@devslab/dds-react 0.23.0 → 0.25.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 (62) hide show
  1. package/README.ko.md +3 -2
  2. package/README.md +3 -2
  3. package/dist/calendar-view-BxjCQV9k.js +119 -0
  4. package/dist/calendar-view-BxjCQV9k.js.map +1 -0
  5. package/dist/calendar-view.d.ts +11 -1
  6. package/dist/calendar-view.d.ts.map +1 -1
  7. package/dist/calendar.js +5 -4
  8. package/dist/calendar.js.map +1 -1
  9. package/dist/choice-N-5K_ggs.js +309 -0
  10. package/dist/choice-N-5K_ggs.js.map +1 -0
  11. package/dist/choice-types-kSaEnZPr.js +23 -0
  12. package/dist/choice-types-kSaEnZPr.js.map +1 -0
  13. package/dist/combobox.js +1 -1
  14. package/dist/date-only-Bu4UmsTP.js +151 -0
  15. package/dist/date-only-Bu4UmsTP.js.map +1 -0
  16. package/dist/date-only.d.ts +92 -0
  17. package/dist/date-only.d.ts.map +1 -1
  18. package/dist/date-picker.js +69 -68
  19. package/dist/date-picker.js.map +1 -1
  20. package/dist/date-range-picker.d.ts +41 -0
  21. package/dist/date-range-picker.d.ts.map +1 -0
  22. package/dist/date-range-picker.js +327 -0
  23. package/dist/date-range-picker.js.map +1 -0
  24. package/dist/direction-DbZcVPsZ.js +21 -0
  25. package/dist/direction-DbZcVPsZ.js.map +1 -0
  26. package/dist/direction.d.ts +5 -0
  27. package/dist/direction.d.ts.map +1 -0
  28. package/dist/index.d.ts +5 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +108 -103
  31. package/dist/index.js.map +1 -1
  32. package/dist/input.d.ts.map +1 -1
  33. package/dist/input.js +1 -1
  34. package/dist/input.js.map +1 -1
  35. package/dist/internal/choice.d.ts +27 -3
  36. package/dist/internal/choice.d.ts.map +1 -1
  37. package/dist/month-picker.d.ts +33 -0
  38. package/dist/month-picker.d.ts.map +1 -0
  39. package/dist/month-picker.js +242 -0
  40. package/dist/month-picker.js.map +1 -0
  41. package/dist/number-input.d.ts +53 -0
  42. package/dist/number-input.d.ts.map +1 -0
  43. package/dist/number-input.js +254 -0
  44. package/dist/number-input.js.map +1 -0
  45. package/dist/segmented-control.d.ts +40 -0
  46. package/dist/segmented-control.d.ts.map +1 -0
  47. package/dist/segmented-control.js +73 -0
  48. package/dist/segmented-control.js.map +1 -0
  49. package/dist/select-picker.js +1 -1
  50. package/dist/time-only.d.ts +32 -0
  51. package/dist/time-only.d.ts.map +1 -0
  52. package/dist/time-picker-BQ7BT6-u.js +100 -0
  53. package/dist/time-picker-BQ7BT6-u.js.map +1 -0
  54. package/dist/time-picker.d.ts +34 -0
  55. package/dist/time-picker.d.ts.map +1 -0
  56. package/dist/time-picker.js +2 -0
  57. package/package.json +29 -4
  58. package/styles.css +31 -1
  59. package/dist/calendar-view-I_sNlioP.js +0 -145
  60. package/dist/calendar-view-I_sNlioP.js.map +0 -1
  61. package/dist/choice-B3vNMfKK.js +0 -300
  62. package/dist/choice-B3vNMfKK.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC7D,MAAM,WAAW,UACf,SAAQ,IAAI,CACV,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAC/C;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,IA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AAE,MAAM,CAAC;CAC3B;AAED,yEAAyE;AACzE,eAAO,MAAM,KAAK,yGA+GhB,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AACD,uEAAuE;AACvE,eAAO,MAAM,UAAU,4GAgBtB,CAAC"}
