@splunk/react-ui 4.20.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 (101) hide show
  1. package/Accordion.js +425 -441
  2. package/Anchor.js +147 -193
  3. package/Animation.js +142 -166
  4. package/AnimationToggle.js +197 -253
  5. package/Box.js +145 -194
  6. package/Breadcrumbs.js +288 -298
  7. package/Button.js +488 -613
  8. package/ButtonGroup.js +160 -212
  9. package/ButtonSimple.js +543 -562
  10. package/CHANGELOG.md +26 -0
  11. package/Calendar.js +1107 -1195
  12. package/Card.js +771 -746
  13. package/CardLayout.js +205 -223
  14. package/Chip.js +509 -612
  15. package/Clickable.js +416 -472
  16. package/CloseButton.js +165 -250
  17. package/Code.js +1808 -2172
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -675
  20. package/Color.js +1066 -1297
  21. package/ColumnLayout.js +402 -465
  22. package/ComboBox.js +892 -969
  23. package/Concertina.js +998 -963
  24. package/ControlGroup.js +687 -718
  25. package/Date.js +567 -697
  26. package/DefinitionList.js +308 -310
  27. package/Divider.js +149 -194
  28. package/Dropdown.js +459 -558
  29. package/DualListbox.js +1480 -1735
  30. package/EventListener.js +94 -165
  31. package/File.js +1051 -1173
  32. package/FormRows.js +885 -880
  33. package/Heading.js +216 -263
  34. package/Image.js +446 -558
  35. package/JSONTree.js +690 -699
  36. package/Layer.js +442 -582
  37. package/Link.js +336 -361
  38. package/List.js +213 -237
  39. package/Markdown.js +510 -612
  40. package/Menu.js +1109 -1331
  41. package/Message.js +474 -629
  42. package/MessageBar.js +387 -561
  43. package/Modal.js +810 -798
  44. package/ModalLayer.js +326 -343
  45. package/Monogram.js +308 -368
  46. package/Multiselect.js +3558 -3998
  47. package/Number.js +729 -843
  48. package/Paginator.js +510 -615
  49. package/Paragraph.js +145 -188
  50. package/Popover.js +1470 -1693
  51. package/Progress.js +301 -362
  52. package/RadioBar.js +610 -651
  53. package/RadioList.js +483 -544
  54. package/Resize.js +530 -623
  55. package/ResultsMenu.js +494 -597
  56. package/ScreenReaderContent.js +142 -187
  57. package/Scroll.js +595 -598
  58. package/ScrollContainerContext.js +197 -278
  59. package/Search.js +745 -817
  60. package/Select.js +2441 -2746
  61. package/SidePanel.js +390 -392
  62. package/Slider.js +668 -825
  63. package/SlidingPanels.js +639 -645
  64. package/SplitButton.js +464 -499
  65. package/StaticContent.js +161 -217
  66. package/StepBar.js +386 -466
  67. package/Switch.js +710 -764
  68. package/TabBar.js +724 -815
  69. package/TabLayout.js +406 -438
  70. package/Table.js +4842 -5121
  71. package/Text.js +1169 -1351
  72. package/TextArea.js +1097 -1307
  73. package/Tooltip.js +624 -721
  74. package/TransitionOpen.js +489 -546
  75. package/Typography.js +176 -229
  76. package/WaitSpinner.js +230 -298
  77. package/package.json +14 -15
  78. package/stubs-splunkui.d.ts +4 -1
  79. package/types/src/ComboBox/Option.d.ts +1 -1
  80. package/types/src/Concertina/Concertina.d.ts +4 -0
  81. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  82. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  83. package/types/src/Link/Link.d.ts +7 -3
  84. package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
  85. package/types/src/Markdown/Markdown.d.ts +1 -1
  86. package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
  87. package/types/src/Menu/Item.d.ts +1 -1
  88. package/types/src/Menu/Menu.d.ts +1 -0
  89. package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
  90. package/types/src/Multiselect/Option.d.ts +1 -1
  91. package/types/src/Search/Option.d.ts +1 -1
  92. package/types/src/Select/Option.d.ts +1 -1
  93. package/types/src/Select/OptionBase.d.ts +1 -1
  94. package/types/src/fixtures/FetchOptions.d.ts +2 -8
  95. package/useForceUpdate.js +112 -146
  96. package/useKeyPress.js +74 -128
  97. package/usePrevious.js +65 -129
  98. package/useRovingFocus.js +122 -218
  99. package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
  100. /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
  101. /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/ControlGroup.js CHANGED
