@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
@@ -0,0 +1,86 @@
1
+ 'use client';
2
+ import { r as e } from "./sx-Dx9JUKp5.js";
3
+ import { a as t, i as n, n as r, o as i, r as a, t as o } from "./field-anatomy-D2ToMeRa.js";
4
+ import { vars as s } from "@jfrader/tokens/vars";
5
+ import { jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
6
+ //#region src/components/textarea/textarea.tsx
7
+ var u = e({
8
+ paddingBlock: s.space[2],
9
+ lineHeight: s.lineHeight.base
10
+ }), d = {
11
+ sm: e({
12
+ minBlockSize: "64px",
13
+ paddingInline: s.space[3],
14
+ fontSize: s.textSize.sm
15
+ }),
16
+ md: e({
17
+ minBlockSize: "80px",
18
+ paddingInline: s.space[4],
19
+ fontSize: s.textSize.sm
20
+ }),
21
+ lg: e({
22
+ minBlockSize: "96px",
23
+ paddingInline: s.space[4],
24
+ fontSize: s.textSize.md
25
+ })
26
+ }, f = {
27
+ none: e({ resize: "none" }),
28
+ vertical: e({ resize: "vertical" })
29
+ }, p = e({ fieldSizing: "content" });
30
+ function m({ ref: e, label: s, description: m, error: h, size: g = "md", resize: _ = "vertical", autoResize: v = !1, rows: y = 3, onChange: b, onValueChange: x, slotProps: S, className: C, sx: w, required: T, id: E, "aria-describedby": D, "aria-invalid": O, ...k }) {
31
+ let A = t({
32
+ id: E,
33
+ description: m,
34
+ error: h,
35
+ "aria-describedby": D,
36
+ "aria-invalid": O
37
+ }), j = (e) => {
38
+ b?.(e), x?.(e.currentTarget.value);
39
+ };
40
+ return /* @__PURE__ */ l(n, {
41
+ "data-ui": "textarea",
42
+ className: C,
43
+ sx: w,
44
+ part: S?.root,
45
+ children: [
46
+ /* @__PURE__ */ c(a, {
47
+ htmlFor: A.id,
48
+ required: T,
49
+ part: S?.label,
50
+ children: s
51
+ }),
52
+ /* @__PURE__ */ c("textarea", {
53
+ ...k,
54
+ ref: e,
55
+ id: A.id,
56
+ rows: y,
57
+ required: T,
58
+ "aria-describedby": A.describedBy,
59
+ "aria-invalid": A.ariaInvalid,
60
+ onChange: j,
61
+ className: S?.control?.className,
62
+ css: [
63
+ i,
64
+ u,
65
+ d[g],
66
+ f[_],
67
+ v && p,
68
+ S?.control?.css
69
+ ]
70
+ }),
71
+ /* @__PURE__ */ c(o, {
72
+ id: A.descriptionId,
73
+ part: S?.description,
74
+ children: m
75
+ }),
76
+ /* @__PURE__ */ c(r, {
77
+ id: A.errorId,
78
+ part: S?.error,
79
+ children: h
80
+ })
81
+ ]
82
+ });
83
+ }
84
+ m.displayName = "Textarea";
85
+ //#endregion
86
+ export { m as t };
package/dist/textarea.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Textarea } from "./textarea-OP8_3IUR.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-eLka0ZP1.js";
2
+ export { t as ThemeRoot } from "./theme-root-BiXXvQvr.js";
@@ -1,14 +1,14 @@
1
1
  'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { n as t } from "./media-D_eA_I-e.js";
4
- import { t as n } from "./renderable-DzcIj1Lo.js";
5
- import { t as r } from "./button-Cmixur4Q.js";
6
- import { createContext as i, forwardRef 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";
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
7
  import { vars as p } from "@jfrader/tokens/vars";
8
8
  import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
9
9
  import { createPortal as _ } from "react-dom";
10
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 = i(null), T = i(null), E = e({
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
12
  position: "fixed",
13
13
  insetBlockEnd: 0,
14
14
  insetInlineEnd: 0,
@@ -44,7 +44,7 @@ var v = 4, y = 5e3, b = "Dismiss", x = 100, S = "min(380px, calc(100vw - 32px))"
44
44
  transform: `translateY(${p.space[2]})`,
45
45
  pointerEvents: "none"
46
46
  },
47
- [t]: { transitionDuration: "0s" }
47
+ [n]: { transitionDuration: "0s" }
48
48
  }), O = {
49
49
  neutral: e({ borderInlineStart: `${C} solid ${p.color.borderStrong}` }),
50
50
  success: e({ borderInlineStart: `${C} solid ${p.color.success}` }),
@@ -145,23 +145,30 @@ function L({ children: e, max: t = v, duration: n = y, dismissLabel: r = b }) {
145
145
  })
146
146
  });
147
147
  }
148
- var R = a(function(e, t) {
149
- let { toasts: n } = F("Viewport"), r = d(null), [i, a] = f(null);
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);
150
151
  return c(() => {
151
- a(r.current?.ownerDocument.body ?? null);
152
+ l(o.current?.ownerDocument.body ?? null);
152
153
  }, []), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
153
154
  hidden: !0,
154
- ref: r
155
- }), i && _(/* @__PURE__ */ h("div", {
156
- ...e,
157
- ref: t,
158
- "data-ui": "toast-viewport",
159
- css: E,
160
- children: n.map((e) => /* @__PURE__ */ h(z, { record: e }, e.id))
161
- }), i)] });
162
- });
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";
163
170
  function z({ record: e }) {
164
- let { dismiss: t, remove: i, 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) => {
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) => {
165
172
  C.current = e, a(l, e);
166
173
  }, [l, a]), [T, E] = f(!1), [I, L] = f(!1), [R, z] = f(!1), V = d(S ?? 0);
