@splunk/react-ui 4.21.0 → 4.21.1

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 (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/Button.js CHANGED
@@ -1,471 +1,494 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- "default": () => (/* reexport */ Button_Button)
55
- });
56
-
57
- ;// CONCATENATED MODULE: external "react"
58
- const external_react_namespaceObject = require("react");
59
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
60
- ;// CONCATENATED MODULE: external "prop-types"
61
- const external_prop_types_namespaceObject = require("prop-types");
62
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
63
- ;// CONCATENATED MODULE: external "lodash/isString"
64
- const isString_namespaceObject = require("lodash/isString");
65
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_namespaceObject);
66
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
67
- const Dropdown_namespaceObject = require("@splunk/react-ui/Dropdown");
68
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/style"
69
- const style_namespaceObject = require("@splunk/ui-utils/style");
70
- ;// CONCATENATED MODULE: external "styled-components"
71
- const external_styled_components_namespaceObject = require("styled-components");
72
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
73
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ButtonSimple"
74
- const ButtonSimple_namespaceObject = require("@splunk/react-ui/ButtonSimple");
75
- var ButtonSimple_default = /*#__PURE__*/__webpack_require__.n(ButtonSimple_namespaceObject);
76
- ;// CONCATENATED MODULE: external "@splunk/themes"
77
- const themes_namespaceObject = require("@splunk/themes");
78
- ;// CONCATENATED MODULE: ./src/Button/ButtonStyles.ts
79
-
80
-
81
-
82
- var StyledIcon = external_styled_components_default().span.withConfig({
83
- displayName: "ButtonStyles__StyledIcon",
84
- componentId: "eqxqs2-0"
85
- })(["display:flex;align-items:center;flex-shrink:0;font-size:", ";", ";"], (0,themes_namespaceObject.pick)({
86
- enterprise: 'inherit',
87
- prisma: {
88
- comfortable: '21px',
89
- compact: '16px'
90
- }
91
- }), (0,themes_namespaceObject.pickVariant)('$isIconOnly', {
92
- "false": {
93
- enterprise: (0,external_styled_components_namespaceObject.css)(["padding-right:3px;"]),
94
- prisma: (0,external_styled_components_namespaceObject.css)(["padding-right:8px;"])
95
- }
96
- }));
97
- var StyledButtonSimple = external_styled_components_default()((ButtonSimple_default())).withConfig({
98
- displayName: "ButtonStyles__StyledButtonSimple",
99
- componentId: "eqxqs2-1"
100
- })(["text-align:center;vertical-align:middle;text-decoration:none;white-space:nowrap;flex-grow:1;min-width:0;max-width:100%;line-height:", ";min-height:", ";padding:", ";", " ", " &[data-inline]{display:inline-block;vertical-align:middle;", "}[data-inline] + &&[data-inline]{margin-bottom:0;", "}"], themes_namespaceObject.variables.lineHeight, themes_namespaceObject.variables.inputHeight, (0,themes_namespaceObject.pick)({
101
- enterprise: {
102
- comfortable: '5px 14px',
103
- compact: '2px 14px'
104
- },
105
- prisma: {
106
- comfortable: function comfortable(_ref) {
107
- var $hasPrismaIcon = _ref.$hasPrismaIcon;
108
- return $hasPrismaIcon ? '7px 18px' : '9px 18px';
109
- },
110
- compact: function compact(_ref2) {
111
- var $isMenu = _ref2.$isMenu;
112
- return $isMenu ? '5px 8px 5px 16px' : '5px 16px';
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var r in n) {
28
+ /******/ if (e.o(n, r) && !e.o(t, r)) {
29
+ /******/ Object.defineProperty(t, r, {
30
+ enumerable: true,
31
+ get: n[r]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ default: () => /* reexport */ U
65
+ });
66
+ // CONCATENATED MODULE: external "react"
67
+ const n = require("react");
68
+ var r = e.n(n);
69
+ // CONCATENATED MODULE: external "prop-types"
70
+ const i = require("prop-types");
71
+ var a = e.n(i);
72
+ // CONCATENATED MODULE: external "lodash/isString"
73
+ const o = require("lodash/isString");
74
+ var l = e.n(o);
75
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
76
+ const c = require("@splunk/react-ui/Dropdown");
77
+ // CONCATENATED MODULE: external "@splunk/ui-utils/style"
78
+ const s = require("@splunk/ui-utils/style");
79
+ // CONCATENATED MODULE: external "styled-components"
80
+ const p = require("styled-components");
81
+ var u = e.n(p);
82
+ // CONCATENATED MODULE: external "@splunk/react-ui/ButtonSimple"
83
+ const f = require("@splunk/react-ui/ButtonSimple");
84
+ var d = e.n(f);
85
+ // CONCATENATED MODULE: external "@splunk/themes"
86
+ const m = require("@splunk/themes");
87
+ // CONCATENATED MODULE: ./src/Button/ButtonStyles.ts
88
+ var v = u().span.withConfig({
89
+ displayName: "ButtonStyles__StyledIcon",
90
+ componentId: "eqxqs2-0"
91
+ })([ "display:flex;align-items:center;flex-shrink:0;font-size:", ";", ";" ], (0,
92
+ m.pick)({
93
+ enterprise: "inherit",
94
+ prisma: {
95
+ comfortable: "21px",
96
+ compact: "16px"
97
+ }
98
+ }), (0, m.pickVariant)("$isIconOnly", {
99
+ false: {
100
+ enterprise: (0, p.css)([ "padding-right:3px;" ]),
101
+ prisma: (0, p.css)([ "padding-right:8px;" ])
102
+ }
103
+ }));
104
+ var y = u()(d()).withConfig({
105
+ displayName: "ButtonStyles__StyledButtonSimple",
106
+ componentId: "eqxqs2-1"
107
+ })([ "text-align:center;vertical-align:middle;text-decoration:none;white-space:nowrap;flex-grow:1;min-width:0;max-width:100%;line-height:", ";min-height:", ";padding:", ";", " ", " &[data-inline]{display:inline-block;vertical-align:middle;", "}[data-inline] + &&[data-inline]{margin-bottom:0;", "}" ], m.variables.lineHeight, m.variables.inputHeight, (0,
108
+ m.pick)({
109
+ enterprise: {
110
+ comfortable: "5px 14px",
111
+ compact: "2px 14px"
112
+ },
113
+ prisma: {
114
+ comfortable: function e(t) {
115
+ var n = t.$hasPrismaIcon;
116
+ return n ? "7px 18px" : "9px 18px";
117
+ },
118
+ compact: function e(t) {
119
+ var n = t.$isMenu;
120
+ return n ? "5px 8px 5px 16px" : "5px 16px";
121
+ }
122
+ }
123
+ }), (function(e) {
124
+ var t = e.$inline, n = e.append, r = e.prepend;
125
+ return !t && !n && !r && (0, p.css)([ "width:100%;" ]);
126
+ }), (function(e) {
127
+ var t = e.$isIconOnly;
128
+ return t && (0, p.css)([ "box-sizing:border-box;padding:", ";width:", ";min-width:", ";" ], (0,
129
+ m.pick)({
130
+ enterprise: {
131
+ comfortable: "0 5px",
132
+ compact: "0 2px"
133
+ },
134
+ prisma: {
135
+ comfortable: (0, p.css)([ "0px calc(", " / 2 - 1px)" ], m.variables.inputHeight),
136
+ compact: (0, p.css)([ "0px calc(", " / 2 - 1px)" ], m.variables.inputHeight)
137
+ }
138
+ }), m.variables.inputHeight, m.variables.inputHeight);
139
+ }), (function(e) {
140
+ var t = e.$isIconOnly;
141
+ return t ? null : (0, p.css)([ "width:auto;" ]);
142
+ }), (function(e) {
143
+ var t = e.prepend;
144
+ return !t && (0, p.css)([ "margin-left:", ";" ], (0, m.pick)({
145
+ enterprise: m.variables.spacingHalf,
146
+ prisma: m.variables.spacingSmall
147
+ }));
148
+ }));
149
+ var b = u().span.withConfig({
150
+ displayName: "ButtonStyles__StyledContentWrapper",
151
+ componentId: "eqxqs2-2"
152
+ })([ "display:flex;flex-direction:row;justify-content:center;align-items:center;max-width:100%;padding:", ";" ], (0,
153
+ m.pick)({
154
+ enterprise: function e(t) {
155
+ var n = t.$error;
156
+ if (n) {
157
+ return "1px";
158
+ }
159
+ return (0, m.pickVariant)("$appearance", {
160
+ default: "0",
161
+ secondary: "0",
162
+ destructive: "1px",
163
+ primary: "1px",
164
+ pill: "0",
165
+ toggle: "0",
166
+ // === default
167
+ flat: "0"
168
+ });
169
+ },
170
+ prisma: (0, m.pickVariant)("$appearance", {
171
+ default: 0,
172
+ secondary: "1px 0",
173
+ primary: "1px 0",
174
+ destructive: "1px 0",
175
+ pill: "1px 0",
176
+ // === secondary
177
+ toggle: "0",
178
+ flat: "1px 0"
179
+ })
180
+ }));
181
+ var h = u().span.withConfig({
182
+ displayName: "ButtonStyles__StyledLabel",
183
+ componentId: "eqxqs2-3"
184
+ })([ "text-overflow:ellipsis;overflow:hidden;flex:0 1 auto;&:not(:last-child){padding-right:", ";}", "" ], (0,
185
+ m.pick)({
186
+ enterprise: "3px",
187
+ prisma: "10px"
188
+ }), (function(e) {
189
+ var t = e.$isMenu;
190
+ return t && (0, p.css)([ "flex:1 1 auto;text-align:left;" ]);
191
+ }));
192
+ var x = u().span.withConfig({
193
+ displayName: "ButtonStyles__StyledCaretWrapper",
194
+ componentId: "eqxqs2-4"
195
+ })([ "display:inline-flex;", "" ], (0, m.pickVariant)("$disabled", {
196
+ false: {
197
+ prisma: (0, m.pickVariant)("$primary", {
198
+ true: (0, p.css)([ "color:", ";" ], m.variables.contentColorInverted),
199
+ false: (0, p.css)([ "color:", ";", ":hover > * > &,", ":active > * > &,{color:", ";}" ], m.variables.contentColorDefault,
200
+ /* sc-sel */
201
+ y,
202
+ /* sc-sel */
203
+ y, m.variables.contentColorDefault)
204
+ })
205
+ }
206
+ }));
207
+ // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
208
+ const g = require("@splunk/react-icons/CaretSmallDown");
209
+ var w = e.n(g);
210
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
211
+ const k = require("@splunk/react-icons/enterprise/Caret");
212
+ var S = e.n(k);
213
+ // CONCATENATED MODULE: ./src/Button/icons/CaretSmallDown.tsx
214
+ var C = function e() {
215
+ var t = (0, m.useSplunkTheme)(), n = t.isEnterprise, i = t.isCompact;
216
+ var a = i ? "20px" : "24px";
217
+ return n ? r().createElement(S(), {
218
+ screenReaderText: null,
219
+ hideDefaultTooltip: true,
220
+ size: .5
221
+ }) : r().createElement(w(), {
222
+ height: a,
223
+ width: a
224
+ });
225
+ };
226
+ /* harmony default export */ const O = C;
227
+ // CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRightInset"
228
+ const q = require("@splunk/react-icons/ArrowSquareTopRightInset");
229
+ var _ = e.n(q);
230
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
231
+ const $ = require("@splunk/react-icons/enterprise/External");
232
+ var I = e.n($);
233
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
234
+ const E = require("@splunk/ui-utils/i18n");
235
+ // CONCATENATED MODULE: ./src/Button/icons/External.tsx
236
+ var P = (0, E._)("Open externally");
237
+ function j() {
238
+ var e = (0, m.useSplunkTheme)(), t = e.isEnterprise, n = e.isCompact;
239
+ var i = n ? "20px" : "24px";
240
+ return t ? r().createElement(I(), {
241
+ screenReaderText: P,
242
+ size: .8,
243
+ style: {
244
+ verticalAlign: "baseline"
245
+ }
246
+ }) : r().createElement(_(), {
247
+ "aria-label": P,
248
+ height: i,
249
+ width: i
250
+ }, r().createElement("title", null, P));
113
251
  }
114
- }
115
- }), function (_ref3) {
116
- var $inline = _ref3.$inline,
117
- append = _ref3.append,
118
- prepend = _ref3.prepend;
119
- return !$inline && !append && !prepend && (0,external_styled_components_namespaceObject.css)(["width:100%;"]);
120
- }, function (_ref4) {
121
- var $isIconOnly = _ref4.$isIconOnly;
122
- return $isIconOnly && (0,external_styled_components_namespaceObject.css)(["box-sizing:border-box;padding:", ";width:", ";min-width:", ";"], (0,themes_namespaceObject.pick)({
123
- enterprise: {
124
- comfortable: '0 5px',
125
- compact: '0 2px'
126
- },
127
- prisma: {
128
- comfortable: (0,external_styled_components_namespaceObject.css)(["0px calc(", " / 2 - 1px)"], themes_namespaceObject.variables.inputHeight),
129
- compact: (0,external_styled_components_namespaceObject.css)(["0px calc(", " / 2 - 1px)"], themes_namespaceObject.variables.inputHeight)
252
+ /* harmony default export */ const N = j;
253
+ // CONCATENATED MODULE: ./src/Button/Button.tsx
254
+ function M(e) {
255
+ "@babel/helpers - typeof";
256
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
257
+ M = function e(t) {
258
+ return typeof t;
259
+ };
260
+ } else {
261
+ M = function e(t) {
262
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
263
+ };
264
+ }
265
+ return M(e);
130
266
  }
131
- }), themes_namespaceObject.variables.inputHeight, themes_namespaceObject.variables.inputHeight);
132
- }, function (_ref5) {
133
- var $isIconOnly = _ref5.$isIconOnly;
134
- return $isIconOnly ? null : (0,external_styled_components_namespaceObject.css)(["width:auto;"]);
135
- }, function (_ref6) {
136
- var prepend = _ref6.prepend;
137
- return !prepend && (0,external_styled_components_namespaceObject.css)(["margin-left:", ";"], (0,themes_namespaceObject.pick)({
138
- enterprise: themes_namespaceObject.variables.spacingHalf,
139
- prisma: themes_namespaceObject.variables.spacingSmall
140
- }));
141
- });
142
- var StyledContentWrapper = external_styled_components_default().span.withConfig({
143
- displayName: "ButtonStyles__StyledContentWrapper",
144
- componentId: "eqxqs2-2"
145
- })(["display:flex;flex-direction:row;justify-content:center;align-items:center;max-width:100%;padding:", ";"], (0,themes_namespaceObject.pick)({
146
- enterprise: function enterprise(_ref7) {
147
- var $error = _ref7.$error;
148
-
149
- if ($error) {
150
- return '1px';
267
+ function T() {
268
+ T = Object.assign || function(e) {
269
+ for (var t = 1; t < arguments.length; t++) {
270
+ var n = arguments[t];
271
+ for (var r in n) {
272
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
273
+ e[r] = n[r];
274
+ }
275
+ }
276
+ }
277
+ return e;
278
+ };
279
+ return T.apply(this, arguments);
151
280
  }
152
-
153
- return (0,themes_namespaceObject.pickVariant)('$appearance', {
154
- "default": '0',
155
- secondary: '0',
156
- destructive: '1px',
157
- primary: '1px',
158
- pill: '0',
159
- toggle: '0',
160
- // === default
161
- flat: '0' // === default
162
-
163
- });
164
- },
165
- prisma: (0,themes_namespaceObject.pickVariant)('$appearance', {
166
- "default": 0,
167
- secondary: '1px 0',
168
- primary: '1px 0',
169
- destructive: '1px 0',
170
- pill: '1px 0',
171
- // === secondary
172
- toggle: '0',
173
- flat: '1px 0'
174
- })
175
- }));
176
- var StyledLabel = external_styled_components_default().span.withConfig({
177
- displayName: "ButtonStyles__StyledLabel",
178
- componentId: "eqxqs2-3"
179
- })(["text-overflow:ellipsis;overflow:hidden;flex:0 1 auto;&:not(:last-child){padding-right:", ";}", ""], (0,themes_namespaceObject.pick)({
180
- enterprise: '3px',
181
- prisma: '10px'
182
- }), function (_ref8) {
183
- var $isMenu = _ref8.$isMenu;
184
- return $isMenu && (0,external_styled_components_namespaceObject.css)(["flex:1 1 auto;text-align:left;"]);
185
- });
186
- var StyledCaretWrapper = external_styled_components_default().span.withConfig({
187
- displayName: "ButtonStyles__StyledCaretWrapper",
188
- componentId: "eqxqs2-4"
189
- })(["display:inline-flex;", ""], (0,themes_namespaceObject.pickVariant)('$disabled', {
190
- "false": {
191
- prisma: (0,themes_namespaceObject.pickVariant)('$primary', {
192
- "true": (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.contentColorInverted),
193
- "false": (0,external_styled_components_namespaceObject.css)(["color:", ";", ":hover > * > &,", ":active > * > &,{color:", ";}"], themes_namespaceObject.variables.contentColorDefault,
194
- /* sc-sel */
195
- StyledButtonSimple,
196
- /* sc-sel */
197
- StyledButtonSimple, themes_namespaceObject.variables.contentColorDefault)
198
- })
199
- }
200
- }));
201
-
202
- ;// CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
203
- const CaretSmallDown_namespaceObject = require("@splunk/react-icons/CaretSmallDown");
204
- var CaretSmallDown_default = /*#__PURE__*/__webpack_require__.n(CaretSmallDown_namespaceObject);
205
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
206
- const Caret_namespaceObject = require("@splunk/react-icons/enterprise/Caret");
207
- var Caret_default = /*#__PURE__*/__webpack_require__.n(Caret_namespaceObject);
208
- ;// CONCATENATED MODULE: ./src/Button/icons/CaretSmallDown.tsx
209
-
210
-
211
-
212
-
213
-
214
- var CaretSmallDown = function CaretSmallDown() {
215
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
216
- isEnterprise = _useSplunkTheme.isEnterprise,
217
- isCompact = _useSplunkTheme.isCompact;
218
-
219
- var prismaSize = isCompact ? '20px' : '24px';
220
- return isEnterprise ? /*#__PURE__*/external_react_default().createElement((Caret_default()), {
221
- screenReaderText: null,
222
- hideDefaultTooltip: true,
223
- size: 0.5
224
- }) : /*#__PURE__*/external_react_default().createElement((CaretSmallDown_default()), {
225
- height: prismaSize,
226
- width: prismaSize
227
- });
228
- };
229
-
230
- /* harmony default export */ const icons_CaretSmallDown = (CaretSmallDown);
231
- ;// CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRightInset"
232
- const ArrowSquareTopRightInset_namespaceObject = require("@splunk/react-icons/ArrowSquareTopRightInset");
233
- var ArrowSquareTopRightInset_default = /*#__PURE__*/__webpack_require__.n(ArrowSquareTopRightInset_namespaceObject);
234
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
235
- const External_namespaceObject = require("@splunk/react-icons/enterprise/External");
236
- var External_default = /*#__PURE__*/__webpack_require__.n(External_namespaceObject);
237
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
238
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
239
- ;// CONCATENATED MODULE: ./src/Button/icons/External.tsx
240
-
241
-
242
-
243
-
244
-
245
-
246
- var label = (0,i18n_namespaceObject._)('Open externally');
247
-
248
- function External() {
249
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
250
- isEnterprise = _useSplunkTheme.isEnterprise,
251
- isCompact = _useSplunkTheme.isCompact;
252
-
253
- var prismaSize = isCompact ? '20px' : '24px';
254
- return isEnterprise ? /*#__PURE__*/external_react_default().createElement((External_default()), {
255
- screenReaderText: label,
256
- size: 0.8,
257
- style: {
258
- verticalAlign: 'baseline'
281
+ function R(e, t) {
282
+ if (!(e instanceof t)) {
283
+ throw new TypeError("Cannot call a class as a function");
284
+ }
259
285
  }
260
- }) : /*#__PURE__*/external_react_default().createElement((ArrowSquareTopRightInset_default()), {
261
- "aria-label": label,
262
- height: prismaSize,
263
- width: prismaSize
264
- }, /*#__PURE__*/external_react_default().createElement("title", null, label));
265
- }
266
-
267
- /* harmony default export */ const icons_External = (External);
268
- ;// CONCATENATED MODULE: ./src/Button/Button.tsx
269
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
270
-
271
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
272
-
273
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
274
-
275
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
276
-
277
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
278
-
279
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
280
-
281
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
282
-
283
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
284
-
285
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
286
-
287
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
288
-
289
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
290
-
291
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
292
-
293
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
- var propTypes = {
304
- action: (external_prop_types_default()).string,
305
- appearance: external_prop_types_default().oneOf(['default', 'secondary', 'primary', 'destructive', 'pill', 'toggle', 'flat']),
306
- append: (external_prop_types_default()).bool,
307
- children: (external_prop_types_default()).node,
308
-
309
- /** @private An additional className to add to the button. */
310
- classNamePrivate: (external_prop_types_default()).string,
311
- disabled: (external_prop_types_default()).bool,
312
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
313
- error: (external_prop_types_default()).bool,
314
- icon: (external_prop_types_default()).node,
315
- inline: (external_prop_types_default()).bool,
316
- isMenu: (external_prop_types_default()).bool,
317
- label: (external_prop_types_default()).node,
318
- onClick: (external_prop_types_default()).func,
319
- openInNewContext: (external_prop_types_default()).bool,
320
- prepend: (external_prop_types_default()).bool,
321
- selected: (external_prop_types_default()).bool,
322
- to: (external_prop_types_default()).string,
323
- value: (external_prop_types_default()).any
324
- };
325
- var defaultProps = {
326
- appearance: 'default',
327
- append: false,
328
- disabled: false,
329
- error: false,
330
- inline: true,
331
- isMenu: false,
332
- openInNewContext: false,
333
- prepend: false,
334
- selected: false
335
- };
336
-
337
- var Button = /*#__PURE__*/function (_Component) {
338
- _inherits(Button, _Component);
339
-
340
- var _super = _createSuper(Button);
341
-
342
- // @docs-props-type ButtonPropsBase
343
- function Button(props) {
344
- var _this;
345
-
346
- _classCallCheck(this, Button);
347
-
348
- _this = _super.call(this, props);
349
-
350
- _defineProperty(_assertThisInitialized(_this), "component", null);
351
-
352
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
353
- var _this$props = _this.props,
354
- label = _this$props.label,
355
- icon = _this$props.icon,
356
- value = _this$props.value,
357
- action = _this$props.action,
358
- onClick = _this$props.onClick;
359
- onClick === null || onClick === void 0 ? void 0 : onClick(e, {
360
- label: label,
361
- icon: icon,
362
- value: value,
363
- action: action
364
- });
365
- });
366
-
367
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (c) {
368
- _this.component = c;
369
- });
370
-
371
- if (false) {}
372
-
373
- return _this;
374
- }
375
-
376
- _createClass(Button, [{
377
- key: "focus",
378
-
379
- /**
380
- * Places focus on the button.
381
- */
382
- value: function focus() {
383
- var _this$component;
384
-
385
- (_this$component = this.component) === null || _this$component === void 0 ? void 0 : _this$component.focus();
286
+ function B(e, t) {
287
+ for (var n = 0; n < t.length; n++) {
288
+ var r = t[n];
289
+ r.enumerable = r.enumerable || false;
290
+ r.configurable = true;
291
+ if ("value" in r) r.writable = true;
292
+ Object.defineProperty(e, r.key, r);
293
+ }
294
+ }
295
+ function D(e, t, n) {
296
+ if (t) B(e.prototype, t);
297
+ if (n) B(e, n);
298
+ return e;
299
+ }
300
+ function H(e, t) {
301
+ if (typeof t !== "function" && t !== null) {
302
+ throw new TypeError("Super expression must either be null or a function");
303
+ }
304
+ e.prototype = Object.create(t && t.prototype, {
305
+ constructor: {
306
+ value: e,
307
+ writable: true,
308
+ configurable: true
309
+ }
310
+ });
311
+ if (t) V(e, t);
386
312
  }
387
- }, {
388
- key: "render",
389
- value: function render() {
390
- var _this$props2 = this.props,
391
- action = _this$props2.action,
392
- appearance = _this$props2.appearance,
393
- append = _this$props2.append,
394
- className = _this$props2.className,
395
- classNamePrivate = _this$props2.classNamePrivate,
396
- disabled = _this$props2.disabled,
397
- error = _this$props2.error,
398
- icon = _this$props2.icon,
399
- inline = _this$props2.inline,
400
- isMenu = _this$props2.isMenu,
401
- onClick = _this$props2.onClick,
402
- openInNewContext = _this$props2.openInNewContext,
403
- prepend = _this$props2.prepend,
404
- to = _this$props2.to,
405
- value = _this$props2.value;
406
- var _this$props3 = this.props,
407
- children = _this$props3.children,
408
- label = _this$props3.label;
409
-
410
- if (!label && isString_default()(children)) {
411
- label = children;
412
- children = null;
413
- }
414
-
415
- var isIconOnly = !!(icon && !label && !isMenu && !children);
416
- var hasPrismaIcon = to && openInNewContext || isMenu || !!icon;
417
- return /*#__PURE__*/external_react_default().createElement(StyledButtonSimple, _extends({
418
- "aria-haspopup": isMenu || undefined,
419
- "aria-invalid": error || undefined,
420
- "data-test": "button"
421
- }, this.props, {
422
- className: (0,style_namespaceObject.toClassName)(className, classNamePrivate),
423
- "data-action": action,
424
- "data-inline": inline || null,
425
- disabled: disabled,
426
- append: append,
427
- prepend: prepend,
428
- $inline: inline,
429
- $hasPrismaIcon: hasPrismaIcon,
430
- $isIconOnly: isIconOnly,
431
- $isMenu: isMenu // @ts-expect-error - this is problematic for two reasons:
432
- // * value is only a valid attribute on button (not on a)
433
- // * this component's value prop is of type any, which can result
434
- // in "[object Object]" attribute values
435
- ,
436
- value: value,
437
- onClick: onClick ? this.handleClick : undefined,
438
- ref: this.handleMount,
439
- openInNewContext: openInNewContext,
440
- appearance: appearance
441
- }), /*#__PURE__*/external_react_default().createElement(StyledContentWrapper, {
442
- $appearance: appearance,
443
- $error: error
444
- }, icon && /*#__PURE__*/external_react_default().createElement(StyledIcon, {
445
- $isIconOnly: isIconOnly
446
- }, icon), label && /*#__PURE__*/external_react_default().createElement(StyledLabel, {
447
- "data-test": "label",
448
- $isMenu: isMenu
449
- }, label), children, isMenu && /*#__PURE__*/external_react_default().createElement(StyledCaretWrapper, {
450
- $disabled: disabled,
451
- $primary: appearance === 'primary'
452
- }, /*#__PURE__*/external_react_default().createElement(icons_CaretSmallDown, null)), openInNewContext && /*#__PURE__*/external_react_default().createElement(icons_External, null)));
313
+ function V(e, t) {
314
+ V = Object.setPrototypeOf || function e(t, n) {
315
+ t.__proto__ = n;
316
+ return t;
317
+ };
318
+ return V(e, t);
453
319
  }
454
- }]);
455
-
456
- return Button;
457
- }(external_react_namespaceObject.Component);
458
-
459
- _defineProperty(Button, "propTypes", propTypes);
460
-
461
- _defineProperty(Button, "defaultProps", defaultProps);
462
-
463
- _defineProperty(Button, Dropdown_namespaceObject.legacyRefMode, true);
464
-
465
- /* harmony default export */ const Button_Button = (Button);
466
- ;// CONCATENATED MODULE: ./src/Button/index.ts
467
-
468
-
469
- module.exports = __webpack_exports__;
470
- /******/ })()
471
- ;
320
+ function z(e) {
321
+ var t = L();
322
+ return function n() {
323
+ var r = F(e), i;
324
+ if (t) {
325
+ var a = F(this).constructor;
326
+ i = Reflect.construct(r, arguments, a);
327
+ } else {
328
+ i = r.apply(this, arguments);
329
+ }
330
+ return A(this, i);
331
+ };
332
+ }
333
+ function A(e, t) {
334
+ if (t && (M(t) === "object" || typeof t === "function")) {
335
+ return t;
336
+ }
337
+ return W(e);
338
+ }
339
+ function W(e) {
340
+ if (e === void 0) {
341
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
342
+ }
343
+ return e;
344
+ }
345
+ function L() {
346
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
347
+ if (Reflect.construct.sham) return false;
348
+ if (typeof Proxy === "function") return true;
349
+ try {
350
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
351
+ return true;
352
+ } catch (e) {
353
+ return false;
354
+ }
355
+ }
356
+ function F(e) {
357
+ F = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
358
+ return t.__proto__ || Object.getPrototypeOf(t);
359
+ };
360
+ return F(e);
361
+ }
362
+ function G(e, t, n) {
363
+ if (t in e) {
364
+ Object.defineProperty(e, t, {
365
+ value: n,
366
+ enumerable: true,
367
+ configurable: true,
368
+ writable: true
369
+ });
370
+ } else {
371
+ e[t] = n;
372
+ }
373
+ return e;
374
+ }
375
+ var J = {
376
+ action: a().string,
377
+ appearance: a().oneOf([ "default", "secondary", "primary", "destructive", "pill", "toggle", "flat" ]),
378
+ append: a().bool,
379
+ children: a().node,
380
+ /** @private An additional className to add to the button. */
381
+ classNamePrivate: a().string,
382
+ disabled: a().bool,
383
+ elementRef: a().oneOfType([ a().func, a().object ]),
384
+ error: a().bool,
385
+ icon: a().node,
386
+ inline: a().bool,
387
+ isMenu: a().bool,
388
+ label: a().node,
389
+ onClick: a().func,
390
+ openInNewContext: a().bool,
391
+ prepend: a().bool,
392
+ selected: a().bool,
393
+ to: a().string,
394
+ value: a().any
395
+ };
396
+ var K = {
397
+ appearance: "default",
398
+ append: false,
399
+ disabled: false,
400
+ error: false,
401
+ inline: true,
402
+ isMenu: false,
403
+ openInNewContext: false,
404
+ prepend: false,
405
+ selected: false
406
+ };
407
+ var Q = function(e) {
408
+ H(n, e);
409
+ var t = z(n);
410
+ // @docs-props-type ButtonPropsBase
411
+ function n(e) {
412
+ var r;
413
+ R(this, n);
414
+ r = t.call(this, e);
415
+ G(W(r), "component", null);
416
+ G(W(r), "handleClick", (function(e) {
417
+ var t = r.props, n = t.label, i = t.icon, a = t.value, o = t.action, l = t.onClick;
418
+ l === null || l === void 0 ? void 0 : l(e, {
419
+ label: n,
420
+ icon: i,
421
+ value: a,
422
+ action: o
423
+ });
424
+ }));
425
+ G(W(r), "handleMount", (function(e) {
426
+ r.component = e;
427
+ }));
428
+ if (false) {}
429
+ return r;
430
+ }
431
+ D(n, [ {
432
+ key: "focus",
433
+ /**
434
+ * Places focus on the button.
435
+ */
436
+ value: function e() {
437
+ var t;
438
+ (t = this.component) === null || t === void 0 ? void 0 : t.focus();
439
+ }
440
+ }, {
441
+ key: "render",
442
+ value: function e() {
443
+ var t = this.props, n = t.action, i = t.appearance, a = t.append, o = t.className, c = t.classNamePrivate, p = t.disabled, u = t.error, f = t.icon, d = t.inline, m = t.isMenu, g = t.onClick, w = t.openInNewContext, k = t.prepend, S = t.to, C = t.value;
444
+ var q = this.props, _ = q.children, $ = q.label;
445
+ if (!$ && l()(_)) {
446
+ $ = _;
447
+ _ = null;
448
+ }
449
+ var I = !!(f && !$ && !m && !_);
450
+ var E = S && w || m || !!f;
451
+
452
+ return r().createElement(y, T({
453
+ "aria-haspopup": m || undefined,
454
+ "aria-invalid": u || undefined,
455
+ "data-test": "button"
456
+ }, this.props, {
457
+ className: (0, s.toClassName)(o, c),
458
+ "data-action": n,
459
+ "data-inline": d || null,
460
+ disabled: p,
461
+ append: a,
462
+ prepend: k,
463
+ $inline: d,
464
+ $hasPrismaIcon: E,
465
+ $isIconOnly: I,
466
+ $isMenu: m,
467
+ value: C,
468
+ onClick: g ? this.handleClick : undefined,
469
+ ref: this.handleMount,
470
+ openInNewContext: w,
471
+ appearance: i
472
+ }), r().createElement(b, {
473
+ $appearance: i,
474
+ $error: u
475
+ }, f && r().createElement(v, {
476
+ $isIconOnly: I
477
+ }, f), $ && r().createElement(h, {
478
+ "data-test": "label",
479
+ $isMenu: m
480
+ }, $), _, m && r().createElement(x, {
481
+ $disabled: p,
482
+ $primary: i === "primary"
483
+ }, r().createElement(O, null)), w && r().createElement(N, null)));
484
+ }
485
+ } ]);
486
+ return n;
487
+ }(n.Component);
488
+ G(Q, "propTypes", J);
489
+ G(Q, "defaultProps", K);
490
+ G(Q, c.legacyRefMode, true);
491
+ /* harmony default export */ const U = Q;
492
+ // CONCATENATED MODULE: ./src/Button/index.ts
493
+ module.exports = t;
494
+ /******/})();