sinwan-ui-core 1.6.0 → 2.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/CHANGELOG.md +35 -0
- package/agents/internal/llms.controlled.txt +39 -0
- package/agents/internal/llms.form.txt +43 -0
- package/agents/internal/llms.ids.txt +46 -0
- package/agents/internal/llms.modal.txt +51 -0
- package/agents/llms.controls.txt +82 -0
- package/agents/llms.core.txt +73 -0
- package/agents/llms.direction.txt +51 -0
- package/agents/llms.dismiss.txt +79 -0
- package/agents/llms.floating.txt +47 -0
- package/agents/llms.index.txt +46 -0
- package/agents/llms.menu-sub.txt +66 -0
- package/agents/llms.menu.txt +94 -0
- package/agents/llms.overlay.txt +122 -0
- package/agents/llms.sinwan-preload.txt +33 -0
- package/agents/llms.slot.txt +51 -0
- package/agents/llms.theme.txt +59 -0
- package/agents/llms.txt +45 -0
- package/agents/llms.types.txt +39 -0
- package/dist/chunks/chunk-7c8ct63g.js +126 -0
- package/dist/chunks/{chunk-saen52f0.js → chunk-eczk2z48.js} +26 -14
- package/dist/chunks/{chunk-f6hw8ash.js → chunk-fe933s8d.js} +2 -2
- package/dist/chunks/chunk-rxbeqj7g.js +65 -0
- package/dist/chunks/{chunk-0dsacv44.js → chunk-s84my297.js} +124 -27
- package/dist/chunks/{chunk-6bm550r5.js → chunk-w6wwgdg6.js} +205 -46
- package/dist/chunks/{chunk-bw9vp0y9.js → chunk-wjzadrvr.js} +54 -0
- package/dist/chunks/{chunk-zmvg5gy1.js → chunk-y1ag4hk4.js} +57 -9
- package/dist/controls.d.ts +4 -0
- package/dist/controls.js +4 -4
- package/dist/core.d.ts +8 -0
- package/dist/core.js +4 -2
- package/dist/direction.d.ts +7 -1
- package/dist/direction.js +1 -1
- package/dist/dismiss.d.ts +18 -0
- package/dist/dismiss.js +9 -3
- package/dist/floating.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -25
- package/dist/internal/controlled.d.ts +1 -0
- package/dist/internal/form.d.ts +6 -0
- package/dist/internal/ids.d.ts +8 -0
- package/dist/internal/modal.d.ts +8 -0
- package/dist/menu-sub.d.ts +10 -2
- package/dist/menu-sub.js +3 -2
- package/dist/menu.d.ts +66 -0
- package/dist/menu.js +16 -0
- package/dist/overlay.d.ts +27 -2
- package/dist/overlay.js +6 -4
- package/dist/slot.d.ts +1 -0
- package/dist/slot.js +1 -1
- package/dist/theme.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +16 -7
- package/dist/chunks/chunk-9whagkb6.js +0 -31
|
@@ -13,9 +13,20 @@ function isControlledProp(props, key, component) {
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// src/internal/ids.ts
|
|
17
|
+
import { getCurrentInstance } from "sinwan/component";
|
|
18
|
+
var mountCount = 0;
|
|
19
|
+
function treeId(prefix) {
|
|
20
|
+
const path = getCurrentInstance()?.idPath;
|
|
21
|
+
if (path !== undefined)
|
|
22
|
+
return `sinwan-ui-${prefix}-t${path.replace(/\./g, "_")}`;
|
|
23
|
+
mountCount += 1;
|
|
24
|
+
return `sinwan-ui-${prefix}-${mountCount}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
// src/core.tsx
|
|
17
28
|
import { unwrap as _$unwrap } from "sinwan/reactivity";
|
|
18
|
-
import { cc,
|
|
29
|
+
import { cc, onUnmounted } from "sinwan/component";
|
|
19
30
|
import { Portal as SinwanPortal2, Show as Show3 } from "sinwan/control-flow";
|
|
20
31
|
import { effect, signal as signal2, untrack } from "sinwan/reactivity";
|
|
21
32
|
import { jsx } from "sinwan/jsx-runtime";
|
|
@@ -55,7 +66,7 @@ var Presence2 = cc((props) => {
|
|
|
55
66
|
return /* @__PURE__ */ jsx(Show3, {
|
|
56
67
|
when: () => mounted.value,
|
|
57
68
|
fallback: null,
|
|
58
|
-
children:
|
|
69
|
+
children: props.children
|
|
59
70
|
});
|
|
60
71
|
});
|
|
61
72
|
var UiPortal2 = cc((props) => {
|
|
@@ -85,18 +96,15 @@ function useControllableState2(options) {
|
|
|
85
96
|
state.value = next;
|
|
86
97
|
options.onChange?.(next);
|
|
87
98
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!isControlled)
|
|
91
|
-
return;
|
|
99
|
+
if (isControlled) {
|
|
100
|
+
effect(() => {
|
|
92
101
|
const v = read();
|
|
93
|
-
|
|
94
|
-
state.value
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
102
|
+
untrack(() => {
|
|
103
|
+
if (v !== undefined && v !== state.value)
|
|
104
|
+
state.value = v;
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
100
108
|
return [state, setState];
|
|
101
109
|
}
|
|
102
110
|
function getFocusableElements2(root) {
|
|
@@ -119,4 +127,8 @@ function trapFocus2(event, root) {
|
|
|
119
127
|
first.focus();
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
|
-
|
|
130
|
+
function usePartId2(prefix) {
|
|
131
|
+
return treeId(prefix);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { isControlledProp, treeId, SinwanPortal2, Show3, signal2, Presence2, UiPortal2, useControllableState2, getFocusableElements2, trapFocus2, usePartId2 };
|
|
@@ -22,8 +22,8 @@ var DirectionProvider2 = cc((props) => {
|
|
|
22
22
|
return _$createTemplate(_$tmpl_0, [() => dir.value, () => _$unwrap(props).children]);
|
|
23
23
|
});
|
|
24
24
|
function useDirection2() {
|
|
25
|
-
const api = inject(DirectionKey2);
|
|
26
|
-
return api?.dir.value ?? "ltr";
|
|
25
|
+
const api = inject(DirectionKey2, null);
|
|
26
|
+
return computed(() => api?.dir.value ?? "ltr");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export { DirectionKey2, DirectionProvider2, useDirection2 };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/dismiss.ts
|
|
2
|
+
import { onUnmounted } from "sinwan/component";
|
|
3
|
+
import { effect, untrack } from "sinwan/reactivity";
|
|
4
|
+
var DISMISS_EXEMPT_SELECTOR = [
|
|
5
|
+
"[data-slot$='-menu-content']",
|
|
6
|
+
"[data-slot='menubar-content']",
|
|
7
|
+
"[data-slot$='-sub-content']",
|
|
8
|
+
"[data-slot='select-content']",
|
|
9
|
+
"[data-slot='popover-content']",
|
|
10
|
+
"[data-slot='dialog-content']",
|
|
11
|
+
"[data-slot='alert-dialog-content']",
|
|
12
|
+
"[data-slot='sheet-content']",
|
|
13
|
+
"[data-slot='drawer-content']",
|
|
14
|
+
"[data-slot$='-overlay']",
|
|
15
|
+
"select",
|
|
16
|
+
"option",
|
|
17
|
+
"optgroup"
|
|
18
|
+
].join(",");
|
|
19
|
+
function isDismissExemptPointerTarget2(target) {
|
|
20
|
+
if (target == null)
|
|
21
|
+
return false;
|
|
22
|
+
let el = null;
|
|
23
|
+
if (target instanceof Element) {
|
|
24
|
+
el = target;
|
|
25
|
+
} else if (target instanceof Node) {
|
|
26
|
+
el = target.parentElement;
|
|
27
|
+
}
|
|
28
|
+
if (el == null)
|
|
29
|
+
return false;
|
|
30
|
+
return el.closest(DISMISS_EXEMPT_SELECTOR) != null;
|
|
31
|
+
}
|
|
32
|
+
var layerStack = [];
|
|
33
|
+
function pushDismissLayer2(token) {
|
|
34
|
+
layerStack.push(token);
|
|
35
|
+
return () => {
|
|
36
|
+
const index = layerStack.lastIndexOf(token);
|
|
37
|
+
if (index !== -1)
|
|
38
|
+
layerStack.splice(index, 1);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function isTopDismissLayer2(token) {
|
|
42
|
+
return layerStack[layerStack.length - 1] === token;
|
|
43
|
+
}
|
|
44
|
+
function useDismissLayer2(open) {
|
|
45
|
+
const token = {};
|
|
46
|
+
let remove;
|
|
47
|
+
effect(() => {
|
|
48
|
+
const isOpen = open();
|
|
49
|
+
untrack(() => {
|
|
50
|
+
if (isOpen && !remove)
|
|
51
|
+
remove = pushDismissLayer2(token);
|
|
52
|
+
if (!isOpen && remove) {
|
|
53
|
+
remove();
|
|
54
|
+
remove = undefined;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
onUnmounted(() => {
|
|
59
|
+
remove?.();
|
|
60
|
+
remove = undefined;
|
|
61
|
+
});
|
|
62
|
+
return { isTop: () => remove !== undefined && isTopDismissLayer2(token) };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { isDismissExemptPointerTarget2, pushDismissLayer2, isTopDismissLayer2, useDismissLayer2 };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isControlledProp,
|
|
3
|
+
treeId,
|
|
3
4
|
Presence2
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-eczk2z48.js";
|
|
5
6
|
import {
|
|
6
7
|
DirectionKey2
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-fe933s8d.js";
|
|
8
9
|
|
|
9
10
|
// src/controls.tsx
|
|
10
11
|
import { _$createTemplate } from "sinwan/renderer/web";
|
|
@@ -13,12 +14,27 @@ import {
|
|
|
13
14
|
cc,
|
|
14
15
|
getRawProps,
|
|
15
16
|
inject,
|
|
16
|
-
onUnmounted,
|
|
17
|
+
onUnmounted as onUnmounted2,
|
|
17
18
|
provide
|
|
18
19
|
} from "sinwan/component";
|
|
19
20
|
import { For as For2, Show as Show2 } from "sinwan/control-flow";
|
|
20
21
|
import { computed, signal } from "sinwan/reactivity";
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
// src/internal/form.ts
|
|
24
|
+
import { onMounted, onUnmounted } from "sinwan/component";
|
|
25
|
+
function useFormReset(input, reset) {
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
const form = input()?.form;
|
|
28
|
+
if (!form)
|
|
29
|
+
return;
|
|
30
|
+
const onReset = () => queueMicrotask(reset);
|
|
31
|
+
form.addEventListener("reset", onReset);
|
|
32
|
+
onUnmounted(() => form.removeEventListener("reset", onReset));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/controls.tsx
|
|
37
|
+
import { jsx, jsxs } from "sinwan/jsx-runtime";
|
|
22
38
|
var _$tmpl_0 = {
|
|
23
39
|
html: '<div data-slot="tabs" data-orientation="" data-horizontal="" data-vertical=""></div>',
|
|
24
40
|
slots: [
|
|
@@ -70,7 +86,7 @@ var _$tmpl_4 = {
|
|
|
70
86
|
]
|
|
71
87
|
};
|
|
72
88
|
var _$tmpl_5 = {
|
|
73
|
-
html: '<button type="button" role="checkbox" id="" data-slot="checkbox" data-state="" aria-checked="" aria-label="" disabled="" name="" value=""
|
|
89
|
+
html: '<button type="button" role="checkbox" id="" data-slot="checkbox" data-state="" aria-checked="" aria-label="" disabled="" name="" value=""><!--s:0--><!--s:1--></button>',
|
|
74
90
|
slots: [
|
|
75
91
|
{ path: [], type: "attr", name: "id" },
|
|
76
92
|
{ path: [], type: "attr", name: "data-state" },
|
|
@@ -81,10 +97,38 @@ var _$tmpl_5 = {
|
|
|
81
97
|
{ path: [], type: "attr", name: "name" },
|
|
82
98
|
{ path: [], type: "attr", name: "value" },
|
|
83
99
|
{ path: [], type: "event", name: "onclick" },
|
|
84
|
-
{ path: [], type: "child" }
|
|
100
|
+
{ path: [0], type: "child" },
|
|
101
|
+
{ path: [1], type: "child" }
|
|
85
102
|
]
|
|
86
103
|
};
|
|
87
104
|
var _$tmpl_6 = {
|
|
105
|
+
html: '<input type="hidden" name="" value="" disabled="" />',
|
|
106
|
+
slots: [
|
|
107
|
+
{ path: [], type: "attr", name: "name" },
|
|
108
|
+
{ path: [], type: "attr", name: "value" },
|
|
109
|
+
{ path: [], type: "attr", name: "disabled" },
|
|
110
|
+
{ path: [], type: "ref", name: "ref" }
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
var _$tmpl_7 = {
|
|
114
|
+
html: '<input type="hidden" name="" value="" disabled="" />',
|
|
115
|
+
slots: [
|
|
116
|
+
{ path: [], type: "attr", name: "name" },
|
|
117
|
+
{ path: [], type: "attr", name: "value" },
|
|
118
|
+
{ path: [], type: "attr", name: "disabled" },
|
|
119
|
+
{ path: [], type: "ref", name: "ref" }
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
var _$tmpl_8 = {
|
|
123
|
+
html: '<input type="hidden" name="" value="" disabled="" />',
|
|
124
|
+
slots: [
|
|
125
|
+
{ path: [], type: "attr", name: "name" },
|
|
126
|
+
{ path: [], type: "attr", name: "value" },
|
|
127
|
+
{ path: [], type: "attr", name: "disabled" },
|
|
128
|
+
{ path: [], type: "ref", name: "ref" }
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
var _$tmpl_9 = {
|
|
88
132
|
html: '<button type="button" role="radio" id="" data-slot="radio-group-item" data-state="" aria-checked="" tabIndex="" disabled=""></button>',
|
|
89
133
|
slots: [
|
|
90
134
|
{ path: [], type: "ref", name: "ref" },
|
|
@@ -99,7 +143,7 @@ var _$tmpl_6 = {
|
|
|
99
143
|
{ path: [], type: "child" }
|
|
100
144
|
]
|
|
101
145
|
};
|
|
102
|
-
var _$
|
|
146
|
+
var _$tmpl_10 = {
|
|
103
147
|
html: '<button type="button" data-slot="toggle" data-state="" aria-pressed="" disabled=""></button>',
|
|
104
148
|
slots: [
|
|
105
149
|
{ path: [], type: "attr", name: "data-state" },
|
|
@@ -110,9 +154,12 @@ var _$tmpl_7 = {
|
|
|
110
154
|
{ path: [], type: "child" }
|
|
111
155
|
]
|
|
112
156
|
};
|
|
113
|
-
var _$
|
|
114
|
-
html: '<button type="button" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
|
|
157
|
+
var _$tmpl_11 = {
|
|
158
|
+
html: '<button type="button" role="" aria-checked="" aria-pressed="" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
|
|
115
159
|
slots: [
|
|
160
|
+
{ path: [], type: "attr", name: "role" },
|
|
161
|
+
{ path: [], type: "attr", name: "aria-checked" },
|
|
162
|
+
{ path: [], type: "attr", name: "aria-pressed" },
|
|
116
163
|
{ path: [], type: "attr", name: "data-variant" },
|
|
117
164
|
{ path: [], type: "attr", name: "data-size" },
|
|
118
165
|
{ path: [], type: "attr", name: "data-spacing" },
|
|
@@ -131,11 +178,6 @@ function toValueList(v) {
|
|
|
131
178
|
function ariaOf(props) {
|
|
132
179
|
return Object.fromEntries(Object.entries(getRawProps(props)).filter(([key]) => key.startsWith("aria-")));
|
|
133
180
|
}
|
|
134
|
-
var idCount = 0;
|
|
135
|
-
function nextId(prefix) {
|
|
136
|
-
idCount += 1;
|
|
137
|
-
return `sinwan-ui-${prefix}-${idCount}`;
|
|
138
|
-
}
|
|
139
181
|
function idPart(value) {
|
|
140
182
|
return value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
141
183
|
}
|
|
@@ -178,7 +220,7 @@ function createRovingFocus(value, select) {
|
|
|
178
220
|
}
|
|
179
221
|
function useRovingItem(register, entry) {
|
|
180
222
|
let unregister;
|
|
181
|
-
|
|
223
|
+
onUnmounted2(() => unregister?.());
|
|
182
224
|
return (el) => {
|
|
183
225
|
if (el && !unregister)
|
|
184
226
|
unregister = register({ ...entry, el });
|
|
@@ -197,7 +239,7 @@ var TabsRoot2 = cc((props) => {
|
|
|
197
239
|
set(v);
|
|
198
240
|
props.onValueChange?.(v);
|
|
199
241
|
};
|
|
200
|
-
const baseId =
|
|
242
|
+
const baseId = treeId("tabs");
|
|
201
243
|
provide(TabsKey2, {
|
|
202
244
|
value,
|
|
203
245
|
setValue,
|
|
@@ -375,6 +417,14 @@ var CheckboxRoot2 = cc((props) => {
|
|
|
375
417
|
if (!("indeterminate" in props))
|
|
376
418
|
mixedLocal.value = next;
|
|
377
419
|
};
|
|
420
|
+
let input = null;
|
|
421
|
+
useFormReset(() => input, () => {
|
|
422
|
+
const initial = props.defaultChecked ?? false;
|
|
423
|
+
if (checked.value === initial)
|
|
424
|
+
return;
|
|
425
|
+
setChecked(initial);
|
|
426
|
+
props.onCheckedChange?.(initial);
|
|
427
|
+
});
|
|
378
428
|
return _$createTemplate(_$tmpl_5, [
|
|
379
429
|
() => _$unwrap(props).id,
|
|
380
430
|
() => mixed.value ? "indeterminate" : checked.value ? "checked" : "unchecked",
|
|
@@ -392,7 +442,15 @@ var CheckboxRoot2 = cc((props) => {
|
|
|
392
442
|
setMixed(false);
|
|
393
443
|
props.onCheckedChange?.(next);
|
|
394
444
|
},
|
|
395
|
-
() => _$unwrap(props).children
|
|
445
|
+
() => _$unwrap(props).children,
|
|
446
|
+
() => _$unwrap(props).name ? _$createTemplate(_$tmpl_6, [
|
|
447
|
+
() => _$unwrap(props).name,
|
|
448
|
+
() => _$unwrap(props).value ?? "on",
|
|
449
|
+
() => Boolean(_$unwrap(props).disabled) || mixed.value || !checked.value,
|
|
450
|
+
(el) => {
|
|
451
|
+
input = el;
|
|
452
|
+
}
|
|
453
|
+
]) : null
|
|
396
454
|
]);
|
|
397
455
|
});
|
|
398
456
|
var SwitchRoot2 = cc((props) => {
|
|
@@ -402,7 +460,15 @@ var SwitchRoot2 = cc((props) => {
|
|
|
402
460
|
if (!("checked" in props))
|
|
403
461
|
checkedLocal.value = next;
|
|
404
462
|
};
|
|
405
|
-
|
|
463
|
+
let input = null;
|
|
464
|
+
useFormReset(() => input, () => {
|
|
465
|
+
const initial = props.defaultChecked ?? false;
|
|
466
|
+
if (checked.value === initial)
|
|
467
|
+
return;
|
|
468
|
+
set(initial);
|
|
469
|
+
props.onCheckedChange?.(initial);
|
|
470
|
+
});
|
|
471
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
406
472
|
...ariaOf(props),
|
|
407
473
|
type: "button",
|
|
408
474
|
role: "switch",
|
|
@@ -420,7 +486,17 @@ var SwitchRoot2 = cc((props) => {
|
|
|
420
486
|
set(next);
|
|
421
487
|
props.onCheckedChange?.(next);
|
|
422
488
|
},
|
|
423
|
-
children:
|
|
489
|
+
children: [
|
|
490
|
+
() => _$unwrap(props).children,
|
|
491
|
+
() => _$unwrap(props).name ? _$createTemplate(_$tmpl_7, [
|
|
492
|
+
() => _$unwrap(props).name,
|
|
493
|
+
() => _$unwrap(props).value ?? "on",
|
|
494
|
+
() => Boolean(_$unwrap(props).disabled) || !checked.value,
|
|
495
|
+
(el) => {
|
|
496
|
+
input = el;
|
|
497
|
+
}
|
|
498
|
+
]) : null
|
|
499
|
+
]
|
|
424
500
|
});
|
|
425
501
|
});
|
|
426
502
|
var RadioGroupKey2 = Symbol("sinwan-ui.radio-group");
|
|
@@ -444,12 +520,28 @@ var RadioGroupRoot2 = cc((props) => {
|
|
|
444
520
|
tabStop: roving.tabStop,
|
|
445
521
|
move: roving.move
|
|
446
522
|
});
|
|
447
|
-
|
|
523
|
+
let input = null;
|
|
524
|
+
useFormReset(() => input, () => {
|
|
525
|
+
const initial = props.defaultValue ?? "";
|
|
526
|
+
if (value.value !== initial)
|
|
527
|
+
setValue(initial);
|
|
528
|
+
});
|
|
529
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
448
530
|
...ariaOf(props),
|
|
449
531
|
role: "radiogroup",
|
|
450
532
|
"data-slot": "radio-group",
|
|
451
533
|
class: () => _$unwrap(props).class,
|
|
452
|
-
children:
|
|
534
|
+
children: [
|
|
535
|
+
() => _$unwrap(props).children,
|
|
536
|
+
() => _$unwrap(props).name ? _$createTemplate(_$tmpl_8, [
|
|
537
|
+
() => _$unwrap(props).name,
|
|
538
|
+
() => value.value,
|
|
539
|
+
() => value.value === "",
|
|
540
|
+
(el) => {
|
|
541
|
+
input = el;
|
|
542
|
+
}
|
|
543
|
+
]) : null
|
|
544
|
+
]
|
|
453
545
|
});
|
|
454
546
|
});
|
|
455
547
|
function radioStep(key, dir) {
|
|
@@ -468,7 +560,7 @@ var RadioGroupItem2 = cc((props) => {
|
|
|
468
560
|
value: () => props.value,
|
|
469
561
|
disabled: () => Boolean(props.disabled)
|
|
470
562
|
});
|
|
471
|
-
return _$createTemplate(_$
|
|
563
|
+
return _$createTemplate(_$tmpl_9, [
|
|
472
564
|
ref,
|
|
473
565
|
() => _$unwrap(props).id,
|
|
474
566
|
() => api.value.value === _$unwrap(props).value ? "checked" : "unchecked",
|
|
@@ -497,7 +589,7 @@ var ToggleRoot2 = cc((props) => {
|
|
|
497
589
|
if (!("pressed" in props))
|
|
498
590
|
pressedLocal.value = next;
|
|
499
591
|
};
|
|
500
|
-
return _$createTemplate(_$
|
|
592
|
+
return _$createTemplate(_$tmpl_10, [
|
|
501
593
|
() => pressed.value ? "on" : "off",
|
|
502
594
|
() => pressed.value,
|
|
503
595
|
() => _$unwrap(props).disabled,
|
|
@@ -551,10 +643,15 @@ var ToggleGroupRoot2 = cc((props) => {
|
|
|
551
643
|
});
|
|
552
644
|
var ToggleGroupItem2 = cc((props) => {
|
|
553
645
|
const api = inject(ToggleGroupKey2);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
646
|
+
const on = () => api.value.value.includes(props.value);
|
|
647
|
+
const single = api.type === "single";
|
|
648
|
+
return _$createTemplate(_$tmpl_11, [
|
|
649
|
+
single ? "radio" : undefined,
|
|
650
|
+
() => single ? on() : undefined,
|
|
651
|
+
() => single ? undefined : on(),
|
|
652
|
+
props["data-variant"],
|
|
653
|
+
props["data-size"],
|
|
654
|
+
props["data-spacing"],
|
|
558
655
|
() => api.value.value.includes(_$unwrap(props).value) ? "on" : "off",
|
|
559
656
|
() => _$unwrap(props).disabled,
|
|
560
657
|
() => _$unwrap(props).class,
|