@splunk/react-ui 4.21.0 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) 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 +24 -3
  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 +1807 -2084
  18. package/CollapsiblePanel.js +586 -519
  19. package/Color.js +1068 -1068
  20. package/ColumnLayout.js +402 -363
  21. package/ComboBox.js +903 -794
  22. package/Concertina.js +997 -802
  23. package/ControlGroup.js +687 -594
  24. package/Date.js +567 -547
  25. package/DefinitionList.js +308 -234
  26. package/Divider.js +149 -118
  27. package/Dropdown.js +459 -416
  28. package/DualListbox.js +1479 -1541
  29. package/EventListener.js +94 -97
  30. package/File.js +1051 -969
  31. package/FormRows.js +883 -696
  32. package/Heading.js +216 -193
  33. package/Image.js +446 -402
  34. package/JSONTree.js +690 -551
  35. package/Layer.js +437 -410
  36. package/Link.js +336 -255
  37. package/List.js +213 -161
  38. package/Markdown.js +509 -487
  39. package/Menu.js +1104 -1056
  40. package/Message.js +475 -441
  41. package/MessageBar.js +387 -373
  42. package/Modal.js +810 -634
  43. package/ModalLayer.js +326 -243
  44. package/Monogram.js +308 -276
  45. package/Multiselect.js +3564 -3364
  46. package/Number.js +729 -687
  47. package/Paginator.js +510 -449
  48. package/Paragraph.js +145 -112
  49. package/Popover.js +1459 -1432
  50. package/Progress.js +301 -246
  51. package/RadioBar.js +634 -527
  52. package/RadioList.js +483 -444
  53. package/Resize.js +530 -489
  54. package/ResultsMenu.js +479 -455
  55. package/ScreenReaderContent.js +142 -111
  56. package/Scroll.js +595 -456
  57. package/ScrollContainerContext.js +197 -206
  58. package/Search.js +756 -650
  59. package/Select.js +2446 -2345
  60. package/SidePanel.js +390 -284
  61. package/Slider.js +680 -676
  62. package/SlidingPanels.js +639 -503
  63. package/SplitButton.js +464 -367
  64. package/StaticContent.js +161 -133
  65. package/StepBar.js +386 -358
  66. package/Switch.js +710 -640
  67. package/TabBar.js +741 -680
  68. package/TabLayout.js +406 -322
  69. package/Table.js +4974 -4616
  70. package/Text.js +1170 -1138
  71. package/TextArea.js +1102 -1090
  72. package/Tooltip.js +624 -581
  73. package/TransitionOpen.js +489 -422
  74. package/Typography.js +176 -153
  75. package/WaitSpinner.js +230 -206
  76. package/package.json +7 -7
  77. package/types/src/Color/Color.d.ts +0 -1
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/types/src/RadioBar/RadioBar.d.ts +1 -0
  81. package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
  82. package/types/src/Select/docs/examples/Icons.d.ts +1 -9
  83. package/types/src/Slider/Slider.d.ts +1 -0
  84. package/types/src/TabBar/Tab.d.ts +10 -1
  85. package/types/src/TabBar/TabBar.d.ts +4 -2
  86. package/types/src/Table/Head.d.ts +7 -3
  87. package/types/src/Table/Table.d.ts +3 -2
  88. package/types/src/Table/TableContext.d.ts +2 -0
  89. package/useForceUpdate.js +112 -82
  90. package/useKeyPress.js +74 -71
  91. package/usePrevious.js +65 -65
  92. package/useRovingFocus.js +122 -138
