@glasshome/ui 1.21.0 → 1.21.2
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/use-is-mobile.d.ts +3 -1
- package/dist/solid/alert-dialog.d.ts +7 -1
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +7 -1
- package/dist/solid/dialog-parts.d.ts +3 -2
- package/dist/solid/dialog.d.ts +7 -1
- package/dist/solid/docked-panel.d.ts +7 -1
- package/dist/solid/index.d.ts +9 -9
- package/dist/solid/index.js +5456 -5447
- package/dist/solid/media-store.d.ts +4 -1
- package/dist/solid/option-card.d.ts +4 -1
- package/dist/solid/responsive-dialog.d.ts +7 -1
- package/dist/solid/sheet.d.ts +7 -1
- package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
- package/package.json +128 -126
- package/scripts/check-gallery.ts +142 -142
- package/scripts/check-pack.ts +13 -13
- package/scripts/check-structural-classes.ts +20 -20
- package/scripts/check-tokens.ts +27 -27
- package/scripts/check-ui-drift.mjs +103 -103
- package/src/index.ts +75 -80
- package/src/lib/alert-tones.ts +41 -41
- package/src/lib/anchor-placement.ts +21 -21
- package/src/lib/button-variants.ts +28 -28
- package/src/lib/card-classes.ts +9 -9
- package/src/lib/carousel-classes.ts +14 -14
- package/src/lib/glass-tone.ts +11 -11
- package/src/lib/input-classes.ts +6 -6
- package/src/lib/layers.ts +4 -4
- package/src/lib/logo-lockup.ts +8 -8
- package/src/lib/menu-classes.ts +2 -2
- package/src/lib/motion-classes.ts +8 -8
- package/src/lib/motion-window.ts +24 -24
- package/src/lib/overlay-classes.ts +6 -6
- package/src/lib/pill-classes.ts +3 -3
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/spotlight-geometry.ts +67 -67
- package/src/lib/thumb-classes.ts +2 -2
- package/src/lib/tier-badge.ts +16 -16
- package/src/lib/use-is-mobile.ts +17 -14
- package/src/lib/utils.ts +1 -1
- package/src/solid/accordion.tsx +41 -41
- package/src/solid/alert-dialog.tsx +95 -95
- package/src/solid/alert.tsx +88 -88
- package/src/solid/area-picker.tsx +204 -204
- package/src/solid/aspect-ratio.tsx +13 -13
- package/src/solid/avatar.tsx +27 -27
- package/src/solid/badge.tsx +49 -49
- package/src/solid/bottom-sheet/arbitration.ts +22 -22
- package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
- package/src/solid/bottom-sheet/drag-controller.ts +201 -201
- package/src/solid/bottom-sheet/focus-trap.ts +51 -47
- package/src/solid/bottom-sheet/index.ts +12 -12
- package/src/solid/bottom-sheet/keyboard.ts +25 -25
- package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
- package/src/solid/bottom-sheet/state-machine.ts +28 -28
- package/src/solid/bottom-sheet/velocity.ts +29 -29
- package/src/solid/breadcrumb.tsx +76 -76
- package/src/solid/button-group.tsx +46 -46
- package/src/solid/button.tsx +19 -19
- package/src/solid/card.tsx +67 -67
- package/src/solid/carousel.tsx +246 -246
- package/src/solid/charts.tsx +253 -253
- package/src/solid/checkbox.tsx +51 -51
- package/src/solid/collapsible.tsx +22 -22
- package/src/solid/color-disc.tsx +213 -213
- package/src/solid/color-slider.tsx +81 -81
- package/src/solid/color-wheel.tsx +61 -61
- package/src/solid/context-menu.tsx +63 -63
- package/src/solid/copy-button.tsx +31 -31
- package/src/solid/count-pill.tsx +11 -11
- package/src/solid/dashboard-preview.tsx +104 -104
- package/src/solid/data-table.tsx +228 -228
- package/src/solid/dialog-parts.tsx +129 -129
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -338
- package/src/solid/docked-panel.tsx +35 -35
- package/src/solid/dropdown-menu.tsx +77 -77
- package/src/solid/empty.tsx +70 -70
- package/src/solid/entity-data.ts +38 -38
- package/src/solid/entity-selector.tsx +634 -634
- package/src/solid/field.tsx +205 -205
- package/src/solid/form.tsx +159 -159
- package/src/solid/hero-action.tsx +85 -85
- package/src/solid/hover-card.tsx +11 -11
- package/src/solid/icon-picker.tsx +401 -401
- package/src/solid/icon.tsx +101 -78
- package/src/solid/image-picker.tsx +416 -414
- package/src/solid/index.ts +265 -304
- package/src/solid/input-group.tsx +123 -123
- package/src/solid/input-otp.tsx +143 -143
- package/src/solid/input.tsx +4 -4
- package/src/solid/item.tsx +130 -130
- package/src/solid/kbd.tsx +20 -20
- package/src/solid/label.tsx +12 -12
- package/src/solid/list-reorder.ts +122 -122
- package/src/solid/logo.tsx +60 -60
- package/src/solid/media-copy.ts +21 -21
- package/src/solid/media-store.ts +60 -57
- package/src/solid/media-tile.tsx +85 -85
- package/src/solid/menu-parts.tsx +164 -164
- package/src/solid/number-field.tsx +56 -56
- package/src/solid/option-card.tsx +168 -165
- package/src/solid/ornament.tsx +43 -43
- package/src/solid/overlay.tsx +4 -4
- package/src/solid/page-header.tsx +75 -75
- package/src/solid/pagination.tsx +80 -80
- package/src/solid/password-input.tsx +51 -51
- package/src/solid/picker-row.tsx +83 -83
- package/src/solid/picker-search.tsx +65 -63
- package/src/solid/picker-trigger.tsx +59 -57
- package/src/solid/popover.tsx +54 -54
- package/src/solid/preview-tile.tsx +67 -67
- package/src/solid/progress.tsx +21 -21
- package/src/solid/radio-group.tsx +51 -51
- package/src/solid/resizable.tsx +128 -128
- package/src/solid/responsive-dialog.tsx +134 -134
- package/src/solid/schema-form.tsx +746 -739
- package/src/solid/scope-indicator.tsx +5 -5
- package/src/solid/scroll-area.tsx +16 -16
- package/src/solid/section-card.tsx +281 -281
- package/src/solid/select.tsx +101 -101
- package/src/solid/separator.tsx +25 -25
- package/src/solid/settings-row.tsx +122 -122
- package/src/solid/sheet.tsx +96 -96
- package/src/solid/skeleton.tsx +8 -8
- package/src/solid/slider.tsx +132 -132
- package/src/solid/sliding-indicator.tsx +280 -265
- package/src/solid/sonner.tsx +164 -164
- package/src/solid/spinner.tsx +12 -12
- package/src/solid/spotlight.tsx +140 -140
- package/src/solid/step-indicator.tsx +18 -18
- package/src/solid/swatch-picker.tsx +38 -38
- package/src/solid/switch.tsx +52 -52
- package/src/solid/table.tsx +63 -63
- package/src/solid/tabs.tsx +93 -93
- package/src/solid/textarea.tsx +8 -8
- package/src/solid/toggle-group.tsx +83 -83
- package/src/solid/toggle.tsx +33 -33
- package/src/solid/tooltip.tsx +16 -16
- package/src/solid/widget-card.tsx +90 -90
- package/src/solid/widget-identity.tsx +99 -99
- package/src/solid/widget-trust-badge.tsx +20 -20
- package/src/styles/globals.css +316 -319
- package/src/styles/theme.css +448 -448
- package/src/tokens/hex.ts +29 -29
- package/src/tokens/material.ts +75 -75
- package/src/tokens/presets.ts +303 -303
- package/src/tokens/readability.ts +32 -32
- package/src/tokens/theme-colors.ts +95 -95
- package/src/tokens/theme-css.ts +22 -22
- package/src/tokens/theme-recipe.ts +106 -106
package/src/solid/select.tsx
CHANGED
|
@@ -11,129 +11,129 @@ import { Icon } from "./icon.js";
|
|
|
11
11
|
import { SlidingIndicator } from "./sliding-indicator.js";
|
|
12
12
|
|
|
13
13
|
const Select = ((props: ComponentProps<typeof SelectPrimitive>) => (
|
|
14
|
-
|
|
14
|
+
<SelectPrimitive gutter={0} getAnchorRect={anchorToTriggerTop} flip={false} overlap {...props} />
|
|
15
15
|
)) as typeof SelectPrimitive;
|
|
16
16
|
const SelectValue = SelectPrimitive.Value;
|
|
17
17
|
|
|
18
18
|
const SelectTrigger: ParentComponent<
|
|
19
|
-
|
|
19
|
+
ComponentProps<typeof SelectPrimitive.Trigger> & { size?: "sm" | "default" }
|
|
20
20
|
> = (props) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
const [local, rest] = splitProps(props, ["class", "children", "size"]);
|
|
22
|
+
const size = () => local.size ?? "default";
|
|
23
|
+
return (
|
|
24
|
+
<SelectPrimitive.Trigger
|
|
25
|
+
data-slot="select-trigger"
|
|
26
|
+
data-size={size()}
|
|
27
|
+
class={cn(
|
|
28
|
+
PICKER_TRIGGER,
|
|
29
|
+
// The one deviation from the shared recipe: a Select sizes to its
|
|
30
|
+
// value, every other picker fills its field.
|
|
31
|
+
"data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground w-fit whitespace-nowrap [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
32
|
+
size() === "sm" && CONTROL_H.sm,
|
|
33
|
+
local.class,
|
|
34
|
+
)}
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
{local.children}
|
|
38
|
+
<SelectPrimitive.Icon>
|
|
39
|
+
<Icon
|
|
40
|
+
icon="lucide:chevron-down"
|
|
41
|
+
width={16}
|
|
42
|
+
height={16}
|
|
43
|
+
class="text-muted-foreground size-4 opacity-50"
|
|
44
|
+
/>
|
|
45
|
+
</SelectPrimitive.Icon>
|
|
46
|
+
</SelectPrimitive.Trigger>
|
|
47
|
+
);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const SelectContent: ParentComponent<
|
|
51
|
-
|
|
51
|
+
ComponentProps<typeof SelectPrimitive.Content> & { listboxClass?: string }
|
|
52
52
|
> = (props) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
const [local, rest] = splitProps(props, ["class", "children", "listboxClass"]);
|
|
54
|
+
return (
|
|
55
|
+
<SelectPrimitive.Portal>
|
|
56
|
+
<SelectPrimitive.Content
|
|
57
|
+
data-slot="select-content"
|
|
58
|
+
class={cn(
|
|
59
|
+
// Same concave surface as the trigger: opening reads as the input
|
|
60
|
+
// expanding, not a separate floating panel.
|
|
61
|
+
INPUT_SURFACE,
|
|
62
|
+
FIELD_MOTION,
|
|
63
|
+
`relative ${Z_CLASS.overlay} text-popover-foreground overflow-hidden rounded-md p-1`,
|
|
64
|
+
local.class,
|
|
65
|
+
)}
|
|
66
|
+
{...rest}
|
|
67
|
+
>
|
|
68
|
+
<SlidingIndicator
|
|
69
|
+
activeSelector="[data-highlighted]"
|
|
70
|
+
orientation="vertical"
|
|
71
|
+
indicatorClass="rounded-sm"
|
|
72
|
+
class={cn("w-full", PICKER_LIST)}
|
|
73
|
+
>
|
|
74
|
+
<SelectPrimitive.Listbox class={cn(STAGGER, local.listboxClass)} />
|
|
75
|
+
</SlidingIndicator>
|
|
76
|
+
</SelectPrimitive.Content>
|
|
77
|
+
</SelectPrimitive.Portal>
|
|
78
|
+
);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
const SelectLabel: Component<ComponentProps<typeof SelectPrimitive.Label>> = (props) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
83
|
+
return (
|
|
84
|
+
<SelectPrimitive.Label
|
|
85
|
+
data-slot="select-label"
|
|
86
|
+
class={cn(MENU_LABEL, "font-normal", local.class)}
|
|
87
|
+
{...rest}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
const SelectItem: ParentComponent<ComponentProps<typeof SelectPrimitive.Item>> = (props) => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
94
|
+
return (
|
|
95
|
+
<SelectPrimitive.Item
|
|
96
|
+
data-slot="select-item"
|
|
97
|
+
class={cn(
|
|
98
|
+
MENU_ITEM,
|
|
99
|
+
"focus:text-foreground data-[highlighted]:text-foreground w-full pr-8 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
100
|
+
local.class,
|
|
101
|
+
)}
|
|
102
|
+
{...rest}
|
|
103
|
+
>
|
|
104
|
+
<span class="absolute right-2 flex size-3.5 items-center justify-center">
|
|
105
|
+
<SelectPrimitive.ItemIndicator>
|
|
106
|
+
<Icon icon="lucide:check" width={16} height={16} class="size-4 text-current" />
|
|
107
|
+
</SelectPrimitive.ItemIndicator>
|
|
108
|
+
</span>
|
|
109
|
+
<SelectPrimitive.ItemLabel>{local.children}</SelectPrimitive.ItemLabel>
|
|
110
|
+
</SelectPrimitive.Item>
|
|
111
|
+
);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
const SelectGroup: Component<ComponentProps<"div">> = (props) => {
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
116
|
+
return <div data-slot="select-group" class={cn("", local.class)} {...rest} />;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
const SelectSeparator: Component<ComponentProps<"div">> = (props) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
121
|
+
return (
|
|
122
|
+
<div
|
|
123
|
+
data-slot="select-separator"
|
|
124
|
+
class={cn("pointer-events-none", MENU_SEPARATOR, local.class)}
|
|
125
|
+
{...rest}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
export {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
Select,
|
|
132
|
+
SelectContent,
|
|
133
|
+
SelectGroup,
|
|
134
|
+
SelectItem,
|
|
135
|
+
SelectLabel,
|
|
136
|
+
SelectSeparator,
|
|
137
|
+
SelectTrigger,
|
|
138
|
+
SelectValue,
|
|
139
139
|
};
|
package/src/solid/separator.tsx
CHANGED
|
@@ -2,34 +2,34 @@ import { type Component, type ComponentProps, splitProps } from "solid-js";
|
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
|
|
4
4
|
type SeparatorProps = ComponentProps<"div"> & {
|
|
5
|
-
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const Separator: Component<SeparatorProps> = (props) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
const [local, others] = splitProps(props, ["class", "orientation"]);
|
|
10
|
+
const orientation = () => local.orientation ?? "horizontal";
|
|
11
|
+
return (
|
|
12
|
+
// Non-focusable role=separator is valid static ARIA; hr cannot express the vertical variant.
|
|
13
|
+
// biome-ignore lint/a11y/useFocusableInteractive: see above
|
|
14
|
+
// biome-ignore lint/a11y/useSemanticElements: see above
|
|
15
|
+
<div
|
|
16
|
+
data-slot="separator"
|
|
17
|
+
// biome-ignore lint/a11y/useAriaPropsForRole: non-focusable separators need no aria-valuenow
|
|
18
|
+
role="separator"
|
|
19
|
+
aria-orientation={orientation()}
|
|
20
|
+
// A luminous glass hairline: the border tone fades to transparent at both
|
|
21
|
+
// ends (a lit line, not a hard rule) with a faint highlight offset one
|
|
22
|
+
// pixel toward the light — the same lit-glass edge cards and chips carry.
|
|
23
|
+
class={cn(
|
|
24
|
+
"shrink-0 border-0 bg-transparent",
|
|
25
|
+
orientation() === "horizontal"
|
|
26
|
+
? "via-border h-px w-full bg-gradient-to-r from-transparent to-transparent shadow-[0_1px_0_oklch(1_0_0_/_0.04)]"
|
|
27
|
+
: "via-border h-full w-px bg-gradient-to-b from-transparent to-transparent shadow-[1px_0_0_oklch(1_0_0_/_0.04)]",
|
|
28
|
+
local.class,
|
|
29
|
+
)}
|
|
30
|
+
{...others}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
export { Separator };
|
|
@@ -12,148 +12,148 @@ import { Switch } from "./switch.js";
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export function SectionAddButton(props: { onClick: () => void }) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
return (
|
|
16
|
+
<Button variant="outline" size="sm" onClick={props.onClick}>
|
|
17
|
+
<Icon icon="lucide:plus" width={14} height={14} />
|
|
18
|
+
Add
|
|
19
|
+
</Button>
|
|
20
|
+
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function SectionEmpty(props: { children: JSX.Element }) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
return (
|
|
25
|
+
<p data-slot="section-empty" class="text-muted-foreground py-4 text-center text-sm">
|
|
26
|
+
{props.children}
|
|
27
|
+
</p>
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function RowActions(props: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
onEdit: () => void;
|
|
33
|
+
onDelete: () => void;
|
|
34
|
+
deleteDisabled?: boolean;
|
|
35
|
+
deleteTitle?: string;
|
|
36
|
+
showDelete?: boolean;
|
|
37
37
|
}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
return (
|
|
39
|
+
<div data-slot="row-actions" class="flex items-center gap-1">
|
|
40
|
+
<Button variant="ghost" size="icon" class="size-8" onClick={props.onEdit}>
|
|
41
|
+
<Icon icon="lucide:pencil" width={14} height={14} />
|
|
42
|
+
</Button>
|
|
43
|
+
<Show when={props.showDelete ?? true}>
|
|
44
|
+
<Button
|
|
45
|
+
variant="ghost"
|
|
46
|
+
size="icon"
|
|
47
|
+
class="text-destructive hover:text-destructive size-8"
|
|
48
|
+
onClick={props.onDelete}
|
|
49
|
+
disabled={props.deleteDisabled}
|
|
50
|
+
title={props.deleteTitle}
|
|
51
|
+
>
|
|
52
|
+
<Icon icon="lucide:trash-2" width={14} height={14} />
|
|
53
|
+
</Button>
|
|
54
|
+
</Show>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function LabeledField(props: { label: string; children: JSX.Element }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
return (
|
|
61
|
+
<div data-slot="labeled-field" class="flex flex-col gap-1">
|
|
62
|
+
<p data-slot="labeled-field-label" class="text-sm font-medium">
|
|
63
|
+
{props.label}
|
|
64
|
+
</p>
|
|
65
|
+
{props.children}
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function LabeledIconPicker(props: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
onChange: (value: string) => void;
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
searchIcons?: IconPickerProps["searchIcons"];
|
|
76
76
|
}) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
return (
|
|
78
|
+
<LabeledField label={props.label}>
|
|
79
|
+
<IconPicker
|
|
80
|
+
value={props.value}
|
|
81
|
+
onChange={props.onChange}
|
|
82
|
+
placeholder={props.placeholder}
|
|
83
|
+
searchIcons={props.searchIcons}
|
|
84
|
+
/>
|
|
85
|
+
</LabeledField>
|
|
86
|
+
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export function LabeledInput(props: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
label: string;
|
|
91
|
+
value: string;
|
|
92
|
+
onInput: (value: string) => void;
|
|
93
|
+
placeholder?: string;
|
|
94
94
|
}) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
return (
|
|
96
|
+
<LabeledField label={props.label}>
|
|
97
|
+
<Input
|
|
98
|
+
value={props.value}
|
|
99
|
+
onInput={(e) => props.onInput(e.currentTarget.value)}
|
|
100
|
+
placeholder={props.placeholder}
|
|
101
|
+
/>
|
|
102
|
+
</LabeledField>
|
|
103
|
+
);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export function SwitchRow(props: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
label: string;
|
|
108
|
+
description?: string;
|
|
109
|
+
/** Iconify id shown before the label (sensitive-device rows, platform toggles). */
|
|
110
|
+
icon?: string;
|
|
111
|
+
checked: boolean;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
onChange: (value: boolean) => void;
|
|
114
114
|
}) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
115
|
+
const id = createUniqueId();
|
|
116
|
+
return (
|
|
117
|
+
<Field
|
|
118
|
+
orientation="horizontal"
|
|
119
|
+
class="py-2"
|
|
120
|
+
data-disabled={props.disabled ? "true" : undefined}
|
|
121
|
+
>
|
|
122
|
+
<Show when={props.icon}>
|
|
123
|
+
{(icon) => (
|
|
124
|
+
<Icon
|
|
125
|
+
icon={icon()}
|
|
126
|
+
width={16}
|
|
127
|
+
height={16}
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
class="text-muted-foreground shrink-0"
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
132
|
+
</Show>
|
|
133
|
+
<Show
|
|
134
|
+
when={props.description}
|
|
135
|
+
fallback={
|
|
136
|
+
<FieldLabel for={id} class="cursor-pointer">
|
|
137
|
+
{props.label}
|
|
138
|
+
</FieldLabel>
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{(description) => (
|
|
142
|
+
<FieldContent>
|
|
143
|
+
<FieldLabel for={id} class="cursor-pointer">
|
|
144
|
+
{props.label}
|
|
145
|
+
</FieldLabel>
|
|
146
|
+
<FieldDescription class="text-xs">{description()}</FieldDescription>
|
|
147
|
+
</FieldContent>
|
|
148
|
+
)}
|
|
149
|
+
</Show>
|
|
150
|
+
<Switch
|
|
151
|
+
id={id}
|
|
152
|
+
checked={props.checked}
|
|
153
|
+
disabled={props.disabled}
|
|
154
|
+
onChange={props.onChange}
|
|
155
|
+
aria-label={props.label}
|
|
156
|
+
/>
|
|
157
|
+
</Field>
|
|
158
|
+
);
|
|
159
159
|
}
|