carbon-addons-iot-react 2.98.2 → 2.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/carbon-addons-iot-react.css +39 -33
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBox.js +98 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxField.js +57 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenu.js +43 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuIcon.js +55 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuItem.js +58 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxPropTypes.js +12 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/ListBoxSelection.js +96 -0
- package/es/node_modules/carbon-components-react/es/components/ListBox/index.js +21 -0
- package/es/node_modules/carbon-components-react/es/prop-types/childrenOfType.js +36 -0
- package/es/node_modules/carbon-components-react/es/prop-types/tools/createChainableTypeChecker.js +38 -0
- package/es/node_modules/carbon-components-react/es/prop-types/tools/getDisplayName.js +37 -0
- package/es/src/components/ComboBox/CarbonComboBox.jsx +882 -0
- package/es/src/components/ComboBox/ComboBox.jsx +375 -0
- package/es/src/components/ComposedModal/ComposedModal.jsx +5 -1
- package/es/src/index.js +2 -1
- package/lib/css/carbon-addons-iot-react.css +39 -33
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBox.js +103 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxField.js +62 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenu.js +48 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuIcon.js +60 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxMenuItem.js +63 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxPropTypes.js +17 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/ListBoxSelection.js +101 -0
- package/lib/node_modules/carbon-components-react/es/components/ListBox/index.js +23 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/childrenOfType.js +41 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/tools/createChainableTypeChecker.js +40 -0
- package/lib/node_modules/carbon-components-react/es/prop-types/tools/getDisplayName.js +39 -0
- package/lib/scss/components/ComboBox/_combo-box.scss +43 -0
- package/lib/scss/components/ComposedModal/_composed-modal.scss +5 -0
- package/lib/scss/components/Tag/_tag.scss +11 -0
- package/lib/scss/styles.scss +1 -44
- package/lib/src/components/ComboBox/CarbonComboBox.jsx +889 -0
- package/lib/src/components/ComboBox/ComboBox.jsx +380 -0
- package/lib/src/components/ComposedModal/ComposedModal.jsx +5 -1
- package/lib/src/index.js +2 -1
- package/package.json +7 -5
- package/scss/components/ComboBox/_combo-box.scss +43 -0
- package/scss/components/ComposedModal/_composed-modal.scss +5 -0
- package/scss/components/Tag/_tag.scss +11 -0
- package/scss/styles.scss +1 -44
- package/umd/carbon-addons-iot-react.js +3327 -237
|
@@ -18091,6 +18091,7 @@
|
|
|
18091
18091
|
|
|
18092
18092
|
return data;
|
|
18093
18093
|
}
|
|
18094
|
+
var iotPrefix$2 = settings.iotPrefix;
|
|
18094
18095
|
var StyledModal = styled(carbonComponentsReact.ComposedModal)(_templateObject$1(), rem$2(515), rem$2(600), rem$2(800), rem$2(600), rem$2(1024), rem$2(1200), rem$2(200));
|
|
18095
18096
|
var StyledMessageBox = styled(carbonComponentsReact.InlineNotification)(_templateObject2(), PADDING.horizontalWrapPadding, PADDING.verticalPadding);
|
|
18096
18097
|
var StyledModalFooter = styled(carbonComponentsReact.ModalFooter)(_templateObject3());
|
|
@@ -18267,7 +18268,9 @@
|
|
|
18267
18268
|
iconDescription: iconDescription
|
|
18268
18269
|
}, helpText ? /*#__PURE__*/React__default.createElement("p", {
|
|
18269
18270
|
className: "bx--modal-content__text"
|
|
18270
|
-
}, helpText) : null), children ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ModalBody,
|
|
18271
|
+
}, helpText) : null), children ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ModalBody, {
|
|
18272
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$2, "--composed-modal__body--small-margin-bottom"), error))
|
|
18273
|
+
}, children) : null, error ? /*#__PURE__*/React__default.createElement(StyledMessageBox, {
|
|
18271
18274
|
title: error,
|
|
18272
18275
|
subtitle: "",
|
|
18273
18276
|
kind: "error",
|
|
@@ -22477,7 +22480,7 @@
|
|
|
22477
22480
|
React__default.useEffect(callback, useDeepCompareMemoize(dependencies));
|
|
22478
22481
|
}
|
|
22479
22482
|
|
|
22480
|
-
var iotPrefix$
|
|
22483
|
+
var iotPrefix$3 = settings.iotPrefix;
|
|
22481
22484
|
var propTypes$4 = {
|
|
22482
22485
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
|
22483
22486
|
wrapText: PropTypes.oneOf(['always', 'never', 'auto']).isRequired,
|
|
@@ -22529,7 +22532,7 @@
|
|
|
22529
22532
|
rowId = _ref.rowId,
|
|
22530
22533
|
row = _ref.row;
|
|
22531
22534
|
var mySpanRef = /*#__PURE__*/React__default.createRef();
|
|
22532
|
-
var myClasses = classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$
|
|
22535
|
+
var myClasses = classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$3, "--table__cell-text--truncate"), wrapText !== 'always' && truncateCellText), defineProperty$3(_classnames, "".concat(iotPrefix$3, "--table__cell-text--no-wrap"), wrapText === 'never'), _classnames));
|
|
22533
22536
|
|
|
22534
22537
|
var _useState = React.useState(false),
|
|
22535
22538
|
_useState2 = slicedToArray(_useState, 2),
|
|
@@ -28464,7 +28467,7 @@
|
|
|
28464
28467
|
var lib_1$1 = lib$1.getEmptyImage;
|
|
28465
28468
|
var lib_2$1 = lib$1.NativeTypes;
|
|
28466
28469
|
|
|
28467
|
-
var iotPrefix$
|
|
28470
|
+
var iotPrefix$4 = settings.iotPrefix;
|
|
28468
28471
|
|
|
28469
28472
|
var ColumnHeaderSelect = function ColumnHeaderSelect(_ref) {
|
|
28470
28473
|
var connectDragSource = _ref.connectDragSource,
|
|
@@ -28476,7 +28479,7 @@
|
|
|
28476
28479
|
isOver = _ref.isOver,
|
|
28477
28480
|
isDisabled = _ref.isDisabled;
|
|
28478
28481
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, {
|
|
28479
|
-
className: classnames('column-header__btn', "".concat(iotPrefix$
|
|
28482
|
+
className: classnames('column-header__btn', "".concat(iotPrefix$4, "--column-header"), 'column-header__select', {
|
|
28480
28483
|
'column-header__select--hidden': isHidden,
|
|
28481
28484
|
'column-header__select--isOver': isOver
|
|
28482
28485
|
}),
|
|
@@ -29194,7 +29197,7 @@
|
|
|
29194
29197
|
|
|
29195
29198
|
return data;
|
|
29196
29199
|
}
|
|
29197
|
-
var iotPrefix$
|
|
29200
|
+
var iotPrefix$5 = settings.iotPrefix,
|
|
29198
29201
|
prefix = settings.prefix;
|
|
29199
29202
|
var TableHeader$1 = carbonComponentsReact.DataTable.TableHeader,
|
|
29200
29203
|
TableRow$2 = carbonComponentsReact.DataTable.TableRow;
|
|
@@ -29325,7 +29328,7 @@
|
|
|
29325
29328
|
|
|
29326
29329
|
var headerContent = column.isFilterable !== undefined && !column.isFilterable ? /*#__PURE__*/React__default.createElement("div", null) : column.options ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ComboBox, {
|
|
29327
29330
|
key: columnStateValue,
|
|
29328
|
-
className: "".concat(iotPrefix$
|
|
29331
|
+
className: "".concat(iotPrefix$5, "--filterheader-combo"),
|
|
29329
29332
|
id: "column-".concat(i),
|
|
29330
29333
|
"aria-label": filterText,
|
|
29331
29334
|
translateWithId: _this2.handleTranslation,
|
|
@@ -29384,7 +29387,7 @@
|
|
|
29384
29387
|
// eslint-disable-line react/destructuring-assignment
|
|
29385
29388
|
React__default.createElement("div", {
|
|
29386
29389
|
role: "button",
|
|
29387
|
-
className: classnames("".concat(prefix, "--list-box__selection"), defineProperty$3({}, "".concat(iotPrefix$
|
|
29390
|
+
className: classnames("".concat(prefix, "--list-box__selection"), defineProperty$3({}, "".concat(iotPrefix$5, "--clear-filters-button--disabled"), isDisabled)),
|
|
29388
29391
|
tabIndex: isDisabled ? '-1' : '0',
|
|
29389
29392
|
onClick: function onClick(event) {
|
|
29390
29393
|
if (!isDisabled) {
|
|
@@ -29403,7 +29406,7 @@
|
|
|
29403
29406
|
description: clearFilterText
|
|
29404
29407
|
})) : null);
|
|
29405
29408
|
return /*#__PURE__*/React__default.createElement(StyledTableHeader$1, {
|
|
29406
|
-
className: "".concat(iotPrefix$
|
|
29409
|
+
className: "".concat(iotPrefix$5, "--tableheader-filter"),
|
|
29407
29410
|
"data-column": column.id,
|
|
29408
29411
|
key: "FilterHeader".concat(column.id),
|
|
29409
29412
|
width: column.width,
|
|
@@ -30787,7 +30790,7 @@
|
|
|
30787
30790
|
ordering: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
30788
30791
|
};
|
|
30789
30792
|
var dragHandleWidth = 4;
|
|
30790
|
-
var iotPrefix$
|
|
30793
|
+
var iotPrefix$6 = settings.iotPrefix;
|
|
30791
30794
|
|
|
30792
30795
|
var getColumnDragBounds = function getColumnDragBounds(myColumn, siblingColumn) {
|
|
30793
30796
|
return {
|
|
@@ -30918,7 +30921,7 @@
|
|
|
30918
30921
|
width: dragHandleWidth,
|
|
30919
30922
|
left: leftPosition || (document.dir === 'rtl' ? 0 : 'auto')
|
|
30920
30923
|
},
|
|
30921
|
-
className: classnames("".concat(iotPrefix$
|
|
30924
|
+
className: classnames("".concat(iotPrefix$6, "--column-resize-handle"), defineProperty$3({}, "".concat(iotPrefix$6, "--column-resize-handle--dragging"), columnIsBeingResized))
|
|
30922
30925
|
})
|
|
30923
30926
|
);
|
|
30924
30927
|
});
|
|
@@ -30987,7 +30990,7 @@
|
|
|
30987
30990
|
function ownKeys$7(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; }
|
|
30988
30991
|
|
|
30989
30992
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
30990
|
-
var iotPrefix$
|
|
30993
|
+
var iotPrefix$7 = settings.iotPrefix;
|
|
30991
30994
|
var CarbonTableHead = carbonComponentsReact.DataTable.TableHead,
|
|
30992
30995
|
TableRow$3 = carbonComponentsReact.DataTable.TableRow,
|
|
30993
30996
|
TableExpandHeader = carbonComponentsReact.DataTable.TableExpandHeader;
|
|
@@ -31236,9 +31239,9 @@
|
|
|
31236
31239
|
onMouseMove: hasResize ? forwardMouseEvent : null,
|
|
31237
31240
|
onMouseUp: hasResize ? forwardMouseEvent : null
|
|
31238
31241
|
}, /*#__PURE__*/React__default.createElement(TableRow$3, null, hasRowExpansion ? /*#__PURE__*/React__default.createElement(TableExpandHeader, {
|
|
31239
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
31242
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$7, "--table-expand-resize"), hasResize))
|
|
31240
31243
|
}) : null, hasRowSelection === 'multi' ? /*#__PURE__*/React__default.createElement(TableHeader$2, {
|
|
31241
|
-
className: classnames("".concat(iotPrefix$
|
|
31244
|
+
className: classnames("".concat(iotPrefix$7, "--table-header-checkbox"), defineProperty$3({}, "".concat(iotPrefix$7, "--table-header-checkbox-resize"), hasResize)),
|
|
31242
31245
|
translateWithId: function translateWithId() {
|
|
31243
31246
|
return tableTranslateWithId.apply(void 0, arguments);
|
|
31244
31247
|
}
|
|
@@ -31285,7 +31288,7 @@
|
|
|
31285
31288
|
align: align,
|
|
31286
31289
|
className: classnames("table-header-label-".concat(align), defineProperty$3({
|
|
31287
31290
|
'table-header-sortable': matchingColumnMeta.isSortable
|
|
31288
|
-
}, "".concat(iotPrefix$
|
|
31291
|
+
}, "".concat(iotPrefix$7, "--table-header-resize"), hasResize))
|
|
31289
31292
|
}, /*#__PURE__*/React__default.createElement(TableCellRenderer, {
|
|
31290
31293
|
wrapText: wrapCellText,
|
|
31291
31294
|
truncateCellText: truncateCellText,
|
|
@@ -31298,7 +31301,7 @@
|
|
|
31298
31301
|
ordering: ordering
|
|
31299
31302
|
}) : null) : null;
|
|
31300
31303
|
}), options.hasRowActions ? /*#__PURE__*/React__default.createElement(TableHeader$2, {
|
|
31301
|
-
className: classnames("".concat(iotPrefix$
|
|
31304
|
+
className: classnames("".concat(iotPrefix$7, "--table-header-row-action-column"), defineProperty$3({}, "".concat(iotPrefix$7, "--table-header-row-action-column--extra-wide"), hasSingleRowEdit))
|
|
31302
31305
|
}) : null), filterBarActive && /*#__PURE__*/React__default.createElement(FilterHeaderRow, {
|
|
31303
31306
|
key: !hasFastFilter && JSON.stringify(filters),
|
|
31304
31307
|
columns: columns.map(function (column) {
|
|
@@ -31686,7 +31689,7 @@
|
|
|
31686
31689
|
});
|
|
31687
31690
|
}
|
|
31688
31691
|
|
|
31689
|
-
var iotPrefix$
|
|
31692
|
+
var iotPrefix$8 = settings.iotPrefix,
|
|
31690
31693
|
prefix$2 = settings.prefix;
|
|
31691
31694
|
var propTypes$7 = {
|
|
31692
31695
|
onClick: PropTypes.func.isRequired,
|
|
@@ -31718,7 +31721,7 @@
|
|
|
31718
31721
|
rest = objectWithoutProperties$1(_ref, ["onClick", "testId", "className", "description", "isActive"]);
|
|
31719
31722
|
|
|
31720
31723
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, _extends_1({}, rest, {
|
|
31721
|
-
className: classnames("".concat(prefix$2, "--btn--icon-only"), "".concat(iotPrefix$
|
|
31724
|
+
className: classnames("".concat(prefix$2, "--btn--icon-only"), "".concat(iotPrefix$8, "--tooltip-svg-wrapper"), className, defineProperty$3({}, "".concat(iotPrefix$8, "--table-toolbar-button-active"), isActive)),
|
|
31722
31725
|
kind: "ghost",
|
|
31723
31726
|
onClick: onClick,
|
|
31724
31727
|
title: description,
|
|
@@ -31790,7 +31793,7 @@
|
|
|
31790
31793
|
function ownKeys$8(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; }
|
|
31791
31794
|
|
|
31792
31795
|
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31793
|
-
var iotPrefix$
|
|
31796
|
+
var iotPrefix$9 = settings.iotPrefix;
|
|
31794
31797
|
var CarbonTableToolbar = carbonComponentsReact.DataTable.TableToolbar,
|
|
31795
31798
|
TableToolbarContent = carbonComponentsReact.DataTable.TableToolbarContent,
|
|
31796
31799
|
TableToolbarSearch = carbonComponentsReact.DataTable.TableToolbarSearch,
|
|
@@ -31915,9 +31918,9 @@
|
|
|
31915
31918
|
totalItemsCount = _ref$tableState.totalItemsCount,
|
|
31916
31919
|
rowEditBarButtons = _ref$tableState.rowEditBarButtons;
|
|
31917
31920
|
return /*#__PURE__*/React__default.createElement(CarbonTableToolbar, {
|
|
31918
|
-
className: classnames("".concat(iotPrefix$
|
|
31921
|
+
className: classnames("".concat(iotPrefix$9, "--table-toolbar"), className)
|
|
31919
31922
|
}, /*#__PURE__*/React__default.createElement(TableBatchActions, {
|
|
31920
|
-
className: "".concat(iotPrefix$
|
|
31923
|
+
className: "".concat(iotPrefix$9, "--table-batch-actions"),
|
|
31921
31924
|
onCancel: onCancelBatchAction,
|
|
31922
31925
|
shouldShowBatchActions: hasRowSelection === 'multi' && totalSelected > 0,
|
|
31923
31926
|
totalSelected: totalSelected,
|
|
@@ -31943,23 +31946,23 @@
|
|
|
31943
31946
|
/*#__PURE__*/
|
|
31944
31947
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
|
|
31945
31948
|
React__default.createElement("label", {
|
|
31946
|
-
className: "".concat(iotPrefix$
|
|
31949
|
+
className: "".concat(iotPrefix$9, "--table-toolbar-secondary-title")
|
|
31947
31950
|
}, secondaryTitle) : null, // Deprecated in favor of secondaryTitle for a more general use-case
|
|
31948
31951
|
hasRowCountInHeader ?
|
|
31949
31952
|
/*#__PURE__*/
|
|
31950
31953
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
|
|
31951
31954
|
React__default.createElement("label", {
|
|
31952
|
-
className: "".concat(iotPrefix$
|
|
31955
|
+
className: "".concat(iotPrefix$9, "--table-toolbar-secondary-title")
|
|
31953
31956
|
}, i18n.rowCountInHeader(totalItemsCount)) : null, tooltip && /*#__PURE__*/React__default.createElement("div", {
|
|
31954
|
-
className: "".concat(iotPrefix$
|
|
31957
|
+
className: "".concat(iotPrefix$9, "--table-tooltip-container")
|
|
31955
31958
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tooltip, {
|
|
31956
31959
|
triggerId: "card-tooltip-trigger-".concat(tableId),
|
|
31957
31960
|
tooltipId: "card-tooltip-".concat(tableId),
|
|
31958
31961
|
triggerText: ""
|
|
31959
31962
|
}, tooltip)), activeBar === 'rowEdit' ? /*#__PURE__*/React__default.createElement("div", {
|
|
31960
|
-
className: "".concat(iotPrefix$
|
|
31963
|
+
className: "".concat(iotPrefix$9, "--table-row-edit-actions")
|
|
31961
31964
|
}, rowEditBarButtons) : /*#__PURE__*/React__default.createElement(TableToolbarContent, {
|
|
31962
|
-
className: "".concat(iotPrefix$
|
|
31965
|
+
className: "".concat(iotPrefix$9, "--table-toolbar-content")
|
|
31963
31966
|
}, hasSearch ? /*#__PURE__*/React__default.createElement(TableToolbarSearch, _extends_1({}, search, {
|
|
31964
31967
|
defaultValue: search.defaultValue || search.value,
|
|
31965
31968
|
className: "table-toolbar-search",
|
|
@@ -33329,7 +33332,7 @@
|
|
|
33329
33332
|
return data;
|
|
33330
33333
|
}
|
|
33331
33334
|
var TableCell$2 = carbonComponentsReact.DataTable.TableCell;
|
|
33332
|
-
var iotPrefix$
|
|
33335
|
+
var iotPrefix$a = settings.iotPrefix;
|
|
33333
33336
|
var StyledTableCell = styled(TableCell$2)(_templateObject$8());
|
|
33334
33337
|
var RowActionsContainer = styled.div(_templateObject2$4());
|
|
33335
33338
|
var OverflowMenuContent = styled.div(_templateObject3$3());
|
|
@@ -33516,9 +33519,9 @@
|
|
|
33516
33519
|
key: "".concat(id, "-row-actions-cell")
|
|
33517
33520
|
}, /*#__PURE__*/React__default.createElement(RowActionsContainer, {
|
|
33518
33521
|
isRowExpanded: isRowExpanded,
|
|
33519
|
-
className: "".concat(iotPrefix$
|
|
33522
|
+
className: "".concat(iotPrefix$a, "--row-actions-container")
|
|
33520
33523
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
33521
|
-
className: classnames("".concat(iotPrefix$
|
|
33524
|
+
className: classnames("".concat(iotPrefix$a, "--row-actions-container__background"), defineProperty$3({}, "".concat(iotPrefix$a, "--row-actions-container__background--overflow-menu-open"), isOpen))
|
|
33522
33525
|
}, rowActionsError ? /*#__PURE__*/React__default.createElement(RowActionsError, {
|
|
33523
33526
|
actionFailedText: actionFailedText,
|
|
33524
33527
|
learnMoreText: learnMoreText,
|
|
@@ -33565,7 +33568,7 @@
|
|
|
33565
33568
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.OverflowMenuItem // We need to focus a MenuItem for the keyboard navigation to work
|
|
33566
33569
|
, {
|
|
33567
33570
|
primaryFocus: actionIndex === firstSelectableItemIndex,
|
|
33568
|
-
className: "".concat(iotPrefix$
|
|
33571
|
+
className: "".concat(iotPrefix$a, "--action-overflow-item"),
|
|
33569
33572
|
key: "".concat(id, "-row-actions-button-").concat(action.id),
|
|
33570
33573
|
onClick: function onClick(e) {
|
|
33571
33574
|
return _onClick(e, id, action.id, onApplyRowAction);
|
|
@@ -33839,7 +33842,7 @@
|
|
|
33839
33842
|
TableExpandRow = carbonComponentsReact.DataTable.TableExpandRow,
|
|
33840
33843
|
TableCell$3 = carbonComponentsReact.DataTable.TableCell;
|
|
33841
33844
|
var prefix$3 = settings.prefix,
|
|
33842
|
-
iotPrefix$
|
|
33845
|
+
iotPrefix$b = settings.iotPrefix;
|
|
33843
33846
|
var propTypes$c = {
|
|
33844
33847
|
/** What column ordering is currently applied to the table */
|
|
33845
33848
|
ordering: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -34093,7 +34096,7 @@
|
|
|
34093
34096
|
"data-offset": offset,
|
|
34094
34097
|
offset: offset,
|
|
34095
34098
|
align: align,
|
|
34096
|
-
className: classnames("data-table-".concat(align), defineProperty$3({}, "".concat(iotPrefix$
|
|
34099
|
+
className: classnames("data-table-".concat(align), defineProperty$3({}, "".concat(iotPrefix$b, "--table__cell--truncate"), truncateCellText)),
|
|
34097
34100
|
width: initialColumnWidth
|
|
34098
34101
|
}, /*#__PURE__*/React__default.createElement(StyledNestedSpan, {
|
|
34099
34102
|
nestingOffset: offset
|
|
@@ -34159,12 +34162,12 @@
|
|
|
34159
34162
|
}
|
|
34160
34163
|
}
|
|
34161
34164
|
}, tableCells), !hasRowNesting && /*#__PURE__*/React__default.createElement(StyledExpansionTableRow, {
|
|
34162
|
-
className: "".concat(iotPrefix$
|
|
34165
|
+
className: "".concat(iotPrefix$b, "--expanded-tablerow")
|
|
34163
34166
|
}, /*#__PURE__*/React__default.createElement(TableCell$3, {
|
|
34164
34167
|
colSpan: totalColumns
|
|
34165
34168
|
}, rowDetails))) : /*#__PURE__*/React__default.createElement(StyledTableExpandRow, {
|
|
34166
34169
|
key: id,
|
|
34167
|
-
className: "".concat(iotPrefix$
|
|
34170
|
+
className: "".concat(iotPrefix$b, "--expanded-tablerow"),
|
|
34168
34171
|
"data-row-nesting": hasRowNesting,
|
|
34169
34172
|
"data-child-count": nestingChildCount,
|
|
34170
34173
|
"data-nesting-offset": nestingOffset,
|
|
@@ -35124,7 +35127,7 @@
|
|
|
35124
35127
|
}
|
|
35125
35128
|
};
|
|
35126
35129
|
|
|
35127
|
-
var iotPrefix$
|
|
35130
|
+
var iotPrefix$c = settings.iotPrefix;
|
|
35128
35131
|
/**
|
|
35129
35132
|
* This pagination component hides the items per page selection dropdown if the isItemsPerPageHidden bit is true.
|
|
35130
35133
|
* It also hides the Items per page and x of x items text if the total width of the pagination bar is less than 500 px
|
|
@@ -35144,7 +35147,7 @@
|
|
|
35144
35147
|
|
|
35145
35148
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.Pagination, _extends_1({}, rest, {
|
|
35146
35149
|
disabled: preventInteraction || disabled,
|
|
35147
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
35150
|
+
className: classnames(className, "".concat(iotPrefix$c, "--pagination"), (_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$c, "--pagination--hide-page"), isItemPerPageHidden), defineProperty$3(_classnames, "".concat(iotPrefix$c, "--pagination--hide-select"), preventInteraction), _classnames)),
|
|
35148
35151
|
style: {
|
|
35149
35152
|
'--pagination-text-display': (size === null || size === void 0 ? void 0 : size.width) && (size === null || size === void 0 ? void 0 : size.width) < 500 ? 'none' : 'flex'
|
|
35150
35153
|
}
|
|
@@ -35164,7 +35167,7 @@
|
|
|
35164
35167
|
function ownKeys$a(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; }
|
|
35165
35168
|
|
|
35166
35169
|
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35167
|
-
var iotPrefix$
|
|
35170
|
+
var iotPrefix$d = settings.iotPrefix;
|
|
35168
35171
|
var propTypes$e = {
|
|
35169
35172
|
/** DOM ID for component */
|
|
35170
35173
|
id: PropTypes.string,
|
|
@@ -35538,7 +35541,7 @@
|
|
|
35538
35541
|
});
|
|
35539
35542
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.TableContainer, {
|
|
35540
35543
|
style: style,
|
|
35541
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
35544
|
+
className: classnames(className, "".concat(iotPrefix$d, "--table-container"))
|
|
35542
35545
|
},
|
|
35543
35546
|
/* If there is no items being rendered in the toolbar, don't render the toolbar */
|
|
35544
35547
|
options.hasFilter || options.hasSearch || options.hasRowActions || options.hasRowCountInHeader || options.hasColumnSelection || options.hasRowEdit || actions.toolbar.onDownloadCSV || secondaryTitle || view.toolbar.customToolbarContent || tooltip ? /*#__PURE__*/React__default.createElement(TableToolbar, {
|
|
@@ -35574,7 +35577,7 @@
|
|
|
35574
35577
|
}) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
35575
35578
|
className: "addons-iot-table-container"
|
|
35576
35579
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Table, _extends_1({
|
|
35577
|
-
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$
|
|
35580
|
+
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$d, "--data-table--resize"), options.hasResize), defineProperty$3(_classnames, "".concat(iotPrefix$d, "--data-table--fixed"), options.hasResize && !options.useAutoTableLayoutForResize), defineProperty$3(_classnames, "".concat(iotPrefix$d, "--data-table--row-actions"), options.hasRowActions), _classnames))
|
|
35578
35581
|
}, others), /*#__PURE__*/React__default.createElement(TableHead, _extends_1({}, others, {
|
|
35579
35582
|
i18n: i18n,
|
|
35580
35583
|
lightweight: lightweight,
|
|
@@ -36202,7 +36205,7 @@
|
|
|
36202
36205
|
});
|
|
36203
36206
|
|
|
36204
36207
|
var prefix$4 = settings.prefix,
|
|
36205
|
-
iotPrefix$
|
|
36208
|
+
iotPrefix$e = settings.iotPrefix;
|
|
36206
36209
|
var propTypes$f = {
|
|
36207
36210
|
/** Disables the form elements when true */
|
|
36208
36211
|
disabled: PropTypes.bool,
|
|
@@ -36300,7 +36303,7 @@
|
|
|
36300
36303
|
},
|
|
36301
36304
|
type: "text"
|
|
36302
36305
|
}, overrides === null || overrides === void 0 ? void 0 : (_overrides$titleTextI2 = overrides.titleTextInput) === null || _overrides$titleTextI2 === void 0 ? void 0 : _overrides$titleTextI2.props)), /*#__PURE__*/React__default.createElement(MyViewDescriptionContainer, _extends_1({
|
|
36303
|
-
className: "".concat(iotPrefix$
|
|
36306
|
+
className: "".concat(iotPrefix$e, "--save-view-modal__view-description") // eslint-disable-next-line react/no-children-prop
|
|
36304
36307
|
,
|
|
36305
36308
|
children: viewDescription
|
|
36306
36309
|
}, overrides === null || overrides === void 0 ? void 0 : (_overrides$viewDescri2 = overrides.viewDescriptionContainer) === null || _overrides$viewDescri2 === void 0 ? void 0 : _overrides$viewDescri2.props)), /*#__PURE__*/React__default.createElement("fieldset", {
|
|
@@ -36317,7 +36320,7 @@
|
|
|
36317
36320
|
isDefault: checked
|
|
36318
36321
|
});
|
|
36319
36322
|
},
|
|
36320
|
-
wrapperClassName: "".concat(iotPrefix$
|
|
36323
|
+
wrapperClassName: "".concat(iotPrefix$e, "--save-view-modal__default-view-checkbox")
|
|
36321
36324
|
}, overrides === null || overrides === void 0 ? void 0 : (_overrides$defaultChe2 = overrides.defaultCheckbox) === null || _overrides$defaultChe2 === void 0 ? void 0 : _overrides$defaultChe2.props)), /*#__PURE__*/React__default.createElement(MyPublicCheckbox, _extends_1({
|
|
36322
36325
|
name: "isPublic",
|
|
36323
36326
|
"data-testid": "".concat(testID, "-public-checkbox"),
|
|
@@ -36325,7 +36328,7 @@
|
|
|
36325
36328
|
disabled: disabled,
|
|
36326
36329
|
id: "save-view-modal-public-checkbox-label",
|
|
36327
36330
|
labelText: publicCheckboxLabelText,
|
|
36328
|
-
wrapperClassName: "".concat(iotPrefix$
|
|
36331
|
+
wrapperClassName: "".concat(iotPrefix$e, "--save-view-modal__public-checkbox"),
|
|
36329
36332
|
onChange: function onChange(checked) {
|
|
36330
36333
|
return _onChange({
|
|
36331
36334
|
isPublic: checked
|
|
@@ -36496,7 +36499,7 @@
|
|
|
36496
36499
|
function ownKeys$b(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; }
|
|
36497
36500
|
|
|
36498
36501
|
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
36499
|
-
var iotPrefix$
|
|
36502
|
+
var iotPrefix$f = settings.iotPrefix;
|
|
36500
36503
|
var propTypes$g = {
|
|
36501
36504
|
/**
|
|
36502
36505
|
* Callbacks for the actions of the modal
|
|
@@ -36653,7 +36656,7 @@
|
|
|
36653
36656
|
sendingData: sendingData,
|
|
36654
36657
|
selectorPrimaryFocus: "#".concat(primaryInputId)
|
|
36655
36658
|
}, overrides === null || overrides === void 0 ? void 0 : (_overrides$composedMo2 = overrides.composedModal) === null || _overrides$composedMo2 === void 0 ? void 0 : _overrides$composedMo2.props), /*#__PURE__*/React__default.createElement("p", {
|
|
36656
|
-
className: "".concat(iotPrefix$
|
|
36659
|
+
className: "".concat(iotPrefix$f, "--save-view-modal__body-text")
|
|
36657
36660
|
}, modalBodyText), /*#__PURE__*/React__default.createElement(MyTableSaveViewForm, _extends_1({
|
|
36658
36661
|
viewDescription: viewDescription,
|
|
36659
36662
|
titleInputInvalid: titleInputInvalid,
|
|
@@ -36897,7 +36900,7 @@
|
|
|
36897
36900
|
return data;
|
|
36898
36901
|
}
|
|
36899
36902
|
var prefix$5 = settings.prefix,
|
|
36900
|
-
iotPrefix$
|
|
36903
|
+
iotPrefix$g = settings.iotPrefix;
|
|
36901
36904
|
var IDPropTypes = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
|
36902
36905
|
var propTypes$h = {
|
|
36903
36906
|
/** array of item objects with id and labels */
|
|
@@ -36983,7 +36986,7 @@
|
|
|
36983
36986
|
|
|
36984
36987
|
var currentStep = matchingIndex > -1 ? matchingIndex : 0;
|
|
36985
36988
|
return /*#__PURE__*/React__default.createElement(StyledProgressIndicator, {
|
|
36986
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
36989
|
+
className: classnames(className, "".concat(iotPrefix$g, "--progress-indicator")),
|
|
36987
36990
|
onChange: handleChange,
|
|
36988
36991
|
currentIndex: currentStep,
|
|
36989
36992
|
isVerticalMode: isVerticalMode,
|
|
@@ -37282,7 +37285,7 @@
|
|
|
37282
37285
|
}
|
|
37283
37286
|
};
|
|
37284
37287
|
|
|
37285
|
-
var iotPrefix$
|
|
37288
|
+
var iotPrefix$h = settings.iotPrefix;
|
|
37286
37289
|
/**
|
|
37287
37290
|
* Extends ComposedModal to add wizard, refer to that component for common props
|
|
37288
37291
|
*/
|
|
@@ -37384,7 +37387,7 @@
|
|
|
37384
37387
|
backLabel: previousButtonLabel || defaultFooterProps.previousButtonLabel,
|
|
37385
37388
|
submitLabel: submitButtonLabel || defaultFooterProps.submitButtonLabel,
|
|
37386
37389
|
sendingData: typeof sendingData === 'boolean' && sendingData || typeof sendingData === 'string',
|
|
37387
|
-
className: "".concat(iotPrefix$
|
|
37390
|
+
className: "".concat(iotPrefix$h, "--wizard-modal__footer")
|
|
37388
37391
|
});
|
|
37389
37392
|
});
|
|
37390
37393
|
|
|
@@ -37409,14 +37412,14 @@
|
|
|
37409
37412
|
});
|
|
37410
37413
|
var stepIndex = this.state.step;
|
|
37411
37414
|
return /*#__PURE__*/React__default.createElement(ComposedModal, _extends_1({}, other, {
|
|
37412
|
-
className: classnames("".concat(iotPrefix$
|
|
37415
|
+
className: classnames("".concat(iotPrefix$h, "--wizard-modal"), className),
|
|
37413
37416
|
footer: this.renderFooter()
|
|
37414
37417
|
}), /*#__PURE__*/React__default.createElement(ProgressIndicator, {
|
|
37415
37418
|
items: items,
|
|
37416
37419
|
currentItemId: !isNil_1(stepIndex) ? items[stepIndex] && items[stepIndex].id : undefined,
|
|
37417
37420
|
onClickItem: this.handleClick
|
|
37418
37421
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
37419
|
-
className: "".concat(iotPrefix$
|
|
37422
|
+
className: "".concat(iotPrefix$h, "--wizard-modal__content")
|
|
37420
37423
|
}, steps[stepIndex].content));
|
|
37421
37424
|
}
|
|
37422
37425
|
}]);
|
|
@@ -42195,7 +42198,7 @@
|
|
|
42195
42198
|
"displayName": "StatefulTable"
|
|
42196
42199
|
};
|
|
42197
42200
|
|
|
42198
|
-
var iotPrefix$
|
|
42201
|
+
var iotPrefix$i = settings.iotPrefix;
|
|
42199
42202
|
var SimplePaginationPropTypes = {
|
|
42200
42203
|
/** current page number */
|
|
42201
42204
|
page: PropTypes.number.isRequired,
|
|
@@ -42248,12 +42251,12 @@
|
|
|
42248
42251
|
};
|
|
42249
42252
|
|
|
42250
42253
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
42251
|
-
className: "".concat(iotPrefix$
|
|
42254
|
+
className: "".concat(iotPrefix$i, "-simple-pagination-container")
|
|
42252
42255
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
42253
|
-
className: "".concat(iotPrefix$
|
|
42256
|
+
className: "".concat(iotPrefix$i, "-simple-pagination-page-label"),
|
|
42254
42257
|
maxpage: maxPage
|
|
42255
42258
|
}, pageText ? "".concat(pageText, " ").concat(page) : pageOfPagesText(page, maxPage)), maxPage > 1 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
42256
|
-
className: hasPrev ? "bx--pagination__button bx--pagination__button--backward ".concat(iotPrefix$
|
|
42259
|
+
className: hasPrev ? "bx--pagination__button bx--pagination__button--backward ".concat(iotPrefix$i, "-addons-simple-pagination-button") : "bx--pagination__button bx--pagination__button--backward ".concat(iotPrefix$i, "-addons-simple-pagination-button-disabled"),
|
|
42257
42260
|
role: "button",
|
|
42258
42261
|
tabIndex: hasPrev ? 0 : -1,
|
|
42259
42262
|
onClick: hasPrev ? handlePrev : undefined,
|
|
@@ -42262,9 +42265,9 @@
|
|
|
42262
42265
|
} : undefined
|
|
42263
42266
|
}, /*#__PURE__*/React__default.createElement(iconsReact.CaretLeft16, {
|
|
42264
42267
|
description: prevPageText,
|
|
42265
|
-
className: hasPrev ? "".concat(iotPrefix$
|
|
42268
|
+
className: hasPrev ? "".concat(iotPrefix$i, "-simple-pagination-caret") : "".concat(iotPrefix$i, "-simple-pagination-caret-disabled")
|
|
42266
42269
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
42267
|
-
className: hasNext ? "bx--pagination__button bx--pagination__button--forward ".concat(iotPrefix$
|
|
42270
|
+
className: hasNext ? "bx--pagination__button bx--pagination__button--forward ".concat(iotPrefix$i, "-addons-simple-pagination-button") : "bx--pagination__button bx--pagination__button--forward ".concat(iotPrefix$i, "-addons-simple-pagination-button-disabled"),
|
|
42268
42271
|
role: "button",
|
|
42269
42272
|
tabIndex: hasNext ? 0 : -1,
|
|
42270
42273
|
onClick: hasNext ? handleNext : undefined,
|
|
@@ -42273,7 +42276,7 @@
|
|
|
42273
42276
|
} : undefined
|
|
42274
42277
|
}, /*#__PURE__*/React__default.createElement(iconsReact.CaretRight16, {
|
|
42275
42278
|
description: nextPageText,
|
|
42276
|
-
className: hasNext ? "".concat(iotPrefix$
|
|
42279
|
+
className: hasNext ? "".concat(iotPrefix$i, "-simple-pagination-caret") : "".concat(iotPrefix$i, "-simple-pagination-caret-disabled")
|
|
42277
42280
|
}))) : null);
|
|
42278
42281
|
};
|
|
42279
42282
|
|
|
@@ -42352,7 +42355,7 @@
|
|
|
42352
42355
|
}
|
|
42353
42356
|
};
|
|
42354
42357
|
|
|
42355
|
-
var iotPrefix$
|
|
42358
|
+
var iotPrefix$j = settings.iotPrefix;
|
|
42356
42359
|
var propTypes$l = {
|
|
42357
42360
|
tiles: PropTypes.arrayOf(PropTypes.node)
|
|
42358
42361
|
};
|
|
@@ -42365,9 +42368,9 @@
|
|
|
42365
42368
|
var tiles = _ref.tiles,
|
|
42366
42369
|
className = _ref.className;
|
|
42367
42370
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
42368
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
42371
|
+
className: classnames(className, "".concat(iotPrefix$j, "--tile-group"))
|
|
42369
42372
|
}, tiles, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tile, {
|
|
42370
|
-
className: "".concat(iotPrefix$
|
|
42373
|
+
className: "".concat(iotPrefix$j, "--greedy-tile")
|
|
42371
42374
|
}));
|
|
42372
42375
|
};
|
|
42373
42376
|
|
|
@@ -42395,7 +42398,7 @@
|
|
|
42395
42398
|
}
|
|
42396
42399
|
};
|
|
42397
42400
|
|
|
42398
|
-
var iotPrefix$
|
|
42401
|
+
var iotPrefix$k = settings.iotPrefix;
|
|
42399
42402
|
var TableToolbarSearch$1 = carbonComponentsReact.DataTable.TableToolbarSearch;
|
|
42400
42403
|
var propTypes$m = {
|
|
42401
42404
|
/** Is the data actively loading? */
|
|
@@ -42481,9 +42484,9 @@
|
|
|
42481
42484
|
var pageSize = pagination && pagination.pageSize ? pagination.pageSize : 10;
|
|
42482
42485
|
var totalTiles = pagination && pagination.totalItems ? pagination.totalItems : 10;
|
|
42483
42486
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
42484
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
42487
|
+
className: classnames(className, "".concat(iotPrefix$k, "--tile-catalog"))
|
|
42485
42488
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
42486
|
-
className: "".concat(iotPrefix$
|
|
42489
|
+
className: "".concat(iotPrefix$k, "--tile-catalog--header")
|
|
42487
42490
|
}, search && search.placeHolderText ? /*#__PURE__*/React__default.createElement(TableToolbarSearch$1, {
|
|
42488
42491
|
size: "sm",
|
|
42489
42492
|
value: searchState,
|
|
@@ -42497,7 +42500,7 @@
|
|
|
42497
42500
|
React__default.createElement(TileGroup, {
|
|
42498
42501
|
tiles: toConsumableArray(Array(pageSize)).map(function (val, index) {
|
|
42499
42502
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tile, {
|
|
42500
|
-
className: "".concat(iotPrefix$
|
|
42503
|
+
className: "".concat(iotPrefix$k, "--tile-catalog--empty-tile"),
|
|
42501
42504
|
key: "emptytile-".concat(index)
|
|
42502
42505
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.SkeletonText, null));
|
|
42503
42506
|
}),
|
|
@@ -42518,7 +42521,7 @@
|
|
|
42518
42521
|
}) : tile.value);
|
|
42519
42522
|
})
|
|
42520
42523
|
}) : /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tile, {
|
|
42521
|
-
className: "".concat(iotPrefix$
|
|
42524
|
+
className: "".concat(iotPrefix$k, "--tile-catalog--empty-tile")
|
|
42522
42525
|
}, error || /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iconsReact.Bee32, null), /*#__PURE__*/React__default.createElement("p", null, search && search.noMatchesFoundText || 'No matches found'))), !isLoading && tiles.length > 0 && !error && pagination ? /*#__PURE__*/React__default.createElement(SimplePagination, _extends_1({}, pagination, {
|
|
42523
42526
|
maxPage: Math.ceil(totalTiles / pageSize)
|
|
42524
42527
|
})) : null);
|
|
@@ -42987,7 +42990,7 @@
|
|
|
42987
42990
|
"composes": ["./TileCatalog"]
|
|
42988
42991
|
};
|
|
42989
42992
|
|
|
42990
|
-
var iotPrefix$
|
|
42993
|
+
var iotPrefix$l = settings.iotPrefix;
|
|
42991
42994
|
var propTypes$n = {
|
|
42992
42995
|
/** optional icon to visually describe catalog item */
|
|
42993
42996
|
icon: PropTypes.node,
|
|
@@ -43005,17 +43008,17 @@
|
|
|
43005
43008
|
title = _ref.title,
|
|
43006
43009
|
description = _ref.description;
|
|
43007
43010
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
43008
|
-
className: "".concat(iotPrefix$
|
|
43011
|
+
className: "".concat(iotPrefix$l, "--sample-tile")
|
|
43009
43012
|
}, icon ? /*#__PURE__*/React__default.createElement("div", {
|
|
43010
|
-
className: "".concat(iotPrefix$
|
|
43013
|
+
className: "".concat(iotPrefix$l, "--sample-tile-icon")
|
|
43011
43014
|
}, icon) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
43012
|
-
className: "".concat(iotPrefix$
|
|
43015
|
+
className: "".concat(iotPrefix$l, "--sample-tile-contents")
|
|
43013
43016
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
43014
|
-
className: "".concat(iotPrefix$
|
|
43017
|
+
className: "".concat(iotPrefix$l, "--sample-tile-title")
|
|
43015
43018
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
43016
43019
|
title: title
|
|
43017
43020
|
}, title)), /*#__PURE__*/React__default.createElement("div", {
|
|
43018
|
-
className: "".concat(iotPrefix$
|
|
43021
|
+
className: "".concat(iotPrefix$l, "--sample-tile-description")
|
|
43019
43022
|
}, description)));
|
|
43020
43023
|
};
|
|
43021
43024
|
|
|
@@ -44334,7 +44337,7 @@
|
|
|
44334
44337
|
}
|
|
44335
44338
|
};
|
|
44336
44339
|
|
|
44337
|
-
var iotPrefix$
|
|
44340
|
+
var iotPrefix$m = settings.iotPrefix; // internal component
|
|
44338
44341
|
|
|
44339
44342
|
var ListItemWrapper = function ListItemWrapper(_ref) {
|
|
44340
44343
|
var id = _ref.id,
|
|
@@ -44346,7 +44349,7 @@
|
|
|
44346
44349
|
return isSelectable ? /*#__PURE__*/React__default.createElement("div", {
|
|
44347
44350
|
role: "button",
|
|
44348
44351
|
tabIndex: 0,
|
|
44349
|
-
className: classnames("".concat(iotPrefix$
|
|
44352
|
+
className: classnames("".concat(iotPrefix$m, "--list-item"), "".concat(iotPrefix$m, "--list-item__selectable"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item__selected"), selected), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item__large"), isLargeRow)),
|
|
44350
44353
|
onKeyPress: function onKeyPress(_ref2) {
|
|
44351
44354
|
var key = _ref2.key;
|
|
44352
44355
|
return key === 'Enter' && onSelect(id);
|
|
@@ -44355,7 +44358,7 @@
|
|
|
44355
44358
|
onSelect(id);
|
|
44356
44359
|
}
|
|
44357
44360
|
}, children) : /*#__PURE__*/React__default.createElement("div", {
|
|
44358
|
-
className: classnames("".concat(iotPrefix$
|
|
44361
|
+
className: classnames("".concat(iotPrefix$m, "--list-item"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item__large"), isLargeRow))
|
|
44359
44362
|
}, children);
|
|
44360
44363
|
};
|
|
44361
44364
|
|
|
@@ -44446,7 +44449,7 @@
|
|
|
44446
44449
|
|
|
44447
44450
|
var renderNestingOffset = function renderNestingOffset() {
|
|
44448
44451
|
return nestingLevel > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
44449
|
-
className: "".concat(iotPrefix$
|
|
44452
|
+
className: "".concat(iotPrefix$m, "--list-item--nesting-offset"),
|
|
44450
44453
|
style: {
|
|
44451
44454
|
width: "".concat(nestingLevel * 30, "px")
|
|
44452
44455
|
}
|
|
@@ -44457,7 +44460,7 @@
|
|
|
44457
44460
|
return isExpandable ? /*#__PURE__*/React__default.createElement("div", {
|
|
44458
44461
|
role: "button",
|
|
44459
44462
|
tabIndex: 0,
|
|
44460
|
-
className: "".concat(iotPrefix$
|
|
44463
|
+
className: "".concat(iotPrefix$m, "--list-item--expand-icon"),
|
|
44461
44464
|
onClick: handleExpansionClick,
|
|
44462
44465
|
onKeyPress: function onKeyPress(_ref4) {
|
|
44463
44466
|
var key = _ref4.key;
|
|
@@ -44472,13 +44475,13 @@
|
|
|
44472
44475
|
|
|
44473
44476
|
var renderIcon = function renderIcon() {
|
|
44474
44477
|
return icon ? /*#__PURE__*/React__default.createElement("div", {
|
|
44475
|
-
className: "".concat(iotPrefix$
|
|
44478
|
+
className: "".concat(iotPrefix$m, "--list-item--content--icon ").concat(iotPrefix$m, "--list-item--content--icon__").concat(iconPosition)
|
|
44476
44479
|
}, icon) : null;
|
|
44477
44480
|
};
|
|
44478
44481
|
|
|
44479
44482
|
var renderRowActions = function renderRowActions() {
|
|
44480
44483
|
return rowActions && rowActions.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
44481
|
-
className: "".concat(iotPrefix$
|
|
44484
|
+
className: "".concat(iotPrefix$m, "--list-item--content--row-actions")
|
|
44482
44485
|
}, rowActions) : null;
|
|
44483
44486
|
};
|
|
44484
44487
|
|
|
@@ -44489,26 +44492,26 @@
|
|
|
44489
44492
|
isLargeRow: isLargeRow,
|
|
44490
44493
|
onSelect: onSelect
|
|
44491
44494
|
}, renderNestingOffset(), renderExpander(), /*#__PURE__*/React__default.createElement("div", {
|
|
44492
|
-
className: classnames("".concat(iotPrefix$
|
|
44495
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item--content__selected"), selected), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item--content__large"), isLargeRow)),
|
|
44493
44496
|
ref: selectedItemRef
|
|
44494
44497
|
}, renderIcon(), /*#__PURE__*/React__default.createElement("div", {
|
|
44495
|
-
className: classnames("".concat(iotPrefix$
|
|
44498
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content--values"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item--content--values__large"), isLargeRow))
|
|
44496
44499
|
}, isLargeRow ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
44497
|
-
className: "".concat(iotPrefix$
|
|
44500
|
+
className: "".concat(iotPrefix$m, "--list-item--content--values--main ").concat(iotPrefix$m, "--list-item--content--values--main__large")
|
|
44498
44501
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
44499
|
-
className: classnames("".concat(iotPrefix$
|
|
44502
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content--values--value"), (_classnames7 = {}, defineProperty$3(_classnames7, "".concat(iotPrefix$m, "--list-item--category"), isCategory), defineProperty$3(_classnames7, "".concat(iotPrefix$m, "--list-item--content--values--value__with-actions"), !isEmpty_1(rowActions)), _classnames7)),
|
|
44500
44503
|
title: value
|
|
44501
44504
|
}, value), renderRowActions()), secondaryValue ? /*#__PURE__*/React__default.createElement("div", {
|
|
44502
44505
|
title: secondaryValue,
|
|
44503
|
-
className: classnames("".concat(iotPrefix$
|
|
44506
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content--values--value"), "".concat(iotPrefix$m, "--list-item--content--values--value__large"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item--content--values--value__with-actions"), !isEmpty_1(rowActions)))
|
|
44504
44507
|
}, secondaryValue) : null) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
44505
|
-
className: "".concat(iotPrefix$
|
|
44508
|
+
className: "".concat(iotPrefix$m, "--list-item--content--values--main")
|
|
44506
44509
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
44507
|
-
className: classnames("".concat(iotPrefix$
|
|
44510
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content--values--value"), (_classnames9 = {}, defineProperty$3(_classnames9, "".concat(iotPrefix$m, "--list-item--category"), isCategory), defineProperty$3(_classnames9, "".concat(iotPrefix$m, "--list-item--content--values--value__with-actions"), !isEmpty_1(rowActions)), _classnames9)),
|
|
44508
44511
|
title: value
|
|
44509
44512
|
}, value), secondaryValue ? /*#__PURE__*/React__default.createElement("div", {
|
|
44510
44513
|
title: secondaryValue,
|
|
44511
|
-
className: classnames("".concat(iotPrefix$
|
|
44514
|
+
className: classnames("".concat(iotPrefix$m, "--list-item--content--values--value"), defineProperty$3({}, "".concat(iotPrefix$m, "--list-item--content--values--value__with-actions"), !isEmpty_1(rowActions)))
|
|
44512
44515
|
}, secondaryValue) : null, renderRowActions())))));
|
|
44513
44516
|
};
|
|
44514
44517
|
|
|
@@ -44727,7 +44730,7 @@
|
|
|
44727
44730
|
}
|
|
44728
44731
|
};
|
|
44729
44732
|
|
|
44730
|
-
var iotPrefix$
|
|
44733
|
+
var iotPrefix$n = settings.iotPrefix;
|
|
44731
44734
|
var propTypes$p = {
|
|
44732
44735
|
title: PropTypes.string.isRequired,
|
|
44733
44736
|
buttons: PropTypes.arrayOf(PropTypes.node),
|
|
@@ -44760,15 +44763,15 @@
|
|
|
44760
44763
|
i18n = _ref.i18n,
|
|
44761
44764
|
isLoading = _ref.isLoading;
|
|
44762
44765
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
44763
|
-
className: "".concat(iotPrefix$
|
|
44766
|
+
className: "".concat(iotPrefix$n, "--list-header-container")
|
|
44764
44767
|
}, title || buttons && buttons.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
44765
|
-
className: "".concat(iotPrefix$
|
|
44768
|
+
className: "".concat(iotPrefix$n, "--list-header")
|
|
44766
44769
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
44767
|
-
className: "".concat(iotPrefix$
|
|
44770
|
+
className: "".concat(iotPrefix$n, "--list-header--title")
|
|
44768
44771
|
}, title), /*#__PURE__*/React__default.createElement("div", {
|
|
44769
|
-
className: "".concat(iotPrefix$
|
|
44772
|
+
className: "".concat(iotPrefix$n, "--list-header--btn-container")
|
|
44770
44773
|
}, !isLoading ? buttons : null)) : null, search && !isLoading ? /*#__PURE__*/React__default.createElement("div", {
|
|
44771
|
-
className: "".concat(iotPrefix$
|
|
44774
|
+
className: "".concat(iotPrefix$n, "--list-header--search")
|
|
44772
44775
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Search, {
|
|
44773
44776
|
placeHolderText: i18n.searchPlaceHolderText,
|
|
44774
44777
|
onChange: search.onChange,
|
|
@@ -44854,7 +44857,7 @@
|
|
|
44854
44857
|
}
|
|
44855
44858
|
};
|
|
44856
44859
|
|
|
44857
|
-
var iotPrefix$
|
|
44860
|
+
var iotPrefix$o = settings.iotPrefix;
|
|
44858
44861
|
var itemPropTypes = {
|
|
44859
44862
|
id: PropTypes.string,
|
|
44860
44863
|
content: PropTypes.shape({
|
|
@@ -44999,21 +45002,21 @@
|
|
|
44999
45002
|
return renderItemAndChildren(item, 0);
|
|
45000
45003
|
});
|
|
45001
45004
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
45002
|
-
className: classnames("".concat(iotPrefix$
|
|
45005
|
+
className: classnames("".concat(iotPrefix$o, "--list"), defineProperty$3({}, "".concat(iotPrefix$o, "--list__full-height"), isFullHeight))
|
|
45003
45006
|
}, /*#__PURE__*/React__default.createElement(ListHeader, {
|
|
45004
|
-
className: "".concat(iotPrefix$
|
|
45007
|
+
className: "".concat(iotPrefix$o, "--list--header"),
|
|
45005
45008
|
title: title,
|
|
45006
45009
|
buttons: buttons,
|
|
45007
45010
|
search: search,
|
|
45008
45011
|
i18n: i18n,
|
|
45009
45012
|
isLoading: isLoading
|
|
45010
45013
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
45011
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
45014
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$o, "--list--content__full-height"), isFullHeight), "".concat(iotPrefix$o, "--list--content"))
|
|
45012
45015
|
}, !isLoading ? listItems : /*#__PURE__*/React__default.createElement(carbonComponentsReact.SkeletonText, {
|
|
45013
|
-
className: "".concat(iotPrefix$
|
|
45016
|
+
className: "".concat(iotPrefix$o, "--list--skeleton"),
|
|
45014
45017
|
width: "90%"
|
|
45015
45018
|
})), pagination && !isLoading ? /*#__PURE__*/React__default.createElement("div", {
|
|
45016
|
-
className: "".concat(iotPrefix$
|
|
45019
|
+
className: "".concat(iotPrefix$o, "--list--page")
|
|
45017
45020
|
}, /*#__PURE__*/React__default.createElement(SimplePagination, pagination)) : null);
|
|
45018
45021
|
});
|
|
45019
45022
|
List.propTypes = propTypes$q;
|
|
@@ -85940,7 +85943,7 @@
|
|
|
85940
85943
|
return "".concat(renderValue).concat(!isNil_1(unit) ? " ".concat(unit) : '');
|
|
85941
85944
|
};
|
|
85942
85945
|
|
|
85943
|
-
var iotPrefix$
|
|
85946
|
+
var iotPrefix$p = settings.iotPrefix;
|
|
85944
85947
|
var CardRangePickerPropTypes = {
|
|
85945
85948
|
/** Optional range to pass at the card level */
|
|
85946
85949
|
timeRange: PropTypes.oneOf(['last24Hours', 'last7Days', 'lastMonth', 'lastQuarter', 'lastYear', 'thisWeek', 'thisMonth', 'thisQuarter', 'thisYear', '']),
|
|
@@ -85987,16 +85990,16 @@
|
|
|
85987
85990
|
setTimeRange(value);
|
|
85988
85991
|
}, [setTimeRange, onCardAction]);
|
|
85989
85992
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
85990
|
-
className: "".concat(iotPrefix$
|
|
85993
|
+
className: "".concat(iotPrefix$p, "--card--toolbar-date-range-wrapper")
|
|
85991
85994
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.ToolbarItem, null, cardWidth > 400 ? /*#__PURE__*/React__default.createElement("div", {
|
|
85992
85995
|
id: "timeRange",
|
|
85993
|
-
className: "".concat(iotPrefix$
|
|
85996
|
+
className: "".concat(iotPrefix$p, "--card--toolbar-timerange-label")
|
|
85994
85997
|
}, timeBoxLabels[timeRange] || i18n.defaultLabel) : null, /*#__PURE__*/React__default.createElement(carbonComponentsReact.OverflowMenu, {
|
|
85995
|
-
className: classnames("".concat(iotPrefix$
|
|
85998
|
+
className: classnames("".concat(iotPrefix$p, "--card--toolbar-date-range-action")),
|
|
85996
85999
|
flipped: true,
|
|
85997
86000
|
title: i18n.selectTimeRangeLabel,
|
|
85998
86001
|
iconDescription: i18n.selectTimeRangeLabel,
|
|
85999
|
-
menuOptionsClass: "".concat(iotPrefix$
|
|
86002
|
+
menuOptionsClass: "".concat(iotPrefix$p, "--card--overflow"),
|
|
86000
86003
|
renderIcon: iconsReact.EventSchedule16
|
|
86001
86004
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.OverflowMenuItem, {
|
|
86002
86005
|
key: "default",
|
|
@@ -86004,7 +86007,7 @@
|
|
|
86004
86007
|
return handleTimeRange('default');
|
|
86005
86008
|
},
|
|
86006
86009
|
itemText: i18n.defaultLabel,
|
|
86007
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
86010
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$p, "--card--overflow-menuitem-active"), timeRange === '' || isNil_1(timeRange))),
|
|
86008
86011
|
primaryFocus: true
|
|
86009
86012
|
}), Object.keys(timeBoxLabels).filter(function (i) {
|
|
86010
86013
|
return i.includes('last');
|
|
@@ -86016,7 +86019,7 @@
|
|
|
86016
86019
|
return handleTimeRange(i);
|
|
86017
86020
|
},
|
|
86018
86021
|
itemText: timeBoxLabels[i],
|
|
86019
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
86022
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$p, "--card--overflow-menuitem-active"), timeRange === i))
|
|
86020
86023
|
});
|
|
86021
86024
|
}), Object.keys(timeBoxLabels).filter(function (i) {
|
|
86022
86025
|
return i.includes('this');
|
|
@@ -86028,7 +86031,7 @@
|
|
|
86028
86031
|
return handleTimeRange(i);
|
|
86029
86032
|
},
|
|
86030
86033
|
itemText: timeBoxLabels[i],
|
|
86031
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
86034
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$p, "--card--overflow-menuitem-active"), timeRange === i))
|
|
86032
86035
|
});
|
|
86033
86036
|
}))));
|
|
86034
86037
|
};
|
|
@@ -86123,13 +86126,13 @@
|
|
|
86123
86126
|
function ownKeys$i(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; }
|
|
86124
86127
|
|
|
86125
86128
|
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$i(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
86126
|
-
var iotPrefix$
|
|
86129
|
+
var iotPrefix$q = settings.iotPrefix,
|
|
86127
86130
|
prefix$7 = settings.prefix;
|
|
86128
86131
|
|
|
86129
86132
|
var ToolbarSVGWrapper = function ToolbarSVGWrapper(props) {
|
|
86130
86133
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, _extends_1({
|
|
86131
86134
|
kind: "ghost",
|
|
86132
|
-
className: classnames("".concat(iotPrefix$
|
|
86135
|
+
className: classnames("".concat(iotPrefix$q, "--card--toolbar-action"), "".concat(iotPrefix$q, "--card--toolbar-svg-wrapper"), "".concat(prefix$7, "--btn--icon-only") // can't actually use the hasIconOnly prop because we don't want the tooltip
|
|
86133
86136
|
)
|
|
86134
86137
|
}, props));
|
|
86135
86138
|
};
|
|
@@ -86162,7 +86165,7 @@
|
|
|
86162
86165
|
onCardAction = _ref.onCardAction,
|
|
86163
86166
|
className = _ref.className;
|
|
86164
86167
|
return isEditable ? /*#__PURE__*/React__default.createElement("div", {
|
|
86165
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
86168
|
+
className: classnames(className, "".concat(iotPrefix$q, "--card--toolbar"))
|
|
86166
86169
|
}, (availableActions.edit || availableActions.clone || availableActions.delete) && /*#__PURE__*/React__default.createElement(carbonComponentsReact.OverflowMenu, {
|
|
86167
86170
|
flipped: true,
|
|
86168
86171
|
title: i18n.overflowMenuDescription
|
|
@@ -86184,7 +86187,7 @@
|
|
|
86184
86187
|
},
|
|
86185
86188
|
itemText: i18n.deleteCardLabel
|
|
86186
86189
|
}))) : /*#__PURE__*/React__default.createElement("div", {
|
|
86187
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
86190
|
+
className: classnames(className, "".concat(iotPrefix$q, "--card--toolbar"))
|
|
86188
86191
|
}, availableActions.range ? /*#__PURE__*/React__default.createElement(CardRangePicker, {
|
|
86189
86192
|
width: width,
|
|
86190
86193
|
i18n: i18n,
|
|
@@ -86266,7 +86269,7 @@
|
|
|
86266
86269
|
|
|
86267
86270
|
function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$j(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$j(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
86268
86271
|
var prefix$8 = settings.prefix,
|
|
86269
|
-
iotPrefix$
|
|
86272
|
+
iotPrefix$r = settings.iotPrefix;
|
|
86270
86273
|
var OptimizedSkeletonText = /*#__PURE__*/React__default.memo(carbonComponentsReact.SkeletonText);
|
|
86271
86274
|
/** Full card */
|
|
86272
86275
|
|
|
@@ -86297,7 +86300,7 @@
|
|
|
86297
86300
|
onTouchEnd: onTouchEnd,
|
|
86298
86301
|
onTouchStart: onTouchStart,
|
|
86299
86302
|
onScroll: onScroll,
|
|
86300
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
86303
|
+
className: classnames(className, "".concat(iotPrefix$r, "--card--wrapper"))
|
|
86301
86304
|
}, validOthers), children);
|
|
86302
86305
|
};
|
|
86303
86306
|
/** Header components */
|
|
@@ -86309,7 +86312,7 @@
|
|
|
86309
86312
|
return (
|
|
86310
86313
|
/*#__PURE__*/
|
|
86311
86314
|
React__default.createElement("div", {
|
|
86312
|
-
className: "".concat(iotPrefix$
|
|
86315
|
+
className: "".concat(iotPrefix$r, "--card--header")
|
|
86313
86316
|
}, children)
|
|
86314
86317
|
);
|
|
86315
86318
|
};
|
|
@@ -86320,7 +86323,7 @@
|
|
|
86320
86323
|
return (
|
|
86321
86324
|
/*#__PURE__*/
|
|
86322
86325
|
React__default.createElement("span", {
|
|
86323
|
-
className: "".concat(iotPrefix$
|
|
86326
|
+
className: "".concat(iotPrefix$r, "--card--title"),
|
|
86324
86327
|
title: title
|
|
86325
86328
|
}, children)
|
|
86326
86329
|
);
|
|
@@ -86333,7 +86336,7 @@
|
|
|
86333
86336
|
var height = "".concat(dimensions.y - CARD_TITLE_HEIGHT, "px");
|
|
86334
86337
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
86335
86338
|
style: defineProperty$3({}, "--card-content-height", height),
|
|
86336
|
-
className: classnames("".concat(iotPrefix$
|
|
86339
|
+
className: classnames("".concat(iotPrefix$r, "--card--content"), defineProperty$3({}, "".concat(iotPrefix$r, "--card--content--expanded"), isExpanded))
|
|
86337
86340
|
}, children);
|
|
86338
86341
|
};
|
|
86339
86342
|
|
|
@@ -86343,7 +86346,7 @@
|
|
|
86343
86346
|
style: {
|
|
86344
86347
|
'--card-content-padding': "".concat(CARD_CONTENT_PADDING, "px")
|
|
86345
86348
|
},
|
|
86346
|
-
className: "".concat(iotPrefix$
|
|
86349
|
+
className: "".concat(iotPrefix$r, "--card--empty-message-wrapper")
|
|
86347
86350
|
}, children);
|
|
86348
86351
|
};
|
|
86349
86352
|
|
|
@@ -86554,17 +86557,17 @@
|
|
|
86554
86557
|
height: 'calc(100% - 50px)',
|
|
86555
86558
|
width: 'calc(100% - 50px)'
|
|
86556
86559
|
},
|
|
86557
|
-
className: classnames("".concat(iotPrefix$
|
|
86560
|
+
className: classnames("".concat(iotPrefix$r, "--card"), className)
|
|
86558
86561
|
}), !hideHeader && /*#__PURE__*/React__default.createElement(CardHeader, null, /*#__PURE__*/React__default.createElement(CardTitle, {
|
|
86559
86562
|
title: title
|
|
86560
86563
|
}, hasTitleTooltip ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tooltip, {
|
|
86561
86564
|
ref: titleRef,
|
|
86562
86565
|
showIcon: false,
|
|
86563
|
-
triggerClassName: "".concat(iotPrefix$
|
|
86566
|
+
triggerClassName: "".concat(iotPrefix$r, "--card--title--text"),
|
|
86564
86567
|
triggerText: title
|
|
86565
86568
|
}, title) : /*#__PURE__*/React__default.createElement("div", {
|
|
86566
86569
|
ref: titleRef,
|
|
86567
|
-
className: "".concat(iotPrefix$
|
|
86570
|
+
className: "".concat(iotPrefix$r, "--card--title--text")
|
|
86568
86571
|
}, title), tooltip && /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tooltip, {
|
|
86569
86572
|
triggerId: "card-tooltip-trigger-".concat(id),
|
|
86570
86573
|
tooltipId: "card-tooltip-".concat(id),
|
|
@@ -86577,7 +86580,7 @@
|
|
|
86577
86580
|
style: {
|
|
86578
86581
|
'--card-content-padding': "".concat(CARD_CONTENT_PADDING, "px")
|
|
86579
86582
|
},
|
|
86580
|
-
className: "".concat(iotPrefix$
|
|
86583
|
+
className: "".concat(iotPrefix$r, "--card--skeleton-wrapper")
|
|
86581
86584
|
}, /*#__PURE__*/React__default.createElement(OptimizedSkeletonText, {
|
|
86582
86585
|
paragraph: true,
|
|
86583
86586
|
lineCount: newSize === CARD_SIZES.SMALL || newSize === CARD_SIZES.SMALLWIDE ? 2 : 3,
|
|
@@ -87615,7 +87618,7 @@
|
|
|
87615
87618
|
function ownKeys$l(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; }
|
|
87616
87619
|
|
|
87617
87620
|
function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$l(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$l(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
87618
|
-
var iotPrefix$
|
|
87621
|
+
var iotPrefix$s = settings.iotPrefix;
|
|
87619
87622
|
var memoizedGenerateSampleValues = memoize_1(generateSampleValues);
|
|
87620
87623
|
|
|
87621
87624
|
var BarChartCard = function BarChartCard(_ref) {
|
|
@@ -87692,7 +87695,7 @@
|
|
|
87692
87695
|
|
|
87693
87696
|
return /*#__PURE__*/React__default.createElement(Card, _extends_1({
|
|
87694
87697
|
title: title,
|
|
87695
|
-
className: "".concat(iotPrefix$
|
|
87698
|
+
className: "".concat(iotPrefix$s, "--bar-chart-card"),
|
|
87696
87699
|
size: size,
|
|
87697
87700
|
i18n: i18n,
|
|
87698
87701
|
isExpanded: isExpanded,
|
|
@@ -87701,7 +87704,7 @@
|
|
|
87701
87704
|
isEditable: isEditable,
|
|
87702
87705
|
isLoading: isLoading
|
|
87703
87706
|
}, others), !isAllValuesEmpty ? /*#__PURE__*/React__default.createElement("div", {
|
|
87704
|
-
className: classnames("".concat(iotPrefix$
|
|
87707
|
+
className: classnames("".concat(iotPrefix$s, "--bar-chart-container"), (_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$s, "--bar-chart-container--expanded"), isExpanded), defineProperty$3(_classnames, "".concat(iotPrefix$s, "--bar-chart-container--editable"), isEditable), _classnames), className)
|
|
87705
87708
|
}, /*#__PURE__*/React__default.createElement(ChartComponent, {
|
|
87706
87709
|
data: chartData,
|
|
87707
87710
|
options: {
|
|
@@ -87748,7 +87751,7 @@
|
|
|
87748
87751
|
width: "100%",
|
|
87749
87752
|
height: "100%"
|
|
87750
87753
|
}), isExpanded ? /*#__PURE__*/React__default.createElement(StatefulTable, {
|
|
87751
|
-
className: "".concat(iotPrefix$
|
|
87754
|
+
className: "".concat(iotPrefix$s, "--bar-chart-card--stateful-table"),
|
|
87752
87755
|
columns: tableColumns,
|
|
87753
87756
|
data: tableData,
|
|
87754
87757
|
options: {
|
|
@@ -88164,7 +88167,7 @@
|
|
|
88164
88167
|
};
|
|
88165
88168
|
|
|
88166
88169
|
var TableToolbarSearch$2 = carbonComponentsReact.DataTable.TableToolbarSearch;
|
|
88167
|
-
var iotPrefix$
|
|
88170
|
+
var iotPrefix$t = settings.iotPrefix;
|
|
88168
88171
|
var propTypes$u = {
|
|
88169
88172
|
/** Title for the product */
|
|
88170
88173
|
title: PropTypes.string,
|
|
@@ -88262,7 +88265,7 @@
|
|
|
88262
88265
|
|
|
88263
88266
|
var renderGrid = function renderGrid() {
|
|
88264
88267
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
88265
|
-
className: "".concat(iotPrefix$
|
|
88268
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--grid-container"),
|
|
88266
88269
|
style: {
|
|
88267
88270
|
'--columns': minTileWidth ? // if the user specifies a minTileWidth, we will render all tiles on one responsive page
|
|
88268
88271
|
"repeat(auto-fill, minmax(".concat(minTileWidth, ", 1fr))") : // if the user specifies numColumns we will render exactly that number
|
|
@@ -88273,9 +88276,9 @@
|
|
|
88273
88276
|
/*#__PURE__*/
|
|
88274
88277
|
// limit the amount of SkeletonText to render
|
|
88275
88278
|
React__default.createElement(carbonComponentsReact.SkeletonText, {
|
|
88276
|
-
key: "".concat(iotPrefix$
|
|
88279
|
+
key: "".concat(iotPrefix$t, "--tile-catalog--grid-").concat(i)
|
|
88277
88280
|
}) : null : minTileWidth || isInCurrentPageRange(i) ? /*#__PURE__*/React__default.createElement("div", {
|
|
88278
|
-
key: "".concat(iotPrefix$
|
|
88281
|
+
key: "".concat(iotPrefix$t, "--tile-catalog--grid-").concat(i)
|
|
88279
88282
|
}, tile) : null;
|
|
88280
88283
|
}));
|
|
88281
88284
|
}; // only render pagination if there is no minTileWidth and there are more tiles than can fit in
|
|
@@ -88286,21 +88289,21 @@
|
|
|
88286
88289
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
88287
88290
|
className: className
|
|
88288
88291
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
88289
|
-
className: "".concat(iotPrefix$
|
|
88292
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--canvas-container")
|
|
88290
88293
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
88291
|
-
className: "".concat(iotPrefix$
|
|
88294
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas")
|
|
88292
88295
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
88293
|
-
className: "".concat(iotPrefix$
|
|
88296
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--header")
|
|
88294
88297
|
}, title ? /*#__PURE__*/React__default.createElement("div", {
|
|
88295
|
-
className: "".concat(iotPrefix$
|
|
88298
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--header--title")
|
|
88296
88299
|
}, title) : null, hasSearch ? /*#__PURE__*/React__default.createElement(TableToolbarSearch$2, {
|
|
88297
88300
|
placeHolderText: i18n.searchPlaceHolderText,
|
|
88298
88301
|
onChange: onSearch,
|
|
88299
|
-
className: "".concat(iotPrefix$
|
|
88302
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--header--search")
|
|
88300
88303
|
}) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
88301
|
-
className: "".concat(iotPrefix$
|
|
88304
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--header--select")
|
|
88302
88305
|
}, hasSort ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.Select, {
|
|
88303
|
-
id: "".concat(iotPrefix$
|
|
88306
|
+
id: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--header--select"),
|
|
88304
88307
|
onChange: function onChange(evt) {
|
|
88305
88308
|
return onSort(evt.target.value);
|
|
88306
88309
|
},
|
|
@@ -88313,11 +88316,11 @@
|
|
|
88313
88316
|
value: option.id
|
|
88314
88317
|
});
|
|
88315
88318
|
})) : null)), tiles && tiles.length && !error ? /*#__PURE__*/React__default.createElement("div", {
|
|
88316
|
-
className: "".concat(iotPrefix$
|
|
88319
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--content")
|
|
88317
88320
|
}, renderGrid()) : /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tile, {
|
|
88318
|
-
className: "".concat(iotPrefix$
|
|
88321
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--empty-tile")
|
|
88319
88322
|
}, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iconsReact.Bee32, null), /*#__PURE__*/React__default.createElement("p", null, error || i18n.error))), /*#__PURE__*/React__default.createElement("div", {
|
|
88320
|
-
className: "".concat(iotPrefix$
|
|
88323
|
+
className: "".concat(iotPrefix$t, "--tile-catalog--tile-canvas--bottom")
|
|
88321
88324
|
}, tiles && hasPagination ? /*#__PURE__*/React__default.createElement(TilePagination, {
|
|
88322
88325
|
page: currentPage,
|
|
88323
88326
|
numPages: Math.ceil(tiles.length / (numRows * numColumns)),
|
|
@@ -88721,7 +88724,7 @@
|
|
|
88721
88724
|
DOWN: 40
|
|
88722
88725
|
};
|
|
88723
88726
|
|
|
88724
|
-
var iotPrefix$
|
|
88727
|
+
var iotPrefix$u = settings.iotPrefix;
|
|
88725
88728
|
var TIMEGROUPS = {
|
|
88726
88729
|
HOURS: 'HOURS',
|
|
88727
88730
|
MINUTES: 'MINUTES'
|
|
@@ -88944,7 +88947,7 @@
|
|
|
88944
88947
|
|
|
88945
88948
|
var timeGroupForLabel = currentTimeGroup === 0 ? 'hours' : 'minutes';
|
|
88946
88949
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
88947
|
-
className: classnames("".concat(iotPrefix$
|
|
88950
|
+
className: classnames("".concat(iotPrefix$u, "--time-picker__wrapper"), (_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$u, "--time-picker__wrapper--with-spinner"), spinner), defineProperty$3(_classnames, "".concat(iotPrefix$u, "--time-picker__wrapper--updown"), keyUpOrDownPosition > -1), defineProperty$3(_classnames, "".concat(iotPrefix$u, "--time-picker__wrapper--show-underline"), isInteractingWithSpinner), defineProperty$3(_classnames, "".concat(iotPrefix$u, "--time-picker__wrapper--show-underline-minutes"), currentTimeGroup === 1), _classnames))
|
|
88948
88951
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.TimePicker, _extends_1({
|
|
88949
88952
|
ref: timePickerRef,
|
|
88950
88953
|
onClick: onInputClick,
|
|
@@ -88955,10 +88958,10 @@
|
|
|
88955
88958
|
onBlur: onInputBlur,
|
|
88956
88959
|
disabled: disabled
|
|
88957
88960
|
}, others), children, spinner ? /*#__PURE__*/React__default.createElement("div", {
|
|
88958
|
-
className: "".concat(iotPrefix$
|
|
88961
|
+
className: "".concat(iotPrefix$u, "--time-picker__controls")
|
|
88959
88962
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
88960
88963
|
type: "button",
|
|
88961
|
-
className: "".concat(iotPrefix$
|
|
88964
|
+
className: "".concat(iotPrefix$u, "--time-picker__controls--btn up-icon"),
|
|
88962
88965
|
onClick: function onClick() {
|
|
88963
88966
|
return onArrowClick('up');
|
|
88964
88967
|
},
|
|
@@ -88983,7 +88986,7 @@
|
|
|
88983
88986
|
className: "up-icon"
|
|
88984
88987
|
})), /*#__PURE__*/React__default.createElement("button", {
|
|
88985
88988
|
type: "button",
|
|
88986
|
-
className: "".concat(iotPrefix$
|
|
88989
|
+
className: "".concat(iotPrefix$u, "--time-picker__controls--btn down-icon"),
|
|
88987
88990
|
onClick: function onClick() {
|
|
88988
88991
|
return onArrowClick('down');
|
|
88989
88992
|
},
|
|
@@ -89125,7 +89128,7 @@
|
|
|
89125
89128
|
function ownKeys$m(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; }
|
|
89126
89129
|
|
|
89127
89130
|
function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$m(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
89128
|
-
var iotPrefix$
|
|
89131
|
+
var iotPrefix$v = settings.iotPrefix;
|
|
89129
89132
|
var PICKER_KINDS = {
|
|
89130
89133
|
PRESET: 'PRESET',
|
|
89131
89134
|
RELATIVE: 'RELATIVE',
|
|
@@ -89408,10 +89411,10 @@
|
|
|
89408
89411
|
datePickerRef.current.cal.open(); // while waiting for https://github.com/carbon-design-system/carbon/issues/5713
|
|
89409
89412
|
// the only way to display the calendar inline is to reparent its DOM to our component
|
|
89410
89413
|
|
|
89411
|
-
var wrapper = document.getElementById("".concat(iotPrefix$
|
|
89414
|
+
var wrapper = document.getElementById("".concat(iotPrefix$v, "--date-time-picker__wrapper"));
|
|
89412
89415
|
|
|
89413
89416
|
if (typeof wrapper !== 'undefined' && wrapper !== null) {
|
|
89414
|
-
var dp = document.getElementById("".concat(iotPrefix$
|
|
89417
|
+
var dp = document.getElementById("".concat(iotPrefix$v, "--date-time-picker__wrapper")).getElementsByClassName("".concat(iotPrefix$v, "--date-time-picker__datepicker"))[0];
|
|
89415
89418
|
dp.appendChild(datePickerRef.current.cal.calendarContainer);
|
|
89416
89419
|
}
|
|
89417
89420
|
}
|
|
@@ -89769,12 +89772,12 @@
|
|
|
89769
89772
|
|
|
89770
89773
|
var tooltipValue = renderPresetTooltipText ? renderPresetTooltipText(currentValue) : getIntervalValue();
|
|
89771
89774
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
89772
|
-
id: "".concat(iotPrefix$
|
|
89773
|
-
className: "".concat(iotPrefix$
|
|
89775
|
+
id: "".concat(iotPrefix$v, "--date-time-picker__wrapper"),
|
|
89776
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__wrapper")
|
|
89774
89777
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89775
|
-
className: "".concat(iotPrefix$
|
|
89778
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__box")
|
|
89776
89779
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89777
|
-
className: "".concat(iotPrefix$
|
|
89780
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__field"),
|
|
89778
89781
|
role: "button",
|
|
89779
89782
|
onClick: onFieldClick,
|
|
89780
89783
|
onKeyPress: onFieldClick,
|
|
@@ -89788,30 +89791,30 @@
|
|
|
89788
89791
|
triggerClassName: ""
|
|
89789
89792
|
}, humanValue) : null, /*#__PURE__*/React__default.createElement(iconsReact.Calendar16, {
|
|
89790
89793
|
"aria-label": strings.calendarLabel,
|
|
89791
|
-
className: "".concat(iotPrefix$
|
|
89794
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__icon")
|
|
89792
89795
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
89793
|
-
className: classnames("".concat(iotPrefix$
|
|
89796
|
+
className: classnames("".concat(iotPrefix$v, "--date-time-picker__menu"), defineProperty$3({}, "".concat(iotPrefix$v, "--date-time-picker__menu-expanded"), isExpanded)),
|
|
89794
89797
|
role: "listbox"
|
|
89795
89798
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89796
|
-
className: "".concat(iotPrefix$
|
|
89799
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-scroll")
|
|
89797
89800
|
}, !isCustomRange ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.OrderedList, {
|
|
89798
89801
|
nested: false
|
|
89799
89802
|
}, tooltipValue ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.ListItem, {
|
|
89800
|
-
className: "".concat(iotPrefix$
|
|
89803
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__listitem ").concat(iotPrefix$v, "--date-time-picker__listitem--current")
|
|
89801
89804
|
}, tooltipValue) : null, /*#__PURE__*/React__default.createElement(carbonComponentsReact.ListItem, {
|
|
89802
89805
|
onClick: toggleIsCustomRange,
|
|
89803
|
-
className: "".concat(iotPrefix$
|
|
89806
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__listitem ").concat(iotPrefix$v, "--date-time-picker__listitem--custom")
|
|
89804
89807
|
}, strings.customRangeLinkLabel), presets.map(function (preset, i) {
|
|
89805
89808
|
return /*#__PURE__*/React__default.createElement(carbonComponentsReact.ListItem, {
|
|
89806
89809
|
key: i,
|
|
89807
89810
|
onClick: function onClick() {
|
|
89808
89811
|
return onPresetClick(preset);
|
|
89809
89812
|
},
|
|
89810
|
-
className: classnames("".concat(iotPrefix$
|
|
89813
|
+
className: classnames("".concat(iotPrefix$v, "--date-time-picker__listitem ").concat(iotPrefix$v, "--date-time-picker__listitem--preset"), defineProperty$3({}, "".concat(iotPrefix$v, "--date-time-picker__listitem--preset-selected"), selectedPreset === preset.offset))
|
|
89811
89814
|
}, strings.presetLabels[i] || preset.label);
|
|
89812
89815
|
})) : /*#__PURE__*/React__default.createElement("div", null, showRelativeOption ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.FormGroup, {
|
|
89813
89816
|
legendText: strings.customRangeLabel,
|
|
89814
|
-
className: "".concat(iotPrefix$
|
|
89817
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-formgroup")
|
|
89815
89818
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.RadioButtonGroup, {
|
|
89816
89819
|
valueSelected: customRangeKind,
|
|
89817
89820
|
onChange: onCustomRangeChange,
|
|
@@ -89826,9 +89829,9 @@
|
|
|
89826
89829
|
labelText: strings.absoluteLabel
|
|
89827
89830
|
}))) : null, showRelativeOption && customRangeKind === PICKER_KINDS.RELATIVE ? /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(carbonComponentsReact.FormGroup, {
|
|
89828
89831
|
legendText: strings.lastLabel,
|
|
89829
|
-
className: "".concat(iotPrefix$
|
|
89832
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-formgroup")
|
|
89830
89833
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89831
|
-
className: "".concat(iotPrefix$
|
|
89834
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__fields-wrapper")
|
|
89832
89835
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.NumberInput, {
|
|
89833
89836
|
id: "last-number",
|
|
89834
89837
|
invalidText: strings.invalidNumberLabel,
|
|
@@ -89849,9 +89852,9 @@
|
|
|
89849
89852
|
});
|
|
89850
89853
|
})))), /*#__PURE__*/React__default.createElement(carbonComponentsReact.FormGroup, {
|
|
89851
89854
|
legendText: strings.relativeToLabel,
|
|
89852
|
-
className: "".concat(iotPrefix$
|
|
89855
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-formgroup")
|
|
89853
89856
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89854
|
-
className: "".concat(iotPrefix$
|
|
89857
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__fields-wrapper")
|
|
89855
89858
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Select, _extends_1({}, others, {
|
|
89856
89859
|
ref: relativeSelect,
|
|
89857
89860
|
id: "relative-to-when",
|
|
@@ -89873,7 +89876,7 @@
|
|
|
89873
89876
|
spinner: true,
|
|
89874
89877
|
autoComplete: "off"
|
|
89875
89878
|
}) : null))) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
89876
|
-
className: "".concat(iotPrefix$
|
|
89879
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__datepicker")
|
|
89877
89880
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.DatePicker, {
|
|
89878
89881
|
datePickerType: "range",
|
|
89879
89882
|
dateFormat: "m/d/Y",
|
|
@@ -89892,9 +89895,9 @@
|
|
|
89892
89895
|
value: absoluteValue ? absoluteValue.endDate : ''
|
|
89893
89896
|
}))), hasTimeInput ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.FormGroup, {
|
|
89894
89897
|
legendText: "",
|
|
89895
|
-
className: "".concat(iotPrefix$
|
|
89898
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-formgroup")
|
|
89896
89899
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
89897
|
-
className: "".concat(iotPrefix$
|
|
89900
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__fields-wrapper")
|
|
89898
89901
|
}, /*#__PURE__*/React__default.createElement(TimePickerSpinner, {
|
|
89899
89902
|
id: "start-time",
|
|
89900
89903
|
labelText: strings.startTimeLabel,
|
|
@@ -89910,21 +89913,21 @@
|
|
|
89910
89913
|
spinner: true,
|
|
89911
89914
|
autoComplete: "off"
|
|
89912
89915
|
}))) : /*#__PURE__*/React__default.createElement("div", {
|
|
89913
|
-
className: "".concat(iotPrefix$
|
|
89916
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__no-formgroup")
|
|
89914
89917
|
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
89915
|
-
className: "".concat(iotPrefix$
|
|
89918
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-btn-set")
|
|
89916
89919
|
}, isCustomRange ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, _extends_1({
|
|
89917
89920
|
kind: "secondary",
|
|
89918
|
-
className: "".concat(iotPrefix$
|
|
89921
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-btn ").concat(iotPrefix$v, "--date-time-picker__menu-btn-back")
|
|
89919
89922
|
}, others, {
|
|
89920
89923
|
onClick: toggleIsCustomRange
|
|
89921
89924
|
}), strings.backBtnLabel) : /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, _extends_1({
|
|
89922
89925
|
kind: "secondary",
|
|
89923
|
-
className: "".concat(iotPrefix$
|
|
89926
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-btn ").concat(iotPrefix$v, "--date-time-picker__menu-btn-cancel"),
|
|
89924
89927
|
onClick: onCancelClick
|
|
89925
89928
|
}, others), strings.cancelBtnLabel), /*#__PURE__*/React__default.createElement(carbonComponentsReact.Button, _extends_1({
|
|
89926
89929
|
kind: "primary",
|
|
89927
|
-
className: "".concat(iotPrefix$
|
|
89930
|
+
className: "".concat(iotPrefix$v, "--date-time-picker__menu-btn ").concat(iotPrefix$v, "--date-time-picker__menu-btn-apply")
|
|
89928
89931
|
}, others, {
|
|
89929
89932
|
onClick: onApplyClick
|
|
89930
89933
|
}), strings.applyBtnLabel)))));
|
|
@@ -90309,7 +90312,7 @@
|
|
|
90309
90312
|
icon: PropTypes.elementType
|
|
90310
90313
|
});
|
|
90311
90314
|
|
|
90312
|
-
var iotPrefix$
|
|
90315
|
+
var iotPrefix$w = settings.iotPrefix;
|
|
90313
90316
|
var propTypes$x = {
|
|
90314
90317
|
isCompact: PropTypes.bool.isRequired,
|
|
90315
90318
|
activeViewEdited: PropTypes.bool.isRequired,
|
|
@@ -90340,13 +90343,13 @@
|
|
|
90340
90343
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
90341
90344
|
"data-testid": testID,
|
|
90342
90345
|
title: "".concat(text).concat(showEdited ? editedPostfix : ''),
|
|
90343
|
-
className: classnames("".concat(iotPrefix$
|
|
90346
|
+
className: classnames("".concat(iotPrefix$w, "--view-dropdown__item"), defineProperty$3({}, "".concat(iotPrefix$w, "--view-dropdown__item-link"), customAction))
|
|
90344
90347
|
}, isSelected && !isCompact ? /*#__PURE__*/React__default.createElement("span", {
|
|
90345
|
-
className: "".concat(iotPrefix$
|
|
90348
|
+
className: "".concat(iotPrefix$w, "--view-dropdown__button-prefix")
|
|
90346
90349
|
}, /*#__PURE__*/React__default.createElement(iconsReact.View20, null), /*#__PURE__*/React__default.createElement("span", null, "".concat(i18n.view, ": "))) : null, /*#__PURE__*/React__default.createElement("span", null, text, showEdited ? /*#__PURE__*/React__default.createElement("span", {
|
|
90347
|
-
className: "".concat(iotPrefix$
|
|
90350
|
+
className: "".concat(iotPrefix$w, "--view-dropdown__edited-text")
|
|
90348
90351
|
}, editedPostfix) : null), Icon && !isCompact ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
90349
|
-
className: classnames(defineProperty$3({}, "".concat(iotPrefix$
|
|
90352
|
+
className: classnames(defineProperty$3({}, "".concat(iotPrefix$w, "--view-dropdown__item-link-icon"), customAction))
|
|
90350
90353
|
}) : null);
|
|
90351
90354
|
};
|
|
90352
90355
|
|
|
@@ -90417,7 +90420,7 @@
|
|
|
90417
90420
|
}
|
|
90418
90421
|
};
|
|
90419
90422
|
|
|
90420
|
-
var iotPrefix$
|
|
90423
|
+
var iotPrefix$x = settings.iotPrefix;
|
|
90421
90424
|
var propTypes$y = {
|
|
90422
90425
|
/** Set to true if the user has modfied filters etc since the view was loaded */
|
|
90423
90426
|
activeViewEdited: PropTypes.bool,
|
|
@@ -90545,7 +90548,7 @@
|
|
|
90545
90548
|
selectedItem: mySelectedItem,
|
|
90546
90549
|
ariaLabel: i18n.ariaLabel,
|
|
90547
90550
|
disabled: disabled,
|
|
90548
|
-
id: "".concat(iotPrefix$
|
|
90551
|
+
id: "".concat(iotPrefix$x, "--view-dropdown") // We are using itemToString instead of itemToElement since we need the custom
|
|
90549
90552
|
// rendering to also happen when the item is selected. See closed PR
|
|
90550
90553
|
// https://github.com/carbon-design-system/carbon/pull/5578
|
|
90551
90554
|
,
|
|
@@ -94583,7 +94586,7 @@
|
|
|
94583
94586
|
};
|
|
94584
94587
|
|
|
94585
94588
|
var carbonPrefix$2 = settings.prefix,
|
|
94586
|
-
iotPrefix$
|
|
94589
|
+
iotPrefix$y = settings.iotPrefix;
|
|
94587
94590
|
/** common proptypes associated with child content for a header action */
|
|
94588
94591
|
|
|
94589
94592
|
var ChildContentPropTypes = {
|
|
@@ -94703,7 +94706,7 @@
|
|
|
94703
94706
|
href: url,
|
|
94704
94707
|
prefix: prefix
|
|
94705
94708
|
}, appName, subtitle ? /*#__PURE__*/React__default.createElement("div", {
|
|
94706
|
-
className: "".concat(iotPrefix$
|
|
94709
|
+
className: "".concat(iotPrefix$y, "--header__subtitle")
|
|
94707
94710
|
}, subtitle) : null), /*#__PURE__*/React__default.createElement(HeaderActionGroup, {
|
|
94708
94711
|
actionItems: actionItems
|
|
94709
94712
|
}));
|
|
@@ -94914,7 +94917,7 @@
|
|
|
94914
94917
|
}
|
|
94915
94918
|
});
|
|
94916
94919
|
|
|
94917
|
-
var iotPrefix$
|
|
94920
|
+
var iotPrefix$z = settings.iotPrefix,
|
|
94918
94921
|
prefix$B = settings.prefix;
|
|
94919
94922
|
var propTypes$I = {
|
|
94920
94923
|
/** Specify whether the side navigation is expanded or collapsed */
|
|
@@ -95043,7 +95046,7 @@
|
|
|
95043
95046
|
};
|
|
95044
95047
|
|
|
95045
95048
|
return /*#__PURE__*/React__default.createElement(SideNav, _extends_1({
|
|
95046
|
-
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$
|
|
95049
|
+
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$z, "--side-nav--expanded"), isSideNavExpanded), defineProperty$3(_classnames, "".concat(prefix$B, "--side-nav--expanded"), isSideNavExpanded), _classnames)),
|
|
95047
95050
|
translateById: translateById,
|
|
95048
95051
|
"aria-label": "Side navigation",
|
|
95049
95052
|
defaultExpanded: defaultExpanded
|
|
@@ -103218,8 +103221,8 @@
|
|
|
103218
103221
|
|
|
103219
103222
|
var filter_1 = filter$1;
|
|
103220
103223
|
|
|
103221
|
-
var iotPrefix$
|
|
103222
|
-
var dsPrefix = "".concat(iotPrefix$
|
|
103224
|
+
var iotPrefix$A = settings.iotPrefix;
|
|
103225
|
+
var dsPrefix = "".concat(iotPrefix$A, "--data-state"); // Testing the tooltip content outside carbon proved difficult.
|
|
103223
103226
|
// So this is exposed for testing purpose.
|
|
103224
103227
|
|
|
103225
103228
|
var TooltipContent = function TooltipContent(_ref) {
|
|
@@ -103487,7 +103490,7 @@
|
|
|
103487
103490
|
|
|
103488
103491
|
return data;
|
|
103489
103492
|
}
|
|
103490
|
-
var iotPrefix$
|
|
103493
|
+
var iotPrefix$B = settings.iotPrefix;
|
|
103491
103494
|
var propTypes$L = {
|
|
103492
103495
|
value: PropTypes.any,
|
|
103493
103496
|
// eslint-disable-line react/forbid-prop-types, react/require-default-props
|
|
@@ -103615,7 +103618,7 @@
|
|
|
103615
103618
|
color: color,
|
|
103616
103619
|
isVertical: isVertical,
|
|
103617
103620
|
allowedToWrap: allowedToWrap,
|
|
103618
|
-
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$
|
|
103621
|
+
className: classnames((_classnames = {}, defineProperty$3(_classnames, "".concat(iotPrefix$B, "--value-card__attribute-value--wrappable"), allowedToWrap), defineProperty$3(_classnames, "".concat(iotPrefix$B, "--value-card__attribute-value--wrappable-compact"), wrapCompact), _classnames))
|
|
103619
103622
|
}, /*#__PURE__*/React__default.createElement(AttributeValue, {
|
|
103620
103623
|
size: newSize,
|
|
103621
103624
|
title: "".concat(value, " ").concat(unit || ''),
|
|
@@ -103756,7 +103759,7 @@
|
|
|
103756
103759
|
}
|
|
103757
103760
|
};
|
|
103758
103761
|
|
|
103759
|
-
var iotPrefix$
|
|
103762
|
+
var iotPrefix$C = settings.iotPrefix;
|
|
103760
103763
|
var propTypes$M = {
|
|
103761
103764
|
value: PropTypes.any,
|
|
103762
103765
|
// eslint-disable-line react/forbid-prop-types, react/require-default-props
|
|
@@ -103787,7 +103790,7 @@
|
|
|
103787
103790
|
allowedToWrap = _ref.allowedToWrap,
|
|
103788
103791
|
wrapCompact = _ref.wrapCompact,
|
|
103789
103792
|
attributeCount = _ref.attributeCount;
|
|
103790
|
-
var bemBase = "".concat(iotPrefix$
|
|
103793
|
+
var bemBase = "".concat(iotPrefix$C, "--value-card__attribute-unit");
|
|
103791
103794
|
var notAllowedToWrap = typeof value === 'string' && !allowedToWrap && attributeCount === 1;
|
|
103792
103795
|
var unitElement = /*#__PURE__*/React__default.createElement("span", {
|
|
103793
103796
|
style: {
|
|
@@ -103895,7 +103898,7 @@
|
|
|
103895
103898
|
|
|
103896
103899
|
return data;
|
|
103897
103900
|
}
|
|
103898
|
-
var iotPrefix$
|
|
103901
|
+
var iotPrefix$D = settings.iotPrefix;
|
|
103899
103902
|
var StyledAttribute = styled.div(_templateObject$q(), function (props) {
|
|
103900
103903
|
return props.isMini ? 'center' : 'baseline';
|
|
103901
103904
|
}, function (props) {
|
|
@@ -104010,7 +104013,7 @@
|
|
|
104010
104013
|
}
|
|
104011
104014
|
}).concat([null])[0];
|
|
104012
104015
|
var valueColor = matchingThreshold && matchingThreshold.icon === undefined ? matchingThreshold.color : null;
|
|
104013
|
-
var bemBase = "".concat(iotPrefix$
|
|
104016
|
+
var bemBase = "".concat(iotPrefix$D, "--value-card__attribute");
|
|
104014
104017
|
|
|
104015
104018
|
var renderThresholdIcon = function renderThresholdIcon(allowedToWrap) {
|
|
104016
104019
|
var _classnames;
|
|
@@ -104831,7 +104834,7 @@
|
|
|
104831
104834
|
});
|
|
104832
104835
|
};
|
|
104833
104836
|
|
|
104834
|
-
var iotPrefix$
|
|
104837
|
+
var iotPrefix$E = settings.iotPrefix;
|
|
104835
104838
|
var propTypes$O = {
|
|
104836
104839
|
/** severities will determine which default icon to use if another icon name isn't provided */
|
|
104837
104840
|
severity: PropTypes.oneOf([1, 2, 3]),
|
|
@@ -104988,10 +104991,10 @@
|
|
|
104988
104991
|
}
|
|
104989
104992
|
|
|
104990
104993
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
104991
|
-
className: "".concat(iotPrefix$
|
|
104994
|
+
className: "".concat(iotPrefix$E, "--threshold-icon--wrapper"),
|
|
104992
104995
|
title: title
|
|
104993
104996
|
}, iconToRender, showSeverityLabel ? /*#__PURE__*/React__default.createElement("span", {
|
|
104994
|
-
className: "".concat(iotPrefix$
|
|
104997
|
+
className: "".concat(iotPrefix$E, "--threshold-icon--text")
|
|
104995
104998
|
}, severityLabel || stringToRender) : null);
|
|
104996
104999
|
};
|
|
104997
105000
|
|
|
@@ -105131,7 +105134,7 @@
|
|
|
105131
105134
|
|
|
105132
105135
|
return data;
|
|
105133
105136
|
}
|
|
105134
|
-
var iotPrefix$
|
|
105137
|
+
var iotPrefix$F = settings.iotPrefix;
|
|
105135
105138
|
var StyledStatefulTable = styled(function (_ref) {
|
|
105136
105139
|
var showHeader = _ref.showHeader,
|
|
105137
105140
|
isExpanded = _ref.isExpanded,
|
|
@@ -105400,7 +105403,7 @@
|
|
|
105400
105403
|
var renderActionCell = function renderActionCell(cellItem) {
|
|
105401
105404
|
var actionList = JSON.parse(cellItem.value);
|
|
105402
105405
|
return actionList && actionList.length === 1 ? /*#__PURE__*/React__default.createElement(typeof actionList[0].icon === 'string' ? icons[actionList[0].icon] : actionList.icon, {
|
|
105403
|
-
className: "".concat(iotPrefix$
|
|
105406
|
+
className: "".concat(iotPrefix$F, "--table-card--action-icon"),
|
|
105404
105407
|
onClick: function onClick(evt) {
|
|
105405
105408
|
evt.preventDefault();
|
|
105406
105409
|
evt.stopPropagation();
|
|
@@ -105411,7 +105414,7 @@
|
|
|
105411
105414
|
},
|
|
105412
105415
|
'aria-label': actionList[0].label
|
|
105413
105416
|
}) : actionList && actionList.length > 1 ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.OverflowMenu, {
|
|
105414
|
-
className: "".concat(iotPrefix$
|
|
105417
|
+
className: "".concat(iotPrefix$F, "--table-card--overflow-menu"),
|
|
105415
105418
|
renderIcon: function renderIcon() {
|
|
105416
105419
|
return /*#__PURE__*/React__default.createElement(iconsReact.OverflowMenuVertical16, {
|
|
105417
105420
|
fill: "#5a6872",
|
|
@@ -105647,11 +105650,11 @@
|
|
|
105647
105650
|
rowId: dataItem.id,
|
|
105648
105651
|
content: /*#__PURE__*/React__default.createElement("div", {
|
|
105649
105652
|
key: "".concat(dataItem.id, "-expanded"),
|
|
105650
|
-
className: "".concat(iotPrefix$
|
|
105653
|
+
className: "".concat(iotPrefix$F, "--table-card--expanded-row-content")
|
|
105651
105654
|
}, formattedExpandedItems.length ? formattedExpandedItems.map(function (item, index) {
|
|
105652
105655
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
105653
105656
|
key: "".concat(item.id, "-expanded-").concat(index),
|
|
105654
|
-
className: "".concat(iotPrefix$
|
|
105657
|
+
className: "".concat(iotPrefix$F, "--table-card--expanded")
|
|
105655
105658
|
}, item.linkTemplate ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
|
|
105656
105659
|
key: "".concat(item.id, "-label"),
|
|
105657
105660
|
style: {
|
|
@@ -105671,7 +105674,7 @@
|
|
|
105671
105674
|
}, item ? dataItem.values[item.id] : null)));
|
|
105672
105675
|
}) : /*#__PURE__*/React__default.createElement("div", {
|
|
105673
105676
|
key: "".concat(dataItem.id, "-expanded"),
|
|
105674
|
-
className: "".concat(iotPrefix$
|
|
105677
|
+
className: "".concat(iotPrefix$F, "--table-card--expanded")
|
|
105675
105678
|
}, ' ', /*#__PURE__*/React__default.createElement("p", {
|
|
105676
105679
|
key: "".concat(dataItem.id, "-label")
|
|
105677
105680
|
}, "--")))
|
|
@@ -105823,7 +105826,7 @@
|
|
|
105823
105826
|
function ownKeys$J(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; }
|
|
105824
105827
|
|
|
105825
105828
|
function _objectSpread$H(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$J(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$J(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
105826
|
-
var iotPrefix$
|
|
105829
|
+
var iotPrefix$G = settings.iotPrefix;
|
|
105827
105830
|
var HotspotContentPropTypes = {
|
|
105828
105831
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
105829
105832
|
description: PropTypes.string,
|
|
@@ -105875,11 +105878,11 @@
|
|
|
105875
105878
|
locale = _ref.locale,
|
|
105876
105879
|
renderIconByName = _ref.renderIconByName;
|
|
105877
105880
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
105878
|
-
className: "".concat(iotPrefix$
|
|
105881
|
+
className: "".concat(iotPrefix$G, "--hotspot-content")
|
|
105879
105882
|
}, typeof title === 'string' ? /*#__PURE__*/React__default.createElement("h4", {
|
|
105880
105883
|
title: title
|
|
105881
105884
|
}, title) : /*#__PURE__*/React__default.isValidElement(title) ? title : null, description && /*#__PURE__*/React__default.createElement("p", {
|
|
105882
|
-
className: "".concat(iotPrefix$
|
|
105885
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-description")
|
|
105883
105886
|
}, description), attributes.map(function (_ref2) {
|
|
105884
105887
|
var thresholds = _ref2.thresholds,
|
|
105885
105888
|
dataSourceId = _ref2.dataSourceId,
|
|
@@ -105916,23 +105919,23 @@
|
|
|
105916
105919
|
}) : null;
|
|
105917
105920
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
105918
105921
|
key: "attribute-".concat(dataSourceId),
|
|
105919
|
-
className: "".concat(iotPrefix$
|
|
105922
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-attribute")
|
|
105920
105923
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
105921
|
-
className: "".concat(iotPrefix$
|
|
105924
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-label-section")
|
|
105922
105925
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
105923
|
-
className: "".concat(iotPrefix$
|
|
105926
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-label")
|
|
105924
105927
|
}, label, ":")), /*#__PURE__*/React__default.createElement("div", {
|
|
105925
|
-
className: "".concat(iotPrefix$
|
|
105928
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-threshold-section")
|
|
105926
105929
|
}, thresholdIcon, /*#__PURE__*/React__default.createElement("span", {
|
|
105927
105930
|
style: {
|
|
105928
105931
|
'--threshold-color': !thresholdIcon && thresholdMatch ? thresholdMatch.color : 'inherit ',
|
|
105929
105932
|
'--threshold-padding': thresholdIcon ? '0.25rem' : '0rem'
|
|
105930
105933
|
},
|
|
105931
|
-
className: "".concat(iotPrefix$
|
|
105934
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-threshold")
|
|
105932
105935
|
}, typeof value === 'number' ? formatNumberWithPrecision(value, !isNil_1(precision) ? precision : Math.abs(value) < 1 ? value === 0 ? 0 : 3 // for small decimals give 3 spots
|
|
105933
105936
|
: 1, // otherwise 1 spot if precision isn't set
|
|
105934
105937
|
locale) : value, unit && value !== '--' && /*#__PURE__*/React__default.createElement("span", {
|
|
105935
|
-
className: "".concat(iotPrefix$
|
|
105938
|
+
className: "".concat(iotPrefix$G, "--hotspot-content-unit")
|
|
105936
105939
|
}, unit))));
|
|
105937
105940
|
}));
|
|
105938
105941
|
};
|
|
@@ -117584,7 +117587,7 @@
|
|
|
117584
117587
|
|
|
117585
117588
|
return data;
|
|
117586
117589
|
}
|
|
117587
|
-
var iotPrefix$
|
|
117590
|
+
var iotPrefix$H = settings.iotPrefix;
|
|
117588
117591
|
var TimeSeriesDatasetPropTypes = PropTypes.shape({
|
|
117589
117592
|
label: PropTypes.string.isRequired,
|
|
117590
117593
|
|
|
@@ -118016,7 +118019,7 @@
|
|
|
118016
118019
|
width: "100%",
|
|
118017
118020
|
height: "100%"
|
|
118018
118021
|
})), isExpanded ? /*#__PURE__*/React__default.createElement(StatefulTable, {
|
|
118019
|
-
className: "".concat(iotPrefix$
|
|
118022
|
+
className: "".concat(iotPrefix$H, "--time-series-card--stateful-table"),
|
|
118020
118023
|
columns: tableColumns,
|
|
118021
118024
|
data: tableData,
|
|
118022
118025
|
isExpanded: isExpanded,
|
|
@@ -118472,7 +118475,7 @@
|
|
|
118472
118475
|
function ownKeys$P(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; }
|
|
118473
118476
|
|
|
118474
118477
|
function _objectSpread$N(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$P(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$P(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
118475
|
-
var iotPrefix$
|
|
118478
|
+
var iotPrefix$I = settings.iotPrefix; // r value of the circle in SVG
|
|
118476
118479
|
|
|
118477
118480
|
var radius = 36; // radius doubled plus stroke
|
|
118478
118481
|
|
|
@@ -118560,14 +118563,14 @@
|
|
|
118560
118563
|
};
|
|
118561
118564
|
return /*#__PURE__*/React__default.createElement(Card, _extends_1({
|
|
118562
118565
|
id: id,
|
|
118563
|
-
className: "".concat(iotPrefix$
|
|
118566
|
+
className: "".concat(iotPrefix$I, "--gauge-card"),
|
|
118564
118567
|
title: title,
|
|
118565
118568
|
size: size
|
|
118566
118569
|
}, others, {
|
|
118567
118570
|
tooltip: tooltip,
|
|
118568
118571
|
isLoading: isLoading
|
|
118569
118572
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
118570
|
-
className: classnames("".concat(iotPrefix$
|
|
118573
|
+
className: classnames("".concat(iotPrefix$I, "--gauge-container"), className),
|
|
118571
118574
|
style: myStyles
|
|
118572
118575
|
}, dataState && /*#__PURE__*/React__default.createElement(DataStateRenderer, {
|
|
118573
118576
|
dataState: dataState,
|
|
@@ -118581,10 +118584,10 @@
|
|
|
118581
118584
|
|
|
118582
118585
|
var valueLength = values[gauge.dataSourceId] && values[gauge.dataSourceId].toString().length;
|
|
118583
118586
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
118584
|
-
key: "".concat(iotPrefix$
|
|
118587
|
+
key: "".concat(iotPrefix$I, "-gauge-").concat(i)
|
|
118585
118588
|
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
118586
118589
|
"aria-labelledby": "gauge-label",
|
|
118587
|
-
className: classnames("".concat(iotPrefix$
|
|
118590
|
+
className: classnames("".concat(iotPrefix$I, "--gauge"), defineProperty$3({}, "".concat(iotPrefix$I, "--gauge__loaded"), loadedState), className),
|
|
118588
118591
|
percent: "0",
|
|
118589
118592
|
style: {
|
|
118590
118593
|
'--gauge-value': values[gauge.dataSourceId] || 0,
|
|
@@ -118597,23 +118600,23 @@
|
|
|
118597
118600
|
'--gauge-trend-color': gauge.trend.color
|
|
118598
118601
|
}
|
|
118599
118602
|
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
118600
|
-
className: "".concat(iotPrefix$
|
|
118603
|
+
className: "".concat(iotPrefix$I, "--gauge-bg"),
|
|
118601
118604
|
cx: gaugeSize / 2,
|
|
118602
118605
|
cy: gaugeSize / 2,
|
|
118603
118606
|
r: radius
|
|
118604
118607
|
}), /*#__PURE__*/React__default.createElement("circle", {
|
|
118605
|
-
className: "".concat(iotPrefix$
|
|
118608
|
+
className: "".concat(iotPrefix$I, "--gauge-fg"),
|
|
118606
118609
|
cx: gaugeSize / 2,
|
|
118607
118610
|
cy: gaugeSize / 2,
|
|
118608
118611
|
r: radius
|
|
118609
118612
|
}), /*#__PURE__*/React__default.createElement("text", {
|
|
118610
118613
|
id: "gauge-label",
|
|
118611
|
-
className: classnames("".concat(iotPrefix$
|
|
118614
|
+
className: classnames("".concat(iotPrefix$I, "--gauge-value"), "".concat(iotPrefix$I, "--gauge-value__centered"), defineProperty$3({}, "".concat(iotPrefix$I, "--gauge-value-sm"), valueLength === 4), defineProperty$3({}, "".concat(iotPrefix$I, "--gauge-value-md"), valueLength === 3), defineProperty$3({}, "".concat(iotPrefix$I, "--gauge-value-lg"), valueLength <= 2)),
|
|
118612
118615
|
x: gaugeSize / 2,
|
|
118613
118616
|
y: "33",
|
|
118614
118617
|
textAnchor: "middle"
|
|
118615
118618
|
}, /*#__PURE__*/React__default.createElement("tspan", null, values[gauge.dataSourceId]), /*#__PURE__*/React__default.createElement("tspan", null, gauge.units))), values[gauge.trend.dataSourceId] && /*#__PURE__*/React__default.createElement("div", {
|
|
118616
|
-
className: classnames("".concat(iotPrefix$
|
|
118619
|
+
className: classnames("".concat(iotPrefix$I, "--gauge-trend"), (_classnames5 = {}, defineProperty$3(_classnames5, "".concat(iotPrefix$I, "--gauge-trend__up"), gauge.trend.trend === 'up'), defineProperty$3(_classnames5, "".concat(iotPrefix$I, "--gauge-trend__down"), gauge.trend.trend === 'down'), _classnames5)),
|
|
118617
118620
|
key: "".concat(gauge.trend.dataSourceId, "-").concat(i)
|
|
118618
118621
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
118619
118622
|
style: {
|
|
@@ -119867,7 +119870,7 @@
|
|
|
119867
119870
|
"composes": ["lodash/omit"]
|
|
119868
119871
|
};
|
|
119869
119872
|
|
|
119870
|
-
var iotPrefix$
|
|
119873
|
+
var iotPrefix$J = settings.iotPrefix;
|
|
119871
119874
|
var childrenPropType = PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]);
|
|
119872
119875
|
var PageWizardPropTypes = {
|
|
119873
119876
|
children: childrenPropType,
|
|
@@ -119993,11 +119996,11 @@
|
|
|
119993
119996
|
beforeFooterContent: beforeFooterContent
|
|
119994
119997
|
});
|
|
119995
119998
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
119996
|
-
className: classnames(isProgressIndicatorVertical ? "".concat(iotPrefix$
|
|
119999
|
+
className: classnames(isProgressIndicatorVertical ? "".concat(iotPrefix$J, "--page-wizard") : null, className, hasStickyFooter ? "".concat(iotPrefix$J, "--page-wizard__sticky") : null)
|
|
119997
120000
|
}, steps.length > 1 ? /*#__PURE__*/React__default.createElement("div", {
|
|
119998
|
-
className: isProgressIndicatorVertical ? "".concat(iotPrefix$
|
|
120001
|
+
className: isProgressIndicatorVertical ? "".concat(iotPrefix$J, "--page-wizard--progress--vertical") : "".concat(iotPrefix$J, "--page-wizard--progress--horizontal")
|
|
119999
120002
|
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.ProgressIndicator, {
|
|
120000
|
-
className: classnames(className, "".concat(iotPrefix$
|
|
120003
|
+
className: classnames(className, "".concat(iotPrefix$J, "--progress-indicator")),
|
|
120001
120004
|
currentIndex: currentStepIdx,
|
|
120002
120005
|
onChange: function onChange(idx) {
|
|
120003
120006
|
return setStep(steps[idx].id);
|
|
@@ -120011,7 +120014,7 @@
|
|
|
120011
120014
|
secondaryLabel: step.secondaryLabel
|
|
120012
120015
|
});
|
|
120013
120016
|
}))) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
120014
|
-
className: "".concat(iotPrefix$
|
|
120017
|
+
className: "".concat(iotPrefix$J, "--page-wizard--content")
|
|
120015
120018
|
}, currentStepToRender));
|
|
120016
120019
|
};
|
|
120017
120020
|
|
|
@@ -120206,7 +120209,7 @@
|
|
|
120206
120209
|
}
|
|
120207
120210
|
};
|
|
120208
120211
|
|
|
120209
|
-
var iotPrefix$
|
|
120212
|
+
var iotPrefix$K = settings.iotPrefix;
|
|
120210
120213
|
var PageWizardStepPropTypes = {
|
|
120211
120214
|
/** Step identifier for controlling which step is active */
|
|
120212
120215
|
id: PropTypes.string.isRequired,
|
|
@@ -120298,7 +120301,7 @@
|
|
|
120298
120301
|
onSubmit = _ref.onSubmit,
|
|
120299
120302
|
beforeFooterContent = _ref.beforeFooterContent;
|
|
120300
120303
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
120301
|
-
className: "".concat(iotPrefix$
|
|
120304
|
+
className: "".concat(iotPrefix$K, "--page-wizard--step"),
|
|
120302
120305
|
id: id
|
|
120303
120306
|
}, error ? /*#__PURE__*/React__default.createElement(carbonComponentsReact.InlineNotification, {
|
|
120304
120307
|
lowContrast: true,
|
|
@@ -120308,7 +120311,7 @@
|
|
|
120308
120311
|
onCloseButtonClick: onClearError,
|
|
120309
120312
|
iconDescription: i18n.close
|
|
120310
120313
|
}) : null, children, /*#__PURE__*/React__default.createElement("div", {
|
|
120311
|
-
className: hasStickyFooter ? "".concat(iotPrefix$
|
|
120314
|
+
className: hasStickyFooter ? "".concat(iotPrefix$K, "--page-wizard--content--actions--sticky") : "".concat(iotPrefix$K, "--page-wizard--content--actions")
|
|
120312
120315
|
}, beforeFooterContent, !hasPrev ? /*#__PURE__*/React__default.createElement(Button, {
|
|
120313
120316
|
onClick: onClose,
|
|
120314
120317
|
kind: "secondary"
|
|
@@ -120509,12 +120512,12 @@
|
|
|
120509
120512
|
}
|
|
120510
120513
|
};
|
|
120511
120514
|
|
|
120512
|
-
var iotPrefix$
|
|
120515
|
+
var iotPrefix$L = settings.iotPrefix;
|
|
120513
120516
|
|
|
120514
120517
|
var PageWizardStepContent = function PageWizardStepContent(_ref) {
|
|
120515
120518
|
var children = _ref.children;
|
|
120516
120519
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
120517
|
-
className: "".concat(iotPrefix$
|
|
120520
|
+
className: "".concat(iotPrefix$L, "--page-wizard--step--content")
|
|
120518
120521
|
}, children);
|
|
120519
120522
|
};
|
|
120520
120523
|
|
|
@@ -120544,12 +120547,12 @@
|
|
|
120544
120547
|
}
|
|
120545
120548
|
};
|
|
120546
120549
|
|
|
120547
|
-
var iotPrefix$
|
|
120550
|
+
var iotPrefix$M = settings.iotPrefix;
|
|
120548
120551
|
|
|
120549
120552
|
var PageWizardStepDescription = function PageWizardStepDescription(_ref) {
|
|
120550
120553
|
var children = _ref.children;
|
|
120551
120554
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
120552
|
-
className: "".concat(iotPrefix$
|
|
120555
|
+
className: "".concat(iotPrefix$M, "--page-wizard--step--description")
|
|
120553
120556
|
}, children);
|
|
120554
120557
|
};
|
|
120555
120558
|
|
|
@@ -120579,12 +120582,12 @@
|
|
|
120579
120582
|
}
|
|
120580
120583
|
};
|
|
120581
120584
|
|
|
120582
|
-
var iotPrefix$
|
|
120585
|
+
var iotPrefix$N = settings.iotPrefix;
|
|
120583
120586
|
|
|
120584
120587
|
var PageWizardStepExtraContent = function PageWizardStepExtraContent(_ref) {
|
|
120585
120588
|
var children = _ref.children;
|
|
120586
120589
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
120587
|
-
className: "".concat(iotPrefix$
|
|
120590
|
+
className: "".concat(iotPrefix$N, "--page-wizard--step--extra-content")
|
|
120588
120591
|
}, children);
|
|
120589
120592
|
};
|
|
120590
120593
|
|
|
@@ -120614,12 +120617,12 @@
|
|
|
120614
120617
|
}
|
|
120615
120618
|
};
|
|
120616
120619
|
|
|
120617
|
-
var iotPrefix$
|
|
120620
|
+
var iotPrefix$O = settings.iotPrefix;
|
|
120618
120621
|
|
|
120619
120622
|
var PageWizardStepTitle = function PageWizardStepTitle(_ref) {
|
|
120620
120623
|
var children = _ref.children;
|
|
120621
120624
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
120622
|
-
className: "".concat(iotPrefix$
|
|
120625
|
+
className: "".concat(iotPrefix$O, "--page-wizard--step--title")
|
|
120623
120626
|
}, children);
|
|
120624
120627
|
};
|
|
120625
120628
|
|
|
@@ -122317,7 +122320,7 @@
|
|
|
122317
122320
|
}
|
|
122318
122321
|
};
|
|
122319
122322
|
|
|
122320
|
-
var iotPrefix$
|
|
122323
|
+
var iotPrefix$P = settings.iotPrefix;
|
|
122321
122324
|
var ICON_SWITCH_SIZES = {
|
|
122322
122325
|
small: 'small',
|
|
122323
122326
|
default: 'default',
|
|
@@ -122356,7 +122359,7 @@
|
|
|
122356
122359
|
}
|
|
122357
122360
|
};
|
|
122358
122361
|
|
|
122359
|
-
var classes = classnames(className, "".concat(iotPrefix$
|
|
122362
|
+
var classes = classnames(className, "".concat(iotPrefix$P, "--icon-switch"), "".concat(iotPrefix$P, "--icon-switch--").concat(size), defineProperty$3({}, "".concat(iotPrefix$P, "--icon-switch--unselected"), !selected));
|
|
122360
122363
|
var commonProps = {
|
|
122361
122364
|
onClick: handleClick,
|
|
122362
122365
|
onKeyDown: handleKeyDown,
|
|
@@ -122587,6 +122590,3093 @@
|
|
|
122587
122590
|
"composes": ["carbon-components-react"]
|
|
122588
122591
|
};
|
|
122589
122592
|
|
|
122593
|
+
var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f;
|
|
122594
|
+
|
|
122595
|
+
|
|
122596
|
+
|
|
122597
|
+
|
|
122598
|
+
|
|
122599
|
+
|
|
122600
|
+
var nativeStartsWith = ''.startsWith;
|
|
122601
|
+
var min$9 = Math.min;
|
|
122602
|
+
|
|
122603
|
+
var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
|
|
122604
|
+
// https://github.com/zloirock/core-js/pull/702
|
|
122605
|
+
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
|
|
122606
|
+
var descriptor = getOwnPropertyDescriptor$5(String.prototype, 'startsWith');
|
|
122607
|
+
return descriptor && !descriptor.writable;
|
|
122608
|
+
}();
|
|
122609
|
+
|
|
122610
|
+
// `String.prototype.startsWith` method
|
|
122611
|
+
// https://tc39.github.io/ecma262/#sec-string.prototype.startswith
|
|
122612
|
+
_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
|
122613
|
+
startsWith: function startsWith(searchString /* , position = 0 */) {
|
|
122614
|
+
var that = String(requireObjectCoercible(this));
|
|
122615
|
+
notARegexp(searchString);
|
|
122616
|
+
var index = toLength(min$9(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
|
122617
|
+
var search = String(searchString);
|
|
122618
|
+
return nativeStartsWith
|
|
122619
|
+
? nativeStartsWith.call(that, search, index)
|
|
122620
|
+
: that.slice(index, index + search.length) === search;
|
|
122621
|
+
}
|
|
122622
|
+
});
|
|
122623
|
+
|
|
122624
|
+
// istanbul ignore next
|
|
122625
|
+
var statusDiv = typeof document === 'undefined' ? null : document.getElementById('a11y-status-message');
|
|
122626
|
+
|
|
122627
|
+
var statuses = [];
|
|
122628
|
+
|
|
122629
|
+
function setStatus(status) {
|
|
122630
|
+
var isSameAsLast = statuses[statuses.length - 1] === status;
|
|
122631
|
+
if (isSameAsLast) {
|
|
122632
|
+
statuses = [].concat(statuses, [status]);
|
|
122633
|
+
} else {
|
|
122634
|
+
statuses = [status];
|
|
122635
|
+
}
|
|
122636
|
+
var div = getStatusDiv();
|
|
122637
|
+
|
|
122638
|
+
// Remove previous children
|
|
122639
|
+
while (div.lastChild) {
|
|
122640
|
+
div.removeChild(div.firstChild);
|
|
122641
|
+
}
|
|
122642
|
+
|
|
122643
|
+
statuses.filter(Boolean).forEach(function (statusItem, index) {
|
|
122644
|
+
div.appendChild(getStatusChildDiv(statusItem, index));
|
|
122645
|
+
});
|
|
122646
|
+
}
|
|
122647
|
+
|
|
122648
|
+
function getStatusChildDiv(status, index) {
|
|
122649
|
+
var display = index === statuses.length - 1 ? 'block' : 'none';
|
|
122650
|
+
|
|
122651
|
+
var childDiv = document.createElement('div');
|
|
122652
|
+
childDiv.style.display = display;
|
|
122653
|
+
childDiv.textContent = status;
|
|
122654
|
+
|
|
122655
|
+
return childDiv;
|
|
122656
|
+
}
|
|
122657
|
+
|
|
122658
|
+
function getStatusDiv() {
|
|
122659
|
+
if (statusDiv) {
|
|
122660
|
+
return statusDiv;
|
|
122661
|
+
}
|
|
122662
|
+
statusDiv = document.createElement('div');
|
|
122663
|
+
statusDiv.setAttribute('id', 'a11y-status-message');
|
|
122664
|
+
statusDiv.setAttribute('role', 'status');
|
|
122665
|
+
statusDiv.setAttribute('aria-live', 'assertive');
|
|
122666
|
+
statusDiv.setAttribute('aria-relevant', 'additions text');
|
|
122667
|
+
Object.assign(statusDiv.style, {
|
|
122668
|
+
border: '0',
|
|
122669
|
+
clip: 'rect(0 0 0 0)',
|
|
122670
|
+
height: '1px',
|
|
122671
|
+
margin: '-1px',
|
|
122672
|
+
overflow: 'hidden',
|
|
122673
|
+
padding: '0',
|
|
122674
|
+
position: 'absolute',
|
|
122675
|
+
width: '1px'
|
|
122676
|
+
});
|
|
122677
|
+
document.body.appendChild(statusDiv);
|
|
122678
|
+
return statusDiv;
|
|
122679
|
+
}
|
|
122680
|
+
|
|
122681
|
+
var idCounter$1 = 0;
|
|
122682
|
+
|
|
122683
|
+
/**
|
|
122684
|
+
* Accepts a parameter and returns it if it's a function
|
|
122685
|
+
* or a noop function if it's not. This allows us to
|
|
122686
|
+
* accept a callback, but not worry about it if it's not
|
|
122687
|
+
* passed.
|
|
122688
|
+
* @param {Function} cb the callback
|
|
122689
|
+
* @return {Function} a function
|
|
122690
|
+
*/
|
|
122691
|
+
function cbToCb(cb) {
|
|
122692
|
+
return typeof cb === 'function' ? cb : noop$4;
|
|
122693
|
+
}
|
|
122694
|
+
function noop$4() {}
|
|
122695
|
+
|
|
122696
|
+
function findParent(finder, node, rootNode) {
|
|
122697
|
+
if (node !== null && node !== rootNode.parentNode) {
|
|
122698
|
+
if (finder(node)) {
|
|
122699
|
+
if (node === document.body && node.scrollTop === 0) {
|
|
122700
|
+
// in chrome body.scrollTop always return 0
|
|
122701
|
+
return document.documentElement;
|
|
122702
|
+
}
|
|
122703
|
+
return node;
|
|
122704
|
+
} else {
|
|
122705
|
+
return findParent(finder, node.parentNode, rootNode);
|
|
122706
|
+
}
|
|
122707
|
+
} else {
|
|
122708
|
+
return null;
|
|
122709
|
+
}
|
|
122710
|
+
}
|
|
122711
|
+
|
|
122712
|
+
/**
|
|
122713
|
+
* Get the closest element that scrolls
|
|
122714
|
+
* @param {HTMLElement} node - the child element to start searching for scroll parent at
|
|
122715
|
+
* @param {HTMLElement} rootNode - the root element of the component
|
|
122716
|
+
* @return {HTMLElement} the closest parentNode that scrolls
|
|
122717
|
+
*/
|
|
122718
|
+
var getClosestScrollParent = findParent.bind(null, function (node) {
|
|
122719
|
+
return node.scrollHeight > node.clientHeight;
|
|
122720
|
+
});
|
|
122721
|
+
|
|
122722
|
+
/**
|
|
122723
|
+
* Scroll node into view if necessary
|
|
122724
|
+
* @param {HTMLElement} node - the element that should scroll into view
|
|
122725
|
+
* @param {HTMLElement} rootNode - the root element of the component
|
|
122726
|
+
* @param {Boolean} alignToTop - align element to the top of the visible area of the scrollable ancestor
|
|
122727
|
+
*/
|
|
122728
|
+
// eslint-disable-next-line complexity
|
|
122729
|
+
function scrollIntoView(node, rootNode) {
|
|
122730
|
+
var scrollParent = getClosestScrollParent(node, rootNode);
|
|
122731
|
+
if (scrollParent === null) {
|
|
122732
|
+
return;
|
|
122733
|
+
}
|
|
122734
|
+
var scrollParentStyles = getComputedStyle(scrollParent);
|
|
122735
|
+
var scrollParentRect = scrollParent.getBoundingClientRect();
|
|
122736
|
+
var scrollParentBorderTopWidth = parseInt(scrollParentStyles.borderTopWidth, 10);
|
|
122737
|
+
var scrollParentBorderBottomWidth = parseInt(scrollParentStyles.borderBottomWidth, 10);
|
|
122738
|
+
var bordersWidth = scrollParentBorderTopWidth + scrollParentBorderBottomWidth;
|
|
122739
|
+
var scrollParentTop = scrollParentRect.top + scrollParentBorderTopWidth;
|
|
122740
|
+
var nodeRect = node.getBoundingClientRect();
|
|
122741
|
+
|
|
122742
|
+
if (nodeRect.top < 0 && scrollParentRect.top < 0) {
|
|
122743
|
+
scrollParent.scrollTop += nodeRect.top;
|
|
122744
|
+
return;
|
|
122745
|
+
}
|
|
122746
|
+
|
|
122747
|
+
if (nodeRect.top < 0) {
|
|
122748
|
+
// the item is above the viewport and the parent is not above the viewport
|
|
122749
|
+
scrollParent.scrollTop += nodeRect.top - scrollParentTop;
|
|
122750
|
+
return;
|
|
122751
|
+
}
|
|
122752
|
+
|
|
122753
|
+
if (nodeRect.top > 0 && scrollParentRect.top < 0) {
|
|
122754
|
+
if (scrollParentRect.bottom > 0 && nodeRect.bottom + bordersWidth > scrollParentRect.bottom) {
|
|
122755
|
+
// the item is below scrollable area
|
|
122756
|
+
scrollParent.scrollTop += nodeRect.bottom - scrollParentRect.bottom + bordersWidth;
|
|
122757
|
+
}
|
|
122758
|
+
// item and parent top are on different sides of view top border (do nothing)
|
|
122759
|
+
return;
|
|
122760
|
+
}
|
|
122761
|
+
|
|
122762
|
+
var nodeOffsetTop = nodeRect.top + scrollParent.scrollTop;
|
|
122763
|
+
var nodeTop = nodeOffsetTop - scrollParentTop;
|
|
122764
|
+
if (nodeTop < scrollParent.scrollTop) {
|
|
122765
|
+
// the item is above the scrollable area
|
|
122766
|
+
scrollParent.scrollTop = nodeTop;
|
|
122767
|
+
} else if (nodeTop + nodeRect.height + bordersWidth > scrollParent.scrollTop + scrollParentRect.height) {
|
|
122768
|
+
// the item is below the scrollable area
|
|
122769
|
+
scrollParent.scrollTop = nodeTop + nodeRect.height - scrollParentRect.height + bordersWidth;
|
|
122770
|
+
}
|
|
122771
|
+
// the item is within the scrollable area (do nothing)
|
|
122772
|
+
}
|
|
122773
|
+
|
|
122774
|
+
/**
|
|
122775
|
+
* @param {HTMLElement} parent the parent node
|
|
122776
|
+
* @param {HTMLElement} child the child node
|
|
122777
|
+
* @return {Boolean} whether the parent is the child or the child is in the parent
|
|
122778
|
+
*/
|
|
122779
|
+
function isOrContainsNode(parent, child) {
|
|
122780
|
+
return parent === child || parent.contains(child);
|
|
122781
|
+
}
|
|
122782
|
+
|
|
122783
|
+
/**
|
|
122784
|
+
* Simple debounce implementation. Will call the given
|
|
122785
|
+
* function once after the time given has passed since
|
|
122786
|
+
* it was last called.
|
|
122787
|
+
* @param {Function} fn the function to call after the time
|
|
122788
|
+
* @param {Number} time the time to wait
|
|
122789
|
+
* @return {Function} the debounced function
|
|
122790
|
+
*/
|
|
122791
|
+
function debounce$5(fn, time) {
|
|
122792
|
+
var timeoutId = void 0;
|
|
122793
|
+
return wrapper;
|
|
122794
|
+
function wrapper() {
|
|
122795
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
122796
|
+
args[_key] = arguments[_key];
|
|
122797
|
+
}
|
|
122798
|
+
|
|
122799
|
+
if (timeoutId) {
|
|
122800
|
+
clearTimeout(timeoutId);
|
|
122801
|
+
}
|
|
122802
|
+
timeoutId = setTimeout(function () {
|
|
122803
|
+
timeoutId = null;
|
|
122804
|
+
fn.apply(undefined, args);
|
|
122805
|
+
}, time);
|
|
122806
|
+
}
|
|
122807
|
+
}
|
|
122808
|
+
|
|
122809
|
+
/**
|
|
122810
|
+
* This is intended to be used to compose event handlers.
|
|
122811
|
+
* They are executed in order until one of them sets
|
|
122812
|
+
* `event.preventDownshiftDefault = true`.
|
|
122813
|
+
* @param {Function} fns the event handler functions
|
|
122814
|
+
* @return {Function} the event handler to add to an element
|
|
122815
|
+
*/
|
|
122816
|
+
function composeEventHandlers() {
|
|
122817
|
+
for (var _len2 = arguments.length, fns = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
122818
|
+
fns[_key2] = arguments[_key2];
|
|
122819
|
+
}
|
|
122820
|
+
|
|
122821
|
+
return function (event) {
|
|
122822
|
+
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
122823
|
+
args[_key3 - 1] = arguments[_key3];
|
|
122824
|
+
}
|
|
122825
|
+
|
|
122826
|
+
return fns.some(function (fn) {
|
|
122827
|
+
fn && fn.apply(undefined, [event].concat(args));
|
|
122828
|
+
// TODO: remove everything after the || in the next breaking change
|
|
122829
|
+
return event.preventDownshiftDefault || event.defaultPrevented;
|
|
122830
|
+
});
|
|
122831
|
+
};
|
|
122832
|
+
}
|
|
122833
|
+
|
|
122834
|
+
/**
|
|
122835
|
+
* This generates a unique ID for an instance of Downshift
|
|
122836
|
+
* @return {String} the unique ID
|
|
122837
|
+
*/
|
|
122838
|
+
function generateId() {
|
|
122839
|
+
return String(idCounter$1++);
|
|
122840
|
+
}
|
|
122841
|
+
|
|
122842
|
+
/**
|
|
122843
|
+
* Resets idCounter to 0. Used for SSR.
|
|
122844
|
+
*/
|
|
122845
|
+
function resetIdCounter() {
|
|
122846
|
+
idCounter$1 = 0;
|
|
122847
|
+
}
|
|
122848
|
+
|
|
122849
|
+
/**
|
|
122850
|
+
* Returns the first argument that is not undefined
|
|
122851
|
+
* @param {...*} args the arguments
|
|
122852
|
+
* @return {*} the defined value
|
|
122853
|
+
*/
|
|
122854
|
+
function firstDefined() {
|
|
122855
|
+
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
122856
|
+
args[_key4] = arguments[_key4];
|
|
122857
|
+
}
|
|
122858
|
+
|
|
122859
|
+
return args.find(function (a) {
|
|
122860
|
+
return typeof a !== 'undefined';
|
|
122861
|
+
});
|
|
122862
|
+
}
|
|
122863
|
+
|
|
122864
|
+
// eslint-disable-next-line complexity
|
|
122865
|
+
function getA11yStatusMessage(_ref) {
|
|
122866
|
+
var isOpen = _ref.isOpen,
|
|
122867
|
+
highlightedItem = _ref.highlightedItem,
|
|
122868
|
+
selectedItem = _ref.selectedItem,
|
|
122869
|
+
resultCount = _ref.resultCount,
|
|
122870
|
+
previousResultCount = _ref.previousResultCount,
|
|
122871
|
+
itemToString = _ref.itemToString;
|
|
122872
|
+
|
|
122873
|
+
if (!isOpen) {
|
|
122874
|
+
if (selectedItem) {
|
|
122875
|
+
return itemToString(selectedItem);
|
|
122876
|
+
} else {
|
|
122877
|
+
return '';
|
|
122878
|
+
}
|
|
122879
|
+
}
|
|
122880
|
+
|
|
122881
|
+
if (!resultCount) {
|
|
122882
|
+
return 'No results.';
|
|
122883
|
+
} else if (!highlightedItem || resultCount !== previousResultCount) {
|
|
122884
|
+
return resultCount + ' ' + (resultCount === 1 ? 'result is' : 'results are') + ' available, use up and down arrow keys to navigate.';
|
|
122885
|
+
}
|
|
122886
|
+
return itemToString(highlightedItem);
|
|
122887
|
+
}
|
|
122888
|
+
|
|
122889
|
+
/**
|
|
122890
|
+
* Takes an argument and if it's an array, returns the first item in the array
|
|
122891
|
+
* otherwise returns the argument
|
|
122892
|
+
* @param {*} arg the maybe-array
|
|
122893
|
+
* @param {*} defaultValue the value if arg is falsey not defined
|
|
122894
|
+
* @return {*} the arg or it's first item
|
|
122895
|
+
*/
|
|
122896
|
+
function unwrapArray(arg, defaultValue) {
|
|
122897
|
+
arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */arg[0] : arg;
|
|
122898
|
+
if (!arg && defaultValue) {
|
|
122899
|
+
return defaultValue;
|
|
122900
|
+
} else {
|
|
122901
|
+
return arg;
|
|
122902
|
+
}
|
|
122903
|
+
}
|
|
122904
|
+
|
|
122905
|
+
/**
|
|
122906
|
+
* @param {Object} element (P)react element
|
|
122907
|
+
* @return {Boolean} whether it's a DOM element
|
|
122908
|
+
*/
|
|
122909
|
+
function isDOMElement(element) {
|
|
122910
|
+
/* istanbul ignore if */
|
|
122911
|
+
if (element.nodeName) {
|
|
122912
|
+
// then this is preact
|
|
122913
|
+
return typeof element.nodeName === 'string';
|
|
122914
|
+
} else {
|
|
122915
|
+
// then we assume this is react
|
|
122916
|
+
return typeof element.type === 'string';
|
|
122917
|
+
}
|
|
122918
|
+
}
|
|
122919
|
+
|
|
122920
|
+
/**
|
|
122921
|
+
* @param {Object} element (P)react element
|
|
122922
|
+
* @return {Object} the props
|
|
122923
|
+
*/
|
|
122924
|
+
function getElementProps(element) {
|
|
122925
|
+
// props for react, attributes for preact
|
|
122926
|
+
return element.props || /* istanbul ignore next (preact) */element.attributes;
|
|
122927
|
+
}
|
|
122928
|
+
|
|
122929
|
+
/**
|
|
122930
|
+
* Throws a helpful error message for required properties. Useful
|
|
122931
|
+
* to be used as a default in destructuring or object params.
|
|
122932
|
+
* @param {String} fnName the function name
|
|
122933
|
+
* @param {String} propName the prop name
|
|
122934
|
+
*/
|
|
122935
|
+
function requiredProp(fnName, propName) {
|
|
122936
|
+
throw new Error('The property "' + propName + '" is required in "' + fnName + '"');
|
|
122937
|
+
}
|
|
122938
|
+
|
|
122939
|
+
var stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
|
|
122940
|
+
/**
|
|
122941
|
+
* @param {Object} state The state object
|
|
122942
|
+
* @return {Object} State that is relevant to downshift
|
|
122943
|
+
*/
|
|
122944
|
+
function pickState() {
|
|
122945
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
122946
|
+
|
|
122947
|
+
var result = {};
|
|
122948
|
+
stateKeys.forEach(function (k) {
|
|
122949
|
+
if (state.hasOwnProperty(k)) {
|
|
122950
|
+
result[k] = state[k];
|
|
122951
|
+
}
|
|
122952
|
+
});
|
|
122953
|
+
return result;
|
|
122954
|
+
}
|
|
122955
|
+
|
|
122956
|
+
/**
|
|
122957
|
+
* Normalizes the 'key' property of a KeyboardEvent in IE/Edge
|
|
122958
|
+
* @param {Object} event a KeyboardEvent object
|
|
122959
|
+
* @return {String} keyboard key
|
|
122960
|
+
*/
|
|
122961
|
+
function normalizeArrowKey(event) {
|
|
122962
|
+
var key = event.key,
|
|
122963
|
+
keyCode = event.keyCode;
|
|
122964
|
+
/* istanbul ignore next (ie) */
|
|
122965
|
+
|
|
122966
|
+
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
|
|
122967
|
+
return 'Arrow' + key;
|
|
122968
|
+
}
|
|
122969
|
+
return key;
|
|
122970
|
+
}
|
|
122971
|
+
|
|
122972
|
+
/**
|
|
122973
|
+
* Simple check if the value passed is object literal
|
|
122974
|
+
* @param {*} obj any things
|
|
122975
|
+
* @return {Boolean} whether it's object literal
|
|
122976
|
+
*/
|
|
122977
|
+
function isPlainObject$3(obj) {
|
|
122978
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
122979
|
+
}
|
|
122980
|
+
|
|
122981
|
+
var classCallCheck$2 = function (instance, Constructor) {
|
|
122982
|
+
if (!(instance instanceof Constructor)) {
|
|
122983
|
+
throw new TypeError("Cannot call a class as a function");
|
|
122984
|
+
}
|
|
122985
|
+
};
|
|
122986
|
+
|
|
122987
|
+
var _extends$k = Object.assign || function (target) {
|
|
122988
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
122989
|
+
var source = arguments[i];
|
|
122990
|
+
|
|
122991
|
+
for (var key in source) {
|
|
122992
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
122993
|
+
target[key] = source[key];
|
|
122994
|
+
}
|
|
122995
|
+
}
|
|
122996
|
+
}
|
|
122997
|
+
|
|
122998
|
+
return target;
|
|
122999
|
+
};
|
|
123000
|
+
|
|
123001
|
+
var inherits$2 = function (subClass, superClass) {
|
|
123002
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
123003
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
123004
|
+
}
|
|
123005
|
+
|
|
123006
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
123007
|
+
constructor: {
|
|
123008
|
+
value: subClass,
|
|
123009
|
+
enumerable: false,
|
|
123010
|
+
writable: true,
|
|
123011
|
+
configurable: true
|
|
123012
|
+
}
|
|
123013
|
+
});
|
|
123014
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
123015
|
+
};
|
|
123016
|
+
|
|
123017
|
+
var objectWithoutProperties$2 = function (obj, keys) {
|
|
123018
|
+
var target = {};
|
|
123019
|
+
|
|
123020
|
+
for (var i in obj) {
|
|
123021
|
+
if (keys.indexOf(i) >= 0) continue;
|
|
123022
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
|
123023
|
+
target[i] = obj[i];
|
|
123024
|
+
}
|
|
123025
|
+
|
|
123026
|
+
return target;
|
|
123027
|
+
};
|
|
123028
|
+
|
|
123029
|
+
var possibleConstructorReturn$2 = function (self, call) {
|
|
123030
|
+
if (!self) {
|
|
123031
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
123032
|
+
}
|
|
123033
|
+
|
|
123034
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
123035
|
+
};
|
|
123036
|
+
|
|
123037
|
+
/* eslint camelcase:0 */
|
|
123038
|
+
|
|
123039
|
+
var Downshift = function (_Component) {
|
|
123040
|
+
inherits$2(Downshift, _Component);
|
|
123041
|
+
|
|
123042
|
+
function Downshift() {
|
|
123043
|
+
classCallCheck$2(this, Downshift);
|
|
123044
|
+
|
|
123045
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
123046
|
+
args[_key] = arguments[_key];
|
|
123047
|
+
}
|
|
123048
|
+
|
|
123049
|
+
var _this = possibleConstructorReturn$2(this, _Component.call.apply(_Component, [this].concat(args)));
|
|
123050
|
+
|
|
123051
|
+
_initialiseProps$1.call(_this);
|
|
123052
|
+
|
|
123053
|
+
var state = _this.getState({
|
|
123054
|
+
highlightedIndex: _this.props.defaultHighlightedIndex,
|
|
123055
|
+
isOpen: _this.props.defaultIsOpen,
|
|
123056
|
+
inputValue: _this.props.defaultInputValue,
|
|
123057
|
+
selectedItem: _this.props.defaultSelectedItem
|
|
123058
|
+
});
|
|
123059
|
+
if (state.selectedItem != null) {
|
|
123060
|
+
state.inputValue = _this.props.itemToString(state.selectedItem);
|
|
123061
|
+
}
|
|
123062
|
+
_this.state = state;
|
|
123063
|
+
_this.id = _this.props.id || 'downshift-' + generateId();
|
|
123064
|
+
return _this;
|
|
123065
|
+
}
|
|
123066
|
+
// itemCount can be changed asynchronously
|
|
123067
|
+
// from within downshift (so it can't come from a prop)
|
|
123068
|
+
// this is why we store it as an instance and use
|
|
123069
|
+
// getItemCount rather than just use items.length
|
|
123070
|
+
// (to support windowing + async)
|
|
123071
|
+
|
|
123072
|
+
|
|
123073
|
+
/**
|
|
123074
|
+
* Gets the state based on internal state or props
|
|
123075
|
+
* If a state value is passed via props, then that
|
|
123076
|
+
* is the value given, otherwise it's retrieved from
|
|
123077
|
+
* stateToMerge
|
|
123078
|
+
*
|
|
123079
|
+
* This will perform a shallow merge of the given state object
|
|
123080
|
+
* with the state coming from props
|
|
123081
|
+
* (for the controlled component scenario)
|
|
123082
|
+
* This is used in state updater functions so they're referencing
|
|
123083
|
+
* the right state regardless of where it comes from.
|
|
123084
|
+
*
|
|
123085
|
+
* @param {Object} stateToMerge defaults to this.state
|
|
123086
|
+
* @return {Object} the state
|
|
123087
|
+
*/
|
|
123088
|
+
Downshift.prototype.getState = function getState() {
|
|
123089
|
+
var _this2 = this;
|
|
123090
|
+
|
|
123091
|
+
var stateToMerge = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state;
|
|
123092
|
+
|
|
123093
|
+
return Object.keys(stateToMerge).reduce(function (state, key) {
|
|
123094
|
+
state[key] = _this2.isControlledProp(key) ? _this2.props[key] : stateToMerge[key];
|
|
123095
|
+
return state;
|
|
123096
|
+
}, {});
|
|
123097
|
+
};
|
|
123098
|
+
|
|
123099
|
+
/**
|
|
123100
|
+
* This determines whether a prop is a "controlled prop" meaning it is
|
|
123101
|
+
* state which is controlled by the outside of this component rather
|
|
123102
|
+
* than within this component.
|
|
123103
|
+
* @param {String} key the key to check
|
|
123104
|
+
* @return {Boolean} whether it is a controlled controlled prop
|
|
123105
|
+
*/
|
|
123106
|
+
|
|
123107
|
+
|
|
123108
|
+
Downshift.prototype.isControlledProp = function isControlledProp(key) {
|
|
123109
|
+
return this.props[key] !== undefined;
|
|
123110
|
+
};
|
|
123111
|
+
|
|
123112
|
+
Downshift.prototype.getItemCount = function getItemCount() {
|
|
123113
|
+
// things read better this way. They're in priority order:
|
|
123114
|
+
// 1. `this.itemCount`
|
|
123115
|
+
// 2. `this.props.itemCount`
|
|
123116
|
+
// 3. `this.items.length`
|
|
123117
|
+
/* eslint-disable no-negated-condition */
|
|
123118
|
+
if (this.itemCount != null) {
|
|
123119
|
+
return this.itemCount;
|
|
123120
|
+
} else if (this.props.itemCount !== undefined) {
|
|
123121
|
+
return this.props.itemCount;
|
|
123122
|
+
} else {
|
|
123123
|
+
return this.items.length;
|
|
123124
|
+
}
|
|
123125
|
+
/* eslint-enable no-negated-condition */
|
|
123126
|
+
};
|
|
123127
|
+
|
|
123128
|
+
Downshift.prototype.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
|
|
123129
|
+
return this.props.environment.document.getElementById(this.getItemId(index));
|
|
123130
|
+
};
|
|
123131
|
+
|
|
123132
|
+
Downshift.prototype.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
|
|
123133
|
+
/* istanbul ignore else (react-native) */
|
|
123134
|
+
{
|
|
123135
|
+
var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
|
|
123136
|
+
scrollIntoView(node, this._rootNode);
|
|
123137
|
+
}
|
|
123138
|
+
};
|
|
123139
|
+
|
|
123140
|
+
Downshift.prototype.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
|
|
123141
|
+
if (this.getState().isOpen) {
|
|
123142
|
+
this.changeHighlightedIndex(amount, otherStateToSet);
|
|
123143
|
+
} else {
|
|
123144
|
+
this.setHighlightedIndex(undefined, _extends$k({ isOpen: true }, otherStateToSet));
|
|
123145
|
+
}
|
|
123146
|
+
};
|
|
123147
|
+
|
|
123148
|
+
// eslint-disable-next-line complexity
|
|
123149
|
+
|
|
123150
|
+
|
|
123151
|
+
Downshift.prototype.changeHighlightedIndex = function changeHighlightedIndex(moveAmount, otherStateToSet) {
|
|
123152
|
+
var itemsLastIndex = this.getItemCount() - 1;
|
|
123153
|
+
if (itemsLastIndex < 0) {
|
|
123154
|
+
return;
|
|
123155
|
+
}
|
|
123156
|
+
|
|
123157
|
+
var _getState = this.getState(),
|
|
123158
|
+
highlightedIndex = _getState.highlightedIndex;
|
|
123159
|
+
|
|
123160
|
+
var baseIndex = highlightedIndex;
|
|
123161
|
+
if (baseIndex === null) {
|
|
123162
|
+
baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
|
|
123163
|
+
}
|
|
123164
|
+
var newIndex = baseIndex + moveAmount;
|
|
123165
|
+
if (newIndex < 0) {
|
|
123166
|
+
newIndex = itemsLastIndex;
|
|
123167
|
+
} else if (newIndex > itemsLastIndex) {
|
|
123168
|
+
newIndex = 0;
|
|
123169
|
+
}
|
|
123170
|
+
this.setHighlightedIndex(newIndex, otherStateToSet);
|
|
123171
|
+
};
|
|
123172
|
+
|
|
123173
|
+
// any piece of our state can live in two places:
|
|
123174
|
+
// 1. Uncontrolled: it's internal (this.state)
|
|
123175
|
+
// We will call this.setState to update that state
|
|
123176
|
+
// 2. Controlled: it's external (this.props)
|
|
123177
|
+
// We will call this.props.onStateChange to update that state
|
|
123178
|
+
//
|
|
123179
|
+
// In addition, we'll call this.props.onChange if the
|
|
123180
|
+
// selectedItem is changed.
|
|
123181
|
+
|
|
123182
|
+
|
|
123183
|
+
Downshift.prototype.getStateAndHelpers = function getStateAndHelpers() {
|
|
123184
|
+
var _getState2 = this.getState(),
|
|
123185
|
+
highlightedIndex = _getState2.highlightedIndex,
|
|
123186
|
+
inputValue = _getState2.inputValue,
|
|
123187
|
+
selectedItem = _getState2.selectedItem,
|
|
123188
|
+
isOpen = _getState2.isOpen;
|
|
123189
|
+
|
|
123190
|
+
var itemToString = this.props.itemToString;
|
|
123191
|
+
var id = this.id;
|
|
123192
|
+
var getRootProps = this.getRootProps,
|
|
123193
|
+
getButtonProps = this.getButtonProps,
|
|
123194
|
+
getToggleButtonProps = this.getToggleButtonProps,
|
|
123195
|
+
getLabelProps = this.getLabelProps,
|
|
123196
|
+
getInputProps = this.getInputProps,
|
|
123197
|
+
getItemProps = this.getItemProps,
|
|
123198
|
+
openMenu = this.openMenu,
|
|
123199
|
+
closeMenu = this.closeMenu,
|
|
123200
|
+
toggleMenu = this.toggleMenu,
|
|
123201
|
+
selectItem = this.selectItem,
|
|
123202
|
+
selectItemAtIndex = this.selectItemAtIndex,
|
|
123203
|
+
selectHighlightedItem = this.selectHighlightedItem,
|
|
123204
|
+
setHighlightedIndex = this.setHighlightedIndex,
|
|
123205
|
+
clearSelection = this.clearSelection,
|
|
123206
|
+
clearItems = this.clearItems,
|
|
123207
|
+
reset = this.reset,
|
|
123208
|
+
setItemCount = this.setItemCount,
|
|
123209
|
+
unsetItemCount = this.unsetItemCount,
|
|
123210
|
+
setState = this.internalSetState;
|
|
123211
|
+
|
|
123212
|
+
return {
|
|
123213
|
+
// prop getters
|
|
123214
|
+
getRootProps: getRootProps,
|
|
123215
|
+
getButtonProps: getButtonProps,
|
|
123216
|
+
getToggleButtonProps: getToggleButtonProps,
|
|
123217
|
+
getLabelProps: getLabelProps,
|
|
123218
|
+
getInputProps: getInputProps,
|
|
123219
|
+
getItemProps: getItemProps,
|
|
123220
|
+
|
|
123221
|
+
// actions
|
|
123222
|
+
reset: reset,
|
|
123223
|
+
openMenu: openMenu,
|
|
123224
|
+
closeMenu: closeMenu,
|
|
123225
|
+
toggleMenu: toggleMenu,
|
|
123226
|
+
selectItem: selectItem,
|
|
123227
|
+
selectItemAtIndex: selectItemAtIndex,
|
|
123228
|
+
selectHighlightedItem: selectHighlightedItem,
|
|
123229
|
+
setHighlightedIndex: setHighlightedIndex,
|
|
123230
|
+
clearSelection: clearSelection,
|
|
123231
|
+
clearItems: clearItems,
|
|
123232
|
+
setItemCount: setItemCount,
|
|
123233
|
+
unsetItemCount: unsetItemCount,
|
|
123234
|
+
setState: setState,
|
|
123235
|
+
|
|
123236
|
+
//props
|
|
123237
|
+
itemToString: itemToString,
|
|
123238
|
+
|
|
123239
|
+
//derived
|
|
123240
|
+
id: id,
|
|
123241
|
+
|
|
123242
|
+
// state
|
|
123243
|
+
highlightedIndex: highlightedIndex,
|
|
123244
|
+
inputValue: inputValue,
|
|
123245
|
+
isOpen: isOpen,
|
|
123246
|
+
selectedItem: selectedItem
|
|
123247
|
+
};
|
|
123248
|
+
};
|
|
123249
|
+
|
|
123250
|
+
//////////////////////////// ROOT
|
|
123251
|
+
|
|
123252
|
+
//\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
|
|
123253
|
+
|
|
123254
|
+
//////////////////////////// BUTTON
|
|
123255
|
+
|
|
123256
|
+
// TODO: remove this in 2.0.0 and just call it `getToggleButtonProps`
|
|
123257
|
+
|
|
123258
|
+
|
|
123259
|
+
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
|
|
123260
|
+
|
|
123261
|
+
/////////////////////////////// LABEL
|
|
123262
|
+
|
|
123263
|
+
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL
|
|
123264
|
+
|
|
123265
|
+
/////////////////////////////// INPUT
|
|
123266
|
+
|
|
123267
|
+
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT
|
|
123268
|
+
|
|
123269
|
+
/////////////////////////////// ITEM
|
|
123270
|
+
Downshift.prototype.getItemId = function getItemId(index) {
|
|
123271
|
+
return this.id + '-item-' + index;
|
|
123272
|
+
};
|
|
123273
|
+
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM
|
|
123274
|
+
|
|
123275
|
+
Downshift.prototype.componentDidMount = function componentDidMount() {
|
|
123276
|
+
var _this3 = this;
|
|
123277
|
+
|
|
123278
|
+
// the _isMounted property is because we have `updateStatus` in a `debounce`
|
|
123279
|
+
// and we don't want to update the status if the component has been umounted
|
|
123280
|
+
this._isMounted = true;
|
|
123281
|
+
/* istanbul ignore if (react-native) */
|
|
123282
|
+
{
|
|
123283
|
+
// this.isMouseDown helps us track whether the mouse is currently held down.
|
|
123284
|
+
// This is useful when the user clicks on an item in the list, but holds the mouse
|
|
123285
|
+
// down long enough for the list to disappear (because the blur event fires on the input)
|
|
123286
|
+
// this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
|
|
123287
|
+
// trigger hiding the menu.
|
|
123288
|
+
var onMouseDown = function () {
|
|
123289
|
+
_this3.isMouseDown = true;
|
|
123290
|
+
};
|
|
123291
|
+
var onMouseUp = function (event) {
|
|
123292
|
+
var document = _this3.props.environment.document;
|
|
123293
|
+
|
|
123294
|
+
_this3.isMouseDown = false;
|
|
123295
|
+
var targetInDownshift = _this3._rootNode && isOrContainsNode(_this3._rootNode, event.target);
|
|
123296
|
+
var activeElementInDownshift = _this3._rootNode && isOrContainsNode(_this3._rootNode, document.activeElement);
|
|
123297
|
+
if (!targetInDownshift && !activeElementInDownshift && _this3.getState().isOpen) {
|
|
123298
|
+
_this3.reset({ type: Downshift.stateChangeTypes.mouseUp }, function () {
|
|
123299
|
+
return _this3.props.onOuterClick(_this3.getStateAndHelpers());
|
|
123300
|
+
});
|
|
123301
|
+
}
|
|
123302
|
+
};
|
|
123303
|
+
// Touching an element in iOS gives focus and hover states, but touching out of
|
|
123304
|
+
// the element will remove hover, and persist the focus state, resulting in the
|
|
123305
|
+
// blur event not being triggered.
|
|
123306
|
+
var onTouchStart = function (event) {
|
|
123307
|
+
var targetInDownshift = _this3._rootNode && isOrContainsNode(_this3._rootNode, event.target);
|
|
123308
|
+
if (!targetInDownshift && _this3.getState().isOpen) {
|
|
123309
|
+
_this3.reset({ type: Downshift.stateChangeTypes.touchStart }, function () {
|
|
123310
|
+
return _this3.props.onOuterClick(_this3.getStateAndHelpers());
|
|
123311
|
+
});
|
|
123312
|
+
}
|
|
123313
|
+
};
|
|
123314
|
+
|
|
123315
|
+
this.props.environment.addEventListener('mousedown', onMouseDown);
|
|
123316
|
+
this.props.environment.addEventListener('mouseup', onMouseUp);
|
|
123317
|
+
this.props.environment.addEventListener('touchstart', onTouchStart);
|
|
123318
|
+
|
|
123319
|
+
this.cleanup = function () {
|
|
123320
|
+
_this3._isMounted = false;
|
|
123321
|
+
_this3.props.environment.removeEventListener('mousedown', onMouseDown);
|
|
123322
|
+
_this3.props.environment.removeEventListener('mouseup', onMouseUp);
|
|
123323
|
+
_this3.props.environment.removeEventListener('touchstart', onTouchStart);
|
|
123324
|
+
};
|
|
123325
|
+
}
|
|
123326
|
+
};
|
|
123327
|
+
|
|
123328
|
+
Downshift.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
123329
|
+
if (this.isControlledProp('selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {
|
|
123330
|
+
this.internalSetState({
|
|
123331
|
+
type: Downshift.stateChangeTypes.controlledPropUpdatedSelectedItem,
|
|
123332
|
+
inputValue: this.props.itemToString(this.props.selectedItem)
|
|
123333
|
+
});
|
|
123334
|
+
}
|
|
123335
|
+
|
|
123336
|
+
var current = this.props.highlightedIndex === undefined ? this.state : this.props;
|
|
123337
|
+
var prev = prevProps.highlightedIndex === undefined ? prevState : prevProps;
|
|
123338
|
+
|
|
123339
|
+
if (current.highlightedIndex !== prev.highlightedIndex && !this.avoidScrolling) {
|
|
123340
|
+
this.scrollHighlightedItemIntoView();
|
|
123341
|
+
}
|
|
123342
|
+
|
|
123343
|
+
this.updateStatus();
|
|
123344
|
+
};
|
|
123345
|
+
|
|
123346
|
+
Downshift.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
123347
|
+
this.cleanup(); // avoids memory leak
|
|
123348
|
+
};
|
|
123349
|
+
|
|
123350
|
+
// eslint-disable-next-line complexity
|
|
123351
|
+
|
|
123352
|
+
|
|
123353
|
+
Downshift.prototype.render = function render() {
|
|
123354
|
+
var children = unwrapArray(this.props.render || this.props.children, noop$4);
|
|
123355
|
+
// because the items are rerendered every time we call the children
|
|
123356
|
+
// we clear this out each render and
|
|
123357
|
+
this.clearItems();
|
|
123358
|
+
// we reset this so we know whether the user calls getRootProps during
|
|
123359
|
+
// this render. If they do then we don't need to do anything,
|
|
123360
|
+
// if they don't then we need to clone the element they return and
|
|
123361
|
+
// apply the props for them.
|
|
123362
|
+
this.getRootProps.called = false;
|
|
123363
|
+
this.getRootProps.refKey = undefined;
|
|
123364
|
+
this.getRootProps.suppressRefError = undefined;
|
|
123365
|
+
// we do something similar for getLabelProps
|
|
123366
|
+
this.getLabelProps.called = false;
|
|
123367
|
+
// and something similar for getInputProps
|
|
123368
|
+
this.getInputProps.called = false;
|
|
123369
|
+
var element = unwrapArray(children(this.getStateAndHelpers()));
|
|
123370
|
+
if (!element) {
|
|
123371
|
+
return null;
|
|
123372
|
+
}
|
|
123373
|
+
if (this.getRootProps.called) {
|
|
123374
|
+
if (!this.getRootProps.suppressRefError) {
|
|
123375
|
+
validateGetRootPropsCalledCorrectly(element, this.getRootProps);
|
|
123376
|
+
}
|
|
123377
|
+
return element;
|
|
123378
|
+
} else if (isDOMElement(element)) {
|
|
123379
|
+
// they didn't apply the root props, but we can clone
|
|
123380
|
+
// this and apply the props ourselves
|
|
123381
|
+
return React__default.cloneElement(element, this.getRootProps(getElementProps(element)));
|
|
123382
|
+
} else {
|
|
123383
|
+
// they didn't apply the root props, but they need to
|
|
123384
|
+
// otherwise we can't query around the autocomplete
|
|
123385
|
+
throw new Error('downshift: If you return a non-DOM element, you must use apply the getRootProps function');
|
|
123386
|
+
}
|
|
123387
|
+
};
|
|
123388
|
+
|
|
123389
|
+
return Downshift;
|
|
123390
|
+
}(React.Component);
|
|
123391
|
+
|
|
123392
|
+
Downshift.defaultProps = {
|
|
123393
|
+
defaultHighlightedIndex: null,
|
|
123394
|
+
defaultSelectedItem: null,
|
|
123395
|
+
defaultInputValue: '',
|
|
123396
|
+
defaultIsOpen: false,
|
|
123397
|
+
getA11yStatusMessage: getA11yStatusMessage,
|
|
123398
|
+
itemToString: function itemToString(i) {
|
|
123399
|
+
if (i == null) {
|
|
123400
|
+
return '';
|
|
123401
|
+
}
|
|
123402
|
+
if (isPlainObject$3(i)) {
|
|
123403
|
+
//eslint-disable-next-line no-console
|
|
123404
|
+
console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);
|
|
123405
|
+
}
|
|
123406
|
+
return String(i);
|
|
123407
|
+
},
|
|
123408
|
+
onStateChange: function onStateChange() {},
|
|
123409
|
+
onInputValueChange: function onInputValueChange() {},
|
|
123410
|
+
onUserAction: function onUserAction() {},
|
|
123411
|
+
onChange: function onChange() {},
|
|
123412
|
+
onSelect: function onSelect() {},
|
|
123413
|
+
onOuterClick: function onOuterClick() {},
|
|
123414
|
+
selectedItemChanged: function selectedItemChanged(prevItem, item) {
|
|
123415
|
+
return prevItem !== item;
|
|
123416
|
+
},
|
|
123417
|
+
environment: typeof window === 'undefined' /* istanbul ignore next (ssr) */
|
|
123418
|
+
? {} : window,
|
|
123419
|
+
stateReducer: function stateReducer(state, stateToSet) {
|
|
123420
|
+
return stateToSet;
|
|
123421
|
+
},
|
|
123422
|
+
breakingChanges: {}
|
|
123423
|
+
};
|
|
123424
|
+
Downshift.stateChangeTypes = {
|
|
123425
|
+
unknown: '__autocomplete_unknown__',
|
|
123426
|
+
mouseUp: '__autocomplete_mouseup__',
|
|
123427
|
+
itemMouseEnter: '__autocomplete_item_mouseenter__',
|
|
123428
|
+
keyDownArrowUp: '__autocomplete_keydown_arrow_up__',
|
|
123429
|
+
keyDownArrowDown: '__autocomplete_keydown_arrow_down__',
|
|
123430
|
+
keyDownEscape: '__autocomplete_keydown_escape__',
|
|
123431
|
+
keyDownEnter: '__autocomplete_keydown_enter__',
|
|
123432
|
+
clickItem: '__autocomplete_click_item__',
|
|
123433
|
+
blurInput: '__autocomplete_blur_input__',
|
|
123434
|
+
changeInput: '__autocomplete_change_input__',
|
|
123435
|
+
keyDownSpaceButton: '__autocomplete_keydown_space_button__',
|
|
123436
|
+
clickButton: '__autocomplete_click_button__',
|
|
123437
|
+
blurButton: '__autocomplete_blur_button__',
|
|
123438
|
+
controlledPropUpdatedSelectedItem: '__autocomplete_controlled_prop_updated_selected_item__',
|
|
123439
|
+
touchStart: '__autocomplete_touchstart__'
|
|
123440
|
+
};
|
|
123441
|
+
|
|
123442
|
+
var _initialiseProps$1 = function () {
|
|
123443
|
+
var _this4 = this;
|
|
123444
|
+
|
|
123445
|
+
this.input = null;
|
|
123446
|
+
this.items = [];
|
|
123447
|
+
this.itemCount = null;
|
|
123448
|
+
this.previousResultCount = 0;
|
|
123449
|
+
|
|
123450
|
+
this.setItemCount = function (count) {
|
|
123451
|
+
return _this4.itemCount = count;
|
|
123452
|
+
};
|
|
123453
|
+
|
|
123454
|
+
this.unsetItemCount = function () {
|
|
123455
|
+
return _this4.itemCount = null;
|
|
123456
|
+
};
|
|
123457
|
+
|
|
123458
|
+
this.setHighlightedIndex = function () {
|
|
123459
|
+
var highlightedIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this4.props.defaultHighlightedIndex;
|
|
123460
|
+
var otherStateToSet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
123461
|
+
|
|
123462
|
+
otherStateToSet = pickState(otherStateToSet);
|
|
123463
|
+
_this4.internalSetState(_extends$k({ highlightedIndex: highlightedIndex }, otherStateToSet));
|
|
123464
|
+
};
|
|
123465
|
+
|
|
123466
|
+
this.clearSelection = function (cb) {
|
|
123467
|
+
_this4.internalSetState({
|
|
123468
|
+
selectedItem: null,
|
|
123469
|
+
inputValue: '',
|
|
123470
|
+
isOpen: false
|
|
123471
|
+
}, cb);
|
|
123472
|
+
};
|
|
123473
|
+
|
|
123474
|
+
this.selectItem = function (item, otherStateToSet, cb) {
|
|
123475
|
+
otherStateToSet = pickState(otherStateToSet);
|
|
123476
|
+
_this4.internalSetState(_extends$k({
|
|
123477
|
+
isOpen: false,
|
|
123478
|
+
highlightedIndex: _this4.props.defaultHighlightedIndex,
|
|
123479
|
+
selectedItem: item,
|
|
123480
|
+
inputValue: _this4.isControlledProp('selectedItem') && _this4.props.breakingChanges.resetInputOnSelection ? _this4.props.defaultInputValue : _this4.props.itemToString(item)
|
|
123481
|
+
}, otherStateToSet), cb);
|
|
123482
|
+
};
|
|
123483
|
+
|
|
123484
|
+
this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {
|
|
123485
|
+
var item = _this4.items[itemIndex];
|
|
123486
|
+
if (item == null) {
|
|
123487
|
+
return;
|
|
123488
|
+
}
|
|
123489
|
+
_this4.selectItem(item, otherStateToSet, cb);
|
|
123490
|
+
};
|
|
123491
|
+
|
|
123492
|
+
this.selectHighlightedItem = function (otherStateToSet, cb) {
|
|
123493
|
+
return _this4.selectItemAtIndex(_this4.getState().highlightedIndex, otherStateToSet, cb);
|
|
123494
|
+
};
|
|
123495
|
+
|
|
123496
|
+
this.internalSetState = function (stateToSet, cb) {
|
|
123497
|
+
var isItemSelected = void 0,
|
|
123498
|
+
onChangeArg = void 0;
|
|
123499
|
+
|
|
123500
|
+
var onStateChangeArg = {};
|
|
123501
|
+
var isStateToSetFunction = typeof stateToSet === 'function';
|
|
123502
|
+
|
|
123503
|
+
// we want to call `onInputValueChange` before the `setState` call
|
|
123504
|
+
// so someone controlling the `inputValue` state gets notified of
|
|
123505
|
+
// the input change as soon as possible. This avoids issues with
|
|
123506
|
+
// preserving the cursor position.
|
|
123507
|
+
// See https://github.com/paypal/downshift/issues/217 for more info.
|
|
123508
|
+
if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
|
|
123509
|
+
_this4.props.onInputValueChange(stateToSet.inputValue, _extends$k({}, _this4.getStateAndHelpers(), stateToSet));
|
|
123510
|
+
}
|
|
123511
|
+
return _this4.setState(function (state) {
|
|
123512
|
+
state = _this4.getState(state);
|
|
123513
|
+
var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;
|
|
123514
|
+
|
|
123515
|
+
// Your own function that could modify the state that will be set.
|
|
123516
|
+
newStateToSet = _this4.props.stateReducer(state, newStateToSet);
|
|
123517
|
+
|
|
123518
|
+
// checks if an item is selected, regardless of if it's different from
|
|
123519
|
+
// what was selected before
|
|
123520
|
+
// used to determine if onSelect and onChange callbacks should be called
|
|
123521
|
+
isItemSelected = newStateToSet.hasOwnProperty('selectedItem');
|
|
123522
|
+
// this keeps track of the object we want to call with setState
|
|
123523
|
+
var nextState = {};
|
|
123524
|
+
// this is just used to tell whether the state changed
|
|
123525
|
+
var nextFullState = {};
|
|
123526
|
+
// we need to call on change if the outside world is controlling any of our state
|
|
123527
|
+
// and we're trying to update that state. OR if the selection has changed and we're
|
|
123528
|
+
// trying to update the selection
|
|
123529
|
+
if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {
|
|
123530
|
+
onChangeArg = newStateToSet.selectedItem;
|
|
123531
|
+
}
|
|
123532
|
+
newStateToSet.type = newStateToSet.type || Downshift.stateChangeTypes.unknown;
|
|
123533
|
+
|
|
123534
|
+
Object.keys(newStateToSet).forEach(function (key) {
|
|
123535
|
+
// onStateChangeArg should only have the state that is
|
|
123536
|
+
// actually changing
|
|
123537
|
+
if (state[key] !== newStateToSet[key]) {
|
|
123538
|
+
onStateChangeArg[key] = newStateToSet[key];
|
|
123539
|
+
}
|
|
123540
|
+
// the type is useful for the onStateChangeArg
|
|
123541
|
+
// but we don't actually want to set it in internal state.
|
|
123542
|
+
// this is an undocumented feature for now... Not all internalSetState
|
|
123543
|
+
// calls support it and I'm not certain we want them to yet.
|
|
123544
|
+
// But it enables users controlling the isOpen state to know when
|
|
123545
|
+
// the isOpen state changes due to mouseup events which is quite handy.
|
|
123546
|
+
if (key === 'type') {
|
|
123547
|
+
return;
|
|
123548
|
+
}
|
|
123549
|
+
nextFullState[key] = newStateToSet[key];
|
|
123550
|
+
// if it's coming from props, then we don't care to set it internally
|
|
123551
|
+
if (!_this4.isControlledProp(key)) {
|
|
123552
|
+
nextState[key] = newStateToSet[key];
|
|
123553
|
+
}
|
|
123554
|
+
});
|
|
123555
|
+
|
|
123556
|
+
// if stateToSet is a function, then we weren't able to call onInputValueChange
|
|
123557
|
+
// earlier, so we'll call it now that we know what the inputValue state will be.
|
|
123558
|
+
if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
|
|
123559
|
+
_this4.props.onInputValueChange(newStateToSet.inputValue, _extends$k({}, _this4.getStateAndHelpers(), newStateToSet));
|
|
123560
|
+
}
|
|
123561
|
+
|
|
123562
|
+
return nextState;
|
|
123563
|
+
}, function () {
|
|
123564
|
+
// call the provided callback if it's a callback
|
|
123565
|
+
cbToCb(cb)();
|
|
123566
|
+
|
|
123567
|
+
// only call the onStateChange and onChange callbacks if
|
|
123568
|
+
// we have relevant information to pass them.
|
|
123569
|
+
var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
|
|
123570
|
+
if (hasMoreStateThanType) {
|
|
123571
|
+
_this4.props.onStateChange(onStateChangeArg, _this4.getStateAndHelpers());
|
|
123572
|
+
}
|
|
123573
|
+
|
|
123574
|
+
if (isItemSelected) {
|
|
123575
|
+
_this4.props.onSelect(stateToSet.selectedItem, _this4.getStateAndHelpers());
|
|
123576
|
+
}
|
|
123577
|
+
|
|
123578
|
+
if (onChangeArg !== undefined) {
|
|
123579
|
+
_this4.props.onChange(onChangeArg, _this4.getStateAndHelpers());
|
|
123580
|
+
}
|
|
123581
|
+
// this is currently undocumented and therefore subject to change
|
|
123582
|
+
// We'll try to not break it, but just be warned.
|
|
123583
|
+
_this4.props.onUserAction(onStateChangeArg, _this4.getStateAndHelpers());
|
|
123584
|
+
});
|
|
123585
|
+
};
|
|
123586
|
+
|
|
123587
|
+
this.rootRef = function (node) {
|
|
123588
|
+
return _this4._rootNode = node;
|
|
123589
|
+
};
|
|
123590
|
+
|
|
123591
|
+
this.getRootProps = function () {
|
|
123592
|
+
var _babelHelpers$extends;
|
|
123593
|
+
|
|
123594
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123595
|
+
|
|
123596
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
123597
|
+
_ref3$suppressRefErro = _ref3.suppressRefError,
|
|
123598
|
+
suppressRefError = _ref3$suppressRefErro === undefined ? false : _ref3$suppressRefErro;
|
|
123599
|
+
|
|
123600
|
+
var _ref2$refKey = _ref2.refKey,
|
|
123601
|
+
refKey = _ref2$refKey === undefined ? 'ref' : _ref2$refKey,
|
|
123602
|
+
rest = objectWithoutProperties$2(_ref2, ['refKey']);
|
|
123603
|
+
|
|
123604
|
+
// this is used in the render to know whether the user has called getRootProps.
|
|
123605
|
+
// It uses that to know whether to apply the props automatically
|
|
123606
|
+
_this4.getRootProps.called = true;
|
|
123607
|
+
_this4.getRootProps.refKey = refKey;
|
|
123608
|
+
_this4.getRootProps.suppressRefError = suppressRefError;
|
|
123609
|
+
return _extends$k((_babelHelpers$extends = {}, _babelHelpers$extends[refKey] = _this4.rootRef, _babelHelpers$extends), rest);
|
|
123610
|
+
};
|
|
123611
|
+
|
|
123612
|
+
this.keyDownHandlers = {
|
|
123613
|
+
ArrowDown: function ArrowDown(event) {
|
|
123614
|
+
event.preventDefault();
|
|
123615
|
+
var amount = event.shiftKey ? 5 : 1;
|
|
123616
|
+
this.moveHighlightedIndex(amount, {
|
|
123617
|
+
type: Downshift.stateChangeTypes.keyDownArrowDown
|
|
123618
|
+
});
|
|
123619
|
+
},
|
|
123620
|
+
ArrowUp: function ArrowUp(event) {
|
|
123621
|
+
event.preventDefault();
|
|
123622
|
+
var amount = event.shiftKey ? -5 : -1;
|
|
123623
|
+
this.moveHighlightedIndex(amount, {
|
|
123624
|
+
type: Downshift.stateChangeTypes.keyDownArrowUp
|
|
123625
|
+
});
|
|
123626
|
+
},
|
|
123627
|
+
Enter: function Enter(event) {
|
|
123628
|
+
if (this.getState().isOpen) {
|
|
123629
|
+
event.preventDefault();
|
|
123630
|
+
var itemIndex = this.getState().highlightedIndex;
|
|
123631
|
+
var item = this.items[itemIndex];
|
|
123632
|
+
var itemNode = this.getItemNodeFromIndex(itemIndex);
|
|
123633
|
+
if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
|
|
123634
|
+
return;
|
|
123635
|
+
}
|
|
123636
|
+
this.selectHighlightedItem({
|
|
123637
|
+
type: Downshift.stateChangeTypes.keyDownEnter
|
|
123638
|
+
});
|
|
123639
|
+
}
|
|
123640
|
+
},
|
|
123641
|
+
Escape: function Escape(event) {
|
|
123642
|
+
event.preventDefault();
|
|
123643
|
+
this.reset({ type: Downshift.stateChangeTypes.keyDownEscape });
|
|
123644
|
+
}
|
|
123645
|
+
};
|
|
123646
|
+
this.buttonKeyDownHandlers = _extends$k({}, this.keyDownHandlers, {
|
|
123647
|
+
' ': function _(event) {
|
|
123648
|
+
event.preventDefault();
|
|
123649
|
+
this.toggleMenu({ type: Downshift.stateChangeTypes.keyDownSpaceButton });
|
|
123650
|
+
}
|
|
123651
|
+
});
|
|
123652
|
+
|
|
123653
|
+
this.getToggleButtonProps = function () {
|
|
123654
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123655
|
+
|
|
123656
|
+
var onClick = _ref4.onClick,
|
|
123657
|
+
onKeyDown = _ref4.onKeyDown,
|
|
123658
|
+
onBlur = _ref4.onBlur,
|
|
123659
|
+
rest = objectWithoutProperties$2(_ref4, ['onClick', 'onKeyDown', 'onBlur']);
|
|
123660
|
+
|
|
123661
|
+
var _getState3 = _this4.getState(),
|
|
123662
|
+
isOpen = _getState3.isOpen;
|
|
123663
|
+
|
|
123664
|
+
var enabledEventHandlers = {
|
|
123665
|
+
onClick: composeEventHandlers(onClick, _this4.button_handleClick),
|
|
123666
|
+
onKeyDown: composeEventHandlers(onKeyDown, _this4.button_handleKeyDown),
|
|
123667
|
+
onBlur: composeEventHandlers(onBlur, _this4.button_handleBlur)
|
|
123668
|
+
};
|
|
123669
|
+
var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
|
|
123670
|
+
return _extends$k({
|
|
123671
|
+
type: 'button',
|
|
123672
|
+
role: 'button',
|
|
123673
|
+
'aria-label': isOpen ? 'close menu' : 'open menu',
|
|
123674
|
+
'aria-expanded': isOpen,
|
|
123675
|
+
'aria-haspopup': true,
|
|
123676
|
+
'data-toggle': true
|
|
123677
|
+
}, eventHandlers, rest);
|
|
123678
|
+
};
|
|
123679
|
+
|
|
123680
|
+
this.getButtonProps = this.getToggleButtonProps;
|
|
123681
|
+
|
|
123682
|
+
this.button_handleKeyDown = function (event) {
|
|
123683
|
+
var key = normalizeArrowKey(event);
|
|
123684
|
+
if (_this4.buttonKeyDownHandlers[key]) {
|
|
123685
|
+
_this4.buttonKeyDownHandlers[key].call(_this4, event);
|
|
123686
|
+
}
|
|
123687
|
+
};
|
|
123688
|
+
|
|
123689
|
+
this.button_handleClick = function (event) {
|
|
123690
|
+
event.preventDefault();
|
|
123691
|
+
// handle odd case for Safari and Firefox which
|
|
123692
|
+
// don't give the button the focus properly.
|
|
123693
|
+
/* istanbul ignore if (can't reasonably test this) */
|
|
123694
|
+
if (_this4.props.environment.document.activeElement === _this4.props.environment.document.body) {
|
|
123695
|
+
event.target.focus();
|
|
123696
|
+
}
|
|
123697
|
+
// to simplify testing components that use downshift, we'll not wrap this in a setTimeout
|
|
123698
|
+
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
|
|
123699
|
+
// when building for production and should therefore have no impact on production code.
|
|
123700
|
+
{
|
|
123701
|
+
// Ensure that toggle of menu occurs after the potential blur event in iOS
|
|
123702
|
+
setTimeout(function () {
|
|
123703
|
+
return _this4.toggleMenu({ type: Downshift.stateChangeTypes.clickButton });
|
|
123704
|
+
});
|
|
123705
|
+
}
|
|
123706
|
+
};
|
|
123707
|
+
|
|
123708
|
+
this.button_handleBlur = function (event) {
|
|
123709
|
+
var blurTarget = event.target; // Save blur target for comparison with activeElement later
|
|
123710
|
+
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
|
|
123711
|
+
setTimeout(function () {
|
|
123712
|
+
if (!_this4.isMouseDown && (_this4.props.environment.document.activeElement == null || _this4.props.environment.document.activeElement.id !== _this4.inputId) && _this4.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
|
|
123713
|
+
) {
|
|
123714
|
+
_this4.reset({ type: Downshift.stateChangeTypes.blurButton });
|
|
123715
|
+
}
|
|
123716
|
+
});
|
|
123717
|
+
};
|
|
123718
|
+
|
|
123719
|
+
this.getLabelProps = function () {
|
|
123720
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123721
|
+
|
|
123722
|
+
_this4.getLabelProps.called = true;
|
|
123723
|
+
if (_this4.getInputProps.called && props.htmlFor && props.htmlFor !== _this4.inputId) {
|
|
123724
|
+
throw new Error('downshift: You provided the htmlFor of "' + props.htmlFor + '" for your label, but the id of your input is "' + _this4.inputId + '". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');
|
|
123725
|
+
}
|
|
123726
|
+
_this4.inputId = firstDefined(_this4.inputId, props.htmlFor, _this4.id + '-input');
|
|
123727
|
+
return _extends$k({}, props, {
|
|
123728
|
+
htmlFor: _this4.inputId
|
|
123729
|
+
});
|
|
123730
|
+
};
|
|
123731
|
+
|
|
123732
|
+
this.getInputProps = function () {
|
|
123733
|
+
var _ref6;
|
|
123734
|
+
|
|
123735
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123736
|
+
|
|
123737
|
+
var onKeyDown = _ref5.onKeyDown,
|
|
123738
|
+
onBlur = _ref5.onBlur,
|
|
123739
|
+
onChange = _ref5.onChange,
|
|
123740
|
+
onInput = _ref5.onInput,
|
|
123741
|
+
rest = objectWithoutProperties$2(_ref5, ['onKeyDown', 'onBlur', 'onChange', 'onInput']);
|
|
123742
|
+
|
|
123743
|
+
_this4.getInputProps.called = true;
|
|
123744
|
+
if (_this4.getLabelProps.called && rest.id && rest.id !== _this4.inputId) {
|
|
123745
|
+
throw new Error('downshift: You provided the id of "' + rest.id + '" for your input, but the htmlFor of your label is "' + _this4.inputId + '". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');
|
|
123746
|
+
}
|
|
123747
|
+
_this4.inputId = firstDefined(_this4.inputId, rest.id, _this4.id + '-input');
|
|
123748
|
+
var onChangeKey = void 0;
|
|
123749
|
+
/* istanbul ignore next (preact) */
|
|
123750
|
+
onChangeKey = 'onChange';
|
|
123751
|
+
|
|
123752
|
+
var _getState4 = _this4.getState(),
|
|
123753
|
+
inputValue = _getState4.inputValue,
|
|
123754
|
+
isOpen = _getState4.isOpen,
|
|
123755
|
+
highlightedIndex = _getState4.highlightedIndex;
|
|
123756
|
+
|
|
123757
|
+
var eventHandlers = rest.disabled ? {} : (_ref6 = {}, _ref6[onChangeKey] = composeEventHandlers(onChange, onInput, _this4.input_handleChange), _ref6.onKeyDown = composeEventHandlers(onKeyDown, _this4.input_handleKeyDown), _ref6.onBlur = composeEventHandlers(onBlur, _this4.input_handleBlur), _ref6);
|
|
123758
|
+
return _extends$k({
|
|
123759
|
+
role: 'combobox',
|
|
123760
|
+
'aria-autocomplete': 'list',
|
|
123761
|
+
'aria-expanded': isOpen,
|
|
123762
|
+
'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this4.getItemId(highlightedIndex) : null,
|
|
123763
|
+
autoComplete: 'off',
|
|
123764
|
+
value: inputValue
|
|
123765
|
+
}, eventHandlers, rest, {
|
|
123766
|
+
id: _this4.inputId
|
|
123767
|
+
});
|
|
123768
|
+
};
|
|
123769
|
+
|
|
123770
|
+
this.input_handleKeyDown = function (event) {
|
|
123771
|
+
var key = normalizeArrowKey(event);
|
|
123772
|
+
if (key && _this4.keyDownHandlers[key]) {
|
|
123773
|
+
_this4.keyDownHandlers[key].call(_this4, event);
|
|
123774
|
+
}
|
|
123775
|
+
};
|
|
123776
|
+
|
|
123777
|
+
this.input_handleChange = function (event) {
|
|
123778
|
+
_this4.internalSetState({
|
|
123779
|
+
type: Downshift.stateChangeTypes.changeInput,
|
|
123780
|
+
isOpen: true,
|
|
123781
|
+
inputValue: event.target.value
|
|
123782
|
+
});
|
|
123783
|
+
};
|
|
123784
|
+
|
|
123785
|
+
this.input_handleBlur = function () {
|
|
123786
|
+
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
|
|
123787
|
+
setTimeout(function () {
|
|
123788
|
+
var downshiftButtonIsActive = _this4.props.environment.document.activeElement.dataset.toggle && _this4._rootNode && _this4._rootNode.contains(_this4.props.environment.document.activeElement);
|
|
123789
|
+
if (!_this4.isMouseDown && !downshiftButtonIsActive) {
|
|
123790
|
+
_this4.reset({ type: Downshift.stateChangeTypes.blurInput });
|
|
123791
|
+
}
|
|
123792
|
+
});
|
|
123793
|
+
};
|
|
123794
|
+
|
|
123795
|
+
this.getItemProps = function () {
|
|
123796
|
+
var _enabledEventHandlers;
|
|
123797
|
+
|
|
123798
|
+
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123799
|
+
|
|
123800
|
+
var onMouseMove = _ref7.onMouseMove,
|
|
123801
|
+
onMouseDown = _ref7.onMouseDown,
|
|
123802
|
+
onClick = _ref7.onClick,
|
|
123803
|
+
index = _ref7.index,
|
|
123804
|
+
_ref7$item = _ref7.item,
|
|
123805
|
+
item = _ref7$item === undefined ? requiredProp('getItemProps', 'item') : _ref7$item,
|
|
123806
|
+
rest = objectWithoutProperties$2(_ref7, ['onMouseMove', 'onMouseDown', 'onClick', 'index', 'item']);
|
|
123807
|
+
|
|
123808
|
+
if (index === undefined) {
|
|
123809
|
+
_this4.items.push(item);
|
|
123810
|
+
index = _this4.items.indexOf(item);
|
|
123811
|
+
} else {
|
|
123812
|
+
_this4.items[index] = item;
|
|
123813
|
+
}
|
|
123814
|
+
|
|
123815
|
+
var onSelectKey = 'onClick';
|
|
123816
|
+
|
|
123817
|
+
var enabledEventHandlers = (_enabledEventHandlers = {
|
|
123818
|
+
// onMouseMove is used over onMouseEnter here. onMouseMove
|
|
123819
|
+
// is only triggered on actual mouse movement while onMouseEnter
|
|
123820
|
+
// can fire on DOM changes, interrupting keyboard navigation
|
|
123821
|
+
onMouseMove: composeEventHandlers(onMouseMove, function () {
|
|
123822
|
+
if (index === _this4.getState().highlightedIndex) {
|
|
123823
|
+
return;
|
|
123824
|
+
}
|
|
123825
|
+
_this4.setHighlightedIndex(index, {
|
|
123826
|
+
type: Downshift.stateChangeTypes.itemMouseEnter
|
|
123827
|
+
});
|
|
123828
|
+
|
|
123829
|
+
// We never want to manually scroll when changing state based
|
|
123830
|
+
// on `onMouseMove` because we will be moving the element out
|
|
123831
|
+
// from under the user which is currently scrolling/moving the
|
|
123832
|
+
// cursor
|
|
123833
|
+
_this4.avoidScrolling = true;
|
|
123834
|
+
setTimeout(function () {
|
|
123835
|
+
return _this4.avoidScrolling = false;
|
|
123836
|
+
}, 250);
|
|
123837
|
+
}),
|
|
123838
|
+
onMouseDown: composeEventHandlers(onMouseDown, function (event) {
|
|
123839
|
+
// This prevents the activeElement from being changed
|
|
123840
|
+
// to the item so it can remain with the current activeElement
|
|
123841
|
+
// which is a more common use case.
|
|
123842
|
+
event.preventDefault();
|
|
123843
|
+
})
|
|
123844
|
+
}, _enabledEventHandlers[onSelectKey] = composeEventHandlers(onClick, function () {
|
|
123845
|
+
_this4.selectItemAtIndex(index, {
|
|
123846
|
+
type: Downshift.stateChangeTypes.clickItem
|
|
123847
|
+
});
|
|
123848
|
+
}), _enabledEventHandlers);
|
|
123849
|
+
|
|
123850
|
+
var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
|
|
123851
|
+
|
|
123852
|
+
return _extends$k({
|
|
123853
|
+
id: _this4.getItemId(index)
|
|
123854
|
+
}, eventHandlers, rest);
|
|
123855
|
+
};
|
|
123856
|
+
|
|
123857
|
+
this.clearItems = function () {
|
|
123858
|
+
_this4.items = [];
|
|
123859
|
+
};
|
|
123860
|
+
|
|
123861
|
+
this.reset = function () {
|
|
123862
|
+
var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123863
|
+
var cb = arguments[1];
|
|
123864
|
+
|
|
123865
|
+
otherStateToSet = pickState(otherStateToSet);
|
|
123866
|
+
_this4.internalSetState(function (_ref8) {
|
|
123867
|
+
var selectedItem = _ref8.selectedItem;
|
|
123868
|
+
return _extends$k({
|
|
123869
|
+
isOpen: false,
|
|
123870
|
+
highlightedIndex: _this4.props.defaultHighlightedIndex,
|
|
123871
|
+
inputValue: _this4.props.itemToString(selectedItem)
|
|
123872
|
+
}, otherStateToSet);
|
|
123873
|
+
}, cbToCb(cb));
|
|
123874
|
+
};
|
|
123875
|
+
|
|
123876
|
+
this.toggleMenu = function () {
|
|
123877
|
+
var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123878
|
+
var cb = arguments[1];
|
|
123879
|
+
|
|
123880
|
+
otherStateToSet = pickState(otherStateToSet);
|
|
123881
|
+
_this4.internalSetState(function (_ref9) {
|
|
123882
|
+
var isOpen = _ref9.isOpen;
|
|
123883
|
+
|
|
123884
|
+
return _extends$k({ isOpen: !isOpen }, otherStateToSet);
|
|
123885
|
+
}, function () {
|
|
123886
|
+
var _getState5 = _this4.getState(),
|
|
123887
|
+
isOpen = _getState5.isOpen;
|
|
123888
|
+
|
|
123889
|
+
if (isOpen) {
|
|
123890
|
+
// highlight default index
|
|
123891
|
+
_this4.setHighlightedIndex(undefined, otherStateToSet);
|
|
123892
|
+
}
|
|
123893
|
+
cbToCb(cb)();
|
|
123894
|
+
});
|
|
123895
|
+
};
|
|
123896
|
+
|
|
123897
|
+
this.openMenu = function (cb) {
|
|
123898
|
+
_this4.internalSetState({ isOpen: true }, cbToCb(cb));
|
|
123899
|
+
};
|
|
123900
|
+
|
|
123901
|
+
this.closeMenu = function (cb) {
|
|
123902
|
+
_this4.internalSetState({ isOpen: false }, cbToCb(cb));
|
|
123903
|
+
};
|
|
123904
|
+
|
|
123905
|
+
this.updateStatus = debounce$5(function () {
|
|
123906
|
+
if (!_this4._isMounted) {
|
|
123907
|
+
return;
|
|
123908
|
+
}
|
|
123909
|
+
var state = _this4.getState();
|
|
123910
|
+
var item = _this4.items[state.highlightedIndex];
|
|
123911
|
+
var resultCount = _this4.getItemCount();
|
|
123912
|
+
var status = _this4.props.getA11yStatusMessage(_extends$k({
|
|
123913
|
+
itemToString: _this4.props.itemToString,
|
|
123914
|
+
previousResultCount: _this4.previousResultCount,
|
|
123915
|
+
resultCount: resultCount,
|
|
123916
|
+
highlightedItem: item
|
|
123917
|
+
}, state));
|
|
123918
|
+
_this4.previousResultCount = resultCount;
|
|
123919
|
+
/* istanbul ignore else (react-native) */
|
|
123920
|
+
setStatus(status);
|
|
123921
|
+
}, 200);
|
|
123922
|
+
};
|
|
123923
|
+
|
|
123924
|
+
Downshift.propTypes = {
|
|
123925
|
+
children: PropTypes.func,
|
|
123926
|
+
render: PropTypes.func,
|
|
123927
|
+
defaultHighlightedIndex: PropTypes.number,
|
|
123928
|
+
defaultSelectedItem: PropTypes.any,
|
|
123929
|
+
defaultInputValue: PropTypes.string,
|
|
123930
|
+
defaultIsOpen: PropTypes.bool,
|
|
123931
|
+
getA11yStatusMessage: PropTypes.func,
|
|
123932
|
+
itemToString: PropTypes.func,
|
|
123933
|
+
onChange: PropTypes.func,
|
|
123934
|
+
onSelect: PropTypes.func,
|
|
123935
|
+
onStateChange: PropTypes.func,
|
|
123936
|
+
onInputValueChange: PropTypes.func,
|
|
123937
|
+
onUserAction: PropTypes.func,
|
|
123938
|
+
onOuterClick: PropTypes.func,
|
|
123939
|
+
selectedItemChanged: PropTypes.func,
|
|
123940
|
+
stateReducer: PropTypes.func,
|
|
123941
|
+
itemCount: PropTypes.number,
|
|
123942
|
+
id: PropTypes.string,
|
|
123943
|
+
environment: PropTypes.shape({
|
|
123944
|
+
addEventListener: PropTypes.func,
|
|
123945
|
+
removeEventListener: PropTypes.func,
|
|
123946
|
+
document: PropTypes.shape({
|
|
123947
|
+
getElementById: PropTypes.func,
|
|
123948
|
+
activeElement: PropTypes.any,
|
|
123949
|
+
body: PropTypes.any
|
|
123950
|
+
})
|
|
123951
|
+
}),
|
|
123952
|
+
// things we keep in state for uncontrolled components
|
|
123953
|
+
// but can accept as props for controlled components
|
|
123954
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
123955
|
+
selectedItem: PropTypes.any,
|
|
123956
|
+
isOpen: PropTypes.bool,
|
|
123957
|
+
inputValue: PropTypes.string,
|
|
123958
|
+
highlightedIndex: PropTypes.number,
|
|
123959
|
+
breakingChanges: PropTypes.shape({
|
|
123960
|
+
resetInputOnSelection: PropTypes.bool
|
|
123961
|
+
})
|
|
123962
|
+
/* eslint-enable */
|
|
123963
|
+
};
|
|
123964
|
+
|
|
123965
|
+
function validateGetRootPropsCalledCorrectly(element, _ref) {
|
|
123966
|
+
var refKey = _ref.refKey;
|
|
123967
|
+
|
|
123968
|
+
var refKeySpecified = refKey !== 'ref';
|
|
123969
|
+
var isComposite = !isDOMElement(element);
|
|
123970
|
+
if (isComposite && !refKeySpecified) {
|
|
123971
|
+
throw new Error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
|
|
123972
|
+
} else if (!isComposite && refKeySpecified) {
|
|
123973
|
+
throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"');
|
|
123974
|
+
}
|
|
123975
|
+
if (!getElementProps(element)[refKey]) {
|
|
123976
|
+
throw new Error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.');
|
|
123977
|
+
}
|
|
123978
|
+
}
|
|
123979
|
+
|
|
123980
|
+
/*
|
|
123981
|
+
* Fix importing in typescript after rollup compilation
|
|
123982
|
+
* https://github.com/rollup/rollup/issues/1156
|
|
123983
|
+
* https://github.com/Microsoft/TypeScript/issues/13017#issuecomment-268657860
|
|
123984
|
+
*/
|
|
123985
|
+
Downshift.default = Downshift;
|
|
123986
|
+
Downshift.resetIdCounter = resetIdCounter;
|
|
123987
|
+
|
|
123988
|
+
/**
|
|
123989
|
+
* Copyright IBM Corp. 2016, 2018
|
|
123990
|
+
*
|
|
123991
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
123992
|
+
* LICENSE file in the root directory of this source tree.
|
|
123993
|
+
*/
|
|
123994
|
+
var ListBoxType = PropTypes.oneOf(['default', 'inline']);
|
|
123995
|
+
var ListBoxSize = PropTypes.oneOf(['sm', 'xl']);
|
|
123996
|
+
|
|
123997
|
+
function _extends$l() { _extends$l = 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$l.apply(this, arguments); }
|
|
123998
|
+
|
|
123999
|
+
function _defineProperty$r(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; }
|
|
124000
|
+
|
|
124001
|
+
function _objectWithoutProperties$i(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$i(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; }
|
|
124002
|
+
|
|
124003
|
+
function _objectWithoutPropertiesLoose$i(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; }
|
|
124004
|
+
var prefix$D = carbonComponents.settings.prefix;
|
|
124005
|
+
|
|
124006
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
124007
|
+
if (event.keyCode === 27) {
|
|
124008
|
+
event.stopPropagation();
|
|
124009
|
+
}
|
|
124010
|
+
};
|
|
124011
|
+
|
|
124012
|
+
var handleClick = function handleClick(event) {
|
|
124013
|
+
event.preventDefault();
|
|
124014
|
+
event.stopPropagation();
|
|
124015
|
+
};
|
|
124016
|
+
/**
|
|
124017
|
+
* `ListBox` is a generic container component that handles creating the
|
|
124018
|
+
* container class name in response to certain props.
|
|
124019
|
+
*/
|
|
124020
|
+
|
|
124021
|
+
|
|
124022
|
+
var ListBox = function ListBox(_ref) {
|
|
124023
|
+
var _cx;
|
|
124024
|
+
|
|
124025
|
+
var children = _ref.children,
|
|
124026
|
+
containerClassName = _ref.className,
|
|
124027
|
+
disabled = _ref.disabled,
|
|
124028
|
+
innerRef = _ref.innerRef,
|
|
124029
|
+
type = _ref.type,
|
|
124030
|
+
size = _ref.size,
|
|
124031
|
+
invalid = _ref.invalid,
|
|
124032
|
+
invalidText = _ref.invalidText,
|
|
124033
|
+
light = _ref.light,
|
|
124034
|
+
isOpen = _ref.isOpen,
|
|
124035
|
+
rest = _objectWithoutProperties$i(_ref, ["children", "className", "disabled", "innerRef", "type", "size", "invalid", "invalidText", "light", "isOpen"]);
|
|
124036
|
+
|
|
124037
|
+
var className = classnames((_cx = {}, _defineProperty$r(_cx, containerClassName, !!containerClassName), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box"), true), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box--").concat(size), size), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box--inline"), type === 'inline'), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box--disabled"), disabled), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box--light"), light), _defineProperty$r(_cx, "".concat(prefix$D, "--list-box--expanded"), isOpen), _cx));
|
|
124038
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", _extends$l({}, rest, {
|
|
124039
|
+
className: className,
|
|
124040
|
+
ref: innerRef,
|
|
124041
|
+
onKeyDown: handleOnKeyDown,
|
|
124042
|
+
onClick: handleClick,
|
|
124043
|
+
"data-invalid": invalid || undefined
|
|
124044
|
+
}), children), invalid ? React__default.createElement("div", {
|
|
124045
|
+
className: "".concat(prefix$D, "--form-requirement")
|
|
124046
|
+
}, invalidText) : null);
|
|
124047
|
+
};
|
|
124048
|
+
|
|
124049
|
+
ListBox.propTypes = {
|
|
124050
|
+
/**
|
|
124051
|
+
* Provide the contents of your ListBox
|
|
124052
|
+
*/
|
|
124053
|
+
children: PropTypes.node,
|
|
124054
|
+
|
|
124055
|
+
/**
|
|
124056
|
+
* Specify a class name to be applied on the containing list box node
|
|
124057
|
+
*/
|
|
124058
|
+
className: PropTypes.string,
|
|
124059
|
+
|
|
124060
|
+
/**
|
|
124061
|
+
* `innerRef` hook used for libraries like Downshift that require a reference
|
|
124062
|
+
* on a container node when it is not a native element
|
|
124063
|
+
*/
|
|
124064
|
+
innerRef: PropTypes.func.isRequired,
|
|
124065
|
+
|
|
124066
|
+
/**
|
|
124067
|
+
* Specify whether the ListBox is currently disabled
|
|
124068
|
+
*/
|
|
124069
|
+
disabled: PropTypes.bool.isRequired,
|
|
124070
|
+
|
|
124071
|
+
/**
|
|
124072
|
+
* Specify the "type" of the ListBox. Currently supports either `default` or
|
|
124073
|
+
* `inline` as an option.
|
|
124074
|
+
*/
|
|
124075
|
+
type: ListBoxType.isRequired,
|
|
124076
|
+
|
|
124077
|
+
/**
|
|
124078
|
+
* Specify the size of the ListBox. Currently supports either `sm` or `xl` as an option.
|
|
124079
|
+
*/
|
|
124080
|
+
size: ListBoxSize
|
|
124081
|
+
};
|
|
124082
|
+
ListBox.defaultProps = {
|
|
124083
|
+
innerRef: function innerRef() {},
|
|
124084
|
+
disabled: false,
|
|
124085
|
+
type: 'default'
|
|
124086
|
+
};
|
|
124087
|
+
|
|
124088
|
+
function _extends$m() { _extends$m = 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$m.apply(this, arguments); }
|
|
124089
|
+
|
|
124090
|
+
function _objectWithoutProperties$j(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$j(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; }
|
|
124091
|
+
|
|
124092
|
+
function _objectWithoutPropertiesLoose$j(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; }
|
|
124093
|
+
var prefix$E = carbonComponents.settings.prefix;
|
|
124094
|
+
|
|
124095
|
+
/**
|
|
124096
|
+
* `ListBoxField` is responsible for creating the containing node for valid
|
|
124097
|
+
* elements inside of a field. It also provides a11y-related attributes like
|
|
124098
|
+
* `role` to make sure a user can focus the given field.
|
|
124099
|
+
*/
|
|
124100
|
+
|
|
124101
|
+
var ListBoxField = function ListBoxField(_ref) {
|
|
124102
|
+
var children = _ref.children,
|
|
124103
|
+
id = _ref.id,
|
|
124104
|
+
disabled = _ref.disabled,
|
|
124105
|
+
tabIndex = _ref.tabIndex,
|
|
124106
|
+
rest = _objectWithoutProperties$j(_ref, ["children", "id", "disabled", "tabIndex"]);
|
|
124107
|
+
|
|
124108
|
+
return React__default.createElement("div", _extends$m({
|
|
124109
|
+
role: rest['aria-expanded'] ? 'combobox' : rest.role || 'combobox',
|
|
124110
|
+
"aria-owns": rest['aria-expanded'] && "".concat(id, "__menu") || null,
|
|
124111
|
+
"aria-controls": rest['aria-expanded'] && "".concat(id, "__menu") || null,
|
|
124112
|
+
"aria-haspopup": "listbox",
|
|
124113
|
+
className: "".concat(prefix$E, "--list-box__field"),
|
|
124114
|
+
tabIndex: !disabled && tabIndex || -1
|
|
124115
|
+
}, rest), children);
|
|
124116
|
+
};
|
|
124117
|
+
|
|
124118
|
+
ListBoxField.propTypes = {
|
|
124119
|
+
/**
|
|
124120
|
+
* Provide the contents of your ListBoxField
|
|
124121
|
+
*/
|
|
124122
|
+
children: PropTypes.node,
|
|
124123
|
+
|
|
124124
|
+
/**
|
|
124125
|
+
* Specify a custom `id`
|
|
124126
|
+
*/
|
|
124127
|
+
id: PropTypes.string.isRequired,
|
|
124128
|
+
|
|
124129
|
+
/**
|
|
124130
|
+
* Specify if the parent <ListBox> is disabled
|
|
124131
|
+
*/
|
|
124132
|
+
disabled: PropTypes.bool,
|
|
124133
|
+
|
|
124134
|
+
/**
|
|
124135
|
+
* Optional prop to specify the tabIndex of the <ListBox> trigger button
|
|
124136
|
+
*/
|
|
124137
|
+
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
124138
|
+
};
|
|
124139
|
+
|
|
124140
|
+
function _extends$n() { _extends$n = 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$n.apply(this, arguments); }
|
|
124141
|
+
|
|
124142
|
+
function _defineProperty$s(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; }
|
|
124143
|
+
|
|
124144
|
+
function _objectWithoutProperties$k(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$k(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; }
|
|
124145
|
+
|
|
124146
|
+
function _objectWithoutPropertiesLoose$k(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; }
|
|
124147
|
+
var prefix$F = carbonComponents.settings.prefix;
|
|
124148
|
+
/**
|
|
124149
|
+
* `ListBoxMenuItem` is a helper component for managing the container class
|
|
124150
|
+
* name, alongside any classes for any corresponding states, for a generic list
|
|
124151
|
+
* box menu item.
|
|
124152
|
+
*/
|
|
124153
|
+
|
|
124154
|
+
var ListBoxMenuItem = function ListBoxMenuItem(_ref) {
|
|
124155
|
+
var _cx;
|
|
124156
|
+
|
|
124157
|
+
var children = _ref.children,
|
|
124158
|
+
isActive = _ref.isActive,
|
|
124159
|
+
isHighlighted = _ref.isHighlighted,
|
|
124160
|
+
rest = _objectWithoutProperties$k(_ref, ["children", "isActive", "isHighlighted"]);
|
|
124161
|
+
|
|
124162
|
+
var className = classnames((_cx = {}, _defineProperty$s(_cx, "".concat(prefix$F, "--list-box__menu-item"), true), _defineProperty$s(_cx, "".concat(prefix$F, "--list-box__menu-item--active"), isActive), _defineProperty$s(_cx, "".concat(prefix$F, "--list-box__menu-item--highlighted"), isHighlighted), _cx));
|
|
124163
|
+
return React__default.createElement("div", _extends$n({
|
|
124164
|
+
className: className
|
|
124165
|
+
}, rest), React__default.createElement("div", {
|
|
124166
|
+
className: "".concat(prefix$F, "--list-box__menu-item__option")
|
|
124167
|
+
}, children));
|
|
124168
|
+
};
|
|
124169
|
+
|
|
124170
|
+
ListBoxMenuItem.propTypes = {
|
|
124171
|
+
/**
|
|
124172
|
+
* Specify any children nodes that hsould be rendered inside of the ListBox
|
|
124173
|
+
* Menu Item
|
|
124174
|
+
*/
|
|
124175
|
+
children: PropTypes.node,
|
|
124176
|
+
|
|
124177
|
+
/**
|
|
124178
|
+
* Specify whether the current menu item is "active".
|
|
124179
|
+
*/
|
|
124180
|
+
isActive: PropTypes.bool.isRequired,
|
|
124181
|
+
|
|
124182
|
+
/**
|
|
124183
|
+
* Specify whether the current menu item is "highlighed".
|
|
124184
|
+
*/
|
|
124185
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
124186
|
+
};
|
|
124187
|
+
ListBoxMenuItem.defaultProps = {
|
|
124188
|
+
isActive: false,
|
|
124189
|
+
isHighlighted: false
|
|
124190
|
+
};
|
|
124191
|
+
|
|
124192
|
+
/**
|
|
124193
|
+
* Copyright IBM Corp. 2016, 2018
|
|
124194
|
+
*
|
|
124195
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
124196
|
+
* LICENSE file in the root directory of this source tree.
|
|
124197
|
+
*/
|
|
124198
|
+
|
|
124199
|
+
/**
|
|
124200
|
+
* `createChainableTypeChecker` is used inside of our custom prop validators to
|
|
124201
|
+
* add in chaining `isRequired` on a given prop validator.
|
|
124202
|
+
*/
|
|
124203
|
+
var createChainableTypeChecker = function createChainableTypeChecker(validate) {
|
|
124204
|
+
// `checkType` is borrowed heavily from the `prop-types` package
|
|
124205
|
+
var checkType = function checkType(isRequired, props, propName, componentName, location) {
|
|
124206
|
+
if (props[propName] == null) {
|
|
124207
|
+
if (isRequired) {
|
|
124208
|
+
if (props[propName] === null) {
|
|
124209
|
+
return new Error("The ".concat(location, " `").concat(propName, "` is marked as required in ") + "".concat(componentName, ", but its value is `null`."));
|
|
124210
|
+
}
|
|
124211
|
+
|
|
124212
|
+
return new Error("The ".concat(location, " `").concat(propName, "` is marked as required in ") + "".concat(componentName, ", but its value is `undefined`."));
|
|
124213
|
+
}
|
|
124214
|
+
|
|
124215
|
+
return null;
|
|
124216
|
+
} else {
|
|
124217
|
+
return validate(props, propName, componentName, location);
|
|
124218
|
+
}
|
|
124219
|
+
}; // By default, the validator will have `isRequired` set to false. However, we
|
|
124220
|
+
// also define the `isRequired` property on the validtor so that consumers can
|
|
124221
|
+
// chain their prop validator and assert that the property is required.
|
|
124222
|
+
|
|
124223
|
+
|
|
124224
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
124225
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
124226
|
+
return chainedCheckType;
|
|
124227
|
+
};
|
|
124228
|
+
|
|
124229
|
+
/**
|
|
124230
|
+
* Copyright IBM Corp. 2016, 2018
|
|
124231
|
+
*
|
|
124232
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
124233
|
+
* LICENSE file in the root directory of this source tree.
|
|
124234
|
+
*/
|
|
124235
|
+
var cachedDisplayNames = new WeakMap();
|
|
124236
|
+
/**
|
|
124237
|
+
* `getDisplayName` is a utility function for getting a name from a given
|
|
124238
|
+
* component type. It supports names from React elements, Stateless Functional
|
|
124239
|
+
* Components, and Class-based Components
|
|
124240
|
+
*/
|
|
124241
|
+
|
|
124242
|
+
var getDisplayName$1 = function getDisplayName(type) {
|
|
124243
|
+
if (typeof type === 'string') {
|
|
124244
|
+
return type;
|
|
124245
|
+
}
|
|
124246
|
+
|
|
124247
|
+
if (cachedDisplayNames.has(type)) {
|
|
124248
|
+
return cachedDisplayNames.get(type);
|
|
124249
|
+
}
|
|
124250
|
+
|
|
124251
|
+
var displayName;
|
|
124252
|
+
|
|
124253
|
+
if (typeof type.displayName === 'string') {
|
|
124254
|
+
displayName = type.displayName;
|
|
124255
|
+
}
|
|
124256
|
+
|
|
124257
|
+
if (!displayName) {
|
|
124258
|
+
displayName = type.name || 'Unknown';
|
|
124259
|
+
}
|
|
124260
|
+
|
|
124261
|
+
cachedDisplayNames.set(type, displayName);
|
|
124262
|
+
return displayName;
|
|
124263
|
+
};
|
|
124264
|
+
|
|
124265
|
+
/**
|
|
124266
|
+
* Copyright IBM Corp. 2016, 2018
|
|
124267
|
+
*
|
|
124268
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
124269
|
+
* LICENSE file in the root directory of this source tree.
|
|
124270
|
+
*/
|
|
124271
|
+
/**
|
|
124272
|
+
* `childrenOfType` is used for asserting that children of a given React
|
|
124273
|
+
* component are only of a given type. Currently, this supports React elements,
|
|
124274
|
+
* Stateless Functional Components, and Class-based components.
|
|
124275
|
+
*
|
|
124276
|
+
* This prop validator also supports chaining through `isRequired`
|
|
124277
|
+
*/
|
|
124278
|
+
|
|
124279
|
+
var childrenOfType = function childrenOfType(expectedChildType) {
|
|
124280
|
+
var expectedDisplayName = getDisplayName$1( // Support both React elements and components by using `type` if it exists
|
|
124281
|
+
expectedChildType.type || expectedChildType);
|
|
124282
|
+
|
|
124283
|
+
var validate = function validate(props, propName, componentName) {
|
|
124284
|
+
React.Children.forEach(props[propName], function (child) {
|
|
124285
|
+
var childDisplayName = getDisplayName$1(child.type);
|
|
124286
|
+
|
|
124287
|
+
if (child.type !== expectedChildType.type && child.type !== expectedChildType) {
|
|
124288
|
+
throw new Error("Invalid prop `children` of type `".concat(childDisplayName, "` ") + "supplied to `".concat(componentName, "`, expected each child to be a ") + "`".concat(expectedDisplayName, "` component."));
|
|
124289
|
+
}
|
|
124290
|
+
});
|
|
124291
|
+
};
|
|
124292
|
+
|
|
124293
|
+
return createChainableTypeChecker(validate);
|
|
124294
|
+
};
|
|
124295
|
+
|
|
124296
|
+
function _extends$o() { _extends$o = 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$o.apply(this, arguments); }
|
|
124297
|
+
|
|
124298
|
+
function _objectWithoutProperties$l(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$l(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; }
|
|
124299
|
+
|
|
124300
|
+
function _objectWithoutPropertiesLoose$l(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; }
|
|
124301
|
+
var prefix$G = carbonComponents.settings.prefix;
|
|
124302
|
+
/**
|
|
124303
|
+
* `ListBoxMenu` is a simple container node that isolates the `list-box__menu`
|
|
124304
|
+
* class into a single component. It is also being used to validate given
|
|
124305
|
+
* `children` components.
|
|
124306
|
+
*/
|
|
124307
|
+
|
|
124308
|
+
var ListBoxMenu = function ListBoxMenu(_ref) {
|
|
124309
|
+
var children = _ref.children,
|
|
124310
|
+
id = _ref.id,
|
|
124311
|
+
rest = _objectWithoutProperties$l(_ref, ["children", "id"]);
|
|
124312
|
+
|
|
124313
|
+
return React__default.createElement("div", _extends$o({
|
|
124314
|
+
id: "".concat(id, "__menu"),
|
|
124315
|
+
className: "".concat(prefix$G, "--list-box__menu"),
|
|
124316
|
+
role: "listbox"
|
|
124317
|
+
}, rest), children);
|
|
124318
|
+
};
|
|
124319
|
+
|
|
124320
|
+
ListBoxMenu.propTypes = {
|
|
124321
|
+
/**
|
|
124322
|
+
* Provide the contents of your ListBoxMenu
|
|
124323
|
+
*/
|
|
124324
|
+
children: childrenOfType(ListBoxMenuItem),
|
|
124325
|
+
|
|
124326
|
+
/**
|
|
124327
|
+
* Specify a custom `id`
|
|
124328
|
+
*/
|
|
124329
|
+
id: PropTypes.string.isRequired
|
|
124330
|
+
};
|
|
124331
|
+
|
|
124332
|
+
var _defaultTranslations;
|
|
124333
|
+
|
|
124334
|
+
function _defineProperty$t(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; }
|
|
124335
|
+
var prefix$H = carbonComponents.settings.prefix;
|
|
124336
|
+
var translationIds$1 = {
|
|
124337
|
+
'close.menu': 'close.menu',
|
|
124338
|
+
'open.menu': 'open.menu'
|
|
124339
|
+
};
|
|
124340
|
+
var defaultTranslations = (_defaultTranslations = {}, _defineProperty$t(_defaultTranslations, translationIds$1['close.menu'], 'Close menu'), _defineProperty$t(_defaultTranslations, translationIds$1['open.menu'], 'Open menu'), _defaultTranslations);
|
|
124341
|
+
/**
|
|
124342
|
+
* `ListBoxMenuIcon` is used to orient the icon up or down depending on the
|
|
124343
|
+
* state of the menu for a given `ListBox`
|
|
124344
|
+
*/
|
|
124345
|
+
|
|
124346
|
+
var ListBoxMenuIcon = function ListBoxMenuIcon(_ref) {
|
|
124347
|
+
var isOpen = _ref.isOpen,
|
|
124348
|
+
t = _ref.translateWithId;
|
|
124349
|
+
var className = classnames("".concat(prefix$H, "--list-box__menu-icon"), _defineProperty$t({}, "".concat(prefix$H, "--list-box__menu-icon--open"), isOpen));
|
|
124350
|
+
var description = isOpen ? t('close.menu') : t('open.menu');
|
|
124351
|
+
return React__default.createElement("div", {
|
|
124352
|
+
className: className
|
|
124353
|
+
}, React__default.createElement(iconsReact.ChevronDown16, {
|
|
124354
|
+
name: "chevron--down",
|
|
124355
|
+
"aria-label": description
|
|
124356
|
+
}, React__default.createElement("title", null, description)));
|
|
124357
|
+
};
|
|
124358
|
+
|
|
124359
|
+
ListBoxMenuIcon.propTypes = {
|
|
124360
|
+
/**
|
|
124361
|
+
* Specify whether the menu is currently open, which will influence the
|
|
124362
|
+
* direction of the menu icon
|
|
124363
|
+
*/
|
|
124364
|
+
isOpen: PropTypes.bool.isRequired,
|
|
124365
|
+
|
|
124366
|
+
/**
|
|
124367
|
+
* i18n hook used to provide the appropriate description for the given menu
|
|
124368
|
+
* icon. This function takes in an id defined in `translationIds` and should
|
|
124369
|
+
* return a string message for that given message id.
|
|
124370
|
+
*/
|
|
124371
|
+
translateWithId: PropTypes.func.isRequired
|
|
124372
|
+
};
|
|
124373
|
+
ListBoxMenuIcon.defaultProps = {
|
|
124374
|
+
translateWithId: function translateWithId(id) {
|
|
124375
|
+
return defaultTranslations[id];
|
|
124376
|
+
}
|
|
124377
|
+
};
|
|
124378
|
+
|
|
124379
|
+
var _defaultTranslations$1;
|
|
124380
|
+
|
|
124381
|
+
function _defineProperty$u(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; }
|
|
124382
|
+
var prefix$I = carbonComponents.settings.prefix;
|
|
124383
|
+
/**
|
|
124384
|
+
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
124385
|
+
* addition to conditionally rendering a badge if the control has more than one
|
|
124386
|
+
* selection.
|
|
124387
|
+
*/
|
|
124388
|
+
|
|
124389
|
+
var ListBoxSelection = function ListBoxSelection(_ref) {
|
|
124390
|
+
var _cx;
|
|
124391
|
+
|
|
124392
|
+
var clearSelection = _ref.clearSelection,
|
|
124393
|
+
selectionCount = _ref.selectionCount,
|
|
124394
|
+
t = _ref.translateWithId,
|
|
124395
|
+
disabled = _ref.disabled;
|
|
124396
|
+
var className = classnames("".concat(prefix$I, "--list-box__selection"), (_cx = {}, _defineProperty$u(_cx, "".concat(prefix$I, "--tag--filter"), selectionCount), _defineProperty$u(_cx, "".concat(prefix$I, "--list-box__selection--multi"), selectionCount), _cx));
|
|
124397
|
+
|
|
124398
|
+
var handleOnClick = function handleOnClick(event) {
|
|
124399
|
+
event.stopPropagation();
|
|
124400
|
+
|
|
124401
|
+
if (disabled) {
|
|
124402
|
+
return;
|
|
124403
|
+
}
|
|
124404
|
+
|
|
124405
|
+
clearSelection(event);
|
|
124406
|
+
};
|
|
124407
|
+
|
|
124408
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
124409
|
+
event.stopPropagation();
|
|
124410
|
+
|
|
124411
|
+
if (disabled) {
|
|
124412
|
+
return;
|
|
124413
|
+
} // When a user hits ENTER, we'll clear the selection
|
|
124414
|
+
|
|
124415
|
+
|
|
124416
|
+
if (match$2(event, Enter)) {
|
|
124417
|
+
clearSelection(event);
|
|
124418
|
+
}
|
|
124419
|
+
};
|
|
124420
|
+
|
|
124421
|
+
var description = selectionCount ? t('clear.all') : t('clear.selection');
|
|
124422
|
+
return React__default.createElement("div", {
|
|
124423
|
+
role: "button",
|
|
124424
|
+
className: className,
|
|
124425
|
+
tabIndex: disabled ? -1 : 0,
|
|
124426
|
+
onClick: handleOnClick,
|
|
124427
|
+
onKeyDown: handleOnKeyDown,
|
|
124428
|
+
"aria-label": "Clear Selection",
|
|
124429
|
+
title: description
|
|
124430
|
+
}, selectionCount, React__default.createElement(iconsReact.Close16, null));
|
|
124431
|
+
};
|
|
124432
|
+
|
|
124433
|
+
var translationIds$2 = {
|
|
124434
|
+
'clear.all': 'clear.all',
|
|
124435
|
+
'clear.selection': 'clear.selection'
|
|
124436
|
+
};
|
|
124437
|
+
var defaultTranslations$1 = (_defaultTranslations$1 = {}, _defineProperty$u(_defaultTranslations$1, translationIds$2['clear.all'], 'Clear all selected items'), _defineProperty$u(_defaultTranslations$1, translationIds$2['clear.selection'], 'Clear selected item'), _defaultTranslations$1);
|
|
124438
|
+
ListBoxSelection.propTypes = {
|
|
124439
|
+
/**
|
|
124440
|
+
* Specify a function to be invoked when a user interacts with the clear
|
|
124441
|
+
* selection element.
|
|
124442
|
+
*/
|
|
124443
|
+
clearSelection: PropTypes.func.isRequired,
|
|
124444
|
+
|
|
124445
|
+
/**
|
|
124446
|
+
* Specify an optional `selectionCount` value that will be used to determine
|
|
124447
|
+
* whether the selection should display a badge or a single clear icon.
|
|
124448
|
+
*/
|
|
124449
|
+
selectionCount: PropTypes.number,
|
|
124450
|
+
|
|
124451
|
+
/**
|
|
124452
|
+
* i18n hook used to provide the appropriate description for the given menu
|
|
124453
|
+
* icon. This function takes in an id defined in `translationIds` and should
|
|
124454
|
+
* return a string message for that given message id.
|
|
124455
|
+
*/
|
|
124456
|
+
translateWithId: PropTypes.func.isRequired
|
|
124457
|
+
};
|
|
124458
|
+
ListBoxSelection.defaultProps = {
|
|
124459
|
+
translateWithId: function translateWithId(id) {
|
|
124460
|
+
return defaultTranslations$1[id];
|
|
124461
|
+
}
|
|
124462
|
+
};
|
|
124463
|
+
|
|
124464
|
+
/**
|
|
124465
|
+
* Copyright IBM Corp. 2016, 2018
|
|
124466
|
+
*
|
|
124467
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
124468
|
+
* LICENSE file in the root directory of this source tree.
|
|
124469
|
+
*/
|
|
124470
|
+
ListBox.Field = ListBoxField;
|
|
124471
|
+
ListBox.Menu = ListBoxMenu;
|
|
124472
|
+
ListBox.MenuIcon = ListBoxMenuIcon;
|
|
124473
|
+
ListBox.MenuItem = ListBoxMenuItem;
|
|
124474
|
+
ListBox.Selection = ListBoxSelection;
|
|
124475
|
+
|
|
124476
|
+
var keys$6 = {
|
|
124477
|
+
Tab: {
|
|
124478
|
+
key: 'Tab',
|
|
124479
|
+
which: 9,
|
|
124480
|
+
keyCode: 9
|
|
124481
|
+
},
|
|
124482
|
+
Enter: {
|
|
124483
|
+
key: 'Enter',
|
|
124484
|
+
which: 13,
|
|
124485
|
+
keyCode: 13
|
|
124486
|
+
},
|
|
124487
|
+
Escape: {
|
|
124488
|
+
key: ['Escape', // IE11 Escape
|
|
124489
|
+
'Esc'],
|
|
124490
|
+
which: 27,
|
|
124491
|
+
keyCode: 27
|
|
124492
|
+
},
|
|
124493
|
+
Space: {
|
|
124494
|
+
key: ' ',
|
|
124495
|
+
which: 32,
|
|
124496
|
+
keyCode: 32
|
|
124497
|
+
},
|
|
124498
|
+
PageUp: {
|
|
124499
|
+
key: 'PageUp',
|
|
124500
|
+
which: 33,
|
|
124501
|
+
keyCode: 33
|
|
124502
|
+
},
|
|
124503
|
+
PageDown: {
|
|
124504
|
+
key: 'PageDown',
|
|
124505
|
+
which: 34,
|
|
124506
|
+
keyCode: 34
|
|
124507
|
+
},
|
|
124508
|
+
End: {
|
|
124509
|
+
key: 'End',
|
|
124510
|
+
which: 35,
|
|
124511
|
+
keyCode: 35
|
|
124512
|
+
},
|
|
124513
|
+
Home: {
|
|
124514
|
+
key: 'Home',
|
|
124515
|
+
which: 36,
|
|
124516
|
+
keyCode: 36
|
|
124517
|
+
},
|
|
124518
|
+
ArrowLeft: {
|
|
124519
|
+
key: 'ArrowLeft',
|
|
124520
|
+
which: 37,
|
|
124521
|
+
keyCode: 37
|
|
124522
|
+
},
|
|
124523
|
+
ArrowUp: {
|
|
124524
|
+
key: 'ArrowUp',
|
|
124525
|
+
which: 38,
|
|
124526
|
+
keyCode: 38
|
|
124527
|
+
},
|
|
124528
|
+
ArrowRight: {
|
|
124529
|
+
key: 'ArrowRight',
|
|
124530
|
+
which: 39,
|
|
124531
|
+
keyCode: 39
|
|
124532
|
+
},
|
|
124533
|
+
ArrowDown: {
|
|
124534
|
+
key: 'ArrowDown',
|
|
124535
|
+
which: 40,
|
|
124536
|
+
keyCode: 40
|
|
124537
|
+
}
|
|
124538
|
+
};
|
|
124539
|
+
var ListBoxPropTypes$$1 = {
|
|
124540
|
+
ListBoxType: PropTypes.oneOf(['default', 'inline']),
|
|
124541
|
+
ListBoxSize: PropTypes.oneOf(['sm', 'xl'])
|
|
124542
|
+
};
|
|
124543
|
+
var prefix$J = carbonComponents.settings.prefix;
|
|
124544
|
+
/**
|
|
124545
|
+
* Check to see if the given key matches the corresponding keyboard event. Also
|
|
124546
|
+
* supports passing in the value directly if you can't used the given event.
|
|
124547
|
+
*
|
|
124548
|
+
* @example
|
|
124549
|
+
* import * as keys from '../keys';
|
|
124550
|
+
* import { matches } from '../match';
|
|
124551
|
+
*
|
|
124552
|
+
* function handleOnKeyDown(event) {
|
|
124553
|
+
* if (match(event, keys.Enter) {
|
|
124554
|
+
* // ...
|
|
124555
|
+
* }
|
|
124556
|
+
* }
|
|
124557
|
+
*
|
|
124558
|
+
* @param {Event|number|string} eventOrCode
|
|
124559
|
+
* @param {Key} key
|
|
124560
|
+
* @returns {boolean}
|
|
124561
|
+
*/
|
|
124562
|
+
|
|
124563
|
+
/* istanbul ignore next */
|
|
124564
|
+
|
|
124565
|
+
function match$3(eventOrCode) {
|
|
124566
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
124567
|
+
key = _ref.key,
|
|
124568
|
+
which = _ref.which,
|
|
124569
|
+
keyCode = _ref.keyCode;
|
|
124570
|
+
|
|
124571
|
+
if (typeof eventOrCode === 'string') {
|
|
124572
|
+
return eventOrCode === key;
|
|
124573
|
+
}
|
|
124574
|
+
|
|
124575
|
+
if (typeof eventOrCode === 'number') {
|
|
124576
|
+
return eventOrCode === which || eventOrCode === keyCode;
|
|
124577
|
+
}
|
|
124578
|
+
|
|
124579
|
+
if (eventOrCode.key && Array.isArray(key)) {
|
|
124580
|
+
return key.indexOf(eventOrCode.key) !== -1;
|
|
124581
|
+
}
|
|
124582
|
+
|
|
124583
|
+
return eventOrCode.key === key || eventOrCode.which === which || eventOrCode.keyCode === keyCode;
|
|
124584
|
+
}
|
|
124585
|
+
/**
|
|
124586
|
+
* Generic utility to initialize a method that will return a unique instance id
|
|
124587
|
+
* for a component.
|
|
124588
|
+
*/
|
|
124589
|
+
|
|
124590
|
+
function setupGetInstanceId() {
|
|
124591
|
+
var instanceId = 0;
|
|
124592
|
+
return function getInstanceId() {
|
|
124593
|
+
return ++instanceId; // eslint-disable-line no-plusplus
|
|
124594
|
+
};
|
|
124595
|
+
}
|
|
124596
|
+
var defaultItemToString = function defaultItemToString(item) {
|
|
124597
|
+
if (typeof item === 'string') {
|
|
124598
|
+
return item;
|
|
124599
|
+
}
|
|
124600
|
+
|
|
124601
|
+
return item && item.label;
|
|
124602
|
+
};
|
|
124603
|
+
|
|
124604
|
+
var defaultShouldFilterItem = function defaultShouldFilterItem() {
|
|
124605
|
+
return true;
|
|
124606
|
+
};
|
|
124607
|
+
|
|
124608
|
+
var getInputValue = function getInputValue(props, state) {
|
|
124609
|
+
if (props.selectedItem) {
|
|
124610
|
+
return props.itemToString(props.selectedItem);
|
|
124611
|
+
} // TODO: consistent `initialSelectedItem` behavior with other listbox components in v11
|
|
124612
|
+
|
|
124613
|
+
|
|
124614
|
+
if (props.initialSelectedItem) {
|
|
124615
|
+
return props.itemToString(props.initialSelectedItem);
|
|
124616
|
+
}
|
|
124617
|
+
|
|
124618
|
+
return state.inputValue || '';
|
|
124619
|
+
}; // Since we always provide a func this will never be hit
|
|
124620
|
+
|
|
124621
|
+
/* istanbul ignore next */
|
|
124622
|
+
|
|
124623
|
+
|
|
124624
|
+
var defaultFindHighlightedIndex = function defaultFindHighlightedIndex(_ref2, inputValue) {
|
|
124625
|
+
var items = _ref2.items,
|
|
124626
|
+
itemToString = _ref2.itemToString;
|
|
124627
|
+
|
|
124628
|
+
if (!inputValue) {
|
|
124629
|
+
return -1;
|
|
124630
|
+
}
|
|
124631
|
+
|
|
124632
|
+
var searchValue = inputValue.toLowerCase(); // eslint-disable-next-line no-plusplus
|
|
124633
|
+
|
|
124634
|
+
for (var i = 0; i < items.length; i++) {
|
|
124635
|
+
var item = itemToString(items[i]).toLowerCase();
|
|
124636
|
+
|
|
124637
|
+
if (item.indexOf(searchValue) !== -1 && searchValue.length > 1) {
|
|
124638
|
+
return i;
|
|
124639
|
+
}
|
|
124640
|
+
}
|
|
124641
|
+
|
|
124642
|
+
return -1;
|
|
124643
|
+
};
|
|
124644
|
+
|
|
124645
|
+
var getInstanceId = setupGetInstanceId();
|
|
124646
|
+
/* eslint react/require-default-props: 0 */
|
|
124647
|
+
|
|
124648
|
+
var ComboBox = /*#__PURE__*/function (_React$Component) {
|
|
124649
|
+
inherits$1(ComboBox, _React$Component);
|
|
124650
|
+
|
|
124651
|
+
createClass$1(ComboBox, null, [{
|
|
124652
|
+
key: "getDerivedStateFromProps",
|
|
124653
|
+
value: function getDerivedStateFromProps(nextProps, state) {
|
|
124654
|
+
var prevSelectedItem = state.prevSelectedItem,
|
|
124655
|
+
doneInitialSelectedItem = state.doneInitialSelectedItem;
|
|
124656
|
+
var selectedItem = nextProps.selectedItem;
|
|
124657
|
+
|
|
124658
|
+
if (!doneInitialSelectedItem || prevSelectedItem !== selectedItem) {
|
|
124659
|
+
return {
|
|
124660
|
+
doneInitialSelectedItem: true,
|
|
124661
|
+
prevSelectedItem: selectedItem,
|
|
124662
|
+
inputValue: getInputValue(nextProps, state)
|
|
124663
|
+
};
|
|
124664
|
+
}
|
|
124665
|
+
|
|
124666
|
+
return null;
|
|
124667
|
+
}
|
|
124668
|
+
}]);
|
|
124669
|
+
|
|
124670
|
+
function ComboBox(props) {
|
|
124671
|
+
var _this;
|
|
124672
|
+
|
|
124673
|
+
classCallCheck$1(this, ComboBox);
|
|
124674
|
+
|
|
124675
|
+
_this = possibleConstructorReturn$1(this, getPrototypeOf(ComboBox).call(this, props));
|
|
124676
|
+
|
|
124677
|
+
defineProperty$3(assertThisInitialized(_this), "filterItems", function (items, itemToString, inputValue) {
|
|
124678
|
+
return items.filter(function (item) {
|
|
124679
|
+
return _this.props.shouldFilterItem({
|
|
124680
|
+
item: item,
|
|
124681
|
+
itemToString: itemToString,
|
|
124682
|
+
inputValue: inputValue
|
|
124683
|
+
});
|
|
124684
|
+
});
|
|
124685
|
+
});
|
|
124686
|
+
|
|
124687
|
+
defineProperty$3(assertThisInitialized(_this), "handleOnChange", function (selectedItem) {
|
|
124688
|
+
if (_this.props.onChange) {
|
|
124689
|
+
_this.props.onChange({
|
|
124690
|
+
selectedItem: selectedItem
|
|
124691
|
+
});
|
|
124692
|
+
}
|
|
124693
|
+
});
|
|
124694
|
+
|
|
124695
|
+
defineProperty$3(assertThisInitialized(_this), "handleOnInputValueChange", function (inputValue) {
|
|
124696
|
+
var onInputChange = _this.props.onInputChange;
|
|
124697
|
+
|
|
124698
|
+
_this.setState(function () {
|
|
124699
|
+
return {
|
|
124700
|
+
// Default to empty string if we have a false-y `inputValue`
|
|
124701
|
+
inputValue: inputValue || ''
|
|
124702
|
+
};
|
|
124703
|
+
}, function () {
|
|
124704
|
+
if (onInputChange) {
|
|
124705
|
+
onInputChange(inputValue);
|
|
124706
|
+
}
|
|
124707
|
+
});
|
|
124708
|
+
});
|
|
124709
|
+
|
|
124710
|
+
defineProperty$3(assertThisInitialized(_this), "handleOnStateChange", function (newState, _ref3) {
|
|
124711
|
+
var setHighlightedIndex = _ref3.setHighlightedIndex,
|
|
124712
|
+
highlightedIndex = _ref3.highlightedIndex;
|
|
124713
|
+
|
|
124714
|
+
_this.props.onHighligtedIndexChange(highlightedIndex);
|
|
124715
|
+
|
|
124716
|
+
var findHighlightedIndex = _this.props.findHighlightedIndex || defaultFindHighlightedIndex;
|
|
124717
|
+
|
|
124718
|
+
if (Object.prototype.hasOwnProperty.call(newState, 'inputValue')) {
|
|
124719
|
+
var inputValue = newState.inputValue;
|
|
124720
|
+
setHighlightedIndex(findHighlightedIndex(_this.props, inputValue));
|
|
124721
|
+
}
|
|
124722
|
+
});
|
|
124723
|
+
|
|
124724
|
+
defineProperty$3(assertThisInitialized(_this), "onToggleClick", function (isOpen) {
|
|
124725
|
+
return function (event) {
|
|
124726
|
+
if (event.target === _this.textInput.current && isOpen) {
|
|
124727
|
+
// eslint-disable-next-line no-param-reassign
|
|
124728
|
+
event.preventDownshiftDefault = true;
|
|
124729
|
+
event.persist();
|
|
124730
|
+
}
|
|
124731
|
+
};
|
|
124732
|
+
});
|
|
124733
|
+
|
|
124734
|
+
_this.textInput = /*#__PURE__*/React__default.createRef();
|
|
124735
|
+
_this.comboBoxInstanceId = getInstanceId();
|
|
124736
|
+
_this.state = {
|
|
124737
|
+
inputValue: getInputValue(props, {})
|
|
124738
|
+
};
|
|
124739
|
+
return _this;
|
|
124740
|
+
}
|
|
124741
|
+
|
|
124742
|
+
createClass$1(ComboBox, [{
|
|
124743
|
+
key: "render",
|
|
124744
|
+
value: function render() {
|
|
124745
|
+
var _this2 = this;
|
|
124746
|
+
|
|
124747
|
+
var _this$props = this.props,
|
|
124748
|
+
containerClassName = _this$props.className,
|
|
124749
|
+
disabled = _this$props.disabled,
|
|
124750
|
+
id = _this$props.id,
|
|
124751
|
+
items = _this$props.items,
|
|
124752
|
+
itemToString = _this$props.itemToString,
|
|
124753
|
+
itemToElement = _this$props.itemToElement,
|
|
124754
|
+
titleText = _this$props.titleText,
|
|
124755
|
+
helperText = _this$props.helperText,
|
|
124756
|
+
placeholder = _this$props.placeholder,
|
|
124757
|
+
initialSelectedItem = _this$props.initialSelectedItem,
|
|
124758
|
+
selectedItem = _this$props.selectedItem,
|
|
124759
|
+
ariaLabel = _this$props.ariaLabel,
|
|
124760
|
+
translateWithId = _this$props.translateWithId,
|
|
124761
|
+
invalid = _this$props.invalid,
|
|
124762
|
+
invalidText = _this$props.invalidText,
|
|
124763
|
+
light = _this$props.light,
|
|
124764
|
+
type = _this$props.type,
|
|
124765
|
+
size = _this$props.size,
|
|
124766
|
+
shouldFilterItem = _this$props.shouldFilterItem,
|
|
124767
|
+
onChange = _this$props.onChange,
|
|
124768
|
+
onInputChange = _this$props.onInputChange,
|
|
124769
|
+
downshiftProps = _this$props.downshiftProps,
|
|
124770
|
+
direction = _this$props.direction,
|
|
124771
|
+
onHighligtedIndexChange = _this$props.onHighligtedIndexChange,
|
|
124772
|
+
findHighlightedIndex = _this$props.findHighlightedIndex,
|
|
124773
|
+
editOptionText = _this$props.editOptionText,
|
|
124774
|
+
rest = objectWithoutProperties$1(_this$props, ["className", "disabled", "id", "items", "itemToString", "itemToElement", "titleText", "helperText", "placeholder", "initialSelectedItem", "selectedItem", "ariaLabel", "translateWithId", "invalid", "invalidText", "light", "type", "size", "shouldFilterItem", "onChange", "onInputChange", "downshiftProps", "direction", "onHighligtedIndexChange", "findHighlightedIndex", "editOptionText"]);
|
|
124775
|
+
|
|
124776
|
+
var inputValue = this.state.inputValue;
|
|
124777
|
+
var className = classnames("".concat(prefix$J, "--combo-box"), containerClassName, defineProperty$3({}, "".concat(prefix$J, "--list-box--up"), direction === 'top'));
|
|
124778
|
+
var titleClasses = classnames("".concat(prefix$J, "--label"), defineProperty$3({}, "".concat(prefix$J, "--label--disabled"), disabled));
|
|
124779
|
+
var comboBoxHelperId = !helperText ? undefined : "combobox-helper-text-".concat(this.comboBoxInstanceId);
|
|
124780
|
+
var comboBoxLabelId = "combobox-label-".concat(this.comboBoxInstanceId);
|
|
124781
|
+
var title = titleText ?
|
|
124782
|
+
/*#__PURE__*/
|
|
124783
|
+
// eslint-disable-next-line jsx-a11y/label-has-for
|
|
124784
|
+
React__default.createElement("label", {
|
|
124785
|
+
id: comboBoxLabelId,
|
|
124786
|
+
htmlFor: id,
|
|
124787
|
+
className: titleClasses
|
|
124788
|
+
}, titleText) : null;
|
|
124789
|
+
var helperClasses = classnames("".concat(prefix$J, "--form__helper-text"), defineProperty$3({}, "".concat(prefix$J, "--form__helper-text--disabled"), disabled));
|
|
124790
|
+
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
124791
|
+
id: comboBoxHelperId,
|
|
124792
|
+
className: helperClasses
|
|
124793
|
+
}, helperText) : null;
|
|
124794
|
+
var wrapperClasses = classnames("".concat(prefix$J, "--list-box__wrapper"));
|
|
124795
|
+
var comboBoxA11yId = "combobox-a11y-".concat(this.comboBoxInstanceId);
|
|
124796
|
+
var inputClasses = classnames("".concat(prefix$J, "--text-input"), defineProperty$3({}, "".concat(prefix$J, "--text-input--empty"), !inputValue)); // needs to be Capitalized for react to render it correctly
|
|
124797
|
+
|
|
124798
|
+
var ItemToElement = itemToElement;
|
|
124799
|
+
var input = /*#__PURE__*/React__default.createElement(Downshift, _extends_1({}, downshiftProps, {
|
|
124800
|
+
onChange: this.handleOnChange,
|
|
124801
|
+
onInputValueChange: this.handleOnInputValueChange,
|
|
124802
|
+
onStateChange: this.handleOnStateChange,
|
|
124803
|
+
inputValue: inputValue || '',
|
|
124804
|
+
itemToString: itemToString,
|
|
124805
|
+
initialIsOpen: false,
|
|
124806
|
+
defaultSelectedItem: initialSelectedItem,
|
|
124807
|
+
selectedItem: selectedItem
|
|
124808
|
+
}), function (_ref4) {
|
|
124809
|
+
var getButtonProps = _ref4.getButtonProps,
|
|
124810
|
+
getInputProps = _ref4.getInputProps,
|
|
124811
|
+
getItemProps = _ref4.getItemProps,
|
|
124812
|
+
getRootProps = _ref4.getRootProps,
|
|
124813
|
+
isOpen = _ref4.isOpen,
|
|
124814
|
+
inputValue = _ref4.inputValue,
|
|
124815
|
+
selectedItem = _ref4.selectedItem,
|
|
124816
|
+
highlightedIndex = _ref4.highlightedIndex,
|
|
124817
|
+
clearSelection = _ref4.clearSelection,
|
|
124818
|
+
toggleMenu = _ref4.toggleMenu;
|
|
124819
|
+
// console.log({ highlightedIndex });
|
|
124820
|
+
return /*#__PURE__*/React__default.createElement(ListBox, _extends_1({
|
|
124821
|
+
className: className,
|
|
124822
|
+
disabled: disabled,
|
|
124823
|
+
invalid: invalid,
|
|
124824
|
+
id: comboBoxA11yId,
|
|
124825
|
+
"aria-label": ariaLabel,
|
|
124826
|
+
invalidText: invalidText,
|
|
124827
|
+
isOpen: isOpen,
|
|
124828
|
+
light: light,
|
|
124829
|
+
size: size
|
|
124830
|
+
}, getRootProps({
|
|
124831
|
+
refKey: 'innerRef'
|
|
124832
|
+
})), /*#__PURE__*/React__default.createElement(ListBox.Field, _extends_1({
|
|
124833
|
+
id: id,
|
|
124834
|
+
disabled: disabled,
|
|
124835
|
+
"aria-labelledby": comboBoxLabelId,
|
|
124836
|
+
"aria-describedby": comboBoxHelperId
|
|
124837
|
+
}, getButtonProps({
|
|
124838
|
+
disabled: disabled,
|
|
124839
|
+
onClick: _this2.onToggleClick(isOpen)
|
|
124840
|
+
})), /*#__PURE__*/React__default.createElement("input", _extends_1({
|
|
124841
|
+
className: inputClasses,
|
|
124842
|
+
"aria-labelledby": comboBoxA11yId,
|
|
124843
|
+
tabIndex: "0",
|
|
124844
|
+
"aria-disabled": disabled,
|
|
124845
|
+
"aria-controls": isOpen ? "".concat(id, "__menu") : null,
|
|
124846
|
+
"aria-owns": isOpen ? "".concat(id, "__menu") : null,
|
|
124847
|
+
"aria-autocomplete": "list",
|
|
124848
|
+
ref: _this2.textInput,
|
|
124849
|
+
title: inputValue
|
|
124850
|
+
}, rest, getInputProps({
|
|
124851
|
+
disabled: disabled,
|
|
124852
|
+
id: id,
|
|
124853
|
+
placeholder: placeholder,
|
|
124854
|
+
onKeyDown: function onKeyDown(event) {
|
|
124855
|
+
if (match$3(event, keys$6.Space)) {
|
|
124856
|
+
event.stopPropagation();
|
|
124857
|
+
}
|
|
124858
|
+
|
|
124859
|
+
if (match$3(event, keys$6.Enter)) {
|
|
124860
|
+
toggleMenu();
|
|
124861
|
+
}
|
|
124862
|
+
}
|
|
124863
|
+
}))), invalid && /*#__PURE__*/React__default.createElement(iconsReact.WarningFilled16, {
|
|
124864
|
+
className: "".concat(prefix$J, "--list-box__invalid-icon")
|
|
124865
|
+
}), inputValue && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
|
|
124866
|
+
clearSelection: clearSelection,
|
|
124867
|
+
translateWithId: translateWithId,
|
|
124868
|
+
disabled: disabled
|
|
124869
|
+
}), /*#__PURE__*/React__default.createElement(ListBox.MenuIcon, {
|
|
124870
|
+
isOpen: isOpen,
|
|
124871
|
+
translateWithId: translateWithId
|
|
124872
|
+
})), /*#__PURE__*/React__default.createElement(ListBox.Menu, {
|
|
124873
|
+
"aria-label": ariaLabel,
|
|
124874
|
+
id: id
|
|
124875
|
+
}, _this2.filterItems(items, itemToString, inputValue).map(function (item, index) {
|
|
124876
|
+
var itemProps = getItemProps({
|
|
124877
|
+
item: item,
|
|
124878
|
+
index: index
|
|
124879
|
+
});
|
|
124880
|
+
return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends_1({
|
|
124881
|
+
key: itemProps.id,
|
|
124882
|
+
"data-text": editOptionText,
|
|
124883
|
+
isActive: selectedItem === item,
|
|
124884
|
+
isHighlighted: highlightedIndex === index || selectedItem && selectedItem.id === item.id || false,
|
|
124885
|
+
title: itemToElement ? item.text : itemToString(item)
|
|
124886
|
+
}, itemProps), itemToElement ? /*#__PURE__*/React__default.createElement(ItemToElement, _extends_1({
|
|
124887
|
+
key: itemProps.id
|
|
124888
|
+
}, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(iconsReact.Checkmark16, {
|
|
124889
|
+
className: "".concat(prefix$J, "--list-box__menu-item__selected-icon")
|
|
124890
|
+
}));
|
|
124891
|
+
})));
|
|
124892
|
+
});
|
|
124893
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
124894
|
+
className: wrapperClasses
|
|
124895
|
+
}, title, helper, input);
|
|
124896
|
+
}
|
|
124897
|
+
}]);
|
|
124898
|
+
|
|
124899
|
+
return ComboBox;
|
|
124900
|
+
}(React__default.Component);
|
|
124901
|
+
|
|
124902
|
+
defineProperty$3(ComboBox, "propTypes", {
|
|
124903
|
+
/**
|
|
124904
|
+
* 'aria-label' of the ListBox component.
|
|
124905
|
+
*/
|
|
124906
|
+
ariaLabel: PropTypes.string,
|
|
124907
|
+
|
|
124908
|
+
/**
|
|
124909
|
+
* An optional className to add to the container node
|
|
124910
|
+
*/
|
|
124911
|
+
className: PropTypes.string,
|
|
124912
|
+
|
|
124913
|
+
/**
|
|
124914
|
+
* Specify if the control should be disabled, or not
|
|
124915
|
+
*/
|
|
124916
|
+
disabled: PropTypes.bool,
|
|
124917
|
+
|
|
124918
|
+
/**
|
|
124919
|
+
* Specify a custom `id` for the input
|
|
124920
|
+
*/
|
|
124921
|
+
id: PropTypes.string.isRequired,
|
|
124922
|
+
|
|
124923
|
+
/**
|
|
124924
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
124925
|
+
* from their collection that are pre-selected
|
|
124926
|
+
*/
|
|
124927
|
+
initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
124928
|
+
|
|
124929
|
+
/**
|
|
124930
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
124931
|
+
* in a collection of whatever kind of data structure they prefer
|
|
124932
|
+
*/
|
|
124933
|
+
items: PropTypes.array.isRequired,
|
|
124934
|
+
// eslint-disable-line react/forbid-prop-types
|
|
124935
|
+
|
|
124936
|
+
/**
|
|
124937
|
+
* Helper function passed to downshift that allows the library to render a
|
|
124938
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
124939
|
+
* from a given item to serve as the item label in the list
|
|
124940
|
+
*/
|
|
124941
|
+
itemToString: PropTypes.func,
|
|
124942
|
+
|
|
124943
|
+
/**
|
|
124944
|
+
* Optional function to render items as custom components instead of strings.
|
|
124945
|
+
* Defaults to null and is overriden by a getter
|
|
124946
|
+
*/
|
|
124947
|
+
itemToElement: PropTypes.func,
|
|
124948
|
+
|
|
124949
|
+
/**
|
|
124950
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
124951
|
+
* consuming component when a specific dropdown item is selected.
|
|
124952
|
+
* @param {{ selectedItem }}
|
|
124953
|
+
*/
|
|
124954
|
+
onChange: PropTypes.func.isRequired,
|
|
124955
|
+
|
|
124956
|
+
/**
|
|
124957
|
+
* Used to provide a placeholder text node before a user enters any input.
|
|
124958
|
+
* This is only present if the control has no items selected
|
|
124959
|
+
*/
|
|
124960
|
+
placeholder: PropTypes.string.isRequired,
|
|
124961
|
+
|
|
124962
|
+
/**
|
|
124963
|
+
* Specify your own filtering logic by passing in a `shouldFilterItem`
|
|
124964
|
+
* function that takes in the current input and an item and passes back
|
|
124965
|
+
* whether or not the item should be filtered.
|
|
124966
|
+
*/
|
|
124967
|
+
shouldFilterItem: PropTypes.func,
|
|
124968
|
+
|
|
124969
|
+
/**
|
|
124970
|
+
* Specify if the currently selected value is invalid.
|
|
124971
|
+
*/
|
|
124972
|
+
invalid: PropTypes.bool,
|
|
124973
|
+
|
|
124974
|
+
/**
|
|
124975
|
+
* Message which is displayed if the value is invalid.
|
|
124976
|
+
*/
|
|
124977
|
+
invalidText: PropTypes.string,
|
|
124978
|
+
|
|
124979
|
+
/**
|
|
124980
|
+
* For full control of the selection
|
|
124981
|
+
*/
|
|
124982
|
+
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
124983
|
+
|
|
124984
|
+
/**
|
|
124985
|
+
* Specify a custom translation function that takes in a message identifier
|
|
124986
|
+
* and returns the localized string for the message
|
|
124987
|
+
*/
|
|
124988
|
+
translateWithId: PropTypes.func,
|
|
124989
|
+
|
|
124990
|
+
/**
|
|
124991
|
+
* Currently supports either the default type, or an inline variant
|
|
124992
|
+
*/
|
|
124993
|
+
type: ListBoxPropTypes$$1.ListBoxType,
|
|
124994
|
+
|
|
124995
|
+
/**
|
|
124996
|
+
* Specify the size of the ListBox. Currently supports either `sm`, `lg` or `xl` as an option.
|
|
124997
|
+
*/
|
|
124998
|
+
size: ListBoxPropTypes$$1.ListBoxSize,
|
|
124999
|
+
|
|
125000
|
+
/**
|
|
125001
|
+
* Callback function to notify consumer when the text input changes.
|
|
125002
|
+
* This provides support to change available items based on the text.
|
|
125003
|
+
* @param {string} inputText
|
|
125004
|
+
*/
|
|
125005
|
+
onInputChange: PropTypes.func,
|
|
125006
|
+
|
|
125007
|
+
/**
|
|
125008
|
+
* should use "light theme" (white background)?
|
|
125009
|
+
*/
|
|
125010
|
+
light: PropTypes.bool,
|
|
125011
|
+
|
|
125012
|
+
/**
|
|
125013
|
+
* Additional props passed to Downshift
|
|
125014
|
+
*/
|
|
125015
|
+
downshiftProps: PropTypes.shape(Downshift.propTypes),
|
|
125016
|
+
|
|
125017
|
+
/**
|
|
125018
|
+
* Specify the direction of the combobox dropdown. Can be either top or bottom.
|
|
125019
|
+
*/
|
|
125020
|
+
direction: PropTypes.oneOf(['top', 'bottom']),
|
|
125021
|
+
|
|
125022
|
+
/**
|
|
125023
|
+
* Optional callback to pass the highlighted index to parent
|
|
125024
|
+
*/
|
|
125025
|
+
onHighligtedIndexChange: PropTypes.func,
|
|
125026
|
+
|
|
125027
|
+
/**
|
|
125028
|
+
* Optional func to change behavior of highlighted index
|
|
125029
|
+
*/
|
|
125030
|
+
findHighlightedIndex: PropTypes.func,
|
|
125031
|
+
|
|
125032
|
+
/**
|
|
125033
|
+
* String to pass to input field option
|
|
125034
|
+
*/
|
|
125035
|
+
editOptionText: PropTypes.string
|
|
125036
|
+
});
|
|
125037
|
+
|
|
125038
|
+
defineProperty$3(ComboBox, "defaultProps", {
|
|
125039
|
+
disabled: false,
|
|
125040
|
+
itemToString: defaultItemToString,
|
|
125041
|
+
itemToElement: null,
|
|
125042
|
+
shouldFilterItem: defaultShouldFilterItem,
|
|
125043
|
+
type: 'default',
|
|
125044
|
+
ariaLabel: 'Choose an item',
|
|
125045
|
+
light: false,
|
|
125046
|
+
direction: 'bottom',
|
|
125047
|
+
editOptionText: '+ Add'
|
|
125048
|
+
});
|
|
125049
|
+
ComboBox.__docgenInfo = {
|
|
125050
|
+
"description": "",
|
|
125051
|
+
"methods": [{
|
|
125052
|
+
"name": "filterItems",
|
|
125053
|
+
"docblock": null,
|
|
125054
|
+
"modifiers": [],
|
|
125055
|
+
"params": [{
|
|
125056
|
+
"name": "items",
|
|
125057
|
+
"type": null
|
|
125058
|
+
}, {
|
|
125059
|
+
"name": "itemToString",
|
|
125060
|
+
"type": null
|
|
125061
|
+
}, {
|
|
125062
|
+
"name": "inputValue",
|
|
125063
|
+
"type": null
|
|
125064
|
+
}],
|
|
125065
|
+
"returns": null
|
|
125066
|
+
}, {
|
|
125067
|
+
"name": "handleOnChange",
|
|
125068
|
+
"docblock": null,
|
|
125069
|
+
"modifiers": [],
|
|
125070
|
+
"params": [{
|
|
125071
|
+
"name": "selectedItem",
|
|
125072
|
+
"type": null
|
|
125073
|
+
}],
|
|
125074
|
+
"returns": null
|
|
125075
|
+
}, {
|
|
125076
|
+
"name": "handleOnInputValueChange",
|
|
125077
|
+
"docblock": null,
|
|
125078
|
+
"modifiers": [],
|
|
125079
|
+
"params": [{
|
|
125080
|
+
"name": "inputValue",
|
|
125081
|
+
"type": null
|
|
125082
|
+
}],
|
|
125083
|
+
"returns": null
|
|
125084
|
+
}, {
|
|
125085
|
+
"name": "handleOnStateChange",
|
|
125086
|
+
"docblock": null,
|
|
125087
|
+
"modifiers": [],
|
|
125088
|
+
"params": [{
|
|
125089
|
+
"name": "newState",
|
|
125090
|
+
"type": null
|
|
125091
|
+
}, {
|
|
125092
|
+
"name": "{ setHighlightedIndex, highlightedIndex }",
|
|
125093
|
+
"type": null
|
|
125094
|
+
}],
|
|
125095
|
+
"returns": null
|
|
125096
|
+
}, {
|
|
125097
|
+
"name": "onToggleClick",
|
|
125098
|
+
"docblock": null,
|
|
125099
|
+
"modifiers": [],
|
|
125100
|
+
"params": [{
|
|
125101
|
+
"name": "isOpen",
|
|
125102
|
+
"type": null
|
|
125103
|
+
}],
|
|
125104
|
+
"returns": null
|
|
125105
|
+
}],
|
|
125106
|
+
"displayName": "ComboBox",
|
|
125107
|
+
"props": {
|
|
125108
|
+
"disabled": {
|
|
125109
|
+
"defaultValue": {
|
|
125110
|
+
"value": "false",
|
|
125111
|
+
"computed": false
|
|
125112
|
+
},
|
|
125113
|
+
"type": {
|
|
125114
|
+
"name": "bool"
|
|
125115
|
+
},
|
|
125116
|
+
"required": false,
|
|
125117
|
+
"description": "Specify if the control should be disabled, or not"
|
|
125118
|
+
},
|
|
125119
|
+
"itemToString": {
|
|
125120
|
+
"defaultValue": {
|
|
125121
|
+
"value": "item => {\n if (typeof item === 'string') {\n return item;\n }\n\n return item && item.label;\n}",
|
|
125122
|
+
"computed": false
|
|
125123
|
+
},
|
|
125124
|
+
"type": {
|
|
125125
|
+
"name": "func"
|
|
125126
|
+
},
|
|
125127
|
+
"required": false,
|
|
125128
|
+
"description": "Helper function passed to downshift that allows the library to render a\ngiven item to a string label. By default, it extracts the `label` field\nfrom a given item to serve as the item label in the list"
|
|
125129
|
+
},
|
|
125130
|
+
"itemToElement": {
|
|
125131
|
+
"defaultValue": {
|
|
125132
|
+
"value": "null",
|
|
125133
|
+
"computed": false
|
|
125134
|
+
},
|
|
125135
|
+
"type": {
|
|
125136
|
+
"name": "func"
|
|
125137
|
+
},
|
|
125138
|
+
"required": false,
|
|
125139
|
+
"description": "Optional function to render items as custom components instead of strings.\nDefaults to null and is overriden by a getter"
|
|
125140
|
+
},
|
|
125141
|
+
"shouldFilterItem": {
|
|
125142
|
+
"defaultValue": {
|
|
125143
|
+
"value": "() => true",
|
|
125144
|
+
"computed": false
|
|
125145
|
+
},
|
|
125146
|
+
"type": {
|
|
125147
|
+
"name": "func"
|
|
125148
|
+
},
|
|
125149
|
+
"required": false,
|
|
125150
|
+
"description": "Specify your own filtering logic by passing in a `shouldFilterItem`\nfunction that takes in the current input and an item and passes back\nwhether or not the item should be filtered."
|
|
125151
|
+
},
|
|
125152
|
+
"type": {
|
|
125153
|
+
"defaultValue": {
|
|
125154
|
+
"value": "'default'",
|
|
125155
|
+
"computed": false
|
|
125156
|
+
},
|
|
125157
|
+
"type": {
|
|
125158
|
+
"name": "custom",
|
|
125159
|
+
"raw": "ListBoxPropTypes.ListBoxType"
|
|
125160
|
+
},
|
|
125161
|
+
"required": false,
|
|
125162
|
+
"description": "Currently supports either the default type, or an inline variant"
|
|
125163
|
+
},
|
|
125164
|
+
"ariaLabel": {
|
|
125165
|
+
"defaultValue": {
|
|
125166
|
+
"value": "'Choose an item'",
|
|
125167
|
+
"computed": false
|
|
125168
|
+
},
|
|
125169
|
+
"type": {
|
|
125170
|
+
"name": "string"
|
|
125171
|
+
},
|
|
125172
|
+
"required": false,
|
|
125173
|
+
"description": "'aria-label' of the ListBox component."
|
|
125174
|
+
},
|
|
125175
|
+
"light": {
|
|
125176
|
+
"defaultValue": {
|
|
125177
|
+
"value": "false",
|
|
125178
|
+
"computed": false
|
|
125179
|
+
},
|
|
125180
|
+
"type": {
|
|
125181
|
+
"name": "bool"
|
|
125182
|
+
},
|
|
125183
|
+
"required": false,
|
|
125184
|
+
"description": "should use \"light theme\" (white background)?"
|
|
125185
|
+
},
|
|
125186
|
+
"direction": {
|
|
125187
|
+
"defaultValue": {
|
|
125188
|
+
"value": "'bottom'",
|
|
125189
|
+
"computed": false
|
|
125190
|
+
},
|
|
125191
|
+
"type": {
|
|
125192
|
+
"name": "enum",
|
|
125193
|
+
"value": [{
|
|
125194
|
+
"value": "'top'",
|
|
125195
|
+
"computed": false
|
|
125196
|
+
}, {
|
|
125197
|
+
"value": "'bottom'",
|
|
125198
|
+
"computed": false
|
|
125199
|
+
}]
|
|
125200
|
+
},
|
|
125201
|
+
"required": false,
|
|
125202
|
+
"description": "Specify the direction of the combobox dropdown. Can be either top or bottom."
|
|
125203
|
+
},
|
|
125204
|
+
"editOptionText": {
|
|
125205
|
+
"defaultValue": {
|
|
125206
|
+
"value": "'+ Add'",
|
|
125207
|
+
"computed": false
|
|
125208
|
+
},
|
|
125209
|
+
"type": {
|
|
125210
|
+
"name": "string"
|
|
125211
|
+
},
|
|
125212
|
+
"required": false,
|
|
125213
|
+
"description": "String to pass to input field option"
|
|
125214
|
+
},
|
|
125215
|
+
"className": {
|
|
125216
|
+
"type": {
|
|
125217
|
+
"name": "string"
|
|
125218
|
+
},
|
|
125219
|
+
"required": false,
|
|
125220
|
+
"description": "An optional className to add to the container node"
|
|
125221
|
+
},
|
|
125222
|
+
"id": {
|
|
125223
|
+
"type": {
|
|
125224
|
+
"name": "string"
|
|
125225
|
+
},
|
|
125226
|
+
"required": true,
|
|
125227
|
+
"description": "Specify a custom `id` for the input"
|
|
125228
|
+
},
|
|
125229
|
+
"initialSelectedItem": {
|
|
125230
|
+
"type": {
|
|
125231
|
+
"name": "union",
|
|
125232
|
+
"value": [{
|
|
125233
|
+
"name": "object"
|
|
125234
|
+
}, {
|
|
125235
|
+
"name": "string"
|
|
125236
|
+
}]
|
|
125237
|
+
},
|
|
125238
|
+
"required": false,
|
|
125239
|
+
"description": "Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)\nfrom their collection that are pre-selected"
|
|
125240
|
+
},
|
|
125241
|
+
"items": {
|
|
125242
|
+
"type": {
|
|
125243
|
+
"name": "array"
|
|
125244
|
+
},
|
|
125245
|
+
"required": true,
|
|
125246
|
+
"description": "We try to stay as generic as possible here to allow individuals to pass\nin a collection of whatever kind of data structure they prefer"
|
|
125247
|
+
},
|
|
125248
|
+
"onChange": {
|
|
125249
|
+
"type": {
|
|
125250
|
+
"name": "func"
|
|
125251
|
+
},
|
|
125252
|
+
"required": true,
|
|
125253
|
+
"description": "`onChange` is a utility for this controlled component to communicate to a\nconsuming component when a specific dropdown item is selected.\n@param {{ selectedItem }}"
|
|
125254
|
+
},
|
|
125255
|
+
"placeholder": {
|
|
125256
|
+
"type": {
|
|
125257
|
+
"name": "string"
|
|
125258
|
+
},
|
|
125259
|
+
"required": true,
|
|
125260
|
+
"description": "Used to provide a placeholder text node before a user enters any input.\nThis is only present if the control has no items selected"
|
|
125261
|
+
},
|
|
125262
|
+
"invalid": {
|
|
125263
|
+
"type": {
|
|
125264
|
+
"name": "bool"
|
|
125265
|
+
},
|
|
125266
|
+
"required": false,
|
|
125267
|
+
"description": "Specify if the currently selected value is invalid."
|
|
125268
|
+
},
|
|
125269
|
+
"invalidText": {
|
|
125270
|
+
"type": {
|
|
125271
|
+
"name": "string"
|
|
125272
|
+
},
|
|
125273
|
+
"required": false,
|
|
125274
|
+
"description": "Message which is displayed if the value is invalid."
|
|
125275
|
+
},
|
|
125276
|
+
"selectedItem": {
|
|
125277
|
+
"type": {
|
|
125278
|
+
"name": "union",
|
|
125279
|
+
"value": [{
|
|
125280
|
+
"name": "object"
|
|
125281
|
+
}, {
|
|
125282
|
+
"name": "string"
|
|
125283
|
+
}]
|
|
125284
|
+
},
|
|
125285
|
+
"required": false,
|
|
125286
|
+
"description": "For full control of the selection"
|
|
125287
|
+
},
|
|
125288
|
+
"translateWithId": {
|
|
125289
|
+
"type": {
|
|
125290
|
+
"name": "func"
|
|
125291
|
+
},
|
|
125292
|
+
"required": false,
|
|
125293
|
+
"description": "Specify a custom translation function that takes in a message identifier\nand returns the localized string for the message"
|
|
125294
|
+
},
|
|
125295
|
+
"size": {
|
|
125296
|
+
"type": {
|
|
125297
|
+
"name": "custom",
|
|
125298
|
+
"raw": "ListBoxPropTypes.ListBoxSize"
|
|
125299
|
+
},
|
|
125300
|
+
"required": false,
|
|
125301
|
+
"description": "Specify the size of the ListBox. Currently supports either `sm`, `lg` or `xl` as an option."
|
|
125302
|
+
},
|
|
125303
|
+
"onInputChange": {
|
|
125304
|
+
"type": {
|
|
125305
|
+
"name": "func"
|
|
125306
|
+
},
|
|
125307
|
+
"required": false,
|
|
125308
|
+
"description": "Callback function to notify consumer when the text input changes.\nThis provides support to change available items based on the text.\n@param {string} inputText"
|
|
125309
|
+
},
|
|
125310
|
+
"downshiftProps": {
|
|
125311
|
+
"type": {
|
|
125312
|
+
"name": "shape",
|
|
125313
|
+
"value": "Downshift.propTypes",
|
|
125314
|
+
"computed": true
|
|
125315
|
+
},
|
|
125316
|
+
"required": false,
|
|
125317
|
+
"description": "Additional props passed to Downshift"
|
|
125318
|
+
},
|
|
125319
|
+
"onHighligtedIndexChange": {
|
|
125320
|
+
"type": {
|
|
125321
|
+
"name": "func"
|
|
125322
|
+
},
|
|
125323
|
+
"required": false,
|
|
125324
|
+
"description": "Optional callback to pass the highlighted index to parent"
|
|
125325
|
+
},
|
|
125326
|
+
"findHighlightedIndex": {
|
|
125327
|
+
"type": {
|
|
125328
|
+
"name": "func"
|
|
125329
|
+
},
|
|
125330
|
+
"required": false,
|
|
125331
|
+
"description": "Optional func to change behavior of highlighted index"
|
|
125332
|
+
}
|
|
125333
|
+
}
|
|
125334
|
+
};
|
|
125335
|
+
|
|
125336
|
+
function ownKeys$S(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; }
|
|
125337
|
+
|
|
125338
|
+
function _objectSpread$Q(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$S(Object(source), true).forEach(function (key) { defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$S(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
125339
|
+
var iotPrefix$Q = settings.iotPrefix;
|
|
125340
|
+
|
|
125341
|
+
var propTypes$10 = _objectSpread$Q({}, ComboBox.propTypes, {
|
|
125342
|
+
loading: PropTypes.bool,
|
|
125343
|
+
// Callback that is called with the value of the input on change
|
|
125344
|
+
onChange: PropTypes.func.isRequired,
|
|
125345
|
+
// OPtional classname to be applied to wrapper
|
|
125346
|
+
wrapperClassName: PropTypes.string,
|
|
125347
|
+
// String to pass to input field option
|
|
125348
|
+
editOptionText: PropTypes.string,
|
|
125349
|
+
// String to pass for tags close button aria-label. Will be prepended to value name
|
|
125350
|
+
closeButtonText: PropTypes.string,
|
|
125351
|
+
// Bit that will allow mult value and tag feature
|
|
125352
|
+
hasMultiValue: deprecate(PropTypes.bool, '\nThe prop `hasMultiValue` for Combobox is experimental. The functionality that is enabled by this prop is subject to change until Combobbox moves out of experimental.')
|
|
125353
|
+
});
|
|
125354
|
+
|
|
125355
|
+
var defaultProps$16 = _objectSpread$Q({}, ComboBox.defaultProps, {
|
|
125356
|
+
loading: false,
|
|
125357
|
+
wrapperClassName: null,
|
|
125358
|
+
closeButtonText: 'Close',
|
|
125359
|
+
editOptionText: '-Create',
|
|
125360
|
+
hasMultiValue: false,
|
|
125361
|
+
items: []
|
|
125362
|
+
});
|
|
125363
|
+
|
|
125364
|
+
var ComboBox$1 = function ComboBox$$1(_ref) {
|
|
125365
|
+
var loading = _ref.loading,
|
|
125366
|
+
wrapperClassName = _ref.wrapperClassName,
|
|
125367
|
+
closeButtonText = _ref.closeButtonText,
|
|
125368
|
+
editOptionText = _ref.editOptionText,
|
|
125369
|
+
hasMultiValue = _ref.hasMultiValue,
|
|
125370
|
+
onChange = _ref.onChange,
|
|
125371
|
+
comboProps = objectWithoutProperties$1(_ref, ["loading", "wrapperClassName", "closeButtonText", "editOptionText", "hasMultiValue", "onChange"]);
|
|
125372
|
+
|
|
125373
|
+
var items = comboProps.items,
|
|
125374
|
+
ariaLabel = comboProps.ariaLabel,
|
|
125375
|
+
className = comboProps.className,
|
|
125376
|
+
disabled = comboProps.disabled,
|
|
125377
|
+
id = comboProps.id,
|
|
125378
|
+
initialSelectedItem = comboProps.initialSelectedItem,
|
|
125379
|
+
downshiftProps = comboProps.downshiftProps,
|
|
125380
|
+
itemToString = comboProps.itemToString,
|
|
125381
|
+
itemToElement = comboProps.itemToElement,
|
|
125382
|
+
placeholder = comboProps.placeholder,
|
|
125383
|
+
shouldFilterItem = comboProps.shouldFilterItem,
|
|
125384
|
+
type = comboProps.type,
|
|
125385
|
+
invalid = comboProps.invalid,
|
|
125386
|
+
invalidText = comboProps.invalidText,
|
|
125387
|
+
translateWithId = comboProps.translateWithId,
|
|
125388
|
+
size = comboProps.size,
|
|
125389
|
+
onInputChange = comboProps.onInputChange,
|
|
125390
|
+
light = comboProps.light,
|
|
125391
|
+
direction = comboProps.direction; // Ref for the combobox input
|
|
125392
|
+
|
|
125393
|
+
var comboRef = /*#__PURE__*/React__default.createRef(); // Input value that is added to list
|
|
125394
|
+
|
|
125395
|
+
var _useState = React.useState(''),
|
|
125396
|
+
_useState2 = slicedToArray(_useState, 2),
|
|
125397
|
+
inputValue = _useState2[0],
|
|
125398
|
+
setInputValue = _useState2[1]; // Current selected item that shows in the input
|
|
125399
|
+
|
|
125400
|
+
|
|
125401
|
+
var _useState3 = React.useState(null),
|
|
125402
|
+
_useState4 = slicedToArray(_useState3, 2),
|
|
125403
|
+
selectedItem = _useState4[0],
|
|
125404
|
+
setSelectedItem = _useState4[1]; // Array that populates list
|
|
125405
|
+
|
|
125406
|
+
|
|
125407
|
+
var _useState5 = React.useState(items),
|
|
125408
|
+
_useState6 = slicedToArray(_useState5, 2),
|
|
125409
|
+
listItems = _useState6[0],
|
|
125410
|
+
setListItems = _useState6[1]; // Array that populates tags
|
|
125411
|
+
|
|
125412
|
+
|
|
125413
|
+
var _useState7 = React.useState([]),
|
|
125414
|
+
_useState8 = slicedToArray(_useState7, 2),
|
|
125415
|
+
tagItems = _useState8[0],
|
|
125416
|
+
setTagItems = _useState8[1]; // Highlighted index for list dropdown
|
|
125417
|
+
|
|
125418
|
+
|
|
125419
|
+
var _useState9 = React.useState(-1),
|
|
125420
|
+
_useState10 = slicedToArray(_useState9, 2),
|
|
125421
|
+
highlightedIndex = _useState10[0],
|
|
125422
|
+
setHighlightedIndex = _useState10[1];
|
|
125423
|
+
|
|
125424
|
+
React.useEffect(function () {
|
|
125425
|
+
// If there are tags then clear and focus the input
|
|
125426
|
+
if (hasMultiValue) {
|
|
125427
|
+
setSelectedItem(null);
|
|
125428
|
+
}
|
|
125429
|
+
});
|
|
125430
|
+
|
|
125431
|
+
var handleOnClose = function handleOnClose(e) {
|
|
125432
|
+
var _e$currentTarget$pare, _e$currentTarget$pare2, _e$currentTarget$pare3, _e$currentTarget$pare4, _e$currentTarget$pare5, _e$currentTarget$pare6, _e$currentTarget$pare7, _e$currentTarget$pare8;
|
|
125433
|
+
|
|
125434
|
+
// Get close target's text
|
|
125435
|
+
var closedValue = (_e$currentTarget$pare = e.currentTarget.parentNode) === null || _e$currentTarget$pare === void 0 ? void 0 : (_e$currentTarget$pare2 = _e$currentTarget$pare.children[0]) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.textContent; // If there is a tag with the same value then remove from tag array
|
|
125436
|
+
|
|
125437
|
+
tagItems.forEach(function (item, idx) {
|
|
125438
|
+
if (itemToString(item) === closedValue) {
|
|
125439
|
+
tagItems.splice(idx, 1);
|
|
125440
|
+
setTagItems(toConsumableArray(tagItems));
|
|
125441
|
+
}
|
|
125442
|
+
}); // Send new value to users onChange callback
|
|
125443
|
+
|
|
125444
|
+
onChange(toConsumableArray(tagItems)); // eslint-disable-next-line no-unused-expressions
|
|
125445
|
+
|
|
125446
|
+
(_e$currentTarget$pare3 = e.currentTarget.parentNode) === null || _e$currentTarget$pare3 === void 0 ? void 0 : (_e$currentTarget$pare4 = _e$currentTarget$pare3.parentNode) === null || _e$currentTarget$pare4 === void 0 ? void 0 : (_e$currentTarget$pare5 = _e$currentTarget$pare4.parentNode) === null || _e$currentTarget$pare5 === void 0 ? void 0 : (_e$currentTarget$pare6 = _e$currentTarget$pare5.firstChild) === null || _e$currentTarget$pare6 === void 0 ? void 0 : (_e$currentTarget$pare7 = _e$currentTarget$pare6.children[0]) === null || _e$currentTarget$pare7 === void 0 ? void 0 : (_e$currentTarget$pare8 = _e$currentTarget$pare7.children[1]) === null || _e$currentTarget$pare8 === void 0 ? void 0 : _e$currentTarget$pare8.focus();
|
|
125447
|
+
};
|
|
125448
|
+
|
|
125449
|
+
var handleOnChange = function handleOnChange(_ref2) {
|
|
125450
|
+
var downShiftSelectedItem = _ref2.selectedItem;
|
|
125451
|
+
var newItem = downShiftSelectedItem && Object.keys(downShiftSelectedItem).reduce(function (acc, currentId) {
|
|
125452
|
+
return _objectSpread$Q({}, acc, defineProperty$3({}, currentId, downShiftSelectedItem[currentId].trim()));
|
|
125453
|
+
}, {});
|
|
125454
|
+
var currentValue = itemToString(newItem); // Check that there is no existing tag
|
|
125455
|
+
|
|
125456
|
+
var hasNoExistingTag = tagItems.filter(function (x) {
|
|
125457
|
+
return itemToString(x) === currentValue;
|
|
125458
|
+
}).length < 1; // Check if value is part of items array
|
|
125459
|
+
|
|
125460
|
+
var matchedItem = listItems.filter(function (x) {
|
|
125461
|
+
return itemToString(x).trim() === currentValue;
|
|
125462
|
+
})[0];
|
|
125463
|
+
|
|
125464
|
+
if (hasMultiValue) {
|
|
125465
|
+
// If tags array does not contain new value
|
|
125466
|
+
if (newItem && hasNoExistingTag) {
|
|
125467
|
+
// Add new value to tags array
|
|
125468
|
+
setTagItems(function (inputValues) {
|
|
125469
|
+
return [].concat(toConsumableArray(inputValues), [newItem]);
|
|
125470
|
+
}); // pass the combobox value to user's onChange callback
|
|
125471
|
+
|
|
125472
|
+
onChange([].concat(toConsumableArray(tagItems), [newItem]));
|
|
125473
|
+
}
|
|
125474
|
+
} else {
|
|
125475
|
+
onChange(newItem);
|
|
125476
|
+
}
|
|
125477
|
+
|
|
125478
|
+
if ((newItem === null || newItem === void 0 ? void 0 : newItem.id.startsWith("".concat(iotPrefix$Q, "-input-"))) && !matchedItem) {
|
|
125479
|
+
// Add new item to items array
|
|
125480
|
+
setListItems(function (currentList) {
|
|
125481
|
+
return [newItem].concat(toConsumableArray(currentList));
|
|
125482
|
+
});
|
|
125483
|
+
}
|
|
125484
|
+
|
|
125485
|
+
setSelectedItem(newItem);
|
|
125486
|
+
setInputValue(null);
|
|
125487
|
+
};
|
|
125488
|
+
|
|
125489
|
+
var handleOnKeypress = function handleOnKeypress(evt) {
|
|
125490
|
+
// Current value of input
|
|
125491
|
+
var currentValue = comboRef.current.textInput.current.value.trim();
|
|
125492
|
+
|
|
125493
|
+
if (evt.key === 'Enter' && currentValue && highlightedIndex < 0) {
|
|
125494
|
+
var newItem = {
|
|
125495
|
+
id: "".concat(iotPrefix$Q, "-input-").concat(currentValue.split(' ').join('-'), "-").concat(currentValue.length),
|
|
125496
|
+
text: currentValue
|
|
125497
|
+
};
|
|
125498
|
+
handleOnChange({
|
|
125499
|
+
selectedItem: newItem
|
|
125500
|
+
});
|
|
125501
|
+
}
|
|
125502
|
+
};
|
|
125503
|
+
|
|
125504
|
+
var handleInputChange = function handleInputChange(e) {
|
|
125505
|
+
var matchedItem = listItems.filter(function (x) {
|
|
125506
|
+
return itemToString(x) === e;
|
|
125507
|
+
})[0];
|
|
125508
|
+
|
|
125509
|
+
if (e !== '' && !matchedItem) {
|
|
125510
|
+
setInputValue({
|
|
125511
|
+
id: "".concat(iotPrefix$Q, "-input-").concat(e.split(' ').join('-'), "-").concat(e.length),
|
|
125512
|
+
text: e
|
|
125513
|
+
});
|
|
125514
|
+
} else {
|
|
125515
|
+
setInputValue(null);
|
|
125516
|
+
} // Pass on to user callback
|
|
125517
|
+
|
|
125518
|
+
|
|
125519
|
+
onInputChange(e);
|
|
125520
|
+
};
|
|
125521
|
+
|
|
125522
|
+
var findHighlightedIndex = function findHighlightedIndex(_ref3, carbonInputValue) {
|
|
125523
|
+
var carbonItems = _ref3.items;
|
|
125524
|
+
|
|
125525
|
+
if (!carbonInputValue) {
|
|
125526
|
+
return -1;
|
|
125527
|
+
}
|
|
125528
|
+
|
|
125529
|
+
var searchValue = carbonItems[0].id.startsWith("".concat(iotPrefix$Q, "-input")) ? carbonInputValue.slice(0, -1).toLowerCase() : carbonInputValue.toLowerCase(); // eslint-disable-next-line no-plusplus
|
|
125530
|
+
|
|
125531
|
+
for (var i = 0; i < carbonItems.length; i++) {
|
|
125532
|
+
var item = itemToString(carbonItems[i]).toLowerCase();
|
|
125533
|
+
|
|
125534
|
+
if (item.indexOf(searchValue) !== -1 && searchValue && searchValue.trim() === item.trim()) {
|
|
125535
|
+
return i;
|
|
125536
|
+
}
|
|
125537
|
+
}
|
|
125538
|
+
|
|
125539
|
+
return -1;
|
|
125540
|
+
};
|
|
125541
|
+
|
|
125542
|
+
var combinedItems = React.useMemo(function () {
|
|
125543
|
+
return inputValue ? [inputValue].concat(toConsumableArray(listItems)) : listItems;
|
|
125544
|
+
}, [inputValue, listItems]);
|
|
125545
|
+
return (
|
|
125546
|
+
/*#__PURE__*/
|
|
125547
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
125548
|
+
React__default.createElement("div", {
|
|
125549
|
+
className: classnames("".concat(iotPrefix$Q, "--combobox"), defineProperty$3({}, wrapperClassName, wrapperClassName), defineProperty$3({}, "".concat(iotPrefix$Q, "--combobox-add"), inputValue)),
|
|
125550
|
+
onKeyDown: function onKeyDown(evt) {
|
|
125551
|
+
return handleOnKeypress(evt);
|
|
125552
|
+
},
|
|
125553
|
+
"data-testid": "combo-wrapper"
|
|
125554
|
+
}, /*#__PURE__*/React__default.createElement(ComboBox, {
|
|
125555
|
+
"data-testid": "combo-box",
|
|
125556
|
+
ariaLabel: ariaLabel,
|
|
125557
|
+
id: id,
|
|
125558
|
+
type: type,
|
|
125559
|
+
placeholder: placeholder,
|
|
125560
|
+
shouldFilterItem: shouldFilterItem,
|
|
125561
|
+
size: size,
|
|
125562
|
+
invalid: invalid,
|
|
125563
|
+
light: light,
|
|
125564
|
+
direction: direction,
|
|
125565
|
+
invalidText: invalidText,
|
|
125566
|
+
translateWithId: translateWithId,
|
|
125567
|
+
initialSelectedItem: initialSelectedItem,
|
|
125568
|
+
downshiftProps: downshiftProps,
|
|
125569
|
+
findHighlightedIndex: findHighlightedIndex,
|
|
125570
|
+
onHighligtedIndexChange: setHighlightedIndex,
|
|
125571
|
+
ref: comboRef,
|
|
125572
|
+
selectedItem: comboProps.selectedItem || selectedItem,
|
|
125573
|
+
items: combinedItems,
|
|
125574
|
+
itemToString: itemToString,
|
|
125575
|
+
itemToElement: itemToElement,
|
|
125576
|
+
editOptionText: editOptionText,
|
|
125577
|
+
onChange: handleOnChange,
|
|
125578
|
+
onInputChange: handleInputChange,
|
|
125579
|
+
className: classnames(className, "".concat(iotPrefix$Q, "--combobox-input")),
|
|
125580
|
+
disabled: disabled || loading !== undefined && loading !== false
|
|
125581
|
+
}), /*#__PURE__*/React__default.createElement("ul", {
|
|
125582
|
+
"data-testid": "combo-tags",
|
|
125583
|
+
className: "".concat(iotPrefix$Q, "--combobox-tags")
|
|
125584
|
+
}, tagItems.map(function (item, idx) {
|
|
125585
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
125586
|
+
key: "li-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx)
|
|
125587
|
+
}, /*#__PURE__*/React__default.createElement(carbonComponentsReact.Tag, {
|
|
125588
|
+
key: "tag-".concat(item === null || item === void 0 ? void 0 : item.id, "-").concat(idx),
|
|
125589
|
+
filter: true,
|
|
125590
|
+
onClose: function onClose(e) {
|
|
125591
|
+
return handleOnClose(e);
|
|
125592
|
+
},
|
|
125593
|
+
title: closeButtonText
|
|
125594
|
+
}, itemToString(item)));
|
|
125595
|
+
})))
|
|
125596
|
+
);
|
|
125597
|
+
};
|
|
125598
|
+
|
|
125599
|
+
ComboBox$1.propTypes = propTypes$10;
|
|
125600
|
+
ComboBox$1.defaultProps = defaultProps$16;
|
|
125601
|
+
ComboBox$1.__docgenInfo = {
|
|
125602
|
+
"description": "",
|
|
125603
|
+
"methods": [],
|
|
125604
|
+
"displayName": "ComboBox",
|
|
125605
|
+
"props": {
|
|
125606
|
+
"loading": {
|
|
125607
|
+
"defaultValue": {
|
|
125608
|
+
"value": "false",
|
|
125609
|
+
"computed": false
|
|
125610
|
+
},
|
|
125611
|
+
"type": {
|
|
125612
|
+
"name": "bool"
|
|
125613
|
+
},
|
|
125614
|
+
"required": false,
|
|
125615
|
+
"description": ""
|
|
125616
|
+
},
|
|
125617
|
+
"wrapperClassName": {
|
|
125618
|
+
"defaultValue": {
|
|
125619
|
+
"value": "null",
|
|
125620
|
+
"computed": false
|
|
125621
|
+
},
|
|
125622
|
+
"type": {
|
|
125623
|
+
"name": "string"
|
|
125624
|
+
},
|
|
125625
|
+
"required": false,
|
|
125626
|
+
"description": ""
|
|
125627
|
+
},
|
|
125628
|
+
"closeButtonText": {
|
|
125629
|
+
"defaultValue": {
|
|
125630
|
+
"value": "'Close'",
|
|
125631
|
+
"computed": false
|
|
125632
|
+
},
|
|
125633
|
+
"type": {
|
|
125634
|
+
"name": "string"
|
|
125635
|
+
},
|
|
125636
|
+
"required": false,
|
|
125637
|
+
"description": ""
|
|
125638
|
+
},
|
|
125639
|
+
"editOptionText": {
|
|
125640
|
+
"defaultValue": {
|
|
125641
|
+
"value": "'-Create'",
|
|
125642
|
+
"computed": false
|
|
125643
|
+
},
|
|
125644
|
+
"type": {
|
|
125645
|
+
"name": "string"
|
|
125646
|
+
},
|
|
125647
|
+
"required": false,
|
|
125648
|
+
"description": ""
|
|
125649
|
+
},
|
|
125650
|
+
"hasMultiValue": {
|
|
125651
|
+
"defaultValue": {
|
|
125652
|
+
"value": "false",
|
|
125653
|
+
"computed": false
|
|
125654
|
+
},
|
|
125655
|
+
"type": {
|
|
125656
|
+
"name": "custom",
|
|
125657
|
+
"raw": "deprecate(\n PropTypes.bool,\n '\\nThe prop `hasMultiValue` for Combobox is experimental. The functionality that is enabled by this prop is subject to change until Combobbox moves out of experimental.'\n)"
|
|
125658
|
+
},
|
|
125659
|
+
"required": false,
|
|
125660
|
+
"description": ""
|
|
125661
|
+
},
|
|
125662
|
+
"items": {
|
|
125663
|
+
"defaultValue": {
|
|
125664
|
+
"value": "[]",
|
|
125665
|
+
"computed": false
|
|
125666
|
+
},
|
|
125667
|
+
"required": false
|
|
125668
|
+
},
|
|
125669
|
+
"onChange": {
|
|
125670
|
+
"type": {
|
|
125671
|
+
"name": "func"
|
|
125672
|
+
},
|
|
125673
|
+
"required": true,
|
|
125674
|
+
"description": ""
|
|
125675
|
+
}
|
|
125676
|
+
},
|
|
125677
|
+
"composes": ["./CarbonComboBox"]
|
|
125678
|
+
};
|
|
125679
|
+
|
|
122590
125680
|
// Needed so that any component that uses sizeme can be jest tested
|
|
122591
125681
|
reactSizeme.noPlaceholders = true; // Components
|
|
122592
125682
|
|
|
@@ -122596,7 +125686,6 @@
|
|
|
122596
125686
|
exports.AccordionItem = carbonComponentsReact.AccordionItem;
|
|
122597
125687
|
exports.Checkbox = carbonComponentsReact.Checkbox;
|
|
122598
125688
|
exports.CodeSnippet = carbonComponentsReact.CodeSnippet;
|
|
122599
|
-
exports.ComboBox = carbonComponentsReact.ComboBox;
|
|
122600
125689
|
exports.ModalHeader = carbonComponentsReact.ModalHeader;
|
|
122601
125690
|
exports.ModalBody = carbonComponentsReact.ModalBody;
|
|
122602
125691
|
exports.ModalFooter = carbonComponentsReact.ModalFooter;
|
|
@@ -122796,6 +125885,7 @@
|
|
|
122796
125885
|
exports.SimpleList = SimpleList;
|
|
122797
125886
|
exports.IconSwitch = IconSwitch;
|
|
122798
125887
|
exports.AccordionItemDefer = AccordionItemDefer;
|
|
125888
|
+
exports.ComboBox = ComboBox$1;
|
|
122799
125889
|
exports.baseTableReducer = baseTableReducer;
|
|
122800
125890
|
exports.tableReducer = tableReducer;
|
|
122801
125891
|
exports.tileCatalogReducer = tileCatalogReducer;
|