x-ui-design 0.4.9 → 0.4.11

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/dist/index.esm.js CHANGED
@@ -3458,7 +3458,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
3458
3458
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3459
3459
  // @ts-expect-error
3460
3460
  const optionFilterPropValue = option[optionFilterProp];
3461
- const valueToCheck = optionFilterProp && typeof optionFilterPropValue === 'string' ? String(optionFilterPropValue) : getTextFromNode(option.children) || String(option.value);
3461
+ const valueToCheck = optionFilterProp && typeof optionFilterPropValue === 'string' ? String(optionFilterPropValue) : getTextFromNode(option.children) || String(option.label) || String(option.value);
3462
3462
  return valueToCheck.toLowerCase().includes(searchQuery.toLowerCase());
3463
3463
  });
3464
3464
  const handleTriggerClick = () => {
@@ -3513,7 +3513,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
3513
3513
  });
3514
3514
  },
3515
3515
  "data-value": props.value
3516
- }), children || props.value, menuItemSelectedIcon && hasMode && isSelected && /*#__PURE__*/React.createElement("span", {
3516
+ }), children || props.label || props.value, menuItemSelectedIcon && hasMode && isSelected && /*#__PURE__*/React.createElement("span", {
3517
3517
  className: `${prefixCls}-selected-icon`
3518
3518
  }, menuItemSelectedIcon === true ? /*#__PURE__*/React.createElement(CheckIcon, null) : menuItemSelectedIcon));
3519
3519
  });
@@ -3550,6 +3550,10 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
3550
3550
  },
3551
3551
  "data-value": searchQuery
3552
3552
  }, searchQuery), filteredOptions.length ? dataRender : !asTag ? notFoundContent || /*#__PURE__*/React.createElement(EmptyContent, null) : null));
3553
+ const selectedOption = (() => {
3554
+ const option = extractedOptions.find(e => e.value === selected || e.label === selected || e.children === selected);
3555
+ return option?.children || option?.label || option?.value || null;
3556
+ })();
3553
3557
  return /*#__PURE__*/React.createElement("div", {
3554
3558
  id: id,
3555
3559
  ref: selectRef,
@@ -3613,21 +3617,18 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
3613
3617
  contentEditable: "plaintext-only",
3614
3618
  id: `${prefixCls}-search-tag-input`,
3615
3619
  className: `${prefixCls}-tag-input`
3616
- }), !hasMode && !searchQuery.length ? selected === '' ? placeholder : extractedOptions.find(e => e.value === selected)?.children || selected : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
3620
+ }), !hasMode && !searchQuery.length ? selected === '' ? placeholder : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
3617
3621
  className: `${prefixCls}-input globalEllipsis`,
3618
3622
  style: {
3619
3623
  opacity: isOpen || selected === '' ? '0.6' : '1'
3620
3624
  }
3621
- }, selected === '' ? placeholder : extractedOptions.find(e => e.value === selected)?.children || selected) : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
3625
+ }, selected === '' ? placeholder : selectedOption) : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
3622
3626
  className: `${prefixCls}-input globalEllipsis`,
3623
3627
  onClick: () => !disabled && setIsOpen(!isOpen || open),
3624
3628
  style: {
3625
3629
  opacity: isOpen || selected === '' ? '0.6' : '1'
3626
3630
  }
3627
- }, selected === '' ? placeholder : (() => {
3628
- const option = extractedOptions.find(e => e.value === selected || e.label === selected || e.children === selected);
3629
- return option?.children || option?.value || option?.value || null;
3630
- })()) : null, isHover && !loading ? allowClear && selected ? /*#__PURE__*/React.createElement("button", {
3631
+ }, selected === '' ? placeholder : selectedOption) : null, isHover && !loading ? allowClear && selected ? /*#__PURE__*/React.createElement("button", {
3631
3632
  className: `${prefixCls}-clear-btn`,
3632
3633
  onClick: handleClear
3633
3634
  }, removeIcon || /*#__PURE__*/React.createElement(ClearIcon, null)) : /*#__PURE__*/React.createElement("span", {