@devslab/dds-solid 0.22.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +49 -3
- package/README.md +47 -3
- package/dist/assets/{calendar-view-1RO2mtf1.js → calendar-view-BBQGmkJ7.js} +181 -145
- package/dist/assets/calendar-view-BBQGmkJ7.js.map +1 -0
- package/dist/assets/{choice-DoXiK8nc.js → choice-DPmk9AHn.js} +41 -29
- package/dist/assets/choice-DPmk9AHn.js.map +1 -0
- package/dist/assets/choice-types-h4YVL8xH.js +24 -0
- package/dist/assets/choice-types-h4YVL8xH.js.map +1 -0
- package/dist/assets/date-only-0Ldsjp43.js +174 -0
- package/dist/assets/date-only-0Ldsjp43.js.map +1 -0
- package/dist/assets/direction-BpTqmXs-.js +24 -0
- package/dist/assets/direction-BpTqmXs-.js.map +1 -0
- package/dist/calendar-view-CZLsC57_.js +481 -0
- package/dist/calendar-view-CZLsC57_.js.map +1 -0
- package/dist/calendar-view.d.ts +10 -0
- package/dist/calendar-view.d.ts.map +1 -1
- package/dist/calendar.js +7 -6
- package/dist/calendar.js.map +1 -1
- package/dist/calendar.server.js +2 -1
- package/dist/calendar.server.js.map +1 -1
- package/dist/choice-CTNeFOVo.js +403 -0
- package/dist/choice-CTNeFOVo.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/combobox.server.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 +51 -50
- package/dist/date-picker.js.map +1 -1
- package/dist/date-picker.server.js +2 -1
- package/dist/date-picker.server.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 +368 -0
- package/dist/date-range-picker.js.map +1 -0
- package/dist/date-range-picker.server.js +347 -0
- package/dist/date-range-picker.server.js.map +1 -0
- package/dist/direction-CS85IDNU.js +21 -0
- package/dist/direction-CS85IDNU.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +193 -176
- package/dist/index.js.map +1 -1
- package/dist/internal/choice.d.ts +25 -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 +287 -0
- package/dist/month-picker.js.map +1 -0
- package/dist/month-picker.server.js +282 -0
- package/dist/month-picker.server.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 +267 -0
- package/dist/number-input.js.map +1 -0
- package/dist/number-input.server.js +237 -0
- package/dist/number-input.server.js.map +1 -0
- package/dist/pending-action.d.ts +36 -0
- package/dist/pending-action.d.ts.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 +133 -0
- package/dist/segmented-control.js.map +1 -0
- package/dist/segmented-control.server.js +138 -0
- package/dist/segmented-control.server.js.map +1 -0
- package/dist/select-picker.js +1 -1
- package/dist/select-picker.server.js +1 -1
- package/dist/server.js +49 -23
- package/dist/server.js.map +1 -1
- package/dist/time-only.d.ts +32 -0
- package/dist/time-only.d.ts.map +1 -0
- package/dist/time-picker-BlMWCQwk.js +113 -0
- package/dist/time-picker-BlMWCQwk.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/dist/time-picker.server.js +152 -0
- package/dist/time-picker.server.js.map +1 -0
- package/package.json +44 -4
- package/styles.css +31 -1
- package/dist/assets/calendar-view-1RO2mtf1.js.map +0 -1
- package/dist/assets/choice-DoXiK8nc.js.map +0 -1
- package/dist/calendar-view-CTBTPB4T.js +0 -444
- package/dist/calendar-view-CTBTPB4T.js.map +0 -1
- package/dist/choice-BPMiJlPJ.js +0 -395
- package/dist/choice-BPMiJlPJ.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,EAA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M,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,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,SAAU,GACf,kBAAkB,CAyBpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C,QAAQ,CAAC,EAAE,MA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t as e } from "./calendar-view-CZLsC57_.js";
|
|
2
|
+
import { c as t, i as n, o as r, p as i, r as a, t as o } from "./date-only-Bu4UmsTP.js";
|
|
2
3
|
import { Show as s, createEffect as c, createMemo as l, createSignal as u, createUniqueId as d, on as f, onCleanup as p, onMount as m } from "solid-js";
|
|
3
|
-
import { Portal as
|
|
4
|
-
import { DatePicker as
|
|
4
|
+
import { Portal as ee, addEventListener as h, className as te, createComponent as g, delegateEvents as _, effect as v, getNextElement as y, getNextMarker as b, insert as x, memo as S, runHydrationEvents as ne, setAttribute as C, setProperty as w, template as T, use as E } from "solid-js/web";
|
|
5
|
+
import { DatePicker as D, parseDate as O } from "@ark-ui/solid/date-picker";
|
|
5
6
|
//#region src/date-picker.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
return y(
|
|
7
|
+
var k = /*#__PURE__*/ T("<svg width=20 height=20 viewBox=\"0 0 24 24\"fill=none stroke=currentColor stroke-width=1.5 aria-hidden=true><rect x=3.5 y=5.5 width=17 height=15 rx=2></rect><path d=\"M7.5 3v5M16.5 3v5M3.5 10.5h17\">"), re = /*#__PURE__*/ T("<span aria-hidden=true> *"), A = /*#__PURE__*/ T("<input type=text autocomplete=off autocorrect=off>"), j = /*#__PURE__*/ T("<span class=dds-field__error role=alert>"), M = /*#__PURE__*/ T("<div role=group><label class=dds-field__label><!$><!/><!$><!/></label><!$><!/><!$><!/>");
|
|
8
|
+
function ie() {
|
|
9
|
+
return y(k);
|
|
9
10
|
}
|
|
10
|
-
function N(
|
|
11
|
-
return e
|
|
11
|
+
function N(e) {
|
|
12
|
+
return r(e) ? [O(e)] : [];
|
|
12
13
|
}
|
|
13
14
|
function P(_) {
|
|
14
|
-
let T = () => _.locale ?? "ko-KR",
|
|
15
|
-
text:
|
|
15
|
+
let T = () => _.locale ?? "ko-KR", k = `dds-date-${d()}`, [P, F] = u({
|
|
16
|
+
text: n(_.value, T()),
|
|
16
17
|
locale: T()
|
|
17
18
|
}), I = l(() => {
|
|
18
|
-
let
|
|
19
|
-
return
|
|
19
|
+
let e = P(), t = o(e.text, e.locale);
|
|
20
|
+
return e.locale !== T() && r(t) ? n(t, T()) : e.text;
|
|
20
21
|
}), L = (e) => F({
|
|
21
22
|
text: e,
|
|
22
23
|
locale: T()
|
|
@@ -24,16 +25,16 @@ function P(_) {
|
|
|
24
25
|
m(() => {
|
|
25
26
|
H && ae(H.closest("[role=\"dialog\"], [role=\"alertdialog\"]") ?? H.ownerDocument.body);
|
|
26
27
|
});
|
|
27
|
-
let X = () =>
|
|
28
|
-
c(f(() => [_.value, T()], ([
|
|
29
|
-
if (W ===
|
|
30
|
-
W =
|
|
31
|
-
let i = q.indexOf(
|
|
28
|
+
let X = () => a(T(), _.messages), Z = l(() => i(I(), _.required ?? !1, _.min, _.max, T())), Q = () => Z().valid ? void 0 : Z().reason === "required" ? X().required : X().invalid;
|
|
29
|
+
c(f(() => [_.value, T()], ([e, t]) => {
|
|
30
|
+
if (W === e) return;
|
|
31
|
+
W = e;
|
|
32
|
+
let i = q.indexOf(e);
|
|
32
33
|
if (i !== -1) {
|
|
33
34
|
q.splice(i, 1);
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
q = [], G =
|
|
37
|
+
q = [], G = e, L(n(e, t)), (e === "" || r(e)) && z(N(e));
|
|
37
38
|
})), c(() => {
|
|
38
39
|
H?.setCustomValidity(Q() ?? "");
|
|
39
40
|
let e = Z(), t = _.onValidityChange, n = JSON.stringify(e);
|
|
@@ -45,7 +46,7 @@ function P(_) {
|
|
|
45
46
|
});
|
|
46
47
|
function $(e) {
|
|
47
48
|
if (_.disabled || _.readOnly) return;
|
|
48
|
-
let t =
|
|
49
|
+
let t = i(e, _.required ?? !1, _.min, _.max, T());
|
|
49
50
|
if (e !== "" && !t.valid) return;
|
|
50
51
|
let n = e === "" ? "" : t.value;
|
|
51
52
|
z(N(n)), n !== G && (G = n, q.push(n), _.onChange(n));
|
|
@@ -53,19 +54,19 @@ function P(_) {
|
|
|
53
54
|
function oe(e) {
|
|
54
55
|
if (_.disabled || _.readOnly) return;
|
|
55
56
|
L(e);
|
|
56
|
-
let
|
|
57
|
-
H?.setCustomValidity(
|
|
57
|
+
let t = i(e, _.required ?? !1, _.min, _.max, T());
|
|
58
|
+
H?.setCustomValidity(t.valid ? "" : X().invalid), (e === "" || t.valid) && (L(n(t.value ?? "", T())), $(e));
|
|
58
59
|
}
|
|
59
60
|
return (() => {
|
|
60
|
-
var
|
|
61
|
-
return C(
|
|
61
|
+
var a = y(M), o = a.firstChild, c = o.firstChild, [l, u] = b(c.nextSibling), d = l.nextSibling, [f, m] = b(d.nextSibling), N = o.nextSibling, [P, F] = b(N.nextSibling), z = P.nextSibling, [W, G] = b(z.nextSibling);
|
|
62
|
+
return C(o, "for", k), x(o, () => _.label, l, u), x(o, g(s, {
|
|
62
63
|
get when() {
|
|
63
64
|
return _.required;
|
|
64
65
|
},
|
|
65
66
|
get children() {
|
|
66
|
-
return y(
|
|
67
|
+
return y(re);
|
|
67
68
|
}
|
|
68
|
-
}), f, m), x(
|
|
69
|
+
}), f, m), x(a, g(D.Root, {
|
|
69
70
|
get locale() {
|
|
70
71
|
return T();
|
|
71
72
|
},
|
|
@@ -89,10 +90,10 @@ function P(_) {
|
|
|
89
90
|
},
|
|
90
91
|
onOpenChange: (e) => V(e.open && !_.disabled && !_.readOnly),
|
|
91
92
|
get min() {
|
|
92
|
-
return S(() => !!(_.min &&
|
|
93
|
+
return S(() => !!(_.min && r(_.min)))() ? O(_.min) : void 0;
|
|
93
94
|
},
|
|
94
95
|
get max() {
|
|
95
|
-
return S(() => !!(_.max &&
|
|
96
|
+
return S(() => !!(_.max && r(_.max)))() ? O(_.max) : void 0;
|
|
96
97
|
},
|
|
97
98
|
get startOfWeek() {
|
|
98
99
|
return _.startOfWeek ?? 0;
|
|
@@ -109,11 +110,11 @@ function P(_) {
|
|
|
109
110
|
get value() {
|
|
110
111
|
return R();
|
|
111
112
|
},
|
|
112
|
-
format: (e) =>
|
|
113
|
+
format: (e) => n(e.toString(), T()),
|
|
113
114
|
onValueChange: (e) => {
|
|
114
115
|
if (_.disabled || _.readOnly) return;
|
|
115
|
-
let
|
|
116
|
-
|
|
116
|
+
let t = e.value[0]?.toString() ?? "";
|
|
117
|
+
t !== "" && !i(t, _.required ?? !1, _.min, _.max, T()).valid || (L(n(t, T())), $(t), J !== void 0 && cancelAnimationFrame(J), J = requestAnimationFrame(() => {
|
|
117
118
|
!_.disabled && !_.readOnly && H?.focus({ preventScroll: !0 });
|
|
118
119
|
}));
|
|
119
120
|
},
|
|
@@ -126,23 +127,23 @@ function P(_) {
|
|
|
126
127
|
};
|
|
127
128
|
},
|
|
128
129
|
get children() {
|
|
129
|
-
return [g(
|
|
130
|
+
return [g(D.Control, {
|
|
130
131
|
class: "dds-date-picker-control",
|
|
131
132
|
get "data-filled"() {
|
|
132
133
|
return I() === "" ? void 0 : "true";
|
|
133
134
|
},
|
|
134
135
|
get children() {
|
|
135
136
|
return [(() => {
|
|
136
|
-
var e = y(
|
|
137
|
+
var e = y(A);
|
|
137
138
|
e.$$keydown = (e) => {
|
|
138
139
|
e.key === "Enter" && !e.isComposing && (e.preventDefault(), e.stopPropagation(), $(I()));
|
|
139
|
-
}, e.addEventListener("blur", () => $(I())),
|
|
140
|
+
}, e.addEventListener("blur", () => $(I())), h(e, "input", (e) => {
|
|
140
141
|
e.stopPropagation(), oe(e.currentTarget.value);
|
|
141
142
|
});
|
|
142
|
-
var
|
|
143
|
-
return typeof
|
|
144
|
-
var
|
|
145
|
-
return
|
|
143
|
+
var n = H;
|
|
144
|
+
return typeof n == "function" ? E(n, e) : H = e, C(e, "id", k), C(e, "spellcheck", !1), v((n) => {
|
|
145
|
+
var r = Z().valid ? void 0 : "true", i = _.required ? "true" : void 0, a = Q() ? `${k}-error` : void 0, o = _.required, s = _.readOnly, c = _.disabled, l = t(T()) ? "YYYY/MM/DD" : "YYYY-MM-DD";
|
|
146
|
+
return r !== n.e && C(e, "aria-invalid", n.e = r), i !== n.t && C(e, "aria-required", n.t = i), a !== n.a && C(e, "aria-describedby", n.a = a), o !== n.o && w(e, "required", n.o = o), s !== n.i && w(e, "readOnly", n.i = s), c !== n.n && w(e, "disabled", n.n = c), l !== n.s && C(e, "placeholder", n.s = l), n;
|
|
146
147
|
}, {
|
|
147
148
|
e: void 0,
|
|
148
149
|
t: void 0,
|
|
@@ -152,7 +153,7 @@ function P(_) {
|
|
|
152
153
|
n: void 0,
|
|
153
154
|
s: void 0
|
|
154
155
|
}), v(() => w(e, "value", I())), ne(), e;
|
|
155
|
-
})(), g(
|
|
156
|
+
})(), g(D.Trigger, {
|
|
156
157
|
ref(e) {
|
|
157
158
|
var t = U;
|
|
158
159
|
typeof t == "function" ? t(e) : U = e;
|
|
@@ -162,7 +163,7 @@ function P(_) {
|
|
|
162
163
|
return `${_.label} ${X().openCalendar}`;
|
|
163
164
|
},
|
|
164
165
|
get children() {
|
|
165
|
-
return g(
|
|
166
|
+
return g(ie, {});
|
|
166
167
|
}
|
|
167
168
|
})];
|
|
168
169
|
}
|
|
@@ -170,15 +171,15 @@ function P(_) {
|
|
|
170
171
|
get when() {
|
|
171
172
|
return Y();
|
|
172
173
|
},
|
|
173
|
-
children: (
|
|
174
|
+
children: (t) => g(ee, {
|
|
174
175
|
get mount() {
|
|
175
|
-
return
|
|
176
|
+
return t();
|
|
176
177
|
},
|
|
177
178
|
get children() {
|
|
178
|
-
return g(
|
|
179
|
+
return g(D.Positioner, {
|
|
179
180
|
class: "dds-date-picker-positioner",
|
|
180
181
|
get children() {
|
|
181
|
-
return g(
|
|
182
|
+
return g(D.Content, {
|
|
182
183
|
ref: (e) => {
|
|
183
184
|
let t = (e) => {
|
|
184
185
|
e.key === "Escape" && (J !== void 0 && cancelAnimationFrame(J), J = requestAnimationFrame(() => {
|
|
@@ -194,7 +195,7 @@ function P(_) {
|
|
|
194
195
|
return `${_.label} 날짜 선택`;
|
|
195
196
|
},
|
|
196
197
|
get children() {
|
|
197
|
-
return g(
|
|
198
|
+
return g(e, {
|
|
198
199
|
get timeZone() {
|
|
199
200
|
return _.timeZone;
|
|
200
201
|
},
|
|
@@ -234,21 +235,21 @@ function P(_) {
|
|
|
234
235
|
})
|
|
235
236
|
})];
|
|
236
237
|
}
|
|
237
|
-
}), P, F), x(
|
|
238
|
+
}), P, F), x(a, g(s, {
|
|
238
239
|
get when() {
|
|
239
240
|
return Q();
|
|
240
241
|
},
|
|
241
242
|
get children() {
|
|
242
|
-
var e = y(
|
|
243
|
-
return C(e, "id", `${
|
|
243
|
+
var e = y(j);
|
|
244
|
+
return C(e, "id", `${k}-error`), x(e, Q), e;
|
|
244
245
|
}
|
|
245
246
|
}), W, G), v((e) => {
|
|
246
|
-
var t = `dds-field dds-date-picker dds-date-picker--${_.labelPlacement ?? "outside"}${Q() ? " dds-field--error" : ""}`,
|
|
247
|
-
return t !== e.e && te(
|
|
247
|
+
var t = `dds-field dds-date-picker dds-date-picker--${_.labelPlacement ?? "outside"}${Q() ? " dds-field--error" : ""}`, n = I() === "" ? void 0 : "true";
|
|
248
|
+
return t !== e.e && te(a, e.e = t), n !== e.t && C(a, "data-filled", e.t = n), e;
|
|
248
249
|
}, {
|
|
249
250
|
e: void 0,
|
|
250
251
|
t: void 0
|
|
251
|
-
}),
|
|
252
|
+
}), a;
|
|
252
253
|
})();
|
|
253
254
|
}
|
|
254
255
|
_(["keydown"]);
|