package/ControlGroup.js CHANGED
@@ -1,293 +1,463 @@
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
- ControlGroupContext: () => (/* reexport */ ControlGroup_ControlGroupContext),
55
- "default": () => (/* reexport */ ControlGroup_ControlGroup)
56
- });
57
-
58
- ;// CONCATENATED MODULE: external "react"
59
- const external_react_namespaceObject = require("react");
60
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
61
- ;// CONCATENATED MODULE: external "prop-types"
62
- const external_prop_types_namespaceObject = require("prop-types");
63
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
64
- ;// CONCATENATED MODULE: external "lodash/find"
65
- const find_namespaceObject = require("lodash/find");
66
- var find_default = /*#__PURE__*/__webpack_require__.n(find_namespaceObject);
67
- ;// CONCATENATED MODULE: external "lodash/isFinite"
68
- const isFinite_namespaceObject = require("lodash/isFinite");
69
- var isFinite_default = /*#__PURE__*/__webpack_require__.n(isFinite_namespaceObject);
70
- ;// CONCATENATED MODULE: external "@splunk/themes"
71
- const themes_namespaceObject = require("@splunk/themes");
72
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/id"
73
- const id_namespaceObject = require("@splunk/ui-utils/id");
74
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
75
- const Box_namespaceObject = require("@splunk/react-ui/Box");
76
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
77
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
78
- const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
79
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
80
- ;// CONCATENATED MODULE: external "styled-components"
81
- const external_styled_components_namespaceObject = require("styled-components");
82
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
83
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
84
- const Tooltip_namespaceObject = require("@splunk/react-ui/Tooltip");
85
- var Tooltip_default = /*#__PURE__*/__webpack_require__.n(Tooltip_namespaceObject);
86
- ;// CONCATENATED MODULE: ./src/ControlGroup/ControlGroupStyles.ts
87
-
88
-
89
-
90
-
91
- var StyledBox = external_styled_components_default()((Box_default())).withConfig({
92
- displayName: "ControlGroupStyles__StyledBox",
93
- componentId: "wjnyif-0"
94
- })(["", " ", " max-width:600px;margin-bottom:", ";", " color:", ";", ""], themes_namespaceObject.mixins.reset('block'), themes_namespaceObject.mixins.clearfix(), (0,themes_namespaceObject.pick)({
95
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(", " * 0.75)"], themes_namespaceObject.variables.spacing),
96
- prisma: {
97
- comfortable: '16px',
98
- compact: '12px'
99
- }
100
- }), (0,themes_namespaceObject.pick)({
101
- prisma: {
102
- comfortable: (0,external_styled_components_namespaceObject.css)(["&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}"], themes_namespaceObject.variables.spacingMedium, themes_namespaceObject.variables.spacingMedium),
103
- compact: (0,external_styled_components_namespaceObject.css)(["&:first-child{margin-top:", ";}&:last-child{margin-bottom:", ";}"], themes_namespaceObject.variables.spacingSmall, themes_namespaceObject.variables.spacingSmall)
104
- }
105
- }), (0,themes_namespaceObject.pick)({
106
- enterprise: themes_namespaceObject.variables.textColor,
107
- prisma: themes_namespaceObject.variables.contentColorMuted
108
- }), function (_ref) {
109
- var $error = _ref.$error;
110
- return $error && (0,external_styled_components_namespaceObject.css)(["color:", ";"], (0,themes_namespaceObject.pick)({
111
- enterprise: {
112
- light: themes_namespaceObject.variables.errorColorD10,
113
- dark: themes_namespaceObject.variables.errorColorL20
114
- },
115
- prisma: themes_namespaceObject.variables.accentColorNegative
116
- }));
117
- });
118
- var StyledControlsStackBox = external_styled_components_default()((Box_default())).withConfig({
119
- displayName: "ControlGroupStyles__StyledControlsStackBox",
120
- componentId: "wjnyif-1"
121
- })(["flex-direction:column;"]);
122
- var StyledLabelWrapper = external_styled_components_default().div.withConfig({
123
- displayName: "ControlGroupStyles__StyledLabelWrapper",
124
- componentId: "wjnyif-2"
125
- })(["display:inline-flex;align-items:center;", " ", ""], (0,themes_namespaceObject.pick)({
126
- enterprise: (0,external_styled_components_namespaceObject.css)(["justify-content:flex-end;"])
127
- }), function (_ref2) {
128
- var $labelPosition = _ref2.$labelPosition;
129
- return $labelPosition === 'top' ? (0,external_styled_components_namespaceObject.css)(["", ""], (0,themes_namespaceObject.pick)({
130
- prisma: (0,external_styled_components_namespaceObject.css)(["height:24px;padding-bottom:", ";"], themes_namespaceObject.variables.spacingXSmall)
131
- })) : (0,external_styled_components_namespaceObject.css)(["", ""], (0,themes_namespaceObject.pick)({
132
- prisma: (0,external_styled_components_namespaceObject.css)(["min-height:", ";"], themes_namespaceObject.variables.inputHeight)
133
- }));
134
- });
135
- var StyledLabelWrapperLeft = external_styled_components_default()(StyledLabelWrapper).withConfig({
136
- displayName: "ControlGroupStyles__StyledLabelWrapperLeft",
137
- componentId: "wjnyif-3"
138
- })(["float:left;"]);
139
- var StyledLabel = external_styled_components_default().label.withConfig({
140
- displayName: "ControlGroupStyles__StyledLabel",
141
- componentId: "wjnyif-4"
142
- })(["padding:", ";word-wrap:break-word;color:inherit;text-align:", ";"], (0,themes_namespaceObject.pick)({
143
- enterprise: {
144
- comfortable: '6px 0',
145
- compact: '4px 0'
146
- }
147
- }), (0,themes_namespaceObject.pick)({
148
- enterprise: 'right',
149
- prisma: 'left'
150
- }));
151
- var StyledTooltip = external_styled_components_default()((Tooltip_default())).withConfig({
152
- displayName: "ControlGroupStyles__StyledTooltip",
153
- componentId: "wjnyif-5"
154
- })(["", ""], function (_ref3) {
155
- var $labelPosition = _ref3.$labelPosition;
156
- return $labelPosition === 'top' && (0,external_styled_components_namespaceObject.css)(["button{", "}"], (0,themes_namespaceObject.pick)({
157
- prisma: (0,external_styled_components_namespaceObject.css)(["svg{width:20px;height:20px;}padding:4px;"])
158
- }));
159
- });
160
- var StyledHelp = external_styled_components_default().div.withConfig({
161
- displayName: "ControlGroupStyles__StyledHelp",
162
- componentId: "wjnyif-6"
163
- })(["", ";font-size:", ";color:", ";margin-top:", ";", ""], themes_namespaceObject.mixins.reset('block'), themes_namespaceObject.variables.fontSizeSmall, themes_namespaceObject.variables.contentColorMuted, (0,themes_namespaceObject.pick)({
164
- enterprise: '2px',
165
- prisma: '4px'
166
- }), function (_ref4) {
167
- var $error = _ref4.$error;
168
- return $error && (0,external_styled_components_namespaceObject.css)(["color:inherit;"]);
169
- });
170
- var StyledErrorText = external_styled_components_default().div.withConfig({
171
- displayName: "ControlGroupStyles__StyledErrorText",
172
- componentId: "wjnyif-7"
173
- })(["", ";font-size:", ";[aria-invalid] > &{color:inherit;}", ""], themes_namespaceObject.mixins.reset('block'), themes_namespaceObject.variables.fontSizeSmall, function (_ref5) {
174
- var $help = _ref5.$help;
175
- return !$help && (0,external_styled_components_namespaceObject.css)(["margin-top:", ";"], (0,themes_namespaceObject.pick)({
176
- enterprise: '2px',
177
- prisma: '4px'
178
- }));
179
- });
180
- var StyledAsterisk = external_styled_components_default().span.withConfig({
181
- displayName: "ControlGroupStyles__StyledAsterisk",
182
- componentId: "wjnyif-8"
183
- })(["color:inherit;margin-right:2px;"]);
184
-
185
- ;// CONCATENATED MODULE: ./src/ControlGroup/ControlGroupContext.tsx
186
-
187
-
188
- /**
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
+ /**
189
193
  * A React context used to inform subcomponets of ControlGroup of parent component values.
190
194
  * The context interface is `ControlGroupContextValue`.
191
195
  * Defaults to `'{}'`.
192
196
  * @public
193
197
  */
