@lumx/react 3.6.1-alpha-chore-dependency-updates.0 → 3.6.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +18 -2
- package/index.js +17 -4
- package/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/lightbox/Lightbox.stories.tsx +61 -5
- package/src/components/lightbox/Lightbox.tsx +21 -4
- package/src/components/navigation/NavigationItem.tsx +2 -2
- package/src/components/uploader/Uploader.test.tsx +1 -1
- package/src/stories/controls/image.ts +6 -0
- package/src/utils/forwardRefPolymorphic.ts +2 -2
package/index.d.ts
CHANGED
|
@@ -1422,13 +1422,15 @@ declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
|
|
|
1422
1422
|
/**
|
|
1423
1423
|
* Defines the props of the component.
|
|
1424
1424
|
*/
|
|
1425
|
-
interface LightboxProps extends GenericProps, HasTheme {
|
|
1425
|
+
interface LightboxProps extends GenericProps, HasTheme, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'> {
|
|
1426
1426
|
/** Props to pass to the close button (minus those already set by the Lightbox props). */
|
|
1427
1427
|
closeButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
1428
1428
|
/** Whether the component is open or not. */
|
|
1429
1429
|
isOpen?: boolean;
|
|
1430
1430
|
/** Reference to the element that triggered modal opening to set focus on. */
|
|
1431
1431
|
parentElement: RefObject<any>;
|
|
1432
|
+
/** Reference to the element that should get the focus when the lightbox opens. By default, the close button or the lightbox itself will take focus. */
|
|
1433
|
+
focusElement?: RefObject<HTMLElement>;
|
|
1432
1434
|
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
1433
1435
|
preventAutoClose?: boolean;
|
|
1434
1436
|
/** Z-axis position. */
|
|
@@ -1676,7 +1678,21 @@ declare type NavigationProps = React.ComponentProps<'nav'> & HasClassName & HasT
|
|
|
1676
1678
|
children?: ReactNode;
|
|
1677
1679
|
orientation?: Orientation;
|
|
1678
1680
|
} & HasAriaLabelOrLabelledBy;
|
|
1679
|
-
declare const Navigation: React.ForwardRefExoticComponent<
|
|
1681
|
+
declare const Navigation: React.ForwardRefExoticComponent<(Omit<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & HasClassName & HasTheme & {
|
|
1682
|
+
/** Content of the navigation. These components should be of type NavigationItem to be rendered */
|
|
1683
|
+
children?: ReactNode;
|
|
1684
|
+
orientation?: Orientation | undefined;
|
|
1685
|
+
} & {
|
|
1686
|
+
'aria-label': string;
|
|
1687
|
+
'aria-labelledby'?: undefined;
|
|
1688
|
+
}, "ref"> | Omit<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & HasClassName & HasTheme & {
|
|
1689
|
+
/** Content of the navigation. These components should be of type NavigationItem to be rendered */
|
|
1690
|
+
children?: ReactNode;
|
|
1691
|
+
orientation?: Orientation | undefined;
|
|
1692
|
+
} & {
|
|
1693
|
+
'aria-labelledby': string;
|
|
1694
|
+
'aria-label'?: undefined;
|
|
1695
|
+
}, "ref">) & React.RefAttributes<HTMLElement>> & {
|
|
1680
1696
|
displayName: string;
|
|
1681
1697
|
className: string;
|
|
1682
1698
|
defaultProps: {
|
package/index.js
CHANGED
|
@@ -7740,7 +7740,7 @@ InputLabel.displayName = COMPONENT_NAME$A;
|
|
|
7740
7740
|
InputLabel.className = CLASSNAME$x;
|
|
7741
7741
|
InputLabel.defaultProps = DEFAULT_PROPS$t;
|
|
7742
7742
|
|
|
7743
|
-
const _excluded$C = ["ariaLabel", "children", "className", "closeButtonProps", "isOpen", "onClose", "parentElement", "preventAutoClose", "theme", "zIndex"];
|
|
7743
|
+
const _excluded$C = ["aria-labelledby", "ariaLabelledBy", "aria-label", "ariaLabel", "children", "className", "closeButtonProps", "isOpen", "onClose", "parentElement", "focusElement", "preventAutoClose", "theme", "zIndex"];
|
|
7744
7744
|
|
|
7745
7745
|
/**
|
|
7746
7746
|
* Defines the props of the component.
|
|
@@ -7764,15 +7764,18 @@ const CLASSNAME$y = getRootClassName(COMPONENT_NAME$B);
|
|
|
7764
7764
|
* @return React element.
|
|
7765
7765
|
*/
|
|
7766
7766
|
const Lightbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
7767
|
-
var _childrenRef$current;
|
|
7768
7767
|
const {
|
|
7769
|
-
|
|
7768
|
+
'aria-labelledby': propAriaLabelledBy,
|
|
7769
|
+
ariaLabelledBy = propAriaLabelledBy,
|
|
7770
|
+
'aria-label': propAriaLabel,
|
|
7771
|
+
ariaLabel = propAriaLabel,
|
|
7770
7772
|
children,
|
|
7771
7773
|
className,
|
|
7772
7774
|
closeButtonProps,
|
|
7773
7775
|
isOpen,
|
|
7774
7776
|
onClose,
|
|
7775
7777
|
parentElement,
|
|
7778
|
+
focusElement,
|
|
7776
7779
|
preventAutoClose,
|
|
7777
7780
|
theme,
|
|
7778
7781
|
zIndex
|
|
@@ -7787,6 +7790,8 @@ const Lightbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7787
7790
|
const childrenRef = useRef(null);
|
|
7788
7791
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7789
7792
|
const wrapperRef = useRef(null);
|
|
7793
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7794
|
+
const closeButtonRef = useRef(null);
|
|
7790
7795
|
|
|
7791
7796
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7792
7797
|
useDisableBodyScroll(isOpen && wrapperRef.current);
|
|
@@ -7796,7 +7801,11 @@ const Lightbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7796
7801
|
|
|
7797
7802
|
// Handle focus trap.
|
|
7798
7803
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7799
|
-
useFocusTrap(
|
|
7804
|
+
useFocusTrap(
|
|
7805
|
+
// Focus trap zone
|
|
7806
|
+
isOpen && wrapperRef.current,
|
|
7807
|
+
// Focus element (fallback on close button and then on the dialog)
|
|
7808
|
+
(focusElement === null || focusElement === void 0 ? void 0 : focusElement.current) || closeButtonRef.current || wrapperRef.current);
|
|
7800
7809
|
|
|
7801
7810
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7802
7811
|
const previousOpen = useRef(isOpen);
|
|
@@ -7827,7 +7836,10 @@ const Lightbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7827
7836
|
ref: mergeRefs(ref, wrapperRef)
|
|
7828
7837
|
}, forwardedProps, {
|
|
7829
7838
|
"aria-label": ariaLabel,
|
|
7839
|
+
"aria-labelledby": ariaLabelledBy,
|
|
7830
7840
|
"aria-modal": "true",
|
|
7841
|
+
role: "dialog",
|
|
7842
|
+
tabIndex: -1,
|
|
7831
7843
|
className: classnames(className, handleBasicClasses({
|
|
7832
7844
|
prefix: CLASSNAME$y,
|
|
7833
7845
|
isHidden: !isOpen,
|
|
@@ -7838,6 +7850,7 @@ const Lightbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7838
7850
|
zIndex
|
|
7839
7851
|
}
|
|
7840
7852
|
}), closeButtonProps && /*#__PURE__*/React.createElement(IconButton, _extends({}, closeButtonProps, {
|
|
7853
|
+
ref: closeButtonRef,
|
|
7841
7854
|
className: `${CLASSNAME$y}__close`,
|
|
7842
7855
|
color: ColorPalette.light,
|
|
7843
7856
|
emphasis: Emphasis.low,
|