167
174
  c(() => {
@@ -181,15 +188,15 @@ function z({ record: e }) {
181
188
  l
182
189
  ]), c(() => {
183
190
  if (p !== "closing") return;
184
- let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
191
+ let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], r = !1;
185
192
  return Promise.allSettled(t.map((e) => e.finished)).then(() => {
186
- n || i(l);
193
+ r || n(l);
187
194
  }), () => {
188
- n = !0;
195
+ r = !0;
189
196
  };
190
197
  }, [
191
198
  p,
192
- i,
199
+ n,
193
200
  l
194
201
  ]), /* @__PURE__ */ g("div", {
195
202
  ref: w,
@@ -209,16 +216,16 @@ function z({ record: e }) {
209
216
  role: y === "danger" ? "alert" : "status",
210
217
  "aria-atomic": "true",
211
218
  css: k,
212
- children: T && /* @__PURE__ */ g(m, { children: [n(_) && /* @__PURE__ */ h("div", {
219
+ children: T && /* @__PURE__ */ g(m, { children: [r(_) && /* @__PURE__ */ h("div", {
213
220
  css: A,
214
221
  children: _
215
- }), n(v) && /* @__PURE__ */ h("div", {
222
+ }), r(v) && /* @__PURE__ */ h("div", {
216
223
  css: j,
217
224
  children: v
218
225
  })] })
219
226
  }), T && /* @__PURE__ */ g("div", {
220
227
  css: N,
221
- children: [/* @__PURE__ */ h(r, {
228
+ children: [/* @__PURE__ */ h(i, {
222
229
  variant: "ghost",
223
230
  size: "sm",
224
231
  "aria-label": s,
@@ -228,7 +235,7 @@ function z({ record: e }) {
228
235
  children: /* @__PURE__ */ h(B, {})
229
236
  }), b && /* @__PURE__ */ h("div", {
230
237
  css: P,
231
- children: /* @__PURE__ */ h(r, {
238
+ children: /* @__PURE__ */ h(i, {
232
239
  variant: "outline",
233
240
  size: "sm",
234
241
  onClick: (e) => {
@@ -263,9 +270,13 @@ function B() {
263
270
  })]
264
271
  });
265
272
  }
266
- var V = Object.assign(L, {
273
+ function V(e) {
274
+ return /* @__PURE__ */ h(L, { ...e });
275
+ }
276
+ V.displayName = "Toast";
277
+ var H = Object.assign(V, {
267
278
  Provider: L,
268
279
  Viewport: R
269
280
  });
270
281
  //#endregion
271
- export { I as n, V as t };
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-D3Y6OAsg.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-BxzJ-6Cp.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-CVl8HS4S.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
- import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
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<HTMLAttributes<HTMLDivElement>, '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,15 +20,19 @@ 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 HTMLAttributes<HTMLDivElement> {
23
+ export interface AccordionItemProps extends ComponentPropsWithRef<'div'>, SxProps {
23
24
  value: string;
24
25
  disabled?: boolean;
25
26
  }
26
- export type AccordionTriggerProps = ButtonHTMLAttributes<HTMLButtonElement>;
27
- export type AccordionPanelProps = HTMLAttributes<HTMLDivElement>;
28
- export declare const Accordion: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>> & {
29
- Item: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
30
- Trigger: import("react").ForwardRefExoticComponent<AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
31
- Panel: import("react").ForwardRefExoticComponent<AccordionPanelProps & import("react").RefAttributes<HTMLDivElement>>;
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;
33
+ export declare const Accordion: typeof AccordionRoot & {
34
+ Item: typeof AccordionItem;
35
+ Trigger: typeof AccordionTrigger;
36
+ Panel: typeof AccordionPanel;
32
37
  };
33
38
  export {};
@@ -1,11 +1,12 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
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<HTMLAttributes<HTMLDivElement>, '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,4 +21,7 @@ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
20
21
  dismiss?: AlertPartProps;
21
22
  };
22
23
  }
23
- export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
24
+ export declare function Alert({ ref, tone, toneLabel, title, children, onDismiss, dismissLabel, slotProps, className, sx, ...rest }: AlertProps): import("@emotion/react/jsx-runtime").JSX.Element;
25
+ export declare namespace Alert {
26
+ var displayName: string;
27
+ }
@@ -1,12 +1,13 @@
1
- import { type HTMLAttributes } from 'react';
1
+ import { type ComponentPropsWithRef } from 'react';
2
2
  import { type Interpolation, type Theme } from '../../styling/css';
3
+ import { type SxProps } from '../../styling/sx';
3
4
  export type AvatarSize = 'sm' | 'md' | 'lg';
4
5
  export type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';
5
6
  export interface AvatarPartProps {
6
7
  className?: string;
7
8
  css?: Interpolation<Theme>;
8
9
  }
9
- export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'role' | 'aria-label'> {
10
+ export interface AvatarProps extends Omit<ComponentPropsWithRef<'span'>, 'children' | 'role' | 'aria-label'>, SxProps {
10
11
  /** Used for the accessible name and the initials fallback. */
11
12
  name: string;
12
13
  src?: string;
@@ -20,4 +21,7 @@ export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'chil
20
21
  status?: AvatarPartProps;
21
22
  };
22
23
  }
23
- export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
24
+ export declare function Avatar({ ref, name, src, size, status, statusLabel, slotProps, className, sx, ...rest }: AvatarProps): import("@emotion/react/jsx-runtime").JSX.Element;
25
+ export declare namespace Avatar {
26
+ var displayName: string;
27
+ }