@k-int/stripes-kint-components 5.25.2 → 5.25.3
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/CHANGELOG.md +7 -0
- package/es/__mocks__/@folio/stripes/components.js +7 -3
- package/es/__mocks__/@folio/stripes/core.js +6 -4
- package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
- package/es/__mocks__/react-query.js +6 -4
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +33 -26
- package/es/lib/ActionList/ActionListFieldArray.js +119 -103
- package/es/lib/ComboButton/ComboButton.js +47 -42
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +35 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +17 -14
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +17 -9
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
- package/es/lib/EditableRefdataList/EditableRefdataList.js +43 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +9 -5
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +6 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +12 -8
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/FormModal/FormModal.js +32 -24
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
- package/es/lib/IconSelect/IconSelect.js +32 -22
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
- package/es/lib/NumberField/NumberField.js +25 -17
- package/es/lib/NumberField/NumberField.test.js +7 -6
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +36 -31
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +51 -41
- package/es/lib/SASQRoute/SASQRoute.js +29 -25
- package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
- package/es/lib/SearchField/SearchField.js +13 -7
- package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +35 -30
- package/es/lib/Tags/Tags.js +8 -5
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +1 -1
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +28 -21
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +10 -6
- package/es/lib/hooks/useHelperApp.js +16 -13
- package/es/lib/hooks/useKiwtFieldArray.js +8 -7
- package/es/lib/hooks/useKiwtSASQuery.js +19 -15
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
- package/es/lib/hooks/usePrevNextPagination.js +19 -17
- package/es/lib/hooks/useQIndex.js +14 -11
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings/useAppSettings.js +11 -7
- package/es/lib/settingsHooks/useSettingSection/useSettingSection.js +18 -12
- package/es/lib/settingsHooks/useSettings/useSettings.js +60 -60
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +82 -70
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString.js +7 -5
- package/es/lib/utils/parseErrorResponse.js +4 -3
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +9 -6
- package/package.json +1 -1
- package/styles/TypeDown.css +3 -1
|
@@ -13,6 +13,11 @@ var _EditableRefdataList = _interopRequireDefault(require("../EditableRefdataLis
|
|
|
13
13
|
var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMessage"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
21
|
const propTypes = {
|
|
17
22
|
afterQueryCalls: _propTypes.default.object,
|
|
18
23
|
catchQueryCalls: _propTypes.default.object,
|
|
@@ -29,6 +34,7 @@ const propTypes = {
|
|
|
29
34
|
refdataEndpoint: _propTypes.default.string
|
|
30
35
|
};
|
|
31
36
|
const RefdataCategoriesSettings = _ref => {
|
|
37
|
+
var _refdataCategory$valu;
|
|
32
38
|
let {
|
|
33
39
|
/*
|
|
34
40
|
* Set of extra booleans for controlling access to actions
|
|
@@ -58,28 +64,29 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
58
64
|
};
|
|
59
65
|
const pickListValuesLabel = kintIntl.formatKintMessage({
|
|
60
66
|
id: 'settings.pickListValues',
|
|
61
|
-
overrideValue: labelOverrides
|
|
67
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.pickListValues
|
|
62
68
|
});
|
|
63
|
-
const renderViewPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, {
|
|
64
|
-
...renderProps,
|
|
69
|
+
const renderViewPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, _objectSpread(_objectSpread({}, renderProps), {}, {
|
|
65
70
|
dismissible: true,
|
|
66
71
|
onClose: () => setRefdataCategory(),
|
|
67
72
|
paneTitle: kintIntl.formatKintMessage({
|
|
68
73
|
id: 'refdataCategories.config.viewPaneTitle',
|
|
69
|
-
overrideValue: labelOverrides
|
|
70
|
-
fallbackMessage: refdataCategory
|
|
74
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.viewPaneTitle,
|
|
75
|
+
fallbackMessage: refdataCategory === null || refdataCategory === void 0 ? void 0 : refdataCategory.desc
|
|
71
76
|
}, {
|
|
72
|
-
name: refdataCategory
|
|
77
|
+
name: refdataCategory === null || refdataCategory === void 0 ? void 0 : refdataCategory.desc
|
|
73
78
|
})
|
|
74
|
-
});
|
|
75
|
-
const renderLookupPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, {
|
|
76
|
-
...renderProps,
|
|
79
|
+
}));
|
|
80
|
+
const renderLookupPaneHeader = renderProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneHeader, _objectSpread(_objectSpread({}, renderProps), {}, {
|
|
77
81
|
dismissible: true,
|
|
78
82
|
lastMenu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
|
|
79
83
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
80
|
-
disabled: !!refState
|
|
84
|
+
disabled: !!(refState !== null && refState !== void 0 && refState.editing) || !displayConditions.create,
|
|
81
85
|
marginBottom0: true,
|
|
82
|
-
onClick: () =>
|
|
86
|
+
onClick: () => {
|
|
87
|
+
var _rdclRef$current;
|
|
88
|
+
return rdclRef === null || rdclRef === void 0 || (_rdclRef$current = rdclRef.current) === null || _rdclRef$current === void 0 ? void 0 : _rdclRef$current.create();
|
|
89
|
+
},
|
|
83
90
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
|
|
84
91
|
id: "new"
|
|
85
92
|
})
|
|
@@ -88,9 +95,9 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
88
95
|
onClose: onClose,
|
|
89
96
|
paneTitle: kintIntl.formatKintMessage({
|
|
90
97
|
id: 'settings.pickLists',
|
|
91
|
-
overrideValue: labelOverrides
|
|
98
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.pickLists
|
|
92
99
|
})
|
|
93
|
-
});
|
|
100
|
+
}));
|
|
94
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
95
102
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
96
103
|
defaultWidth: "fill",
|
|
@@ -107,13 +114,13 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
107
114
|
handleRefdataCategoryClick: handleRefdataCategoryClick,
|
|
108
115
|
hideCreateButton: true,
|
|
109
116
|
onConfirmDelete: id => {
|
|
110
|
-
if (refdataCategory
|
|
117
|
+
if ((refdataCategory === null || refdataCategory === void 0 ? void 0 : refdataCategory.id) === id) {
|
|
111
118
|
setRefdataCategory();
|
|
112
119
|
}
|
|
113
120
|
},
|
|
114
121
|
refdataEndpoint: refdataEndpoint
|
|
115
122
|
})
|
|
116
|
-
}), refdataCategory
|
|
123
|
+
}), (refdataCategory === null || refdataCategory === void 0 ? void 0 : refdataCategory.desc) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Pane, {
|
|
117
124
|
defaultWidth: "fill",
|
|
118
125
|
id: "settings-refdataCategories-viewPane",
|
|
119
126
|
renderHeader: renderViewPaneHeader,
|
|
@@ -123,7 +130,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
123
130
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
124
131
|
label: kintIntl.formatKintMessage({
|
|
125
132
|
id: 'refdataCategory.refdataCategory',
|
|
126
|
-
overrideValue: labelOverrides
|
|
133
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.refdataCategory
|
|
127
134
|
}),
|
|
128
135
|
value: refdataCategory.desc
|
|
129
136
|
})
|
|
@@ -132,9 +139,9 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
132
139
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
133
140
|
label: kintIntl.formatKintMessage({
|
|
134
141
|
id: 'refdataCategory.noOfValues',
|
|
135
|
-
overrideValue: labelOverrides
|
|
142
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.noOfValues
|
|
136
143
|
}),
|
|
137
|
-
value: refdataCategory
|
|
144
|
+
value: refdataCategory === null || refdataCategory === void 0 || (_refdataCategory$valu = refdataCategory.values) === null || _refdataCategory$valu === void 0 ? void 0 : _refdataCategory$valu.length
|
|
138
145
|
})
|
|
139
146
|
})]
|
|
140
147
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditableRefdataList.default, {
|
|
@@ -142,7 +149,7 @@ const RefdataCategoriesSettings = _ref => {
|
|
|
142
149
|
put: json => setRefdataCategory(json),
|
|
143
150
|
delete: json => setRefdataCategory(json)
|
|
144
151
|
},
|
|
145
|
-
desc: refdataCategory
|
|
152
|
+
desc: refdataCategory === null || refdataCategory === void 0 ? void 0 : refdataCategory.desc,
|
|
146
153
|
displayConditions: displayConditions,
|
|
147
154
|
label: pickListValuesLabel,
|
|
148
155
|
refdataEndpoint: refdataEndpoint
|
|
@@ -11,7 +11,15 @@ var _components = require("@folio/stripes/components");
|
|
|
11
11
|
var _ResponsiveButtonGroup = _interopRequireDefault(require("../../../styles/ResponsiveButtonGroup.css"));
|
|
12
12
|
var _useResponsiveButtonGroupSizing = _interopRequireDefault(require("./useResponsiveButtonGroupSizing"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const _excluded = ["children", "className", "dropdownTriggerProps", "fullWidth", "id", "marginBottom0", "selectedIndex", "tagName"];
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
22
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
23
|
const propTypes = {
|
|
16
24
|
children: _propTypes.default.node,
|
|
17
25
|
className: _propTypes.default.string,
|
|
@@ -28,31 +36,31 @@ const calculateCumulativeThreshold = function (arrayOfNumbers, maximum) {
|
|
|
28
36
|
let value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
29
37
|
// If all the numbers fit, return the last index
|
|
30
38
|
if (arrayOfNumbers.reduce((partialSum, a) => partialSum + a, 0) <= maximum) {
|
|
31
|
-
return arrayOfNumbers
|
|
39
|
+
return (arrayOfNumbers === null || arrayOfNumbers === void 0 ? void 0 : arrayOfNumbers.length) - 1;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
// Else we'll need a down arrow button, so include that in calculations
|
|
35
43
|
const nextValue = value + arrayOfNumbers[index];
|
|
36
|
-
if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 < arrayOfNumbers
|
|
44
|
+
if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 < (arrayOfNumbers === null || arrayOfNumbers === void 0 ? void 0 : arrayOfNumbers.length)) {
|
|
37
45
|
return calculateCumulativeThreshold(arrayOfNumbers, maximum, index + 1, nextValue);
|
|
38
46
|
}
|
|
39
47
|
return index - 1;
|
|
40
48
|
};
|
|
41
49
|
const ResponsiveButtonGroup = props => {
|
|
42
50
|
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
children: childButtons,
|
|
52
|
+
// These MUST consist only of Button components
|
|
53
|
+
className,
|
|
54
|
+
dropdownTriggerProps = {},
|
|
55
|
+
fullWidth = false,
|
|
56
|
+
// Only bother with this when buttonGroupWidth < ContainerWidth
|
|
57
|
+
id,
|
|
58
|
+
marginBottom0,
|
|
59
|
+
// Will ONLL control the margin of the dropdown button
|
|
60
|
+
selectedIndex,
|
|
61
|
+
tagName: Tag = 'div'
|
|
62
|
+
} = props,
|
|
63
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
56
64
|
const {
|
|
57
65
|
buttons,
|
|
58
66
|
cachedSizeArray,
|
|
@@ -65,6 +73,7 @@ const ResponsiveButtonGroup = props => {
|
|
|
65
73
|
});
|
|
66
74
|
const buttonThreshold = calculateCumulativeThreshold(cachedSizeArray, containerWidth);
|
|
67
75
|
const renderActionMenuToggle = (0, _react.useCallback)(_ref => {
|
|
76
|
+
var _displayButtons$lengt;
|
|
68
77
|
let {
|
|
69
78
|
displayButtons,
|
|
70
79
|
onToggle,
|
|
@@ -74,42 +83,46 @@ const ResponsiveButtonGroup = props => {
|
|
|
74
83
|
ariaProps,
|
|
75
84
|
getTriggerProps
|
|
76
85
|
} = _ref;
|
|
77
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
78
87
|
ref: triggerRef,
|
|
79
88
|
"aria-label": "menu",
|
|
80
89
|
buttonClass: (0, _classnames.default)(_ResponsiveButtonGroup.default.width100, {
|
|
81
|
-
[
|
|
90
|
+
["".concat(_ResponsiveButtonGroup.default.dropdownButtonClass)]: ((_displayButtons$lengt = displayButtons === null || displayButtons === void 0 ? void 0 : displayButtons.length) !== null && _displayButtons$lengt !== void 0 ? _displayButtons$lengt : 0) > 0
|
|
82
91
|
}, {
|
|
83
|
-
[
|
|
92
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom)]: !marginBottom0
|
|
84
93
|
}, {
|
|
85
|
-
[
|
|
94
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom0)]: marginBottom0
|
|
86
95
|
}),
|
|
87
96
|
buttonStyle: selectedIndex > buttonThreshold ? 'primary' : 'default',
|
|
88
97
|
onClick: onToggle,
|
|
89
98
|
onKeyDown: keyHandler,
|
|
90
|
-
type: "button"
|
|
91
|
-
|
|
92
|
-
...ariaProps,
|
|
93
|
-
...dropdownTriggerProps,
|
|
99
|
+
type: "button"
|
|
100
|
+
}, getTriggerProps()), ariaProps), dropdownTriggerProps), {}, {
|
|
94
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
95
102
|
icon: open ? 'triangle-up' : 'triangle-down',
|
|
96
103
|
iconPosition: "end"
|
|
97
104
|
})
|
|
98
|
-
});
|
|
105
|
+
}));
|
|
99
106
|
}, [buttonThreshold, dropdownTriggerProps, marginBottom0, selectedIndex]);
|
|
100
|
-
const displayButtons = (0, _react.useMemo)(() =>
|
|
101
|
-
|
|
107
|
+
const displayButtons = (0, _react.useMemo)(() => {
|
|
108
|
+
var _buttons$slice;
|
|
109
|
+
return buttons === null || buttons === void 0 || (_buttons$slice = buttons.slice(0, buttonThreshold + 1)) === null || _buttons$slice === void 0 ? void 0 : _buttons$slice.map((button, index) => {
|
|
110
|
+
if (index === selectedIndex && !(button !== null && button !== void 0 && button.buttonStyle)) {
|
|
111
|
+
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
112
|
+
buttonStyle: 'primary'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return button;
|
|
116
|
+
});
|
|
117
|
+
}, [buttonThreshold, buttons, selectedIndex]);
|
|
118
|
+
const dropdownButtons = (0, _react.useMemo)(() => {
|
|
119
|
+
var _buttons$slice2;
|
|
120
|
+
return [...((_buttons$slice2 = buttons.slice(buttonThreshold + 1, buttons === null || buttons === void 0 ? void 0 : buttons.length)) === null || _buttons$slice2 === void 0 ? void 0 : _buttons$slice2.map(button => {
|
|
102
121
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
103
|
-
buttonStyle: '
|
|
122
|
+
buttonStyle: 'dropdownItem'
|
|
104
123
|
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}), [buttonThreshold, buttons, selectedIndex]);
|
|
108
|
-
const dropdownButtons = (0, _react.useMemo)(() => [...buttons.slice(buttonThreshold + 1, buttons?.length)?.map(button => {
|
|
109
|
-
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
110
|
-
buttonStyle: 'dropdownItem'
|
|
111
|
-
});
|
|
112
|
-
})], [buttonThreshold, buttons]);
|
|
124
|
+
}))];
|
|
125
|
+
}, [buttonThreshold, buttons]);
|
|
113
126
|
|
|
114
127
|
// eslint-disable-next-line react/prop-types
|
|
115
128
|
const renderActionMenuContent = (0, _react.useCallback)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
@@ -118,34 +131,33 @@ const ResponsiveButtonGroup = props => {
|
|
|
118
131
|
const buttonsSlice = (0, _react.useMemo)(() => [...displayButtons, /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
|
|
119
132
|
className: _ResponsiveButtonGroup.default.dropdownClass,
|
|
120
133
|
renderMenu: renderActionMenuContent,
|
|
121
|
-
renderTrigger: triggerProps => renderActionMenuToggle({
|
|
122
|
-
displayButtons
|
|
123
|
-
|
|
124
|
-
})
|
|
134
|
+
renderTrigger: triggerProps => renderActionMenuToggle(_objectSpread({
|
|
135
|
+
displayButtons
|
|
136
|
+
}, triggerProps))
|
|
125
137
|
}, "responsiveButtonGroup-dropdown-toggle")], [displayButtons, renderActionMenuContent, renderActionMenuToggle]);
|
|
126
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
127
139
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
128
140
|
ref: containerRef,
|
|
129
141
|
className: "width: 100%;"
|
|
130
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, _objectSpread(_objectSpread({
|
|
131
143
|
className: (0, _classnames.default)({
|
|
132
|
-
[
|
|
144
|
+
["".concat(_ResponsiveButtonGroup.default.hidden)]: !ready
|
|
133
145
|
}, _ResponsiveButtonGroup.default.buttonGroup, {
|
|
134
|
-
[
|
|
146
|
+
["".concat(_ResponsiveButtonGroup.default.fullWidth)]: ready && fullWidth
|
|
135
147
|
}, className),
|
|
136
148
|
style: fullWidth ? {
|
|
137
|
-
width:
|
|
138
|
-
} : {}
|
|
139
|
-
|
|
140
|
-
children: !ready || buttonThreshold === cachedSizeArray
|
|
141
|
-
if (index === selectedIndex && !button
|
|
149
|
+
width: "".concat(containerWidth, "px")
|
|
150
|
+
} : {}
|
|
151
|
+
}, rest), {}, {
|
|
152
|
+
children: !ready || buttonThreshold === (cachedSizeArray === null || cachedSizeArray === void 0 ? void 0 : cachedSizeArray.length) - 1 ? buttons === null || buttons === void 0 ? void 0 : buttons.map((button, index) => {
|
|
153
|
+
if (index === selectedIndex && !(button !== null && button !== void 0 && button.buttonStyle)) {
|
|
142
154
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
143
155
|
buttonStyle: 'primary'
|
|
144
156
|
});
|
|
145
157
|
}
|
|
146
158
|
return button;
|
|
147
159
|
}) : buttonsSlice
|
|
148
|
-
})]
|
|
160
|
+
}))]
|
|
149
161
|
});
|
|
150
162
|
};
|
|
151
163
|
ResponsiveButtonGroup.propTypes = propTypes;
|
|
@@ -14,7 +14,7 @@ const useResponsiveButtonGroupSizing = _ref => {
|
|
|
14
14
|
id,
|
|
15
15
|
buttons = []
|
|
16
16
|
} = _ref;
|
|
17
|
-
const eventString = 'responsive-button-group-loaded' + (id ?
|
|
17
|
+
const eventString = 'responsive-button-group-loaded' + (id ? "-".concat(id) : '');
|
|
18
18
|
const loadedEvent = new Event(eventString);
|
|
19
19
|
const isMounted = (0, _react.useRef)(false);
|
|
20
20
|
(0, _react.useEffect)(() => {
|
|
@@ -37,7 +37,8 @@ const useResponsiveButtonGroupSizing = _ref => {
|
|
|
37
37
|
const refArray = buttons.map((_button, index) => {
|
|
38
38
|
return node => {
|
|
39
39
|
if (node !== null) {
|
|
40
|
-
|
|
40
|
+
var _node$clientWidth;
|
|
41
|
+
const newSizeArray = sizeArray.slice(0, index).concat([(_node$clientWidth = node === null || node === void 0 ? void 0 : node.clientWidth) !== null && _node$clientWidth !== void 0 ? _node$clientWidth : 0]).concat(sizeArray.slice(index + 1));
|
|
41
42
|
if (!(0, _isEqual.default)(sizeArray, newSizeArray)) {
|
|
42
43
|
setSizeArray(newSizeArray);
|
|
43
44
|
}
|
|
@@ -49,16 +50,16 @@ const useResponsiveButtonGroupSizing = _ref => {
|
|
|
49
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
51
|
(0, _react.useEffect)((0, _lodash.debounce)(() => {
|
|
51
52
|
if (isMounted.current) {
|
|
52
|
-
if (!cachedSizeArray
|
|
53
|
+
if (!(cachedSizeArray !== null && cachedSizeArray !== void 0 && cachedSizeArray.length) && sizeArray !== null && sizeArray !== void 0 && sizeArray.length) {
|
|
53
54
|
setCachedSizeArray(sizeArray);
|
|
54
55
|
setReady(true);
|
|
55
56
|
document.dispatchEvent(loadedEvent);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}, 150), [cachedSizeArray, sizeArray]);
|
|
59
|
-
const returnButtons = buttons
|
|
60
|
+
const returnButtons = buttons === null || buttons === void 0 ? void 0 : buttons.map((button, index) => {
|
|
60
61
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
61
|
-
ref: refArray
|
|
62
|
+
ref: refArray === null || refArray === void 0 ? void 0 : refArray[index]
|
|
62
63
|
});
|
|
63
64
|
});
|
|
64
65
|
return {
|
|
@@ -11,7 +11,13 @@ var _RichSelect = _interopRequireDefault(require("../../../styles/RichSelect.css
|
|
|
11
11
|
var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMessage"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
19
|
const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
20
|
+
var _ref2, _meta$initial, _findSelectedOptionBy, _meta$initial2;
|
|
15
21
|
let {
|
|
16
22
|
ariaLabel,
|
|
17
23
|
disabled = false,
|
|
@@ -32,17 +38,17 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
32
38
|
value
|
|
33
39
|
} = _ref;
|
|
34
40
|
const hiddenInput = (0, _react.useRef)(null);
|
|
35
|
-
const [internalValue, setInternalValue] = (0, _react.useState)(meta
|
|
41
|
+
const [internalValue, setInternalValue] = (0, _react.useState)((_ref2 = (_meta$initial = meta === null || meta === void 0 ? void 0 : meta.initial) !== null && _meta$initial !== void 0 ? _meta$initial : value) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
36
42
|
const findSelectedOptionByValue = (0, _react.useCallback)(val => {
|
|
37
43
|
return userOptions.find(opt => opt.value === val);
|
|
38
44
|
}, [userOptions]);
|
|
39
|
-
const [selectedOption, setSelectedOption] = (0, _react.useState)(findSelectedOptionByValue(meta
|
|
45
|
+
const [selectedOption, setSelectedOption] = (0, _react.useState)((_findSelectedOptionBy = findSelectedOptionByValue((_meta$initial2 = meta === null || meta === void 0 ? void 0 : meta.initial) !== null && _meta$initial2 !== void 0 ? _meta$initial2 : '')) !== null && _findSelectedOptionBy !== void 0 ? _findSelectedOptionBy : {});
|
|
40
46
|
(0, _react.useEffect)(() => {
|
|
41
47
|
// We treat non-undefined value/formInput values as valid values, whereas undefined is only relevant when prop has not been provided
|
|
42
|
-
if (value !== undefined && !(value === selectedOption
|
|
48
|
+
if (value !== undefined && !(value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) && value === internalValue)) {
|
|
43
49
|
setSelectedOption(findSelectedOptionByValue(value));
|
|
44
50
|
setInternalValue(value);
|
|
45
|
-
} else if (formInput
|
|
51
|
+
} else if ((formInput === null || formInput === void 0 ? void 0 : formInput.value) !== undefined && !(value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) && value === internalValue)) {
|
|
46
52
|
setSelectedOption(findSelectedOptionByValue(formInput.value));
|
|
47
53
|
setInternalValue(formInput.value);
|
|
48
54
|
}
|
|
@@ -52,15 +58,16 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
52
58
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
53
59
|
selectedOption
|
|
54
60
|
}));
|
|
55
|
-
const defaultRenderTrigger =
|
|
61
|
+
const defaultRenderTrigger = _ref3 => {
|
|
62
|
+
var _ref4, _ref5, _ref6, _selectedOption$label;
|
|
56
63
|
let {
|
|
57
64
|
onToggle,
|
|
58
65
|
triggerRef,
|
|
59
66
|
keyHandler,
|
|
60
67
|
ariaProps,
|
|
61
68
|
getTriggerProps
|
|
62
|
-
} =
|
|
63
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownButton, {
|
|
69
|
+
} = _ref3;
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownButton, _objectSpread(_objectSpread(_objectSpread({
|
|
64
71
|
ref: triggerRef,
|
|
65
72
|
buttonClass: _RichSelect.default.triggerButton,
|
|
66
73
|
buttonStyle: "none",
|
|
@@ -69,19 +76,18 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
69
76
|
onClick: onToggle,
|
|
70
77
|
onKeyDown: keyHandler,
|
|
71
78
|
paddingSide0: true,
|
|
72
|
-
type: "button"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
children: selectedOption?.label ?? selectedOption?.value ?? (internalValue || null) ?? placeholder ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
|
|
79
|
+
type: "button"
|
|
80
|
+
}, getTriggerProps()), ariaProps), {}, {
|
|
81
|
+
children: (_ref4 = (_ref5 = (_ref6 = (_selectedOption$label = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _selectedOption$label !== void 0 ? _selectedOption$label : selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== null && _ref6 !== void 0 ? _ref6 : internalValue || null) !== null && _ref5 !== void 0 ? _ref5 : placeholder) !== null && _ref4 !== void 0 ? _ref4 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
|
|
76
82
|
id: "pleaseSelectOption",
|
|
77
83
|
intlKey: passedIntlKey,
|
|
78
84
|
intlNS: passedIntlNS
|
|
79
85
|
})
|
|
80
|
-
});
|
|
86
|
+
}));
|
|
81
87
|
};
|
|
82
88
|
const handleChange = e => {
|
|
83
89
|
// Actually set the value in the form (If formInput exists)
|
|
84
|
-
if (formInput
|
|
90
|
+
if (formInput !== null && formInput !== void 0 && formInput.onChange) {
|
|
85
91
|
formInput.onChange(e);
|
|
86
92
|
}
|
|
87
93
|
|
|
@@ -93,17 +99,20 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
93
99
|
const changeField = val => {
|
|
94
100
|
(0, _components.nativeChangeFieldValue)(hiddenInput, false, val);
|
|
95
101
|
};
|
|
96
|
-
const defaultRenderOption = opt =>
|
|
97
|
-
|
|
102
|
+
const defaultRenderOption = opt => {
|
|
103
|
+
var _opt$label;
|
|
104
|
+
return (_opt$label = opt.label) !== null && _opt$label !== void 0 ? _opt$label : opt.value;
|
|
105
|
+
};
|
|
106
|
+
const defaultRenderMenu = _ref7 => {
|
|
98
107
|
let {
|
|
99
108
|
onToggle
|
|
100
|
-
} =
|
|
109
|
+
} = _ref7;
|
|
101
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
102
111
|
children: userOptions.map(opt => {
|
|
103
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
104
|
-
autoFocus: selectedOption
|
|
113
|
+
autoFocus: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === opt.value,
|
|
105
114
|
buttonStyle: "dropdownItem",
|
|
106
|
-
id:
|
|
115
|
+
id: "".concat(id, "-").concat(formInput.name, "-option-").concat(opt.value),
|
|
107
116
|
marginBottom0: true,
|
|
108
117
|
onClick: () => {
|
|
109
118
|
// Trigger change event
|
|
@@ -121,43 +130,39 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
121
130
|
children: [label || ariaLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
122
131
|
className: ariaLabel && 'sr-only',
|
|
123
132
|
htmlFor: id,
|
|
124
|
-
id:
|
|
133
|
+
id: "".concat(id, "-label"),
|
|
125
134
|
required: required,
|
|
126
135
|
children: ariaLabel || label
|
|
127
|
-
}) : '', /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
|
|
136
|
+
}) : '', /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, _objectSpread({
|
|
128
137
|
disabled: disabled,
|
|
129
138
|
hasPadding: true,
|
|
130
139
|
placement: "bottom-start",
|
|
131
140
|
renderMenu: menuProps => {
|
|
132
141
|
if (renderMenu) {
|
|
133
|
-
return renderMenu({
|
|
134
|
-
...menuProps,
|
|
142
|
+
return renderMenu(_objectSpread(_objectSpread({}, menuProps), {}, {
|
|
135
143
|
selectedOption,
|
|
136
144
|
changeField
|
|
137
|
-
});
|
|
145
|
+
}));
|
|
138
146
|
} else {
|
|
139
147
|
return defaultRenderMenu(menuProps);
|
|
140
148
|
}
|
|
141
149
|
},
|
|
142
150
|
renderTrigger: triggerProps => {
|
|
143
151
|
if (renderTrigger) {
|
|
144
|
-
return renderTrigger({
|
|
145
|
-
...triggerProps,
|
|
152
|
+
return renderTrigger(_objectSpread(_objectSpread({}, triggerProps), {}, {
|
|
146
153
|
selectedOption
|
|
147
|
-
});
|
|
154
|
+
}));
|
|
148
155
|
} else {
|
|
149
156
|
return defaultRenderTrigger(triggerProps);
|
|
150
157
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
154
|
-
...formInput,
|
|
158
|
+
}
|
|
159
|
+
}, dropdownProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, formInput), {}, {
|
|
155
160
|
ref: hiddenInput,
|
|
156
161
|
hidden: true,
|
|
157
162
|
onChange: handleChange,
|
|
158
163
|
type: "text",
|
|
159
164
|
value: internalValue
|
|
160
|
-
})]
|
|
165
|
+
}))]
|
|
161
166
|
});
|
|
162
167
|
});
|
|
163
168
|
RichSelect.propTypes = {
|
|
@@ -8,7 +8,8 @@ var _react = require("react");
|
|
|
8
8
|
const useSelectedOption = () => {
|
|
9
9
|
const [selectedOption, setSelectedOption] = (0, _react.useState)();
|
|
10
10
|
const ref = (0, _react.useCallback)(node => {
|
|
11
|
-
|
|
11
|
+
var _node$selectedOption;
|
|
12
|
+
if (node !== null && (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== ((_node$selectedOption = node.selectedOption) === null || _node$selectedOption === void 0 ? void 0 : _node$selectedOption.value)) {
|
|
12
13
|
setSelectedOption(node.selectedOption);
|
|
13
14
|
}
|
|
14
15
|
}, [selectedOption]);
|