@splunk/react-ui 5.0.0-beta.2 → 5.0.0-beta.4

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 (187) hide show
  1. package/Accordion.js +185 -243
  2. package/Animation.js +2 -2
  3. package/Button.js +4 -4
  4. package/ButtonGroup.js +10 -11
  5. package/ButtonSimple.js +48 -42
  6. package/CHANGELOG.md +26 -0
  7. package/CHANGELOG.v5.mdx +81 -0
  8. package/Calendar.js +352 -469
  9. package/Card.js +178 -321
  10. package/Chip.js +154 -296
  11. package/Clickable.js +30 -30
  12. package/Code.js +64 -49
  13. package/Color.js +546 -462
  14. package/ComboBox.js +575 -767
  15. package/Date.js +144 -136
  16. package/Divider.js +29 -26
  17. package/DualListbox.js +441 -444
  18. package/File.js +707 -981
  19. package/FormRows.js +260 -286
  20. package/Image.js +124 -251
  21. package/JSONTree.js +129 -129
  22. package/Layout.d.ts +2 -0
  23. package/Link.js +12 -12
  24. package/MIGRATION.mdx +22 -1
  25. package/MIGRATION.v5.mdx +12 -1
  26. package/Menu.js +76 -76
  27. package/Message.js +77 -100
  28. package/MessageBar.js +141 -251
  29. package/Modal.js +42 -40
  30. package/ModalLayer.js +12 -12
  31. package/Multiselect.js +1989 -2362
  32. package/NonInteractiveCheckbox.js +30 -118
  33. package/Number.js +75 -73
  34. package/Popover.js +348 -350
  35. package/Progress.js +1 -1
  36. package/RadioBar.js +136 -136
  37. package/Resize.js +62 -65
  38. package/Scroll.js +2 -2
  39. package/Select.js +281 -283
  40. package/SidePanel.js +53 -55
  41. package/Slider.js +370 -364
  42. package/SlidingPanels.js +100 -102
  43. package/SplitButton.js +170 -343
  44. package/StaticContent.js +15 -13
  45. package/StepBar.js +61 -60
  46. package/Switch.js +150 -164
  47. package/TabBar.js +544 -417
  48. package/Table.js +1711 -1540
  49. package/Text.js +28 -26
  50. package/TextArea.js +26 -26
  51. package/Tooltip.js +416 -562
  52. package/TransitionOpen.js +179 -158
  53. package/Tree.d.ts +2 -0
  54. package/WaitSpinner.js +1 -1
  55. package/package.json +7 -9
  56. package/types/src/Accordion/Accordion.d.ts +14 -21
  57. package/types/src/Accordion/AccordionContext.d.ts +0 -1
  58. package/types/src/Animation/Animation.d.ts +2 -3
  59. package/types/src/AnimationToggle/docs/examples/Provider.d.ts +2 -2
  60. package/types/src/AnimationToggle/docs/examples/ToggleComponent.d.ts +2 -2
  61. package/types/src/AnimationToggle/useAnimationToggle.d.ts +1 -1
  62. package/types/src/Button/Button.d.ts +2 -2
  63. package/types/src/ButtonGroup/ButtonGroupContext.d.ts +0 -1
  64. package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -3
  65. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  66. package/types/src/Calendar/Calendar.d.ts +2 -2
  67. package/types/src/Calendar/{DateTable.d.ts → DateGrid.d.ts} +9 -9
  68. package/types/src/Calendar/Day.d.ts +8 -4
  69. package/types/src/Card/Card.d.ts +27 -14
  70. package/types/src/CardLayout/CardLayoutContext.d.ts +0 -1
  71. package/types/src/CardLayout/docs/examples/Interactive.d.ts +2 -2
  72. package/types/src/Clickable/Clickable.d.ts +1 -1
  73. package/types/src/CollapsiblePanel/SingleOpenPanelGroupContext.d.ts +0 -1
  74. package/types/src/Color/Color.d.ts +3 -3
  75. package/types/src/Color/ColorInput.d.ts +27 -0
  76. package/types/src/Color/Palette.d.ts +11 -18
  77. package/types/src/Color/Swatch.d.ts +3 -1
  78. package/types/src/ComboBox/ComboBox.d.ts +46 -50
  79. package/types/src/ComboBox/Option.d.ts +34 -18
  80. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +2 -2
  81. package/types/src/Date/Date.d.ts +3 -2
  82. package/types/src/Date/docs/examples/Controlled.d.ts +2 -2
  83. package/types/src/Date/docs/examples/HighlightToday.d.ts +2 -2
  84. package/types/src/DefinitionList/DefinitionListContext.d.ts +0 -1
  85. package/types/src/Divider/Divider.d.ts +14 -6
  86. package/types/src/Divider/docs/examples/Appearance.d.ts +3 -0
  87. package/types/src/DualListbox/DualListbox.d.ts +5 -1
  88. package/types/src/File/File.d.ts +6 -6
  89. package/types/src/File/FileContext.d.ts +0 -1
  90. package/types/src/File/Item.d.ts +11 -3
  91. package/types/src/File/ItemIcon.d.ts +7 -0
  92. package/types/src/File/docs/examples/Disabled.d.ts +2 -2
  93. package/types/src/File/docs/examples/DropAnywhere.d.ts +2 -2
  94. package/types/src/File/docs/examples/Multi.d.ts +2 -2
  95. package/types/src/File/docs/examples/Single.d.ts +2 -2
  96. package/types/src/FormRows/FormRows.d.ts +8 -8
  97. package/types/src/FormRows/FormRowsContext.d.ts +1 -2
  98. package/types/src/FormRows/Row.d.ts +2 -2
  99. package/types/src/FormRows/RowInternal.d.ts +1 -1
  100. package/types/src/FormRows/SortableRow.d.ts +3 -3
  101. package/types/src/FormRows/docs/examples/Basic.d.ts +2 -2
  102. package/types/src/FormRows/docs/examples/Header.d.ts +2 -2
  103. package/types/src/FormRows/docs/examples/Menu.d.ts +2 -2
  104. package/types/src/FormRows/docs/examples/ReorderOnly.d.ts +2 -2
  105. package/types/src/Image/Image.d.ts +1 -4
  106. package/types/src/JSONTree/docs/examples/Events.d.ts +2 -2
  107. package/types/src/Layout/Layout.d.ts +1 -0
  108. package/types/src/Link/icons/External.d.ts +1 -2
  109. package/types/src/Menu/Divider.d.ts +1 -1
  110. package/types/src/Menu/MenuContext.d.ts +0 -1
  111. package/types/src/MessageBar/MessageBar.d.ts +5 -1
  112. package/types/src/Modal/ModalContext.d.ts +0 -1
  113. package/types/src/Multiselect/Compact.d.ts +49 -21
  114. package/types/src/Multiselect/Multiselect.d.ts +73 -30
  115. package/types/src/Multiselect/Normal.d.ts +46 -57
  116. package/types/src/Multiselect/Option.d.ts +42 -18
  117. package/types/src/Multiselect/docs/examples/Children.d.ts +2 -2
  118. package/types/src/Multiselect/docs/examples/Controlled.d.ts +2 -2
  119. package/types/src/Multiselect/docs/examples/CustomizeSelected.d.ts +2 -2
  120. package/types/src/Multiselect/docs/examples/Disabled.d.ts +2 -2
  121. package/types/src/Multiselect/docs/examples/Error.d.ts +2 -2
  122. package/types/src/Multiselect/docs/examples/Fetching.d.ts +2 -2
  123. package/types/src/Multiselect/docs/examples/LoadMoreOnScrollBottom.d.ts +2 -2
  124. package/types/src/Multiselect/docs/examples/NewValues.d.ts +2 -2
  125. package/types/src/Multiselect/docs/examples/TabInput.d.ts +2 -2
  126. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +9 -8
  127. package/types/src/Number/Number.d.ts +1 -0
  128. package/types/src/Number/docs/examples/Basic.d.ts +2 -2
  129. package/types/src/Number/docs/examples/Limits.d.ts +2 -2
  130. package/types/src/Number/docs/examples/Locale.d.ts +2 -2
  131. package/types/src/Popover/Popover.d.ts +1 -1
  132. package/types/src/Popover/PopoverMenuContext.d.ts +0 -1
  133. package/types/src/RadioBar/RadioBar.d.ts +1 -1
  134. package/types/src/RadioBar/RadioBarContext.d.ts +0 -1
  135. package/types/src/RadioList/RadioListContext.d.ts +0 -1
  136. package/types/src/Scroll/Inner.d.ts +1 -1
  137. package/types/src/Scroll/docs/examples/Controlled.d.ts +2 -2
  138. package/types/src/Search/Search.d.ts +2 -2
  139. package/types/src/Select/SelectBase.d.ts +2 -2
  140. package/types/src/SidePanel/SidePanel.d.ts +8 -3
  141. package/types/src/Slider/Slider.d.ts +1 -1
  142. package/types/src/Slider/docs/examples/Controlled.d.ts +2 -2
  143. package/types/src/Slider/docs/examples/CustomLabels.d.ts +2 -2
  144. package/types/src/Slider/getStepMarksBackground.d.ts +8 -0
  145. package/types/src/SlidingPanels/Panel.d.ts +2 -2
  146. package/types/src/SlidingPanels/SlidingPanels.d.ts +2 -2
  147. package/types/src/SlidingPanels/docs/examples/Basic.d.ts +2 -2
  148. package/types/src/SlidingPanels/docs/examples/Dropdown.d.ts +2 -2
  149. package/types/src/SplitButton/Item.d.ts +34 -20
  150. package/types/src/SplitButton/SplitButton.d.ts +4 -1
  151. package/types/src/StaticContent/StaticContent.d.ts +3 -1
  152. package/types/src/StepBar/Step.d.ts +1 -1
  153. package/types/src/StepBar/StepBar.d.ts +1 -1
  154. package/types/src/StepBar/StepBarContext.d.ts +0 -1
  155. package/types/src/Switch/Switch.d.ts +1 -9
  156. package/types/src/Switch/docs/examples/Basic.d.ts +2 -2
  157. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -2
  158. package/types/src/TabBar/Tab.d.ts +12 -5
  159. package/types/src/TabBar/TabBar.d.ts +4 -3
  160. package/types/src/TabBar/TabBarContext.d.ts +7 -2
  161. package/types/src/Table/Head.d.ts +4 -15
  162. package/types/src/Table/HeadCell.d.ts +23 -25
  163. package/types/src/Table/HeadDropdownCell.d.ts +23 -26
  164. package/types/src/Table/HeadInner.d.ts +4 -10
  165. package/types/src/Table/Row.d.ts +6 -6
  166. package/types/src/Table/Table.d.ts +3 -8
  167. package/types/src/Table/TableContext.d.ts +0 -1
  168. package/types/src/Table/Toggle.d.ts +1 -1
  169. package/types/src/Text/Text.d.ts +5 -1
  170. package/types/src/Tooltip/Tooltip.d.ts +26 -58
  171. package/types/src/Tooltip/docs/examples/Controlled.d.ts +2 -2
  172. package/types/src/TransitionOpen/TransitionOpen.d.ts +6 -1
  173. package/types/src/Tree/TreeContext.d.ts +0 -1
  174. package/types/src/useForceUpdate/useForceUpdate.d.ts +0 -1
  175. package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -1
  176. package/types/src/utils/types.d.ts +2 -3
  177. package/useResizeObserver.js +26 -19
  178. package/types/src/File/Icon.d.ts +0 -3
  179. package/types/src/File/IconCloud.d.ts +0 -3
  180. package/types/src/File/PaperClip.d.ts +0 -3
  181. package/types/src/File/Retry.d.ts +0 -2
  182. package/types/src/File/Trash.d.ts +0 -3
  183. package/types/src/FormRows/icons/FormRowsPlusIcon.d.ts +0 -3
  184. package/types/src/Image/icons/Cross.d.ts +0 -3
  185. package/types/src/Multiselect/docs/examples/CompactSelectAll.d.ts +0 -3
  186. package/types/src/Table/docs/examples/prisma/DockedHeaderScrollbar.d.ts +0 -3
  187. package/types/src/Tooltip/InfoIcon.d.ts +0 -4
