@slotted/react 0.1.0-beta.3 → 0.1.0-beta.4

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 (102) hide show
  1. package/dist/{accordion-D-YuMJzk.js → accordion-lCqrmQ3w.js} +43 -43
  2. package/dist/accordion.js +1 -1
  3. package/dist/calendar-BZ6PP7Ke.js +436 -0
  4. package/dist/calendar.js +1 -1
  5. package/dist/{collapsible-CGo49NNW.js → collapsible-F-K36XbF.js} +17 -17
  6. package/dist/collapsible.js +1 -1
  7. package/dist/{data-grid-BKaGMqIm.js → data-grid-Eb-a4jg3.js} +6 -6
  8. package/dist/data-grid.js +1 -1
  9. package/dist/date-field-Hr-OCU-H.js +290 -0
  10. package/dist/date-field.js +1 -1
  11. package/dist/date-picker-D3-y2Jxw.js +295 -0
  12. package/dist/date-picker.js +1 -1
  13. package/dist/{date-range-picker-CNOAtHwU.js → date-range-picker-y3b82Wmf.js} +2 -2
  14. package/dist/date-range-picker.js +1 -1
  15. package/dist/{datetime-picker-HDVlUhzy.js → datetime-picker-CIRHVLQp.js} +1 -1
  16. package/dist/datetime-picker.js +1 -1
  17. package/dist/{datetime-range-picker-IqOFJtdW.js → datetime-range-picker-DM-1m98z.js} +1 -1
  18. package/dist/datetime-range-picker.js +1 -1
  19. package/dist/{detail-panel-qOJiNuzr.js → detail-panel-CW53lUjp.js} +3 -3
  20. package/dist/detail-panel.js +1 -1
  21. package/dist/docs/calendar.json +7 -0
  22. package/dist/docs/calendar.md +1 -0
  23. package/dist/docs/collapsible.json +1 -1
  24. package/dist/docs/collapsible.md +1 -1
  25. package/dist/docs/date-field.json +8 -1
  26. package/dist/docs/date-field.md +2 -1
  27. package/dist/docs/date-picker.examples.md +29 -0
  28. package/dist/docs/date-picker.json +16 -1
  29. package/dist/docs/date-picker.md +2 -1
  30. package/dist/docs/guidelines/composition.md +10 -0
  31. package/dist/docs/guidelines/index.md +2 -0
  32. package/dist/docs/guidelines/list-pages.md +12 -1
  33. package/dist/docs/page.json +1 -0
  34. package/dist/docs/page.md +1 -0
  35. package/dist/docs/select.json +1 -1
  36. package/dist/docs/select.md +1 -1
  37. package/dist/docs/skills/compose-screen/SKILL.md +7 -0
  38. package/dist/docs/table.json +13 -0
  39. package/dist/docs/table.md +3 -1
  40. package/dist/docs/tabs.json +9 -1
  41. package/dist/docs/tabs.md +3 -1
  42. package/dist/docs/text-field.json +1 -1
  43. package/dist/docs/text-field.md +1 -1
  44. package/dist/{entity-picker-CPDd73JR.js → entity-picker-Dn1T7JCq.js} +1 -1
  45. package/dist/entity-picker.js +1 -1
  46. package/dist/{filter-bar-D_xDcAp2.js → filter-bar-CHyy1o--.js} +3 -3
  47. package/dist/filter-bar.js +1 -1
  48. package/dist/{import-export-center-DpY2DGBZ.js → import-export-center-jF37b909.js} +2 -2
  49. package/dist/import-export-center.js +1 -1
  50. package/dist/index.js +19 -19
  51. package/dist/{notification-center-Sz54IziY.js → notification-center-C1iWWl5Y.js} +1 -1
  52. package/dist/notification-center.js +1 -1
  53. package/dist/{page-kQgLctsA.js → page-IiYXk1sz.js} +32 -32
  54. package/dist/{page-header-CWEBfMGq.js → page-header-Bn4nIGfF.js} +1 -1
  55. package/dist/page-header.js +1 -1
  56. package/dist/page.js +1 -1
  57. package/dist/{select-DOFqPy26.js → select-M7Io4UL9.js} +273 -260
  58. package/dist/select.js +1 -1
  59. package/dist/styles.css +1 -1
  60. package/dist/{table-Cipi2c5X.js → table-U9eJYCuB.js} +167 -165
  61. package/dist/table.js +1 -1
  62. package/dist/tabs-BtHmjlnM.js +348 -0
  63. package/dist/tabs.js +1 -1
  64. package/dist/types/accordion/accordion.d.ts.map +1 -1
  65. package/dist/types/calendar/calendar.d.ts +1 -1
  66. package/dist/types/calendar/calendar.d.ts.map +1 -1
  67. package/dist/types/calendar/calendar.types.d.ts +9 -0
  68. package/dist/types/calendar/calendar.types.d.ts.map +1 -1
  69. package/dist/types/calendar/index.d.ts +1 -1
  70. package/dist/types/calendar/index.d.ts.map +1 -1
  71. package/dist/types/collapsible/collapsible-parts.d.ts.map +1 -1
  72. package/dist/types/date-field/date-field.d.ts +1 -1
  73. package/dist/types/date-field/date-field.d.ts.map +1 -1
  74. package/dist/types/date-field/date-field.types.d.ts +7 -0
  75. package/dist/types/date-field/date-field.types.d.ts.map +1 -1
  76. package/dist/types/date-picker/date-picker.d.ts +5 -1
  77. package/dist/types/date-picker/date-picker.d.ts.map +1 -1
  78. package/dist/types/date-picker/date-picker.types.d.ts +20 -2
  79. package/dist/types/date-picker/date-picker.types.d.ts.map +1 -1
  80. package/dist/types/date-picker/index.d.ts +1 -1
  81. package/dist/types/date-picker/index.d.ts.map +1 -1
  82. package/dist/types/page/page.d.ts.map +1 -1
  83. package/dist/types/select/select-items.d.ts.map +1 -1
  84. package/dist/types/select/select-parts.d.ts.map +1 -1
  85. package/dist/types/select/select.d.ts.map +1 -1
  86. package/dist/types/table/index.d.ts +1 -1
  87. package/dist/types/table/index.d.ts.map +1 -1
  88. package/dist/types/table/table-defaults.d.ts.map +1 -1
  89. package/dist/types/table/table.d.ts +1 -1
  90. package/dist/types/table/table.d.ts.map +1 -1
  91. package/dist/types/table/table.types.d.ts +15 -0
  92. package/dist/types/table/table.types.d.ts.map +1 -1
  93. package/dist/types/tabs/tabs-parts.d.ts.map +1 -1
  94. package/dist/types/tabs/tabs.d.ts +1 -1
  95. package/dist/types/tabs/tabs.d.ts.map +1 -1
  96. package/dist/types/tabs/tabs.types.d.ts +18 -0
  97. package/dist/types/tabs/tabs.types.d.ts.map +1 -1
  98. package/package.json +6 -6
  99. package/dist/calendar-B3mio8iQ.js +0 -387
  100. package/dist/date-field-CYcN6diW.js +0 -279
  101. package/dist/date-picker-4X-_2ltN.js +0 -264
  102. package/dist/tabs-DQ36APY-.js +0 -343
