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