194
- var ControlGroupContext = /*#__PURE__*/external_react_default().createContext({});
195
- /* harmony default export */ const ControlGroup_ControlGroupContext = (ControlGroupContext);
196
- ;// CONCATENATED MODULE: ./src/ControlGroup/ControlGroup.tsx
197
- 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); }
198
-
199
- 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); }
200
-
201
- 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; }
202
-
203
- 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; }
204
-
205
- 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; }
206
-
207
- 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; }
208
-
209
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
210
-
211
- 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."); }
212
-
213
- 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); }
214
-
215
- 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; }
216
-
217
- 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; }
218
-
219
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
220
-
221
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
222
-
223
- 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); } }
224
-
225
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
226
-
227
- 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); }
228
-
229
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
230
-
231
- 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); }; }
232
-
233
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
234
-
235
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
236
-
237
- 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; } }
238
-
239
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
240
-
241
- 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; }
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
- // props ControlGroup may access and/or override on children
253
-
254
- var propTypes = {
255
- children: (external_prop_types_default()).node,
256
- controlsLayout: external_prop_types_default().oneOf(['fill', 'fillJoin', 'none', 'stack']),
257
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
258
- error: external_prop_types_default().oneOfType([(external_prop_types_default()).bool, (external_prop_types_default()).string]),
259
- help: (external_prop_types_default()).node,
260
- hideLabel: (external_prop_types_default()).bool,
261
- label: (external_prop_types_default()).string.isRequired,
262
- labelFor: (external_prop_types_default()).string,
263
- labelPosition: external_prop_types_default().oneOf(['left', 'top']),
264
- labelWidth: external_prop_types_default().oneOfType([(external_prop_types_default()).number, (external_prop_types_default()).string]),
265
- required: (external_prop_types_default()).bool,
266
- size: external_prop_types_default().oneOf(['small', 'medium']),
267
-
268
- /** @private */
269
- splunkTheme: (external_prop_types_default()).object,
270
- tooltip: (external_prop_types_default()).node,
271
- tooltipDefaultPlacement: external_prop_types_default().oneOf(['above', 'below', 'left', 'right', 'theme'])
272
- };
273
- var defaultProps = {
274
- controlsLayout: 'fill',
275
- error: false,
276
- hideLabel: false,
277
- labelPosition: 'left',
278
- labelWidth: 120,
279
- required: false,
280
- size: 'medium'
281
- };
282
- // Style cloned onto child elements when fill behavior set.
283
- var FLEX_GROW_STYLE = {
284
- flexGrow: 1
285
- }; // Margin bootom values cloned onto child elements when the stacking behavior is needed.
286
-
287
- var CHILD_MARGIN_BOTTOM_DEFAULT = '0';
288
- var CHILD_MARGIN_BOTTOM_PRISMA = '16px';
289
- var CHILD_MARGIN_BOTTOM_PRISMA_COMPACT = '12px';
290
- /**
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
+ /**
291
461
  * `ControlGroup` places a label and optional help text around one or more controls. The `ControlGroup`
292
462
  * will automatically add aria attributes to associate the controls with the labels and help text to
293
463
  * address accessibility requirements.
@@ -304,313 +474,236 @@ var CHILD_MARGIN_BOTTOM_PRISMA_COMPACT = '12px';
304
474
  * If the linked child supports an `inputId` prop and it's set, its value is used for the label's `for`
305
475
  * attribute. If `inputId` is supported but not set a generated id is used instead. If `inputId` isn't
306
476
  * supported `id` is used. The `labelFor` prop may be used to override the `for` attribute.
307
- */
308
-
309
- var ControlGroup = /*#__PURE__*/function (_Component) {
310
- _inherits(ControlGroup, _Component);
311
-
312
- var _super = _createSuper(ControlGroup);
313
-
314
- // @docs-props-type ControlGroupPropsBase
315
- function ControlGroup(props) {
316
- var _this;
317
-
318
- _classCallCheck(this, ControlGroup);
319
-
320
- _this = _super.call(this, props);
321
-
322
- _defineProperty(_assertThisInitialized(_this), "errorId", void 0);
323
-
324
- _defineProperty(_assertThisInitialized(_this), "helpId", void 0);
325
-
326
- _defineProperty(_assertThisInitialized(_this), "labelId", void 0);
327
-
328
- _defineProperty(_assertThisInitialized(_this), "contextValue", void 0);
329
-
330
- _defineProperty(_assertThisInitialized(_this), "childIds", void 0);
331
-
332
- _defineProperty(_assertThisInitialized(_this), "stackLayoutChildStyle", void 0);
333
-
334
- _defineProperty(_assertThisInitialized(_this), "getChildID", function (key, index) {
335
- var childKey = "".concat(key, "-").concat(index);
336
- var value = _this.childIds[childKey];
337
-
338
- if (!value || !value.length) {
339
- value = (0,id_namespaceObject.createDOMID)(key);
340
- _this.childIds[childKey] = value;
341
- }
342
-
343
- return value;
344
- });
345
-
346
- _defineProperty(_assertThisInitialized(_this), "getStackLayoutChildStyle", function (isPrisma, isCompact) {
347
- if (isPrisma) {
348
- if (isCompact) {
349
- _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;
350
543
  }
351
-
352
- _this.stackLayoutChildStyle.marginBottom = CHILD_MARGIN_BOTTOM_PRISMA;
353
- } else {
354
- _this.stackLayoutChildStyle.marginBottom = CHILD_MARGIN_BOTTOM_DEFAULT;
355
- }
356
-
357
- return _this.stackLayoutChildStyle;
358
- });
359
-
360
- _defineProperty(_assertThisInitialized(_this), "hasInputId", function (item) {
361
- return item.type && item.type.propTypes && Object.prototype.hasOwnProperty.call(item.type.propTypes, 'inputId');
362
- });
363
-
364
- _defineProperty(_assertThisInitialized(_this), "getLinkedId", function (components) {
365
- if (components.length === 0) {
366
- return undefined;
367
- }
368
-
369
- var _components = _slicedToArray(components, 1),
370
- firstChild = _components[0];
371
-
372
- var firstText = find_default()(components, function (comp) {
373
- return comp.type && comp.type.componentType === 'Text';
374
- });
375
-
376
- var inputId = _this.hasInputId(firstChild); // see class doc block for details
377
-
378
-
379
- if (components.length === 1 && firstChild && firstChild.props) {
380
- return inputId ? firstChild.props.inputId : firstChild.props.id;
381
- }
382
-
383
- if (firstText && firstText.props) {
384
- return firstText.props.inputId;
385
- }
386
-
387
- if (firstChild.props) {
388
- return inputId ? firstChild.props.inputId : firstChild.props.id;
389
- }
390
-
391
- return undefined;
392
- });
393
-
394
- _this.errorId = (0,id_namespaceObject.createDOMID)('error');
395
- _this.helpId = (0,id_namespaceObject.createDOMID)('help');
396
- _this.labelId = (0,id_namespaceObject.createDOMID)('label');
397
- _this.contextValue = _this.createContextValue();
398
- _this.childIds = {};
399
- _this.stackLayoutChildStyle = {};
400
-
401
- if (false) {}
402
-
403
- return _this;
404
- }
405
-
406
- _createClass(ControlGroup, [{
407
- key: "shouldComponentUpdate",
408
- value: function shouldComponentUpdate(nextProps) {
409
- if (external_react_default().Children.count(nextProps.children) !== external_react_default().Children.count(this.props.children)) {
410
- this.childIds = {};
411
- }
412
-
413
- return true;
414
- }
415
- }, {
416
- key: "createContextValue",
417
- value: function createContextValue() {
418
- return {
419
- labelAttrs: {
420
- text: this.props.label,
421
- id: this.labelId
422
- }
423
- };
424
- }
425
- }, {
426
- key: "getContextValue",
427
- value: function getContextValue() {
428
- var _this$contextValue$la, _this$contextValue$la2;
429
-
430
- 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)) {
431
- this.contextValue = this.createContextValue();
432
- }
433
-
434
- return this.contextValue;
435
- }
436
- }, {
437
- key: "render",
438
- value: function render() {
439
- var _this2 = this;
440
-
441
- var _this$props = this.props,
442
- children = _this$props.children,
443
- controlsLayout = _this$props.controlsLayout,
444
- error = _this$props.error,
445
- help = _this$props.help,
446
- hideLabel = _this$props.hideLabel,
447
- label = _this$props.label,
448
- labelFor = _this$props.labelFor,
449
- labelPosition = _this$props.labelPosition,
450
- labelWidth = _this$props.labelWidth,
451
- required = _this$props.required,
452
- size = _this$props.size,
453
- splunkTheme = _this$props.splunkTheme,
454
- tooltip = _this$props.tooltip,
455
- tooltipDefaultPlacement = _this$props.tooltipDefaultPlacement,
456
- otherProps = _objectWithoutProperties(_this$props, ["children", "controlsLayout", "error", "help", "hideLabel", "label", "labelFor", "labelPosition", "labelWidth", "required", "size", "splunkTheme", "tooltip", "tooltipDefaultPlacement"]);
457
-
458
- var isPrisma = splunkTheme.isPrisma,
459
- isCompact = splunkTheme.isCompact;
460
- var validChildren = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement);
461
- var count = validChildren.length;
462
- var writableOtherProps = otherProps; // Clean the Children
463
-
464
- var cloneWithProps = function cloneWithProps(item, i) {
465
- var cloneProps = {
466
- key: item.key || i
467
- };
468
-
469
- if (controlsLayout === 'fillJoin') {
470
- if (i > 0) {
471
- cloneProps.prepend = true;
472
- }
473
-
474
- if (i < count - 1) {
475
- cloneProps.append = true;
476
- }
477
-
478
- if (cloneProps.prepend || cloneProps.append) {
479
- cloneProps.inline = false;
480
- }
481
- }
482
-
483
- if (controlsLayout === 'fill' && count > 1) {
484
- cloneProps.inline = true;
485
- }
486
-
487
- if (controlsLayout === 'stack') {
488
- cloneProps.inline = false;
489
-
490
- if (i < count - 1) {
491
- // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
492
- var stackStyle = _this2.getStackLayoutChildStyle(isPrisma, isCompact);
493
-
494
- cloneProps.style = item.props.style ? _objectSpread(_objectSpread({}, item.props.style), stackStyle) : stackStyle;
495
- }
496
- }
497
-
498
- cloneProps.labelledBy = _this2.labelId;
499
-
500
- if (_this2.props.help && typeof _this2.props.error === 'boolean') {
501
- cloneProps.describedBy = _this2.helpId;
502
- } else if (_this2.props.help && typeof _this2.props.error === 'string') {
503
- cloneProps.describedBy = "".concat(_this2.helpId, " ").concat(_this2.errorId);
504
- } else if (!_this2.props.help && typeof _this2.props.error === 'string') {
505
- cloneProps.describedBy = _this2.errorId;
506
- }
507
-
508
- if (_this2.props.required) {
509
- cloneProps.required = true;
510
- } // TODO: SUI-3402 refactor so that parent component doesn't have to know what it's child components are
511
-
512
-
513
- if (item.type.componentType === 'Multiselect') {
514
- var multiselect = item;
515
-
516
- if (multiselect.props.compact === false) {
517
- cloneProps.labelText = label;
518
- }
519
- } else {
520
- cloneProps.labelText = label;
521
- }
522
-
523
- if (count === 1 && (controlsLayout === 'fillJoin' || controlsLayout === 'fill')) {
524
- // Some controls like Select do not grow by default, so flexGrow is applied
525
- // The spread operator is used as css styles are not nested, so there is no need for a deep copy.
526
- cloneProps.style = item.props.style ? _objectSpread(_objectSpread({}, item.props.style), FLEX_GROW_STYLE) : FLEX_GROW_STYLE;
527
- }
528
-
529
- if (!labelFor && item) {
530
- if (_this2.hasInputId(item)) {
531
- cloneProps.inputId = item.props.inputId || _this2.getChildID('input-id', i);
532
- } else {
533
- cloneProps.id = item.props.id || _this2.getChildID('id', i);
534
- }
535
- }
536
-
537
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(item, cloneProps);
538
- };
539
-
540
- var childrenFormatted = validChildren.map(cloneWithProps);
541
- var defaultLinkedId = this.getLinkedId(childrenFormatted);
542
-
543
- if (error) {
544
- writableOtherProps['aria-invalid'] = true;
545
- }
546
-
547
- var labelWidthStyle = labelPosition === 'left' ? {
548
- width: labelWidth
549
- } : undefined;
550
- var labelWidthString = isFinite_default()(labelWidth) ? "".concat(labelWidth, "px") : labelWidth;
551
- var labelMargin = isPrisma ? '16px' : '20px';
552
- var contentMarginStyle = labelPosition === 'left' ? {
553
- marginLeft: "calc(".concat(labelWidthString, " + ").concat(labelMargin, ")")
554
- } : undefined;
555
- var StyledControlsComponent = controlsLayout === 'stack' ? StyledControlsStackBox : (Box_default());
556
- var StyledLabelWrapperComponent = labelPosition === 'left' ? StyledLabelWrapperLeft : StyledLabelWrapper;
557
- var styledLabel = /*#__PURE__*/external_react_default().createElement(StyledLabelWrapperComponent, {
558
- style: labelWidthStyle,
559
- $labelPosition: labelPosition
560
- }, /*#__PURE__*/external_react_default().createElement(StyledLabel, {
561
- "data-size": size,
562
- "data-test": "label",
563
- id: this.labelId,
564
- htmlFor: labelFor || defaultLinkedId,
565
- $tooltip: !!tooltip
566
- }, required && /*#__PURE__*/external_react_default().createElement(StyledAsterisk, {
567
- "aria-hidden": "true"
568
- }, "*"), label, !isPrisma && !hideLabel && tooltip && /*#__PURE__*/external_react_default().createElement("span", null, "\xA0"), !hideLabel && tooltip && /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, tooltip)), !hideLabel && tooltip && /*#__PURE__*/external_react_default().createElement(StyledTooltip, {
569
- $labelPosition: labelPosition,
570
- closeWhen: "notOnClick",
571
- content: tooltip,
572
- defaultPlacement: tooltipDefaultPlacement,
573
- "aria-hidden": "true"
574
- }));
575
- var isError = typeof error === 'string' || error === true;
576
- var isErrorBoolean = typeof error === 'boolean';
577
- return /*#__PURE__*/external_react_default().createElement(StyledBox, _extends({
578
- "data-test": "control-group",
579
- $error: isError
580
- }, writableOtherProps), /*#__PURE__*/external_react_default().createElement(ControlGroup_ControlGroupContext.Provider, {
581
- value: this.getContextValue()
582
- }, hideLabel ? /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, styledLabel) : styledLabel, /*#__PURE__*/external_react_default().createElement(StyledControlsComponent, {
583
- "data-test": "controls",
584
- flex: controlsLayout !== 'none',
585
- style: contentMarginStyle
586
- }, childrenFormatted), help && /*#__PURE__*/external_react_default().createElement(StyledHelp, {
587
- "data-test": "help",
588
- id: this.helpId,
589
- style: contentMarginStyle,
590
- $error: isError && isErrorBoolean
591
- }, help), isError && !isErrorBoolean && /*#__PURE__*/external_react_default().createElement(StyledErrorText, {
592
- "data-test": "error",
593
- id: this.errorId,
594
- style: contentMarginStyle,
595
- $help: !!help
596
- }, error)));
597
- }
598
- }]);
599
-
600
- return ControlGroup;
601
- }(external_react_namespaceObject.Component);
602
-
603
- _defineProperty(ControlGroup, "propTypes", propTypes);
604
-
605
- _defineProperty(ControlGroup, "defaultProps", defaultProps);
606
-
607
- var ControlGroupWithTheme = (0,themes_namespaceObject.withSplunkTheme)(ControlGroup);
608
- ControlGroupWithTheme.propTypes = ControlGroup.propTypes;
609
- /* harmony default export */ const ControlGroup_ControlGroup = (ControlGroupWithTheme);
610
-
611
- ;// CONCATENATED MODULE: ./src/ControlGroup/index.ts
612
-
613
-
614
- module.exports = __webpack_exports__;
615
- /******/ })()
616
- ;
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
+ /******/})();