@@ -1,381 +1,463 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 200);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 0:
91
- /***/ (function(module, exports) {
92
-
93
- module.exports = require("@splunk/themes");
94
-
95
- /***/ }),
96
-
97
- /***/ 1:
98
- /***/ (function(module, exports) {
99
-
100
- module.exports = require("prop-types");
101
-
102
- /***/ }),
103
-
104
- /***/ 14:
105
- /***/ (function(module, exports) {
106
-
107
- module.exports = require("@splunk/react-ui/ScreenReaderContent");
108
-
109
- /***/ }),
110
-
111
- /***/ 19:
112
- /***/ (function(module, exports) {
113
-
114
- module.exports = require("lodash/isFinite");
115
-
116
- /***/ }),
117
-
118
- /***/ 2:
119
- /***/ (function(module, exports) {
120
-
121
- module.exports = require("react");
122
-
123
- /***/ }),
124
-
125
- /***/ 200:
126
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
127
-
128
- "use strict";
129
- // ESM COMPAT FLAG
130
- __webpack_require__.r(__webpack_exports__);
131
-
132
- // EXPORTS
133
- __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_ControlGroup_ControlGroup; });
134
- __webpack_require__.d(__webpack_exports__, "ControlGroupContext", function() { return /* reexport */ ControlGroup_ControlGroupContext; });
135
-
136
- // EXTERNAL MODULE: external "react"
137
- var external_react_ = __webpack_require__(2);
138
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
139
-
140
- // EXTERNAL MODULE: external "prop-types"
141
- var external_prop_types_ = __webpack_require__(1);
142
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
143
-
144
- // EXTERNAL MODULE: external "lodash/find"
145
- var find_ = __webpack_require__(55);
146
- var find_default = /*#__PURE__*/__webpack_require__.n(find_);
147
-
148
- // EXTERNAL MODULE: external "lodash/isFinite"
149
- var isFinite_ = __webpack_require__(19);
150
- var isFinite_default = /*#__PURE__*/__webpack_require__.n(isFinite_);
151
-
152
- // EXTERNAL MODULE: external "@splunk/themes"
153
- var themes_ = __webpack_require__(0);
154
-
155
- // EXTERNAL MODULE: external "@splunk/ui-utils/id"
156
- var id_ = __webpack_require__(8);
157
-
158
- // EXTERNAL MODULE: external "@splunk/react-ui/Box"
159
- var Box_ = __webpack_require__(6);
160
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_);
161
-
162
- // EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
163
- var ScreenReaderContent_ = __webpack_require__(14);
164
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
165
-
166
- // EXTERNAL MODULE: external "styled-components"
167
- var external_styled_components_ = __webpack_require__(3);
168
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
169
-
170
- // EXTERNAL MODULE: external "@splunk/react-ui/Tooltip"
171
- var Tooltip_ = __webpack_require__(45);
172
- var Tooltip_default = /*#__PURE__*/__webpack_require__.n(Tooltip_);
173
-
174
- // CONCATENATED MODULE: ./src/ControlGroup/ControlGroupStyles.ts
175
-
176
-
177
-
178
-
179
- var StyledBox = external_styled_components_default()(Box_default.a).withConfig({
180
- displayName: "ControlGroupStyles__StyledBox",
181
- componentId: "wjnyif-0"
182
- })(["", " ", " max-width:600px;margin-bottom:", ";", " color:", ";", ""], themes_["mixins"].reset('block'), themes_["mixins"].clearfix(), Object(themes_["pick"])({
183
- enterprise: Object(external_styled_components_["css"])(["calc(", " * 0.75)"], themes_["variables"].spacing),
184
- prisma: {
185
- comfortable: '16px',
186
- compact: '12px'
187
- }
188
- }), Object(themes_["pick"])({
189
- prisma: {
190
- comfortable: Object(external_styled_components_["css"])(["&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}"], themes_["variables"].spacingMedium, themes_["variables"].spacingMedium),
191
- compact: Object(external_styled_components_["css"])(["&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}"], themes_["variables"].spacingSmall, themes_["variables"].spacingSmall)
192
- }
193
- }), Object(themes_["pick"])({
194
- enterprise: themes_["variables"].textColor,
195
- prisma: themes_["variables"].contentColorMuted
196
- }), function (_ref) {
197
- var $error = _ref.$error;
198
- return $error && Object(external_styled_components_["css"])(["color:", ";"], Object(themes_["pick"])({
199
- enterprise: {
200
- light: themes_["variables"].errorColorD10,
201
- dark: themes_["variables"].errorColorL20
202
- },
203
- prisma: themes_["variables"].accentColorNegative
204
- }));
205
- });
206
- var StyledControlsStackBox = external_styled_components_default()(Box_default.a).withConfig({
207
- displayName: "ControlGroupStyles__StyledControlsStackBox",
208
- componentId: "wjnyif-1"
209
- })(["flex-direction:column;"]);
210
- var StyledLabelWrapper = external_styled_components_default.a.div.withConfig({
211
- displayName: "ControlGroupStyles__StyledLabelWrapper",
212
- componentId: "wjnyif-2"
213
- })(["display:inline-flex;align-items:center;", " ", ""], Object(themes_["pick"])({
214
- enterprise: Object(external_styled_components_["css"])(["justify-content:flex-end;"])
215
- }), function (_ref2) {
216
- var $labelPosition = _ref2.$labelPosition;
217
- return $labelPosition === 'top' ? Object(external_styled_components_["css"])(["", ""], Object(themes_["pick"])({
218
- prisma: Object(external_styled_components_["css"])(["height:24px;padding-bottom:", ";"], themes_["variables"].spacingXSmall)
219
- })) : Object(external_styled_components_["css"])(["", ""], Object(themes_["pick"])({
220
- prisma: Object(external_styled_components_["css"])(["min-height:", ";"], themes_["variables"].inputHeight)
221
- }));
222
- });
223
- var StyledLabelWrapperLeft = external_styled_components_default()(StyledLabelWrapper).withConfig({
224
- displayName: "ControlGroupStyles__StyledLabelWrapperLeft",
225
- componentId: "wjnyif-3"
226
- })(["float:left;"]);
227
- var StyledLabel = external_styled_components_default.a.label.withConfig({
228
- displayName: "ControlGroupStyles__StyledLabel",
229
- componentId: "wjnyif-4"
230
- })(["padding:", ";word-wrap:break-word;color:inherit;text-align:", ";"], Object(themes_["pick"])({
231
- enterprise: {
232
- comfortable: '6px 0',
233
- compact: '4px 0'
234
- }
235
- }), Object(themes_["pick"])({
236
- enterprise: 'right',
237
- prisma: 'left'
238
- }));
239
- var StyledTooltip = external_styled_components_default()(Tooltip_default.a).withConfig({
240
- displayName: "ControlGroupStyles__StyledTooltip",
241
- componentId: "wjnyif-5"
242
- })(["", ""], function (_ref3) {
243
- var $labelPosition = _ref3.$labelPosition;
244
- return $labelPosition === 'top' && Object(external_styled_components_["css"])(["button{", "}"], Object(themes_["pick"])({
245
- prisma: Object(external_styled_components_["css"])(["svg{width:20px;height:20px;}padding:4px;"])
246
- }));
247
- });
248
- var StyledHelp = external_styled_components_default.a.div.withConfig({
249
- displayName: "ControlGroupStyles__StyledHelp",
250
- componentId: "wjnyif-6"
251
- })(["", ";font-size:", ";color:", ";margin-top:", ";", ""], themes_["mixins"].reset('block'), themes_["variables"].fontSizeSmall, themes_["variables"].contentColorMuted, Object(themes_["pick"])({
252
- enterprise: '2px',
253
- prisma: '4px'
254
- }), function (_ref4) {
255
- var $error = _ref4.$error;
256
- return $error && Object(external_styled_components_["css"])(["color:inherit;"]);
257
- });
258
- var StyledErrorText = external_styled_components_default.a.div.withConfig({
259
- displayName: "ControlGroupStyles__StyledErrorText",
260
- componentId: "wjnyif-7"
261
- })(["", ";font-size:", ";[aria-invalid] > &{color:inherit;}", ""], themes_["mixins"].reset('block'), themes_["variables"].fontSizeSmall, function (_ref5) {
262
- var $help = _ref5.$help;
263
- return !$help && Object(external_styled_components_["css"])(["margin-top:", ";"], Object(themes_["pick"])({
264
- enterprise: '2px',
265
- prisma: '4px'
266
- }));
267
- });
268
- var StyledAsterisk = external_styled_components_default.a.span.withConfig({
269
- displayName: "ControlGroupStyles__StyledAsterisk",
270
- componentId: "wjnyif-8"
271
- })(["color:inherit;margin-right:2px;"]);
272
-
273
- // CONCATENATED MODULE: ./src/ControlGroup/ControlGroupContext.tsx
274
-
275
-
276
- /**
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 r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
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
+ ControlGroupContext: () => /* reexport */ T,
65
+ default: () => /* reexport */ se
66
+ });
67
+ // CONCATENATED MODULE: external "react"
68
+ const r = require("react");
69
+ var n = e.n(r);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const o = require("prop-types");
72
+ var i = e.n(o);
73
+ // CONCATENATED MODULE: external "lodash/find"
74
+ const l = require("lodash/find");
75
+ var a = e.n(l);
76
+ // CONCATENATED MODULE: external "lodash/isFinite"
77
+ const s = require("lodash/isFinite");
78
+ var p = e.n(s);
79
+ // CONCATENATED MODULE: external "@splunk/themes"
80
+ const c = require("@splunk/themes");
81
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
82
+ const u = require("@splunk/ui-utils/id");
83
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
84
+ const f = require("@splunk/react-ui/Box");
85
+ var d = e.n(f);
86
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
87
+ const y = require("@splunk/react-ui/ScreenReaderContent");
88
+ var b = e.n(y);
89
+ // CONCATENATED MODULE: external "styled-components"
90
+ const h = require("styled-components");
91
+ var m = e.n(h);
92
+ // CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
93
+ const v = require("@splunk/react-ui/Tooltip");
94
+ var g = e.n(v);
95
+ // CONCATENATED MODULE: ./src/ControlGroup/ControlGroupStyles.ts
96
+ var O = m()(d()).withConfig({
97
+ displayName: "ControlGroupStyles__StyledBox",
98
+ componentId: "wjnyif-0"
99
+ })([ "", " ", " max-width:600px;margin-bottom:", ";", " color:", ";", "" ], c.mixins.reset("block"), c.mixins.clearfix(), (0,
100
+ c.pick)({
101
+ enterprise: (0, h.css)([ "calc(", " * 0.75)" ], c.variables.spacing),
102
+ prisma: {
103
+ comfortable: "16px",
104
+ compact: "12px"
105
+ }
106
+ }), (0, c.pick)({
107
+ prisma: {
108
+ comfortable: (0, h.css)([ "&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}" ], c.variables.spacingMedium, c.variables.spacingMedium),
109
+ compact: (0, h.css)([ "&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}" ], c.variables.spacingSmall, c.variables.spacingSmall)
110
+ }
111
+ }), (0, c.pick)({
112
+ enterprise: c.variables.textColor,
113
+ prisma: c.variables.contentColorMuted
114
+ }), (function(e) {
115
+ var t = e.$error;
116
+ return t && (0, h.css)([ "color:", ";" ], (0, c.pick)({
117
+ enterprise: {
118
+ light: c.variables.errorColorD10,
119
+ dark: c.variables.errorColorL20
120
+ },
121
+ prisma: c.variables.accentColorNegative
122
+ }));
123
+ }));
124
+ var x = m()(d()).withConfig({
125
+ displayName: "ControlGroupStyles__StyledControlsStackBox",
126
+ componentId: "wjnyif-1"
127
+ })([ "flex-direction:column;" ]);
128
+ var S = m().div.withConfig({
129
+ displayName: "ControlGroupStyles__StyledLabelWrapper",
130
+ componentId: "wjnyif-2"
131
+ })([ "display:inline-flex;align-items:center;", " ", "" ], (0, c.pick)({
132
+ enterprise: (0, h.css)([ "justify-content:flex-end;" ])
133
+ }), (function(e) {
134
+ var t = e.$labelPosition;
135
+ return t === "top" ? (0, h.css)([ "", "" ], (0, c.pick)({
136
+ prisma: (0, h.css)([ "height:24px;padding-bottom:", ";" ], c.variables.spacingXSmall)
137
+ })) : (0, h.css)([ "", "" ], (0, c.pick)({
138
+ prisma: (0, h.css)([ "min-height:", ";" ], c.variables.inputHeight)
139
+ }));
140
+ }));
141
+ var I = m()(S).withConfig({
142
+ displayName: "ControlGroupStyles__StyledLabelWrapperLeft",
143
+ componentId: "wjnyif-3"
144
+ })([ "float:left;" ]);
145
+ var C = m().label.withConfig({
146
+ displayName: "ControlGroupStyles__StyledLabel",
147
+ componentId: "wjnyif-4"
148
+ })([ "padding:", ";word-wrap:break-word;color:inherit;text-align:", ";" ], (0, c.pick)({
149
+ enterprise: {
150
+ comfortable: "6px 0",
151
+ compact: "4px 0"
152
+ }
153
+ }), (0, c.pick)({
154
+ enterprise: "right",
155
+ prisma: "left"
156
+ }));
157
+ var k = m()(g()).withConfig({
158
+ displayName: "ControlGroupStyles__StyledTooltip",
159
+ componentId: "wjnyif-5"
160
+ })([ "", "" ], (function(e) {
161
+ var t = e.$labelPosition;
162
+ return t === "top" && (0, h.css)([ "button{", "}" ], (0, c.pick)({
163
+ prisma: (0, h.css)([ "svg{width:20px;height:20px;}padding:4px;" ])
164
+ }));
165
+ }));
166
+ var w = m().div.withConfig({
167
+ displayName: "ControlGroupStyles__StyledHelp",
168
+ componentId: "wjnyif-6"
169
+ })([ "", ";font-size:", ";color:", ";margin-top:", ";", "" ], c.mixins.reset("block"), c.variables.fontSizeSmall, c.variables.contentColorMuted, (0,
170
+ c.pick)({
171
+ enterprise: "2px",
172
+ prisma: "4px"
173
+ }), (function(e) {
174
+ var t = e.$error;
175
+ return t && (0, h.css)([ "color:inherit;" ]);
176
+ }));
177
+ var j = m().div.withConfig({
178
+ displayName: "ControlGroupStyles__StyledErrorText",
179
+ componentId: "wjnyif-7"
180
+ })([ "", ";font-size:", ";[aria-invalid] > &{color:inherit;}", "" ], c.mixins.reset("block"), c.variables.fontSizeSmall, (function(e) {
181
+ var t = e.$help;
182
+ return !t && (0, h.css)([ "margin-top:", ";" ], (0, c.pick)({
183
+ enterprise: "2px",
184
+ prisma: "4px"
185
+ }));
186
+ }));
187
+ var P = m().span.withConfig({
188
+ displayName: "ControlGroupStyles__StyledAsterisk",
189
+ componentId: "wjnyif-8"
190
+ })([ "color:inherit;margin-right:2px;" ]);
191
+ // CONCATENATED MODULE: ./src/ControlGroup/ControlGroupContext.tsx
192
+ /**
277
193
  * A React context used to inform subcomponets of ControlGroup of parent component values.
278
194
  * The context interface is `ControlGroupContextValue`.
279
195
  * Defaults to `'{}'`.
280
196
  * @public
281
197
  */
