@iyulab/components 1.57.1 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/assets/locales/ar.json.js +12 -2
  3. package/dist/assets/locales/de.json.js +12 -2
  4. package/dist/assets/locales/en.json.js +12 -2
  5. package/dist/assets/locales/es.json.js +14 -2
  6. package/dist/assets/locales/fr.json.js +12 -2
  7. package/dist/assets/locales/id.json.js +12 -2
  8. package/dist/assets/locales/ja.json.js +14 -2
  9. package/dist/assets/locales/ko.json.js +14 -2
  10. package/dist/assets/locales/pt-BR.json.js +12 -2
  11. package/dist/assets/locales/ru.json.js +12 -2
  12. package/dist/assets/locales/th.json.js +14 -2
  13. package/dist/assets/locales/vi.json.js +12 -2
  14. package/dist/assets/locales/zh-CN.json.js +14 -2
  15. package/dist/assets/locales/zh-TW.json.js +14 -2
  16. package/dist/components/calendar/UCalendar.d.ts +4 -0
  17. package/dist/components/calendar/UCalendar.js +5 -4
  18. package/dist/components/calendar/dates.d.ts +4 -0
  19. package/dist/components/calendar/dates.js +5 -1
  20. package/dist/components/calendar/datetime.d.ts +14 -0
  21. package/dist/components/calendar/datetime.js +35 -0
  22. package/dist/components/calendar/picker.styles.js +35 -0
  23. package/dist/components/carousel/UCarousel.d.ts +7 -1
  24. package/dist/components/carousel/UCarousel.js +8 -1
  25. package/dist/components/date-picker/UDatePicker.d.ts +29 -1
  26. package/dist/components/date-picker/UDatePicker.js +89 -31
  27. package/dist/components/date-picker/UDatePicker.styles.js +0 -19
  28. package/dist/components/date-range-picker/UDateRangePicker.d.ts +69 -7
  29. package/dist/components/date-range-picker/UDateRangePicker.js +205 -34
  30. package/dist/index.js +2 -2
  31. package/dist/utilities/Locale.d.ts +2 -2
  32. package/dist/utilities/Locale.js +2 -2
  33. package/dist/utilities/format.d.ts +32 -4
  34. package/dist/utilities/format.js +131 -15
  35. package/package.json +1 -1
  36. package/skills/iyulab-components/references/components/carousel.md +3 -1
  37. package/skills/iyulab-components/references/components/date-picker.md +34 -2
  38. package/skills/iyulab-components/references/components/date-range-picker.md +52 -5
  39. package/skills/iyulab-components/references/utilities/locale.md +1 -1
