sellmate-design-system-react 0.1.10 → 0.2.0

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.
Files changed (163) hide show
  1. package/dist/components/SActionModal/SActionModal.cjs +10 -4
  2. package/dist/components/SActionModal/SActionModal.cjs.map +1 -1
  3. package/dist/components/SActionModal/SActionModal.js +10 -4
  4. package/dist/components/SActionModal/SActionModal.js.map +1 -1
  5. package/dist/components/SBarcodeInput/SBarcodeInput.cjs +22 -5
  6. package/dist/components/SBarcodeInput/SBarcodeInput.cjs.map +1 -1
  7. package/dist/components/SBarcodeInput/SBarcodeInput.d.ts +3 -1
  8. package/dist/components/SBarcodeInput/SBarcodeInput.js +22 -5
  9. package/dist/components/SBarcodeInput/SBarcodeInput.js.map +1 -1
  10. package/dist/components/SCalendar/SCalendar.cjs +9 -3
  11. package/dist/components/SCalendar/SCalendar.cjs.map +1 -1
  12. package/dist/components/SCalendar/SCalendar.js +9 -3
  13. package/dist/components/SCalendar/SCalendar.js.map +1 -1
  14. package/dist/components/SChip/SChip.cjs +9 -3
  15. package/dist/components/SChip/SChip.cjs.map +1 -1
  16. package/dist/components/SChip/SChip.js +9 -3
  17. package/dist/components/SChip/SChip.js.map +1 -1
  18. package/dist/components/SChipInput/SChipInput.cjs +44 -13
  19. package/dist/components/SChipInput/SChipInput.cjs.map +1 -1
  20. package/dist/components/SChipInput/SChipInput.d.ts +5 -0
  21. package/dist/components/SChipInput/SChipInput.js +44 -13
  22. package/dist/components/SChipInput/SChipInput.js.map +1 -1
  23. package/dist/components/SChipInput/index.d.ts +1 -1
  24. package/dist/components/SCircleProgress/SCircleProgress.cjs +6 -2
  25. package/dist/components/SCircleProgress/SCircleProgress.cjs.map +1 -1
  26. package/dist/components/SCircleProgress/SCircleProgress.js +6 -2
  27. package/dist/components/SCircleProgress/SCircleProgress.js.map +1 -1
  28. package/dist/components/SConfirmModal/SConfirmModal.cjs +20 -13
  29. package/dist/components/SConfirmModal/SConfirmModal.cjs.map +1 -1
  30. package/dist/components/SConfirmModal/SConfirmModal.d.ts +7 -4
  31. package/dist/components/SConfirmModal/SConfirmModal.js +20 -13
  32. package/dist/components/SConfirmModal/SConfirmModal.js.map +1 -1
  33. package/dist/components/SDatePicker/SDatePicker.cjs +22 -5
  34. package/dist/components/SDatePicker/SDatePicker.cjs.map +1 -1
  35. package/dist/components/SDatePicker/SDatePicker.d.ts +3 -1
  36. package/dist/components/SDatePicker/SDatePicker.js +22 -5
  37. package/dist/components/SDatePicker/SDatePicker.js.map +1 -1
  38. package/dist/components/SDateRangePicker/SDateRangePicker.cjs +22 -5
  39. package/dist/components/SDateRangePicker/SDateRangePicker.cjs.map +1 -1
  40. package/dist/components/SDateRangePicker/SDateRangePicker.d.ts +3 -1
  41. package/dist/components/SDateRangePicker/SDateRangePicker.js +22 -5
  42. package/dist/components/SDateRangePicker/SDateRangePicker.js.map +1 -1
  43. package/dist/components/SDropdownButton/SDropdownButton.cjs +3 -1
  44. package/dist/components/SDropdownButton/SDropdownButton.cjs.map +1 -1
  45. package/dist/components/SDropdownButton/SDropdownButton.js +3 -1
  46. package/dist/components/SDropdownButton/SDropdownButton.js.map +1 -1
  47. package/dist/components/SField/SField.cjs +20 -5
  48. package/dist/components/SField/SField.cjs.map +1 -1
  49. package/dist/components/SField/SField.d.ts +4 -1
  50. package/dist/components/SField/SField.js +20 -5
  51. package/dist/components/SField/SField.js.map +1 -1
  52. package/dist/components/SFilePicker/SFilePicker.cjs +23 -6
  53. package/dist/components/SFilePicker/SFilePicker.cjs.map +1 -1
  54. package/dist/components/SFilePicker/SFilePicker.d.ts +3 -1
  55. package/dist/components/SFilePicker/SFilePicker.js +23 -6
  56. package/dist/components/SFilePicker/SFilePicker.js.map +1 -1
  57. package/dist/components/SGhostButton/SGhostButton.cjs +9 -3
  58. package/dist/components/SGhostButton/SGhostButton.cjs.map +1 -1
  59. package/dist/components/SGhostButton/SGhostButton.d.ts +5 -1
  60. package/dist/components/SGhostButton/SGhostButton.js +9 -3
  61. package/dist/components/SGhostButton/SGhostButton.js.map +1 -1
  62. package/dist/components/SGnb/SGnb.cjs +3297 -0
  63. package/dist/components/SGnb/SGnb.cjs.map +1 -0
  64. package/dist/components/SGnb/SGnb.d.ts +35 -0
  65. package/dist/components/SGnb/SGnb.js +3295 -0
  66. package/dist/components/SGnb/SGnb.js.map +1 -0
  67. package/dist/components/SGnb/gnb.config.d.ts +63 -0
  68. package/dist/components/SGnb/index.d.ts +2 -0
  69. package/dist/components/SGuide/SGuide.cjs +9 -3
  70. package/dist/components/SGuide/SGuide.cjs.map +1 -1
  71. package/dist/components/SGuide/SGuide.js +9 -3
  72. package/dist/components/SGuide/SGuide.js.map +1 -1
  73. package/dist/components/SInput/SInput.cjs +22 -5
  74. package/dist/components/SInput/SInput.cjs.map +1 -1
  75. package/dist/components/SInput/SInput.d.ts +4 -1
  76. package/dist/components/SInput/SInput.js +22 -5
  77. package/dist/components/SInput/SInput.js.map +1 -1
  78. package/dist/components/SKeyValueTable/SKeyValueTable.cjs +511 -209
  79. package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
  80. package/dist/components/SKeyValueTable/SKeyValueTable.d.ts +27 -6
  81. package/dist/components/SKeyValueTable/SKeyValueTable.js +510 -208
  82. package/dist/components/SKeyValueTable/SKeyValueTable.js.map +1 -1
  83. package/dist/components/SLayout/SLayout.cjs +79 -0
  84. package/dist/components/SLayout/SLayout.cjs.map +1 -0
  85. package/dist/components/SLayout/SLayout.d.ts +41 -0
  86. package/dist/components/SLayout/SLayout.js +75 -0
  87. package/dist/components/SLayout/SLayout.js.map +1 -0
  88. package/dist/components/SLayout/index.d.ts +1 -0
  89. package/dist/components/SLoadingContainer/SLoadingContainer.cjs +6 -2
  90. package/dist/components/SLoadingContainer/SLoadingContainer.cjs.map +1 -1
  91. package/dist/components/SLoadingContainer/SLoadingContainer.js +6 -2
  92. package/dist/components/SLoadingContainer/SLoadingContainer.js.map +1 -1
  93. package/dist/components/SLoadingContainer/loading.cjs +6 -2
  94. package/dist/components/SLoadingContainer/loading.cjs.map +1 -1
  95. package/dist/components/SLoadingContainer/loading.js +6 -2
  96. package/dist/components/SLoadingContainer/loading.js.map +1 -1
  97. package/dist/components/SLoadingModal/SLoadingModal.cjs +16 -6
  98. package/dist/components/SLoadingModal/SLoadingModal.cjs.map +1 -1
  99. package/dist/components/SLoadingModal/SLoadingModal.js +16 -6
  100. package/dist/components/SLoadingModal/SLoadingModal.js.map +1 -1
  101. package/dist/components/SModalContainer/SModalContainer.cjs +10 -4
  102. package/dist/components/SModalContainer/SModalContainer.cjs.map +1 -1
  103. package/dist/components/SModalContainer/SModalContainer.d.ts +10 -0
  104. package/dist/components/SModalContainer/SModalContainer.js +10 -4
  105. package/dist/components/SModalContainer/SModalContainer.js.map +1 -1
  106. package/dist/components/SNumberInput/SNumberInput.cjs +22 -5
  107. package/dist/components/SNumberInput/SNumberInput.cjs.map +1 -1
  108. package/dist/components/SNumberInput/SNumberInput.d.ts +2 -0
  109. package/dist/components/SNumberInput/SNumberInput.js +22 -5
  110. package/dist/components/SNumberInput/SNumberInput.js.map +1 -1
  111. package/dist/components/SPage/SPage.cjs +86 -0
  112. package/dist/components/SPage/SPage.cjs.map +1 -0
  113. package/dist/components/SPage/SPage.d.ts +13 -0
  114. package/dist/components/SPage/SPage.js +84 -0
  115. package/dist/components/SPage/SPage.js.map +1 -0
  116. package/dist/components/SPage/index.d.ts +1 -0
  117. package/dist/components/SPopover/SPopover.cjs +9 -3
  118. package/dist/components/SPopover/SPopover.cjs.map +1 -1
  119. package/dist/components/SPopover/SPopover.js +9 -3
  120. package/dist/components/SPopover/SPopover.js.map +1 -1
  121. package/dist/components/SPortal/SPortal.cjs +3 -1
  122. package/dist/components/SPortal/SPortal.cjs.map +1 -1
  123. package/dist/components/SPortal/SPortal.js +3 -1
  124. package/dist/components/SPortal/SPortal.js.map +1 -1
  125. package/dist/components/SSelect/SSelect.cjs +545 -265
  126. package/dist/components/SSelect/SSelect.cjs.map +1 -1
  127. package/dist/components/SSelect/SSelect.d.ts +4 -2
  128. package/dist/components/SSelect/SSelect.js +546 -265
  129. package/dist/components/SSelect/SSelect.js.map +1 -1
  130. package/dist/components/STable/STable.cjs +552 -268
  131. package/dist/components/STable/STable.cjs.map +1 -1
  132. package/dist/components/STable/STable.js +553 -268
  133. package/dist/components/STable/STable.js.map +1 -1
  134. package/dist/components/STextLink/STextLink.cjs +2 -0
  135. package/dist/components/STextLink/STextLink.cjs.map +1 -1
  136. package/dist/components/STextLink/STextLink.js +2 -0
  137. package/dist/components/STextLink/STextLink.js.map +1 -1
  138. package/dist/components/STextarea/STextarea.cjs +22 -5
  139. package/dist/components/STextarea/STextarea.cjs.map +1 -1
  140. package/dist/components/STextarea/STextarea.d.ts +2 -0
  141. package/dist/components/STextarea/STextarea.js +22 -5
  142. package/dist/components/STextarea/STextarea.js.map +1 -1
  143. package/dist/components/SToast/SToast.cjs +9 -3
  144. package/dist/components/SToast/SToast.cjs.map +1 -1
  145. package/dist/components/SToast/SToast.js +9 -3
  146. package/dist/components/SToast/SToast.js.map +1 -1
  147. package/dist/components/SToast/SToastContainer.cjs +9 -3
  148. package/dist/components/SToast/SToastContainer.cjs.map +1 -1
  149. package/dist/components/SToast/SToastContainer.js +9 -3
  150. package/dist/components/SToast/SToastContainer.js.map +1 -1
  151. package/dist/components/STooltip/STooltip.cjs +9 -3
  152. package/dist/components/STooltip/STooltip.cjs.map +1 -1
  153. package/dist/components/STooltip/STooltip.js +9 -3
  154. package/dist/components/STooltip/STooltip.js.map +1 -1
  155. package/dist/index.cjs +840 -199
  156. package/dist/index.cjs.map +1 -1
  157. package/dist/index.d.ts +3 -1
  158. package/dist/index.js +832 -200
  159. package/dist/index.js.map +1 -1
  160. package/dist/lib/portal-container.d.ts +7 -0
  161. package/dist/styles.css +253 -63
  162. package/dist/theme.css +66 -13
  163. package/package.json +1 -1
