@k-int/stripes-kint-components 5.1.0 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es/lib/ActionList/ActionListFieldArray.js +29 -32
  3. package/es/lib/ComboButton/ComboButton.js +5 -6
  4. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +4 -7
  5. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +29 -32
  6. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
  7. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +2 -2
  8. package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
  9. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
  10. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
  11. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
  12. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +5 -10
  13. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +20 -26
  14. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
  15. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
  16. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
  17. package/es/lib/CustomProperties/Edit/testResources.js +11 -12
  18. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +6 -11
  19. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +20 -28
  20. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
  21. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
  22. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +8 -8
  23. package/es/lib/CustomProperties/Filter/testResources.js +1 -2
  24. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
  25. package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
  26. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
  27. package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
  28. package/es/lib/CycleButton/CycleButton.js +1 -1
  29. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +21 -32
  30. package/es/lib/EditableRefdataList/EditableRefdataList.js +26 -33
  31. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
  32. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -5
  33. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +10 -12
  34. package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
  35. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +4 -7
  36. package/es/lib/IconSelect/IconSelect.js +5 -9
  37. package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
  38. package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
  39. package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +21 -28
  40. package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
  41. package/es/lib/RichSelect/RichSelect.js +14 -19
  42. package/es/lib/RichSelect/useSelectedOption.js +1 -2
  43. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +14 -17
  44. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +4 -6
  45. package/es/lib/SASQRoute/SASQRoute.js +2 -2
  46. package/es/lib/SASQViewComponent/SASQViewComponent.js +5 -9
  47. package/es/lib/SettingPage/SettingPagePane.js +2 -2
  48. package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -2
  49. package/es/lib/Typedown/Typedown.js +19 -26
  50. package/es/lib/constants/comparators.js +1 -1
  51. package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
  52. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
  53. package/es/lib/hooks/useActiveElement.js +1 -1
  54. package/es/lib/hooks/useCustomProperties.js +2 -2
  55. package/es/lib/hooks/useHelperApp.js +6 -6
  56. package/es/lib/hooks/useIntlKeyStore.js +4 -7
  57. package/es/lib/hooks/useKintIntl.js +5 -11
  58. package/es/lib/hooks/useKiwtSASQuery.js +1 -1
  59. package/es/lib/hooks/useModConfigEntries.js +2 -2
  60. package/es/lib/hooks/useMutateCustomProperties.js +8 -8
  61. package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
  62. package/es/lib/hooks/useMutateRefdataCategory.js +4 -4
  63. package/es/lib/hooks/useMutateRefdataValue.js +6 -6
  64. package/es/lib/hooks/useQIndex.js +5 -5
  65. package/es/lib/hooks/useRefdata.js +3 -3
  66. package/es/lib/hooks/useTemplates.js +4 -4
  67. package/es/lib/settingsHooks/useAppSettings.js +7 -11
  68. package/es/lib/settingsHooks/useSettingSection.js +2 -2
  69. package/es/lib/settingsHooks/useSettings.js +3 -3
  70. package/es/lib/utils/buildUrl.js +2 -3
  71. package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +6 -6
  72. package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
  73. package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +4 -5
  74. package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
  75. package/es/lib/utils/generateKiwtQueryParams.js +28 -37
  76. package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
  77. package/es/lib/utils/matchString.js +1 -1
  78. package/es/lib/utils/parseErrorResponse.js +2 -3
  79. package/es/lib/utils/selectorSafe.js +2 -3
  80. package/es/lib/utils/sortByLabel.js +2 -3
  81. package/es/lib/validators/validators.js +3 -3
  82. package/package.json +1 -1
  83. package/src/lib/CustomProperties/Edit/CustomPropertyField.js +4 -2
  84. package/src/lib/constants/comparators.js +1 -0
