@bestow-ui/react 1.7.0 → 2.0.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.
package/dist/client.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  themeToStyle,
27
27
  toISODate,
28
28
  visuallyHidden
29
- } from "./chunk-YYLDXZWR.js";
29
+ } from "./chunk-BDQ5IJIS.js";
30
30
 
31
31
  // src/theme/ThemeProvider.tsx
32
32
  import { createContext, forwardRef, useContext, useId, useMemo } from "react";
@@ -158,10 +158,41 @@ var AccordionItem = /* @__PURE__ */ forwardRef2(function AccordionItem2({ title:
158
158
  });
159
159
 
160
160
  // src/components/AddressInput/AddressInput.tsx
161
- import { forwardRef as forwardRef7, useEffect, useId as useId3, useRef as useRef2, useState } from "react";
161
+ import { forwardRef as forwardRef7, useEffect as useEffect2, useId as useId3, useRef as useRef3, useState } from "react";
162
+
163
+ // src/utils/mergeRefs.ts
164
+ function mergeRefs(...refs) {
165
+ return (value3) => {
166
+ for (const ref of refs) {
167
+ if (typeof ref === "function") ref(value3);
168
+ else if (ref) ref.current = value3;
169
+ }
170
+ };
171
+ }
172
+
173
+ // src/utils/useFormReset.ts
174
+ import { useEffect, useRef } from "react";
175
+ function useFormReset(ref, onReset) {
176
+ const latest = useRef(onReset);
177
+ useEffect(() => {
178
+ latest.current = onReset;
179
+ });
180
+ useEffect(() => {
181
+ const form = ref.current?.closest("form");
182
+ if (!form) return;
183
+ const handleReset = () => latest.current();
184
+ form.addEventListener("reset", handleReset);
185
+ return () => form.removeEventListener("reset", handleReset);
186
+ }, [ref]);
187
+ }
162
188
 
163
189
  // src/components/Button/Button.tsx
164
- import { forwardRef as forwardRef4 } from "react";
190
+ import {
191
+ Children,
192
+ cloneElement,
193
+ forwardRef as forwardRef4,
194
+ version
195
+ } from "react";
165
196
 
166
197
  // src/components/Spinner/Spinner.tsx
167
198
  import { LoaderIcon } from "@bestow-ui/icons";
@@ -189,7 +220,7 @@ var button = /* @__PURE__ */ _7a4682({ defaultClassName: "xcekda6", variantClass
189
220
  var icon = "xcekdai";
190
221
 
191
222
  // src/components/Button/Button.tsx
192
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
223
+ import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
193
224
  var Button = /* @__PURE__ */ forwardRef4(function Button2({
194
225
  variant,
195
226
  color,
@@ -198,6 +229,8 @@ var Button = /* @__PURE__ */ forwardRef4(function Button2({
198
229
  startIcon,
199
230
  endIcon,
200
231
  loading,
232
+ asChild,
233
+ disabled,
201
234
  className,
202
235
  type = "button",
203
236
  onClick,
@@ -205,28 +238,55 @@ var Button = /* @__PURE__ */ forwardRef4(function Button2({
205
238
  ...rest
206
239
  }, ref) {
207
240
  const handleClick = (event) => {
208
- if (loading) {
241
+ if (loading || disabled) {
209
242
  event.preventDefault();
210
243
  return;
211
244
  }
212
245
  onClick?.(event);
213
246
  };
214
247
  const leading = loading ? /* @__PURE__ */ jsx5(Spinner, { size: "sm", label: "" }) : startIcon;
215
- return /* @__PURE__ */ jsxs4(
248
+ const buttonClassName = cx(button({ variant, color, size, fullWidth }), className);
249
+ const content12 = (label6) => /* @__PURE__ */ jsxs4(Fragment, { children: [
250
+ leading && /* @__PURE__ */ jsx5("span", { className: icon, children: leading }),
251
+ label6,
252
+ endIcon && /* @__PURE__ */ jsx5("span", { className: icon, children: endIcon })
253
+ ] });
254
+ if (asChild) {
255
+ const child = Children.only(children);
256
+ const { props } = child;
257
+ return cloneElement(
258
+ child,
259
+ {
260
+ ...rest,
261
+ ...props,
262
+ className: cx(buttonClassName, props.className),
263
+ style: { ...rest.style, ...props.style },
264
+ // React 19 는 ref 가 props 에 있고, element.ref 를 읽으면 경고한다. 18 은 element.ref 에만 있다
265
+ ref: mergeRefs(ref, parseInt(version) >= 19 ? props.ref : child.ref),
266
+ tabIndex: disabled ? -1 : props.tabIndex,
267
+ "aria-busy": loading || void 0,
268
+ "aria-disabled": loading || disabled || void 0,
269
+ "data-disabled": disabled ? "" : void 0,
270
+ onClick: (event) => {
271
+ handleClick(event);
272
+ if (!loading && !disabled) props.onClick?.(event);
273
+ }
274
+ },
275
+ content12(props.children)
276
+ );
277
+ }
278
+ return /* @__PURE__ */ jsx5(
216
279
  "button",
217
280
  {
218
281
  ref,
219
282
  type,
220
- className: cx(button({ variant, color, size, fullWidth }), className),
283
+ disabled,
284
+ className: buttonClassName,
221
285
  "aria-busy": loading || void 0,
222
286
  "aria-disabled": loading || void 0,
223
287
  onClick: handleClick,
224
288
  ...rest,
225
- children: [
226
- leading && /* @__PURE__ */ jsx5("span", { className: icon, children: leading }),
227
- children,
228
- endIcon && /* @__PURE__ */ jsx5("span", { className: icon, children: endIcon })
229
- ]
289
+ children: content12(children)
230
290
  }
231
291
  );
232
292
  });
@@ -292,9 +352,9 @@ import * as Dialog from "@radix-ui/react-dialog";
292
352
  import { XIcon } from "@bestow-ui/icons";
293
353
 
294
354
  // src/utils/useReturnFocus.ts
295
- import { useRef } from "react";
355
+ import { useRef as useRef2 } from "react";
296
356
  function useReturnFocus(hasTrigger, onCloseAutoFocus) {
297
- const returnTo = useRef(null);
357
+ const returnTo = useRef2(null);
298
358
  return {
299
359
  onOpenAutoFocus: () => {
300
360
  const active = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -386,7 +446,7 @@ var searchStatus = "_16fi7uy5";
386
446
  var zonecode = "_16fi7uy3";
387
447
 
388
448
  // src/components/AddressInput/AddressInput.tsx
389
- import { Fragment, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
449
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
390
450
  var EMPTY = { zonecode: "", address: "", extraAddress: "", detail: "" };
391
451
  function SearchArea({
392
452
  provider,
@@ -394,13 +454,13 @@ function SearchArea({
394
454
  loadErrorText,
395
455
  loadingText
396
456
  }) {
397
- const containerRef = useRef2(null);
457
+ const containerRef = useRef3(null);
398
458
  const [status, setStatus] = useState("loading");
399
- const onSelectRef = useRef2(onSelect);
400
- useEffect(() => {
459
+ const onSelectRef = useRef3(onSelect);
460
+ useEffect2(() => {
401
461
  onSelectRef.current = onSelect;
402
462
  });
403
- useEffect(() => {
463
+ useEffect2(() => {
404
464
  const container2 = containerRef.current;
405
465
  if (!container2) return;
406
466
  let cleanup;
@@ -447,8 +507,8 @@ var AddressInput = /* @__PURE__ */ forwardRef7(
447
507
  const loadErrorText = loadErrorTextProp ?? m.addressLoadError ?? "\uC8FC\uC18C \uAC80\uC0C9\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC5B4\uC694. \uC7A0\uC2DC \uB4A4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.";
448
508
  const baseId = useId3();
449
509
  const helperId = helperText3 ? `${baseId}-helper` : void 0;
450
- const detailRef = useRef2(null);
451
- const selectedRef = useRef2(false);
510
+ const detailRef = useRef3(null);
511
+ const selectedRef = useRef3(false);
452
512
  const [open, setOpen] = useState(false);
453
513
  const isControlled = "value" in props;
454
514
  const [innerValue, setInnerValue] = useState(defaultValue ?? EMPTY);
@@ -457,6 +517,10 @@ var AddressInput = /* @__PURE__ */ forwardRef7(
457
517
  if (!isControlled) setInnerValue(next);
458
518
  onValueChange?.(next);
459
519
  };
520
+ const rootRef = useRef3(null);
521
+ useFormReset(rootRef, () => {
522
+ if (!isControlled) update(defaultValue ?? EMPTY);
523
+ });
460
524
  const openSearch = () => {
461
525
  if (disabled) return;
462
526
  selectedRef.current = false;
@@ -473,102 +537,101 @@ var AddressInput = /* @__PURE__ */ forwardRef7(
473
537
  setOpen(false);
474
538
  };
475
539
  const fullAddress = `${current2.address}${current2.extraAddress ?? ""}`;
476
- return /* @__PURE__ */ jsxs8("fieldset", { ref, className: cx(fieldset, className), disabled, "aria-describedby": helperId, children: [
477
- /* @__PURE__ */ jsxs8("legend", { className: legend, children: [
478
- label6,
479
- required && /* @__PURE__ */ jsx9("span", { className: requiredMark, "aria-hidden": true, children: "*" })
480
- ] }),
481
- /* @__PURE__ */ jsxs8("div", { className: row, children: [
482
- /* @__PURE__ */ jsx9(
483
- TextField,
484
- {
485
- "aria-label": m.postalCode ?? "\uC6B0\uD3B8\uBC88\uD638",
486
- readOnly: true,
487
- value: current2.zonecode,
488
- placeholder: m.postalCode ?? "\uC6B0\uD3B8\uBC88\uD638",
489
- error: error && !current2.zonecode,
490
- "aria-required": required || void 0,
491
- rootClassName: zonecode,
492
- onClick: openSearch
493
- }
494
- ),
495
- /* @__PURE__ */ jsx9(Button, { variant: "outline", color: "neutral", onClick: openSearch, disabled, children: searchLabel })
496
- ] }),
497
- /* @__PURE__ */ jsx9(
498
- TextField,
499
- {
500
- "aria-label": m.baseAddress ?? "\uAE30\uBCF8 \uC8FC\uC18C",
501
- readOnly: true,
502
- value: fullAddress,
503
- placeholder: m.baseAddressPlaceholder ?? `${searchLabel}\uC744 \uB20C\uB7EC \uC8FC\uC18C\uB97C \uACE0\uB974\uC138\uC694`,
504
- error: error && !current2.address,
505
- "aria-required": required || void 0,
506
- fullWidth: true,
507
- onClick: openSearch
508
- }
509
- ),
510
- /* @__PURE__ */ jsx9(
511
- TextField,
512
- {
513
- ref: detailRef,
514
- "aria-label": m.detailAddress ?? "\uC0C1\uC138 \uC8FC\uC18C",
515
- value: current2.detail,
516
- placeholder: detailPlaceholder,
517
- onChange: (event) => update({ ...current2, detail: event.target.value }),
518
- autoComplete: "address-line2",
519
- fullWidth: true
520
- }
521
- ),
522
- helperText3 && /* @__PURE__ */ jsx9("p", { id: helperId, className: helperText({ error }), children: helperText3 }),
523
- name && /* @__PURE__ */ jsxs8(Fragment, { children: [
524
- /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[zonecode]`, value: current2.zonecode }),
525
- /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[address]`, value: fullAddress }),
526
- /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[detail]`, value: current2.detail })
527
- ] }),
528
- /* @__PURE__ */ jsx9(
529
- Modal,
530
- {
531
- open,
532
- onOpenChange: setOpen,
533
- title: searchLabel,
534
- description: m.addressSearchDescription ?? "\uB3C4\uB85C\uBA85, \uAC74\uBB3C\uBA85, \uC9C0\uBC88\uC73C\uB85C \uAC80\uC0C9\uD560 \uC218 \uC788\uC5B4\uC694.",
535
- onCloseAutoFocus: (event) => {
536
- if (selectedRef.current) {
537
- event.preventDefault();
538
- detailRef.current?.focus();
540
+ return /* @__PURE__ */ jsxs8(
541
+ "fieldset",
542
+ {
543
+ ref: mergeRefs(ref, rootRef),
544
+ className: cx(fieldset, className),
545
+ disabled,
546
+ "aria-describedby": helperId,
547
+ children: [
548
+ /* @__PURE__ */ jsxs8("legend", { className: legend, children: [
549
+ label6,
550
+ required && /* @__PURE__ */ jsx9("span", { className: requiredMark, "aria-hidden": true, children: "*" })
551
+ ] }),
552
+ /* @__PURE__ */ jsxs8("div", { className: row, children: [
553
+ /* @__PURE__ */ jsx9(
554
+ TextField,
555
+ {
556
+ "aria-label": m.postalCode ?? "\uC6B0\uD3B8\uBC88\uD638",
557
+ readOnly: true,
558
+ value: current2.zonecode,
559
+ placeholder: m.postalCode ?? "\uC6B0\uD3B8\uBC88\uD638",
560
+ error: error && !current2.zonecode,
561
+ "aria-required": required || void 0,
562
+ rootClassName: zonecode,
563
+ onClick: openSearch
564
+ }
565
+ ),
566
+ /* @__PURE__ */ jsx9(Button, { variant: "outline", color: "neutral", onClick: openSearch, disabled, children: searchLabel })
567
+ ] }),
568
+ /* @__PURE__ */ jsx9(
569
+ TextField,
570
+ {
571
+ "aria-label": m.baseAddress ?? "\uAE30\uBCF8 \uC8FC\uC18C",
572
+ readOnly: true,
573
+ value: fullAddress,
574
+ placeholder: m.baseAddressPlaceholder ?? `${searchLabel}\uC744 \uB20C\uB7EC \uC8FC\uC18C\uB97C \uACE0\uB974\uC138\uC694`,
575
+ error: error && !current2.address,
576
+ "aria-required": required || void 0,
577
+ fullWidth: true,
578
+ onClick: openSearch
539
579
  }
540
- },
541
- children: /* @__PURE__ */ jsx9(
542
- SearchArea,
580
+ ),
581
+ /* @__PURE__ */ jsx9(
582
+ TextField,
543
583
  {
544
- provider,
545
- onSelect: handleSelect,
546
- loadErrorText,
547
- loadingText: m.addressLoading ?? "\uC8FC\uC18C \uAC80\uC0C9\uC744 \uBD88\uB7EC\uC624\uB294 \uC911"
584
+ ref: detailRef,
585
+ "aria-label": m.detailAddress ?? "\uC0C1\uC138 \uC8FC\uC18C",
586
+ value: current2.detail,
587
+ placeholder: detailPlaceholder,
588
+ onChange: (event) => update({ ...current2, detail: event.target.value }),
589
+ autoComplete: "address-line2",
590
+ fullWidth: true
591
+ }
592
+ ),
593
+ helperText3 && /* @__PURE__ */ jsx9("p", { id: helperId, className: helperText({ error }), children: helperText3 }),
594
+ name && /* @__PURE__ */ jsxs8(Fragment2, { children: [
595
+ /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[zonecode]`, value: current2.zonecode }),
596
+ /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[address]`, value: fullAddress }),
597
+ /* @__PURE__ */ jsx9("input", { type: "hidden", name: `${name}[detail]`, value: current2.detail })
598
+ ] }),
599
+ /* @__PURE__ */ jsx9(
600
+ Modal,
601
+ {
602
+ open,
603
+ onOpenChange: setOpen,
604
+ title: searchLabel,
605
+ description: m.addressSearchDescription ?? "\uB3C4\uB85C\uBA85, \uAC74\uBB3C\uBA85, \uC9C0\uBC88\uC73C\uB85C \uAC80\uC0C9\uD560 \uC218 \uC788\uC5B4\uC694.",
606
+ onCloseAutoFocus: (event) => {
607
+ if (selectedRef.current) {
608
+ event.preventDefault();
609
+ detailRef.current?.focus();
610
+ }
611
+ },
612
+ children: /* @__PURE__ */ jsx9(
613
+ SearchArea,
614
+ {
615
+ provider,
616
+ onSelect: handleSelect,
617
+ loadErrorText,
618
+ loadingText: m.addressLoading ?? "\uC8FC\uC18C \uAC80\uC0C9\uC744 \uBD88\uB7EC\uC624\uB294 \uC911"
619
+ }
620
+ )
548
621
  }
549
622
  )
550
- }
551
- )
552
- ] });
623
+ ]
624
+ }
625
+ );
553
626
  }
554
627
  );
555
628
 
556
629
  // src/components/AgreementGroup/AgreementGroup.tsx
557
- import { forwardRef as forwardRef9, useId as useId4, useState as useState2 } from "react";
630
+ import { forwardRef as forwardRef9, useId as useId4, useRef as useRef5, useState as useState2 } from "react";
558
631
  import { ChevronDownIcon as ChevronDownIcon2 } from "@bestow-ui/icons";
559
632
 
560
633
  // src/components/Checkbox/Checkbox.tsx
561
- import { forwardRef as forwardRef8, useEffect as useEffect2, useRef as useRef3 } from "react";
562
-
563
- // src/utils/mergeRefs.ts
564
- function mergeRefs(...refs) {
565
- return (value3) => {
566
- for (const ref of refs) {
567
- if (typeof ref === "function") ref(value3);
568
- else if (ref) ref.current = value3;
569
- }
570
- };
571
- }
634
+ import { forwardRef as forwardRef8, useEffect as useEffect3, useRef as useRef4 } from "react";
572
635
 
573
636
  // src/components/Checkbox/Checkbox.css.ts
574
637
  import { createRuntimeFn as _7a4684 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -581,8 +644,8 @@ var root4 = /* @__PURE__ */ _7a4684({ defaultClassName: "_1y7mzsn0", variantClas
581
644
  // src/components/Checkbox/Checkbox.tsx
582
645
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
583
646
  var Checkbox = /* @__PURE__ */ forwardRef8(function Checkbox2({ label: label6, size, indeterminate = false, invalid, disabled, onChange, onCheckedChange, className, ...rest }, ref) {
584
- const innerRef = useRef3(null);
585
- useEffect2(() => {
647
+ const innerRef = useRef4(null);
648
+ useEffect3(() => {
586
649
  if (innerRef.current) innerRef.current.indeterminate = indeterminate;
587
650
  }, [indeterminate]);
588
651
  return /* @__PURE__ */ jsxs9("label", { className: cx(root4({ size }), className), "data-disabled": disabled || void 0, children: [
@@ -665,6 +728,13 @@ var AgreementGroup = /* @__PURE__ */ forwardRef9(
665
728
  const [innerValue, setInnerValue] = useState2(defaultValue ?? []);
666
729
  const agreed = isControlled ? value3 ?? [] : innerValue;
667
730
  const [expanded, setExpanded] = useState2([]);
731
+ const rootRef = useRef5(null);
732
+ useFormReset(rootRef, () => {
733
+ if (isControlled) return;
734
+ const next = defaultValue ?? [];
735
+ setInnerValue(next);
736
+ if (next.join() !== agreed.join()) onValueChange?.(next);
737
+ });
668
738
  const update = (next) => {
669
739
  if (!isControlled) setInnerValue(next);
670
740
  onValueChange?.(next);
@@ -676,7 +746,7 @@ var AgreementGroup = /* @__PURE__ */ forwardRef9(
676
746
  return /* @__PURE__ */ jsxs10(
677
747
  "fieldset",
678
748
  {
679
- ref,
749
+ ref: mergeRefs(ref, rootRef),
680
750
  id,
681
751
  className: cx(fieldset2, className),
682
752
  disabled,
@@ -797,15 +867,15 @@ var Alert = /* @__PURE__ */ forwardRef10(function Alert2({
797
867
  });
798
868
 
799
869
  // src/components/AmountInput/AmountInput.tsx
800
- import { forwardRef as forwardRef11, useRef as useRef5 } from "react";
870
+ import { forwardRef as forwardRef11, useRef as useRef7 } from "react";
801
871
  import { formatKoreanAmount } from "@bestow-ui/korean-utils";
802
872
 
803
873
  // src/utils/useFormattedInput.ts
804
- import { useRef as useRef4, useState as useState3 } from "react";
874
+ import { useRef as useRef6, useState as useState3 } from "react";
805
875
 
806
876
  // src/utils/useIsomorphicLayoutEffect.ts
807
- import { useEffect as useEffect3, useLayoutEffect } from "react";
808
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect3;
877
+ import { useEffect as useEffect4, useLayoutEffect } from "react";
878
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect4;
809
879
 
810
880
  // src/utils/useFormattedInput.ts
811
881
  function caretAfter(display, count2, isMeaningful2) {
@@ -822,15 +892,16 @@ function useFormattedInput({
822
892
  value: value3,
823
893
  defaultValue,
824
894
  onValueChange,
825
- sanitize: sanitize4,
895
+ sanitize: sanitize3,
826
896
  format: format2,
827
897
  isMeaningful: isMeaningful2,
828
- inputRef
898
+ inputRef,
899
+ manualReset
829
900
  }) {
830
- const [innerValue, setInnerValue] = useState3(() => sanitize4(defaultValue ?? ""));
831
- const raw = isControlled ? sanitize4(value3 ?? "") : innerValue;
901
+ const [innerValue, setInnerValue] = useState3(() => sanitize3(defaultValue ?? ""));
902
+ const raw = isControlled ? sanitize3(value3 ?? "") : innerValue;
832
903
  const display = format2(raw);
833
- const pendingCaret = useRef4(null);
904
+ const pendingCaret = useRef6(null);
834
905
  useIsomorphicLayoutEffect(() => {
835
906
  const input6 = inputRef.current;
836
907
  if (pendingCaret.current === null || !input6 || document.activeElement !== input6) return;
@@ -838,6 +909,12 @@ function useFormattedInput({
838
909
  input6.setSelectionRange(position, position);
839
910
  pendingCaret.current = null;
840
911
  });
912
+ useFormReset(inputRef, () => {
913
+ if (isControlled || manualReset) return;
914
+ const next = sanitize3(defaultValue ?? "");
915
+ setInnerValue(next);
916
+ if (next !== innerValue) onValueChange?.(next);
917
+ });
841
918
  const commit = (next, caretCount) => {
842
919
  pendingCaret.current = caretCount;
843
920
  if (!isControlled) setInnerValue(next);
@@ -845,8 +922,8 @@ function useFormattedInput({
845
922
  };
846
923
  const onChange = (event) => {
847
924
  const { value: typed, selectionStart } = event.target;
848
- const next = sanitize4(typed);
849
- const before = sanitize4(typed.slice(0, selectionStart ?? typed.length));
925
+ const next = sanitize3(typed);
926
+ const before = sanitize3(typed.slice(0, selectionStart ?? typed.length));
850
927
  commit(next, Math.min(before.length, next.length));
851
928
  };
852
929
  const onKeyDown = (event) => {
@@ -866,7 +943,7 @@ function useFormattedInput({
866
943
  commit(raw.slice(0, index) + raw.slice(index + 1), index);
867
944
  }
868
945
  };
869
- const setRaw = (next) => setInnerValue(sanitize4(next));
946
+ const setRaw = (next) => setInnerValue(sanitize3(next));
870
947
  return { raw, display, onChange, onKeyDown, setRaw };
871
948
  }
872
949
 
@@ -874,7 +951,7 @@ function useFormattedInput({
874
951
  var input3 = "_70qkav0";
875
952
 
876
953
  // src/components/AmountInput/AmountInput.tsx
877
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
954
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
878
955
  var MAX_DIGITS = 15;
879
956
  var isDigit = (char) => /\d/.test(char);
880
957
  var AmountInput = /* @__PURE__ */ forwardRef11(
@@ -893,11 +970,11 @@ var AmountInput = /* @__PURE__ */ forwardRef11(
893
970
  className,
894
971
  ...rest
895
972
  } = props;
896
- const inputRef = useRef5(null);
973
+ const inputRef = useRef7(null);
897
974
  const m = useMessages();
898
975
  const unit2 = unitProp ?? m.currencyUnit ?? "\uC6D0";
899
976
  const label6 = labelProp ?? m.amount ?? "\uAE08\uC561";
900
- const sanitize4 = (input6) => {
977
+ const sanitize3 = (input6) => {
901
978
  let digits = input6.replace(/\D/g, "").replace(/^0+(?=\d)/, "").slice(0, MAX_DIGITS);
902
979
  if (max !== void 0 && digits && Number(digits) > max) digits = String(Math.floor(max));
903
980
  return digits;
@@ -908,7 +985,7 @@ var AmountInput = /* @__PURE__ */ forwardRef11(
908
985
  value: toRaw(value3),
909
986
  defaultValue: toRaw(defaultValue),
910
987
  onValueChange: (digits) => onValueChange?.(digits === "" ? null : Number(digits)),
911
- sanitize: sanitize4,
988
+ sanitize: sanitize3,
912
989
  format: (digits) => digits === "" ? "" : Number(digits).toLocaleString("ko-KR"),
913
990
  isMeaningful: isDigit,
914
991
  inputRef
@@ -928,7 +1005,7 @@ var AmountInput = /* @__PURE__ */ forwardRef11(
928
1005
  onKeyDown?.(event);
929
1006
  },
930
1007
  endAdornment: unit2,
931
- helperText: reading && helperText3 ? /* @__PURE__ */ jsxs12(Fragment2, { children: [
1008
+ helperText: reading && helperText3 ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
932
1009
  reading,
933
1010
  /* @__PURE__ */ jsx13("br", {}),
934
1011
  helperText3
@@ -983,7 +1060,7 @@ var externalIcon = "_1t4hlp6";
983
1060
  var link = /* @__PURE__ */ _7a4687({ defaultClassName: "_1t4hlp0", variantClassNames: { color: { primary: "_1t4hlp1", neutral: "_1t4hlp2", inherit: "_1t4hlp3" }, underline: { always: "_1t4hlp4", hover: "_1t4hlp5" } }, defaultVariants: { color: "primary", underline: "always" }, compoundVariants: [] });
984
1061
 
985
1062
  // src/components/Link/Link.tsx
986
- import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1063
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
987
1064
  var Link = /* @__PURE__ */ forwardRef13(function Link2({
988
1065
  as: Component = "a",
989
1066
  asChild,
@@ -1016,7 +1093,7 @@ var Link = /* @__PURE__ */ forwardRef13(function Link2({
1016
1093
  ...rest,
1017
1094
  children: [
1018
1095
  children,
1019
- external && /* @__PURE__ */ jsxs14(Fragment3, { children: [
1096
+ external && /* @__PURE__ */ jsxs14(Fragment4, { children: [
1020
1097
  " ",
1021
1098
  /* @__PURE__ */ jsx15(ExternalLinkIcon, { className: externalIcon }),
1022
1099
  /* @__PURE__ */ jsx15("span", { className: visuallyHidden, children: externalLabel })
@@ -1049,15 +1126,15 @@ var Breadcrumb = /* @__PURE__ */ forwardRef14(function Breadcrumb2({ items: item
1049
1126
  });
1050
1127
 
1051
1128
  // src/components/BusinessNumberInput/BusinessNumberInput.tsx
1052
- import { forwardRef as forwardRef15, useRef as useRef6, useState as useState5 } from "react";
1129
+ import { forwardRef as forwardRef15, useRef as useRef8, useState as useState5 } from "react";
1053
1130
  import { formatBusinessNumber, isValidBusinessNumber } from "@bestow-ui/korean-utils";
1054
1131
 
1055
1132
  // src/utils/useDelayedAnnouncement.ts
1056
- import { useEffect as useEffect4, useState as useState4 } from "react";
1133
+ import { useEffect as useEffect5, useState as useState4 } from "react";
1057
1134
  var ANNOUNCE_DELAY = 800;
1058
1135
  function useDelayedAnnouncement(message, delay = ANNOUNCE_DELAY) {
1059
1136
  const [announced, setAnnounced] = useState4("");
1060
- useEffect4(() => {
1137
+ useEffect5(() => {
1061
1138
  const timer2 = setTimeout(() => setAnnounced(message), message ? delay : 0);
1062
1139
  return () => clearTimeout(timer2);
1063
1140
  }, [message, delay]);
@@ -1065,7 +1142,7 @@ function useDelayedAnnouncement(message, delay = ANNOUNCE_DELAY) {
1065
1142
  }
1066
1143
 
1067
1144
  // src/components/BusinessNumberInput/BusinessNumberInput.tsx
1068
- import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1145
+ import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1069
1146
  var sanitize = (input6) => input6.replace(/\D/g, "").slice(0, 10);
1070
1147
  var isDigit2 = (char) => /\d/.test(char);
1071
1148
  var BusinessNumberInput = /* @__PURE__ */ forwardRef15(
@@ -1084,12 +1161,13 @@ var BusinessNumberInput = /* @__PURE__ */ forwardRef15(
1084
1161
  onKeyDown,
1085
1162
  ...rest
1086
1163
  } = props;
1087
- const inputRef = useRef6(null);
1164
+ const inputRef = useRef8(null);
1088
1165
  const m = useMessages();
1089
1166
  const invalidText = invalidTextProp ?? m.businessNumberInvalid ?? "\uC62C\uBC14\uB978 \uC0AC\uC5C5\uC790\uB4F1\uB85D\uBC88\uD638\uAC00 \uC544\uB2C8\uC5D0\uC694. \uBC88\uD638\uB97C \uB2E4\uC2DC \uD655\uC778\uD574 \uC8FC\uC138\uC694.";
1090
1167
  const label6 = labelProp ?? m.businessNumber ?? "\uC0AC\uC5C5\uC790\uB4F1\uB85D\uBC88\uD638";
1091
1168
  const incompleteText = m.businessNumberIncomplete ?? "10\uC790\uB9AC\uB97C \uBAA8\uB450 \uC785\uB825\uD574 \uC8FC\uC138\uC694.";
1092
1169
  const [touched, setTouched] = useState5(false);
1170
+ useFormReset(inputRef, () => setTouched(false));
1093
1171
  const field4 = useFormattedInput({
1094
1172
  isControlled: "value" in props,
1095
1173
  value: value3,
@@ -1104,7 +1182,7 @@ var BusinessNumberInput = /* @__PURE__ */ forwardRef15(
1104
1182
  const autoInvalid = validate && field4.raw.length > 0 && (complete ? !isValidBusinessNumber(field4.raw) : touched);
1105
1183
  const showAuto = autoInvalid && error === void 0;
1106
1184
  const announcement = useDelayedAnnouncement(showAuto && complete ? invalidText : "");
1107
- return /* @__PURE__ */ jsxs16(Fragment4, { children: [
1185
+ return /* @__PURE__ */ jsxs16(Fragment5, { children: [
1108
1186
  /* @__PURE__ */ jsx17(
1109
1187
  TextField,
1110
1188
  {
@@ -1133,7 +1211,7 @@ var BusinessNumberInput = /* @__PURE__ */ forwardRef15(
1133
1211
  );
1134
1212
 
1135
1213
  // src/components/Calendar/Calendar.tsx
1136
- import { forwardRef as forwardRef17, useEffect as useEffect5, useId as useId5, useRef as useRef7, useState as useState6 } from "react";
1214
+ import { forwardRef as forwardRef17, useEffect as useEffect6, useId as useId5, useRef as useRef9, useState as useState6 } from "react";
1137
1215
  import { ChevronLeftIcon, ChevronRightIcon as ChevronRightIcon2 } from "@bestow-ui/icons";
1138
1216
  import { KOREAN_WEEKDAYS } from "@bestow-ui/korean-utils";
1139
1217
 
@@ -1150,7 +1228,7 @@ function useIsClient() {
1150
1228
  }
1151
1229
 
1152
1230
  // src/components/IconButton/IconButton.tsx
1153
- import { forwardRef as forwardRef16 } from "react";
1231
+ import { cloneElement as cloneElement2, forwardRef as forwardRef16 } from "react";
1154
1232
 
1155
1233
  // src/components/IconButton/IconButton.css.ts
1156
1234
  import { createRuntimeFn as _7a4688 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -1158,7 +1236,7 @@ var iconButton = /* @__PURE__ */ _7a4688({ defaultClassName: "ip9et20", variantC
1158
1236
 
1159
1237
  // src/components/IconButton/IconButton.tsx
1160
1238
  import { jsx as jsx18 } from "react/jsx-runtime";
1161
- var IconButton = /* @__PURE__ */ forwardRef16(function IconButton2({ variant = "ghost", color = "neutral", size, loading, className, children, ...rest }, ref) {
1239
+ var IconButton = /* @__PURE__ */ forwardRef16(function IconButton2({ variant = "ghost", color = "neutral", size, loading, asChild, className, children, ...rest }, ref) {
1162
1240
  return /* @__PURE__ */ jsx18(
1163
1241
  Button,
1164
1242
  {
@@ -1167,9 +1245,10 @@ var IconButton = /* @__PURE__ */ forwardRef16(function IconButton2({ variant = "
1167
1245
  color,
1168
1246
  size,
1169
1247
  loading,
1248
+ asChild,
1170
1249
  className: cx(iconButton({ size }), className),
1171
1250
  ...rest,
1172
- children: !loading && children
1251
+ children: loading ? asChild && cloneElement2(children, void 0, null) : children
1173
1252
  }
1174
1253
  );
1175
1254
  });
@@ -1206,7 +1285,7 @@ var Calendar = /* @__PURE__ */ forwardRef17(function Calendar2(props, ref) {
1206
1285
  const weekdaysShort = m.weekdaysShort ?? KOREAN_WEEKDAYS;
1207
1286
  const weekdaysLong = m.weekdaysLong ?? KOREAN_WEEKDAYS.map((name) => `${name}\uC694\uC77C`);
1208
1287
  const headingId = useId5();
1209
- const gridRef = useRef7(null);
1288
+ const gridRef = useRef9(null);
1210
1289
  const isControlled = "value" in props;
1211
1290
  const [innerValue, setInnerValue] = useState6(defaultValue ?? "");
1212
1291
  const selected = parseISODate(isControlled ? value3 : innerValue);
@@ -1223,13 +1302,13 @@ var Calendar = /* @__PURE__ */ forwardRef17(function Calendar2(props, ref) {
1223
1302
  const [focusedState, setFocused] = useState6(null);
1224
1303
  const base = selected ?? today;
1225
1304
  const focused = focusedState ?? (base ? clamp(base) : null);
1226
- const moveFocus = useRef7(initialFocus ?? false);
1305
+ const moveFocus = useRef9(initialFocus ?? false);
1227
1306
  const selectedIso = selected ? toISODate(selected) : "";
1228
- useEffect5(() => {
1307
+ useEffect6(() => {
1229
1308
  const date = parseISODate(selectedIso);
1230
1309
  if (date) setFocused((prev) => isSameDay(prev, date) ? prev : date);
1231
1310
  }, [selectedIso]);
1232
- useEffect5(() => {
1311
+ useEffect6(() => {
1233
1312
  if (!moveFocus.current || !focused) return;
1234
1313
  moveFocus.current = false;
1235
1314
  gridRef.current?.querySelector(`[data-date="${toISODate(focused)}"]`)?.focus();
@@ -1332,7 +1411,7 @@ var Calendar = /* @__PURE__ */ forwardRef17(function Calendar2(props, ref) {
1332
1411
  });
1333
1412
 
1334
1413
  // src/components/CheckboxGroup/CheckboxGroup.tsx
1335
- import { forwardRef as forwardRef18, useId as useId6, useState as useState7 } from "react";
1414
+ import { forwardRef as forwardRef18, useId as useId6, useRef as useRef10, useState as useState7 } from "react";
1336
1415
 
1337
1416
  // src/components/CheckboxGroup/CheckboxGroup.css.ts
1338
1417
  import { createRuntimeFn as _7a4689 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -1342,7 +1421,7 @@ var items = /* @__PURE__ */ _7a4689({ defaultClassName: "_1z0r6xj1", variantClas
1342
1421
  var option = "_1z0r6xj4";
1343
1422
 
1344
1423
  // src/components/CheckboxGroup/CheckboxGroup.tsx
1345
- import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
1424
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
1346
1425
  var CheckboxGroup = /* @__PURE__ */ forwardRef18(
1347
1426
  function CheckboxGroup2(props, ref) {
1348
1427
  const {
@@ -1370,6 +1449,13 @@ var CheckboxGroup = /* @__PURE__ */ forwardRef18(
1370
1449
  const baseId = id ?? generatedId;
1371
1450
  const labelId = label6 ? `${baseId}-label` : void 0;
1372
1451
  const helperId = helperText3 ? `${baseId}-helper` : void 0;
1452
+ const rootRef = useRef10(null);
1453
+ useFormReset(rootRef, () => {
1454
+ if (isControlled) return;
1455
+ const next = defaultValue ?? [];
1456
+ setInnerValue(next);
1457
+ if (next.join() !== current2.join()) onValueChange?.(next);
1458
+ });
1373
1459
  const toggle3 = (optionValue, checked) => {
1374
1460
  const next = options.map((option3) => option3.value).filter((v) => v === optionValue ? checked : current2.includes(v));
1375
1461
  if (!isControlled) setInnerValue(next);
@@ -1378,7 +1464,7 @@ var CheckboxGroup = /* @__PURE__ */ forwardRef18(
1378
1464
  return /* @__PURE__ */ jsxs18("div", { className: cx(field, className), children: [
1379
1465
  label6 && /* @__PURE__ */ jsxs18("span", { id: labelId, className: cx(label, groupLabel), children: [
1380
1466
  label6,
1381
- required && /* @__PURE__ */ jsxs18(Fragment5, { children: [
1467
+ required && /* @__PURE__ */ jsxs18(Fragment6, { children: [
1382
1468
  /* @__PURE__ */ jsx20("span", { className: requiredMark, "aria-hidden": true, children: "*" }),
1383
1469
  " ",
1384
1470
  /* @__PURE__ */ jsxs18("span", { className: visuallyHidden, children: [
@@ -1391,7 +1477,7 @@ var CheckboxGroup = /* @__PURE__ */ forwardRef18(
1391
1477
  /* @__PURE__ */ jsx20(
1392
1478
  "div",
1393
1479
  {
1394
- ref,
1480
+ ref: mergeRefs(ref, rootRef),
1395
1481
  id: baseId,
1396
1482
  role: "group",
1397
1483
  "aria-label": ariaLabel,
@@ -1431,10 +1517,10 @@ var CheckboxGroup = /* @__PURE__ */ forwardRef18(
1431
1517
  import * as Popover from "@radix-ui/react-popover";
1432
1518
  import {
1433
1519
  forwardRef as forwardRef19,
1434
- useEffect as useEffect6,
1520
+ useEffect as useEffect7,
1435
1521
  useId as useId7,
1436
1522
  useMemo as useMemo3,
1437
- useRef as useRef8,
1523
+ useRef as useRef11,
1438
1524
  useState as useState8
1439
1525
  } from "react";
1440
1526
  import { CheckIcon, ChevronDownIcon as ChevronDownIcon3, XIcon as XIcon3 } from "@bestow-ui/icons";
@@ -1492,8 +1578,8 @@ var Combobox = /* @__PURE__ */ forwardRef19(function Combobox2(props, ref) {
1492
1578
  const helperId = helperText3 ? `${inputId}-helper` : void 0;
1493
1579
  const optionId = (index) => `${inputId}-option-${index}`;
1494
1580
  const portal2 = usePortalProps();
1495
- const inputRef = useRef8(null);
1496
- const anchorRef = useRef8(null);
1581
+ const inputRef = useRef11(null);
1582
+ const anchorRef = useRef11(null);
1497
1583
  const isControlled = "value" in props;
1498
1584
  const [innerValue, setInnerValue] = useState8(defaultValue);
1499
1585
  const selectedValue = isControlled ? value3 : innerValue;
@@ -1519,6 +1605,12 @@ var Combobox = /* @__PURE__ */ forwardRef19(function Combobox2(props, ref) {
1519
1605
  setQuery(null);
1520
1606
  setActiveIndex(-1);
1521
1607
  };
1608
+ useFormReset(inputRef, () => {
1609
+ reset();
1610
+ if (isControlled) return;
1611
+ setInnerValue(defaultValue);
1612
+ if (defaultValue !== selectedValue) onValueChange?.(defaultValue ?? "");
1613
+ });
1522
1614
  const clearSelection = () => {
1523
1615
  if (!isControlled) setInnerValue(void 0);
1524
1616
  if (selectedValue) onValueChange?.("");
@@ -1546,6 +1638,7 @@ var Combobox = /* @__PURE__ */ forwardRef19(function Combobox2(props, ref) {
1546
1638
  setActiveIndex(nextQuery ? firstEnabled(nextList) : -1);
1547
1639
  };
1548
1640
  const handleKeyDown = (event) => {
1641
+ if (event.nativeEvent.isComposing || event.keyCode === 229) return;
1549
1642
  switch (event.key) {
1550
1643
  case "ArrowDown":
1551
1644
  event.preventDefault();
@@ -1576,14 +1669,14 @@ var Combobox = /* @__PURE__ */ forwardRef19(function Combobox2(props, ref) {
1576
1669
  break;
1577
1670
  }
1578
1671
  };
1579
- useEffect6(() => {
1672
+ useEffect7(() => {
1580
1673
  if (!open || activeIndex < 0) return;
1581
1674
  document.getElementById(optionId(activeIndex))?.scrollIntoView?.({ block: "nearest" });
1582
1675
  }, [open, activeIndex]);
1583
1676
  const hasOptions = filtered.length > 0;
1584
1677
  const noResults = open && !disabled && !hasOptions;
1585
1678
  const [announcedFor, setAnnouncedFor] = useState8(void 0);
1586
- useEffect6(() => {
1679
+ useEffect7(() => {
1587
1680
  if (!noResults) return;
1588
1681
  const timer2 = setTimeout(() => setAnnouncedFor(query2), ANNOUNCE_DELAY);
1589
1682
  return () => clearTimeout(timer2);
@@ -1732,7 +1825,7 @@ var Combobox = /* @__PURE__ */ forwardRef19(function Combobox2(props, ref) {
1732
1825
  });
1733
1826
 
1734
1827
  // src/components/DatePicker/DatePicker.tsx
1735
- import { forwardRef as forwardRef20, useEffect as useEffect7, useRef as useRef9, useState as useState9 } from "react";
1828
+ import { forwardRef as forwardRef20, useEffect as useEffect8, useRef as useRef12, useState as useState9 } from "react";
1736
1829
  import { CalendarIcon } from "@bestow-ui/icons";
1737
1830
 
1738
1831
  // src/components/Popover/Popover.tsx
@@ -1798,7 +1891,7 @@ function Popover2({
1798
1891
  var PopoverClose = RadixPopover.Close;
1799
1892
 
1800
1893
  // src/components/DatePicker/DatePicker.tsx
1801
- import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
1894
+ import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
1802
1895
  var sanitize2 = (input6) => input6.replace(/\D/g, "").slice(0, 8);
1803
1896
  var format = (digits) => digits.length <= 4 ? digits : digits.length <= 6 ? `${digits.slice(0, 4)}-${digits.slice(4)}` : `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
1804
1897
  var isDigit3 = (char) => /\d/.test(char);
@@ -1828,7 +1921,7 @@ var DatePicker = /* @__PURE__ */ forwardRef20(
1828
1921
  id,
1829
1922
  className
1830
1923
  } = props;
1831
- const inputRef = useRef9(null);
1924
+ const inputRef = useRef12(null);
1832
1925
  const m = useMessages();
1833
1926
  const label6 = labelProp ?? m.date ?? "\uB0A0\uC9DC";
1834
1927
  const calendarLabel = calendarLabelProp ?? m.openCalendar ?? "\uB2EC\uB825 \uC5F4\uAE30";
@@ -1838,7 +1931,7 @@ var DatePicker = /* @__PURE__ */ forwardRef20(
1838
1931
  const [open, setOpen] = useState9(false);
1839
1932
  const [touched, setTouched] = useState9(false);
1840
1933
  const isControlled = "value" in props;
1841
- const lastEmitted = useRef9(isControlled ? value3 ?? "" : defaultValue ?? "");
1934
+ const lastEmitted = useRef12(isControlled ? value3 ?? "" : defaultValue ?? "");
1842
1935
  const minDate = parseISODate(min);
1843
1936
  const maxDate = parseISODate(max);
1844
1937
  const toIso = (digits) => digits.length === 8 ? `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}` : "";
@@ -1859,11 +1952,12 @@ var DatePicker = /* @__PURE__ */ forwardRef20(
1859
1952
  sanitize: sanitize2,
1860
1953
  format,
1861
1954
  isMeaningful: isDigit3,
1862
- inputRef
1955
+ inputRef,
1956
+ manualReset: true
1863
1957
  });
1864
1958
  const textIso = toIso(field4.raw);
1865
1959
  const { setRaw } = field4;
1866
- useEffect7(() => {
1960
+ useEffect8(() => {
1867
1961
  if (!isControlled) return;
1868
1962
  const next = value3 ?? "";
1869
1963
  lastEmitted.current = next;
@@ -1873,13 +1967,19 @@ var DatePicker = /* @__PURE__ */ forwardRef20(
1873
1967
  if (next === "" && !textIsValid) return;
1874
1968
  setRaw(next.replace(/\D/g, ""));
1875
1969
  }, [value3]);
1970
+ useFormReset(inputRef, () => {
1971
+ setTouched(false);
1972
+ const next = (isControlled ? value3 : defaultValue) ?? "";
1973
+ setRaw(next.replace(/\D/g, ""));
1974
+ if (!isControlled) emit(next);
1975
+ });
1876
1976
  const date = parseISODate(textIso);
1877
1977
  const complete = field4.raw.length === 8;
1878
1978
  const autoError = complete ? !date ? invalidText : isUnavailable(date) ? unavailableText : null : touched && field4.raw.length > 0 ? incompleteText : null;
1879
1979
  const showAuto = autoError !== null && error === void 0;
1880
1980
  const announcement = useDelayedAnnouncement(showAuto && complete ? autoError ?? "" : "");
1881
1981
  const selectedIso = date && !isUnavailable(date) ? textIso : "";
1882
- return /* @__PURE__ */ jsxs21(Fragment6, { children: [
1982
+ return /* @__PURE__ */ jsxs21(Fragment7, { children: [
1883
1983
  /* @__PURE__ */ jsx23(
1884
1984
  TextField,
1885
1985
  {
@@ -1937,7 +2037,7 @@ var DatePicker = /* @__PURE__ */ forwardRef20(
1937
2037
  );
1938
2038
 
1939
2039
  // src/components/DateRangePicker/DateRangePicker.tsx
1940
- import { forwardRef as forwardRef21, useId as useId9, useState as useState10 } from "react";
2040
+ import { forwardRef as forwardRef21, useId as useId9, useRef as useRef13, useState as useState10 } from "react";
1941
2041
 
1942
2042
  // src/components/DateRangePicker/DateRangePicker.css.ts
1943
2043
  var field2 = "_17277dh3";
@@ -1986,6 +2086,10 @@ var DateRangePicker = /* @__PURE__ */ forwardRef21(
1986
2086
  if (!isControlled) setInner(next);
1987
2087
  onValueChange?.(next);
1988
2088
  };
2089
+ const rootRef = useRef13(null);
2090
+ useFormReset(rootRef, () => {
2091
+ if (!isControlled) update(defaultValue ?? { start: "", end: "" });
2092
+ });
1989
2093
  const todayIso = () => today ?? toISODate(/* @__PURE__ */ new Date());
1990
2094
  const startLabel = startLabelProp ?? m.dateRangeStart ?? "\uC2DC\uC791\uC77C";
1991
2095
  const endLabel = endLabelProp ?? m.dateRangeEnd ?? "\uC885\uB8CC\uC77C";
@@ -1993,7 +2097,7 @@ var DateRangePicker = /* @__PURE__ */ forwardRef21(
1993
2097
  return /* @__PURE__ */ jsxs22(
1994
2098
  "fieldset",
1995
2099
  {
1996
- ref,
2100
+ ref: mergeRefs(ref, rootRef),
1997
2101
  id,
1998
2102
  className: cx(fieldset3, className),
1999
2103
  "aria-describedby": helperId,
@@ -2128,7 +2232,7 @@ function Drawer({
2128
2232
  var DrawerClose = Dialog2.Close;
2129
2233
 
2130
2234
  // src/components/ErrorSummary/ErrorSummary.tsx
2131
- import { forwardRef as forwardRef22, useEffect as useEffect8, useId as useId10, useRef as useRef10 } from "react";
2235
+ import { forwardRef as forwardRef22, useEffect as useEffect9, useId as useId10, useRef as useRef14 } from "react";
2132
2236
 
2133
2237
  // src/components/ErrorSummary/ErrorSummary.css.ts
2134
2238
  var link3 = "_1cdophv2";
@@ -2140,9 +2244,9 @@ import { jsx as jsx26 } from "react/jsx-runtime";
2140
2244
  var ErrorSummary = /* @__PURE__ */ forwardRef22(function ErrorSummary2({ errors: errors2, title: title6, focusKey, className, ...rest }, ref) {
2141
2245
  const m = useMessages();
2142
2246
  const titleId = useId10();
2143
- const rootRef = useRef10(null);
2247
+ const rootRef = useRef14(null);
2144
2248
  const hasErrors = errors2.length > 0;
2145
- useEffect8(() => {
2249
+ useEffect9(() => {
2146
2250
  if (hasErrors) rootRef.current?.focus();
2147
2251
  }, [focusKey, hasErrors]);
2148
2252
  if (!hasErrors) return null;
@@ -2177,9 +2281,20 @@ var ErrorSummary = /* @__PURE__ */ forwardRef22(function ErrorSummary2({ errors:
2177
2281
  });
2178
2282
 
2179
2283
  // src/components/FileUpload/FileUpload.tsx
2180
- import { forwardRef as forwardRef23, useEffect as useEffect9, useId as useId11, useRef as useRef11, useState as useState11 } from "react";
2284
+ import { forwardRef as forwardRef23, useEffect as useEffect10, useId as useId11, useRef as useRef15, useState as useState11 } from "react";
2181
2285
  import { FileIcon, UploadIcon, XIcon as XIcon6 } from "@bestow-ui/icons";
2182
2286
 
2287
+ // src/utils/useFieldsetDisabled.ts
2288
+ import { useSyncExternalStore as useSyncExternalStore3 } from "react";
2289
+ var noSubscribe = () => () => void 0;
2290
+ function useFieldsetDisabled(ref) {
2291
+ return useSyncExternalStore3(
2292
+ noSubscribe,
2293
+ () => !!ref.current?.matches("fieldset:disabled *"),
2294
+ () => false
2295
+ );
2296
+ }
2297
+
2183
2298
  // src/components/FileUpload/FileUpload.css.ts
2184
2299
  var dropHint = "r2jefr3";
2185
2300
  var dropIcon = "r2jefr2";
@@ -2224,12 +2339,15 @@ var FileUpload = /* @__PURE__ */ forwardRef23(function FileUpload2(props, ref) {
2224
2339
  helperText: helperText3,
2225
2340
  error,
2226
2341
  required,
2227
- disabled,
2342
+ disabled: disabledProp,
2228
2343
  name,
2229
2344
  id,
2230
2345
  className
2231
2346
  } = props;
2232
2347
  const m = useMessages();
2348
+ const rootRef = useRef15(null);
2349
+ const fieldsetDisabled = useFieldsetDisabled(rootRef);
2350
+ const disabled = disabledProp || fieldsetDisabled;
2233
2351
  const isControlled = "value" in props;
2234
2352
  const [innerFiles, setInnerFiles] = useState11(defaultValue ?? []);
2235
2353
  const files = isControlled ? value3 ?? NO_FILES : innerFiles;
@@ -2241,12 +2359,12 @@ var FileUpload = /* @__PURE__ */ forwardRef23(function FileUpload2(props, ref) {
2241
2359
  const labelId = label6 ? `${baseId}-label` : void 0;
2242
2360
  const helperId = helperText3 ? `${baseId}-helper` : void 0;
2243
2361
  const errorsId = rejections.length > 0 ? `${baseId}-errors` : void 0;
2244
- const inputRef = useRef11(null);
2245
- const selectButtonRef = useRef11(null);
2246
- const removeButtonRefs = useRef11([]);
2247
- const focusAfterRemove = useRef11(null);
2248
- const announceTimer = useRef11(void 0);
2249
- useEffect9(() => () => clearTimeout(announceTimer.current), []);
2362
+ const inputRef = useRef15(null);
2363
+ const selectButtonRef = useRef15(null);
2364
+ const removeButtonRefs = useRef15([]);
2365
+ const focusAfterRemove = useRef15(null);
2366
+ const announceTimer = useRef15(void 0);
2367
+ useEffect10(() => () => clearTimeout(announceTimer.current), []);
2250
2368
  const selectLabel = m.fileSelect ?? "\uD30C\uC77C \uC120\uD0DD";
2251
2369
  const reasonText = (rejection) => {
2252
2370
  const fileName2 = rejection.file.name;
@@ -2294,13 +2412,13 @@ var FileUpload = /* @__PURE__ */ forwardRef23(function FileUpload2(props, ref) {
2294
2412
  setRejections([]);
2295
2413
  commit(next, m.fileRemoved?.(removed.name) ?? `${removed.name} \uC0AD\uC81C\uB428`, REMOVED_ANNOUNCE_DELAY);
2296
2414
  };
2297
- useEffect9(() => {
2415
+ useEffect10(() => {
2298
2416
  if (focusAfterRemove.current === null) return;
2299
2417
  const target = focusAfterRemove.current;
2300
2418
  focusAfterRemove.current = null;
2301
2419
  (target >= 0 ? removeButtonRefs.current[target] : selectButtonRef.current)?.focus();
2302
2420
  }, [files]);
2303
- useEffect9(() => {
2421
+ useEffect10(() => {
2304
2422
  const input6 = inputRef.current;
2305
2423
  if (!name || !input6 || typeof DataTransfer === "undefined") return;
2306
2424
  try {
@@ -2310,12 +2428,20 @@ var FileUpload = /* @__PURE__ */ forwardRef23(function FileUpload2(props, ref) {
2310
2428
  } catch {
2311
2429
  }
2312
2430
  }, [files, name]);
2431
+ useFormReset(rootRef, () => {
2432
+ setRejections([]);
2433
+ announce("");
2434
+ if (isControlled) return;
2435
+ const next = defaultValue ?? [];
2436
+ setInnerFiles(next);
2437
+ if (next.length !== files.length) onValueChange?.(next);
2438
+ });
2313
2439
  const onDrag = (event, over) => {
2314
2440
  if (disabled) return;
2315
2441
  event.preventDefault();
2316
2442
  setDragging(over);
2317
2443
  };
2318
- return /* @__PURE__ */ jsxs24("div", { ref, className: cx(field, root8, className), children: [
2444
+ return /* @__PURE__ */ jsxs24("div", { ref: mergeRefs(ref, rootRef), className: cx(field, root8, className), children: [
2319
2445
  label6 && /* @__PURE__ */ jsxs24("span", { id: labelId, className: label, children: [
2320
2446
  label6,
2321
2447
  required && /* @__PURE__ */ jsx27("span", { className: requiredMark, "aria-hidden": true, children: "*" })
@@ -2510,7 +2636,7 @@ var DropdownMenuSubContent = /* @__PURE__ */ forwardRef24(
2510
2636
  );
2511
2637
 
2512
2638
  // src/components/NumberInput/NumberInput.tsx
2513
- import { forwardRef as forwardRef25, useEffect as useEffect10, useId as useId12, useRef as useRef12, useState as useState12 } from "react";
2639
+ import { forwardRef as forwardRef25, useEffect as useEffect11, useId as useId12, useRef as useRef16, useState as useState12 } from "react";
2514
2640
  import { MinusIcon as MinusIcon2, PlusIcon } from "@bestow-ui/icons";
2515
2641
 
2516
2642
  // src/components/NumberInput/NumberInput.css.ts
@@ -2521,7 +2647,7 @@ var stepper = /* @__PURE__ */ _7a46811({ defaultClassName: "_1vq2qhv3", variantC
2521
2647
  var unit = "_1vq2qhv2";
2522
2648
 
2523
2649
  // src/components/NumberInput/NumberInput.tsx
2524
- import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
2650
+ import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
2525
2651
  var MAX_DIGITS2 = 15;
2526
2652
  var isMeaningful = (char) => /[\d.-]/.test(char);
2527
2653
  var decimalsOf = (n) => Number.isFinite(n) ? String(n).split(".")[1]?.length ?? 0 : 0;
@@ -2552,7 +2678,7 @@ var NumberInput = /* @__PURE__ */ forwardRef25(
2552
2678
  } = props;
2553
2679
  const isControlled = "value" in props;
2554
2680
  const m = useMessages();
2555
- const inputRef = useRef12(null);
2681
+ const inputRef = useRef16(null);
2556
2682
  const generatedId = useId12();
2557
2683
  const inputId = id ?? generatedId;
2558
2684
  const precision = Math.max(0, precisionProp ?? decimalsOf(step2));
@@ -2560,7 +2686,7 @@ var NumberInput = /* @__PURE__ */ forwardRef25(
2560
2686
  const round = (n) => Number(n.toFixed(precision));
2561
2687
  const clamp = (n) => Math.min(max ?? Infinity, Math.max(min ?? -Infinity, round(n)));
2562
2688
  const toRaw = (n) => n === null || n === void 0 || !Number.isFinite(n) ? "" : String(round(n));
2563
- const sanitize4 = (input6) => {
2689
+ const sanitize3 = (input6) => {
2564
2690
  const negative = allowNegative && input6.trimStart().startsWith("-");
2565
2691
  const [intPart = "", ...fracParts] = input6.replace(/[^\d.]/g, "").split(".");
2566
2692
  const int = intPart.replace(/^0+(?=\d)/, "").slice(0, MAX_DIGITS2);
@@ -2573,7 +2699,7 @@ var NumberInput = /* @__PURE__ */ forwardRef25(
2573
2699
  const [, sign = "", int = "", rest2 = ""] = raw.match(/^(-?)(\d*)(.*)$/) ?? [];
2574
2700
  return `${sign}${int ? Number(int).toLocaleString("ko-KR") : ""}${rest2}`;
2575
2701
  };
2576
- const lastEmitted = useRef12(parse(toRaw(isControlled ? value3 : defaultValue)));
2702
+ const lastEmitted = useRef16(parse(toRaw(isControlled ? value3 : defaultValue)));
2577
2703
  const emit = (next) => {
2578
2704
  if (next === lastEmitted.current) return;
2579
2705
  lastEmitted.current = next;
@@ -2584,18 +2710,24 @@ var NumberInput = /* @__PURE__ */ forwardRef25(
2584
2710
  value: void 0,
2585
2711
  defaultValue: toRaw(isControlled ? value3 : defaultValue),
2586
2712
  onValueChange: (raw) => emit(parse(raw)),
2587
- sanitize: sanitize4,
2713
+ sanitize: sanitize3,
2588
2714
  format: format2,
2589
2715
  isMeaningful,
2590
- inputRef
2716
+ inputRef,
2717
+ manualReset: true
2591
2718
  });
2592
2719
  const { setRaw } = field4;
2593
- useEffect10(() => {
2720
+ useEffect11(() => {
2594
2721
  if (!isControlled) return;
2595
2722
  const next = value3 ?? null;
2596
2723
  lastEmitted.current = next;
2597
2724
  if (parse(field4.raw) !== next) setRaw(toRaw(next));
2598
2725
  }, [value3]);
2726
+ useFormReset(inputRef, () => {
2727
+ const next = toRaw(isControlled ? value3 : defaultValue);
2728
+ setRaw(next);
2729
+ if (!isControlled) emit(parse(next));
2730
+ });
2599
2731
  const current2 = parse(field4.raw);
2600
2732
  const valueText = (n) => `${format2(toRaw(n))}${unit2 ?? ""}`;
2601
2733
  const [announcement, setAnnouncement] = useState12("");
@@ -2646,7 +2778,7 @@ var NumberInput = /* @__PURE__ */ forwardRef25(
2646
2778
  children: direction < 0 ? /* @__PURE__ */ jsx29(MinusIcon2, {}) : /* @__PURE__ */ jsx29(PlusIcon, {})
2647
2779
  }
2648
2780
  );
2649
- return /* @__PURE__ */ jsxs26(Fragment7, { children: [
2781
+ return /* @__PURE__ */ jsxs26(Fragment8, { children: [
2650
2782
  /* @__PURE__ */ jsx29(
2651
2783
  TextField,
2652
2784
  {
@@ -2790,13 +2922,9 @@ var Pagination = /* @__PURE__ */ forwardRef26(function Pagination2({
2790
2922
  });
2791
2923
 
2792
2924
  // src/components/PhoneNumberInput/PhoneNumberInput.tsx
2793
- import { forwardRef as forwardRef27, useRef as useRef13 } from "react";
2794
- import { formatPhoneNumber, phoneNumberMaxDigits } from "@bestow-ui/korean-utils";
2925
+ import { forwardRef as forwardRef27, useRef as useRef17 } from "react";
2926
+ import { formatPhoneNumber, phoneNumberDigits } from "@bestow-ui/korean-utils";
2795
2927
  import { jsx as jsx31 } from "react/jsx-runtime";
2796
- var sanitize3 = (input6) => {
2797
- const digits = input6.replace(/\D/g, "");
2798
- return digits.slice(0, phoneNumberMaxDigits(digits));
2799
- };
2800
2928
  var isDigit4 = (char) => /\d/.test(char);
2801
2929
  var PhoneNumberInput = /* @__PURE__ */ forwardRef27(
2802
2930
  function PhoneNumberInput2(props, ref) {
@@ -2809,7 +2937,7 @@ var PhoneNumberInput = /* @__PURE__ */ forwardRef27(
2809
2937
  onKeyDown,
2810
2938
  ...rest
2811
2939
  } = props;
2812
- const inputRef = useRef13(null);
2940
+ const inputRef = useRef17(null);
2813
2941
  const m = useMessages();
2814
2942
  const label6 = labelProp ?? m.phoneNumber ?? "\uD734\uB300\uD3F0 \uBC88\uD638";
2815
2943
  const field4 = useFormattedInput({
@@ -2817,7 +2945,7 @@ var PhoneNumberInput = /* @__PURE__ */ forwardRef27(
2817
2945
  value: value3,
2818
2946
  defaultValue,
2819
2947
  onValueChange,
2820
- sanitize: sanitize3,
2948
+ sanitize: phoneNumberDigits,
2821
2949
  format: formatPhoneNumber,
2822
2950
  isMeaningful: isDigit4,
2823
2951
  inputRef
@@ -2844,7 +2972,7 @@ var PhoneNumberInput = /* @__PURE__ */ forwardRef27(
2844
2972
  );
2845
2973
 
2846
2974
  // src/components/RadioGroup/RadioGroup.tsx
2847
- import { forwardRef as forwardRef28, useId as useId13, useState as useState14 } from "react";
2975
+ import { forwardRef as forwardRef28, useId as useId13, useRef as useRef18, useState as useState14 } from "react";
2848
2976
 
2849
2977
  // src/components/RadioGroup/RadioGroup.css.ts
2850
2978
  import { createRuntimeFn as _7a46813 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -2885,6 +3013,13 @@ var RadioGroup2 = /* @__PURE__ */ forwardRef28(function RadioGroup3(props, ref)
2885
3013
  const helperId = helperText3 ? `${baseId}-helper` : void 0;
2886
3014
  const groupName = name ?? `${baseId}-radio`;
2887
3015
  const detachedForm = name ? void 0 : `${baseId}-no-form`;
3016
+ const rootRef = useRef18(null);
3017
+ useFormReset(rootRef, () => {
3018
+ if (isControlled) return;
3019
+ const next = defaultValue ?? "";
3020
+ setInnerValue(next);
3021
+ if (next !== current2) onValueChange?.(next);
3022
+ });
2888
3023
  const handleChange = (next) => {
2889
3024
  if (next === current2) return;
2890
3025
  if (!isControlled) setInnerValue(next);
@@ -2898,7 +3033,7 @@ var RadioGroup2 = /* @__PURE__ */ forwardRef28(function RadioGroup3(props, ref)
2898
3033
  /* @__PURE__ */ jsx32(
2899
3034
  "div",
2900
3035
  {
2901
- ref,
3036
+ ref: mergeRefs(ref, rootRef),
2902
3037
  id: baseId,
2903
3038
  role: "radiogroup",
2904
3039
  "aria-label": ariaLabel,
@@ -2944,7 +3079,7 @@ var RadioGroup2 = /* @__PURE__ */ forwardRef28(function RadioGroup3(props, ref)
2944
3079
  });
2945
3080
 
2946
3081
  // src/components/ResidentNumberInput/ResidentNumberInput.tsx
2947
- import { forwardRef as forwardRef29, useId as useId14, useRef as useRef14, useState as useState15 } from "react";
3082
+ import { forwardRef as forwardRef29, useId as useId14, useRef as useRef19, useState as useState15 } from "react";
2948
3083
  import { isValidResidentNumber, parseResidentNumber } from "@bestow-ui/korean-utils";
2949
3084
 
2950
3085
  // src/components/ResidentNumberInput/ResidentNumberInput.css.ts
@@ -2996,8 +3131,8 @@ var ResidentNumberInput = /* @__PURE__ */ forwardRef29(
2996
3131
  const frontId = `${baseId}-front`;
2997
3132
  const backId = `${baseId}-back`;
2998
3133
  const labelId = `${baseId}-label`;
2999
- const frontRef = useRef14(null);
3000
- const backRef = useRef14(null);
3134
+ const frontRef = useRef19(null);
3135
+ const backRef = useRef19(null);
3001
3136
  const complete = current2.front.length === 6 && current2.back.length === backLength;
3002
3137
  const isValid = (v) => digits === 13 ? isValidResidentNumber(v) : parseResidentNumber(v) !== null;
3003
3138
  const update = (next) => {
@@ -3008,6 +3143,12 @@ var ResidentNumberInput = /* @__PURE__ */ forwardRef29(
3008
3143
  onValueChange?.(nextRaw, nextComplete ? isValid(nextRaw) : null);
3009
3144
  };
3010
3145
  const [touched, setTouched] = useState15(false);
3146
+ useFormReset(frontRef, () => {
3147
+ setTouched(false);
3148
+ if (isControlled) return setParts(split(value3 ?? ""));
3149
+ const next = split(defaultValue ?? "");
3150
+ update(next);
3151
+ });
3011
3152
  const autoInvalid = validate && raw.length > 0 && (complete ? !isValid(raw) : touched);
3012
3153
  const showAuto = autoInvalid && error === void 0;
3013
3154
  const invalid = error ?? autoInvalid;
@@ -3090,7 +3231,7 @@ var ResidentNumberInput = /* @__PURE__ */ forwardRef29(
3090
3231
  );
3091
3232
 
3092
3233
  // src/components/SegmentedControl/SegmentedControl.tsx
3093
- import { forwardRef as forwardRef30, useId as useId15, useRef as useRef15, useState as useState16 } from "react";
3234
+ import { forwardRef as forwardRef30, useId as useId15, useRef as useRef20, useState as useState16 } from "react";
3094
3235
 
3095
3236
  // src/components/SegmentedControl/SegmentedControl.css.ts
3096
3237
  import { createRuntimeFn as _7a46814 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -3122,8 +3263,15 @@ var SegmentedControl = /* @__PURE__ */ forwardRef30(
3122
3263
  const current2 = isControlled ? value3 ?? "" : innerValue;
3123
3264
  const generatedId = useId15();
3124
3265
  const labelId = label6 ? `${id ?? generatedId}-label` : void 0;
3125
- const itemRefs = useRef15([]);
3266
+ const itemRefs = useRef20([]);
3126
3267
  const isEnabled = (index) => !disabled && !options[index]?.disabled;
3268
+ const rootRef = useRef20(null);
3269
+ useFormReset(rootRef, () => {
3270
+ if (isControlled) return;
3271
+ const next = defaultValue ?? "";
3272
+ setInnerValue(next);
3273
+ if (next !== current2) onValueChange?.(next);
3274
+ });
3127
3275
  const select2 = (index) => {
3128
3276
  const next = options[index].value;
3129
3277
  if (next === current2) return;
@@ -3156,7 +3304,7 @@ var SegmentedControl = /* @__PURE__ */ forwardRef30(
3156
3304
  const group = /* @__PURE__ */ jsxs30(
3157
3305
  "div",
3158
3306
  {
3159
- ref,
3307
+ ref: mergeRefs(ref, rootRef),
3160
3308
  id,
3161
3309
  role: "radiogroup",
3162
3310
  "aria-labelledby": labelId,
@@ -3396,7 +3544,7 @@ var SkipLink = /* @__PURE__ */ forwardRef33(function SkipLink2({ href = "#main",
3396
3544
 
3397
3545
  // src/components/Slider/Slider.tsx
3398
3546
  import * as RadixSlider from "@radix-ui/react-slider";
3399
- import { forwardRef as forwardRef34, useId as useId18, useState as useState17 } from "react";
3547
+ import { forwardRef as forwardRef34, useId as useId18, useRef as useRef21, useState as useState17 } from "react";
3400
3548
 
3401
3549
  // src/components/Slider/Slider.css.ts
3402
3550
  import { createRuntimeFn as _7a46816 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -3428,7 +3576,7 @@ var Slider = /* @__PURE__ */ forwardRef34(function Slider2(props, ref) {
3428
3576
  size,
3429
3577
  id,
3430
3578
  className,
3431
- disabled,
3579
+ disabled: disabledProp,
3432
3580
  ...rest
3433
3581
  } = props;
3434
3582
  const m = useMessages();
@@ -3441,6 +3589,15 @@ var Slider = /* @__PURE__ */ forwardRef34(function Slider2(props, ref) {
3441
3589
  const [innerValue, setInnerValue] = useState17(defaultValue ?? [min]);
3442
3590
  const current2 = isControlled ? value3 ?? [min] : innerValue;
3443
3591
  const isRange = current2.length > 1;
3592
+ const rootRef = useRef21(null);
3593
+ const fieldsetDisabled = useFieldsetDisabled(rootRef);
3594
+ const disabled = disabledProp || fieldsetDisabled;
3595
+ useFormReset(rootRef, () => {
3596
+ if (isControlled) return;
3597
+ const next = defaultValue ?? [min];
3598
+ setInnerValue(next);
3599
+ if (next.join() !== current2.join()) onValueChange?.(next);
3600
+ });
3444
3601
  const handleChange = (next) => {
3445
3602
  if (!isControlled) setInnerValue(next);
3446
3603
  onValueChange?.(next);
@@ -3454,7 +3611,7 @@ var Slider = /* @__PURE__ */ forwardRef34(function Slider2(props, ref) {
3454
3611
  /* @__PURE__ */ jsxs33(
3455
3612
  RadixSlider.Root,
3456
3613
  {
3457
- ref,
3614
+ ref: mergeRefs(ref, rootRef),
3458
3615
  id: baseId,
3459
3616
  min,
3460
3617
  max,
@@ -3496,17 +3653,18 @@ import { CheckIcon as CheckIcon4 } from "@bestow-ui/icons";
3496
3653
 
3497
3654
  // src/components/Stepper/Stepper.css.ts
3498
3655
  import { createRuntimeFn as _7a46817 } from "@vanilla-extract/recipes/createRuntimeFn";
3499
- var description6 = "kervhmh";
3656
+ var description6 = "kervhmi";
3500
3657
  var indicator2 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhm6", variantClassNames: { status: { complete: "kervhm7", current: "kervhm8", upcoming: "kervhm9" } }, defaultVariants: {}, compoundVariants: [] });
3501
- var label4 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhmd", variantClassNames: { status: { complete: "kervhme", current: "kervhmf", upcoming: "kervhmg" } }, defaultVariants: {}, compoundVariants: [] });
3658
+ var label4 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhme", variantClassNames: { status: { complete: "kervhmf", current: "kervhmg", upcoming: "kervhmh" } }, defaultVariants: {}, compoundVariants: [] });
3502
3659
  var root11 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhm0", variantClassNames: { orientation: { horizontal: "kervhm1", vertical: "kervhm2" } }, defaultVariants: { orientation: "horizontal" }, compoundVariants: [] });
3503
3660
  var step = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhm3", variantClassNames: { orientation: { horizontal: "kervhm4", vertical: "kervhm5" } }, defaultVariants: { orientation: "horizontal" }, compoundVariants: [] });
3504
- var text2 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhma", variantClassNames: { orientation: { horizontal: "kervhmb", vertical: "kervhmc" } }, defaultVariants: {}, compoundVariants: [] });
3661
+ var text2 = /* @__PURE__ */ _7a46817({ defaultClassName: "kervhma", variantClassNames: { orientation: { horizontal: "kervhmb", vertical: "kervhmc" }, reserveDescription: { true: "kervhmd" } }, defaultVariants: {}, compoundVariants: [] });
3505
3662
 
3506
3663
  // src/components/Stepper/Stepper.tsx
3507
3664
  import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
3508
- var Stepper = /* @__PURE__ */ forwardRef35(function Stepper2({ steps, current: current2, orientation = "horizontal", "aria-label": ariaLabel, className, ...rest }, ref) {
3665
+ var Stepper = /* @__PURE__ */ forwardRef35(function Stepper2({ steps, current: current2, orientation = "horizontal", loading, "aria-label": ariaLabel, className, ...rest }, ref) {
3509
3666
  const m = useMessages();
3667
+ const reserveDescription = orientation === "vertical" && steps.some((step2) => step2.description);
3510
3668
  return /* @__PURE__ */ jsx39(
3511
3669
  "ol",
3512
3670
  {
@@ -3516,6 +3674,7 @@ var Stepper = /* @__PURE__ */ forwardRef35(function Stepper2({ steps, current: c
3516
3674
  ...rest,
3517
3675
  children: steps.map((step2, index) => {
3518
3676
  const status = index < current2 ? "complete" : index === current2 ? "current" : "upcoming";
3677
+ const inProgress = loading && status === "current";
3519
3678
  return /* @__PURE__ */ jsxs34(
3520
3679
  "li",
3521
3680
  {
@@ -3523,14 +3682,19 @@ var Stepper = /* @__PURE__ */ forwardRef35(function Stepper2({ steps, current: c
3523
3682
  "data-status": status,
3524
3683
  "aria-current": status === "current" ? "step" : void 0,
3525
3684
  children: [
3526
- /* @__PURE__ */ jsx39("span", { className: indicator2({ status }), "aria-hidden": true, children: status === "complete" ? /* @__PURE__ */ jsx39(CheckIcon4, { size: 16, strokeWidth: 2.5 }) : index + 1 }),
3527
- /* @__PURE__ */ jsxs34("span", { className: text2({ orientation }), children: [
3685
+ /* @__PURE__ */ jsx39("span", { className: indicator2({ status }), "aria-hidden": true, children: status === "complete" ? /* @__PURE__ */ jsx39(CheckIcon4, { size: 16, strokeWidth: 2.5 }) : inProgress ? /* @__PURE__ */ jsx39(Spinner, { size: "sm", label: "" }) : index + 1 }),
3686
+ /* @__PURE__ */ jsxs34("span", { className: text2({ orientation, reserveDescription }), children: [
3528
3687
  /* @__PURE__ */ jsxs34("span", { className: label4({ status }), children: [
3529
3688
  step2.label,
3530
3689
  status === "complete" && /* @__PURE__ */ jsxs34("span", { className: visuallyHidden, children: [
3531
3690
  " (",
3532
3691
  m.stepCompleted ?? "\uC644\uB8CC",
3533
3692
  ")"
3693
+ ] }),
3694
+ inProgress && /* @__PURE__ */ jsxs34("span", { className: visuallyHidden, children: [
3695
+ " (",
3696
+ m.stepInProgress ?? "\uC9C4\uD589 \uC911",
3697
+ ")"
3534
3698
  ] })
3535
3699
  ] }),
3536
3700
  step2.description && /* @__PURE__ */ jsx39("span", { className: description6, children: step2.description })
@@ -3545,7 +3709,7 @@ var Stepper = /* @__PURE__ */ forwardRef35(function Stepper2({ steps, current: c
3545
3709
  });
3546
3710
 
3547
3711
  // src/components/Switch/Switch.tsx
3548
- import { forwardRef as forwardRef36, useEffect as useEffect11, useId as useId19, useRef as useRef16, useState as useState18 } from "react";
3712
+ import { forwardRef as forwardRef36, useEffect as useEffect12, useId as useId19, useRef as useRef22, useState as useState18 } from "react";
3549
3713
 
3550
3714
  // src/components/Switch/Switch.css.ts
3551
3715
  import { createRuntimeFn as _7a46818 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -3579,26 +3743,21 @@ var Switch = /* @__PURE__ */ forwardRef36(function Switch2({
3579
3743
  const [uncontrolled, setUncontrolled] = useState18(defaultChecked ?? false);
3580
3744
  const isControlled = checkedProp !== void 0;
3581
3745
  const checked = isControlled ? checkedProp : uncontrolled;
3582
- const buttonRef = useRef16(null);
3583
- const inputRef = useRef16(null);
3746
+ const buttonRef = useRef22(null);
3747
+ const inputRef = useRef22(null);
3584
3748
  const [inForm, setInForm] = useState18(true);
3585
- const userToggled = useRef16(false);
3749
+ const userToggled = useRef22(false);
3586
3750
  const setChecked = (next) => {
3587
3751
  if (!isControlled) setUncontrolled(next);
3588
3752
  if (next !== checked) onCheckedChange?.(next);
3589
3753
  };
3590
- const setCheckedRef = useRef16(setChecked);
3591
- setCheckedRef.current = setChecked;
3592
- useEffect11(() => {
3593
- const form = buttonRef.current?.form;
3594
- setInForm(!!form);
3595
- if (!form) return;
3596
- const initial = checked;
3597
- const onReset = () => setCheckedRef.current(initial);
3598
- form.addEventListener("reset", onReset);
3599
- return () => form.removeEventListener("reset", onReset);
3754
+ useFormReset(buttonRef, () => {
3755
+ if (!isControlled) setChecked(defaultChecked ?? false);
3756
+ });
3757
+ useEffect12(() => {
3758
+ setInForm(!!buttonRef.current?.form);
3600
3759
  }, []);
3601
- useEffect11(() => {
3760
+ useEffect12(() => {
3602
3761
  const input6 = inputRef.current;
3603
3762
  if (!input6 || input6.checked === checked) return;
3604
3763
  setNativeChecked(input6, checked);
@@ -3679,7 +3838,7 @@ var striped = "l3ploy6";
3679
3838
  var table = "l3ploy1";
3680
3839
 
3681
3840
  // src/components/Table/Table.tsx
3682
- import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
3841
+ import { Fragment as Fragment9, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
3683
3842
  var TableSizeContext = /* @__PURE__ */ createContext3("md");
3684
3843
  var TableSectionContext = /* @__PURE__ */ createContext3("body");
3685
3844
  var Table = /* @__PURE__ */ forwardRef37(function Table2({
@@ -3779,7 +3938,7 @@ var TableEmpty = /* @__PURE__ */ forwardRef37(function TableEmpty2({ colSpan, cl
3779
3938
  return /* @__PURE__ */ jsx41(TableRow, { children: /* @__PURE__ */ jsx41(TableCell, { ref, colSpan, className: cx(emptyCell, className), ...rest, children: /* @__PURE__ */ jsx41("div", { className: emptyContent, children }) }) });
3780
3939
  });
3781
3940
  function TableSkeleton({ rows = 5, columns }) {
3782
- return /* @__PURE__ */ jsx41(Fragment8, { children: Array.from({ length: rows }, (_, row6) => /* @__PURE__ */ jsx41(TableRow, { "aria-hidden": true, children: Array.from({ length: columns }, (_2, column) => /* @__PURE__ */ jsx41(TableCell, { children: /* @__PURE__ */ jsx41(Skeleton, { width: column === 0 ? "60%" : "80%" }) }, column)) }, row6)) });
3941
+ return /* @__PURE__ */ jsx41(Fragment9, { children: Array.from({ length: rows }, (_, row6) => /* @__PURE__ */ jsx41(TableRow, { "aria-hidden": true, children: Array.from({ length: columns }, (_2, column) => /* @__PURE__ */ jsx41(TableCell, { children: /* @__PURE__ */ jsx41(Skeleton, { width: column === 0 ? "60%" : "80%" }) }, column)) }, row6)) });
3783
3942
  }
3784
3943
 
3785
3944
  // src/components/Table/useTableSelection.ts
@@ -3848,7 +4007,7 @@ import {
3848
4007
  forwardRef as forwardRef39,
3849
4008
  useCallback as useCallback2,
3850
4009
  useId as useId21,
3851
- useRef as useRef17,
4010
+ useRef as useRef23,
3852
4011
  useState as useState20
3853
4012
  } from "react";
3854
4013
 
@@ -3886,7 +4045,7 @@ var Textarea = /* @__PURE__ */ forwardRef39(function Textarea2({
3886
4045
  const generatedId = useId21();
3887
4046
  const textareaId = id ?? generatedId;
3888
4047
  const helperId = helperText3 ? `${textareaId}-helper` : void 0;
3889
- const innerRef = useRef17(null);
4048
+ const innerRef = useRef23(null);
3890
4049
  const [uncontrolledLength, setUncontrolledLength] = useState20(() => String(defaultValue ?? "").length);
3891
4050
  const length = value3 !== void 0 ? String(value3).length : uncontrolledLength;
3892
4051
  const fitHeight = useCallback2(() => {
@@ -3897,6 +4056,10 @@ var Textarea = /* @__PURE__ */ forwardRef39(function Textarea2({
3897
4056
  el.style.height = `${el.scrollHeight + borders}px`;
3898
4057
  }, [autoResize]);
3899
4058
  useIsomorphicLayoutEffect(fitHeight, [fitHeight, value3]);
4059
+ useFormReset(innerRef, () => {
4060
+ if (value3 === void 0) setUncontrolledLength(String(defaultValue ?? "").length);
4061
+ setTimeout(fitHeight);
4062
+ });
3900
4063
  const handleChange = (event) => {
3901
4064
  if (value3 === void 0) setUncontrolledLength(event.target.value.length);
3902
4065
  fitHeight();
@@ -3938,7 +4101,7 @@ var Textarea = /* @__PURE__ */ forwardRef39(function Textarea2({
3938
4101
 
3939
4102
  // src/components/Toast/Toast.tsx
3940
4103
  import * as RadixToast from "@radix-ui/react-toast";
3941
- import { createContext as createContext5, useCallback as useCallback3, useContext as useContext5, useMemo as useMemo4, useRef as useRef18, useState as useState21 } from "react";
4104
+ import { createContext as createContext5, useCallback as useCallback3, useContext as useContext5, useMemo as useMemo4, useRef as useRef24, useState as useState21 } from "react";
3942
4105
  import { XIcon as XIcon7 } from "@bestow-ui/icons";
3943
4106
 
3944
4107
  // src/components/Toast/Toast.css.ts
@@ -3958,7 +4121,7 @@ function ToastProvider({ children, duration = 5e3, label: labelProp }) {
3958
4121
  const m = useMessages();
3959
4122
  const label6 = labelProp ?? m.notifications ?? "\uC54C\uB9BC";
3960
4123
  const [toasts, setToasts] = useState21([]);
3961
- const nextId = useRef18(0);
4124
+ const nextId = useRef24(0);
3962
4125
  const portal2 = usePortalProps();
3963
4126
  const toast2 = useCallback3((options) => {
3964
4127
  const id = nextId.current++;
@@ -4044,7 +4207,7 @@ function Tooltip({
4044
4207
  }
4045
4208
 
4046
4209
  // src/components/VerificationCodeInput/VerificationCodeInput.tsx
4047
- import { forwardRef as forwardRef40, useEffect as useEffect12, useId as useId22, useRef as useRef19, useState as useState22 } from "react";
4210
+ import { forwardRef as forwardRef40, useEffect as useEffect13, useId as useId22, useRef as useRef25, useState as useState22 } from "react";
4048
4211
 
4049
4212
  // src/components/VerificationCodeInput/VerificationCodeInput.css.ts
4050
4213
  var input5 = "ea01812";
@@ -4087,7 +4250,7 @@ var VerificationCodeInput = /* @__PURE__ */ forwardRef40(
4087
4250
  const inputId = id ?? generatedId;
4088
4251
  const helperId = `${inputId}-helper`;
4089
4252
  const statusId = `${inputId}-status`;
4090
- const inputRef = useRef19(null);
4253
+ const inputRef = useRef25(null);
4091
4254
  const isControlled = "value" in props;
4092
4255
  const [innerValue, setInnerValue] = useState22(defaultValue ?? "");
4093
4256
  const code = (isControlled ? value3 ?? "" : innerValue).slice(0, length);
@@ -4095,11 +4258,11 @@ var VerificationCodeInput = /* @__PURE__ */ forwardRef40(
4095
4258
  const [endAt, setEndAt] = useState22(() => expiresIn ? Date.now() + expiresIn * 1e3 : null);
4096
4259
  const [remaining, setRemaining] = useState22(expiresIn ?? 0);
4097
4260
  const expired = expiresIn !== void 0 && remaining <= 0;
4098
- const onExpireRef = useRef19(onExpire);
4099
- useEffect12(() => {
4261
+ const onExpireRef = useRef25(onExpire);
4262
+ useEffect13(() => {
4100
4263
  onExpireRef.current = onExpire;
4101
4264
  });
4102
- useEffect12(() => {
4265
+ useEffect13(() => {
4103
4266
  if (endAt === null) return;
4104
4267
  const tick = () => {
4105
4268
  const left = Math.max(0, Math.ceil((endAt - Date.now()) / 1e3));
@@ -4113,6 +4276,12 @@ var VerificationCodeInput = /* @__PURE__ */ forwardRef40(
4113
4276
  tick();
4114
4277
  return () => clearInterval(timer2);
4115
4278
  }, [endAt]);
4279
+ useFormReset(inputRef, () => {
4280
+ if (isControlled) return;
4281
+ const next = defaultValue ?? "";
4282
+ setInnerValue(next);
4283
+ if (next !== code) onValueChange?.(next);
4284
+ });
4116
4285
  const setCode = (next) => {
4117
4286
  if (!isControlled) setInnerValue(next);
4118
4287
  onValueChange?.(next);