@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-types-kSaEnZPr.js","names":[],"sources":["../src/choice-types.ts"],"sourcesContent":["export interface ChoiceOption {\n value: string;\n label: string;\n description?: string;\n disabled?: boolean;\n}\nexport interface ChoiceMessages {\n open?: string;\n clear?: string;\n loading?: string;\n empty?: string;\n error?: string;\n retry?: string;\n}\nexport type ChoiceVirtualization =\n | false\n | { itemHeight?: number; overscan?: number };\nexport interface ChoiceProps {\n items: ChoiceOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n selectedOption?: ChoiceOption;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n name?: string;\n form?: string;\n id?: string;\n label?: string;\n labelPlacement?: \"outside\" | \"inside\" | \"hidden\";\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n placeholder?: string;\n clearable?: boolean;\n messages?: ChoiceMessages;\n virtualization?: ChoiceVirtualization;\n}\nexport interface ComboboxProps extends ChoiceProps {\n inputValue?: string;\n defaultInputValue?: string;\n onInputValueChange?: (value: string) => void;\n filterMode?: \"local\" | \"external\";\n loading?: boolean;\n error?: string | boolean;\n onRetry?: () => void;\n}\nexport interface SelectPickerProps extends ChoiceProps {}\n\nexport function validateOptions(items: ChoiceOption[]) {\n const ids = new Set<string>();\n for (const item of items) {\n if (!item.value || ids.has(item.value))\n throw new Error(\n `DDS choice: option IDs must be nonempty and unique (${JSON.stringify(item.value)})`,\n );\n ids.add(item.value);\n }\n}\nexport const choiceMessages: Required<ChoiceMessages> = {\n open: \"선택 열기\",\n clear: \"선택 지우기\",\n loading: \"불러오는 중\",\n empty: \"결과 없음\",\n error: \"불러오지 못했습니다\",\n retry: \"다시 시도\",\n};\n\n/** Read the consumer environment at runtime, rather than the library build mode. */\nexport function choiceWarningsEnabled() {\n return (\n (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env\n ?.NODE_ENV !== \"production\"\n );\n}\n"],"mappings":";AAkDA,SAAgB,EAAgB,GAAuB;CACrD,IAAM,oBAAM,IAAI,IAAY;CAC5B,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAI,CAAC,EAAK,SAAS,EAAI,IAAI,EAAK,KAAK,GACnC,MAAU,MACR,uDAAuD,KAAK,UAAU,EAAK,KAAK,EAAE,EACpF;EACF,EAAI,IAAI,EAAK,KAAK;CACpB;AACF;AACA,IAAa,IAA2C;CACtD,MAAM;CACN,OAAO;CACP,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAGA,SAAgB,IAAwB;CACtC,OACG,WAA6D,SAAS,KACnE,aAAa;AAErB"}
package/dist/combobox.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./choice-B3vNMfKK.js";
1
+ import { t as e } from "./choice-N-5K_ggs.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/combobox.tsx
4
4
  function n(n) {
@@ -0,0 +1,151 @@
1
+ //#region src/date-only.ts
2
+ function e(e) {
3
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
4
+ let t = Number(e.slice(0, 4)), n = Number(e.slice(5, 7)), r = Number(e.slice(8, 10));
5
+ return t < 1 || n < 1 || n > 12 || r < 1 ? !1 : r <= [
6
+ 31,
7
+ t % 4 == 0 && (t % 100 != 0 || t % 400 == 0) ? 29 : 28,
8
+ 31,
9
+ 30,
10
+ 31,
11
+ 30,
12
+ 31,
13
+ 31,
14
+ 30,
15
+ 31,
16
+ 30,
17
+ 31
18
+ ][n - 1];
19
+ }
20
+ function t(e) {
21
+ return /^ko(?:-|$)/i.test(e);
22
+ }
23
+ function n(n, r) {
24
+ return t(r) && e(n) ? n.replaceAll("-", "/") : n;
25
+ }
26
+ function r(e, n) {
27
+ return t(n) && /^\d{4}\/\d{2}\/\d{2}$/.test(e) ? e.replaceAll("/", "-") : e;
28
+ }
29
+ function i(n, i, a, o, s = "en-US") {
30
+ let c = r(n, s), l = n.length < 10 && (/^\d{0,4}(?:-\d{0,2}(?:-\d{0,2})?)?$/.test(n) || t(s) && /^\d{0,4}(?:\/\d{0,2}(?:\/\d{0,2})?)?$/.test(n)), u = "valid";
31
+ return n === "" ? u = i ? "required" : "valid" : e(c) ? a && !e(a) || o && !e(o) || a && o && a > o ? u = "invalid" : a && c < a ? u = "rangeUnderflow" : o && c > o && (u = "rangeOverflow") : u = l ? "incomplete" : "invalid", {
32
+ inputValue: n,
33
+ value: u === "valid" ? c : null,
34
+ valid: u === "valid",
35
+ reason: u
36
+ };
37
+ }
38
+ function a(e, n = {}) {
39
+ let r = t(e);
40
+ return {
41
+ previousMonth: r ? "이전 달" : "Previous month",
42
+ nextMonth: r ? "다음 달" : "Next month",
43
+ previousYear: r ? "이전 해" : "Previous year",
44
+ nextYear: r ? "다음 해" : "Next year",
45
+ today: r ? "오늘" : "Today",
46
+ thisMonth: r ? "이번 달" : "This month",
47
+ clear: r ? "선택 날짜 지우기" : "Clear selected date",
48
+ openCalendar: r ? "달력 열기" : "Open calendar",
49
+ selectDate: (e) => r ? `${e} 선택` : `Choose ${e}`,
50
+ required: r ? "날짜를 입력해 주세요." : "Enter a date.",
51
+ invalid: r ? "YYYY/MM/DD 형식의 유효한 범위 내 날짜를 입력해 주세요." : "Enter a valid date within the allowed range (YYYY-MM-DD).",
52
+ ...n
53
+ };
54
+ }
55
+ function o(e) {
56
+ let t = new Intl.DateTimeFormat("en-US-u-ca-gregory-nu-latn", {
57
+ timeZone: e,
58
+ year: "numeric",
59
+ month: "2-digit",
60
+ day: "2-digit"
61
+ }).formatToParts(/* @__PURE__ */ new Date()), n = (e) => t.find((t) => t.type === e).value;
62
+ return `${n("year").padStart(4, "0")}-${n("month")}-${n("day")}`;
63
+ }
64
+ function s(e, n = {}) {
65
+ let r = t(e);
66
+ return {
67
+ ...a(e),
68
+ clear: r ? "선택 기간 지우기" : "Clear selected period",
69
+ startLabel: r ? "시작일" : "Start date",
70
+ endLabel: r ? "종료일" : "End date",
71
+ chooseRange: r ? "기간 선택" : "Choose a period",
72
+ presets: r ? "빠른 기간 선택" : "Quick periods",
73
+ required: r ? "시작일과 종료일을 입력해 주세요." : "Enter a start date and an end date.",
74
+ order: r ? "종료일은 시작일과 같거나 그 이후여야 합니다." : "The end date must be on or after the start date.",
75
+ ...n
76
+ };
77
+ }
78
+ function c(e, t, n, r, a, o = "en-US") {
79
+ let s = i(e, n, r, a, o), c = i(t, n, r, a, o), l = s.valid ? c.valid ? "valid" : c.reason : s.reason;
80
+ return l === "valid" && s.value && c.value && s.value > c.value && (l = "order"), {
81
+ start: s,
82
+ end: c,
83
+ value: l === "valid" ? {
84
+ start: s.value,
85
+ end: c.value
86
+ } : null,
87
+ valid: l === "valid",
88
+ reason: l
89
+ };
90
+ }
91
+ function l(e) {
92
+ if (!/^\d{4}-\d{2}$/.test(e)) return !1;
93
+ let t = Number(e.slice(0, 4)), n = Number(e.slice(5, 7));
94
+ return t >= 1 && n >= 1 && n <= 12;
95
+ }
96
+ function u(e, n) {
97
+ return t(n) && l(e) ? e.replace("-", "/") : e;
98
+ }
99
+ function d(e) {
100
+ let t = /^(\d{4})[-/.](\d{2})$/.exec(e) ?? /^(\d{4})(\d{2})$/.exec(e);
101
+ return t ? `${t[1]}-${t[2]}` : e;
102
+ }
103
+ function f(e, t, n, r) {
104
+ let i = d(e), a = /^\d{0,5}$/.test(e) || /^\d{4}[-/.]\d?$/.test(e), o = "valid";
105
+ return e === "" ? o = t ? "required" : "valid" : l(i) ? n && !l(n) || r && !l(r) || n && r && n > r ? o = "invalid" : n && i < n ? o = "rangeUnderflow" : r && i > r && (o = "rangeOverflow") : o = a ? "incomplete" : "invalid", {
106
+ inputValue: e,
107
+ value: o === "valid" ? i : null,
108
+ valid: o === "valid",
109
+ reason: o
110
+ };
111
+ }
112
+ function p(e, t) {
113
+ return {
114
+ min: e && l(e) ? `${e}-01` : void 0,
115
+ max: t && l(t) ? `${t}-${((e) => {
116
+ let t = Number(e.slice(0, 4)), n = Number(e.slice(5, 7));
117
+ return [
118
+ 31,
119
+ t % 4 == 0 && (t % 100 != 0 || t % 400 == 0) ? 29 : 28,
120
+ 31,
121
+ 30,
122
+ 31,
123
+ 30,
124
+ 31,
125
+ 31,
126
+ 30,
127
+ 31,
128
+ 30,
129
+ 31
130
+ ][n - 1];
131
+ })(t)}` : void 0
132
+ };
133
+ }
134
+ function m(e, n = {}) {
135
+ let r = t(e);
136
+ return {
137
+ previousYear: r ? "이전 해" : "Previous year",
138
+ nextYear: r ? "다음 해" : "Next year",
139
+ thisMonth: r ? "이번 달" : "This month",
140
+ clear: r ? "선택 월 지우기" : "Clear selected month",
141
+ openCalendar: r ? "달력 열기" : "Open calendar",
142
+ chooseMonth: r ? "월 선택" : "Choose a month",
143
+ required: r ? "월을 입력해 주세요." : "Enter a month.",
144
+ invalid: r ? "YYYY/MM 형식의 유효한 범위 내 월을 입력해 주세요." : "Enter a valid month within the allowed range (YYYY-MM).",
145
+ ...n
146
+ };
147
+ }
148
+ //#endregion
149
+ export { u as a, t as c, s as d, o as f, c as h, n as i, p as l, f as m, d as n, e as o, i as p, a as r, l as s, r as t, m as u };
150
+
151
+ //# sourceMappingURL=date-only-Bu4UmsTP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-only-Bu4UmsTP.js","names":[],"sources":["../src/date-only.ts"],"sourcesContent":["export interface DatePickerValidity {\n /** Exact displayed draft; never persist this display text as an API date. */\n inputValue: string;\n /** Valid ISO date, optional empty string, or null when invalid/incomplete. */\n value: string | null;\n valid: boolean;\n reason:\n | \"valid\"\n | \"required\"\n | \"incomplete\"\n | \"invalid\"\n | \"rangeUnderflow\"\n | \"rangeOverflow\";\n}\n// Date-only Gregorian validation: never let a permissive parser repair user text.\nexport function isCalendarDate(value: string) {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return false;\n const year = Number(value.slice(0, 4)),\n month = Number(value.slice(5, 7)),\n day = Number(value.slice(8, 10));\n if (year < 1 || month < 1 || month > 12 || day < 1) return false;\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n return (\n day <=\n [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1]!\n );\n}\nexport function isKorean(locale: string) {\n return /^ko(?:-|$)/i.test(locale);\n}\nexport function displayDate(value: string, locale: string) {\n return isKorean(locale) && isCalendarDate(value)\n ? value.replaceAll(\"-\", \"/\")\n : value;\n}\nexport function canonicalInput(inputValue: string, locale: string) {\n return isKorean(locale) && /^\\d{4}\\/\\d{2}\\/\\d{2}$/.test(inputValue)\n ? inputValue.replaceAll(\"/\", \"-\")\n : inputValue;\n}\nexport function validateInput(\n inputValue: string,\n required: boolean,\n min?: string,\n max?: string,\n locale = \"en-US\",\n): DatePickerValidity {\n const canonical = canonicalInput(inputValue, locale);\n const incomplete =\n inputValue.length < 10 &&\n (/^\\d{0,4}(?:-\\d{0,2}(?:-\\d{0,2})?)?$/.test(inputValue) ||\n (isKorean(locale) &&\n /^\\d{0,4}(?:\\/\\d{0,2}(?:\\/\\d{0,2})?)?$/.test(inputValue)));\n let reason: DatePickerValidity[\"reason\"] = \"valid\";\n if (inputValue === \"\") reason = required ? \"required\" : \"valid\";\n else if (!isCalendarDate(canonical))\n reason = incomplete ? \"incomplete\" : \"invalid\";\n else if (\n (min && !isCalendarDate(min)) ||\n (max && !isCalendarDate(max)) ||\n (min && max && min > max)\n )\n reason = \"invalid\";\n else if (min && canonical < min) reason = \"rangeUnderflow\";\n else if (max && canonical > max) reason = \"rangeOverflow\";\n return {\n inputValue,\n value: reason === \"valid\" ? canonical : null,\n valid: reason === \"valid\",\n reason,\n };\n}\n\nexport interface CalendarMessages {\n previousMonth?: string;\n nextMonth?: string;\n /** Month-grid header controls (MonthPicker). */\n previousYear?: string;\n nextYear?: string;\n today?: string;\n /** Footer action of the month grid (MonthPicker). */\n thisMonth?: string;\n clear?: string;\n openCalendar?: string;\n selectDate?: (dateText: string) => string;\n required?: string;\n invalid?: string;\n}\nexport function dateMessages(locale: string, messages: CalendarMessages = {}) {\n const ko = isKorean(locale);\n return {\n previousMonth: ko ? \"이전 달\" : \"Previous month\",\n nextMonth: ko ? \"다음 달\" : \"Next month\",\n previousYear: ko ? \"이전 해\" : \"Previous year\",\n nextYear: ko ? \"다음 해\" : \"Next year\",\n today: ko ? \"오늘\" : \"Today\",\n thisMonth: ko ? \"이번 달\" : \"This month\",\n clear: ko ? \"선택 날짜 지우기\" : \"Clear selected date\",\n openCalendar: ko ? \"달력 열기\" : \"Open calendar\",\n selectDate: (text: string) => (ko ? `${text} 선택` : `Choose ${text}`),\n required: ko ? \"날짜를 입력해 주세요.\" : \"Enter a date.\",\n invalid: ko\n ? \"YYYY/MM/DD 형식의 유효한 범위 내 날짜를 입력해 주세요.\"\n : \"Enter a valid date within the allowed range (YYYY-MM-DD).\",\n ...messages,\n };\n}\n\n/** Today is the sole timestamp boundary; stored dates remain Gregorian date-only strings. */\nexport function todayDate(timeZone: string) {\n const parts = new Intl.DateTimeFormat(\"en-US-u-ca-gregory-nu-latn\", {\n timeZone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n }).formatToParts(new Date());\n const part = (type: string) =>\n parts.find((item) => item.type === type)!.value;\n return `${part(\"year\").padStart(4, \"0\")}-${part(\"month\")}-${part(\"day\")}`;\n}\n\n/* ── Date ranges ─────────────────────────────────────────────────────────── */\n\n/** A period of two date-only values; either side may be \"\" (not chosen). */\nexport interface DateRange {\n start: string;\n end: string;\n}\n\nexport interface DateRangeMessages extends CalendarMessages {\n /** Accessible name of the first input. */\n startLabel?: string;\n /** Accessible name of the second input. */\n endLabel?: string;\n /** Accessible name of the calendar popup. */\n chooseRange?: string;\n /** Shown when both dates are typed but the end is before the start. */\n order?: string;\n /** Accessible name of the preset button group. */\n presets?: string;\n}\n\nexport function rangeMessages(locale: string, messages: DateRangeMessages = {}) {\n const ko = isKorean(locale);\n return {\n ...dateMessages(locale),\n clear: ko ? \"선택 기간 지우기\" : \"Clear selected period\",\n startLabel: ko ? \"시작일\" : \"Start date\",\n endLabel: ko ? \"종료일\" : \"End date\",\n chooseRange: ko ? \"기간 선택\" : \"Choose a period\",\n presets: ko ? \"빠른 기간 선택\" : \"Quick periods\",\n required: ko\n ? \"시작일과 종료일을 입력해 주세요.\"\n : \"Enter a start date and an end date.\",\n order: ko\n ? \"종료일은 시작일과 같거나 그 이후여야 합니다.\"\n : \"The end date must be on or after the start date.\",\n ...messages,\n };\n}\n\nexport interface DateRangeValidity {\n start: DatePickerValidity;\n end: DatePickerValidity;\n /** Canonical range, or null while either side is invalid/incomplete or out of order. */\n value: DateRange | null;\n valid: boolean;\n reason: DatePickerValidity[\"reason\"] | \"order\";\n}\n\n/** Each side follows DatePicker's rules; a typed end before the start is invalid, never swapped. */\nexport function validateRange(\n startText: string,\n endText: string,\n required: boolean,\n min?: string,\n max?: string,\n locale = \"en-US\",\n): DateRangeValidity {\n const start = validateInput(startText, required, min, max, locale),\n end = validateInput(endText, required, min, max, locale);\n let reason: DateRangeValidity[\"reason\"] = !start.valid\n ? start.reason\n : !end.valid\n ? end.reason\n : \"valid\";\n if (reason === \"valid\" && start.value && end.value && start.value > end.value)\n reason = \"order\";\n return {\n start,\n end,\n value:\n reason === \"valid\" ? { start: start.value!, end: end.value! } : null,\n valid: reason === \"valid\",\n reason,\n };\n}\n\n/* ── Months ──────────────────────────────────────────────────────────────── */\n\nexport function isCalendarMonth(value: string) {\n if (!/^\\d{4}-\\d{2}$/.test(value)) return false;\n const year = Number(value.slice(0, 4)),\n month = Number(value.slice(5, 7));\n return year >= 1 && month >= 1 && month <= 12;\n}\n\nexport function displayMonth(value: string, locale: string) {\n return isKorean(locale) && isCalendarMonth(value)\n ? value.replace(\"-\", \"/\")\n : value;\n}\n\n/** Accepts YYYY-MM, YYYY/MM, YYYY.MM and YYYYMM; other text is returned unchanged. */\nexport function canonicalMonth(inputValue: string) {\n const match =\n /^(\\d{4})[-/.](\\d{2})$/.exec(inputValue) ?? /^(\\d{4})(\\d{2})$/.exec(inputValue);\n return match ? `${match[1]}-${match[2]}` : inputValue;\n}\n\nexport interface MonthPickerValidity {\n /** Exact displayed draft; never persist this display text as an API month. */\n inputValue: string;\n /** Valid YYYY-MM, optional empty string, or null when invalid/incomplete. */\n value: string | null;\n valid: boolean;\n reason: DatePickerValidity[\"reason\"];\n}\n\nexport function validateMonth(\n inputValue: string,\n required: boolean,\n min?: string,\n max?: string,\n): MonthPickerValidity {\n const canonical = canonicalMonth(inputValue);\n const incomplete = /^\\d{0,5}$/.test(inputValue) || /^\\d{4}[-/.]\\d?$/.test(inputValue);\n let reason: MonthPickerValidity[\"reason\"] = \"valid\";\n if (inputValue === \"\") reason = required ? \"required\" : \"valid\";\n else if (!isCalendarMonth(canonical))\n reason = incomplete ? \"incomplete\" : \"invalid\";\n else if (\n (min && !isCalendarMonth(min)) ||\n (max && !isCalendarMonth(max)) ||\n (min && max && min > max)\n )\n reason = \"invalid\";\n else if (min && canonical < min) reason = \"rangeUnderflow\";\n else if (max && canonical > max) reason = \"rangeOverflow\";\n return {\n inputValue,\n value: reason === \"valid\" ? canonical : null,\n valid: reason === \"valid\",\n reason,\n };\n}\n\n/** Month bounds widened to whole days, so any day inside an allowed month stays selectable. */\nexport function monthBounds(min?: string, max?: string) {\n const last = (month: string) => {\n const year = Number(month.slice(0, 4)),\n index = Number(month.slice(5, 7)),\n leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n return [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][index - 1]!;\n };\n return {\n min: min && isCalendarMonth(min) ? `${min}-01` : undefined,\n max: max && isCalendarMonth(max) ? `${max}-${last(max)}` : undefined,\n };\n}\n\nexport interface MonthPickerMessages {\n previousYear?: string;\n nextYear?: string;\n thisMonth?: string;\n clear?: string;\n openCalendar?: string;\n /** Accessible name of the month popup. */\n chooseMonth?: string;\n required?: string;\n invalid?: string;\n}\n\nexport function monthMessages(locale: string, messages: MonthPickerMessages = {}) {\n const ko = isKorean(locale);\n return {\n previousYear: ko ? \"이전 해\" : \"Previous year\",\n nextYear: ko ? \"다음 해\" : \"Next year\",\n thisMonth: ko ? \"이번 달\" : \"This month\",\n clear: ko ? \"선택 월 지우기\" : \"Clear selected month\",\n openCalendar: ko ? \"달력 열기\" : \"Open calendar\",\n chooseMonth: ko ? \"월 선택\" : \"Choose a month\",\n required: ko ? \"월을 입력해 주세요.\" : \"Enter a month.\",\n invalid: ko\n ? \"YYYY/MM 형식의 유효한 범위 내 월을 입력해 주세요.\"\n : \"Enter a valid month within the allowed range (YYYY-MM).\",\n ...messages,\n };\n}\n"],"mappings":";AAeA,SAAgB,EAAe,GAAe;CAC5C,IAAI,CAAC,sBAAsB,KAAK,CAAK,GAAG,OAAO;CAC/C,IAAM,IAAO,OAAO,EAAM,MAAM,GAAG,CAAC,CAAC,GACnC,IAAQ,OAAO,EAAM,MAAM,GAAG,CAAC,CAAC,GAChC,IAAM,OAAO,EAA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MAAkB;GAC9B,IAAM,IAAO,OAAO,EAAM,MAAM,GAAG,CAAC,CAAC,GACnC,IAAQ,OAAO,EAAM,MAAM,GAAG,CAAC,CAAC;GAElC,OAAO;IAAC;IADC,IAAO,KAAM,MAAM,IAAO,OAAQ,KAAK,IAAO,OAAQ,KAC5C,KAAK;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;GAAE,CAAC,CAAC,IAAQ;EAC9E,EAG+C,CAAK,CAAG,MAAM,KAAA;CAC7D;AACF;AAcA,SAAgB,EAAc,GAAgB,IAAgC,CAAC,GAAG;CAChF,IAAM,IAAK,EAAS,CAAM;CAC1B,OAAO;EACL,cAAc,IAAK,SAAS;EAC5B,UAAU,IAAK,SAAS;EACxB,WAAW,IAAK,SAAS;EACzB,OAAO,IAAK,aAAa;EACzB,cAAc,IAAK,UAAU;EAC7B,aAAa,IAAK,SAAS;EAC3B,UAAU,IAAK,gBAAgB;EAC/B,SAAS,IACL,qCACA;EACJ,GAAG;CACL;AACF"}
@@ -14,7 +14,12 @@ export declare function validateInput(inputValue: string, required: boolean, min
14
14
  export interface CalendarMessages {
15
15
  previousMonth?: string;
16
16
  nextMonth?: string;
17
+ /** Month-grid header controls (MonthPicker). */
18
+ previousYear?: string;
19
+ nextYear?: string;
17
20
  today?: string;
21
+ /** Footer action of the month grid (MonthPicker). */
22
+ thisMonth?: string;
18
23
  clear?: string;
19
24
  openCalendar?: string;
20
25
  selectDate?: (dateText: string) => string;
@@ -24,7 +29,10 @@ export interface CalendarMessages {
24
29
  export declare function dateMessages(locale: string, messages?: CalendarMessages): {
25
30
  previousMonth: string;
26
31
  nextMonth: string;
32
+ previousYear: string;
33
+ nextYear: string;
27
34
  today: string;
35
+ thisMonth: string;
28
36
  clear: string;
29
37
  openCalendar: string;
30
38
  selectDate: (text: string) => string;
@@ -33,4 +41,88 @@ export declare function dateMessages(locale: string, messages?: CalendarMessages
33
41
  };
34
42
  /** Today is the sole timestamp boundary; stored dates remain Gregorian date-only strings. */
35
43
  export declare function todayDate(timeZone: string): string;
44
+ /** A period of two date-only values; either side may be "" (not chosen). */
45
+ export interface DateRange {
46
+ start: string;
47
+ end: string;
48
+ }
49
+ export interface DateRangeMessages extends CalendarMessages {
50
+ /** Accessible name of the first input. */
51
+ startLabel?: string;
52
+ /** Accessible name of the second input. */
53
+ endLabel?: string;
54
+ /** Accessible name of the calendar popup. */
55
+ chooseRange?: string;
56
+ /** Shown when both dates are typed but the end is before the start. */
57
+ order?: string;
58
+ /** Accessible name of the preset button group. */
59
+ presets?: string;
60
+ }
61
+ export declare function rangeMessages(locale: string, messages?: DateRangeMessages): {
62
+ previousMonth: string;
63
+ nextMonth: string;
64
+ previousYear: string;
65
+ nextYear: string;
66
+ today: string;
67
+ thisMonth: string;
68
+ openCalendar: string;
69
+ selectDate: (text: string) => string;
70
+ invalid: string;
71
+ clear: string;
72
+ startLabel: string;
73
+ endLabel: string;
74
+ chooseRange: string;
75
+ presets: string;
76
+ required: string;
77
+ order: string;
78
+ };
79
+ export interface DateRangeValidity {
80
+ start: DatePickerValidity;
81
+ end: DatePickerValidity;
82
+ /** Canonical range, or null while either side is invalid/incomplete or out of order. */
83
+ value: DateRange | null;
84
+ valid: boolean;
85
+ reason: DatePickerValidity["reason"] | "order";
86
+ }
87
+ /** Each side follows DatePicker's rules; a typed end before the start is invalid, never swapped. */
88
+ export declare function validateRange(startText: string, endText: string, required: boolean, min?: string, max?: string, locale?: string): DateRangeValidity;
89
+ export declare function isCalendarMonth(value: string): boolean;
90
+ export declare function displayMonth(value: string, locale: string): string;
91
+ /** Accepts YYYY-MM, YYYY/MM, YYYY.MM and YYYYMM; other text is returned unchanged. */
92
+ export declare function canonicalMonth(inputValue: string): string;
93
+ export interface MonthPickerValidity {
94
+ /** Exact displayed draft; never persist this display text as an API month. */
95
+ inputValue: string;
96
+ /** Valid YYYY-MM, optional empty string, or null when invalid/incomplete. */
97
+ value: string | null;
98
+ valid: boolean;
99
+ reason: DatePickerValidity["reason"];
100
+ }
101
+ export declare function validateMonth(inputValue: string, required: boolean, min?: string, max?: string): MonthPickerValidity;
102
+ /** Month bounds widened to whole days, so any day inside an allowed month stays selectable. */
103
+ export declare function monthBounds(min?: string, max?: string): {
104
+ min: string | undefined;
105
+ max: string | undefined;
106
+ };
107
+ export interface MonthPickerMessages {
108
+ previousYear?: string;
109
+ nextYear?: string;
110
+ thisMonth?: string;
111
+ clear?: string;
112
+ openCalendar?: string;
113
+ /** Accessible name of the month popup. */
114
+ chooseMonth?: string;
115
+ required?: string;
116
+ invalid?: string;
117
+ }
118
+ export declare function monthMessages(locale: string, messages?: MonthPickerMessages): {
119
+ previousYear: string;
120
+ nextYear: string;
121
+ thisMonth: string;
122
+ clear: string;
123
+ openCalendar: string;
124
+ chooseMonth: string;
125
+ required: string;
126
+ invalid: string;
127
+ };
36
128
  //# sourceMappingURL=date-only.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-only.d.ts","sourceRoot":"","sources":["../src/date-only.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EACF,OAAO,GACP,UAAU,GACV,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,eAAe,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,WAW3C;AACD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,WAEtC;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAIxD;AACD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAIhE;AACD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,EACjB,GAAG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B;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,mBAAwB;;;;;;;;;EAe/E"}
@@ -1,11 +1,12 @@
1
1
  import { r as e, t } from "./controls-BajigKUv.js";
2
- import { a as n, i as r, n as i, o as ee, r as a, s as o, t as s } from "./calendar-view-I_sNlioP.js";
2
+ import { c as n, i as r, o as i, p as a, r as ee, t as o } from "./date-only-Bu4UmsTP.js";
3
+ import { t as s } from "./calendar-view-BxjCQV9k.js";
3
4
  import { useEffect as c, useRef as l, useState as u } from "react";
4
5
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
- import { Portal as p } from "@ark-ui/react/portal";
6
- import { DatePicker as m, parseDate as h } from "@ark-ui/react/date-picker";
6
+ import { Portal as te } from "@ark-ui/react/portal";
7
+ import { DatePicker as p, parseDate as m } from "@ark-ui/react/date-picker";
7
8
  //#region src/date-picker.tsx
8
- function g() {
9
+ function h() {
9
10
  return /* @__PURE__ */ f("svg", {
10
11
  width: "20",
11
12
  height: "20",
@@ -23,11 +24,11 @@ function g() {
23
24
  }), /* @__PURE__ */ d("path", { d: "M7.5 3v5M16.5 3v5M3.5 10.5h17" })]
24
25
  });
25
26
  }
26
- function _(e) {
27
- return n(e) ? [h(e)] : [];
27
+ function g(e) {
28
+ return i(e) ? [m(e)] : [];
28
29
  }
29
- function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S = "Asia/Seoul", disabled: C = !1, readOnly: w = !1, required: T = !1, onValidityChange: E, min: D, max: O, startOfWeek: k = 0, labelPlacement: te = "outside", messages: A, clearable: ne = !0, showToday: re = !0 }) {
30
- let [j, M] = u(() => r(y, x)), [N, P] = u(() => _(y)), [F, I] = u(!1), L = l(null), R = l(null), z = l(void 0);
30
+ function _({ label: _, value: v, onChange: y, locale: b = "ko-KR", timeZone: x = "Asia/Seoul", disabled: S = !1, readOnly: C = !1, required: w = !1, onValidityChange: T, min: E, max: D, startOfWeek: O = 0, labelPlacement: k = "outside", messages: A, clearable: ne = !0, showToday: re = !0 }) {
31
+ let [j, M] = u(() => r(v, b)), [N, P] = u(() => g(v)), [F, I] = u(!1), L = l(null), R = l(null), z = l(void 0);
31
32
  c(() => () => {
32
33
  z.current !== void 0 && cancelAnimationFrame(z.current);
33
34
  }, []);
@@ -36,36 +37,36 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
36
37
  let e = L.current;
37
38
  e && V(e.closest("[role=\"dialog\"], [role=\"alertdialog\"]") ?? e.ownerDocument.body);
38
39
  }, []);
39
- let H = l(!1), U = l(y), W = l(x), G = l([]), K = l(y), q = l(""), J = i(j, W.current), Y = W.current !== x && n(J) ? r(J, x) : j, X = o(Y, T, D, O, x), Z = a(x, A), Q = X.valid ? void 0 : X.reason === "required" ? Z.required : Z.invalid;
40
+ let H = l(!1), U = l(v), W = l(b), G = l([]), K = l(v), q = l(""), J = o(j, W.current), Y = W.current !== b && i(J) ? r(J, b) : j, X = a(Y, w, E, D, b), Z = ee(b, A), Q = X.valid ? void 0 : X.reason === "required" ? Z.required : Z.invalid;
40
41
  c(() => {
41
42
  let e = W.current;
42
- if (W.current = x, U.current === y) {
43
- e !== x && M(Y);
43
+ if (W.current = b, U.current === v) {
44
+ e !== b && M(Y);
44
45
  return;
45
46
  }
46
- U.current = y;
47
- let t = G.current.indexOf(y);
47
+ U.current = v;
48
+ let t = G.current.indexOf(v);
48
49
  if (t !== -1) {
49
50
  G.current.splice(t, 1);
50
51
  return;
51
52
  }
52
- G.current = [], K.current = y, M(r(y, x)), (y === "" || n(y)) && P(_(y));
53
- }, [y, x]), c(() => {
53
+ G.current = [], K.current = v, M(r(v, b)), (v === "" || i(v)) && P(g(v));
54
+ }, [v, b]), c(() => {
54
55
  L.current?.setCustomValidity(Q ?? "");
55
56
  let e = JSON.stringify(X);
56
- E && q.current !== e && (q.current = e, E(X));
57
+ T && q.current !== e && (q.current = e, T(X));
57
58
  }, [
58
59
  j,
59
- T,
60
+ w,
61
+ E,
60
62
  D,
61
- O,
62
- x,
63
+ b,
63
64
  Q,
64
- E
65
+ T
65
66
  ]), c(() => {
66
- (C || w) && (H.current = !1, I(!1));
67
- }, [C, w]), c(() => {
68
- if (!H.current || C || w) return;
67
+ (S || C) && (H.current = !1, I(!1));
68
+ }, [S, C]), c(() => {
69
+ if (!H.current || S || C) return;
69
70
  let e = requestAnimationFrame(() => {
70
71
  H.current = !1, L.current?.focus({ preventScroll: !0 });
71
72
  });
@@ -73,38 +74,38 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
73
74
  }, [
74
75
  F,
75
76
  N,
76
- C,
77
- w
77
+ S,
78
+ C
78
79
  ]);
79
80
  function $(e) {
80
- let t = o(e, T, D, O, x);
81
+ let t = a(e, w, E, D, b);
81
82
  if (e !== "" && !t.valid) return;
82
83
  let n = e === "" ? "" : t.value;
83
- P(_(n)), n !== K.current && (K.current = n, G.current.push(n), b(n));
84
+ P(g(n)), n !== K.current && (K.current = n, G.current.push(n), y(n));
84
85
  }
85
86
  function ie(e) {
86
87
  M(e);
87
- let t = o(e, T, D, O, x);
88
- L.current?.setCustomValidity(t.valid ? "" : Q ?? "Enter a valid date (YYYY-MM-DD)."), (e === "" || t.valid) && (M(r(t.value ?? "", x)), $(e));
88
+ let t = a(e, w, E, D, b);
89
+ L.current?.setCustomValidity(t.valid ? "" : Q ?? "Enter a valid date (YYYY-MM-DD)."), (e === "" || t.valid) && (M(r(t.value ?? "", b)), $(e));
89
90
  }
90
91
  return /* @__PURE__ */ d(e, {
91
- label: v,
92
- required: T,
92
+ label: _,
93
+ required: w,
93
94
  error: Q,
94
- className: `dds-date-picker dds-date-picker--${te}`,
95
+ className: `dds-date-picker dds-date-picker--${k}`,
95
96
  "data-filled": Y === "" ? void 0 : "true",
96
- children: (e) => /* @__PURE__ */ f(m.Root, {
97
- locale: x,
98
- timeZone: S,
99
- disabled: C,
100
- readOnly: w,
101
- required: T,
97
+ children: (e) => /* @__PURE__ */ f(p.Root, {
98
+ locale: b,
99
+ timeZone: x,
100
+ disabled: S,
101
+ readOnly: C,
102
+ required: w,
102
103
  invalid: !X.valid,
103
- open: F && !C && !w,
104
- onOpenChange: (e) => I(e.open && !C && !w),
105
- min: D && n(D) ? h(D) : void 0,
106
- max: O && n(O) ? h(O) : void 0,
107
- startOfWeek: k,
104
+ open: F && !S && !C,
105
+ onOpenChange: (e) => I(e.open && !S && !C),
106
+ min: E && i(E) ? m(E) : void 0,
107
+ max: D && i(D) ? m(D) : void 0,
108
+ startOfWeek: O,
108
109
  minView: "day",
109
110
  maxView: "day",
110
111
  fixedWeeks: !0,
@@ -113,10 +114,10 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
113
114
  clearTrigger: Z.clear
114
115
  },
115
116
  value: N,
116
- format: (e) => r(e.toString(), x),
117
+ format: (e) => r(e.toString(), b),
117
118
  onValueChange: (e) => {
118
119
  let t = e.value[0]?.toString() || "";
119
- t !== "" && !o(t, T, D, O, x).valid || (H.current = !0, M(r(t, x)), $(t));
120
+ t !== "" && !a(t, w, E, D, b).valid || (H.current = !0, M(r(t, b)), $(t));
120
121
  },
121
122
  positioning: {
122
123
  placement: "bottom-start",
@@ -124,7 +125,7 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
124
125
  strategy: B?.matches("[role=\"dialog\"], [role=\"alertdialog\"]") ? "fixed" : "absolute",
125
126
  hideWhenDetached: !!B?.matches("[role=\"dialog\"], [role=\"alertdialog\"]")
126
127
  },
127
- children: [/* @__PURE__ */ f(m.Control, {
128
+ children: [/* @__PURE__ */ f(p.Control, {
128
129
  className: "dds-date-picker-control",
129
130
  children: [/* @__PURE__ */ d("input", {
130
131
  ...e,
@@ -132,54 +133,54 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
132
133
  type: "text",
133
134
  value: Y,
134
135
  onChange: () => {},
135
- required: T,
136
- readOnly: w,
137
- disabled: C,
138
- placeholder: ee(x) ? "YYYY/MM/DD" : "YYYY-MM-DD",
136
+ required: w,
137
+ readOnly: C,
138
+ disabled: S,
139
+ placeholder: n(b) ? "YYYY/MM/DD" : "YYYY-MM-DD",
139
140
  autoComplete: "off",
140
141
  autoCorrect: "off",
141
142
  spellCheck: !1,
142
143
  onInputCapture: (e) => {
143
- C || w || (e.stopPropagation(), ie(e.currentTarget.value));
144
+ S || C || (e.stopPropagation(), ie(e.currentTarget.value));
144
145
  },
145
146
  onBlur: () => {
146
- !C && !w && $(Y);
147
+ !S && !C && $(Y);
147
148
  },
148
149
  onKeyDownCapture: (e) => {
149
- e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), !C && !w && $(Y));
150
+ e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), !S && !C && $(Y));
150
151
  }
151
- }), /* @__PURE__ */ d(m.Trigger, {
152
+ }), /* @__PURE__ */ d(p.Trigger, {
152
153
  asChild: !0,
153
154
  children: /* @__PURE__ */ d(t, {
154
155
  ref: R,
155
156
  type: "button",
156
157
  tone: "secondary",
157
- "aria-label": `${v} ${Z.openCalendar}`,
158
- children: /* @__PURE__ */ d(g, {})
158
+ "aria-label": `${_} ${Z.openCalendar}`,
159
+ children: /* @__PURE__ */ d(h, {})
159
160
  })
160
161
  })]
161
- }), /* @__PURE__ */ d(p, {
162
+ }), /* @__PURE__ */ d(te, {
162
163
  container: B ? { current: B } : void 0,
163
- children: /* @__PURE__ */ d(m.Positioner, {
164
+ children: /* @__PURE__ */ d(p.Positioner, {
164
165
  className: "dds-date-picker-positioner",
165
- children: /* @__PURE__ */ d(m.Content, {
166
+ children: /* @__PURE__ */ d(p.Content, {
166
167
  onKeyDownCapture: (e) => {
167
168
  e.key === "Escape" && (H.current = !1, z.current !== void 0 && cancelAnimationFrame(z.current), z.current = requestAnimationFrame(() => {
168
169
  z.current = requestAnimationFrame(() => {
169
- !C && !w && R.current?.focus({ preventScroll: !0 });
170
+ !S && !C && R.current?.focus({ preventScroll: !0 });
170
171
  });
171
172
  }));
172
173
  },
173
174
  className: "dds-date-picker-content",
174
- "aria-label": `${v} 날짜 선택`,
175
+ "aria-label": `${_} 날짜 선택`,
175
176
  children: /* @__PURE__ */ d(s, {
176
- timeZone: S,
177
- min: D,
178
- max: O,
179
- locale: x,
177
+ timeZone: x,
178
+ min: E,
179
+ max: D,
180
+ locale: b,
180
181
  messages: A,
181
- disabled: C,
182
- readOnly: w,
182
+ disabled: S,
183
+ readOnly: C,
183
184
  showToday: re,
184
185
  showClear: ne,
185
186
  onClear: () => {
@@ -193,6 +194,6 @@ function v({ label: v, value: y, onChange: b, locale: x = "ko-KR", timeZone: S =
193
194
  });
194
195
  }
195
196
  //#endregion
196
- export { v as DatePicker };
197
+ export { _ as DatePicker };
197
198
 
198
199
  //# sourceMappingURL=date-picker.js.map