@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.
Files changed (105) hide show
  1. package/index.js +13990 -64
  2. package/index.js.map +1 -0
  3. package/package.json +3 -3
  4. package/utils/index.js +159 -3
  5. package/utils/index.js.map +1 -0
  6. package/_internal/035c132d.js +0 -314
  7. package/_internal/0b9c76cb.js +0 -5
  8. package/_internal/0ea95af1.js +0 -819
  9. package/_internal/230173a8.js +0 -12
  10. package/_internal/2a3d237c.js +0 -11
  11. package/_internal/2c2b6a89.js +0 -51
  12. package/_internal/3181f000.js +0 -13
  13. package/_internal/36bd7352.js +0 -218
  14. package/_internal/3864a6c1.js +0 -436
  15. package/_internal/3a1facc0.js +0 -17
  16. package/_internal/49bbeed3.js +0 -5
  17. package/_internal/4daccdd5.js +0 -24
  18. package/_internal/4f4c0582.js +0 -2169
  19. package/_internal/5cef5e8c.js +0 -74
  20. package/_internal/6a60381c.js +0 -117
  21. package/_internal/6f084a40.js +0 -111
  22. package/_internal/76ddefd4.js +0 -61
  23. package/_internal/78df9309.js +0 -19
  24. package/_internal/7ad474e4.js +0 -98
  25. package/_internal/7b293665.js +0 -19
  26. package/_internal/7daf0f24.js +0 -76
  27. package/_internal/825ac334.js +0 -129
  28. package/_internal/827b804a.js +0 -5
  29. package/_internal/8bce732e.js +0 -8
  30. package/_internal/9d1336a1.js +0 -18
  31. package/_internal/a38bdcd0.js +0 -49
  32. package/_internal/b326655a.js +0 -682
  33. package/_internal/b83e864b.js +0 -76
  34. package/_internal/bace1bf1.js +0 -103
  35. package/_internal/c57190eb.js +0 -146
  36. package/_internal/components/alert-dialog/index-284fed80.js +0 -163
  37. package/_internal/components/autocomplete/__mockData__/index-96fc7ea7.js +0 -27
  38. package/_internal/components/autocomplete/index-27a49d5d.js +0 -261
  39. package/_internal/components/avatar/index-b8bc3cae.js +0 -83
  40. package/_internal/components/badge/index-9880f056.js +0 -81
  41. package/_internal/components/button/index-d919f96d.js +0 -47
  42. package/_internal/components/checkbox/index-dd478de9.js +0 -143
  43. package/_internal/components/chip/index-7f84cdbd.js +0 -102
  44. package/_internal/components/comment-block/index-e942de30.js +0 -138
  45. package/_internal/components/date-picker/index-a258d3ce.js +0 -596
  46. package/_internal/components/dialog/index-c7066813.js +0 -238
  47. package/_internal/components/divider/index-b6934baf.js +0 -50
  48. package/_internal/components/drag-handle/index-80e5af6c.js +0 -52
  49. package/_internal/components/dropdown/index-cebfc268.js +0 -147
  50. package/_internal/components/expansion-panel/index-9d45a211.js +0 -167
  51. package/_internal/components/flag/index-33e9d909.js +0 -59
  52. package/_internal/components/flex-box/index-0d6b6b43.js +0 -56
  53. package/_internal/components/generic-block/index-836c4352.js +0 -124
  54. package/_internal/components/grid/index-8c16a4f1.js +0 -104
  55. package/_internal/components/grid-column/index-4a2f56bb.js +0 -59
  56. package/_internal/components/heading/index-fd558a9a.js +0 -53
  57. package/_internal/components/icon/index-e7b9b40e.js +0 -1
  58. package/_internal/components/image-block/index-7021c2f1.js +0 -110
  59. package/_internal/components/image-lightbox/index-27017547.js +0 -759
  60. package/_internal/components/inline-list/index-52efec7f.js +0 -74
  61. package/_internal/components/input-helper/index-5a837e7c.js +0 -71
  62. package/_internal/components/input-label/index-0113f382.js +0 -59
  63. package/_internal/components/lightbox/index-fad5a9f2.js +0 -155
  64. package/_internal/components/link/index-008bae4b.js +0 -72
  65. package/_internal/components/link-preview/index-3e9c32f2.js +0 -117
  66. package/_internal/components/list/index-da88c6e9.js +0 -71
  67. package/_internal/components/message/index-17b568f2.js +0 -98
  68. package/_internal/components/mosaic/index-2d40e01c.js +0 -95
  69. package/_internal/components/navigation/index-dc17c639.js +0 -225
  70. package/_internal/components/notification/index-a1101015.js +0 -146
  71. package/_internal/components/popover/index-dbca63f1.js +0 -2
  72. package/_internal/components/popover-dialog/index-654d2abc.js +0 -66
  73. package/_internal/components/post-block/index-4b6b4dcb.js +0 -109
  74. package/_internal/components/progress/index-6f578c31.js +0 -182
  75. package/_internal/components/progress-tracker/index-700bc4c2.js +0 -309
  76. package/_internal/components/radio-button/index-89b725af.js +0 -149
  77. package/_internal/components/select/index-2755aa32.js +0 -458
  78. package/_internal/components/side-navigation/index-0bbe1fdd.js +0 -165
  79. package/_internal/components/skeleton/index-b2f8501c.js +0 -166
  80. package/_internal/components/slider/index-4f9b891b.js +0 -311
  81. package/_internal/components/slideshow/index-d4604589.js +0 -150
  82. package/_internal/components/switch/index-58fe0f0c.js +0 -122
  83. package/_internal/components/table/index-d541aa88.js +0 -297
  84. package/_internal/components/tabs/index-af1538d6.js +0 -298
  85. package/_internal/components/text/index-5bfc6d5e.js +0 -1
  86. package/_internal/components/text-field/index-47c98d09.js +0 -360
  87. package/_internal/components/thumbnail/index-71545d95.js +0 -41
  88. package/_internal/components/toolbar/index-7041a5a6.js +0 -61
  89. package/_internal/components/tooltip/index-8bb97e60.js +0 -327
  90. package/_internal/components/uploader/index-8f6f55de.js +0 -153
  91. package/_internal/components/user-block/index-70d4ce8f.js +0 -145
  92. package/_internal/d0e3f49e.js +0 -23
  93. package/_internal/de24f857.js +0 -3
  94. package/_internal/e806b848.js +0 -8
  95. package/_internal/e913a3af.js +0 -117
  96. package/_internal/ea04260d.js +0 -28
  97. package/_internal/eaf6c45a.js +0 -3
  98. package/_internal/ebdcb0c7.js +0 -60
  99. package/_internal/ef5d1aac.js +0 -3
  100. package/_internal/f0d7d6ea.js +0 -29
  101. package/_internal/utils/ClickAwayProvider/index-1234ce76.js +0 -94
  102. package/_internal/utils/MaterialThemeSwitcher/index-8d22de5a.js +0 -48
  103. package/_internal/utils/Portal/index-6e0a7404.js +0 -44
  104. package/_internal/utils/disabled/index-075b99c3.js +0 -36
  105. package/_internal/utils/type/index-ea9fc197.js +0 -2
