@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
package/dist/textarea.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Textarea } from "./textarea-CcGWuntL.js";
2
+ export { t as Textarea } from "./textarea-DyfjtP0A.js";
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import { a as e, n as t, r as n, t as r } from "./sx-Dx9JUKp5.js";
3
+ import { vars as i } from "@jfrader/tokens/vars";
4
+ import { jsx as a } from "@emotion/react/jsx-runtime";
5
+ //#region src/styling/theme.ts
6
+ var o = i;
7
+ //#endregion
8
+ //#region src/components/theme-provider/theme-provider.tsx
9
+ function s({ theme: e = o, children: n }) {
10
+ return /* @__PURE__ */ a(t, {
11
+ theme: e,
12
+ children: n
13
+ });
14
+ }
15
+ s.displayName = "ThemeProvider";
16
+ function c() {
17
+ return e();
18
+ }
19
+ //#endregion
20
+ //#region src/components/theme-root/theme-root.tsx
21
+ var l = n({
22
+ color: i.color.text,
23
+ colorScheme: "dark",
24
+ "&[data-theme=\"light\"]": { colorScheme: "light" }
25
+ });
26
+ function u({ ref: e, theme: t, className: n, sx: i, ...o }) {
27
+ return /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(r, {
28
+ className: n,
29
+ styles: l,
30
+ sx: i,
31
+ children: (n) => /* @__PURE__ */ a("div", {
32
+ "data-ui": "theme-root",
33
+ "data-theme": t ?? "dark",
34
+ ...o,
35
+ ref: e,
36
+ className: n
37
+ })
38
+ }) });
39
+ }
40
+ u.displayName = "ThemeRoot";
41
+ //#endregion
42
+ export { o as i, s as n, c as r, u as t };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as ThemeRoot } from "./theme-root-BRLIA4eb.js";
2
+ export { t as ThemeRoot } from "./theme-root-BiXXvQvr.js";
@@ -0,0 +1,282 @@
1
+ 'use client';
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { n } from "./media-D_eA_I-e.js";
4
+ import { t as r } from "./renderable-DzcIj1Lo.js";
5
+ import { t as i } from "./button-P2e7_44z.js";
6
+ import { createContext as a, useCallback as o, useContext as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
7
+ import { vars as p } from "@jfrader/tokens/vars";
8
+ import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
9
+ import { createPortal as _ } from "react-dom";
10
+ //#region src/components/toast/toast.tsx
11
+ var v = 4, y = 5e3, b = "Dismiss", x = 100, S = "min(380px, calc(100vw - 32px))", C = "3px", w = a(null), T = a(null), E = e({
12
+ position: "fixed",
13
+ insetBlockEnd: 0,
14
+ insetInlineEnd: 0,
15
+ display: "flex",
16
+ flexDirection: "column",
17
+ gap: p.space[2],
18
+ inlineSize: S,
19
+ margin: 0,
20
+ paddingInlineEnd: p.space[4],
21
+ paddingBlockEnd: p.space[4],
22
+ pointerEvents: "none",
23
+ fontFamily: p.font.sans
24
+ }), D = e({
25
+ boxSizing: "border-box",
26
+ display: "grid",
27
+ gridTemplateColumns: "minmax(0, 1fr) auto",
28
+ alignItems: "start",
29
+ gap: p.space[2],
30
+ backgroundColor: p.color.surfaceRaised,
31
+ border: `1px solid ${p.color.border}`,
32
+ borderRadius: p.radius.lg,
33
+ boxShadow: p.shadow.floating,
34
+ padding: p.space[3],
35
+ color: p.color.text,
36
+ lineHeight: p.lineHeight.base,
37
+ pointerEvents: "auto",
38
+ transitionProperty: "opacity, transform",
39
+ transitionDuration: p.motion.duration.base,
40
+ transitionTimingFunction: p.motion.easeStandard,
41
+ "&[data-populated=\"false\"]": { opacity: 0 },
42
+ "&[data-state=\"closing\"]": {
43
+ opacity: 0,
44
+ transform: `translateY(${p.space[2]})`,
45
+ pointerEvents: "none"
46
+ },
47
+ [n]: { transitionDuration: "0s" }
48
+ }), O = {
49
+ neutral: e({ borderInlineStart: `${C} solid ${p.color.borderStrong}` }),
50
+ success: e({ borderInlineStart: `${C} solid ${p.color.success}` }),
51
+ danger: e({ borderInlineStart: `${C} solid ${p.color.danger}` })
52
+ }, k = e({
53
+ display: "grid",
54
+ gap: p.space[1],
55
+ alignSelf: "center",
56
+ minInlineSize: 0
57
+ }), A = e({
58
+ margin: 0,
59
+ fontSize: p.textSize.sm,
60
+ fontWeight: p.fontWeight.semibold
61
+ }), j = e({
62
+ margin: 0,
63
+ fontSize: p.textSize.sm,
64
+ color: p.color.textMuted
65
+ }), M = e({
66
+ gridColumn: 2,
67
+ gridRow: 1,
68
+ inlineSize: "32px",
69
+ paddingInline: 0
70
+ }), N = e({ display: "contents" }), P = e({
71
+ gridColumn: "1 / -1",
72
+ display: "flex",
73
+ gap: p.space[2]
74
+ });
75
+ function F(e) {
76
+ let t = s(T);
77
+ if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
78
+ return t;
79
+ }
80
+ function I() {
81
+ let e = s(w);
82
+ if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
83
+ return e;
84
+ }
85
+ function L({ children: e, max: t = v, duration: n = y, dismissLabel: r = b }) {
86
+ let i = l(), a = d(0), [s, c] = f([]), p = d([]), m = d(/* @__PURE__ */ new Map()), g = Math.max(1, Math.floor(Number.isFinite(t) ? t : v)), _ = o((e, t) => {
87
+ t ? m.current.set(e, t) : m.current.delete(e);
88
+ }, []), x = o((e, t) => {
89
+ let n = new Set(t.filter((e) => e.state === "open").map((e) => m.current.get(e.id)));
90
+ for (let t of e) {
91
+ let e = m.current.get(t.id);
92
+ if (e?.contains(e.ownerDocument.activeElement)) {
93
+ Array.from(e.parentElement?.querySelectorAll("[data-ui=\"toast\"]") ?? []).find((e) => n.has(e))?.querySelector("[data-toast-dismiss]")?.focus();
94
+ break;
95
+ }
96
+ }
97
+ }, []), S = o((e) => {
98
+ a.current += 1;
99
+ let t = `${i}toast-${a.current}`, r = {
100
+ id: t,
101
+ options: {
102
+ ...e,
103
+ duration: e.duration === void 0 ? n : e.duration
104
+ },
105
+ state: "open"
106
+ }, o = p.current, s = [...o, r].slice(-g);
107
+ return x(o.filter((e) => !s.includes(e)), s), p.current = s, c(s), t;
108
+ }, [
109
+ i,
110
+ g,
111
+ n,
112
+ x
113
+ ]), C = o((e) => {
114
+ let t = p.current;
115
+ x(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
116
+ let n = t.map((t) => t.id === e && t.state === "open" ? {
117
+ ...t,
118
+ state: "closing"
119
+ } : t);
120
+ p.current = n, c(n);
121
+ }, [x]), E = o((e) => {
122
+ let t = p.current, n = t.filter((t) => t.id !== e);
123
+ x(t.filter((t) => t.id === e), n), p.current = n, c(n);
124
+ }, [x]), D = u(() => ({
125
+ toast: S,
126
+ dismiss: C
127
+ }), [S, C]), O = u(() => ({
128
+ toasts: s,
129
+ dismiss: C,
130
+ remove: E,
131
+ registerRoot: _,
132
+ dismissLabel: r
133
+ }), [
134
+ s,
135
+ C,
136
+ E,
137
+ _,
138
+ r
139
+ ]);
140
+ return /* @__PURE__ */ h(w.Provider, {
141
+ value: D,
142
+ children: /* @__PURE__ */ h(T.Provider, {
143
+ value: O,
144
+ children: e
145
+ })
146
+ });
147
+ }
148
+ L.displayName = "Toast.Provider";
149
+ function R({ ref: e, className: n, sx: r, ...i }) {
150
+ let { toasts: a } = F("Viewport"), o = d(null), [s, l] = f(null);
151
+ return c(() => {
152
+ l(o.current?.ownerDocument.body ?? null);
153
+ }, []), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
154
+ hidden: !0,
155
+ ref: o
156
+ }), s && _(/* @__PURE__ */ h(t, {
157
+ className: n,
158
+ styles: E,
159
+ sx: r,
160
+ children: (t) => /* @__PURE__ */ h("div", {
161
+ ...i,
162
+ ref: e,
163
+ "data-ui": "toast-viewport",
164
+ className: t,
165
+ children: a.map((e) => /* @__PURE__ */ h(z, { record: e }, e.id))
166
+ })
167
+ }), s)] });
168
+ }
169
+ R.displayName = "Toast.Viewport";
170
+ function z({ record: e }) {
171
+ let { dismiss: t, remove: n, registerRoot: a, dismissLabel: s } = F("Viewport"), { id: l, options: u, state: p } = e, { title: _, description: v, tone: y = "neutral", action: b } = u, S = u.duration, C = d(null), w = o((e) => {
172
+ C.current = e, a(l, e);
173
+ }, [l, a]), [T, E] = f(!1), [I, L] = f(!1), [R, z] = f(!1), V = d(S ?? 0);
174
+ c(() => {
175
+ let e = setTimeout(() => E(!0), x);
176
+ return () => clearTimeout(e);
177
+ }, []);
178
+ let H = T && p === "open" && S !== null && !I && !R;
179
+ return c(() => {
180
+ if (!H) return;
181
+ let e = performance.now(), n = setTimeout(() => t(l), V.current);
182
+ return () => {
183
+ clearTimeout(n), V.current -= performance.now() - e;
184
+ };
185
+ }, [
186
+ H,
187
+ t,
188
+ l
189
+ ]), c(() => {
190
+ if (p !== "closing") return;
191
+ let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], r = !1;
192
+ return Promise.allSettled(t.map((e) => e.finished)).then(() => {
193
+ r || n(l);
194
+ }), () => {
195
+ r = !0;
196
+ };
197
+ }, [
198
+ p,
199
+ n,
200
+ l
201
+ ]), /* @__PURE__ */ g("div", {
202
+ ref: w,
203
+ inert: p === "closing",
204
+ "data-ui": "toast",
205
+ "data-tone": y,
206
+ "data-state": p,
207
+ "data-populated": T,
208
+ onPointerEnter: () => L(!0),
209
+ onPointerLeave: () => L(!1),
210
+ onFocus: () => z(!0),
211
+ onBlur: (e) => {
212
+ e.currentTarget.contains(e.relatedTarget) || z(!1);
213
+ },
214
+ css: [D, O[y]],
215
+ children: [/* @__PURE__ */ h("div", {
216
+ role: y === "danger" ? "alert" : "status",
217
+ "aria-atomic": "true",
218
+ css: k,
219
+ children: T && /* @__PURE__ */ g(m, { children: [r(_) && /* @__PURE__ */ h("div", {
220
+ css: A,
221
+ children: _
222
+ }), r(v) && /* @__PURE__ */ h("div", {
223
+ css: j,
224
+ children: v
225
+ })] })
226
+ }), T && /* @__PURE__ */ g("div", {
227
+ css: N,
228
+ children: [/* @__PURE__ */ h(i, {
229
+ variant: "ghost",
230
+ size: "sm",
231
+ "aria-label": s,
232
+ "data-toast-dismiss": "",
233
+ onClick: () => t(l),
234
+ css: M,
235
+ children: /* @__PURE__ */ h(B, {})
236
+ }), b && /* @__PURE__ */ h("div", {
237
+ css: P,
238
+ children: /* @__PURE__ */ h(i, {
239
+ variant: "outline",
240
+ size: "sm",
241
+ onClick: (e) => {
242
+ b?.onClick(e), e.defaultPrevented || t(l);
243
+ },
244
+ children: b.label
245
+ })
246
+ })]
247
+ })]
248
+ });
249
+ }
250
+ function B() {
251
+ return /* @__PURE__ */ g("svg", {
252
+ "aria-hidden": "true",
253
+ viewBox: "0 0 16 16",
254
+ width: "16",
255
+ height: "16",
256
+ fill: "none",
257
+ stroke: "currentColor",
258
+ strokeWidth: "2",
259
+ strokeLinecap: "round",
260
+ children: [/* @__PURE__ */ h("line", {
261
+ x1: "4",
262
+ y1: "4",
263
+ x2: "12",
264
+ y2: "12"
265
+ }), /* @__PURE__ */ h("line", {
266
+ x1: "12",
267
+ y1: "4",
268
+ x2: "4",
269
+ y2: "12"
270
+ })]
271
+ });
272
+ }
273
+ function V(e) {
274
+ return /* @__PURE__ */ h(L, { ...e });
275
+ }
276
+ V.displayName = "Toast";
277
+ var H = Object.assign(V, {
278
+ Provider: L,
279
+ Viewport: R
280
+ });
281
+ //#endregion
282
+ export { I as n, H as t };
package/dist/toast.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Toast, n as useToast } from "./toast-B1PXuwZ4.js";
2
+ export { t as Toast, n as useToast } from "./toast-iqelR-r0.js";
@@ -0,0 +1,166 @@
1
+ 'use client';
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { t as n } from "./focus-ring-BK5W5_NY.js";
4
+ import { n as r, t as i } from "./media-D_eA_I-e.js";
5
+ import { n as a, r as o, t as s } from "./roving-focus-CYlo_Kf8.js";
6
+ import { t as c } from "./use-controlled-state-CVXDa-qM.js";
7
+ import { createContext as l, useContext as u, useEffect as d, useImperativeHandle as f, useMemo as p, useRef as m, useState as h } from "react";
8
+ import { vars as g } from "@jfrader/tokens/vars";
9
+ import { jsx as _ } from "@emotion/react/jsx-runtime";
10
+ //#region src/components/toggle-group/toggle-group.tsx
11
+ var v = l(null);
12
+ function y(e) {
13
+ let t = u(v);
14
+ if (!t) throw Error(`ToggleGroup.${e} must be rendered inside <ToggleGroup>.`);
15
+ return t;
16
+ }
17
+ var b = [], x = (e, t) => {
18
+ if (Array.isArray(e)) {
19
+ if (t === "multiple") return e;
20
+ e = e[0] ?? "";
21
+ }
22
+ return e === void 0 || e === "" ? b : [e];
23
+ }, S = {
24
+ itemSelector: "[data-ui=\"toggle-group-item\"]:not([disabled])",
25
+ ownerSelector: "[data-ui=\"toggle-group-root\"]"
26
+ }, C = "2px", w = e({
27
+ display: "inline-flex",
28
+ gap: C,
29
+ padding: C,
30
+ border: `1px solid ${g.color.borderControl}`,
31
+ borderRadius: g.radius.md,
32
+ backgroundColor: g.color.surfaceInset
33
+ }), T = {
34
+ horizontal: e({ flexDirection: "row" }),
35
+ vertical: e({
36
+ flexDirection: "column",
37
+ alignItems: "stretch"
38
+ })
39
+ }, E = e({
40
+ appearance: "none",
41
+ display: "inline-flex",
42
+ alignItems: "center",
43
+ justifyContent: "center",
44
+ gap: g.space[2],
45
+ minBlockSize: "32px",
46
+ boxSizing: "border-box",
47
+ border: "1px solid transparent",
48
+ borderRadius: g.radius.sm,
49
+ background: "transparent",
50
+ cursor: "pointer",
51
+ paddingBlock: g.space[1],
52
+ paddingInline: g.space[3],
53
+ font: "inherit",
54
+ fontSize: g.textSize.sm,
55
+ fontWeight: g.fontWeight.medium,
56
+ color: g.color.textMuted,
57
+ transitionProperty: "background-color, border-color, color",
58
+ transitionDuration: g.motion.duration.fast,
59
+ transitionTimingFunction: g.motion.easeStandard,
60
+ "&:hover:not(:disabled):not([aria-pressed=\"true\"])": {
61
+ backgroundColor: g.color.surfaceHover,
62
+ color: g.color.text
63
+ },
64
+ "&[aria-pressed=\"true\"]": {
65
+ backgroundColor: g.color.accentSoft,
66
+ borderColor: g.color.accent,
67
+ color: g.color.accentText
68
+ },
69
+ "&[aria-pressed=\"true\"]:hover:not(:disabled)": { backgroundColor: g.color.accentSoftHover },
70
+ "&:disabled": {
71
+ opacity: .55,
72
+ cursor: "not-allowed"
73
+ },
74
+ "&:focus-visible": { ...n },
75
+ [r]: { transitionDuration: "0s" },
76
+ [i]: { "&[aria-pressed=\"true\"]": {
77
+ backgroundColor: "SelectedItem",
78
+ borderColor: "SelectedItem",
79
+ color: "SelectedItemText"
80
+ } }
81
+ });
82
+ function D({ ref: e, type: n = "single", value: r, defaultValue: i, onValueChange: l, orientation: u = "horizontal", disabled: g = !1, allowEmpty: y = !1, label: b, "aria-label": C, onKeyDown: E, className: D, sx: O, ...k }) {
83
+ let [A, j] = c(r, i, l), [M, N] = h(null), P = m(null);
84
+ f(e, () => P.current, []);
85
+ let F = p(() => x(A, n), [A, n]), I = p(() => ({
86
+ pressed: F,
87
+ toggle: (e) => {
88
+ let t = F.includes(e);
89
+ n === "multiple" ? j(t ? F.filter((t) => t !== e) : [...F, e]) : t ? y && j("") : j(e);
90
+ },
91
+ focused: M,
92
+ setFocused: N,
93
+ disabled: g
94
+ }), [
95
+ F,
96
+ j,
97
+ n,
98
+ y,
99
+ M,
100
+ g
101
+ ]);
102
+ d(() => {
103
+ let e = P.current;
104
+ if (!e) return;
105
+ let t = o(e, S);
106
+ if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
107
+ let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
108
+ N((n ?? s(t, M) ?? t[0])?.dataset.value ?? null);
109
+ });
110
+ let L = (e) => {
111
+ E?.(e);
112
+ let t = P.current;
113
+ !e.defaultPrevented && t && a(e, t, u, S);
114
+ };
115
+ return /* @__PURE__ */ _(v.Provider, {
116
+ value: I,
117
+ children: /* @__PURE__ */ _(t, {
118
+ className: D,
119
+ styles: [w, T[u]],
120
+ sx: O,
121
+ children: (e) => /* @__PURE__ */ _("div", {
122
+ ...k,
123
+ ref: P,
124
+ role: "group",
125
+ "aria-label": b ?? C,
126
+ "aria-disabled": g || void 0,
127
+ "data-ui": "toggle-group-root",
128
+ "data-type": n,
129
+ "data-orientation": u,
130
+ onKeyDown: L,
131
+ className: e
132
+ })
133
+ })
134
+ });
135
+ }
136
+ D.displayName = "ToggleGroup";
137
+ function O({ ref: e, value: n, disabled: r, onClick: i, onFocus: a, className: o, sx: s, ...c }) {
138
+ let { pressed: l, toggle: u, focused: d, setFocused: f, disabled: p } = y("Item"), m = p || r, h = l.includes(n), g = !m && (d === null ? l[0] === n : d === n), v = (e) => {
139
+ i?.(e), !e.defaultPrevented && u(n);
140
+ }, b = (e) => {
141
+ a?.(e), f(n);
142
+ };
143
+ return /* @__PURE__ */ _(t, {
144
+ className: o,
145
+ styles: E,
146
+ sx: s,
147
+ children: (t) => /* @__PURE__ */ _("button", {
148
+ ...c,
149
+ ref: e,
150
+ type: "button",
151
+ "aria-pressed": h,
152
+ "data-ui": "toggle-group-item",
153
+ "data-value": n,
154
+ "data-state": h ? "on" : "off",
155
+ tabIndex: g ? 0 : -1,
156
+ disabled: m,
157
+ onClick: v,
158
+ onFocus: b,
159
+ className: t
160
+ })
161
+ });
162
+ }
163
+ O.displayName = "ToggleGroup.Item";
164
+ var k = Object.assign(D, { Item: O });
165
+ //#endregion
166
+ export { k as t };
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as ToggleGroup } from "./toggle-group-N_owicT0.js";
2
+ export { t as ToggleGroup } from "./toggle-group-CI0e7hFm.js";
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { t as n } from "./use-controlled-state-CVXDa-qM.js";
4
+ import { t as r } from "./trigger-style-B1KVC8O1.js";
5
+ import { t as i } from "./use-overlay-floating-efeqppiw.js";
6
+ import { createContext as a, useContext as o, useMemo as s } from "react";
7
+ import { vars as c } from "@jfrader/tokens/vars";
8
+ import { jsx as l } from "@emotion/react/jsx-runtime";
9
+ import { FloatingPortal as u, useDismiss as d, useFocus as f, useHover as p, useInteractions as m, useMergeRefs as h, useRole as g } from "@floating-ui/react";
10
+ //#region src/components/tooltip/tooltip.tsx
11
+ var _ = 300, v = 100, y = a(null);
12
+ function b(e) {
13
+ let t = o(y);
14
+ if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
15
+ return t;
16
+ }
17
+ var x = e({
18
+ boxSizing: "border-box",
19
+ backgroundColor: c.color.bgSoft,
20
+ border: `1px solid ${c.color.border}`,
21
+ borderRadius: c.radius.sm,
22
+ boxShadow: c.shadow.raised,
23
+ padding: `${c.space[1]} ${c.space[2]}`,
24
+ maxInlineSize: "260px",
25
+ color: c.color.text,
26
+ fontFamily: c.font.sans,
27
+ fontSize: c.textSize.sm,
28
+ lineHeight: c.lineHeight.base
29
+ });
30
+ function S({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: a = "top", openDelay: o = _, closeDelay: c = v, children: u }) {
31
+ let [h = !1, b] = n(e, t, r), { refs: x, floatingStyles: S, context: C } = i({
32
+ open: h,
33
+ placement: a,
34
+ onOpenChange: b
35
+ }), w = p(C, {
36
+ delay: {
37
+ open: o,
38
+ close: c
39
+ },
40
+ move: !1
41
+ }), T = f(C), E = d(C, { escapeKey: !0 }), D = g(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = m([
42
+ w,
43
+ T,
44
+ E,
45
+ D
46
+ ]), A = s(() => ({
47
+ open: h,
48
+ refs: x,
49
+ floatingStyles: S,
50
+ getReferenceProps: O,
51
+ getFloatingProps: k
52
+ }), [
53
+ h,
54
+ x,
55
+ S,
56
+ O,
57
+ k
58
+ ]);
59
+ return /* @__PURE__ */ l(y.Provider, {
60
+ value: A,
61
+ children: u
62
+ });
63
+ }
64
+ S.displayName = "Tooltip";
65
+ function C({ ref: e, "aria-describedby": n, className: i, sx: a, ...o }) {
66
+ let { refs: s, getReferenceProps: c } = b("Trigger"), u = h([s.setReference, e]), d = c(o), f = [n, d["aria-describedby"]].filter(Boolean).join(" ") || void 0;
67
+ return /* @__PURE__ */ l(t, {
68
+ className: i,
69
+ styles: r,
70
+ sx: a,
71
+ children: (e) => /* @__PURE__ */ l("button", {
72
+ type: "button",
73
+ ...d,
74
+ ref: u,
75
+ "aria-describedby": f,
76
+ "data-ui": "tooltip-trigger",
77
+ className: e
78
+ })
79
+ });
80
+ }
81
+ C.displayName = "Tooltip.Trigger";
82
+ function w({ ref: e, style: n, className: r, sx: i, ...a }) {
83
+ let { open: o, refs: s, floatingStyles: c, getFloatingProps: d } = b("Content"), f = h([s.setFloating, e]);
84
+ if (!o) return null;
85
+ let { tabIndex: p, ...m } = d(a);
86
+ return /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l(t, {
87
+ className: r,
88
+ styles: x,
89
+ sx: i,
90
+ children: (e) => /* @__PURE__ */ l("div", {
91
+ ...m,
92
+ ref: f,
93
+ "data-ui": "tooltip",
94
+ style: {
95
+ ...n,
96
+ ...c
97
+ },
98
+ className: e
99
+ })
100
+ }) });
101
+ }
102
+ w.displayName = "Tooltip.Content";
103
+ var T = Object.assign(S, {
104
+ Trigger: C,
105
+ Content: w
106
+ });
107
+ //#endregion
108
+ export { T as t };
package/dist/tooltip.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Tooltip } from "./tooltip-BJPisf60.js";
2
+ export { t as Tooltip } from "./tooltip-CB-HC1js.js";
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
2
+ import { r as e } from "./sx-Dx9JUKp5.js";
3
3
  import { vars as t } from "@jfrader/tokens/vars";
