@jfrader/ui 0.2.0 → 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 (162) hide show
  1. package/dist/accordion-Bd-j04hW.js +198 -0
  2. package/dist/accordion.js +1 -1
  3. package/dist/alert-BBqaKI4k.js +135 -0
  4. package/dist/alert.js +1 -1
  5. package/dist/avatar-BahDVO9t.js +132 -0
  6. package/dist/avatar.js +1 -1
  7. package/dist/badge-B_sLygxU.js +108 -0
  8. package/dist/badge.js +1 -1
  9. package/dist/breadcrumbs-DVAOxfvL.js +141 -0
  10. package/dist/breadcrumbs.js +1 -1
  11. package/dist/button-P2e7_44z.js +200 -0
  12. package/dist/button.js +1 -1
  13. package/dist/calendar-C9Yad_-w.js +394 -0
  14. package/dist/calendar.js +1 -1
  15. package/dist/card-D-aI2QHx.js +158 -0
  16. package/dist/card.js +1 -1
  17. package/dist/checkbox-COYG6L7d.js +140 -0
  18. package/dist/checkbox.js +1 -1
  19. package/dist/{choice-control-ByFogYcT.js → choice-control-5kJkLXgv.js} +1 -1
  20. package/dist/{collection-registry-1l9f3XJZ.js → collection-registry-BTYi6zGh.js} +1 -1
  21. package/dist/combobox-DrmjBbo7.js +327 -0
  22. package/dist/combobox.js +1 -1
  23. package/dist/command-palette-V_2pEay7.js +379 -0
  24. package/dist/command-palette.js +1 -1
  25. package/dist/container-BOaSptJa.js +41 -0
  26. package/dist/container.js +1 -1
  27. package/dist/date-picker-ClUYBIBh.js +250 -0
  28. package/dist/date-picker.js +1 -1
  29. package/dist/dialog-xaydbXl2.js +218 -0
  30. package/dist/dialog.js +1 -1
  31. package/dist/divider-DYoJf0I_.js +84 -0
  32. package/dist/divider.js +1 -1
  33. package/dist/field-anatomy-D2ToMeRa.js +109 -0
  34. package/dist/flex-Dh-_J5-U.js +28 -0
  35. package/dist/flex.js +1 -1
  36. package/dist/{icon-wrapper-CFWzew5m.js → icon-wrapper-stN8sD7R.js} +1 -1
  37. package/dist/index.js +38 -37
  38. package/dist/kbd-C3ACoMoE.js +71 -0
  39. package/dist/kbd.js +1 -1
  40. package/dist/{layout-style-7ZTOiWGR.js → layout-style-Cbd1Vilw.js} +1 -1
  41. package/dist/{loading-ring-BpdB0aFi.js → loading-ring-B8-30Dl1.js} +1 -1
  42. package/dist/menu-DU60SMdt.js +216 -0
  43. package/dist/menu.js +1 -1
  44. package/dist/navigation-DhnKriOp.js +197 -0
  45. package/dist/navigation.js +1 -1
  46. package/dist/pagination-DYdwsxwe.js +156 -0
  47. package/dist/pagination.js +1 -1
  48. package/dist/pill-DO2gHzMb.js +56 -0
  49. package/dist/pill.js +1 -1
  50. package/dist/popover-BtN_0ejj.js +113 -0
  51. package/dist/popover.js +1 -1
  52. package/dist/progress-BpJswTG4.js +90 -0
  53. package/dist/progress.js +1 -1
  54. package/dist/radio-group-Ce0_IWQr.js +145 -0
  55. package/dist/radio-group.js +1 -1
  56. package/dist/select-BCS0-LVW.js +286 -0
  57. package/dist/select.js +1 -1
  58. package/dist/skeleton-OoFlOEXO.js +54 -0
  59. package/dist/skeleton.js +1 -1
  60. package/dist/spinner-C2YDoiMn.js +56 -0
  61. package/dist/spinner.js +1 -1
  62. package/dist/stack-DC3IbtWk.js +27 -0
  63. package/dist/stack.js +1 -1
  64. package/dist/switch-Dr-qjmT4.js +142 -0
  65. package/dist/switch.js +1 -1
  66. package/dist/sx-Dx9JUKp5.js +23 -0
  67. package/dist/tabs-CK_g1RKa.js +203 -0
  68. package/dist/tabs.js +1 -1
  69. package/dist/{text-field-8PQAqRpM.js → text-field-D60ok14S.js} +19 -18
  70. package/dist/text-field.js +1 -1
  71. package/dist/{textarea-CcGWuntL.js → textarea-DyfjtP0A.js} +19 -18
  72. package/dist/textarea.js +1 -1
  73. package/dist/theme-root-BiXXvQvr.js +42 -0
  74. package/dist/theme-root.js +1 -1
  75. package/dist/toast-iqelR-r0.js +282 -0
  76. package/dist/toast.js +1 -1
  77. package/dist/toggle-group-CI0e7hFm.js +166 -0
  78. package/dist/toggle-group.js +1 -1
  79. package/dist/tooltip-CB-HC1js.js +108 -0
  80. package/dist/tooltip.js +1 -1
  81. package/dist/{trigger-style-B1GFmH7M.js → trigger-style-B1KVC8O1.js} +1 -1
  82. package/dist/types/components/accordion/accordion.d.ts +9 -8
  83. package/dist/types/components/alert/alert.d.ts +3 -2
  84. package/dist/types/components/avatar/avatar.d.ts +3 -2
  85. package/dist/types/components/badge/badge.d.ts +3 -2
  86. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +5 -4
  87. package/dist/types/components/button/button.d.ts +3 -2
  88. package/dist/types/components/calendar/calendar.d.ts +7 -6
  89. package/dist/types/components/card/card.d.ts +13 -12
  90. package/dist/types/components/checkbox/checkbox.d.ts +3 -2
  91. package/dist/types/components/combobox/combobox.d.ts +8 -7
  92. package/dist/types/components/command-palette/command-palette.d.ts +15 -14
  93. package/dist/types/components/container/container.d.ts +3 -2
  94. package/dist/types/components/date-picker/date-picker.d.ts +3 -2
  95. package/dist/types/components/dialog/dialog.d.ts +11 -10
  96. package/dist/types/components/divider/divider.d.ts +3 -2
  97. package/dist/types/components/field/field-anatomy.d.ts +3 -2
  98. package/dist/types/components/flex/flex.d.ts +3 -2
  99. package/dist/types/components/kbd/kbd.d.ts +5 -4
  100. package/dist/types/components/menu/menu.d.ts +9 -8
  101. package/dist/types/components/navigation/navigation.d.ts +7 -6
  102. package/dist/types/components/pagination/pagination.d.ts +3 -2
  103. package/dist/types/components/pill/pill.d.ts +3 -2
  104. package/dist/types/components/popover/popover.d.ts +5 -4
  105. package/dist/types/components/progress/progress.d.ts +3 -2
  106. package/dist/types/components/radio-group/radio-group.d.ts +5 -4
  107. package/dist/types/components/select/select.d.ts +9 -8
  108. package/dist/types/components/skeleton/skeleton.d.ts +3 -2
  109. package/dist/types/components/spinner/spinner.d.ts +3 -2
  110. package/dist/types/components/stack/stack.d.ts +1 -1
  111. package/dist/types/components/switch/switch.d.ts +3 -2
  112. package/dist/types/components/tabs/tabs.d.ts +9 -8
  113. package/dist/types/components/text-field/text-field.d.ts +3 -2
  114. package/dist/types/components/textarea/textarea.d.ts +3 -2
  115. package/dist/types/components/theme-provider/theme-provider.d.ts +11 -0
  116. package/dist/types/components/theme-root/theme-root.d.ts +3 -2
  117. package/dist/types/components/toast/toast.d.ts +3 -2
  118. package/dist/types/components/toggle-group/toggle-group.d.ts +5 -4
  119. package/dist/types/components/tooltip/tooltip.d.ts +5 -4
  120. package/dist/types/index.d.ts +4 -0
  121. package/dist/types/styling/css.d.ts +3 -2
  122. package/dist/types/styling/styled.d.ts +1 -0
  123. package/dist/types/styling/sx.d.ts +16 -0
  124. package/dist/types/styling/theme.d.ts +98 -0
  125. package/dist/{visually-hidden-DCWhf0Cb.js → visually-hidden-BJdvqqvn.js} +1 -1
  126. package/package.json +3 -2
  127. package/dist/accordion-CkOZ-tvs.js +0 -178
  128. package/dist/alert-Dsjx14UW.js +0 -131
  129. package/dist/avatar-BRGKkoSr.js +0 -127
  130. package/dist/badge-DLxUMsCx.js +0 -104
  131. package/dist/breadcrumbs-694hF_hm.js +0 -131
  132. package/dist/button-CoaIcykB.js +0 -190
  133. package/dist/calendar-Doj7PTdG.js +0 -379
  134. package/dist/card-2IM71XZj.js +0 -134
  135. package/dist/checkbox-B7xGNFzp.js +0 -136
  136. package/dist/combobox-Bjhxv5U3.js +0 -311
  137. package/dist/command-palette-BhJwm6cS.js +0 -344
  138. package/dist/container-BhnrGPu-.js +0 -36
  139. package/dist/css-Cgj6sCHn.js +0 -2
  140. package/dist/date-picker-Jk8SpoiO.js +0 -245
  141. package/dist/dialog-fhS07G41.js +0 -187
  142. package/dist/divider-v_78HYF5.js +0 -79
  143. package/dist/field-anatomy-BzGw1Ch9.js +0 -105
  144. package/dist/flex-COZzFqI8.js +0 -22
  145. package/dist/kbd-CeP8Kfvp.js +0 -61
  146. package/dist/menu-B6KCbLCr.js +0 -196
  147. package/dist/navigation-BDht6S2-.js +0 -182
  148. package/dist/pagination-B50PCaDU.js +0 -151
  149. package/dist/pill-2_XzBdkD.js +0 -51
  150. package/dist/popover-DRHbeIVq.js +0 -103
  151. package/dist/progress-CpsskKTD.js +0 -85
  152. package/dist/radio-group-DPI5KUCj.js +0 -136
  153. package/dist/select-C1xGrOhT.js +0 -266
  154. package/dist/skeleton-DitdP-yz.js +0 -49
  155. package/dist/spinner-CFq5HPoo.js +0 -51
  156. package/dist/stack-D_g6NJzo.js +0 -21
  157. package/dist/switch-B5TTU-oJ.js +0 -138
  158. package/dist/tabs-C26PWl2c.js +0 -183
  159. package/dist/theme-root-BRLIA4eb.js +0 -22
  160. package/dist/toast-B1PXuwZ4.js +0 -277
  161. package/dist/toggle-group-N_owicT0.js +0 -156
  162. package/dist/tooltip-BJPisf60.js +0 -98
