@redsift/design-system 9.0.0-alpha.15 → 9.0.0-alpha.17

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/index.d.ts CHANGED
@@ -2072,7 +2072,8 @@ type ListboxState = Readonly<{
2072
2072
  }>;
2073
2073
  declare enum ListboxActionType {
2074
2074
  TOGGLE = "TOGGLE",
2075
- SET = "SET"
2075
+ SET = "SET",
2076
+ UPDATE_OPTIONS = "UPDATE_OPTIONS"
2076
2077
  }
2077
2078
  type ListboxAction = {
2078
2079
  type: ListboxActionType.TOGGLE;
@@ -2086,6 +2087,11 @@ type ListboxAction = {
2086
2087
  values: string[];
2087
2088
  activedescendant?: [string, string];
2088
2089
  };
2090
+ } | {
2091
+ type: ListboxActionType.UPDATE_OPTIONS;
2092
+ payload: {
2093
+ isDisabled: boolean;
2094
+ };
2089
2095
  };
2090
2096
  type UseListboxItemProps = UseFocusWithinGroupProps & {
2091
2097
  isSelected?: boolean;
@@ -2185,7 +2191,7 @@ interface ItemProps extends Omit<ComponentProps<'div'>, 'onClick'>, ContainerPro
2185
2191
  /** Method to handle component change. */
2186
2192
  onClick?: (isSelected: boolean, value?: string, event?: MouseEvent<HTMLDivElement>, state?: ListboxContextProps) => void | ComponentProps<'div'>['onClick'];
2187
2193
  /** Value. */
2188
- value: string;
2194
+ value?: string;
2189
2195
  }
