@slotted/react 0.1.0-beta.37 → 0.1.0-beta.39

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 (92) hide show
  1. package/dist/calendar-CX0wN5Bh.js +564 -0
  2. package/dist/calendar.js +1 -1
  3. package/dist/{data-grid-C5YmAqdN.js → data-grid-Cx0ZOf_e.js} +4 -4
  4. package/dist/data-grid.js +1 -1
  5. package/dist/{data-list-DovwQEMt.js → data-list-Cb2sNA6I.js} +218 -214
  6. package/dist/data-list.js +1 -1
  7. package/dist/{date-picker-DQbj3FON.js → date-picker-CLXTtQGe.js} +1 -1
  8. package/dist/date-picker.js +1 -1
  9. package/dist/{date-range-picker-B16hMhJf.js → date-range-picker-Br0neGyT.js} +1 -1
  10. package/dist/date-range-picker.js +1 -1
  11. package/dist/{datetime-picker-C9pxH7Xf.js → datetime-picker-CR-H_BLu.js} +1 -1
  12. package/dist/datetime-picker.js +1 -1
  13. package/dist/{datetime-range-picker-Cmn7o_Qv.js → datetime-range-picker-BLo58OIk.js} +1 -1
  14. package/dist/datetime-range-picker.js +1 -1
  15. package/dist/docs/calendar.json +44 -4
  16. package/dist/docs/calendar.md +7 -1
  17. package/dist/docs/dialog.json +1 -0
  18. package/dist/docs/dialog.md +1 -1
  19. package/dist/docs/drawer.json +1 -0
  20. package/dist/docs/drawer.md +1 -1
  21. package/dist/docs/list-item.json +1 -1
  22. package/dist/docs/message.json +15 -0
  23. package/dist/docs/message.md +2 -1
  24. package/dist/docs/section.json +1 -1
  25. package/dist/docs/table.json +12 -0
  26. package/dist/docs/table.md +2 -0
  27. package/dist/{filter-bar-Cfwk-3Eu.js → filter-bar-b8bRNPs9.js} +2 -2
  28. package/dist/filter-bar.js +1 -1
  29. package/dist/{import-export-center-BH1bNw_E.js → import-export-center-C_oNc-RM.js} +1 -1
  30. package/dist/import-export-center.js +1 -1
  31. package/dist/index.js +40 -40
  32. package/dist/{message-CdcUyh3g.js → message-D1Dd6Y2k.js} +6 -5
  33. package/dist/message.js +1 -1
  34. package/dist/roving-focus-BXshJYlW.js +149 -0
  35. package/dist/roving-focus.js +2 -2
  36. package/dist/styles/action-sheet.css +1 -1
  37. package/dist/styles/calendar.css +1 -1
  38. package/dist/styles/column-manager.css +1 -1
  39. package/dist/styles/command-palette.css +1 -1
  40. package/dist/styles/data-grid.css +1 -1
  41. package/dist/styles/data-list.css +1 -1
  42. package/dist/styles/date-picker.css +1 -1
  43. package/dist/styles/date-range-picker.css +1 -1
  44. package/dist/styles/datetime-picker.css +1 -1
  45. package/dist/styles/datetime-range-picker.css +1 -1
  46. package/dist/styles/detail-panel.css +1 -1
  47. package/dist/styles/dialog.css +1 -1
  48. package/dist/styles/drawer.css +1 -1
  49. package/dist/styles/event-calendar.css +1 -1
  50. package/dist/styles/filter-bar.css +2 -2
  51. package/dist/styles/import-export-center.css +2 -2
  52. package/dist/styles/index.css +7 -7
  53. package/dist/styles/list-item.css +1 -1
  54. package/dist/styles/media-viewer.css +1 -1
  55. package/dist/styles/message.css +1 -1
  56. package/dist/styles/section.css +1 -1
  57. package/dist/styles/table.css +2 -2
  58. package/dist/styles/upload.css +1 -1
  59. package/dist/styles.css +1 -1
  60. package/dist/{table-CnXBp9j9.js → table-DqwYPHGS.js} +353 -351
  61. package/dist/table.js +1 -1
  62. package/dist/types/calendar/calendar-day-cell.d.ts +30 -0
  63. package/dist/types/calendar/calendar-day-cell.d.ts.map +1 -0
  64. package/dist/types/calendar/calendar-month-table.d.ts +18 -0
  65. package/dist/types/calendar/calendar-month-table.d.ts.map +1 -0
  66. package/dist/types/calendar/calendar-periods.d.ts +24 -0
  67. package/dist/types/calendar/calendar-periods.d.ts.map +1 -0
  68. package/dist/types/calendar/calendar.d.ts +1 -1
  69. package/dist/types/calendar/calendar.d.ts.map +1 -1
  70. package/dist/types/calendar/calendar.types.d.ts +23 -0
  71. package/dist/types/calendar/calendar.types.d.ts.map +1 -1
  72. package/dist/types/calendar/index.d.ts +1 -1
  73. package/dist/types/calendar/index.d.ts.map +1 -1
  74. package/dist/types/data-list/data-list.d.ts.map +1 -1
  75. package/dist/types/message/message-parts.d.ts +1 -1
  76. package/dist/types/message/message-parts.d.ts.map +1 -1
  77. package/dist/types/message/message.types.d.ts +2 -0
  78. package/dist/types/message/message.types.d.ts.map +1 -1
  79. package/dist/types/roving-focus/index.d.ts +2 -0
  80. package/dist/types/roving-focus/index.d.ts.map +1 -1
  81. package/dist/types/roving-focus/roving-grid.d.ts +27 -0
  82. package/dist/types/roving-focus/roving-grid.d.ts.map +1 -0
  83. package/dist/types/table/index.d.ts +1 -1
  84. package/dist/types/table/index.d.ts.map +1 -1
  85. package/dist/types/table/table-defaults.d.ts.map +1 -1
  86. package/dist/types/table/table.d.ts +1 -1
  87. package/dist/types/table/table.d.ts.map +1 -1
  88. package/dist/types/table/table.types.d.ts +10 -0
  89. package/dist/types/table/table.types.d.ts.map +1 -1
  90. package/package.json +7 -6
  91. package/dist/calendar-D8FhdXWc.js +0 -537
  92. package/dist/roving-focus-C5-rVFzI.js +0 -89
