Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Lightbox): use logical properties and fix prop forwarding (#2367)

Cindy Zhang9c7e1279179d
diff --git a/packages/core/src/Lightbox/XDSLightbox.tsx b/packages/core/src/Lightbox/XDSLightbox.tsx
index f81aeac0df..4a5f991fd1 100644
--- a/packages/core/src/Lightbox/XDSLightbox.tsx
+++ b/packages/core/src/Lightbox/XDSLightbox.tsx
@@ -183,10 +183,9 @@ const styles = stylex.create({
fontSize: typeScaleVars['--text-large-size'],
lineHeight: typeScaleVars['--text-large-leading'],
textAlign: 'center',
- paddingTop: spacingVars['--spacing-2'],
- paddingBottom: 0,
- paddingLeft: spacingVars['--spacing-3'],
- paddingRight: spacingVars['--spacing-3'],
+ paddingBlockStart: spacingVars['--spacing-2'],
+ paddingBlockEnd: 0,
+ paddingInline: spacingVars['--spacing-3'],
maxWidth: '600px',
flexShrink: 0,
},
@@ -273,6 +272,8 @@ export function XDSLightbox({
className,
style,
ref,
+ onClick: onClickProp,
+ onKeyDown: onKeyDownProp,
...props
}: XDSLightboxProps) {
const dialogRef = useRef<HTMLDialogElement>(null);
@@ -456,8 +457,14 @@ export function XDSLightbox({
<dialog
ref={mergeRefs(ref, dialogRef)}
onCancel={handleCancel}
- onClick={handleBackdropClick}
- onKeyDown={handleKeyDown}
+ onClick={e => {
+ handleBackdropClick(e);
+ onClickProp?.(e);
+ }}
+ onKeyDown={e => {
+ handleKeyDown(e);
+ onKeyDownProp?.(e);
+ }}
aria-label={currentItem.alt || 'Media viewer'}
{...mergeProps(
xdsClassName('lightbox'),
diff --git a/packages/core/src/Lightbox/index.ts b/packages/core/src/Lightbox/index.ts
index d6501df8d5..06a30a969f 100644
--- a/packages/core/src/Lightbox/index.ts
+++ b/packages/core/src/Lightbox/index.ts
@@ -3,7 +3,10 @@
'use client';
/**
- * @file Lightbox component barrel export
+ * @file index.ts
+ * @input Imports XDSLightbox component, useXDSLightbox hook, and types
+ * @output Exports XDSLightbox, useXDSLightbox, and all related types
+ * @position Component entry point; re-exported by /packages/core/src/index.ts
*/
export {XDSLightbox} from './XDSLightbox';