@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/FormRows.js CHANGED
@@ -1,654 +1,852 @@
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
- Row: () => (/* reexport */ FormRows_Row),
55
- "default": () => (/* reexport */ FormRows_FormRows)
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 "@splunk/ui-utils/i18n"
65
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
66
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
67
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
68
- ;// CONCATENATED MODULE: ./src/FormRows/FormRowsContext.tsx
69
-
70
- var FormRowsContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({
71
- disabledDeleteButton: false,
72
- sortable: true
73
- });
74
- FormRowsContext.displayName = 'FormRows';
75
- /* harmony default export */ const FormRows_FormRowsContext = (FormRowsContext);
76
- ;// CONCATENATED MODULE: external "@splunk/themes"
77
- const themes_namespaceObject = require("@splunk/themes");
78
- ;// CONCATENATED MODULE: external "@splunk/react-icons/Plus"
79
- const Plus_namespaceObject = require("@splunk/react-icons/Plus");
80
- var Plus_default = /*#__PURE__*/__webpack_require__.n(Plus_namespaceObject);
81
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Plus"
82
- const enterprise_Plus_namespaceObject = require("@splunk/react-icons/enterprise/Plus");
83
- var enterprise_Plus_default = /*#__PURE__*/__webpack_require__.n(enterprise_Plus_namespaceObject);
84
- ;// CONCATENATED MODULE: ./src/FormRows/icons/FormRowsPlusIcon.tsx
85
-
86
-
87
-
88
-
89
-
90
- var FormRowsPlusIcon = function FormRowsPlusIcon() {
91
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
92
- isEnterprise = _useSplunkTheme.isEnterprise,
93
- isCompact = _useSplunkTheme.isCompact;
94
-
95
- var prismaSize = isCompact ? '20px' : '24px';
96
- return isEnterprise ? /*#__PURE__*/external_react_default().createElement((enterprise_Plus_default()), {
97
- screenReaderText: null,
98
- hideDefaultTooltip: true
99
- }) : /*#__PURE__*/external_react_default().createElement((Plus_default()), {
100
- width: prismaSize,
101
- height: prismaSize
102
- });
103
- };
104
-
105
- /* harmony default export */ const icons_FormRowsPlusIcon = (FormRowsPlusIcon);
106
- ;// CONCATENATED MODULE: external "lodash/omit"
107
- const omit_namespaceObject = require("lodash/omit");
108
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
109
- ;// CONCATENATED MODULE: external "@splunk/react-ui/CloseButton"
110
- const CloseButton_namespaceObject = require("@splunk/react-ui/CloseButton");
111
- var CloseButton_default = /*#__PURE__*/__webpack_require__.n(CloseButton_namespaceObject);
112
- ;// CONCATENATED MODULE: external "styled-components"
113
- const external_styled_components_namespaceObject = require("styled-components");
114
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
115
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
116
- const Box_namespaceObject = require("@splunk/react-ui/Box");
117
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
118
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Button"
119
- const Button_namespaceObject = require("@splunk/react-ui/Button");
120
- var Button_default = /*#__PURE__*/__webpack_require__.n(Button_namespaceObject);
121
- ;// CONCATENATED MODULE: ./src/FormRows/FormRowsStyles.ts
122
-
123
-
124
-
125
-
126
- var StyledBox = external_styled_components_default()((Box_default())).withConfig({
127
- displayName: "FormRowsStyles__StyledBox",
128
- componentId: "sc-1j4j7h3-0"
129
- })(["", ";"], themes_namespaceObject.mixins.reset('block'));
130
- var StyledHeader = external_styled_components_default().div.withConfig({
131
- displayName: "FormRowsStyles__StyledHeader",
132
- componentId: "sc-1j4j7h3-1"
133
- })(["padding-left:", ";", ""], (0,themes_namespaceObject.pick)({
134
- enterprise: themes_namespaceObject.variables.spacingHalf,
135
- prisma: '16px'
136
- }), (0,themes_namespaceObject.pick)({
137
- prisma: {
138
- comfortable: (0,external_styled_components_namespaceObject.css)(["padding-bottom:8px;"]),
139
- compact: (0,external_styled_components_namespaceObject.css)(["padding-bottom:6px;"])
140
- }
141
- }));
142
- var StyledAddRowButton = external_styled_components_default()((Button_default())).withConfig({
143
- displayName: "FormRowsStyles__StyledAddRowButton",
144
- componentId: "sc-1j4j7h3-2"
145
- })(["", ""], function (_ref) {
146
- var $sortable = _ref.$sortable;
147
- return $sortable && (0,themes_namespaceObject.pick)({
148
- prisma: (0,external_styled_components_namespaceObject.css)(["margin-left:16px;"])
149
- });
150
- });
151
- var StyledRows = external_styled_components_default().div.withConfig({
152
- displayName: "FormRowsStyles__StyledRows",
153
- componentId: "sc-1j4j7h3-3"
154
- })(["position:relative;", ""], (0,themes_namespaceObject.pick)({
155
- prisma: {
156
- comfortable: (0,external_styled_components_namespaceObject.css)(["padding-bottom:12px;"]),
157
- compact: (0,external_styled_components_namespaceObject.css)(["padding-bottom:10px;"])
158
- }
159
- }));
160
- var Styled = external_styled_components_default().div.withConfig({
161
- displayName: "FormRowsStyles__Styled",
162
- componentId: "sc-1j4j7h3-4"
163
- })(["padding:", ";position:relative;&.sorting{z-index:calc(", " + 1);}", " &:focus{outline:0;box-shadow:", ";}"], (0,themes_namespaceObject.pick)({
164
- enterprise: (0,external_styled_components_namespaceObject.css)(["3px calc(", " + 3px) 3px 0"], themes_namespaceObject.variables.inputHeight),
165
- prisma: {
166
- comfortable: (0,external_styled_components_namespaceObject.css)(["8px calc(", " + 8px) 8px 0"], themes_namespaceObject.variables.inputHeight),
167
- compact: (0,external_styled_components_namespaceObject.css)(["6px calc(", " + 8px) 6px 0"], themes_namespaceObject.variables.inputHeight)
168
- }
169
- }), themes_namespaceObject.variables.zindexPopover, function (_ref2) {
170
- var $sortable = _ref2.$sortable;
171
- return $sortable && (0,external_styled_components_namespaceObject.css)(["padding-left:", ";"], (0,themes_namespaceObject.pick)({
172
- enterprise: themes_namespaceObject.variables.spacingHalf,
173
- prisma: '16px'
174
- }));
175
- }, themes_namespaceObject.variables.focusShadow);
176
- var StyledButton = external_styled_components_default().div.withConfig({
177
- displayName: "FormRowsStyles__StyledButton",
178
- componentId: "sc-1j4j7h3-5"
179
- })(["position:absolute;right:0;top:", ";float:right;"], (0,themes_namespaceObject.pick)({
180
- enterprise: '3px',
181
- prisma: {
182
- comfortable: '8px',
183
- compact: '6px'
184
- }
185
- }));
186
- var StyledDrag = external_styled_components_default().div.withConfig({
187
- displayName: "FormRowsStyles__StyledDrag",
188
- componentId: "sc-1j4j7h3-6"
189
- })(["position:absolute;left:0;right:0;content:'';cursor:move;background:", ";width:", ";top:", ";", ""], themes_namespaceObject.variables.draggableBackground, (0,themes_namespaceObject.pick)({
190
- enterprise: '7px',
191
- prisma: '6px'
192
- }), (0,themes_namespaceObject.pick)({
193
- enterprise: '4px',
194
- prisma: {
195
- comfortable: '18px',
196
- compact: '12px'
197
- }
198
- }), (0,themes_namespaceObject.pick)({
199
- enterprise: (0,external_styled_components_namespaceObject.css)(["bottom:3px;opacity:0.5;"]),
200
- prisma: (0,external_styled_components_namespaceObject.css)(["height:20px;"])
201
- }));
202
-
203
- ;// CONCATENATED MODULE: ./src/FormRows/RowInternal.tsx
204
- 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); }
205
-
206
- 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; }
207
-
208
- 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; }
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
- /** @public */
218
-
219
- var propTypes = {
220
- children: (external_prop_types_default()).node,
221
- index: (external_prop_types_default()).number,
222
- onRequestRemove: (external_prop_types_default()).func,
223
- renderDragHandle: (external_prop_types_default()).func,
224
- style: (external_prop_types_default()).object,
225
- value: (external_prop_types_default()).node
226
- };
227
- var RowInternal = /*#__PURE__*/external_react_default().forwardRef(function (_ref, ref) {
228
- var children = _ref.children,
229
- index = _ref.index,
230
- onRequestRemove = _ref.onRequestRemove,
231
- renderDragHandle = _ref.renderDragHandle,
232
- otherProps = _objectWithoutProperties(_ref, ["children", "index", "onRequestRemove", "renderDragHandle"]);
233
-
234
- var _useContext = (0,external_react_namespaceObject.useContext)(FormRows_FormRowsContext),
235
- disabledDeleteButtonContext = _useContext.disabledDeleteButton,
236
- hasOnRequestAddContext = _useContext.hasOnRequestAdd,
237
- onKeyDownContext = _useContext.onKeyDown,
238
- sortableContext = _useContext.sortable;
239
-
240
- var handleKeyDown = (0,external_react_namespaceObject.useCallback)(function (e) {
241
- // TODO: this callback doesn't work correctly if index isn't provided SUI-5639
242
- onKeyDownContext === null || onKeyDownContext === void 0 ? void 0 : onKeyDownContext(e, {
243
- index: index !== null && index !== void 0 ? index : 0
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
+ Row: () => /* reexport */ ye,
65
+ default: () => /* reexport */ He
244
66
  });
245
- }, [onKeyDownContext, index]);
246
- var handleRequestRemove = (0,external_react_namespaceObject.useCallback)(function (e) {
247
- // TODO: this callback doesn't work correctly if index isn't provided SUI-5639
248
- onRequestRemove === null || onRequestRemove === void 0 ? void 0 : onRequestRemove(e, {
249
- index: index !== null && index !== void 0 ? index : 0
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 "@splunk/ui-utils/i18n"
74
+ const a = require("@splunk/ui-utils/i18n");
75
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
76
+ const u = require("@splunk/ui-utils/keyboard");
77
+ // CONCATENATED MODULE: ./src/FormRows/FormRowsContext.tsx
78
+ var l = (0, r.createContext)({
79
+ disabledDeleteButton: false,
80
+ sortable: true
250
81
  });
251
- }, [onRequestRemove, index]);
252
- var onRequestRemoveExists = onRequestRemove !== undefined;
253
-
254
- if (false) {}
255
-
256
- if (false) {}
257
-
258
- if (false) {}
259
-
260
- return /*#__PURE__*/external_react_default().createElement(Styled, _extends({
261
- $sortable: sortableContext,
262
- "data-test": "row",
263
- ref: ref,
264
- onKeyDown: handleKeyDown
265
- }, omit_default()(otherProps, ['onKeyDown', 'onRequestRemove'])), renderDragHandle && renderDragHandle(), children, onRequestRemoveExists && /*#__PURE__*/external_react_default().createElement(StyledButton, null, /*#__PURE__*/external_react_default().createElement((CloseButton_default()), {
266
- disabled: disabledDeleteButtonContext,
267
- "data-test": "remove",
268
- onClick: handleRequestRemove,
269
- screenReaderText: (0,i18n_namespaceObject._)('Remove Row')
270
- })));
271
- });
272
- RowInternal.propTypes = propTypes;
273
- /* harmony default export */ const FormRows_RowInternal = (RowInternal);
274
- ;// CONCATENATED MODULE: external "@dnd-kit/sortable"
275
- const sortable_namespaceObject = require("@dnd-kit/sortable");
276
- ;// CONCATENATED MODULE: external "@dnd-kit/utilities"
277
- const utilities_namespaceObject = require("@dnd-kit/utilities");
278
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
279
- const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
280
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
281
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
282
- /**
82
+ l.displayName = "FormRows";
83
+ /* harmony default export */ const c = l;
84
+ // CONCATENATED MODULE: external "@splunk/themes"
85
+ const s = require("@splunk/themes");
86
+ // CONCATENATED MODULE: external "@splunk/react-icons/Plus"
87
+ const f = require("@splunk/react-icons/Plus");
88
+ var p = e.n(f);
89
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Plus"
90
+ const d = require("@splunk/react-icons/enterprise/Plus");
91
+ var v = e.n(d);
92
+ // CONCATENATED MODULE: ./src/FormRows/icons/FormRowsPlusIcon.tsx
93
+ var y = function e() {
94
+ var t = (0, s.useSplunkTheme)(), r = t.isEnterprise, o = t.isCompact;
95
+ var i = o ? "20px" : "24px";
96
+ return r ? n().createElement(v(), {
97
+ screenReaderText: null,
98
+ hideDefaultTooltip: true
99
+ }) : n().createElement(p(), {
100
+ width: i,
101
+ height: i
102
+ });
103
+ };
104
+ /* harmony default export */ const b = y;
105
+ // CONCATENATED MODULE: external "lodash/omit"
106
+ const m = require("lodash/omit");
107
+ var h = e.n(m);
108
+ // CONCATENATED MODULE: external "@splunk/react-ui/CloseButton"
109
+ const g = require("@splunk/react-ui/CloseButton");
110
+ var x = e.n(g);
111
+ // CONCATENATED MODULE: external "styled-components"
112
+ const w = require("styled-components");
113
+ var O = e.n(w);
114
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
115
+ const R = require("@splunk/react-ui/Box");
116
+ var j = e.n(R);
117
+ // CONCATENATED MODULE: external "@splunk/react-ui/Button"
118
+ const S = require("@splunk/react-ui/Button");
119
+ var k = e.n(S);
120
+ // CONCATENATED MODULE: ./src/FormRows/FormRowsStyles.ts
121
+ var E = O()(j()).withConfig({
122
+ displayName: "FormRowsStyles__StyledBox",
123
+ componentId: "sc-1j4j7h3-0"
124
+ })([ "", ";" ], s.mixins.reset("block"));
125
+ var P = O().div.withConfig({
126
+ displayName: "FormRowsStyles__StyledHeader",
127
+ componentId: "sc-1j4j7h3-1"
128
+ })([ "padding-left:", ";", "" ], (0, s.pick)({
129
+ enterprise: s.variables.spacingHalf,
130
+ prisma: "16px"
131
+ }), (0, s.pick)({
132
+ prisma: {
133
+ comfortable: (0, w.css)([ "padding-bottom:8px;" ]),
134
+ compact: (0, w.css)([ "padding-bottom:6px;" ])
135
+ }
136
+ }));
137
+ var _ = O()(k()).withConfig({
138
+ displayName: "FormRowsStyles__StyledAddRowButton",
139
+ componentId: "sc-1j4j7h3-2"
140
+ })([ "", "" ], (function(e) {
141
+ var t = e.$sortable;
142
+ return t && (0, s.pick)({
143
+ prisma: (0, w.css)([ "margin-left:16px;" ])
144
+ });
145
+ }));
146
+ var q = O().div.withConfig({
147
+ displayName: "FormRowsStyles__StyledRows",
148
+ componentId: "sc-1j4j7h3-3"
149
+ })([ "position:relative;", "" ], (0, s.pick)({
150
+ prisma: {
151
+ comfortable: (0, w.css)([ "padding-bottom:12px;" ]),
152
+ compact: (0, w.css)([ "padding-bottom:10px;" ])
153
+ }
154
+ }));
155
+ var C = O().div.withConfig({
156
+ displayName: "FormRowsStyles__Styled",
157
+ componentId: "sc-1j4j7h3-4"
158
+ })([ "padding:", ";position:relative;&.sorting{z-index:calc(", " + 1);}", " &:focus{outline:0;box-shadow:", ";}" ], (0,
159
+ s.pick)({
160
+ enterprise: (0, w.css)([ "3px calc(", " + 3px) 3px 0" ], s.variables.inputHeight),
161
+ prisma: {
162
+ comfortable: (0, w.css)([ "8px calc(", " + 8px) 8px 0" ], s.variables.inputHeight),
163
+ compact: (0, w.css)([ "6px calc(", " + 8px) 6px 0" ], s.variables.inputHeight)
164
+ }
165
+ }), s.variables.zindexPopover, (function(e) {
166
+ var t = e.$sortable;
167
+ return t && (0, w.css)([ "padding-left:", ";" ], (0, s.pick)({
168
+ enterprise: s.variables.spacingHalf,
169
+ prisma: "16px"
170
+ }));
171
+ }), s.variables.focusShadow);
172
+ var D = O().div.withConfig({
173
+ displayName: "FormRowsStyles__StyledButton",
174
+ componentId: "sc-1j4j7h3-5"
175
+ })([ "position:absolute;right:0;top:", ";float:right;" ], (0, s.pick)({
176
+ enterprise: "3px",
177
+ prisma: {
178
+ comfortable: "8px",
179
+ compact: "6px"
180
+ }
181
+ }));
182
+ var I = O().div.withConfig({
183
+ displayName: "FormRowsStyles__StyledDrag",
184
+ componentId: "sc-1j4j7h3-6"
185
+ })([ "position:absolute;left:0;right:0;content:'';cursor:move;background:", ";width:", ";top:", ";", "" ], s.variables.draggableBackground, (0,
186
+ s.pick)({
187
+ enterprise: "7px",
188
+ prisma: "6px"
189
+ }), (0, s.pick)({
190
+ enterprise: "4px",
191
+ prisma: {
192
+ comfortable: "18px",
193
+ compact: "12px"
194
+ }
195
+ }), (0, s.pick)({
196
+ enterprise: (0, w.css)([ "bottom:3px;opacity:0.5;" ]),
197
+ prisma: (0, w.css)([ "height:20px;" ])
198
+ }));
199
+ // CONCATENATED MODULE: ./src/FormRows/RowInternal.tsx
200
+ function T() {
201
+ T = Object.assign || function(e) {
202
+ for (var t = 1; t < arguments.length; t++) {
203
+ var r = arguments[t];
204
+ for (var n in r) {
205
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
206
+ e[n] = r[n];
207
+ }
208
+ }
209
+ }
210
+ return e;
211
+ };
212
+ return T.apply(this, arguments);
213
+ }
214
+ function A(e, t) {
215
+ if (e == null) return {};
216
+ var r = B(e, t);
217
+ var n, o;
218
+ if (Object.getOwnPropertySymbols) {
219
+ var i = Object.getOwnPropertySymbols(e);
220
+ for (o = 0; o < i.length; o++) {
221
+ n = i[o];
222
+ if (t.indexOf(n) >= 0) continue;
223
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
224
+ r[n] = e[n];
225
+ }
226
+ }
227
+ return r;
228
+ }
229
+ function B(e, t) {
230
+ if (e == null) return {};
231
+ var r = {};
232
+ var n = Object.keys(e);
233
+ var o, i;
234
+ for (i = 0; i < n.length; i++) {
235
+ o = n[i];
236
+ if (t.indexOf(o) >= 0) continue;
237
+ r[o] = e[o];
238
+ }
239
+ return r;
240
+ }
241
+ /** @public */ var H = {
242
+ children: i().node,
243
+ index: i().number,
244
+ onRequestRemove: i().func,
245
+ renderDragHandle: i().func,
246
+ style: i().object,
247
+ value: i().node
248
+ };
249
+ var M = n().forwardRef((function(e, t) {
250
+ var o = e.children, i = e.index, u = e.onRequestRemove, l = e.renderDragHandle, s = A(e, [ "children", "index", "onRequestRemove", "renderDragHandle" ]);
251
+ var f = (0, r.useContext)(c), p = f.disabledDeleteButton, d = f.hasOnRequestAdd, v = f.onKeyDown, y = f.sortable;
252
+ var b = (0, r.useCallback)((function(e) {
253
+ // TODO: this callback doesn't work correctly if index isn't provided SUI-5639
254
+ v === null || v === void 0 ? void 0 : v(e, {
255
+ index: i !== null && i !== void 0 ? i : 0
256
+ });
257
+ }), [ v, i ]);
258
+ var m = (0, r.useCallback)((function(e) {
259
+ // TODO: this callback doesn't work correctly if index isn't provided SUI-5639
260
+ u === null || u === void 0 ? void 0 : u(e, {
261
+ index: i !== null && i !== void 0 ? i : 0
262
+ });
263
+ }), [ u, i ]);
264
+ var g = u !== undefined;
265
+ if (false) {}
266
+ if (false) {}
267
+ if (false) {}
268
+
269
+ return n().createElement(C, T({
270
+ $sortable: y,
271
+ "data-test": "row",
272
+ ref: t,
273
+ onKeyDown: b
274
+ }, h()(s, [ "onKeyDown", "onRequestRemove" ])), l && l(), o, g && n().createElement(D, null, n().createElement(x(), {
275
+ disabled: p,
276
+ "data-test": "remove",
277
+ onClick: m,
278
+ screenReaderText: (0, a._)("Remove Row")
279
+ })));
280
+ }));
281
+ M.propTypes = H;
282
+ /* harmony default export */ const N = M;
283
+ // CONCATENATED MODULE: external "@dnd-kit/sortable"
284
+ const F = require("@dnd-kit/sortable");
285
+ // CONCATENATED MODULE: external "@dnd-kit/utilities"
286
+ const K = require("@dnd-kit/utilities");
287
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
288
+ const L = require("@splunk/react-ui/ScreenReaderContent");
289
+ var $ = e.n(L);
290
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
291
+ /**
283
292
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
284
293
  *
285
294
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
286
295
  * @param current - The new value of the ref.
287
296
  */
288
- function updateReactRef(ref, current) {
289
- if (ref) {
290
- if (typeof ref === 'function') {
291
- ref(current);
292
- } else {
293
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
294
- // the intention here is to signal "we will take care of setting 'current', not you".
295
- ref.current = current; // eslint-disable-line no-param-reassign
296
- }
297
- }
298
- }
299
-
300
-
301
- ;// CONCATENATED MODULE: ./src/FormRows/SortableRow.tsx
302
- function SortableRow_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = SortableRow_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; }
303
-
304
- function SortableRow_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; }
305
-
306
- function SortableRow_extends() { SortableRow_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 SortableRow_extends.apply(this, arguments); }
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
- var SortableRow_propTypes = {
318
- children: (external_prop_types_default()).node,
319
- index: (external_prop_types_default()).number,
320
- onRequestRemove: (external_prop_types_default()).func,
321
- value: (external_prop_types_default()).node
322
- };
323
- var DragHandle = /*#__PURE__*/external_react_default().forwardRef(function (props, ref) {
324
- return /*#__PURE__*/external_react_default().createElement(StyledDrag, SortableRow_extends({
325
- "data-test": "drag-handle",
326
- ref: ref
327
- }, props), /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, (0,i18n_namespaceObject._)('Press arrow up or arrow down to re-order items')));
328
- });
329
- var Row = /*#__PURE__*/external_react_default().forwardRef(function (_ref, ref) {
330
- var children = _ref.children,
331
- index = _ref.index,
332
- otherProps = SortableRow_objectWithoutProperties(_ref, ["children", "index"]);
333
-
334
- // @docs-props-type RowPropsBase
335
- var _useSortable = (0,sortable_namespaceObject.useSortable)({
336
- // @dnd-kit requires "id" to be greater than 0 https://github.com/clauderic/dnd-kit/issues/1150
337
- // TODO: FormRows drag functionality doesn't work without an index, but it's not a required prop SUI-5639
338
- id: (index || 0) + 1
339
- }),
340
- attributes = _useSortable.attributes,
341
- listeners = _useSortable.listeners,
342
- setActivatorNodeRef = _useSortable.setActivatorNodeRef,
343
- setNodeRef = _useSortable.setNodeRef,
344
- transform = _useSortable.transform,
345
- transition = _useSortable.transition;
346
-
347
- var style = {
348
- transform: utilities_namespaceObject.CSS.Transform.toString(transform),
349
- transition: transition
350
- };
351
-
352
- var handleRef = function handleRef(el) {
353
- setNodeRef(el);
354
- updateReactRef(ref, el);
355
- };
356
-
357
- return /*#__PURE__*/external_react_default().createElement(FormRows_RowInternal, SortableRow_extends({
358
- index: index,
359
- ref: handleRef,
360
- renderDragHandle: function renderDragHandle() {
361
- return /*#__PURE__*/external_react_default().createElement(DragHandle, SortableRow_extends({
362
- ref: setActivatorNodeRef
363
- }, listeners));
364
- },
365
- style: style
366
- }, otherProps, attributes), children);
367
- });
368
- Row.propTypes = SortableRow_propTypes;
369
- /* harmony default export */ const SortableRow = (Row);
370
- ;// CONCATENATED MODULE: ./src/FormRows/Row.tsx
371
- 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); }
372
-
373
- function Row_extends() { Row_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 Row_extends.apply(this, arguments); }
374
-
375
- function Row_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Row_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; }
376
-
377
- function Row_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; }
378
-
379
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
380
-
381
- 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); } }
382
-
383
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
384
-
385
- 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); }
386
-
387
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
388
-
389
- 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); }; }
390
-
391
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
392
-
393
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
394
-
395
- 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; } }
396
-
397
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
398
-
399
- 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; }
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
- var Row_propTypes = {
408
- children: (external_prop_types_default()).node,
409
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
410
- index: (external_prop_types_default()).number,
411
- onRequestRemove: (external_prop_types_default()).func,
412
- value: (external_prop_types_default()).node
413
- };
414
-
415
- var Row_Row = /*#__PURE__*/function (_Component) {
416
- _inherits(Row, _Component);
417
-
418
- var _super = _createSuper(Row);
419
-
420
- function Row() {
421
- _classCallCheck(this, Row);
422
-
423
- return _super.apply(this, arguments);
424
- }
425
-
426
- _createClass(Row, [{
427
- key: "render",
428
- // @docs-props-type RowPropsBase
429
- value: function render() {
430
- var _this$props = this.props,
431
- children = _this$props.children,
432
- elementRef = _this$props.elementRef,
433
- otherProps = Row_objectWithoutProperties(_this$props, ["children", "elementRef"]);
434
-
435
- var sortableContext = this.context.sortable;
436
- var rowProps = omit_default()(otherProps, ['onKeyDown']);
437
- var RowComponent = sortableContext ? SortableRow : FormRows_RowInternal;
438
- return /*#__PURE__*/external_react_default().createElement(RowComponent, Row_extends({
439
- ref: elementRef
440
- }, rowProps), children);
441
- }
442
- }]);
443
-
444
- return Row;
445
- }(external_react_namespaceObject.Component);
446
-
447
- _defineProperty(Row_Row, "propTypes", Row_propTypes);
448
-
449
- _defineProperty(Row_Row, "contextType", FormRows_FormRowsContext);
450
-
451
- /* harmony default export */ const FormRows_Row = (Row_Row);
452
- ;// CONCATENATED MODULE: external "@dnd-kit/core"
453
- const core_namespaceObject = require("@dnd-kit/core");
454
- ;// CONCATENATED MODULE: ./src/FormRows/SortableList.tsx
455
-
456
-
457
-
458
-
459
- var SortableList = function SortableList(_ref) {
460
- var children = _ref.children,
461
- onSortEnd = _ref.onSortEnd;
462
- var sensors = (0,core_namespaceObject.useSensors)((0,core_namespaceObject.useSensor)(core_namespaceObject.PointerSensor), (0,core_namespaceObject.useSensor)(core_namespaceObject.MouseSensor));
463
- var validChildren = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement);
464
- var items = validChildren.map(function (child) {
465
- return (child.props.index || 0) + 1;
466
- });
467
-
468
- function handleDragEnd(event) {
469
- var active = event.active,
470
- over = event.over;
471
-
472
- if (over && active.id !== over.id) {
473
- var oldIndex = items.indexOf(active.id);
474
- var newIndex = items.indexOf(over.id);
475
- onSortEnd({
476
- oldIndex: oldIndex,
477
- newIndex: newIndex
478
- });
479
- }
480
- }
481
-
482
- return /*#__PURE__*/external_react_default().createElement(core_namespaceObject.DndContext, {
483
- sensors: sensors,
484
- collisionDetection: core_namespaceObject.closestCenter,
485
- onDragEnd: handleDragEnd
486
- }, /*#__PURE__*/external_react_default().createElement(sortable_namespaceObject.SortableContext, {
487
- items: items,
488
- strategy: sortable_namespaceObject.verticalListSortingStrategy
489
- }, validChildren));
490
- };
491
-
492
- /* harmony default export */ const FormRows_SortableList = (SortableList);
493
- ;// CONCATENATED MODULE: ./src/FormRows/FormRows.tsx
494
- function FormRows_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { FormRows_typeof = function _typeof(obj) { return typeof obj; }; } else { FormRows_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return FormRows_typeof(obj); }
495
-
496
- function FormRows_extends() { FormRows_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 FormRows_extends.apply(this, arguments); }
497
-
498
- function FormRows_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = FormRows_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; }
499
-
500
- function FormRows_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; }
501
-
502
- function FormRows_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
503
-
504
- function FormRows_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); } }
505
-
506
- function FormRows_createClass(Constructor, protoProps, staticProps) { if (protoProps) FormRows_defineProperties(Constructor.prototype, protoProps); if (staticProps) FormRows_defineProperties(Constructor, staticProps); return Constructor; }
507
-
508
- function FormRows_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) FormRows_setPrototypeOf(subClass, superClass); }
509
-
510
- function FormRows_setPrototypeOf(o, p) { FormRows_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FormRows_setPrototypeOf(o, p); }
511
-
512
- function FormRows_createSuper(Derived) { var hasNativeReflectConstruct = FormRows_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FormRows_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FormRows_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FormRows_possibleConstructorReturn(this, result); }; }
513
-
514
- function FormRows_possibleConstructorReturn(self, call) { if (call && (FormRows_typeof(call) === "object" || typeof call === "function")) { return call; } return FormRows_assertThisInitialized(self); }
515
-
516
- function FormRows_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
517
-
518
- function FormRows_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; } }
519
-
520
- function FormRows_getPrototypeOf(o) { FormRows_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FormRows_getPrototypeOf(o); }
521
-
522
- function FormRows_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; }
523
-
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
-
532
-
533
- var FormRows_propTypes = {
534
- addLabel: (external_prop_types_default()).string,
535
- children: (external_prop_types_default()).node,
536
- disabled: (external_prop_types_default()).bool,
537
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
538
- header: (external_prop_types_default()).node,
539
- menu: (external_prop_types_default()).node,
540
- onRequestAdd: (external_prop_types_default()).func,
541
- onRequestMove: (external_prop_types_default()).func
542
- };
543
- var defaultProps = {
544
- addLabel: (0,i18n_namespaceObject._)('Add Row'),
545
- disabled: false,
546
- header: null
547
- };
548
-
549
- var FormRows = /*#__PURE__*/function (_Component) {
550
- FormRows_inherits(FormRows, _Component);
551
-
552
- var _super = FormRows_createSuper(FormRows);
553
-
554
- function FormRows() {
555
- var _this;
556
-
557
- FormRows_classCallCheck(this, FormRows);
558
-
559
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
560
- args[_key] = arguments[_key];
561
- }
562
-
563
- _this = _super.call.apply(_super, [this].concat(args));
564
-
565
- FormRows_defineProperty(FormRows_assertThisInitialized(_this), "handleKeyDown", function (e, _ref) {
566
- var index = _ref.index;
567
-
568
- if (e.currentTarget !== e.target) {
569
- return;
570
- }
571
-
572
- if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'up') {
573
- e.preventDefault();
574
-
575
- if (index > 0) {
576
- var _this$props$onRequest, _this$props;
577
-
578
- (_this$props$onRequest = (_this$props = _this.props).onRequestMove) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, {
579
- fromIndex: index,
580
- toIndex: index - 1
581
- });
582
- }
583
- } else if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'down') {
584
- e.preventDefault();
585
-
586
- if (index < external_react_default().Children.toArray(_this.props.children).length - 1) {
587
- var _this$props$onRequest2, _this$props2;
588
-
589
- (_this$props$onRequest2 = (_this$props2 = _this.props).onRequestMove) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, {
590
- fromIndex: index,
591
- toIndex: index + 1
592
- });
593
- }
594
- }
595
- });
596
-
597
- FormRows_defineProperty(FormRows_assertThisInitialized(_this), "handleSortEnd", function (_ref2) {
598
- var _this$props$onRequest3, _this$props3;
599
-
600
- var oldIndex = _ref2.oldIndex,
601
- newIndex = _ref2.newIndex;
602
- (_this$props$onRequest3 = (_this$props3 = _this.props).onRequestMove) === null || _this$props$onRequest3 === void 0 ? void 0 : _this$props$onRequest3.call(_this$props3, {
603
- fromIndex: oldIndex,
604
- toIndex: newIndex
605
- });
606
- });
607
-
608
- return _this;
609
- }
610
-
611
- FormRows_createClass(FormRows, [{
612
- key: "render",
613
- value: function render() {
614
- var _this$props4 = this.props,
615
- addLabel = _this$props4.addLabel,
616
- children = _this$props4.children,
617
- disabled = _this$props4.disabled,
618
- header = _this$props4.header,
619
- menu = _this$props4.menu,
620
- onRequestAdd = _this$props4.onRequestAdd,
621
- onRequestMove = _this$props4.onRequestMove,
622
- otherProps = FormRows_objectWithoutProperties(_this$props4, ["addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove"]);
623
-
624
- var sortable = onRequestMove !== undefined && !disabled;
625
- var StyledHeaderComp = sortable ? StyledHeader : 'div';
626
- var hasOnRequestAdd = onRequestAdd !== undefined;
627
- return /*#__PURE__*/external_react_default().createElement(StyledBox, FormRows_extends({
628
- "data-test": "form-rows"
629
- }, otherProps), /*#__PURE__*/external_react_default().createElement(FormRows_FormRowsContext.Provider, {
630
- value: {
631
- disabledDeleteButton: disabled,
632
- onKeyDown: this.handleKeyDown,
633
- hasOnRequestAdd: hasOnRequestAdd,
634
- sortable: sortable
635
- }
636
- }, header && /*#__PURE__*/external_react_default().createElement(StyledHeaderComp, null, header), /*#__PURE__*/external_react_default().createElement(StyledRows, null, /*#__PURE__*/external_react_default().createElement(FormRows_SortableList, {
637
- onSortEnd: this.handleSortEnd
638
- }, children)), menu || hasOnRequestAdd && /*#__PURE__*/external_react_default().createElement(StyledAddRowButton, {
639
- disabled: disabled,
640
- appearance: "pill",
641
- "data-test": "add-row",
642
- icon: /*#__PURE__*/external_react_default().createElement(icons_FormRowsPlusIcon, null),
643
- label: addLabel,
644
- onClick: onRequestAdd,
645
- $sortable: sortable
646
- })));
647
- }
648
- }], [{
649
- key: "addRow",
650
-
651
- /**
297
+ function z(e, t) {
298
+ if (e) {
299
+ if (typeof e === "function") {
300
+ e(t);
301
+ } else {
302
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
303
+ // the intention here is to signal "we will take care of setting 'current', not you".
304
+ e.current = t;
305
+ // eslint-disable-line no-param-reassign
306
+ }
307
+ }
308
+ }
309
+ // CONCATENATED MODULE: ./src/FormRows/SortableRow.tsx
310
+ function V(e, t) {
311
+ if (e == null) return {};
312
+ var r = G(e, t);
313
+ var n, o;
314
+ if (Object.getOwnPropertySymbols) {
315
+ var i = Object.getOwnPropertySymbols(e);
316
+ for (o = 0; o < i.length; o++) {
317
+ n = i[o];
318
+ if (t.indexOf(n) >= 0) continue;
319
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
320
+ r[n] = e[n];
321
+ }
322
+ }
323
+ return r;
324
+ }
325
+ function G(e, t) {
326
+ if (e == null) return {};
327
+ var r = {};
328
+ var n = Object.keys(e);
329
+ var o, i;
330
+ for (i = 0; i < n.length; i++) {
331
+ o = n[i];
332
+ if (t.indexOf(o) >= 0) continue;
333
+ r[o] = e[o];
334
+ }
335
+ return r;
336
+ }
337
+ function J() {
338
+ J = Object.assign || function(e) {
339
+ for (var t = 1; t < arguments.length; t++) {
340
+ var r = arguments[t];
341
+ for (var n in r) {
342
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
343
+ e[n] = r[n];
344
+ }
345
+ }
346
+ }
347
+ return e;
348
+ };
349
+ return J.apply(this, arguments);
350
+ }
351
+ var Q = {
352
+ children: i().node,
353
+ index: i().number,
354
+ onRequestRemove: i().func,
355
+ value: i().node
356
+ };
357
+ var U = n().forwardRef((function(e, t) {
358
+
359
+ return n().createElement(I, J({
360
+ "data-test": "drag-handle",
361
+ ref: t
362
+ }, e), n().createElement($(), null, (0, a._)("Press arrow up or arrow down to re-order items")));
363
+ }));
364
+ var W = n().forwardRef((function(e, t) {
365
+ var r = e.children, o = e.index, i = V(e, [ "children", "index" ]);
366
+ // @docs-props-type RowPropsBase
367
+ var a = (0, F.useSortable)({
368
+ // @dnd-kit requires "id" to be greater than 0 https://github.com/clauderic/dnd-kit/issues/1150
369
+ // TODO: FormRows drag functionality doesn't work without an index, but it's not a required prop SUI-5639
370
+ id: (o || 0) + 1
371
+ }), u = a.attributes, l = a.listeners, c = a.setActivatorNodeRef, s = a.setNodeRef, f = a.transform, p = a.transition;
372
+ var d = {
373
+ transform: K.CSS.Transform.toString(f),
374
+ transition: p
375
+ };
376
+ var v = function e(r) {
377
+ s(r);
378
+ z(t, r);
379
+ };
380
+
381
+ return n().createElement(N, J({
382
+ index: o,
383
+ ref: v,
384
+ renderDragHandle: function e() {
385
+
386
+ return n().createElement(U, J({
387
+ ref: c
388
+ }, l));
389
+ },
390
+ style: d
391
+ }, i, u), r);
392
+ }));
393
+ W.propTypes = Q;
394
+ /* harmony default export */ const X = W;
395
+ // CONCATENATED MODULE: ./src/FormRows/Row.tsx
396
+ function Y(e) {
397
+ "@babel/helpers - typeof";
398
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
399
+ Y = function e(t) {
400
+ return typeof t;
401
+ };
402
+ } else {
403
+ Y = function e(t) {
404
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
405
+ };
406
+ }
407
+ return Y(e);
408
+ }
409
+ function Z() {
410
+ Z = Object.assign || function(e) {
411
+ for (var t = 1; t < arguments.length; t++) {
412
+ var r = arguments[t];
413
+ for (var n in r) {
414
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
415
+ e[n] = r[n];
416
+ }
417
+ }
418
+ }
419
+ return e;
420
+ };
421
+ return Z.apply(this, arguments);
422
+ }
423
+ function ee(e, t) {
424
+ if (e == null) return {};
425
+ var r = te(e, t);
426
+ var n, o;
427
+ if (Object.getOwnPropertySymbols) {
428
+ var i = Object.getOwnPropertySymbols(e);
429
+ for (o = 0; o < i.length; o++) {
430
+ n = i[o];
431
+ if (t.indexOf(n) >= 0) continue;
432
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
433
+ r[n] = e[n];
434
+ }
435
+ }
436
+ return r;
437
+ }
438
+ function te(e, t) {
439
+ if (e == null) return {};
440
+ var r = {};
441
+ var n = Object.keys(e);
442
+ var o, i;
443
+ for (i = 0; i < n.length; i++) {
444
+ o = n[i];
445
+ if (t.indexOf(o) >= 0) continue;
446
+ r[o] = e[o];
447
+ }
448
+ return r;
449
+ }
450
+ function re(e, t) {
451
+ if (!(e instanceof t)) {
452
+ throw new TypeError("Cannot call a class as a function");
453
+ }
454
+ }
455
+ function ne(e, t) {
456
+ for (var r = 0; r < t.length; r++) {
457
+ var n = t[r];
458
+ n.enumerable = n.enumerable || false;
459
+ n.configurable = true;
460
+ if ("value" in n) n.writable = true;
461
+ Object.defineProperty(e, n.key, n);
462
+ }
463
+ }
464
+ function oe(e, t, r) {
465
+ if (t) ne(e.prototype, t);
466
+ if (r) ne(e, r);
467
+ return e;
468
+ }
469
+ function ie(e, t) {
470
+ if (typeof t !== "function" && t !== null) {
471
+ throw new TypeError("Super expression must either be null or a function");
472
+ }
473
+ e.prototype = Object.create(t && t.prototype, {
474
+ constructor: {
475
+ value: e,
476
+ writable: true,
477
+ configurable: true
478
+ }
479
+ });
480
+ if (t) ae(e, t);
481
+ }
482
+ function ae(e, t) {
483
+ ae = Object.setPrototypeOf || function e(t, r) {
484
+ t.__proto__ = r;
485
+ return t;
486
+ };
487
+ return ae(e, t);
488
+ }
489
+ function ue(e) {
490
+ var t = se();
491
+ return function r() {
492
+ var n = fe(e), o;
493
+ if (t) {
494
+ var i = fe(this).constructor;
495
+ o = Reflect.construct(n, arguments, i);
496
+ } else {
497
+ o = n.apply(this, arguments);
498
+ }
499
+ return le(this, o);
500
+ };
501
+ }
502
+ function le(e, t) {
503
+ if (t && (Y(t) === "object" || typeof t === "function")) {
504
+ return t;
505
+ }
506
+ return ce(e);
507
+ }
508
+ function ce(e) {
509
+ if (e === void 0) {
510
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
511
+ }
512
+ return e;
513
+ }
514
+ function se() {
515
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
516
+ if (Reflect.construct.sham) return false;
517
+ if (typeof Proxy === "function") return true;
518
+ try {
519
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
520
+ return true;
521
+ } catch (e) {
522
+ return false;
523
+ }
524
+ }
525
+ function fe(e) {
526
+ fe = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
527
+ return t.__proto__ || Object.getPrototypeOf(t);
528
+ };
529
+ return fe(e);
530
+ }
531
+ function pe(e, t, r) {
532
+ if (t in e) {
533
+ Object.defineProperty(e, t, {
534
+ value: r,
535
+ enumerable: true,
536
+ configurable: true,
537
+ writable: true
538
+ });
539
+ } else {
540
+ e[t] = r;
541
+ }
542
+ return e;
543
+ }
544
+ var de = {
545
+ children: i().node,
546
+ elementRef: i().oneOfType([ i().func, i().object ]),
547
+ index: i().number,
548
+ onRequestRemove: i().func,
549
+ value: i().node
550
+ };
551
+ var ve = function(e) {
552
+ ie(r, e);
553
+ var t = ue(r);
554
+ function r() {
555
+ re(this, r);
556
+ return t.apply(this, arguments);
557
+ }
558
+ oe(r, [ {
559
+ key: "render",
560
+ // @docs-props-type RowPropsBase
561
+ value: function e() {
562
+ var t = this.props, r = t.children, o = t.elementRef, i = ee(t, [ "children", "elementRef" ]);
563
+ var a = this.context.sortable;
564
+ var u = h()(i, [ "onKeyDown" ]);
565
+ var l = a ? X : N;
566
+
567
+ return n().createElement(l, Z({
568
+ ref: o
569
+ }, u), r);
570
+ }
571
+ } ]);
572
+ return r;
573
+ }(r.Component);
574
+ pe(ve, "propTypes", de);
575
+ pe(ve, "contextType", c);
576
+ /* harmony default export */ const ye = ve;
577
+ // CONCATENATED MODULE: external "@dnd-kit/core"
578
+ const be = require("@dnd-kit/core");
579
+ // CONCATENATED MODULE: ./src/FormRows/SortableList.tsx
580
+ var me = function e(t) {
581
+ var o = t.children, i = t.onSortEnd;
582
+ var a = (0, be.useSensors)((0, be.useSensor)(be.PointerSensor), (0, be.useSensor)(be.MouseSensor));
583
+ var u = r.Children.toArray(o).filter(r.isValidElement);
584
+ var l = u.map((function(e) {
585
+ return (e.props.index || 0) + 1;
586
+ }));
587
+ function c(e) {
588
+ var t = e.active, r = e.over;
589
+ if (r && t.id !== r.id) {
590
+ var n = l.indexOf(t.id);
591
+ var o = l.indexOf(r.id);
592
+ i({
593
+ oldIndex: n,
594
+ newIndex: o
595
+ });
596
+ }
597
+ }
598
+
599
+ return n().createElement(be.DndContext, {
600
+ sensors: a,
601
+ collisionDetection: be.closestCenter,
602
+ onDragEnd: c
603
+ }, n().createElement(F.SortableContext, {
604
+ items: l,
605
+ strategy: F.verticalListSortingStrategy
606
+ }, u));
607
+ };
608
+ /* harmony default export */ const he = me;
609
+ // CONCATENATED MODULE: ./src/FormRows/FormRows.tsx
610
+ function ge(e) {
611
+ "@babel/helpers - typeof";
612
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
613
+ ge = function e(t) {
614
+ return typeof t;
615
+ };
616
+ } else {
617
+ ge = function e(t) {
618
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
619
+ };
620
+ }
621
+ return ge(e);
622
+ }
623
+ function xe() {
624
+ xe = Object.assign || function(e) {
625
+ for (var t = 1; t < arguments.length; t++) {
626
+ var r = arguments[t];
627
+ for (var n in r) {
628
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
629
+ e[n] = r[n];
630
+ }
631
+ }
632
+ }
633
+ return e;
634
+ };
635
+ return xe.apply(this, arguments);
636
+ }
637
+ function we(e, t) {
638
+ if (e == null) return {};
639
+ var r = Oe(e, t);
640
+ var n, o;
641
+ if (Object.getOwnPropertySymbols) {
642
+ var i = Object.getOwnPropertySymbols(e);
643
+ for (o = 0; o < i.length; o++) {
644
+ n = i[o];
645
+ if (t.indexOf(n) >= 0) continue;
646
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
647
+ r[n] = e[n];
648
+ }
649
+ }
650
+ return r;
651
+ }
652
+ function Oe(e, t) {
653
+ if (e == null) return {};
654
+ var r = {};
655
+ var n = Object.keys(e);
656
+ var o, i;
657
+ for (i = 0; i < n.length; i++) {
658
+ o = n[i];
659
+ if (t.indexOf(o) >= 0) continue;
660
+ r[o] = e[o];
661
+ }
662
+ return r;
663
+ }
664
+ function Re(e, t) {
665
+ if (!(e instanceof t)) {
666
+ throw new TypeError("Cannot call a class as a function");
667
+ }
668
+ }
669
+ function je(e, t) {
670
+ for (var r = 0; r < t.length; r++) {
671
+ var n = t[r];
672
+ n.enumerable = n.enumerable || false;
673
+ n.configurable = true;
674
+ if ("value" in n) n.writable = true;
675
+ Object.defineProperty(e, n.key, n);
676
+ }
677
+ }
678
+ function Se(e, t, r) {
679
+ if (t) je(e.prototype, t);
680
+ if (r) je(e, r);
681
+ return e;
682
+ }
683
+ function ke(e, t) {
684
+ if (typeof t !== "function" && t !== null) {
685
+ throw new TypeError("Super expression must either be null or a function");
686
+ }
687
+ e.prototype = Object.create(t && t.prototype, {
688
+ constructor: {
689
+ value: e,
690
+ writable: true,
691
+ configurable: true
692
+ }
693
+ });
694
+ if (t) Ee(e, t);
695
+ }
696
+ function Ee(e, t) {
697
+ Ee = Object.setPrototypeOf || function e(t, r) {
698
+ t.__proto__ = r;
699
+ return t;
700
+ };
701
+ return Ee(e, t);
702
+ }
703
+ function Pe(e) {
704
+ var t = Ce();
705
+ return function r() {
706
+ var n = De(e), o;
707
+ if (t) {
708
+ var i = De(this).constructor;
709
+ o = Reflect.construct(n, arguments, i);
710
+ } else {
711
+ o = n.apply(this, arguments);
712
+ }
713
+ return _e(this, o);
714
+ };
715
+ }
716
+ function _e(e, t) {
717
+ if (t && (ge(t) === "object" || typeof t === "function")) {
718
+ return t;
719
+ }
720
+ return qe(e);
721
+ }
722
+ function qe(e) {
723
+ if (e === void 0) {
724
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
725
+ }
726
+ return e;
727
+ }
728
+ function Ce() {
729
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
730
+ if (Reflect.construct.sham) return false;
731
+ if (typeof Proxy === "function") return true;
732
+ try {
733
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
734
+ return true;
735
+ } catch (e) {
736
+ return false;
737
+ }
738
+ }
739
+ function De(e) {
740
+ De = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
741
+ return t.__proto__ || Object.getPrototypeOf(t);
742
+ };
743
+ return De(e);
744
+ }
745
+ function Ie(e, t, r) {
746
+ if (t in e) {
747
+ Object.defineProperty(e, t, {
748
+ value: r,
749
+ enumerable: true,
750
+ configurable: true,
751
+ writable: true
752
+ });
753
+ } else {
754
+ e[t] = r;
755
+ }
756
+ return e;
757
+ }
758
+ var Te = {
759
+ addLabel: i().string,
760
+ children: i().node,
761
+ disabled: i().bool,
762
+ elementRef: i().oneOfType([ i().func, i().object ]),
763
+ header: i().node,
764
+ menu: i().node,
765
+ onRequestAdd: i().func,
766
+ onRequestMove: i().func
767
+ };
768
+ var Ae = {
769
+ addLabel: (0, a._)("Add Row"),
770
+ disabled: false,
771
+ header: null
772
+ };
773
+ var Be = function(e) {
774
+ ke(o, e);
775
+ var t = Pe(o);
776
+ function o() {
777
+ var e;
778
+ Re(this, o);
779
+ for (var r = arguments.length, i = new Array(r), a = 0; a < r; a++) {
780
+ i[a] = arguments[a];
781
+ }
782
+ e = t.call.apply(t, [ this ].concat(i));
783
+ Ie(qe(e), "handleKeyDown", (function(t, r) {
784
+ var o = r.index;
785
+ if (t.currentTarget !== t.target) {
786
+ return;
787
+ }
788
+ if ((0, u.keycode)(t.nativeEvent) === "up") {
789
+ t.preventDefault();
790
+ if (o > 0) {
791
+ var i, a;
792
+ (i = (a = e.props).onRequestMove) === null || i === void 0 ? void 0 : i.call(a, {
793
+ fromIndex: o,
794
+ toIndex: o - 1
795
+ });
796
+ }
797
+ } else if ((0, u.keycode)(t.nativeEvent) === "down") {
798
+ t.preventDefault();
799
+ if (o < n().Children.toArray(e.props.children).length - 1) {
800
+ var l, c;
801
+ (l = (c = e.props).onRequestMove) === null || l === void 0 ? void 0 : l.call(c, {
802
+ fromIndex: o,
803
+ toIndex: o + 1
804
+ });
805
+ }
806
+ }
807
+ }));
808
+ Ie(qe(e), "handleSortEnd", (function(t) {
809
+ var r, n;
810
+ var o = t.oldIndex, i = t.newIndex;
811
+ (r = (n = e.props).onRequestMove) === null || r === void 0 ? void 0 : r.call(n, {
812
+ fromIndex: o,
813
+ toIndex: i
814
+ });
815
+ }));
816
+ return e;
817
+ }
818
+ Se(o, [ {
819
+ key: "render",
820
+ value: function e() {
821
+ var t = this.props, r = t.addLabel, o = t.children, i = t.disabled, a = t.header, u = t.menu, l = t.onRequestAdd, s = t.onRequestMove, f = we(t, [ "addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove" ]);
822
+ var p = s !== undefined && !i;
823
+ var d = p ? P : "div";
824
+ var v = l !== undefined;
825
+
826
+ return n().createElement(E, xe({
827
+ "data-test": "form-rows"
828
+ }, f), n().createElement(c.Provider, {
829
+ value: {
830
+ disabledDeleteButton: i,
831
+ onKeyDown: this.handleKeyDown,
832
+ hasOnRequestAdd: v,
833
+ sortable: p
834
+ }
835
+ }, a && n().createElement(d, null, a), n().createElement(q, null, n().createElement(he, {
836
+ onSortEnd: this.handleSortEnd
837
+ }, o)), u || v && n().createElement(_, {
838
+ disabled: i,
839
+ appearance: "pill",
840
+ "data-test": "add-row",
841
+ icon: n().createElement(b, null),
842
+ label: r,
843
+ onClick: l,
844
+ $sortable: p
845
+ })));
846
+ }
847
+ } ], [ {
848
+ key: "addRow",
849
+ /**
652
850
  * Static function for adding a row.
653
851
  *
654
852
  * Example Use:
@@ -672,10 +870,10 @@ var FormRows = /*#__PURE__*/function (_Component) {
672
870
  * @param items Array of current FormRows to add to.
673
871
  * @return New array of FormRows with new Row added.
674
872
  */
675
- value: function addRow(element, items) {
676
- return items.concat(element);
677
- }
678
- /**
873
+ value: function e(t, r) {
874
+ return r.concat(t);
875
+ }
876
+ /**
679
877
  * Static function for moving a row.
680
878
  *
681
879
  * Example Use:
@@ -690,22 +888,21 @@ var FormRows = /*#__PURE__*/function (_Component) {
690
888
  * @param toIndex New index to move row to.
691
889
  * @param items Array of current FormRows.
692
890
  * @return New array of FormRows arranged in new order.
693
- */
694
-
695
- }, {
696
- key: "moveRow",
697
- value: function moveRow(fromIndex, toIndex, items) {
698
- var tempArray = items.filter(function (val, idx) {
699
- return idx !== fromIndex;
700
- });
701
- tempArray.splice(toIndex, 0, items[fromIndex]);
702
- return tempArray.map(function (item, index) {
703
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(item, {
704
- index: index
705
- });
706
- });
707
- }
708
- /**
891
+ */ }, {
892
+ key: "moveRow",
893
+ value: function e(t, n, o) {
894
+ var i = o.filter((function(e, r) {
895
+ return r !== t;
896
+ }));
897
+ i.splice(n, 0, o[t]);
898
+ return i.map((function(e, t) {
899
+
900
+ return (0, r.cloneElement)(e, {
901
+ index: t
902
+ });
903
+ }));
904
+ }
905
+ /**
709
906
  * Static function for removing a row.
710
907
  *
711
908
  * Example Use:
@@ -719,35 +916,25 @@ var FormRows = /*#__PURE__*/function (_Component) {
719
916
  * @param index Index of Row to delete.
720
917
  * @param items Array of current FormRows.
721
918
  * @return New array of FormRows with Row of given index deleted.
722
- */
723
-
724
- }, {
725
- key: "removeRow",
726
- value: function removeRow(index, items) {
727
- return items.filter(function (val, idx) {
728
- return idx !== index;
729
- }).map(function (item, idx) {
730
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(item, {
731
- index: idx
732
- });
733
- });
734
- }
735
- }]);
736
-
737
- return FormRows;
738
- }(external_react_namespaceObject.Component);
739
-
740
- FormRows_defineProperty(FormRows, "propTypes", FormRows_propTypes);
741
-
742
- FormRows_defineProperty(FormRows, "defaultProps", defaultProps);
743
-
744
- FormRows_defineProperty(FormRows, "Row", FormRows_Row);
745
-
746
- /* harmony default export */ const FormRows_FormRows = (FormRows);
747
-
748
- ;// CONCATENATED MODULE: ./src/FormRows/index.ts
749
-
750
-
751
- module.exports = __webpack_exports__;
752
- /******/ })()
753
- ;
919
+ */ }, {
920
+ key: "removeRow",
921
+ value: function e(t, n) {
922
+ return n.filter((function(e, r) {
923
+ return r !== t;
924
+ })).map((function(e, t) {
925
+
926
+ return (0, r.cloneElement)(e, {
927
+ index: t
928
+ });
929
+ }));
930
+ }
931
+ } ]);
932
+ return o;
933
+ }(r.Component);
934
+ Ie(Be, "propTypes", Te);
935
+ Ie(Be, "defaultProps", Ae);
936
+ Ie(Be, "Row", ye);
937
+ /* harmony default export */ const He = Be;
938
+ // CONCATENATED MODULE: ./src/FormRows/index.ts
939
+ module.exports = t;
940
+ /******/})();