@lumx/react 3.20.1-alpha.28 → 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 +3 -3
  4. package/utils/index.js +158 -3
  5. package/utils/index.js.map +1 -1
  6. package/_internal/Button-5a87fee9.js +0 -97
  7. package/_internal/Button-5a87fee9.js.map +0 -1
  8. package/_internal/ButtonRoot-bf682215.js +0 -117
  9. package/_internal/ButtonRoot-bf682215.js.map +0 -1
  10. package/_internal/Chip-8d0aae06.js +0 -143
  11. package/_internal/Chip-8d0aae06.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-351389b0.js +0 -77
  19. package/_internal/IconButton-351389b0.js.map +0 -1
  20. package/_internal/ImageCaption-4109b433.js +0 -75
  21. package/_internal/ImageCaption-4109b433.js.map +0 -1
  22. package/_internal/List-b7882a99.js +0 -817
  23. package/_internal/List-b7882a99.js.map +0 -1
  24. package/_internal/PopoverDialog-2e7b9ed5.js +0 -655
  25. package/_internal/PopoverDialog-2e7b9ed5.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-83646e84.js +0 -679
  31. package/_internal/Slides-83646e84.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-741501a5.js +0 -314
  35. package/_internal/Thumbnail-741501a5.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-5df4f133.js +0 -163
  47. package/_internal/components/alert-dialog-5df4f133.js.map +0 -1
  48. package/_internal/components/autocomplete-824c779e.js +0 -261
  49. package/_internal/components/autocomplete-824c779e.js.map +0 -1
  50. package/_internal/components/avatar-69b66f01.js +0 -83
  51. package/_internal/components/avatar-69b66f01.js.map +0 -1
  52. package/_internal/components/badge-63cd3b1c.js +0 -81
  53. package/_internal/components/badge-63cd3b1c.js.map +0 -1
  54. package/_internal/components/button-eebd4e00.js +0 -47
  55. package/_internal/components/button-eebd4e00.js.map +0 -1
  56. package/_internal/components/checkbox-54943a02.js +0 -143
  57. package/_internal/components/checkbox-54943a02.js.map +0 -1
  58. package/_internal/components/chip-9ad6b318.js +0 -102
  59. package/_internal/components/chip-9ad6b318.js.map +0 -1
  60. package/_internal/components/comment-block-55a4ab3c.js +0 -138
  61. package/_internal/components/comment-block-55a4ab3c.js.map +0 -1
  62. package/_internal/components/date-picker-a824a3ae.js +0 -2
  63. package/_internal/components/date-picker-a824a3ae.js.map +0 -1
  64. package/_internal/components/dialog-5e6320b8.js +0 -238
  65. package/_internal/components/dialog-5e6320b8.js.map +0 -1
  66. package/_internal/components/divider-bdf11ba3.js +0 -50
  67. package/_internal/components/divider-bdf11ba3.js.map +0 -1
  68. package/_internal/components/drag-handle-45912fd3.js +0 -52
  69. package/_internal/components/drag-handle-45912fd3.js.map +0 -1
  70. package/_internal/components/dropdown-0216211d.js +0 -147
  71. package/_internal/components/dropdown-0216211d.js.map +0 -1
  72. package/_internal/components/expansion-panel-3ce73c6b.js +0 -167
  73. package/_internal/components/expansion-panel-3ce73c6b.js.map +0 -1
  74. package/_internal/components/flag-1b177f78.js +0 -59
  75. package/_internal/components/flag-1b177f78.js.map +0 -1
  76. package/_internal/components/flex-box-93b97715.js +0 -56
  77. package/_internal/components/flex-box-93b97715.js.map +0 -1
  78. package/_internal/components/generic-block-925f7c5b.js +0 -128
  79. package/_internal/components/generic-block-925f7c5b.js.map +0 -1
  80. package/_internal/components/grid-95fd1493.js +0 -104
  81. package/_internal/components/grid-95fd1493.js.map +0 -1
  82. package/_internal/components/grid-column-43f28cfb.js +0 -58
  83. package/_internal/components/grid-column-43f28cfb.js.map +0 -1
  84. package/_internal/components/heading-45d6e78e.js +0 -53
  85. package/_internal/components/heading-45d6e78e.js.map +0 -1
  86. package/_internal/components/icon-79195151.js +0 -2
  87. package/_internal/components/icon-79195151.js.map +0 -1
  88. package/_internal/components/image-block-aba6d2db.js +0 -110
  89. package/_internal/components/image-block-aba6d2db.js.map +0 -1
  90. package/_internal/components/image-lightbox-8b8e77c2.js +0 -759
  91. package/_internal/components/image-lightbox-8b8e77c2.js.map +0 -1
  92. package/_internal/components/inline-list-dfb9fd34.js +0 -74
  93. package/_internal/components/inline-list-dfb9fd34.js.map +0 -1
  94. package/_internal/components/input-helper-c8a0078b.js +0 -71
  95. package/_internal/components/input-helper-c8a0078b.js.map +0 -1
  96. package/_internal/components/input-label-9711398b.js +0 -59
  97. package/_internal/components/input-label-9711398b.js.map +0 -1
  98. package/_internal/components/lightbox-894abe64.js +0 -155
  99. package/_internal/components/lightbox-894abe64.js.map +0 -1
  100. package/_internal/components/link-e70e64ed.js +0 -72
  101. package/_internal/components/link-e70e64ed.js.map +0 -1
  102. package/_internal/components/link-preview-e56f3570.js +0 -117
  103. package/_internal/components/link-preview-e56f3570.js.map +0 -1
  104. package/_internal/components/list-59b7ce56.js +0 -71
  105. package/_internal/components/list-59b7ce56.js.map +0 -1
  106. package/_internal/components/message-a255dfd3.js +0 -98
  107. package/_internal/components/message-a255dfd3.js.map +0 -1
  108. package/_internal/components/mosaic-192f2270.js +0 -94
  109. package/_internal/components/mosaic-192f2270.js.map +0 -1
  110. package/_internal/components/navigation-dfe8aac0.js +0 -225
  111. package/_internal/components/navigation-dfe8aac0.js.map +0 -1
  112. package/_internal/components/notification-10f289b5.js +0 -143
  113. package/_internal/components/notification-10f289b5.js.map +0 -1
  114. package/_internal/components/popover-6c7f745b.js +0 -3
  115. package/_internal/components/popover-6c7f745b.js.map +0 -1
  116. package/_internal/components/post-block-f7dcc6e9.js +0 -109
  117. package/_internal/components/post-block-f7dcc6e9.js.map +0 -1
  118. package/_internal/components/progress-7a05fb0c.js +0 -182
  119. package/_internal/components/progress-7a05fb0c.js.map +0 -1
  120. package/_internal/components/progress-tracker-48876add.js +0 -309
  121. package/_internal/components/progress-tracker-48876add.js.map +0 -1
  122. package/_internal/components/radio-button-07cf45e9.js +0 -149
  123. package/_internal/components/radio-button-07cf45e9.js.map +0 -1
  124. package/_internal/components/select-8b54a444.js +0 -457
  125. package/_internal/components/select-8b54a444.js.map +0 -1
  126. package/_internal/components/side-navigation-7eeed3b4.js +0 -164
  127. package/_internal/components/side-navigation-7eeed3b4.js.map +0 -1
  128. package/_internal/components/skeleton-a4e84085.js +0 -166
  129. package/_internal/components/skeleton-a4e84085.js.map +0 -1
  130. package/_internal/components/slider-5d64b470.js +0 -311
  131. package/_internal/components/slider-5d64b470.js.map +0 -1
  132. package/_internal/components/slideshow-bce65cf6.js +0 -151
  133. package/_internal/components/slideshow-bce65cf6.js.map +0 -1
  134. package/_internal/components/switch-7ae55d89.js +0 -121
  135. package/_internal/components/switch-7ae55d89.js.map +0 -1
  136. package/_internal/components/table-5bdf4aec.js +0 -297
  137. package/_internal/components/table-5bdf4aec.js.map +0 -1
  138. package/_internal/components/tabs-2ad54592.js +0 -298
  139. package/_internal/components/tabs-2ad54592.js.map +0 -1
  140. package/_internal/components/text-09c81111.js +0 -2
  141. package/_internal/components/text-09c81111.js.map +0 -1
  142. package/_internal/components/text-field-3e1030f0.js +0 -359
  143. package/_internal/components/text-field-3e1030f0.js.map +0 -1
  144. package/_internal/components/thumbnail-1c5828b9.js +0 -42
  145. package/_internal/components/thumbnail-1c5828b9.js.map +0 -1
  146. package/_internal/components/toolbar-0d14efb7.js +0 -61
  147. package/_internal/components/toolbar-0d14efb7.js.map +0 -1
  148. package/_internal/components/tooltip-31181a24.js +0 -327
  149. package/_internal/components/tooltip-31181a24.js.map +0 -1
  150. package/_internal/components/uploader-845b2412.js +0 -153
  151. package/_internal/components/uploader-845b2412.js.map +0 -1
  152. package/_internal/components/user-block-91c30797.js +0 -144
  153. package/_internal/components/user-block-91c30797.js.map +0 -1
  154. package/_internal/constants-9b714e31.js +0 -2167
  155. package/_internal/constants-9b714e31.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-d0e90329.js +0 -82
  161. package/_internal/forwardRef-d0e90329.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-68e1b0af.js +0 -436
  165. package/_internal/index-68e1b0af.js.map +0 -1
  166. package/_internal/index-745f94ee.js +0 -103
  167. package/_internal/index-745f94ee.js.map +0 -1
  168. package/_internal/index-ab520e78.js +0 -117
  169. package/_internal/index-ab520e78.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-e6038f72.js +0 -20
  197. package/_internal/wrapChildrenIconWithSpaces-e6038f72.js.map +0 -1
