@jfrader/ui 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +3 -1
  2. package/dist/accordion-CkOZ-tvs.js +178 -0
  3. package/dist/accordion.js +2 -1
  4. package/dist/alert-Dsjx14UW.js +131 -0
  5. package/dist/alert.js +2 -1
  6. package/dist/avatar-BRGKkoSr.js +127 -0
  7. package/dist/avatar.js +2 -1
  8. package/dist/badge-DLxUMsCx.js +104 -0
  9. package/dist/badge.js +2 -1
  10. package/dist/breadcrumbs-694hF_hm.js +131 -0
  11. package/dist/breadcrumbs.js +2 -1
  12. package/dist/button-CoaIcykB.js +190 -0
  13. package/dist/button.js +2 -1
  14. package/dist/calendar-Doj7PTdG.js +379 -0
  15. package/dist/calendar.js +2 -1
  16. package/dist/card-2IM71XZj.js +134 -0
  17. package/dist/card.js +2 -1
  18. package/dist/checkbox-B7xGNFzp.js +136 -0
  19. package/dist/checkbox.js +2 -1
  20. package/dist/{choice-control-DCyQ_hVw.js → choice-control-ByFogYcT.js} +2 -1
  21. package/dist/{collection-registry-C2jnQa7X.js → collection-registry-1l9f3XJZ.js} +3 -2
  22. package/dist/combobox-Bjhxv5U3.js +311 -0
  23. package/dist/combobox.js +2 -1
  24. package/dist/command-palette-BhJwm6cS.js +344 -0
  25. package/dist/command-palette.js +2 -1
  26. package/dist/container-BhnrGPu-.js +36 -0
  27. package/dist/container.js +2 -1
  28. package/dist/{css-CW_HG55W.js → css-Cgj6sCHn.js} +1 -0
  29. package/dist/date-picker-Jk8SpoiO.js +245 -0
  30. package/dist/date-picker.js +2 -1
  31. package/dist/dialog-fhS07G41.js +187 -0
  32. package/dist/dialog.js +2 -1
  33. package/dist/{disclosure-caret-BC6P8AsM.js → disclosure-caret-C5T3fcl6.js} +1 -0
  34. package/dist/divider-v_78HYF5.js +79 -0
  35. package/dist/divider.js +2 -1
  36. package/dist/{field-anatomy-DKkB268x.js → field-anatomy-BzGw1Ch9.js} +4 -3
  37. package/dist/flex-COZzFqI8.js +22 -0
  38. package/dist/flex.js +2 -1
  39. package/dist/{focus-ring-qOS3rPlM.js → focus-ring-BK5W5_NY.js} +1 -0
  40. package/dist/{icon-wrapper-BKo4FI-O.js → icon-wrapper-CFWzew5m.js} +2 -1
  41. package/dist/index.js +37 -36
  42. package/dist/kbd-CeP8Kfvp.js +61 -0
  43. package/dist/kbd.js +2 -1
  44. package/dist/{layout-style-B_6YHQ6Q.js → layout-style-7ZTOiWGR.js} +2 -1
  45. package/dist/{loading-ring-CTpT-IrT.js → loading-ring-BpdB0aFi.js} +2 -1
  46. package/dist/{media-8K3xDAxM.js → media-D_eA_I-e.js} +1 -0
  47. package/dist/menu-B6KCbLCr.js +196 -0
  48. package/dist/menu.js +2 -1
  49. package/dist/navigation-BDht6S2-.js +182 -0
  50. package/dist/navigation.js +2 -1
  51. package/dist/pagination-B50PCaDU.js +151 -0
  52. package/dist/pagination.js +2 -1
  53. package/dist/{part-id-Bg1LSlk7.js → part-id-D0zksy32.js} +1 -0
  54. package/dist/pill-2_XzBdkD.js +51 -0
  55. package/dist/pill.js +2 -1
  56. package/dist/popover-DRHbeIVq.js +103 -0
  57. package/dist/popover.js +2 -1
  58. package/dist/progress-CpsskKTD.js +85 -0
  59. package/dist/progress.js +2 -1
  60. package/dist/radio-group-DPI5KUCj.js +136 -0
  61. package/dist/radio-group.js +2 -1
  62. package/dist/{renderable-DwPvt1I8.js → renderable-DzcIj1Lo.js} +1 -0
  63. package/dist/{roving-focus-DeEZ55-T.js → roving-focus-CYlo_Kf8.js} +1 -0
  64. package/dist/select-C1xGrOhT.js +266 -0
  65. package/dist/select.js +2 -1
  66. package/dist/skeleton-DitdP-yz.js +49 -0
  67. package/dist/skeleton.js +2 -1
  68. package/dist/spinner-CFq5HPoo.js +51 -0
  69. package/dist/spinner.js +2 -1
  70. package/dist/stack-D_g6NJzo.js +21 -0
  71. package/dist/stack.js +2 -1
  72. package/dist/{surface-Bo_aSQOb.js → surface-DZ4d-2aL.js} +1 -0
  73. package/dist/switch-B5TTU-oJ.js +138 -0
  74. package/dist/switch.js +2 -1
  75. package/dist/tabs-C26PWl2c.js +183 -0
  76. package/dist/tabs.js +2 -1
  77. package/dist/text-field-8PQAqRpM.js +75 -0
  78. package/dist/text-field.js +2 -1
  79. package/dist/textarea-CcGWuntL.js +85 -0
  80. package/dist/textarea.js +2 -1
  81. package/dist/theme-root-BRLIA4eb.js +22 -0
  82. package/dist/theme-root.js +2 -1
  83. package/dist/toast-B1PXuwZ4.js +277 -0
  84. package/dist/toast.js +2 -1
  85. package/dist/toggle-group-N_owicT0.js +156 -0
  86. package/dist/toggle-group.js +2 -1
  87. package/dist/tooltip-BJPisf60.js +98 -0
  88. package/dist/tooltip.js +2 -1
  89. package/dist/{trigger-style-f54idgjT.js → trigger-style-B1GFmH7M.js} +2 -1
  90. package/dist/types/components/accordion/accordion.d.ts +13 -9
  91. package/dist/types/components/alert/alert.d.ts +6 -3
  92. package/dist/types/components/avatar/avatar.d.ts +6 -3
  93. package/dist/types/components/badge/badge.d.ts +6 -3
  94. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +8 -5
  95. package/dist/types/components/button/button.d.ts +6 -3
  96. package/dist/types/components/calendar/calendar.d.ts +11 -7
  97. package/dist/types/components/card/card.d.ts +20 -13
  98. package/dist/types/components/checkbox/checkbox.d.ts +6 -3
  99. package/dist/types/components/combobox/combobox.d.ts +12 -8
  100. package/dist/types/components/command-palette/command-palette.d.ts +22 -15
  101. package/dist/types/components/container/container.d.ts +6 -3
  102. package/dist/types/components/date-picker/date-picker.d.ts +6 -4
  103. package/dist/types/components/dialog/dialog.d.ts +16 -11
  104. package/dist/types/components/divider/divider.d.ts +6 -3
  105. package/dist/types/components/flex/flex.d.ts +6 -3
  106. package/dist/types/components/kbd/kbd.d.ts +8 -5
  107. package/dist/types/components/menu/menu.d.ts +13 -9
  108. package/dist/types/components/navigation/navigation.d.ts +11 -7
  109. package/dist/types/components/pagination/pagination.d.ts +6 -3
  110. package/dist/types/components/pill/pill.d.ts +6 -3
  111. package/dist/types/components/popover/popover.d.ts +7 -5
  112. package/dist/types/components/progress/progress.d.ts +6 -3
  113. package/dist/types/components/radio-group/radio-group.d.ts +8 -5
  114. package/dist/types/components/select/select.d.ts +13 -9
  115. package/dist/types/components/skeleton/skeleton.d.ts +6 -3
  116. package/dist/types/components/spinner/spinner.d.ts +6 -3
  117. package/dist/types/components/stack/stack.d.ts +4 -1
  118. package/dist/types/components/switch/switch.d.ts +6 -3
  119. package/dist/types/components/tabs/tabs.d.ts +14 -9
  120. package/dist/types/components/text-field/text-field.d.ts +6 -3
  121. package/dist/types/components/textarea/textarea.d.ts +6 -3
  122. package/dist/types/components/theme-root/theme-root.d.ts +6 -3
  123. package/dist/types/components/toast/toast.d.ts +6 -4
  124. package/dist/types/components/toggle-group/toggle-group.d.ts +7 -5
  125. package/dist/types/components/tooltip/tooltip.d.ts +7 -5
  126. package/dist/types/overlay/use-native-dialog.d.ts +2 -2
  127. package/dist/{use-controlled-state-DQXkiTQI.js → use-controlled-state-CVXDa-qM.js} +1 -0
  128. package/dist/{use-native-dialog-BCp1chwO.js → use-native-dialog-DWpIUVO1.js} +1 -0
  129. package/dist/{use-overlay-floating-CsZd3qxa.js → use-overlay-floating-efeqppiw.js} +1 -0
  130. package/dist/{visually-hidden-BXVyhj0y.js → visually-hidden-DCWhf0Cb.js} +2 -1
  131. package/package.json +4 -4
  132. package/dist/accordion-Dl-kvgPQ.js +0 -168
  133. package/dist/alert-BzntPa_5.js +0 -129
  134. package/dist/avatar-Dk2ES3ru.js +0 -124
  135. package/dist/badge-DZefC7rm.js +0 -102
  136. package/dist/breadcrumbs-5MCZ_Jr3.js +0 -125
  137. package/dist/button-qy-50NPd.js +0 -187
  138. package/dist/calendar-DcCAiN3b.js +0 -372
  139. package/dist/card-L-Z_1vZN.js +0 -120
  140. package/dist/checkbox-B7em7B-6.js +0 -134
  141. package/dist/combobox-DQcXR94r.js +0 -301
  142. package/dist/command-palette-BRJ8A5De.js +0 -328
  143. package/dist/container-COHiEjI8.js +0 -34
  144. package/dist/date-picker-D1GwiRB9.js +0 -239
  145. package/dist/dialog-CYf9fCZO.js +0 -175
  146. package/dist/divider-bi7OgCI5.js +0 -76
  147. package/dist/flex-CDFDDaiu.js +0 -21
  148. package/dist/kbd-DpiJgDJ2.js +0 -55
  149. package/dist/menu-A9fZUaAG.js +0 -186
  150. package/dist/navigation-Cemnmc_J.js +0 -174
  151. package/dist/pagination-orCjUsn_.js +0 -148
  152. package/dist/pill-Dg2JJHHW.js +0 -49
  153. package/dist/popover-D_YU34WS.js +0 -97
  154. package/dist/progress-XdvBG0Vv.js +0 -83
  155. package/dist/radio-group-CxMJ2Vq7.js +0 -130
  156. package/dist/select-mwFbmzsn.js +0 -256
  157. package/dist/skeleton-qas9ZKK9.js +0 -47
  158. package/dist/spinner-ros2CfIf.js +0 -49
  159. package/dist/stack-Hs8THnIL.js +0 -20
  160. package/dist/switch-E375Bz4X.js +0 -135
  161. package/dist/tabs-CBwRiuul.js +0 -173
  162. package/dist/text-field-BlP8qGn_.js +0 -73
  163. package/dist/textarea-CUG26CH2.js +0 -83
  164. package/dist/theme-root-CrdzwfSo.js +0 -20
  165. package/dist/toast-D_dnqnn-.js +0 -270
  166. package/dist/toggle-group-B7gXCea8.js +0 -150
  167. package/dist/tooltip-BJ2hLV1b.js +0 -92
