@lumx/react 3.20.1-alpha.27 → 3.20.1-alpha.29

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 (197) hide show
  1. package/index.js +14033 -63
  2. package/index.js.map +1 -1
  3. package/package.json +7 -13
  4. package/utils/index.js +158 -3
  5. package/utils/index.js.map +1 -1
  6. package/_internal/Button-2b55a913.js +0 -97
  7. package/_internal/Button-2b55a913.js.map +0 -1
  8. package/_internal/ButtonRoot-823f3e9c.js +0 -117
  9. package/_internal/ButtonRoot-823f3e9c.js.map +0 -1
  10. package/_internal/Chip-e1e85810.js +0 -143
  11. package/_internal/Chip-e1e85810.js.map +0 -1
  12. package/_internal/ClickAwayProvider-1204f237.js +0 -95
  13. package/_internal/ClickAwayProvider-1204f237.js.map +0 -1
  14. package/_internal/DisabledStateContext-ea04260d.js +0 -29
  15. package/_internal/DisabledStateContext-ea04260d.js.map +0 -1
  16. package/_internal/HeadingLevelProvider-ebdcb0c7.js +0 -61
  17. package/_internal/HeadingLevelProvider-ebdcb0c7.js.map +0 -1
  18. package/_internal/IconButton-be160cb0.js +0 -77
  19. package/_internal/IconButton-be160cb0.js.map +0 -1
  20. package/_internal/ImageCaption-fcf5720c.js +0 -75
  21. package/_internal/ImageCaption-fcf5720c.js.map +0 -1
  22. package/_internal/List-dbf4297f.js +0 -791
  23. package/_internal/List-dbf4297f.js.map +0 -1
  24. package/_internal/PopoverDialog-193a0918.js +0 -655
  25. package/_internal/PopoverDialog-193a0918.js.map +0 -1
  26. package/_internal/Portal-3f86608e.js +0 -45
  27. package/_internal/Portal-3f86608e.js.map +0 -1
  28. package/_internal/RawClickable-2c2b6a89.js +0 -52
  29. package/_internal/RawClickable-2c2b6a89.js.map +0 -1
  30. package/_internal/Slides-2d267d8c.js +0 -679
  31. package/_internal/Slides-2d267d8c.js.map +0 -1
  32. package/_internal/ThemeContext-3181f000.js +0 -14
  33. package/_internal/ThemeContext-3181f000.js.map +0 -1
  34. package/_internal/Thumbnail-0872250e.js +0 -314
  35. package/_internal/Thumbnail-0872250e.js.map +0 -1
  36. package/_internal/check-circle-de24f857.js +0 -4
  37. package/_internal/check-circle-de24f857.js.map +0 -1
  38. package/_internal/chevron-right-827b804a.js +0 -6
  39. package/_internal/chevron-right-827b804a.js.map +0 -1
  40. package/_internal/chevron-up-0b9c76cb.js +0 -6
  41. package/_internal/chevron-up-0b9c76cb.js.map +0 -1
  42. package/_internal/close-circle-ef5d1aac.js +0 -4
  43. package/_internal/close-circle-ef5d1aac.js.map +0 -1
  44. package/_internal/close-eaf6c45a.js +0 -4
  45. package/_internal/close-eaf6c45a.js.map +0 -1
  46. package/_internal/components/alert-dialog-a6ed922b.js +0 -163
  47. package/_internal/components/alert-dialog-a6ed922b.js.map +0 -1
  48. package/_internal/components/autocomplete-c97b7698.js +0 -261
  49. package/_internal/components/autocomplete-c97b7698.js.map +0 -1
  50. package/_internal/components/avatar-d2214a61.js +0 -83
  51. package/_internal/components/avatar-d2214a61.js.map +0 -1
  52. package/_internal/components/badge-8390e590.js +0 -81
  53. package/_internal/components/badge-8390e590.js.map +0 -1
  54. package/_internal/components/button-b05f8f0c.js +0 -47
  55. package/_internal/components/button-b05f8f0c.js.map +0 -1
  56. package/_internal/components/checkbox-346834f8.js +0 -143
  57. package/_internal/components/checkbox-346834f8.js.map +0 -1
  58. package/_internal/components/chip-e3a6330f.js +0 -102
  59. package/_internal/components/chip-e3a6330f.js.map +0 -1
  60. package/_internal/components/comment-block-b1acc69f.js +0 -138
  61. package/_internal/components/comment-block-b1acc69f.js.map +0 -1
  62. package/_internal/components/date-picker-582c4925.js +0 -2
  63. package/_internal/components/date-picker-582c4925.js.map +0 -1
  64. package/_internal/components/dialog-785646aa.js +0 -238
  65. package/_internal/components/dialog-785646aa.js.map +0 -1
  66. package/_internal/components/divider-116af6b9.js +0 -50
  67. package/_internal/components/divider-116af6b9.js.map +0 -1
  68. package/_internal/components/drag-handle-6b073866.js +0 -52
  69. package/_internal/components/drag-handle-6b073866.js.map +0 -1
  70. package/_internal/components/dropdown-c0c0cfe8.js +0 -147
  71. package/_internal/components/dropdown-c0c0cfe8.js.map +0 -1
  72. package/_internal/components/expansion-panel-1de1d1ff.js +0 -167
  73. package/_internal/components/expansion-panel-1de1d1ff.js.map +0 -1
  74. package/_internal/components/flag-7c9d3abf.js +0 -59
  75. package/_internal/components/flag-7c9d3abf.js.map +0 -1
  76. package/_internal/components/flex-box-10423fa5.js +0 -56
  77. package/_internal/components/flex-box-10423fa5.js.map +0 -1
  78. package/_internal/components/generic-block-b79f163a.js +0 -128
  79. package/_internal/components/generic-block-b79f163a.js.map +0 -1
  80. package/_internal/components/grid-6f1b5a41.js +0 -104
  81. package/_internal/components/grid-6f1b5a41.js.map +0 -1
  82. package/_internal/components/grid-column-ee504283.js +0 -58
  83. package/_internal/components/grid-column-ee504283.js.map +0 -1
  84. package/_internal/components/heading-d4c66a34.js +0 -53
  85. package/_internal/components/heading-d4c66a34.js.map +0 -1
  86. package/_internal/components/icon-7c79ab42.js +0 -2
  87. package/_internal/components/icon-7c79ab42.js.map +0 -1
  88. package/_internal/components/image-block-762eb669.js +0 -110
  89. package/_internal/components/image-block-762eb669.js.map +0 -1
  90. package/_internal/components/image-lightbox-10fef304.js +0 -759
  91. package/_internal/components/image-lightbox-10fef304.js.map +0 -1
  92. package/_internal/components/inline-list-e6f19a98.js +0 -74
  93. package/_internal/components/inline-list-e6f19a98.js.map +0 -1
  94. package/_internal/components/input-helper-64153099.js +0 -71
  95. package/_internal/components/input-helper-64153099.js.map +0 -1
  96. package/_internal/components/input-label-2feb0bb0.js +0 -59
  97. package/_internal/components/input-label-2feb0bb0.js.map +0 -1
  98. package/_internal/components/lightbox-dcc9a7a0.js +0 -155
  99. package/_internal/components/lightbox-dcc9a7a0.js.map +0 -1
  100. package/_internal/components/link-f9421eab.js +0 -72
  101. package/_internal/components/link-f9421eab.js.map +0 -1
  102. package/_internal/components/link-preview-5c7e3878.js +0 -117
  103. package/_internal/components/link-preview-5c7e3878.js.map +0 -1
  104. package/_internal/components/list-f29e54b7.js +0 -71
  105. package/_internal/components/list-f29e54b7.js.map +0 -1
  106. package/_internal/components/message-aa3e3f76.js +0 -98
  107. package/_internal/components/message-aa3e3f76.js.map +0 -1
  108. package/_internal/components/mosaic-b4b35fa7.js +0 -94
  109. package/_internal/components/mosaic-b4b35fa7.js.map +0 -1
  110. package/_internal/components/navigation-8357dbe6.js +0 -225
  111. package/_internal/components/navigation-8357dbe6.js.map +0 -1
  112. package/_internal/components/notification-ec4cf95f.js +0 -143
  113. package/_internal/components/notification-ec4cf95f.js.map +0 -1
  114. package/_internal/components/popover-a674dd8d.js +0 -3
  115. package/_internal/components/popover-a674dd8d.js.map +0 -1
  116. package/_internal/components/post-block-bb3d3cbf.js +0 -109
  117. package/_internal/components/post-block-bb3d3cbf.js.map +0 -1
  118. package/_internal/components/progress-f39c3fa2.js +0 -182
  119. package/_internal/components/progress-f39c3fa2.js.map +0 -1
  120. package/_internal/components/progress-tracker-997931ac.js +0 -309
  121. package/_internal/components/progress-tracker-997931ac.js.map +0 -1
  122. package/_internal/components/radio-button-559a4863.js +0 -149
  123. package/_internal/components/radio-button-559a4863.js.map +0 -1
  124. package/_internal/components/select-8295a416.js +0 -457
  125. package/_internal/components/select-8295a416.js.map +0 -1
  126. package/_internal/components/side-navigation-40ee8bda.js +0 -164
  127. package/_internal/components/side-navigation-40ee8bda.js.map +0 -1
  128. package/_internal/components/skeleton-c66516ee.js +0 -166
  129. package/_internal/components/skeleton-c66516ee.js.map +0 -1
  130. package/_internal/components/slider-efbfbc45.js +0 -311
  131. package/_internal/components/slider-efbfbc45.js.map +0 -1
  132. package/_internal/components/slideshow-c5faf531.js +0 -151
  133. package/_internal/components/slideshow-c5faf531.js.map +0 -1
  134. package/_internal/components/switch-a26a5a72.js +0 -121
  135. package/_internal/components/switch-a26a5a72.js.map +0 -1
  136. package/_internal/components/table-c43ec4a5.js +0 -297
  137. package/_internal/components/table-c43ec4a5.js.map +0 -1
  138. package/_internal/components/tabs-4037fe57.js +0 -298
  139. package/_internal/components/tabs-4037fe57.js.map +0 -1
  140. package/_internal/components/text-851c62f8.js +0 -2
  141. package/_internal/components/text-851c62f8.js.map +0 -1
  142. package/_internal/components/text-field-82adaeb4.js +0 -359
  143. package/_internal/components/text-field-82adaeb4.js.map +0 -1
  144. package/_internal/components/thumbnail-f1784929.js +0 -42
  145. package/_internal/components/thumbnail-f1784929.js.map +0 -1
  146. package/_internal/components/toolbar-a43533a2.js +0 -61
  147. package/_internal/components/toolbar-a43533a2.js.map +0 -1
  148. package/_internal/components/tooltip-aa48ddda.js +0 -327
  149. package/_internal/components/tooltip-aa48ddda.js.map +0 -1
  150. package/_internal/components/uploader-7bc3adaa.js +0 -153
  151. package/_internal/components/uploader-7bc3adaa.js.map +0 -1
  152. package/_internal/components/user-block-fc03f01a.js +0 -144
  153. package/_internal/components/user-block-fc03f01a.js.map +0 -1
  154. package/_internal/constants-b9e57936.js +0 -2155
  155. package/_internal/constants-b9e57936.js.map +0 -1
  156. package/_internal/constants-d0e3f49e.js +0 -24
  157. package/_internal/constants-d0e3f49e.js.map +0 -1
  158. package/_internal/context-9d1336a1.js +0 -19
  159. package/_internal/context-9d1336a1.js.map +0 -1
  160. package/_internal/forwardRef-15f62847.js +0 -70
  161. package/_internal/forwardRef-15f62847.js.map +0 -1
  162. package/_internal/getFocusableElements-230173a8.js +0 -13
  163. package/_internal/getFocusableElements-230173a8.js.map +0 -1
  164. package/_internal/index-192f8ada.js +0 -103
  165. package/_internal/index-192f8ada.js.map +0 -1
  166. package/_internal/index-8e7fecb5.js +0 -436
  167. package/_internal/index-8e7fecb5.js.map +0 -1
  168. package/_internal/index-b06353f2.js +0 -117
  169. package/_internal/index-b06353f2.js.map +0 -1
  170. package/_internal/information-49bbeed3.js +0 -6
  171. package/_internal/information-49bbeed3.js.map +0 -1
  172. package/_internal/isComponent-b9762ff1.js +0 -18
  173. package/_internal/isComponent-b9762ff1.js.map +0 -1
  174. package/_internal/isComponentType-e806b848.js +0 -9
  175. package/_internal/isComponentType-e806b848.js.map +0 -1
  176. package/_internal/mergeRefs-f0d7d6ea.js +0 -30
  177. package/_internal/mergeRefs-f0d7d6ea.js.map +0 -1
  178. package/_internal/state-db358714.js +0 -130
  179. package/_internal/state-db358714.js.map +0 -1
  180. package/_internal/useBooleanState-2a3d237c.js +0 -12
  181. package/_internal/useBooleanState-2a3d237c.js.map +0 -1
  182. package/_internal/useCallbackOnEscape-0b220f9c.js +0 -62
  183. package/_internal/useCallbackOnEscape-0b220f9c.js.map +0 -1
  184. package/_internal/useDisableBodyScroll-36bd7352.js +0 -219
  185. package/_internal/useDisableBodyScroll-36bd7352.js.map +0 -1
  186. package/_internal/useDisableStateProps-69e16b7c.js +0 -36
  187. package/_internal/useDisableStateProps-69e16b7c.js.map +0 -1
  188. package/_internal/useFocusTrap-3114e5e8.js +0 -112
  189. package/_internal/useFocusTrap-3114e5e8.js.map +0 -1
  190. package/_internal/useId-3a1facc0.js +0 -18
  191. package/_internal/useId-3a1facc0.js.map +0 -1
  192. package/_internal/useRovingTabIndex-7daf0f24.js +0 -77
  193. package/_internal/useRovingTabIndex-7daf0f24.js.map +0 -1
  194. package/_internal/useTransitionVisibility-321fdbfa.js +0 -50
  195. package/_internal/useTransitionVisibility-321fdbfa.js.map +0 -1
  196. package/_internal/wrapChildrenIconWithSpaces-f1e91251.js +0 -20
  197. package/_internal/wrapChildrenIconWithSpaces-f1e91251.js.map +0 -1
