@jfrader/ui 0.1.2 → 0.3.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 (156) hide show
  1. package/README.md +1 -1
  2. package/dist/accordion-Bd-j04hW.js +198 -0
  3. package/dist/accordion.js +1 -1
  4. package/dist/{alert-CA9ZlIZp.js → alert-BBqaKI4k.js} +57 -52
  5. package/dist/alert.js +1 -1
  6. package/dist/{avatar-IUW4yJl0.js → avatar-BahDVO9t.js} +40 -33
  7. package/dist/avatar.js +1 -1
  8. package/dist/{badge-Bru30HEn.js → badge-B_sLygxU.js} +32 -27
  9. package/dist/badge.js +1 -1
  10. package/dist/breadcrumbs-DVAOxfvL.js +141 -0
  11. package/dist/breadcrumbs.js +1 -1
  12. package/dist/{button-Cmixur4Q.js → button-P2e7_44z.js} +65 -53
  13. package/dist/button.js +1 -1
  14. package/dist/calendar-C9Yad_-w.js +394 -0
  15. package/dist/calendar.js +1 -1
  16. package/dist/card-D-aI2QHx.js +158 -0
  17. package/dist/card.js +1 -1
  18. package/dist/checkbox-COYG6L7d.js +140 -0
  19. package/dist/checkbox.js +1 -1
  20. package/dist/{choice-control-ByFogYcT.js → choice-control-5kJkLXgv.js} +1 -1
  21. package/dist/{collection-registry-1l9f3XJZ.js → collection-registry-BTYi6zGh.js} +1 -1
  22. package/dist/combobox-DrmjBbo7.js +327 -0
  23. package/dist/combobox.js +1 -1
  24. package/dist/command-palette-V_2pEay7.js +379 -0
  25. package/dist/command-palette.js +1 -1
  26. package/dist/container-BOaSptJa.js +41 -0
  27. package/dist/container.js +1 -1
  28. package/dist/{date-picker-DrHJMt2p.js → date-picker-ClUYBIBh.js} +69 -59
  29. package/dist/date-picker.js +1 -1
  30. package/dist/dialog-xaydbXl2.js +218 -0
  31. package/dist/dialog.js +1 -1
  32. package/dist/divider-DYoJf0I_.js +84 -0
  33. package/dist/divider.js +1 -1
  34. package/dist/field-anatomy-D2ToMeRa.js +109 -0
  35. package/dist/flex-Dh-_J5-U.js +28 -0
  36. package/dist/flex.js +1 -1
  37. package/dist/{icon-wrapper-CFWzew5m.js → icon-wrapper-stN8sD7R.js} +1 -1
  38. package/dist/index.js +38 -37
  39. package/dist/{kbd-B03_qIwQ.js → kbd-C3ACoMoE.js} +36 -21
  40. package/dist/kbd.js +1 -1
  41. package/dist/{layout-style-7ZTOiWGR.js → layout-style-Cbd1Vilw.js} +1 -1
  42. package/dist/{loading-ring-BpdB0aFi.js → loading-ring-B8-30Dl1.js} +1 -1
  43. package/dist/menu-DU60SMdt.js +216 -0
  44. package/dist/menu.js +1 -1
  45. package/dist/navigation-DhnKriOp.js +197 -0
  46. package/dist/navigation.js +1 -1
  47. package/dist/pagination-DYdwsxwe.js +156 -0
  48. package/dist/pagination.js +1 -1
  49. package/dist/{pill-CrVqffKM.js → pill-DO2gHzMb.js} +16 -10
  50. package/dist/pill.js +1 -1
  51. package/dist/popover-BtN_0ejj.js +113 -0
  52. package/dist/popover.js +1 -1
  53. package/dist/progress-BpJswTG4.js +90 -0
  54. package/dist/progress.js +1 -1
  55. package/dist/radio-group-Ce0_IWQr.js +145 -0
  56. package/dist/radio-group.js +1 -1
  57. package/dist/select-BCS0-LVW.js +286 -0
  58. package/dist/select.js +1 -1
  59. package/dist/{skeleton-gJ4ImO5u.js → skeleton-OoFlOEXO.js} +24 -18
  60. package/dist/skeleton.js +1 -1
  61. package/dist/spinner-C2YDoiMn.js +56 -0
  62. package/dist/spinner.js +1 -1
  63. package/dist/stack-DC3IbtWk.js +27 -0
  64. package/dist/stack.js +1 -1
  65. package/dist/{switch-2hm2WnWt.js → switch-Dr-qjmT4.js} +63 -57
  66. package/dist/switch.js +1 -1
  67. package/dist/sx-Dx9JUKp5.js +23 -0
  68. package/dist/tabs-CK_g1RKa.js +203 -0
  69. package/dist/tabs.js +1 -1
  70. package/dist/text-field-D60ok14S.js +76 -0
  71. package/dist/text-field.js +1 -1
  72. package/dist/textarea-DyfjtP0A.js +86 -0
  73. package/dist/textarea.js +1 -1
  74. package/dist/theme-root-BiXXvQvr.js +42 -0
  75. package/dist/theme-root.js +1 -1
  76. package/dist/{toast-D3Y6OAsg.js → toast-iqelR-r0.js} +41 -30
  77. package/dist/toast.js +1 -1
  78. package/dist/toggle-group-CI0e7hFm.js +166 -0
  79. package/dist/toggle-group.js +1 -1
  80. package/dist/tooltip-CB-HC1js.js +108 -0
  81. package/dist/tooltip.js +1 -1
  82. package/dist/{trigger-style-B1GFmH7M.js → trigger-style-B1KVC8O1.js} +1 -1
  83. package/dist/types/components/accordion/accordion.d.ts +14 -9
  84. package/dist/types/components/alert/alert.d.ts +7 -3
  85. package/dist/types/components/avatar/avatar.d.ts +7 -3
  86. package/dist/types/components/badge/badge.d.ts +7 -3
  87. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +9 -5
  88. package/dist/types/components/button/button.d.ts +7 -3
  89. package/dist/types/components/calendar/calendar.d.ts +12 -7
  90. package/dist/types/components/card/card.d.ts +21 -13
  91. package/dist/types/components/checkbox/checkbox.d.ts +7 -3
  92. package/dist/types/components/combobox/combobox.d.ts +13 -8
  93. package/dist/types/components/command-palette/command-palette.d.ts +23 -15
  94. package/dist/types/components/container/container.d.ts +7 -3
  95. package/dist/types/components/date-picker/date-picker.d.ts +7 -4
  96. package/dist/types/components/dialog/dialog.d.ts +17 -11
  97. package/dist/types/components/divider/divider.d.ts +7 -3
  98. package/dist/types/components/field/field-anatomy.d.ts +3 -2
  99. package/dist/types/components/flex/flex.d.ts +7 -3
  100. package/dist/types/components/kbd/kbd.d.ts +9 -5
  101. package/dist/types/components/menu/menu.d.ts +14 -9
  102. package/dist/types/components/navigation/navigation.d.ts +12 -7
  103. package/dist/types/components/pagination/pagination.d.ts +7 -3
  104. package/dist/types/components/pill/pill.d.ts +7 -3
  105. package/dist/types/components/popover/popover.d.ts +8 -5
  106. package/dist/types/components/progress/progress.d.ts +7 -3
  107. package/dist/types/components/radio-group/radio-group.d.ts +9 -5
  108. package/dist/types/components/select/select.d.ts +14 -9
  109. package/dist/types/components/skeleton/skeleton.d.ts +7 -3
  110. package/dist/types/components/spinner/spinner.d.ts +7 -3
  111. package/dist/types/components/stack/stack.d.ts +4 -1
  112. package/dist/types/components/switch/switch.d.ts +7 -3
  113. package/dist/types/components/tabs/tabs.d.ts +15 -9
  114. package/dist/types/components/text-field/text-field.d.ts +7 -3
  115. package/dist/types/components/textarea/textarea.d.ts +7 -3
  116. package/dist/types/components/theme-provider/theme-provider.d.ts +11 -0
  117. package/dist/types/components/theme-root/theme-root.d.ts +7 -3
  118. package/dist/types/components/toast/toast.d.ts +7 -4
  119. package/dist/types/components/toggle-group/toggle-group.d.ts +8 -5
  120. package/dist/types/components/tooltip/tooltip.d.ts +8 -5
  121. package/dist/types/index.d.ts +4 -0
  122. package/dist/types/overlay/use-native-dialog.d.ts +2 -2
  123. package/dist/types/styling/css.d.ts +3 -2
  124. package/dist/types/styling/styled.d.ts +1 -0
  125. package/dist/types/styling/sx.d.ts +16 -0
  126. package/dist/types/styling/theme.d.ts +98 -0
  127. package/dist/{visually-hidden-DCWhf0Cb.js → visually-hidden-BJdvqqvn.js} +1 -1
  128. package/package.json +5 -4
  129. package/dist/accordion-C3YbYFBi.js +0 -169
  130. package/dist/breadcrumbs-CQaviWRc.js +0 -126
  131. package/dist/calendar-DUgS0xmp.js +0 -373
  132. package/dist/card-D9CHtouU.js +0 -121
  133. package/dist/checkbox-DKa5BCdy.js +0 -135
  134. package/dist/combobox-Dq3V88Zt.js +0 -302
  135. package/dist/command-palette-6c158eH1.js +0 -329
  136. package/dist/container-xUEIoZzj.js +0 -35
  137. package/dist/css-Cgj6sCHn.js +0 -2
  138. package/dist/dialog-C2NSOOP-.js +0 -176
  139. package/dist/divider-yF5EmhhT.js +0 -77
  140. package/dist/field-anatomy-BzGw1Ch9.js +0 -105
  141. package/dist/flex-5-NI5SSy.js +0 -22
  142. package/dist/menu-bvKRJOhJ.js +0 -187
  143. package/dist/navigation-xPoqh_Iz.js +0 -175
  144. package/dist/pagination-BIKYsxK1.js +0 -149
  145. package/dist/popover-CVAZ_C1a.js +0 -98
  146. package/dist/progress-C8bgujFI.js +0 -84
  147. package/dist/radio-group-CvQ4x8ii.js +0 -131
  148. package/dist/select-CNNiUhKB.js +0 -257
  149. package/dist/spinner-CSFiP0Oi.js +0 -50
  150. package/dist/stack-mEAryjKz.js +0 -21
  151. package/dist/tabs-GBppQabg.js +0 -174
  152. package/dist/text-field-DDPqQu29.js +0 -74
  153. package/dist/textarea-OP8_3IUR.js +0 -84
  154. package/dist/theme-root-eLka0ZP1.js +0 -21
  155. package/dist/toggle-group-BxzJ-6Cp.js +0 -151
  156. package/dist/tooltip-CVl8HS4S.js +0 -93