@@ -1,10 +1,10 @@
1
1
  import { isHeldOpen as e, nextOpenValues as t, sameOpenValues as n } from "@slotted/core/disclosure";
2
2
  import { createArrowNavigation as r } from "@slotted/core/focus";
3
3
  import { createControllable as i } from "@slotted/core/state";
4
- import { createContext as a, useContext as o, useEffect as s, useImperativeHandle as c, useState as l } from "react";
5
- import { jsx as u } from "react/jsx-runtime";
4
+ import { createContext as a, useContext as o, useEffect as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
5
+ import { jsx as d } from "react/jsx-runtime";
6
6
  //#region src/accordion/accordion-defaults.tsx
7
- var d = a({
7
+ var f = a({
8
8
  headingLevel: "3",
9
9
  indicator: "chevron",
10
10
  loop: !0,
@@ -16,12 +16,12 @@ var d = a({
16
16
  truncate: !1,
17
17
  variant: "ruled"
18
18
  });
19
- function f() {
20
- return o(d);
19
+ function p() {
20
+ return o(f);
21
21
  }
22
- function p({ children: e, ...t }) {
23
- let n = f();
24
- return /* @__PURE__ */ u(d.Provider, {
22
+ function m({ children: e, ...t }) {
23
+ let n = p();
24
+ return /* @__PURE__ */ d(f.Provider, {
25
25
  value: {
26
26
  headingLevel: t.headingLevel ?? n.headingLevel,
27
27
  indicator: t.indicator ?? n.indicator,
@@ -39,87 +39,87 @@ function p({ children: e, ...t }) {
39
39
  }
40
40
  //#endregion
41
41
  //#region src/accordion/accordion.tsx
42
- var m = ":scope > * > [data-part=\"header\"] > [data-part=\"trigger\"]", h = {
42
+ var h = ":scope > * > [data-part=\"header\"] > [data-part=\"trigger\"]", g = {
43
43
  plain: "plain",
44
44
  ruled: "ruled",
45
45
  framed: "ruled",
46
46
  separated: "framed"
47
- }, g = a(void 0);
48
- function _(e) {
47
+ }, _ = a(void 0);
48
+ function v(e) {
49
49
  return e === null ? [] : [...e.querySelectorAll(":scope > [data-value]")].map((e) => ({
50
50
  disabled: e.hasAttribute("data-disabled"),
51
51
  value: e.getAttribute("data-value") ?? ""
52
52
  }));
53
53
  }
54
- function v() {
55
- return o(g);
54
+ function y() {
55
+ return o(_);
56
56
  }
57
- function y({ children: a, className: o, defaultValue: d, disabled: p, handle: v, headingLevel: y, indicator: b, loop: x, mount: S, multiple: C, onValueChange: w, ref: T, render: E, requireOpen: D, size: O, style: k, togglePlacement: A, truncate: ee, value: j, variant: M, ...N }) {
58
- let P = f(), [F, I] = l(d ?? []), L = j ?? F, [R, z] = l(null), B = p === !0, V = y ?? P.headingLevel, H = b ?? P.indicator, U = x ?? P.loop, W = S ?? P.mount, G = C ?? P.multiple, K = D ?? P.requireOpen, q = O ?? P.size, J = A ?? P.togglePlacement, Y = ee ?? P.truncate, X = M ?? P.variant, Z = {
57
+ function b({ children: a, className: o, defaultValue: f, disabled: m, handle: y, headingLevel: b, indicator: x, loop: S, mount: C, multiple: w, onValueChange: T, ref: E, render: D, requireOpen: O, size: k, style: ee, togglePlacement: A, truncate: j, value: M, variant: N, ...P }) {
58
+ let F = p(), [I, L] = u(f ?? []), R = M ?? I, z = l(null), B = m === !0, V = b ?? F.headingLevel, H = x ?? F.indicator, U = S ?? F.loop, W = C ?? F.mount, G = w ?? F.multiple, K = O ?? F.requireOpen, q = k ?? F.size, J = A ?? F.togglePlacement, Y = j ?? F.truncate, X = N ?? F.variant, Z = {
59
59
  multiple: G,
60
60
  requireOpen: K
61
61
  };
62
62
  s(() => {
63
- if (R === null) return;
64
- let e = r(R, {
65
- itemSelector: m,
63
+ let e = z.current;
64
+ if (e === null) return;
65
+ let t = r(e, {
66
+ itemSelector: h,
66
67
  loop: U,
67
68
  orientation: () => "vertical"
68
- }), t = new MutationObserver(() => e.refresh());
69
- return t.observe(R, {
69
+ }), n = new MutationObserver(() => t.refresh());
70
+ return n.observe(e, {
70
71
  childList: !0,
71
72
  subtree: !0
72
73
  }), () => {
73
- t.disconnect(), e.destroy();
74
+ n.disconnect(), t.destroy();
74
75
  };
75
- }, [R, U]);
76
+ }, [U]);
76
77
  function Q(e, t, r) {
77
78
  let a = !1, o = i({
78
- controlled: j,
79
+ controlled: M,
79
80
  equals: n,
80
- initial: L,
81
+ initial: R,
81
82
  onRequest: (e) => {
82
- a = e.cancelled, w?.(e.value, e);
83
+ a = e.cancelled, T?.(e.value, e);
83
84
  }
84
85
  }).request(e, t, r);
85
- a || o && I(e);
86
+ a || o && L(e);
86
87
  }
87
88
  let te = {
88
89
  disabled: B,
89
90
  indicator: H,
90
- isHeld: (t) => e(L, t, Z),
91
- isOpen: (e) => L.includes(e),
91
+ isHeld: (t) => e(R, t, Z),
92
+ isOpen: (e) => R.includes(e),
92
93
  level: V,
93
94
  mount: W,
94
95
  size: q,
95
96
  togglePlacement: J,
96
97
  toggle: (e, n, r) => {
97
- let i = t(L, e, Z);
98
- i !== L && Q(i, n, r);
98
+ let i = t(R, e, Z);
99
+ i !== R && Q(i, n, r);
99
100
  },
100
101
  truncate: Y,
101
- variant: h[X]
102
+ variant: g[X]
102
103
  };
103
- c(v, () => ({
104
+ c(y, () => ({
104
105
  openAll: () => {
105
- let e = _(R).filter((e) => !e.disabled).map((e) => e.value);
106
+ let e = v(z.current).filter((e) => !e.disabled).map((e) => e.value);
106
107
  Q(G ? e : e.slice(0, 1), "programmatic", void 0);
107
108
  },
108
109
  closeAll: () => {
109
- if (K && L.length > 0) {
110
- Q(L.slice(0, 1), "programmatic", void 0);
110
+ if (K && R.length > 0) {
111
+ Q(R.slice(0, 1), "programmatic", void 0);
111
112
  return;
112
113
  }
113
114
  Q([], "programmatic", void 0);
114
115
  }
115
116
  }), [
116
117
  R,
117
- L,
118
118
  G,
119
119
  K
120
120
  ]);
121
121
  let $ = {
122
- ...N,
122
+ ...P,
123
123
  children: a,
124
124
  className: o,
125
125
  ...B ? { "data-disabled": "" } : {},
@@ -127,17 +127,17 @@ function y({ children: a, className: o, defaultValue: d, disabled: p, handle: v,
127
127
  "data-size": q,
128
128
  "data-ui": "accordion",
129
129
  "data-variant": X,
130
- style: k
130
+ style: ee
131
131
  };
132
- return /* @__PURE__ */ u(g.Provider, {
132
+ return /* @__PURE__ */ d(_.Provider, {
133
133
  value: te,
134
- children: E === void 0 ? /* @__PURE__ */ u("div", {
134
+ children: D === void 0 ? /* @__PURE__ */ d("div", {
135
135
  ...$,
136
136
  ref: (e) => {
137
- z(e), typeof T == "function" ? T(e) : T != null && (T.current = e);
137
+ z.current = e, typeof E == "function" ? E(e) : E != null && (E.current = e);
138
138
  }
139
- }) : E($)
139
+ }) : D($)
140
140
  });
141
141
  }
142
142
  //#endregion
143
- export { f as a, p as i, y as n, v as r, m as t };
143
+ export { p as a, m as i, b as n, y as r, h as t };
package/dist/accordion.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, r, t as i } from "./accordion-D-YuMJzk.js";
1
+ import { a as e, i as t, n, r, t as i } from "./accordion-lCqrmQ3w.js";
2
2
  export { i as ACCORDION_TRIGGER_SELECTOR, n as Accordion, t as AccordionDefaultsProvider, r as useAccordion, e as useAccordionDefaults };
@@ -0,0 +1,436 @@
1
+ import { n as e, t } from "./icon-T9Yt4tnm.js";
2
+ import { n, r } from "./i18n-DpW8lqJ1.js";
3
+ import { createControllable as i } from "@slotted/core/state";
4
+ import { createContext as a, useCallback as o, useContext as s, useEffect as c, useId as ee, useImperativeHandle as l, useMemo as u, useRef as d, useState as f } from "react";
5
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
6
+ import { calendarMessages as g } from "@slotted/core/i18n";
7
+ import { addDays as _, clampDate as v, compareDate as y, createDateFormat as te, endOfWeek as ne, isDateInRange as re, isSameDate as b, monthGrid as ie, plainDate as x, startOfWeek as ae, stepMonth as S, stepYear as C, todayIn as oe, visibleMonths as se, yearPage as w } from "@slotted/core/date";
8
+ //#region src/calendar/calendar-defaults.tsx
9
+ var T = a({
10
+ calendar: "gregory",
11
+ firstDayOfWeek: void 0,
12
+ fixedWeeks: !1,
13
+ months: 1,
14
+ outsideDays: void 0,
15
+ timeZone: void 0,
16
+ weekNumbers: !1
17
+ });
18
+ function E() {
19
+ return s(T);
20
+ }
21
+ function D({ children: e, ...t }) {
22
+ let n = E();
23
+ return /* @__PURE__ */ m(T.Provider, {
24
+ value: {
25
+ calendar: t.calendar ?? n.calendar,
26
+ firstDayOfWeek: t.firstDayOfWeek ?? n.firstDayOfWeek,
27
+ fixedWeeks: t.fixedWeeks ?? n.fixedWeeks,
28
+ months: t.months ?? n.months,
29
+ outsideDays: t.outsideDays ?? n.outsideDays,
30
+ timeZone: t.timeZone ?? n.timeZone,
31
+ weekNumbers: t.weekNumbers ?? n.weekNumbers
32
+ },
33
+ children: e
34
+ });
35
+ }
36
+ //#endregion
37
+ //#region src/calendar/calendar-selection.ts
38
+ function O(e) {
39
+ return e !== null && !Array.isArray(e) && "start" in e;
40
+ }
41
+ function k(e) {
42
+ return e === null ? [] : Array.isArray(e) ? e : O(e) ? [e.start, e.end].filter((e) => e !== null) : [e];
43
+ }
44
+ function A(e, t) {
45
+ if (!O(t)) return null;
46
+ let { start: n, end: r } = t;
47
+ return n !== null && b(e, n) ? "start" : r !== null && b(e, r) ? "end" : n === null || r === null ? null : y(e, n) > 0 && y(e, r) < 0 ? "inside" : null;
48
+ }
49
+ function j(e, t) {
50
+ if (O(t)) {
51
+ let n = A(e, t);
52
+ return n === "start" || n === "end";
53
+ }
54
+ return k(t).some((t) => b(t, e));
55
+ }
56
+ function ce(e, t, n) {
57
+ if (n === "single") return j(e, t) ? null : e;
58
+ if (n === "multiple") {
59
+ let n = k(t), r = n.filter((t) => !b(t, e));
60
+ return r.length === n.length ? [...n, e].sort(y) : r;
61
+ }
62
+ let r = O(t) ? t : {
63
+ start: null,
64
+ end: null
65
+ };
66
+ return r.start === null || r.end !== null ? {
67
+ start: e,
68
+ end: null
69
+ } : y(e, r.start) < 0 ? {
70
+ start: e,
71
+ end: r.start
72
+ } : {
73
+ start: r.start,
74
+ end: e
75
+ };
76
+ }
77
+ function le(e, t) {
78
+ return t === null || !O(e) || e.start === null || e.end !== null ? null : y(t, e.start) < 0 ? {
79
+ start: t,
80
+ end: e.start
81
+ } : {
82
+ start: e.start,
83
+ end: t
84
+ };
85
+ }
86
+ function ue(e, t) {
87
+ if (O(e) || O(t)) return !O(e) || !O(t) ? !1 : b(e.start, t.start) && b(e.end, t.end);
88
+ let n = k(e), r = k(t);
89
+ return n.length === r.length && n.every((e, t) => b(e, r[t] ?? null));
90
+ }
91
+ //#endregion
92
+ //#region src/calendar/calendar.tsx
93
+ var de = {
94
+ day: 7,
95
+ month: 4,
96
+ year: 4
97
+ }, M = 12;
98
+ function fe({ calendar: a, className: s, defaultFocusedDate: y, defaultValue: ie, defaultView: T, disabled: D, firstDayOfWeek: k, fixedWeeks: A, focusedDate: j, granularity: fe, invalid: me, isDateUnavailable: he, locale: ge, max: N, min: P, messages: _e, months: ve, onFocusedDateChange: ye, onKeyDown: be, onPreviewChange: xe, onValueChange: Se, onViewChange: Ce, outsideDays: we, readOnly: Te, ref: Ee, render: De, selectionMode: Oe = "single", style: ke, timeZone: Ae, value: F, view: I, weekNumbers: je, ...Me }) {
99
+ let L = E(), Ne = n(), Pe = r(g, _e), R = d(null), Fe = ee(), Ie = ge ?? Ne, Le = k ?? L.firstDayOfWeek, Re = Ae ?? L.timeZone, z = Math.max(1, ve ?? L.months), ze = je ?? L.weekNumbers, Be = A ?? L.fixedWeeks, Ve = we ?? L.outsideDays ?? (z > 1 ? "hidden" : "shown"), He = a ?? L.calendar, B = D !== !0 && Te !== !0, V = u(() => te({
100
+ locale: Ie,
101
+ firstDayOfWeek: Le
102
+ }), [Le, Ie]), [H, Ue] = f(null);
103
+ c(() => Ue(oe(Re)), [Re]);
104
+ let [We, Ge] = f(ie ?? null), U = F ?? We, W = ie ?? F ?? null, Ke = W === null ? null : Array.isArray(W) ? W[0] ?? null : "start" in W ? W.start : W, qe = y !== void 0 || j !== void 0 || Ke !== null, G = y ?? j ?? Ke ?? x(2026, 1, 1), [Je, Ye] = f(G), K = j ?? Je, q = d(!1), J = fe === "month", [Xe, Ze] = f(T ?? (J ? "month" : "day")), Qe = I ?? Xe, Y = J && Qe === "day" ? "month" : Qe, [$e, et] = f(null), X = Oe === "range" && B ? le(U, $e ?? K) : null, Z = X === null ? null : O(U) && U.start !== null && b(X.start, U.start) ? X.end : X.start, tt = d(null);
105
+ c(() => {
106
+ b(tt.current, Z) || (tt.current = Z, xe?.(Z));
107
+ }, [xe, Z]);
108
+ let [nt, rt] = f(() => ({
109
+ year: G.year,
110
+ month: G.month
111
+ })), it = o((e, t) => {
112
+ let n = t.year * 12 + (t.month - 1), r = e.year * 12 + (e.month - 1);
113
+ if (r >= n && r < n + z) return t;
114
+ let i = n + Math.floor((r - n) / z) * z;
115
+ return {
116
+ year: Math.floor(i / 12),
117
+ month: i % 12 + 1
118
+ };
119
+ }, [z]);
120
+ c(() => {
121
+ if (H === null || qe) return;
122
+ let e = v(H, P, N);
123
+ Ye((t) => b(t, G) ? e : t), rt((t) => t.year === G.year && t.month === G.month ? {
124
+ year: e.year,
125
+ month: e.month
126
+ } : t);
127
+ }, [H]);
128
+ let at = o((e, t, n) => {
129
+ i({
130
+ controlled: F,
131
+ initial: U,
132
+ equals: ue,
133
+ onRequest: (e) => Se?.(e.value, e)
134
+ }).request(e, t, n) && Ge(e);
135
+ }, [
136
+ U,
137
+ Se,
138
+ F
139
+ ]), Q = o((e, t, n) => {
140
+ let r = v(e, P, N), a = i({
141
+ controlled: j,
142
+ initial: K,
143
+ equals: (e, t) => b(e, t),
144
+ onRequest: (e) => ye?.(e.value, e)
145
+ });
146
+ q.current = t === "keyboard", a.request(r, t, n) && Ye(r);
147
+ }, [
148
+ K,
149
+ j,
150
+ N,
151
+ P,
152
+ ye
153
+ ]);
154
+ c(() => {
155
+ rt((e) => it(K, e));
156
+ }, [K, it]);
157
+ let $ = o((e) => {
158
+ I === void 0 && Ze(e), Ce?.(e);
159
+ }, [Ce, I]);
160
+ c(() => {
161
+ if (!q.current) return;
162
+ let e = R.current, t = e?.querySelector("[data-part=\"cell\"]:not([data-outside-month]) [data-part=\"day\"][tabindex=\"0\"], [data-part=\"period\"][tabindex=\"0\"]");
163
+ if (t == null) {
164
+ e?.querySelector("[data-part=\"day\"][tabindex=\"0\"]") ?? (q.current = !1);
165
+ return;
166
+ }
167
+ q.current = !1, t.focus();
168
+ }), l(Ee, () => ({
169
+ focus: () => {
170
+ R.current?.querySelector("[data-part=\"day\"][tabindex=\"0\"], [data-part=\"period\"][tabindex=\"0\"]")?.focus();
171
+ },
172
+ focusDate: (e) => Q(e, "keyboard", void 0)
173
+ }), [Q]);
174
+ let ot = o((e) => !re(e, P, N) || he?.(e) === !0, [
175
+ he,
176
+ N,
177
+ P
178
+ ]), st = (e, t, n) => {
179
+ B && !ot(e) && (at(ce(e, U, Oe), t, n), Q(e, t, n));
180
+ }, ct = (e, t) => P !== void 0 && e * 12 + t < P.year * 12 + P.month || N !== void 0 && e * 12 + t > N.year * 12 + N.month, lt = (e, t, n, r) => {
181
+ if (!B || ct(e, t)) return;
182
+ let i = x(e, t, 1);
183
+ at(i, n, r), Q(i, n, r);
184
+ }, ut = U === null || Array.isArray(U) || O(U) ? null : {
185
+ year: U.year,
186
+ month: U.month
187
+ }, dt = (e) => {
188
+ if (be?.(e), e.defaultPrevented) return;
189
+ let t = R.current !== null && getComputedStyle(R.current).direction === "rtl", n = t ? "ArrowLeft" : "ArrowRight", r = t ? "ArrowRight" : "ArrowLeft", i = () => {
190
+ e.preventDefault(), e.stopPropagation();
191
+ }, a = (t) => {
192
+ i(), Q(t, "keyboard", e);
193
+ };
194
+ if (J && Y === "month") {
195
+ let t = (e) => {
196
+ let t = K.year * 12 + (K.month - 1) + e;
197
+ return x(Math.floor(t / 12), t % 12 + 1, 1);
198
+ }, o = de.month;
199
+ switch (e.key) {
200
+ case n: return a(t(1));
201
+ case r: return a(t(-1));
202
+ case "ArrowUp": return a(t(-o));
203
+ case "ArrowDown": return a(t(o));
204
+ case "Home": return a(x(K.year, 1, 1));
205
+ case "End": return a(x(K.year, 12, 1));
206
+ case "PageUp": return a(t(-12));
207
+ case "PageDown": return a(t(12));
208
+ case "Enter":
209
+ case " ":
210
+ i(), lt(K.year, K.month, "keyboard", e);
211
+ return;
212
+ }
213
+ }
214
+ switch (e.key) {
215
+ case n: return a(_(K, 1));
216
+ case r: return a(_(K, -1));
217
+ case "ArrowUp": return a(_(K, -7));
218
+ case "ArrowDown": return a(_(K, 7));
219
+ case "Home": return a(ae(K, V.firstDayOfWeek));
220
+ case "End": return a(ne(K, V.firstDayOfWeek));
221
+ case "PageUp": return a(e.shiftKey ? C(K, -1).date : S(K, -1).date);
222
+ case "PageDown": return a(e.shiftKey ? C(K, 1).date : S(K, 1).date);
223
+ case "Enter":
224
+ case " ":
225
+ i(), st(K, "keyboard", e);
226
+ return;
227
+ case "Escape":
228
+ if (Y === "day" || J && Y === "month") return;
229
+ i(), $(Y === "year" ? "month" : "day");
230
+ return;
231
+ default: return;
232
+ }
233
+ }, ft = (e) => (t) => {
234
+ if (Y === "day") {
235
+ Q(S(K, e * z).date, "pointer", t);
236
+ return;
237
+ }
238
+ Q(Y === "month" ? C(K, e).date : C(K, e * M).date, "pointer", t);
239
+ }, pt = x(nt.year, nt.month, 1), mt = Y === "day" ? z === 1 ? V.monthYear(pt) : `${V.monthYear(pt, "short")} – ${V.monthYear(S(pt, z - 1).date, "short")}` : Y === "month" ? String(K.year) : `${String(w(K.year, M)[0] ?? K.year)} – ${String(w(K.year, M).at(-1) ?? K.year)}`, ht = Y === "day" ? /* @__PURE__ */ m("div", {
240
+ "data-part": "grids",
241
+ children: se(nt, z).map((e) => /* @__PURE__ */ m(pe, {
242
+ editable: B,
243
+ firstDayOfWeek: V.firstDayOfWeek,
244
+ fixedWeeks: Be,
245
+ focused: K,
246
+ format: V,
247
+ headingId: Fe,
248
+ month: e,
249
+ onHover: et,
250
+ onSelect: st,
251
+ outsideDays: Ve,
252
+ pending: X,
253
+ today: H,
254
+ unavailable: ot,
255
+ value: U,
256
+ weekNumbers: ze
257
+ }, `${String(e.year)}-${String(e.month)}`))
258
+ }) : Y === "month" && J ? /* @__PURE__ */ m("div", {
259
+ "data-part": "months",
260
+ children: V.monthNames("short").map((e, t) => {
261
+ let n = t + 1, r = ct(K.year, n), i = ut?.year === K.year && ut.month === n;
262
+ return /* @__PURE__ */ m("button", {
263
+ "aria-label": V.monthYear(x(K.year, n, 1)),
264
+ "data-part": "period",
265
+ onClick: (e) => lt(K.year, n, "pointer", e),
266
+ tabIndex: K.month === n ? 0 : -1,
267
+ type: "button",
268
+ ...i ? {
269
+ "aria-selected": !0,
270
+ "data-selected": ""
271
+ } : {},
272
+ ...r ? {
273
+ "aria-disabled": !0,
274
+ "data-unavailable": ""
275
+ } : {},
276
+ ...K.month === n ? { "data-focused": "" } : {},
277
+ children: e
278
+ }, e);
279
+ })
280
+ }) : Y === "month" ? /* @__PURE__ */ m("div", {
281
+ "data-part": "months",
282
+ children: V.monthNames("short").map((e, t) => /* @__PURE__ */ m("button", {
283
+ "data-part": "period",
284
+ onClick: (e) => {
285
+ Q({
286
+ ...K,
287
+ month: t + 1,
288
+ day: 1
289
+ }, "pointer", e), $("day");
290
+ },
291
+ type: "button",
292
+ ...K.month === t + 1 ? {
293
+ "aria-selected": !0,
294
+ "data-selected": ""
295
+ } : {},
296
+ children: e
297
+ }, e))
298
+ }) : /* @__PURE__ */ m("div", {
299
+ "data-part": "years",
300
+ children: w(K.year, M).map((e) => /* @__PURE__ */ m("button", {
301
+ "data-part": "period",
302
+ onClick: (t) => {
303
+ Q({
304
+ ...K,
305
+ year: e,
306
+ day: 1
307
+ }, "pointer", t), $("month");
308
+ },
309
+ type: "button",
310
+ ...K.year === e ? {
311
+ "aria-selected": !0,
312
+ "data-selected": ""
313
+ } : {},
314
+ children: e
315
+ }, e))
316
+ }), gt = /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("div", {
317
+ "data-part": "header",
318
+ children: [
319
+ /* @__PURE__ */ m("button", {
320
+ "aria-label": Pe("previous"),
321
+ "data-part": "previous",
322
+ disabled: !B,
323
+ onClick: ft(-1),
324
+ type: "button",
325
+ children: /* @__PURE__ */ m(t, {
326
+ directional: !0,
327
+ children: /* @__PURE__ */ m(e, { name: "chevron-right" })
328
+ })
329
+ }),
330
+ /* @__PURE__ */ h("button", {
331
+ "aria-live": "polite",
332
+ "data-part": "heading",
333
+ disabled: !B || Y === "year",
334
+ id: Fe,
335
+ onClick: () => $(Y === "day" ? "month" : "year"),
336
+ type: "button",
337
+ children: [mt, Y === "year" ? null : /* @__PURE__ */ m(t, { children: /* @__PURE__ */ m(e, { name: "chevron-down" }) })]
338
+ }),
339
+ /* @__PURE__ */ m("button", {
340
+ "aria-label": Pe("next"),
341
+ "data-part": "next",
342
+ disabled: !B,
343
+ onClick: ft(1),
344
+ type: "button",
345
+ children: /* @__PURE__ */ m(t, {
346
+ directional: !0,
347
+ children: /* @__PURE__ */ m(e, { name: "chevron-right" })
348
+ })
349
+ })
350
+ ]
351
+ }), ht] }), _t = {
352
+ ...Me,
353
+ children: gt,
354
+ className: s,
355
+ onKeyDown: dt,
356
+ style: ke,
357
+ ...D === !0 ? { "data-disabled": "" } : {},
358
+ ...me === !0 ? { "data-invalid": "" } : {},
359
+ ...Te === !0 ? { "data-readonly": "" } : {},
360
+ ...ze ? { "data-week-numbers": "" } : {},
361
+ ...z > 1 ? { "data-months": String(z) } : {},
362
+ "data-calendar": He,
363
+ "data-columns": String(de[Y]),
364
+ "data-part": "root",
365
+ "data-ui": "calendar",
366
+ "data-view": Y,
367
+ ref: R
368
+ };
369
+ return De === void 0 ? /* @__PURE__ */ m("div", { ..._t }) : De(_t);
370
+ }
371
+ function pe({ editable: e, firstDayOfWeek: t, fixedWeeks: n, focused: r, format: i, headingId: a, month: o, onHover: s, onSelect: c, outsideDays: ee, pending: l, today: u, unavailable: d, value: f, weekNumbers: p }) {
372
+ let g = ie({
373
+ ...o,
374
+ firstDayOfWeek: t,
375
+ fixedWeeks: n
376
+ }), _ = i.monthYear(x(o.year, o.month, 1)), v = i.weekdayNames("long"), y = i.weekdayNames("narrow");
377
+ return /* @__PURE__ */ h("table", {
378
+ "aria-labelledby": a,
379
+ "data-part": "grid",
380
+ role: "grid",
381
+ children: [
382
+ /* @__PURE__ */ m("caption", {
383
+ "data-part": "grid-caption",
384
+ children: _
385
+ }),
386
+ /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", {
387
+ "data-part": "week-headers",
388
+ children: [p ? /* @__PURE__ */ m("th", {
389
+ "aria-hidden": "true",
390
+ "data-part": "week-number"
391
+ }) : null, y.map((e, t) => /* @__PURE__ */ m("th", {
392
+ abbr: v[t],
393
+ "data-part": "week-header",
394
+ scope: "col",
395
+ children: e
396
+ }, v[t]))]
397
+ }) }),
398
+ /* @__PURE__ */ m("tbody", { children: g.map((t) => /* @__PURE__ */ h("tr", {
399
+ "data-part": "week",
400
+ children: [p ? /* @__PURE__ */ m("th", {
401
+ "data-part": "week-number",
402
+ scope: "row",
403
+ children: t.weekNumber
404
+ }) : null, t.days.map((t) => {
405
+ let n = t.outsideMonth, i = n && ee === "hidden", a = d(t.date) || n && ee === "shown", o = j(t.date, f), p = A(t.date, l ?? f), h = l !== null && p !== null && !o, g = b(t.date, r);
406
+ return /* @__PURE__ */ m("td", {
407
+ "data-part": "cell",
408
+ ...n ? { "data-outside-month": "" } : {},
409
+ ...!i && d(t.date) ? { "data-unavailable": "" } : {},
410
+ ...!i && o ? { "data-selected": "" } : {},
411
+ ...!i && p === "start" ? { "data-range-start": "" } : {},
412
+ ...!i && p === "end" ? { "data-range-end": "" } : {},
413
+ ...!i && p === "inside" ? { "data-in-range": "" } : {},
414
+ ...!i && h ? { "data-preview": "" } : {},
415
+ children: i ? null : /* @__PURE__ */ m("span", {
416
+ "aria-disabled": a ? !0 : void 0,
417
+ "aria-selected": o ? !0 : void 0,
418
+ "data-part": "day",
419
+ ...u !== null && b(t.date, u) ? { "data-today": "" } : {},
420
+ onClick: (e) => {
421
+ a || c(t.date, "pointer", e);
422
+ },
423
+ onPointerEnter: () => s(t.date),
424
+ onPointerLeave: () => s(null),
425
+ role: "button",
426
+ tabIndex: g && e ? 0 : -1,
427
+ children: t.date.day
428
+ })
429
+ }, `${String(t.date.month)}-${String(t.date.day)}`);
430
+ })]
431
+ }, t.weekNumber)) })
432
+ ]
433
+ });
434
+ }
435
+ //#endregion
436
+ export { j as a, D as c, ue as i, E as l, k as n, ce as o, O as r, A as s, fe as t };
package/dist/calendar.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./calendar-B3mio8iQ.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./calendar-BZ6PP7Ke.js";
2
2
  export { c as Calendar, t as CalendarDefaultsProvider, i as asDates, o as isRange, n as isSameValue, e as isSelected, a as nextValue, s as rangeStateOf, r as useCalendarDefaults };
@@ -1,4 +1,4 @@
1
- import { r as e } from "./accordion-D-YuMJzk.js";
1
+ import { r as e } from "./accordion-lCqrmQ3w.js";
2
2
  import { n as t, t as n } from "./icon-T9Yt4tnm.js";
3
3
  import { createControllable as r } from "@slotted/core/state";
4
4
  import { createContext as i, useContext as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
@@ -172,31 +172,31 @@ function C({ children: e, className: t, ref: n, render: r, style: i, ...a }) {
172
172
  }) : r(o);
173
173
  }
174
174
  function w({ children: e, className: t, ref: n, render: r, style: i, ...a }) {
175
- let { ids: s, loading: c, mount: u, open: f, region: p, seen: m, toggle: h } = v(), [g, _] = l(null), y = u === "until-found";
175
+ let { ids: s, loading: l, mount: u, open: f, region: p, seen: m, toggle: h } = v(), g = c(null), _ = u === "until-found";
176
176
  o(() => {
177
- if (g !== null) {
177
+ let e = g.current;
178
+ if (e !== null) {
178
179
  if (f) {
179
- g.removeAttribute("hidden"), g.removeAttribute("inert");
180
+ e.removeAttribute("hidden"), e.removeAttribute("inert");
180
181
  return;
181
182
  }
182
- if (y) {
183
- g.removeAttribute("inert"), g.setAttribute("hidden", "until-found");
184
- let e = () => h(!0, "programmatic", void 0);
185
- return g.addEventListener("beforematch", e), () => g.removeEventListener("beforematch", e);
183
+ if (_) {
184
+ e.removeAttribute("inert"), e.setAttribute("hidden", "until-found");
185
+ let t = () => h(!0, "programmatic", void 0);
186
+ return e.addEventListener("beforematch", t), () => e.removeEventListener("beforematch", t);
186
187
  }
187
- g.removeAttribute("hidden"), g.setAttribute("inert", "");
188
+ e.removeAttribute("hidden"), e.setAttribute("inert", "");
188
189
  }
189
190
  }, [
190
- g,
191
191
  f,
192
192
  h,
193
- y
193
+ _
194
194
  ]);
195
- let b = u !== "active" && u !== "lazy" || f || u === "lazy" && m, x = {
195
+ let y = u !== "active" && u !== "lazy" || f || u === "lazy" && m, b = {
196
196
  ...a,
197
197
  "aria-labelledby": s.triggerId,
198
- ...c ? { "aria-busy": !0 } : {},
199
- children: b ? /* @__PURE__ */ d("div", {
198
+ ...l ? { "aria-busy": !0 } : {},
199
+ children: y ? /* @__PURE__ */ d("div", {
200
200
  "data-part": "content",
201
201
  children: e
202
202
  }) : null,
@@ -207,11 +207,11 @@ function w({ children: e, className: t, ref: n, render: r, style: i, ...a }) {
207
207
  style: i
208
208
  };
209
209
  return r === void 0 ? /* @__PURE__ */ d("div", {
210
- ...x,
210
+ ...b,
211
211
  ref: (e) => {
212
- _(e), typeof n == "function" ? n(e) : n != null && (n.current = e);
212
+ g.current = e, typeof n == "function" ? n(e) : n != null && (n.current = e);
213
213
  }
214
- }) : r(x);
214
+ }) : r(b);
215
215
  }
216
216
  //#endregion
217
217
  export { g as a, h as c, S as i, m as l, x as n, y as o, w as r, v as s, C as t };