@lumx/react 3.20.1-alpha.26 → 3.20.1-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/{Button-85482487.js → Button-5a87fee9.js} +10 -11
- package/_internal/Button-5a87fee9.js.map +1 -0
- package/_internal/{ButtonRoot-823f3e9c.js → ButtonRoot-bf682215.js} +2 -2
- package/_internal/ButtonRoot-bf682215.js.map +1 -0
- package/_internal/{Chip-a34f6905.js → Chip-8d0aae06.js} +8 -11
- package/_internal/Chip-8d0aae06.js.map +1 -0
- package/_internal/{ClickAwayProvider-7093ba23.js → ClickAwayProvider-1204f237.js} +2 -2
- package/_internal/ClickAwayProvider-1204f237.js.map +1 -0
- package/_internal/{IconButton-1a22c4c8.js → IconButton-351389b0.js} +5 -5
- package/_internal/{IconButton-1a22c4c8.js.map → IconButton-351389b0.js.map} +1 -1
- package/_internal/{ImageCaption-a0a6de5c.js → ImageCaption-4109b433.js} +4 -4
- package/_internal/{ImageCaption-a0a6de5c.js.map → ImageCaption-4109b433.js.map} +1 -1
- package/_internal/{List-54237e0e.js → List-b7882a99.js} +247 -223
- package/_internal/List-b7882a99.js.map +1 -0
- package/_internal/{PopoverDialog-4ebe79f2.js → PopoverDialog-2e7b9ed5.js} +12 -12
- package/_internal/PopoverDialog-2e7b9ed5.js.map +1 -0
- package/_internal/{Slides-ae91d12c.js → Slides-83646e84.js} +6 -9
- package/_internal/Slides-83646e84.js.map +1 -0
- package/_internal/{Thumbnail-0872250e.js → Thumbnail-741501a5.js} +3 -3
- package/_internal/{Thumbnail-0872250e.js.map → Thumbnail-741501a5.js.map} +1 -1
- package/_internal/components/{alert-dialog-0eeb06ce.js → alert-dialog-5df4f133.js} +6 -6
- package/_internal/components/{alert-dialog-0eeb06ce.js.map → alert-dialog-5df4f133.js.map} +1 -1
- package/_internal/components/{autocomplete-32170542.js → autocomplete-824c779e.js} +7 -7
- package/_internal/components/{autocomplete-32170542.js.map → autocomplete-824c779e.js.map} +1 -1
- package/_internal/components/{avatar-d2214a61.js → avatar-69b66f01.js} +3 -3
- package/_internal/components/{avatar-d2214a61.js.map → avatar-69b66f01.js.map} +1 -1
- package/_internal/components/{badge-8390e590.js → badge-63cd3b1c.js} +2 -2
- package/_internal/components/{badge-8390e590.js.map → badge-63cd3b1c.js.map} +1 -1
- package/_internal/components/{button-b5818c5a.js → button-eebd4e00.js} +4 -4
- package/_internal/components/{button-b5818c5a.js.map → button-eebd4e00.js.map} +1 -1
- package/_internal/components/{checkbox-346834f8.js → checkbox-54943a02.js} +5 -5
- package/_internal/components/{checkbox-346834f8.js.map → checkbox-54943a02.js.map} +1 -1
- package/_internal/components/{chip-e40c5521.js → chip-9ad6b318.js} +3 -3
- package/_internal/components/{chip-e40c5521.js.map → chip-9ad6b318.js.map} +1 -1
- package/_internal/components/{comment-block-a4997791.js → comment-block-55a4ab3c.js} +4 -4
- package/_internal/components/{comment-block-a4997791.js.map → comment-block-55a4ab3c.js.map} +1 -1
- package/_internal/components/date-picker-a824a3ae.js +2 -0
- package/_internal/components/date-picker-a824a3ae.js.map +1 -0
- package/_internal/components/{dialog-ebdb9500.js → dialog-5e6320b8.js} +8 -8
- package/_internal/components/dialog-5e6320b8.js.map +1 -0
- package/_internal/components/{divider-116af6b9.js → divider-bdf11ba3.js} +2 -2
- package/_internal/components/{divider-116af6b9.js.map → divider-bdf11ba3.js.map} +1 -1
- package/_internal/components/{drag-handle-6b073866.js → drag-handle-45912fd3.js} +3 -3
- package/_internal/components/{drag-handle-6b073866.js.map → drag-handle-45912fd3.js.map} +1 -1
- package/_internal/components/{dropdown-0baed51b.js → dropdown-0216211d.js} +6 -6
- package/_internal/components/{dropdown-0baed51b.js.map → dropdown-0216211d.js.map} +1 -1
- package/_internal/components/{expansion-panel-80edf6c9.js → expansion-panel-3ce73c6b.js} +8 -8
- package/_internal/components/expansion-panel-3ce73c6b.js.map +1 -0
- package/_internal/components/{flag-7c9d3abf.js → flag-1b177f78.js} +4 -4
- package/_internal/components/{flag-7c9d3abf.js.map → flag-1b177f78.js.map} +1 -1
- package/_internal/components/{flex-box-55144e5f.js → flex-box-93b97715.js} +3 -3
- package/_internal/components/flex-box-93b97715.js.map +1 -0
- package/_internal/components/{generic-block-ff0509ee.js → generic-block-925f7c5b.js} +16 -12
- package/_internal/components/generic-block-925f7c5b.js.map +1 -0
- package/_internal/components/{grid-6f1b5a41.js → grid-95fd1493.js} +2 -2
- package/_internal/components/{grid-6f1b5a41.js.map → grid-95fd1493.js.map} +1 -1
- package/_internal/components/{grid-column-f01df853.js → grid-column-43f28cfb.js} +3 -4
- package/_internal/components/grid-column-43f28cfb.js.map +1 -0
- package/_internal/components/{heading-d4c66a34.js → heading-45d6e78e.js} +3 -3
- package/_internal/components/{heading-d4c66a34.js.map → heading-45d6e78e.js.map} +1 -1
- package/_internal/components/icon-79195151.js +2 -0
- package/_internal/components/icon-79195151.js.map +1 -0
- package/_internal/components/{image-block-755d8b96.js → image-block-aba6d2db.js} +4 -4
- package/_internal/components/{image-block-755d8b96.js.map → image-block-aba6d2db.js.map} +1 -1
- package/_internal/components/{image-lightbox-d31dcd8a.js → image-lightbox-8b8e77c2.js} +9 -9
- package/_internal/components/{image-lightbox-d31dcd8a.js.map → image-lightbox-8b8e77c2.js.map} +1 -1
- package/_internal/components/{inline-list-e6f19a98.js → inline-list-dfb9fd34.js} +2 -2
- package/_internal/components/{inline-list-e6f19a98.js.map → inline-list-dfb9fd34.js.map} +1 -1
- package/_internal/components/{input-helper-64153099.js → input-helper-c8a0078b.js} +2 -2
- package/_internal/components/{input-helper-64153099.js.map → input-helper-c8a0078b.js.map} +1 -1
- package/_internal/components/{input-label-2feb0bb0.js → input-label-9711398b.js} +2 -2
- package/_internal/components/{input-label-2feb0bb0.js.map → input-label-9711398b.js.map} +1 -1
- package/_internal/components/{lightbox-9dbd7c15.js → lightbox-894abe64.js} +6 -6
- package/_internal/components/{lightbox-9dbd7c15.js.map → lightbox-894abe64.js.map} +1 -1
- package/_internal/components/{link-f9421eab.js → link-e70e64ed.js} +4 -4
- package/_internal/components/{link-f9421eab.js.map → link-e70e64ed.js.map} +1 -1
- package/_internal/components/{link-preview-5c7e3878.js → link-preview-e56f3570.js} +4 -4
- package/_internal/components/{link-preview-5c7e3878.js.map → link-preview-e56f3570.js.map} +1 -1
- package/_internal/components/{list-b08d8423.js → list-59b7ce56.js} +3 -3
- package/_internal/components/{list-b08d8423.js.map → list-59b7ce56.js.map} +1 -1
- package/_internal/components/{message-b3957df0.js → message-a255dfd3.js} +4 -4
- package/_internal/components/{message-b3957df0.js.map → message-a255dfd3.js.map} +1 -1
- package/_internal/components/{mosaic-742a9109.js → mosaic-192f2270.js} +4 -5
- package/_internal/components/mosaic-192f2270.js.map +1 -0
- package/_internal/components/{navigation-b1cd43c3.js → navigation-dfe8aac0.js} +7 -7
- package/_internal/components/{navigation-b1cd43c3.js.map → navigation-dfe8aac0.js.map} +1 -1
- package/_internal/components/{notification-94679f51.js → notification-10f289b5.js} +5 -8
- package/_internal/components/notification-10f289b5.js.map +1 -0
- package/_internal/components/popover-6c7f745b.js +3 -0
- package/_internal/components/popover-6c7f745b.js.map +1 -0
- package/_internal/components/{post-block-3ac52237.js → post-block-f7dcc6e9.js} +13 -13
- package/_internal/components/post-block-f7dcc6e9.js.map +1 -0
- package/_internal/components/{progress-f39c3fa2.js → progress-7a05fb0c.js} +2 -2
- package/_internal/components/{progress-f39c3fa2.js.map → progress-7a05fb0c.js.map} +1 -1
- package/_internal/components/{progress-tracker-997931ac.js → progress-tracker-48876add.js} +5 -5
- package/_internal/components/{progress-tracker-997931ac.js.map → progress-tracker-48876add.js.map} +1 -1
- package/_internal/components/{radio-button-559a4863.js → radio-button-07cf45e9.js} +4 -4
- package/_internal/components/{radio-button-559a4863.js.map → radio-button-07cf45e9.js.map} +1 -1
- package/_internal/components/{select-f3b44cb6.js → select-8b54a444.js} +13 -14
- package/_internal/components/select-8b54a444.js.map +1 -0
- package/_internal/components/{side-navigation-414825d8.js → side-navigation-7eeed3b4.js} +6 -7
- package/_internal/components/side-navigation-7eeed3b4.js.map +1 -0
- package/_internal/components/{skeleton-c66516ee.js → skeleton-a4e84085.js} +2 -2
- package/_internal/components/{skeleton-c66516ee.js.map → skeleton-a4e84085.js.map} +1 -1
- package/_internal/components/{slider-efbfbc45.js → slider-5d64b470.js} +4 -4
- package/_internal/components/{slider-efbfbc45.js.map → slider-5d64b470.js.map} +1 -1
- package/_internal/components/{slideshow-dc4b79ae.js → slideshow-bce65cf6.js} +4 -4
- package/_internal/components/{slideshow-dc4b79ae.js.map → slideshow-bce65cf6.js.map} +1 -1
- package/_internal/components/{switch-769a2a04.js → switch-7ae55d89.js} +5 -6
- package/_internal/components/switch-7ae55d89.js.map +1 -0
- package/_internal/components/{table-c43ec4a5.js → table-5bdf4aec.js} +3 -3
- package/_internal/components/{table-c43ec4a5.js.map → table-5bdf4aec.js.map} +1 -1
- package/_internal/components/{tabs-4037fe57.js → tabs-2ad54592.js} +4 -4
- package/_internal/components/{tabs-4037fe57.js.map → tabs-2ad54592.js.map} +1 -1
- package/_internal/components/text-09c81111.js +2 -0
- package/_internal/components/text-09c81111.js.map +1 -0
- package/_internal/components/{text-field-0a15a15d.js → text-field-3e1030f0.js} +7 -8
- package/_internal/components/text-field-3e1030f0.js.map +1 -0
- package/_internal/components/{thumbnail-f1784929.js → thumbnail-1c5828b9.js} +2 -2
- package/_internal/components/{thumbnail-f1784929.js.map → thumbnail-1c5828b9.js.map} +1 -1
- package/_internal/components/{toolbar-a43533a2.js → toolbar-0d14efb7.js} +2 -2
- package/_internal/components/{toolbar-a43533a2.js.map → toolbar-0d14efb7.js.map} +1 -1
- package/_internal/components/{tooltip-2885ab2e.js → tooltip-31181a24.js} +4 -4
- package/_internal/components/{tooltip-2885ab2e.js.map → tooltip-31181a24.js.map} +1 -1
- package/_internal/components/{uploader-7bc3adaa.js → uploader-845b2412.js} +3 -3
- package/_internal/components/{uploader-7bc3adaa.js.map → uploader-845b2412.js.map} +1 -1
- package/_internal/components/{user-block-5f7b09af.js → user-block-91c30797.js} +12 -13
- package/_internal/components/user-block-91c30797.js.map +1 -0
- package/_internal/{constants-b9e57936.js → constants-9b714e31.js} +145 -133
- package/_internal/{constants-b9e57936.js.map → constants-9b714e31.js.map} +1 -1
- package/_internal/forwardRef-d0e90329.js +82 -0
- package/_internal/{forwardRef-15f62847.js.map → forwardRef-d0e90329.js.map} +1 -1
- package/_internal/{index-9df37c0d.js → index-68e1b0af.js} +6 -6
- package/_internal/{index-9df37c0d.js.map → index-68e1b0af.js.map} +1 -1
- package/_internal/{index-192f8ada.js → index-745f94ee.js} +2 -2
- package/_internal/{index-192f8ada.js.map → index-745f94ee.js.map} +1 -1
- package/_internal/{index-b06353f2.js → index-ab520e78.js} +3 -3
- package/_internal/{index-b06353f2.js.map → index-ab520e78.js.map} +1 -1
- package/_internal/{isComponent-78df9309.js → isComponent-b9762ff1.js} +3 -5
- package/_internal/isComponent-b9762ff1.js.map +1 -0
- package/_internal/{useCallbackOnEscape-ea4d9eb4.js → useCallbackOnEscape-0b220f9c.js} +3 -3
- package/_internal/useCallbackOnEscape-0b220f9c.js.map +1 -0
- package/_internal/{useFocusTrap-c3c6378b.js → useFocusTrap-3114e5e8.js} +2 -2
- package/_internal/{useFocusTrap-c3c6378b.js.map → useFocusTrap-3114e5e8.js.map} +1 -1
- package/_internal/{wrapChildrenIconWithSpaces-f1e91251.js → wrapChildrenIconWithSpaces-e6038f72.js} +2 -2
- package/_internal/{wrapChildrenIconWithSpaces-f1e91251.js.map → wrapChildrenIconWithSpaces-e6038f72.js.map} +1 -1
- package/index.d.ts +4 -15
- package/index.js +61 -61
- package/package.json +7 -13
- package/utils/index.js +1 -1
- package/_internal/Button-85482487.js.map +0 -1
- package/_internal/ButtonRoot-823f3e9c.js.map +0 -1
- package/_internal/Chip-a34f6905.js.map +0 -1
- package/_internal/ClickAwayProvider-7093ba23.js.map +0 -1
- package/_internal/List-54237e0e.js.map +0 -1
- package/_internal/PopoverDialog-4ebe79f2.js.map +0 -1
- package/_internal/Slides-ae91d12c.js.map +0 -1
- package/_internal/components/date-picker-48a39549.js +0 -2
- package/_internal/components/date-picker-48a39549.js.map +0 -1
- package/_internal/components/dialog-ebdb9500.js.map +0 -1
- package/_internal/components/expansion-panel-80edf6c9.js.map +0 -1
- package/_internal/components/flex-box-55144e5f.js.map +0 -1
- package/_internal/components/generic-block-ff0509ee.js.map +0 -1
- package/_internal/components/grid-column-f01df853.js.map +0 -1
- package/_internal/components/icon-7c79ab42.js +0 -2
- package/_internal/components/icon-7c79ab42.js.map +0 -1
- package/_internal/components/mosaic-742a9109.js.map +0 -1
- package/_internal/components/notification-94679f51.js.map +0 -1
- package/_internal/components/popover-65bfbc57.js +0 -3
- package/_internal/components/popover-65bfbc57.js.map +0 -1
- package/_internal/components/post-block-3ac52237.js.map +0 -1
- package/_internal/components/select-f3b44cb6.js.map +0 -1
- package/_internal/components/side-navigation-414825d8.js.map +0 -1
- package/_internal/components/switch-769a2a04.js.map +0 -1
- package/_internal/components/text-851c62f8.js +0 -2
- package/_internal/components/text-851c62f8.js.map +0 -1
- package/_internal/components/text-field-0a15a15d.js.map +0 -1
- package/_internal/components/user-block-5f7b09af.js.map +0 -1
- package/_internal/forwardRef-15f62847.js +0 -70
- package/_internal/isComponent-78df9309.js.map +0 -1
- package/_internal/partitionMulti-4daccdd5.js +0 -25
- package/_internal/partitionMulti-4daccdd5.js.map +0 -1
- package/_internal/useCallbackOnEscape-ea4d9eb4.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
var classnames = {exports: {}};
|
|
8
|
+
|
|
9
|
+
/*!
|
|
10
|
+
Copyright (c) 2018 Jed Watson.
|
|
11
|
+
Licensed under the MIT License (MIT), see
|
|
12
|
+
http://jedwatson.github.io/classnames
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var hasRequiredClassnames;
|
|
16
|
+
|
|
17
|
+
function requireClassnames () {
|
|
18
|
+
if (hasRequiredClassnames) return classnames.exports;
|
|
19
|
+
hasRequiredClassnames = 1;
|
|
20
|
+
(function (module) {
|
|
21
|
+
/* global define */
|
|
22
|
+
|
|
23
|
+
(function () {
|
|
24
|
+
|
|
25
|
+
var hasOwn = {}.hasOwnProperty;
|
|
26
|
+
|
|
27
|
+
function classNames() {
|
|
28
|
+
var classes = [];
|
|
29
|
+
|
|
30
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
31
|
+
var arg = arguments[i];
|
|
32
|
+
if (!arg) continue;
|
|
33
|
+
|
|
34
|
+
var argType = typeof arg;
|
|
35
|
+
|
|
36
|
+
if (argType === 'string' || argType === 'number') {
|
|
37
|
+
classes.push(arg);
|
|
38
|
+
} else if (Array.isArray(arg)) {
|
|
39
|
+
if (arg.length) {
|
|
40
|
+
var inner = classNames.apply(null, arg);
|
|
41
|
+
if (inner) {
|
|
42
|
+
classes.push(inner);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} else if (argType === 'object') {
|
|
46
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
47
|
+
classes.push(arg.toString());
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (var key in arg) {
|
|
52
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
53
|
+
classes.push(key);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return classes.join(' ');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (module.exports) {
|
|
63
|
+
classNames.default = classNames;
|
|
64
|
+
module.exports = classNames;
|
|
65
|
+
} else {
|
|
66
|
+
window.classNames = classNames;
|
|
67
|
+
}
|
|
68
|
+
}());
|
|
69
|
+
} (classnames));
|
|
70
|
+
return classnames.exports;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var classnamesExports = requireClassnames();
|
|
74
|
+
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* React.forwardRef but re-typed to attach some custom metadata on our components.
|
|
78
|
+
*/
|
|
79
|
+
const forwardRef = React__default.forwardRef;
|
|
80
|
+
|
|
81
|
+
export { classNames as c, forwardRef as f, getDefaultExportFromCjs as g };
|
|
82
|
+
//# sourceMappingURL=forwardRef-d0e90329.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forwardRef-
|
|
1
|
+
{"version":3,"file":"forwardRef-d0e90329.js","sources":["../../../../node_modules/classnames/index.js","../../src/utils/react/forwardRef.ts"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { type ReactNode, type ForwardedRef } from 'react';\nimport type { Comp } from '../type';\n\ntype ForwardRef = <P, T = HTMLElement, A = unknown>(\n render: (props: P, ref: ForwardedRef<T>) => ReactNode,\n) => Comp<P, T> & A;\n\n/**\n * React.forwardRef but re-typed to attach some custom metadata on our components.\n */\nexport const forwardRef = React.forwardRef as ForwardRef;\n"],"names":["forwardRef","React"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA;;AAEA,EAAA,CAAC,YAAY;;AAGb,GAAC,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAA;;GAG9B,SAAS,UAAU,GAAG;IACrB,IAAI,OAAO,GAAG,EAAE,CAAA;;AAElB,IAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,KAAG,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;KACtB,IAAI,CAAC,GAAG,EAAE,SAAA;;AAEb,KAAG,IAAI,OAAO,GAAG,OAAO,GAAG,CAAA;;KAExB,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE;AACrD,MAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;MACjB,MAAM,IAAI,KAAK,CAAC,OA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useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { f as forwardRef, c as classNames } from './forwardRef-
|
|
3
|
-
import { u as useCallbackOnEscape } from './useCallbackOnEscape-
|
|
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';
|
|
4
5
|
import { D as DOCUMENT, W as WINDOW } from './constants-d0e3f49e.js';
|
|
5
6
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
6
7
|
import { u as useMergeRefs } from './mergeRefs-f0d7d6ea.js';
|
|
7
|
-
import { g as getFirstAndLastFocusable, u as useFocusTrap } from './useFocusTrap-
|
|
8
|
+
import { g as getFirstAndLastFocusable, u as useFocusTrap } from './useFocusTrap-3114e5e8.js';
|
|
8
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
10
|
import { T as ThemeProvider } from './ThemeContext-3181f000.js';
|
|
10
11
|
import memoize from 'lodash/memoize';
|
|
11
|
-
import { A as ARROW_SIZE, u as usePopper, d as detectOverflow, F as FitAnchorWidth, P as Placement, a as POPOVER_ZINDEX } from './constants-
|
|
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';
|
|
12
13
|
import { P as Portal } from './Portal-3f86608e.js';
|
|
13
|
-
import { C as ClickAwayProvider } from './ClickAwayProvider-7093ba23.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Hook focusing an element when defined and `focus` boolean `true`.
|
|
@@ -433,4 +433,4 @@ Popover.className = CLASSNAME;
|
|
|
433
433
|
Popover.defaultProps = DEFAULT_PROPS;
|
|
434
434
|
|
|
435
435
|
export { Popover as P, useFocus as u };
|
|
436
|
-
//# sourceMappingURL=index-
|
|
436
|
+
//# sourceMappingURL=index-68e1b0af.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-9df37c0d.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","Theme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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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AAA;QAACC,QAAQ,EAAE3B,gBAAgB,IAAII,OAAQ;AAACwB,QAAAA,YAAY,EAAEd,aAAc;QAAAhB,QAAA,EAAA,CACjFnD,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,4 +1,4 @@
|
|
|
1
|
-
import { f as forwardRef, c as classNames } from './forwardRef-
|
|
1
|
+
import { f as forwardRef, c as classNames } from './forwardRef-d0e90329.js';
|
|
2
2
|
import { getRootClassName, resolveColorWithVariants, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
3
|
import { u as useTheme } from './ThemeContext-3181f000.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -100,4 +100,4 @@ Icon.className = CLASSNAME;
|
|
|
100
100
|
Icon.defaultProps = DEFAULT_PROPS;
|
|
101
101
|
|
|
102
102
|
export { Icon as I, mdiAlertCircle as m };
|
|
103
|
-
//# sourceMappingURL=index-
|
|
103
|
+
//# sourceMappingURL=index-745f94ee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
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,CAACT,SAAS,EAAEE,gBAAgB,CAAC,CAAA;;AAEnF;EACA,IAAIQ,SAAS,GAAGX,KAAK,CAAA;AACrB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,EACrC,CAACc,QAAQ,IACLO,SAAS,KAAKG,YAAY,CAACe,MAAM,IACjCxB,IAAI,KAAKjB,cAAc,IACvB,CAAGE,EAAAA,SAAS,CAAkB,gBAAA,CAAA,EAClC,CAAGA,EAAAA,SAAS,QAChB,CAAE;AAAAwC,IAAAA,QAAA,eAEFL,GAAA,CAAA,KAAA,EAAA;AACI,MAAA,aAAA,EAAajB,GAAG,GAAGuB,SAAS,GAAG,MAAO;AACtCC,MAAAA,IAAI,EAAExB,GAAG,GAAG,KAAK,GAAGuB,SAAU;AAC9B,MAAA,YAAA,EAAYvB,GAAI;AAChByB,MAAAA,MAAM,EAAC,KAAK;AACZC,MAAAA,mBAAmB,EAAC,eAAe;AACnCC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,aAAa,EAAE,UAAA;OAAa;AACrCC,MAAAA,OAAO,EAAC,WAAW;AACnBC,MAAAA,KAAK,EAAC,KAAK;AAAAR,MAAAA,QAAA,eAEXL,GAAA,CAAA,MAAA,EAAA;AAAMc,QAAAA,CAAC,EAAElC,IAAK;AAACmC,QAAAA,IAAI,EAAC,cAAA;OAAgB,CAAA;KACnC,CAAA;AAAC,GACP,CAAC,CAAA;AAEZ,CAAC,EAAC;AACF/C,IAAI,CAACgD,WAAW,GAAGpD,cAAc,CAAA;AACjCI,IAAI,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC1BG,IAAI,CAACiD,YAAY,GAAGlD,aAAa;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { f as forwardRef, c as classNames } from './forwardRef-
|
|
1
|
+
import { f as forwardRef, c as classNames } from './forwardRef-d0e90329.js';
|
|
2
2
|
import { getRootClassName, getTypographyClassName, handleBasicClasses, fontColorClass } from '@lumx/core/js/utils/className';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { u as useTooltipContext } from './context-9d1336a1.js';
|
|
5
5
|
import { V as VISUALLY_HIDDEN } from './constants-d0e3f49e.js';
|
|
6
6
|
import { u as useMergeRefs } from './mergeRefs-f0d7d6ea.js';
|
|
7
|
-
import { w as wrapChildrenIconWithSpaces } from './wrapChildrenIconWithSpaces-
|
|
7
|
+
import { w as wrapChildrenIconWithSpaces } from './wrapChildrenIconWithSpaces-e6038f72.js';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -114,4 +114,4 @@ Text.className = CLASSNAME;
|
|
|
114
114
|
Text.defaultProps = DEFAULT_PROPS;
|
|
115
115
|
|
|
116
116
|
export { Text as T, useOverflowTooltipLabel as u };
|
|
117
|
-
//# sourceMappingURL=index-
|
|
117
|
+
//# sourceMappingURL=index-ab520e78.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-ab520e78.js","sources":["../../src/hooks/useOverflowTooltipLabel.tsx","../../src/components/text/Text.tsx"],"sourcesContent":["import React from 'react';\nimport { useTooltipContext } from '@lumx/react/components/tooltip/context';\nimport { VISUALLY_HIDDEN } from '@lumx/react/constants';\n\n/**\n * Compute a tooltip label based on a label element `innerText` if the text overflows.\n * Updates dynamically on content changes (but not on resize!)\n */\nexport const useOverflowTooltipLabel = (content: React.ReactNode) => {\n const parentTooltip = useTooltipContext();\n const [tooltipLabel, setTooltipLabel] = React.useState<string | undefined>(undefined);\n const [labelElement, setLabelElement] = React.useState<HTMLElement | null>(null);\n\n React.useLayoutEffect(() => {\n if (\n // Not inside a tooltip\n !parentTooltip &&\n labelElement &&\n // Not inside a visually hidden\n !labelElement?.closest(`.${VISUALLY_HIDDEN}`) &&\n // Text overflows\n labelElement.offsetWidth < labelElement.scrollWidth\n ) {\n // Set tooltip label\n setTooltipLabel(labelElement.innerText);\n } else {\n setTooltipLabel(undefined);\n }\n }, [labelElement, parentTooltip, content]);\n\n return { labelRef: setLabelElement, tooltipLabel };\n};\n","import classNames from 'classnames';\n\nimport { ColorWithVariants, ColorVariant, Typography, WhiteSpace } from '@lumx/react';\nimport { GenericProps, TextElement } from '@lumx/react/utils/type';\nimport {\n fontColorClass,\n getRootClassName,\n handleBasicClasses,\n getTypographyClassName,\n} from '@lumx/core/js/utils/className';\nimport { useOverflowTooltipLabel } from '@lumx/react/hooks/useOverflowTooltipLabel';\nimport { useMergeRefs } from '@lumx/react/utils/react/mergeRefs';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { wrapChildrenIconWithSpaces } from '@lumx/react/utils/react/wrapChildrenIconWithSpaces';\n\n/**\n * Defines the props of the component.\n */\nexport interface TextProps extends GenericProps {\n /**\n * Color variant.\n */\n color?: ColorWithVariants;\n /**\n * Lightened or darkened variant of the selected color.\n */\n colorVariant?: ColorVariant;\n /**\n * Typography variant.\n */\n typography?: Typography;\n /**\n * Custom component to render the text.\n */\n as: TextElement;\n /**\n * Control whether the text should truncate or not.\n * Setting as `true` will make the text truncate on a single line.\n * Setting as `{ lines: number }` will make the text truncate on a multiple lines.\n */\n truncate?: boolean | { lines: number };\n /**\n * Prevents text to wrap on multiple lines\n * (automatically activated when single line text truncate is activated).\n */\n noWrap?: boolean;\n /**\n * WhiteSpace variant\n * Ignored when `noWrap` is set to true\n * Ignored when `truncate` is set to true or lines: 1\n * */\n whiteSpace?: WhiteSpace;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Text';\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 = {} as const;\n\n/**\n * Text component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Text = forwardRef<TextProps>((props, ref) => {\n const {\n as: Component,\n children,\n className,\n color,\n colorVariant,\n noWrap,\n typography,\n truncate,\n whiteSpace,\n style,\n ...forwardedProps\n } = props;\n\n const typographyClass = typography && getTypographyClassName(typography);\n\n // Truncate mode\n const truncateLinesStyle = typeof truncate === 'object' &&\n truncate.lines > 1 && { '--lumx-text-truncate-lines': truncate.lines };\n const isTruncatedMultiline = !!truncateLinesStyle;\n const isTruncated = !!truncate;\n\n /**\n * Add custom white-space style if specified\n * Disabled if noWrap is specified\n * Disabled if truncated on one-line\n * */\n const whiteSpaceStyle = !noWrap &&\n !(isTruncated && !isTruncatedMultiline) &&\n whiteSpace && { '--lumx-text-white-space': whiteSpace };\n\n const { tooltipLabel, labelRef } = useOverflowTooltipLabel(children);\n\n return (\n <Component\n ref={useMergeRefs(ref as React.Ref<any>, labelRef)}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isTruncated: isTruncated && !isTruncatedMultiline,\n isTruncatedMultiline,\n }),\n typographyClass,\n fontColorClass(color, colorVariant),\n noWrap && `${CLASSNAME}--no-wrap`,\n )}\n title={tooltipLabel}\n style={{ ...truncateLinesStyle, ...whiteSpaceStyle, ...style }}\n {...forwardedProps}\n >\n {wrapChildrenIconWithSpaces(children)}\n </Component>\n );\n});\nText.displayName = COMPONENT_NAME;\nText.className = CLASSNAME;\nText.defaultProps = DEFAULT_PROPS;\n"],"names":["useOverflowTooltipLabel","content","parentTooltip","useTooltipContext","tooltipLabel","setTooltipLabel","React","useState","undefined","labelElement","setLabelElement","useLayoutEffect","closest","VISUALLY_HIDDEN","offsetWidth","scrollWidth","innerText","labelRef","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Text","forwardRef","props","ref","as","Component","children","className","color","colorVariant","noWrap","typography","truncate","whiteSpace","style","forwardedProps","typographyClass","getTypographyClassName","truncateLinesStyle","lines","isTruncatedMultiline","isTruncated","whiteSpaceStyle","_jsx","useMergeRefs","classNames","handleBasicClasses","prefix","fontColorClass","title","wrapChildrenIconWithSpaces","displayName","defaultProps"],"mappings":";;;;;;;;;AAIA;AACA;AACA;AACA;AACaA,MAAAA,uBAAuB,GAAIC,OAAwB,IAAK;AACjE,EAAA,MAAMC,aAAa,GAAGC,iBAAiB,EAAE,CAAA;EACzC,M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jBwB,0BAA0B,CAACxB,QAAQ,CAAA;AAAC,GAC9B,CAAC,CAAA;AAEpB,CAAC,EAAC;AACFN,IAAI,CAAC+B,WAAW,GAAGnC,cAAc,CAAA;AACjCI,IAAI,CAACO,SAAS,GAAGV,SAAS,CAAA;AAC1BG,IAAI,CAACgC,YAAY,GAAGjC,aAAa;;;;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* Properties of a component to use to determine
|
|
2
|
+
* Properties of a component to use to determine its name.
|
|
5
3
|
* In the order of preference.
|
|
6
4
|
*/
|
|
7
5
|
const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'type.name', 'props.mdxType', '_reactInternalFiber.elementType.name'];
|
|
@@ -13,8 +11,8 @@ const NAME_PROPERTIES = ['type', 'type.displayName', 'displayName', 'name', 'typ
|
|
|
13
11
|
*/
|
|
14
12
|
const isComponent = component => instance => {
|
|
15
13
|
const componentName = typeof component === 'string' ? component : component.displayName;
|
|
16
|
-
return !!
|
|
14
|
+
return !!instance.$$typeof && NAME_PROPERTIES.some(nameProperty => instance[nameProperty] === componentName);
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
export { isComponent as i };
|
|
20
|
-
//# sourceMappingURL=isComponent-
|
|
18
|
+
//# sourceMappingURL=isComponent-b9762ff1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isComponent-b9762ff1.js","sources":["../../src/utils/type/isComponent.ts"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport type { Comp } from './Comp';\n\n/**\n * Properties of a component to use to determine its name.\n * In the order of preference.\n */\nconst NAME_PROPERTIES: string[] = [\n 'type',\n 'type.displayName',\n 'displayName',\n 'name',\n 'type.name',\n 'props.mdxType',\n '_reactInternalFiber.elementType.name',\n];\n/**\n * Create a predicate function that checks if a ReactNode is a react element from the given component.\n *\n * @param component React function component or the component name\n * @return predicate returning true if value is instance of the component\n */\nexport const isComponent =\n <C>(component: Comp<C, any> | string) =>\n (instance: ReactNode): instance is ReactElement => {\n const componentName = typeof component === 'string' ? component : component.displayName;\n\n return (\n !!(instance as any).$$typeof &&\n NAME_PROPERTIES.some((nameProperty: string): boolean => (instance as any)[nameProperty] === componentName)\n );\n };\n"],"names":["NAME_PROPERTIES","isComponent","component","instance","componentName","displayName","$$typeof","some","nameProperty"],"mappings":"AAGA;AACA;AACA;AACA;AACA,MAAMA,eAAyB,GAAG,CAC9B,MAAM,EACN,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,WAAW,EACX,eAAe,EACf,sCAAsC,CACzC,CAAA;AACD;AACA;AACA;AACA;AACA;AACA;MACaC,WAAW,GAChBC,SAAgC,IACnCC,QAAmB,IAA+B;EAC/C,MAAMC,aAAa,GAAG,OAAOF,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGA,SAAS,CAACG,WAAW,CAAA;AAEvF,EAAA,OACI,CAAC,CAAEF,QAAQ,CAASG,QAAQ,IAC5BN,eAAe,CAACO,IAAI,CAAEC,YAAoB,IAAeL,QAAQ,CAASK,YAAY,CAAC,KAAKJ,aAAa,CAAC,CAAA;AAElH;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as DOCUMENT } from './constants-d0e3f49e.js';
|
|
2
2
|
import { onEscapePressed } from '@lumx/core/js/utils';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { pull } from '@lumx/core/js/utils/collection/pull';
|
|
5
|
+
import { last } from '@lumx/core/js/utils/collection/last';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Keep track of listeners, only the last registered listener gets activated at any point (previously registered
|
|
@@ -59,4 +59,4 @@ function useCallbackOnEscape(callback, closeOnEscape = true) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export { makeListenerTowerContext as m, useCallbackOnEscape as u };
|
|
62
|
-
//# sourceMappingURL=useCallbackOnEscape-
|
|
62
|
+
//# sourceMappingURL=useCallbackOnEscape-0b220f9c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCallbackOnEscape-0b220f9c.js","sources":["../../src/utils/function/makeListenerTowerContext.ts","../../src/hooks/useCallbackOnEscape.ts"],"sourcesContent":["import { pull } from '@lumx/core/js/utils/collection/pull';\nimport { last } from '@lumx/core/js/utils/collection/last';\n\nexport type Listener = { enable(): void; disable(): void };\n\n/**\n * Keep track of listeners, only the last registered listener gets activated at any point (previously registered\n * listener are disabled).\n * When a listener gets unregistered, the previously registered listener gets enabled again.\n */\nexport function makeListenerTowerContext() {\n const LISTENERS: Listener[] = [];\n\n return {\n register(listener: Listener) {\n // Disable previous listener.\n last(LISTENERS)?.disable();\n // Keep track of current listener.\n LISTENERS.push(listener);\n // Enable current listener.\n listener.enable();\n },\n unregister(listener: Listener) {\n // Disable current listener.\n listener.disable();\n // Remove current listener.\n pull(LISTENERS, listener);\n // Enable previous listener.\n last(LISTENERS)?.enable();\n },\n };\n}\n","import { DOCUMENT } from '@lumx/react/constants';\nimport { Callback } from '@lumx/react/utils/type';\nimport { onEscapePressed } from '@lumx/core/js/utils';\nimport { useEffect } from 'react';\nimport { Listener, makeListenerTowerContext } from '@lumx/react/utils/function/makeListenerTowerContext';\n\nconst LISTENERS = makeListenerTowerContext();\n\n/**\n * Register a global listener on 'Escape' key pressed.\n *\n * If multiple listener are registered, only the last one is maintained. When a listener is unregistered, the previous\n * one gets activated again.\n *\n * @param callback Callback\n * @param closeOnEscape Disables the hook when false\n */\nexport function useCallbackOnEscape(callback: Callback | undefined, closeOnEscape = true) {\n useEffect(() => {\n const rootElement = DOCUMENT?.body;\n if (!closeOnEscape || !callback || !rootElement) {\n return undefined;\n }\n const onKeyDown = onEscapePressed(callback);\n\n const listener: Listener = {\n enable: () => rootElement.addEventListener('keydown', onKeyDown),\n disable: () => rootElement.removeEventListener('keydown', onKeyDown),\n };\n\n LISTENERS.register(listener);\n return () => LISTENERS.unregister(listener);\n }, [callback, closeOnEscape]);\n}\n"],"names":["makeListenerTowerContext","LISTENERS","register","listener","last","disable","push","enable","unregister","pull","useCallbackOnEscape","callback","closeOnEscape","useEffect","rootElement","DOCUMENT","body","undefined","onKeyDown","onEscapePressed","addEventListener","removeEventListener"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,GAAG;EACvC,MAAMC,SAAqB,GAAG,EAAE,CAAA;EAEhC,OAAO;IACHC,QAAQA,CAACC,QAAkB,EAAE;AACzB;AACAC,MAAAA,IAAI,CAACH,SAAS,CAAC,EAAEI,OAAO,EAAE,CAAA;AAC1B;AACAJ,MAAAA,SAAS,CAACK,IAAI,CAACH,QAAQ,CAAC,CAAA;AACxB;MACAA,QAAQ,CAACI,MAAM,EAAE,CAAA;KACpB;IACDC,UAAUA,CAACL,QAAkB,EAAE;AAC3B;MACAA,QAAQ,CAACE,OAAO,EAAE,CAAA;AAClB;AACAI,MAAAA,IAAI,CAACR,SAAS,EAAEE,QAAQ,CAAC,CAAA;AACzB;AACAC,MAAAA,IAAI,CAACH,SAAS,CAAC,EAAEM,MAAM,EAAE,CAAA;AAC7B,KAAA;GACH,CAAA;AACL;;ACzBA,MAAMN,SAAS,GAAGD,wBAAwB,EAAE,CAAA;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASU,mBAAmBA,CAACC,QAA8B,EAAEC,aAAa,GAAG,IAAI,EAAE;AACtFC,EAAAA,SAAS,CAAC,MAAM;AACZ,IAAA,MAAMC,WAAW,GAAGC,QAAQ,EAAEC,IAAI,CAAA;IAClC,IAAI,CAACJ,aAAa,IAAI,CAACD,QAAQ,IAAI,CAACG,WAAW,EAAE;AAC7C,MAAA,OAAOG,SAAS,CAAA;AACpB,KAAA;AACA,IAAA,MAAMC,SAAS,GAAGC,eAAe,CAACR,QAAQ,CAAC,CAAA;AAE3C,IAAA,MAAMR,QAAkB,GAAG;MACvBI,MAAM,EAAEA,MAAMO,WAAW,CAACM,gBAAgB,CAAC,SAAS,EAAEF,SAAS,CAAC;MAChEb,OAAO,EAAEA,MAAMS,WAAW,CAACO,mBAAmB,CAAC,SAAS,EAAEH,SAAS,CAAA;KACtE,CAAA;AAEDjB,IAAAA,SAAS,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AAC5B,IAAA,OAAO,MAAMF,SAAS,CAACO,UAAU,CAACL,QAAQ,CAAC,CAAA;AAC/C,GAAC,EAAE,CAACQ,QAAQ,EAAEC,aAAa,CAAC,CAAC,CAAA;AACjC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { D as DOCUMENT } from './constants-d0e3f49e.js';
|
|
3
3
|
import { g as getFocusableElements } from './getFocusableElements-230173a8.js';
|
|
4
|
-
import { m as makeListenerTowerContext } from './useCallbackOnEscape-
|
|
4
|
+
import { m as makeListenerTowerContext } from './useCallbackOnEscape-0b220f9c.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Get first and last elements focusable in an element.
|
|
@@ -109,4 +109,4 @@ function useFocusTrap(focusZoneElement, focusElement) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
export { getFirstAndLastFocusable as g, useFocusTrap as u };
|
|
112
|
-
//# sourceMappingURL=useFocusTrap-
|
|
112
|
+
//# sourceMappingURL=useFocusTrap-3114e5e8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap-
|
|
1
|
+
{"version":3,"file":"useFocusTrap-3114e5e8.js","sources":["../../src/utils/browser/focus/getFirstAndLastFocusable.ts","../../src/hooks/useFocusTrap.ts"],"sourcesContent":["import { getFocusableElements } from './getFocusableElements';\n\n/**\n * Get first and last elements focusable in an element.\n *\n * @param parentElement The element in which to search focusable elements.\n * @return first and last focusable elements\n */\nexport function getFirstAndLastFocusable(parentElement: HTMLElement | ShadowRoot) {\n const focusableElements = getFocusableElements(parentElement);\n\n // First non disabled element.\n const first = focusableElements[0];\n // Last non disabled element.\n const last = focusableElements[focusableElements.length - 1];\n\n if (last && first) {\n return { first, last };\n }\n return {};\n}\n","import { useEffect } from 'react';\n\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { getFirstAndLastFocusable } from '@lumx/react/utils/browser/focus/getFirstAndLastFocusable';\nimport { Falsy } from '@lumx/react/utils/type';\nimport { Listener, makeListenerTowerContext } from '@lumx/react/utils/function/makeListenerTowerContext';\n\nconst FOCUS_TRAPS = makeListenerTowerContext();\n\n/**\n * Trap 'Tab' focus switch inside the `focusZoneElement`.\n *\n * If multiple focus trap are activated, only the last one is maintained and when a focus trap closes, the previous one\n * gets activated again.\n *\n * @param focusZoneElement The element in which to trap the focus.\n * @param focusElement The element to focus when the focus trap is activated (otherwise the first focusable element\n * will be focused).\n */\nexport function useFocusTrap(focusZoneElement: HTMLElement | Falsy, focusElement?: HTMLElement | null): void {\n useEffect(() => {\n // Body element can be undefined in SSR context.\n const rootElement = DOCUMENT?.body;\n\n if (!rootElement || !focusZoneElement) {\n return undefined;\n }\n\n // Use the shadow root as focusZoneElement when available\n const focusZoneElementOrShadowRoot = focusZoneElement.shadowRoot || focusZoneElement;\n\n // Trap 'Tab' key down focus switch into the focus zone.\n const trapTabFocusInFocusZone = (evt: KeyboardEvent) => {\n const { key } = evt;\n if (key !== 'Tab') {\n return;\n }\n\n const focusable = getFirstAndLastFocusable(focusZoneElementOrShadowRoot);\n\n // Prevent focus switch if no focusable available.\n if (!focusable.first) {\n evt.preventDefault();\n return;\n }\n\n const activeElement = focusZoneElement.shadowRoot\n ? focusZoneElement.shadowRoot.activeElement\n : document.activeElement;\n\n if (\n // No previous focus\n !activeElement ||\n // Previous focus is at the end of the focus zone.\n (!evt.shiftKey && activeElement === focusable.last) ||\n // Previous focus is outside the focus zone\n !focusZoneElementOrShadowRoot.contains(activeElement)\n ) {\n focusable.first.focus();\n evt.preventDefault();\n return;\n }\n\n if (\n // Focus order reversed\n evt.shiftKey &&\n // Previous focus is at the start of the focus zone.\n activeElement === focusable.first\n ) {\n focusable.last.focus();\n evt.preventDefault();\n }\n };\n\n const focusTrap: Listener = {\n enable: () => rootElement.addEventListener('keydown', trapTabFocusInFocusZone),\n disable: () => rootElement.removeEventListener('keydown', trapTabFocusInFocusZone),\n };\n\n // SETUP:\n if (focusElement && focusZoneElementOrShadowRoot.contains(focusElement)) {\n // Focus the given element.\n focusElement.focus({ preventScroll: true });\n } else {\n // Focus the first focusable element in the zone.\n getFirstAndLastFocusable(focusZoneElementOrShadowRoot).first?.focus({ preventScroll: true });\n }\n FOCUS_TRAPS.register(focusTrap);\n\n // TEARDOWN:\n return () => FOCUS_TRAPS.unregister(focusTrap);\n }, [focusElement, focusZoneElement]);\n}\n"],"names":["getFirstAndLastFocusable","parentElement","focusableElements","getFocusableElements","first","last","length","FOCUS_TRAPS","makeListenerTowerContext","useFocusTrap","focusZoneElement","focusElement","useEffect","rootElement","DOCUMENT","body","undefined","focusZoneElementOrShadowRoot","shadowRoot","trapTabFocusInFocusZone","evt","key","focusable","preventDefault","activeElement","document","shiftKey","contains","focus","focusTrap","enable","addEventListener","disable","removeEventListener","preventScroll","register","unregister"],"mappings":";;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CAACC,aAAuC,EAAE;AAC9E,EAAA,MAAMC,iBAAiB,GAAGC,oBAAoB,CAACF,aAAa,CAAC,CAAA;;AAE7D;AACA,EAAA,MAAMG,KAAK,GAAGF,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAClC;EACA,MAAMG,IAAI,GAAGH,iBAAiB,CAACA,iBAAiB,CAACI,MAAM,GAAG,CAAC,CAAC,CAAA;EAE5D,IAAID,IAAI,IAAID,KAAK,EAAE;IACf,OAAO;MAAEA,KAAK;AAAEC,MAAAA,IAAAA;KAAM,CAAA;AAC1B,GAAA;AACA,EAAA,OAAO,EAAE,CAAA;AACb;;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;AACJ,OAAA;AAEA,MAAA;AACI;AACAH,MAAAA,GAAG,CAACM,QAAQ;AACZ;AACAF,MAAAA,aAAa,KAAKF,SAAS,CAAClB,KAAK,EACnC;AACEkB,QAAAA,SAAS,CAACjB,IAAI,CAACuB,KAAK,EAAE,CAAA;QACtBR,GAAG,CAACG,cAAc,EAAE,CAAA;AACxB,OAAA;KACH,CAAA;AAED,IAAA,MAAMM,SAAmB,GAAG;MACxBC,MAAM,EAAEA,MAAMjB,WAAW,CAACkB,gBAAgB,CAAC,SAAS,EAAEZ,uBAAuB,CAAC;MAC9Ea,OAAO,EAAEA,MAAMnB,WAAW,CAACoB,mBAAmB,CAAC,SAAS,EAAEd,uBAAuB,CAAA;KACpF,CAAA;;AAED;IACA,IAAIR,YAAY,IAAIM,4BAA4B,CAACU,QAAQ,CAAChB,YAAY,CAAC,EAAE;AACrE;MACAA,YAAY,CAACiB,KAAK,CAAC;AAAEM,QAAAA,aAAa,EAAE,IAAA;AAAK,OAAC,CAAC,CAAA;AAC/C,KAAC,MAAM;AACH;AACAlC,MAAAA,wBAAwB,CAACiB,4BAA4B,CAAC,CAACb,KAAK,EAAEwB,KAAK,CAAC;AAAEM,QAAAA,aAAa,EAAE,IAAA;AAAK,OAAC,CAAC,CAAA;AAChG,KAAA;AACA3B,IAAAA,WAAW,CAAC4B,QAAQ,CAACN,SAAS,CAAC,CAAA;;AAE/B;AACA,IAAA,OAAO,MAAMtB,WAAW,CAAC6B,UAAU,CAACP,SAAS,CAAC,CAAA;AAClD,GAAC,EAAE,CAAClB,YAAY,EAAED,gBAAgB,CAAC,CAAC,CAAA;AACxC;;;;"}
|
package/_internal/{wrapChildrenIconWithSpaces-f1e91251.js → wrapChildrenIconWithSpaces-e6038f72.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { Children } from 'react';
|
|
2
2
|
import { i as isComponentType } from './isComponentType-e806b848.js';
|
|
3
|
-
import { I as Icon } from './index-
|
|
3
|
+
import { I as Icon } from './index-745f94ee.js';
|
|
4
4
|
|
|
5
5
|
/** Force wrap spaces around icons to make sure they are never stuck against text. */
|
|
6
6
|
function wrapChildrenIconWithSpaces(children) {
|
|
@@ -17,4 +17,4 @@ function wrapChildrenIconWithSpaces(children) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export { wrapChildrenIconWithSpaces as w };
|
|
20
|
-
//# sourceMappingURL=wrapChildrenIconWithSpaces-
|
|
20
|
+
//# sourceMappingURL=wrapChildrenIconWithSpaces-e6038f72.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapChildrenIconWithSpaces-
|
|
1
|
+
{"version":3,"file":"wrapChildrenIconWithSpaces-e6038f72.js","sources":["../../src/utils/react/wrapChildrenIconWithSpaces.tsx"],"sourcesContent":["import React, { Children } from 'react';\nimport { isComponentType } from '@lumx/react/utils/type';\nimport { Icon } from '@lumx/react';\n\n/** Force wrap spaces around icons to make sure they are never stuck against text. */\nexport function wrapChildrenIconWithSpaces(children: React.ReactNode): React.ReactNode {\n if (children === null || children === undefined) return undefined;\n return Children.toArray(children).flatMap((child) => {\n if (isComponentType(Icon)(child)) {\n return [' ', child, ' '];\n }\n if (\n React.isValidElement(child) &&\n child.props &&\n typeof child.props === 'object' &&\n 'children' in child.props\n ) {\n return React.cloneElement(child, undefined, wrapChildrenIconWithSpaces(child.props.children));\n }\n return child;\n });\n}\n"],"names":["wrapChildrenIconWithSpaces","children","undefined","Children","toArray","flatMap","child","isComponentType","Icon","React","isValidElement","props","cloneElement"],"mappings":";;;;AAIA;AACO,SAASA,0BAA0BA,CAACC,QAAyB,EAAmB;EACnF,IAAIA,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAKC,SAAS,EAAE,OAAOA,SAAS,CAAA;EACjE,OAAOC,QAAQ,CAACC,OAAO,CAACH,QAAQ,CAAC,CAACI,OAAO,CAAEC,KAAK,IAAK;AACjD,IAAA,IAAIC,eAAe,CAACC,IAAI,CAAC,CAACF,KAAK,CAAC,EAAE;AAC9B,MAAA,OAAO,CAAC,GAAG,EAAEA,KAAK,EAAE,GAAG,CAAC,CAAA;AAC5B,KAAA;IACA,iBACIG,cAAK,CAACC,cAAc,CAACJ,KAAK,CAAC,IAC3BA,KAAK,CAACK,KAAK,IACX,OAAOL,KAAK,CAACK,KAAK,KAAK,QAAQ,IAC/B,UAAU,IAAIL,KAAK,CAACK,KAAK,EAC3B;AACE,MAAA,oBAAOF,cAAK,CAACG,YAAY,CAACN,KAAK,EAAEJ,SAAS,EAAEF,0BAA0B,CAACM,KAAK,CAACK,KAAK,CAACV,QAAQ,CAAC,CAAC,CAAA;AACjG,KAAA;AACA,IAAA,OAAOK,KAAK,CAAA;AAChB,GAAC,CAAC,CAAA;AACN;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1042,24 +1042,13 @@ interface FlexBoxProps extends GenericProps {
|
|
|
1042
1042
|
*/
|
|
1043
1043
|
declare const FlexBox: Comp<FlexBoxProps, HTMLDivElement>;
|
|
1044
1044
|
|
|
1045
|
+
type GenericBlockGapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;
|
|
1045
1046
|
/**
|
|
1046
1047
|
* Accepted gap sizes for the generic block.
|
|
1047
1048
|
*/
|
|
1048
|
-
declare const GenericBlockGapSize:
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
readonly s: "s";
|
|
1052
|
-
readonly m: "m";
|
|
1053
|
-
readonly l: "l";
|
|
1054
|
-
readonly xl: "xl";
|
|
1055
|
-
readonly xxl: "xxl";
|
|
1056
|
-
readonly tiny: "tiny";
|
|
1057
|
-
readonly regular: "regular";
|
|
1058
|
-
readonly medium: "medium";
|
|
1059
|
-
readonly big: "big";
|
|
1060
|
-
readonly huge: "huge";
|
|
1061
|
-
}, "tiny" | "regular" | "medium" | "big" | "huge">;
|
|
1062
|
-
type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
|
|
1049
|
+
declare const GenericBlockGapSize: {
|
|
1050
|
+
[S in GenericBlockGapSize]: S;
|
|
1051
|
+
};
|
|
1063
1052
|
|
|
1064
1053
|
interface GenericBlockProps extends FlexBoxProps {
|
|
1065
1054
|
/**
|