@@ -11,7 +11,6 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  // This works analogously to useKintIntl's "formatKintMessage"
13
13
  const FormattedKintMessage = _ref => {
14
- var _intlObj$messages2;
15
14
  let {
16
15
  fallbackMessage,
17
16
  id,
@@ -23,12 +22,11 @@ const FormattedKintMessage = _ref => {
23
22
  const intlKey = (0, _hooks.useIntlKey)(passedIntlKey, passedIntlNS);
24
23
  const intlObj = (0, _reactIntl.useIntl)();
25
24
  if (overrideValue) {
26
- var _intlObj$messages;
27
25
  // Version 3 is a breaking change, where labelOverrides must be strings.
28
26
  if (typeof overrideValue !== 'string') {
29
27
  throw new Error('Override values must be strings as of stripes-kint-components ^3.0.0');
30
28
  }
31
- if ((_intlObj$messages = intlObj.messages) !== null && _intlObj$messages !== void 0 && _intlObj$messages[overrideValue]) {
29
+ if (intlObj.messages?.[overrideValue]) {
32
30
  // We've been passed a key as an override, return formattedMessage with it
33
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
34
32
  id: overrideValue,
@@ -42,10 +40,9 @@ const FormattedKintMessage = _ref => {
42
40
  // If key does not exist in intl, and we have a specified "fallbackMessage", use that
43
41
 
44
42
  // (FallbackMessage works like defaultMessage but with no warning)
45
- if (!((_intlObj$messages2 = intlObj.messages) !== null && _intlObj$messages2 !== void 0 && _intlObj$messages2["".concat(intlKey, ".").concat(id)]) && fallbackMessage) {
46
- var _intlObj$messages3;
43
+ if (!intlObj.messages?.[`${intlKey}.${id}`] && fallbackMessage) {
47
44
  // Allow fallback message to be an intl key
48
- if ((_intlObj$messages3 = intlObj.messages) !== null && _intlObj$messages3 !== void 0 && _intlObj$messages3[fallbackMessage]) {
45
+ if (intlObj.messages?.[fallbackMessage]) {
49
46
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
50
47
  id: fallbackMessage,
51
48
  ...formattedMessageProps
@@ -54,7 +51,7 @@ const FormattedKintMessage = _ref => {
54
51
  return fallbackMessage;
55
52
  }
56
53
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
57
- id: "".concat(intlKey, ".").concat(id),
54
+ id: `${intlKey}.${id}`,
58
55
  ...formattedMessageProps
59
56
  });
60
57
  };
@@ -17,7 +17,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
  // A form component which acts as a "Select for states with corresponding icons"
19
19
  const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
20
- var _selectedOption$butto;
21
20
  let {
22
21
  ariaLabel,
23
22
  disabled = false,
@@ -44,7 +43,7 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
44
43
  };
45
44
 
46
45
  // Options with notSet
47
- const options = [notSet !== null && notSet !== void 0 ? notSet : defaultNotSet, ...userOptions];
46
+ const options = [notSet ?? defaultNotSet, ...userOptions];
48
47
  const [richSelectRef, selectedOption] = (0, _RichSelect.useSelectedOption)();
49
48
  (0, _react.useImperativeHandle)(ref, () => ({
50
49
  selectedOption
@@ -52,7 +51,7 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
52
51
  const {
53
52
  className: iconButtonClassName,
54
53
  ...buttonProps
55
- } = (_selectedOption$butto = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.buttonProps) !== null && _selectedOption$butto !== void 0 ? _selectedOption$butto : {};
54
+ } = selectedOption?.buttonProps ?? {};
56
55
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RichSelect.default, {
57
56
  ref: richSelectRef,
58
57
  ariaLabel: ariaLabel,
@@ -64,19 +63,16 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
64
63
  onChange: onChange,
65
64
  options: options,
66
65
  renderOption: opt => {
67
- var _opt$label2;
68
66
  if (opt.icon) {
69
- var _opt$label;
70
67
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
71
68
  icon: opt.icon,
72
69
  ...opt.iconProps,
73
- children: (_opt$label = opt.label) !== null && _opt$label !== void 0 ? _opt$label : opt.value
70
+ children: opt.label ?? opt.value
74
71
  });
75
72
  }
76
- return (_opt$label2 = opt.label) !== null && _opt$label2 !== void 0 ? _opt$label2 : opt.value;
73
+ return opt.label ?? opt.value;
77
74
  },
78
75
  renderTrigger: _ref2 => {
79
- var _selectedOption$icon;
80
76
  let {
81
77
  onToggle,
82
78
  triggerRef,
@@ -87,7 +83,7 @@ const IconSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
87
83
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
88
84
  ref: triggerRef,
89
85
  disabled: disabled,
90
- icon: (_selectedOption$icon = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.icon) !== null && _selectedOption$icon !== void 0 ? _selectedOption$icon : 'ellipsis',
86
+ icon: selectedOption?.icon ?? 'ellipsis',
91
87
  marginBottom0: true,
92
88
  onClick: onToggle,
93
89
  onKeyDown: keyHandler,
@@ -54,18 +54,18 @@ const NoResultsMessage = _ref => {
54
54
  // Request failure
55
55
  if (isError) {
56
56
  icon = 'exclamation-circle';
57
- label = error === null || error === void 0 ? void 0 : error.message;
57
+ label = error?.message;
58
58
  }
59
59
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
60
60
  className: _NoResultsMessage.default.noResultsMessage,
61
61
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
62
62
  className: _NoResultsMessage.default.noResultsMessageLabelWrap,
63
63
  children: [(icon || userIcon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
64
- icon: userIcon !== null && userIcon !== void 0 ? userIcon : icon,
64
+ icon: userIcon ?? icon,
65
65
  iconRootClass: _NoResultsMessage.default.noResultsMessageIcon
66
66
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
67
67
  className: _NoResultsMessage.default.noResultsMessageLabel,
68
- children: userLabel !== null && userLabel !== void 0 ? userLabel : label
68
+ children: userLabel ?? label
69
69
  })]
70
70
  }), !filterPaneIsVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
71
71
  buttonClass: _NoResultsMessage.default.noResultsMessageButton,
@@ -73,7 +73,7 @@ const NoResultsMessage = _ref => {
73
73
  onClick: toggleFilterPane,
74
74
  children: kintIntl.formatKintMessage({
75
75
  id: 'showFilters',
76
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.showFilters
76
+ overrideValue: labelOverrides?.showFilters
77
77
  })
78
78
  })]
79
79
  });
@@ -32,7 +32,7 @@ const RefdataButtons = props => {
32
32
  'checked': input.value === option.value,
33
33
  'fullWidth': true,
34
34
  'label': labelTranslations ? intl.formatMessage({
35
- id: "".concat(labelTranslations.key, ".").concat(option.value),
35
+ id: `${labelTranslations.key}.${option.value}`,
36
36
  defaultMessage: option.label
37
37
  }) : option.label,
38
38
  'marginBottom0': true,
@@ -44,7 +44,7 @@ const RefdataButtons = props => {
44
44
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioButton, {
45
45
  ...buttonProps
46
46
  })
47
- }, "".concat(input.name, ":").concat(option.id));
47
+ }, `${input.name}:${option.id}`);
48
48
  });