package/SplitButton.js CHANGED
@@ -8,27 +8,27 @@
8
8
  /******/ /* webpack/runtime/compat get default export */
9
9
  /******/ (() => {
10
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
- /******/ e.n = r => {
12
- /******/ var t = r && r.__esModule ?
13
- /******/ () => r["default"]
14
- /******/ : () => r
11
+ /******/ e.n = n => {
12
+ /******/ var r = n && n.__esModule ?
13
+ /******/ () => n["default"]
14
+ /******/ : () => n
15
15
  /******/;
16
- e.d(t, {
17
- a: t
16
+ e.d(r, {
17
+ a: r
18
18
  });
19
- /******/ return t;
19
+ /******/ return r;
20
20
  /******/ };
21
21
  /******/ })();
22
22
  /******/
23
23
  /******/ /* webpack/runtime/define property getters */
24
24
  /******/ (() => {
25
25
  /******/ // define getter functions for harmony exports
26
- /******/ e.d = (r, t) => {
27
- /******/ for (var n in t) {
28
- /******/ if (e.o(t, n) && !e.o(r, n)) {
29
- /******/ Object.defineProperty(r, n, {
26
+ /******/ e.d = (n, r) => {
27
+ /******/ for (var t in r) {
28
+ /******/ if (e.o(r, t) && !e.o(n, t)) {
29
+ /******/ Object.defineProperty(n, t, {
30
30
  enumerable: true,
31
- get: t[n]
31
+ get: r[t]
32
32
  });
33
33
  /******/ }
34
34
  /******/ }
@@ -37,7 +37,7 @@
37
37
  /******/
38
38
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
39
  /******/ (() => {
40
- /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
40
+ /******/ e.o = (e, n) => Object.prototype.hasOwnProperty.call(e, n)
41
41
  /******/;
42
42
  })();
43
43
  /******/
@@ -56,405 +56,232 @@
56
56
  /******/ };
57
57
  /******/ })();
58
58
  /******/
59
- /************************************************************************/ var r = {};
59
+ /************************************************************************/ var n = {};
60
60
  // ESM COMPAT FLAG
61
- e.r(r);
61
+ e.r(n);
62
62
  // EXPORTS
63
- e.d(r, {
64
- Item: () => /* reexport */ K,
65
- default: () => /* reexport */ Y
63
+ e.d(n, {
64
+ Item: () => /* reexport */ P,
65
+ default: () => /* reexport */ T
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
- const t = require("react");
69
- var n = e.n(t);
68
+ const r = require("react");
69
+ var t = e.n(r);
70
70
  // CONCATENATED MODULE: external "prop-types"
71
- const i = require("prop-types");
72
- var o = e.n(i);
73
- // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronDown"
74
- const a = require("@splunk/react-icons/enterprise/ChevronDown");
75
- var l = e.n(a);
71
+ const a = require("prop-types");
72
+ var i = e.n(a);
73
+ // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
74
+ const l = require("@splunk/react-icons/CaretSmallDown");
75
+ var o = e.n(l);
76
76
  // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
77
77
  const c = require("@splunk/react-ui/Dropdown");
78
78
  var u = e.n(c);
79
79
  // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
80
80
  const s = require("@splunk/react-ui/Menu");
81
- var p = e.n(s);
81
+ var d = e.n(s);
82
82
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
83
- const f = require("@splunk/ui-utils/i18n");
83
+ const p = require("@splunk/ui-utils/i18n");
84
84
  // CONCATENATED MODULE: external "styled-components"
85
- const d = require("styled-components");
86
- var v = e.n(d);
85
+ const f = require("styled-components");
86
+ var v = e.n(f);
87
87
  // CONCATENATED MODULE: external "@splunk/react-ui/Button"
88
88
  const b = require("@splunk/react-ui/Button");
89
89
  var y = e.n(b);
90
- // CONCATENATED MODULE: external "@splunk/react-ui/Box"
91
- const h = require("@splunk/react-ui/Box");
92
- var m = e.n(h);
93
90
  // CONCATENATED MODULE: external "@splunk/themes"
94
- const g = require("@splunk/themes");
91
+ const m = require("@splunk/themes");
95
92
  // CONCATENATED MODULE: ./src/SplitButton/SplitButtonStyles.ts
96
- var O = v()(y()).withConfig({
97
- displayName: "SplitButtonStyles__StyledButton",
93
+ var g = v()(y()).withConfig({
94
+ displayName: "SplitButtonStyles__StyledToggle",
98
95
  componentId: "sc-9igsyh-0"
99
- })([ "", "" ], (0, g.pick)({
100
- prisma: function e(r) {
101
- var t = r.appearance;
102
- return t === "default" && (0, d.css)([ "&:first-child{border-right:1px solid ", ";}" ], g.variables.interactiveColorBorder);
103
- }
104
- }));
105
- var w = v()(m()).withConfig({
106
- displayName: "SplitButtonStyles__StyledSeparator",
107
- componentId: "sc-9igsyh-1"
108
- })([ "width:", ";height:", ";background-color:", ";" ], (0, g.pick)({
109
- prisma: (0, g.pickVariant)("$appearance", {
110
- primary: "2px",
111
- destructive: "2px"
112
- }),
113
- enterprise: "1px"
114
- }), g.variables.inputHeight, (0, g.pickVariant)("$appearance", {
115
- primary: {
116
- enterprise: g.variables.white,
117
- prisma: {
118
- light: g.variables.white,
119
- dark: g.variables.black
120
- }
121
- },
122
- destructive: {
123
- enterprise: {
124
- light: g.variables.white,
125
- dark: g.variables.black
126
- },
127
- prisma: {
128
- light: g.variables.white,
129
- dark: g.variables.black
130
- }
131
- }
132
- }));
133
- var k = v().div.withConfig({
96
+ })([ "min-width:0;width:24px;" ]);
97
+ var h = v().div.withConfig({
134
98
  displayName: "SplitButtonStyles__StyledDiv",
135
- componentId: "sc-9igsyh-2"
136
- })([ "", " ", "" ], g.mixins.reset("inline-flex"), (function(e) {
137
- var r = e.$inline;
138
- return !r && (0, d.css)([ "width:100%;" ]);
99
+ componentId: "sc-9igsyh-1"
100
+ })([ "", " ", " ", "" ], m.mixins.reset("inline-flex"), (function(e) {
101
+ var n = e.$appearance;
102
+ return (n === "primary" || n === "destructive") && (0, f.css)([ "gap:1px;" ]);
103
+ }), (function(e) {
104
+ var n = e.$inline;
105
+ return !n && (0, f.css)([ "width:100%;" ]);
139
106
  }));
140
107
  // CONCATENATED MODULE: external "lodash/omit"
141
- const S = require("lodash/omit");
142
- var j = e.n(S);
143
- // CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
144
- // A utility that attempts to move an element into view by scrolling it's derived parent.
145
- var P = function e(r) {
146
- if (!r) {
147
- return;
148
- }
149
- var t = r.offsetParent;
150
- if (!t) {
151
- return;
152
- }
153
- // Below the bottom of the container.
154
- if (t.scrollTop + t.clientHeight < r.offsetTop + r.clientHeight) {
155
- t.scrollTop = r.offsetTop + r.clientHeight - t.clientHeight;
156
- // Above the top of the container.
157
- } else if (t.scrollTop > r.offsetTop) {
158
- t.scrollTop = r.offsetTop;
159
- }
160
- };
108
+ const O = require("lodash/omit");
109
+ var S = e.n(O);
161
110
  // CONCATENATED MODULE: ./src/SplitButton/Item.tsx
162
- function _(e) {
163
- "@babel/helpers - typeof";
164
- return _ = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
165
- return typeof e;
166
- } : function(e) {
167
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
168
- }, _(e);
169
- }
170
- function C() {
171
- return C = Object.assign ? Object.assign.bind() : function(e) {
172
- for (var r = 1; r < arguments.length; r++) {
173
- var t = arguments[r];
174
- for (var n in t) {
175
- ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
111
+ function k() {
112
+ return k = Object.assign ? Object.assign.bind() : function(e) {
113
+ for (var n = 1; n < arguments.length; n++) {
114
+ var r = arguments[n];
115
+ for (var t in r) {
116
+ ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
176
117
  }
177
118
  }
178
119
  return e;
179
- }, C.apply(null, arguments);
120
+ }, k.apply(null, arguments);
180
121
  }
181
- function E(e, r) {
122
+ function w(e, n) {
182
123
  if (null == e) return {};
183
- var t, n, i = T(e, r);
124
+ var r, t, a = C(e, n);
184
125
  if (Object.getOwnPropertySymbols) {
185
- var o = Object.getOwnPropertySymbols(e);
186
- for (n = 0; n < o.length; n++) {
187
- t = o[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (i[t] = e[t]);
126
+ var i = Object.getOwnPropertySymbols(e);
127
+ for (t = 0; t < i.length; t++) {
128
+ r = i[t], n.includes(r) || {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
188
129
  }
189
130
  }
190
- return i;
131
+ return a;
191
132
  }
192
- function T(e, r) {
133
+ function C(e, n) {
193
134
  if (null == e) return {};
194
- var t = {};
195
- for (var n in e) {
196
- if ({}.hasOwnProperty.call(e, n)) {
197
- if (r.includes(n)) continue;
198
- t[n] = e[n];
199
- }
200
- }
201
- return t;
202
- }
203
- function R(e, r) {
204
- if (!(e instanceof r)) throw new TypeError("Cannot call a class as a function");
205
- }
206
- function q(e, r) {
207
- for (var t = 0; t < r.length; t++) {
208
- var n = r[t];
209
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
210
- Object.defineProperty(e, A(n.key), n);
211
- }
212
- }
213
- function I(e, r, t) {
214
- return r && q(e.prototype, r), t && q(e, t), Object.defineProperty(e, "prototype", {
215
- writable: !1
216
- }), e;
217
- }
218
- function x(e, r) {
219
- if ("function" != typeof r && null !== r) throw new TypeError("Super expression must either be null or a function");
220
- e.prototype = Object.create(r && r.prototype, {
221
- constructor: {
222
- value: e,
223
- writable: !0,
224
- configurable: !0
135
+ var r = {};
136
+ for (var t in e) {
137
+ if ({}.hasOwnProperty.call(e, t)) {
138
+ if (n.includes(t)) continue;
139
+ r[t] = e[t];
225
140
  }
226
- }), Object.defineProperty(e, "prototype", {
227
- writable: !1
228
- }), r && B(e, r);
229
- }
230
- function B(e, r) {
231
- return B = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, r) {
232
- return e.__proto__ = r, e;
233
- }, B(e, r);
234
- }
235
- function M(e) {
236
- var r = $();
237
- return function() {
238
- var t, n = D(e);
239
- if (r) {
240
- var i = D(this).constructor;
241
- t = Reflect.construct(n, arguments, i);
242
- } else t = n.apply(this, arguments);
243
- return H(this, t);
244
- };
245
- }
246
- function H(e, r) {
247
- if (r && ("object" == _(r) || "function" == typeof r)) return r;
248
- if (void 0 !== r) throw new TypeError("Derived constructors may only return object or undefined");
249
- return N(e);
250
- }
251
- function N(e) {
252
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
253
- return e;
254
- }
255
- function $() {
256
- try {
257
- var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
258
- } catch (e) {}
259
- return ($ = function r() {
260
- return !!e;
261
- })();
262
- }
263
- function D(e) {
264
- return D = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
265
- return e.__proto__ || Object.getPrototypeOf(e);
266
- }, D(e);
267
- }
268
- function V(e, r, t) {
269
- return (r = A(r)) in e ? Object.defineProperty(e, r, {
270
- value: t,
271
- enumerable: !0,
272
- configurable: !0,
273
- writable: !0
274
- }) : e[r] = t, e;
275
- }
276
- function A(e) {
277
- var r = z(e, "string");
278
- return "symbol" == _(r) ? r : r + "";
279
- }
280
- function z(e, r) {
281
- if ("object" != _(e) || !e) return e;
282
- var t = e[Symbol.toPrimitive];
283
- if (void 0 !== t) {
284
- var n = t.call(e, r || "default");
285
- if ("object" != _(n)) return n;
286
- throw new TypeError("@@toPrimitive must return a primitive value.");
287
141
  }
288
- return ("string" === r ? String : Number)(e);
142
+ return r;
289
143
  }
290
- var F = {
291
- appearance: o().oneOf([ "default", "primary", "destructive" ]),
292
- children: o().node,
293
- disabled: o().bool,
294
- isMain: o().bool,
295
- onClick: o().func
296
- };
297
- var G = {
298
- appearance: "default"
144
+ /** @public */ var j = {
145
+ appearance: i().oneOf([ "default", "secondary", "primary", "destructive", "destructiveSecondary" ]),
146
+ children: i().node,
147
+ disabled: i().bool,
148
+ elementRef: i().oneOfType([ i().func, i().object ]),
149
+ icon: i().node,
150
+ isMain: i().bool,
151
+ onClick: i().func
299
152
  };
300
153
  /**
301
- * An item within a `SplitButton`. This inherits from
302
- * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
303
- * so any elements passed to it must also be pure.
304
- */ var J = function(e) {
305
- x(t, e);
306
- var r = M(t);
307
- function t() {
308
- var e;
309
- R(this, t);
310
- for (var i = arguments.length, o = new Array(i), a = 0; a < i; a++) {
311
- o[a] = arguments[a];
154
+ * An item within a `SplitButton`.
155
+ */ function E(e) {
156
+ var n = e.appearance, a = n === void 0 ? "secondary" : n, i = e.disabled, l = e.elementRef, o = e.icon, c = e.isMain, u = e.children, s = e.onClick, p = w(e, [ "appearance", "disabled", "elementRef", "icon", "isMain", "children", "onClick" ]);
157
+ // @docs-props-type ItemPropsBase
158
+ var f = (0, r.useCallback)((function(e) {
159
+ if (!i) {
160
+ s === null || s === void 0 ? void 0 : s(e, {});
312
161
  }
313
- e = r.call.apply(r, [ this ].concat(o));
314
- V(N(e), "itemRef", n().createRef());
315
- V(N(e), "handleClick", (function(r) {
316
- var t = e.props, n = t.disabled, i = t.onClick;
317
- if (!n) {
318
- i === null || i === void 0 ? void 0 : i(r);
319
- }
320
- }));
321
- return e;
322
- }
323
- // @docs-props-type ItemPropsBase
324
- I(t, [ {
325
- key: "scrollIntoViewIfNeeded",
326
- // eslint-disable-next-line react/no-unused-class-component-methods
327
- value: function e() {
328
- P(this.itemRef.current);
329
- }
330
- /**
331
- * Place focus on the item.
332
- */
333
- // eslint-disable-next-line react/no-unused-class-component-methods
334
- }, {
335
- key: "focus",
336
- value: function e() {
337
- var r, t;
338
- (r = this.itemRef) === null || r === void 0 ? void 0 : (t = r.current) === null || t === void 0 ? void 0 : t.focus();
339
- }
340
- }, {
341
- key: "render",
342
- value: function e() {
343
- var r = this.props, t = r.disabled, i = r.isMain, o = r.children, a = r.appearance, l = E(r, [ "disabled", "isMain", "children", "appearance" ]);
344
- if (i) {
345
-
346
- return n().createElement(O, C({
347
- onClick: this.handleClick,
348
- disabled: t,
349
- append: true,
350
- appearance: a
351
- }, l), o);
352
- }
353
-
354
- return n().createElement(p().Item, C({
355
- elementRef: this.itemRef,
356
- onClick: this.handleClick,
357
- disabled: t
358
- }, j()(l, [ "role" ])), o);
162
+ }), [ i, s ]);
163
+ var v = (0, r.useCallback)((function(e, n) {
164
+ var r = n.action, t = n.icon, a = n.label, l = n.value;
165
+ if (!i) {
166
+ s === null || s === void 0 ? void 0 : s(e, {
167
+ action: r,
168
+ icon: t,
169
+ label: a,
170
+ value: l
171
+ });
359
172
  }
360
- } ]);
361
- return t;
362
- }(t.PureComponent);
363
- V(J, "propTypes", F);
364
- V(J, "defaultProps", G);
365
- /* harmony default export */ const K = J;
173
+ }), [ i, s ]);
174
+ if (c) {
175
+
176
+ return t().createElement(y(), k({
177
+ appearance: a,
178
+ append: true,
179
+ disabled: i,
180
+ elementRef: l,
181
+ icon: o,
182
+ onClick: v
183
+ }, p), u);
184
+ }
185
+
186
+ return t().createElement(d().Item, k({
187
+ disabled: i,
188
+ elementRef: l,
189
+ onClick: f,
190
+ startAdornment: o
191
+ }, S()(p, [ "role" ])), u);
192
+ }
193
+ E.propTypes = j;
194
+ /* harmony default export */ const P = E;
366
195
  // CONCATENATED MODULE: ./src/SplitButton/SplitButton.tsx
367
- function L() {
368
- return L = Object.assign ? Object.assign.bind() : function(e) {
369
- for (var r = 1; r < arguments.length; r++) {
370
- var t = arguments[r];
371
- for (var n in t) {
372
- ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
196
+ function q() {
197
+ return q = Object.assign ? Object.assign.bind() : function(e) {
198
+ for (var n = 1; n < arguments.length; n++) {
199
+ var r = arguments[n];
200
+ for (var t in r) {
201
+ ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
373
202
  }
374
203
  }
375
204
  return e;
376
- }, L.apply(null, arguments);
205
+ }, q.apply(null, arguments);
377
206
  }
378
- function Q(e, r) {
207
+ function _(e, n) {
379
208
  if (null == e) return {};
380
- var t, n, i = U(e, r);
209
+ var r, t, a = M(e, n);
381
210
  if (Object.getOwnPropertySymbols) {
382
- var o = Object.getOwnPropertySymbols(e);
383
- for (n = 0; n < o.length; n++) {
384
- t = o[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (i[t] = e[t]);
211
+ var i = Object.getOwnPropertySymbols(e);
212
+ for (t = 0; t < i.length; t++) {
213
+ r = i[t], n.includes(r) || {}.propertyIsEnumerable.call(e, r) && (a[r] = e[r]);
385
214
  }
386
215
  }
387
- return i;
216
+ return a;
388
217
  }
389
- function U(e, r) {
218
+ function M(e, n) {
390
219
  if (null == e) return {};
391
- var t = {};
392
- for (var n in e) {
393
- if ({}.hasOwnProperty.call(e, n)) {
394
- if (r.includes(n)) continue;
395
- t[n] = e[n];
220
+ var r = {};
221
+ for (var t in e) {
222
+ if ({}.hasOwnProperty.call(e, t)) {
223
+ if (n.includes(t)) continue;
224
+ r[t] = e[t];
396
225
  }
397
226
  }
398
- return t;
227
+ return r;
399
228
  }
400
- var W = {
401
- appearance: o().oneOf([ "default", "primary", "destructive" ]),
402
- children: o().node,
403
- disabled: o().bool,
404
- elementRef: o().oneOfType([ o().func, o().object ]),
405
- onClick: o().func,
406
- inline: o().bool
229
+ var R = {
230
+ appearance: i().oneOf([ "default", "secondary", "primary", "destructive", "destructiveSecondary" ]),
231
+ children: i().node,
232
+ disabled: i().bool,
233
+ elementRef: i().oneOfType([ i().func, i().object ]),
234
+ onClick: i().func,
235
+ inline: i().bool
407
236
  };
408
- function X(e) {
409
- var r = e.appearance, i = r === void 0 ? "default" : r, o = e.children, a = e.disabled, c = e.elementRef, s = e.inline, d = s === void 0 ? true : s, v = e.onClick, b = Q(e, [ "appearance", "children", "disabled", "elementRef", "inline", "onClick" ]);
237
+ function I(e) {
238
+ var n = e.appearance, a = n === void 0 ? "secondary" : n, i = e.children, l = e.disabled, c = e.elementRef, s = e.inline, f = s === void 0 ? true : s, v = e.onClick, b = _(e, [ "appearance", "children", "disabled", "elementRef", "inline", "onClick" ]);
410
239
  // @docs-props-type SplitButtonPropsBase
411
- var y = t.Children.toArray(o).filter(t.isValidElement);
412
- var h = 0;
240
+ var y = r.Children.toArray(i).filter(r.isValidElement);
413
241
  var m = 0;
414
- y.forEach((function(e, r) {
415
- var t = e.props, n = t.disabled, i = t.isMain;
416
- if (i) {
417
- h = r;
242
+ var O = 0;
243
+ y.forEach((function(e, n) {
244
+ var r = e.props, t = r.disabled, a = r.isMain;
245
+ if (a) {
246
+ m = n;
418
247
  }
419
- if (n) {
420
- m += 1;
248
+ if (t) {
249
+ O += 1;
421
250
  }
422
251
  }));
423
- var g = (0, t.cloneElement)(y[h], {
252
+ var S = (0, r.cloneElement)(y[m], {
424
253
  isMain: true,
425
- appearance: i,
426
- disabled: a || y[h].props.disabled
254
+ appearance: a,
255
+ disabled: l || y[m].props.disabled
427
256
  });
428
257
  // Remove mainButton from array of dropdown items
429
- y.splice(h, 1);
430
- var S = y;
431
- var j = n().createElement(O, {
258
+ y.splice(m, 1);
259
+ var k = y;
260
+ var w = t().createElement(g, {
432
261
  prepend: true,
433
- disabled: a || m === S.length,
434
- appearance: i,
262
+ disabled: l || O === k.length,
263
+ appearance: a,
435
264
  "data-test": "split-button-toggle",
436
- "aria-label": (0, f._)("Open more options"),
437
- icon: n().createElement(l(), null)
265
+ "aria-label": (0, p._)("Open more options"),
266
+ icon: t().createElement(o(), null)
438
267
  });
439
268
 
440
- return n().createElement(k, L({
441
- "aria-label": (0, f._)("Split button"),
442
- "data-inline": d || null,
269
+ return t().createElement(h, q({
270
+ "aria-label": (0, p._)("Split button"),
271
+ "data-inline": f || null,
443
272
  "data-test": "split-button-container",
444
- $inline: d,
273
+ $inline: f,
445
274
  ref: c,
446
275
  role: "group",
447
- onClick: a ? undefined : v
448
- }, b), g, i !== "default" && n().createElement(w, {
449
- inline: true,
450
- $appearance: i
451
- }), n().createElement("div", null, n().createElement(u(), {
452
- toggle: j
453
- }, n().createElement(p(), null, S))));
276
+ onClick: l ? undefined : v,
277
+ $appearance: a
278
+ }, b), S, t().createElement("div", null, t().createElement(u(), {
279
+ toggle: w
280
+ }, t().createElement(d(), null, k))));
454
281
  }
455
- X.propTypes = W;
456
- X.Item = K;
457
- /* harmony default export */ const Y = X;
282
+ I.propTypes = R;
283
+ I.Item = P;
284
+ /* harmony default export */ const T = I;
458
285
  // CONCATENATED MODULE: ./src/SplitButton/index.ts
459
- module.exports = r;
286
+ module.exports = n;
460
287
  /******/})();