@@ -1,10 +1,10 @@
1
1
  'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { n as t } from "./focus-ring-BK5W5_NY.js";
4
- import { n } from "./media-D_eA_I-e.js";
5
- import { t as r } from "./icon-wrapper-CFWzew5m.js";
6
- import { n as i, t as a } from "./loading-ring-BpdB0aFi.js";
7
- import { forwardRef as o } from "react";
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { n } from "./focus-ring-BK5W5_NY.js";
4
+ import { n as r } from "./media-D_eA_I-e.js";
5
+ import { t as i } from "./icon-wrapper-stN8sD7R.js";
6
+ import { n as a, t as o } from "./loading-ring-B8-30Dl1.js";
7
+ import "react";
8
8
  import { vars as s } from "@jfrader/tokens/vars";
9
9
  import { Fragment as c, jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
10
10
  import { useMergeRefs as d } from "@floating-ui/react";
@@ -25,12 +25,12 @@ var f = "&:hover:not(:disabled):not([aria-disabled=\"true\"])", p = e({
25
25
  transitionProperty: "background-color, border-color, color",
26
26
  transitionDuration: s.motion.duration.fast,
27
27
  transitionTimingFunction: s.motion.easeStandard,
28
- "&:focus-visible": { ...t },
28
+ "&:focus-visible": { ...n },
29
29
  "&:disabled, &[aria-disabled=\"true\"]": {
30
30
  cursor: "not-allowed",
31
31
  opacity: .55
32
32
  },
33
- [n]: { transitionDuration: "0s" }
33
+ [r]: { transitionDuration: "0s" }
34
34
  }), m = {
35
35
  sm: e({
36
36
  blockSize: "32px",
@@ -127,62 +127,74 @@ var f = "&:hover:not(:disabled):not([aria-disabled=\"true\"])", p = e({
127
127
  boxSizing: "border-box",
128
128
  textDecoration: "none"
129
129
  }), _ = e({
130
- ...a,
130
+ ...o,
131
131
  inlineSize: "1em",
132
132
  blockSize: "1em",
133
- [n]: { animation: `${i} 1.2s ease-in-out infinite alternate` }
134
- }), v = o(function({ variant: e = "solid", tone: t = "neutral", size: n = "md", loading: i = !1, startIcon: a, endIcon: o, type: s, children: f, onClick: v, css: y, render: b, ...x }, S) {
135
- let { "data-ui": C, ...w } = x, T = b && C !== void 0 ? `${C} button` : "button", E = d([S]), D = w["aria-disabled"], O = i || D === !0 || D === "true" || b !== void 0 && w.disabled === !0, k = v, A = (e) => {
136
- O ? e.preventDefault() : k?.(e);
137
- }, j = i ? /* @__PURE__ */ l("span", { css: _ }) : a, M = /* @__PURE__ */ u(c, { children: [
138
- j != null && /* @__PURE__ */ l("span", {
139
- css: r,
133
+ [r]: { animation: `${a} 1.2s ease-in-out infinite alternate` }
134
+ });
135
+ function v({ ref: e, variant: n = "solid", tone: r = "neutral", size: a = "md", loading: o = !1, startIcon: s, endIcon: f, type: v, children: y, onClick: b, className: x, css: S, sx: C, render: w, ...T }) {
136
+ let { "data-ui": E, ...D } = T, O = w && E !== void 0 ? `${E} button` : "button", k = d([e]), A = D["aria-disabled"], j = o || A === !0 || A === "true" || w !== void 0 && D.disabled === !0, M = b, N = (e) => {
137
+ j ? e.preventDefault() : M?.(e);
138
+ }, P = o ? /* @__PURE__ */ l("span", { css: _ }) : s, F = /* @__PURE__ */ u(c, { children: [
139
+ P != null && /* @__PURE__ */ l("span", {
140
+ css: i,
140
141
  "aria-hidden": !0,
141
- children: j
142
+ children: P
142
143
  }),
143
- f,
144
- o != null && /* @__PURE__ */ l("span", {
145
- css: r,
144
+ y,
145
+ f != null && /* @__PURE__ */ l("span", {
146
+ css: i,
146
147
  "aria-hidden": !0,
147
- children: o
148
+ children: f
148
149
  })
149
150
  ] });
150
- if (b) {
151
- let { disabled: r, ...a } = w;
152
- return b({
153
- ...a,
154
- ref: E,
155
- type: s,
156
- "data-ui": T,
157
- "aria-busy": i ? !0 : w["aria-busy"],
158
- "aria-disabled": O ? !0 : D,
159
- onClick: A,
160
- css: [
161
- p,
162
- g,
163
- m[n],
164
- h[e][t],
165
- y
166
- ],
167
- children: M
151
+ if (w) {
152
+ let { disabled: e, ...i } = D;
153
+ return /* @__PURE__ */ l(t, {
154
+ className: x,
155
+ sx: C,
156
+ children: (e) => w({
157
+ ...i,
158
+ className: e,
159
+ ref: k,
160
+ type: v,
161
+ "data-ui": O,
162
+ "aria-busy": o ? !0 : D["aria-busy"],
163
+ "aria-disabled": j ? !0 : A,
164
+ onClick: N,
165
+ css: [
166
+ p,
167
+ g,
168
+ m[a],
169
+ h[n][r],
170
+ S
171
+ ],
172
+ children: F
173
+ })
168
174
  });
169
175
  }
170
- return /* @__PURE__ */ l("button", {
171
- ...w,
172
- ref: S,
173
- type: s ?? "button",
174
- "data-ui": T,
175
- "aria-busy": i ? !0 : w["aria-busy"],
176
- "aria-disabled": O ? !0 : D,
177
- onClick: A,
178
- css: [
176
+ return /* @__PURE__ */ l(t, {
177
+ className: x,
178
+ styles: [
179
179
  p,
180
- m[n],
181
- h[e][t],
182
- y
180
+ m[a],
181
+ h[n][r],
182
+ S
183
183
  ],
184
- children: M
184
+ sx: C,
185
+ children: (t) => /* @__PURE__ */ l("button", {
186
+ ...D,
187
+ ref: e,
188
+ type: v ?? "button",
189
+ "data-ui": O,
190
+ "aria-busy": o ? !0 : D["aria-busy"],
191
+ "aria-disabled": j ? !0 : A,
192
+ onClick: N,
193
+ className: t,
194
+ children: F
195
+ })
185
196
  });
186
- });
197
+ }
198
+ v.displayName = "Button";
187
199
  //#endregion
188
200
  export { v as t };
package/dist/button.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Button } from "./button-Cmixur4Q.js";
2
+ export { t as Button } from "./button-P2e7_44z.js";
@@ -0,0 +1,394 @@
1
+ 'use client';
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { n } from "./focus-ring-BK5W5_NY.js";
4
+ import { n as r, t as i } from "./media-D_eA_I-e.js";
5
+ import { t as a } from "./use-controlled-state-CVXDa-qM.js";
6
+ import { createContext as o, useContext as s, useEffect as c, useId as l, useImperativeHandle as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m } from "react";
7
+ import { vars as h } from "@jfrader/tokens/vars";
8
+ import { jsx as g, jsxs as _ } from "@emotion/react/jsx-runtime";
9
+ //#region src/components/calendar/calendar.styles.ts
10
+ var v = e({
11
+ display: "inline-flex",
12
+ flexDirection: "column",
13
+ gap: h.space[2],
14
+ fontFamily: h.font.sans,
15
+ color: h.color.text
16
+ }), y = e({
17
+ display: "flex",
18
+ alignItems: "center",
19
+ gap: h.space[2]
20
+ }), b = e({
21
+ flex: 1,
22
+ textAlign: "center",
23
+ fontSize: h.textSize.sm,
24
+ fontWeight: h.fontWeight.semibold
25
+ }), x = {
26
+ transitionDuration: h.motion.duration.fast,
27
+ transitionTimingFunction: h.motion.easeStandard,
28
+ [r]: { transitionDuration: "0s" }
29
+ }, S = e({
30
+ appearance: "none",
31
+ display: "inline-flex",
32
+ alignItems: "center",
33
+ justifyContent: "center",
34
+ inlineSize: "32px",
35
+ blockSize: "32px",
36
+ padding: 0,
37
+ border: `1px solid ${h.color.borderControl}`,
38
+ borderRadius: h.radius.sm,
39
+ backgroundColor: "transparent",
40
+ font: "inherit",
41
+ fontSize: h.textSize.lg,
42
+ lineHeight: 1,
43
+ color: h.color.text,
44
+ cursor: "pointer",
45
+ transitionProperty: "background-color",
46
+ ...x,
47
+ "&:hover:not([aria-disabled=\"true\"])": { backgroundColor: h.color.surfaceHover },
48
+ "&[aria-disabled=\"true\"]": {
49
+ opacity: .55,
50
+ cursor: "not-allowed"
51
+ },
52
+ "&:focus-visible": { ...n }
53
+ }), C = e({
54
+ display: "inline-block",
55
+ "&:dir(rtl)": { transform: "scaleX(-1)" }
56
+ }), w = e({
57
+ borderCollapse: "separate",
58
+ borderSpacing: h.space[1],
59
+ marginInline: `calc(-1 * ${h.space[1]})`
60
+ }), T = e({
61
+ paddingBlock: h.space[1],
62
+ fontSize: h.textSize.xs,
63
+ fontWeight: h.fontWeight.medium,
64
+ color: h.color.textMuted,
65
+ textAlign: "center"
66
+ }), E = e({ padding: 0 }), D = e({
67
+ appearance: "none",
68
+ display: "inline-flex",
69
+ alignItems: "center",
70
+ justifyContent: "center",
71
+ inlineSize: "36px",
72
+ blockSize: "36px",
73
+ padding: 0,
74
+ border: "1px solid transparent",
75
+ borderRadius: h.radius.sm,
76
+ backgroundColor: "transparent",
77
+ font: "inherit",
78
+ fontSize: h.textSize.sm,
79
+ fontVariantNumeric: "tabular-nums",
80
+ color: h.color.text,
81
+ cursor: "pointer",
82
+ transitionProperty: "background-color, border-color, color",
83
+ ...x,
84
+ "&:hover:not(:disabled):not([data-selected])": { backgroundColor: h.color.surfaceHover },
85
+ "&[data-today]": {
86
+ borderColor: h.color.borderControl,
87
+ fontWeight: h.fontWeight.semibold
88
+ },
89
+ "&[data-selected]": {
90
+ backgroundColor: h.color.accent,
91
+ borderColor: h.color.accent,
92
+ color: h.color.accentContrast,
93
+ fontWeight: h.fontWeight.semibold
94
+ },
95
+ "&[data-selected]:hover": { backgroundColor: h.color.accentHover },
96
+ "&:disabled": {
97
+ opacity: .55,
98
+ cursor: "not-allowed",
99
+ textDecoration: "line-through"
100
+ },
101
+ "&:focus-visible": { ...n },
102
+ [i]: { "&[data-selected]": {
103
+ forcedColorAdjust: "none",
104
+ backgroundColor: "Highlight",
105
+ borderColor: "Highlight",
106
+ color: "HighlightText"
107
+ } }
108
+ }), O = /^\d{4}-\d{2}-\d{2}$/, k = /^\d{4}-\d{2}$/, A = 12, j = 0, M = "2026-01-04", N = (e, t) => String(e).padStart(t, "0");
109
+ function P(e, t, n) {
110
+ let r = new Date(Date.UTC(0, 0, 1));
111
+ return r.setUTCFullYear(e, t, n), r;
112
+ }
113
+ function F(e) {
114
+ let [t = NaN, n = NaN, r = 1] = e.split("-").map(Number);
115
+ return P(t, n - 1, r);
116
+ }
117
+ var I = (e) => `${N(e.getUTCFullYear(), 4)}-${N(e.getUTCMonth() + 1, 2)}-${N(e.getUTCDate(), 2)}`, L = (e) => e !== void 0 && O.test(e) && I(F(e)) === e, R = (e) => e !== void 0 && k.test(e) && L(`${e}-01`), z = (e) => e.slice(0, 7), B = (e) => `${e}-01`;
118
+ function V(e, t) {
119
+ let n = F(e);
120
+ return I(P(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate() + t));
121
+ }
122
+ function H(e, t) {
123
+ let n = F(e), r = P(n.getUTCFullYear(), n.getUTCMonth() + t, 1), i = P(r.getUTCFullYear(), r.getUTCMonth() + 1, 0).getUTCDate();
124
+ return I(P(r.getUTCFullYear(), r.getUTCMonth(), Math.min(n.getUTCDate(), i)));
125
+ }
126
+ var U = (e, t) => z(H(B(e), t)), W = (e) => V(B(U(e, 1)), -1), G = (e, t, n) => (t === void 0 || e >= t) && (n === void 0 || e <= n);
127
+ function ee(e, t, n) {
128
+ return t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
129
+ }
130
+ var K = (e, t) => (F(e).getUTCDay() - t + 7) % 7;
131
+ function q(e) {
132
+ let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
133
+ return n ? n.firstDay % 7 : j;
134
+ }
135
+ var J = {
136
+ calendar: "gregory",
137
+ timeZone: "UTC"
138
+ };
139
+ function te(e) {
140
+ return {
141
+ month: new Intl.DateTimeFormat(e, {
142
+ ...J,
143
+ month: "long",
144
+ year: "numeric"
145
+ }),
146
+ day: new Intl.DateTimeFormat(e, {
147
+ ...J,
148
+ day: "numeric"
149
+ }),
150
+ date: new Intl.DateTimeFormat(e, {
151
+ ...J,
152
+ dateStyle: "long"
153
+ }),
154
+ weekdayShort: new Intl.DateTimeFormat(e, {
155
+ ...J,
156
+ weekday: "short"
157
+ }),
158
+ weekdayLong: new Intl.DateTimeFormat(e, {
159
+ ...J,
160
+ weekday: "long"
161
+ })
162
+ };
163
+ }
164
+ var ne = () => typeof navigator > "u" ? void 0 : navigator.language, Y = (e) => (t) => V(t, e), X = (e) => (t, { shiftKey: n }) => H(t, n ? e * A : e), Z = {
165
+ ArrowDown: Y(7),
166
+ ArrowUp: Y(-7),
167
+ Home: (e, { firstDayOfWeek: t }) => V(e, -K(e, t)),
168
+ End: (e, { firstDayOfWeek: t }) => V(e, 6 - K(e, t)),
169
+ PageUp: X(-1),
170
+ PageDown: X(1)
171
+ }, re = {
172
+ ltr: {
173
+ ...Z,
174
+ ArrowRight: Y(1),
175
+ ArrowLeft: Y(-1)
176
+ },
177
+ rtl: {
178
+ ...Z,
179
+ ArrowRight: Y(-1),
180
+ ArrowLeft: Y(1)
181
+ }
182
+ }, Q = o(null);
183
+ function $(e) {
184
+ let t = s(Q);
185
+ if (!t) throw Error(`Calendar.${e} must be rendered inside <Calendar>.`);
186
+ return t;
187
+ }
188
+ var ie = "‹", ae = "›";
189
+ function oe({ ref: e, value: n, defaultValue: r, onValueChange: i, visibleMonth: o, defaultVisibleMonth: s, onVisibleMonthChange: c, min: u, max: d, locale: p, firstDayOfWeek: h, className: _, sx: y, ...b }) {
190
+ let x = `${l()}-label`, S = /* @__PURE__ */ new Date(), C = I(P(S.getFullYear(), S.getMonth(), S.getDate())), w = f(() => new Intl.DateTimeFormat(p ?? ne(), J).resolvedOptions().locale, [p]), T = f(() => te(w), [w]), E = f(() => q(w), [w]), D = h ?? E, [O, k] = a(n, r, i), A = n ?? r, [j, M] = a(o, s ?? z(L(A) ? A : C), c), N = R(j) ? j : z(C), F = L(u) ? u : void 0, B = L(d) ? d : void 0, [V, H] = m(null), [U, W] = m(!1), G = f(() => ({
191
+ value: O,
192
+ visibleMonth: N,
193
+ today: C,
194
+ min: F,
195
+ max: B,
196
+ firstDayOfWeek: D,
197
+ formatters: T,
198
+ focus: V,
199
+ setFocus: H,
200
+ requestValue: k,
201
+ requestVisibleMonth: M,
202
+ labelId: x,
203
+ hasHeader: U,
204
+ setHasHeader: W
205
+ }), [
206
+ O,
207
+ N,
208
+ C,
209
+ F,
210
+ B,
211
+ D,
212
+ T,
213
+ V,
214
+ k,
215
+ M,
216
+ x,
217
+ U
218
+ ]);
219
+ return /* @__PURE__ */ g(Q.Provider, {
220
+ value: G,
221
+ children: /* @__PURE__ */ g(t, {
222
+ className: _,
223
+ styles: v,
224
+ sx: y,
225
+ children: (t) => /* @__PURE__ */ g("div", {
226
+ ...b,
227
+ ref: e,
228
+ "data-ui": "calendar",
229
+ className: t
230
+ })
231
+ })
232
+ });
233
+ }
234
+ oe.displayName = "Calendar";
235
+ function se({ ref: e, className: n, sx: r, ...i }) {
236
+ let { visibleMonth: a, min: o, max: s, formatters: c, requestVisibleMonth: l, labelId: u, setHasHeader: f } = $("Header");
237
+ d(() => (f(!0), () => f(!1)), [f]);
238
+ let p = U(a, -1), m = U(a, 1), h = o !== void 0 && W(p) < o, v = s !== void 0 && B(m) > s, x = (e) => c.month.format(F(B(e)));
239
+ return /* @__PURE__ */ g(t, {
240
+ className: n,
241
+ styles: y,
242
+ sx: r,
243
+ children: (t) => /* @__PURE__ */ _("div", {
244
+ ...i,
245
+ ref: e,
246
+ "data-ui": "calendar-header",
247
+ className: t,
248
+ children: [
249
+ /* @__PURE__ */ g("button", {
250
+ type: "button",
251
+ "data-ui": "calendar-previous",
252
+ "aria-label": x(p),
253
+ "aria-disabled": h || void 0,
254
+ onClick: () => {
255
+ h || l(p);
256
+ },
257
+ css: S,
258
+ children: /* @__PURE__ */ g("span", {
259
+ "aria-hidden": "true",
260
+ css: C,
261
+ children: ie
262
+ })
263
+ }),
264
+ /* @__PURE__ */ g("span", {
265
+ id: u,
266
+ "aria-live": "polite",
267
+ "aria-atomic": "true",
268
+ "data-ui": "calendar-label",
269
+ css: b,
270
+ children: x(a)
271
+ }),
272
+ /* @__PURE__ */ g("button", {
273
+ type: "button",
274
+ "data-ui": "calendar-next",
275
+ "aria-label": x(m),
276
+ "aria-disabled": v || void 0,
277
+ onClick: () => {
278
+ v || l(m);
279
+ },
280
+ css: S,
281
+ children: /* @__PURE__ */ g("span", {
282
+ "aria-hidden": "true",
283
+ css: C,
284
+ children: ae
285
+ })
286
+ })
287
+ ]
288
+ })
289
+ });
290
+ }
291
+ se.displayName = "Calendar.Header";
292
+ function ce({ date: e, isTabStop: t }) {
293
+ let { value: n, today: r, min: i, max: a, formatters: o, setFocus: s, requestValue: c } = $("Grid"), l = n === e, u = r === e, d = F(e);
294
+ return /* @__PURE__ */ g("td", {
295
+ role: "gridcell",
296
+ "aria-selected": l || void 0,
297
+ css: E,
298
+ children: /* @__PURE__ */ g("button", {
299
+ type: "button",
300
+ "data-ui": "calendar-day",
301
+ "data-date": e,
302
+ "data-today": u || void 0,
303
+ "data-selected": l || void 0,
304
+ "aria-current": u ? "date" : void 0,
305
+ "aria-label": o.date.format(d),
306
+ tabIndex: t ? 0 : -1,
307
+ disabled: !G(e, i, a),
308
+ onFocus: () => s({
309
+ date: e,
310
+ fallback: e
311
+ }),
312
+ onClick: () => {
313
+ s({
314
+ date: e,
315
+ fallback: e
316
+ }), c(e);
317
+ },
318
+ css: D,
319
+ children: o.day.format(d)
320
+ })
321
+ });
322
+ }
323
+ function le({ ref: e, onKeyDown: n, "aria-labelledby": r, "aria-label": i, className: a, sx: o, ...s }) {
324
+ let { value: l, visibleMonth: d, today: f, min: m, max: h, firstDayOfWeek: v, formatters: y, focus: b, setFocus: x, requestVisibleMonth: S, labelId: C, hasHeader: D } = $("Grid"), O = p(null);
325
+ u(e, () => O.current, []);
326
+ let k = p(!1), A = B(d), j = F(W(d)).getUTCDate(), N = Array.from({ length: j }, (e, t) => V(A, t)), P = (e) => e !== void 0 && N.includes(e) && G(e, m, h), I = [
327
+ b?.date,
328
+ b?.fallback,
329
+ l,
330
+ f
331
+ ].find(P) ?? N.find((e) => G(e, m, h)), L = [...Array(K(A, v)).fill(null), ...N], R = Array.from({ length: Math.ceil(L.length / 7) }, (e, t) => Array.from({ length: 7 }, (e, n) => L[t * 7 + n] ?? null)), H = Array.from({ length: 7 }, (e, t) => F(V(M, (v + t) % 7)));
332
+ c(() => {
333
+ k.current && (k.current = !1, O.current?.querySelector(`[data-date="${I}"]`)?.focus());
334
+ });
335
+ let U = (e) => {
336
+ n?.(e);
337
+ let t = O.current;
338
+ if (e.defaultPrevented || !t) return;
339
+ let r = e.target.dataset.date;
340
+ if (!P(r)) return;
341
+ let i = re[getComputedStyle(t).direction === "rtl" ? "rtl" : "ltr"][e.key];
342
+ if (!i) return;
343
+ e.preventDefault();
344
+ let a = ee(i(r, {
345
+ firstDayOfWeek: v,
346
+ shiftKey: e.shiftKey
347
+ }), m, h);
348
+ a !== r && (x({
349
+ date: a,
350
+ fallback: r
351
+ }), k.current = !0, z(a) !== d && S(z(a)));
352
+ }, q = [r, D ? C : void 0].filter(Boolean).join(" ") || void 0, J = y.month.format(F(A));
353
+ return /* @__PURE__ */ g(t, {
354
+ className: a,
355
+ styles: w,
356
+ sx: o,
357
+ children: (e) => /* @__PURE__ */ _("table", {
358
+ ...s,
359
+ ref: O,
360
+ role: "grid",
361
+ "aria-labelledby": q,
362
+ "aria-label": q === void 0 ? i ?? J : i,
363
+ "data-ui": "calendar-grid",
364
+ onKeyDown: U,
365
+ className: e,
366
+ children: [/* @__PURE__ */ g("thead", { children: /* @__PURE__ */ g("tr", {
367
+ role: "row",
368
+ children: H.map((e) => /* @__PURE__ */ g("th", {
369
+ role: "columnheader",
370
+ scope: "col",
371
+ abbr: y.weekdayLong.format(e),
372
+ css: T,
373
+ children: y.weekdayShort.format(e)
374
+ }, e.getUTCDay()))
375
+ }) }), /* @__PURE__ */ g("tbody", { children: R.map((e, t) => /* @__PURE__ */ g("tr", {
376
+ role: "row",
377
+ children: e.map((e, t) => e === null ? /* @__PURE__ */ g("td", {
378
+ role: "gridcell",
379
+ css: E
380
+ }, `empty-${t}`) : /* @__PURE__ */ g(ce, {
381
+ date: e,
382
+ isTabStop: e === I
383
+ }, e))
384
+ }, t)) })]
385
+ })
386
+ });
387
+ }
388
+ le.displayName = "Calendar.Grid";
389
+ var ue = Object.assign(oe, {
390
+ Header: se,
391
+ Grid: le
392
+ });
393
+ //#endregion
394
+ export { ue as t };
package/dist/calendar.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Calendar } from "./calendar-DUgS0xmp.js";
2
+ export { t as Calendar } from "./calendar-C9Yad_-w.js";