@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,169 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { t } from "./disclosure-caret-C5T3fcl6.js";
4
- import { t as n } from "./focus-ring-BK5W5_NY.js";
5
- import { n as r } from "./media-D_eA_I-e.js";
6
- import { n as i } from "./roving-focus-CYlo_Kf8.js";
7
- import { t as a } from "./use-controlled-state-CVXDa-qM.js";
8
- import { createContext as o, forwardRef as s, useContext as c, useId as l, useMemo as u } from "react";
9
- import { vars as d } from "@jfrader/tokens/vars";
10
- import { jsx as f } from "@emotion/react/jsx-runtime";
11
- //#region src/components/accordion/accordion.tsx
12
- var p = o(null), m = o(null);
13
- function h(e) {
14
- let t = c(p);
15
- if (!t) throw Error(`Accordion.${e} must be rendered inside <Accordion>.`);
16
- return t;
17
- }
18
- function g(e) {
19
- let t = c(m);
20
- if (!t) throw Error(`Accordion.${e} must be rendered inside <Accordion.Item>.`);
21
- return t;
22
- }
23
- var _ = "", v = {
24
- itemSelector: "[data-ui=\"accordion-trigger\"]:not([disabled])",
25
- ownerSelector: "[data-ui=\"accordion\"]"
26
- }, y = (e, t) => {
27
- if (t === "multiple" && Array.isArray(e)) return e;
28
- let n = Array.isArray(e) ? e[0] : e;
29
- return n === void 0 || n === _ ? [] : [n];
30
- }, b = e({
31
- borderBlockEnd: `1px solid ${d.color.border}`,
32
- "&:first-of-type": { borderBlockStart: `1px solid ${d.color.border}` }
33
- }), x = e({
34
- margin: 0,
35
- font: "inherit"
36
- }), S = e({
37
- appearance: "none",
38
- display: "flex",
39
- alignItems: "center",
40
- justifyContent: "space-between",
41
- gap: d.space[3],
42
- inlineSize: "100%",
43
- border: 0,
44
- background: "transparent",
45
- cursor: "pointer",
46
- paddingBlock: d.space[3],
47
- paddingInline: d.space[4],
48
- font: "inherit",
49
- fontSize: d.textSize.sm,
50
- fontWeight: d.fontWeight.medium,
51
- color: d.color.text,
52
- textAlign: "start",
53
- transitionProperty: "background-color",
54
- transitionDuration: d.motion.duration.fast,
55
- transitionTimingFunction: d.motion.easeStandard,
56
- "&::after": { ...t },
57
- "&[aria-expanded=\"true\"]::after": { transform: "rotate(90deg)" },
58
- "&[aria-expanded=\"true\"]:dir(rtl)::after": { transform: "rotate(-90deg)" },
59
- "&:hover:not(:disabled):not([aria-disabled=\"true\"])": { backgroundColor: d.color.surfaceHover },
60
- "&[aria-disabled=\"true\"]": { cursor: "default" },
61
- "&:disabled": {
62
- opacity: .55,
63
- cursor: "not-allowed"
64
- },
65
- "&:focus-visible": { ...n },
66
- [r]: {
67
- transitionDuration: "0s",
68
- "&::after": { transitionDuration: "0s" }
69
- }
70
- }), C = e({
71
- paddingBlock: d.space[3],
72
- paddingInline: d.space[4],
73
- color: d.color.textMuted,
74
- lineHeight: d.lineHeight.relaxed,
75
- "&[hidden]": { display: "none" }
76
- }), w = s(function({ value: e, defaultValue: t, onValueChange: n, type: r = "single", collapsible: o = !0, onKeyDown: s, ...c }, l) {
77
- let [d, m] = a(e, t, n), h = u(() => {
78
- let e = y(d, r), t = o || e.length > 1;
79
- return {
80
- openValues: e,
81
- toggle: (n) => {
82
- let i = e.includes(n);
83
- (!i || t) && m(r === "multiple" ? i ? e.filter((e) => e !== n) : [...e, n] : i ? _ : n);
84
- },
85
- canCollapse: t
86
- };
87
- }, [
88
- d,
89
- m,
90
- r,
91
- o
92
- ]), g = (e) => {
93
- s?.(e), !e.defaultPrevented && i(e, e.currentTarget, "vertical", v);
94
- };
95
- return /* @__PURE__ */ f(p.Provider, {
96
- value: h,
97
- children: /* @__PURE__ */ f("div", {
98
- ...c,
99
- ref: l,
100
- "data-ui": "accordion",
101
- onKeyDown: g
102
- })
103
- });
104
- }), T = s(function({ value: e, disabled: t = !1, ...n }, r) {
105
- let { openValues: i } = h("Item"), a = l(), o = i.includes(e), s = u(() => ({
106
- value: e,
107
- disabled: t,
108
- expanded: o,
109
- triggerId: `${a}-trigger`,
110
- panelId: `${a}-panel`
111
- }), [
112
- e,
113
- t,
114
- o,
115
- a
116
- ]);
117
- return /* @__PURE__ */ f(m.Provider, {
118
- value: s,
119
- children: /* @__PURE__ */ f("div", {
120
- ...n,
121
- ref: r,
122
- "data-ui": "accordion-item",
123
- "data-state": o ? "open" : "closed",
124
- "data-disabled": t ? "" : void 0,
125
- css: b
126
- })
127
- });
128
- }), E = s(function({ onClick: e, disabled: t, ...n }, r) {
129
- let { toggle: i, canCollapse: a } = h("Trigger"), { value: o, disabled: s, expanded: c, triggerId: l, panelId: u } = g("Trigger"), d = c && !a, p = (t) => {
130
- e?.(t), !t.defaultPrevented && i(o);
131
- };
132
- return /* @__PURE__ */ f("h3", {
133
- "data-ui": "accordion-heading",
134
- css: x,
135
- children: /* @__PURE__ */ f("button", {
136
- ...n,
137
- ref: r,
138
- type: "button",
139
- id: l,
140
- "data-ui": "accordion-trigger",
141
- "data-state": c ? "open" : "closed",
142
- "aria-expanded": c,
143
- "aria-controls": u,
144
- "aria-disabled": d || void 0,
145
- disabled: s || t,
146
- onClick: p,
147
- css: S
148
- })
149
- });
150
- }), D = s(function({ "aria-labelledby": e, ...t }, n) {
151
- let { expanded: r, triggerId: i, panelId: a } = g("Panel"), o = [e, i].filter(Boolean).join(" ");
152
- return /* @__PURE__ */ f("div", {
153
- ...t,
154
- ref: n,
155
- role: "region",
156
- id: a,
157
- "aria-labelledby": o,
158
- hidden: !r,
159
- "data-ui": "accordion-panel",
160
- "data-state": r ? "open" : "closed",
161
- css: C
162
- });
163
- }), O = Object.assign(w, {
164
- Item: T,
165
- Trigger: E,
166
- Panel: D
167
- });
168
- //#endregion
169
- export { O as t };
@@ -1,126 +0,0 @@
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 { createContext as r, forwardRef as i, useCallback as a, useContext as o, useId as s, useImperativeHandle as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
6
- import { vars as p } from "@jfrader/tokens/vars";
7
- import { jsx as m, jsxs as h } from "@emotion/react/jsx-runtime";
8
- //#region src/components/breadcrumbs/breadcrumbs.tsx
9
- var g = r(null);
10
- function _(e) {
11
- let t = o(g);
12
- if (!t) throw Error(`Breadcrumbs.${e} must be rendered inside <Breadcrumbs>.`);
13
- return t;
14
- }
15
- var v = ([, e], [, t]) => e.node.compareDocumentPosition(t.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1, y = e({
16
- display: "flex",
17
- flexWrap: "wrap",
18
- alignItems: "center",
19
- gap: p.space[2],
20
- margin: 0,
21
- padding: 0,
22
- listStyle: "none",
23
- fontFamily: p.font.sans,
24
- fontSize: p.textSize.sm,
25
- lineHeight: p.lineHeight.tight
26
- }), b = e({
27
- display: "inline-flex",
28
- alignItems: "center",
29
- gap: p.space[2],
30
- color: p.color.textMuted,
31
- "&:first-of-type > [data-ui=\"breadcrumbs-separator\"]": { display: "none" }
32
- }), x = e({ display: "inline-flex" }), S = e({
33
- display: "inline-flex",
34
- alignItems: "center",
35
- gap: p.space[1],
36
- minBlockSize: "24px",
37
- borderRadius: p.radius.sm,
38
- color: "inherit",
39
- "& svg": {
40
- inlineSize: "1em",
41
- blockSize: "1em",
42
- flexShrink: 0
43
- },
44
- "&[aria-current=\"page\"]": {
45
- color: p.color.text,
46
- fontWeight: p.fontWeight.medium
47
- }
48
- }), C = e({
49
- textDecoration: "underline",
50
- textDecorationColor: "transparent",
51
- textUnderlineOffset: "0.2em",
52
- transitionProperty: "color, text-decoration-color",
53
- transitionDuration: p.motion.duration.fast,
54
- transitionTimingFunction: p.motion.easeStandard,
55
- "&:hover": {
56
- color: p.color.text,
57
- textDecorationColor: "currentColor"
58
- },
59
- "&:focus-visible": { ...t },
60
- [n]: { transitionDuration: "0s" }
61
- }), w = i(function({ label: e = "Breadcrumb", separator: t = "/", children: n, ...r }, i) {
62
- let o = d(/* @__PURE__ */ new Map()), [s, c] = f(null), l = d(null), p = a(() => {
63
- let e = Array.from(o.current).sort(v), t = e.some(([, e]) => e.current === !0) ? null : e.at(-1)?.[0] ?? null;
64
- l.current !== t && (l.current = t, c(t));
65
- }, []), h = a((e, t) => {
66
- o.current.set(e, t), p();
67
- }, [p]), _ = a((e) => {
68
- o.current.delete(e), p();
69
- }, [p]), b = u(() => ({
70
- separator: t,
71
- autoCurrentId: s,
72
- register: h,
73
- unregister: _
74
- }), [
75
- t,
76
- s,
77
- h,
78
- _
79
- ]);
80
- return /* @__PURE__ */ m(g.Provider, {
81
- value: b,
82
- children: /* @__PURE__ */ m("nav", {
83
- ...r,
84
- ref: i,
85
- "aria-label": e,
86
- "data-ui": "breadcrumbs",
87
- children: /* @__PURE__ */ m("ol", {
88
- css: y,
89
- children: n
90
- })
91
- })
92
- });
93
- }), T = i(function({ href: e, current: t, children: n, ...r }, i) {
94
- let { separator: a, autoCurrentId: o, register: u, unregister: f } = _("Item"), p = s(), g = d(null);
95
- c(i, () => g.current, []), l(() => {
96
- let e = g.current;
97
- e && u(p, {
98
- node: e,
99
- current: t
100
- });
101
- }), l(() => () => f(p), [p, f]);
102
- let v = t ?? o === p ? "page" : void 0;
103
- return /* @__PURE__ */ h("li", {
104
- ...r,
105
- ref: g,
106
- "data-ui": "breadcrumbs-item",
107
- css: b,
108
- children: [/* @__PURE__ */ m("span", {
109
- "aria-hidden": "true",
110
- "data-ui": "breadcrumbs-separator",
111
- css: x,
112
- children: a
113
- }), e === void 0 ? /* @__PURE__ */ m("span", {
114
- "aria-current": v,
115
- css: S,
116
- children: n
117
- }) : /* @__PURE__ */ m("a", {
118
- href: e,
119
- "aria-current": v,
120
- css: [S, C],
121
- children: n
122
- })]
123
- });
124
- }), E = Object.assign(w, { Item: T });
125
- //#endregion
126
- export { E as t };
@@ -1,373 +0,0 @@
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, forwardRef 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
- [n]: { 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": { ...t }
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": { ...t },
102
- [r]: { "&[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 te(e) {
132
- let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
133
- return n ? n.firstDay % 7 : j;
134
- }
135
- var q = {
136
- calendar: "gregory",
137
- timeZone: "UTC"
138
- };
139
- function ne(e) {
140
- return {
141
- month: new Intl.DateTimeFormat(e, {
142
- ...q,
143
- month: "long",
144
- year: "numeric"
145
- }),
146
- day: new Intl.DateTimeFormat(e, {
147
- ...q,
148
- day: "numeric"
149
- }),
150
- date: new Intl.DateTimeFormat(e, {
151
- ...q,
152
- dateStyle: "long"
153
- }),
154
- weekdayShort: new Intl.DateTimeFormat(e, {
155
- ...q,
156
- weekday: "short"
157
- }),
158
- weekdayLong: new Intl.DateTimeFormat(e, {
159
- ...q,
160
- weekday: "long"
161
- })
162
- };
163
- }
164
- var re = () => typeof navigator > "u" ? void 0 : navigator.language, J = (e) => (t) => V(t, e), Y = (e) => (t, { shiftKey: n }) => H(t, n ? e * A : e), X = {
165
- ArrowDown: J(7),
166
- ArrowUp: J(-7),
167
- Home: (e, { firstDayOfWeek: t }) => V(e, -K(e, t)),
168
- End: (e, { firstDayOfWeek: t }) => V(e, 6 - K(e, t)),
169
- PageUp: Y(-1),
170
- PageDown: Y(1)
171
- }, ie = {
172
- ltr: {
173
- ...X,
174
- ArrowRight: J(1),
175
- ArrowLeft: J(-1)
176
- },
177
- rtl: {
178
- ...X,
179
- ArrowRight: J(-1),
180
- ArrowLeft: J(1)
181
- }
182
- }, Z = a(null);
183
- function Q(e) {
184
- let t = s(Z);
185
- if (!t) throw Error(`Calendar.${e} must be rendered inside <Calendar>.`);
186
- return t;
187
- }
188
- var $ = "‹", ae = "›", oe = o(function({ value: e, defaultValue: t, onValueChange: n, visibleMonth: r, defaultVisibleMonth: a, onVisibleMonthChange: o, min: s, max: c, locale: u, firstDayOfWeek: d, ...p }, h) {
189
- let _ = `${l()}-label`, y = /* @__PURE__ */ new Date(), b = I(P(y.getFullYear(), y.getMonth(), y.getDate())), x = f(() => new Intl.DateTimeFormat(u ?? re(), q).resolvedOptions().locale, [u]), S = f(() => ne(x), [x]), C = f(() => te(x), [x]), w = d ?? C, [T, E] = i(e, t, n), D = e ?? t, [O, k] = i(r, a ?? z(L(D) ? D : b), o), A = R(O) ? O : z(b), j = L(s) ? s : void 0, M = L(c) ? c : void 0, [N, F] = m(null), [B, V] = m(!1), H = f(() => ({
190
- value: T,
191
- visibleMonth: A,
192
- today: b,
193
- min: j,
194
- max: M,
195
- firstDayOfWeek: w,
196
- formatters: S,
197
- focus: N,
198
- setFocus: F,
199
- requestValue: E,
200
- requestVisibleMonth: k,
201
- labelId: _,
202
- hasHeader: B,
203
- setHasHeader: V
204
- }), [
205
- T,
206
- A,
207
- b,
208
- j,
209
- M,
210
- w,
211
- S,
212
- N,
213
- E,
214
- k,
215
- _,
216
- B
217
- ]);
218
- return /* @__PURE__ */ g(Z.Provider, {
219
- value: H,
220
- children: /* @__PURE__ */ g("div", {
221
- ...p,
222
- ref: h,
223
- "data-ui": "calendar",
224
- css: v
225
- })
226
- });
227
- }), se = o(function(e, t) {
228
- let { visibleMonth: n, min: r, max: i, formatters: a, requestVisibleMonth: o, labelId: s, setHasHeader: c } = Q("Header");
229
- d(() => (c(!0), () => c(!1)), [c]);
230
- let l = U(n, -1), u = U(n, 1), f = r !== void 0 && W(l) < r, p = i !== void 0 && B(u) > i, m = (e) => a.month.format(F(B(e)));
231
- return /* @__PURE__ */ _("div", {
232
- ...e,
233
- ref: t,
234
- "data-ui": "calendar-header",
235
- css: y,
236
- children: [
237
- /* @__PURE__ */ g("button", {
238
- type: "button",
239
- "data-ui": "calendar-previous",
240
- "aria-label": m(l),
241
- "aria-disabled": f || void 0,
242
- onClick: () => {
243
- f || o(l);
244
- },
245
- css: S,
246
- children: /* @__PURE__ */ g("span", {
247
- "aria-hidden": "true",
248
- css: C,
249
- children: $
250
- })
251
- }),
252
- /* @__PURE__ */ g("span", {
253
- id: s,
254
- "aria-live": "polite",
255
- "aria-atomic": "true",
256
- "data-ui": "calendar-label",
257
- css: b,
258
- children: m(n)
259
- }),
260
- /* @__PURE__ */ g("button", {
261
- type: "button",
262
- "data-ui": "calendar-next",
263
- "aria-label": m(u),
264
- "aria-disabled": p || void 0,
265
- onClick: () => {
266
- p || o(u);
267
- },
268
- css: S,
269
- children: /* @__PURE__ */ g("span", {
270
- "aria-hidden": "true",
271
- css: C,
272
- children: ae
273
- })
274
- })
275
- ]
276
- });
277
- });
278
- function ce({ date: e, isTabStop: t }) {
279
- let { value: n, today: r, min: i, max: a, formatters: o, setFocus: s, requestValue: c } = Q("Grid"), l = n === e, u = r === e, d = F(e);
280
- return /* @__PURE__ */ g("td", {
281
- role: "gridcell",
282
- "aria-selected": l || void 0,
283
- css: E,
284
- children: /* @__PURE__ */ g("button", {
285
- type: "button",
286
- "data-ui": "calendar-day",
287
- "data-date": e,
288
- "data-today": u || void 0,
289
- "data-selected": l || void 0,
290
- "aria-current": u ? "date" : void 0,
291
- "aria-label": o.date.format(d),
292
- tabIndex: t ? 0 : -1,
293
- disabled: !G(e, i, a),
294
- onFocus: () => s({
295
- date: e,
296
- fallback: e
297
- }),
298
- onClick: () => {
299
- s({
300
- date: e,
301
- fallback: e
302
- }), c(e);
303
- },
304
- css: D,
305
- children: o.day.format(d)
306
- })
307
- });
308
- }
309
- var le = o(function({ onKeyDown: e, "aria-labelledby": t, "aria-label": n, ...r }, i) {
310
- let { value: a, visibleMonth: o, today: s, min: l, max: d, firstDayOfWeek: f, formatters: m, focus: h, setFocus: v, requestVisibleMonth: y, labelId: b, hasHeader: x } = Q("Grid"), S = p(null);
311
- u(i, () => S.current, []);
312
- let C = p(!1), D = B(o), O = F(W(o)).getUTCDate(), k = Array.from({ length: O }, (e, t) => V(D, t)), A = (e) => e !== void 0 && k.includes(e) && G(e, l, d), j = [
313
- h?.date,
314
- h?.fallback,
315
- a,
316
- s
317
- ].find(A) ?? k.find((e) => G(e, l, d)), N = [...Array(K(D, f)).fill(null), ...k], P = 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) => F(V(M, (f + t) % 7)));
318
- c(() => {
319
- C.current && (C.current = !1, S.current?.querySelector(`[data-date="${j}"]`)?.focus());
320
- });
321
- let L = (t) => {
322
- e?.(t);
323
- let n = S.current;
324
- if (t.defaultPrevented || !n) return;
325
- let r = t.target.dataset.date;
326
- if (!A(r)) return;
327
- let i = ie[getComputedStyle(n).direction === "rtl" ? "rtl" : "ltr"][t.key];
328
- if (!i) return;
329
- t.preventDefault();
330
- let a = ee(i(r, {
331
- firstDayOfWeek: f,
332
- shiftKey: t.shiftKey
333
- }), l, d);
334
- a !== r && (v({
335
- date: a,
336
- fallback: r
337
- }), C.current = !0, z(a) !== o && y(z(a)));
338
- }, R = [t, x ? b : void 0].filter(Boolean).join(" ") || void 0, H = m.month.format(F(D));
339
- return /* @__PURE__ */ _("table", {
340
- ...r,
341
- ref: S,
342
- role: "grid",
343
- "aria-labelledby": R,
344
- "aria-label": R === void 0 ? n ?? H : n,
345
- "data-ui": "calendar-grid",
346
- onKeyDown: L,
347
- css: w,
348
- children: [/* @__PURE__ */ g("thead", { children: /* @__PURE__ */ g("tr", {
349
- role: "row",
350
- children: I.map((e) => /* @__PURE__ */ g("th", {
351
- role: "columnheader",
352
- scope: "col",
353
- abbr: m.weekdayLong.format(e),
354
- css: T,
355
- children: m.weekdayShort.format(e)
356
- }, e.getUTCDay()))
357
- }) }), /* @__PURE__ */ g("tbody", { children: P.map((e, t) => /* @__PURE__ */ g("tr", {
358
- role: "row",
359
- children: e.map((e, t) => e === null ? /* @__PURE__ */ g("td", {
360
- role: "gridcell",
361
- css: E
362
- }, `empty-${t}`) : /* @__PURE__ */ g(ce, {
363
- date: e,
364
- isTabStop: e === j
365
- }, e))
366
- }, t)) })]
367
- });
368
- }), ue = Object.assign(oe, {
369
- Header: se,
370
- Grid: le
371
- });
372
- //#endregion
373
- export { ue as t };