@@ -1,791 +0,0 @@
1
- import React__default, { useState, useEffect, useMemo, Children, isValidElement, cloneElement, useRef } from 'react';
2
- import { f as forwardRef, c as classNames } from './forwardRef-15f62847.js';
3
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
4
- import { m as mergeRefs } from './mergeRefs-f0d7d6ea.js';
5
- import { onEnterPressed, onButtonPressed } from '@lumx/core/js/utils';
6
- import { u as useDisableStateProps } from './useDisableStateProps-69e16b7c.js';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { Size } from '@lumx/core/js/constants';
9
- import { i as isComponent } from './isComponent-b9762ff1.js';
10
-
11
- const INITIAL_INDEX$1 = -1;
12
-
13
- /**
14
- * This custom hook provides the necessary set of functions and values to properly navigate
15
- * a list using the keyboard.
16
- *
17
- * @param items the list of items that will be navigated using the keyboard.
18
- * @param ref A reference to the element that is controlling the navigation.
19
- * @param onListItemSelected callback to be executed when the ENTER key is pressed on an item.
20
- * @param onListItemNavigated callback to be executed when the Arrow keys are pressed.
21
- * @param onEnterPressed callback to be executed when the ENTER key is pressed.
22
- * @param onBackspacePressed callback to be executed when the BACKSPACE key is pressed.
23
- * @param keepFocusAfterSelection determines whether after selecting an item, the focus should be maintained on the current target or not.
24
- * @param initialIndex where should the navigation start from. it defaults to `-1`, so the first item navigated is the item on position `0`.
25
- * @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.
26
- * @return useKeyboardListNavigation helpers.
27
- */
28
- const useKeyboardListNavigation = (items, ref, onListItemSelected, onListItemNavigated, onEnterPressed, onBackspacePressed, keepFocusAfterSelection = false, initialIndex = INITIAL_INDEX$1, preventTabOnEnteredValue = true) => {
29
- const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);
30
-
31
- /**
32
- * This function calculates the next index in the list to be highlighted
33
- * @param key - key code pressed
34
- * @return next active index
35
- */
36
- const calculateActiveIndex = key => {
37
- switch (key) {
38
- case 'ArrowDown':
39
- return activeItemIndex + 1 < items.length ? activeItemIndex + 1 : 0;
40
- case 'ArrowUp':
41
- return activeItemIndex - 1 >= 0 ? activeItemIndex - 1 : items.length - 1;
42
- default:
43
- return initialIndex;
44
- }
45
- };
46
-
47
- /**
48
- * Resets the active index to the initial state
49
- */
50
- const resetActiveIndex = () => {
51
- setActiveItemIndex(initialIndex);
52
- };
53
-
54
- /**
55
- * Prevents the default event and stops the propagation of said event
56
- * @param evt - key pressed event
57
- */
58
- const preventDefaultAndStopPropagation = evt => {
59
- evt.preventDefault();
60
- evt.stopPropagation();
61
- };
62
-
63
- /**
64
- * Handles navigation with the arrows using the keyboard
65
- * @param evt - key pressed event
66
- */
67
- const onArrowPressed = evt => {
68
- const {
69
- key
70
- } = evt;
71
- const nextActiveIndex = calculateActiveIndex(key);
72
- setActiveItemIndex(nextActiveIndex);
73
- preventDefaultAndStopPropagation(evt);
74
- if (onListItemNavigated) {
75
- const selectedItem = items[nextActiveIndex];
76
- onListItemNavigated(selectedItem);
77
- }
78
- };
79
-
80
- /**
81
- * Handles the event when the backspace key is pressed
82
- * @param evt - key pressed event
83
- */
84
- const onBackspaceKeyPressed = evt => {
85
- if (onBackspacePressed) {
86
- onBackspacePressed(evt);
87
- }
88
- };
89
-
90
- /**
91
- * Handles when the ENTER key is pressed
92
- * @param evt - key pressed event
93
- */
94
- const onEnterKeyPressed = evt => {
95
- if (!onListItemSelected) {
96
- return;
97
- }
98
- preventDefaultAndStopPropagation(evt);
99
- if (!keepFocusAfterSelection) {
100
- evt.currentTarget.blur();
101
- }
102
- const selectedItem = items[activeItemIndex];
103
- if (selectedItem) {
104
- onListItemSelected(selectedItem);
105
- resetActiveIndex();
106
- } else if (activeItemIndex === initialIndex && onEnterPressed) {
107
- const value = evt.target?.value;
108
- onEnterPressed(value);
109
- resetActiveIndex();
110
- }
111
- };
112
-
113
- /**
114
- * Handles when the TAB key is pressed
115
- * @param evt - key pressed event
116
- */
117
- const onTabKeyPressed = evt => {
118
- const value = evt.target?.value;
119
- if (preventTabOnEnteredValue && value && value.length > 0) {
120
- preventDefaultAndStopPropagation(evt);
121
- }
122
- };
123
-
124
- /**
125
- * In order to make it easier in the future to add new events depending on the key
126
- * a map was created to add these handlers. In the future, if there is another event
127
- * that we need to manage depending on a specific key, we just need to add the key code
128
- * here, and as a value, the handler for said key.
129
- */
130
- const eventsForKeyPressed = {
131
- ArrowDown: onArrowPressed,
132
- Tab: onTabKeyPressed,
133
- ArrowUp: onArrowPressed,
134
- Enter: onEnterKeyPressed,
135
- Backspace: onBackspaceKeyPressed
136
- };
137
-
138
- /**
139
- * Calculates the next active item index depending on the key pressed.
140
- * If the key pressed was ENTER, the function executes the callback `onListItemSelected`
141
- * and resets the active index, since an item was selected.
142
- * @param evt - key pressed or key down event
143
- */
144
- const onKeyboardNavigation = evt => {
145
- const {
146
- key
147
- } = evt;
148
- const handler = eventsForKeyPressed[key];
149
- if (handler) {
150
- handler(evt);
151
- }
152
- };
153
- useEffect(() => {
154
- const {
155
- current: currentElement
156
- } = ref;
157
- if (!currentElement) {
158
- return undefined;
159
- }
160
- currentElement.addEventListener('focus', resetActiveIndex);
161
- currentElement.addEventListener('keydown', onKeyboardNavigation);
162
- return () => {
163
- currentElement.removeEventListener('focus', resetActiveIndex);
164
- currentElement.removeEventListener('keydown', onKeyboardNavigation);
165
- };
166
- });
167
- return {
168
- activeItemIndex,
169
- onKeyboardNavigation,
170
- resetActiveIndex,
171
- setActiveItemIndex
172
- };
173
- };
174
-
175
- /**
176
- * Render link with default <a> HTML component or a custom one provided by `linkAs`.
177
- *
178
- * Can be used to inject the `Link` component from `react-router` and provide better a11y on LumX components.
179
- *
180
- * @param linkAs Custom link component.
181
- * @param children Link children.
182
- * @return A link.
183
- */
184
- const renderLink = ({
185
- linkAs,
186
- ...forwardedProps
187
- }, ...children) => /*#__PURE__*/React__default.createElement(linkAs || 'a', forwardedProps, ...children);
188
-
189
- /**
190
- * Component display name.
191
- */
192
- const COMPONENT_NAME$1 = 'ListItem';
193
-
194
- /**
195
- * Component default class name and class prefix.
196
- */
197
- const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
198
-
199
- /**
200
- * Component default props.
201
- */
202
- const DEFAULT_PROPS$1 = {
203
- size: Size.regular
204
- };
205
-
206
- /**
207
- * Check if the list item is clickable.
208
- * @return `true` if the list item is clickable; `false` otherwise.
209
- */
210
- function isClickable({
211
- linkProps,
212
- onItemSelected
213
- }) {
214
- return !!linkProps?.href || !!onItemSelected;
215
- }
216
-
217
- /**
218
- * ListItem component.
219
- *
220
- * @param props Component props.
221
- * @param ref Component ref.
222
- * @return React element.
223
- */
224
- const ListItem = forwardRef((props, ref) => {
225
- const {
226
- isAnyDisabled,
227
- disabledStateProps,
228
- otherProps
229
- } = useDisableStateProps(props);
230
- const {
231
- after,
232
- before,
233
- children,
234
- className,
235
- isHighlighted,
236
- isSelected,
237
- linkAs,
238
- linkProps = {},
239
- linkRef,
240
- onItemSelected,
241
- size = DEFAULT_PROPS$1.size,
242
- ...forwardedProps
243
- } = otherProps;
244
- const role = linkAs || linkProps.href ? 'link' : 'button';
245
- const onKeyDown = useMemo(() => {
246
- if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected);
247
- if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected);
248
- return undefined;
249
- }, [role, onItemSelected]);
250
- const content = /*#__PURE__*/jsxs(Fragment, {
251
- children: [before && /*#__PURE__*/jsx("div", {
252
- className: `${CLASSNAME$1}__before`,
253
- children: before
254
- }), /*#__PURE__*/jsx("div", {
255
- className: `${CLASSNAME$1}__content`,
256
- children: children
257
- }), after && /*#__PURE__*/jsx("div", {
258
- className: `${CLASSNAME$1}__after`,
259
- children: after
260
- })]
261
- });
262
- return /*#__PURE__*/jsx("li", {
263
- ref: ref,
264
- ...forwardedProps,
265
- className: classNames(className, handleBasicClasses({
266
- prefix: CLASSNAME$1,
267
- size
268
- })),
269
- children: isClickable({
270
- linkProps,
271
- onItemSelected
272
- }) ? (/* Clickable list item */
273
- renderLink({
274
- linkAs,
275
- tabIndex: !disabledStateProps.disabled ? 0 : undefined,
276
- role,
277
- 'aria-disabled': isAnyDisabled,
278
- ...linkProps,
279
- href: isAnyDisabled ? undefined : linkProps.href,
280
- className: classNames(handleBasicClasses({
281
- prefix: `${CLASSNAME$1}__link`,
282
- isHighlighted,
283
- isSelected,
284
- isDisabled: isAnyDisabled
285
- })),
286
- onClick: isAnyDisabled ? undefined : onItemSelected,
287
- onKeyDown: isAnyDisabled ? undefined : onKeyDown,
288
- ref: linkRef
289
- }, content)) :
290
- /*#__PURE__*/
291
- /* Non clickable list item */
292
- jsx("div", {
293
- className: `${CLASSNAME$1}__wrapper`,
294
- children: content
295
- })
296
- });
297
- });
298
- ListItem.displayName = COMPONENT_NAME$1;
299
- ListItem.className = CLASSNAME$1;
300
- ListItem.defaultProps = DEFAULT_PROPS$1;
301
-
302
- var reactIs = {exports: {}};
303
-
304
- var reactIs_production_min = {};
305
-
306
- /**
307
- * @license React
308
- * react-is.production.min.js
309
- *
310
- * Copyright (c) Facebook, Inc. and its affiliates.
311
- *
312
- * This source code is licensed under the MIT license found in the
313
- * LICENSE file in the root directory of this source tree.
314
- */
315
- var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
316
- function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
317
- reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
318
- reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
319
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
320
-
321
- var reactIs_development = {};
322
-
323
- /**
324
- * @license React
325
- * react-is.development.js
326
- *
327
- * Copyright (c) Facebook, Inc. and its affiliates.
328
- *
329
- * This source code is licensed under the MIT license found in the
330
- * LICENSE file in the root directory of this source tree.
331
- */
332
-
333
- if (process.env.NODE_ENV !== "production") {
334
- (function() {
335
-
336
- // ATTENTION
337
- // When adding new symbols to this file,
338
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
339
- // The Symbol used to tag the ReactElement-like types.
340
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
341
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
342
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
343
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
344
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
345
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
346
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
347
- var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
348
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
349
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
350
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
351
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
352
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
353
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
354
-
355
- // -----------------------------------------------------------------------------
356
-
357
- var enableScopeAPI = false; // Experimental Create Event Handle API.
358
- var enableCacheElement = false;
359
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
360
-
361
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
362
- // stuff. Intended to enable React core members to more easily debug scheduling
363
- // issues in DEV builds.
364
-
365
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
366
-
367
- var REACT_MODULE_REFERENCE;
368
-
369
- {
370
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
371
- }
372
-
373
- function isValidElementType(type) {
374
- if (typeof type === 'string' || typeof type === 'function') {
375
- return true;
376
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
377
-
378
-
379
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
380
- return true;
381
- }
382
-
383
- if (typeof type === 'object' && type !== null) {
384
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
385
- // types supported by any Flight configuration anywhere since
386
- // we don't know which Flight build this will end up being used
387
- // with.
388
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
389
- return true;
390
- }
391
- }
392
-
393
- return false;
394
- }
395
-
396
- function typeOf(object) {
397
- if (typeof object === 'object' && object !== null) {
398
- var $$typeof = object.$$typeof;
399
-
400
- switch ($$typeof) {
401
- case REACT_ELEMENT_TYPE:
402
- var type = object.type;
403
-
404
- switch (type) {
405
- case REACT_FRAGMENT_TYPE:
406
- case REACT_PROFILER_TYPE:
407
- case REACT_STRICT_MODE_TYPE:
408
- case REACT_SUSPENSE_TYPE:
409
- case REACT_SUSPENSE_LIST_TYPE:
410
- return type;
411
-
412
- default:
413
- var $$typeofType = type && type.$$typeof;
414
-
415
- switch ($$typeofType) {
416
- case REACT_SERVER_CONTEXT_TYPE:
417
- case REACT_CONTEXT_TYPE:
418
- case REACT_FORWARD_REF_TYPE:
419
- case REACT_LAZY_TYPE:
420
- case REACT_MEMO_TYPE:
421
- case REACT_PROVIDER_TYPE:
422
- return $$typeofType;
423
-
424
- default:
425
- return $$typeof;
426
- }
427
-
428
- }
429
-
430
- case REACT_PORTAL_TYPE:
431
- return $$typeof;
432
- }
433
- }
434
-
435
- return undefined;
436
- }
437
- var ContextConsumer = REACT_CONTEXT_TYPE;
438
- var ContextProvider = REACT_PROVIDER_TYPE;
439
- var Element = REACT_ELEMENT_TYPE;
440
- var ForwardRef = REACT_FORWARD_REF_TYPE;
441
- var Fragment = REACT_FRAGMENT_TYPE;
442
- var Lazy = REACT_LAZY_TYPE;
443
- var Memo = REACT_MEMO_TYPE;
444
- var Portal = REACT_PORTAL_TYPE;
445
- var Profiler = REACT_PROFILER_TYPE;
446
- var StrictMode = REACT_STRICT_MODE_TYPE;
447
- var Suspense = REACT_SUSPENSE_TYPE;
448
- var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
449
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
450
- var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
451
-
452
- function isAsyncMode(object) {
453
- {
454
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
455
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
456
-
457
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
458
- }
459
- }
460
-
461
- return false;
462
- }
463
- function isConcurrentMode(object) {
464
- {
465
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
466
- hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
467
-
468
- console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
469
- }
470
- }
471
-
472
- return false;
473
- }
474
- function isContextConsumer(object) {
475
- return typeOf(object) === REACT_CONTEXT_TYPE;
476
- }
477
- function isContextProvider(object) {
478
- return typeOf(object) === REACT_PROVIDER_TYPE;
479
- }
480
- function isElement(object) {
481
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
482
- }
483
- function isForwardRef(object) {
484
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
485
- }
486
- function isFragment(object) {
487
- return typeOf(object) === REACT_FRAGMENT_TYPE;
488
- }
489
- function isLazy(object) {
490
- return typeOf(object) === REACT_LAZY_TYPE;
491
- }
492
- function isMemo(object) {
493
- return typeOf(object) === REACT_MEMO_TYPE;
494
- }
495
- function isPortal(object) {
496
- return typeOf(object) === REACT_PORTAL_TYPE;
497
- }
498
- function isProfiler(object) {
499
- return typeOf(object) === REACT_PROFILER_TYPE;
500
- }
501
- function isStrictMode(object) {
502
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
503
- }
504
- function isSuspense(object) {
505
- return typeOf(object) === REACT_SUSPENSE_TYPE;
506
- }
507
- function isSuspenseList(object) {
508
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
509
- }
510
-
511
- reactIs_development.ContextConsumer = ContextConsumer;
512
- reactIs_development.ContextProvider = ContextProvider;
513
- reactIs_development.Element = Element;
514
- reactIs_development.ForwardRef = ForwardRef;
515
- reactIs_development.Fragment = Fragment;
516
- reactIs_development.Lazy = Lazy;
517
- reactIs_development.Memo = Memo;
518
- reactIs_development.Portal = Portal;
519
- reactIs_development.Profiler = Profiler;
520
- reactIs_development.StrictMode = StrictMode;
521
- reactIs_development.Suspense = Suspense;
522
- reactIs_development.SuspenseList = SuspenseList;
523
- reactIs_development.isAsyncMode = isAsyncMode;
524
- reactIs_development.isConcurrentMode = isConcurrentMode;
525
- reactIs_development.isContextConsumer = isContextConsumer;
526
- reactIs_development.isContextProvider = isContextProvider;
527
- reactIs_development.isElement = isElement;
528
- reactIs_development.isForwardRef = isForwardRef;
529
- reactIs_development.isFragment = isFragment;
530
- reactIs_development.isLazy = isLazy;
531
- reactIs_development.isMemo = isMemo;
532
- reactIs_development.isPortal = isPortal;
533
- reactIs_development.isProfiler = isProfiler;
534
- reactIs_development.isStrictMode = isStrictMode;
535
- reactIs_development.isSuspense = isSuspense;
536
- reactIs_development.isSuspenseList = isSuspenseList;
537
- reactIs_development.isValidElementType = isValidElementType;
538
- reactIs_development.typeOf = typeOf;
539
- })();
540
- }
541
-
542
- if (process.env.NODE_ENV === 'production') {
543
- reactIs.exports = reactIs_production_min;
544
- } else {
545
- reactIs.exports = reactIs_development;
546
- }
547
-
548
- /**
549
- * Flatten list of react nodes removing fragments and adding keys.
550
- * based on: https://github.com/grrowl/react-keyed-flatten-children/blob/5d421644a449765ddd62b659946196b4b5d7b135/index.ts
551
- *
552
- * @param children React nodes to flatten.
553
- * @return Flattened react nodes.
554
- * @deprecated This function was used to develop keyboard navigation in the List component,
555
- * but we will replace this with a better method that does not require to hack the children inspection
556
- *
557
- * TODO: remove List keyboard navigation once we have provided alternative component (Menu, Combobox, etc.),
558
- * remove this function and then remove react-is from the dependencies
559
- */
560
- function flattenChildren(children) {
561
- function recur(nodes, keys = []) {
562
- return Children.toArray(nodes).reduce((acc, node, index) => {
563
- const nodeKeys = keys.concat(node?.key ?? index);
564
- if (reactIs.exports.isFragment(node)) {
565
- acc.push(...recur(node.props.children, nodeKeys));
566
- } else if (/*#__PURE__*/isValidElement(node)) {
567
- acc.push(/*#__PURE__*/cloneElement(node, {
568
- key: nodeKeys.join('.')
569
- }));
570
- } else if (typeof node === 'string' || typeof node === 'number') {
571
- acc.push(node);
572
- }
573
- return acc;
574
- }, []);
575
- }
576
- return recur(children);
577
- }
578
-
579
- const INITIAL_INDEX = -1;
580
- function onKeyboardFocus(props, handler) {
581
- let isMouseDown = false;
582
- return {
583
- onFocus(evt) {
584
- props.onFocus?.(evt);
585
- if (!isMouseDown) {
586
- handler(evt);
587
- }
588
- },
589
- onMouseDown(evt) {
590
- props.onMouseDown?.(evt);
591
- isMouseDown = true;
592
- },
593
- onMouseUp(evt) {
594
- props.onMouseUp?.(evt);
595
- isMouseDown = false;
596
- }
597
- };
598
- }
599
- const isNavigableItem = node => {
600
- return isComponent('ListItem')(node) && isClickable(node.props) && !node.props.isDisabled;
601
- };
602
-
603
- /**
604
- * This custom hook detects clickable list item in a list and make them navigable with the keyboard.
605
- *
606
- * @param options See {@link Options}
607
- * @return See {@link Output}
608
- */
609
- const useInteractiveList = options => {
610
- const {
611
- ref,
612
- onListItemSelected,
613
- onListItemNavigated
614
- } = options;
615
- const items = useMemo(() => flattenChildren(options.items), [options.items]);
616
- const [activeItemIndex, setActiveItemIndex] = useState(INITIAL_INDEX);
617
-
618
- // Attach listeners to the list.
619
- useEffect(() => {
620
- const {
621
- current: listElement
622
- } = ref;
623
- if (!listElement) {
624
- return undefined;
625
- }
626
-
627
- /**
628
- * This function calculates the next index in the list to be active
629
- * @param index current index
630
- * @param code key code pressed
631
- * @return next index
632
- */
633
- const getNextIndex = (index, key) => {
634
- switch (key) {
635
- case 'ArrowDown':
636
- return index + 1 < items.length ? index + 1 : 0;
637
- case 'ArrowUp':
638
- return index - 1 >= 0 ? index - 1 : items.length - 1;
639
- default:
640
- return INITIAL_INDEX;
641
- }
642
- };
643
-
644
- /**
645
- * Resets the active index to the initial state
646
- */
647
- const resetActiveIndex = () => {
648
- setActiveItemIndex(INITIAL_INDEX);
649
- };
650
-
651
- /**
652
- * Handles navigation with the arrows using the keyboard
653
- * @param evt Key event
654
- */
655
- const onArrowPressed = evt => {
656
- const {
657
- key
658
- } = evt;
659
- if (key !== 'ArrowUp' && key !== 'ArrowDown') {
660
- return;
661
- }
662
- let nextIndex = activeItemIndex;
663
- let iterations = 0;
664
-
665
- // Move to next navigable item.
666
- do {
667
- nextIndex = getNextIndex(nextIndex, key);
668
- iterations += 1;
669
- } while (nextIndex !== INITIAL_INDEX && nextIndex !== activeItemIndex && !isNavigableItem(items[nextIndex]) && iterations < items.length);
670
- setActiveItemIndex(nextIndex);
671
- evt.preventDefault();
672
- evt.stopPropagation();
673
- onListItemNavigated?.(nextIndex, items[nextIndex]?.key);
674
- };
675
-
676
- /**
677
- * Reset active list item index when focusing outside the list.
678
- * @param evt Focus out event
679
- */
680
- const onFocusOut = evt => {
681
- if (!evt.relatedTarget || !listElement.contains(evt.relatedTarget)) {
682
- resetActiveIndex();
683
- }
684
- };
685
- listElement.addEventListener('focusout', onFocusOut);
686
- listElement.addEventListener('keydown', onArrowPressed);
687
- return () => {
688
- listElement.removeEventListener('focusout', onFocusOut);
689
- listElement.removeEventListener('keydown', onArrowPressed);
690
- };
691
- }, [ref, activeItemIndex, items, onListItemNavigated]);
692
- return useMemo(() => {
693
- let hasClickableItem = false;
694
- const transformedItems = items.map((item, index) => {
695
- // Ignore if list not clickable or item is not a simple list item.
696
- if (!isNavigableItem(item)) {
697
- return item;
698
- }
699
- hasClickableItem = true;
700
- const isHighlighted = index === activeItemIndex;
701
-
702
- // Clone list item: inject ref, add tab index and active state.
703
- return /*#__PURE__*/cloneElement(item, {
704
- ...item.props,
705
- isHighlighted: item.props.isHighlighted ?? isHighlighted,
706
- linkRef: mergeRefs(item.props.linkRef, element => {
707
- if (isHighlighted) {
708
- element?.focus();
709
- }
710
- }),
711
- onItemSelected(evt) {
712
- item.props.onItemSelected?.();
713
- onListItemSelected?.(index, item.key, evt);
714
- },
715
- ...onKeyboardFocus(item.props, () => {
716
- setActiveItemIndex(index);
717
- })
718
- });
719
- });
720
- return {
721
- items: transformedItems,
722
- hasClickableItem
723
- };
724
- }, [items, activeItemIndex, onListItemSelected]);
725
- };
726
-
727
- /**
728
- * Component display name.
729
- */
730
- const COMPONENT_NAME = 'List';
731
-
732
- /**
733
- * Component default class name and class prefix.
734
- */
735
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
736
-
737
- /**
738
- * Component default props.
739
- */
740
- const DEFAULT_PROPS = {
741
- tabIndex: -1
742
- };
743
-
744
- /* eslint-disable jsx-a11y/no-noninteractive-tabindex */
745
- /**
746
- * List component.
747
- *
748
- * @param props Component props.
749
- * @param ref Component ref.
750
- * @return React element.
751
- */
752
- const InternalList = forwardRef((props, ref) => {
753
- const {
754
- children,
755
- className,
756
- isClickable,
757
- itemPadding,
758
- onListItemSelected,
759
- tabIndex = DEFAULT_PROPS.tabIndex,
760
- ...forwardedProps
761
- } = props;
762
- const listElementRef = useRef(null);
763
- const {
764
- items,
765
- hasClickableItem
766
- } = useInteractiveList({
767
- items: children,
768
- ref: listElementRef,
769
- onListItemSelected
770
- });
771
- const clickable = hasClickableItem || isClickable;
772
- return /*#__PURE__*/jsx("ul", {
773
- ...forwardedProps,
774
- className: classNames(className, handleBasicClasses({
775
- prefix: CLASSNAME,
776
- itemPadding: itemPadding ?? (clickable ? Size.big : undefined)
777
- })),
778
- tabIndex: tabIndex,
779
- ref: mergeRefs(ref, listElementRef),
780
- children: items
781
- });
782
- });
783
- InternalList.displayName = COMPONENT_NAME;
784
- InternalList.className = CLASSNAME;
785
- InternalList.defaultProps = DEFAULT_PROPS;
786
- const List = Object.assign(InternalList, {
787
- useKeyboardListNavigation
788
- });
789
-
790
- export { List as L, ListItem as a, isClickable as i };
791
- //# sourceMappingURL=List-dbf4297f.js.map