@linzjs/lui 18.5.1 → 18.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [18.6.1](https://github.com/linz/lui/compare/v18.6.0...v18.6.1) (2023-08-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **LuiMultiSwitch:** Fix controlled props warning for read-only text input ([#985](https://github.com/linz/lui/issues/985)) ([ac718ee](https://github.com/linz/lui/commit/ac718eeaf08f1e58107098d44ed7497c6b42963b))
7
+
8
+ # [18.6.0](https://github.com/linz/lui/compare/v18.5.1...v18.6.0) (2023-08-14)
9
+
10
+
11
+ ### Features
12
+
13
+ * **LuiMultiSwitch:** Adding ability to disable particular options ([#984](https://github.com/linz/lui/issues/984)) ([7eeddf3](https://github.com/linz/lui/commit/7eeddf3b86e98bf7e9f6748a3db6eb61d2f317d1))
14
+
1
15
  ## [18.5.1](https://github.com/linz/lui/compare/v18.5.0...v18.5.1) (2023-08-13)
2
16
 
3
17
 
@@ -4,6 +4,7 @@ export interface LuiMultiSwitchOption<ValueType> {
4
4
  value: ValueType;
5
5
  shortcutKey?: string;
6
6
  className?: string;
7
+ disabled?: boolean;
7
8
  }
8
9
  export declare const LuiMultiSwitchYesNo: LuiMultiSwitchOption<boolean>[];
9
10
  export interface LuiMultiSwitchProps<ValueType> {
package/dist/index.js CHANGED
@@ -67825,7 +67825,10 @@ var LuiMultiSwitch = function (_a) {
67825
67825
  switch (_b.label) {
67826
67826
  case 0:
67827
67827
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
67828
- if (disabled || updating.current || newSelectedIndex === selectedIndex) {
67828
+ if (disabled ||
67829
+ updating.current ||
67830
+ newSelectedIndex === selectedIndex ||
67831
+ options[newSelectedIndex].disabled) {
67829
67832
  return [2 /*return*/];
67830
67833
  }
67831
67834
  if (isUncontrolled) {
@@ -67862,7 +67865,7 @@ var LuiMultiSwitch = function (_a) {
67862
67865
  select(newSelectedIndex).then();
67863
67866
  };
67864
67867
  return (React__default["default"].createElement("div", { className: clsx('LuiMultiSwitch', className), role: 'radiogroup', "data-testid": props['data-testid'] },
67865
- React__default["default"].createElement("input", { ref: inputRef, name: id.current, type: 'text', value: selectedIndex, autoFocus: autoFocus, onKeyUp: function (e) {
67868
+ React__default["default"].createElement("input", { ref: inputRef, readOnly: true, name: id.current, type: 'text', value: selectedIndex, autoFocus: autoFocus, onKeyUp: function (e) {
67866
67869
  e.key === 'ArrowLeft' && selectOffset(-1);
67867
67870
  e.key === 'ArrowRight' && selectOffset(1);
67868
67871
  e.key === ' ' && selectOffset(1, true);
@@ -67870,7 +67873,7 @@ var LuiMultiSwitch = function (_a) {
67870
67873
  return e.key && e.key === option.shortcutKey && select(i).then();
67871
67874
  });
67872
67875
  } }),
67873
- React__default["default"].createElement("div", { className: clsx('LuiMultiSwitch-labels', disabled && 'LuiMultiSwitch-disabled') }, options === null || options === void 0 ? void 0 : options.map(function (option, i) { return (React__default["default"].createElement("label", { role: 'radio', key: i, htmlFor: id.current, "aria-disabled": disabled, "aria-checked": selectedIndex === i, className: option.className, onClick: function () { return select(i); }, onTouchStart: function () { return select(i); } }, option.text)); }))));
67876
+ React__default["default"].createElement("div", { className: clsx('LuiMultiSwitch-labels', disabled && 'LuiMultiSwitch-disabled') }, options === null || options === void 0 ? void 0 : options.map(function (option, i) { return (React__default["default"].createElement("label", { role: 'radio', key: i, htmlFor: id.current, "aria-disabled": option.disabled || disabled, "aria-checked": selectedIndex === i, className: option.className, onClick: function () { return select(i); }, onTouchStart: function () { return select(i); } }, option.text)); }))));
67874
67877
  };
67875
67878
 
67876
67879
  var css_248z$5 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.LuiListBox {\n padding: 0;\n list-style: none;\n}\n.LuiListBox .LuiListBoxItem {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: normal;\n user-select: none;\n color: #2a292c;\n line-height: 24px;\n outline: none;\n padding: 0.5rem 0.75rem;\n border: 2px solid transparent;\n}\n.LuiListBox .LuiListBoxItem:focus-visible {\n border-color: #007198;\n}\n.LuiListBox .LuiListBoxItem.LuiListBoxItem-selected {\n background: #e2f3f7;\n}\n.LuiListBox .LuiListBoxItem:hover, .LuiListBox .LuiListBoxItem.LuiListBoxItem-selected:hover {\n background: #d6eef4;\n}\n.LuiListBox .LuiListBoxItem.LuiListBoxItem-disabled {\n background: #eaeaea;\n}\n.LuiListBox .LuiListBox-emptyIndicator, .LuiListBox .LuiListBox-loadingIndicator {\n padding: 0.5rem 0.75rem;\n}\n.LuiListBox .LuiListBoxGroup .LuiListBoxGroup-heading {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n user-select: none;\n color: #6b6966;\n line-height: 16px;\n padding: 0.5rem 0.5rem;\n}";