sinwan-ui-core 0.0.0 → 1.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.
@@ -0,0 +1,107 @@
1
+ // src/core.tsx
2
+ import { unwrap as _$unwrap } from "sinwan/reactivity";
3
+ import { cc, onMounted, onUnmounted } from "sinwan/component";
4
+ import { Portal as SinwanPortal2, Show as Show3 } from "sinwan/control-flow";
5
+ import { effect, signal as signal2, untrack } from "sinwan/reactivity";
6
+ import { jsx } from "sinwan/jsx-runtime";
7
+ var DEFAULT_EXIT_MS = 200;
8
+ var Presence2 = cc((props) => {
9
+ const mounted = signal2(untrack(() => Boolean(props.present)));
10
+ let exitTimer;
11
+ function clearExitTimer() {
12
+ if (exitTimer !== undefined) {
13
+ window.clearTimeout(exitTimer);
14
+ exitTimer = undefined;
15
+ }
16
+ }
17
+ effect(() => {
18
+ const next = Boolean(props.present);
19
+ untrack(() => {
20
+ if (next) {
21
+ clearExitTimer();
22
+ mounted.value = true;
23
+ return;
24
+ }
25
+ if (!mounted.value)
26
+ return;
27
+ clearExitTimer();
28
+ const delay = props.exitMs ?? DEFAULT_EXIT_MS;
29
+ if (delay <= 0) {
30
+ mounted.value = false;
31
+ return;
32
+ }
33
+ exitTimer = window.setTimeout(() => {
34
+ exitTimer = undefined;
35
+ mounted.value = false;
36
+ }, delay);
37
+ });
38
+ });
39
+ onUnmounted(clearExitTimer);
40
+ return /* @__PURE__ */ jsx(Show3, {
41
+ when: () => mounted.value,
42
+ fallback: null,
43
+ children: () => _$unwrap(props).children
44
+ });
45
+ });
46
+ var UiPortal2 = cc((props) => {
47
+ return /* @__PURE__ */ jsx(SinwanPortal2, {
48
+ mount: () => {
49
+ if (typeof props.container === "function")
50
+ return props.container();
51
+ return props.container ?? document.body;
52
+ },
53
+ children: () => _$unwrap(props).children
54
+ });
55
+ });
56
+ function readOptionValue(value) {
57
+ if (typeof value === "function" && value.length === 0) {
58
+ return value();
59
+ }
60
+ return value;
61
+ }
62
+ function useControllableState2(options) {
63
+ const isControlled = "value" in options;
64
+ const read = () => isControlled ? readOptionValue(options.value) : options.defaultValue;
65
+ const state = signal2(isControlled ? read() : options.defaultValue);
66
+ const setState = (value) => {
67
+ const current = isControlled ? read() : state.value;
68
+ const next = typeof value === "function" ? value(current) : value;
69
+ if (!isControlled)
70
+ state.value = next;
71
+ options.onChange?.(next);
72
+ };
73
+ onMounted(() => {
74
+ const sync = () => {
75
+ if (!isControlled)
76
+ return;
77
+ const v = read();
78
+ if (v !== undefined && v !== state.value)
79
+ state.value = v;
80
+ };
81
+ sync();
82
+ const id = window.setInterval(sync, 16);
83
+ onUnmounted(() => window.clearInterval(id));
84
+ });
85
+ return [state, setState];
86
+ }
87
+ function getFocusableElements2(root) {
88
+ const selector = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
89
+ return Array.from(root.querySelectorAll(selector)).filter((el) => !el.hasAttribute("disabled") && el.tabIndex !== -1);
90
+ }
91
+ function trapFocus2(event, root) {
92
+ if (event.key !== "Tab")
93
+ return;
94
+ const focusables = getFocusableElements2(root);
95
+ if (focusables.length === 0)
96
+ return;
97
+ const first = focusables[0];
98
+ const last = focusables[focusables.length - 1];
99
+ if (event.shiftKey && document.activeElement === first) {
100
+ event.preventDefault();
101
+ last.focus();
102
+ } else if (!event.shiftKey && document.activeElement === last) {
103
+ event.preventDefault();
104
+ first.focus();
105
+ }
106
+ }
107
+ export { SinwanPortal2, Show3, signal2, Presence2, UiPortal2, useControllableState2, getFocusableElements2, trapFocus2 };
@@ -0,0 +1,29 @@
1
+ // src/direction.tsx
2
+ import { _$createTemplate } from "sinwan/renderer/web";
3
+ import { unwrap as _$unwrap } from "sinwan/reactivity";
4
+ import { cc, inject, provide } from "sinwan/component";
5
+ import { computed, signal } from "sinwan/reactivity";
6
+ var _$tmpl_0 = {
7
+ html: '<div dir="" data-slot="direction-provider"></div>',
8
+ slots: [
9
+ { path: [], type: "attr", name: "dir" },
10
+ { path: [], type: "child" }
11
+ ]
12
+ };
13
+ var DirectionKey2 = Symbol("sinwan-ui.direction");
14
+ var DirectionProvider2 = cc((props) => {
15
+ const dirLocal = signal("ltr");
16
+ const dir = "dir" in props ? computed(() => props.dir ?? "ltr") : dirLocal;
17
+ const setDir = (next) => {
18
+ if (!("dir" in props))
19
+ dirLocal.value = next;
20
+ };
21
+ provide(DirectionKey2, { dir, setDir });
22
+ return _$createTemplate(_$tmpl_0, [() => dir.value, () => _$unwrap(props).children]);
23
+ });
24
+ function useDirection2() {
25
+ const api = inject(DirectionKey2);
26
+ return api?.dir.value ?? "ltr";
27
+ }
28
+
29
+ export { DirectionKey2, DirectionProvider2, useDirection2 };
@@ -0,0 +1,448 @@
1
+ import {
2
+ Presence2
3
+ } from "./chunk-ejwby1pn.js";
4
+
5
+ // src/controls.tsx
6
+ import { _$createTemplate } from "sinwan/renderer/web";
7
+ import { unwrap as _$unwrap } from "sinwan/reactivity";
8
+ import { cc, inject, provide } from "sinwan/component";
9
+ import { For as For2, Show as Show2 } from "sinwan/control-flow";
10
+ import { computed, signal } from "sinwan/reactivity";
11
+ import { jsx } from "sinwan/jsx-runtime";
12
+ var _$tmpl_0 = {
13
+ html: '<div data-slot="tabs" data-orientation="" data-horizontal="" data-vertical=""></div>',
14
+ slots: [
15
+ { path: [], type: "attr", name: "data-orientation" },
16
+ { path: [], type: "attr", name: "data-horizontal" },
17
+ { path: [], type: "attr", name: "data-vertical" },
18
+ { path: [], type: "attr", name: "class" },
19
+ { path: [], type: "child" }
20
+ ]
21
+ };
22
+ var _$tmpl_1 = {
23
+ html: '<div role="tablist" data-slot="tabs-list" data-variant=""></div>',
24
+ slots: [
25
+ { path: [], type: "attr", name: "data-variant" },
26
+ { path: [], type: "attr", name: "class" },
27
+ { path: [], type: "child" }
28
+ ]
29
+ };
30
+ var _$tmpl_2 = {
31
+ html: '<button type="button" role="tab" data-slot="tabs-trigger" data-state="" aria-selected="" disabled=""></button>',
32
+ slots: [
33
+ { path: [], type: "attr", name: "data-state" },
34
+ { path: [], type: "attr", name: "aria-selected" },
35
+ { path: [], type: "attr", name: "disabled" },
36
+ { path: [], type: "attr", name: "class" },
37
+ { path: [], type: "event", name: "onclick" },
38
+ { path: [], type: "child" }
39
+ ]
40
+ };
41
+ var _$tmpl_3 = {
42
+ html: '<div data-slot="accordion"></div>',
43
+ slots: [
44
+ { path: [], type: "attr", name: "class" },
45
+ { path: [], type: "child" }
46
+ ]
47
+ };
48
+ var _$tmpl_4 = {
49
+ html: '<div data-slot="accordion-item" data-state=""></div>',
50
+ slots: [
51
+ { path: [], type: "attr", name: "data-state" },
52
+ { path: [], type: "attr", name: "class" },
53
+ { path: [], type: "child" }
54
+ ]
55
+ };
56
+ var _$tmpl_5 = {
57
+ html: '<button type="button" data-slot="accordion-trigger" aria-expanded=""></button>',
58
+ slots: [
59
+ { path: [], type: "attr", name: "aria-expanded" },
60
+ { path: [], type: "attr", name: "class" },
61
+ { path: [], type: "event", name: "onclick" },
62
+ { path: [], type: "child" }
63
+ ]
64
+ };
65
+ var _$tmpl_6 = {
66
+ html: '<button type="button" role="checkbox" id="" data-slot="checkbox" data-state="" aria-checked="" aria-label="" disabled="" name="" value=""></button>',
67
+ slots: [
68
+ { path: [], type: "attr", name: "id" },
69
+ { path: [], type: "attr", name: "data-state" },
70
+ { path: [], type: "attr", name: "aria-checked" },
71
+ { path: [], type: "attr", name: "aria-label" },
72
+ { path: [], type: "attr", name: "disabled" },
73
+ { path: [], type: "attr", name: "class" },
74
+ { path: [], type: "attr", name: "name" },
75
+ { path: [], type: "attr", name: "value" },
76
+ { path: [], type: "event", name: "onclick" },
77
+ { path: [], type: "child" }
78
+ ]
79
+ };
80
+ var _$tmpl_7 = {
81
+ html: '<button type="button" role="switch" id="" data-slot="switch" data-size="" data-state="" aria-checked="" disabled=""></button>',
82
+ slots: [
83
+ { path: [], type: "attr", name: "id" },
84
+ { path: [], type: "attr", name: "data-size" },
85
+ { path: [], type: "attr", name: "data-state" },
86
+ { path: [], type: "attr", name: "aria-checked" },
87
+ { path: [], type: "attr", name: "disabled" },
88
+ { path: [], type: "attr", name: "class" },
89
+ { path: [], type: "event", name: "onclick" },
90
+ { path: [], type: "child" }
91
+ ]
92
+ };
93
+ var _$tmpl_8 = {
94
+ html: '<div role="radiogroup" data-slot="radio-group"></div>',
95
+ slots: [
96
+ { path: [], type: "attr", name: "class" },
97
+ { path: [], type: "child" }
98
+ ]
99
+ };
100
+ var _$tmpl_9 = {
101
+ html: '<button type="button" role="radio" id="" data-slot="radio-group-item" data-state="" aria-checked="" disabled=""></button>',
102
+ slots: [
103
+ { path: [], type: "attr", name: "id" },
104
+ { path: [], type: "attr", name: "data-state" },
105
+ { path: [], type: "attr", name: "aria-checked" },
106
+ { path: [], type: "attr", name: "disabled" },
107
+ { path: [], type: "attr", name: "class" },
108
+ { path: [], type: "event", name: "onclick" },
109
+ { path: [], type: "child" }
110
+ ]
111
+ };
112
+ var _$tmpl_10 = {
113
+ html: '<button type="button" data-slot="toggle" data-state="" aria-pressed="" disabled=""></button>',
114
+ slots: [
115
+ { path: [], type: "attr", name: "data-state" },
116
+ { path: [], type: "attr", name: "aria-pressed" },
117
+ { path: [], type: "attr", name: "disabled" },
118
+ { path: [], type: "attr", name: "class" },
119
+ { path: [], type: "event", name: "onclick" },
120
+ { path: [], type: "child" }
121
+ ]
122
+ };
123
+ var _$tmpl_11 = {
124
+ html: '<div data-slot="toggle-group" role="group" style="" data-variant="" data-size="" data-spacing="" data-orientation=""></div>',
125
+ slots: [
126
+ { path: [], type: "attr", name: "class" },
127
+ { path: [], type: "attr", name: "style" },
128
+ { path: [], type: "attr", name: "data-variant" },
129
+ { path: [], type: "attr", name: "data-size" },
130
+ { path: [], type: "attr", name: "data-spacing" },
131
+ { path: [], type: "attr", name: "data-orientation" },
132
+ { path: [], type: "child" }
133
+ ]
134
+ };
135
+ var _$tmpl_12 = {
136
+ html: '<button type="button" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
137
+ slots: [
138
+ { path: [], type: "attr", name: "data-variant" },
139
+ { path: [], type: "attr", name: "data-size" },
140
+ { path: [], type: "attr", name: "data-spacing" },
141
+ { path: [], type: "attr", name: "data-state" },
142
+ { path: [], type: "attr", name: "disabled" },
143
+ { path: [], type: "attr", name: "class" },
144
+ { path: [], type: "event", name: "onclick" },
145
+ { path: [], type: "child" }
146
+ ]
147
+ };
148
+ function toValueList(v) {
149
+ if (v == null)
150
+ return [];
151
+ return Array.isArray(v) ? v : v ? [v] : [];
152
+ }
153
+ var TabsKey2 = Symbol("sinwan-ui.tabs");
154
+ var TabsRoot2 = cc((props) => {
155
+ const valueLocal = signal(props.defaultValue ?? "");
156
+ const value = "value" in props ? computed(() => props.value ?? "") : valueLocal;
157
+ const set = (next) => {
158
+ if (!("value" in props))
159
+ valueLocal.value = next;
160
+ };
161
+ provide(TabsKey2, {
162
+ value,
163
+ setValue: (v) => {
164
+ set(v);
165
+ props.onValueChange?.(v);
166
+ }
167
+ });
168
+ return _$createTemplate(_$tmpl_0, [
169
+ () => _$unwrap(props).orientation ?? "horizontal",
170
+ () => (_$unwrap(props).orientation ?? "horizontal") === "horizontal" ? "" : undefined,
171
+ () => _$unwrap(props).orientation === "vertical" ? "" : undefined,
172
+ () => _$unwrap(props).class,
173
+ () => _$unwrap(props).children
174
+ ]);
175
+ });
176
+ var TabsList2 = cc((props) => _$createTemplate(_$tmpl_1, [
177
+ () => props["data-variant"],
178
+ () => _$unwrap(props).class,
179
+ () => _$unwrap(props).children
180
+ ]));
181
+ var TabsTrigger2 = cc((props) => {
182
+ const api = inject(TabsKey2);
183
+ return _$createTemplate(_$tmpl_2, [
184
+ () => api.value.value === _$unwrap(props).value ? "active" : "inactive",
185
+ () => api.value.value === _$unwrap(props).value,
186
+ () => _$unwrap(props).disabled,
187
+ () => _$unwrap(props).class,
188
+ () => {
189
+ if (!props.disabled)
190
+ api.setValue(props.value);
191
+ },
192
+ () => _$unwrap(props).children
193
+ ]);
194
+ });
195
+ var TabsContent2 = cc((props) => {
196
+ const api = inject(TabsKey2);
197
+ return /* @__PURE__ */ jsx(Show2, {
198
+ when: () => api.value.value === _$unwrap(props).value,
199
+ children: /* @__PURE__ */ jsx("div", {
200
+ role: "tabpanel",
201
+ "data-slot": "tabs-content",
202
+ "data-state": "active",
203
+ class: () => _$unwrap(props).class,
204
+ children: () => _$unwrap(props).children
205
+ })
206
+ });
207
+ });
208
+ var AccordionKey2 = Symbol("sinwan-ui.accordion");
209
+ var AccordionItemKey2 = Symbol("sinwan-ui.accordion-item");
210
+ var AccordionRoot2 = cc((props) => {
211
+ const type = () => props.type ?? "single";
212
+ const collapsible = () => props.collapsible ?? true;
213
+ const valueLocal = signal(toValueList(props.defaultValue));
214
+ const value = "value" in props ? computed(() => toValueList(props.value)) : valueLocal;
215
+ const set = (next) => {
216
+ if (!("value" in props))
217
+ valueLocal.value = next;
218
+ };
219
+ provide(AccordionKey2, {
220
+ type: type(),
221
+ value,
222
+ toggle: (item) => {
223
+ let next;
224
+ if (type() === "single") {
225
+ const open = value.value.includes(item);
226
+ next = open && collapsible() ? [] : [item];
227
+ } else {
228
+ next = value.value.includes(item) ? value.value.filter((v) => v !== item) : [...value.value, item];
229
+ }
230
+ set(next);
231
+ props.onValueChange?.(type() === "single" ? next[0] ?? "" : next);
232
+ }
233
+ });
234
+ return _$createTemplate(_$tmpl_3, [() => _$unwrap(props).class, () => _$unwrap(props).children]);
235
+ });
236
+ var AccordionItem2 = cc((props) => {
237
+ provide(AccordionItemKey2, { value: props.value });
238
+ const api = inject(AccordionKey2);
239
+ return _$createTemplate(_$tmpl_4, [
240
+ () => api.value.value.includes(_$unwrap(props).value) ? "open" : "closed",
241
+ () => _$unwrap(props).class,
242
+ () => _$unwrap(props).children
243
+ ]);
244
+ });
245
+ var AccordionTrigger2 = cc((props) => {
246
+ const root = inject(AccordionKey2);
247
+ const item = inject(AccordionItemKey2);
248
+ return _$createTemplate(_$tmpl_5, [
249
+ () => root.value.value.includes(item.value) ? "true" : "false",
250
+ () => _$unwrap(props).class,
251
+ () => root.toggle(item.value),
252
+ () => _$unwrap(props).children
253
+ ]);
254
+ });
255
+ var AccordionContent2 = cc((props) => {
256
+ const root = inject(AccordionKey2);
257
+ const item = inject(AccordionItemKey2);
258
+ function open() {
259
+ return root.value.value.includes(item.value);
260
+ }
261
+ function stateAttr() {
262
+ return open() ? "open" : "closed";
263
+ }
264
+ function bindContent(el) {
265
+ if (el == null)
266
+ return;
267
+ const node = el;
268
+ function measure() {
269
+ const inner = node.firstElementChild;
270
+ const height = inner instanceof HTMLElement ? inner.scrollHeight : node.scrollHeight;
271
+ node.style.setProperty("--radix-accordion-content-height", `${height}px`);
272
+ }
273
+ measure();
274
+ requestAnimationFrame(measure);
275
+ }
276
+ return /* @__PURE__ */ jsx(Presence2, {
277
+ present: () => open(),
278
+ children: /* @__PURE__ */ jsx("div", {
279
+ "data-slot": "accordion-content",
280
+ "data-state": stateAttr,
281
+ class: () => _$unwrap(props).class,
282
+ ref: bindContent,
283
+ children: () => _$unwrap(props).children
284
+ })
285
+ });
286
+ });
287
+ var CheckboxRoot2 = cc((props) => {
288
+ const checkedLocal = signal(props.defaultChecked ?? false);
289
+ const checked = "checked" in props ? computed(() => Boolean(props.checked)) : checkedLocal;
290
+ const setChecked = (next) => {
291
+ if (!("checked" in props))
292
+ checkedLocal.value = next;
293
+ };
294
+ const mixedLocal = signal(false);
295
+ const mixed = "indeterminate" in props ? computed(() => Boolean(props.indeterminate)) : mixedLocal;
296
+ const setMixed = (next) => {
297
+ if (!("indeterminate" in props))
298
+ mixedLocal.value = next;
299
+ };
300
+ return _$createTemplate(_$tmpl_6, [
301
+ () => _$unwrap(props).id,
302
+ () => mixed.value ? "indeterminate" : checked.value ? "checked" : "unchecked",
303
+ () => mixed.value ? "mixed" : checked.value,
304
+ () => props["aria-label"],
305
+ () => _$unwrap(props).disabled,
306
+ () => _$unwrap(props).class,
307
+ () => _$unwrap(props).name,
308
+ () => _$unwrap(props).value,
309
+ () => {
310
+ if (props.disabled)
311
+ return;
312
+ const next = mixed.value ? true : !checked.value;
313
+ setChecked(next);
314
+ setMixed(false);
315
+ props.onCheckedChange?.(next);
316
+ },
317
+ () => _$unwrap(props).children
318
+ ]);
319
+ });
320
+ var SwitchRoot2 = cc((props) => {
321
+ const checkedLocal = signal(props.defaultChecked ?? false);
322
+ const checked = "checked" in props ? computed(() => Boolean(props.checked)) : checkedLocal;
323
+ const set = (next) => {
324
+ if (!("checked" in props))
325
+ checkedLocal.value = next;
326
+ };
327
+ return _$createTemplate(_$tmpl_7, [
328
+ () => _$unwrap(props).id,
329
+ () => props["data-size"],
330
+ () => checked.value ? "checked" : "unchecked",
331
+ () => checked.value,
332
+ () => _$unwrap(props).disabled,
333
+ () => _$unwrap(props).class,
334
+ () => {
335
+ if (props.disabled)
336
+ return;
337
+ const next = !checked.value;
338
+ set(next);
339
+ props.onCheckedChange?.(next);
340
+ },
341
+ () => _$unwrap(props).children
342
+ ]);
343
+ });
344
+ var RadioGroupKey2 = Symbol("sinwan-ui.radio-group");
345
+ var RadioGroupRoot2 = cc((props) => {
346
+ const valueLocal = signal(props.defaultValue ?? "");
347
+ const value = "value" in props ? computed(() => props.value ?? "") : valueLocal;
348
+ const set = (next) => {
349
+ if (!("value" in props))
350
+ valueLocal.value = next;
351
+ };
352
+ provide(RadioGroupKey2, {
353
+ value,
354
+ name: props.name,
355
+ setValue: (v) => {
356
+ set(v);
357
+ props.onValueChange?.(v);
358
+ }
359
+ });
360
+ return _$createTemplate(_$tmpl_8, [() => _$unwrap(props).class, () => _$unwrap(props).children]);
361
+ });
362
+ var RadioGroupItem2 = cc((props) => {
363
+ const api = inject(RadioGroupKey2);
364
+ return _$createTemplate(_$tmpl_9, [
365
+ () => _$unwrap(props).id,
366
+ () => api.value.value === _$unwrap(props).value ? "checked" : "unchecked",
367
+ () => api.value.value === _$unwrap(props).value,
368
+ () => _$unwrap(props).disabled,
369
+ () => _$unwrap(props).class,
370
+ () => {
371
+ if (!props.disabled)
372
+ api.setValue(props.value);
373
+ },
374
+ () => _$unwrap(props).children
375
+ ]);
376
+ });
377
+ var ToggleRoot2 = cc((props) => {
378
+ const pressedLocal = signal(props.defaultPressed ?? false);
379
+ const pressed = "pressed" in props ? computed(() => Boolean(props.pressed)) : pressedLocal;
380
+ const set = (next) => {
381
+ if (!("pressed" in props))
382
+ pressedLocal.value = next;
383
+ };
384
+ return _$createTemplate(_$tmpl_10, [
385
+ () => pressed.value ? "on" : "off",
386
+ () => pressed.value,
387
+ () => _$unwrap(props).disabled,
388
+ () => _$unwrap(props).class,
389
+ () => {
390
+ if (props.disabled)
391
+ return;
392
+ const next = !pressed.value;
393
+ set(next);
394
+ props.onPressedChange?.(next);
395
+ },
396
+ () => _$unwrap(props).children
397
+ ]);
398
+ });
399
+ var ToggleGroupKey2 = Symbol("sinwan-ui.toggle-group");
400
+ var ToggleGroupRoot2 = cc((props) => {
401
+ const type = () => props.type ?? "single";
402
+ const valueLocal = signal(toValueList(props.defaultValue));
403
+ const value = "value" in props ? computed(() => toValueList(props.value)) : valueLocal;
404
+ const set = (next) => {
405
+ if (!("value" in props))
406
+ valueLocal.value = next;
407
+ };
408
+ provide(ToggleGroupKey2, {
409
+ type: type(),
410
+ value,
411
+ toggle: (item) => {
412
+ let next;
413
+ if (type() === "single") {
414
+ next = value.value.includes(item) ? [] : [item];
415
+ } else {
416
+ next = value.value.includes(item) ? value.value.filter((x) => x !== item) : [...value.value, item];
417
+ }
418
+ set(next);
419
+ props.onValueChange?.(type() === "single" ? next[0] ?? "" : next);
420
+ }
421
+ });
422
+ return _$createTemplate(_$tmpl_11, [
423
+ () => _$unwrap(props).class,
424
+ () => _$unwrap(props).style,
425
+ () => props["data-variant"],
426
+ () => props["data-size"],
427
+ () => props["data-spacing"],
428
+ () => props["data-orientation"],
429
+ () => _$unwrap(props).children
430
+ ]);
431
+ });
432
+ var ToggleGroupItem2 = cc((props) => {
433
+ const api = inject(ToggleGroupKey2);
434
+ return _$createTemplate(_$tmpl_12, [
435
+ () => props["data-variant"],
436
+ () => props["data-size"],
437
+ () => props["data-spacing"],
438
+ () => api.value.value.includes(_$unwrap(props).value) ? "on" : "off",
439
+ () => _$unwrap(props).disabled,
440
+ () => _$unwrap(props).class,
441
+ () => {
442
+ if (!props.disabled)
443
+ api.toggle(props.value);
444
+ },
445
+ () => _$unwrap(props).children
446
+ ]);
447
+ });
448
+ export { For2, Show2, TabsKey2, TabsRoot2, TabsList2, TabsTrigger2, TabsContent2, AccordionKey2, AccordionItemKey2, AccordionRoot2, AccordionItem2, AccordionTrigger2, AccordionContent2, CheckboxRoot2, SwitchRoot2, RadioGroupKey2, RadioGroupRoot2, RadioGroupItem2, ToggleRoot2, ToggleGroupKey2, ToggleGroupRoot2, ToggleGroupItem2 };