@jfrader/ui 0.1.1 → 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.
- package/README.md +3 -1
- package/dist/accordion-CkOZ-tvs.js +178 -0
- package/dist/accordion.js +2 -1
- package/dist/alert-Dsjx14UW.js +131 -0
- package/dist/alert.js +2 -1
- package/dist/avatar-BRGKkoSr.js +127 -0
- package/dist/avatar.js +2 -1
- package/dist/badge-DLxUMsCx.js +104 -0
- package/dist/badge.js +2 -1
- package/dist/breadcrumbs-694hF_hm.js +131 -0
- package/dist/breadcrumbs.js +2 -1
- package/dist/button-CoaIcykB.js +190 -0
- package/dist/button.js +2 -1
- package/dist/calendar-Doj7PTdG.js +379 -0
- package/dist/calendar.js +2 -1
- package/dist/card-2IM71XZj.js +134 -0
- package/dist/card.js +2 -1
- package/dist/checkbox-B7xGNFzp.js +136 -0
- package/dist/checkbox.js +2 -1
- package/dist/{choice-control-DCyQ_hVw.js → choice-control-ByFogYcT.js} +2 -1
- package/dist/{collection-registry-C2jnQa7X.js → collection-registry-1l9f3XJZ.js} +3 -2
- package/dist/combobox-Bjhxv5U3.js +311 -0
- package/dist/combobox.js +2 -1
- package/dist/command-palette-BhJwm6cS.js +344 -0
- package/dist/command-palette.js +2 -1
- package/dist/container-BhnrGPu-.js +36 -0
- package/dist/container.js +2 -1
- package/dist/{css-CW_HG55W.js → css-Cgj6sCHn.js} +1 -0
- package/dist/date-picker-Jk8SpoiO.js +245 -0
- package/dist/date-picker.js +2 -1
- package/dist/dialog-fhS07G41.js +187 -0
- package/dist/dialog.js +2 -1
- package/dist/{disclosure-caret-BC6P8AsM.js → disclosure-caret-C5T3fcl6.js} +1 -0
- package/dist/divider-v_78HYF5.js +79 -0
- package/dist/divider.js +2 -1
- package/dist/{field-anatomy-DKkB268x.js → field-anatomy-BzGw1Ch9.js} +4 -3
- package/dist/flex-COZzFqI8.js +22 -0
- package/dist/flex.js +2 -1
- package/dist/{focus-ring-qOS3rPlM.js → focus-ring-BK5W5_NY.js} +1 -0
- package/dist/{icon-wrapper-BKo4FI-O.js → icon-wrapper-CFWzew5m.js} +2 -1
- package/dist/index.js +37 -36
- package/dist/kbd-CeP8Kfvp.js +61 -0
- package/dist/kbd.js +2 -1
- package/dist/{layout-style-B_6YHQ6Q.js → layout-style-7ZTOiWGR.js} +2 -1
- package/dist/{loading-ring-CTpT-IrT.js → loading-ring-BpdB0aFi.js} +2 -1
- package/dist/{media-8K3xDAxM.js → media-D_eA_I-e.js} +1 -0
- package/dist/menu-B6KCbLCr.js +196 -0
- package/dist/menu.js +2 -1
- package/dist/navigation-BDht6S2-.js +182 -0
- package/dist/navigation.js +2 -1
- package/dist/pagination-B50PCaDU.js +151 -0
- package/dist/pagination.js +2 -1
- package/dist/{part-id-Bg1LSlk7.js → part-id-D0zksy32.js} +1 -0
- package/dist/pill-2_XzBdkD.js +51 -0
- package/dist/pill.js +2 -1
- package/dist/popover-DRHbeIVq.js +103 -0
- package/dist/popover.js +2 -1
- package/dist/progress-CpsskKTD.js +85 -0
- package/dist/progress.js +2 -1
- package/dist/radio-group-DPI5KUCj.js +136 -0
- package/dist/radio-group.js +2 -1
- package/dist/{renderable-DwPvt1I8.js → renderable-DzcIj1Lo.js} +1 -0
- package/dist/{roving-focus-DeEZ55-T.js → roving-focus-CYlo_Kf8.js} +1 -0
- package/dist/select-C1xGrOhT.js +266 -0
- package/dist/select.js +2 -1
- package/dist/skeleton-DitdP-yz.js +49 -0
- package/dist/skeleton.js +2 -1
- package/dist/spinner-CFq5HPoo.js +51 -0
- package/dist/spinner.js +2 -1
- package/dist/stack-D_g6NJzo.js +21 -0
- package/dist/stack.js +2 -1
- package/dist/{surface-Bo_aSQOb.js → surface-DZ4d-2aL.js} +1 -0
- package/dist/switch-B5TTU-oJ.js +138 -0
- package/dist/switch.js +2 -1
- package/dist/tabs-C26PWl2c.js +183 -0
- package/dist/tabs.js +2 -1
- package/dist/text-field-8PQAqRpM.js +75 -0
- package/dist/text-field.js +2 -1
- package/dist/textarea-CcGWuntL.js +85 -0
- package/dist/textarea.js +2 -1
- package/dist/theme-root-BRLIA4eb.js +22 -0
- package/dist/theme-root.js +2 -1
- package/dist/toast-B1PXuwZ4.js +277 -0
- package/dist/toast.js +2 -1
- package/dist/toggle-group-N_owicT0.js +156 -0
- package/dist/toggle-group.js +2 -1
- package/dist/tooltip-BJPisf60.js +98 -0
- package/dist/tooltip.js +2 -1
- package/dist/{trigger-style-f54idgjT.js → trigger-style-B1GFmH7M.js} +2 -1
- package/dist/types/components/accordion/accordion.d.ts +13 -9
- package/dist/types/components/alert/alert.d.ts +6 -3
- package/dist/types/components/avatar/avatar.d.ts +6 -3
- package/dist/types/components/badge/badge.d.ts +6 -3
- package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +8 -5
- package/dist/types/components/button/button.d.ts +6 -3
- package/dist/types/components/calendar/calendar.d.ts +11 -7
- package/dist/types/components/card/card.d.ts +20 -13
- package/dist/types/components/checkbox/checkbox.d.ts +6 -3
- package/dist/types/components/combobox/combobox.d.ts +12 -8
- package/dist/types/components/command-palette/command-palette.d.ts +22 -15
- package/dist/types/components/container/container.d.ts +6 -3
- package/dist/types/components/date-picker/date-picker.d.ts +6 -4
- package/dist/types/components/dialog/dialog.d.ts +16 -11
- package/dist/types/components/divider/divider.d.ts +6 -3
- package/dist/types/components/flex/flex.d.ts +6 -3
- package/dist/types/components/kbd/kbd.d.ts +8 -5
- package/dist/types/components/menu/menu.d.ts +13 -9
- package/dist/types/components/navigation/navigation.d.ts +11 -7
- package/dist/types/components/pagination/pagination.d.ts +6 -3
- package/dist/types/components/pill/pill.d.ts +6 -3
- package/dist/types/components/popover/popover.d.ts +7 -5
- package/dist/types/components/progress/progress.d.ts +6 -3
- package/dist/types/components/radio-group/radio-group.d.ts +8 -5
- package/dist/types/components/select/select.d.ts +13 -9
- package/dist/types/components/skeleton/skeleton.d.ts +6 -3
- package/dist/types/components/spinner/spinner.d.ts +6 -3
- package/dist/types/components/stack/stack.d.ts +4 -1
- package/dist/types/components/switch/switch.d.ts +6 -3
- package/dist/types/components/tabs/tabs.d.ts +14 -9
- package/dist/types/components/text-field/text-field.d.ts +6 -3
- package/dist/types/components/textarea/textarea.d.ts +6 -3
- package/dist/types/components/theme-root/theme-root.d.ts +6 -3
- package/dist/types/components/toast/toast.d.ts +6 -4
- package/dist/types/components/toggle-group/toggle-group.d.ts +7 -5
- package/dist/types/components/tooltip/tooltip.d.ts +7 -5
- package/dist/types/overlay/use-native-dialog.d.ts +2 -2
- package/dist/{use-controlled-state-DQXkiTQI.js → use-controlled-state-CVXDa-qM.js} +1 -0
- package/dist/{use-native-dialog-BCp1chwO.js → use-native-dialog-DWpIUVO1.js} +1 -0
- package/dist/{use-overlay-floating-CsZd3qxa.js → use-overlay-floating-efeqppiw.js} +1 -0
- package/dist/{visually-hidden-BXVyhj0y.js → visually-hidden-DCWhf0Cb.js} +2 -1
- package/package.json +4 -4
- package/dist/accordion-Dl-kvgPQ.js +0 -168
- package/dist/alert-BzntPa_5.js +0 -129
- package/dist/avatar-Dk2ES3ru.js +0 -124
- package/dist/badge-DZefC7rm.js +0 -102
- package/dist/breadcrumbs-5MCZ_Jr3.js +0 -125
- package/dist/button-qy-50NPd.js +0 -187
- package/dist/calendar-DcCAiN3b.js +0 -372
- package/dist/card-L-Z_1vZN.js +0 -120
- package/dist/checkbox-B7em7B-6.js +0 -134
- package/dist/combobox-DQcXR94r.js +0 -301
- package/dist/command-palette-BRJ8A5De.js +0 -328
- package/dist/container-COHiEjI8.js +0 -34
- package/dist/date-picker-D1GwiRB9.js +0 -239
- package/dist/dialog-CYf9fCZO.js +0 -175
- package/dist/divider-bi7OgCI5.js +0 -76
- package/dist/flex-CDFDDaiu.js +0 -21
- package/dist/kbd-DpiJgDJ2.js +0 -55
- package/dist/menu-A9fZUaAG.js +0 -186
- package/dist/navigation-Cemnmc_J.js +0 -174
- package/dist/pagination-orCjUsn_.js +0 -148
- package/dist/pill-Dg2JJHHW.js +0 -49
- package/dist/popover-D_YU34WS.js +0 -97
- package/dist/progress-XdvBG0Vv.js +0 -83
- package/dist/radio-group-CxMJ2Vq7.js +0 -130
- package/dist/select-mwFbmzsn.js +0 -256
- package/dist/skeleton-qas9ZKK9.js +0 -47
- package/dist/spinner-ros2CfIf.js +0 -49
- package/dist/stack-Hs8THnIL.js +0 -20
- package/dist/switch-E375Bz4X.js +0 -135
- package/dist/tabs-CBwRiuul.js +0 -173
- package/dist/text-field-BlP8qGn_.js +0 -73
- package/dist/textarea-CUG26CH2.js +0 -83
- package/dist/theme-root-CrdzwfSo.js +0 -20
- package/dist/toast-D_dnqnn-.js +0 -270
- package/dist/toggle-group-B7gXCea8.js +0 -150
- package/dist/tooltip-BJ2hLV1b.js +0 -92
package/dist/breadcrumbs.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
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 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
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 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
export { t as Calendar } from "./calendar-Doj7PTdG.js";
|