@lumx/react 4.11.0 → 4.12.0-next.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 +11 -9
- package/index.js +109 -48
- package/index.js.map +1 -1
- package/package.json +5 -4
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _lumx_core_js_types from '@lumx/core/js/types';
|
|
|
4
4
|
import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1 } from '@lumx/core/js/types';
|
|
5
5
|
export * from '@lumx/core/js/types';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
|
-
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes
|
|
7
|
+
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes } from 'react';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
/** LumX Component Type. */
|
|
@@ -2331,7 +2331,6 @@ interface DialogProps extends GenericProps$1, HasCloseMode$1, BaseDialogProps {
|
|
|
2331
2331
|
/** Children */
|
|
2332
2332
|
children?: React__default.ReactNode;
|
|
2333
2333
|
}
|
|
2334
|
-
|
|
2335
2334
|
/**
|
|
2336
2335
|
* Dialog component.
|
|
2337
2336
|
*
|
|
@@ -3280,22 +3279,25 @@ interface InputLabelProps extends ReactToJSX<InputLabelProps$1>, GenericProps$1
|
|
|
3280
3279
|
*/
|
|
3281
3280
|
declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
|
|
3282
3281
|
|
|
3282
|
+
interface BaseLightboxProps extends HasClassName, HasTheme, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'> {
|
|
3283
|
+
/** Whether the component is open or not. */
|
|
3284
|
+
isOpen?: boolean;
|
|
3285
|
+
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
3286
|
+
preventAutoClose?: boolean;
|
|
3287
|
+
/** Z-axis position. */
|
|
3288
|
+
zIndex?: number;
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3283
3291
|
/**
|
|
3284
3292
|
* Defines the props of the component.
|
|
3285
3293
|
*/
|
|
3286
|
-
interface LightboxProps extends GenericProps$1,
|
|
3294
|
+
interface LightboxProps extends GenericProps$1, ReactToJSX<BaseLightboxProps> {
|
|
3287
3295
|
/** Props to pass to the close button (minus those already set by the Lightbox props). */
|
|
3288
3296
|
closeButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
3289
|
-
/** Whether the component is open or not. */
|
|
3290
|
-
isOpen?: boolean;
|
|
3291
3297
|
/** Reference to the element that triggered modal opening to set focus on. */
|
|
3292
3298
|
parentElement: RefObject<any>;
|
|
3293
3299
|
/** 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. */
|
|
3294
3300
|
focusElement?: RefObject<HTMLElement>;
|
|
3295
|
-
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
3296
|
-
preventAutoClose?: boolean;
|
|
3297
|
-
/** Z-axis position. */
|
|
3298
|
-
zIndex?: number;
|
|
3299
3301
|
/** On close callback. */
|
|
3300
3302
|
onClose?(): void;
|
|
3301
3303
|
/** Children */
|
package/index.js
CHANGED
|
@@ -13966,7 +13966,7 @@ const CLASSNAME$G = 'lumx-lightbox';
|
|
|
13966
13966
|
const {
|
|
13967
13967
|
block: block$z,
|
|
13968
13968
|
element: element$r
|
|
13969
|
-
} =
|
|
13969
|
+
} = bem(CLASSNAME$G);
|
|
13970
13970
|
|
|
13971
13971
|
/**
|
|
13972
13972
|
* Lightbox component.
|
|
@@ -13975,12 +13975,97 @@ const {
|
|
|
13975
13975
|
* @param ref Component ref.
|
|
13976
13976
|
* @return React element.
|
|
13977
13977
|
*/
|
|
13978
|
-
const Lightbox =
|
|
13978
|
+
const Lightbox$1 = props => {
|
|
13979
13979
|
const {
|
|
13980
13980
|
'aria-labelledby': propAriaLabelledBy,
|
|
13981
13981
|
ariaLabelledBy = propAriaLabelledBy,
|
|
13982
13982
|
'aria-label': propAriaLabel,
|
|
13983
13983
|
ariaLabel = propAriaLabel,
|
|
13984
|
+
children,
|
|
13985
|
+
className,
|
|
13986
|
+
closeButtonProps,
|
|
13987
|
+
isOpen,
|
|
13988
|
+
handleClose,
|
|
13989
|
+
parentElement,
|
|
13990
|
+
focusElement,
|
|
13991
|
+
preventAutoClose,
|
|
13992
|
+
theme,
|
|
13993
|
+
zIndex,
|
|
13994
|
+
isVisible,
|
|
13995
|
+
ref,
|
|
13996
|
+
Portal,
|
|
13997
|
+
HeadingLevelProvider,
|
|
13998
|
+
ThemeProvider,
|
|
13999
|
+
ClickAwayProvider,
|
|
14000
|
+
childrenRef,
|
|
14001
|
+
clickAwayRefs,
|
|
14002
|
+
closeButtonRef,
|
|
14003
|
+
IconButton,
|
|
14004
|
+
...forwardedProps
|
|
14005
|
+
} = props;
|
|
14006
|
+
if (!isOpen && !isVisible) return null;
|
|
14007
|
+
return /*#__PURE__*/jsx(Portal, {
|
|
14008
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
14009
|
+
ref: ref,
|
|
14010
|
+
...forwardedProps,
|
|
14011
|
+
"aria-label": ariaLabel,
|
|
14012
|
+
"aria-labelledby": ariaLabelledBy,
|
|
14013
|
+
"aria-modal": "true",
|
|
14014
|
+
role: "dialog",
|
|
14015
|
+
tabIndex: -1,
|
|
14016
|
+
className: classnames(className, block$z({
|
|
14017
|
+
'is-hidden': !isOpen,
|
|
14018
|
+
'is-shown': isOpen || isVisible,
|
|
14019
|
+
[`theme-${theme}`]: Boolean(theme)
|
|
14020
|
+
})),
|
|
14021
|
+
style: {
|
|
14022
|
+
zIndex
|
|
14023
|
+
},
|
|
14024
|
+
children: [closeButtonProps && /*#__PURE__*/jsx("div", {
|
|
14025
|
+
className: element$r('close'),
|
|
14026
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
14027
|
+
...closeButtonProps,
|
|
14028
|
+
ref: closeButtonRef,
|
|
14029
|
+
emphasis: "low",
|
|
14030
|
+
hasBackground: true,
|
|
14031
|
+
icon: mdiClose,
|
|
14032
|
+
theme: "dark",
|
|
14033
|
+
type: "button",
|
|
14034
|
+
onClick: handleClose
|
|
14035
|
+
})
|
|
14036
|
+
}), /*#__PURE__*/jsx(HeadingLevelProvider, {
|
|
14037
|
+
level: 2,
|
|
14038
|
+
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
14039
|
+
value: undefined,
|
|
14040
|
+
children: /*#__PURE__*/jsx(ClickAwayProvider, {
|
|
14041
|
+
callback: !preventAutoClose && handleClose,
|
|
14042
|
+
childrenRefs: clickAwayRefs,
|
|
14043
|
+
children: /*#__PURE__*/jsx("div", {
|
|
14044
|
+
ref: childrenRef,
|
|
14045
|
+
className: element$r('wrapper'),
|
|
14046
|
+
role: "presentation",
|
|
14047
|
+
children: children
|
|
14048
|
+
})
|
|
14049
|
+
})
|
|
14050
|
+
})
|
|
14051
|
+
})]
|
|
14052
|
+
})
|
|
14053
|
+
});
|
|
14054
|
+
};
|
|
14055
|
+
|
|
14056
|
+
/**
|
|
14057
|
+
* Defines the props of the component.
|
|
14058
|
+
*/
|
|
14059
|
+
|
|
14060
|
+
/**
|
|
14061
|
+
* Lightbox component.
|
|
14062
|
+
*
|
|
14063
|
+
* @param props Component props.
|
|
14064
|
+
* @param ref Component ref.
|
|
14065
|
+
* @return React element.
|
|
14066
|
+
*/
|
|
14067
|
+
const Lightbox = forwardRef((props, ref) => {
|
|
14068
|
+
const {
|
|
13984
14069
|
children,
|
|
13985
14070
|
className,
|
|
13986
14071
|
closeButtonProps,
|
|
@@ -14041,52 +14126,28 @@ const Lightbox = forwardRef((props, ref) => {
|
|
|
14041
14126
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14042
14127
|
const clickAwayRefs = useRef([wrapperRef]);
|
|
14043
14128
|
if (!isOpen && !isVisible) return null;
|
|
14044
|
-
return
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
emphasis: "low",
|
|
14067
|
-
hasBackground: true,
|
|
14068
|
-
icon: mdiClose,
|
|
14069
|
-
theme: "dark",
|
|
14070
|
-
type: "button",
|
|
14071
|
-
onClick: onClose
|
|
14072
|
-
})
|
|
14073
|
-
}), /*#__PURE__*/jsx(HeadingLevelProvider, {
|
|
14074
|
-
level: 2,
|
|
14075
|
-
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
14076
|
-
value: undefined,
|
|
14077
|
-
children: /*#__PURE__*/jsx(ClickAwayProvider, {
|
|
14078
|
-
callback: !preventAutoClose && onClose,
|
|
14079
|
-
childrenRefs: clickAwayRefs,
|
|
14080
|
-
children: /*#__PURE__*/jsx("div", {
|
|
14081
|
-
ref: childrenRef,
|
|
14082
|
-
className: element$r('wrapper'),
|
|
14083
|
-
role: "presentation",
|
|
14084
|
-
children: children
|
|
14085
|
-
})
|
|
14086
|
-
})
|
|
14087
|
-
})
|
|
14088
|
-
})]
|
|
14089
|
-
})
|
|
14129
|
+
return Lightbox$1({
|
|
14130
|
+
ClickAwayProvider,
|
|
14131
|
+
HeadingLevelProvider,
|
|
14132
|
+
IconButton,
|
|
14133
|
+
parentElement,
|
|
14134
|
+
Portal,
|
|
14135
|
+
ThemeProvider,
|
|
14136
|
+
children,
|
|
14137
|
+
childrenRef,
|
|
14138
|
+
className,
|
|
14139
|
+
clickAwayRefs,
|
|
14140
|
+
closeButtonProps,
|
|
14141
|
+
closeButtonRef,
|
|
14142
|
+
focusElement,
|
|
14143
|
+
isOpen,
|
|
14144
|
+
isVisible,
|
|
14145
|
+
ref: mergeRefs(ref, wrapperRef),
|
|
14146
|
+
theme,
|
|
14147
|
+
zIndex,
|
|
14148
|
+
preventAutoClose,
|
|
14149
|
+
handleClose: onClose,
|
|
14150
|
+
...forwardedProps
|
|
14090
14151
|
});
|
|
14091
14152
|
});
|
|
14092
14153
|
Lightbox.displayName = COMPONENT_NAME$F;
|