@@ -223,28 +223,78 @@ function parseDate(text, options = {}) {
223
223
  /**
224
224
  * Reads a date and a time of day as people type them and returns local `YYYY-MM-DDTHH:mm`, or `null`.
225
225
  * The date part is anything {@link parseDate} reads; the time follows a space or `T` as `HH:mm`
226
- * (`9:05`, `09:05`, `09:05:30` — seconds are dropped). Text with only a date takes `defaultTime`
227
- * (`00:00` unless given). An hour above 23 or a minute above 59 is `null`.
226
+ * (`9:05`, `09:05`, `09:05:30` — seconds are dropped). With `seconds`, the result is
227
+ * `YYYY-MM-DDTHH:mm:ss` and typed seconds are kept (`:00` when none are typed). Text with only a date
228
+ * takes `defaultTime` (`00:00` unless given). An hour above 23, or a minute or second above 59, is `null`.
228
229
  */
229
230
  function parseDateTime(text, options = {}) {
230
231
  const t = text.trim();
231
- const m = /^(.*?)(?:[T\s]+(\d{1,2}):(\d{2})(?::\d{2})?)?$/.exec(t);
232
+ const words = meridiemWords(options.locale ?? Locale.get());
233
+ const joined = words.unspaced ? `|(?=${words.unspaced})` : "";
234
+ const m = new RegExp(`^(.*?)(?:(?:[T\\s]+${joined})(${words.timeOfDay}))?$`, "iu").exec(t);
232
235
  if (!m) return null;
233
236
  const date = parseDate(m[1], options);
234
237
  if (!date) return null;
235
- if (m[2] === void 0) {
236
- const fallback = options.defaultTime ?? "00:00";
237
- return /^\d{2}:\d{2}$/.test(fallback) ? `${date}T${fallback}` : null;
238
+ const time = readTimeOfDay(m[2] ?? options.defaultTime ?? "00:00", words);
239
+ return time ? `${date}T${timeText(time.h, time.m, time.s, options.seconds)}` : null;
240
+ }
241
+ var escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
242
+ /**
243
+ * The morning/afternoon words read around a time: the locale's own (`timeAm`/`timePm` in its locale
244
+ * table — `오전`/`오후`, `午前`/`午後`, `上午`/`下午` …) and English `AM`/`PM` (also `a.m.`/`p.m.`).
245
+ * Not `Intl`'s day period: engines disagree on it (Node's ICU writes `PM` for `ko`, Chromium `오후`).
246
+ */
247
+ function meridiemWords(locale) {
248
+ const pm = /* @__PURE__ */ new Map([["am", false], ["pm", true]]);
249
+ for (const [key, isPm] of [["timeAm", false], ["timePm", true]]) {
250
+ const word = Locale.getValue(key, void 0, locale).trim().toLowerCase().replace(/\./g, "");
251
+ if (word) pm.set(word, isPm);
252
+ }
253
+ const latin = (w) => /^[a-z]+$/.test(w);
254
+ const pattern = (w) => latin(w) ? w.split("").map((c) => `${escapeRegExp(c)}\\.?`).join("") : escapeRegExp(w);
255
+ const any = [...pm.keys()].map(pattern).join("|");
256
+ return {
257
+ pm,
258
+ any,
259
+ unspaced: [...pm.keys()].filter((w) => !latin(w)).map(escapeRegExp).join("|"),
260
+ timeOfDay: String.raw`(?:(?:${any})\s*)?\d{1,2}:\d{2}(?::\d{2})?(?:\s*(?:${any}))?`
261
+ };
262
+ }
263
+ /**
264
+ * Reads a time of day — `9:05`, `09:05:30`, and the 12-hour forms `3:00 PM`, `3:00pm`, `p.m. 3:00`, or
265
+ * the locale's own words before or after (`Intl` day periods) — as 24-hour parts, or `null`. With a
266
+ * morning/afternoon word the hour must be 1–12 (`12 AM` is midnight, `12 PM` noon); without one 0–23.
267
+ */
268
+ function readTimeOfDay(text, words) {
269
+ const r = new RegExp(String.raw`^(?:(${words.any})\s*)?(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\s*(${words.any}))?$`, "iu").exec(text.trim());
270
+ if (!r || r[1] && r[5]) return null;
271
+ const marker = r[1] ?? r[5];
272
+ let h = Number(r[2]);
273
+ if (marker) {
274
+ const pm = words.pm.get(marker.toLowerCase().replace(/\./g, ""));
275
+ if (pm === void 0 || h < 1 || h > 12) return null;
276
+ h = h % 12 + (pm ? 12 : 0);
238
277
  }
239
- const h = Number(m[2]);
240
- const min = Number(m[3]);
241
- if (h > 23 || min > 59) return null;
242
- return `${date}T${String(h).padStart(2, "0")}:${String(min).padStart(2, "0")}`;
278
+ if (h > 23 || Number(r[3]) > 59 || Number(r[4] ?? 0) > 59) return null;
279
+ return {
280
+ h: String(h),
281
+ m: r[3],
282
+ s: r[4]
283
+ };
243
284
  }
244
- /** Writes local `YYYY-MM-DDTHH:mm` (or a longer ISO date-time) as `{date} HH:mm`, the date part as {@link formatDateText} writes it. */
245
- function formatDateTimeText(isoLocal, format = "iso", locale) {
246
- const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(isoLocal);
247
- return m ? `${formatDateText(m[1], format, locale)} ${m[2]}` : isoLocal;
285
+ /** `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` when there are none). */
286
+ function timeText(h, min, s, seconds) {
287
+ const hm = `${h.padStart(2, "0")}:${min}`;
288
+ return seconds ? `${hm}:${(s ?? "00").padStart(2, "0")}` : hm;
289
+ }
290
+ /**
291
+ * Writes local `YYYY-MM-DDTHH:mm` (or a longer ISO date-time) as `{date} HH:mm`, the date part as
292
+ * {@link formatDateText} writes it — `{date} HH:mm:ss` with `seconds`.
293
+ */
294
+ function formatDateTimeText(isoLocal, format = "iso", locale, seconds = false) {
295
+ const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(:\d{2})?/.exec(isoLocal);
296
+ if (!m) return isoLocal;
297
+ return `${formatDateText(m[1], format, locale)} ${m[2]}${seconds ? m[3] ?? ":00" : ""}`;
248
298
  }
249
299
  /** Separators read between the two days of a typed range: `~`, en/em dash, or ` - ` with spaces. */
250
300
  var RANGE_SEPARATOR = /\s*[~–—]\s*|\s+-\s+/;
@@ -295,5 +345,71 @@ function parseDateRange(text, options = {}) {
295
345
  function formatDateRangeText(start, end, format = "iso", locale) {
296
346
  return `${formatDateText(start, format, locale)} – ${formatDateText(end, format, locale)}`;
297
347
  }
348
+ /**
349
+ * Reads a period with times of day — `2026-10-01 09:00 ~ 2026-10-31 18:00`, `2026-10-01 09:00 ~ 18:00`
350
+ * (a time alone ends on the first day), the ISO interval `2026-10-01T09:00/2026-10-31T18:00`, or the
351
+ * day forms {@link parseDateRange} reads — and returns `{ start, end }` as local `YYYY-MM-DDTHH:mm`,
352
+ * earlier first, or `null`. A day typed without a time takes `startTime` (default `00:00`) at the
353
+ * start and `endTime` (default `23:59`) at the end, so a period of days covers them whole; one day
354
+ * alone runs from `startTime` to `endTime` that day. A short second day takes the first day's year,
355
+ * or the next year when it would otherwise fall before the first day. With `seconds`, both ends are
356
+ * `YYYY-MM-DDTHH:mm:ss` (see {@link parseDateTime}).
357
+ */
358
+ function parseDateTimeRange(text, options = {}) {
359
+ const t = text.trim();
360
+ if (!t) return null;
361
+ const startTime = options.startTime ?? "00:00";
362
+ const endTime = options.endTime ?? "23:59";
363
+ let parts = t.split(RANGE_SEPARATOR);
364
+ if (parts.length === 1 && t.includes("/")) {
365
+ const iso = /^(\d{4}-\d{2}-\d{2}(?:T[\d:]+)?)[^/]*\/(\d{4}-\d{2}-\d{2}(?:T[\d:]+)?)/.exec(t);
366
+ if (iso) parts = [iso[1], iso[2]];
367
+ }
368
+ if (parts.length > 2) return null;
369
+ const start = parseDateTime(parts[0], {
370
+ ...options,
371
+ defaultTime: startTime
372
+ });
373
+ if (!start) return null;
374
+ const startDay = start.slice(0, 10);
375
+ if (parts.length === 1) {
376
+ const sameDayEnd = parseDateTime(startDay, {
377
+ ...options,
378
+ defaultTime: endTime
379
+ });
380
+ if (!sameDayEnd) return null;
381
+ return {
382
+ start,
383
+ end: sameDayEnd < start ? start : sameDayEnd
384
+ };
385
+ }
386
+ let end;
387
+ if (new RegExp(`^${meridiemWords(options.locale ?? Locale.get()).timeOfDay}$`, "iu").test(parts[1].trim())) end = parseDateTime(`${startDay} ${parts[1].trim()}`, options);
388
+ else {
389
+ const [y, m, d] = startDay.split("-").map(Number);
390
+ end = parseDateTime(parts[1], {
391
+ ...options,
392
+ referenceDate: new Date(y, m - 1, d),
393
+ defaultTime: endTime
394
+ });
395
+ if (end && end.slice(0, 10) < startDay && !/\d{4}/.test(parts[1])) end = parseDateTime(parts[1], {
396
+ ...options,
397
+ referenceDate: new Date(y + 1, 0, 1),
398
+ defaultTime: endTime
399
+ });
400
+ }
401
+ if (!end) return null;
402
+ return start <= end ? {
403
+ start,
404
+ end
405
+ } : {
406
+ start: end,
407
+ end: start
408
+ };
409
+ }
410
+ /** Writes a period with times as `{start} – {end}`, each as {@link formatDateTimeText} writes it. */
411
+ function formatDateTimeRangeText(start, end, format = "iso", locale, seconds = false) {
412
+ return `${formatDateTimeText(start, format, locale, seconds)} – ${formatDateTimeText(end, format, locale, seconds)}`;
413
+ }
298
414
  //#endregion
299
- export { dateTextPattern, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeText, formatNumber, parseDate, parseDateRange, parseDateTime, parseNumber };
415
+ export { dateTextPattern, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "1.57.1",
4
+ "version": "1.58.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -24,7 +24,9 @@ Slide carousel. Each direct child element becomes one slide.
24
24
  With `autoplay`, the carousel renders a stop/start button as the first control of its indicator
25
25
  row (WCAG 2.2.2). Rotation pauses while the mouse is over the carousel and stops when keyboard focus
26
26
  moves into it, until the user presses start (WAI-ARIA APG carousel pattern). Slides are
27
- `aria-live="off"` while rotating and `polite` when stopped.
27
+ `aria-live="off"` while rotating and `polite` when stopped. For a user who has asked for reduced
28
+ motion (`prefers-reduced-motion: reduce`) the carousel starts stopped — the start button turns
29
+ rotation on — and it stops if that setting is turned on while the page is open.
28
30
 
29
31
  ---
30
32
 
@@ -22,7 +22,9 @@ field opens the calendar and keeps the caret in the text box; ArrowDown (or Alt+
22
22
  into the calendar. Text that is not a date clears the value and reports `badInput` (the text stays
23
23
  so it can be fixed); a date outside `min`/`max` is kept and reported as out of range.
24
24
  In `mode="datetime"` the text box takes a time after the date (`2026-10-02 14:30`, `9:05`, seconds
25
- dropped) and shows `YYYY-MM-DD HH:mm`; typing only a date keeps the time already set.
25
+ dropped unless `seconds` is set) and shows `YYYY-MM-DD HH:mm`; typing only a date keeps the time
26
+ already set. 12-hour times are read too — `3:00 PM`, `3:00pm`, `p.m. 3:00`, `오후 3:00`, `午後3:00`,
27
+ `下午 3:00` (`12 AM` is midnight) — and shown in 24-hour form; the value is the same either way.
26
28
  The parser and formatter are exported as `parseDate`, `parseDateTime`, `formatDateText`,
27
29
  `formatDateTimeText` and `dateTextPattern`.
28
30
 
@@ -32,6 +34,30 @@ in `mode="datetime"` this also sets the time to right now — disabled when toda
32
34
  day preserves whatever time-of-day was already set; only the "Today" button overrides the time.
33
35
  `min`/`max` are always date-only, even in `mode="datetime"` — time-of-day is never range-checked.
34
36
 
37
+ ### Disabled days
38
+
39
+ `min`/`max` bound the calendar; `isDateDisabled` removes days inside it — weekends, holidays, fully
40
+ booked days. It receives the ISO day and returns `true` to disable it. A disabled day is drawn with
41
+ `aria-disabled="true"` and cannot be picked (nor can "Today" when today is disabled). A typed or
42
+ assigned value on a disabled day reports `stepMismatch` ("This date is not available") — the native
43
+ date input reports the same flag for a readable day its `step` does not allow.
44
+
45
+ ```js
46
+ const holidays = new Set(['2026-10-03', '2026-10-09']);
47
+ picker.isDateDisabled = (date) => {
48
+ const day = new Date(`${date}T00:00`).getDay();
49
+ return day === 0 || day === 6 || holidays.has(date);
50
+ };
51
+ ```
52
+
53
+ ### Apply to confirm
54
+
55
+ With `confirm`, choosing in the calendar does not change the value yet: a day, the time, "Today"
56
+ and "Clear value" only stage the choice, shown in the calendar, and the footer adds **Cancel** and
57
+ **Apply**. Apply commits the staged choice (empty if "Clear value" was chosen), fires `change` once
58
+ and closes; Cancel, Escape or closing the calendar any other way drops it, and the next opening
59
+ starts from the value. Typing in the text box still commits on Enter or leaving the field.
60
+
35
61
  ```html
36
62
  <u-date-picker name="start-date" label="Start date"></u-date-picker>
37
63
 
@@ -40,6 +66,9 @@ day preserves whatever time-of-day was already set; only the "Today" button over
40
66
 
41
67
  <!-- Date + time, value is a full ISO-8601 DateTimeOffset string -->
42
68
  <u-date-picker name="sent-at" label="Sent at" mode="datetime"></u-date-picker>
69
+
70
+ <!-- Day and time are applied together -->
71
+ <u-date-picker name="due-at" label="Due at" mode="datetime" confirm></u-date-picker>
43
72
  ```
44
73
 
45
74
  ---
@@ -53,8 +82,11 @@ day preserves whatever time-of-day was already set; only the "Today" button over
53
82
  | `min` | `string` | — | — | Minimum selectable date (ISO `YYYY-MM-DD`, date-only in both modes) |
54
83
  | `max` | `string` | — | — | Maximum selectable date (ISO `YYYY-MM-DD`, date-only in both modes) |
55
84
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
85
+ | `isDateDisabled` | `(date: string) => boolean` | — | — | App rule for days that cannot be chosen (ISO in, `true` = disabled). Property only; see «Disabled days» |
56
86
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type, e.g. `YYYY-MM-DD` or `YYYY-MM-DD HH:mm`) |
57
87
  | `format` | `'iso' \| 'locale'` | `'iso'` | ✓ | How the text box writes and reads the date part |
88
+ | `confirm` | `boolean` | `false` | ✓ | Calendar picks wait for an Apply button (see «Apply to confirm») |
89
+ | `seconds` | `boolean` | `false` | ✓ | `mode="datetime"`: enter the time to the second (`HH:mm:ss` in the text box, seconds in the time input). The value carries seconds either way |
58
90
  | `disabled` | `boolean` | `false` | ✓ | Disable |
59
91
  | `readonly` | `boolean` | `false` | ✓ | Read-only |
60
92
  | `required` | `boolean` | `false` | ✓ | Required |
@@ -68,7 +100,7 @@ day preserves whatever time-of-day was already set; only the "Today" button over
68
100
 
69
101
  | Event | Description |
70
102
  |-------|-------------|
71
- | `change` | Fires when the user clicks a date cell, confirms via keyboard, commits typed text (Enter or leaving the field, when the value changes), changes the time input (`mode="datetime"`, once a date is set), or clicks the clear button. Programmatic value assignment does not fire it. |
103
+ | `change` | Fires when the user clicks a date cell, confirms via keyboard, commits typed text (Enter or leaving the field, when the value changes), changes the time input (`mode="datetime"`, once a date is set), or clicks the clear button — with `confirm`, calendar picks fire it only when Apply commits a different value. Programmatic value assignment does not fire it. |
72
104
 
73
105
  ## Methods
74
106
 
@@ -41,6 +41,46 @@ exported as `parseDateRange` and `formatDateRangeText`.
41
41
  min="2026-01-01" max="2026-12-31" value="2026-03-01/2026-03-31"></u-date-range-picker>
42
42
  ```
43
43
 
44
+ ### Date and time (`mode="datetime"`)
45
+
46
+ `mode="datetime"` adds a start time and an end time under the calendar (labelled inputs). Each half of
47
+ the value is then a complete ISO-8601 `DateTimeOffset` — seconds and the browser's local offset are
48
+ always filled in — and `start`/`end` return those halves:
49
+
50
+ ```html
51
+ <u-date-range-picker name="shift" label="Shift" mode="datetime"
52
+ value="2026-10-01T09:00:00+09:00/2026-10-01T18:00:00+09:00"></u-date-range-picker>
53
+ ```
54
+
55
+ The first range picked covers its days whole (00:00 to 23:59), as do presets; after that, picking
56
+ other days keeps the times already set. Changing a time updates that end at once (the calendar stays
57
+ open); a start time set after the end on the same day swaps the two. The text box reads
58
+ `2026-10-01 09:00 ~ 2026-10-31 18:00` and `2026-10-01 09:00 ~ 18:00` (a time alone ends on the first
59
+ day); a day typed without a time keeps that end's time. 12-hour times are read as well
60
+ (`2026-10-01 오전 9:00 ~ 오후 6:00`, `9:00 AM ~ 6:00 PM`) and shown in 24-hour form. `min`/`max` and `isDateDisabled` stay
61
+ date-only. The reader and writer are exported as `parseDateTimeRange` and `formatDateTimeRangeText`.
62
+ Add `seconds` to enter times to the second: the inputs and the text box show `HH:mm:ss`, and a whole
63
+ day runs from `00:00:00` to `23:59:59`.
64
+
65
+ ### Disabled days
66
+
67
+ `isDateDisabled` receives an ISO day and returns `true` to disable it. A disabled day cannot start or
68
+ end a range, but a range may run across it — a working week still spans the weekend between. A preset
69
+ whose range starts or ends on a disabled day is disabled. A typed or assigned range that starts or ends
70
+ on one reports `stepMismatch` ("This date is not available").
71
+
72
+ ### Apply to confirm
73
+
74
+ With `confirm`, choosing in the calendar does not change the value yet: a completed range, a preset
75
+ and "Clear value" only stage the choice, shown in the calendar, and the footer adds **Cancel** and
76
+ **Apply**. Apply commits the staged choice (empty if "Clear value" was chosen), fires `change` once
77
+ and closes; Cancel, Escape or closing the calendar any other way drops it, and the next opening
78
+ starts from the value. Typing in the text box still commits on Enter or leaving the field.
79
+
80
+ ```html
81
+ <u-date-range-picker name="period" label="Period" presets="last7Days thisMonth" confirm></u-date-range-picker>
82
+ ```
83
+
44
84
  ### Quick ranges (presets)
45
85
 
46
86
  `presets` lists quick ranges beside the calendar (above it on a narrow screen), in the order given.
@@ -91,14 +131,18 @@ picker.addEventListener('change', () => {
91
131
 
92
132
  | Property | Type | Default | Reflect | Description |
93
133
  |----------|------|---------|---------|-------------|
94
- | `value` | `string` | — | — | The range as `YYYY-MM-DD/YYYY-MM-DD` (start first) |
95
- | `start` | `string` (read-only) | — | — | First day of the range (ISO), `undefined` without a complete range |
96
- | `end` | `string` (read-only) | — | — | Last day of the range (ISO), `undefined` without a complete range |
134
+ | `mode` | `'date' \| 'datetime'` | `'date'` | ✓ | `datetime` adds start and end times; each half becomes an ISO-8601 `DateTimeOffset` |
135
+ | `value` | `string` | — | — | The range as `YYYY-MM-DD/YYYY-MM-DD` (start first), or two `DateTimeOffset`s in `mode="datetime"` |
136
+ | `start` | `string` (read-only) | — | — | Start of the range (ISO day, or date-time in `mode="datetime"`), `undefined` without a complete range |
137
+ | `end` | `string` (read-only) | — | — | End of the range (ISO day, or date-time in `mode="datetime"`), `undefined` without a complete range |
97
138
  | `min` | `string` | — | — | Earliest selectable day (ISO `YYYY-MM-DD`), inclusive |
98
139
  | `max` | `string` | — | — | Latest selectable day (ISO `YYYY-MM-DD`), inclusive |
99
140
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
141
+ | `isDateDisabled` | `(date: string) => boolean` | — | — | App rule for days that cannot start or end a range (ISO in, `true` = disabled). Property only; see «Disabled days» |
100
142
  | `placeholder` | `string` | — | — | Placeholder text (defaults to the pattern to type) |
101
143
  | `format` | `'iso' \| 'locale'` | `'iso'` | ✓ | How the text box writes and reads each day |
144
+ | `confirm` | `boolean` | `false` | ✓ | Calendar picks wait for an Apply button (see «Apply to confirm») |
145
+ | `seconds` | `boolean` | `false` | ✓ | `mode="datetime"`: enter times to the second; a whole day ends at `23:59:59` |
102
146
  | `presets` | `Array<DateRangePresetName \| DateRangePreset>` | `[]` | — | Quick ranges beside the calendar; attribute form is space-separated built-in names |
103
147
  | `disabled` | `boolean` | `false` | ✓ | Disable |
104
148
  | `readonly` | `boolean` | `false` | ✓ | Read-only |
@@ -110,13 +154,14 @@ picker.addEventListener('change', () => {
110
154
  | `validationMessage` | `string` | — | — | Custom validation message |
111
155
 
112
156
  Validation: `required` with no value → `valueMissing`; a value that is not two ISO days joined by `/`
113
- → `badInput`; start before `min` → `rangeUnderflow`; end after `max` → `rangeOverflow`.
157
+ → `badInput`; start before `min` → `rangeUnderflow`; end after `max` → `rangeOverflow`; start or end on a day
158
+ `isDateDisabled` refuses → `stepMismatch`.
114
159
 
115
160
  ## Events
116
161
 
117
162
  | Event | Description |
118
163
  |-------|-------------|
119
- | `change` | Fires when the user completes a range or clears it. Programmatic value assignment does not fire it. |
164
+ | `change` | Fires when the user completes a range or clears it (with `confirm`, when Apply commits a different value). Programmatic value assignment does not fire it. |
120
165
 
121
166
  ## Methods
122
167
 
@@ -143,6 +188,8 @@ Validation: `required` with no value → `valueMissing`; a value that is not two
143
188
  | `calendar-grid` | A date grid |
144
189
  | `calendar-week` | One week row inside a date grid |
145
190
  | `day` | A date cell button |
191
+ | `calendar-time` | The row holding the start and end time inputs (`mode="datetime"` only) |
192
+ | `time-input` | A time-of-day input (`mode="datetime"` only) |
146
193
  | `calendar-footer` | The row holding the "Clear" quick action |
147
194
  | `presets` | The list of quick ranges beside the calendar |
148
195
  | `preset` | One quick-range button |
@@ -38,7 +38,7 @@ same chain.
38
38
  | `Locale.set(locale)` | Set active locale |
39
39
  | `Locale.get()` | Get active locale |
40
40
  | `Locale.register(locale, table)` | Register/override locale messages (partial merge supported) |
41
- | `Locale.getValue(key, params?)` | Resolve a localized message for current locale |
41
+ | `Locale.getValue(key, params?, locale?)` | Resolve a localized message for the current locale (or `locale`, along its fallback chain) |
42
42
  | `Locale.namespace(name)` | A string table for a package or app area, keyed by its own union — returns a handle (below) |
43
43
 
44
44
  ### Namespaces