@@ -1,270 +0,0 @@
1
- import { t as e } from "./css-CW_HG55W.js";
2
- import { n as t } from "./media-8K3xDAxM.js";
3
- import { t as n } from "./renderable-DwPvt1I8.js";
4
- import { t as r } from "./button-qy-50NPd.js";
5
- 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";
6
- import { vars as p } from "@jfrader/tokens/vars";
7
- import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
8
- import { createPortal as _ } from "react-dom";
9
- //#region src/components/toast/toast.tsx
10
- 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
- position: "fixed",
12
- insetBlockEnd: 0,
13
- insetInlineEnd: 0,
14
- display: "flex",
15
- flexDirection: "column",
16
- gap: p.space[2],
17
- inlineSize: S,
18
- margin: 0,
19
- paddingInlineEnd: p.space[4],
20
- paddingBlockEnd: p.space[4],
21
- pointerEvents: "none",
22
- fontFamily: p.font.sans
23
- }), D = e({
24
- boxSizing: "border-box",
25
- display: "grid",
26
- gridTemplateColumns: "minmax(0, 1fr) auto",
27
- alignItems: "start",
28
- gap: p.space[2],
29
- backgroundColor: p.color.surfaceRaised,
30
- border: `1px solid ${p.color.border}`,
31
- borderRadius: p.radius.lg,
32
- boxShadow: p.shadow.floating,
33
- padding: p.space[3],
34
- color: p.color.text,
35
- lineHeight: p.lineHeight.base,
36
- pointerEvents: "auto",
37
- transitionProperty: "opacity, transform",
38
- transitionDuration: p.motion.duration.base,
39
- transitionTimingFunction: p.motion.easeStandard,
40
- "&[data-populated=\"false\"]": { opacity: 0 },
41
- "&[data-state=\"closing\"]": {
42
- opacity: 0,
43
- transform: `translateY(${p.space[2]})`,
44
- pointerEvents: "none"
45
- },
46
- [t]: { transitionDuration: "0s" }
47
- }), O = {
48
- neutral: e({ borderInlineStart: `${C} solid ${p.color.borderStrong}` }),
49
- success: e({ borderInlineStart: `${C} solid ${p.color.success}` }),
50
- danger: e({ borderInlineStart: `${C} solid ${p.color.danger}` })
51
- }, k = e({
52
- display: "grid",
53
- gap: p.space[1],
54
- alignSelf: "center",
55
- minInlineSize: 0
56
- }), A = e({
57
- margin: 0,
58
- fontSize: p.textSize.sm,
59
- fontWeight: p.fontWeight.semibold
60
- }), j = e({
61
- margin: 0,
62
- fontSize: p.textSize.sm,
63
- color: p.color.textMuted
64
- }), M = e({
65
- gridColumn: 2,
66
- gridRow: 1,
67
- inlineSize: "32px",
68
- paddingInline: 0
69
- }), N = e({ display: "contents" }), P = e({
70
- gridColumn: "1 / -1",
71
- display: "flex",
72
- gap: p.space[2]
73
- });
74
- function F(e) {
75
- let t = s(T);
76
- if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
77
- return t;
78
- }
79
- function I() {
80
- let e = s(w);
81
- if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
82
- return e;
83
- }
84
- function L({ children: e, max: t = v, duration: n = y, dismissLabel: r = b }) {
85
- 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) => {
86
- t ? m.current.set(e, t) : m.current.delete(e);
87
- }, []), x = o((e, t) => {
88
- let n = new Set(t.filter((e) => e.state === "open").map((e) => m.current.get(e.id)));
89
- for (let t of e) {
90
- let e = m.current.get(t.id);
91
- if (e?.contains(e.ownerDocument.activeElement)) {
92
- Array.from(e.parentElement?.querySelectorAll("[data-ui=\"toast\"]") ?? []).find((e) => n.has(e))?.querySelector("[data-toast-dismiss]")?.focus();
93
- break;
94
- }
95
- }
96
- }, []), S = o((e) => {
97
- a.current += 1;
98
- let t = `${i}toast-${a.current}`, r = {
99
- id: t,
100
- options: {
101
- ...e,
102
- duration: e.duration === void 0 ? n : e.duration
103
- },
104
- state: "open"
105
- }, o = p.current, s = [...o, r].slice(-g);
106
- return x(o.filter((e) => !s.includes(e)), s), p.current = s, c(s), t;
107
- }, [
108
- i,
109
- g,
110
- n,
111
- x
112
- ]), C = o((e) => {
113
- let t = p.current;
114
- x(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
115
- let n = t.map((t) => t.id === e && t.state === "open" ? {
116
- ...t,
117
- state: "closing"
118
- } : t);
119
- p.current = n, c(n);
120
- }, [x]), E = o((e) => {
121
- let t = p.current, n = t.filter((t) => t.id !== e);
122
- x(t.filter((t) => t.id === e), n), p.current = n, c(n);
123
- }, [x]), D = u(() => ({
124
- toast: S,
125
- dismiss: C
126
- }), [S, C]), O = u(() => ({
127
- toasts: s,
128
- dismiss: C,
129
- remove: E,
130
- registerRoot: _,
131
- dismissLabel: r
132
- }), [
133
- s,
134
- C,
135
- E,
136
- _,
137
- r
138
- ]);
139
- return /* @__PURE__ */ h(w.Provider, {
140
- value: D,
141
- children: /* @__PURE__ */ h(T.Provider, {
142
- value: O,
143
- children: e
144
- })
145
- });
146
- }
147
- var R = a(function(e, t) {
148
- let { toasts: n } = F("Viewport"), r = d(null), [i, a] = f(null);
149
- return c(() => {
150
- a(r.current?.ownerDocument.body ?? null);
151
- }, []), /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
152
- hidden: !0,
153
- ref: r
154
- }), i && _(/* @__PURE__ */ h("div", {
155
- ...e,
156
- ref: t,
157
- "data-ui": "toast-viewport",
158
- css: E,
159
- children: n.map((e) => /* @__PURE__ */ h(z, { record: e }, e.id))
160
- }), i)] });
161
- });
162
- function z({ record: e }) {
163
- 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) => {
164
- C.current = e, a(l, e);
165
- }, [l, a]), [T, E] = f(!1), [I, L] = f(!1), [R, z] = f(!1), V = d(S ?? 0);
166
- c(() => {
167
- let e = setTimeout(() => E(!0), x);
168
- return () => clearTimeout(e);
169
- }, []);
170
- let H = T && p === "open" && S !== null && !I && !R;
171
- return c(() => {
172
- if (!H) return;
173
- let e = performance.now(), n = setTimeout(() => t(l), V.current);
174
- return () => {
175
- clearTimeout(n), V.current -= performance.now() - e;
176
- };
177
- }, [
178
- H,
179
- t,
180
- l
181
- ]), c(() => {
182
- if (p !== "closing") return;
183
- let e = C.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
184
- return Promise.allSettled(t.map((e) => e.finished)).then(() => {
185
- n || i(l);
186
- }), () => {
187
- n = !0;
188
- };
189
- }, [
190
- p,
191
- i,
192
- l
193
- ]), /* @__PURE__ */ g("div", {
194
- ref: w,
195
- inert: p === "closing",
196
- "data-ui": "toast",
197
- "data-tone": y,
198
- "data-state": p,
199
- "data-populated": T,
200
- onPointerEnter: () => L(!0),
201
- onPointerLeave: () => L(!1),
202
- onFocus: () => z(!0),
203
- onBlur: (e) => {
204
- e.currentTarget.contains(e.relatedTarget) || z(!1);
205
- },
206
- css: [D, O[y]],
207
- children: [/* @__PURE__ */ h("div", {
208
- role: y === "danger" ? "alert" : "status",
209
- "aria-atomic": "true",
210
- css: k,
211
- children: T && /* @__PURE__ */ g(m, { children: [n(_) && /* @__PURE__ */ h("div", {
212
- css: A,
213
- children: _
214
- }), n(v) && /* @__PURE__ */ h("div", {
215
- css: j,
216
- children: v
217
- })] })
218
- }), T && /* @__PURE__ */ g("div", {
219
- css: N,
220
- children: [/* @__PURE__ */ h(r, {
221
- variant: "ghost",
222
- size: "sm",
223
- "aria-label": s,
224
- "data-toast-dismiss": "",
225
- onClick: () => t(l),
226
- css: M,
227
- children: /* @__PURE__ */ h(B, {})
228
- }), b && /* @__PURE__ */ h("div", {
229
- css: P,
230
- children: /* @__PURE__ */ h(r, {
231
- variant: "outline",
232
- size: "sm",
233
- onClick: (e) => {
234
- b?.onClick(e), e.defaultPrevented || t(l);
235
- },
236
- children: b.label
237
- })
238
- })]
239
- })]
240
- });
241
- }
242
- function B() {
243
- return /* @__PURE__ */ g("svg", {
244
- "aria-hidden": "true",
245
- viewBox: "0 0 16 16",
246
- width: "16",
247
- height: "16",
248
- fill: "none",
249
- stroke: "currentColor",
250
- strokeWidth: "2",
251
- strokeLinecap: "round",
252
- children: [/* @__PURE__ */ h("line", {
253
- x1: "4",
254
- y1: "4",
255
- x2: "12",
256
- y2: "12"
257
- }), /* @__PURE__ */ h("line", {
258
- x1: "12",
259
- y1: "4",
260
- x2: "4",
261
- y2: "12"
262
- })]
263
- });
264
- }
265
- var V = Object.assign(L, {
266
- Provider: L,
267
- Viewport: R
268
- });
269
- //#endregion
270
- export { I as n, V as t };
@@ -1,150 +0,0 @@
1
- import { t as e } from "./css-CW_HG55W.js";
2
- import { t } from "./focus-ring-qOS3rPlM.js";
3
- import { n, t as r } from "./media-8K3xDAxM.js";
4
- import { n as i, r as a, t as o } from "./roving-focus-DeEZ55-T.js";
5
- import { t as s } from "./use-controlled-state-DQXkiTQI.js";
6
- import { createContext as c, forwardRef as l, useContext as u, useEffect as d, useImperativeHandle as f, useMemo as p, useRef as m, useState as h } from "react";
7
- import { vars as g } from "@jfrader/tokens/vars";
8
- import { jsx as _ } from "@emotion/react/jsx-runtime";
9
- //#region src/components/toggle-group/toggle-group.tsx
10
- var v = c(null);
11
- function y(e) {
12
- let t = u(v);
13
- if (!t) throw Error(`ToggleGroup.${e} must be rendered inside <ToggleGroup>.`);
14
- return t;
15
- }
16
- var b = [], x = (e, t) => {
17
- if (Array.isArray(e)) {
18
- if (t === "multiple") return e;
19
- e = e[0] ?? "";
20
- }
21
- return e === void 0 || e === "" ? b : [e];
22
- }, S = {
23
- itemSelector: "[data-ui=\"toggle-group-item\"]:not([disabled])",
24
- ownerSelector: "[data-ui=\"toggle-group-root\"]"
25
- }, C = "2px", w = e({
26
- display: "inline-flex",
27
- gap: C,
28
- padding: C,
29
- border: `1px solid ${g.color.borderControl}`,
30
- borderRadius: g.radius.md,
31
- backgroundColor: g.color.surfaceInset
32
- }), T = {
33
- horizontal: e({ flexDirection: "row" }),
34
- vertical: e({
35
- flexDirection: "column",
36
- alignItems: "stretch"
37
- })
38
- }, E = e({
39
- appearance: "none",
40
- display: "inline-flex",
41
- alignItems: "center",
42
- justifyContent: "center",
43
- gap: g.space[2],
44
- minBlockSize: "32px",
45
- boxSizing: "border-box",
46
- border: "1px solid transparent",
47
- borderRadius: g.radius.sm,
48
- background: "transparent",
49
- cursor: "pointer",
50
- paddingBlock: g.space[1],
51
- paddingInline: g.space[3],
52
- font: "inherit",
53
- fontSize: g.textSize.sm,
54
- fontWeight: g.fontWeight.medium,
55
- color: g.color.textMuted,
56
- transitionProperty: "background-color, border-color, color",
57
- transitionDuration: g.motion.duration.fast,
58
- transitionTimingFunction: g.motion.easeStandard,
59
- "&:hover:not(:disabled):not([aria-pressed=\"true\"])": {
60
- backgroundColor: g.color.surfaceHover,
61
- color: g.color.text
62
- },
63
- "&[aria-pressed=\"true\"]": {
64
- backgroundColor: g.color.accentSoft,
65
- borderColor: g.color.accent,
66
- color: g.color.accentText
67
- },
68
- "&[aria-pressed=\"true\"]:hover:not(:disabled)": { backgroundColor: g.color.accentSoftHover },
69
- "&:disabled": {
70
- opacity: .55,
71
- cursor: "not-allowed"
72
- },
73
- "&:focus-visible": { ...t },
74
- [n]: { transitionDuration: "0s" },
75
- [r]: { "&[aria-pressed=\"true\"]": {
76
- backgroundColor: "SelectedItem",
77
- borderColor: "SelectedItem",
78
- color: "SelectedItemText"
79
- } }
80
- }), D = l(function({ type: e = "single", value: t, defaultValue: n, onValueChange: r, orientation: c = "horizontal", disabled: l = !1, allowEmpty: u = !1, label: g, "aria-label": y, onKeyDown: b, ...C }, E) {
81
- let [D, O] = s(t, n, r), [k, A] = h(null), j = m(null);
82
- f(E, () => j.current, []);
83
- let M = p(() => x(D, e), [D, e]), N = p(() => ({
84
- pressed: M,
85
- toggle: (t) => {
86
- let n = M.includes(t);
87
- e === "multiple" ? O(n ? M.filter((e) => e !== t) : [...M, t]) : n ? u && O("") : O(t);
88
- },
89
- focused: k,
90
- setFocused: A,
91
- disabled: l
92
- }), [
93
- M,
94
- O,
95
- e,
96
- u,
97
- k,
98
- l
99
- ]);
100
- d(() => {
101
- let e = j.current;
102
- if (!e) return;
103
- let t = a(e, S);
104
- if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
105
- let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
106
- A((n ?? o(t, k) ?? t[0])?.dataset.value ?? null);
107
- });
108
- let P = (e) => {
109
- b?.(e);
110
- let t = j.current;
111
- !e.defaultPrevented && t && i(e, t, c, S);
112
- };
113
- return /* @__PURE__ */ _(v.Provider, {
114
- value: N,
115
- children: /* @__PURE__ */ _("div", {
116
- ...C,
117
- ref: j,
118
- role: "group",
119
- "aria-label": g ?? y,
120
- "aria-disabled": l || void 0,
121
- "data-ui": "toggle-group-root",
122
- "data-type": e,
123
- "data-orientation": c,
124
- onKeyDown: P,
125
- css: [w, T[c]]
126
- })
127
- });
128
- }), O = l(function({ value: e, disabled: t, onClick: n, onFocus: r, ...i }, a) {
129
- let { pressed: o, toggle: s, focused: c, setFocused: l, disabled: u } = y("Item"), d = u || t, f = o.includes(e), p = !d && (c === null ? o[0] === e : c === e), m = (t) => {
130
- n?.(t), !t.defaultPrevented && s(e);
131
- }, h = (t) => {
132
- r?.(t), l(e);
133
- };
134
- return /* @__PURE__ */ _("button", {
135
- ...i,
136
- ref: a,
137
- type: "button",
138
- "aria-pressed": f,
139
- "data-ui": "toggle-group-item",
140
- "data-value": e,
141
- "data-state": f ? "on" : "off",
142
- tabIndex: p ? 0 : -1,
143
- disabled: d,
144
- onClick: m,
145
- onFocus: h,
146
- css: E
147
- });
148
- }), k = Object.assign(D, { Item: O });
149
- //#endregion
150
- export { k as t };
@@ -1,92 +0,0 @@
1
- import { t as e } from "./css-CW_HG55W.js";
2
- import { t } from "./use-controlled-state-DQXkiTQI.js";
3
- import { t as n } from "./trigger-style-f54idgjT.js";
4
- import { t as r } from "./use-overlay-floating-CsZd3qxa.js";
5
- import { createContext as i, forwardRef as a, useContext as o, useMemo as s } from "react";
6
- import { vars as c } from "@jfrader/tokens/vars";
7
- import { jsx as l } from "@emotion/react/jsx-runtime";
8
- 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";
9
- //#region src/components/tooltip/tooltip.tsx
10
- var _ = 300, v = 100, y = i(null);
11
- function b(e) {
12
- let t = o(y);
13
- if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
14
- return t;
15
- }
16
- var x = e({
17
- boxSizing: "border-box",
18
- backgroundColor: c.color.bgSoft,
19
- border: `1px solid ${c.color.border}`,
20
- borderRadius: c.radius.sm,
21
- boxShadow: c.shadow.raised,
22
- padding: `${c.space[1]} ${c.space[2]}`,
23
- maxInlineSize: "260px",
24
- color: c.color.text,
25
- fontFamily: c.font.sans,
26
- fontSize: c.textSize.sm,
27
- lineHeight: c.lineHeight.base
28
- });
29
- function S({ open: e, defaultOpen: n = !1, onOpenChange: i, placement: a = "top", openDelay: o = _, closeDelay: c = v, children: u }) {
30
- let [h = !1, b] = t(e, n, i), { refs: x, floatingStyles: S, context: C } = r({
31
- open: h,
32
- placement: a,
33
- onOpenChange: b
34
- }), w = p(C, {
35
- delay: {
36
- open: o,
37
- close: c
38
- },
39
- move: !1
40
- }), T = f(C), E = d(C, { escapeKey: !0 }), D = g(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = m([
41
- w,
42
- T,
43
- E,
44
- D
45
- ]), A = s(() => ({
46
- open: h,
47
- refs: x,
48
- floatingStyles: S,
49
- getReferenceProps: O,
50
- getFloatingProps: k
51
- }), [
52
- h,
53
- x,
54
- S,
55
- O,
56
- k
57
- ]);
58
- return /* @__PURE__ */ l(y.Provider, {
59
- value: A,
60
- children: u
61
- });
62
- }
63
- var C = a(function({ "aria-describedby": e, ...t }, r) {
64
- let { refs: i, getReferenceProps: a } = b("Trigger"), o = h([i.setReference, r]), s = a(t), c = [e, s["aria-describedby"]].filter(Boolean).join(" ") || void 0;
65
- return /* @__PURE__ */ l("button", {
66
- type: "button",
67
- ...s,
68
- ref: o,
69
- "aria-describedby": c,
70
- "data-ui": "tooltip-trigger",
71
- css: n
72
- });
73
- }), w = a(function({ style: e, ...t }, n) {
74
- let { open: r, refs: i, floatingStyles: a, getFloatingProps: o } = b("Content"), s = h([i.setFloating, n]);
75
- if (!r) return null;
76
- let { tabIndex: c, ...d } = o(t);
77
- return /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l("div", {
78
- ...d,
79
- ref: s,
80
- "data-ui": "tooltip",
81
- style: {
82
- ...e,
83
- ...a
84
- },
85
- css: x
86
- }) });
87
- }), T = Object.assign(S, {
88
- Trigger: C,
89
- Content: w
90
- });
91
- //#endregion
92
- export { T as t };