package/dist/input.js CHANGED
@@ -14,7 +14,7 @@ var c = t(function({ value: t, defaultValue: c = "", onValueChange: l, label: u,
14
14
  let e = E.current;
15
15
  if (!e) return;
16
16
  e.defaultValue = D.current;
17
- let t = (t) => queueMicrotask(() => {
17
+ let t = (t) => setTimeout(() => {
18
18
  t.defaultPrevented || (M.current.controlled ? e.value = M.current.current : (e.value = D.current, k(D.current)));
19
19
  }), n = e.form;
20
20
  return n?.addEventListener("reset", t), () => n?.removeEventListener("reset", t);
package/dist/input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../src/input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { classes } from \"./controls\";\n\nexport type LabelPlacement = \"outside\" | \"inside\" | \"hidden\";\nexport interface InputProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"value\" | \"defaultValue\" | \"children\"\n > {\n type?: \"text\" | \"search\" | \"email\" | \"tel\" | \"url\" | \"password\" | \"number\";\n value?: string;\n defaultValue?: string;\n onValueChange?: (next: string) => void;\n label?: ReactNode;\n labelPlacement?: LabelPlacement;\n clearable?: boolean;\n clearLabel?: string;\n wrapperClassName?: string;\n}\n\n/** A native text input. Supply label, aria-label, or aria-labelledby. */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n value,\n defaultValue = \"\",\n onValueChange,\n label,\n labelPlacement = \"outside\",\n clearable,\n clearLabel = \"내용 지우기\",\n wrapperClassName,\n className,\n id: requestedId,\n type = \"text\",\n onChange,\n onKeyDown,\n disabled,\n readOnly,\n ...rest\n },\n forwardedRef,\n) {\n const generated = useId();\n const id = requestedId ?? `dds-input-${generated}`;\n const inputRef = useRef<HTMLInputElement | null>(null);\n const initial = useRef(defaultValue);\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const controlled = value !== undefined;\n const latest = useRef({ controlled, current });\n latest.current = { controlled, current };\n useEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n input.defaultValue = initial.current;\n // Reset happens after the event dispatch. Respect preventDefault, and keep\n // the parent's controlled value when the browser resets native form data.\n const reset = (event: Event) =>\n queueMicrotask(() => {\n if (event.defaultPrevented) return;\n if (latest.current.controlled) input.value = latest.current.current;\n else {\n input.value = initial.current;\n setInternal(initial.current);\n }\n });\n const form = input.form;\n form?.addEventListener(\"reset\", reset);\n return () => form?.removeEventListener(\"reset\", reset);\n }, [rest.form]);\n const update = (next: string) => {\n if (disabled || readOnly) return;\n if (!controlled) setInternal(next);\n onValueChange?.(next);\n };\n return (\n <span\n className={classes(\"dds-input\", wrapperClassName)}\n data-label-placement={labelPlacement}\n data-filled={current.length > 0 ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n >\n {label != null && (\n <label htmlFor={id} className=\"dds-input__label\">\n {label}\n </label>\n )}\n <input\n {...rest}\n id={id}\n type={type}\n disabled={disabled}\n readOnly={readOnly}\n ref={(node) => {\n inputRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n }}\n className={classes(\"dds-input__control\", className)}\n value={current}\n onChange={(event) => {\n onChange?.(event);\n update(event.currentTarget.value);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (\n event.key === \"Enter\" &&\n (event.nativeEvent.isComposing || event.keyCode === 229)\n )\n event.preventDefault();\n }}\n />\n {clearable && current.length > 0 && !disabled && !readOnly && (\n <button\n type=\"button\"\n className=\"dds-input__clear\"\n aria-label={clearLabel}\n onPointerDown={(event) => event.preventDefault()}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n update(\"\");\n inputRef.current?.focus();\n }}\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n )}\n </span>\n );\n});\n\nexport interface InputGroupProps extends HTMLAttributes<HTMLDivElement> {\n start?: ReactNode;\n end?: ReactNode;\n}\n/** Layout only: the child Input owns its value and accessible name. */\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(\n function InputGroup({ start, end, className, children, ...rest }, ref) {\n return (\n <div\n {...rest}\n ref={ref}\n className={classes(\"dds-input-group\", className)}\n >\n {start != null && (\n <span className=\"dds-input-group__start\">{start}</span>\n )}\n {children}\n {end != null && <span className=\"dds-input-group__end\">{end}</span>}\n </div>\n );\n },\n);\n"],"mappings":";;;;AA8BA,IAAa,IAAQ,EAAyC,SAC5D,EACE,UACA,kBAAe,IACf,kBACA,UACA,oBAAiB,WACjB,cACA,gBAAa,UACb,qBACA,cACA,IAAI,GACJ,UAAO,QACP,aACA,cACA,aACA,aACA,GAAG,KAEL,GACA;CACA,IAAM,IAAY,EAAM,GAClB,IAAK,KAAe,aAAa,KACjC,IAAW,EAAgC,IAAI,GAC/C,IAAU,EAAO,CAAY,GAC7B,CAAC,GAAU,KAAe,EAAS,CAAY,GAC/C,IAAU,KAAS,GACnB,IAAa,MAAU,KAAA,GACvB,IAAS,EAAO;EAAE;EAAY;CAAQ,CAAC;CAE7C,AADA,EAAO,UAAU;EAAE;EAAY;CAAQ,GACvC,QAAgB;EACd,IAAM,IAAQ,EAAS;EACvB,IAAI,CAAC,GAAO;EACZ,EAAM,eAAe,EAAQ;EAG7B,IAAM,KAAS,MACb,qBAAqB;GACf,EAAM,qBACN,EAAO,QAAQ,aAAY,EAAM,QAAQ,EAAO,QAAQ,WAE1D,EAAM,QAAQ,EAAQ,SACtB,EAAY,EAAQ,OAAO;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ACxB,SAAoB,EAAE,UAAO,QAAK,cAAW,aAAU,GAAG,KAAQ,GAAK;CACrE,OACE,kBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,EAAQ,mBAAmB,CAAS;EAHjD,UAAA;GAKG,KAAS,QACR,kBAAC,QAAD;IAAM,WAAU;IAA0B,UAAA;GAAY,CAAA;GAEvD;GACA,KAAO,QAAQ,kBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA;GAAU,CAAA;EAC/D;;AAET,CACF"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../src/input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { classes } from \"./controls\";\n\nexport type LabelPlacement = \"outside\" | \"inside\" | \"hidden\";\nexport interface InputProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"value\" | \"defaultValue\" | \"children\"\n > {\n type?: \"text\" | \"search\" | \"email\" | \"tel\" | \"url\" | \"password\" | \"number\";\n value?: string;\n defaultValue?: string;\n onValueChange?: (next: string) => void;\n label?: ReactNode;\n labelPlacement?: LabelPlacement;\n clearable?: boolean;\n clearLabel?: string;\n wrapperClassName?: string;\n}\n\n/** A native text input. Supply label, aria-label, or aria-labelledby. */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n value,\n defaultValue = \"\",\n onValueChange,\n label,\n labelPlacement = \"outside\",\n clearable,\n clearLabel = \"내용 지우기\",\n wrapperClassName,\n className,\n id: requestedId,\n type = \"text\",\n onChange,\n onKeyDown,\n disabled,\n readOnly,\n ...rest\n },\n forwardedRef,\n) {\n const generated = useId();\n const id = requestedId ?? `dds-input-${generated}`;\n const inputRef = useRef<HTMLInputElement | null>(null);\n const initial = useRef(defaultValue);\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const controlled = value !== undefined;\n const latest = useRef({ controlled, current });\n latest.current = { controlled, current };\n useEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n input.defaultValue = initial.current;\n // The browser resets the controls after the reset event; after a reset-button\n // click a microtask would run before that, so restore on a task. Respect\n // preventDefault, and keep the parent's controlled value.\n const reset = (event: Event) =>\n setTimeout(() => {\n if (event.defaultPrevented) return;\n if (latest.current.controlled) input.value = latest.current.current;\n else {\n input.value = initial.current;\n setInternal(initial.current);\n }\n });\n const form = input.form;\n form?.addEventListener(\"reset\", reset);\n return () => form?.removeEventListener(\"reset\", reset);\n }, [rest.form]);\n const update = (next: string) => {\n if (disabled || readOnly) return;\n if (!controlled) setInternal(next);\n onValueChange?.(next);\n };\n return (\n <span\n className={classes(\"dds-input\", wrapperClassName)}\n data-label-placement={labelPlacement}\n data-filled={current.length > 0 ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n >\n {label != null && (\n <label htmlFor={id} className=\"dds-input__label\">\n {label}\n </label>\n )}\n <input\n {...rest}\n id={id}\n type={type}\n disabled={disabled}\n readOnly={readOnly}\n ref={(node) => {\n inputRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n }}\n className={classes(\"dds-input__control\", className)}\n value={current}\n onChange={(event) => {\n onChange?.(event);\n update(event.currentTarget.value);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (\n event.key === \"Enter\" &&\n (event.nativeEvent.isComposing || event.keyCode === 229)\n )\n event.preventDefault();\n }}\n />\n {clearable && current.length > 0 && !disabled && !readOnly && (\n <button\n type=\"button\"\n className=\"dds-input__clear\"\n aria-label={clearLabel}\n onPointerDown={(event) => event.preventDefault()}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n update(\"\");\n inputRef.current?.focus();\n }}\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n )}\n </span>\n );\n});\n\nexport interface InputGroupProps extends HTMLAttributes<HTMLDivElement> {\n start?: ReactNode;\n end?: ReactNode;\n}\n/** Layout only: the child Input owns its value and accessible name. */\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(\n function InputGroup({ start, end, className, children, ...rest }, ref) {\n return (\n <div\n {...rest}\n ref={ref}\n className={classes(\"dds-input-group\", className)}\n >\n {start != null && (\n <span className=\"dds-input-group__start\">{start}</span>\n )}\n {children}\n {end != null && <span className=\"dds-input-group__end\">{end}</span>}\n </div>\n );\n },\n);\n"],"mappings":";;;;AA8BA,IAAa,IAAQ,EAAyC,SAC5D,EACE,UACA,kBAAe,IACf,kBACA,UACA,oBAAiB,WACjB,cACA,gBAAa,UACb,qBACA,cACA,IAAI,GACJ,UAAO,QACP,aACA,cACA,aACA,aACA,GAAG,KAEL,GACA;CACA,IAAM,IAAY,EAAM,GAClB,IAAK,KAAe,aAAa,KACjC,IAAW,EAAgC,IAAI,GAC/C,IAAU,EAAO,CAAY,GAC7B,CAAC,GAAU,KAAe,EAAS,CAAY,GAC/C,IAAU,KAAS,GACnB,IAAa,MAAU,KAAA,GACvB,IAAS,EAAO;EAAE;EAAY;CAAQ,CAAC;CAE7C,AADA,EAAO,UAAU;EAAE;EAAY;CAAQ,GACvC,QAAgB;EACd,IAAM,IAAQ,EAAS;EACvB,IAAI,CAAC,GAAO;EACZ,EAAM,eAAe,EAAQ;EAI7B,IAAM,KAAS,MACb,iBAAiB;GACX,EAAM,qBACN,EAAO,QAAQ,aAAY,EAAM,QAAQ,EAAO,QAAQ,WAE1D,EAAM,QAAQ,EAAQ,SACtB,EAAY,EAAQ,OAAO;EAE/B,CAAC,GACG,IAAO,EAAM;EAEnB,OADA,GAAM,iBAAiB,SAAS,CAAK,SACxB,GAAM,oBAAoB,SAAS,CAAK;CACvD,GAAG,CAAC,EAAK,IAAI,CAAC;CACd,IAAM,KAAU,MAAiB;EAC3B,KAAY,MACX,KAAY,EAAY,CAAI,GACjC,IAAgB,CAAI;CACtB;CACA,OACE,kBAAC,QAAD;EACE,WAAW,EAAQ,aAAa,CAAgB;E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GAAU,CAAA;EAC/D;;AAET,CACF"}
@@ -1,5 +1,29 @@
1
- import { type ComboboxProps } from "../choice-types";
2
- export declare function Choice(props: ComboboxProps & {
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type ChoiceOption, type ComboboxProps } from "../choice-types";
3
+ /**
4
+ * Options for DDS components built on Choice (TimePicker). They are not part
5
+ * of the public Combobox/SelectPicker props; every default keeps the existing
6
+ * Combobox and SelectPicker behavior. Mirrors the Solid Choice internals.
7
+ */
8
+ export interface ChoiceInternals {
3
9
  searchable: boolean;
4
- }): import("react").JSX.Element;
10
+ /** Replaces the default case-insensitive label substring filter. */
11
+ matchItem?: (item: ChoiceOption, query: string) => boolean;
12
+ /** On blur, the value the typed text stands for, "" to clear, or null to restore the label. */
13
+ commitDraft?: (text: string) => string | null;
14
+ /** Content of the searchable trigger button (default "⌄"). */
15
+ triggerContent?: ReactNode;
16
+ rootClass?: string;
17
+ invalid?: boolean;
18
+ /** Highlight the first match while typing so Enter picks it. */
19
+ autoHighlight?: boolean;
20
+ /** Scroll the selected option to the middle of the list when it opens. */
21
+ centerSelected?: boolean;
22
+ inputMode?: HTMLAttributes<HTMLInputElement>["inputMode"];
23
+ /** Called before a native form reset restores the value. */
24
+ onFormReset?: () => void;
25
+ /** Observes every change of the uncontrolled input text, including restores. */
26
+ onDraftChange?: (text: string) => void;
27
+ }
28
+ export declare function Choice(props: ComboboxProps & ChoiceInternals): import("react").JSX.Element;
5
29
  //# sourceMappingURL=choice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"choice.d.ts","sourceRoot":"","sources":["../../src/internal/choice.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAazB,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,+BA6YpE"}
1
+ {"version":3,"file":"choice.d.ts","sourceRoot":"","sources":["../../src/internal/choice.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAwC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,oEAAoE;IACpE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3D,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC9C,8DAA8D;IAC9D,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1D,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,gFAAgF;IAChF,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAaD,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,+BA+b5D"}
@@ -0,0 +1,33 @@
1
+ import { type MonthPickerMessages } from "./date-only";
2
+ export type { MonthPickerMessages, MonthPickerValidity } from "./date-only";
3
+ export interface MonthPickerProps {
4
+ label?: string;
5
+ labelPlacement?: "outside" | "inside" | "hidden";
6
+ "aria-label"?: string;
7
+ "aria-labelledby"?: string;
8
+ "aria-describedby"?: string;
9
+ id?: string;
10
+ /** YYYY-MM or "" (no month). */
11
+ value?: string;
12
+ defaultValue?: string;
13
+ /** Called on user changes only, with YYYY-MM or "". */
14
+ onValueChange?: (next: string) => void;
15
+ locale?: string;
16
+ /** Decides the current month for "This month" and its marker. */
17
+ timeZone?: string;
18
+ /** Inclusive YYYY-MM bounds. */
19
+ min?: string;
20
+ max?: string;
21
+ messages?: MonthPickerMessages;
22
+ clearable?: boolean;
23
+ showThisMonth?: boolean;
24
+ required?: boolean;
25
+ disabled?: boolean;
26
+ readOnly?: boolean;
27
+ invalid?: boolean;
28
+ /** Form field name submitting YYYY-MM (or ""), never the display text. */
29
+ name?: string;
30
+ form?: string;
31
+ }
32
+ export declare function MonthPicker(props: MonthPickerProps): import("react").JSX.Element;
33
+ //# sourceMappingURL=month-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month-picker.d.ts","sourceRoot":"","sources":["../src/month-picker.tsx"],"names":[],"mappings":"AASA,OAAO,EAQL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAwBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAsTlD"}
@@ -0,0 +1,242 @@
1
+ import { t as e } from "./controls-BajigKUv.js";
2
+ import { a as t, c as n, l as r, m as i, n as a, s as o, u as ee } from "./date-only-Bu4UmsTP.js";
3
+ import { t as s } from "./calendar-view-BxjCQV9k.js";
4
+ import { useEffect as c, useId as l, useRef as u, useState as d } from "react";
5
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ import { Portal as m } from "@ark-ui/react/portal";
7
+ import { DatePicker as h, parseDate as g } from "@ark-ui/react/date-picker";
8
+ //#region src/month-picker.tsx
9
+ var _ = (e) => o(e) ? [g(`${e}-01`)] : [], v = (...e) => e.filter(Boolean).join(" ") || void 0;
10
+ function y() {
11
+ return /* @__PURE__ */ p("svg", {
12
+ width: "20",
13
+ height: "20",
14
+ viewBox: "0 0 24 24",
15
+ fill: "none",
16
+ stroke: "currentColor",
17
+ strokeWidth: "1.5",
18
+ "aria-hidden": "true",
19
+ children: [/* @__PURE__ */ f("rect", {
20
+ x: "3.5",
21
+ y: "5.5",
22
+ width: "17",
23
+ height: "15",
24
+ rx: "2"
25
+ }), /* @__PURE__ */ f("path", { d: "M7.5 3v5M16.5 3v5M3.5 10.5h17" })]
26
+ });
27
+ }
28
+ function b(b) {
29
+ let x = b.locale ?? "ko-KR", S = l(), C = b.id ?? `dds-month-${S}`, w = `${C}-error`, T = ee(x, b.messages), [te, E] = d(() => b.defaultValue ?? ""), D = b.value ?? te, [O] = d(() => ({
30
+ text: t(D, x),
31
+ locale: x
32
+ })), k = u(O), [, A] = d(0), j = (() => {
33
+ let e = k.current, n = a(e.text);
34
+ return e.locale !== x && o(n) ? t(n, x) : e.text;
35
+ })(), M = (e) => {
36
+ k.current = {
37
+ text: e,
38
+ locale: x
39
+ }, A((e) => e + 1);
40
+ }, [N, P] = d(() => _(D)), [F, I] = d(!1), L = u(null), R = u(null), z = u(D), B = u(void 0), [V, H] = d(null);
41
+ c(() => {
42
+ let e = L.current;
43
+ e && H(e.closest("[role=\"dialog\"], [role=\"alertdialog\"]") ?? e.ownerDocument.body);
44
+ }, []);
45
+ let U = !!(b.disabled || b.readOnly), W = r(b.min, b.max), G = i(j, b.required ?? !1, b.min, b.max), K = G.valid ? void 0 : G.reason === "required" ? T.required : T.invalid, q = !!b.invalid || !G.valid, J = b.label ?? b["aria-label"] ?? "", Y = u({
46
+ props: b,
47
+ locale: x,
48
+ blocked: U
49
+ });
50
+ Y.current = {
51
+ props: b,
52
+ locale: x,
53
+ blocked: U
54
+ }, c(() => {
55
+ D !== z.current && (z.current = D, M(t(D, x)), P(_(D)));
56
+ }, [D]), c(() => {
57
+ L.current?.setCustomValidity(K ?? "");
58
+ }, [K]), c(() => {
59
+ U && (I(!1), B.current !== void 0 && cancelAnimationFrame(B.current));
60
+ }, [U]), c(() => {
61
+ let e = L.current?.ownerDocument;
62
+ if (!e) return;
63
+ let n = /* @__PURE__ */ new Set(), r = (r) => {
64
+ let { props: i } = Y.current, a = i.form ? e.getElementById(i.form) : L.current?.form;
65
+ if (!a || r.target !== a) return;
66
+ let o = setTimeout(() => {
67
+ if (n.delete(o), r.defaultPrevented) return;
68
+ let e = Y.current, i = e.props.value ?? e.props.defaultValue ?? "";
69
+ z.current = i, e.props.value === void 0 && E(i);
70
+ let a = t(i, e.locale);
71
+ k.current = {
72
+ text: a,
73
+ locale: e.locale
74
+ }, A((e) => e + 1), P(_(i)), L.current && (L.current.value = a);
75
+ }, 0);
76
+ n.add(o);
77
+ };
78
+ return e.addEventListener("reset", r, !0), () => {
79
+ e.removeEventListener("reset", r, !0);
80
+ for (let e of n) clearTimeout(e);
81
+ };
82
+ }, []), c(() => () => {
83
+ B.current !== void 0 && cancelAnimationFrame(B.current);
84
+ }, []);
85
+ function X(e, t = 1) {
86
+ B.current !== void 0 && cancelAnimationFrame(B.current);
87
+ let n = (t) => {
88
+ B.current = requestAnimationFrame(() => {
89
+ if (t > 1) return n(t - 1);
90
+ B.current = void 0, Y.current.blocked || e()?.focus({ preventScroll: !0 });
91
+ });
92
+ };
93
+ n(t);
94
+ }
95
+ let Z = u(null);
96
+ function ne(e) {
97
+ Z.current = e, X(e, 2);
98
+ }
99
+ c(() => {
100
+ let e = Z.current;
101
+ F || !e || (Z.current = null, X(e, 2));
102
+ }, [F]);
103
+ function Q(e) {
104
+ U || (P(_(e)), e !== z.current && (z.current = e, b.value === void 0 && E(e), b.onValueChange?.(e)));
105
+ }
106
+ function re(e) {
107
+ if (U) return;
108
+ let n = i(e, !1, b.min, b.max);
109
+ M(n.valid ? t(n.value ?? "", x) : e), n.valid && Q(n.value ?? "");
110
+ }
111
+ let $ = !!V?.matches("[role=\"dialog\"], [role=\"alertdialog\"]");
112
+ return /* @__PURE__ */ p("div", {
113
+ className: `dds-field dds-date-picker dds-month-picker dds-date-picker--${b.labelPlacement ?? "outside"}${K ? " dds-field--error" : ""}`,
114
+ "data-filled": j === "" ? void 0 : "true",
115
+ "data-invalid": q ? "" : void 0,
116
+ "data-disabled": b.disabled ? "" : void 0,
117
+ role: "group",
118
+ children: [
119
+ b.label && /* @__PURE__ */ p("label", {
120
+ className: "dds-field__label",
121
+ htmlFor: C,
122
+ children: [b.label, b.required && /* @__PURE__ */ f("span", {
123
+ "aria-hidden": "true",
124
+ children: " *"
125
+ })]
126
+ }),
127
+ /* @__PURE__ */ p(h.Root, {
128
+ locale: x,
129
+ timeZone: b.timeZone ?? "Asia/Seoul",
130
+ disabled: b.disabled,
131
+ readOnly: b.readOnly,
132
+ required: b.required,
133
+ invalid: q,
134
+ open: F && !U,
135
+ onOpenChange: (e) => {
136
+ I(e.open && !U), e.open || P(_(z.current));
137
+ },
138
+ min: W.min ? g(W.min) : void 0,
139
+ max: W.max ? g(W.max) : void 0,
140
+ minView: "month",
141
+ maxView: "month",
142
+ defaultView: "month",
143
+ translations: { clearTrigger: T.clear },
144
+ value: N,
145
+ onValueChange: (e) => {
146
+ if (U) return;
147
+ let n = e.value[0]?.toString().slice(0, 7) ?? "";
148
+ n !== "" && !i(n, !1, b.min, b.max).valid || (M(t(n, x)), Q(n), ne(() => L.current));
149
+ },
150
+ positioning: {
151
+ placement: "bottom-start",
152
+ gutter: 8,
153
+ strategy: $ ? "fixed" : "absolute",
154
+ hideWhenDetached: $
155
+ },
156
+ children: [/* @__PURE__ */ p(h.Control, {
157
+ className: "dds-date-picker-control",
158
+ "data-filled": j === "" ? void 0 : "true",
159
+ children: [/* @__PURE__ */ f("input", {
160
+ id: C,
161
+ ref: L,
162
+ form: b.form,
163
+ "aria-label": b.label ? void 0 : b["aria-label"],
164
+ "aria-labelledby": b["aria-labelledby"],
165
+ "aria-invalid": q ? "true" : void 0,
166
+ "aria-required": b.required ? "true" : void 0,
167
+ "aria-describedby": v(b["aria-describedby"], K && w),
168
+ type: "text",
169
+ value: j,
170
+ onChange: () => {},
171
+ required: b.required,
172
+ readOnly: b.readOnly,
173
+ disabled: b.disabled,
174
+ placeholder: n(x) ? "YYYY/MM" : "YYYY-MM",
175
+ autoComplete: "off",
176
+ autoCorrect: "off",
177
+ spellCheck: !1,
178
+ onInputCapture: (e) => {
179
+ e.stopPropagation(), re(e.currentTarget.value);
180
+ },
181
+ onKeyDown: (e) => {
182
+ e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation());
183
+ }
184
+ }), /* @__PURE__ */ f(h.Trigger, {
185
+ asChild: !0,
186
+ children: /* @__PURE__ */ f(e, {
187
+ ref: R,
188
+ type: "button",
189
+ tone: "secondary",
190
+ "aria-label": `${J} ${T.openCalendar}`.trim(),
191
+ children: /* @__PURE__ */ f(y, {})
192
+ })
193
+ })]
194
+ }), /* @__PURE__ */ f(m, {
195
+ container: V ? { current: V } : void 0,
196
+ children: /* @__PURE__ */ f(h.Positioner, {
197
+ className: "dds-date-picker-positioner",
198
+ children: /* @__PURE__ */ f(h.Content, {
199
+ onKeyDownCapture: (e) => {
200
+ e.key === "Escape" && (Z.current = null, X(() => R.current, 2));
201
+ },
202
+ className: "dds-date-picker-content dds-month-picker-content",
203
+ "aria-label": `${J} ${T.chooseMonth}`.trim(),
204
+ children: /* @__PURE__ */ f(s, {
205
+ view: "month",
206
+ timeZone: b.timeZone,
207
+ min: W.min,
208
+ max: W.max,
209
+ locale: x,
210
+ messages: T,
211
+ disabled: b.disabled,
212
+ readOnly: b.readOnly,
213
+ showToday: b.showThisMonth,
214
+ showClear: b.clearable,
215
+ onClear: () => {
216
+ M(""), Q("");
217
+ }
218
+ })
219
+ })
220
+ })
221
+ })]
222
+ }),
223
+ b.name && /* @__PURE__ */ f("input", {
224
+ type: "hidden",
225
+ name: b.name,
226
+ form: b.form,
227
+ value: D,
228
+ disabled: b.disabled
229
+ }),
230
+ K && /* @__PURE__ */ f("span", {
231
+ id: w,
232
+ className: "dds-field__error",
233
+ role: "alert",
234
+ children: K
235
+ })
236
+ ]
237
+ });
238
+ }
239
+ //#endregion
240
+ export { b as MonthPicker };
241
+
242
+ //# sourceMappingURL=month-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month-picker.js","names":[],"sources":["../src/month-picker.tsx"],"sourcesContent":["import { useEffect, useId, useRef, useState } from \"react\";\nimport {\n DatePicker as ArkDatePicker,\n parseDate,\n type DateValue,\n} from \"@ark-ui/react/date-picker\";\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { Button } from \"./controls\";\nimport { CalendarView } from \"./calendar-view\";\nimport {\n canonicalMonth,\n displayMonth,\n isCalendarMonth,\n isKorean,\n monthBounds,\n monthMessages,\n validateMonth,\n type MonthPickerMessages,\n} from \"./date-only\";\nexport type { MonthPickerMessages, MonthPickerValidity } from \"./date-only\";\n\nexport interface MonthPickerProps {\n label?: string;\n labelPlacement?: \"outside\" | \"inside\" | \"hidden\";\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n /** YYYY-MM or \"\" (no month). */\n value?: string;\n defaultValue?: string;\n /** Called on user changes only, with YYYY-MM or \"\". */\n onValueChange?: (next: string) => void;\n locale?: string;\n /** Decides the current month for \"This month\" and its marker. */\n timeZone?: string;\n /** Inclusive YYYY-MM bounds. */\n min?: string;\n max?: string;\n messages?: MonthPickerMessages;\n clearable?: boolean;\n showThisMonth?: boolean;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n /** Form field name submitting YYYY-MM (or \"\"), never the display text. */\n name?: string;\n form?: string;\n}\n\nconst selectionOf = (month: string): DateValue[] =>\n isCalendarMonth(month) ? [parseDate(`${month}-01`)] : [];\nconst describedBy = (...ids: Array<string | false | null | undefined>) =>\n ids.filter(Boolean).join(\" \") || undefined;\n\nfunction CalendarIcon() {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n aria-hidden=\"true\"\n >\n <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"15\" rx=\"2\" />\n <path d=\"M7.5 3v5M16.5 3v5M3.5 10.5h17\" />\n </svg>\n );\n}\n\nexport function MonthPicker(props: MonthPickerProps) {\n const locale = props.locale ?? \"ko-KR\",\n generated = useId(),\n id = props.id ?? `dds-month-${generated}`,\n errorId = `${id}-error`;\n const text = monthMessages(locale, props.messages);\n const [internal, setInternal] = useState(() => props.defaultValue ?? \"\");\n const value = props.value ?? internal;\n // The draft keeps its formatting locale so a locale change re-displays complete months only.\n const [initialDraft] = useState(() => ({\n text: displayMonth(value, locale),\n locale,\n }));\n const draftRef = useRef(initialDraft);\n const [, setDraftVersion] = useState(0);\n const currentDraft = () => {\n const state = draftRef.current,\n canonical = canonicalMonth(state.text);\n return state.locale !== locale && isCalendarMonth(canonical)\n ? displayMonth(canonical, locale)\n : state.text;\n };\n const draft = currentDraft();\n const setDraft = (next: string) => {\n draftRef.current = { text: next, locale };\n setDraftVersion((version) => version + 1);\n };\n const [selection, setSelection] = useState(() => selectionOf(value));\n const [open, setOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null),\n triggerRef = useRef<HTMLButtonElement>(null),\n emitted = useRef(value),\n focusFrame = useRef<number | undefined>(undefined);\n const [portalMount, setPortalMount] = useState<HTMLElement | null>(null);\n useEffect(() => {\n const input = inputRef.current;\n if (input)\n setPortalMount(\n input.closest<HTMLElement>('[role=\"dialog\"], [role=\"alertdialog\"]') ??\n input.ownerDocument.body,\n );\n }, []);\n const blocked = Boolean(props.disabled || props.readOnly);\n const bounds = monthBounds(props.min, props.max);\n const validity = validateMonth(\n draft,\n props.required ?? false,\n props.min,\n props.max,\n );\n const error = validity.valid\n ? undefined\n : validity.reason === \"required\"\n ? text.required\n : text.invalid;\n const invalid = Boolean(props.invalid) || !validity.valid;\n const fieldName = props.label ?? props[\"aria-label\"] ?? \"\";\n // Handlers registered once (form reset, frames) read the latest render through this ref.\n const latest = useRef({ props, locale, blocked });\n latest.current = { props, locale, blocked };\n\n useEffect(() => {\n if (value === emitted.current) return;\n emitted.current = value;\n setDraft(displayMonth(value, locale));\n setSelection(selectionOf(value));\n }, [value]);\n useEffect(() => {\n inputRef.current?.setCustomValidity(error ?? \"\");\n }, [error]);\n useEffect(() => {\n if (!blocked) return;\n setOpen(false);\n if (focusFrame.current !== undefined)\n cancelAnimationFrame(focusFrame.current);\n }, [blocked]);\n // Resolve the owning form when a reset happens: the field may mount before it joins its form.\n useEffect(() => {\n const doc = inputRef.current?.ownerDocument;\n if (!doc) return;\n const timers = new Set<ReturnType<typeof setTimeout>>();\n const reset = (event: Event) => {\n const { props: now } = latest.current;\n const form = now.form\n ? doc.getElementById(now.form)\n : inputRef.current?.form;\n if (!form || event.target !== form) return;\n // A task, not a microtask: a user-triggered reset runs its listeners before rewriting the controls.\n const timer = setTimeout(() => {\n timers.delete(timer);\n if (event.defaultPrevented) return;\n const current = latest.current;\n const next = current.props.value ?? current.props.defaultValue ?? \"\";\n emitted.current = next;\n if (current.props.value === undefined) setInternal(next);\n const shown = displayMonth(next, current.locale);\n draftRef.current = { text: shown, locale: current.locale };\n setDraftVersion((version) => version + 1);\n setSelection(selectionOf(next));\n // Native reset rewrote the visible input; the draft may not have changed.\n if (inputRef.current) inputRef.current.value = shown;\n }, 0);\n timers.add(timer);\n };\n doc.addEventListener(\"reset\", reset, true);\n return () => {\n doc.removeEventListener(\"reset\", reset, true);\n for (const timer of timers) clearTimeout(timer);\n };\n }, []);\n useEffect(\n () => () => {\n if (focusFrame.current !== undefined)\n cancelAnimationFrame(focusFrame.current);\n },\n [],\n );\n\n function focusSoon(target: () => HTMLElement | null, frames = 1) {\n if (focusFrame.current !== undefined)\n cancelAnimationFrame(focusFrame.current);\n const run = (left: number) => {\n focusFrame.current = requestAnimationFrame(() => {\n if (left > 1) return run(left - 1);\n focusFrame.current = undefined;\n if (!latest.current.blocked) target()?.focus({ preventScroll: true });\n });\n };\n run(frames);\n }\n // Ark returns focus to its trigger once it sees the calendar closed; move it on after that.\n const pendingFocus = useRef<(() => HTMLElement | null) | null>(null);\n function focusAfterClose(target: () => HTMLElement | null) {\n // If the calendar stays open (This month), move focus now as well.\n pendingFocus.current = target;\n focusSoon(target, 2);\n }\n useEffect(() => {\n const target = pendingFocus.current;\n // Ark sees the closed prop in this same commit and schedules its own focus one frame out.\n if (open || !target) return;\n pendingFocus.current = null;\n focusSoon(target, 2);\n }, [open]);\n function commit(next: string) {\n if (blocked) return;\n setSelection(selectionOf(next));\n if (next === emitted.current) return;\n emitted.current = next;\n if (props.value === undefined) setInternal(next);\n props.onValueChange?.(next);\n }\n /** Committing ignores `required` like DatePicker: an emptied field is still reported. */\n function changeDraft(typed: string) {\n if (blocked) return;\n const state = validateMonth(typed, false, props.min, props.max);\n setDraft(state.valid ? displayMonth(state.value ?? \"\", locale) : typed);\n if (state.valid) commit(state.value ?? \"\");\n }\n const dialogMount = !!portalMount?.matches(\n '[role=\"dialog\"], [role=\"alertdialog\"]',\n );\n\n return (\n <div\n className={`dds-field dds-date-picker dds-month-picker dds-date-picker--${props.labelPlacement ?? \"outside\"}${error ? \" dds-field--error\" : \"\"}`}\n data-filled={draft !== \"\" ? \"true\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-disabled={props.disabled ? \"\" : undefined}\n role=\"group\"\n >\n {props.label && (\n <label className=\"dds-field__label\" htmlFor={id}>\n {props.label}\n {props.required && <span aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <ArkDatePicker.Root\n locale={locale}\n timeZone={props.timeZone ?? \"Asia/Seoul\"}\n disabled={props.disabled}\n readOnly={props.readOnly}\n required={props.required}\n invalid={invalid}\n open={open && !blocked}\n onOpenChange={(details) => {\n setOpen(details.open && !blocked);\n if (!details.open) setSelection(selectionOf(emitted.current));\n }}\n min={bounds.min ? parseDate(bounds.min) : undefined}\n max={bounds.max ? parseDate(bounds.max) : undefined}\n minView=\"month\"\n maxView=\"month\"\n defaultView=\"month\"\n translations={{ clearTrigger: text.clear }}\n value={selection}\n onValueChange={(details) => {\n if (blocked) return;\n const next = details.value[0]?.toString().slice(0, 7) ?? \"\";\n if (\n next !== \"\" &&\n !validateMonth(next, false, props.min, props.max).valid\n )\n return;\n setDraft(displayMonth(next, locale));\n commit(next);\n focusAfterClose(() => inputRef.current);\n }}\n positioning={{\n placement: \"bottom-start\",\n gutter: 8,\n strategy: dialogMount ? \"fixed\" : \"absolute\",\n hideWhenDetached: dialogMount,\n }}\n >\n <ArkDatePicker.Control\n className=\"dds-date-picker-control\"\n data-filled={draft !== \"\" ? \"true\" : undefined}\n >\n <input\n id={id}\n ref={inputRef}\n form={props.form}\n aria-label={props.label ? undefined : props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n aria-invalid={invalid ? \"true\" : undefined}\n aria-required={props.required ? \"true\" : undefined}\n aria-describedby={describedBy(\n props[\"aria-describedby\"],\n error && errorId,\n )}\n type=\"text\"\n value={draft}\n onChange={() => {}}\n required={props.required}\n readOnly={props.readOnly}\n disabled={props.disabled}\n placeholder={isKorean(locale) ? \"YYYY/MM\" : \"YYYY-MM\"}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n onInputCapture={(event) => {\n event.stopPropagation();\n changeDraft(event.currentTarget.value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n event.stopPropagation();\n }\n }}\n />\n <ArkDatePicker.Trigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n tone=\"secondary\"\n aria-label={`${fieldName} ${text.openCalendar}`.trim()}\n >\n <CalendarIcon />\n </Button>\n </ArkDatePicker.Trigger>\n </ArkDatePicker.Control>\n <Portal container={portalMount ? { current: portalMount } : undefined}>\n <ArkDatePicker.Positioner className=\"dds-date-picker-positioner\">\n <ArkDatePicker.Content\n onKeyDownCapture={(event) => {\n if (event.key !== \"Escape\") return;\n pendingFocus.current = null;\n focusSoon(() => triggerRef.current, 2);\n }}\n className=\"dds-date-picker-content dds-month-picker-content\"\n aria-label={`${fieldName} ${text.chooseMonth}`.trim()}\n >\n <CalendarView\n view=\"month\"\n timeZone={props.timeZone}\n min={bounds.min}\n max={bounds.max}\n locale={locale}\n messages={text}\n disabled={props.disabled}\n readOnly={props.readOnly}\n showToday={props.showThisMonth}\n showClear={props.clearable}\n onClear={() => {\n setDraft(\"\");\n commit(\"\");\n }}\n />\n </ArkDatePicker.Content>\n </ArkDatePicker.Positioner>\n </Portal>\n </ArkDatePicker.Root>\n {props.name && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={value}\n disabled={props.disabled}\n />\n )}\n {error && (\n <span id={errorId} className=\"dds-field__error\" role=\"alert\">\n {error}\n </span>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmDA,IAAM,KAAe,MACnB,EAAgB,CAAK,IAAI,CAAC,EAAU,GAAG,EAAM,IAAI,CAAC,IAAI,CAAC,GACnD,KAAe,GAAG,MACtB,EAAI,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAEnC,SAAS,IAAe;CACtB,OACE,kBAAC,OAAD;EACE,OAAM;EACN,QAAO;EACP,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAY;EAPd,UAAA,CASE,kBAAC,QAAD;GAAM,GAAE;GAAM,GAAE;GAAM,OAAM;GAAK,QAAO;GAAK,IAAG;EAAK,CAAA,GACrD,kBAAC,QAAD,EAAM,GAAE,gCAAiC,CAAA,CACtC;;AAET;AAEA,SAAgB,EAAY,GAAyB;CACnD,IAAM,IAAS,EAAM,UAAU,SAC7B,IAAY,EAAM,GAClB,IAAK,EAAM,MAAM,aAAa,KAC9B,IAAU,GAAG,EAAG,SACZ,IAAO,GAAc,GAAQ,EAAM,QAAQ,GAC3C,CAAC,IAAU,KAAe,QAAe,EAAM,gBAAgB,EAAE,GACjE,IAAQ,EAAM,SAAS,IAEvB,CAAC,KAAgB,SAAgB;EACrC,MAAM,EAAa,GAAO,CAAM;EAChC;CACF,EAAE,GACI,IAAW,EAAO,CAAY,GAC9B,GAAG,KAAmB,EAAS,CAAC,GAQhC,WAPqB;EACzB,IAAM,IAAQ,EAAS,SACrB,IAAY,EAAe,EAAM,IAAI;EACvC,OAAO,EAAM,WAAW,KAAU,EAAgB,CAAS,IACvD,EAAa,GAAW,CAAM,IAC9B,EAAM;CACZ,EACc,CAAa,GACrB,KAAY,MAAiB;EAEjC,AADA,EAAS,UAAU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GAAY,EAAM,cAAc,KAAK;MACvC;MACA,YAAY,MAAU;OACpB,AAAI,EAAM,QAAQ,WAAW,CAAC,EAAM,YAAY,gBAC9C,EAAM,eAAe,GACrB,EAAM,gBAAgB;MAE1B;KACD,CAAA,GACD,kBAAC,EAAc,SAAf;MAAuB,SAAA;MACrB,UAAA,kBAAC,GAAD;OACE,KAAK;OACL,MAAK;OACL,MAAK;OACL,cAAY,GAAG,EAAU,GAAG,EAAK,eAAe,KAAK;OAErD,UAAA,kBAAC,GAAD,CAAe,CAAA;MACT,CAAA;KACa,CAAA,CACF;IACvB,CAAA,GAAA,kBAAC,GAAD;KAAQ,WAAW,IAAc,EAAE,SAAS,EAAY,IAAI,KAAA;KAC1D,UAAA,kBAAC,EAAc,YAAf;MAA0B,WAAU;MAClC,UAAA,kBAAC,EAAc,SAAf;OACE,mBAAmB,MAAU;QACvB,EAAM,QAAQ,aAClB,EAAa,UAAU,MACvB,QAAgB,EAAW,SAAS,CAAC;OACvC;OACA,WAAU;OACV,cAAY,GAAG,EAAU,GAAG,EAAK,cAAc,KAAK;OAEpD,UAAA,kBAAC,GAAD;QACE,MAAK;QACL,UAAU,EAAM;QAChB,KAAK,EAAO;QACZ,KAAK,EAAO;QACJ;QACR,UAAU;QACV,UAAU,EAAM;QAChB,UAAU,EAAM;QAChB,WAAW,EAAM;QACjB,WAAW,EAAM;QACjB,eAAe;SAEb,AADA,EAAS,EAAE,GACX,EAAO,EAAE;QACX;OACD,CAAA;MACoB,CAAA;KACC,CAAA;IACpB,CAAA,CACU;;GACnB,EAAM,QACL,kBAAC,SAAD;IACE,MAAK;IACL,MAAM,EAAM;IACZ,MAAM,EAAM;IACL;IACP,UAAU,EAAM;GACjB,CAAA;GAEF,KACC,kBAAC,QAAD;IAAM,IAAI;IAAS,WAAU;IAAmB,MAAK;IAClD,UAAA;GACG,CAAA;EAEL;;AAET"}
@@ -0,0 +1,53 @@
1
+ import { type Direction } from "./direction";
2
+ export interface NumberInputMessages {
3
+ /** Accessible name of the − button. */
4
+ decrease?: string;
5
+ /** Accessible name of the + button. */
6
+ increase?: string;
7
+ }
8
+ export declare function numberInputMessages(locale: string, messages?: NumberInputMessages): Required<NumberInputMessages>;
9
+ export interface NumberInputProps {
10
+ /** null means empty. Controlled when not undefined. */
11
+ value?: number | null;
12
+ defaultValue?: number | null;
13
+ /** Called with the new number, or null when emptied, only after a user change. */
14
+ onValueChange?: (next: number | null) => void;
15
+ min?: number;
16
+ max?: number;
17
+ /** Arrow keys and the stepper buttons move by step; PageUp/PageDown by ten steps. */
18
+ step?: number;
19
+ /** Formatting and parsing locale. Defaults to ko-KR. */
20
+ locale?: string;
21
+ /** Defaults to whole numbers with thousands separators. */
22
+ formatOptions?: Intl.NumberFormatOptions;
23
+ /** Show the − / + buttons. Defaults to true. */
24
+ stepper?: boolean;
25
+ /** Unit shown after the digits, for example 원, 개 or 분. */
26
+ suffix?: string;
27
+ label?: string;
28
+ labelPlacement?: "outside" | "hidden";
29
+ "aria-label"?: string;
30
+ "aria-labelledby"?: string;
31
+ "aria-describedby"?: string;
32
+ id?: string;
33
+ /** Submits the plain number (1234.5), never the formatted text. */
34
+ name?: string;
35
+ form?: string;
36
+ required?: boolean;
37
+ disabled?: boolean;
38
+ readOnly?: boolean;
39
+ /** Also invalid on its own while the number is outside min/max. */
40
+ invalid?: boolean;
41
+ placeholder?: string;
42
+ messages?: NumberInputMessages;
43
+ dir?: Direction;
44
+ className?: string;
45
+ }
46
+ /** Full-width digits from Japanese/Chinese IMEs become ASCII; other text is left for validation. */
47
+ export declare function normalizeNumberText(text: string): string;
48
+ /**
49
+ * A localized number field. Values are numbers (or null for empty); display
50
+ * text is formatted with Intl and never leaves the component.
51
+ */
52
+ export declare function NumberInput(props: NumberInputProps): import("react").JSX.Element;
53
+ //# sourceMappingURL=number-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-input.d.ts","sourceRoot":"","sources":["../src/number-input.tsx"],"names":[],"mappings":"AAiBA,OAAO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