282
- var ControlGroupContext = /*#__PURE__*/external_react_default.a.createContext({});
283
- /* harmony default export */ var ControlGroup_ControlGroupContext = (ControlGroupContext);
284
- // CONCATENATED MODULE: ./src/ControlGroup/ControlGroup.tsx
285
- 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); }
286
-
287
- 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); }
288
-
289
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
290
-
291
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
292
-
293
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
294
-
295
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
296
-
297
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
298
-
299
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
300
-
301
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
302
-
303
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
304
-
305
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
306
-
307
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
308
-
309
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
310
-
311
- 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); } }
312
-
313
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
314
-
315
- 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); }
316
-
317
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
318
-
319
- 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); }; }
320
-
321
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
322
-
323
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
324
-
325
- 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; } }
326
-
327
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
328
-
329
- 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; }
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
- // props ControlGroup may access and/or override on children
341
-
342
- var propTypes = {
343
- children: external_prop_types_default.a.node,
344
- controlsLayout: external_prop_types_default.a.oneOf(['fill', 'fillJoin', 'none', 'stack']),
345
- elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
346
- error: external_prop_types_default.a.oneOfType([external_prop_types_default.a.bool, external_prop_types_default.a.string]),
347
- help: external_prop_types_default.a.node,
348
- hideLabel: external_prop_types_default.a.bool,
349
- label: external_prop_types_default.a.string.isRequired,
350
- labelFor: external_prop_types_default.a.string,
351
- labelPosition: external_prop_types_default.a.oneOf(['left', 'top']),
352
- labelWidth: external_prop_types_default.a.oneOfType([external_prop_types_default.a.number, external_prop_types_default.a.string]),
353
- required: external_prop_types_default.a.bool,
354
- size: external_prop_types_default.a.oneOf(['small', 'medium']),
355
-
356
- /** @private */
357
- splunkTheme: external_prop_types_default.a.object,
358
- tooltip: external_prop_types_default.a.node,
359
- tooltipDefaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'left', 'right', 'theme'])
360
- };
361
- var defaultProps = {
362
- controlsLayout: 'fill',
363
- error: false,
364
- hideLabel: false,
365
- labelPosition: 'left',
366
- labelWidth: 120,
367
- required: false,
368
- size: 'medium'
369
- };
370
- // Style cloned onto child elements when fill behavior set.
371
- var FLEX_GROW_STYLE = {
372
- flexGrow: 1
373
- }; // Margin bootom values cloned onto child elements when the stacking behavior is needed.
374
-
375
- var CHILD_MARGIN_BOTTOM_DEFAULT = '0';
376
- var CHILD_MARGIN_BOTTOM_PRISMA = '16px';
377
- var CHILD_MARGIN_BOTTOM_PRISMA_COMPACT = '12px';
378
- /**
198
+ var _ = n().createContext({});
199
+ /* harmony default export */ const T = _;
200
+ // CONCATENATED MODULE: ./src/ControlGroup/ControlGroup.tsx
201
+ function L(e) {
202
+ "@babel/helpers - typeof";
203
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
204
+ L = function e(t) {
205
+ return typeof t;
206
+ };
207
+ } else {
208
+ L = function e(t) {
209
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
210
+ };
211
+ }
212
+ return L(e);
213
+ }
214
+ function E() {
215
+ E = Object.assign || function(e) {
216
+ for (var t = 1; t < arguments.length; t++) {
217
+ var r = arguments[t];
218
+ for (var n in r) {
219
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
220
+ e[n] = r[n];
221
+ }
222
+ }
223
+ }
224
+ return e;
225
+ };
226
+ return E.apply(this, arguments);
227
+ }
228
+ function D(e, t) {
229
+ var r = Object.keys(e);
230
+ if (Object.getOwnPropertySymbols) {
231
+ var n = Object.getOwnPropertySymbols(e);
232
+ if (t) n = n.filter((function(t) {
233
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
234
+ }));
235
+ r.push.apply(r, n);
236
+ }
237
+ return r;
238
+ }
239
+ function q(e) {
240
+ for (var t = 1; t < arguments.length; t++) {
241
+ var r = arguments[t] != null ? arguments[t] : {};
242
+ if (t % 2) {
243
+ D(Object(r), true).forEach((function(t) {
244
+ Z(e, t, r[t]);
245
+ }));
246
+ } else if (Object.getOwnPropertyDescriptors) {
247
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
248
+ } else {
249
+ D(Object(r)).forEach((function(t) {
250
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
251
+ }));
252
+ }
253
+ }
254
+ return e;
255
+ }
256
+ function M(e, t) {
257
+ if (e == null) return {};
258
+ var r = V(e, t);
259
+ var n, o;
260
+ if (Object.getOwnPropertySymbols) {
261
+ var i = Object.getOwnPropertySymbols(e);
262
+ for (o = 0; o < i.length; o++) {
263
+ n = i[o];
264
+ if (t.indexOf(n) >= 0) continue;
265
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
266
+ r[n] = e[n];
267
+ }
268
+ }
269
+ return r;
270
+ }
271
+ function V(e, t) {
272
+ if (e == null) return {};
273
+ var r = {};
274
+ var n = Object.keys(e);
275
+ var o, i;
276
+ for (i = 0; i < n.length; i++) {
277
+ o = n[i];
278
+ if (t.indexOf(o) >= 0) continue;
279
+ r[o] = e[o];
280
+ }
281
+ return r;
282
+ }
283
+ function $(e, t) {
284
+ return z(e) || N(e, t) || G(e, t) || A();
285
+ }
286
+ function A() {
287
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
288
+ }
289
+ function G(e, t) {
290
+ if (!e) return;
291
+ if (typeof e === "string") return B(e, t);
292
+ var r = Object.prototype.toString.call(e).slice(8, -1);
293
+ if (r === "Object" && e.constructor) r = e.constructor.name;
294
+ if (r === "Map" || r === "Set") return Array.from(e);
295
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return B(e, t);
296
+ }
297
+ function B(e, t) {
298
+ if (t == null || t > e.length) t = e.length;
299
+ for (var r = 0, n = new Array(t); r < t; r++) {
300
+ n[r] = e[r];
301
+ }
302
+ return n;
303
+ }
304
+ function N(e, t) {
305
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
306
+ var r = [];
307
+ var n = true;
308
+ var o = false;
309
+ var i = undefined;
310
+ try {
311
+ for (var l = e[Symbol.iterator](), a; !(n = (a = l.next()).done); n = true) {
312
+ r.push(a.value);
313
+ if (t && r.length === t) break;
314
+ }
315
+ } catch (e) {
316
+ o = true;
317
+ i = e;
318
+ } finally {
319
+ try {
320
+ if (!n && l["return"] != null) l["return"]();
321
+ } finally {
322
+ if (o) throw i;
323
+ }
324
+ }
325
+ return r;
326
+ }
327
+ function z(e) {
328
+ if (Array.isArray(e)) return e;
329
+ }
330
+ function R(e, t) {
331
+ if (!(e instanceof t)) {
332
+ throw new TypeError("Cannot call a class as a function");
333
+ }
334
+ }
335
+ function W(e, t) {
336
+ for (var r = 0; r < t.length; r++) {
337
+ var n = t[r];
338
+ n.enumerable = n.enumerable || false;
339
+ n.configurable = true;
340
+ if ("value" in n) n.writable = true;
341
+ Object.defineProperty(e, n.key, n);
342
+ }
343
+ }
344
+ function F(e, t, r) {
345
+ if (t) W(e.prototype, t);
346
+ if (r) W(e, r);
347
+ return e;
348
+ }
349
+ function J(e, t) {
350
+ if (typeof t !== "function" && t !== null) {
351
+ throw new TypeError("Super expression must either be null or a function");
352
+ }
353
+ e.prototype = Object.create(t && t.prototype, {
354
+ constructor: {
355
+ value: e,
356
+ writable: true,
357
+ configurable: true
358
+ }
359
+ });
360
+ if (t) H(e, t);
361
+ }
362
+ function H(e, t) {
363
+ H = Object.setPrototypeOf || function e(t, r) {
364
+ t.__proto__ = r;
365
+ return t;
366
+ };
367
+ return H(e, t);
368
+ }
369
+ function U(e) {
370
+ var t = Q();
371
+ return function r() {
372
+ var n = Y(e), o;
373
+ if (t) {
374
+ var i = Y(this).constructor;
375
+ o = Reflect.construct(n, arguments, i);
376
+ } else {
377
+ o = n.apply(this, arguments);
378
+ }
379
+ return X(this, o);
380
+ };
381
+ }
382
+ function X(e, t) {
383
+ if (t && (L(t) === "object" || typeof t === "function")) {
384
+ return t;
385
+ }
386
+ return K(e);
387
+ }
388
+ function K(e) {
389
+ if (e === void 0) {
390
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
391
+ }
392
+ return e;
393
+ }
394
+ function Q() {
395
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
396
+ if (Reflect.construct.sham) return false;
397
+ if (typeof Proxy === "function") return true;
398
+ try {
399
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
400
+ return true;
401
+ } catch (e) {
402
+ return false;
403
+ }
404
+ }
405
+ function Y(e) {
406
+ Y = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
407
+ return t.__proto__ || Object.getPrototypeOf(t);
408
+ };
409
+ return Y(e);
410
+ }
411
+ function Z(e, t, r) {
412
+ if (t in e) {
413
+ Object.defineProperty(e, t, {
414
+ value: r,
415
+ enumerable: true,
416
+ configurable: true,
417
+ writable: true
418
+ });
419
+ } else {
420
+ e[t] = r;
421
+ }
422
+ return e;
423
+ }
424
+ // props ControlGroup may access and/or override on children
425
+ var ee = {
426
+ children: i().node,
427
+ controlsLayout: i().oneOf([ "fill", "fillJoin", "none", "stack" ]),
428
+ elementRef: i().oneOfType([ i().func, i().object ]),
429
+ error: i().oneOfType([ i().bool, i().string ]),
430
+ help: i().node,
431
+ hideLabel: i().bool,
432
+ label: i().string.isRequired,
433
+ labelFor: i().string,
434
+ labelPosition: i().oneOf([ "left", "top" ]),
435
+ labelWidth: i().oneOfType([ i().number, i().string ]),
436
+ required: i().bool,
437
+ size: i().oneOf([ "small", "medium" ]),
438
+ /** @private */
439
+ splunkTheme: i().object,
440
+ tooltip: i().node,
441
+ tooltipDefaultPlacement: i().oneOf([ "above", "below", "left", "right", "theme" ])
442
+ };
443
+ var te = {
444
+ controlsLayout: "fill",
445
+ error: false,
446
+ hideLabel: false,
447
+ labelPosition: "left",
448
+ labelWidth: 120,
449
+ required: false,
450
+ size: "medium"
451
+ };
452
+ // Style cloned onto child elements when fill behavior set.
453
+ var re = {
454
+ flexGrow: 1
455
+ };
456
+ // Margin bootom values cloned onto child elements when the stacking behavior is needed.
457
+ var ne = "0";
458
+ var oe = "16px";
459
+ var ie = "12px";
460
+ /**
379
461
  * `ControlGroup` places a label and optional help text around one or more controls. The `ControlGroup`
380
462
  * will automatically add aria attributes to associate the controls with the labels and help text to
381
463
  * address accessibility requirements.
@@ -392,349 +474,236 @@ var CHILD_MARGIN_BOTTOM_PRISMA_COMPACT = '12px';
392
474
  * If the linked child supports an `inputId` prop and it's set, its value is used for the label's `for`
393
475
  * attribute. If `inputId` is supported but not set a generated id is used instead. If `inputId` isn't
394
476
  * supported `id` is used. The `labelFor` prop may be used to override the `for` attribute.
395
- */
396
-
397
- var ControlGroup_ControlGroup = /*#__PURE__*/function (_Component) {
398
- _inherits(ControlGroup, _Component);
399
-
400
- var _super = _createSuper(ControlGroup);
401
-
402
- // @docs-props-type ControlGroupPropsBase
403
- function ControlGroup(props) {
404
- var _this;
405
-
406
- _classCallCheck(this, ControlGroup);
407
-
408
- _this = _super.call(this, props);
409
-
410
- _defineProperty(_assertThisInitialized(_this), "errorId", void 0);
411
-
412
- _defineProperty(_assertThisInitialized(_this), "helpId", void 0);
413
-
414
- _defineProperty(_assertThisInitialized(_this), "labelId", void 0);
415
-
416
- _defineProperty(_assertThisInitialized(_this), "contextValue", void 0);
417
-
418
- _defineProperty(_assertThisInitialized(_this), "childIds", void 0);
419
-
420
- _defineProperty(_assertThisInitialized(_this), "stackLayoutChildStyle", void 0);
421
-
422
- _defineProperty(_assertThisInitialized(_this), "getChildID", function (key, index) {
423
- var childKey = "".concat(key, "-").concat(index);
424
- var value = _this.childIds[childKey];
425
-
426
- if (!value || !value.length) {
427
- value = Object(id_["createDOMID"])(key);
428
- _this.childIds[childKey] = value;
429
- }
430
-
431
- return value;
432
- });
433
-
434
- _defineProperty(_assertThisInitialized(_this), "getStackLayoutChildStyle", function (isPrisma, isCompact) {
435
- if (isPrisma) {
436
- if (isCompact) {
437
- _this.stackLayoutChildStyle.marginBottom = CHILD_MARGIN_BOTTOM_PRISMA_COMPACT;
477
+ */ var le = function(e) {
478
+ J(o, e);
479
+ var t = U(o);
480
+ // @docs-props-type ControlGroupPropsBase
481
+ function o(e) {
482
+ var r;
483
+ R(this, o);
484
+ r = t.call(this, e);
485
+ Z(K(r), "errorId", void 0);
486
+ Z(K(r), "helpId", void 0);
487
+ Z(K(r), "labelId", void 0);
488
+ Z(K(r), "contextValue", void 0);
489
+ Z(K(r), "childIds", void 0);
490
+ Z(K(r), "stackLayoutChildStyle", void 0);
491
+ Z(K(r), "getChildID", (function(e, t) {
492
+ var n = "".concat(e, "-").concat(t);
493
+ var o = r.childIds[n];
494
+ if (!o || !o.length) {
495
+ o = (0, u.createDOMID)(e);
496
+ r.childIds[n] = o;
497
+ }
498
+ return o;
499
+ }));
500
+ Z(K(r), "getStackLayoutChildStyle", (function(e, t) {
501
+ if (e) {
502
+ if (t) {
503
+ r.stackLayoutChildStyle.marginBottom = ie;
504
+ }
505
+ r.stackLayoutChildStyle.marginBottom = oe;
506
+ } else {
507
+ r.stackLayoutChildStyle.marginBottom = ne;
508
+ }
509
+ return r.stackLayoutChildStyle;
510
+ }));
511
+ Z(K(r), "hasInputId", (function(e) {
512
+ return e.type && e.type.propTypes && Object.prototype.hasOwnProperty.call(e.type.propTypes, "inputId");
513
+ }));
514
+ Z(K(r), "getLinkedId", (function(e) {
515
+ if (e.length === 0) {
516
+ return undefined;
517
+ }
518
+ var t = $(e, 1), n = t[0];
519
+ var o = a()(e, (function(e) {
520
+ return e.type && e.type.componentType === "Text";
521
+ }));
522
+ var i = r.hasInputId(n);
523
+ // see class doc block for details
524
+ if (e.length === 1 && n && n.props) {
525
+ return i ? n.props.inputId : n.props.id;
526
+ }
527
+ if (o && o.props) {
528
+ return o.props.inputId;
529
+ }
530
+ if (n.props) {
531
+ return i ? n.props.inputId : n.props.id;
532
+ }
533
+ return undefined;
534
+ }));
535
+ r.errorId = (0, u.createDOMID)("error");
536
+ r.helpId = (0, u.createDOMID)("help");
537
+ r.labelId = (0, u.createDOMID)("label");
538
+ r.contextValue = r.createContextValue();
539
+ r.childIds = {};
540
+ r.stackLayoutChildStyle = {};
541
+ if (false) {}
542
+ return r;
438
543
  }
439
-
440
- _this.stackLayoutChildStyle.marginBottom = CHILD_MARGIN_BOTTOM_PRISMA;
441
- } else {
442
- _this.stackLayoutChildStyle.marginBottom = CHILD_MARGIN_BOTTOM_DEFAULT;
443
- }
444
-
445
- return _this.stackLayoutChildStyle;
446
- });
447
-
448
- _defineProperty(_assertThisInitialized(_this), "hasInputId", function (item) {
449
- return item.type && item.type.propTypes && Object.prototype.hasOwnProperty.call(item.type.propTypes, 'inputId');
450
- });
451
-
452
- _defineProperty(_assertThisInitialized(_this), "getLinkedId", function (components) {
453
- if (components.length === 0) {
454
- return undefined;
455
- }
456
-
457
- var _components = _slicedToArray(components, 1),
458
- firstChild = _components[0];
459
-
460
- var firstText = find_default()(components, function (comp) {
461
- return comp.type && comp.type.componentType === 'Text';
462
- });
463
-
464
- var inputId = _this.hasInputId(firstChild); // see class doc block for details
465
-
466
-
467
- if (components.length === 1 && firstChild && firstChild.props) {
468
- return inputId ? firstChild.props.inputId : firstChild.props.id;
469
- }
470
-
471
- if (firstText && firstText.props) {
472
- return firstText.props.inputId;
473
- }
474
-
475
- if (firstChild.props) {
476
- return inputId ? firstChild.props.inputId : firstChild.props.id;
477
- }
478
-
479
- return undefined;
480
- });
481
-
482
- _this.errorId = Object(id_["createDOMID"])('error');
483
- _this.helpId = Object(id_["createDOMID"])('help');
484
- _this.labelId = Object(id_["createDOMID"])('label');
485
- _this.contextValue = _this.createContextValue();
486
- _this.childIds = {};
487
- _this.stackLayoutChildStyle = {};
488
-
489
- if (false) {}
490
-
491
- return _this;
492
- }
493
-
494
- _createClass(ControlGroup, [{
495
- key: "shouldComponentUpdate",
496
- value: function shouldComponentUpdate(nextProps) {
497
- if (external_react_default.a.Children.count(nextProps.children) !== external_react_default.a.Children.count(this.props.children)) {
498
- this.childIds = {};
499
- }
500
-
501
- return true;
502
- }
503
- }, {
504
- key: "createContextValue",
505
- value: function createContextValue() {
506
- return {
507
- labelAttrs: {
508
- text: this.props.label,
509
- id: this.labelId
510
- }
511
- };
512
- }
513
- }, {
514
- key: "getContextValue",
515
- value: function getContextValue() {
516
- var _this$contextValue$la, _this$contextValue$la2;
517
-
518
- if (this.props.label !== ((_this$contextValue$la = this.contextValue.labelAttrs) === null || _this$contextValue$la === void 0 ? void 0 : _this$contextValue$la.text) || this.labelId !== ((_this$contextValue$la2 = this.contextValue.labelAttrs) === null || _this$contextValue$la2 === void 0 ? void 0 : _this$contextValue$la2.id)) {
519
- this.contextValue = this.createContextValue();
520
- }
521
-
522
- return this.contextValue;
523
- }
524
- }, {
525
- key: "render",
526
- value: function render() {
527
- var _this2 = this;
528
-
529
- var _this$props = this.props,
530
- children = _this$props.children,
531
- controlsLayout = _this$props.controlsLayout,
532
- error = _this$props.error,
533
- help = _this$props.help,
534
- hideLabel = _this$props.hideLabel,
535
- label = _this$props.label,
536
- labelFor = _this$props.labelFor,
537
- labelPosition = _this$props.labelPosition,
538
- labelWidth = _this$props.labelWidth,
539
- required = _this$props.required,
540
- size = _this$props.size,
541
- splunkTheme = _this$props.splunkTheme,
542
- tooltip = _this$props.tooltip,
543
- tooltipDefaultPlacement = _this$props.tooltipDefaultPlacement,
544
- otherProps = _objectWithoutProperties(_this$props, ["children", "controlsLayout", "error", "help", "hideLabel", "label", "labelFor", "labelPosition", "labelWidth", "required", "size", "splunkTheme", "tooltip", "tooltipDefaultPlacement"]);
545
-
546
- var isPrisma = splunkTheme.isPrisma,
547
- isCompact = splunkTheme.isCompact;
548
- var validChildren = external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]);
549
- var count = validChildren.length;
550
- var writableOtherProps = otherProps; // Clean the Children
551
-
552
- var cloneWithProps = function cloneWithProps(item, i) {
553
- var cloneProps = {
554
- key: item.key || i
555
- };
556
-
557
- if (controlsLayout === 'fillJoin') {
558
- if (i > 0) {
559
- cloneProps.prepend = true;
560
- }
561
-
562
- if (i < count - 1) {
563
- cloneProps.append = true;
564
- }
565
-
566
- if (cloneProps.prepend || cloneProps.append) {
567
- cloneProps.inline = false;
568
- }
569
- }
570
-
571
- if (controlsLayout === 'fill' && count > 1) {
572
- cloneProps.inline = true;
573
- }
574
-
575
- if (controlsLayout === 'stack') {
576
- cloneProps.inline = false;
577
-
578
- if (i < count - 1) {
579
- // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
580
- var stackStyle = _this2.getStackLayoutChildStyle(isPrisma, isCompact);
581
-
582
- cloneProps.style = item.props.style ? _objectSpread(_objectSpread({}, item.props.style), stackStyle) : stackStyle;
583
- }
584
- }
585
-
586
- cloneProps.labelledBy = _this2.labelId;
587
-
588
- if (_this2.props.help && typeof _this2.props.error === 'boolean') {
589
- cloneProps.describedBy = _this2.helpId;
590
- } else if (_this2.props.help && typeof _this2.props.error === 'string') {
591
- cloneProps.describedBy = "".concat(_this2.helpId, " ").concat(_this2.errorId);
592
- } else if (!_this2.props.help && typeof _this2.props.error === 'string') {
593
- cloneProps.describedBy = _this2.errorId;
594
- }
595
-
596
- if (_this2.props.required) {
597
- cloneProps.required = true;
598
- } // TODO: SUI-3402 refactor so that parent component doesn't have to know what it's child components are
599
-
600
-
601
- if (item.type.componentType === 'Multiselect') {
602
- var multiselect = item;
603
-
604
- if (multiselect.props.compact === false) {
605
- cloneProps.labelText = label;
606
- }
607
- } else {
608
- cloneProps.labelText = label;
609
- }
610
-
611
- if (count === 1 && (controlsLayout === 'fillJoin' || controlsLayout === 'fill')) {
612
- // Some controls like Select do not grow by default, so flexGrow is applied
613
- // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
614
- cloneProps.style = item.props.style ? _objectSpread(_objectSpread({}, item.props.style), FLEX_GROW_STYLE) : FLEX_GROW_STYLE;
615
- }
616
-
617
- if (!labelFor && item) {
618
- if (_this2.hasInputId(item)) {
619
- cloneProps.inputId = item.props.inputId || _this2.getChildID('input-id', i);
620
- } else {
621
- cloneProps.id = item.props.id || _this2.getChildID('id', i);
622
- }
623
- }
624
-
625
- return /*#__PURE__*/Object(external_react_["cloneElement"])(item, cloneProps);
626
- };
627
-
628
- var childrenFormatted = validChildren.map(cloneWithProps);
629
- var defaultLinkedId = this.getLinkedId(childrenFormatted);
630
-
631
- if (error) {
632
- writableOtherProps['aria-invalid'] = true;
633
- }
634
-
635
- var labelWidthStyle = labelPosition === 'left' ? {
636
- width: labelWidth
637
- } : undefined;
638
- var labelWidthString = isFinite_default()(labelWidth) ? "".concat(labelWidth, "px") : labelWidth;
639
- var labelMargin = isPrisma ? '16px' : '20px';
640
- var contentMarginStyle = labelPosition === 'left' ? {
641
- marginLeft: "calc(".concat(labelWidthString, " + ").concat(labelMargin, ")")
642
- } : undefined;
643
- var StyledControlsComponent = controlsLayout === 'stack' ? StyledControlsStackBox : Box_default.a;
644
- var StyledLabelWrapperComponent = labelPosition === 'left' ? StyledLabelWrapperLeft : StyledLabelWrapper;
645
- var styledLabel = /*#__PURE__*/external_react_default.a.createElement(StyledLabelWrapperComponent, {
646
- style: labelWidthStyle,
647
- $labelPosition: labelPosition
648
- }, /*#__PURE__*/external_react_default.a.createElement(StyledLabel, {
649
- "data-size": size,
650
- "data-test": "label",
651
- id: this.labelId,
652
- htmlFor: labelFor || defaultLinkedId,
653
- $tooltip: !!tooltip
654
- }, required && /*#__PURE__*/external_react_default.a.createElement(StyledAsterisk, {
655
- "aria-hidden": "true"
656
- }, "*"), label, !isPrisma && !hideLabel && tooltip && /*#__PURE__*/external_react_default.a.createElement("span", null, "\xA0"), !hideLabel && tooltip && /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, tooltip)), !hideLabel && tooltip && /*#__PURE__*/external_react_default.a.createElement(StyledTooltip, {
657
- $labelPosition: labelPosition,
658
- closeWhen: "notOnClick",
659
- content: tooltip,
660
- defaultPlacement: tooltipDefaultPlacement,
661
- "aria-hidden": "true"
662
- }));
663
- var isError = typeof error === 'string' || error === true;
664
- var isErrorBoolean = typeof error === 'boolean';
665
- return /*#__PURE__*/external_react_default.a.createElement(StyledBox, _extends({
666
- "data-test": "control-group",
667
- $error: isError
668
- }, writableOtherProps), /*#__PURE__*/external_react_default.a.createElement(ControlGroup_ControlGroupContext.Provider, {
669
- value: this.getContextValue()
670
- }, hideLabel ? /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, styledLabel) : styledLabel, /*#__PURE__*/external_react_default.a.createElement(StyledControlsComponent, {
671
- "data-test": "controls",
672
- flex: controlsLayout !== 'none',
673
- style: contentMarginStyle
674
- }, childrenFormatted), help && /*#__PURE__*/external_react_default.a.createElement(StyledHelp, {
675
- "data-test": "help",
676
- id: this.helpId,
677
- style: contentMarginStyle,
678
- $error: isError && isErrorBoolean
679
- }, help), isError && !isErrorBoolean && /*#__PURE__*/external_react_default.a.createElement(StyledErrorText, {
680
- "data-test": "error",
681
- id: this.errorId,
682
- style: contentMarginStyle,
683
- $help: !!help
684
- }, error)));
685
- }
686
- }]);
687
-
688
- return ControlGroup;
689
- }(external_react_["Component"]);
690
-
691
- _defineProperty(ControlGroup_ControlGroup, "propTypes", propTypes);
692
-
693
- _defineProperty(ControlGroup_ControlGroup, "defaultProps", defaultProps);
694
-
695
- var ControlGroupWithTheme = Object(themes_["withSplunkTheme"])(ControlGroup_ControlGroup);
696
- ControlGroupWithTheme.propTypes = ControlGroup_ControlGroup.propTypes;
697
- /* harmony default export */ var src_ControlGroup_ControlGroup = (ControlGroupWithTheme);
698
-
699
- // CONCATENATED MODULE: ./src/ControlGroup/index.ts
700
-
701
-
702
-
703
- /***/ }),
704
-
705
- /***/ 3:
706
- /***/ (function(module, exports) {
707
-
708
- module.exports = require("styled-components");
709
-
710
- /***/ }),
711
-
712
- /***/ 45:
713
- /***/ (function(module, exports) {
714
-
715
- module.exports = require("@splunk/react-ui/Tooltip");
716
-
717
- /***/ }),
718
-
719
- /***/ 55:
720
- /***/ (function(module, exports) {
721
-
722
- module.exports = require("lodash/find");
723
-
724
- /***/ }),
725
-
726
- /***/ 6:
727
- /***/ (function(module, exports) {
728
-
729
- module.exports = require("@splunk/react-ui/Box");
730
-
731
- /***/ }),
732
-
733
- /***/ 8:
734
- /***/ (function(module, exports) {
735
-
736
- module.exports = require("@splunk/ui-utils/id");
737
-
738
- /***/ })
739
-
740
- /******/ });
544
+ F(o, [ {
545
+ key: "shouldComponentUpdate",
546
+ value: function e(t) {
547
+ if (n().Children.count(t.children) !== n().Children.count(this.props.children)) {
548
+ this.childIds = {};
549
+ }
550
+ return true;
551
+ }
552
+ }, {
553
+ key: "createContextValue",
554
+ value: function e() {
555
+ return {
556
+ labelAttrs: {
557
+ text: this.props.label,
558
+ id: this.labelId
559
+ }
560
+ };
561
+ }
562
+ }, {
563
+ key: "getContextValue",
564
+ value: function e() {
565
+ var t, r;
566
+ if (this.props.label !== ((t = this.contextValue.labelAttrs) === null || t === void 0 ? void 0 : t.text) || this.labelId !== ((r = this.contextValue.labelAttrs) === null || r === void 0 ? void 0 : r.id)) {
567
+ this.contextValue = this.createContextValue();
568
+ }
569
+ return this.contextValue;
570
+ }
571
+ }, {
572
+ key: "render",
573
+ value: function e() {
574
+ var t = this;
575
+ var o = this.props, i = o.children, l = o.controlsLayout, a = o.error, s = o.help, c = o.hideLabel, u = o.label, f = o.labelFor, y = o.labelPosition, h = o.labelWidth, m = o.required, v = o.size, g = o.splunkTheme, _ = o.tooltip, L = o.tooltipDefaultPlacement, D = M(o, [ "children", "controlsLayout", "error", "help", "hideLabel", "label", "labelFor", "labelPosition", "labelWidth", "required", "size", "splunkTheme", "tooltip", "tooltipDefaultPlacement" ]);
576
+ var V = g.isPrisma, $ = g.isCompact;
577
+ var A = r.Children.toArray(i).filter(r.isValidElement);
578
+ var G = A.length;
579
+ var B = D;
580
+ // Clean the Children
581
+ var N = function e(n, o) {
582
+ var i = {
583
+ key: n.key || o
584
+ };
585
+ if (l === "fillJoin") {
586
+ if (o > 0) {
587
+ i.prepend = true;
588
+ }
589
+ if (o < G - 1) {
590
+ i.append = true;
591
+ }
592
+ if (i.prepend || i.append) {
593
+ i.inline = false;
594
+ }
595
+ }
596
+ if (l === "fill" && G > 1) {
597
+ i.inline = true;
598
+ }
599
+ if (l === "stack") {
600
+ i.inline = false;
601
+ if (o < G - 1) {
602
+ // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
603
+ var a = t.getStackLayoutChildStyle(V, $);
604
+ i.style = n.props.style ? q(q({}, n.props.style), a) : a;
605
+ }
606
+ }
607
+ i.labelledBy = t.labelId;
608
+ if (t.props.help && typeof t.props.error === "boolean") {
609
+ i.describedBy = t.helpId;
610
+ } else if (t.props.help && typeof t.props.error === "string") {
611
+ i.describedBy = "".concat(t.helpId, " ").concat(t.errorId);
612
+ } else if (!t.props.help && typeof t.props.error === "string") {
613
+ i.describedBy = t.errorId;
614
+ }
615
+ if (t.props.required) {
616
+ i.required = true;
617
+ }
618
+ // TODO: SUI-3402 refactor so that parent component doesn't have to know what it's child components are
619
+ if (n.type.componentType === "Multiselect") {
620
+ var s = n;
621
+ if (s.props.compact === false) {
622
+ i.labelText = u;
623
+ }
624
+ } else {
625
+ i.labelText = u;
626
+ }
627
+ if (G === 1 && (l === "fillJoin" || l === "fill")) {
628
+ // Some controls like Select do not grow by default, so flexGrow is applied
629
+ // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
630
+ i.style = n.props.style ? q(q({}, n.props.style), re) : re;
631
+ }
632
+ if (!f && n) {
633
+ if (t.hasInputId(n)) {
634
+ i.inputId = n.props.inputId || t.getChildID("input-id", o);
635
+ } else {
636
+ i.id = n.props.id || t.getChildID("id", o);
637
+ }
638
+ }
639
+
640
+ return (0, r.cloneElement)(n, i);
641
+ };
642
+ var z = A.map(N);
643
+ var R = this.getLinkedId(z);
644
+ if (a) {
645
+ B["aria-invalid"] = true;
646
+ }
647
+ var W = y === "left" ? {
648
+ width: h
649
+ } : undefined;
650
+ var F = p()(h) ? "".concat(h, "px") : h;
651
+ var J = V ? "16px" : "20px";
652
+ var H = y === "left" ? {
653
+ marginLeft: "calc(".concat(F, " + ").concat(J, ")")
654
+ } : undefined;
655
+ var U = l === "stack" ? x : d();
656
+ var X = y === "left" ? I : S;
657
+ var K = n().createElement(X, {
658
+ style: W,
659
+ $labelPosition: y
660
+ }, n().createElement(C, {
661
+ "data-size": v,
662
+ "data-test": "label",
663
+ id: this.labelId,
664
+ htmlFor: f || R,
665
+ $tooltip: !!_
666
+ }, m && n().createElement(P, {
667
+ "aria-hidden": "true"
668
+ }, "*"), u, !V && !c && _ && n().createElement("span", null, " "), !c && _ && n().createElement(b(), null, _)), !c && _ && n().createElement(k, {
669
+ $labelPosition: y,
670
+ closeWhen: "notOnClick",
671
+ content: _,
672
+ defaultPlacement: L,
673
+ "aria-hidden": "true"
674
+ }));
675
+ var Q = typeof a === "string" || a === true;
676
+ var Y = typeof a === "boolean";
677
+
678
+ return n().createElement(O, E({
679
+ "data-test": "control-group",
680
+ $error: Q
681
+ }, B), n().createElement(T.Provider, {
682
+ value: this.getContextValue()
683
+ }, c ? n().createElement(b(), null, K) : K, n().createElement(U, {
684
+ "data-test": "controls",
685
+ flex: l !== "none",
686
+ style: H
687
+ }, z), s && n().createElement(w, {
688
+ "data-test": "help",
689
+ id: this.helpId,
690
+ style: H,
691
+ $error: Q && Y
692
+ }, s), Q && !Y && n().createElement(j, {
693
+ "data-test": "error",
694
+ id: this.errorId,
695
+ style: H,
696
+ $help: !!s
697
+ }, a)));
698
+ }
699
+ } ]);
700
+ return o;
701
+ }(r.Component);
702
+ Z(le, "propTypes", ee);
703
+ Z(le, "defaultProps", te);
704
+ var ae = (0, c.withSplunkTheme)(le);
705
+ ae.propTypes = le.propTypes;
706
+ /* harmony default export */ const se = ae;
707
+ // CONCATENATED MODULE: ./src/ControlGroup/index.ts
708
+ module.exports = t;
709
+ /******/})();