@splunk/react-ui 5.2.0 → 5.4.0

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 (114) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +64 -59
  3. package/Box.js +2 -1
  4. package/Breadcrumbs.js +66 -63
  5. package/ButtonSimple.js +52 -52
  6. package/CHANGELOG.md +47 -0
  7. package/Calendar.js +8 -4
  8. package/CardLayout.js +39 -36
  9. package/Checkbox.d.ts +2 -0
  10. package/Checkbox.js +350 -0
  11. package/Clickable.js +5 -6
  12. package/Code.js +451 -536
  13. package/CollapsiblePanel.js +184 -210
  14. package/Color.js +903 -1023
  15. package/ControlGroup.js +2 -1
  16. package/Date.js +123 -119
  17. package/DefinitionList.js +100 -77
  18. package/Dropdown.js +2 -2
  19. package/DualListbox.js +409 -353
  20. package/File.js +102 -99
  21. package/FormRows.js +13 -11
  22. package/JSONTree.js +679 -1391
  23. package/Link.js +7 -7
  24. package/MIGRATION.md +27 -0
  25. package/Markdown.js +171 -156
  26. package/Menu.js +107 -100
  27. package/Modal.js +3 -3
  28. package/Multiselect.js +2698 -2767
  29. package/Paginator.js +2 -1
  30. package/Popover.js +201 -196
  31. package/Resize.js +11 -8
  32. package/ResultsMenu.js +913 -1029
  33. package/ScreenReaderContent.js +86 -130
  34. package/Scroll.js +366 -424
  35. package/Search.js +131 -127
  36. package/Select.js +1741 -1831
  37. package/Slider.js +1 -1
  38. package/SlidingPanels.js +129 -127
  39. package/StepBar.js +123 -97
  40. package/Switch.js +214 -242
  41. package/TabBar.js +10 -10
  42. package/Table.js +1255 -1248
  43. package/Text.js +180 -206
  44. package/TextArea.js +596 -675
  45. package/Tooltip.js +144 -139
  46. package/Tree.js +638 -682
  47. package/package.json +15 -16
  48. package/tsconfig.check-docs.json +8 -0
  49. package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
  50. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  51. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  52. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  53. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  54. package/types/src/Checkbox/Checkbox.d.ts +90 -0
  55. package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
  56. package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
  57. package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
  58. package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
  59. package/types/src/Checkbox/index.d.ts +2 -0
  60. package/types/src/Code/Code.d.ts +4 -1
  61. package/types/src/Code/LineHighlights.d.ts +1 -0
  62. package/types/src/Code/LineNumbers.d.ts +2 -1
  63. package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
  64. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
  65. package/types/src/Date/Date.d.ts +7 -1
  66. package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
  67. package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
  68. package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
  69. package/types/src/DualListbox/DualListbox.d.ts +1 -1
  70. package/types/src/DualListbox/Label.d.ts +7 -7
  71. package/types/src/DualListbox/Listbox.d.ts +2 -2
  72. package/types/src/DualListbox/ListboxContext.d.ts +1 -1
  73. package/types/src/File/File.d.ts +7 -1
  74. package/types/src/JSONTree/JSONTreeItem.d.ts +5 -3
  75. package/types/src/JSONTree/renderTreeItems.d.ts +3 -2
  76. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
  77. package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
  78. package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
  79. package/types/src/Modal/ModalContext.d.ts +1 -1
  80. package/types/src/Multiselect/Compact.d.ts +9 -3
  81. package/types/src/Multiselect/Multiselect.d.ts +7 -1
  82. package/types/src/Multiselect/Normal.d.ts +9 -3
  83. package/types/src/Number/utils.d.ts +1 -1
  84. package/types/src/Popover/getPlacement.d.ts +1 -1
  85. package/types/src/RadioList/Option.d.ts +1 -1
  86. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  87. package/types/src/Search/Search.d.ts +5 -1
  88. package/types/src/StepBar/StepBar.d.ts +4 -1
  89. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  90. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  91. package/types/src/Switch/Switch.d.ts +13 -1
  92. package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
  93. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
  94. package/types/src/TabBar/Tab.d.ts +3 -1
  95. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  96. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  97. package/types/src/TabLayout/Panel.d.ts +2 -0
  98. package/types/src/Table/ExpandButton.d.ts +1 -1
  99. package/types/src/Table/Head.d.ts +1 -1
  100. package/types/src/Table/Row.d.ts +1 -1
  101. package/types/src/Table/Table.d.ts +1 -0
  102. package/types/src/Tooltip/Tooltip.d.ts +14 -1
  103. package/types/src/Tree/TreeContext.d.ts +1 -1
  104. package/useControlled.js +61 -97
  105. package/usePrevious.js +30 -62
  106. package/useResizeObserver.js +95 -127
  107. package/NonInteractiveCheckbox.js +0 -101
  108. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
  109. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
  110. package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
  111. package/types/src/Switch/docs/examples/Error.d.ts +0 -6
  112. package/types/src/Text/IconOutlinedHide.d.ts +0 -3
  113. package/types/src/Text/IconOutlinedView.d.ts +0 -3
  114. /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/useControlled.js CHANGED