4
4
  //#region src/styling/trigger-style.ts
5
5
  var n = e({
@@ -1,7 +1,8 @@
1
1
  import { type ComponentPropsWithRef } from 'react';
2
+ import { type SxProps } from '../../styling/sx';
2
3
  export type AccordionType = 'single' | 'multiple';
3
4
  export type AccordionValue = string | string[];
4
- interface AccordionBaseProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'defaultValue'> {
5
+ interface AccordionBaseProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'defaultValue'>, SxProps {
5
6
  /** Allow closing the last open panel. */
6
7
  collapsible?: boolean;
7
8
  }
@@ -19,16 +20,16 @@ export interface AccordionMultipleProps extends AccordionBaseProps {
19
20
  onValueChange?: (value: string[]) => void;
20
21
  }
21
22
  export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
22
- export interface AccordionItemProps extends ComponentPropsWithRef<'div'> {
23
+ export interface AccordionItemProps extends ComponentPropsWithRef<'div'>, SxProps {
23
24
  value: string;
24
25
  disabled?: boolean;
25
26
  }
26
- export type AccordionTriggerProps = ComponentPropsWithRef<'button'>;
27
- export type AccordionPanelProps = ComponentPropsWithRef<'div'>;
28
- declare function AccordionRoot({ ref, value: valueProp, defaultValue, onValueChange, type, collapsible, onKeyDown, ...rest }: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
29
- declare function AccordionItem({ ref, value, disabled, ...rest }: AccordionItemProps): import("@emotion/react/jsx-runtime").JSX.Element;
30
- declare function AccordionTrigger({ ref, onClick, disabled: disabledProp, ...rest }: AccordionTriggerProps): import("@emotion/react/jsx-runtime").JSX.Element;
31
- declare function AccordionPanel({ ref, 'aria-labelledby': ariaLabelledByProp, ...rest }: AccordionPanelProps): import("@emotion/react/jsx-runtime").JSX.Element;
27
+ export type AccordionTriggerProps = ComponentPropsWithRef<'button'> & SxProps;
28
+ export type AccordionPanelProps = ComponentPropsWithRef<'div'> & SxProps;
29
+ declare function AccordionRoot({ ref, value: valueProp, defaultValue, onValueChange, type, collapsible, onKeyDown, className, sx, ...rest }: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
30
+ declare function AccordionItem({ ref, value, disabled, className, sx, ...rest }: AccordionItemProps): import("@emotion/react/jsx-runtime").JSX.Element;
31
+ declare function AccordionTrigger({ ref, onClick, disabled: disabledProp, className, sx, ...rest }: AccordionTriggerProps): import("@emotion/react/jsx-runtime").JSX.Element;
32
+ declare function AccordionPanel({ ref, 'aria-labelledby': ariaLabelledByProp, className, sx, ...rest }: AccordionPanelProps): import("@emotion/react/jsx-runtime").JSX.Element;
32
33
  export declare const Accordion: typeof AccordionRoot & {
33
34
  Item: typeof AccordionItem;
34
35
  Trigger: typeof AccordionTrigger;
@@ -1,11 +1,12 @@
1
1
  import type { ComponentPropsWithRef, ReactNode } from 'react';
2
2
  import { type Interpolation, type Theme } from '../../styling/css';
3
+ import { type SxProps } from '../../styling/sx';
3
4
  export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
4
5
  export interface AlertPartProps {
5
6
  className?: string;
6
7
  css?: Interpolation<Theme>;
7
8
  }
8
- export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'role'> {
9
+ export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'role'>, SxProps {
9
10
  tone?: AlertTone;
10
11
  /** Announced tone word. Put visible meaning in the title text. */
11
12
  toneLabel?: string;
@@ -20,7 +21,7 @@ export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title' |
20
21
  dismiss?: AlertPartProps;
21
22
  };
22
23
  }
23
- export declare function Alert({ ref, tone, toneLabel, title, children, onDismiss, dismissLabel, slotProps, className, ...rest }: AlertProps): import("@emotion/react/jsx-runtime").JSX.Element;
24
+ export declare function Alert({ ref, tone, toneLabel, title, children, onDismiss, dismissLabel, slotProps, className, sx, ...rest }: AlertProps): import("@emotion/react/jsx-runtime").JSX.Element;
24
25
  export declare namespace Alert {
25
26
  var displayName: string;
26
27
  }