49
49
  };
50
50
  const returnRows = dataOptions => {
@@ -71,7 +71,7 @@ const RefdataButtons = props => {
71
71
  return chunkedDataOptions.map((cdo, index) => {
72
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
73
73
  children: buttonRender(cdo, false)
74
- }, "".concat(props.input.name, ":row").concat(index));
74
+ }, `${props.input.name}:row${index}`);
75
75
  });
76
76
  };
77
77
  return returnRows(props.dataOptions);
@@ -28,12 +28,12 @@ const calculateCumulativeThreshold = function (arrayOfNumbers, maximum) {
28
28
  let value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
29
29
  // If all the numbers fit, return the last index
30
30
  if (arrayOfNumbers.reduce((partialSum, a) => partialSum + a, 0) <= maximum) {
31
- return (arrayOfNumbers === null || arrayOfNumbers === void 0 ? void 0 : arrayOfNumbers.length) - 1;
31
+ return arrayOfNumbers?.length - 1;
32
32
  }
33
33
 
34
34
  // Else we'll need a down arrow button, so include that in calculations
35
35
  const nextValue = value + arrayOfNumbers[index];
36
- if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 < (arrayOfNumbers === null || arrayOfNumbers === void 0 ? void 0 : arrayOfNumbers.length)) {
36
+ if (nextValue + SIZE_OF_DOWN_ARROW_BUTTON <= maximum && index + 1 < arrayOfNumbers?.length) {
37
37
  return calculateCumulativeThreshold(arrayOfNumbers, maximum, index + 1, nextValue);
38
38
  }
39
39
  return index - 1;
@@ -65,7 +65,6 @@ const ResponsiveButtonGroup = props => {
65
65
  });
66
66
  const buttonThreshold = calculateCumulativeThreshold(cachedSizeArray, containerWidth);