@@ -1,67 +1,34 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 5919:
6
- /***/ e => {
7
- e.exports = require("lodash/has");
8
- /***/ },
9
- /***/ 9497:
10
- /***/ e => {
11
- e.exports = require("react");
12
- /***/
13
- /******/ }
14
- };
15
- /************************************************************************/
16
- /******/ // The module cache
17
- /******/ var r = {};
18
- /******/
19
- /******/ // The require function
20
- /******/ function t(o) {
21
- /******/ // Check if module is in cache
22
- /******/ var n = r[o];
23
- /******/ if (n !== undefined) {
24
- /******/ return n.exports;
25
- /******/ }
26
- /******/ // Create a new module (and put it into the cache)
27
- /******/ var u = r[o] = {
28
- /******/ // no module.id needed
29
- /******/ // no module.loaded needed
30
- /******/ exports: {}
31
- /******/ };
32
- /******/
33
- /******/ // Execute the module function
34
- /******/ e[o](u, u.exports, t);
35
- /******/
36
- /******/ // Return the exports of the module
37
- /******/ return u.exports;
38
- /******/ }
4
+ /******/ // The require scope
5
+ /******/ var e = {};
39
6
  /******/
40
7
  /************************************************************************/
41
8
  /******/ /* webpack/runtime/compat get default export */