@@ -1,436 +0,0 @@
1
- import React__default, { useState, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
2
- import { f as forwardRef, c as classNames } from './forwardRef-d0e90329.js';
3
- import { u as useCallbackOnEscape } from './useCallbackOnEscape-0b220f9c.js';
4
- import { C as ClickAwayProvider } from './ClickAwayProvider-1204f237.js';
5
- import { D as DOCUMENT, W as WINDOW } from './constants-d0e3f49e.js';
6
- import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
7
- import { u as useMergeRefs } from './mergeRefs-f0d7d6ea.js';
8
- import { g as getFirstAndLastFocusable, u as useFocusTrap } from './useFocusTrap-3114e5e8.js';
9
- import { jsx, jsxs } from 'react/jsx-runtime';
10
- import { T as ThemeProvider } from './ThemeContext-3181f000.js';
11
- import memoize from 'lodash/memoize';
12
- import { A as ARROW_SIZE, u as usePopper, d as detectOverflow, F as FitAnchorWidth, P as Placement, a as POPOVER_ZINDEX } from './constants-9b714e31.js';
13
- import { P as Portal } from './Portal-3f86608e.js';
14
-
15
- /**
16
- * Hook focusing an element when defined and `focus` boolean `true`.
17
- *
18
- * @param element Element to focus.
19
- * @param shouldFocus Boolean flag to trigger the focus
20
- */
21
- function useFocus(element, shouldFocus = true) {
22
- const [wasFocus, setWasFocus] = useState(false);
23
- useEffect(() => {
24
- if (shouldFocus && wasFocus !== shouldFocus && element) {
25
- element.focus();
26
- setWasFocus(shouldFocus);
27
- }
28
- },
29
- // eslint-disable-next-line react-hooks/exhaustive-deps
30
- [element, shouldFocus]);
31
- }
32
-
33
- /**
34
- * HOC component wrapping a component to skip render if predicate return falsy
35
- */
36
- const skipRender = (predicate, Component) => {
37
- const Wrapper = /*#__PURE__*/React__default.forwardRef((props, ref) => {
38
- if (!DOCUMENT) {
39
- // Can't render in SSR.
40
- return null;
41
- }
42
- return /*#__PURE__*/jsx(Component, {
43
- ref: ref,
44
- ...props
45
- });
46
- });
47
- Wrapper.displayName = Component.displayName;
48
- return Wrapper;
49
- };
50
-
51
- /**
52
- * Helper component using useLayoutEffect to trigger a callback on before unmount.
53
- *
54
- * The callback must be wrapped in a React ref to avoid updating the `useLayoutEffect` before the un-mount
55
- */
56
- const OnBeforeUnmount = ({
57
- callbackRef
58
- }) => {
59
- useLayoutEffect(() => {
60
- return () => {
61
- // On unmount
62
- // eslint-disable-next-line react-hooks/exhaustive-deps
63
- callbackRef.current?.();
64
- };
65
- },
66
- // eslint-disable-next-line react-hooks/exhaustive-deps
67
- []);
68
- return null;
69
- };
70
-
71
- /**
72
- * Provides an unmount sentinel to inject in the popover to detect when it closes and restore the focus to the
73
- * anchor if needed.
74
- */
75
- function useRestoreFocusOnClose({
76
- focusAnchorOnClose,
77
- anchorRef,
78
- parentElement
79
- }, popoverElement) {
80
- const onBeforeUnmountRef = React__default.useRef();
81
- React__default.useEffect(() => {
82
- if (!popoverElement || !focusAnchorOnClose) {
83
- onBeforeUnmountRef.current = undefined;
84
- return;
85
- }
86
- onBeforeUnmountRef.current = () => {
87
- const isFocusWithin = popoverElement?.contains(document.activeElement);
88
- if (!isFocusWithin) return;
89
-
90
- // On next render
91
- setTimeout(() => {
92
- const anchor = anchorRef.current;
93
- const elementToFocus =
94
- // Provided parent element
95
- parentElement?.current || (
96
- // Or first focusable element in anchor
97
- anchor ? getFirstAndLastFocusable(anchor).first : undefined) ||
98
- // Fallback to anchor
99
- anchor;
100
- elementToFocus?.focus({
101
- preventScroll: true
102
- });
103
- }, 0);
104
- };
105
- }, [anchorRef, focusAnchorOnClose, parentElement, popoverElement]);
106
- return /*#__PURE__*/jsx(OnBeforeUnmount, {
107
- callbackRef: onBeforeUnmountRef
108
- });
109
- }
110
-
111
- /**
112
- * Popper js modifier to fit popover min width to the anchor width.
113
- */
114
- const sameWidth = memoize(anchorWidthOption => ({
115
- name: 'sameWidth',
116
- enabled: true,
117
- phase: 'beforeWrite',
118
- requires: ['computeStyles'],
119
- fn({
120
- state
121
- }) {
122
- // eslint-disable-next-line no-param-reassign
123
- state.styles.popper[anchorWidthOption] = `${state.rects.reference.width}px`;
124
- },
125
- effect({
126
- state
127
- }) {
128
- // eslint-disable-next-line no-param-reassign
129
- state.elements.popper.style[anchorWidthOption] = `${state.elements.reference.offsetWidth}px`;
130
- }
131
- }));
132
-
133
- /**
134
- * Popper js modifier to compute max size of the popover.
135
- */
136
- const maxSize = {
137
- name: 'maxSize',
138
- enabled: true,
139
- phase: 'main',
140
- requiresIfExists: ['offset', 'preventOverflow', 'flip'],
141
- fn({
142
- state,
143
- name,
144
- options
145
- }) {
146
- const overflow = detectOverflow(state, options);
147
- const {
148
- y = 0,
149
- x = 0
150
- } = state.modifiersData.preventOverflow;
151
- const {
152
- width,
153
- height
154
- } = state.rects.popper;
155
- const [basePlacement] = state.placement.split('-');
156
- const widthProp = basePlacement === 'left' ? 'left' : 'right';
157
- const heightProp = basePlacement === 'top' ? 'top' : 'bottom';
158
- // eslint-disable-next-line no-param-reassign
159
- state.modifiersData[name] = {
160
- width: width - overflow[widthProp] - x,
161
- height: height - overflow[heightProp] - y
162
- };
163
- }
164
- };
165
-
166
- /**
167
- * Popper js modifier to apply the max height.
168
- */
169
- const applyMaxHeight = {
170
- name: 'applyMaxHeight',
171
- enabled: true,
172
- phase: 'beforeWrite',
173
- requires: ['maxSize'],
174
- fn({
175
- state
176
- }) {
177
- const {
178
- height
179
- } = state.modifiersData.maxSize;
180
- // eslint-disable-next-line no-param-reassign
181
- state.elements.popper.style.maxHeight = `${height - ARROW_SIZE}px`;
182
- }
183
- };
184
- function usePopoverStyle({
185
- offset,
186
- hasArrow,
187
- fitToAnchorWidth,
188
- fitWithinViewportHeight,
189
- boundaryRef,
190
- anchorRef,
191
- placement,
192
- style,
193
- zIndex
194
- }) {
195
- const [popperElement, setPopperElement] = useState(null);
196
- const [arrowElement, setArrowElement] = useState(null);
197
- const actualOffset = [offset?.along ?? 0, (offset?.away ?? 0) + (hasArrow ? ARROW_SIZE : 0)];
198
- const modifiers = [{
199
- name: 'offset',
200
- options: {
201
- offset: actualOffset
202
- }
203
- }];
204
- if (hasArrow && arrowElement) {
205
- modifiers.push({
206
- name: 'arrow',
207
- options: {
208
- element: arrowElement,
209
- padding: ARROW_SIZE / 2
210
- }
211
- });
212
- }
213
- if (fitToAnchorWidth) {
214
- const fitWidth = typeof fitToAnchorWidth === 'string' ? fitToAnchorWidth : FitAnchorWidth.MIN_WIDTH;
215
- modifiers.push(sameWidth(fitWidth));
216
- }
217
- if (fitWithinViewportHeight) {
218
- modifiers.push({
219
- ...maxSize,
220
- options: {
221
- boundary: boundaryRef?.current
222
- }
223
- }, applyMaxHeight);
224
- }
225
- if (boundaryRef) {
226
- modifiers.push({
227
- name: 'flip',
228
- options: {
229
- boundary: boundaryRef.current
230
- }
231
- }, {
232
- name: 'preventOverflow',
233
- options: {
234
- boundary: boundaryRef.current
235
- }
236
- });
237
- }
238
- const {
239
- styles,
240
- attributes,
241
- state,
242
- update
243
- } = usePopper(anchorRef.current, popperElement, {
244
- placement,
245
- modifiers
246
- });
247
-
248
- // Auto update popover
249
- useEffect(() => {
250
- const {
251
- current: anchorElement
252
- } = anchorRef;
253
- if (!update || !popperElement || !anchorElement || !WINDOW?.ResizeObserver) {
254
- return undefined;
255
- }
256
- let running;
257
- function updateRateLimited() {
258
- if (running) return;
259
- update?.();
260
- running = setTimeout(() => {
261
- running = undefined;
262
- }, 100);
263
- }
264
- updateRateLimited();
265
-
266
- // On anchor or popover resize
267
- const resizeObserver = new ResizeObserver(updateRateLimited);
268
- resizeObserver.observe(anchorElement);
269
- resizeObserver.observe(popperElement);
270
- return () => {
271
- resizeObserver.disconnect();
272
- };
273
- }, [anchorRef, popperElement, update]);
274
- const position = state?.placement ?? placement;
275
- const popoverStyle = useMemo(() => {
276
- const newStyles = {
277
- ...style,
278
- ...styles.popper,
279
- zIndex
280
- };
281
- if (fitWithinViewportHeight && !newStyles.maxHeight) {
282
- newStyles.maxHeight = WINDOW?.innerHeight || DOCUMENT?.documentElement.clientHeight;
283
- }
284
- return newStyles;
285
- }, [style, styles.popper, zIndex, fitWithinViewportHeight]);
286
- return {
287
- styles: {
288
- arrow: styles.arrow,
289
- popover: popoverStyle
290
- },
291
- attributes,
292
- isPositioned: (state?.rects?.popper?.y ?? -1) >= 0,
293
- position,
294
- setArrowElement,
295
- setPopperElement,
296
- popperElement
297
- };
298
- }
299
-
300
- /**
301
- * Component display name.
302
- */
303
- const COMPONENT_NAME = 'Popover';
304
-
305
- /**
306
- * Component default class name and class prefix.
307
- */
308
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
309
-
310
- /**
311
- * Component default props.
312
- */
313
- const DEFAULT_PROPS = {
314
- elevation: 3,
315
- placement: Placement.AUTO,
316
- focusAnchorOnClose: true,
317
- usePortal: true,
318
- zIndex: POPOVER_ZINDEX
319
- };
320
-
321
- // Inner component (must be wrapped before export)
322
- const _InnerPopover = forwardRef((props, ref) => {
323
- const {
324
- anchorRef,
325
- as: Component = 'div',
326
- children,
327
- className,
328
- closeOnClickAway,
329
- closeOnEscape,
330
- elevation = DEFAULT_PROPS.elevation,
331
- focusElement,
332
- hasArrow,
333
- isOpen,
334
- onClose,
335
- parentElement,
336
- usePortal = DEFAULT_PROPS.usePortal,
337
- focusAnchorOnClose = DEFAULT_PROPS.focusAnchorOnClose,
338
- withFocusTrap,
339
- boundaryRef,
340
- fitToAnchorWidth,
341
- fitWithinViewportHeight,
342
- focusTrapZoneElement,
343
- offset,
344
- placement = DEFAULT_PROPS.placement,
345
- style,
346
- theme,
347
- zIndex = DEFAULT_PROPS.zIndex,
348
- ...forwardedProps
349
- } = props;
350
- const popoverRef = useRef(null);
351
- const {
352
- styles,
353
- attributes,
354
- isPositioned,
355
- position,
356
- setArrowElement,
357
- setPopperElement,
358
- popperElement
359
- } = usePopoverStyle({
360
- offset,
361
- hasArrow,
362
- fitToAnchorWidth,
363
- fitWithinViewportHeight,
364
- boundaryRef,
365
- anchorRef,
366
- placement,
367
- style,
368
- zIndex
369
- });
370
- const unmountSentinel = useRestoreFocusOnClose({
371
- focusAnchorOnClose,
372
- anchorRef,
373
- parentElement
374
- }, popperElement);
375
- const focusZoneElement = focusTrapZoneElement?.current || popoverRef?.current;
376
- useCallbackOnEscape(onClose, isOpen && closeOnEscape);
377
-
378
- /** Only set focus within if the focus trap is disabled as they interfere with one another. */
379
- useFocus(focusElement?.current, !withFocusTrap && isOpen && isPositioned);
380
- useFocusTrap(withFocusTrap && isOpen && focusZoneElement, focusElement?.current);
381
- const clickAwayRefs = useRef([popoverRef, anchorRef]);
382
- const mergedRefs = useMergeRefs(setPopperElement, ref, popoverRef);
383
- return isOpen ? /*#__PURE__*/jsx(Portal, {
384
- enabled: usePortal,
385
- children: /*#__PURE__*/jsxs(Component, {
386
- ...forwardedProps,
387
- ref: mergedRefs,
388
- className: classNames(className, handleBasicClasses({
389
- prefix: CLASSNAME,
390
- theme,
391
- elevation: Math.min(elevation || 0, 5),
392
- position,
393
- isInitializing: !styles.popover?.transform
394
- })),
395
- style: styles.popover,
396
- ...attributes.popper,
397
- children: [unmountSentinel, /*#__PURE__*/jsxs(ClickAwayProvider, {
398
- callback: closeOnClickAway && onClose,
399
- childrenRefs: clickAwayRefs,
400
- children: [hasArrow && /*#__PURE__*/jsx("div", {
401
- ref: setArrowElement,
402
- className: `${CLASSNAME}__arrow`,
403
- style: styles.arrow,
404
- children: /*#__PURE__*/jsx("svg", {
405
- viewBox: "0 0 14 14",
406
- "aria-hidden": true,
407
- children: /*#__PURE__*/jsx("path", {
408
- d: "M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z"
409
- })
410
- })
411
- }), /*#__PURE__*/jsx(ThemeProvider, {
412
- value: theme,
413
- children: children
414
- })]
415
- })]
416
- })
417
- }) : null;
418
- });
419
- _InnerPopover.displayName = COMPONENT_NAME;
420
-
421
- /**
422
- * Popover component.
423
- *
424
- * @param props Component props.
425
- * @param ref Component ref.
426
- * @return React element.
427
- */
428
- const Popover = skipRender(
429
- // Skip render in SSR
430
- () => Boolean(DOCUMENT), _InnerPopover);
431
- Popover.displayName = COMPONENT_NAME;
432
- Popover.className = CLASSNAME;
433
- Popover.defaultProps = DEFAULT_PROPS;
434
-
435
- export { Popover as P, useFocus as u };
436
- //# sourceMappingURL=index-68e1b0af.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-68e1b0af.js","sources":["../../src/hooks/useFocus.tsx","../../src/utils/react/skipRender.tsx","../../src/utils/react/OnBeforeUnmount.tsx","../../src/components/popover/useRestoreFocusOnClose.tsx","../../src/components/popover/usePopoverStyle.tsx","../../src/components/popover/Popover.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Hook focusing an element when defined and `focus` boolean `true`.\n *\n * @param element Element to focus.\n * @param shouldFocus Boolean flag to trigger the focus\n */\nexport function useFocus(element: HTMLElement | null | undefined, shouldFocus = true): void {\n const [wasFocus, setWasFocus] = useState(false);\n useEffect(\n () => {\n if (shouldFocus && wasFocus !== shouldFocus && element) {\n element.focus();\n setWasFocus(shouldFocus);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, shouldFocus],\n );\n}\n","import React from 'react';\n\nimport { DOCUMENT } from '@lumx/react/constants';\nimport type { Comp } from '@lumx/react/utils/type';\n/**\n * HOC component wrapping a component to skip render if predicate return falsy\n */\nexport const skipRender = <P, T>(predicate: (props: P) => any, Component: Comp<P, T>) => {\n const Wrapper = React.forwardRef<T, P>((props, ref) => {\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n return <Component ref={ref} {...props} />;\n });\n Wrapper.displayName = Component.displayName;\n return Wrapper;\n};\n","import { useLayoutEffect } from 'react';\n\n/**\n * Helper component using useLayoutEffect to trigger a callback on before unmount.\n *\n * The callback must be wrapped in a React ref to avoid updating the `useLayoutEffect` before the un-mount\n */\nexport const OnBeforeUnmount = ({ callbackRef }: { callbackRef: React.RefObject<(() => void) | undefined> }) => {\n useLayoutEffect(\n () => {\n return () => {\n // On unmount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n callbackRef.current?.();\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n return null;\n};\n","import React from 'react';\nimport { getFirstAndLastFocusable } from '@lumx/react/utils/browser/focus/getFirstAndLastFocusable';\nimport { OnBeforeUnmount } from '@lumx/react/utils/react/OnBeforeUnmount';\nimport type { PopoverProps } from './Popover';\n\n/**\n * Provides an unmount sentinel to inject in the popover to detect when it closes and restore the focus to the\n * anchor if needed.\n */\nexport function useRestoreFocusOnClose(\n {\n focusAnchorOnClose,\n anchorRef,\n parentElement,\n }: Pick<PopoverProps, 'focusAnchorOnClose' | 'anchorRef' | 'parentElement'>,\n popoverElement?: HTMLElement | null,\n) {\n const onBeforeUnmountRef = React.useRef<(() => void) | undefined>();\n\n React.useEffect(() => {\n if (!popoverElement || !focusAnchorOnClose) {\n onBeforeUnmountRef.current = undefined;\n return;\n }\n\n onBeforeUnmountRef.current = () => {\n const isFocusWithin = popoverElement?.contains(document.activeElement);\n if (!isFocusWithin) return;\n\n // On next render\n setTimeout(() => {\n const anchor = anchorRef.current;\n const elementToFocus =\n // Provided parent element\n parentElement?.current ||\n // Or first focusable element in anchor\n (anchor ? getFirstAndLastFocusable(anchor).first : undefined) ||\n // Fallback to anchor\n anchor;\n\n elementToFocus?.focus({ preventScroll: true });\n }, 0);\n };\n }, [anchorRef, focusAnchorOnClose, parentElement, popoverElement]);\n\n return <OnBeforeUnmount callbackRef={onBeforeUnmountRef} />;\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport memoize from 'lodash/memoize';\nimport { detectOverflow } from '@popperjs/core';\n\nimport { DOCUMENT, WINDOW } from '@lumx/react/constants';\nimport { PopoverProps } from '@lumx/react/components/popover/Popover';\nimport { usePopper } from '@lumx/react/hooks/usePopper';\nimport { ARROW_SIZE, FitAnchorWidth, Placement } from './constants';\n\n/**\n * Popper js modifier to fit popover min width to the anchor width.\n */\nconst sameWidth = memoize((anchorWidthOption: FitAnchorWidth) => ({\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn({ state }: any) {\n // eslint-disable-next-line no-param-reassign\n state.styles.popper[anchorWidthOption] = `${state.rects.reference.width}px`;\n },\n effect({ state }: any) {\n // eslint-disable-next-line no-param-reassign\n state.elements.popper.style[anchorWidthOption] = `${state.elements.reference.offsetWidth}px`;\n },\n}));\n\n/**\n * Popper js modifier to compute max size of the popover.\n */\nconst maxSize = {\n name: 'maxSize',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n fn({ state, name, options }: any) {\n const overflow = detectOverflow(state, options);\n\n const { y = 0, x = 0 } = state.modifiersData.preventOverflow;\n const { width, height } = state.rects.popper;\n\n const [basePlacement] = state.placement.split('-');\n\n const widthProp = basePlacement === 'left' ? 'left' : 'right';\n const heightProp = basePlacement === 'top' ? 'top' : 'bottom';\n // eslint-disable-next-line no-param-reassign\n state.modifiersData[name] = {\n width: width - overflow[widthProp] - x,\n height: height - overflow[heightProp] - y,\n };\n },\n};\n\n/**\n * Popper js modifier to apply the max height.\n */\nconst applyMaxHeight = {\n name: 'applyMaxHeight',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['maxSize'],\n fn({ state }: any) {\n const { height } = state.modifiersData.maxSize;\n // eslint-disable-next-line no-param-reassign\n state.elements.popper.style.maxHeight = `${height - ARROW_SIZE}px`;\n },\n};\n\ntype Options = Pick<\n PopoverProps,\n | 'offset'\n | 'hasArrow'\n | 'fitToAnchorWidth'\n | 'fitWithinViewportHeight'\n | 'boundaryRef'\n | 'anchorRef'\n | 'placement'\n | 'style'\n | 'zIndex'\n>;\n\ninterface Output {\n styles: { arrow?: React.CSSProperties; popover?: React.CSSProperties };\n attributes: any;\n isPositioned: boolean;\n position?: Placement;\n setArrowElement?: React.Ref<HTMLDivElement>;\n setPopperElement?: React.Ref<HTMLDivElement>;\n popperElement: HTMLElement | null;\n}\n\nexport function usePopoverStyle({\n offset,\n hasArrow,\n fitToAnchorWidth,\n fitWithinViewportHeight,\n boundaryRef,\n anchorRef,\n placement,\n style,\n zIndex,\n}: Options): Output {\n const [popperElement, setPopperElement] = useState<null | HTMLElement>(null);\n const [arrowElement, setArrowElement] = useState<null | HTMLElement>(null);\n\n const actualOffset: [number, number] = [offset?.along ?? 0, (offset?.away ?? 0) + (hasArrow ? ARROW_SIZE : 0)];\n const modifiers: any = [\n {\n name: 'offset',\n options: { offset: actualOffset },\n },\n ];\n if (hasArrow && arrowElement) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n padding: ARROW_SIZE / 2,\n },\n });\n }\n if (fitToAnchorWidth) {\n const fitWidth = typeof fitToAnchorWidth === 'string' ? fitToAnchorWidth : FitAnchorWidth.MIN_WIDTH;\n modifiers.push(sameWidth(fitWidth));\n }\n if (fitWithinViewportHeight) {\n modifiers.push({ ...maxSize, options: { boundary: boundaryRef?.current } }, applyMaxHeight);\n }\n if (boundaryRef) {\n modifiers.push(\n { name: 'flip', options: { boundary: boundaryRef.current } },\n { name: 'preventOverflow', options: { boundary: boundaryRef.current } },\n );\n }\n\n const { styles, attributes, state, update } = usePopper(anchorRef.current, popperElement, { placement, modifiers });\n\n // Auto update popover\n useEffect(() => {\n const { current: anchorElement } = anchorRef;\n if (!update || !popperElement || !anchorElement || !WINDOW?.ResizeObserver) {\n return undefined;\n }\n let running: ReturnType<typeof setTimeout> | undefined;\n function updateRateLimited() {\n if (running) return;\n update?.();\n running = setTimeout(() => {\n running = undefined;\n }, 100);\n }\n updateRateLimited();\n\n // On anchor or popover resize\n const resizeObserver = new ResizeObserver(updateRateLimited);\n resizeObserver.observe(anchorElement);\n resizeObserver.observe(popperElement);\n return () => {\n resizeObserver.disconnect();\n };\n }, [anchorRef, popperElement, update]);\n\n const position = state?.placement ?? placement;\n\n const popoverStyle = useMemo(() => {\n const newStyles = { ...style, ...styles.popper, zIndex };\n\n if (fitWithinViewportHeight && !newStyles.maxHeight) {\n newStyles.maxHeight = WINDOW?.innerHeight || DOCUMENT?.documentElement.clientHeight;\n }\n\n return newStyles;\n }, [style, styles.popper, zIndex, fitWithinViewportHeight]);\n\n return {\n styles: { arrow: styles.arrow, popover: popoverStyle },\n attributes,\n isPositioned: (state?.rects?.popper?.y ?? -1) >= 0,\n position,\n setArrowElement,\n setPopperElement,\n popperElement,\n };\n}\n","import { ReactNode, RefObject, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useMergeRefs } from '@lumx/react/utils/react/mergeRefs';\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { skipRender } from '@lumx/react/utils/react/skipRender';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { ThemeProvider } from '@lumx/react/utils/theme/ThemeContext';\nimport { Portal } from '@lumx/react/utils';\nimport { useRestoreFocusOnClose } from './useRestoreFocusOnClose';\nimport { usePopoverStyle } from './usePopoverStyle';\nimport { Elevation, FitAnchorWidth, Offset, Placement, POPOVER_ZINDEX } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface PopoverProps extends GenericProps, HasTheme {\n /** Reference to the DOM element used to set the position of the popover. */\n anchorRef: React.RefObject<HTMLElement>;\n /** Customize the root element. (Must accept ref forwarding and props forwarding!). */\n as?: React.ElementType;\n /** Element which will act as boundary when opening the popover. */\n boundaryRef?: RefObject<HTMLElement>;\n /** Content. */\n children: ReactNode;\n /** Whether a click anywhere out of the popover would close it. */\n closeOnClickAway?: boolean;\n /** Whether an escape key press would close the popover. */\n closeOnEscape?: boolean;\n /** Shadow elevation. */\n elevation?: Elevation;\n /**\n * Manage popover width:\n * - `maxWidth`: popover not bigger than anchor\n * - `minWidth` or `true`: popover not smaller than anchor\n * - `width`: popover equal to the anchor.\n */\n fitToAnchorWidth?: FitAnchorWidth | boolean;\n /** Shrink popover if even after flipping there is not enough space. */\n fitWithinViewportHeight?: boolean;\n /** Element to focus when opening the popover. */\n focusElement?: RefObject<HTMLElement>;\n /** Whether the focus should go back on the anchor when popover closes and focus is within. */\n focusAnchorOnClose?: boolean;\n /** Whether we put an arrow or not. */\n hasArrow?: boolean;\n /** Whether the popover is open or not. */\n isOpen: boolean;\n /** Offset placement relative to anchor. */\n offset?: Offset;\n /** Reference to the parent element that triggered the popover (will get back focus on close or else fallback on the anchor element). */\n parentElement?: RefObject<HTMLElement>;\n /** Placement relative to anchor. */\n placement?: Placement;\n /** Whether the popover should be rendered into a DOM node that exists outside the DOM hierarchy of the parent component. */\n usePortal?: boolean;\n /** The element in which the focus trap should be set. Default to popover. */\n focusTrapZoneElement?: RefObject<HTMLElement>;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback (on click away or Escape pressed). */\n onClose?(): void;\n /** Whether the popover should trap the focus within itself. Default to false. */\n withFocusTrap?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Popover';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<PopoverProps> = {\n elevation: 3,\n placement: Placement.AUTO,\n focusAnchorOnClose: true,\n usePortal: true,\n zIndex: POPOVER_ZINDEX,\n};\n\n// Inner component (must be wrapped before export)\nconst _InnerPopover = forwardRef<PopoverProps, HTMLDivElement>((props, ref) => {\n const {\n anchorRef,\n as: Component = 'div',\n children,\n className,\n closeOnClickAway,\n closeOnEscape,\n elevation = DEFAULT_PROPS.elevation,\n focusElement,\n hasArrow,\n isOpen,\n onClose,\n parentElement,\n usePortal = DEFAULT_PROPS.usePortal,\n focusAnchorOnClose = DEFAULT_PROPS.focusAnchorOnClose,\n withFocusTrap,\n boundaryRef,\n fitToAnchorWidth,\n fitWithinViewportHeight,\n focusTrapZoneElement,\n offset,\n placement = DEFAULT_PROPS.placement,\n style,\n theme,\n zIndex = DEFAULT_PROPS.zIndex,\n ...forwardedProps\n } = props;\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const { styles, attributes, isPositioned, position, setArrowElement, setPopperElement, popperElement } =\n usePopoverStyle({\n offset,\n hasArrow,\n fitToAnchorWidth,\n fitWithinViewportHeight,\n boundaryRef,\n anchorRef,\n placement,\n style,\n zIndex,\n });\n\n const unmountSentinel = useRestoreFocusOnClose({ focusAnchorOnClose, anchorRef, parentElement }, popperElement);\n const focusZoneElement = focusTrapZoneElement?.current || popoverRef?.current;\n\n useCallbackOnEscape(onClose, isOpen && closeOnEscape);\n\n /** Only set focus within if the focus trap is disabled as they interfere with one another. */\n useFocus(focusElement?.current, !withFocusTrap && isOpen && isPositioned);\n useFocusTrap(withFocusTrap && isOpen && focusZoneElement, focusElement?.current);\n\n const clickAwayRefs = useRef([popoverRef, anchorRef]);\n const mergedRefs = useMergeRefs<HTMLDivElement>(setPopperElement, ref, popoverRef);\n\n return isOpen ? (\n <Portal enabled={usePortal}>\n <Component\n {...forwardedProps}\n ref={mergedRefs}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n theme,\n elevation: Math.min(elevation || 0, 5),\n position,\n isInitializing: !styles.popover?.transform,\n }),\n )}\n style={styles.popover}\n {...attributes.popper}\n >\n {unmountSentinel}\n <ClickAwayProvider callback={closeOnClickAway && onClose} childrenRefs={clickAwayRefs}>\n {hasArrow && (\n <div ref={setArrowElement} className={`${CLASSNAME}__arrow`} style={styles.arrow}>\n <svg viewBox=\"0 0 14 14\" aria-hidden>\n <path d=\"M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z\" />\n </svg>\n </div>\n )}\n <ThemeProvider value={theme}>{children}</ThemeProvider>\n </ClickAwayProvider>\n </Component>\n </Portal>\n ) : null;\n});\n_InnerPopover.displayName = COMPONENT_NAME;\n\n/**\n * Popover component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Popover: Comp<PopoverProps, HTMLDivElement> = skipRender(\n // Skip render in SSR\n () => Boolean(DOCUMENT),\n _InnerPopover,\n);\nPopover.displayName = COMPONENT_NAME;\nPopover.className = CLASSNAME;\nPopover.defaultProps = DEFAULT_PROPS;\n"],"names":["useFocus","element","shouldFocus","wasFocus","setWasFocus","useState","useEffect","focus","skipRender","predicate","Component","Wrapper","React","forwardRef","props","ref","DOCUMENT","_jsx","displayName","OnBeforeUnmount","callbackRef","useLayoutEffect","current","useRestoreFocusOnClose","focusAnchorOnClose","anchorRef","parentElement","popoverElement","onBeforeUnmountRef","useRef","undefined","isFocusWithin","contains","document","activeElement","setTimeout","anchor","elementToFocus","getFirstAndLastFocusable","first","preventScroll","sameWidth","memoize","anchorWidthOption","name","enabled","phase","requires","fn","state","styles","popper","rects","reference","width","effect","elements","style","offsetWidth","maxSize","requiresIfExists","options","overflow","detectOverflow","y","x","modifiersData","preventOverflow","height","basePlacement","placement","split","widthProp","heightProp","applyMaxHeight","maxHeight","ARROW_SIZE","usePopoverStyle","offset","hasArrow","fitToAnchorWidth","fitWithinViewportHeight","boundaryRef","zIndex","popperElement","setPopperElement","arrowElement","setArrowElement","actualOffset","along","away","modifiers","push","padding","fitWidth","FitAnchorWidth","MIN_WIDTH","boundary","attributes","update","usePopper","anchorElement","WINDOW","ResizeObserver","running","updateRateLimited","resizeObserver","observe","disconnect","position","popoverStyle","useMemo","newStyles","innerHeight","documentElement","clientHeight","arrow","popover","isPositioned","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","elevation","Placement","AUTO","usePortal","POPOVER_ZINDEX","_InnerPopover","as","children","className","closeOnClickAway","closeOnEscape","focusElement","isOpen","onClose","withFocusTrap","focusTrapZoneElement","theme","forwardedProps","popoverRef","unmountSentinel","focusZoneElement","useCallbackOnEscape","useFocusTrap","clickAwayRefs","mergedRefs","useMergeRefs","Portal","_jsxs","classNames","handleBasicClasses","prefix","Math","min","isInitializing","transform","ClickAwayProvider","callback","childrenRefs","viewBox","d","ThemeProvider","value","Popover","Boolean","defaultProps"],"mappings":";;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,QAAQA,CAACC,OAAuC,EAAEC,WAAW,GAAG,IAAI,EAAQ;EACxF,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGC,QAAQ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ACjFnD,QAAQ,iBACL9D,GAAA,CAAA,KAAA,EAAA;AAAKF,UAAAA,GAAG,EAAEwE,eAAgB;UAAC4C,SAAS,EAAE,CAAGX,EAAAA,SAAS,CAAU,OAAA,CAAA;UAAC/D,KAAK,EAAEP,MAAM,CAACkE,KAAM;AAAAc,UAAAA,QAAA,eAC7EjH,GAAA,CAAA,KAAA,EAAA;AAAKgJ,YAAAA,OAAO,EAAC,WAAW;YAAC,aAAW,EAAA,IAAA;AAAA/B,YAAAA,QAAA,eAChCjH,GAAA,CAAA,MAAA,EAAA;AAAMiJ,cAAAA,CAAC,EAAC,+DAAA;aAAiE,CAAA;WACxE,CAAA;AAAC,SACL,CACR,eACDjJ,GAAA,CAACkJ,aAAa,EAAA;AAACC,UAAAA,KAAK,EAAEzB,KAAM;AAAAT,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAgB,CAAC,CAAA;AAAA,OACxC,CAAC,CAAA;KACb,CAAA;GACP,CAAC,GACT,IAAI,CAAA;AACZ,CAAC,CAAC,CAAA;AACFF,aAAa,CAAC9G,WAAW,GAAGqG,cAAc,CAAA;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM8C,OAA2C,GAAG7J,UAAU;AACjE;AACA,MAAM8J,OAAO,CAACtJ,QAAQ,CAAC,EACvBgH,aACJ,EAAC;AACDqC,OAAO,CAACnJ,WAAW,GAAGqG,cAAc,CAAA;AACpC8C,OAAO,CAAClC,SAAS,GAAGX,SAAS,CAAA;AAC7B6C,OAAO,CAACE,YAAY,GAAG7C,aAAa;;;;"}
@@ -1,103 +0,0 @@
1
- import { f as forwardRef, c as classNames } from './forwardRef-d0e90329.js';
2
- import { getRootClassName, resolveColorWithVariants, handleBasicClasses } from '@lumx/core/js/utils/className';
3
- import { u as useTheme } from './ThemeContext-3181f000.js';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
6
-
7
- 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';
8
-
9
- /**
10
- * Component display name.
11
- */
12
- const COMPONENT_NAME = 'Icon';
13
-
14
- /**
15
- * Component default class name and class prefix.
16
- */
17
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
18
-
19
- /**
20
- * Component default props.
21
- */
22
- const DEFAULT_PROPS = {};
23
-
24
- /**
25
- * Icon component.
26
- *
27
- * @param props Component props.
28
- * @param ref Component ref.
29
- * @return React element.
30
- */
31
- const Icon = forwardRef((props, ref) => {
32
- const defaultTheme = useTheme();
33
- const {
34
- className,
35
- color: propColor,
36
- colorVariant: propColorVariant,
37
- hasShape,
38
- icon,
39
- size,
40
- theme = defaultTheme,
41
- alt,
42
- ...forwardedProps
43
- } = props;
44
- const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);
45
-
46
- // Color
47
- let iconColor = color;
48
- if (!iconColor && (hasShape || theme)) {
49
- iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
50
- }
51
-
52
- // Color variant
53
- let iconColorVariant = colorVariant;
54
- if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {
55
- iconColorVariant = 'L2';
56
- }
57
-
58
- // Size
59
- let iconSize = size;
60
- if (size && hasShape) {
61
- if (size === Size.xxs || size === Size.xs) {
62
- iconSize = Size.s;
63
- } else if (size === Size.xxl) {
64
- iconSize = Size.xl;
65
- }
66
- } else if (hasShape) {
67
- iconSize = Size.m;
68
- }
69
- return /*#__PURE__*/jsx("i", {
70
- ref: ref,
71
- ...forwardedProps,
72
- className: classNames(className, handleBasicClasses({
73
- color: iconColor,
74
- colorVariant: iconColorVariant,
75
- hasShape,
76
- prefix: CLASSNAME,
77
- theme,
78
- size: iconSize
79
- }), !hasShape && `${CLASSNAME}--no-shape`, !hasShape && iconColor === ColorPalette.yellow && icon === mdiAlertCircle && `${CLASSNAME}--has-dark-layer`, `${CLASSNAME}--path`),
80
- children: /*#__PURE__*/jsx("svg", {
81
- "aria-hidden": alt ? undefined : 'true',
82
- role: alt ? 'img' : undefined,
83
- "aria-label": alt,
84
- height: "1em",
85
- preserveAspectRatio: "xMidYMid meet",
86
- style: {
87
- verticalAlign: '-0.125em'
88
- },
89
- viewBox: "0 0 24 24",
90
- width: "1em",
91
- children: /*#__PURE__*/jsx("path", {
92
- d: icon,
93
- fill: "currentColor"
94
- })
95
- })
96
- });
97
- });
98
- Icon.displayName = COMPONENT_NAME;
99
- Icon.className = CLASSNAME;
100
- Icon.defaultProps = DEFAULT_PROPS;
101
-
102
- export { Icon as I, mdiAlertCircle as m };
103
- //# sourceMappingURL=index-745f94ee.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-745f94ee.js","sources":["../../../lumx-icons/dist/esm/alert-circle.js","../../src/components/icon/Icon.tsx"],"sourcesContent":["export const mdiAlertCircle = /*#__PURE__*/ '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';","import classNames from 'classnames';\n\nimport { mdiAlertCircle } from '@lumx/icons';\nimport { ColorPalette, ColorVariant, ColorWithVariants, Size, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses, resolveColorWithVariants } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\n\nexport type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface IconProps extends GenericProps, HasTheme {\n /** Color variant. */\n color?: ColorWithVariants;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Whether the icon has a shape. */\n hasShape?: boolean;\n /**\n * Icon (SVG path) draw code (`d` property of the `<path>` SVG element).\n * See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths\n */\n icon: string;\n /** Size variant. */\n size?: IconSizes;\n /** Sets an alternative text on the svg. Will set an `img` role to the svg. */\n alt?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Icon';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<IconProps> = {};\n\n/**\n * Icon component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Icon = forwardRef<IconProps, HTMLElement>((props, ref) => {\n const defaultTheme = useTheme();\n const {\n className,\n color: propColor,\n colorVariant: propColorVariant,\n hasShape,\n icon,\n size,\n theme = defaultTheme,\n alt,\n ...forwardedProps\n } = props;\n const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);\n\n // Color\n let iconColor = color;\n if (!iconColor && (hasShape || theme)) {\n iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;\n }\n\n // Color variant\n let iconColorVariant = colorVariant;\n if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {\n iconColorVariant = 'L2';\n }\n\n // Size\n let iconSize = size;\n if (size && hasShape) {\n if (size === Size.xxs || size === Size.xs) {\n iconSize = Size.s;\n } else if (size === Size.xxl) {\n iconSize = Size.xl;\n }\n } else if (hasShape) {\n iconSize = Size.m;\n }\n\n return (\n <i\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color: iconColor,\n colorVariant: iconColorVariant,\n hasShape,\n prefix: CLASSNAME,\n theme,\n size: iconSize,\n }),\n !hasShape && `${CLASSNAME}--no-shape`,\n !hasShape &&\n iconColor === ColorPalette.yellow &&\n icon === mdiAlertCircle &&\n `${CLASSNAME}--has-dark-layer`,\n `${CLASSNAME}--path`,\n )}\n >\n <svg\n aria-hidden={alt ? undefined : 'true'}\n role={alt ? 'img' : undefined}\n aria-label={alt}\n height=\"1em\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ verticalAlign: '-0.125em' }}\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={icon} fill=\"currentColor\" />\n </svg>\n </i>\n );\n});\nIcon.displayName = COMPONENT_NAME;\nIcon.className = CLASSNAME;\nIcon.defaultProps = DEFAULT_PROPS;\n"],"names":["mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Icon","forwardRef","props","ref","defaultTheme","useTheme","className","color","propColor","colorVariant","propColorVariant","hasShape","icon","size","theme","alt","forwardedProps","resolveColorWithVariants","iconColor","Theme","dark","ColorPalette","light","iconColorVariant","iconSize","Size","xxs","xs","s","xxl","xl","m","_jsx","classNames","handleBasicClasses","prefix","yellow","children","undefined","role","height","preserveAspectRatio","style","verticalAlign","viewBox","width","d","fill","displayName","defaultProps"],"mappings":";;;;;;AAAaA,MAAAA,cAAc,GAAiB;;ACgC5C;AACA;AACA;AACA,MAAMC,cAAc,GAAG,MAAM,CAAA;;AAE7B;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAiC,GAAG,EAAE,CAAA;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,IAAI,GAAGC,UAAU,CAAyB,CAACC,KAAK,EAAEC,GAAG,KAAK;AACnE,EAAA,MAAMC,YAAY,GAAGC,QAAQ,EAAE,CAAA;EAC/B,MAAM;IACFC,SAAS;AACTC,IAAAA,KAAK,EAAEC,SAAS;AAChBC,IAAAA,YAAY,EAAEC,gBAAgB;IAC9BC,QAAQ;IACRC,IAAI;IACJC,IAAI;AACJC,IAAAA,KAAK,GAAGV,YAAY;IACpBW,GAAG;IACH,GAAGC,cAAAA;AACP,GAAC,GAAGd,KAAK,CAAA;EACT,MAAM,CAACK,KAAK,EAAEE,YAAY,CAAC,GAAGQ,wBAAwB,CA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