@@ -1,98 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
3
- import { f as forwardRef } from '../../8bce732e.js';
4
- import { jsxs, jsx } from 'react/jsx-runtime';
5
- import { Kind, ColorPalette, Size, Emphasis } from '@lumx/core/js/constants';
6
- import { m as mdiAlert, a as mdiInformation } from '../../49bbeed3.js';
7
- import { m as mdiCheckCircle } from '../../de24f857.js';
8
- import { m as mdiAlertCircle, I as Icon } from '../../bace1bf1.js';
9
- import { I as IconButton } from '../../b83e864b.js';
10
- import { m as mdiClose } from '../../eaf6c45a.js';
11
-
12
- /**
13
- * Component display name.
14
- */
15
- const COMPONENT_NAME = 'Message';
16
-
17
- /**
18
- * Component default class name and class prefix.
19
- */
20
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
21
-
22
- /**
23
- * Associative map from message kind to color and icon.
24
- */
25
- const CONFIG = {
26
- [Kind.error]: {
27
- color: ColorPalette.red,
28
- icon: mdiAlert
29
- },
30
- [Kind.info]: {
31
- color: ColorPalette.blue,
32
- icon: mdiInformation
33
- },
34
- [Kind.success]: {
35
- color: ColorPalette.green,
36
- icon: mdiCheckCircle
37
- },
38
- [Kind.warning]: {
39
- color: ColorPalette.yellow,
40
- icon: mdiAlertCircle
41
- }
42
- };
43
-
44
- /**
45
- * Message component.
46
- *
47
- * @param props Component props.
48
- * @param ref Component ref.
49
- * @return React element.
50
- */
51
- const Message = forwardRef((props, ref) => {
52
- const {
53
- children,
54
- className,
55
- hasBackground,
56
- kind,
57
- icon: customIcon,
58
- closeButtonProps,
59
- ...forwardedProps
60
- } = props;
61
- const {
62
- color,
63
- icon
64
- } = CONFIG[kind] || {};
65
- const {
66
- onClick,
67
- label: closeButtonLabel
68
- } = closeButtonProps || {};
69
- const isCloseButtonDisplayed = hasBackground && kind === 'info' && onClick && closeButtonLabel;
70
- return /*#__PURE__*/jsxs("div", {
71
- ref: ref,
72
- className: classNames(className, handleBasicClasses({
73
- color,
74
- hasBackground,
75
- prefix: CLASSNAME
76
- })),
77
- ...forwardedProps,
78
- children: [(customIcon || icon) && /*#__PURE__*/jsx(Icon, {
79
- className: `${CLASSNAME}__icon`,
80
- icon: customIcon || icon,
81
- size: Size.xs,
82
- color: color
83
- }), /*#__PURE__*/jsx("div", {
84
- className: `${CLASSNAME}__text`,
85
- children: children
86
- }), isCloseButtonDisplayed && /*#__PURE__*/jsx(IconButton, {
87
- className: `${CLASSNAME}__close-button`,
88
- icon: mdiClose,
89
- onClick: onClick,
90
- label: closeButtonLabel,
91
- emphasis: Emphasis.low
92
- })]
93
- });
94
- });
95
- Message.displayName = COMPONENT_NAME;
96
- Message.className = CLASSNAME;
97
-
98
- export { Message };
@@ -1,95 +0,0 @@
1
- import { useMemo } from 'react';
2
- import classNames from 'classnames';
3
- import take from 'lodash/take';
4
- import { u as useTheme } from '../../3181f000.js';
5
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
6
- import { f as forwardRef } from '../../8bce732e.js';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
- import { Theme, Alignment, AspectRatio } from '@lumx/core/js/constants';
9
- import { T as Thumbnail } from '../../035c132d.js';
10
-
11
- /**
12
- * Component display name.
13
- */
14
- const COMPONENT_NAME = 'Mosaic';
15
-
16
- /**
17
- * Component default class name and class prefix.
18
- */
19
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
20
-
21
- /**
22
- * Component default props.
23
- */
24
- const DEFAULT_PROPS = {};
25
-
26
- /**
27
- * Mosaic component.
28
- *
29
- * @param props Component props.
30
- * @param ref Component ref.
31
- * @return React element.
32
- */
33
- const Mosaic = forwardRef((props, ref) => {
34
- const defaultTheme = useTheme() || Theme.light;
35
- const {
36
- className,
37
- theme = defaultTheme,
38
- thumbnails,
39
- onImageClick,
40
- ...forwardedProps
41
- } = props;
42
- const handleImageClick = useMemo(() => {
43
- if (!onImageClick) return undefined;
44
- return (index, onClick) => event => {
45
- onClick?.(event);
46
- onImageClick?.(index);
47
- };
48
- }, [onImageClick]);
49
- return /*#__PURE__*/jsx("div", {
50
- ref: ref,
51
- ...forwardedProps,
52
- className: classNames(className, handleBasicClasses({
53
- prefix: CLASSNAME,
54
- theme
55
- }), {
56
- [`${CLASSNAME}--has-1-thumbnail`]: thumbnails?.length === 1,
57
- [`${CLASSNAME}--has-2-thumbnails`]: thumbnails?.length === 2,
58
- [`${CLASSNAME}--has-3-thumbnails`]: thumbnails?.length === 3,
59
- [`${CLASSNAME}--has-4-thumbnails`]: thumbnails?.length >= 4
60
- }),
61
- children: /*#__PURE__*/jsx("div", {
62
- className: `${CLASSNAME}__wrapper`,
63
- children: take(thumbnails, 4).map((thumbnail, index) => {
64
- const {
65
- image,
66
- onClick,
67
- align,
68
- ...thumbnailProps
69
- } = thumbnail;
70
- return /*#__PURE__*/jsxs("div", {
71
- className: `${CLASSNAME}__thumbnail`,
72
- children: [/*#__PURE__*/jsx(Thumbnail, {
73
- ...thumbnailProps,
74
- align: align || Alignment.left,
75
- image: image,
76
- theme: theme,
77
- aspectRatio: AspectRatio.free,
78
- fillHeight: true,
79
- onClick: handleImageClick?.(index, onClick) || onClick
80
- }), thumbnails.length > 4 && index === 3 && /*#__PURE__*/jsx("div", {
81
- className: `${CLASSNAME}__overlay`,
82
- children: /*#__PURE__*/jsxs("span", {
83
- children: ["+", thumbnails.length - 4]
84
- })
85
- })]
86
- }, index);
87
- })
88
- })
89
- });
90
- });
91
- Mosaic.displayName = COMPONENT_NAME;
92
- Mosaic.className = CLASSNAME;
93
- Mosaic.defaultProps = DEFAULT_PROPS;
94
-
95
- export { Mosaic };
@@ -1,225 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName, handleBasicClasses } 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 { createContext, useState, useRef, useContext } from 'react';
6
- import { u as useId } from '../../3a1facc0.js';
7
- import { f as forwardRefPolymorphic, R as RawClickable } from '../../2c2b6a89.js';
8
- import { u as useOverflowTooltipLabel, T as Text } from '../../e913a3af.js';
9
- import { jsx, jsxs } from 'react/jsx-runtime';
10
- import { Tooltip } from '../tooltip/index-8bb97e60.js';
11
- import { P as Placement } from '../../4f4c0582.js';
12
- import { I as Icon } from '../../bace1bf1.js';
13
- import { Size, Orientation, Theme } from '@lumx/core/js/constants';
14
- import { P as Popover } from '../../3864a6c1.js';
15
- import { m as mdiChevronUp, a as mdiChevronDown } from '../../0b9c76cb.js';
16
-
17
- /**
18
- * Component display name.
19
- */
20
- const COMPONENT_NAME$2 = 'NavigationItem';
21
-
22
- /**
23
- * Component default class name and class prefix.
24
- */
25
- const CLASSNAME$2 = getRootClassName(COMPONENT_NAME$2);
26
- const NavigationItem = Object.assign(forwardRefPolymorphic((props, ref) => {
27
- const {
28
- className,
29
- icon,
30
- label,
31
- isCurrentPage,
32
- as: Element = 'a',
33
- ...forwardedProps
34
- } = props;
35
- const theme = useTheme();
36
- const {
37
- tooltipLabel,
38
- labelRef
39
- } = useOverflowTooltipLabel(label);
40
- return /*#__PURE__*/jsx("li", {
41
- className: classNames(className, handleBasicClasses({
42
- prefix: CLASSNAME$2,
43
- theme
44
- })),
45
- children: /*#__PURE__*/jsx(Tooltip, {
46
- label: tooltipLabel,
47
- placement: Placement.TOP,
48
- children: /*#__PURE__*/jsxs(RawClickable, {
49
- as: Element,
50
- className: handleBasicClasses({
51
- prefix: `${CLASSNAME$2}__link`,
52
- isSelected: isCurrentPage
53
- }),
54
- ref: ref,
55
- "aria-current": isCurrentPage ? 'page' : undefined,
56
- ...forwardedProps,
57
- children: [icon ? /*#__PURE__*/jsx(Icon, {
58
- className: `${CLASSNAME$2}__icon`,
59
- icon: icon,
60
- size: Size.xs,
61
- theme: theme
62
- }) : null, /*#__PURE__*/jsx(Text, {
63
- as: "span",
64
- truncate: true,
65
- className: `${CLASSNAME$2}__label`,
66
- ref: labelRef,
67
- children: label
68
- })]
69
- })
70
- })
71
- });
72
- }), {
73
- displayName: COMPONENT_NAME$2,
74
- className: CLASSNAME$2
75
- });
76
-
77
- const NavigationContext = /*#__PURE__*/createContext({
78
- orientation: Orientation.vertical
79
- });
80
-
81
- /**
82
- * Component display name.
83
- */
84
- const COMPONENT_NAME$1 = 'NavigationSection';
85
-
86
- /**
87
- * Component default class name and class prefix.
88
- */
89
- const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
90
- const NavigationSection = forwardRef((props, ref) => {
91
- const {
92
- children,
93
- className,
94
- label,
95
- icon,
96
- ...forwardedProps
97
- } = props;
98
- const [isOpen, setIsOpen] = useState(false);
99
- const buttonRef = useRef(null);
100
- const sectionId = useId();
101
- const {
102
- orientation
103
- } = useContext(NavigationContext) || {};
104
- const theme = useTheme();
105
- const isDropdown = orientation === Orientation.horizontal;
106
- return /*#__PURE__*/jsxs("li", {
107
- className: classNames(className, CLASSNAME$1, CLASSNAME$2, handleBasicClasses({
108
- prefix: CLASSNAME$2,
109
- theme
110
- })),
111
- ref: ref,
112
- children: [/*#__PURE__*/jsxs(RawClickable, {
113
- as: "button",
114
- ...forwardedProps,
115
- "aria-controls": sectionId,
116
- "aria-expanded": isOpen,
117
- className: classNames(`${CLASSNAME$2}__link`),
118
- ref: buttonRef,
119
- onClick: event => {
120
- setIsOpen(!isOpen);
121
- event.stopPropagation();
122
- },
123
- children: [icon ? /*#__PURE__*/jsx(Icon, {
124
- className: `${CLASSNAME$2}__icon`,
125
- icon: icon,
126
- size: Size.xs
127
- }) : null, /*#__PURE__*/jsx(Text, {
128
- as: "span",
129
- truncate: true,
130
- className: `${CLASSNAME$2}__label`,
131
- ref: ref,
132
- children: label
133
- }), /*#__PURE__*/jsx(Icon, {
134
- className: classNames(`${CLASSNAME$2}__icon`, `${CLASSNAME$1}__chevron`),
135
- icon: isOpen ? mdiChevronUp : mdiChevronDown
136
- })]
137
- }), isOpen && (isDropdown ? /*#__PURE__*/jsx(Popover, {
138
- anchorRef: buttonRef,
139
- isOpen: isOpen,
140
- placement: Placement.BOTTOM_START,
141
- usePortal: false,
142
- closeOnClickAway: true,
143
- closeOnEscape: true,
144
- onClick: () => setIsOpen(false),
145
- onClose: () => setIsOpen(false),
146
- zIndex: 996,
147
- children: /*#__PURE__*/jsx(ThemeProvider, {
148
- value: Theme.light,
149
- children: /*#__PURE__*/jsx("ul", {
150
- className: `${CLASSNAME$1}__drawer--popover`,
151
- id: sectionId,
152
- children: /*#__PURE__*/jsx(NavigationContext.Provider, {
153
- value: {
154
- orientation: Orientation.vertical
155
- },
156
- children: children
157
- })
158
- })
159
- })
160
- }) : /*#__PURE__*/jsx("ul", {
161
- className: `${CLASSNAME$1}__drawer`,
162
- id: sectionId,
163
- children: children
164
- }))]
165
- });
166
- });
167
- NavigationSection.displayName = COMPONENT_NAME$1;
168
- NavigationSection.className = CLASSNAME$1;
169
-
170
- /**
171
- * Component display name.
172
- */
173
- const COMPONENT_NAME = 'Navigation';
174
-
175
- /**
176
- * Component default class name and class prefix.
177
- */
178
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
179
-
180
- /**
181
- * Component default props
182
- */
183
- const DEFAULT_PROPS = {
184
- orientation: Orientation.vertical
185
- };
186
- const Navigation = forwardRef((props, ref) => {
187
- const defaultTheme = useTheme() || Theme.light;
188
- const {
189
- children,
190
- className,
191
- theme = defaultTheme,
192
- orientation = DEFAULT_PROPS.orientation,
193
- ...forwardedProps
194
- } = props;
195
- return /*#__PURE__*/jsx(ThemeProvider, {
196
- value: theme,
197
- children: /*#__PURE__*/jsx("nav", {
198
- className: classNames(className, handleBasicClasses({
199
- prefix: CLASSNAME,
200
- theme,
201
- orientation
202
- })),
203
- ref: ref,
204
- ...forwardedProps,
205
- children: /*#__PURE__*/jsx(NavigationContext.Provider, {
206
- value: {
207
- orientation
208
- },
209
- children: /*#__PURE__*/jsx("ul", {
210
- className: `${CLASSNAME}__list`,
211
- children: children
212
- })
213
- })
214
- })
215
- });
216
- });
217
- Navigation.displayName = COMPONENT_NAME;
218
- Navigation.className = CLASSNAME;
219
- Navigation.defaultProps = DEFAULT_PROPS;
220
-
221
- // Sub components
222
- Navigation.Section = NavigationSection;
223
- Navigation.Item = NavigationItem;
224
-
225
- export { Navigation };
@@ -1,146 +0,0 @@
1
- import { useRef } from 'react';
2
- import classNames from 'classnames';
3
- import isFunction from 'lodash/isFunction';
4
- import { D as DOCUMENT } from '../../d0e3f49e.js';
5
- import { m as mdiAlert, a as mdiInformation } from '../../49bbeed3.js';
6
- import { m as mdiCheckCircle } from '../../de24f857.js';
7
- import { m as mdiAlertCircle, I as Icon } from '../../bace1bf1.js';
8
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
9
- import { u as useTransitionVisibility } from '../../a38bdcd0.js';
10
- import { m as mergeRefs } from '../../f0d7d6ea.js';
11
- import { u as useTheme } from '../../3181f000.js';
12
- import { f as forwardRef } from '../../8bce732e.js';
13
- import { jsx, jsxs } from 'react/jsx-runtime';
14
- import { Portal } from '../../utils/Portal/index-6e0a7404.js';
15
- import { Theme, Size, Emphasis, NOTIFICATION_TRANSITION_DURATION } from '@lumx/core/js/constants';
16
- import { a as Button } from '../../7ad474e4.js';
17
-
18
- /**
19
- * Notification icon and colors according to their type.
20
- */
21
- const NOTIFICATION_CONFIGURATION = {
22
- error: {
23
- color: 'red',
24
- icon: mdiAlert
25
- },
26
- info: {
27
- color: 'blue',
28
- icon: mdiInformation
29
- },
30
- success: {
31
- color: 'green',
32
- icon: mdiCheckCircle
33
- },
34
- warning: {
35
- color: 'yellow',
36
- icon: mdiAlertCircle
37
- }
38
- };
39
-
40
- /**
41
- * Component display name.
42
- */
43
- const COMPONENT_NAME = 'Notification';
44
-
45
- /**
46
- * Component default class name and class prefix.
47
- */
48
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
49
-
50
- /**
51
- * Component default props.
52
- */
53
- const DEFAULT_PROPS = {
54
- zIndex: 9999,
55
- usePortal: true
56
- };
57
-
58
- /* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
59
- /**
60
- * Notification component.
61
- *
62
- * @param props Component props.
63
- * @param ref Component ref.
64
- * @return React element.
65
- */
66
- const Notification = forwardRef((props, ref) => {
67
- const defaultTheme = useTheme() || Theme.light;
68
- const {
69
- actionLabel,
70
- className,
71
- content,
72
- isOpen,
73
- onActionClick,
74
- onClick,
75
- theme = defaultTheme,
76
- type,
77
- zIndex = DEFAULT_PROPS.zIndex,
78
- usePortal = DEFAULT_PROPS.usePortal,
79
- style,
80
- ...forwardedProps
81
- } = props;
82
- if (!DOCUMENT) {
83
- // Can't render in SSR.
84
- return null;
85
- }
86
- const {
87
- color,
88
- icon
89
- } = NOTIFICATION_CONFIGURATION[type] || {};
90
- const rootRef = useRef(null);
91
- const isVisible = useTransitionVisibility(rootRef, !!isOpen, NOTIFICATION_TRANSITION_DURATION);
92
- const hasAction = Boolean(onActionClick) && Boolean(actionLabel);
93
- const handleCallback = evt => {
94
- if (isFunction(onActionClick)) {
95
- onActionClick();
96
- }
97
- evt.stopPropagation();
98
- };
99
- if (!type || !isVisible) {
100
- return null;
101
- }
102
- return /*#__PURE__*/jsx(Portal, {
103
- enabled: usePortal,
104
- children: /*#__PURE__*/jsxs("div", {
105
- ref: mergeRefs(ref, rootRef),
106
- role: "alert",
107
- ...forwardedProps,
108
- className: classNames(className, handleBasicClasses({
109
- color,
110
- hasAction,
111
- isHidden: !isOpen,
112
- prefix: CLASSNAME
113
- })),
114
- onClick: onClick,
115
- style: {
116
- ...style,
117
- zIndex
118
- },
119
- children: [/*#__PURE__*/jsx("div", {
120
- className: `${CLASSNAME}__icon`,
121
- children: /*#__PURE__*/jsx(Icon, {
122
- icon: icon,
123
- size: Size.s
124
- })
125
- }), /*#__PURE__*/jsx("div", {
126
- className: `${CLASSNAME}__content`,
127
- children: content
128
- }), hasAction && /*#__PURE__*/jsx("div", {
129
- className: `${CLASSNAME}__action`,
130
- children: /*#__PURE__*/jsx(Button, {
131
- emphasis: Emphasis.medium,
132
- theme: theme,
133
- onClick: handleCallback,
134
- children: /*#__PURE__*/jsx("span", {
135
- children: actionLabel
136
- })
137
- })
138
- })]
139
- })
140
- });
141
- });
142
- Notification.displayName = COMPONENT_NAME;
143
- Notification.className = CLASSNAME;
144
- Notification.defaultProps = DEFAULT_PROPS;
145
-
146
- export { Notification };
@@ -1,2 +0,0 @@
1
- export { P as Popover } from '../../3864a6c1.js';
2
- export { P as Placement } from '../../4f4c0582.js';
@@ -1,66 +0,0 @@
1
- import classNames from 'classnames';
2
- import { getRootClassName } from '@lumx/core/js/utils/className';
3
- import { f as forwardRef } from '../../8bce732e.js';
4
- import { P as Popover } from '../../3864a6c1.js';
5
- import { jsx } from 'react/jsx-runtime';
6
- import { H as HeadingLevelProvider } from '../../ebdcb0c7.js';
7
-
8
- /**
9
- * Component display name.
10
- */
11
- const COMPONENT_NAME = 'PopoverDialog';
12
-
13
- /**
14
- * Component default class name and class prefix.
15
- */
16
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
17
-
18
- /**
19
- * Component default props.
20
- */
21
- const DEFAULT_PROPS = {};
22
-
23
- /**
24
- * PopoverDialog component.
25
- * Defines a popover that acts like a dialog
26
- * * Has a dialog aria role
27
- * * Sets a focus trap within the popover
28
- * * Closes on click away and escape.
29
- */
30
- const PopoverDialog = forwardRef((props, ref) => {
31
- const {
32
- children,
33
- isOpen,
34
- focusElement,
35
- 'aria-label': ariaLabel,
36
- label = ariaLabel,
37
- className,
38
- ...forwardedProps
39
- } = props;
40
- return /*#__PURE__*/jsx(Popover, {
41
- ...forwardedProps,
42
- ref: ref,
43
- className: classNames(className, CLASSNAME),
44
- role: "dialog",
45
- "aria-modal": "true"
46
- /**
47
- * If a label is set, set as aria-label.
48
- * If it is undefined, the label can be set using the `aria-label` and `aria-labelledby` props
49
- */,
50
- "aria-label": label,
51
- isOpen: isOpen,
52
- focusElement: focusElement,
53
- closeOnClickAway: true,
54
- closeOnEscape: true,
55
- withFocusTrap: true,
56
- children: /*#__PURE__*/jsx(HeadingLevelProvider, {
57
- level: 2,
58
- children: children
59
- })
60
- });
61
- });
62
- PopoverDialog.displayName = COMPONENT_NAME;
63
- PopoverDialog.className = CLASSNAME;
64
- PopoverDialog.defaultProps = DEFAULT_PROPS;
65
-
66
- export { PopoverDialog };