@@ -1,537 +0,0 @@
1
- import { n as e, r as t } from "./i18n-D7xXDd8-.js";
2
- import { n, t as r } from "./icon-D04-_QFA.js";
3
- /* empty css */
4
- import { a as i, i as a, n as o, r as s } from "./tooltip-DrFiRlH8.js";
5
- import { keyedProps as c } from "@slotted/core/selector-key";
6
- import { createControllable as l } from "@slotted/core/state";
7
- import { createContext as u, useCallback as d, useContext as f, useEffect as p, useId as m, useImperativeHandle as ee, useMemo as h, useRef as g, useState as _ } from "react";
8
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
9
- import { calendarMessages as te } from "@slotted/core/i18n";
10
- import { addDays as x, clampDate as S, compareDate as C, createDateFormat as ne, endOfWeek as re, isDateInRange as ie, isSameDate as w, monthGrid as ae, plainDate as T, startOfWeek as oe, stepMonth as E, stepYear as D, toISODate as se, todayIn as ce, visibleMonths as le, yearPage as ue } from "@slotted/core/date";
11
- //#region src/calendar/calendar-day-button.tsx
12
- function de({ tooltip: e, ...t }) {
13
- return e == null || e === !1 ? /* @__PURE__ */ y("span", { ...t }) : /* @__PURE__ */ b(i, { children: [/* @__PURE__ */ y(a, {
14
- ...t,
15
- render: (e) => /* @__PURE__ */ y("span", { ...e })
16
- }), /* @__PURE__ */ y(s, { children: /* @__PURE__ */ y(o, { children: e }) })] });
17
- }
18
- //#endregion
19
- //#region src/calendar/calendar-defaults.tsx
20
- var fe = u({
21
- calendar: "gregory",
22
- firstDayOfWeek: void 0,
23
- fixedWeeks: !1,
24
- months: 1,
25
- outsideDays: void 0,
26
- timeZone: void 0,
27
- weekNumbers: !1
28
- });
29
- function pe() {
30
- return f(fe);
31
- }
32
- function me({ children: e, ...t }) {
33
- let n = pe();
34
- return /* @__PURE__ */ y(fe.Provider, {
35
- value: {
36
- calendar: t.calendar ?? n.calendar,
37
- firstDayOfWeek: t.firstDayOfWeek ?? n.firstDayOfWeek,
38
- fixedWeeks: t.fixedWeeks ?? n.fixedWeeks,
39
- months: t.months ?? n.months,
40
- outsideDays: t.outsideDays ?? n.outsideDays,
41
- timeZone: t.timeZone ?? n.timeZone,
42
- weekNumbers: t.weekNumbers ?? n.weekNumbers
43
- },
44
- children: e
45
- });
46
- }
47
- //#endregion
48
- //#region src/calendar/calendar-header.tsx
49
- function he({ editable: e, heading: t, headingId: i, nextName: a, onTurn: o, onWalkUp: s, previousName: c, view: l }) {
50
- return /* @__PURE__ */ b("div", {
51
- "data-part": "header",
52
- "data-part-header": "",
53
- children: [
54
- /* @__PURE__ */ y("button", {
55
- "aria-label": c,
56
- "data-part": "previous",
57
- "data-part-previous": "",
58
- disabled: !e,
59
- onClick: o(-1),
60
- type: "button",
61
- children: /* @__PURE__ */ y(r, {
62
- directional: !0,
63
- children: /* @__PURE__ */ y(n, { name: "chevron-right" })
64
- })
65
- }),
66
- /* @__PURE__ */ b("button", {
67
- "aria-live": "polite",
68
- "data-part": "heading",
69
- "data-part-heading": "",
70
- disabled: !e || l === "year",
71
- id: i,
72
- onClick: s,
73
- type: "button",
74
- children: [t, l === "year" ? null : /* @__PURE__ */ y(r, { children: /* @__PURE__ */ y(n, { name: "chevron-down" }) })]
75
- }),
76
- /* @__PURE__ */ y("button", {
77
- "aria-label": a,
78
- "data-part": "next",
79
- "data-part-next": "",
80
- disabled: !e,
81
- onClick: o(1),
82
- type: "button",
83
- children: /* @__PURE__ */ y(r, {
84
- directional: !0,
85
- children: /* @__PURE__ */ y(n, { name: "chevron-right" })
86
- })
87
- })
88
- ]
89
- });
90
- }
91
- //#endregion
92
- //#region src/calendar/calendar-selection.ts
93
- function O(e) {
94
- return e !== null && !Array.isArray(e) && "start" in e;
95
- }
96
- function k(e) {
97
- return e === null ? [] : Array.isArray(e) ? e : O(e) ? [e.start, e.end].filter((e) => e !== null) : [e];
98
- }
99
- function A(e, t) {
100
- if (!O(t)) return null;
101
- let { start: n, end: r } = t;
102
- return n !== null && w(e, n) ? "start" : r !== null && w(e, r) ? "end" : n === null || r === null ? null : C(e, n) > 0 && C(e, r) < 0 ? "inside" : null;
103
- }
104
- function j(e, t) {
105
- if (O(t)) {
106
- let n = A(e, t);
107
- return n === "start" || n === "end";
108
- }
109
- return k(t).some((t) => w(t, e));
110
- }
111
- function ge(e, t, n) {
112
- if (n === "single") return j(e, t) ? null : e;
113
- if (n === "multiple") {
114
- let n = k(t), r = n.filter((t) => !w(t, e));
115
- return r.length === n.length ? [...n, e].sort(C) : r;
116
- }
117
- let r = O(t) ? t : {
118
- start: null,
119
- end: null
120
- };
121
- return r.start === null || r.end !== null ? {
122
- start: e,
123
- end: null
124
- } : C(e, r.start) < 0 ? {
125
- start: e,
126
- end: r.start
127
- } : {
128
- start: r.start,
129
- end: e
130
- };
131
- }
132
- function _e(e, t) {
133
- return t === null || !O(e) || e.start === null || e.end !== null ? null : C(t, e.start) < 0 ? {
134
- start: t,
135
- end: e.start
136
- } : {
137
- start: e.start,
138
- end: t
139
- };
140
- }
141
- function ve(e, t) {
142
- if (O(e) || O(t)) return !O(e) || !O(t) ? !1 : w(e.start, t.start) && w(e.end, t.end);
143
- let n = k(e), r = k(t);
144
- return n.length === r.length && n.every((e, t) => w(e, r[t] ?? null));
145
- }
146
- //#endregion
147
- //#region src/calendar/calendar.tsx
148
- var ye = {
149
- day: 7,
150
- month: 4,
151
- year: 4
152
- }, M = 12;
153
- function N({ calendar: n, className: r, defaultFocusedDate: i, defaultValue: a, defaultView: o, disabled: s, firstDayOfWeek: u, fixedWeeks: f, focusedDate: C, granularity: ae, header: se = !0, dayLabel: de, invalid: fe, isDateUnavailable: me, layout: k = "cells", lines: A = !1, locale: j, max: N, min: P, messages: xe, months: Se, onFocusedDateChange: Ce, onKeyDown: we, onPreviewChange: Te, onValueChange: Ee, onViewChange: De, marks: Oe, outsideDays: ke, readOnly: Ae, ref: je, render: Me, renderDay: Ne, renderDayTooltip: Pe, selectionMode: Fe = "single", style: Ie, timeZone: Le, value: F, view: Re, weekNumbers: ze, ...Be }) {
154
- let I = pe(), Ve = e(), L = t(te, xe), R = g(null), He = m(), Ue = j ?? Ve, We = u ?? I.firstDayOfWeek, Ge = Le ?? I.timeZone, z = Math.max(1, Se ?? I.months), Ke = ze ?? I.weekNumbers, qe = f ?? I.fixedWeeks, Je = ke ?? I.outsideDays ?? (z > 1 ? "hidden" : "shown"), Ye = n ?? I.calendar, B = s !== !0 && Ae !== !0, V = h(() => ne({
155
- locale: Ue,
156
- firstDayOfWeek: We
157
- }), [We, Ue]), [H, Xe] = _(null);
158
- p(() => Xe(ce(Ge)), [Ge]);
159
- let [Ze, Qe] = _(a ?? null), U = F ?? Ze, W = a ?? F ?? null, $e = W === null ? null : Array.isArray(W) ? W[0] ?? null : "start" in W ? W.start : W, et = i !== void 0 || C !== void 0 || $e !== null, G = i ?? C ?? $e ?? T(2026, 1, 1), [tt, nt] = _(G), K = C ?? tt, q = g(!1), J = ae === "month", [rt, it] = _(o ?? (J ? "month" : "day")), at = Re ?? rt, Y = J && at === "day" ? "month" : at, [ot, st] = _(null), X = Fe === "range" && B ? _e(U, ot ?? K) : null, Z = X === null ? null : O(U) && U.start !== null && w(X.start, U.start) ? X.end : X.start, ct = g(null);
160
- p(() => {
161
- w(ct.current, Z) || (ct.current = Z, Te?.(Z));
162
- }, [Te, Z]);
163
- let [lt, ut] = _(() => ({
164
- year: G.year,
165
- month: G.month
166
- })), dt = d((e, t) => {
167
- let n = t.year * 12 + (t.month - 1), r = e.year * 12 + (e.month - 1);
168
- if (r >= n && r < n + z) return t;
169
- let i = n + Math.floor((r - n) / z) * z;
170
- return {
171
- year: Math.floor(i / 12),
172
- month: i % 12 + 1
173
- };
174
- }, [z]);
175
- p(() => {
176
- if (H === null || et) return;
177
- let e = S(H, P, N);
178
- nt((t) => w(t, G) ? e : t), ut((t) => t.year === G.year && t.month === G.month ? {
179
- year: e.year,
180
- month: e.month
181
- } : t);
182
- }, [H]);
183
- let ft = d((e, t, n) => {
184
- l({
185
- controlled: F,
186
- initial: U,
187
- equals: ve,
188
- onRequest: (e) => Ee?.(e.value, e)
189
- }).request(e, t, n) && Qe(e);
190
- }, [
191
- U,
192
- Ee,
193
- F
194
- ]), Q = d((e, t, n) => {
195
- let r = S(e, P, N), i = l({
196
- controlled: C,
197
- initial: K,
198
- equals: (e, t) => w(e, t),
199
- onRequest: (e) => Ce?.(e.value, e)
200
- });
201
- q.current = t === "keyboard", i.request(r, t, n) && nt(r);
202
- }, [
203
- K,
204
- C,
205
- N,
206
- P,
207
- Ce
208
- ]);
209
- p(() => {
210
- ut((e) => dt(K, e));
211
- }, [K, dt]);
212
- let $ = d((e) => {
213
- Re === void 0 && it(e), De?.(e);
214
- }, [De, Re]);
215
- p(() => {
216
- if (!q.current) return;
217
- let e = R.current, t = e?.querySelector("[data-part=\"cell\"]:not([data-outside-month]) [data-part=\"day\"][tabindex=\"0\"], [data-part=\"period\"][tabindex=\"0\"]");
218
- if (t == null) {
219
- e?.querySelector("[data-part=\"day\"][tabindex=\"0\"]") ?? (q.current = !1);
220
- return;
221
- }
222
- q.current = !1, t.focus();
223
- }), ee(je, () => ({
224
- focus: () => {
225
- R.current?.querySelector("[data-part=\"day\"][tabindex=\"0\"], [data-part=\"period\"][tabindex=\"0\"]")?.focus();
226
- },
227
- focusDate: (e) => Q(e, "keyboard", void 0)
228
- }), [Q]);
229
- let pt = d((e) => !ie(e, P, N) || me?.(e) === !0, [
230
- me,
231
- N,
232
- P
233
- ]), mt = (e, t, n) => {
234
- B && !pt(e) && (ft(ge(e, U, Fe), t, n), Q(e, t, n));
235
- }, ht = (e, t) => P !== void 0 && e * 12 + t < P.year * 12 + P.month || N !== void 0 && e * 12 + t > N.year * 12 + N.month, gt = (e, t, n, r) => {
236
- if (!B || ht(e, t)) return;
237
- let i = T(e, t, 1);
238
- ft(i, n, r), Q(i, n, r);
239
- }, _t = U === null || Array.isArray(U) || O(U) ? null : {
240
- year: U.year,
241
- month: U.month
242
- }, vt = (e) => {
243
- if (we?.(e), e.defaultPrevented) return;
244
- let t = R.current !== null && getComputedStyle(R.current).direction === "rtl", n = t ? "ArrowLeft" : "ArrowRight", r = t ? "ArrowRight" : "ArrowLeft", i = () => {
245
- e.preventDefault(), e.stopPropagation();
246
- }, a = (t) => {
247
- i(), Q(t, "keyboard", e);
248
- };
249
- if (J && Y === "month") {
250
- let t = (e) => {
251
- let t = K.year * 12 + (K.month - 1) + e;
252
- return T(Math.floor(t / 12), t % 12 + 1, 1);
253
- }, o = ye.month;
254
- switch (e.key) {
255
- case n: return a(t(1));
256
- case r: return a(t(-1));
257
- case "ArrowUp": return a(t(-o));
258
- case "ArrowDown": return a(t(o));
259
- case "Home": return a(T(K.year, 1, 1));
260
- case "End": return a(T(K.year, 12, 1));
261
- case "PageUp": return a(t(-12));
262
- case "PageDown": return a(t(12));
263
- case "Enter":
264
- case " ":
265
- i(), gt(K.year, K.month, "keyboard", e);
266
- return;
267
- }
268
- }
269
- switch (e.key) {
270
- case n: return a(x(K, 1));
271
- case r: return a(x(K, -1));
272
- case "ArrowUp": return a(x(K, -7));
273
- case "ArrowDown": return a(x(K, 7));
274
- case "Home": return a(oe(K, V.firstDayOfWeek));
275
- case "End": return a(re(K, V.firstDayOfWeek));
276
- case "PageUp": return a(e.shiftKey ? D(K, -1).date : E(K, -1).date);
277
- case "PageDown": return a(e.shiftKey ? D(K, 1).date : E(K, 1).date);
278
- case "Enter":
279
- case " ":
280
- i(), mt(K, "keyboard", e);
281
- return;
282
- case "Escape":
283
- if (Y === "day" || J && Y === "month") return;
284
- i(), $(Y === "year" ? "month" : "day");
285
- return;
286
- default: return;
287
- }
288
- }, yt = (e) => (t) => {
289
- if (Y === "day") {
290
- Q(E(K, e * z).date, "pointer", t);
291
- return;
292
- }
293
- Q(Y === "month" ? D(K, e).date : D(K, e * M).date, "pointer", t);
294
- }, bt = T(lt.year, lt.month, 1), xt = Y === "day" ? z === 1 ? V.monthYear(bt) : `${V.monthYear(bt, "short")} – ${V.monthYear(E(bt, z - 1).date, "short")}` : Y === "month" ? String(K.year) : `${String(ue(K.year, M)[0] ?? K.year)} – ${String(ue(K.year, M).at(-1) ?? K.year)}`, St = Y === "day" ? /* @__PURE__ */ y("div", {
295
- "data-part": "grids",
296
- "data-part-grids": "",
297
- children: le(lt, z).map((e) => /* @__PURE__ */ y(be, {
298
- editable: B,
299
- firstDayOfWeek: V.firstDayOfWeek,
300
- fixedWeeks: qe,
301
- focused: K,
302
- format: V,
303
- headingId: se ? He : void 0,
304
- month: e,
305
- onHover: st,
306
- dayLabel: de,
307
- marks: Oe,
308
- renderDay: Ne,
309
- renderDayTooltip: Pe,
310
- markName: (e) => e.count === void 0 ? L("marked") : L("markCount", { count: e.count }),
311
- onSelect: mt,
312
- outsideDays: Je,
313
- pending: X,
314
- today: H,
315
- unavailable: pt,
316
- value: U,
317
- weekNumbers: Ke
318
- }, `${String(e.year)}-${String(e.month)}`))
319
- }) : Y === "month" && J ? /* @__PURE__ */ y("div", {
320
- "data-part": "months",
321
- "data-part-months": "",
322
- children: V.monthNames("short").map((e, t) => {
323
- let n = t + 1, r = ht(K.year, n), i = _t?.year === K.year && _t.month === n;
324
- return /* @__PURE__ */ y("button", {
325
- "aria-label": V.monthYear(T(K.year, n, 1)),
326
- "data-part": "period",
327
- "data-part-period": "",
328
- onClick: (e) => gt(K.year, n, "pointer", e),
329
- tabIndex: K.month === n ? 0 : -1,
330
- type: "button",
331
- ...i ? {
332
- "aria-selected": !0,
333
- "data-selected": ""
334
- } : {},
335
- ...r ? {
336
- "aria-disabled": !0,
337
- "data-unavailable": ""
338
- } : {},
339
- ...K.month === n ? { "data-focused": "" } : {},
340
- children: e
341
- }, e);
342
- })
343
- }) : Y === "month" ? /* @__PURE__ */ y("div", {
344
- "data-part": "months",
345
- "data-part-months": "",
346
- children: V.monthNames("short").map((e, t) => /* @__PURE__ */ y("button", {
347
- "data-part": "period",
348
- "data-part-period": "",
349
- onClick: (e) => {
350
- Q({
351
- ...K,
352
- month: t + 1,
353
- day: 1
354
- }, "pointer", e), $("day");
355
- },
356
- type: "button",
357
- ...K.month === t + 1 ? {
358
- "aria-selected": !0,
359
- "data-selected": ""
360
- } : {},
361
- children: e
362
- }, e))
363
- }) : /* @__PURE__ */ y("div", {
364
- "data-part": "years",
365
- "data-part-years": "",
366
- children: ue(K.year, M).map((e) => /* @__PURE__ */ y("button", {
367
- "data-part": "period",
368
- "data-part-period": "",
369
- onClick: (t) => {
370
- Q({
371
- ...K,
372
- year: e,
373
- day: 1
374
- }, "pointer", t), $("month");
375
- },
376
- type: "button",
377
- ...K.year === e ? {
378
- "aria-selected": !0,
379
- "data-selected": ""
380
- } : {},
381
- children: e
382
- }, e))
383
- }), [Ct, wt] = Y === "day" ? [L("previousMonth"), L("nextMonth")] : Y === "month" ? [L("previousYear"), L("nextYear")] : [L("previousYears"), L("nextYears")], Tt = /* @__PURE__ */ b(v, { children: [se ? /* @__PURE__ */ y(he, {
384
- editable: B,
385
- heading: xt,
386
- headingId: He,
387
- nextName: wt,
388
- onTurn: yt,
389
- onWalkUp: () => $(Y === "day" ? "month" : "year"),
390
- previousName: Ct,
391
- view: Y
392
- }) : null, St] }), Et = c({
393
- ...Be,
394
- children: Tt,
395
- className: r,
396
- onKeyDown: vt,
397
- style: Ie,
398
- ...s === !0 ? { "data-disabled": "" } : {},
399
- ...fe === !0 ? { "data-invalid": "" } : {},
400
- ...Ae === !0 ? { "data-readonly": "" } : {},
401
- ...Ke ? { "data-week-numbers": "" } : {},
402
- ...z > 1 ? { "data-months": String(z) } : {},
403
- ...k === "fill" ? { "data-layout": "fill" } : {},
404
- ...A ? { "data-lines": "" } : {},
405
- "data-calendar": Ye,
406
- "data-columns": String(ye[Y]),
407
- "data-part": "root",
408
- "data-ui": "calendar",
409
- "data-view": Y,
410
- ref: R
411
- });
412
- return Me === void 0 ? /* @__PURE__ */ y("div", { ...Et }) : Me(Et);
413
- }
414
- function be({ dayLabel: e, editable: t, firstDayOfWeek: n, fixedWeeks: r, focused: i, format: a, headingId: o, markName: s, marks: c, month: l, onHover: u, onSelect: d, outsideDays: f, pending: p, renderDay: m, renderDayTooltip: ee, today: h, unavailable: g, value: _, weekNumbers: v }) {
415
- let te = ae({
416
- ...l,
417
- firstDayOfWeek: n,
418
- fixedWeeks: r
419
- }), x = a.monthYear(T(l.year, l.month, 1)), S = a.weekdayNames("long"), C = a.weekdayNames("narrow");
420
- return /* @__PURE__ */ b("table", {
421
- "aria-labelledby": o,
422
- "data-part": "grid",
423
- "data-part-grid": "",
424
- role: "grid",
425
- children: [
426
- /* @__PURE__ */ y("caption", {
427
- "data-part": "grid-caption",
428
- "data-part-grid-caption": "",
429
- children: x
430
- }),
431
- /* @__PURE__ */ y("thead", { children: /* @__PURE__ */ b("tr", {
432
- "data-part": "week-headers",
433
- "data-part-week-headers": "",
434
- children: [v ? /* @__PURE__ */ y("th", {
435
- "aria-hidden": "true",
436
- "data-part": "week-number",
437
- "data-part-week-number": ""
438
- }) : null, C.map((e, t) => /* @__PURE__ */ y("th", {
439
- abbr: S[t],
440
- "data-part": "week-header",
441
- "data-part-week-header": "",
442
- scope: "col",
443
- children: e
444
- }, S[t]))]
445
- }) }),
446
- /* @__PURE__ */ y("tbody", { children: te.map((n) => /* @__PURE__ */ b("tr", {
447
- "data-part": "week",
448
- "data-part-week": "",
449
- children: [v ? /* @__PURE__ */ y("th", {
450
- "data-part": "week-number",
451
- "data-part-week-number": "",
452
- scope: "row",
453
- children: n.weekNumber
454
- }) : null, n.days.map((n) => {
455
- let r = n.outsideMonth, a = r && f === "hidden", o = g(n.date) || r && f === "shown", l = j(n.date, _), v = A(n.date, p ?? _), te = p !== null && v !== null && !l, x = w(n.date, i), S = a ? void 0 : c?.get(se(n.date)), C = {
456
- outside: r,
457
- selected: l,
458
- today: h !== null && w(n.date, h),
459
- unavailable: g(n.date)
460
- };
461
- return /* @__PURE__ */ y("td", {
462
- "data-part": "cell",
463
- "data-part-cell": "",
464
- ...r ? { "data-outside-month": "" } : {},
465
- ...!a && g(n.date) ? { "data-unavailable": "" } : {},
466
- ...!a && l ? { "data-selected": "" } : {},
467
- ...!a && v === "start" ? { "data-range-start": "" } : {},
468
- ...!a && v === "end" ? { "data-range-end": "" } : {},
469
- ...!a && v === "inside" ? { "data-in-range": "" } : {},
470
- ...!a && te ? { "data-preview": "" } : {},
471
- children: a ? null : /* @__PURE__ */ b(de, {
472
- "aria-disabled": o ? !0 : void 0,
473
- "aria-selected": l ? !0 : void 0,
474
- "data-part": "day",
475
- "data-part-day": "",
476
- ...C.today ? { "data-today": "" } : {},
477
- onClick: (e) => {
478
- o || d(n.date, "pointer", e);
479
- },
480
- onPointerEnter: () => u(n.date),
481
- onPointerLeave: () => u(null),
482
- role: "button",
483
- tabIndex: x && t ? 0 : -1,
484
- tooltip: ee?.(n.date, C),
485
- ...e === void 0 ? {} : { "aria-label": e(n.date) },
486
- children: [
487
- n.date.day,
488
- m === void 0 ? null : /* @__PURE__ */ y("span", {
489
- "data-part": "day-content",
490
- "data-part-day-content": "",
491
- children: m(n.date, C)
492
- }),
493
- S === void 0 ? null : /* @__PURE__ */ y("span", {
494
- "data-part": "mark",
495
- "data-part-mark": "",
496
- ...S.tone === void 0 ? {} : { "data-tone": S.tone },
497
- children: /* @__PURE__ */ y("span", {
498
- "data-ui": "visually-hidden",
499
- "data-ui-visually-hidden": "",
500
- children: `, ${s(S)}`
501
- })
502
- })
503
- ]
504
- })
505
- }, `${String(n.date.month)}-${String(n.date.day)}`);
506
- })]
507
- }, n.weekNumber)) })
508
- ]
509
- });
510
- }
511
- //#endregion
512
- //#region src/calendar/calendar-day.tsx
513
- function P(e) {
514
- return /* @__PURE__ */ y("span", {
515
- ...e,
516
- "data-part": "day-marks",
517
- "data-part-day-marks": ""
518
- });
519
- }
520
- function xe({ hollow: e = !1, tone: t, ...n }) {
521
- return /* @__PURE__ */ y("span", {
522
- ...n,
523
- "data-part": "day-mark",
524
- "data-part-day-mark": "",
525
- ...e ? { "data-hollow": "" } : {},
526
- ...t === void 0 ? {} : { "data-tone": t }
527
- });
528
- }
529
- function Se(e) {
530
- return /* @__PURE__ */ y("span", {
531
- ...e,
532
- "data-part": "day-value",
533
- "data-part-day-value": ""
534
- });
535
- }
536
- //#endregion
537
- export { k as a, j as c, me as d, pe as f, N as i, ge as l, P as n, O as o, Se as r, ve as s, xe as t, A as u };
@@ -1,89 +0,0 @@
1
- import { isNavigationDisabled as e } from "@slotted/core/focus";
2
- import { useCallback as t, useRef as n } from "react";
3
- //#region src/roving-focus/roving-focus.ts
4
- var r = {
5
- vertical: {
6
- next: "ArrowDown",
7
- previous: "ArrowUp"
8
- },
9
- horizontal: {
10
- next: "ArrowRight",
11
- previous: "ArrowLeft"
12
- }
13
- };
14
- function i({ exitToTrigger: i = !1, loop: a = !0, onClose: o, orientation: s, reverse: c = !1, triggerRef: l }) {
15
- let u = n(/* @__PURE__ */ new Map()), d = n({
16
- exitToTrigger: i,
17
- loop: a,
18
- onClose: o,
19
- orientation: s,
20
- reverse: c
21
- });
22
- d.current = {
23
- exitToTrigger: i,
24
- loop: a,
25
- onClose: o,
26
- orientation: s,
27
- reverse: c
28
- };
29
- let f = () => [...u.current.entries()].sort(([e], [t]) => e - t).map(([, e]) => e), p = t((e) => ({
30
- ref: (t) => {
31
- t === null ? u.current.delete(e) : u.current.set(e, t);
32
- },
33
- tabIndex: -1
34
- }), []), m = (t, n, r, i) => {
35
- let a = n;
36
- for (let n = 0; n < t.length; n += 1) {
37
- if (a += r, a < 0 || a >= t.length) {
38
- if (!i) return !1;
39
- a = (a + t.length) % t.length;
40
- }
41
- let n = t[a];
42
- if (!e(n, !0)) return n.focus(), !0;
43
- }
44
- return !1;
45
- };
46
- return {
47
- focusFirst: t(() => {
48
- let t = f();
49
- (t.find((t) => !e(t, !0)) ?? t[0])?.focus();
50
- }, []),
51
- getItemProps: p,
52
- onKeyDown: (e) => {
53
- if (e.defaultPrevented) return;
54
- let t = d.current, n = l.current;
55
- if (e.key === "Escape") {
56
- e.preventDefault(), t.onClose(), n?.focus();
57
- return;
58
- }
59
- if (e.key === "Tab") {
60
- t.onClose();
61
- return;
62
- }
63
- if (e.ctrlKey || e.metaKey || e.altKey) return;
64
- let i = f();
65
- if (i.length === 0) return;
66
- let a = t.orientation === "horizontal" && e.currentTarget.ownerDocument.defaultView?.getComputedStyle(e.currentTarget).direction === "rtl", o = r[t.orientation], s = a ? o.previous : o.next, c = a ? o.next : o.previous, u = t.reverse ? {
67
- next: c,
68
- previous: s
69
- } : {
70
- next: s,
71
- previous: c
72
- }, p = i.findIndex((t) => t.contains(e.target));
73
- if (e.key === "Home" || e.key === "End") {
74
- e.preventDefault(), e.key === "Home" ? m(i, -1, 1, !1) : m(i, i.length, -1, !1);
75
- return;
76
- }
77
- if (e.key !== u.next && e.key !== u.previous) return;
78
- e.preventDefault();
79
- let h = e.key === u.next ? 1 : -1, g = h === 1 ? "end" : "start";
80
- if (p !== -1 && (h === 1 ? p === i.length - 1 : p === 0) && t.exitToTrigger === g && n !== null) {
81
- n.focus();
82
- return;
83
- }
84
- m(i, p === -1 ? h === 1 ? -1 : i.length : p, h, t.loop);
85
- }
86
- };
87
- }
88
- //#endregion
89
- export { i as t };