@glasshome/ui 1.20.0 → 1.21.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/dist/solid/index.js +6 -26
- package/dist/tokens/index.js +2 -1
- package/package.json +1 -1
- package/src/solid/toggle-group.tsx +5 -30
- package/src/tokens/presets.ts +1 -0
package/dist/solid/index.js
CHANGED
|
@@ -19083,21 +19083,8 @@ var ck = Object.assign(sk, { Item: ak }), lk = ce({
|
|
|
19083
19083
|
"size",
|
|
19084
19084
|
"tone",
|
|
19085
19085
|
"children"
|
|
19086
|
-
]), r = () => !e.multiple
|
|
19087
|
-
|
|
19088
|
-
let e = o.querySelectorAll("[data-slot=\"toggle-group-item\"]"), t = 8 + 4 * Math.max(0, e.length - 1);
|
|
19089
|
-
for (let n of e) t += n.scrollWidth;
|
|
19090
|
-
let n = o.parentElement?.clientWidth ?? o.clientWidth;
|
|
19091
|
-
a(t > n + 1);
|
|
19092
|
-
};
|
|
19093
|
-
return Tt(() => {
|
|
19094
|
-
if (!o || typeof ResizeObserver > "u") return;
|
|
19095
|
-
let e = new ResizeObserver(s);
|
|
19096
|
-
e.observe(o), o.parentElement && e.observe(o.parentElement), P(() => e.disconnect());
|
|
19097
|
-
}), R(ck, H({
|
|
19098
|
-
ref: (e) => {
|
|
19099
|
-
o = e;
|
|
19100
|
-
},
|
|
19086
|
+
]), r = () => !e.multiple;
|
|
19087
|
+
return R(ck, H({
|
|
19101
19088
|
"data-slot": "toggle-group",
|
|
19102
19089
|
get "data-variant"() {
|
|
19103
19090
|
return t.variant;
|
|
@@ -19105,11 +19092,8 @@ var ck = Object.assign(sk, { Item: ak }), lk = ce({
|
|
|
19105
19092
|
get "data-size"() {
|
|
19106
19093
|
return t.size;
|
|
19107
19094
|
},
|
|
19108
|
-
get "data-wrap"() {
|
|
19109
|
-
return i() ? "" : void 0;
|
|
19110
|
-
},
|
|
19111
19095
|
get class() {
|
|
19112
|
-
return D(`group/toggle-group flex w-fit max-w-full items-center rounded-lg ${se} p-1 data-[variant=outline]:shadow-xs`,
|
|
19096
|
+
return D(`group/toggle-group flex w-fit max-w-full flex-wrap items-center gap-y-1 rounded-lg ${se} p-1 data-[variant=outline]:shadow-xs`, t.class);
|
|
19113
19097
|
}
|
|
19114
19098
|
}, n, { get children() {
|
|
19115
19099
|
return R(fk.Provider, {
|
|
@@ -19135,12 +19119,8 @@ var ck = Object.assign(sk, { Item: ak }), lk = ce({
|
|
|
19135
19119
|
get indicatorTone() {
|
|
19136
19120
|
return t.tone;
|
|
19137
19121
|
},
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
},
|
|
19141
|
-
get class() {
|
|
19142
|
-
return D("flex w-full items-center", i() && "flex-wrap gap-1");
|
|
19143
|
-
},
|
|
19122
|
+
wrapped: !0,
|
|
19123
|
+
class: "flex w-full flex-wrap items-center gap-y-1",
|
|
19144
19124
|
get children() {
|
|
19145
19125
|
return t.children;
|
|
19146
19126
|
}
|
|
@@ -19168,7 +19148,7 @@ var ck = Object.assign(sk, { Item: ak }), lk = ce({
|
|
|
19168
19148
|
return D(lk({
|
|
19169
19149
|
variant: r.variant || t.variant,
|
|
19170
19150
|
size: r.size || t.size
|
|
19171
|
-
}), "min-w-
|
|
19151
|
+
}), "min-w-max flex-1 shrink-0 rounded-md px-4 shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first-of-type:border-l", r.sliding ? "hover:text-primary" : "not-data-[pressed]:hover:text-primary data-[pressed]:bg-muted data-[pressed]:text-foreground", t.class);
|
|
19172
19152
|
}
|
|
19173
19153
|
}, n));
|
|
19174
19154
|
}, hk = /*#__PURE__*/ K("<ul class=\"flex list-inside list-disc flex-col gap-1\">"), gk = /*#__PURE__*/ K("<div data-slot=schema-form>"), _k = /*#__PURE__*/ K("<li>"), vk = /*#__PURE__*/ K("<div class=\"flex items-center gap-3\"><span class=text-sm>"), yk = /*#__PURE__*/ K("<p class=\"text-muted-foreground text-sm\">Add at least <!> <!>."), bk = /*#__PURE__*/ K("<fieldset data-slot=schema-form-list>"), xk = /*#__PURE__*/ K("<span data-slot=schema-form-list-item-thumb>"), Sk = /*#__PURE__*/ K("<div data-slot=schema-form-list-row><span class=\"pointer-events-none relative min-w-0 flex-1 truncate text-left text-sm\">"), Ck = /*#__PURE__*/ K("<div class=\"border-border border-t p-3\">"), wk = /*#__PURE__*/ K("<img alt decoding=async class=\"absolute inset-0 h-full w-full object-cover\">"), Tk = /*#__PURE__*/ K("<fieldset class=\"flex w-full min-w-0 flex-col gap-3\"data-slot=schema-form-variants>"), Ek = /*#__PURE__*/ K("<div>"), Dk = /*#__PURE__*/ K("<div class=\"flex flex-wrap gap-1.5\">"), Ok = /*#__PURE__*/ K("<fieldset class=\"flex min-w-0 flex-col gap-2\"data-slot=schema-form-string-list>"), kk = /*#__PURE__*/ K("<button type=button class=\"cursor-pointer rounded-sm hover:text-destructive\">"), Ak = [
|
package/dist/tokens/index.js
CHANGED
package/package.json
CHANGED
|
@@ -4,9 +4,6 @@ import {
|
|
|
4
4
|
type Component,
|
|
5
5
|
type ComponentProps,
|
|
6
6
|
createContext,
|
|
7
|
-
createSignal,
|
|
8
|
-
onCleanup,
|
|
9
|
-
onMount,
|
|
10
7
|
type ParentComponent,
|
|
11
8
|
Show,
|
|
12
9
|
splitProps,
|
|
@@ -47,36 +44,13 @@ const ToggleGroup: ParentComponent<
|
|
|
47
44
|
// discriminated union, so pulling `multiple` into a separate prop collapses the
|
|
48
45
|
// union and mistypes `value`. Leave it in `rest` and just peek at it here.
|
|
49
46
|
const sliding = () => !(props as { multiple?: boolean }).multiple;
|
|
50
|
-
// Items that overflow the width they are given wrap onto rows; measured, so labels of any length work.
|
|
51
|
-
const [wrap, setWrap] = createSignal(false);
|
|
52
|
-
let root: HTMLDivElement | undefined;
|
|
53
|
-
const measure = () => {
|
|
54
|
-
if (!root) return;
|
|
55
|
-
const items = root.querySelectorAll<HTMLElement>('[data-slot="toggle-group-item"]');
|
|
56
|
-
let needed = 8 + 4 * Math.max(0, items.length - 1);
|
|
57
|
-
for (const item of items) needed += item.scrollWidth;
|
|
58
|
-
const room = root.parentElement?.clientWidth ?? root.clientWidth;
|
|
59
|
-
setWrap(needed > room + 1);
|
|
60
|
-
};
|
|
61
|
-
onMount(() => {
|
|
62
|
-
if (!root || typeof ResizeObserver === "undefined") return;
|
|
63
|
-
const ro = new ResizeObserver(measure);
|
|
64
|
-
ro.observe(root);
|
|
65
|
-
if (root.parentElement) ro.observe(root.parentElement);
|
|
66
|
-
onCleanup(() => ro.disconnect());
|
|
67
|
-
});
|
|
68
47
|
return (
|
|
69
48
|
<ToggleGroupPrimitive
|
|
70
|
-
ref={(el: HTMLDivElement) => {
|
|
71
|
-
root = el;
|
|
72
|
-
}}
|
|
73
49
|
data-slot="toggle-group"
|
|
74
50
|
data-variant={local.variant}
|
|
75
51
|
data-size={local.size}
|
|
76
|
-
data-wrap={wrap() ? "" : undefined}
|
|
77
52
|
class={cn(
|
|
78
|
-
`group/toggle-group flex w-fit max-w-full items-center rounded-lg ${TRACK_SURFACE} p-1 data-[variant=outline]:shadow-xs`,
|
|
79
|
-
wrap() && "flex-wrap gap-1",
|
|
53
|
+
`group/toggle-group flex w-fit max-w-full flex-wrap items-center gap-y-1 rounded-lg ${TRACK_SURFACE} p-1 data-[variant=outline]:shadow-xs`,
|
|
80
54
|
local.class,
|
|
81
55
|
)}
|
|
82
56
|
{...rest}
|
|
@@ -91,8 +65,8 @@ const ToggleGroup: ParentComponent<
|
|
|
91
65
|
activeSelector="[data-pressed]"
|
|
92
66
|
indicatorClass="rounded-md"
|
|
93
67
|
indicatorTone={local.tone}
|
|
94
|
-
wrapped
|
|
95
|
-
class=
|
|
68
|
+
wrapped
|
|
69
|
+
class="flex w-full flex-wrap items-center gap-y-1"
|
|
96
70
|
>
|
|
97
71
|
{local.children}
|
|
98
72
|
</SlidingIndicator>
|
|
@@ -118,7 +92,8 @@ const ToggleGroupItem: Component<
|
|
|
118
92
|
variant: context.variant || local.variant,
|
|
119
93
|
size: context.size || local.size,
|
|
120
94
|
}),
|
|
121
|
-
|
|
95
|
+
// Wrapping is plain CSS: an item never shrinks below its label, so a row that runs out of width breaks.
|
|
96
|
+
"min-w-max flex-1 shrink-0 rounded-md px-4 shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first-of-type:border-l",
|
|
122
97
|
// Single-select: the sliding indicator paints the active segment, so the
|
|
123
98
|
// item needs no pressed fill of its own and hover only tints the text.
|
|
124
99
|
// Multi-select has no single indicator, so each pressed segment carries
|