@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
@@ -1,174 +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, forwardRef as u, useContext as d, useEffect as f, useId as p, useImperativeHandle as m, useMemo as h, useRef as g, useState as _ } from "react";
9
- import { vars as v } from "@jfrader/tokens/vars";
10
- import { jsx as y } from "@emotion/react/jsx-runtime";
11
- //#region src/components/tabs/tabs.tsx
12
- var b = l(null);
13
- function x(e) {
14
- let t = d(b);
15
- if (!t) throw Error(`Tabs.${e} must be rendered inside <Tabs>.`);
16
- return t;
17
- }
18
- var S = {
19
- itemSelector: "[role=\"tab\"]:not([disabled])",
20
- ownerSelector: "[role=\"tablist\"]"
21
- }, C = e({ "&[data-orientation=\"vertical\"]": {
22
- display: "flex",
23
- alignItems: "flex-start",
24
- gap: v.space[4]
25
- } }), w = {
26
- horizontal: e({
27
- display: "inline-flex",
28
- gap: v.space[1],
29
- borderBlockEnd: `1px solid ${v.color.border}`
30
- }),
31
- vertical: e({
32
- display: "inline-flex",
33
- flexDirection: "column",
34
- alignItems: "stretch",
35
- borderInlineEnd: `1px solid ${v.color.border}`
36
- })
37
- }, T = e({
38
- appearance: "none",
39
- border: 0,
40
- background: "transparent",
41
- cursor: "pointer",
42
- paddingBlock: v.space[2],
43
- paddingInline: v.space[3],
44
- font: "inherit",
45
- fontSize: v.textSize.sm,
46
- fontWeight: v.fontWeight.medium,
47
- color: v.color.textMuted,
48
- transitionProperty: "color, border-color",
49
- transitionDuration: v.motion.duration.fast,
50
- transitionTimingFunction: v.motion.easeStandard,
51
- "&:hover:not(:disabled):not([aria-selected=\"true\"])": { color: v.color.text },
52
- "&[aria-selected=\"true\"]": {
53
- color: v.color.text,
54
- borderColor: v.color.accent
55
- },
56
- "&:disabled": {
57
- opacity: .55,
58
- cursor: "not-allowed"
59
- },
60
- "&:focus-visible": { ...n },
61
- [r]: { transitionDuration: "0s" }
62
- }), E = {
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
- }, D = e({
73
- color: v.color.text,
74
- outline: "none",
75
- "&:focus-visible": { ...t },
76
- "&[hidden]": { display: "none" }
77
- }), O = e({ paddingBlockStart: v.space[3] }), k = u(function({ value: e, defaultValue: t, onValueChange: n, orientation: r = "horizontal", activation: i = "auto", ...a }, o) {
78
- let c = p(), [l, u] = s(e, t, n), [d, f] = _(null), m = h(() => ({
79
- value: l,
80
- setValue: u,
81
- focused: d,
82
- setFocused: f,
83
- orientation: r,
84
- activation: i,
85
- baseId: c
86
- }), [
87
- l,
88
- u,
89
- d,
90
- r,
91
- i,
92
- c
93
- ]);
94
- return /* @__PURE__ */ y(b.Provider, {
95
- value: m,
96
- children: /* @__PURE__ */ y("div", {
97
- ...a,
98
- ref: o,
99
- "data-ui": "tabs-root",
100
- "data-orientation": r,
101
- css: C
102
- })
103
- });
104
- }), A = u(function({ onKeyDown: e, ...t }, n) {
105
- let { orientation: r, value: s, focused: c, setFocused: l } = x("List"), u = g(null);
106
- m(n, () => u.current, []), f(() => {
107
- let e = u.current;
108
- if (!e) return;
109
- let t = a(e, S);
110
- t.length !== 0 && (t.some((e) => e.tabIndex === 0) || l((o(t, s) ?? o(t, c) ?? t[0])?.dataset.value ?? null));
111
- });
112
- let d = (t) => {
113
- e?.(t);
114
- let n = u.current;
115
- !t.defaultPrevented && n && i(t, n, r, S);
116
- };
117
- return /* @__PURE__ */ y("div", {
118
- ...t,
119
- ref: u,
120
- role: "tablist",
121
- "aria-orientation": r,
122
- "data-ui": "tabs-list",
123
- "data-orientation": r,
124
- "data-roving": c ?? "",
125
- "data-selected": s ?? "",
126
- onKeyDown: d,
127
- css: w[r]
128
- });
129
- }), j = u(function({ value: e, disabled: t, onClick: n, onFocus: r, ...i }, a) {
130
- let { value: o, setValue: s, focused: l, setFocused: u, activation: d, baseId: f, orientation: p } = x("Tab"), m = o === e, h = !t && (l === null ? m : l === e), _ = g(!1), v = (t) => {
131
- if (n?.(t), t.defaultPrevented) return;
132
- let r = _.current;
133
- _.current = !1, !(d === "auto" && r) && s(e);
134
- }, b = (t) => {
135
- r?.(t), !t.defaultPrevented && (_.current = !0, u(e), d === "auto" && s(e));
136
- };
137
- return /* @__PURE__ */ y("button", {
138
- ...i,
139
- ref: a,
140
- type: "button",
141
- role: "tab",
142
- id: c(f, "tab", e),
143
- "data-ui": "tabs-tab",
144
- "data-value": e,
145
- "data-state": m ? "active" : "inactive",
146
- "aria-selected": m,
147
- "aria-controls": c(f, "panel", e),
148
- tabIndex: h ? 0 : -1,
149
- disabled: t,
150
- onClick: v,
151
- onFocus: b,
152
- css: [T, E[p]]
153
- });
154
- }), M = u(function({ value: e, tabIndex: t = 0, "aria-labelledby": n, ...r }, i) {
155
- let { value: a, baseId: o, orientation: s } = x("Panel"), l = a === e, u = [n, c(o, "tab", e)].filter(Boolean).join(" ") || void 0;
156
- return /* @__PURE__ */ y("div", {
157
- ...r,
158
- ref: i,
159
- role: "tabpanel",
160
- id: c(o, "panel", e),
161
- "aria-labelledby": u,
162
- tabIndex: t,
163
- hidden: !l,
164
- "data-ui": "tabs-panel",
165
- "data-state": l ? "active" : "inactive",
166
- css: [D, s === "horizontal" && O]
167
- });
168
- }), N = Object.assign(k, {
169
- List: A,
170
- Tab: j,
171
- Panel: M
172
- });
173
- //#endregion
174
- export { N as t };
@@ -1,74 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { a as t, i as n, n as r, o as i, r as a, t as o } from "./field-anatomy-BzGw1Ch9.js";
4
- import { forwardRef as s } from "react";
5
- import { vars as c } from "@jfrader/tokens/vars";
6
- import { jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
7
- //#region src/components/text-field/text-field.tsx
8
- var d = {
9
- sm: e({
10
- blockSize: "32px",
11
- paddingInline: c.space[3],
12
- fontSize: c.textSize.sm
13
- }),
14
- md: e({
15
- blockSize: "40px",
16
- paddingInline: c.space[4],
17
- fontSize: c.textSize.sm
18
- }),
19
- lg: e({
20
- blockSize: "48px",
21
- paddingInline: c.space[4],
22
- fontSize: c.textSize.md
23
- })
24
- }, f = s(function({ label: e, description: s, error: c, size: f = "md", onChange: p, onValueChange: m, slotProps: h, className: g, required: _, id: v, "aria-describedby": y, "aria-invalid": b, ...x }, S) {
25
- let C = t({
26
- id: v,
27
- description: s,
28
- error: c,
29
- "aria-describedby": y,
30
- "aria-invalid": b
31
- }), w = (e) => {
32
- p?.(e), m?.(e.currentTarget.value);
33
- };
34
- return /* @__PURE__ */ u(n, {
35
- "data-ui": "text-field",
36
- className: g,
37
- part: h?.root,
38
- children: [
39
- /* @__PURE__ */ l(a, {
40
- htmlFor: C.id,
41
- required: _,
42
- part: h?.label,
43
- children: e
44
- }),
45
- /* @__PURE__ */ l("input", {
46
- ...x,
47
- ref: S,
48
- id: C.id,
49
- required: _,
50
- "aria-describedby": C.describedBy,
51
- "aria-invalid": C.ariaInvalid,
52
- onChange: w,
53
- className: h?.control?.className,
54
- css: [
55
- i,
56
- d[f],
57
- h?.control?.css
58
- ]
59
- }),
60
- /* @__PURE__ */ l(o, {
61
- id: C.descriptionId,
62
- part: h?.description,
63
- children: s
64
- }),
65
- /* @__PURE__ */ l(r, {
66
- id: C.errorId,
67
- part: h?.error,
68
- children: c
69
- })
70
- ]
71
- });
72
- });
73
- //#endregion
74
- export { f as t };
@@ -1,84 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { a as t, i as n, n as r, o as i, r as a, t as o } from "./field-anatomy-BzGw1Ch9.js";
4
- import { forwardRef as s } from "react";
5
- import { vars as c } from "@jfrader/tokens/vars";
6
- import { jsx as l, jsxs as u } from "@emotion/react/jsx-runtime";
7
- //#region src/components/textarea/textarea.tsx
8
- var d = e({
9
- paddingBlock: c.space[2],
10
- lineHeight: c.lineHeight.base
11
- }), f = {
12
- sm: e({
13
- minBlockSize: "64px",
14
- paddingInline: c.space[3],
15
- fontSize: c.textSize.sm
16
- }),
17
- md: e({
18
- minBlockSize: "80px",
19
- paddingInline: c.space[4],
20
- fontSize: c.textSize.sm
21
- }),
22
- lg: e({
23
- minBlockSize: "96px",
24
- paddingInline: c.space[4],
25
- fontSize: c.textSize.md
26
- })
27
- }, p = {
28
- none: e({ resize: "none" }),
29
- vertical: e({ resize: "vertical" })
30
- }, m = e({ fieldSizing: "content" }), h = s(function({ label: e, description: s, error: c, size: h = "md", resize: g = "vertical", autoResize: _ = !1, rows: v = 3, onChange: y, onValueChange: b, slotProps: x, className: S, required: C, id: w, "aria-describedby": T, "aria-invalid": E, ...D }, O) {
31
- let k = t({
32
- id: w,
33
- description: s,
34
- error: c,
35
- "aria-describedby": T,
36
- "aria-invalid": E
37
- }), A = (e) => {
38
- y?.(e), b?.(e.currentTarget.value);
39
- };
40
- return /* @__PURE__ */ u(n, {
41
- "data-ui": "textarea",
42
- className: S,
43
- part: x?.root,
44
- children: [
45
- /* @__PURE__ */ l(a, {
46
- htmlFor: k.id,
47
- required: C,
48
- part: x?.label,
49
- children: e
50
- }),
51
- /* @__PURE__ */ l("textarea", {
52
- ...D,
53
- ref: O,
54
- id: k.id,
55
- rows: v,
56
- required: C,
57
- "aria-describedby": k.describedBy,
58
- "aria-invalid": k.ariaInvalid,
59
- onChange: A,
60
- className: x?.control?.className,
61
- css: [
62
- i,
63
- d,
64
- f[h],
65
- p[g],
66
- _ && m,
67
- x?.control?.css
68
- ]
69
- }),
70
- /* @__PURE__ */ l(o, {
71
- id: k.descriptionId,
72
- part: x?.description,
73
- children: s
74
- }),
75
- /* @__PURE__ */ l(r, {
76
- id: k.errorId,
77
- part: x?.error,
78
- children: c
79
- })
80
- ]
81
- });
82
- });
83
- //#endregion
84
- export { h as t };
@@ -1,21 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { forwardRef as t } from "react";
4
- import { vars as n } from "@jfrader/tokens/vars";
5
- import { jsx as r } from "@emotion/react/jsx-runtime";
6
- //#region src/components/theme-root/theme-root.tsx
7
- var i = e({
8
- color: n.color.text,
9
- colorScheme: "dark",
10
- "&[data-theme=\"light\"]": { colorScheme: "light" }
11
- }), a = t(function({ theme: e, ...t }, n) {
12
- return /* @__PURE__ */ r("div", {
13
- "data-ui": "theme-root",
14
- "data-theme": e ?? "dark",
15
- ...t,
16
- ref: n,
17
- css: i
18
- });
19
- });
20
- //#endregion
21
- export { a as t };
@@ -1,151 +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, forwardRef 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 = c(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": { ...t },
75
- [n]: { transitionDuration: "0s" },
76
- [r]: { "&[aria-pressed=\"true\"]": {
77
- backgroundColor: "SelectedItem",
78
- borderColor: "SelectedItem",
79
- color: "SelectedItemText"
80
- } }
81
- }), 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) {
82
- let [D, O] = s(t, n, r), [k, A] = h(null), j = m(null);
83
- f(E, () => j.current, []);
84
- let M = p(() => x(D, e), [D, e]), N = p(() => ({
85
- pressed: M,
86
- toggle: (t) => {
87
- let n = M.includes(t);
88
- e === "multiple" ? O(n ? M.filter((e) => e !== t) : [...M, t]) : n ? u && O("") : O(t);
89
- },
90
- focused: k,
91
- setFocused: A,
92
- disabled: l
93
- }), [
94
- M,
95
- O,
96
- e,
97
- u,
98
- k,
99
- l
100
- ]);
101
- d(() => {
102
- let e = j.current;
103
- if (!e) return;
104
- let t = a(e, S);
105
- if (t.length === 0 || t.some((e) => e.tabIndex === 0)) return;
106
- let n = t.find((e) => e.getAttribute("aria-pressed") === "true");
107
- A((n ?? o(t, k) ?? t[0])?.dataset.value ?? null);
108
- });
109
- let P = (e) => {
110
- b?.(e);
111
- let t = j.current;
112
- !e.defaultPrevented && t && i(e, t, c, S);
113
- };
114
- return /* @__PURE__ */ _(v.Provider, {
115
- value: N,
116
- children: /* @__PURE__ */ _("div", {
117
- ...C,
118
- ref: j,
119
- role: "group",
120
- "aria-label": g ?? y,
121
- "aria-disabled": l || void 0,
122
- "data-ui": "toggle-group-root",
123
- "data-type": e,
124
- "data-orientation": c,
125
- onKeyDown: P,
126
- css: [w, T[c]]
127
- })
128
- });
129
- }), O = l(function({ value: e, disabled: t, onClick: n, onFocus: r, ...i }, a) {
130
- 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) => {
131
- n?.(t), !t.defaultPrevented && s(e);
132
- }, h = (t) => {
133
- r?.(t), l(e);
134
- };
135
- return /* @__PURE__ */ _("button", {
136
- ...i,
137
- ref: a,
138
- type: "button",
139
- "aria-pressed": f,
140
- "data-ui": "toggle-group-item",
141
- "data-value": e,
142
- "data-state": f ? "on" : "off",
143
- tabIndex: p ? 0 : -1,
144
- disabled: d,
145
- onClick: m,
146
- onFocus: h,
147
- css: E
148
- });
149
- }), k = Object.assign(D, { Item: O });
150
- //#endregion
151
- export { k as t };
@@ -1,93 +0,0 @@
1
- 'use client';
2
- import { t as e } from "./css-Cgj6sCHn.js";
3
- import { t } from "./use-controlled-state-CVXDa-qM.js";
4
- import { t as n } from "./trigger-style-B1GFmH7M.js";
5
- import { t as r } from "./use-overlay-floating-efeqppiw.js";
6
- import { createContext as i, forwardRef 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 = i(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: n = !1, onOpenChange: i, placement: a = "top", openDelay: o = _, closeDelay: c = v, children: u }) {
31
- let [h = !1, b] = t(e, n, i), { refs: x, floatingStyles: S, context: C } = r({
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
- var C = a(function({ "aria-describedby": e, ...t }, r) {
65
- 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;
66
- return /* @__PURE__ */ l("button", {
67
- type: "button",
68
- ...s,
69
- ref: o,
70
- "aria-describedby": c,
71
- "data-ui": "tooltip-trigger",
72
- css: n
73
- });
74
- }), w = a(function({ style: e, ...t }, n) {
75
- let { open: r, refs: i, floatingStyles: a, getFloatingProps: o } = b("Content"), s = h([i.setFloating, n]);
76
- if (!r) return null;
77
- let { tabIndex: c, ...d } = o(t);
78
- return /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l("div", {
79
- ...d,
80
- ref: s,
81
- "data-ui": "tooltip",
82
- style: {
83
- ...e,
84
- ...a
85
- },
86
- css: x
87
- }) });
88
- }), T = Object.assign(S, {
89
- Trigger: C,
90
- Content: w
91
- });
92
- //#endregion
93
- export { T as t };