42
9
  /******/ (() => {
43
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
44
- /******/ t.n = e => {
45
- /******/ var r = e && e.__esModule ?
46
- /******/ () => e["default"]
47
- /******/ : () => e
11
+ /******/ e.n = r => {
12
+ /******/ var t = r && r.__esModule ?
13
+ /******/ () => r["default"]
14
+ /******/ : () => r
48
15
  /******/;
49
- t.d(r, {
50
- a: r
16
+ e.d(t, {
17
+ a: t
51
18
  });
52
- /******/ return r;
19
+ /******/ return t;
53
20
  /******/ };
54
21
  /******/ })();
55
22
  /******/
56
23
  /******/ /* webpack/runtime/define property getters */
57
24
  /******/ (() => {
58
25
  /******/ // define getter functions for harmony exports
59
- /******/ t.d = (e, r) => {
60
- /******/ for (var o in r) {
61
- /******/ if (t.o(r, o) && !t.o(e, o)) {
62
- /******/ Object.defineProperty(e, o, {
26
+ /******/ e.d = (r, t) => {
27
+ /******/ for (var o in t) {
28
+ /******/ if (e.o(t, o) && !e.o(r, o)) {
29
+ /******/ Object.defineProperty(r, o, {
63
30
  enumerable: true,
64
- get: r[o]
31
+ get: t[o]
65
32
  });
66
33
  /******/ }
67
34
  /******/ }
@@ -70,14 +37,14 @@
70
37
  /******/
71
38
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
72
39
  /******/ (() => {
73
- /******/ t.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
40
+ /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
74
41
  /******/;
75
42
  })();
76
43
  /******/
77
44
  /******/ /* webpack/runtime/make namespace object */
78
45
  /******/ (() => {
79
46
  /******/ // define __esModule on exports
80
- /******/ t.r = e => {
47
+ /******/ e.r = e => {
81
48
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
82
49
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
83
50
  value: "Module"
@@ -89,38 +56,36 @@
89
56
  /******/ };
90
57
  /******/ })();
91
58
  /******/
92
- /************************************************************************/ var o = {};
93
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
94
- (() => {
95
- // ESM COMPAT FLAG
96
- t.r(o);
97
- // EXPORTS
98
- t.d(o, {
99
- default: () => /* reexport */ l,
100
- isAllowedType: () => /* reexport */ f,
101
- isPrimitive: () => /* reexport */ a
102
- });
103
- // EXTERNAL MODULE: external "react"
104
- var e = t(9497);
105
- // CONCATENATED MODULE: external "lodash/isEqual"
106
- const r = require("lodash/isEqual");
107
- // EXTERNAL MODULE: external "lodash/has"
108
- var n = t(5919);
109
- var u = t.n(n);
110
- // CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
111
- function a(e) {
112
- return e === null || e === undefined || typeof e === "boolean" || typeof e === "string" || typeof e === "number";
59
+ /************************************************************************/ var r = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(r);
62
+ // EXPORTS
63
+ e.d(r, {
64
+ default: () => /* reexport */ l,
65
+ isAllowedType: () => /* reexport */ f,
66
+ isPrimitive: () => /* reexport */ a
67
+ });
68
+ // CONCATENATED MODULE: external "react"
69
+ const t = require("react");
70
+ // CONCATENATED MODULE: external "lodash/isEqual"
71
+ const o = require("lodash/isEqual");
72
+ // CONCATENATED MODULE: external "lodash/has"
73
+ const n = require("lodash/has");
74
+ var u = e.n(n);
75
+ // CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
76
+ function a(e) {
77
+ return e === null || e === undefined || typeof e === "boolean" || typeof e === "string" || typeof e === "number";
78
+ }
79
+ function f(e) {
80
+ if (a(e)) {
81
+ return true;
113
82
  }
114
- function f(e) {
115
- if (a(e)) {
116
- return true;
117
- }
118
- if (Array.isArray(e)) {
119
- return e.every(a);
120
- }
121
- return false;
83
+ if (Array.isArray(e)) {
84
+ return e.every(a);
122
85
  }
123
- /**
86
+ return false;
87
+ }
88
+ /**
124
89
  * This is a private component not intended for use outside @splunk/react-ui
125
90
  *
126
91
  * A hook that accepts a default value (as used in an uncontrolled component)
@@ -129,22 +94,21 @@
129
94
  * are not happening.
130
95
  *
131
96
  * Return the controlled state of the component.
132
- */ function i(r) {
133
- var t = r.componentProps, o = r.componentName, n = o === void 0 ? "this component" : o, a = r.defaultValuePropName, f = a === void 0 ? "defaultValue" : a, i = r.valuePropName, l = i === void 0 ? "value" : i;
134
- var s = (0, e.useRef)(u()(t, l));
135
- var d = (0, e.useRef)(t[f]);
136
- (0, e.useEffect)((function() {
137
- if (false) {}
138
- }), [ n, t, f, l ]);
139
- (0, e.useEffect)((function() {
140
- if (false) {}
141
- if (false) {}
142
- if (false) {}
143
- }), [ n, t, f, l ]);
144
- return s.current;
145
- }
146
- /* harmony default export */ const l = i;
147
- }) // CONCATENATED MODULE: ./src/useControlled/index.ts
148
- ();
149
- module.exports = o;
97
+ */ function i(e) {
98
+ var r = e.componentProps, o = e.componentName, n = o === void 0 ? "this component" : o, a = e.defaultValuePropName, f = a === void 0 ? "defaultValue" : a, i = e.valuePropName, l = i === void 0 ? "value" : i;
99
+ var s = (0, t.useRef)(u()(r, l));
100
+ var d = (0, t.useRef)(r[f]);
101
+ (0, t.useEffect)((function() {
102
+ if (false) {}
103
+ }), [ n, r, f, l ]);
104
+ (0, t.useEffect)((function() {
105
+ if (false) {}
106
+ if (false) {}
107
+ if (false) {}
108
+ }), [ n, r, f, l ]);
109
+ return s.current;
110
+ }
111
+ /* harmony default export */ const l = i;
112
+ // CONCATENATED MODULE: ./src/useControlled/index.ts
113
+ module.exports = r;
150
114
  /******/})();
package/usePrevious.js CHANGED
@@ -1,48 +1,19 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 9497:
6
- /***/ e => {
7
- e.exports = require("react");
8
- /***/
9
- /******/ }
10
- };
11
- /************************************************************************/
12
- /******/ // The module cache
13
- /******/ var r = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function t(o) {
17
- /******/ // Check if module is in cache
18
- /******/ var n = r[o];
19
- /******/ if (n !== undefined) {
20
- /******/ return n.exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var u = r[o] = {
24
- /******/ // no module.id needed
25
- /******/ // no module.loaded needed
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ e[o](u, u.exports, t);
31
- /******/
32
- /******/ // Return the exports of the module
33
- /******/ return u.exports;
34
- /******/ }
4
+ /******/ // The require scope
5
+ /******/ var e = {};
35
6
  /******/
36
7
  /************************************************************************/
37
8
  /******/ /* webpack/runtime/define property getters */
38
9
  /******/ (() => {
39
10
  /******/ // define getter functions for harmony exports
40
- /******/ t.d = (e, r) => {
41
- /******/ for (var o in r) {
42
- /******/ if (t.o(r, o) && !t.o(e, o)) {
43
- /******/ Object.defineProperty(e, o, {
11
+ /******/ e.d = (r, t) => {
12
+ /******/ for (var o in t) {
13
+ /******/ if (e.o(t, o) && !e.o(r, o)) {
14
+ /******/ Object.defineProperty(r, o, {
44
15
  enumerable: true,
45
- get: r[o]
16
+ get: t[o]
46
17
  });
47
18
  /******/ }
48
19
  /******/ }
@@ -51,14 +22,14 @@
51
22
  /******/
52
23
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
53
24
  /******/ (() => {
54
- /******/ t.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
25
+ /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
55
26
  /******/;
56
27
  })();
57
28
  /******/
58
29
  /******/ /* webpack/runtime/make namespace object */
59
30
  /******/ (() => {
60
31
  /******/ // define __esModule on exports
61
- /******/ t.r = e => {
32
+ /******/ e.r = e => {
62
33
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
63
34
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
64
35
  value: "Module"
@@ -70,19 +41,17 @@
70
41
  /******/ };
71
42
  /******/ })();
72
43
  /******/
73
- /************************************************************************/ var o = {};
74
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
75
- (() => {
76
- // ESM COMPAT FLAG
77
- t.r(o);
78
- // EXPORTS
79
- t.d(o, {
80
- default: () => /* reexport */ n
81
- });
82
- // EXTERNAL MODULE: external "react"
83
- var e = t(9497);
84
- // CONCATENATED MODULE: ./src/usePrevious/usePrevious.tsx
85
- /**
44
+ /************************************************************************/ var r = {};
45
+ // ESM COMPAT FLAG
46
+ e.r(r);
47
+ // EXPORTS
48
+ e.d(r, {
49
+ default: () => /* reexport */ n
50
+ });
51
+ // CONCATENATED MODULE: external "react"
52
+ const t = require("react");
53
+ // CONCATENATED MODULE: ./src/usePrevious/usePrevious.tsx
54
+ /**
86
55
  * This is a private component not intended for use outside @splunk/react-ui
87
56
  *
88
57
  * Keeps the previous version of a value. Useful for emulating the "prevState"
@@ -91,15 +60,14 @@
91
60
  *
92
61
  * @param value - The value to store
93
62
  */
94
- function r(r) {
95
- var t = (0, e.useRef)();
96
- (0, e.useEffect)((function() {
97
- t.current = r;
98
- }), [ r ]);
99
- return t.current;
100
- }
101
- /* harmony default export */ const n = r;
102
- }) // CONCATENATED MODULE: ./src/usePrevious/index.ts
103
- ();
104
- module.exports = o;
63
+ function o(e) {
64
+ var r = (0, t.useRef)();
65
+ (0, t.useEffect)((function() {
66
+ r.current = e;
67
+ }), [ e ]);
68
+ return r.current;
69
+ }
70
+ /* harmony default export */ const n = o;
71
+ // CONCATENATED MODULE: ./src/usePrevious/index.ts
72
+ module.exports = r;
105
73
  /******/})();
@@ -1,46 +1,17 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 9497:
6
- /***/ e => {
7
- e.exports = require("react");
8
- /***/
9
- /******/ }
10
- };
11
- /************************************************************************/
12
- /******/ // The module cache
13
- /******/ var r = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function t(n) {
17
- /******/ // Check if module is in cache
18
- /******/ var i = r[n];
19
- /******/ if (i !== undefined) {
20
- /******/ return i.exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var o = r[n] = {
24
- /******/ // no module.id needed
25
- /******/ // no module.loaded needed
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ e[n](o, o.exports, t);
31
- /******/
32
- /******/ // Return the exports of the module
33
- /******/ return o.exports;
34
- /******/ }
4
+ /******/ // The require scope
5
+ /******/ var e = {};
35
6
  /******/
36
7
  /************************************************************************/
37
8
  /******/ /* webpack/runtime/define property getters */
38
9
  /******/ (() => {
39
10
  /******/ // define getter functions for harmony exports
40
- /******/ t.d = (e, r) => {
11
+ /******/ e.d = (t, r) => {
41
12
  /******/ for (var n in r) {
42
- /******/ if (t.o(r, n) && !t.o(e, n)) {
43
- /******/ Object.defineProperty(e, n, {
13
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
14
+ /******/ Object.defineProperty(t, n, {
44
15
  enumerable: true,
45
16
  get: r[n]
46
17
  });
@@ -51,14 +22,14 @@
51
22
  /******/
52
23
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
53
24
  /******/ (() => {
54
- /******/ t.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
25
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
55
26
  /******/;
56
27
  })();
57
28
  /******/
58
29
  /******/ /* webpack/runtime/make namespace object */
59
30
  /******/ (() => {
60
31
  /******/ // define __esModule on exports
61
- /******/ t.r = e => {
32
+ /******/ e.r = e => {
62
33
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
63
34
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
64
35
  value: "Module"
@@ -70,107 +41,104 @@
70
41
  /******/ };
71
42
  /******/ })();
72
43
  /******/
73
- /************************************************************************/ var n = {};
74
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
75
- (() => {
76
- // ESM COMPAT FLAG
77
- t.r(n);
78
- // EXPORTS
79
- t.d(n, {
80
- default: () => /* reexport */ c
81
- });
82
- // EXTERNAL MODULE: external "react"
83
- var e = t(9497);
84
- // CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
85
- function r(e, r) {
86
- return a(e) || l(e, r) || o(e, r) || i();
87
- }
88
- function i() {
89
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
+ /************************************************************************/ var t = {};
45
+ // ESM COMPAT FLAG
46
+ e.r(t);
47
+ // EXPORTS
48
+ e.d(t, {
49
+ default: () => /* reexport */ c
50
+ });
51
+ // CONCATENATED MODULE: external "react"
52
+ const r = require("react");
53
+ // CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
54
+ function n(e, t) {
55
+ return a(e) || l(e, t) || o(e, t) || i();
56
+ }
57
+ function i() {
58
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
+ }
60
+ function o(e, t) {
61
+ if (e) {
62
+ if ("string" == typeof e) return u(e, t);
63
+ var r = {}.toString.call(e).slice(8, -1);
64
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? u(e, t) : void 0;
90
65
  }
91
- function o(e, r) {
92
- if (e) {
93
- if ("string" == typeof e) return u(e, r);
94
- var t = {}.toString.call(e).slice(8, -1);
95
- return "Object" === t && e.constructor && (t = e.constructor.name), "Map" === t || "Set" === t ? Array.from(e) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? u(e, r) : void 0;
96
- }
97
- }
98
- function u(e, r) {
99
- (null == r || r > e.length) && (r = e.length);
100
- for (var t = 0, n = Array(r); t < r; t++) {
101
- n[t] = e[t];
102
- }
103
- return n;
66
+ }
67
+ function u(e, t) {
68
+ (null == t || t > e.length) && (t = e.length);
69
+ for (var r = 0, n = Array(t); r < t; r++) {
70
+ n[r] = e[r];
104
71
  }
105
- function l(e, r) {
106
- var t = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
107
- if (null != t) {
108
- var n, i, o, u, l = [], a = !0, f = !1;
72
+ return n;
73
+ }
74
+ function l(e, t) {
75
+ var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
76
+ if (null != r) {
77
+ var n, i, o, u, l = [], a = !0, f = !1;
78
+ try {
79
+ if (o = (r = r.call(e)).next, 0 === t) {
80
+ if (Object(r) !== r) return;
81
+ a = !1;
82
+ } else for (;!(a = (n = o.call(r)).done) && (l.push(n.value), l.length !== t); a = !0) {
83
+ }
84
+ } catch (e) {
85
+ f = !0, i = e;
86
+ } finally {
109
87
  try {
110
- if (o = (t = t.call(e)).next, 0 === r) {
111
- if (Object(t) !== t) return;
112
- a = !1;
113
- } else for (;!(a = (n = o.call(t)).done) && (l.push(n.value), l.length !== r); a = !0) {
114
- }
115
- } catch (e) {
116
- f = !0, i = e;
88
+ if (!a && null != r["return"] && (u = r["return"](), Object(u) !== u)) return;
117
89
  } finally {
118
- try {
119
- if (!a && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
120
- } finally {
121
- if (f) throw i;
122
- }
90
+ if (f) throw i;
123
91
  }
124
- return l;
125
92
  }
93
+ return l;
126
94
  }
127
- function a(e) {
128
- if (Array.isArray(e)) return e;
129
- }
130
- /**
95
+ }
96
+ function a(e) {
97
+ if (Array.isArray(e)) return e;
98
+ }
99
+ /**
131
100
  * Watches a React ref element for changes in size.
132
101
  *
133
102
  * @param ref - The React ref to observe size changes on
134
- */ var f = function t(n, i) {
135
- var o = (0, e.useState)({
136
- width: 0,
137
- height: 0
138
- }), u = r(o, 2), l = u[0], a = u[1];
139
- (0, e.useEffect)((function() {
140
- var e = n.current;
141
- if (typeof window !== "undefined" && window.ResizeObserver) {
142
- var r = new ResizeObserver((function(e) {
143
- if (e[0]) {
144
- var r, t;
145
- var o = {
146
- width: (n === null || n === void 0 ? void 0 : (r = n.current) === null || r === void 0 ? void 0 : r.getBoundingClientRect().width) || 0,
147
- height: (n === null || n === void 0 ? void 0 : (t = n.current) === null || t === void 0 ? void 0 : t.getBoundingClientRect().height) || 0
148
- };
149
- a((function(e) {
150
- if (e.height !== o.height || e.width !== o.width) {
151
- i === null || i === void 0 ? void 0 : i(o);
152
- return o;
153
- }
154
- return e;
155
- }));
156
- }
157
- }));
158
- if (e) {
159
- r.observe(e);
103
+ */ var f = function e(t, i) {
104
+ var o = (0, r.useState)({
105
+ width: 0,
106
+ height: 0
107
+ }), u = n(o, 2), l = u[0], a = u[1];
108
+ (0, r.useEffect)((function() {
109
+ var e = t.current;
110
+ if (typeof window !== "undefined" && window.ResizeObserver) {
111
+ var r = new ResizeObserver((function(e) {
112
+ if (e[0]) {
113
+ var r, n;
114
+ var o = {
115
+ width: (t === null || t === void 0 ? void 0 : (r = t.current) === null || r === void 0 ? void 0 : r.getBoundingClientRect().width) || 0,
116
+ height: (t === null || t === void 0 ? void 0 : (n = t.current) === null || n === void 0 ? void 0 : n.getBoundingClientRect().height) || 0
117
+ };
118
+ a((function(e) {
119
+ if (e.height !== o.height || e.width !== o.width) {
120
+ i === null || i === void 0 ? void 0 : i(o);
121
+ return o;
122
+ }
123
+ return e;
124
+ }));
160
125
  }
161
- return function() {
162
- if (e) {
163
- r.unobserve(e);
164
- }
165
- };
126
+ }));
127
+ if (e) {
128
+ r.observe(e);
166
129
  }
167
- // Return a no-op function to satisfy consistent-return rule
168
- return function() {};
169
- }), [ i, n ]);
170
- return l;
171
- };
172
- /* harmony default export */ const c = f;
173
- }) // CONCATENATED MODULE: ./src/useResizeObserver/index.ts
174
- ();
175
- module.exports = n;
130
+ return function() {
131
+ if (e) {
132
+ r.unobserve(e);
133
+ }
134
+ };
135
+ }
136
+ // Return a no-op function to satisfy consistent-return rule
137
+ return function() {};
138
+ }), [ i, t ]);
139
+ return l;
140
+ };
141
+ /* harmony default export */ const c = f;
142
+ // CONCATENATED MODULE: ./src/useResizeObserver/index.ts
143
+ module.exports = t;
176
144
  /******/})();