@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/Accordion.js CHANGED
@@ -1,334 +1,434 @@
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
- Panel: () => (/* reexport */ Accordion_Panel),
55
- "default": () => (/* reexport */ Accordion_Accordion)
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/has"
65
- const has_namespaceObject = require("lodash/has");
66
- var has_default = /*#__PURE__*/__webpack_require__.n(has_namespaceObject);
67
- ;// CONCATENATED MODULE: external "lodash/keys"
68
- const keys_namespaceObject = require("lodash/keys");
69
- var keys_default = /*#__PURE__*/__webpack_require__.n(keys_namespaceObject);
70
- ;// CONCATENATED MODULE: external "lodash/omit"
71
- const omit_namespaceObject = require("lodash/omit");
72
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
73
- ;// CONCATENATED MODULE: external "@splunk/react-ui/CollapsiblePanel"
74
- const CollapsiblePanel_namespaceObject = require("@splunk/react-ui/CollapsiblePanel");
75
- var CollapsiblePanel_default = /*#__PURE__*/__webpack_require__.n(CollapsiblePanel_namespaceObject);
76
- ;// CONCATENATED MODULE: external "@splunk/themes"
77
- const themes_namespaceObject = require("@splunk/themes");
78
- ;// CONCATENATED MODULE: ./src/Accordion/AccordionContext.tsx
79
-
80
- var AccordionContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({});
81
- AccordionContext.displayName = 'Accordion';
82
- /* harmony default export */ const Accordion_AccordionContext = (AccordionContext);
83
- ;// CONCATENATED MODULE: ./src/Accordion/Panel.tsx
84
- 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); }
85
-
86
- 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; }
87
-
88
- 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; }
89
-
90
-
91
-
92
-
93
-
94
-
95
- var propTypes = {
96
- description: (external_prop_types_default()).string,
97
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
98
- inset: (external_prop_types_default()).bool,
99
- panelId: (external_prop_types_default()).any.isRequired,
100
- title: (external_prop_types_default()).node.isRequired
101
- };
102
-
103
- var getPaddingValue = function getPaddingValue(family, density) {
104
- var values = {
105
- enterprise: {
106
- compact: '8px',
107
- comfortable: '10px'
108
- },
109
- prisma: {
110
- compact: '12px 20px',
111
- comfortable: '20px'
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var r in n) {
28
+ /******/ if (e.o(n, r) && !e.o(t, r)) {
29
+ /******/ Object.defineProperty(t, r, {
30
+ enumerable: true,
31
+ get: n[r]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ Panel: () => /* reexport */ S,
65
+ default: () => /* reexport */ L
66
+ });
67
+ // CONCATENATED MODULE: external "react"
68
+ const n = require("react");
69
+ var r = e.n(n);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const o = require("prop-types");
72
+ var i = e.n(o);
73
+ // CONCATENATED MODULE: external "lodash/has"
74
+ const a = require("lodash/has");
75
+ var l = e.n(a);
76
+ // CONCATENATED MODULE: external "lodash/keys"
77
+ const u = require("lodash/keys");
78
+ var c = e.n(u);
79
+ // CONCATENATED MODULE: external "lodash/omit"
80
+ const s = require("lodash/omit");
81
+ var f = e.n(s);
82
+ // CONCATENATED MODULE: external "@splunk/react-ui/CollapsiblePanel"
83
+ const p = require("@splunk/react-ui/CollapsiblePanel");
84
+ var d = e.n(p);
85
+ // CONCATENATED MODULE: external "@splunk/themes"
86
+ const y = require("@splunk/themes");
87
+ // CONCATENATED MODULE: ./src/Accordion/AccordionContext.tsx
88
+ var b = (0, n.createContext)({});
89
+ b.displayName = "Accordion";
90
+ /* harmony default export */ const v = b;
91
+ // CONCATENATED MODULE: ./src/Accordion/Panel.tsx
92
+ function h() {
93
+ h = Object.assign || function(e) {
94
+ for (var t = 1; t < arguments.length; t++) {
95
+ var n = arguments[t];
96
+ for (var r in n) {
97
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
98
+ e[r] = n[r];
99
+ }
100
+ }
101
+ }
102
+ return e;
103
+ };
104
+ return h.apply(this, arguments);
105
+ }
106
+ function O(e, t) {
107
+ if (e == null) return {};
108
+ var n = m(e, t);
109
+ var r, o;
110
+ if (Object.getOwnPropertySymbols) {
111
+ var i = Object.getOwnPropertySymbols(e);
112
+ for (o = 0; o < i.length; o++) {
113
+ r = i[o];
114
+ if (t.indexOf(r) >= 0) continue;
115
+ if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
116
+ n[r] = e[r];
117
+ }
118
+ }
119
+ return n;
120
+ }
121
+ function m(e, t) {
122
+ if (e == null) return {};
123
+ var n = {};
124
+ var r = Object.keys(e);
125
+ var o, i;
126
+ for (i = 0; i < r.length; i++) {
127
+ o = r[i];
128
+ if (t.indexOf(o) >= 0) continue;
129
+ n[o] = e[o];
130
+ }
131
+ return n;
112
132
  }
113
- };
114
- return values[family][density];
115
- };
116
-
117
- /**
133
+ var P = {
134
+ description: i().string,
135
+ elementRef: i().oneOfType([ i().func, i().object ]),
136
+ inset: i().bool,
137
+ panelId: i().any.isRequired,
138
+ title: i().node.isRequired
139
+ };
140
+ var g = function e(t, n) {
141
+ var r = {
142
+ enterprise: {
143
+ compact: "8px",
144
+ comfortable: "10px"
145
+ },
146
+ prisma: {
147
+ compact: "12px 20px",
148
+ comfortable: "20px"
149
+ }
150
+ };
151
+ return r[t][n];
152
+ };
153
+ /**
118
154
  * `Accordion.Panel` operates as a container component for content in an `Accordion`.
119
- */
120
- function Panel(_ref) {
121
- var panelId = _ref.panelId,
122
- inset = _ref.inset,
123
- otherProps = _objectWithoutProperties(_ref, ["panelId", "inset"]);
124
-
125
- // @docs-props-type AccordionPanelPropsBase
126
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
127
- family = _useSplunkTheme.family,
128
- density = _useSplunkTheme.density;
129
-
130
- var _useContext = (0,external_react_namespaceObject.useContext)(AccordionContext),
131
- onRequestCloseContext = _useContext.onRequestClose,
132
- onRequestOpenContext = _useContext.onRequestOpen,
133
- openPanelIdContext = _useContext.openPanelId,
134
- insetContext = _useContext.inset;
135
-
136
- var open = openPanelIdContext === panelId;
137
- var finalInset = inset !== undefined ? inset : insetContext;
138
- return /*#__PURE__*/external_react_default().createElement((CollapsiblePanel_default()), _extends({
139
- panelId: panelId,
140
- "data-test": "panel",
141
- innerBodyStyles: finalInset ? {
142
- padding: getPaddingValue(family, density)
143
- } : undefined,
144
- "data-test-panel-id": panelId,
145
- style: {
146
- flexShrink: 1
155
+ */ function j(e) {
156
+ var t = e.panelId, o = e.inset, i = O(e, [ "panelId", "inset" ]);
157
+ // @docs-props-type AccordionPanelPropsBase
158
+ var a = (0, y.useSplunkTheme)(), l = a.family, u = a.density;
159
+ var c = (0, n.useContext)(b), s = c.onRequestClose, f = c.onRequestOpen, p = c.openPanelId, v = c.inset;
160
+ var m = p === t;
161
+ var P = o !== undefined ? o : v;
162
+
163
+ return r().createElement(d(), h({
164
+ panelId: t,
165
+ "data-test": "panel",
166
+ innerBodyStyles: P ? {
167
+ padding: g(l, u)
168
+ } : undefined,
169
+ "data-test-panel-id": t,
170
+ style: {
171
+ flexShrink: 1
172
+ }
173
+ }, i, {
174
+ onRequestClose: s,
175
+ onRequestOpen: f,
176
+ open: m
177
+ }));
147
178
  }
148
- }, otherProps, {
149
- onRequestClose: onRequestCloseContext,
150
- onRequestOpen: onRequestOpenContext,
151
- open: open
152
- }));
153
- }
154
-
155
- Panel.propTypes = propTypes;
156
- /* harmony default export */ const Accordion_Panel = (Panel);
157
- ;// CONCATENATED MODULE: external "styled-components"
158
- const external_styled_components_namespaceObject = require("styled-components");
159
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
160
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
161
- const Box_namespaceObject = require("@splunk/react-ui/Box");
162
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
163
- ;// CONCATENATED MODULE: ./src/Accordion/AccordionStyles.ts
164
-
165
-
166
-
167
- var StyledBox = external_styled_components_default()((Box_default())).withConfig({
168
- displayName: "AccordionStyles__StyledBox",
169
- componentId: "m39hyh-0"
170
- })(["", ";flex-direction:column;margin-bottom:0;", ""], themes_namespaceObject.mixins.reset('flex'), (0,themes_namespaceObject.pick)({
171
- enterprise: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.backgroundColor)
172
- }));
173
-
174
- ;// CONCATENATED MODULE: ./src/Accordion/Accordion.tsx
175
- 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); }
176
-
177
- function Accordion_extends() { Accordion_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 Accordion_extends.apply(this, arguments); }
178
-
179
- 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; }
180
-
181
- 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; }
182
-
183
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
184
-
185
- 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); } }
186
-
187
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
188
-
189
- 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); }
190
-
191
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
192
-
193
- 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); }; }
194
-
195
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
196
-
197
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
198
-
199
- 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; } }
200
-
201
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
202
-
203
- 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; }
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
- /** @public */
214
-
215
- var Accordion_propTypes = {
216
- children: (external_prop_types_default()).node,
217
- defaultOpenPanelId: (external_prop_types_default()).any,
218
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
219
- onChange: (external_prop_types_default()).func,
220
- openPanelId: (external_prop_types_default()).any
221
- };
222
- var defaultProps = {
223
- inset: false // SUI-2559 This will become true in 5.0
224
-
225
- };
226
-
227
- var Accordion = /*#__PURE__*/function (_Component) {
228
- _inherits(Accordion, _Component);
229
-
230
- var _super = _createSuper(Accordion);
231
-
232
- // @docs-props-type AccordionPropsBase
233
- function Accordion(props) {
234
- var _this;
235
-
236
- _classCallCheck(this, Accordion);
237
-
238
- _this = _super.call(this, props);
239
-
240
- _defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
241
-
242
- _defineProperty(_assertThisInitialized(_this), "handleRequestOpen", function (data) {
243
- var _this$props$onChange, _this$props;
244
-
245
- if (!_this.isControlled()) {
246
- _this.setState({
247
- openPanelId: data.panelId
248
- });
249
- }
250
-
251
- (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, data.event, data);
252
- });
253
-
254
- _defineProperty(_assertThisInitialized(_this), "handleRequestClose", function (data) {
255
- var _this$props$onChange2, _this$props2;
256
-
257
- if (!_this.isControlled()) {
258
- _this.setState({
259
- openPanelId: undefined
179
+ j.propTypes = P;
180
+ /* harmony default export */ const S = j;
181
+ // CONCATENATED MODULE: external "styled-components"
182
+ const R = require("styled-components");
183
+ var q = e.n(R);
184
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
185
+ const w = require("@splunk/react-ui/Box");
186
+ var x = e.n(w);
187
+ // CONCATENATED MODULE: ./src/Accordion/AccordionStyles.ts
188
+ var C = q()(x()).withConfig({
189
+ displayName: "AccordionStyles__StyledBox",
190
+ componentId: "m39hyh-0"
191
+ })([ "", ";flex-direction:column;margin-bottom:0;", "" ], y.mixins.reset("flex"), (0,
192
+ y.pick)({
193
+ enterprise: (0, R.css)([ "background:", ";" ], y.variables.backgroundColor)
194
+ }));
195
+ // CONCATENATED MODULE: ./src/Accordion/Accordion.tsx
196
+ function I(e) {
197
+ "@babel/helpers - typeof";
198
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
199
+ I = function e(t) {
200
+ return typeof t;
201
+ };
202
+ } else {
203
+ I = function e(t) {
204
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
205
+ };
206
+ }
207
+ return I(e);
208
+ }
209
+ function k() {
210
+ k = Object.assign || function(e) {
211
+ for (var t = 1; t < arguments.length; t++) {
212
+ var n = arguments[t];
213
+ for (var r in n) {
214
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
215
+ e[r] = n[r];
216
+ }
217
+ }
218
+ }
219
+ return e;
220
+ };
221
+ return k.apply(this, arguments);
222
+ }
223
+ function _(e, t) {
224
+ var n = Object.keys(e);
225
+ if (Object.getOwnPropertySymbols) {
226
+ var r = Object.getOwnPropertySymbols(e);
227
+ if (t) r = r.filter((function(t) {
228
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
229
+ }));
230
+ n.push.apply(n, r);
231
+ }
232
+ return n;
233
+ }
234
+ function E(e) {
235
+ for (var t = 1; t < arguments.length; t++) {
236
+ var n = arguments[t] != null ? arguments[t] : {};
237
+ if (t % 2) {
238
+ _(Object(n), true).forEach((function(t) {
239
+ G(e, t, n[t]);
240
+ }));
241
+ } else if (Object.getOwnPropertyDescriptors) {
242
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
243
+ } else {
244
+ _(Object(n)).forEach((function(t) {
245
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
246
+ }));
247
+ }
248
+ }
249
+ return e;
250
+ }
251
+ function T(e, t) {
252
+ if (!(e instanceof t)) {
253
+ throw new TypeError("Cannot call a class as a function");
254
+ }
255
+ }
256
+ function D(e, t) {
257
+ for (var n = 0; n < t.length; n++) {
258
+ var r = t[n];
259
+ r.enumerable = r.enumerable || false;
260
+ r.configurable = true;
261
+ if ("value" in r) r.writable = true;
262
+ Object.defineProperty(e, r.key, r);
263
+ }
264
+ }
265
+ function A(e, t, n) {
266
+ if (t) D(e.prototype, t);
267
+ if (n) D(e, n);
268
+ return e;
269
+ }
270
+ function B(e, t) {
271
+ if (typeof t !== "function" && t !== null) {
272
+ throw new TypeError("Super expression must either be null or a function");
273
+ }
274
+ e.prototype = Object.create(t && t.prototype, {
275
+ constructor: {
276
+ value: e,
277
+ writable: true,
278
+ configurable: true
279
+ }
260
280
  });
261
- }
262
-
263
- (_this$props$onChange2 = (_this$props2 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props2, data.event, _objectSpread(_objectSpread({}, data), {}, {
264
- panelId: undefined
265
- }));
266
- });
267
-
268
- _this.controlledExternally = has_default()(props, 'openPanelId');
269
-
270
- if (!_this.isControlled()) {
271
- _this.state = {
272
- openPanelId: props.defaultOpenPanelId
273
- };
281
+ if (t) M(e, t);
282
+ }
283
+ function M(e, t) {
284
+ M = Object.setPrototypeOf || function e(t, n) {
285
+ t.__proto__ = n;
286
+ return t;
287
+ };
288
+ return M(e, t);
274
289
  }
275
-
276
- if (false) {}
277
-
278
- return _this;
279
- }
280
-
281
- _createClass(Accordion, [{
282
- key: "componentDidUpdate",
283
- value: function componentDidUpdate(prevProps) {
284
- if (false) {}
285
-
286
- if (false) {}
290
+ function N(e) {
291
+ var t = z();
292
+ return function n() {
293
+ var r = F(e), o;
294
+ if (t) {
295
+ var i = F(this).constructor;
296
+ o = Reflect.construct(r, arguments, i);
297
+ } else {
298
+ o = r.apply(this, arguments);
299
+ }
300
+ return U(this, o);
301
+ };
287
302
  }
288
- }, {
289
- key: "isControlled",
290
- value: function isControlled() {
291
- return this.controlledExternally;
303
+ function U(e, t) {
304
+ if (t && (I(t) === "object" || typeof t === "function")) {
305
+ return t;
306
+ }
307
+ return V(e);
308
+ }
309
+ function V(e) {
310
+ if (e === void 0) {
311
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
312
+ }
313
+ return e;
292
314
  }
293
- }, {
294
- key: "render",
295
- value: function render() {
296
- var _this$props3 = this.props,
297
- children = _this$props3.children,
298
- elementRef = _this$props3.elementRef,
299
- inset = _this$props3.inset;
300
- var openPanelId = this.isControlled() ? this.props.openPanelId : this.state.openPanelId;
301
- var childrenCleaned = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement); // remove false, null, 0, etc
302
-
303
- return /*#__PURE__*/external_react_default().createElement(StyledBox, Accordion_extends({
304
- "data-test": "accordion",
305
- "data-test-open-panel-id": openPanelId,
306
- elementRef: elementRef
307
- }, omit_default()(this.props, keys_default()(Accordion.propTypes))), /*#__PURE__*/external_react_default().createElement(Accordion_AccordionContext.Provider, {
308
- value: {
309
- onRequestOpen: this.handleRequestOpen,
310
- onRequestClose: this.handleRequestClose,
311
- openPanelId: openPanelId,
312
- inset: inset
315
+ function z() {
316
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
317
+ if (Reflect.construct.sham) return false;
318
+ if (typeof Proxy === "function") return true;
319
+ try {
320
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
321
+ return true;
322
+ } catch (e) {
323
+ return false;
313
324
  }
314
- }, childrenCleaned));
315
325
  }
316
- }]);
317
-
318
- return Accordion;
319
- }(external_react_namespaceObject.Component);
320
-
321
- _defineProperty(Accordion, "propTypes", Accordion_propTypes);
322
-
323
- _defineProperty(Accordion, "defaultProps", defaultProps);
324
-
325
- _defineProperty(Accordion, "Panel", Accordion_Panel);
326
-
327
- /* harmony default export */ const Accordion_Accordion = (Accordion);
328
-
329
- ;// CONCATENATED MODULE: ./src/Accordion/index.ts
330
-
331
-
332
- module.exports = __webpack_exports__;
333
- /******/ })()
334
- ;
326
+ function F(e) {
327
+ F = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
328
+ return t.__proto__ || Object.getPrototypeOf(t);
329
+ };
330
+ return F(e);
331
+ }
332
+ function G(e, t, n) {
333
+ if (t in e) {
334
+ Object.defineProperty(e, t, {
335
+ value: n,
336
+ enumerable: true,
337
+ configurable: true,
338
+ writable: true
339
+ });
340
+ } else {
341
+ e[t] = n;
342
+ }
343
+ return e;
344
+ }
345
+ /** @public */ var H = {
346
+ children: i().node,
347
+ defaultOpenPanelId: i().any,
348
+ elementRef: i().oneOfType([ i().func, i().object ]),
349
+ onChange: i().func,
350
+ openPanelId: i().any
351
+ };
352
+ var J = {
353
+ inset: false
354
+ };
355
+ var K = function(e) {
356
+ B(o, e);
357
+ var t = N(o);
358
+ // @docs-props-type AccordionPropsBase
359
+ function o(e) {
360
+ var n;
361
+ T(this, o);
362
+ n = t.call(this, e);
363
+ G(V(n), "controlledExternally", void 0);
364
+ G(V(n), "handleRequestOpen", (function(e) {
365
+ var t, r;
366
+ if (!n.isControlled()) {
367
+ n.setState({
368
+ openPanelId: e.panelId
369
+ });
370
+ }
371
+ (t = (r = n.props).onChange) === null || t === void 0 ? void 0 : t.call(r, e.event, e);
372
+ }));
373
+ G(V(n), "handleRequestClose", (function(e) {
374
+ var t, r;
375
+ if (!n.isControlled()) {
376
+ n.setState({
377
+ openPanelId: undefined
378
+ });
379
+ }
380
+ (t = (r = n.props).onChange) === null || t === void 0 ? void 0 : t.call(r, e.event, E(E({}, e), {}, {
381
+ panelId: undefined
382
+ }));
383
+ }));
384
+ n.controlledExternally = l()(e, "openPanelId");
385
+ if (!n.isControlled()) {
386
+ n.state = {
387
+ openPanelId: e.defaultOpenPanelId
388
+ };
389
+ }
390
+ if (false) {}
391
+ return n;
392
+ }
393
+ A(o, [ {
394
+ key: "componentDidUpdate",
395
+ value: function e(t) {
396
+ if (false) {}
397
+ if (false) {}
398
+ }
399
+ }, {
400
+ key: "isControlled",
401
+ value: function e() {
402
+ return this.controlledExternally;
403
+ }
404
+ }, {
405
+ key: "render",
406
+ value: function e() {
407
+ var t = this.props, i = t.children, a = t.elementRef, l = t.inset;
408
+ var u = this.isControlled() ? this.props.openPanelId : this.state.openPanelId;
409
+ var s = n.Children.toArray(i).filter(n.isValidElement);
410
+ // remove false, null, 0, etc
411
+
412
+ return r().createElement(C, k({
413
+ "data-test": "accordion",
414
+ "data-test-open-panel-id": u,
415
+ elementRef: a
416
+ }, f()(this.props, c()(o.propTypes))), r().createElement(v.Provider, {
417
+ value: {
418
+ onRequestOpen: this.handleRequestOpen,
419
+ onRequestClose: this.handleRequestClose,
420
+ openPanelId: u,
421
+ inset: l
422
+ }
423
+ }, s));
424
+ }
425
+ } ]);
426
+ return o;
427
+ }(n.Component);
428
+ G(K, "propTypes", H);
429
+ G(K, "defaultProps", J);
430
+ G(K, "Panel", S);
431
+ /* harmony default export */ const L = K;
432
+ // CONCATENATED MODULE: ./src/Accordion/index.ts
433
+ module.exports = t;
434
+ /******/})();