sellmate-design-system-react 9.0.0-beta.16 → 9.0.0-beta.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/dist/index.js CHANGED
@@ -10410,6 +10410,7 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
10410
10410
  allSelectedLabel = "\uC804\uCCB4",
10411
10411
  placeholder = "\uC120\uD0DD",
10412
10412
  disabled = false,
10413
+ clearable = false,
10413
10414
  error = false,
10414
10415
  rules,
10415
10416
  labelTooltipProps,
@@ -10565,6 +10566,11 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
10565
10566
  return labelByValue.get(selected[0]) ?? selected[0];
10566
10567
  })();
10567
10568
  const isPlaceholder = selected.length === 0;
10569
+ const showClear = clearable && !effectiveDisabled && !isPlaceholder;
10570
+ const handleClear = () => {
10571
+ emit3([]);
10572
+ if (rules && rules.length > 0) setRuleError(runRules(multi ? [] : "", rules));
10573
+ };
10568
10574
  const handleSelect = (nextValue) => {
10569
10575
  if (multi) {
10570
10576
  const next = selected.includes(nextValue) ? selected.filter((v) => v !== nextValue) : [...selected, nextValue];
@@ -10707,15 +10713,53 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
10707
10713
  dangerouslySetInnerHTML: { __html: sanitizeInlineHtml(triggerText) }
10708
10714
  }
10709
10715
  ) : /* @__PURE__ */ jsx("span", { className: "truncate", children: triggerText }),
10710
- /* @__PURE__ */ jsx(
10711
- SIcon,
10712
- {
10713
- name: "chevronDown",
10714
- size: 12,
10715
- color: effectiveDisabled ? "var(--cmp-select-icon-disabled)" : "var(--cmp-select-icon-default)",
10716
- className: cn("shrink-0 transition-transform duration-200", open && "rotate-180")
10717
- }
10718
- )
10716
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-[8px]", children: [
10717
+ showClear && /* @__PURE__ */ jsxs(
10718
+ "span",
10719
+ {
10720
+ role: "button",
10721
+ tabIndex: 0,
10722
+ "aria-label": "\uC120\uD0DD \uC9C0\uC6B0\uAE30",
10723
+ className: "group/select-clear relative inline-flex shrink-0 cursor-pointer items-center justify-center",
10724
+ style: {
10725
+ width: "var(--cmp-ghostButton-xxs-size)",
10726
+ height: "var(--cmp-ghostButton-xxs-size)",
10727
+ borderRadius: "var(--cmp-ghostButton-radius-sm)"
10728
+ },
10729
+ onClick: (event) => {
10730
+ event.preventDefault();
10731
+ event.stopPropagation();
10732
+ handleClear();
10733
+ },
10734
+ onKeyDown: (event) => {
10735
+ if (event.key !== "Enter" && event.key !== " ") return;
10736
+ event.preventDefault();
10737
+ event.stopPropagation();
10738
+ handleClear();
10739
+ },
10740
+ children: [
10741
+ /* @__PURE__ */ jsx(
10742
+ "span",
10743
+ {
10744
+ "aria-hidden": true,
10745
+ className: "pointer-events-none absolute inset-0 rounded-[inherit] opacity-0 transition-opacity duration-200 group-hover/select-clear:opacity-5",
10746
+ style: { background: "var(--cmp-ghostButton-default-hover-bg)" }
10747
+ }
10748
+ ),
10749
+ /* @__PURE__ */ jsx(SIcon, { name: "close", size: 12, color: "var(--cmp-ghostButton-default-content)" })
10750
+ ]
10751
+ }
10752
+ ),
10753
+ /* @__PURE__ */ jsx(
10754
+ SIcon,
10755
+ {
10756
+ name: "chevronDown",
10757
+ size: 12,
10758
+ color: effectiveDisabled ? "var(--cmp-select-icon-disabled)" : "var(--cmp-select-icon-default)",
10759
+ className: cn("shrink-0 transition-transform duration-200", open && "rotate-180")
10760
+ }
10761
+ )
10762
+ ] })
10719
10763
  ]
10720
10764
  }
10721
10765
  ),