@devslab/dds-react 0.24.0 → 0.25.1
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/README.ko.md +3 -2
- package/README.md +3 -2
- package/dist/calendar-view-BxjCQV9k.js +119 -0
- package/dist/calendar-view-BxjCQV9k.js.map +1 -0
- package/dist/calendar-view.d.ts +11 -1
- package/dist/calendar-view.d.ts.map +1 -1
- package/dist/calendar.js +5 -4
- package/dist/calendar.js.map +1 -1
- package/dist/choice-CWXdcWkH.js +295 -0
- package/dist/choice-CWXdcWkH.js.map +1 -0
- package/dist/choice-types-kSaEnZPr.js +23 -0
- package/dist/choice-types-kSaEnZPr.js.map +1 -0
- package/dist/combobox.js +1 -1
- package/dist/date-only-Bu4UmsTP.js +151 -0
- package/dist/date-only-Bu4UmsTP.js.map +1 -0
- package/dist/date-only.d.ts +92 -0
- package/dist/date-only.d.ts.map +1 -1
- package/dist/date-picker.js +69 -68
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.d.ts +41 -0
- package/dist/date-range-picker.d.ts.map +1 -0
- package/dist/date-range-picker.js +327 -0
- package/dist/date-range-picker.js.map +1 -0
- package/dist/direction-DbZcVPsZ.js +21 -0
- package/dist/direction-DbZcVPsZ.js.map +1 -0
- package/dist/direction.d.ts +5 -0
- package/dist/direction.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -103
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/internal/choice.d.ts +27 -3
- package/dist/internal/choice.d.ts.map +1 -1
- package/dist/month-picker.d.ts +33 -0
- package/dist/month-picker.d.ts.map +1 -0
- package/dist/month-picker.js +242 -0
- package/dist/month-picker.js.map +1 -0
- package/dist/number-input.d.ts +53 -0
- package/dist/number-input.d.ts.map +1 -0
- package/dist/number-input.js +254 -0
- package/dist/number-input.js.map +1 -0
- package/dist/segmented-control.d.ts +40 -0
- package/dist/segmented-control.d.ts.map +1 -0
- package/dist/segmented-control.js +73 -0
- package/dist/segmented-control.js.map +1 -0
- package/dist/select-picker.js +1 -1
- package/dist/time-only.d.ts +32 -0
- package/dist/time-only.d.ts.map +1 -0
- package/dist/time-picker-BNmQMQdq.js +100 -0
- package/dist/time-picker-BNmQMQdq.js.map +1 -0
- package/dist/time-picker.d.ts +34 -0
- package/dist/time-picker.d.ts.map +1 -0
- package/dist/time-picker.js +2 -0
- package/package.json +29 -4
- package/styles.css +31 -1
- package/dist/calendar-view-I_sNlioP.js +0 -145
- package/dist/calendar-view-I_sNlioP.js.map +0 -1
- package/dist/choice-B3vNMfKK.js +0 -300
- package/dist/choice-B3vNMfKK.js.map +0 -1
|
@@ -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,EAAM,MAAM,GAAG,EAAE,CAAC;CAGjC,OAFI,IAAO,KAAK,IAAQ,KAAK,IAAQ,MAAM,IAAM,IAAU,KAGzD,KACA;EAAC;EAHU,IAAO,KAAM,MAAM,IAAO,OAAQ,KAAK,IAAO,OAAQ,KAGrD,KAAK;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;CAAE,CAAC,CAAC,IAAQ;AAEzE;AACA,SAAgB,EAAS,GAAgB;CACvC,OAAO,cAAc,KAAK,CAAM;AAClC;AACA,SAAgB,EAAY,GAAe,GAAgB;CACzD,OAAO,EAAS,CAAM,KAAK,EAAe,CAAK,IAC3C,EAAM,WAAW,KAAK,GAAG,IACzB;AACN;AACA,SAAgB,EAAe,GAAoB,GAAgB;CACjE,OAAO,EAAS,CAAM,KAAK,wBAAwB,KAAK,CAAU,IAC9D,EAAW,WAAW,KAAK,GAAG,IAC9B;AACN;AACA,SAAgB,EACd,GACA,GACA,GACA,GACA,IAAS,SACW;CACpB,IAAM,IAAY,EAAe,GAAY,CAAM,GAC7C,IACJ,EAAW,SAAS,OACnB,sCAAsC,KAAK,CAAU,KACnD,EAAS,CAAM,KACd,wCAAwC,KAAK,CAAU,IACzD,IAAuC;CAY3C,OAXI,MAAe,KAAI,IAAS,IAAW,aAAa,UAC9C,EAAe,CAAS,IAG/B,KAAO,CAAC,EAAe,CAAG,KAC1B,KAAO,CAAC,EAAe,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AO,KAAO,IAAM,IAErB,IAAS,YACF,KAAO,IAAY,IAAK,IAAS,mBACjC,KAAO,IAAY,MAAK,IAAS,mBARxC,IAAS,IAAa,eAAe,WAShC;EACL;EACA,OAAO,MAAW,UAAU,IAAY;EACxC,OAAO,MAAW;EAClB;CACF;AACF;AAGA,SAAgB,EAAY,GAAc,GAAc;CAOtD,OAAO;EACL,KAAK,KAAO,EAAgB,CAAG,IAAI,GAAG,EAAI,OAAO,KAAA;EACjD,KAAK,KAAO,EAAgB,CAAG,IAAI,GAAG,EAAI,KAR9B,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"}
|
package/dist/date-only.d.ts
CHANGED
|
@@ -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
|
package/dist/date-only.d.ts.map
CHANGED
|
@@ -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,CAAC,EAAE,MAAM,EACZ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,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"}
|
package/dist/date-picker.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { r as e, t } from "./controls-BajigKUv.js";
|
|
2
|
-
import {
|
|
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
|
|
6
|
-
import { DatePicker as
|
|
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
|
|
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
|
|
27
|
-
return
|
|
27
|
+
function g(e) {
|
|
28
|
+
return i(e) ? [m(e)] : [];
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
let [j, M] = u(() => r(
|
|
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(
|
|
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 =
|
|
43
|
-
e !==
|
|
43
|
+
if (W.current = b, U.current === v) {
|
|
44
|
+
e !== b && M(Y);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
U.current =
|
|
47
|
-
let t = G.current.indexOf(
|
|
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 =
|
|
53
|
-
}, [
|
|
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
|
-
|
|
57
|
+
T && q.current !== e && (q.current = e, T(X));
|
|
57
58
|
}, [
|
|
58
59
|
j,
|
|
59
|
-
|
|
60
|
+
w,
|
|
61
|
+
E,
|
|
60
62
|
D,
|
|
61
|
-
|
|
62
|
-
x,
|
|
63
|
+
b,
|
|
63
64
|
Q,
|
|
64
|
-
|
|
65
|
+
T
|
|
65
66
|
]), c(() => {
|
|
66
|
-
(
|
|
67
|
-
}, [
|
|
68
|
-
if (!H.current ||
|
|
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
|
-
|
|
77
|
-
|
|
77
|
+
S,
|
|
78
|
+
C
|
|
78
79
|
]);
|
|
79
80
|
function $(e) {
|
|
80
|
-
let t =
|
|
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(
|
|
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 =
|
|
88
|
-
L.current?.setCustomValidity(t.valid ? "" : Q ?? "Enter a valid date (YYYY-MM-DD)."), (e === "" || t.valid) && (M(r(t.value ?? "",
|
|
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:
|
|
92
|
-
required:
|
|
92
|
+
label: _,
|
|
93
|
+
required: w,
|
|
93
94
|
error: Q,
|
|
94
|
-
className: `dds-date-picker dds-date-picker--${
|
|
95
|
+
className: `dds-date-picker dds-date-picker--${k}`,
|
|
95
96
|
"data-filled": Y === "" ? void 0 : "true",
|
|
96
|
-
children: (e) => /* @__PURE__ */ f(
|
|
97
|
-
locale:
|
|
98
|
-
timeZone:
|
|
99
|
-
disabled:
|
|
100
|
-
readOnly:
|
|
101
|
-
required:
|
|
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 && !
|
|
104
|
-
onOpenChange: (e) => I(e.open && !
|
|
105
|
-
min:
|
|
106
|
-
max:
|
|
107
|
-
startOfWeek:
|
|
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(),
|
|
117
|
+
format: (e) => r(e.toString(), b),
|
|
117
118
|
onValueChange: (e) => {
|
|
118
119
|
let t = e.value[0]?.toString() || "";
|
|
119
|
-
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(
|
|
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:
|
|
136
|
-
readOnly:
|
|
137
|
-
disabled:
|
|
138
|
-
placeholder:
|
|
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
|
-
|
|
144
|
+
S || C || (e.stopPropagation(), ie(e.currentTarget.value));
|
|
144
145
|
},
|
|
145
146
|
onBlur: () => {
|
|
146
|
-
!
|
|
147
|
+
!S && !C && $(Y);
|
|
147
148
|
},
|
|
148
149
|
onKeyDownCapture: (e) => {
|
|
149
|
-
e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), !
|
|
150
|
+
e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), !S && !C && $(Y));
|
|
150
151
|
}
|
|
151
|
-
}), /* @__PURE__ */ d(
|
|
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": `${
|
|
158
|
-
children: /* @__PURE__ */ d(
|
|
158
|
+
"aria-label": `${_} ${Z.openCalendar}`,
|
|
159
|
+
children: /* @__PURE__ */ d(h, {})
|
|
159
160
|
})
|
|
160
161
|
})]
|
|
161
|
-
}), /* @__PURE__ */ d(
|
|
162
|
+
}), /* @__PURE__ */ d(te, {
|
|
162
163
|
container: B ? { current: B } : void 0,
|
|
163
|
-
children: /* @__PURE__ */ d(
|
|
164
|
+
children: /* @__PURE__ */ d(p.Positioner, {
|
|
164
165
|
className: "dds-date-picker-positioner",
|
|
165
|
-
children: /* @__PURE__ */ d(
|
|
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
|
-
!
|
|
170
|
+
!S && !C && R.current?.focus({ preventScroll: !0 });
|
|
170
171
|
});
|
|
171
172
|
}));
|
|
172
173
|
},
|
|
173
174
|
className: "dds-date-picker-content",
|
|
174
|
-
"aria-label": `${
|
|
175
|
+
"aria-label": `${_} 날짜 선택`,
|
|
175
176
|
children: /* @__PURE__ */ d(s, {
|
|
176
|
-
timeZone:
|
|
177
|
-
min:
|
|
178
|
-
max:
|
|
179
|
-
locale:
|
|
177
|
+
timeZone: x,
|
|
178
|
+
min: E,
|
|
179
|
+
max: D,
|
|
180
|
+
locale: b,
|
|
180
181
|
messages: A,
|
|
181
|
-
disabled:
|
|
182
|
-
readOnly:
|
|
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 {
|
|
197
|
+
export { _ as DatePicker };
|
|
197
198
|
|
|
198
199
|
//# sourceMappingURL=date-picker.js.map
|
package/dist/date-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","names":[],"sources":["../src/date-picker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport {\n DatePicker as ArkDatePicker,\n parseDate,\n} from \"@ark-ui/react/date-picker\";\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { Button, Field } from \"./controls\";\nimport { CalendarView } from \"./calendar-view\";\nimport {\n isCalendarDate,\n isKorean,\n displayDate,\n canonicalInput,\n validateInput,\n dateMessages,\n type CalendarMessages,\n type DatePickerValidity,\n} from \"./date-only\";\nexport type { DatePickerValidity, CalendarMessages } from \"./date-only\";\n\nexport interface DatePickerProps {\n label: string;\n /** ISO calendar date (YYYY-MM-DD), or an empty string. */\n value: string;\n onChange: (value: string) => void;\n locale?: string;\n timeZone?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n /** Initial mount and semantic draft changes, deduped across callback identity changes. Key by editor identity for a fresh initial report. Button/API saves must guard validity and use its canonical value. */\n onValidityChange?: (state: DatePickerValidity) => void;\n min?: string;\n max?: string;\n startOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n labelPlacement?: \"outside\" | \"inside\" | \"hidden\";\n messages?: CalendarMessages;\n clearable?: boolean;\n showToday?: boolean;\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}\nfunction calendarSelection(value: string) {\n return isCalendarDate(value) ? [parseDate(value)] : [];\n}\n\nexport function DatePicker({\n label,\n value,\n onChange,\n locale = \"ko-KR\",\n timeZone = \"Asia/Seoul\",\n disabled = false,\n readOnly = false,\n required = false,\n onValidityChange,\n min,\n max,\n startOfWeek = 0,\n labelPlacement = \"outside\",\n messages,\n clearable = true,\n showToday = true,\n}: DatePickerProps) {\n const [draft, setDraft] = useState(() => displayDate(value, locale));\n const [selection, setSelection] = useState(() => calendarSelection(value));\n const [open, setOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const escapeFrame = useRef<number | undefined>(undefined);\n useEffect(\n () => () => {\n if (escapeFrame.current !== undefined)\n cancelAnimationFrame(escapeFrame.current);\n },\n [],\n );\n const [portalMount, setPortalMount] = useState<HTMLElement | null>(null);\n useEffect(() => {\n const input = inputRef.current;\n if (input) {\n // A modal hides its body siblings from assistive technology. Keep the\n // calendar within that modal while preserving the server Portal boundary.\n setPortalMount(\n input.closest<HTMLElement>('[role=\"dialog\"], [role=\"alertdialog\"]') ??\n input.ownerDocument.body,\n );\n }\n }, []);\n const restoreInputFocus = useRef(false);\n const observedValue = useRef(value);\n const observedLocale = useRef(locale);\n // Every outstanding emission is retained, including repeated B/C/B values.\n // Entries end on acknowledgement, an unmatched external reset, or unmount.\n const pendingEchoes = useRef<string[]>([]);\n const emittedValue = useRef(value);\n const notified = useRef(\"\");\n // Convert a complete draft before reporting validity in the new locale.\n const canonicalDraft = canonicalInput(draft, observedLocale.current);\n const effectiveDraft =\n observedLocale.current !== locale && isCalendarDate(canonicalDraft)\n ? displayDate(canonicalDraft, locale)\n : draft;\n const validity = validateInput(effectiveDraft, required, min, max, locale);\n const text = dateMessages(locale, messages);\n const error = validity.valid\n ? undefined\n : validity.reason === \"required\"\n ? text.required\n : text.invalid;\n useEffect(() => {\n const previousLocale = observedLocale.current;\n observedLocale.current = locale;\n if (observedValue.current === value) {\n if (previousLocale !== locale) setDraft(effectiveDraft);\n return;\n }\n observedValue.current = value;\n // A matched outstanding value is an acknowledgement, not a draft reset.\n const acknowledged = pendingEchoes.current.indexOf(value);\n if (acknowledged !== -1) {\n pendingEchoes.current.splice(acknowledged, 1);\n return;\n }\n pendingEchoes.current = [];\n emittedValue.current = value;\n setDraft(displayDate(value, locale));\n if (value === \"\" || isCalendarDate(value))\n setSelection(calendarSelection(value));\n }, [value, locale]);\n useEffect(() => {\n inputRef.current?.setCustomValidity(error ?? \"\");\n const key = JSON.stringify(validity);\n if (onValidityChange && notified.current !== key) {\n notified.current = key;\n onValidityChange(validity);\n }\n }, [draft, required, min, max, locale, error, onValidityChange]);\n useEffect(() => {\n if (disabled || readOnly) {\n restoreInputFocus.current = false;\n setOpen(false);\n }\n }, [disabled, readOnly]);\n // Ark's calendar restores focus to its trigger when it does not own an Input.\n // Return to the DDS input after that calendar frame; cancel on lock/unmount.\n useEffect(() => {\n if (!restoreInputFocus.current || disabled || readOnly) return;\n const frame = requestAnimationFrame(() => {\n restoreInputFocus.current = false;\n inputRef.current?.focus({ preventScroll: true });\n });\n return () => cancelAnimationFrame(frame);\n }, [open, selection, disabled, readOnly]);\n function commit(next: string) {\n const state = validateInput(next, required, min, max, locale);\n if (next !== \"\" && !state.valid) return;\n const canonical = next === \"\" ? \"\" : state.value!;\n setSelection(calendarSelection(canonical));\n // Blur/Enter must not emit the same local commit again while props lag.\n if (canonical !== emittedValue.current) {\n emittedValue.current = canonical;\n pendingEchoes.current.push(canonical);\n onChange(canonical);\n }\n }\n function changeDraft(next: string) {\n setDraft(next);\n const state = validateInput(next, required, min, max, locale);\n // Native form submission and callback-based saves both see this edit.\n inputRef.current?.setCustomValidity(\n state.valid ? \"\" : (error ?? \"Enter a valid date (YYYY-MM-DD).\"),\n );\n if (next === \"\" || state.valid) {\n setDraft(displayDate(state.value ?? \"\", locale));\n commit(next);\n }\n }\n return (\n <Field\n label={label}\n required={required}\n error={error}\n className={`dds-date-picker dds-date-picker--${labelPlacement}`}\n data-filled={effectiveDraft !== \"\" ? \"true\" : undefined}\n >\n {(control) => (\n <ArkDatePicker.Root\n locale={locale}\n timeZone={timeZone}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={!validity.valid}\n open={open && !disabled && !readOnly}\n onOpenChange={(details) =>\n setOpen(details.open && !disabled && !readOnly)\n }\n min={min && isCalendarDate(min) ? parseDate(min) : undefined}\n max={max && isCalendarDate(max) ? parseDate(max) : undefined}\n startOfWeek={startOfWeek}\n minView=\"day\"\n maxView=\"day\"\n fixedWeeks\n translations={{\n dayCell: (state) => text.selectDate(state.valueText),\n clearTrigger: text.clear,\n }}\n value={selection}\n format={(v) => displayDate(v.toString(), locale)}\n onValueChange={(details) => {\n const next = details.value[0]?.toString() || \"\";\n if (\n next !== \"\" &&\n !validateInput(next, required, min, max, locale).valid\n )\n return;\n restoreInputFocus.current = true;\n setDraft(displayDate(next, locale));\n commit(next);\n }}\n positioning={{\n placement: \"bottom-start\",\n gutter: 8,\n strategy: portalMount?.matches(\n '[role=\"dialog\"], [role=\"alertdialog\"]',\n )\n ? \"fixed\"\n : \"absolute\",\n hideWhenDetached: !!portalMount?.matches(\n '[role=\"dialog\"], [role=\"alertdialog\"]',\n ),\n }}\n >\n {/* DDS owns the raw text input; Ark owns calendar interaction, not draft DOM writes. */}\n <ArkDatePicker.Control className=\"dds-date-picker-control\">\n <input\n {...control}\n ref={inputRef}\n type=\"text\"\n value={effectiveDraft}\n onChange={() => {}}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n placeholder={isKorean(locale) ? \"YYYY/MM/DD\" : \"YYYY-MM-DD\"}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n onInputCapture={(event) => {\n if (disabled || readOnly) return;\n event.stopPropagation();\n changeDraft(event.currentTarget.value);\n }}\n onBlur={() => {\n if (!disabled && !readOnly) commit(effectiveDraft);\n }}\n onKeyDownCapture={(event) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n event.stopPropagation();\n if (!disabled && !readOnly) commit(effectiveDraft);\n }\n }}\n />\n <ArkDatePicker.Trigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n tone=\"secondary\"\n aria-label={`${label} ${text.openCalendar}`}\n >\n <CalendarIcon />\n </Button>\n </ArkDatePicker.Trigger>\n </ArkDatePicker.Control>\n <Portal\n container={portalMount ? { current: portalMount } : undefined}\n >\n <ArkDatePicker.Positioner className=\"dds-date-picker-positioner\">\n <ArkDatePicker.Content\n onKeyDownCapture={(event) => {\n if (event.key !== \"Escape\") return;\n restoreInputFocus.current = false;\n if (escapeFrame.current !== undefined)\n cancelAnimationFrame(escapeFrame.current);\n escapeFrame.current = requestAnimationFrame(() => {\n escapeFrame.current = requestAnimationFrame(() => {\n if (!disabled && !readOnly)\n triggerRef.current?.focus({ preventScroll: true });\n });\n });\n }}\n className=\"dds-date-picker-content\"\n aria-label={`${label} 날짜 선택`}\n >\n <CalendarView\n timeZone={timeZone}\n min={min}\n max={max}\n locale={locale}\n messages={messages}\n disabled={disabled}\n readOnly={readOnly}\n showToday={showToday}\n showClear={clearable}\n onClear={() => {\n setDraft(\"\");\n commit(\"\");\n }}\n />\n </ArkDatePicker.Content>\n </ArkDatePicker.Positioner>\n </Portal>\n </ArkDatePicker.Root>\n )}\n </Field>\n );\n}\n"],"mappings":";;;;;;;AAwCA,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;AACA,SAAS,EAAkB,GAAe;CACxC,OAAO,EAAe,CAAK,IAAI,CAAC,EAAU,CAAK,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AAW;OACX,eAAe;QAEb,AADA,EAAS,EAAE,GACX,EAAO,EAAE;OACX;MACD,CAAA;KACoB,CAAA;IACC,CAAA;GACpB,CAAA,CACU;;CAEjB,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":[],"sources":["../src/date-picker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport {\n DatePicker as ArkDatePicker,\n parseDate,\n} from \"@ark-ui/react/date-picker\";\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { Button, Field } from \"./controls\";\nimport { CalendarView } from \"./calendar-view\";\nimport {\n isCalendarDate,\n isKorean,\n displayDate,\n canonicalInput,\n validateInput,\n dateMessages,\n type CalendarMessages,\n type DatePickerValidity,\n} from \"./date-only\";\nexport type { DatePickerValidity, CalendarMessages } from \"./date-only\";\n\nexport interface DatePickerProps {\n label: string;\n /** ISO calendar date (YYYY-MM-DD), or an empty string. */\n value: string;\n onChange: (value: string) => void;\n locale?: string;\n timeZone?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n /** Initial mount and semantic draft changes, deduped across callback identity changes. Key by editor identity for a fresh initial report. Button/API saves must guard validity and use its canonical value. */\n onValidityChange?: (state: DatePickerValidity) => void;\n min?: string;\n max?: string;\n startOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n labelPlacement?: \"outside\" | \"inside\" | \"hidden\";\n messages?: CalendarMessages;\n clearable?: boolean;\n showToday?: boolean;\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}\nfunction calendarSelection(value: string) {\n return isCalendarDate(value) ? [parseDate(value)] : [];\n}\n\nexport function DatePicker({\n label,\n value,\n onChange,\n locale = \"ko-KR\",\n timeZone = \"Asia/Seoul\",\n disabled = false,\n readOnly = false,\n required = false,\n onValidityChange,\n min,\n max,\n startOfWeek = 0,\n labelPlacement = \"outside\",\n messages,\n clearable = true,\n showToday = true,\n}: DatePickerProps) {\n const [draft, setDraft] = useState(() => displayDate(value, locale));\n const [selection, setSelection] = useState(() => calendarSelection(value));\n const [open, setOpen] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const escapeFrame = useRef<number | undefined>(undefined);\n useEffect(\n () => () => {\n if (escapeFrame.current !== undefined)\n cancelAnimationFrame(escapeFrame.current);\n },\n [],\n );\n const [portalMount, setPortalMount] = useState<HTMLElement | null>(null);\n useEffect(() => {\n const input = inputRef.current;\n if (input) {\n // A modal hides its body siblings from assistive technology. Keep the\n // calendar within that modal while preserving the server Portal boundary.\n setPortalMount(\n input.closest<HTMLElement>('[role=\"dialog\"], [role=\"alertdialog\"]') ??\n input.ownerDocument.body,\n );\n }\n }, []);\n const restoreInputFocus = useRef(false);\n const observedValue = useRef(value);\n const observedLocale = useRef(locale);\n // Every outstanding emission is retained, including repeated B/C/B values.\n // Entries end on acknowledgement, an unmatched external reset, or unmount.\n const pendingEchoes = useRef<string[]>([]);\n const emittedValue = useRef(value);\n const notified = useRef(\"\");\n // Convert a complete draft before reporting validity in the new locale.\n const canonicalDraft = canonicalInput(draft, observedLocale.current);\n const effectiveDraft =\n observedLocale.current !== locale && isCalendarDate(canonicalDraft)\n ? displayDate(canonicalDraft, locale)\n : draft;\n const validity = validateInput(effectiveDraft, required, min, max, locale);\n const text = dateMessages(locale, messages);\n const error = validity.valid\n ? undefined\n : validity.reason === \"required\"\n ? text.required\n : text.invalid;\n useEffect(() => {\n const previousLocale = observedLocale.current;\n observedLocale.current = locale;\n if (observedValue.current === value) {\n if (previousLocale !== locale) setDraft(effectiveDraft);\n return;\n }\n observedValue.current = value;\n // A matched outstanding value is an acknowledgement, not a draft reset.\n const acknowledged = pendingEchoes.current.indexOf(value);\n if (acknowledged !== -1) {\n pendingEchoes.current.splice(acknowledged, 1);\n return;\n }\n pendingEchoes.current = [];\n emittedValue.current = value;\n setDraft(displayDate(value, locale));\n if (value === \"\" || isCalendarDate(value))\n setSelection(calendarSelection(value));\n }, [value, locale]);\n useEffect(() => {\n inputRef.current?.setCustomValidity(error ?? \"\");\n const key = JSON.stringify(validity);\n if (onValidityChange && notified.current !== key) {\n notified.current = key;\n onValidityChange(validity);\n }\n }, [draft, required, min, max, locale, error, onValidityChange]);\n useEffect(() => {\n if (disabled || readOnly) {\n restoreInputFocus.current = false;\n setOpen(false);\n }\n }, [disabled, readOnly]);\n // Ark's calendar restores focus to its trigger when it does not own an Input.\n // Return to the DDS input after that calendar frame; cancel on lock/unmount.\n useEffect(() => {\n if (!restoreInputFocus.current || disabled || readOnly) return;\n const frame = requestAnimationFrame(() => {\n restoreInputFocus.current = false;\n inputRef.current?.focus({ preventScroll: true });\n });\n return () => cancelAnimationFrame(frame);\n }, [open, selection, disabled, readOnly]);\n function commit(next: string) {\n const state = validateInput(next, required, min, max, locale);\n if (next !== \"\" && !state.valid) return;\n const canonical = next === \"\" ? \"\" : state.value!;\n setSelection(calendarSelection(canonical));\n // Blur/Enter must not emit the same local commit again while props lag.\n if (canonical !== emittedValue.current) {\n emittedValue.current = canonical;\n pendingEchoes.current.push(canonical);\n onChange(canonical);\n }\n }\n function changeDraft(next: string) {\n setDraft(next);\n const state = validateInput(next, required, min, max, locale);\n // Native form submission and callback-based saves both see this edit.\n inputRef.current?.setCustomValidity(\n state.valid ? \"\" : (error ?? \"Enter a valid date (YYYY-MM-DD).\"),\n );\n if (next === \"\" || state.valid) {\n setDraft(displayDate(state.value ?? \"\", locale));\n commit(next);\n }\n }\n return (\n <Field\n label={label}\n required={required}\n error={error}\n className={`dds-date-picker dds-date-picker--${labelPlacement}`}\n data-filled={effectiveDraft !== \"\" ? \"true\" : undefined}\n >\n {(control) => (\n <ArkDatePicker.Root\n locale={locale}\n timeZone={timeZone}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={!validity.valid}\n open={open && !disabled && !readOnly}\n onOpenChange={(details) =>\n setOpen(details.open && !disabled && !readOnly)\n }\n min={min && isCalendarDate(min) ? parseDate(min) : undefined}\n max={max && isCalendarDate(max) ? parseDate(max) : undefined}\n startOfWeek={startOfWeek}\n minView=\"day\"\n maxView=\"day\"\n fixedWeeks\n translations={{\n dayCell: (state) => text.selectDate(state.valueText),\n clearTrigger: text.clear,\n }}\n value={selection}\n format={(v) => displayDate(v.toString(), locale)}\n onValueChange={(details) => {\n const next = details.value[0]?.toString() || \"\";\n if (\n next !== \"\" &&\n !validateInput(next, required, min, max, locale).valid\n )\n return;\n restoreInputFocus.current = true;\n setDraft(displayDate(next, locale));\n commit(next);\n }}\n positioning={{\n placement: \"bottom-start\",\n gutter: 8,\n strategy: portalMount?.matches(\n '[role=\"dialog\"], [role=\"alertdialog\"]',\n )\n ? \"fixed\"\n : \"absolute\",\n hideWhenDetached: !!portalMount?.matches(\n '[role=\"dialog\"], [role=\"alertdialog\"]',\n ),\n }}\n >\n {/* DDS owns the raw text input; Ark owns calendar interaction, not draft DOM writes. */}\n <ArkDatePicker.Control className=\"dds-date-picker-control\">\n <input\n {...control}\n ref={inputRef}\n type=\"text\"\n value={effectiveDraft}\n onChange={() => {}}\n required={required}\n readOnly={readOnly}\n disabled={disabled}\n placeholder={isKorean(locale) ? \"YYYY/MM/DD\" : \"YYYY-MM-DD\"}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n onInputCapture={(event) => {\n if (disabled || readOnly) return;\n event.stopPropagation();\n changeDraft(event.currentTarget.value);\n }}\n onBlur={() => {\n if (!disabled && !readOnly) commit(effectiveDraft);\n }}\n onKeyDownCapture={(event) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n event.stopPropagation();\n if (!disabled && !readOnly) commit(effectiveDraft);\n }\n }}\n />\n <ArkDatePicker.Trigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n tone=\"secondary\"\n aria-label={`${label} ${text.openCalendar}`}\n >\n <CalendarIcon />\n </Button>\n </ArkDatePicker.Trigger>\n </ArkDatePicker.Control>\n <Portal\n container={portalMount ? { current: portalMount } : undefined}\n >\n <ArkDatePicker.Positioner className=\"dds-date-picker-positioner\">\n <ArkDatePicker.Content\n onKeyDownCapture={(event) => {\n if (event.key !== \"Escape\") return;\n restoreInputFocus.current = false;\n if (escapeFrame.current !== undefined)\n cancelAnimationFrame(escapeFrame.current);\n escapeFrame.current = requestAnimationFrame(() => {\n escapeFrame.current = requestAnimationFrame(() => {\n if (!disabled && !readOnly)\n triggerRef.current?.focus({ preventScroll: true });\n });\n });\n }}\n className=\"dds-date-picker-content\"\n aria-label={`${label} 날짜 선택`}\n >\n <CalendarView\n timeZone={timeZone}\n min={min}\n max={max}\n locale={locale}\n messages={messages}\n disabled={disabled}\n readOnly={readOnly}\n showToday={showToday}\n showClear={clearable}\n onClear={() => {\n setDraft(\"\");\n commit(\"\");\n }}\n />\n </ArkDatePicker.Content>\n </ArkDatePicker.Positioner>\n </Portal>\n </ArkDatePicker.Root>\n )}\n </Field>\n );\n}\n"],"mappings":";;;;;;;;AAwCA,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;AACA,SAAS,EAAkB,GAAe;CACxC,OAAO,EAAe,CAAK,IAAI,CAAC,EAAU,CAAK,CAAC,IAAI,CAAC;AACvD;AAEA,SAAgB,EAAW,EACzB,UACA,UACA,aACA,YAAS,SACT,cAAW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