@versini/ui-togglegroup 0.0.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.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +619 -0
- package/dist/style.css +1 -0
- package/dist/style.js +0 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Arno Versini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as ToggleGroupRadix from '@radix-ui/react-toggle-group';
|
|
3
|
+
import { SpacingProps } from '@versini/ui-private/dist/utilities';
|
|
4
|
+
|
|
5
|
+
declare const TOGGLEGROUP_CLASSNAME = "av-togglegroup";
|
|
6
|
+
|
|
7
|
+
type Size = "small" | "medium" | "large";
|
|
8
|
+
type Mode = "dark" | "light" | "system" | "alt-system";
|
|
9
|
+
|
|
10
|
+
type ToggleGroupProps = {
|
|
11
|
+
/**
|
|
12
|
+
* The type of focus for the buttons. This will change the color
|
|
13
|
+
* of the focus ring around the buttons.
|
|
14
|
+
*/
|
|
15
|
+
focusMode?: Mode;
|
|
16
|
+
/**
|
|
17
|
+
* The mode of the group container. This will change the color of the background.
|
|
18
|
+
*/
|
|
19
|
+
mode?: Mode;
|
|
20
|
+
/**
|
|
21
|
+
* The size of the component.
|
|
22
|
+
*/
|
|
23
|
+
size?: Size;
|
|
24
|
+
} & Omit<ToggleGroupRadix.ToggleGroupSingleProps, "type", "defaultValue"> &
|
|
25
|
+
SpacingProps;
|
|
26
|
+
|
|
27
|
+
type ToggleGroupItemProps = ToggleGroupRadix.ToggleGroupItemProps;
|
|
28
|
+
|
|
29
|
+
declare const ToggleGroup: ({ children, value, onValueChange, disabled, mode, focusMode, size, defaultValue, ...otherProps }: ToggleGroupProps) => react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare const ToggleGroupItem: ({ value, disabled }: ToggleGroupItemProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
export { TOGGLEGROUP_CLASSNAME, ToggleGroup, ToggleGroupItem };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import { jsx as a, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import v, { useContext as ge } from "react";
|
|
4
|
+
import w from "clsx";
|
|
5
|
+
/*!
|
|
6
|
+
@versini/ui-togglegroup v0.0.0
|
|
7
|
+
© 2024 gizmette.com
|
|
8
|
+
*/
|
|
9
|
+
try {
|
|
10
|
+
window.__VERSINI_UI_TOGGLEGROUP__ || (window.__VERSINI_UI_TOGGLEGROUP__ = {
|
|
11
|
+
version: "0.0.0",
|
|
12
|
+
buildTime: "10/04/2024 07:05 PM EDT",
|
|
13
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
14
|
+
license: "MIT"
|
|
15
|
+
});
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
const me = "av-togglegroup";
|
|
19
|
+
function U(e, t = []) {
|
|
20
|
+
let o = [];
|
|
21
|
+
function r(s, l) {
|
|
22
|
+
const c = u.createContext(l), i = o.length;
|
|
23
|
+
o = [...o, l];
|
|
24
|
+
function d(p) {
|
|
25
|
+
const { scope: C, children: b, ...f } = p, h = (C == null ? void 0 : C[e][i]) || c, R = u.useMemo(() => f, Object.values(f));
|
|
26
|
+
return /* @__PURE__ */ a(h.Provider, { value: R, children: b });
|
|
27
|
+
}
|
|
28
|
+
function g(p, C) {
|
|
29
|
+
const b = (C == null ? void 0 : C[e][i]) || c, f = u.useContext(b);
|
|
30
|
+
if (f) return f;
|
|
31
|
+
if (l !== void 0) return l;
|
|
32
|
+
throw new Error(`\`${p}\` must be used within \`${s}\``);
|
|
33
|
+
}
|
|
34
|
+
return d.displayName = s + "Provider", [d, g];
|
|
35
|
+
}
|
|
36
|
+
const n = () => {
|
|
37
|
+
const s = o.map((l) => u.createContext(l));
|
|
38
|
+
return function(c) {
|
|
39
|
+
const i = (c == null ? void 0 : c[e]) || s;
|
|
40
|
+
return u.useMemo(
|
|
41
|
+
() => ({ [`__scope${e}`]: { ...c, [e]: i } }),
|
|
42
|
+
[c, i]
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
return n.scopeName = e, [r, ve(n, ...t)];
|
|
47
|
+
}
|
|
48
|
+
function ve(...e) {
|
|
49
|
+
const t = e[0];
|
|
50
|
+
if (e.length === 1) return t;
|
|
51
|
+
const o = () => {
|
|
52
|
+
const r = e.map((n) => ({
|
|
53
|
+
useScope: n(),
|
|
54
|
+
scopeName: n.scopeName
|
|
55
|
+
}));
|
|
56
|
+
return function(s) {
|
|
57
|
+
const l = r.reduce((c, { useScope: i, scopeName: d }) => {
|
|
58
|
+
const p = i(s)[`__scope${d}`];
|
|
59
|
+
return { ...c, ...p };
|
|
60
|
+
}, {});
|
|
61
|
+
return u.useMemo(() => ({ [`__scope${t.scopeName}`]: l }), [l]);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
return o.scopeName = t.scopeName, o;
|
|
65
|
+
}
|
|
66
|
+
function Ce(e, t) {
|
|
67
|
+
typeof e == "function" ? e(t) : e != null && (e.current = t);
|
|
68
|
+
}
|
|
69
|
+
function Y(...e) {
|
|
70
|
+
return (t) => e.forEach((o) => Ce(o, t));
|
|
71
|
+
}
|
|
72
|
+
function D(...e) {
|
|
73
|
+
return u.useCallback(Y(...e), e);
|
|
74
|
+
}
|
|
75
|
+
var F = u.forwardRef((e, t) => {
|
|
76
|
+
const { children: o, ...r } = e, n = u.Children.toArray(o), s = n.find(Ie);
|
|
77
|
+
if (s) {
|
|
78
|
+
const l = s.props.children, c = n.map((i) => i === s ? u.Children.count(l) > 1 ? u.Children.only(null) : u.isValidElement(l) ? l.props.children : null : i);
|
|
79
|
+
return /* @__PURE__ */ a(L, { ...r, ref: t, children: u.isValidElement(l) ? u.cloneElement(l, void 0, c) : null });
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ a(L, { ...r, ref: t, children: o });
|
|
82
|
+
});
|
|
83
|
+
F.displayName = "Slot";
|
|
84
|
+
var L = u.forwardRef((e, t) => {
|
|
85
|
+
const { children: o, ...r } = e;
|
|
86
|
+
if (u.isValidElement(o)) {
|
|
87
|
+
const n = Re(o);
|
|
88
|
+
return u.cloneElement(o, {
|
|
89
|
+
...be(r, o.props),
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
ref: t ? Y(t, n) : n
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return u.Children.count(o) > 1 ? u.Children.only(null) : null;
|
|
95
|
+
});
|
|
96
|
+
L.displayName = "SlotClone";
|
|
97
|
+
var he = ({ children: e }) => /* @__PURE__ */ a(pe, { children: e });
|
|
98
|
+
function Ie(e) {
|
|
99
|
+
return u.isValidElement(e) && e.type === he;
|
|
100
|
+
}
|
|
101
|
+
function be(e, t) {
|
|
102
|
+
const o = { ...t };
|
|
103
|
+
for (const r in t) {
|
|
104
|
+
const n = e[r], s = t[r];
|
|
105
|
+
/^on[A-Z]/.test(r) ? n && s ? o[r] = (...c) => {
|
|
106
|
+
s(...c), n(...c);
|
|
107
|
+
} : n && (o[r] = n) : r === "style" ? o[r] = { ...n, ...s } : r === "className" && (o[r] = [n, s].filter(Boolean).join(" "));
|
|
108
|
+
}
|
|
109
|
+
return { ...e, ...o };
|
|
110
|
+
}
|
|
111
|
+
function Re(e) {
|
|
112
|
+
var r, n;
|
|
113
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, o = t && "isReactWarning" in t && t.isReactWarning;
|
|
114
|
+
return o ? e.ref : (t = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
|
|
115
|
+
}
|
|
116
|
+
var Te = [
|
|
117
|
+
"a",
|
|
118
|
+
"button",
|
|
119
|
+
"div",
|
|
120
|
+
"form",
|
|
121
|
+
"h2",
|
|
122
|
+
"h3",
|
|
123
|
+
"img",
|
|
124
|
+
"input",
|
|
125
|
+
"label",
|
|
126
|
+
"li",
|
|
127
|
+
"nav",
|
|
128
|
+
"ol",
|
|
129
|
+
"p",
|
|
130
|
+
"span",
|
|
131
|
+
"svg",
|
|
132
|
+
"ul"
|
|
133
|
+
], E = Te.reduce((e, t) => {
|
|
134
|
+
const o = u.forwardRef((r, n) => {
|
|
135
|
+
const { asChild: s, ...l } = r, c = s ? F : t;
|
|
136
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ a(c, { ...l, ref: n });
|
|
137
|
+
});
|
|
138
|
+
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
139
|
+
}, {});
|
|
140
|
+
function S(e, t, { checkForDefaultPrevented: o = !0 } = {}) {
|
|
141
|
+
return function(n) {
|
|
142
|
+
if (e == null || e(n), o === !1 || !n.defaultPrevented)
|
|
143
|
+
return t == null ? void 0 : t(n);
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function ye(e) {
|
|
147
|
+
const t = e + "CollectionProvider", [o, r] = U(t), [n, s] = o(
|
|
148
|
+
t,
|
|
149
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
150
|
+
), l = (b) => {
|
|
151
|
+
const { scope: f, children: h } = b, R = v.useRef(null), m = v.useRef(/* @__PURE__ */ new Map()).current;
|
|
152
|
+
return /* @__PURE__ */ a(n, { scope: f, itemMap: m, collectionRef: R, children: h });
|
|
153
|
+
};
|
|
154
|
+
l.displayName = t;
|
|
155
|
+
const c = e + "CollectionSlot", i = v.forwardRef(
|
|
156
|
+
(b, f) => {
|
|
157
|
+
const { scope: h, children: R } = b, m = s(c, h), I = D(f, m.collectionRef);
|
|
158
|
+
return /* @__PURE__ */ a(F, { ref: I, children: R });
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
i.displayName = c;
|
|
162
|
+
const d = e + "CollectionItemSlot", g = "data-radix-collection-item", p = v.forwardRef(
|
|
163
|
+
(b, f) => {
|
|
164
|
+
const { scope: h, children: R, ...m } = b, I = v.useRef(null), P = D(f, I), _ = s(d, h);
|
|
165
|
+
return v.useEffect(() => (_.itemMap.set(I, { ref: I, ...m }), () => void _.itemMap.delete(I))), /* @__PURE__ */ a(F, { [g]: "", ref: P, children: R });
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
p.displayName = d;
|
|
169
|
+
function C(b) {
|
|
170
|
+
const f = s(e + "CollectionConsumer", b);
|
|
171
|
+
return v.useCallback(() => {
|
|
172
|
+
const R = f.collectionRef.current;
|
|
173
|
+
if (!R) return [];
|
|
174
|
+
const m = Array.from(R.querySelectorAll(`[${g}]`));
|
|
175
|
+
return Array.from(f.itemMap.values()).sort(
|
|
176
|
+
(_, x) => m.indexOf(_.ref.current) - m.indexOf(x.ref.current)
|
|
177
|
+
);
|
|
178
|
+
}, [f.collectionRef, f.itemMap]);
|
|
179
|
+
}
|
|
180
|
+
return [
|
|
181
|
+
{ Provider: l, Slot: i, ItemSlot: p },
|
|
182
|
+
C,
|
|
183
|
+
r
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
var Se = globalThis != null && globalThis.document ? u.useLayoutEffect : () => {
|
|
187
|
+
}, Pe = u.useId || (() => {
|
|
188
|
+
}), _e = 0;
|
|
189
|
+
function Ge(e) {
|
|
190
|
+
const [t, o] = u.useState(Pe());
|
|
191
|
+
return Se(() => {
|
|
192
|
+
o((r) => r ?? String(_e++));
|
|
193
|
+
}, [e]), t ? `radix-${t}` : "";
|
|
194
|
+
}
|
|
195
|
+
function $(e) {
|
|
196
|
+
const t = u.useRef(e);
|
|
197
|
+
return u.useEffect(() => {
|
|
198
|
+
t.current = e;
|
|
199
|
+
}), u.useMemo(() => (...o) => {
|
|
200
|
+
var r;
|
|
201
|
+
return (r = t.current) == null ? void 0 : r.call(t, ...o);
|
|
202
|
+
}, []);
|
|
203
|
+
}
|
|
204
|
+
function N({
|
|
205
|
+
prop: e,
|
|
206
|
+
defaultProp: t,
|
|
207
|
+
onChange: o = () => {
|
|
208
|
+
}
|
|
209
|
+
}) {
|
|
210
|
+
const [r, n] = xe({ defaultProp: t, onChange: o }), s = e !== void 0, l = s ? e : r, c = $(o), i = u.useCallback(
|
|
211
|
+
(d) => {
|
|
212
|
+
if (s) {
|
|
213
|
+
const p = typeof d == "function" ? d(e) : d;
|
|
214
|
+
p !== e && c(p);
|
|
215
|
+
} else
|
|
216
|
+
n(d);
|
|
217
|
+
},
|
|
218
|
+
[s, e, n, c]
|
|
219
|
+
);
|
|
220
|
+
return [l, i];
|
|
221
|
+
}
|
|
222
|
+
function xe({
|
|
223
|
+
defaultProp: e,
|
|
224
|
+
onChange: t
|
|
225
|
+
}) {
|
|
226
|
+
const o = u.useState(e), [r] = o, n = u.useRef(r), s = $(t);
|
|
227
|
+
return u.useEffect(() => {
|
|
228
|
+
n.current !== r && (s(r), n.current = r);
|
|
229
|
+
}, [r, n, s]), o;
|
|
230
|
+
}
|
|
231
|
+
var Ee = u.createContext(void 0);
|
|
232
|
+
function z(e) {
|
|
233
|
+
const t = u.useContext(Ee);
|
|
234
|
+
return e || t || "ltr";
|
|
235
|
+
}
|
|
236
|
+
var O = "rovingFocusGroup.onEntryFocus", we = { bubbles: !1, cancelable: !0 }, k = "RovingFocusGroup", [V, q, Fe] = ye(k), [Ae, Z] = U(
|
|
237
|
+
k,
|
|
238
|
+
[Fe]
|
|
239
|
+
), [Ne, ke] = Ae(k), J = u.forwardRef(
|
|
240
|
+
(e, t) => /* @__PURE__ */ a(V.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(V.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(Me, { ...e, ref: t }) }) })
|
|
241
|
+
);
|
|
242
|
+
J.displayName = k;
|
|
243
|
+
var Me = u.forwardRef((e, t) => {
|
|
244
|
+
const {
|
|
245
|
+
__scopeRovingFocusGroup: o,
|
|
246
|
+
orientation: r,
|
|
247
|
+
loop: n = !1,
|
|
248
|
+
dir: s,
|
|
249
|
+
currentTabStopId: l,
|
|
250
|
+
defaultCurrentTabStopId: c,
|
|
251
|
+
onCurrentTabStopIdChange: i,
|
|
252
|
+
onEntryFocus: d,
|
|
253
|
+
preventScrollOnEntryFocus: g = !1,
|
|
254
|
+
...p
|
|
255
|
+
} = e, C = u.useRef(null), b = D(t, C), f = z(s), [h = null, R] = N({
|
|
256
|
+
prop: l,
|
|
257
|
+
defaultProp: c,
|
|
258
|
+
onChange: i
|
|
259
|
+
}), [m, I] = u.useState(!1), P = $(d), _ = q(o), x = u.useRef(!1), [le, K] = u.useState(0);
|
|
260
|
+
return u.useEffect(() => {
|
|
261
|
+
const T = C.current;
|
|
262
|
+
if (T)
|
|
263
|
+
return T.addEventListener(O, P), () => T.removeEventListener(O, P);
|
|
264
|
+
}, [P]), /* @__PURE__ */ a(
|
|
265
|
+
Ne,
|
|
266
|
+
{
|
|
267
|
+
scope: o,
|
|
268
|
+
orientation: r,
|
|
269
|
+
dir: f,
|
|
270
|
+
loop: n,
|
|
271
|
+
currentTabStopId: h,
|
|
272
|
+
onItemFocus: u.useCallback(
|
|
273
|
+
(T) => R(T),
|
|
274
|
+
[R]
|
|
275
|
+
),
|
|
276
|
+
onItemShiftTab: u.useCallback(() => I(!0), []),
|
|
277
|
+
onFocusableItemAdd: u.useCallback(
|
|
278
|
+
() => K((T) => T + 1),
|
|
279
|
+
[]
|
|
280
|
+
),
|
|
281
|
+
onFocusableItemRemove: u.useCallback(
|
|
282
|
+
() => K((T) => T - 1),
|
|
283
|
+
[]
|
|
284
|
+
),
|
|
285
|
+
children: /* @__PURE__ */ a(
|
|
286
|
+
E.div,
|
|
287
|
+
{
|
|
288
|
+
tabIndex: m || le === 0 ? -1 : 0,
|
|
289
|
+
"data-orientation": r,
|
|
290
|
+
...p,
|
|
291
|
+
ref: b,
|
|
292
|
+
style: { outline: "none", ...e.style },
|
|
293
|
+
onMouseDown: S(e.onMouseDown, () => {
|
|
294
|
+
x.current = !0;
|
|
295
|
+
}),
|
|
296
|
+
onFocus: S(e.onFocus, (T) => {
|
|
297
|
+
const ae = !x.current;
|
|
298
|
+
if (T.target === T.currentTarget && ae && !m) {
|
|
299
|
+
const j = new CustomEvent(O, we);
|
|
300
|
+
if (T.currentTarget.dispatchEvent(j), !j.defaultPrevented) {
|
|
301
|
+
const M = _().filter((y) => y.focusable), ie = M.find((y) => y.active), fe = M.find((y) => y.id === h), de = [ie, fe, ...M].filter(
|
|
302
|
+
Boolean
|
|
303
|
+
).map((y) => y.ref.current);
|
|
304
|
+
H(de, g);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
x.current = !1;
|
|
308
|
+
}),
|
|
309
|
+
onBlur: S(e.onBlur, () => I(!1))
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}), Q = "RovingFocusGroupItem", X = u.forwardRef(
|
|
315
|
+
(e, t) => {
|
|
316
|
+
const {
|
|
317
|
+
__scopeRovingFocusGroup: o,
|
|
318
|
+
focusable: r = !0,
|
|
319
|
+
active: n = !1,
|
|
320
|
+
tabStopId: s,
|
|
321
|
+
...l
|
|
322
|
+
} = e, c = Ge(), i = s || c, d = ke(Q, o), g = d.currentTabStopId === i, p = q(o), { onFocusableItemAdd: C, onFocusableItemRemove: b } = d;
|
|
323
|
+
return u.useEffect(() => {
|
|
324
|
+
if (r)
|
|
325
|
+
return C(), () => b();
|
|
326
|
+
}, [r, C, b]), /* @__PURE__ */ a(
|
|
327
|
+
V.ItemSlot,
|
|
328
|
+
{
|
|
329
|
+
scope: o,
|
|
330
|
+
id: i,
|
|
331
|
+
focusable: r,
|
|
332
|
+
active: n,
|
|
333
|
+
children: /* @__PURE__ */ a(
|
|
334
|
+
E.span,
|
|
335
|
+
{
|
|
336
|
+
tabIndex: g ? 0 : -1,
|
|
337
|
+
"data-orientation": d.orientation,
|
|
338
|
+
...l,
|
|
339
|
+
ref: t,
|
|
340
|
+
onMouseDown: S(e.onMouseDown, (f) => {
|
|
341
|
+
r ? d.onItemFocus(i) : f.preventDefault();
|
|
342
|
+
}),
|
|
343
|
+
onFocus: S(e.onFocus, () => d.onItemFocus(i)),
|
|
344
|
+
onKeyDown: S(e.onKeyDown, (f) => {
|
|
345
|
+
if (f.key === "Tab" && f.shiftKey) {
|
|
346
|
+
d.onItemShiftTab();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (f.target !== f.currentTarget) return;
|
|
350
|
+
const h = Le(f, d.orientation, d.dir);
|
|
351
|
+
if (h !== void 0) {
|
|
352
|
+
if (f.metaKey || f.ctrlKey || f.altKey || f.shiftKey) return;
|
|
353
|
+
f.preventDefault();
|
|
354
|
+
let m = p().filter((I) => I.focusable).map((I) => I.ref.current);
|
|
355
|
+
if (h === "last") m.reverse();
|
|
356
|
+
else if (h === "prev" || h === "next") {
|
|
357
|
+
h === "prev" && m.reverse();
|
|
358
|
+
const I = m.indexOf(f.currentTarget);
|
|
359
|
+
m = d.loop ? Ve(m, I + 1) : m.slice(I + 1);
|
|
360
|
+
}
|
|
361
|
+
setTimeout(() => H(m));
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
X.displayName = Q;
|
|
371
|
+
var Oe = {
|
|
372
|
+
ArrowLeft: "prev",
|
|
373
|
+
ArrowUp: "prev",
|
|
374
|
+
ArrowRight: "next",
|
|
375
|
+
ArrowDown: "next",
|
|
376
|
+
PageUp: "first",
|
|
377
|
+
Home: "first",
|
|
378
|
+
PageDown: "last",
|
|
379
|
+
End: "last"
|
|
380
|
+
};
|
|
381
|
+
function De(e, t) {
|
|
382
|
+
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
383
|
+
}
|
|
384
|
+
function Le(e, t, o) {
|
|
385
|
+
const r = De(e.key, o);
|
|
386
|
+
if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
|
|
387
|
+
return Oe[r];
|
|
388
|
+
}
|
|
389
|
+
function H(e, t = !1) {
|
|
390
|
+
const o = document.activeElement;
|
|
391
|
+
for (const r of e)
|
|
392
|
+
if (r === o || (r.focus({ preventScroll: t }), document.activeElement !== o)) return;
|
|
393
|
+
}
|
|
394
|
+
function Ve(e, t) {
|
|
395
|
+
return e.map((o, r) => e[(t + r) % e.length]);
|
|
396
|
+
}
|
|
397
|
+
var Ue = J, $e = X, Be = "Toggle", ee = u.forwardRef((e, t) => {
|
|
398
|
+
const { pressed: o, defaultPressed: r = !1, onPressedChange: n, ...s } = e, [l = !1, c] = N({
|
|
399
|
+
prop: o,
|
|
400
|
+
onChange: n,
|
|
401
|
+
defaultProp: r
|
|
402
|
+
});
|
|
403
|
+
return /* @__PURE__ */ a(
|
|
404
|
+
E.button,
|
|
405
|
+
{
|
|
406
|
+
type: "button",
|
|
407
|
+
"aria-pressed": l,
|
|
408
|
+
"data-state": l ? "on" : "off",
|
|
409
|
+
"data-disabled": e.disabled ? "" : void 0,
|
|
410
|
+
...s,
|
|
411
|
+
ref: t,
|
|
412
|
+
onClick: S(e.onClick, () => {
|
|
413
|
+
e.disabled || c(!l);
|
|
414
|
+
})
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
});
|
|
418
|
+
ee.displayName = Be;
|
|
419
|
+
var G = "ToggleGroup", [te, nt] = U(G, [
|
|
420
|
+
Z
|
|
421
|
+
]), oe = Z(), B = v.forwardRef((e, t) => {
|
|
422
|
+
const { type: o, ...r } = e;
|
|
423
|
+
if (o === "single")
|
|
424
|
+
return /* @__PURE__ */ a(Ke, { ...r, ref: t });
|
|
425
|
+
if (o === "multiple")
|
|
426
|
+
return /* @__PURE__ */ a(je, { ...r, ref: t });
|
|
427
|
+
throw new Error(`Missing prop \`type\` expected on \`${G}\``);
|
|
428
|
+
});
|
|
429
|
+
B.displayName = G;
|
|
430
|
+
var [re, ne] = te(G), Ke = v.forwardRef((e, t) => {
|
|
431
|
+
const {
|
|
432
|
+
value: o,
|
|
433
|
+
defaultValue: r,
|
|
434
|
+
onValueChange: n = () => {
|
|
435
|
+
},
|
|
436
|
+
...s
|
|
437
|
+
} = e, [l, c] = N({
|
|
438
|
+
prop: o,
|
|
439
|
+
defaultProp: r,
|
|
440
|
+
onChange: n
|
|
441
|
+
});
|
|
442
|
+
return /* @__PURE__ */ a(
|
|
443
|
+
re,
|
|
444
|
+
{
|
|
445
|
+
scope: e.__scopeToggleGroup,
|
|
446
|
+
type: "single",
|
|
447
|
+
value: l ? [l] : [],
|
|
448
|
+
onItemActivate: c,
|
|
449
|
+
onItemDeactivate: v.useCallback(() => c(""), [c]),
|
|
450
|
+
children: /* @__PURE__ */ a(se, { ...s, ref: t })
|
|
451
|
+
}
|
|
452
|
+
);
|
|
453
|
+
}), je = v.forwardRef((e, t) => {
|
|
454
|
+
const {
|
|
455
|
+
value: o,
|
|
456
|
+
defaultValue: r,
|
|
457
|
+
onValueChange: n = () => {
|
|
458
|
+
},
|
|
459
|
+
...s
|
|
460
|
+
} = e, [l = [], c] = N({
|
|
461
|
+
prop: o,
|
|
462
|
+
defaultProp: r,
|
|
463
|
+
onChange: n
|
|
464
|
+
}), i = v.useCallback(
|
|
465
|
+
(g) => c((p = []) => [...p, g]),
|
|
466
|
+
[c]
|
|
467
|
+
), d = v.useCallback(
|
|
468
|
+
(g) => c((p = []) => p.filter((C) => C !== g)),
|
|
469
|
+
[c]
|
|
470
|
+
);
|
|
471
|
+
return /* @__PURE__ */ a(
|
|
472
|
+
re,
|
|
473
|
+
{
|
|
474
|
+
scope: e.__scopeToggleGroup,
|
|
475
|
+
type: "multiple",
|
|
476
|
+
value: l,
|
|
477
|
+
onItemActivate: i,
|
|
478
|
+
onItemDeactivate: d,
|
|
479
|
+
children: /* @__PURE__ */ a(se, { ...s, ref: t })
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
});
|
|
483
|
+
B.displayName = G;
|
|
484
|
+
var [We, Ye] = te(G), se = v.forwardRef(
|
|
485
|
+
(e, t) => {
|
|
486
|
+
const {
|
|
487
|
+
__scopeToggleGroup: o,
|
|
488
|
+
disabled: r = !1,
|
|
489
|
+
rovingFocus: n = !0,
|
|
490
|
+
orientation: s,
|
|
491
|
+
dir: l,
|
|
492
|
+
loop: c = !0,
|
|
493
|
+
...i
|
|
494
|
+
} = e, d = oe(o), g = z(l), p = { role: "group", dir: g, ...i };
|
|
495
|
+
return /* @__PURE__ */ a(We, { scope: o, rovingFocus: n, disabled: r, children: n ? /* @__PURE__ */ a(
|
|
496
|
+
Ue,
|
|
497
|
+
{
|
|
498
|
+
asChild: !0,
|
|
499
|
+
...d,
|
|
500
|
+
orientation: s,
|
|
501
|
+
dir: g,
|
|
502
|
+
loop: c,
|
|
503
|
+
children: /* @__PURE__ */ a(E.div, { ...p, ref: t })
|
|
504
|
+
}
|
|
505
|
+
) : /* @__PURE__ */ a(E.div, { ...p, ref: t }) });
|
|
506
|
+
}
|
|
507
|
+
), A = "ToggleGroupItem", ce = v.forwardRef(
|
|
508
|
+
(e, t) => {
|
|
509
|
+
const o = ne(A, e.__scopeToggleGroup), r = Ye(A, e.__scopeToggleGroup), n = oe(e.__scopeToggleGroup), s = o.value.includes(e.value), l = r.disabled || e.disabled, c = { ...e, pressed: s, disabled: l }, i = v.useRef(null);
|
|
510
|
+
return r.rovingFocus ? /* @__PURE__ */ a(
|
|
511
|
+
$e,
|
|
512
|
+
{
|
|
513
|
+
asChild: !0,
|
|
514
|
+
...n,
|
|
515
|
+
focusable: !l,
|
|
516
|
+
active: s,
|
|
517
|
+
ref: i,
|
|
518
|
+
children: /* @__PURE__ */ a(W, { ...c, ref: t })
|
|
519
|
+
}
|
|
520
|
+
) : /* @__PURE__ */ a(W, { ...c, ref: t });
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
ce.displayName = A;
|
|
524
|
+
var W = v.forwardRef(
|
|
525
|
+
(e, t) => {
|
|
526
|
+
const { __scopeToggleGroup: o, value: r, ...n } = e, s = ne(A, o), l = { role: "radio", "aria-checked": e.pressed, "aria-pressed": void 0 }, c = s.type === "single" ? l : void 0;
|
|
527
|
+
return /* @__PURE__ */ a(
|
|
528
|
+
ee,
|
|
529
|
+
{
|
|
530
|
+
...c,
|
|
531
|
+
...n,
|
|
532
|
+
ref: t,
|
|
533
|
+
onPressedChange: (i) => {
|
|
534
|
+
i ? s.onItemActivate(r) : s.onItemDeactivate(r);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
), ze = B, qe = ce;
|
|
540
|
+
const ue = v.createContext({
|
|
541
|
+
size: "medium",
|
|
542
|
+
focusMode: "system",
|
|
543
|
+
mode: "system"
|
|
544
|
+
}), Ze = ({ focusMode: e }) => w("focus:outline", "focus:outline-2", "focus:outline-offset", {
|
|
545
|
+
"focus:outline-focus-light": e === "light",
|
|
546
|
+
"focus:outline-focus-dark": e === "dark",
|
|
547
|
+
"focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
|
|
548
|
+
"focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
|
|
549
|
+
}), Je = ({ mode: e }) => w({
|
|
550
|
+
"data-[state=on]:bg-surface-medium": e === "dark",
|
|
551
|
+
"data-[state=on]:bg-surface-lightest": e === "light",
|
|
552
|
+
"data-[state=on]:bg-surface-lightest dark:data-[state=on]:bg-surface-medium": e === "system",
|
|
553
|
+
"data-[state=on]:bg-surface-medium dark:data-[state=on]:bg-surface-lightest": e === "alt-system"
|
|
554
|
+
}), Qe = ({ size: e }) => w("mx-1", "first:ml-0 last:mr-0", {
|
|
555
|
+
"h-5 px-2": e === "small",
|
|
556
|
+
"h-6 px-3": e === "medium",
|
|
557
|
+
"h-7 px-4": e === "large"
|
|
558
|
+
}), Xe = ({
|
|
559
|
+
focusMode: e,
|
|
560
|
+
mode: t,
|
|
561
|
+
size: o
|
|
562
|
+
}) => w(
|
|
563
|
+
"flex items-center justify-center bg-transparent",
|
|
564
|
+
"rounded-sm",
|
|
565
|
+
"transition duration-200 ease",
|
|
566
|
+
Qe({ size: o }),
|
|
567
|
+
Ze({ focusMode: e }),
|
|
568
|
+
Je({ mode: t })
|
|
569
|
+
), He = ({ mode: e }) => w(me, "inline-flex p-1", "rounded-sm", {
|
|
570
|
+
"bg-surface-light text-copy-dark": e === "light",
|
|
571
|
+
"bg-surface-darker text-copy-lighter": e === "dark",
|
|
572
|
+
"bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-lighter": e === "system",
|
|
573
|
+
"bg-surface-darker text-copy-lighter dark:bg-surface-light dark:text-copy-dark": e === "alt-system"
|
|
574
|
+
}), st = ({
|
|
575
|
+
children: e,
|
|
576
|
+
value: t,
|
|
577
|
+
onValueChange: o,
|
|
578
|
+
disabled: r,
|
|
579
|
+
mode: n = "system",
|
|
580
|
+
focusMode: s = "system",
|
|
581
|
+
size: l = "medium",
|
|
582
|
+
defaultValue: c,
|
|
583
|
+
...i
|
|
584
|
+
}) => {
|
|
585
|
+
const d = He({ mode: n }), g = { size: l, focusMode: s, mode: n };
|
|
586
|
+
return /* @__PURE__ */ a(ue.Provider, { value: g, children: /* @__PURE__ */ a(
|
|
587
|
+
ze,
|
|
588
|
+
{
|
|
589
|
+
disabled: r,
|
|
590
|
+
className: d,
|
|
591
|
+
value: t,
|
|
592
|
+
defaultValue: c,
|
|
593
|
+
onValueChange: o,
|
|
594
|
+
...i,
|
|
595
|
+
type: "single",
|
|
596
|
+
children: e
|
|
597
|
+
}
|
|
598
|
+
) });
|
|
599
|
+
}, ct = ({ value: e, disabled: t }) => {
|
|
600
|
+
const { size: o, focusMode: r, mode: n } = ge(ue), s = Xe({
|
|
601
|
+
focusMode: r,
|
|
602
|
+
mode: n,
|
|
603
|
+
size: o
|
|
604
|
+
});
|
|
605
|
+
return /* @__PURE__ */ a(
|
|
606
|
+
qe,
|
|
607
|
+
{
|
|
608
|
+
disabled: t,
|
|
609
|
+
className: s,
|
|
610
|
+
value: e,
|
|
611
|
+
children: e
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
};
|
|
615
|
+
export {
|
|
616
|
+
me as TOGGLEGROUP_CLASSNAME,
|
|
617
|
+
st as ToggleGroup,
|
|
618
|
+
ct as ToggleGroupItem
|
|
619
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::-ms-backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-ms-input-placeholder,textarea::-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}@keyframes blink{50%{fill:transparent}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.visible{visibility:visible}.m-0{margin:0}.m-1{margin:.25rem}.m-10{margin:2.5rem}.m-11{margin:2.75rem}.m-12{margin:3rem}.m-14{margin:3.5rem}.m-16{margin:4rem}.m-2{margin:.5rem}.m-20{margin:5rem}.m-24{margin:6rem}.m-28{margin:7rem}.m-3{margin:.75rem}.m-32{margin:8rem}.m-36{margin:9rem}.m-4{margin:1rem}.m-44{margin:11rem}.m-48{margin:12rem}.m-5{margin:1.25rem}.m-52{margin:13rem}.m-56{margin:14rem}.m-6{margin:1.5rem}.m-60{margin:15rem}.m-64{margin:16rem}.m-7{margin:1.75rem}.m-72{margin:18rem}.m-8{margin:2rem}.m-80{margin:20rem}.m-9{margin:2.25rem}.m-96{margin:24rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-11{margin-bottom:2.75rem}.mb-12{margin-bottom:3rem}.mb-14{margin-bottom:3.5rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-28{margin-bottom:7rem}.mb-3{margin-bottom:.75rem}.mb-32{margin-bottom:8rem}.mb-36{margin-bottom:9rem}.mb-4{margin-bottom:1rem}.mb-44{margin-bottom:11rem}.mb-48{margin-bottom:12rem}.mb-5{margin-bottom:1.25rem}.mb-52{margin-bottom:13rem}.mb-56{margin-bottom:14rem}.mb-6{margin-bottom:1.5rem}.mb-60{margin-bottom:15rem}.mb-64{margin-bottom:16rem}.mb-7{margin-bottom:1.75rem}.mb-72{margin-bottom:18rem}.mb-8{margin-bottom:2rem}.mb-80{margin-bottom:20rem}.mb-9{margin-bottom:2.25rem}.mb-96{margin-bottom:24rem}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-11{margin-left:2.75rem}.ml-12{margin-left:3rem}.ml-14{margin-left:3.5rem}.ml-16{margin-left:4rem}.ml-2{margin-left:.5rem}.ml-20{margin-left:5rem}.ml-24{margin-left:6rem}.ml-28{margin-left:7rem}.ml-3{margin-left:.75rem}.ml-32{margin-left:8rem}.ml-36{margin-left:9rem}.ml-4{margin-left:1rem}.ml-44{margin-left:11rem}.ml-48{margin-left:12rem}.ml-5{margin-left:1.25rem}.ml-52{margin-left:13rem}.ml-56{margin-left:14rem}.ml-6{margin-left:1.5rem}.ml-60{margin-left:15rem}.ml-64{margin-left:16rem}.ml-7{margin-left:1.75rem}.ml-72{margin-left:18rem}.ml-8{margin-left:2rem}.ml-80{margin-left:20rem}.ml-9{margin-left:2.25rem}.ml-96{margin-left:24rem}.mr-0{margin-right:0}.mr-1{margin-right:.25rem}.mr-10{margin-right:2.5rem}.mr-11{margin-right:2.75rem}.mr-12{margin-right:3rem}.mr-14{margin-right:3.5rem}.mr-16{margin-right:4rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mr-24{margin-right:6rem}.mr-28{margin-right:7rem}.mr-3{margin-right:.75rem}.mr-32{margin-right:8rem}.mr-36{margin-right:9rem}.mr-4{margin-right:1rem}.mr-44{margin-right:11rem}.mr-48{margin-right:12rem}.mr-5{margin-right:1.25rem}.mr-52{margin-right:13rem}.mr-56{margin-right:14rem}.mr-6{margin-right:1.5rem}.mr-60{margin-right:15rem}.mr-64{margin-right:16rem}.mr-7{margin-right:1.75rem}.mr-72{margin-right:18rem}.mr-8{margin-right:2rem}.mr-80{margin-right:20rem}.mr-9{margin-right:2.25rem}.mr-96{margin-right:24rem}.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-11{margin-top:2.75rem}.mt-12{margin-top:3rem}.mt-14{margin-top:3.5rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-28{margin-top:7rem}.mt-3{margin-top:.75rem}.mt-32{margin-top:8rem}.mt-36{margin-top:9rem}.mt-4{margin-top:1rem}.mt-44{margin-top:11rem}.mt-48{margin-top:12rem}.mt-5{margin-top:1.25rem}.mt-52{margin-top:13rem}.mt-56{margin-top:14rem}.mt-6{margin-top:1.5rem}.mt-60{margin-top:15rem}.mt-64{margin-top:16rem}.mt-7{margin-top:1.75rem}.mt-72{margin-top:18rem}.mt-8{margin-top:2rem}.mt-80{margin-top:20rem}.mt-9{margin-top:2.25rem}.mt-96{margin-top:24rem}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.place-items-center{place-items:center}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-sm{border-radius:.125rem}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-surface-darker{--tw-bg-opacity: 1;background-color:var(--av-surface-darker, rgb(15 23 42 / var(--tw-bg-opacity)))}.bg-surface-light{--tw-bg-opacity: 1;background-color:var(--av-surface-light, rgb(203 213 225 / var(--tw-bg-opacity)))}.bg-surface-lightest{--tw-bg-opacity: 1;background-color:var(--av-surface-lightest, rgb(241 245 249 / var(--tw-bg-opacity)))}.bg-surface-medium{--tw-bg-opacity: 1;background-color:var(--av-surface-medium, rgb(100 116 139 / var(--tw-bg-opacity)))}.bg-transparent{background-color:transparent}.p-1{padding:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.text-copy-dark{--tw-text-opacity: 1;color:var(--av-copy-dark, rgb(15 23 42 / var(--tw-text-opacity)))}.text-copy-lighter{--tw-text-opacity: 1;color:var(--av-copy-lighter, rgb(255 255 255 / var(--tw-text-opacity)))}.outline-focus-dark{outline-color:var(--av-focus-dark, rgb(21 128 61 / 1))}.outline-focus-light{outline-color:var(--av-focus-light, rgb(134 239 172 / 1))}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.transition{transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.first\:ml-0:first-child{margin-left:0}.last\:mr-0:last-child{margin-right:0}.focus\:outline:focus{outline-style:solid}.focus\:outline-2:focus{outline-width:2px}.focus\:outline-focus-dark:focus{outline-color:var(--av-focus-dark, rgb(21 128 61 / 1))}.focus\:outline-focus-light:focus{outline-color:var(--av-focus-light, rgb(134 239 172 / 1))}.data-\[state\=on\]\:bg-surface-lightest[data-state=on]{--tw-bg-opacity: 1;background-color:var(--av-surface-lightest, rgb(241 245 249 / var(--tw-bg-opacity)))}.data-\[state\=on\]\:bg-surface-medium[data-state=on]{--tw-bg-opacity: 1;background-color:var(--av-surface-medium, rgb(100 116 139 / var(--tw-bg-opacity)))}@media (min-width: 640px){.sm\:bg-black\/\[\.8\]{background-color:#000c}}@media (prefers-color-scheme: dark){.dark\:bg-surface-darker{--tw-bg-opacity: 1;background-color:var(--av-surface-darker, rgb(15 23 42 / var(--tw-bg-opacity)))}.dark\:bg-surface-light{--tw-bg-opacity: 1;background-color:var(--av-surface-light, rgb(203 213 225 / var(--tw-bg-opacity)))}.dark\:text-copy-dark{--tw-text-opacity: 1;color:var(--av-copy-dark, rgb(15 23 42 / var(--tw-text-opacity)))}.dark\:text-copy-lighter{--tw-text-opacity: 1;color:var(--av-copy-lighter, rgb(255 255 255 / var(--tw-text-opacity)))}.dark\:focus\:outline-focus-dark:focus{outline-color:var(--av-focus-dark, rgb(21 128 61 / 1))}.dark\:focus\:outline-focus-light:focus{outline-color:var(--av-focus-light, rgb(134 239 172 / 1))}.dark\:data-\[state\=on\]\:bg-surface-lightest[data-state=on]{--tw-bg-opacity: 1;background-color:var(--av-surface-lightest, rgb(241 245 249 / var(--tw-bg-opacity)))}.dark\:data-\[state\=on\]\:bg-surface-medium[data-state=on]{--tw-bg-opacity: 1;background-color:var(--av-surface-medium, rgb(100 116 139 / var(--tw-bg-opacity)))}}
|
package/dist/style.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@versini/ui-togglegroup",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Arno Versini",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/aversini/ui-components",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@github.com:aversini/ui-components.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build:check": "tsc",
|
|
22
|
+
"build:js": "vite build",
|
|
23
|
+
"build:types": "tsup",
|
|
24
|
+
"build": "npm-run-all --serial clean build:check build:js build:types",
|
|
25
|
+
"clean": "rimraf dist tmp",
|
|
26
|
+
"dev:js": "vite build --watch --mode development",
|
|
27
|
+
"dev:types": "tsup --watch src",
|
|
28
|
+
"dev": "npm-run-all clean --parallel dev:js dev:types",
|
|
29
|
+
"lint": "biome lint src",
|
|
30
|
+
"start": "static-server dist --port 5173",
|
|
31
|
+
"test:coverage:ui": "vitest --coverage --ui",
|
|
32
|
+
"test:coverage": "vitest run --coverage",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^18.3.1",
|
|
38
|
+
"react-dom": "^18.3.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@radix-ui/react-toggle-group": "1.1.0",
|
|
42
|
+
"@tailwindcss/typography": "0.5.15",
|
|
43
|
+
"@versini/ui-private": "1.4.17",
|
|
44
|
+
"clsx": "2.1.1",
|
|
45
|
+
"tailwindcss": "3.4.13"
|
|
46
|
+
},
|
|
47
|
+
"sideEffects": [
|
|
48
|
+
"**/*.css"
|
|
49
|
+
],
|
|
50
|
+
"gitHead": "a794f971b2597435e86222a2cfbd39306f4d49f5"
|
|
51
|
+
}
|