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