67
67
  const renderActionMenuToggle = (0, _react.useCallback)(_ref => {
68
- var _displayButtons$lengt;
69
68
  let {
70
69
  displayButtons,
71
70
  onToggle,
@@ -79,11 +78,11 @@ const ResponsiveButtonGroup = props => {
79
78
  ref: triggerRef,
80
79
  "aria-label": "menu",
81
80
  buttonClass: (0, _classnames.default)(_ResponsiveButtonGroup.default.width100, {
82
- ["".concat(_ResponsiveButtonGroup.default.dropdownButtonClass)]: ((_displayButtons$lengt = displayButtons === null || displayButtons === void 0 ? void 0 : displayButtons.length) !== null && _displayButtons$lengt !== void 0 ? _displayButtons$lengt : 0) > 0
81
+ [`${_ResponsiveButtonGroup.default.dropdownButtonClass}`]: (displayButtons?.length ?? 0) > 0
83
82
  }, {
84
- ["".concat(_ResponsiveButtonGroup.default.marginBottom)]: !marginBottom0
83
+ [`${_ResponsiveButtonGroup.default.marginBottom}`]: !marginBottom0
85
84
  }, {
86
- ["".concat(_ResponsiveButtonGroup.default.marginBottom0)]: marginBottom0
85
+ [`${_ResponsiveButtonGroup.default.marginBottom0}`]: marginBottom0
87
86
  }),
88
87
  buttonStyle: selectedIndex > buttonThreshold ? 'primary' : 'default',
89
88
  onClick: onToggle,
@@ -98,25 +97,19 @@ const ResponsiveButtonGroup = props => {
98
97
  })
99
98
  });
100
99
  }, [buttonThreshold, dropdownTriggerProps, marginBottom0, selectedIndex]);
101
- const displayButtons = (0, _react.useMemo)(() => {
102
- var _buttons$slice;
103
- 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) => {
104
- if (index === selectedIndex && !(button !== null && button !== void 0 && button.buttonStyle)) {
105
- return /*#__PURE__*/(0, _react.cloneElement)(button, {
106
- buttonStyle: 'primary'
107
- });
108
- }
109
- return button;
110
- });
111
- }, [buttonThreshold, buttons, selectedIndex]);
112
- const dropdownButtons = (0, _react.useMemo)(() => {
113
- var _buttons$slice2;
114
- 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 => {
100
+ const displayButtons = (0, _react.useMemo)(() => buttons?.slice(0, buttonThreshold + 1)?.map((button, index) => {
101
+ if (index === selectedIndex && !button?.buttonStyle) {
115
102
  return /*#__PURE__*/(0, _react.cloneElement)(button, {
116
- buttonStyle: 'dropdownItem'
103
+ buttonStyle: 'primary'
117
104
  });
118
- }))];
119
- }, [buttonThreshold, buttons]);
105
+ }
106
+ return button;
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]);
120
113
 
121
114
  // eslint-disable-next-line react/prop-types
122
115
  const renderActionMenuContent = (0, _react.useCallback)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
