@redsift/design-system 9.0.0-alpha.13 → 9.0.0-alpha.14

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
@@ -2153,7 +2153,7 @@ interface ItemProps extends Omit<ComponentProps<'div'>, 'onClick'>, ContainerPro
2153
2153
  /** Method to handle component change. */
2154
2154
  onClick?: (isSelected: boolean, value?: string, event?: MouseEvent<HTMLDivElement>, state?: ListboxContextProps) => void | ComponentProps<'div'>['onClick'];
2155
2155
  /** Value. */
2156
- value?: string;
2156
+ value: string;
2157
2157
  }
2158
2158
  type StyledItemProps = Omit<ItemProps, 'color' | 'onClick' | 'value'> & {
2159
2159
  $isActive: ItemProps['isActive'];
package/index.js CHANGED
@@ -3754,7 +3754,7 @@ SideNavigationMenuBar.displayName = COMPONENT_NAME$A;
3754
3754
 
3755
3755
  const _excluded$z = ["title", "href", "ref"],
3756
3756
  _excluded2$1 = ["title", "children", "ref"],
3757
- _excluded3$1 = ["title", "href", "ref"];
3757
+ _excluded3 = ["title", "href", "ref"];
3758
3758
  const isMenu = item => {
3759
3759
  return item.children !== undefined;
3760
3760
  };
@@ -3799,7 +3799,7 @@ const useSideNavigationMenuBar = _ref => {
3799
3799
  href,
3800
3800
  ref
3801
3801
  } = child,
3802
- rest = _objectWithoutProperties(child, _excluded3$1);
3802
+ rest = _objectWithoutProperties(child, _excluded3);
3803
3803
  return /*#__PURE__*/React__default.createElement(SideNavigationMenuItem, _extends$1({
3804
3804
  key: title,
3805
3805
  href: href,
@@ -4570,10 +4570,10 @@ const StyledCardBody = styled.div`
4570
4570
  ${baseContainer}
4571
4571
 
4572
4572
  color: var(--redsift-color-neutral-darkgrey);
4573
- font-family: var(--redsift-typography-body2-font-family);
4574
- font-size: var(--redsift-typography-body2-font-size);
4575
- font-weight: var(--redsift-typography-body2-font-weight);
4576
- line-height: var(--redsift-typography-body2-line-height);
4573
+ font-family: var(--redsift-typography-body-font-family);
4574
+ font-size: var(--redsift-typography-body-font-size);
4575
+ font-weight: var(--redsift-typography-body-font-weight);
4576
+ line-height: var(--redsift-typography-body-line-height);
4577
4577
  padding: 16px 0px;
4578
4578
  `;
4579
4579
 
@@ -10696,6 +10696,7 @@ function useListboxItem(props) {
10696
10696
  function useMenuItem(props) {
10697
10697
  const {
10698
10698
  domElementRef,
10699
+ value,
10699
10700
  id,
10700
10701
  isDisabled,
10701
10702
  onClick
@@ -10708,7 +10709,8 @@ function useMenuItem(props) {
10708
10709
  } = useFocusOnListItem({
10709
10710
  domElementRef,
10710
10711
  isDisabled: isDisabled,
10711
- id
10712
+ id,
10713
+ value
10712
10714
  });
10713
10715
  const handleKeyDown = useCallback(event => {
10714
10716
  const code = event.code;
@@ -10737,8 +10739,7 @@ function useMenuItem(props) {
10737
10739
  }
10738
10740
 
10739
10741
  const _excluded$b = ["children", "className", "defaultSelected", "id", "isActive", "isDisabled", "isHovered", "isSelected", "value"],
10740
- _excluded2 = ["children", "className", "id", "isActive", "isDisabled", "isHovered", "onClick"],
10741
- _excluded3 = ["value"];
10742
+ _excluded2 = ["children", "className", "id", "isActive", "isDisabled", "isHovered", "onClick", "value"];
10742
10743
  const COMPONENT_NAME$9 = 'Item';
10743
10744
  const CLASSNAME$9 = 'redsift-item';
10744
10745
  const DEFAULT_PROPS$9 = {};
@@ -10793,13 +10794,15 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10793
10794
  const {
10794
10795
  children,
10795
10796
  className,
10796
- id,
10797
+ id: propsId,
10797
10798
  isActive,
10798
10799
  isDisabled: propsIsDisabled,
10799
10800
  isHovered,
10800
- onClick
10801
+ onClick,
10802
+ value
10801
10803
  } = props,
10802
10804
  forwardedProps = _objectWithoutProperties(props, _excluded2);
10805
+ const id = propsId !== null && propsId !== void 0 ? propsId : value;
10803
10806
  const _ref = useRef();
10804
10807
  const divRef = ref !== null && ref !== void 0 ? ref : _ref;
10805
10808
  const {
@@ -10810,6 +10813,7 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10810
10813
  handleClick
10811
10814
  } = useMenuItem({
10812
10815
  domElementRef: divRef,
10816
+ value,
10813
10817
  id,
10814
10818
  isDisabled: propsIsDisabled,
10815
10819
  onClick: onClick
@@ -10828,7 +10832,7 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10828
10832
  ref: divRef,
10829
10833
  onKeyDown: handleKeyDown,
10830
10834
  tabIndex: tabIndex
10831
- }), children);
10835
+ }), children !== null && children !== void 0 ? children : value);
10832
10836
  });
10833
10837
 
10834
10838
  /**
@@ -10836,14 +10840,12 @@ const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
10836
10840
  */
10837
10841
  const Item = /*#__PURE__*/forwardRef((props, ref) => {
10838
10842
  const {
10839
- value
10840
- } = props,
10841
- forwardedProps = _objectWithoutProperties(props, _excluded3);
10843
+ value
10844
+ } = props;
10842
10845
  const focusContext = useContext(FocusWithinGroupContext);
10843
10846
  const isListbox = focusContext.state.listRole === 'listbox';
10844
10847
  if (!focusContext.state.filter) {
10845
- return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, forwardedProps, {
10846
- value: value,
10848
+ return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
10847
10849
  ref: ref
10848
10850
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
10849
10851
  ref: ref
@@ -10855,22 +10857,19 @@ const Item = /*#__PURE__*/forwardRef((props, ref) => {
10855
10857
  caseSensitive
10856
10858
  } = focusContext.state.filter;
10857
10859
  if (!filterValue) {
10858
- return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, forwardedProps, {
10859
- value: value,
10860
+ return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
10860
10861
  ref: ref
10861
10862
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
10862
10863
  ref: ref
10863
10864
  }));
10864
10865
  } else if (caseSensitive && (type === 'startsWith' && value.startsWith(filterValue) || type === 'contains' && value.includes(filterValue) || type === 'endsWith' && value.endsWith(filterValue))) {
10865
- return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, forwardedProps, {
10866
- value: value,
10866
+ return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
10867
10867
  ref: ref
10868
10868
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
10869
10869
  ref: ref
10870
10870
  }));
10871
10871
  } else if (!caseSensitive && (type === 'startsWith' && value.toLowerCase().startsWith(filterValue.toLowerCase()) || type === 'contains' && value.toLowerCase().includes(filterValue.toLowerCase()) || type === 'endsWith' && value.toLowerCase().endsWith(filterValue.toLowerCase()))) {
10872
- return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, forwardedProps, {
10873
- value: value,
10872
+ return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends$1({}, props, {
10874
10873
  ref: ref
10875
10874
  })) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends$1({}, props, {
10876
10875
  ref: ref
@@ -12290,11 +12289,8 @@ const StyledTextField = styled.div`
12290
12289
  max-width: calc(100% - 24px);
12291
12290
  transform: translate(${$variant === TextFieldVariant.underline ? '0px' : '14px'}, 16px) scale(1);
12292
12291
  ` : css`
12293
- font-family: var(--redsift-typography-body2-font-family);
12294
- font-size: var(--redsift-typography-body2-font-size);
12295
- font-weight: var(--redsift-typography-body2-font-weight);
12296
12292
  max-width: calc(133% - 32px);
12297
- transform: translate(${$variant === TextFieldVariant.underline ? '0px' : '14px'}, -1px) scale(0.75);
12293
+ transform: translate(${$variant === TextFieldVariant.underline ? '0px' : '14px'}, 1px) scale(0.733);
12298
12294
  `}
12299
12295
 
12300
12296
  ${$isDisabled ? css`
@@ -12353,7 +12349,7 @@ const StyledTextField = styled.div`
12353
12349
  .redsift-text-field-input-wrapper__fieldset {
12354
12350
  border-style: solid;
12355
12351
  bottom: 0;
12356
- left: 0;
12352
+ left: 1px;
12357
12353
  margin: 0;
12358
12354
  min-width: 0%;
12359
12355
  overflow: hidden;
@@ -12385,7 +12381,7 @@ const StyledTextField = styled.div`
12385
12381
  .redsift-text-field-input-wrapper-fieldset__legend {
12386
12382
  display: block;
12387
12383
  float: unset;
12388
- font-size: 0.7em;
12384
+ font-size: 11px;
12389
12385
  height: 11px;
12390
12386
  overflow: hidden;
12391
12387
  padding: 0;
@@ -12488,10 +12484,8 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12488
12484
  } = useFocusWithin({
12489
12485
  onFocusWithinChange: isFocusWithin => setFocusWithin(isFocusWithin)
12490
12486
  });
12491
- const [value, setValue] = useState(propsValue !== null && propsValue !== void 0 ? propsValue : defaultValue);
12492
- useEffect(() => {
12493
- setValue(propsValue !== null && propsValue !== void 0 ? propsValue : defaultValue);
12494
- }, [propsValue, defaultValue]);
12487
+ const [value, setValue] = useState(defaultValue);
12488
+ const isControlled = propsValue !== null && propsValue !== undefined;
12495
12489
  warnIfNoAccessibleLabelFound(props, [label]);
12496
12490
  const handleChange = useCallback(event => {
12497
12491
  if (isDisabled || isReadOnly) {
@@ -12519,12 +12513,12 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12519
12513
  setValue('');
12520
12514
  }, [onChange]);
12521
12515
  return /*#__PURE__*/React__default.createElement(StyledTextField, _extends$1({}, focusWithinProps, forwardedProps, {
12522
- $hasContent: isFocusWithin || Boolean(value) || Boolean(placeholder),
12516
+ $hasContent: isFocusWithin || Boolean(isControlled ? propsValue : value) || Boolean(placeholder),
12523
12517
  $hasLeftIcon: Boolean(leftIcon),
12524
12518
  $isColored: isColored,
12525
12519
  $isDisabled: isDisabled,
12526
12520
  $isFocusVisible: isFocusVisible,
12527
- $isInvalid: isInvalid || isRequired && !value,
12521
+ $isInvalid: isInvalid || isRequired && !(isControlled ? propsValue : value),
12528
12522
  $isRequired: isRequired,
12529
12523
  $isFocused: isFocused,
12530
12524
  $variant: variant,
@@ -12547,7 +12541,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12547
12541
  onFocusProps === null || onFocusProps === void 0 ? void 0 : onFocusProps(event);
12548
12542
  },
12549
12543
  "aria-disabled": isDisabled,
12550
- "aria-invalid": isInvalid || isRequired && !value,
12544
+ "aria-invalid": isInvalid || isRequired && !(isControlled ? propsValue : value),
12551
12545
  "aria-label": ariaLabel,
12552
12546
  "aria-labelledby": ariaLabelledby,
12553
12547
  "aria-readonly": isReadOnly,
@@ -12560,7 +12554,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12560
12554
  placeholder: placeholder,
12561
12555
  ref: inputRef,
12562
12556
  type: type,
12563
- value: value
12557
+ value: isControlled ? propsValue : value
12564
12558
  })), hasClearButton || internal || after ? /*#__PURE__*/React__default.createElement(Flexbox, {
12565
12559
  className: `${TextField.className}-input-wrapper__toolbar`,
12566
12560
  gap: "8px"
@@ -12571,11 +12565,11 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
12571
12565
  }, hasClearButton !== true && hasClearButton, {
12572
12566
  onClick: handleClear,
12573
12567
  className: "right clear"
12574
- })) : null, typeof internal === 'function' ? internal(value, isDisabled, isInvalid || isRequired && !value, isRequired) : internal, (hasClearButton || internal) && after ? /*#__PURE__*/React__default.createElement("span", {
12568
+ })) : null, typeof internal === 'function' ? internal(isControlled ? propsValue : value, isDisabled, isInvalid || isRequired && !(isControlled ? propsValue : value), isRequired) : internal, (hasClearButton || internal) && after ? /*#__PURE__*/React__default.createElement("span", {
12575
12569
  style: {
12576
12570
  borderLeft: '1px solid var(--redsift-color-neutral-midgrey)'
12577
12571
  }
12578
- }) : null, typeof after === 'function' ? after(value, isDisabled, isInvalid || isRequired && !value, isRequired) : after) : null, /*#__PURE__*/React__default.createElement("fieldset", {
12572
+ }) : null, typeof after === 'function' ? after(isControlled ? propsValue : value, isDisabled, isInvalid || isRequired && !(isControlled ? propsValue : value), isRequired) : after) : null, /*#__PURE__*/React__default.createElement("fieldset", {
12579
12573
  "aria-hidden": "true",
12580
12574
  className: `${TextField.className}-input-wrapper__fieldset`
12581
12575
  }, /*#__PURE__*/React__default.createElement("legend", {