@@ -1,190 +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 { 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 };
@@ -1,379 +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, 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 };
@@ -1,134 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { createContext as t, useContext as n } from "react";
4
- import { vars as r } from "@jfrader/tokens/vars";
5
- import { jsx as i } from "@emotion/react/jsx-runtime";
6
- //#region src/components/card/card.tsx
7
- var a = t(void 0);
8
- function o(...e) {
9
- return e.filter(Boolean).join(" ") || void 0;
10
- }
11
- var s = e({
12
- boxSizing: "border-box",
13
- minInlineSize: 0,
14
- backgroundColor: r.color.surfaceRaised,
15
- border: `1px solid ${r.color.border}`,
16
- borderRadius: r.radius.lg,
17
- paddingBlock: r.space[4],
18
- paddingInline: r.space[5],
19
- fontFamily: r.font.sans,
20
- lineHeight: r.lineHeight.base,
21
- color: r.color.text
22
- }), c = {
23
- flat: e({ boxShadow: "none" }),
24
- raised: e({ boxShadow: r.shadow.raised })
25
- }, l = e({
26
- display: "grid",
27
- gap: r.space[1],
28
- marginBlockEnd: r.space[4]
29
- }), u = e({
30
- margin: 0,
31
- fontSize: r.textSize.md,
32
- fontWeight: r.fontWeight.semibold,
33
- lineHeight: r.lineHeight.tight,
34
- color: r.color.text
35
- }), d = e({
36
- margin: 0,
37
- fontSize: r.textSize.sm,
38
- color: r.color.textMuted
39
- }), f = e({
40
- fontSize: r.textSize.sm,
41
- color: r.color.text
42
- }), p = e({
43
- display: "flex",
44
- flexWrap: "wrap",
45
- alignItems: "center",
46
- justifyContent: "space-between",
47
- gap: r.space[2],
48
- marginBlockStart: r.space[4],
49
- paddingBlockStart: r.space[4],
50
- borderBlockStart: `1px solid ${r.color.borderSubtle}`,
51
- "& > :only-child": { marginInlineStart: "auto" }
52
- });
53
- function m({ ref: e, variant: t = "raised", slotProps: n, className: r, ...l }) {
54
- return /* @__PURE__ */ i(a.Provider, {
55
- value: n,
56
- children: /* @__PURE__ */ i("div", {
57
- ...l,
58
- ref: e,
59
- "data-ui": "card",
60
- "data-variant": t,
61
- className: o(n?.root?.className, r),
62
- css: [
63
- s,
64
- c[t],
65
- n?.root?.css
66
- ]
67
- })
68
- });
69
- }
70
- m.displayName = "Card";
71
- function h({ ref: e, className: t, ...r }) {
72
- let s = n(a)?.header;
73
- return /* @__PURE__ */ i("div", {
74
- ...r,
75
- ref: e,
76
- "data-ui": "card-header",
77
- className: o(s?.className, t),
78
- css: [l, s?.css]
79
- });
80
- }
81
- h.displayName = "Card.Header";
82
- function g({ ref: e, level: t = 3, className: r, ...s }) {
83
- let c = n(a)?.title, l = `h${t}`;
84
- return /* @__PURE__ */ i(l, {
85
- ...s,
86
- ref: e,
87
- "data-ui": "card-title",
88
- className: o(c?.className, r),
89
- css: [u, c?.css]
90
- });
91
- }
92
- g.displayName = "Card.Title";
93
- function _({ ref: e, className: t, ...r }) {
94
- let s = n(a)?.description;
95
- return /* @__PURE__ */ i("p", {
96
- ...r,
97
- ref: e,
98
- "data-ui": "card-description",
99
- className: o(s?.className, t),
100
- css: [d, s?.css]
101
- });
102
- }
103
- _.displayName = "Card.Description";
104
- function v({ ref: e, className: t, ...r }) {
105
- let s = n(a)?.content;
106
- return /* @__PURE__ */ i("div", {
107
- ...r,
108
- ref: e,
109
- "data-ui": "card-content",
110
- className: o(s?.className, t),
111
- css: [f, s?.css]
112
- });
113
- }
114
- v.displayName = "Card.Content";
115
- function y({ ref: e, className: t, ...r }) {
116
- let s = n(a)?.footer;
117
- return /* @__PURE__ */ i("div", {
118
- ...r,
119
- ref: e,
120
- "data-ui": "card-footer",
121
- className: o(s?.className, t),
122
- css: [p, s?.css]
123
- });
124
- }
125
- y.displayName = "Card.Footer";
126
- var b = Object.assign(m, {
127
- Header: h,
128
- Title: g,
129
- Description: _,
130
- Content: v,
131
- Footer: y
132
- });
133
- //#endregion
134
- export { b as t };