@@ -1,10 +1,9 @@
1
1
  "use client";
2
- import { forwardRef, createContext, useState, useRef, useImperativeHandle, useMemo, useId, useEffect, useCallback, useContext } from 'react';
2
+ import { forwardRef, createContext, useState, useRef, useImperativeHandle, useMemo, useEffect, useId, useCallback, useContext } from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import { extendTailwindMerge } from 'tailwind-merge';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import * as RCheckbox from '@radix-ui/react-checkbox';
7
- import * as Ariakit from '@ariakit/react';
8
7
  import * as RPopover2 from '@radix-ui/react-popover';
9
8
 
10
9
  var twMerge = extendTailwindMerge({
@@ -2954,8 +2953,12 @@ var SCircleProgress = forwardRef(
2954
2953
  "span",
2955
2954
  {
2956
2955
  className: cn(
2957
- "text-center text-[16px] font-bold leading-[26px]",
2958
- innerValue && "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"
2956
+ "text-center text-[16px] font-bold",
2957
+ innerValue ? (
2958
+ // leading-[normal]: 26px leading 은 폰트 content(19px) 위아래로 홀수(7px)만큼 남아
2959
+ // 3px/4px 로 쪼개지고 글자가 링 중심보다 위로 뜬다. (leading-normal 은 1.5 라 동일 문제)
2960
+ "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 leading-[normal]"
2961
+ ) : "leading-[26px]"
2959
2962
  ),
2960
2963
  style: { color: percentColor },
2961
2964
  children: [
@@ -3111,10 +3114,110 @@ function SPagination({
3111
3114
  );
3112
3115
  }
3113
3116
  var PortalContainerContext = createContext(null);
3117
+ var InsideModalContext = createContext(false);
3114
3118
  PortalContainerContext.Provider;
3119
+ InsideModalContext.Provider;
3115
3120
  function usePortalContainer() {
3116
3121
  return useContext(PortalContainerContext) ?? void 0;
3117
3122
  }
3123
+ function useInsideModal() {
3124
+ return useContext(InsideModalContext);
3125
+ }
3126
+ function runRules(value, rules) {
3127
+ if (!rules || rules.length === 0) return "";
3128
+ for (const rule of rules) {
3129
+ const result = rule(value ?? "");
3130
+ if (result !== true) return typeof result === "string" ? result : "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4.";
3131
+ }
3132
+ return "";
3133
+ }
3134
+ var FormContext = createContext(null);
3135
+ function useFormContext() {
3136
+ return useContext(FormContext);
3137
+ }
3138
+ function useFormField(field) {
3139
+ const ctx = useFormContext();
3140
+ const cbRef = useRef(field);
3141
+ cbRef.current = field;
3142
+ const name = field.name ?? "";
3143
+ useEffect(() => {
3144
+ if (!ctx) return;
3145
+ return ctx.register({
3146
+ name,
3147
+ validate: () => cbRef.current.validate(),
3148
+ resetValidation: () => cbRef.current.resetValidation()
3149
+ });
3150
+ }, [ctx, name]);
3151
+ }
3152
+
3153
+ // src/lib/sanitize-inline-html.ts
3154
+ var ALLOWED_INLINE_TAGS = /* @__PURE__ */ new Set(["A", "B", "STRONG", "I", "EM", "BR", "SPAN"]);
3155
+ var ALLOWED_ATTRS_BY_TAG = {
3156
+ A: /* @__PURE__ */ new Set(["href", "target", "rel", "class"])
3157
+ };
3158
+ var COMMON_ALLOWED_ATTRS = /* @__PURE__ */ new Set(["class"]);
3159
+ var SAFE_HREF_RE = /^(https?:|mailto:|tel:|\/|#|\.)/i;
3160
+ var DROP_CONTENT_TAGS = /* @__PURE__ */ new Set([
3161
+ "SCRIPT",
3162
+ "STYLE",
3163
+ "IFRAME",
3164
+ "OBJECT",
3165
+ "EMBED",
3166
+ "META",
3167
+ "LINK",
3168
+ "BASE",
3169
+ "NOSCRIPT",
3170
+ // SVG/MATH 는 foreign-content 파싱 모드로 전환되어 재직렬화 시 다른 트리로
3171
+ // 재파싱될 수 있다(mXSS 벡터). 인라인 라벨에 필요 없으므로 통째로 제거한다.
3172
+ "SVG",
3173
+ "MATH",
3174
+ "TEMPLATE"
3175
+ ]);
3176
+ var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3177
+ var sanitizeNode = (node) => {
3178
+ if (node.nodeType === Node.COMMENT_NODE) {
3179
+ node.remove();
3180
+ return;
3181
+ }
3182
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
3183
+ const element = node;
3184
+ const tagName = element.tagName;
3185
+ if (DROP_CONTENT_TAGS.has(tagName)) {
3186
+ element.remove();
3187
+ return;
3188
+ }
3189
+ Array.from(element.childNodes).forEach((child) => sanitizeNode(child));
3190
+ if (ALLOWED_INLINE_TAGS.has(tagName)) {
3191
+ if (element.hasAttribute("className")) {
3192
+ const val = element.getAttribute("className");
3193
+ element.removeAttribute("className");
3194
+ if (!element.hasAttribute("class")) element.setAttribute("class", val);
3195
+ }
3196
+ const allowedAttrs = ALLOWED_ATTRS_BY_TAG[tagName] ?? COMMON_ALLOWED_ATTRS;
3197
+ Array.from(element.attributes).forEach((attr) => {
3198
+ if (!allowedAttrs.has(attr.name)) element.removeAttribute(attr.name);
3199
+ });
3200
+ if (tagName === "A") {
3201
+ const href = element.getAttribute("href");
3202
+ if (href !== null && href !== "" && !SAFE_HREF_RE.test(href)) element.removeAttribute("href");
3203
+ if (element.hasAttribute("target")) {
3204
+ element.setAttribute("rel", "noopener noreferrer");
3205
+ }
3206
+ }
3207
+ return;
3208
+ }
3209
+ const parent = element.parentNode;
3210
+ if (parent == null) return;
3211
+ while (element.firstChild) parent.insertBefore(element.firstChild, element);
3212
+ parent.removeChild(element);
3213
+ };
3214
+ var sanitizeInlineHtml = (value) => {
3215
+ if (typeof document === "undefined") return escapeHtml(value);
3216
+ const template = document.createElement("template");
3217
+ template.innerHTML = value;
3218
+ Array.from(template.content.childNodes).forEach((child) => sanitizeNode(child));
3219
+ return template.innerHTML;
3220
+ };
3118
3221
 
3119
3222
  // src/lib/floating-anim.ts
3120
3223
  var FLOATING_SLIDE_ANIM = [
@@ -3232,6 +3335,8 @@ function SGhostButton({
3232
3335
  tooltipText,
3233
3336
  disabled = false,
3234
3337
  onClick,
3338
+ anchorClassName,
3339
+ anchorStyle,
3235
3340
  className,
3236
3341
  style
3237
3342
  }) {
@@ -3254,6 +3359,8 @@ function SGhostButton({
3254
3359
  };
3255
3360
  const s = SIZE[size];
3256
3361
  const contentColor = disabled ? intent === "inverse" ? "var(--cmp-ghostButton-inverse-disabled)" : "var(--cmp-ghostButton-icon-disabled)" : `var(--cmp-ghostButton-${intent}-content)`;
3362
+ const text = (tooltipText ?? "").trim();
3363
+ const hasTooltip = text !== "";
3257
3364
  const btn = /* @__PURE__ */ jsxs(
3258
3365
  "button",
3259
3366
  {
@@ -3294,13 +3401,13 @@ function SGhostButton({
3294
3401
  ]
3295
3402
  }
3296
3403
  );
3297
- const text = (tooltipText ?? "").trim();
3298
- if (text === "") return btn;
3404
+ if (!hasTooltip) return btn;
3299
3405
  return /* @__PURE__ */ jsxs(RPopover2.Root, { open, onOpenChange: setOpen, children: [
3300
3406
  /* @__PURE__ */ jsx(RPopover2.Anchor, { asChild: true, children: /* @__PURE__ */ jsx(
3301
3407
  "span",
3302
3408
  {
3303
- className: "inline-flex",
3409
+ className: cn("inline-flex", anchorClassName),
3410
+ style: anchorStyle,
3304
3411
  onMouseEnter: openNow,
3305
3412
  onMouseLeave: startHide,
3306
3413
  onFocus: openNow,
@@ -3452,32 +3559,6 @@ var STooltip = forwardRef(function STooltip2({
3452
3559
  ] });
3453
3560
  });
3454
3561
  STooltip.displayName = "STooltip";
3455
- function runRules(value, rules) {
3456
- if (!rules || rules.length === 0) return "";
3457
- for (const rule of rules) {
3458
- const result = rule(value ?? "");
3459
- if (result !== true) return typeof result === "string" ? result : "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4.";
3460
- }
3461
- return "";
3462
- }
3463
- var FormContext = createContext(null);
3464
- function useFormContext() {
3465
- return useContext(FormContext);
3466
- }
3467
- function useFormField(field) {
3468
- const ctx = useFormContext();
3469
- const cbRef = useRef(field);
3470
- cbRef.current = field;
3471
- const name = field.name ?? "";
3472
- useEffect(() => {
3473
- if (!ctx) return;
3474
- return ctx.register({
3475
- name,
3476
- validate: () => cbRef.current.validate(),
3477
- resetValidation: () => cbRef.current.resetValidation()
3478
- });
3479
- }, [ctx, name]);
3480
- }
3481
3562
  var FIELD_SIZE = {
3482
3563
  sm: { height: 28, radius: 4, fieldGap: 12, labelGap: 6, fontSize: 12, lineHeight: 20, icon: 16 },
3483
3564
  md: { height: 36, radius: 6, fieldGap: 16, labelGap: 8, fontSize: 14, lineHeight: 24, icon: 16 }
@@ -3492,6 +3573,7 @@ var SField = forwardRef(function SField2({
3492
3573
  name,
3493
3574
  label = "",
3494
3575
  icon,
3576
+ iconColor,
3495
3577
  labelTooltip = "",
3496
3578
  labelTooltipProps,
3497
3579
  labelWidth,
@@ -3569,7 +3651,15 @@ var SField = forwardRef(function SField2({
3569
3651
  lineHeight: `${s.lineHeight}px`
3570
3652
  },
3571
3653
  children: [
3572
- icon && /* @__PURE__ */ jsx(SIcon, { name: icon, size: s.icon, style: { marginRight: s.labelGap } }),
3654
+ icon && /* @__PURE__ */ jsx(
3655
+ SIcon,
3656
+ {
3657
+ name: icon,
3658
+ size: s.icon,
3659
+ color: iconColor,
3660
+ style: { marginRight: s.labelGap }
3661
+ }
3662
+ ),
3573
3663
  /* @__PURE__ */ jsx("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap", children: label }),
3574
3664
  (labelTooltip !== "" || labelTooltipProps) && /* @__PURE__ */ jsx("span", { className: "shrink-0", style: { marginLeft: s.labelGap }, children: /* @__PURE__ */ jsx(
3575
3665
  STooltip,
@@ -3619,7 +3709,7 @@ var SField = forwardRef(function SField2({
3619
3709
  borderBottomLeftRadius: s.radius - 1
3620
3710
  },
3621
3711
  children: [
3622
- icon && !label && /* @__PURE__ */ jsx(SIcon, { name: icon, size: s.icon }),
3712
+ icon && !label && /* @__PURE__ */ jsx(SIcon, { name: icon, size: s.icon, color: iconColor }),
3623
3713
  effectiveAddonLabel
3624
3714
  ]
3625
3715
  }
@@ -3634,6 +3724,77 @@ var SField = forwardRef(function SField2({
3634
3724
  }
3635
3725
  );
3636
3726
  });
3727
+ function SPortal({
3728
+ open,
3729
+ onClose,
3730
+ onOpenChange,
3731
+ anchorRef,
3732
+ placement = "bottom",
3733
+ align = "start",
3734
+ offset = 4,
3735
+ alignOffset = 0,
3736
+ fit = false,
3737
+ maxHeight,
3738
+ autoClose = false,
3739
+ persistent = false,
3740
+ viewportPadding = 0,
3741
+ onOpenAutoFocus,
3742
+ onCloseAutoFocus,
3743
+ children,
3744
+ className,
3745
+ style,
3746
+ ariaLabel
3747
+ }) {
3748
+ const portalContainer = usePortalContainer();
3749
+ return /* @__PURE__ */ jsxs(
3750
+ RPopover2.Root,
3751
+ {
3752
+ open,
3753
+ onOpenChange: (next) => {
3754
+ onOpenChange?.(next);
3755
+ if (!next) onClose?.();
3756
+ },
3757
+ children: [
3758
+ /* @__PURE__ */ jsx(RPopover2.Anchor, { virtualRef: anchorRef }),
3759
+ /* @__PURE__ */ jsx(RPopover2.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
3760
+ RPopover2.Content,
3761
+ {
3762
+ side: placement,
3763
+ align,
3764
+ sideOffset: offset,
3765
+ alignOffset,
3766
+ collisionPadding: viewportPadding,
3767
+ "aria-label": ariaLabel,
3768
+ onPointerDownOutside: (e) => {
3769
+ if (persistent || anchorRef.current?.contains(e.target)) {
3770
+ e.preventDefault();
3771
+ }
3772
+ },
3773
+ onFocusOutside: (e) => {
3774
+ if (persistent || anchorRef.current?.contains(e.target)) {
3775
+ e.preventDefault();
3776
+ }
3777
+ },
3778
+ onEscapeKeyDown: persistent ? (e) => e.preventDefault() : void 0,
3779
+ onOpenAutoFocus,
3780
+ onCloseAutoFocus,
3781
+ onClick: autoClose ? () => onClose?.() : void 0,
3782
+ className: cn(
3783
+ "z-50 overflow-hidden rounded-(--cmp-listBox-radius) bg-(--cmp-listBox-bg) shadow-normal-sm",
3784
+ maxHeight != null && "overflow-y-auto",
3785
+ fit && "min-w-(--radix-popover-trigger-width)",
3786
+ FLOATING_SLIDE_ANIM,
3787
+ className
3788
+ ),
3789
+ style: { maxHeight, ...style },
3790
+ children
3791
+ }
3792
+ ) })
3793
+ ]
3794
+ }
3795
+ );
3796
+ }
3797
+ SPortal.displayName = "SPortal";
3637
3798
 
3638
3799
  // src/components/SSelect/select.config.ts
3639
3800
  function flattenOptions(options, depth = 1) {
@@ -3668,75 +3829,6 @@ function flattenOptions(options, depth = 1) {
3668
3829
  var selectableOptions = (flat) => flat.filter((o) => !o.isGroup && !o.disabled);
3669
3830
  var isHtmlLabel = (label) => /<[a-z][\s\S]*>/i.test(label);
3670
3831
  var extractText = (html) => html.replace(/<[^>]*>/g, "");
3671
-
3672
- // src/lib/sanitize-inline-html.ts
3673
- var ALLOWED_INLINE_TAGS = /* @__PURE__ */ new Set(["A", "B", "STRONG", "I", "EM", "BR", "SPAN"]);
3674
- var ALLOWED_ATTRS_BY_TAG = {
3675
- A: /* @__PURE__ */ new Set(["href", "target", "rel", "class"])
3676
- };
3677
- var COMMON_ALLOWED_ATTRS = /* @__PURE__ */ new Set(["class"]);
3678
- var SAFE_HREF_RE = /^(https?:|mailto:|tel:|\/|#|\.)/i;
3679
- var DROP_CONTENT_TAGS = /* @__PURE__ */ new Set([
3680
- "SCRIPT",
3681
- "STYLE",
3682
- "IFRAME",
3683
- "OBJECT",
3684
- "EMBED",
3685
- "META",
3686
- "LINK",
3687
- "BASE",
3688
- "NOSCRIPT",
3689
- // SVG/MATH 는 foreign-content 파싱 모드로 전환되어 재직렬화 시 다른 트리로
3690
- // 재파싱될 수 있다(mXSS 벡터). 인라인 라벨에 필요 없으므로 통째로 제거한다.
3691
- "SVG",
3692
- "MATH",
3693
- "TEMPLATE"
3694
- ]);
3695
- var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3696
- var sanitizeNode = (node) => {
3697
- if (node.nodeType === Node.COMMENT_NODE) {
3698
- node.remove();
3699
- return;
3700
- }
3701
- if (node.nodeType !== Node.ELEMENT_NODE) return;
3702
- const element = node;
3703
- const tagName = element.tagName;
3704
- if (DROP_CONTENT_TAGS.has(tagName)) {
3705
- element.remove();
3706
- return;
3707
- }
3708
- Array.from(element.childNodes).forEach((child) => sanitizeNode(child));
3709
- if (ALLOWED_INLINE_TAGS.has(tagName)) {
3710
- if (element.hasAttribute("className")) {
3711
- const val = element.getAttribute("className");
3712
- element.removeAttribute("className");
3713
- if (!element.hasAttribute("class")) element.setAttribute("class", val);
3714
- }
3715
- const allowedAttrs = ALLOWED_ATTRS_BY_TAG[tagName] ?? COMMON_ALLOWED_ATTRS;
3716
- Array.from(element.attributes).forEach((attr) => {
3717
- if (!allowedAttrs.has(attr.name)) element.removeAttribute(attr.name);
3718
- });
3719
- if (tagName === "A") {
3720
- const href = element.getAttribute("href");
3721
- if (href !== null && href !== "" && !SAFE_HREF_RE.test(href)) element.removeAttribute("href");
3722
- if (element.hasAttribute("target")) {
3723
- element.setAttribute("rel", "noopener noreferrer");
3724
- }
3725
- }
3726
- return;
3727
- }
3728
- const parent = element.parentNode;
3729
- if (parent == null) return;
3730
- while (element.firstChild) parent.insertBefore(element.firstChild, element);
3731
- parent.removeChild(element);
3732
- };
3733
- var sanitizeInlineHtml = (value) => {
3734
- if (typeof document === "undefined") return escapeHtml(value);
3735
- const template = document.createElement("template");
3736
- template.innerHTML = value;
3737
- Array.from(template.content.childNodes).forEach((child) => sanitizeNode(child));
3738
- return template.innerHTML;
3739
- };
3740
3832
  var SEARCH_THRESHOLD = 11;
3741
3833
  var SSelect = forwardRef(function SSelect2({
3742
3834
  value,
@@ -3760,6 +3852,7 @@ var SSelect = forwardRef(function SSelect2({
3760
3852
  label,
3761
3853
  labelWidth,
3762
3854
  icon,
3855
+ iconColor,
3763
3856
  labelTooltip,
3764
3857
  addonLabel,
3765
3858
  addonAlign,
@@ -3771,18 +3864,15 @@ var SSelect = forwardRef(function SSelect2({
3771
3864
  }, ref) {
3772
3865
  const multi = type === "multi" || type === "multi_depth";
3773
3866
  const portalContainer = usePortalContainer();
3867
+ const insideModal = useInsideModal();
3774
3868
  const [search, setSearch] = useState("");
3775
3869
  const [ruleError, setRuleError] = useState("");
3776
3870
  const [open, setOpen] = useState(false);
3871
+ const [pendingOpen, setPendingOpen] = useState(false);
3872
+ const [focusedIndex, setFocusedIndex] = useState(-1);
3777
3873
  const triggerRef = useRef(null);
3778
- useImperativeHandle(
3779
- ref,
3780
- () => ({
3781
- focus: () => triggerRef.current?.focus(),
3782
- open: () => setOpen(true)
3783
- }),
3784
- []
3785
- );
3874
+ const searchInputRef = useRef(null);
3875
+ const listRef = useRef(null);
3786
3876
  const flat = useMemo(() => flattenOptions(options), [options]);
3787
3877
  const selectable = useMemo(() => selectableOptions(flat), [flat]);
3788
3878
  const hasLeaf = useMemo(() => flat.some((o) => !o.isGroup), [flat]);
@@ -3800,6 +3890,46 @@ var SSelect = forwardRef(function SSelect2({
3800
3890
  const arr = Array.isArray(value) ? value : [value];
3801
3891
  return arr.map((v) => v != null && typeof v === "object" ? v.value : v).filter((v) => v != null && v !== "").map(String);
3802
3892
  }, [value]);
3893
+ const selectedRef = useRef(selected);
3894
+ selectedRef.current = selected;
3895
+ const emit = (next) => {
3896
+ if (!onValueChange) return;
3897
+ const mapped = next.map(
3898
+ (v) => emitValue ? rawByValue.get(v) ?? v : optionByValue.get(v) ?? { value: v, label: v }
3899
+ );
3900
+ onValueChange(multi ? mapped : mapped[0] ?? (emitValue ? "" : null));
3901
+ };
3902
+ const commitOpen = (next) => {
3903
+ setOpen(next);
3904
+ onOpenChange?.(next);
3905
+ if (!next) {
3906
+ setPendingOpen(false);
3907
+ setSearch("");
3908
+ if (rules && rules.length > 0) {
3909
+ setRuleError(runRules(multi ? selectedRef.current : selectedRef.current[0] ?? "", rules));
3910
+ }
3911
+ }
3912
+ };
3913
+ const requestOpen = (next) => {
3914
+ if (next && insideModal && portalContainer == null) {
3915
+ setPendingOpen(true);
3916
+ return;
3917
+ }
3918
+ commitOpen(next);
3919
+ };
3920
+ useEffect(() => {
3921
+ if (!insideModal || portalContainer == null || !pendingOpen) return;
3922
+ setPendingOpen(false);
3923
+ commitOpen(true);
3924
+ }, [insideModal, pendingOpen, portalContainer]);
3925
+ useImperativeHandle(
3926
+ ref,
3927
+ () => ({
3928
+ focus: () => triggerRef.current?.focus(),
3929
+ open: () => requestOpen(true)
3930
+ }),
3931
+ [insideModal, portalContainer]
3932
+ );
3803
3933
  useFormField({
3804
3934
  name,
3805
3935
  validate: () => {
@@ -3809,13 +3939,6 @@ var SSelect = forwardRef(function SSelect2({
3809
3939
  },
3810
3940
  resetValidation: () => setRuleError("")
3811
3941
  });
3812
- const emit = (next) => {
3813
- if (!onValueChange) return;
3814
- const mapped = next.map(
3815
- (v) => emitValue ? rawByValue.get(v) ?? v : optionByValue.get(v) ?? { value: v, label: v }
3816
- );
3817
- onValueChange(multi ? mapped : mapped[0] ?? (emitValue ? "" : null));
3818
- };
3819
3942
  const filtered = useMemo(() => {
3820
3943
  if (!showSearch || search.trim() === "") return flat;
3821
3944
  const q = search.trim().toLowerCase();
@@ -3826,6 +3949,16 @@ var SSelect = forwardRef(function SSelect2({
3826
3949
  const allValues = selectable.map((o) => o.value);
3827
3950
  const allSelected = allValues.length > 0 && allValues.every((v) => selected.includes(v));
3828
3951
  const hasItems = filtered.some((o) => !o.isGroup);
3952
+ const navigableItems = useMemo(() => {
3953
+ const items = [];
3954
+ if (multi && useSelectAll && allValues.length > 0) {
3955
+ items.push({ value: "__select_all__", isSelectAll: true });
3956
+ }
3957
+ filtered.forEach((o) => {
3958
+ if (!o.isGroup && !o.disabled) items.push({ value: o.value });
3959
+ });
3960
+ return items;
3961
+ }, [allValues.length, filtered, multi, useSelectAll]);
3829
3962
  const triggerText = (() => {
3830
3963
  if (selected.length === 0) return placeholder;
3831
3964
  if (multi) {
@@ -3835,26 +3968,119 @@ var SSelect = forwardRef(function SSelect2({
3835
3968
  return labelByValue.get(selected[0]) ?? selected[0];
3836
3969
  })();
3837
3970
  const isPlaceholder = selected.length === 0;
3838
- const selectStore = /* @__PURE__ */ jsxs(
3839
- Ariakit.SelectProvider,
3971
+ const handleSelect = (nextValue) => {
3972
+ if (multi) {
3973
+ const next = selected.includes(nextValue) ? selected.filter((v) => v !== nextValue) : [...selected, nextValue];
3974
+ emit(next);
3975
+ return;
3976
+ }
3977
+ emit([nextValue]);
3978
+ commitOpen(false);
3979
+ };
3980
+ const handleSelectAll = () => {
3981
+ emit(allSelected ? [] : allValues);
3982
+ };
3983
+ useEffect(() => {
3984
+ if (!open) {
3985
+ setFocusedIndex(-1);
3986
+ return;
3987
+ }
3988
+ setFocusedIndex(navigableItems.length > 0 ? 0 : -1);
3989
+ }, [open, navigableItems.length]);
3990
+ useEffect(() => {
3991
+ if (!open) return;
3992
+ setFocusedIndex(navigableItems.length > 0 ? 0 : -1);
3993
+ }, [search, open, navigableItems.length]);
3994
+ useEffect(() => {
3995
+ if (!open || focusedIndex < 0) return;
3996
+ const list = listRef.current;
3997
+ const focusedEl = list?.querySelector('[data-select-focused="true"]');
3998
+ if (!list || !focusedEl) return;
3999
+ const listRect = list.getBoundingClientRect();
4000
+ const itemRect = focusedEl.getBoundingClientRect();
4001
+ if (itemRect.top < listRect.top) {
4002
+ list.scrollTop += itemRect.top - listRect.top;
4003
+ } else if (itemRect.bottom > listRect.bottom) {
4004
+ list.scrollTop += itemRect.bottom - listRect.bottom;
4005
+ }
4006
+ }, [focusedIndex, open]);
4007
+ const moveFocusedIndex = (direction) => {
4008
+ if (!open || navigableItems.length === 0) return;
4009
+ setFocusedIndex((current) => {
4010
+ if (direction === "next") {
4011
+ return current < 0 ? 0 : (current + 1) % navigableItems.length;
4012
+ }
4013
+ return current <= 0 ? navigableItems.length - 1 : current - 1;
4014
+ });
4015
+ };
4016
+ const selectFocusedItem = () => {
4017
+ if (focusedIndex < 0 || focusedIndex >= navigableItems.length) return;
4018
+ const focused = navigableItems[focusedIndex];
4019
+ if (focused.isSelectAll) {
4020
+ handleSelectAll();
4021
+ return;
4022
+ }
4023
+ handleSelect(focused.value);
4024
+ };
4025
+ const handleKeyDown = (event) => {
4026
+ if (!open) {
4027
+ if ((event.key === "ArrowDown" || event.key === "ArrowUp") && !effectiveDisabled) {
4028
+ event.preventDefault();
4029
+ requestOpen(true);
4030
+ }
4031
+ return;
4032
+ }
4033
+ if (event.key === "ArrowDown") {
4034
+ event.preventDefault();
4035
+ moveFocusedIndex("next");
4036
+ return;
4037
+ }
4038
+ if (event.key === "ArrowUp") {
4039
+ event.preventDefault();
4040
+ moveFocusedIndex("prev");
4041
+ return;
4042
+ }
4043
+ if (event.key === "Enter") {
4044
+ event.preventDefault();
4045
+ selectFocusedItem();
4046
+ return;
4047
+ }
4048
+ if (event.key === "Escape") {
4049
+ event.preventDefault();
4050
+ commitOpen(false);
4051
+ }
4052
+ };
4053
+ return /* @__PURE__ */ jsxs(
4054
+ SField,
3840
4055
  {
3841
- animated: portalContainer == null ? 150 : false,
3842
- value: multi ? selected : selected[0] ?? "",
3843
- setValue: (v) => emit(Array.isArray(v) ? v : v === "" ? [] : [v]),
3844
- open,
3845
- setOpen: (o) => {
3846
- setOpen(o);
3847
- onOpenChange?.(o);
3848
- if (!o && rules && rules.length > 0) {
3849
- setRuleError(runRules(multi ? selected : selected[0] ?? "", rules));
3850
- }
3851
- },
4056
+ label,
4057
+ labelWidth,
4058
+ icon,
4059
+ iconColor,
4060
+ labelTooltip,
4061
+ labelTooltipProps,
4062
+ addonLabel,
4063
+ addonAlign,
4064
+ hint,
4065
+ error: error || ruleError !== "",
4066
+ status: rules && rules.length > 0 ? ruleError !== "" ? "error" : void 0 : void 0,
4067
+ errorMessage: ruleError !== "" ? ruleError : errorMessage,
4068
+ disabled: effectiveDisabled,
4069
+ width,
4070
+ className,
4071
+ style,
3852
4072
  children: [
4073
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: selected.join(",") }),
3853
4074
  /* @__PURE__ */ jsxs(
3854
- Ariakit.Select,
4075
+ "button",
3855
4076
  {
3856
4077
  ref: triggerRef,
4078
+ type: "button",
3857
4079
  disabled: effectiveDisabled,
4080
+ "aria-haspopup": "listbox",
4081
+ "aria-expanded": open,
4082
+ onClick: () => requestOpen(!open),
4083
+ onKeyDown: handleKeyDown,
3858
4084
  className: "flex h-full w-full cursor-pointer items-center justify-between gap-[8px] bg-transparent px-[12px] text-left text-[12px] leading-[20px] outline-none disabled:cursor-not-allowed",
3859
4085
  style: {
3860
4086
  color: effectiveDisabled ? "var(--cmp-select-text-disabled)" : isPlaceholder ? "var(--cmp-select-icon-default)" : "var(--cmp-select-text-default)"
@@ -3879,178 +4105,237 @@ var SSelect = forwardRef(function SSelect2({
3879
4105
  ]
3880
4106
  }
3881
4107
  ),
3882
- /* @__PURE__ */ jsxs(
3883
- Ariakit.SelectPopover,
4108
+ /* @__PURE__ */ jsx(
4109
+ SPortal,
3884
4110
  {
3885
- portal: true,
3886
- portalElement: portalContainer,
3887
- gutter: 4,
3888
- sameWidth: !dropdownWidth,
3889
- className: "z-50 overflow-auto rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)] data-[enter]:animate-floating-in-bottom data-[leave]:animate-floating-out-bottom",
4111
+ open,
4112
+ onClose: () => commitOpen(false),
4113
+ onOpenChange: (next) => {
4114
+ if (next) requestOpen(true);
4115
+ },
4116
+ anchorRef: triggerRef,
4117
+ placement: "bottom",
4118
+ align: "start",
4119
+ offset: 4,
4120
+ fit: !dropdownWidth,
4121
+ onOpenAutoFocus: (event) => {
4122
+ if (!showSearch) {
4123
+ event.preventDefault();
4124
+ return;
4125
+ }
4126
+ event.preventDefault();
4127
+ requestAnimationFrame(() => searchInputRef.current?.focus());
4128
+ },
4129
+ onCloseAutoFocus: (event) => {
4130
+ event.preventDefault();
4131
+ triggerRef.current?.focus();
4132
+ },
4133
+ className: "rounded-[var(--cmp-listBox-radius)] bg-[var(--cmp-listBox-bg)] shadow-[2px_2px_12px_2px_rgba(0,0,0,0.1)]",
3890
4134
  style: {
3891
- maxHeight: dropdownHeight,
3892
4135
  ...dropdownWidth ? { width: dropdownWidth } : {},
3893
4136
  maxWidth: maxDropdownWidth
3894
4137
  },
3895
- children: [
3896
- showSearch && // 원본 sd-select-list-item-search: sticky + 검색 아이콘 + 테두리 input + focus-within + clear
3897
- /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-[1] bg-[var(--cmp-listBox-bg)] px-[8px] py-[4px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[6px] rounded-[4px] border border-solid border-[color:var(--color-grey-45)] bg-white px-[8px] py-[4px] focus-within:border-[color:var(--sys-color-field-border-focus)]", children: [
3898
- /* @__PURE__ */ jsx(SIcon, { name: "search", size: 16, color: "var(--color-grey-70)", className: "shrink-0" }),
3899
- /* @__PURE__ */ jsx(
3900
- Ariakit.Combobox,
3901
- {
3902
- autoSelect: true,
3903
- placeholder: "\uAC80\uC0C9",
3904
- className: "min-w-0 flex-1 border-none bg-transparent text-[12px] leading-[20px] text-[color:var(--cmp-select-text-default)] outline-none placeholder:text-[color:var(--color-grey-55)]"
3905
- }
3906
- ),
3907
- search !== "" && /* @__PURE__ */ jsx(
3908
- SGhostButton,
3909
- {
3910
- icon: "close",
3911
- size: "xxs",
3912
- intent: "default",
3913
- ariaLabel: "\uAC80\uC0C9\uC5B4 \uC9C0\uC6B0\uAE30",
3914
- onClick: () => setSearch(""),
3915
- className: "shrink-0"
3916
- }
3917
- )
3918
- ] }) }),
3919
- multi && useSelectAll && /* @__PURE__ */ jsx(
3920
- "button",
3921
- {
3922
- type: "button",
3923
- className: "flex w-full items-center px-[12px] py-[4px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-listItem-content-default)] hover:bg-[var(--cmp-listItem-bg-hover)] hover:text-[color:var(--cmp-listItem-content-hover)]",
3924
- onClick: () => emit(allSelected ? [] : allValues),
3925
- children: allSelectedLabel
3926
- }
3927
- ),
3928
- hasItems ? /* @__PURE__ */ jsx(ItemList, { items: filtered, multi, selected, useSearch: showSearch }) : (
3929
- // 원본 sd-select-listbox__empty (표시할 항목이 없을 때)
3930
- /* @__PURE__ */ jsx("div", { className: "px-[12px] py-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-listItem-content-disabled)]", children: "\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." })
3931
- )
3932
- ]
4138
+ children: /* @__PURE__ */ jsxs(
4139
+ "div",
4140
+ {
4141
+ ref: listRef,
4142
+ className: "overflow-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-[8px] [&::-webkit-scrollbar]:bg-[var(--color-grey-25)] [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-thumb]:rounded-[4px] [&::-webkit-scrollbar-thumb]:bg-[var(--color-grey-45)] [&::-webkit-scrollbar-track]:bg-[var(--color-grey-25)]",
4143
+ style: { maxHeight: dropdownHeight },
4144
+ onMouseLeave: () => setFocusedIndex(-1),
4145
+ children: [
4146
+ showSearch && /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-[1] bg-[var(--cmp-listBox-bg)] px-[8px] py-[4px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[6px] rounded-[4px] border border-solid border-[color:var(--color-grey-45)] bg-white px-[8px] py-[4px] focus-within:border-[color:var(--sys-color-field-border-focus)]", children: [
4147
+ /* @__PURE__ */ jsx(SIcon, { name: "search", size: 16, color: "var(--color-grey-70)", className: "shrink-0" }),
4148
+ /* @__PURE__ */ jsx(
4149
+ "input",
4150
+ {
4151
+ ref: searchInputRef,
4152
+ value: search,
4153
+ onChange: (e) => setSearch(e.target.value),
4154
+ onKeyDown: handleKeyDown,
4155
+ placeholder: "\uAC80\uC0C9",
4156
+ className: "min-w-0 flex-1 border-none bg-transparent text-[12px] leading-[20px] text-[color:var(--cmp-select-text-default)] outline-none placeholder:text-[color:var(--color-grey-55)]"
4157
+ }
4158
+ ),
4159
+ search !== "" && /* @__PURE__ */ jsx(
4160
+ SGhostButton,
4161
+ {
4162
+ icon: "close",
4163
+ size: "xxs",
4164
+ intent: "default",
4165
+ ariaLabel: "\uAC80\uC0C9\uC5B4 \uC9C0\uC6B0\uAE30",
4166
+ onClick: () => setSearch(""),
4167
+ className: "shrink-0"
4168
+ }
4169
+ )
4170
+ ] }) }),
4171
+ hasItems ? /* @__PURE__ */ jsx(
4172
+ ItemList,
4173
+ {
4174
+ items: filtered,
4175
+ multi,
4176
+ selected,
4177
+ focusedValue: navigableItems[focusedIndex]?.isSelectAll ? "__select_all__" : navigableItems[focusedIndex]?.value,
4178
+ showSelectAll: multi && useSelectAll && allValues.length > 0,
4179
+ selectAllLabel: allSelectedLabel,
4180
+ selectAllSelected: allSelected,
4181
+ onSelectAll: handleSelectAll,
4182
+ onSelect: handleSelect,
4183
+ onHoverValue: (value2) => {
4184
+ if (value2 == null) {
4185
+ setFocusedIndex(-1);
4186
+ return;
4187
+ }
4188
+ const index = navigableItems.findIndex(
4189
+ (item) => item.isSelectAll ? value2 === "__select_all__" : item.value === value2
4190
+ );
4191
+ if (index >= 0) setFocusedIndex(index);
4192
+ }
4193
+ }
4194
+ ) : /* @__PURE__ */ jsx("div", { className: "px-[12px] py-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-listItem-content-disabled)]", children: "\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." })
4195
+ ]
4196
+ }
4197
+ )
3933
4198
  }
3934
4199
  )
3935
4200
  ]
3936
4201
  }
3937
4202
  );
3938
- const control = showSearch ? /* @__PURE__ */ jsx(Ariakit.ComboboxProvider, { value: search, setValue: setSearch, resetValueOnHide: true, children: selectStore }) : selectStore;
3939
- return /* @__PURE__ */ jsxs(
3940
- SField,
3941
- {
3942
- label,
3943
- labelWidth,
3944
- icon,
3945
- labelTooltip,
3946
- labelTooltipProps,
3947
- addonLabel,
3948
- addonAlign,
3949
- hint,
3950
- error: error || ruleError !== "",
3951
- status: rules && rules.length > 0 ? ruleError !== "" ? "error" : void 0 : void 0,
3952
- errorMessage: ruleError !== "" ? ruleError : errorMessage,
3953
- disabled: effectiveDisabled,
3954
- width,
3955
- className,
3956
- style,
3957
- children: [
3958
- name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: selected.join(",") }),
3959
- control
3960
- ]
3961
- }
3962
- );
3963
4203
  });
3964
4204
  SSelect.displayName = "SSelect";
3965
4205
  function ItemList({
3966
4206
  items,
3967
4207
  multi,
3968
4208
  selected,
3969
- useSearch
4209
+ focusedValue,
4210
+ showSelectAll,
4211
+ selectAllLabel,
4212
+ selectAllSelected,
4213
+ onSelectAll,
4214
+ onSelect,
4215
+ onHoverValue
3970
4216
  }) {
3971
4217
  const itemBase = cn(
3972
- // group: 체크박스 inverse(group-data-[active-item])를 위해 필요
3973
- "group flex cursor-pointer select-none items-center gap-[8px] text-[12px] leading-[20px] outline-none",
4218
+ "group flex w-full cursor-pointer select-none items-center gap-[8px] border-none bg-transparent text-left text-[12px] leading-[20px] outline-none",
3974
4219
  "text-[color:var(--cmp-listItem-content-default)]",
3975
- // Ariakit은 disabled 항목에 aria-disabled를 붙이므로 aria-disabled 변형으로 스타일 (data-disabled 아님)
3976
- "aria-disabled:cursor-not-allowed aria-disabled:text-[color:var(--cmp-listItem-content-disabled)]"
4220
+ "disabled:cursor-not-allowed disabled:text-[color:var(--cmp-listItem-content-disabled)]"
3977
4221
  );
3978
- const activeClass = "data-[active-item]:bg-[var(--cmp-listItem-bg-hover)] data-[active-item]:text-[color:var(--cmp-listItem-content-hover)]";
3979
- return /* @__PURE__ */ jsx(Fragment, { children: items.map((o) => {
3980
- const padLeft = o.depth === 1 ? 12 : o.depth === 2 ? 20 : 28;
3981
- if (o.isGroup) {
3982
- const isDepth1 = o.depth === 1;
3983
- return /* @__PURE__ */ jsx(
3984
- "div",
3985
- {
3986
- className: cn(
3987
- "select-none py-[4px] pr-[12px] text-[12px] leading-[20px] text-[color:var(--cmp-listItem-content-default)]",
3988
- isDepth1 ? "border-t border-solid border-[color:var(--cmp-listItem-depth1-border-color)] bg-[var(--cmp-listItem-depth1-bg-default)] font-bold" : "bg-[var(--cmp-listItem-depth2-middle-bg)] font-medium",
3989
- // 하위가 전부 비활성이면(select.config 에서 bubble-up) 어미 그룹도 비활성 처리:
3990
- // 텍스트는 회색(#888), depth1 그룹은 파란 배경 대신 회색(#EEE)으로 (depth2 는 #F6F6F6 유지)
3991
- o.disabled && "cursor-not-allowed text-[color:var(--cmp-listItem-content-disabled)]",
3992
- o.disabled && isDepth1 && "bg-[var(--cmp-listItem-depth1-bg-disabled)]"
3993
- ),
3994
- style: { paddingLeft: padLeft },
3995
- children: o.label
3996
- },
3997
- o.value
3998
- );
3999
- }
4000
- const isSelected = selected.includes(o.value);
4001
- return /* @__PURE__ */ jsxs(
4002
- Ariakit.SelectItem,
4222
+ const activeClass = "hover:bg-[var(--cmp-listItem-bg-hover)] hover:text-[color:var(--cmp-listItem-content-hover)] focus:bg-[var(--cmp-listItem-bg-hover)] focus:text-[color:var(--cmp-listItem-content-hover)]";
4223
+ return /* @__PURE__ */ jsxs("div", { role: "listbox", "aria-multiselectable": multi || void 0, children: [
4224
+ showSelectAll && /* @__PURE__ */ jsxs(
4225
+ "button",
4003
4226
  {
4004
- value: o.value,
4005
- disabled: o.disabled,
4006
- accessibleWhenDisabled: true,
4227
+ type: "button",
4228
+ "data-select-focused": focusedValue === "__select_all__" ? "true" : void 0,
4229
+ "data-select-active": focusedValue === "__select_all__" ? "true" : void 0,
4007
4230
  className: cn(
4008
4231
  itemBase,
4009
- isSelected && !multi && "font-bold text-[color:var(--cmp-listItem-content-selected)]",
4010
- // Ariakit은 disabled 항목도 hover 시 active(data-active-item) 처리하므로,
4011
- // 비활성 항목에는 hover 하이라이트를 적용하지 않아 회색 비활성 스타일을 유지한다.
4012
- // (원본 Stencil의 `--focused...:not(--disabled)` 규칙과 동일한 의도)
4013
- !o.disabled && activeClass
4232
+ focusedValue === "__select_all__" && "bg-[var(--cmp-listItem-bg-hover)] text-[color:var(--cmp-listItem-content-hover)]"
4014
4233
  ),
4015
- style: { paddingTop: 4, paddingBottom: 4, paddingRight: 12, paddingLeft: padLeft },
4016
- render: useSearch ? /* @__PURE__ */ jsx(Ariakit.ComboboxItem, {}) : void 0,
4234
+ style: { paddingTop: 4, paddingBottom: 4, paddingRight: 12, paddingLeft: 12 },
4235
+ onMouseEnter: () => onHoverValue("__select_all__"),
4236
+ onMouseLeave: () => onHoverValue(null),
4237
+ onClick: onSelectAll,
4017
4238
  children: [
4018
- multi && // hover(active) 시 checkbox inverse — 파란 hover 배경 위에서 checked/unchecked 모두 흰 테두리 + 투명 배경
4019
4239
  /* @__PURE__ */ jsx(
4020
4240
  "span",
4021
4241
  {
4022
4242
  className: cn(
4023
4243
  "flex h-[16px] w-[16px] flex-shrink-0 items-center justify-center rounded-[2px] border border-solid",
4024
- o.disabled ? (
4025
- // 비활성: 회색 채움(#E1E1E1) + 회색 테두리(#CCCCCC)
4026
- "cursor-not-allowed border-[color:var(--cmp-checkbox-border-disabled)] bg-[var(--cmp-checkbox-bg-disabled)]"
4027
- ) : cn(
4028
- "group-data-[active-item]:border-[color:var(--cmp-checkbox-checked-border-inverse)]",
4029
- isSelected ? "border-[color:var(--cmp-checkbox-checked-bg-default)] bg-[var(--cmp-checkbox-checked-bg-default)] group-data-[active-item]:bg-transparent" : "border-[color:var(--cmp-checkbox-unchecked-border-default)] bg-transparent"
4030
- )
4244
+ selectAllSelected ? focusedValue === "__select_all__" ? "border-[color:var(--cmp-checkbox-checked-border-inverse)] bg-[var(--cmp-checkbox-checked-bg-default)]" : "border-[color:var(--cmp-checkbox-checked-bg-default)] bg-[var(--cmp-checkbox-checked-bg-default)]" : "border-[color:var(--cmp-checkbox-unchecked-border-default)] bg-[var(--cmp-checkbox-unchecked-bg-default)]"
4031
4245
  ),
4032
- children: isSelected && /* @__PURE__ */ jsx(
4246
+ children: selectAllSelected && /* @__PURE__ */ jsx(
4033
4247
  SIcon,
4034
4248
  {
4035
4249
  name: "checkboxCheck",
4036
4250
  size: 12,
4037
- color: o.disabled ? "var(--cmp-checkbox-checked-icon-disabled)" : "var(--cmp-checkbox-checked-icon-default)"
4251
+ color: "var(--cmp-checkbox-checked-icon-default)"
4038
4252
  }
4039
4253
  )
4040
4254
  }
4041
4255
  ),
4042
- isHtmlLabel(o.label) ? /* @__PURE__ */ jsx(
4043
- "span",
4044
- {
4045
- className: "flex-1 truncate",
4046
- dangerouslySetInnerHTML: { __html: sanitizeInlineHtml(o.label) }
4047
- }
4048
- ) : /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: o.label })
4256
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: selectAllLabel })
4049
4257
  ]
4050
- },
4051
- o.value
4052
- );
4053
- }) });
4258
+ }
4259
+ ),
4260
+ items.map((o) => {
4261
+ const padLeft = o.depth === 1 ? 12 : o.depth === 2 ? 20 : 28;
4262
+ if (o.isGroup) {
4263
+ const isDepth1 = o.depth === 1;
4264
+ return /* @__PURE__ */ jsx(
4265
+ "div",
4266
+ {
4267
+ className: cn(
4268
+ "select-none py-[4px] pr-[12px] text-[12px] leading-[20px] text-[color:var(--cmp-listItem-content-default)]",
4269
+ isDepth1 ? "border-t border-solid border-[color:var(--cmp-listItem-depth1-border-color)] bg-[var(--cmp-listItem-depth1-bg-default)] font-bold" : "bg-[var(--cmp-listItem-depth2-middle-bg)] font-medium",
4270
+ // 하위가 전부 비활성이면(select.config 에서 bubble-up) 어미 그룹도 비활성 처리:
4271
+ // 텍스트는 회색(#888), depth1 그룹은 파란 배경 대신 회색(#EEE)으로 (depth2 는 #F6F6F6 유지)
4272
+ o.disabled && "cursor-not-allowed text-[color:var(--cmp-listItem-content-disabled)]",
4273
+ o.disabled && isDepth1 && "bg-[var(--cmp-listItem-depth1-bg-disabled)]"
4274
+ ),
4275
+ style: { paddingLeft: padLeft },
4276
+ children: o.label
4277
+ },
4278
+ o.value
4279
+ );
4280
+ }
4281
+ const isSelected = selected.includes(o.value);
4282
+ return /* @__PURE__ */ jsxs(
4283
+ "button",
4284
+ {
4285
+ type: "button",
4286
+ disabled: o.disabled,
4287
+ role: "option",
4288
+ "aria-selected": isSelected,
4289
+ "data-select-focused": focusedValue === o.value ? "true" : void 0,
4290
+ "data-select-active": focusedValue === o.value ? "true" : void 0,
4291
+ className: cn(
4292
+ itemBase,
4293
+ isSelected && !multi && "font-bold text-[color:var(--cmp-listItem-content-selected)]",
4294
+ focusedValue === o.value && "bg-[var(--cmp-listItem-bg-hover)] text-[color:var(--cmp-listItem-content-hover)]",
4295
+ // 비활성 항목은 hover/focus 스타일 대상에서 제외한다.
4296
+ // (:hover 는 disabled 버튼에도 매칭되므로 클래스 자체를 붙이지 않아야 한다)
4297
+ !o.disabled && activeClass
4298
+ ),
4299
+ style: { paddingTop: 4, paddingBottom: 4, paddingRight: 12, paddingLeft: padLeft },
4300
+ onMouseEnter: () => onHoverValue(o.value),
4301
+ onMouseLeave: () => onHoverValue(null),
4302
+ onClick: () => onSelect(o.value),
4303
+ children: [
4304
+ multi && /* @__PURE__ */ jsx(
4305
+ "span",
4306
+ {
4307
+ className: cn(
4308
+ "flex h-[16px] w-[16px] flex-shrink-0 items-center justify-center rounded-[2px] border border-solid",
4309
+ o.disabled ? (
4310
+ // 비활성: 회색 채움(#E1E1E1) + 회색 테두리(#CCCCCC)
4311
+ "cursor-not-allowed border-[color:var(--cmp-checkbox-border-disabled)] bg-[var(--cmp-checkbox-bg-disabled)]"
4312
+ ) : cn(
4313
+ isSelected ? focusedValue === o.value ? "border-[color:var(--cmp-checkbox-checked-border-inverse)] bg-[var(--cmp-checkbox-checked-bg-default)]" : "border-[color:var(--cmp-checkbox-checked-bg-default)] bg-[var(--cmp-checkbox-checked-bg-default)]" : "border-[color:var(--cmp-checkbox-unchecked-border-default)] bg-[var(--cmp-checkbox-unchecked-bg-default)]"
4314
+ )
4315
+ ),
4316
+ children: isSelected && /* @__PURE__ */ jsx(
4317
+ SIcon,
4318
+ {
4319
+ name: "checkboxCheck",
4320
+ size: 12,
4321
+ color: o.disabled ? "var(--cmp-checkbox-checked-icon-disabled)" : "var(--cmp-checkbox-checked-icon-default)"
4322
+ }
4323
+ )
4324
+ }
4325
+ ),
4326
+ isHtmlLabel(o.label) ? /* @__PURE__ */ jsx(
4327
+ "span",
4328
+ {
4329
+ className: "flex-1 truncate",
4330
+ dangerouslySetInnerHTML: { __html: sanitizeInlineHtml(o.label) }
4331
+ }
4332
+ ) : /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: o.label })
4333
+ ]
4334
+ },
4335
+ o.value
4336
+ );
4337
+ })
4338
+ ] });
4054
4339
  }
4055
4340
  var DEFAULT_ROW_HEIGHT = 44;
4056
4341
  var DENSE_ROW_HEIGHT = 32;
@@ -4326,7 +4611,7 @@ var STable = forwardRef(function STable2({
4326
4611
  };
4327
4612
  const radiusClass = radius === "full" ? "rounded-none" : radius === "useTop" ? "rounded-b-[var(--cmp-table-radius)] rounded-t-none" : "rounded-[var(--cmp-table-radius)]";
4328
4613
  const cellPadY = dense ? "var(--cmp-table-body-paddingY-dense)" : "var(--cmp-table-body-paddingY-default)";
4329
- const cellPadX = dense ? "var(--cmp-table-body-paddingX-default)" : "var(--cmp-table-body-paddingX-wide)";
4614
+ const cellPadX = "var(--cmp-table-body-paddingX-wide)";
4330
4615
  const rowH = dense ? "var(--cmp-table-body-dense-height)" : "var(--cmp-table-body-default-height)";
4331
4616
  const totalColSpan = visibleCols.length + (selectable ? 1 : 0);
4332
4617
  const stickyInfo = (i) => {
@@ -4534,10 +4819,10 @@ var STable = forwardRef(function STable2({
4534
4819
  "div",
4535
4820
  {
4536
4821
  "aria-hidden": true,
4537
- className: "pointer-events-none absolute left-0 right-0 top-0 z-[210] h-[var(--cmp-table-header-height)] bg-white/60"
4822
+ className: "pointer-events-none absolute left-0 right-0 top-0 z-[31] h-[var(--cmp-table-header-height)] bg-white/60"
4538
4823
  }
4539
4824
  ),
4540
- /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 right-0 top-[var(--cmp-table-header-height)] z-[200] flex items-center justify-center bg-white/60 text-[12px] text-[color:var(--color-grey-65)]", children: /* @__PURE__ */ jsx("div", { className: "flex min-h-[60px] w-full items-center justify-center", children: noDataLabel }) })
4825
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 right-0 top-[var(--cmp-table-header-height)] z-[30] flex items-center justify-center bg-white/60 text-[12px] text-[color:var(--color-grey-65)]", children: /* @__PURE__ */ jsx("div", { className: "flex min-h-[60px] w-full items-center justify-center", children: noDataLabel }) })
4541
4826
  ] }),
4542
4827
  isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-white/60", children: /* @__PURE__ */ jsx(SCircleProgress, { indeterminate: true }) })
4543
4828
  ]