@@ -136,16 +129,16 @@ const ResponsiveButtonGroup = props => {
136
129
  className: "width: 100%;"
137
130
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
138
131
  className: (0, _classnames.default)({
139
- ["".concat(_ResponsiveButtonGroup.default.hidden)]: !ready
132
+ [`${_ResponsiveButtonGroup.default.hidden}`]: !ready
140
133
  }, _ResponsiveButtonGroup.default.buttonGroup, {
141
- ["".concat(_ResponsiveButtonGroup.default.fullWidth)]: ready && fullWidth
134
+ [`${_ResponsiveButtonGroup.default.fullWidth}`]: ready && fullWidth
142
135
  }, className),
143
136
  style: fullWidth ? {
144
- width: "".concat(containerWidth, "px")
137
+ width: `${containerWidth}px`
145
138
  } : {},
146
139
  ...rest,
147
- children: !ready || buttonThreshold === (cachedSizeArray === null || cachedSizeArray === void 0 ? void 0 : cachedSizeArray.length) - 1 ? buttons === null || buttons === void 0 ? void 0 : buttons.map((button, index) => {
148
- if (index === selectedIndex && !(button !== null && button !== void 0 && button.buttonStyle)) {
140
+ children: !ready || buttonThreshold === cachedSizeArray?.length - 1 ? buttons?.map((button, index) => {
141
+ if (index === selectedIndex && !button?.buttonStyle) {
149
142
  return /*#__PURE__*/(0, _react.cloneElement)(button, {
150
143
  buttonStyle: 'primary'
151
144
  });
@@ -14,7 +14,7 @@ const useResponsiveButtonGroupSizing = _ref => {
14
14
  id,
15
15
  buttons = []
16
16
  } = _ref;
17
- const eventString = 'responsive-button-group-loaded' + (id ? "-".concat(id) : '');
17
+ const eventString = 'responsive-button-group-loaded' + (id ? `-${id}` : '');
18
18
  const loadedEvent = new Event(eventString);
19
19
  const isMounted = (0, _react.useRef)(false);
20
20
  (0, _react.useEffect)(() => {
@@ -37,8 +37,7 @@ const useResponsiveButtonGroupSizing = _ref => {
37
37
  const refArray = buttons.map((_button, index) => {
38
38
  return node => {
39
39
  if (node !== null) {
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));
40
+ const newSizeArray = sizeArray.slice(0, index).concat([node?.clientWidth ?? 0]).concat(sizeArray.slice(index + 1));
42
41
  if (!(0, _isEqual.default)(sizeArray, newSizeArray)) {
43
42
  setSizeArray(newSizeArray);
44
43
  }
@@ -50,16 +49,16 @@ const useResponsiveButtonGroupSizing = _ref => {
50
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
51
50
  (0, _react.useEffect)((0, _lodash.debounce)(() => {
52
51
  if (isMounted.current) {
53
- if (!(cachedSizeArray !== null && cachedSizeArray !== void 0 && cachedSizeArray.length) && sizeArray !== null && sizeArray !== void 0 && sizeArray.length) {
52
+ if (!cachedSizeArray?.length && sizeArray?.length) {
54
53
  setCachedSizeArray(sizeArray);
55
54
  setReady(true);
56
55
  document.dispatchEvent(loadedEvent);
57
56
  }
58
57
  }
59
58
  }, 150), [cachedSizeArray, sizeArray]);
60
- const returnButtons = buttons === null || buttons === void 0 ? void 0 : buttons.map((button, index) => {
59
+ const returnButtons = buttons?.map((button, index) => {
61
60
  return /*#__PURE__*/(0, _react.cloneElement)(button, {
62
- ref: refArray === null || refArray === void 0 ? void 0 : refArray[index]
61
+ ref: refArray?.[index]
63
62
  });
64
63
  });
65
64
  return {
@@ -12,7 +12,6 @@ var _FormattedKintMessage = _interopRequireDefault(require("../FormattedKintMess
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
15
- var _ref2, _meta$initial, _findSelectedOptionBy, _meta$initial2;
16
15
  let {
17
16
  ariaLabel,
18
17
  disabled = false,
@@ -33,17 +32,17 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
33
32
  value
34
33
  } = _ref;
35
34
  const hiddenInput = (0, _react.useRef)(null);
36
- 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 : '');
35
+ const [internalValue, setInternalValue] = (0, _react.useState)(meta?.initial ?? value ?? '');
37
36
  const findSelectedOptionByValue = (0, _react.useCallback)(val => {
38
37
  return userOptions.find(opt => opt.value === val);
39
38
  }, [userOptions]);
40
- 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 : {});
39
+ const [selectedOption, setSelectedOption] = (0, _react.useState)(findSelectedOptionByValue(meta?.initial ?? '') ?? {});
41
40
  (0, _react.useEffect)(() => {
42
41
  // We treat non-undefined value/formInput values as valid values, whereas undefined is only relevant when prop has not been provided
43
- if (value !== undefined && !(value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) && value === internalValue)) {
42
+ if (value !== undefined && !(value === selectedOption?.value && value === internalValue)) {
44
43
  setSelectedOption(findSelectedOptionByValue(value));
45
44
  setInternalValue(value);
46
- } else if ((formInput === null || formInput === void 0 ? void 0 : formInput.value) !== undefined && !(value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) && value === internalValue)) {
45
+ } else if (formInput?.value !== undefined && !(value === selectedOption?.value && value === internalValue)) {
47
46
  setSelectedOption(findSelectedOptionByValue(formInput.value));
48
47
  setInternalValue(formInput.value);
49
48
  }
@@ -53,15 +52,14 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
53
52
  (0, _react.useImperativeHandle)(ref, () => ({
54
53
  selectedOption
55
54
  }));
56
- const defaultRenderTrigger = _ref3 => {
57
- var _ref4, _ref5, _ref6, _selectedOption$label;
55
+ const defaultRenderTrigger = _ref2 => {
58
56
  let {
59
57
  onToggle,
60
58
  triggerRef,
61
59
  keyHandler,
62
60
  ariaProps,
63
61
  getTriggerProps
64
- } = _ref3;
62
+ } = _ref2;
65
63
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownButton, {
66
64
  ref: triggerRef,
67
65
  buttonClass: _RichSelect.default.triggerButton,
@@ -74,7 +72,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
74
72
  type: "button",
75
73
  ...getTriggerProps(),
76
74
  ...ariaProps,
77
- 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, {
75
+ children: selectedOption?.label ?? selectedOption?.value ?? (internalValue || null) ?? placeholder ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormattedKintMessage.default, {
78
76
  id: "pleaseSelectOption",
79
77
  intlKey: passedIntlKey,
80
78
  intlNS: passedIntlNS
@@ -83,7 +81,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
83
81
  };
84
82
  const handleChange = e => {
85
83
  // Actually set the value in the form (If formInput exists)
86
- if (formInput !== null && formInput !== void 0 && formInput.onChange) {
84
+ if (formInput?.onChange) {
87
85
  formInput.onChange(e);
88
86
  }
89
87
 
@@ -95,20 +93,17 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
95
93
  const changeField = val => {
96
94
  (0, _components.nativeChangeFieldValue)(hiddenInput, false, val);
97
95
  };
98
- const defaultRenderOption = opt => {
99
- var _opt$label;
100
- return (_opt$label = opt.label) !== null && _opt$label !== void 0 ? _opt$label : opt.value;
101
- };
102
- const defaultRenderMenu = _ref7 => {
96
+ const defaultRenderOption = opt => opt.label ?? opt.value;
97
+ const defaultRenderMenu = _ref3 => {
103
98
  let {
104
99
  onToggle
105
- } = _ref7;
100
+ } = _ref3;
106
101
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
107
102
  children: userOptions.map(opt => {
108
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
109
- autoFocus: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === opt.value,
104
+ autoFocus: selectedOption?.value === opt.value,
110
105
  buttonStyle: "dropdownItem",
111
- id: "".concat(id, "-").concat(formInput.name, "-option-").concat(opt.value),
106
+ id: `${id}-${formInput.name}-option-${opt.value}`,
112
107
  marginBottom0: true,
113
108
  onClick: () => {
114
109
  // Trigger change event
@@ -126,7 +121,7 @@ const RichSelect = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
126
121
  children: [label || ariaLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
127
122
  className: ariaLabel && 'sr-only',
128
123
  htmlFor: id,
129
- id: "".concat(id, "-label"),
124
+ id: `${id}-label`,
130
125
  required: required,
131
126
  children: ariaLabel || label
132
127
  }) : '', /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
@@ -8,8 +8,7 @@ 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
- 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)) {
11
+ if (node !== null && selectedOption?.value !== node.selectedOption?.value) {
13
12
  setSelectedOption(node.selectedOption);
14
13
  }
15
14
  }, [selectedOption]);
@@ -17,7 +17,6 @@ var _TableBody = _interopRequireDefault(require("./TableBody"));
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
20
- var _totalData$pages$redu, _totalData$pages;
21
20
  const {
22
21
  children,
23
22
  fetchParameters = {},
@@ -46,14 +45,14 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
46
45
  0: namespace
47
46
  } = (0, _core.useNamespace)();
48
47
  const ky = (0, _core.useOkapiKy)();
49
- const filterPaneVisibileKey = "".concat(namespace, "-").concat(id, "-filterPaneVisibility");
48
+ const filterPaneVisibileKey = `${namespace}-${id}-filterPaneVisibility`;
50
49
  const fetchPageData = _ref => {
51
50
  let {
52
51
  pageParam = 0
53
52
  } = _ref;
54
53
  const queryMap = fetchParameters.SASQ_MAP;
55
54
  queryMap.offset = pageParam;
56
- return ky("".concat(fetchParameters.endpoint).concat((0, _utils.generateKiwtQuery)(queryMap, query))).json();
55
+ return ky(`${fetchParameters.endpoint}${(0, _utils.generateKiwtQuery)(queryMap, query)}`).json();
57
56
  };
58
57
  const [filterPaneVisible, setFilterPaneVisible] = (0, _hooks.useLocalStorageState)(filterPaneVisibileKey, true);
59
58
  const toggleFilterPane = () => setFilterPaneVisible(!filterPaneVisible);
@@ -73,8 +72,7 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
73
72
  ...restOfInfiniteQueryProps
74
73
  }
75
74
  }));
76
- const data = (_totalData$pages$redu = (_totalData$pages = totalData.pages) === null || _totalData$pages === void 0 ? void 0 : _totalData$pages.reduce((acc, curr) => {
77
- var _acc$results, _curr$results;
75
+ const data = totalData.pages?.reduce((acc, curr) => {
78
76
  const newAcc = {
79
77
  ...acc
80
78
  };
@@ -83,11 +81,11 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
83
81
  newAcc[key] = value;
84
82
  }
85
83
  }
86
- const newResults = [...((_acc$results = acc.results) !== null && _acc$results !== void 0 ? _acc$results : [])];
87
- newResults.push(...((_curr$results = curr.results) !== null && _curr$results !== void 0 ? _curr$results : []));
84
+ const newResults = [...(acc.results ?? [])];
85
+ newResults.push(...(curr.results ?? []));
88
86
  newAcc.results = newResults;
89
87
  return newAcc;
90
- }, {})) !== null && _totalData$pages$redu !== void 0 ? _totalData$pages$redu : {};
88
+ }, {}) ?? {};
91
89
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.SearchAndSortQuery, {
92
90
  initialSearchState: {
93
91
  query: ''
@@ -109,7 +107,7 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
109
107
  const searchHandlers = getSearchHandlers();
110
108
  const disableReset = !filterChanged && !searchChanged;
111
109
  const filterCount = activeFilters.string ? activeFilters.string.split(',').length : 0;
112
- const Body = RenderBody !== null && RenderBody !== void 0 ? RenderBody : _TableBody.default;
110
+ const Body = RenderBody ?? _TableBody.default;
113
111
  const {
114
112
  filterPaneFirstMenu,
115
113
  filterPaneLastMenu,
@@ -131,12 +129,12 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
131
129
  };
132
130
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_smartComponents.PersistedPaneset, {
133
131
  appId: namespace,
134
- id: "".concat(id, "-paneset"),
132
+ id: `${id}-paneset`,
135
133
  ...persistedPanesetProps,
136
134
  children: [filterPaneVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
137
135
  defaultWidth: "20%",
138
136
  firstMenu: filterPaneFirstMenu ? filterPaneFirstMenu(internalStateProps) : null,
139
- id: "".concat(id, "-filter-pane"),
137
+ id: `${id}-filter-pane`,
140
138
  lastMenu: filterPaneLastMenu ? filterPaneLastMenu(internalStateProps) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
141
139
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.CollapseFilterPaneButton, {
142
140
  onClick: toggleFilterPane
@@ -152,11 +150,10 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
152
150
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SearchField, {
153
151
  ariaLabel: searchFieldAriaLabel,
154
152
  autoFocus: true,
155
- id: "sasq-search-field-".concat(id),
153
+ id: `sasq-search-field-${id}`,
156
154
  name: "query",
157
155
  onChange: e => {
158
- var _e$target;
159
- if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.value) {
156
+ if (e.target?.value) {
160
157
  searchHandlers.query(e); // SASQ needs the whole event here
161
158
  } else {
162
159
  searchHandlers.reset();
@@ -203,15 +200,15 @@ const SASQLookupComponent = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
203
200
  onClick: toggleFilterPane
204
201
  })
205
202
  }) : null,
206
- id: "".concat(id, "-main-pane"),
203
+ id: `${id}-main-pane`,
207
204
  lastMenu: mainPaneLastMenu ? mainPaneLastMenu(internalStateProps) : null,
208
205
  noOverflow: true,
209
206
  padContent: false,
210
207
  paneSub: kintIntl.formatKintMessage({
211
208
  id: 'found#Values',
212
- overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.foundValues
209
+ overrideValue: labelOverrides?.foundValues
213
210
  }, {
214
- total: data === null || data === void 0 ? void 0 : data.total
211
+ total: data?.total
215
212
  }),
216
213
  ...restOfMainPaneProps,
217
214
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, {
@@ -11,7 +11,6 @@ var _NoResultsMessage = _interopRequireDefault(require("../../NoResultsMessage")
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  const TableBody = _ref => {
14
- var _query$sort;
15
14
  let {
16
15
  data,
17
16
  error,
@@ -30,7 +29,7 @@ const TableBody = _ref => {
30
29
  toggleFilterPane,
31
30
  query
32
31
  } = _ref;
33
- const sortOrder = (_query$sort = query.sort) !== null && _query$sort !== void 0 ? _query$sort : '';
32
+ const sortOrder = query.sort ?? '';
34
33
  const history = (0, _reactRouterDom.useHistory)();
35
34
  const location = (0, _reactRouterDom.useLocation)();
36
35
  const onNeedMoreData = (_askAmount, index) => {
@@ -47,7 +46,7 @@ const TableBody = _ref => {
47
46
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
48
47
  autosize: true,
49
48
  columnMapping: columnMapping,
50
- contentData: data === null || data === void 0 ? void 0 : data.results,
49
+ contentData: data?.results,
51
50
  hasMargin: true,
52
51
  isEmptyMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoResultsMessage.default, {
53
52
  error,
@@ -61,16 +60,15 @@ const TableBody = _ref => {
61
60
  toggleFilterPane
62
61
  }),
63
62
  isSelected: _ref2 => {
64
- var _match$params;
65
63
  let {
66
64
  item
67
65
  } = _ref2;
68
- return item.id === (match === null || match === void 0 || (_match$params = match.params) === null || _match$params === void 0 ? void 0 : _match$params.id);
66
+ return item.id === match?.params?.id;
69
67
  },
70
68
  onHeaderClick: onSort,
71
69
  onNeedMoreData: onNeedMoreData,
72
70
  onRowClick: (_e, rowData) => {
73
- history.push("".concat(path, "/").concat(rowData === null || rowData === void 0 ? void 0 : rowData.id).concat(location === null || location === void 0 ? void 0 : location.search));
71
+ history.push(`${path}/${rowData?.id}${location?.search}`);
74
72
  },
75
73
  pagingType: "click",
76
74
  sortDirection: sortOrder.startsWith('-') ? 'descending' : 'ascending',
@@ -36,7 +36,7 @@ const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
36
36
  // Reinsert the SASQ_MAP
37
37
  fetchParameters.SASQ_MAP = SASQ_MAP;
38
38
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
39
- path: "".concat(path, "/:id?"),
39
+ path: `${path}/:id?`,
40
40
  render: routeProps => {
41
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.SASQLookupComponent, {
42
42
  ref: lookupRef,
@@ -46,7 +46,7 @@ const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
46
46
  ...props,
47
47
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Switch, {
48
48
  children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
49
- path: "".concat(path, "/:id"),
49
+ path: `${path}/:id`,
50
50
  render: innerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default, {
51
51
  ref: viewRef,
52
52
  ...innerProps,
@@ -11,7 +11,6 @@ var _core = require("@folio/stripes/core");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
14
- var _fetchParameters$item, _match$params, _match$params3;
15
14
  let {
16
15
  fetchParameters,
17
16
  history,
@@ -27,22 +26,19 @@ const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
27
26
  } = (0, _core.useNamespace)();
28
27
 
29
28
  // If itemEndpoint is available, use that, otherwise use standard endpoint
30
- const endpoint = (_fetchParameters$item = fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.itemEndpoint) !== null && _fetchParameters$item !== void 0 ? _fetchParameters$item : fetchParameters === null || fetchParameters === void 0 ? void 0 : fetchParameters.endpoint;
29
+ const endpoint = fetchParameters?.itemEndpoint ?? fetchParameters?.endpoint;
31
30
  const queryNamespace = [namespace, 'SASQ'];
32
31
  if (id) {
33
32
  queryNamespace.push(id);
34
33
  }
35
34
  queryNamespace.push('view');
36
- queryNamespace.push(match === null || match === void 0 || (_match$params = match.params) === null || _match$params === void 0 ? void 0 : _match$params.id);
35
+ queryNamespace.push(match?.params?.id);
37
36
  const ky = (0, _core.useOkapiKy)();
38
37
  const {
39
38
  data = {},
40
39
  ...rest
41
- } = (0, _reactQuery.useQuery)(queryNamespace, () => {
42
- var _match$params2;
43
- return ky("".concat(endpoint, "/").concat(match === null || match === void 0 || (_match$params2 = match.params) === null || _match$params2 === void 0 ? void 0 : _match$params2.id)).json();
44
- }, {
45
- enabled: !!(match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.id)
40
+ } = (0, _reactQuery.useQuery)(queryNamespace, () => ky(`${endpoint}/${match?.params?.id}`).json(), {
41
+ enabled: !!match?.params?.id
46
42
  });
47
43
  (0, _react.useImperativeHandle)(ref, () => ({
48
44
  queryProps: {
@@ -51,7 +47,7 @@ const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
51
47
  }
52
48
  }));
53
49
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, {
54
- onClose: () => history.push("".concat(path).concat(location.search)),
50
+ onClose: () => history.push(`${path}${location.search}`),
55
51
  queryProps: {
56
52
  ...rest
57
53
  },
@@ -20,9 +20,9 @@ const SettingPagePane = _ref => {
20
20
  const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
21
21
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
22
22
  defaultWidth: "fill",
23
- id: "settings-".concat(sectionName),
23
+ id: `settings-${sectionName}`,
24
24
  paneTitle: kintIntl.formatKintMessage({
25
- id: "settings.settingsSection.".concat((0, _utils.toCamelCase)(sectionName)),
25
+ id: `settings.settingsSection.${(0, _utils.toCamelCase)(sectionName)}`,
26
26
  fallbackMessage: sectionName
27
27
  }),
28
28
  children: children