2190
2196
  type StyledItemProps = Omit<ItemProps, 'color' | 'onClick' | 'value'> & {
2191
2197
  $isActive: ItemProps['isActive'];
package/index.js CHANGED
@@ -10756,6 +10756,7 @@ const ListboxContext = /*#__PURE__*/React__default.createContext({
10756
10756
  let ListboxActionType = /*#__PURE__*/function (ListboxActionType) {
10757
10757
  ListboxActionType["TOGGLE"] = "TOGGLE";
10758
10758
  ListboxActionType["SET"] = "SET";
10759
+ ListboxActionType["UPDATE_OPTIONS"] = "UPDATE_OPTIONS";
10759
10760
  return ListboxActionType;
10760
10761
  }({});
10761
10762
  /**
@@ -10853,7 +10854,6 @@ function useListboxItem(props) {
10853
10854
  function useMenuItem(props) {
10854
10855
  const {
10855
10856
  domElementRef,
10856
- value,
10857
10857
  id,
10858
10858
  isDisabled,
10859
10859
  onClick
@@ -10866,8 +10866,7 @@ function useMenuItem(props) {
10866
10866
  } = useFocusOnListItem({
10867
10867
  domElementRef,
10868
10868
  isDisabled: isDisabled,
10869
- id,
10870
- value
10869
+ id
10871
10870
  });
10872
10871
  const handleKeyDown = useCallback(event => {
10873
10872
  const code = event.code;
@@ -10896,7 +10895,7 @@ function useMenuItem(props) {
10896
10895
  }
10897
10896
 
10898
10897
  const _excluded$b = ["children", "className", "defaultSelected", "id", "isActive", "isDisabled", "isHovered", "isSelected", "value"],
10899
- _excluded2 = ["children", "className", "id", "isActive", "isDisabled", "isHovered", "onClick", "value"];
10898
+ _excluded2 = ["children", "className", "id", "isActive", "isDisabled", "isHovered", "onClick"];
10900
10899
  const COMPONENT_NAME$9 = 'Item';
10901
10900
  const CLASSNAME$9 = 'redsift-item';
10902
10901
  const DEFAULT_PROPS$9 = {};
@@ -10955,11 +10954,11 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10955
10954
  isActive,
10956
10955
  isDisabled: propsIsDisabled,
10957
10956
  isHovered,
10958
- onClick,
10959
- value
10957
+ onClick
10960
10958
  } = props,
10961
10959
  forwardedProps = _objectWithoutProperties(props, _excluded2);
10962
- const id = propsId !== null && propsId !== void 0 ? propsId : value;
10960
+ const [_id] = useId$1();
10961
+ const id = propsId !== null && propsId !== void 0 ? propsId : _id;
10963
10962
  const _ref = useRef();
10964
10963
  const divRef = ref !== null && ref !== void 0 ? ref : _ref;
10965
10964
  const {
@@ -10970,7 +10969,6 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10970
10969
  handleClick
10971
10970
  } = useMenuItem({
10972
10971
  domElementRef: divRef,
10973
- value,
10974
10972
  id,
10975
10973
  isDisabled: propsIsDisabled,
10976
10974
  onClick: onClick
@@ -10989,7 +10987,7 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10989
10987
  ref: divRef,
10990
10988
  onKeyDown: handleKeyDown,
10991
10989
  tabIndex: tabIndex
10992
- }), children !== null && children !== void 0 ? children : value);
10990
+ }), children);
10993
10991
  });
10994
10992
 
10995
10993
  /**
@@ -11003,6 +11001,7 @@ const Item = /*#__PURE__*/forwardRef((props, ref) => {
11003
11001
  const isListbox = focusContext.state.listRole === 'listbox';
11004
11002
  if (!focusContext.state.filter) {
11005
11003
  return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
11004
+ value: props.value,
11006
11005
  ref: ref
11007
11006
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
11008
11007
  ref: ref
@@ -11015,18 +11014,21 @@ const Item = /*#__PURE__*/forwardRef((props, ref) => {
11015
11014
  } = focusContext.state.filter;
11016
11015
  if (!filterValue) {
11017
11016
  return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
11017
+ value: props.value,
11018
11018
  ref: ref
11019
11019
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
11020
11020
  ref: ref
11021
11021
  }));
11022
11022
  } else if (caseSensitive && (type === 'startsWith' && value.startsWith(filterValue) || type === 'contains' && value.includes(filterValue) || type === 'endsWith' && value.endsWith(filterValue))) {
11023
11023
  return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
11024
+ value: props.value,
11024
11025
  ref: ref
11025
11026
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
11026
11027
  ref: ref
11027
11028
  }));
11028
11029
  } else if (!caseSensitive && (type === 'startsWith' && value.toLowerCase().startsWith(filterValue.toLowerCase()) || type === 'contains' && value.toLowerCase().includes(filterValue.toLowerCase()) || type === 'endsWith' && value.toLowerCase().endsWith(filterValue.toLowerCase()))) {
11029
11030
  return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
11031
+ value: props.value,
11030
11032
  ref: ref
11031
11033
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
11032
11034
  ref: ref
@@ -11310,6 +11312,10 @@ const ListboxReducer = (state, action) => {
11310
11312
  activedescendant: action.payload.activedescendant
11311
11313
  });
11312
11314
  }
11315
+ case ListboxActionType.UPDATE_OPTIONS:
11316
+ {
11317
+ return _objectSpread2(_objectSpread2({}, state), action.payload);
11318
+ }
11313
11319
  default:
11314
11320
  return state;
11315
11321
  }
@@ -12685,7 +12691,9 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12685
12691
  className: `${TextField.className}__label`
12686
12692
  }, /*#__PURE__*/React__default.createElement("span", null, label)) : null, /*#__PURE__*/React__default.createElement("div", {
12687
12693
  className: `${TextField.className}__input-wrapper`
12688
- }, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends$1({}, leftIcon, {
12694
+ }, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends$1({
12695
+ color: isDisabled ? 'question' : 'black'
12696
+ }, leftIcon, {
12689
12697
  "aria-hidden": "true",
12690
12698
  className: "left"
12691
12699
  })) : null, /*#__PURE__*/React__default.createElement("input", _extends$1({}, inputProps, {
@@ -12718,6 +12726,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12718
12726
  }, hasClearButton ? /*#__PURE__*/React__default.createElement(IconButton, _extends$1({
12719
12727
  "aria-label": "Clear",
12720
12728
  color: "question",
12729
+ isDisabled: isDisabled,
12721
12730
  icon: mdiClose
12722
12731
  }, hasClearButton !== true && hasClearButton, {
12723
12732
  onClick: handleClear,