@lumx/react 3.20.1-alpha.36 → 3.20.1-alpha.37
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.js +13990 -64
- package/index.js.map +1 -0
- package/package.json +3 -3
- package/utils/index.js +159 -3
- package/utils/index.js.map +1 -0
- package/_internal/035c132d.js +0 -314
- package/_internal/0b9c76cb.js +0 -5
- package/_internal/0ea95af1.js +0 -819
- package/_internal/230173a8.js +0 -12
- package/_internal/2a3d237c.js +0 -11
- package/_internal/2c2b6a89.js +0 -51
- package/_internal/3181f000.js +0 -13
- package/_internal/36bd7352.js +0 -218
- package/_internal/3864a6c1.js +0 -436
- package/_internal/3a1facc0.js +0 -17
- package/_internal/49bbeed3.js +0 -5
- package/_internal/4daccdd5.js +0 -24
- package/_internal/4f4c0582.js +0 -2169
- package/_internal/5cef5e8c.js +0 -74
- package/_internal/6a60381c.js +0 -117
- package/_internal/6f084a40.js +0 -111
- package/_internal/76ddefd4.js +0 -61
- package/_internal/78df9309.js +0 -19
- package/_internal/7ad474e4.js +0 -98
- package/_internal/7b293665.js +0 -19
- package/_internal/7daf0f24.js +0 -76
- package/_internal/825ac334.js +0 -129
- package/_internal/827b804a.js +0 -5
- package/_internal/8bce732e.js +0 -8
- package/_internal/9d1336a1.js +0 -18
- package/_internal/a38bdcd0.js +0 -49
- package/_internal/b326655a.js +0 -682
- package/_internal/b83e864b.js +0 -76
- package/_internal/bace1bf1.js +0 -103
- package/_internal/c57190eb.js +0 -146
- package/_internal/components/alert-dialog/index-284fed80.js +0 -163
- package/_internal/components/autocomplete/__mockData__/index-96fc7ea7.js +0 -27
- package/_internal/components/autocomplete/index-27a49d5d.js +0 -261
- package/_internal/components/avatar/index-b8bc3cae.js +0 -83
- package/_internal/components/badge/index-9880f056.js +0 -81
- package/_internal/components/button/index-d919f96d.js +0 -47
- package/_internal/components/checkbox/index-dd478de9.js +0 -143
- package/_internal/components/chip/index-7f84cdbd.js +0 -102
- package/_internal/components/comment-block/index-e942de30.js +0 -138
- package/_internal/components/date-picker/index-a258d3ce.js +0 -596
- package/_internal/components/dialog/index-c7066813.js +0 -238
- package/_internal/components/divider/index-b6934baf.js +0 -50
- package/_internal/components/drag-handle/index-80e5af6c.js +0 -52
- package/_internal/components/dropdown/index-cebfc268.js +0 -147
- package/_internal/components/expansion-panel/index-9d45a211.js +0 -167
- package/_internal/components/flag/index-33e9d909.js +0 -59
- package/_internal/components/flex-box/index-0d6b6b43.js +0 -56
- package/_internal/components/generic-block/index-836c4352.js +0 -124
- package/_internal/components/grid/index-8c16a4f1.js +0 -104
- package/_internal/components/grid-column/index-4a2f56bb.js +0 -59
- package/_internal/components/heading/index-fd558a9a.js +0 -53
- package/_internal/components/icon/index-e7b9b40e.js +0 -1
- package/_internal/components/image-block/index-7021c2f1.js +0 -110
- package/_internal/components/image-lightbox/index-27017547.js +0 -759
- package/_internal/components/inline-list/index-52efec7f.js +0 -74
- package/_internal/components/input-helper/index-5a837e7c.js +0 -71
- package/_internal/components/input-label/index-0113f382.js +0 -59
- package/_internal/components/lightbox/index-fad5a9f2.js +0 -155
- package/_internal/components/link/index-008bae4b.js +0 -72
- package/_internal/components/link-preview/index-3e9c32f2.js +0 -117
- package/_internal/components/list/index-da88c6e9.js +0 -71
- package/_internal/components/message/index-17b568f2.js +0 -98
- package/_internal/components/mosaic/index-2d40e01c.js +0 -95
- package/_internal/components/navigation/index-dc17c639.js +0 -225
- package/_internal/components/notification/index-a1101015.js +0 -146
- package/_internal/components/popover/index-dbca63f1.js +0 -2
- package/_internal/components/popover-dialog/index-654d2abc.js +0 -66
- package/_internal/components/post-block/index-4b6b4dcb.js +0 -109
- package/_internal/components/progress/index-6f578c31.js +0 -182
- package/_internal/components/progress-tracker/index-700bc4c2.js +0 -309
- package/_internal/components/radio-button/index-89b725af.js +0 -149
- package/_internal/components/select/index-2755aa32.js +0 -458
- package/_internal/components/side-navigation/index-0bbe1fdd.js +0 -165
- package/_internal/components/skeleton/index-b2f8501c.js +0 -166
- package/_internal/components/slider/index-4f9b891b.js +0 -311
- package/_internal/components/slideshow/index-d4604589.js +0 -150
- package/_internal/components/switch/index-58fe0f0c.js +0 -122
- package/_internal/components/table/index-d541aa88.js +0 -297
- package/_internal/components/tabs/index-af1538d6.js +0 -298
- package/_internal/components/text/index-5bfc6d5e.js +0 -1
- package/_internal/components/text-field/index-47c98d09.js +0 -360
- package/_internal/components/thumbnail/index-71545d95.js +0 -41
- package/_internal/components/toolbar/index-7041a5a6.js +0 -61
- package/_internal/components/tooltip/index-8bb97e60.js +0 -327
- package/_internal/components/uploader/index-8f6f55de.js +0 -153
- package/_internal/components/user-block/index-70d4ce8f.js +0 -145
- package/_internal/d0e3f49e.js +0 -23
- package/_internal/de24f857.js +0 -3
- package/_internal/e806b848.js +0 -8
- package/_internal/e913a3af.js +0 -117
- package/_internal/ea04260d.js +0 -28
- package/_internal/eaf6c45a.js +0 -3
- package/_internal/ebdcb0c7.js +0 -60
- package/_internal/ef5d1aac.js +0 -3
- package/_internal/f0d7d6ea.js +0 -29
- package/_internal/utils/ClickAwayProvider/index-1234ce76.js +0 -94
- package/_internal/utils/MaterialThemeSwitcher/index-8d22de5a.js +0 -48
- package/_internal/utils/Portal/index-6e0a7404.js +0 -44
- package/_internal/utils/disabled/index-075b99c3.js +0 -36
- package/_internal/utils/type/index-ea9fc197.js +0 -2
package/_internal/b83e864b.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { B as ButtonRoot } from './6a60381c.js';
|
|
2
|
-
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
3
|
-
import { u as useTheme, T as ThemeProvider } from './3181f000.js';
|
|
4
|
-
import { f as forwardRef } from './8bce732e.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import { Tooltip } from './components/tooltip/index-8bb97e60.js';
|
|
7
|
-
import { Emphasis, Size, Theme } from '@lumx/core/js/constants';
|
|
8
|
-
import { I as Icon } from './bace1bf1.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Component display name.
|
|
12
|
-
*/
|
|
13
|
-
const COMPONENT_NAME = 'IconButton';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Component default class name and class prefix.
|
|
17
|
-
*/
|
|
18
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Component default props.
|
|
22
|
-
*/
|
|
23
|
-
const DEFAULT_PROPS = {
|
|
24
|
-
emphasis: Emphasis.high,
|
|
25
|
-
size: Size.m
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* IconButton component.
|
|
30
|
-
*
|
|
31
|
-
* @param props Component props.
|
|
32
|
-
* @param ref Component ref.
|
|
33
|
-
* @return React element.
|
|
34
|
-
*/
|
|
35
|
-
const IconButton = forwardRef((props, ref) => {
|
|
36
|
-
const defaultTheme = useTheme() || Theme.light;
|
|
37
|
-
const {
|
|
38
|
-
emphasis = DEFAULT_PROPS.emphasis,
|
|
39
|
-
image,
|
|
40
|
-
icon,
|
|
41
|
-
label,
|
|
42
|
-
size = DEFAULT_PROPS.size,
|
|
43
|
-
theme = defaultTheme,
|
|
44
|
-
tooltipProps,
|
|
45
|
-
hideTooltip,
|
|
46
|
-
...forwardedProps
|
|
47
|
-
} = props;
|
|
48
|
-
return /*#__PURE__*/jsx(Tooltip, {
|
|
49
|
-
label: hideTooltip ? '' : label,
|
|
50
|
-
...tooltipProps,
|
|
51
|
-
children: /*#__PURE__*/jsx(ButtonRoot, {
|
|
52
|
-
ref: ref,
|
|
53
|
-
emphasis,
|
|
54
|
-
size,
|
|
55
|
-
theme,
|
|
56
|
-
...forwardedProps,
|
|
57
|
-
"aria-label": label,
|
|
58
|
-
variant: "icon",
|
|
59
|
-
children: image ? /*#__PURE__*/jsx("img", {
|
|
60
|
-
// no need to set alt as an aria-label is already set on the button
|
|
61
|
-
alt: "",
|
|
62
|
-
src: image
|
|
63
|
-
}) : /*#__PURE__*/jsx(ThemeProvider, {
|
|
64
|
-
value: undefined,
|
|
65
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
66
|
-
icon: icon
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
IconButton.displayName = COMPONENT_NAME;
|
|
73
|
-
IconButton.className = CLASSNAME;
|
|
74
|
-
IconButton.defaultProps = DEFAULT_PROPS;
|
|
75
|
-
|
|
76
|
-
export { IconButton as I };
|
package/_internal/bace1bf1.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { getRootClassName, resolveColorWithVariants, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
|
-
import { f as forwardRef } from './8bce732e.js';
|
|
4
|
-
import { u as useTheme } from './3181f000.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
|
|
7
|
-
|
|
8
|
-
const mdiAlertCircle = 'M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Component display name.
|
|
12
|
-
*/
|
|
13
|
-
const COMPONENT_NAME = 'Icon';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Component default class name and class prefix.
|
|
17
|
-
*/
|
|
18
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Component default props.
|
|
22
|
-
*/
|
|
23
|
-
const DEFAULT_PROPS = {};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Icon component.
|
|
27
|
-
*
|
|
28
|
-
* @param props Component props.
|
|
29
|
-
* @param ref Component ref.
|
|
30
|
-
* @return React element.
|
|
31
|
-
*/
|
|
32
|
-
const Icon = forwardRef((props, ref) => {
|
|
33
|
-
const defaultTheme = useTheme();
|
|
34
|
-
const {
|
|
35
|
-
className,
|
|
36
|
-
color: propColor,
|
|
37
|
-
colorVariant: propColorVariant,
|
|
38
|
-
hasShape,
|
|
39
|
-
icon,
|
|
40
|
-
size,
|
|
41
|
-
theme = defaultTheme,
|
|
42
|
-
alt,
|
|
43
|
-
...forwardedProps
|
|
44
|
-
} = props;
|
|
45
|
-
const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);
|
|
46
|
-
|
|
47
|
-
// Color
|
|
48
|
-
let iconColor = color;
|
|
49
|
-
if (!iconColor && (hasShape || theme)) {
|
|
50
|
-
iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Color variant
|
|
54
|
-
let iconColorVariant = colorVariant;
|
|
55
|
-
if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {
|
|
56
|
-
iconColorVariant = 'L2';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Size
|
|
60
|
-
let iconSize = size;
|
|
61
|
-
if (size && hasShape) {
|
|
62
|
-
if (size === Size.xxs || size === Size.xs) {
|
|
63
|
-
iconSize = Size.s;
|
|
64
|
-
} else if (size === Size.xxl) {
|
|
65
|
-
iconSize = Size.xl;
|
|
66
|
-
}
|
|
67
|
-
} else if (hasShape) {
|
|
68
|
-
iconSize = Size.m;
|
|
69
|
-
}
|
|
70
|
-
return /*#__PURE__*/jsx("i", {
|
|
71
|
-
ref: ref,
|
|
72
|
-
...forwardedProps,
|
|
73
|
-
className: classNames(className, handleBasicClasses({
|
|
74
|
-
color: iconColor,
|
|
75
|
-
colorVariant: iconColorVariant,
|
|
76
|
-
hasShape,
|
|
77
|
-
prefix: CLASSNAME,
|
|
78
|
-
theme,
|
|
79
|
-
size: iconSize
|
|
80
|
-
}), !hasShape && `${CLASSNAME}--no-shape`, !hasShape && iconColor === ColorPalette.yellow && icon === mdiAlertCircle && `${CLASSNAME}--has-dark-layer`, `${CLASSNAME}--path`),
|
|
81
|
-
children: /*#__PURE__*/jsx("svg", {
|
|
82
|
-
"aria-hidden": alt ? undefined : 'true',
|
|
83
|
-
role: alt ? 'img' : undefined,
|
|
84
|
-
"aria-label": alt,
|
|
85
|
-
height: "1em",
|
|
86
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
87
|
-
style: {
|
|
88
|
-
verticalAlign: '-0.125em'
|
|
89
|
-
},
|
|
90
|
-
viewBox: "0 0 24 24",
|
|
91
|
-
width: "1em",
|
|
92
|
-
children: /*#__PURE__*/jsx("path", {
|
|
93
|
-
d: icon,
|
|
94
|
-
fill: "currentColor"
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
Icon.displayName = COMPONENT_NAME;
|
|
100
|
-
Icon.className = CLASSNAME;
|
|
101
|
-
Icon.defaultProps = DEFAULT_PROPS;
|
|
102
|
-
|
|
103
|
-
export { Icon as I, mdiAlertCircle as m };
|
package/_internal/c57190eb.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import isFunction from 'lodash/isFunction';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
5
|
-
import { onEnterPressed } from '@lumx/core/js/utils';
|
|
6
|
-
import { f as forwardRef } from './8bce732e.js';
|
|
7
|
-
import { u as useTheme } from './3181f000.js';
|
|
8
|
-
import { useDisableStateProps } from './utils/disabled/index-075b99c3.js';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
import { Size, Theme, ColorPalette } from '@lumx/core/js/constants';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Wrap mouse event handler to stop event propagation.
|
|
14
|
-
*
|
|
15
|
-
* @param handler The mouse handler to wrap.
|
|
16
|
-
* @return Mouse handler stopping propagation.
|
|
17
|
-
*/
|
|
18
|
-
function useStopPropagation(handler) {
|
|
19
|
-
return useCallback(evt => {
|
|
20
|
-
if (!evt || !isFunction(handler)) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
handler(evt);
|
|
24
|
-
evt.stopPropagation();
|
|
25
|
-
}, [handler]);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Component display name.
|
|
30
|
-
*/
|
|
31
|
-
const COMPONENT_NAME = 'Chip';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Component default class name and class prefix.
|
|
35
|
-
*/
|
|
36
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Component default props.
|
|
40
|
-
*/
|
|
41
|
-
const DEFAULT_PROPS = {
|
|
42
|
-
size: Size.m
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Chip component.
|
|
47
|
-
*
|
|
48
|
-
* @param props Component props.
|
|
49
|
-
* @param ref Component ref.
|
|
50
|
-
* @return React element.
|
|
51
|
-
*/
|
|
52
|
-
const Chip = forwardRef((props, ref) => {
|
|
53
|
-
const defaultTheme = useTheme() || Theme.light;
|
|
54
|
-
const {
|
|
55
|
-
isAnyDisabled,
|
|
56
|
-
disabledStateProps,
|
|
57
|
-
otherProps
|
|
58
|
-
} = useDisableStateProps(props);
|
|
59
|
-
const {
|
|
60
|
-
after,
|
|
61
|
-
before,
|
|
62
|
-
children,
|
|
63
|
-
className,
|
|
64
|
-
color,
|
|
65
|
-
isClickable: propIsClickable,
|
|
66
|
-
isHighlighted,
|
|
67
|
-
isSelected,
|
|
68
|
-
onAfterClick,
|
|
69
|
-
onBeforeClick,
|
|
70
|
-
onClick,
|
|
71
|
-
size = DEFAULT_PROPS.size,
|
|
72
|
-
theme = defaultTheme,
|
|
73
|
-
href,
|
|
74
|
-
onKeyDown,
|
|
75
|
-
...forwardedProps
|
|
76
|
-
} = otherProps;
|
|
77
|
-
const hasAfterClick = isFunction(onAfterClick);
|
|
78
|
-
const hasBeforeClick = isFunction(onBeforeClick);
|
|
79
|
-
const hasOnClick = isFunction(props.onClick);
|
|
80
|
-
const isButton = hasOnClick && !href;
|
|
81
|
-
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
82
|
-
|
|
83
|
-
// Adapt color to the theme.
|
|
84
|
-
const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
85
|
-
const handleOnBeforeClick = useStopPropagation(onBeforeClick);
|
|
86
|
-
const handleOnAfterClick = useStopPropagation(onAfterClick);
|
|
87
|
-
const handleKeyDown = evt => {
|
|
88
|
-
onKeyDown?.(evt);
|
|
89
|
-
if (hasOnClick) {
|
|
90
|
-
onEnterPressed(onClick)(evt);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
return (
|
|
94
|
-
/*#__PURE__*/
|
|
95
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
96
|
-
jsxs("a", {
|
|
97
|
-
role: isButton ? 'button' : undefined,
|
|
98
|
-
tabIndex: isClickable && !disabledStateProps.disabled ? 0 : undefined,
|
|
99
|
-
...forwardedProps,
|
|
100
|
-
href: !disabledStateProps.disabled ? href : undefined,
|
|
101
|
-
ref: ref,
|
|
102
|
-
className: classNames(className, handleBasicClasses({
|
|
103
|
-
clickable: isClickable,
|
|
104
|
-
color: chipColor,
|
|
105
|
-
isDisabled: isAnyDisabled,
|
|
106
|
-
hasAfter: Boolean(after),
|
|
107
|
-
hasBefore: Boolean(before),
|
|
108
|
-
highlighted: Boolean(isHighlighted),
|
|
109
|
-
prefix: CLASSNAME,
|
|
110
|
-
selected: Boolean(isSelected),
|
|
111
|
-
size,
|
|
112
|
-
unselected: Boolean(!isSelected)
|
|
113
|
-
})),
|
|
114
|
-
"aria-disabled": isClickable && isAnyDisabled || undefined,
|
|
115
|
-
onClick: hasOnClick ? onClick : undefined,
|
|
116
|
-
onKeyDown: handleKeyDown,
|
|
117
|
-
children: [before &&
|
|
118
|
-
/*#__PURE__*/
|
|
119
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
120
|
-
jsx("div", {
|
|
121
|
-
className: classNames(`${CLASSNAME}__before`, {
|
|
122
|
-
[`${CLASSNAME}__before--is-clickable`]: hasBeforeClick
|
|
123
|
-
}),
|
|
124
|
-
onClick: handleOnBeforeClick,
|
|
125
|
-
children: before
|
|
126
|
-
}), /*#__PURE__*/jsx("div", {
|
|
127
|
-
className: `${CLASSNAME}__label`,
|
|
128
|
-
children: children
|
|
129
|
-
}), after &&
|
|
130
|
-
/*#__PURE__*/
|
|
131
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
132
|
-
jsx("div", {
|
|
133
|
-
className: classNames(`${CLASSNAME}__after`, {
|
|
134
|
-
[`${CLASSNAME}__after--is-clickable`]: hasAfterClick
|
|
135
|
-
}),
|
|
136
|
-
onClick: handleOnAfterClick,
|
|
137
|
-
children: after
|
|
138
|
-
})]
|
|
139
|
-
})
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
Chip.displayName = COMPONENT_NAME;
|
|
143
|
-
Chip.className = CLASSNAME;
|
|
144
|
-
Chip.defaultProps = DEFAULT_PROPS;
|
|
145
|
-
|
|
146
|
-
export { Chip as C };
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
4
|
-
import { u as useId } from '../../3a1facc0.js';
|
|
5
|
-
import { f as forwardRef } from '../../8bce732e.js';
|
|
6
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import { m as mdiAlert, a as mdiInformation } from '../../49bbeed3.js';
|
|
8
|
-
import { m as mdiCheckCircle } from '../../de24f857.js';
|
|
9
|
-
import { m as mdiAlertCircle, I as Icon } from '../../bace1bf1.js';
|
|
10
|
-
import { Dialog } from '../dialog/index-c7066813.js';
|
|
11
|
-
import { Toolbar } from '../toolbar/index-7041a5a6.js';
|
|
12
|
-
import { a as Button } from '../../7ad474e4.js';
|
|
13
|
-
import { Kind, ColorPalette, Size, Emphasis } from '@lumx/core/js/constants';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Associative map from message kind to color and icon.
|
|
17
|
-
*/
|
|
18
|
-
const CONFIG = {
|
|
19
|
-
[Kind.error]: {
|
|
20
|
-
color: ColorPalette.red,
|
|
21
|
-
icon: mdiAlert
|
|
22
|
-
},
|
|
23
|
-
[Kind.info]: {
|
|
24
|
-
color: ColorPalette.blue,
|
|
25
|
-
icon: mdiInformation
|
|
26
|
-
},
|
|
27
|
-
[Kind.success]: {
|
|
28
|
-
color: ColorPalette.green,
|
|
29
|
-
icon: mdiCheckCircle
|
|
30
|
-
},
|
|
31
|
-
[Kind.warning]: {
|
|
32
|
-
color: ColorPalette.yellow,
|
|
33
|
-
icon: mdiAlertCircle
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Component display name.
|
|
39
|
-
*/
|
|
40
|
-
const COMPONENT_NAME = 'AlertDialog';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Component default class name and class prefix.
|
|
44
|
-
*/
|
|
45
|
-
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Component default props.
|
|
49
|
-
*/
|
|
50
|
-
const DEFAULT_PROPS = {
|
|
51
|
-
size: Size.tiny,
|
|
52
|
-
kind: Kind.info
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* AlertDialog component.
|
|
57
|
-
*
|
|
58
|
-
* An alert dialog is a modal dialog that interrupts the user's workflow to
|
|
59
|
-
* communicate an important message and acquire a response.
|
|
60
|
-
*
|
|
61
|
-
* It should not have a complex content.
|
|
62
|
-
* Children of this component should only be strings, paragraphs or links.
|
|
63
|
-
*/
|
|
64
|
-
const AlertDialog = forwardRef((props, ref) => {
|
|
65
|
-
const {
|
|
66
|
-
id,
|
|
67
|
-
title,
|
|
68
|
-
className,
|
|
69
|
-
cancelProps,
|
|
70
|
-
confirmProps,
|
|
71
|
-
kind = DEFAULT_PROPS.kind,
|
|
72
|
-
size = DEFAULT_PROPS.size,
|
|
73
|
-
dialogProps,
|
|
74
|
-
children,
|
|
75
|
-
...forwardedProps
|
|
76
|
-
} = props;
|
|
77
|
-
const cancelButtonRef = React__default.useRef(null);
|
|
78
|
-
const confirmationButtonRef = React__default.useRef(null);
|
|
79
|
-
const {
|
|
80
|
-
color,
|
|
81
|
-
icon
|
|
82
|
-
} = CONFIG[kind] || {};
|
|
83
|
-
|
|
84
|
-
// Define a unique ID to target title and description for aria attributes.
|
|
85
|
-
const generatedId = useId();
|
|
86
|
-
const uniqueId = id || generatedId;
|
|
87
|
-
const titleId = `${uniqueId}-title`;
|
|
88
|
-
const descriptionId = `${uniqueId}-description`;
|
|
89
|
-
|
|
90
|
-
// If content is a string, set in a paragraph.
|
|
91
|
-
const DescriptionElement = typeof children === 'string' ? 'p' : 'div';
|
|
92
|
-
const {
|
|
93
|
-
label: confirmLabel,
|
|
94
|
-
onClick: confirmOnClick,
|
|
95
|
-
...forwardedConfirmProps
|
|
96
|
-
} = confirmProps;
|
|
97
|
-
const {
|
|
98
|
-
label: cancelLabel,
|
|
99
|
-
onClick: cancelOnClick,
|
|
100
|
-
...forwardedCancelProps
|
|
101
|
-
} = cancelProps || {};
|
|
102
|
-
return /*#__PURE__*/jsxs(Dialog, {
|
|
103
|
-
ref: ref,
|
|
104
|
-
focusElement: cancelProps ? cancelButtonRef : confirmationButtonRef,
|
|
105
|
-
size: size,
|
|
106
|
-
dialogProps: {
|
|
107
|
-
id: uniqueId,
|
|
108
|
-
role: 'alertdialog',
|
|
109
|
-
'aria-labelledby': titleId,
|
|
110
|
-
'aria-describedby': descriptionId,
|
|
111
|
-
...dialogProps
|
|
112
|
-
},
|
|
113
|
-
className: classNames(className, handleBasicClasses({
|
|
114
|
-
kind,
|
|
115
|
-
prefix: CLASSNAME
|
|
116
|
-
})),
|
|
117
|
-
...forwardedProps,
|
|
118
|
-
children: [/*#__PURE__*/jsx("header", {
|
|
119
|
-
children: /*#__PURE__*/jsx(Toolbar, {
|
|
120
|
-
className: "lumx-spacing-margin-horizontal",
|
|
121
|
-
before: /*#__PURE__*/jsx(Icon, {
|
|
122
|
-
icon: icon,
|
|
123
|
-
size: Size.s,
|
|
124
|
-
color: color
|
|
125
|
-
}),
|
|
126
|
-
label: /*#__PURE__*/jsx("h2", {
|
|
127
|
-
id: titleId,
|
|
128
|
-
className: "lumx-typography-title",
|
|
129
|
-
children: title
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
}), children && /*#__PURE__*/jsx(DescriptionElement, {
|
|
133
|
-
id: descriptionId,
|
|
134
|
-
className: "lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge",
|
|
135
|
-
children: children
|
|
136
|
-
}), /*#__PURE__*/jsx("footer", {
|
|
137
|
-
children: /*#__PURE__*/jsx(Toolbar, {
|
|
138
|
-
className: "lumx-spacing-margin-horizontal",
|
|
139
|
-
after: /*#__PURE__*/jsxs(Fragment, {
|
|
140
|
-
children: [cancelProps && /*#__PURE__*/jsx(Button, {
|
|
141
|
-
...forwardedCancelProps,
|
|
142
|
-
ref: cancelButtonRef,
|
|
143
|
-
emphasis: Emphasis.medium,
|
|
144
|
-
onClick: cancelOnClick,
|
|
145
|
-
children: cancelLabel
|
|
146
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
147
|
-
...forwardedConfirmProps,
|
|
148
|
-
ref: confirmationButtonRef,
|
|
149
|
-
color: color,
|
|
150
|
-
className: "lumx-spacing-margin-left-regular",
|
|
151
|
-
onClick: confirmOnClick,
|
|
152
|
-
children: confirmLabel
|
|
153
|
-
})]
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
})]
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
AlertDialog.displayName = COMPONENT_NAME;
|
|
160
|
-
AlertDialog.className = CLASSNAME;
|
|
161
|
-
AlertDialog.defaultProps = DEFAULT_PROPS;
|
|
162
|
-
|
|
163
|
-
export { AlertDialog };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const CITIES = [{
|
|
2
|
-
text: 'Los Angeles',
|
|
3
|
-
id: 'losangeles'
|
|
4
|
-
}, {
|
|
5
|
-
text: 'San Francisco',
|
|
6
|
-
id: 'sanfrancisco'
|
|
7
|
-
}, {
|
|
8
|
-
text: 'Paris',
|
|
9
|
-
id: 'paris'
|
|
10
|
-
}, {
|
|
11
|
-
text: 'Montpellier',
|
|
12
|
-
id: 'montpellier'
|
|
13
|
-
}, {
|
|
14
|
-
text: 'Bordeaux',
|
|
15
|
-
id: 'bordeaux'
|
|
16
|
-
}, {
|
|
17
|
-
text: 'Toulouse',
|
|
18
|
-
id: 'toulouse'
|
|
19
|
-
}, {
|
|
20
|
-
text: 'Lyon',
|
|
21
|
-
id: 'lyon'
|
|
22
|
-
}, {
|
|
23
|
-
text: 'Montevideo',
|
|
24
|
-
id: 'montevideo'
|
|
25
|
-
}];
|
|
26
|
-
|
|
27
|
-
export { CITIES };
|