@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/pagination.tsx
CHANGED
|
@@ -4,108 +4,108 @@ import { buttonVariants } from "./button.js";
|
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
5
|
|
|
6
6
|
const Pagination: Component<ComponentProps<"nav">> = (props) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
8
|
+
return (
|
|
9
|
+
<nav
|
|
10
|
+
aria-label="pagination"
|
|
11
|
+
data-slot="pagination"
|
|
12
|
+
class={cn("mx-auto flex w-full justify-center", local.class)}
|
|
13
|
+
{...rest}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const PaginationContent: Component<ComponentProps<"ul">> = (props) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
20
|
+
return (
|
|
21
|
+
<ul
|
|
22
|
+
data-slot="pagination-content"
|
|
23
|
+
class={cn("flex flex-row items-center gap-1", local.class)}
|
|
24
|
+
{...rest}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const PaginationItem: Component<ComponentProps<"li">> = (props) => {
|
|
30
|
-
|
|
30
|
+
return <li data-slot="pagination-item" {...props} />;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
type PaginationLinkProps = ComponentProps<"a"> & {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
isActive?: boolean;
|
|
35
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const PaginationLink: Component<PaginationLinkProps> = (props) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
const [local, rest] = splitProps(props, ["class", "isActive", "size"]);
|
|
40
|
+
const size = () => local.size ?? "icon";
|
|
41
|
+
return (
|
|
42
|
+
<a
|
|
43
|
+
aria-current={local.isActive ? "page" : undefined}
|
|
44
|
+
data-slot="pagination-link"
|
|
45
|
+
data-active={local.isActive}
|
|
46
|
+
class={cn(
|
|
47
|
+
buttonVariants({
|
|
48
|
+
variant: local.isActive ? "outline" : "ghost",
|
|
49
|
+
size: size(),
|
|
50
|
+
}),
|
|
51
|
+
local.class,
|
|
52
|
+
)}
|
|
53
|
+
{...rest}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
const PaginationPrevious: Component<PaginationLinkProps> = (props) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
60
|
+
return (
|
|
61
|
+
<PaginationLink
|
|
62
|
+
aria-label="Go to previous page"
|
|
63
|
+
size="default"
|
|
64
|
+
class={cn("gap-1 px-2.5 sm:pl-2.5", local.class)}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<Icon icon="lucide:chevron-left" width={16} height={16} />
|
|
68
|
+
<span class="hidden sm:block">Previous</span>
|
|
69
|
+
</PaginationLink>
|
|
70
|
+
);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const PaginationNext: Component<PaginationLinkProps> = (props) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
75
|
+
return (
|
|
76
|
+
<PaginationLink
|
|
77
|
+
aria-label="Go to next page"
|
|
78
|
+
size="default"
|
|
79
|
+
class={cn("gap-1 px-2.5 sm:pr-2.5", local.class)}
|
|
80
|
+
{...rest}
|
|
81
|
+
>
|
|
82
|
+
<span class="hidden sm:block">Next</span>
|
|
83
|
+
<Icon icon="lucide:chevron-right" width={16} height={16} />
|
|
84
|
+
</PaginationLink>
|
|
85
|
+
);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
const PaginationEllipsis: Component<ComponentProps<"span">> = (props) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
90
|
+
return (
|
|
91
|
+
<span
|
|
92
|
+
aria-hidden
|
|
93
|
+
data-slot="pagination-ellipsis"
|
|
94
|
+
class={cn("flex size-9 items-center justify-center", local.class)}
|
|
95
|
+
{...rest}
|
|
96
|
+
>
|
|
97
|
+
<Icon icon="lucide:ellipsis" width={16} height={16} class="size-4" />
|
|
98
|
+
<span class="sr-only">More pages</span>
|
|
99
|
+
</span>
|
|
100
|
+
);
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
Pagination,
|
|
105
|
+
PaginationContent,
|
|
106
|
+
PaginationEllipsis,
|
|
107
|
+
PaginationItem,
|
|
108
|
+
PaginationLink,
|
|
109
|
+
PaginationNext,
|
|
110
|
+
PaginationPrevious,
|
|
111
111
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
type Component,
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
createSignal,
|
|
5
|
+
type JSX,
|
|
6
|
+
Show,
|
|
7
|
+
splitProps,
|
|
8
8
|
} from "solid-js";
|
|
9
9
|
import { cn } from "../lib/utils.js";
|
|
10
10
|
import { Icon } from "./icon.js";
|
|
@@ -17,53 +17,53 @@ const LEADING_RESERVE = "pl-10";
|
|
|
17
17
|
const TOGGLE_RESERVE = "pr-10";
|
|
18
18
|
|
|
19
19
|
const PasswordInput: Component<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
Omit<ComponentProps<typeof Input>, "type"> & {
|
|
21
|
+
/** Rendered left-aligned inside the field (e.g. a lock glyph). */
|
|
22
|
+
leading?: JSX.Element;
|
|
23
|
+
showLabel?: string;
|
|
24
|
+
hideLabel?: string;
|
|
25
|
+
}
|
|
26
26
|
> = (props) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const [local, rest] = splitProps(props, ["class", "leading", "showLabel", "hideLabel"]);
|
|
28
|
+
const [visible, setVisible] = createSignal(false);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
30
|
+
return (
|
|
31
|
+
<div data-slot="password-input" class="relative">
|
|
32
|
+
<Show when={local.leading}>
|
|
33
|
+
<span
|
|
34
|
+
data-slot="password-input-leading"
|
|
35
|
+
class={cn(
|
|
36
|
+
"text-primary/70 pointer-events-none absolute inset-y-0 left-0 z-10 flex items-center justify-center",
|
|
37
|
+
AFFORDANCE_COLUMN,
|
|
38
|
+
)}
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
>
|
|
41
|
+
{local.leading}
|
|
42
|
+
</span>
|
|
43
|
+
</Show>
|
|
44
|
+
<Input
|
|
45
|
+
type={visible() ? "text" : "password"}
|
|
46
|
+
// Caller class first, affordance padding last: a caller-supplied px-*
|
|
47
|
+
// must never win the merge and reclaim a button's space.
|
|
48
|
+
class={cn(local.class, local.leading && LEADING_RESERVE, TOGGLE_RESERVE)}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
data-slot="password-input-toggle"
|
|
54
|
+
aria-label={
|
|
55
|
+
visible() ? (local.hideLabel ?? "Hide password") : (local.showLabel ?? "Show password")
|
|
56
|
+
}
|
|
57
|
+
onClick={() => setVisible((v) => !v)}
|
|
58
|
+
class={cn(
|
|
59
|
+
"text-muted-foreground/70 hover:text-foreground absolute inset-y-0 right-0 z-10 flex items-center justify-center transition-colors",
|
|
60
|
+
AFFORDANCE_COLUMN,
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
<Icon icon={visible() ? "lucide:eye-off" : "lucide:eye"} width={20} aria-hidden="true" />
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
export { PasswordInput };
|
package/src/solid/picker-row.tsx
CHANGED
|
@@ -13,90 +13,90 @@ import { Icon } from "./icon.js";
|
|
|
13
13
|
export const PICKER_ROW_HEIGHT = 52;
|
|
14
14
|
|
|
15
15
|
type PickerRowProps = Omit<ComponentProps<"button">, "title"> & {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
as?: ValidComponent;
|
|
17
|
+
icon?: string;
|
|
18
|
+
title: JSX.Element;
|
|
19
|
+
subtitle?: JSX.Element;
|
|
20
|
+
meta?: JSX.Element;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
multi: boolean;
|
|
23
|
+
dimmed?: boolean;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export function PickerRow(props: PickerRowProps) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
27
|
+
const [local, rest] = splitProps(props, [
|
|
28
|
+
"as",
|
|
29
|
+
"icon",
|
|
30
|
+
"title",
|
|
31
|
+
"subtitle",
|
|
32
|
+
"meta",
|
|
33
|
+
"selected",
|
|
34
|
+
"multi",
|
|
35
|
+
"dimmed",
|
|
36
|
+
"class",
|
|
37
|
+
]);
|
|
38
|
+
return (
|
|
39
|
+
<Dynamic
|
|
40
|
+
component={local.as ?? "div"}
|
|
41
|
+
class={cn(
|
|
42
|
+
MENU_ITEM,
|
|
43
|
+
"w-full cursor-pointer gap-3 py-0 text-left",
|
|
44
|
+
local.selected && "text-foreground",
|
|
45
|
+
local.class,
|
|
46
|
+
)}
|
|
47
|
+
style={{ "min-height": `${PICKER_ROW_HEIGHT}px` }}
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
<Show when={local.icon}>
|
|
51
|
+
{(icon) => (
|
|
52
|
+
<div
|
|
53
|
+
class={cn(
|
|
54
|
+
"size-8 rounded-lg",
|
|
55
|
+
local.selected
|
|
56
|
+
? `${ICON_PILL_TINT} text-foreground [--glass-tone:var(--primary)]`
|
|
57
|
+
: ICON_PILL,
|
|
58
|
+
local.dimmed && "opacity-50",
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
<Icon icon={icon()} width={18} height={18} />
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</Show>
|
|
65
|
+
<div class={cn("min-w-0 flex-1", local.dimmed && "opacity-60")}>
|
|
66
|
+
<div class="truncate font-medium">{local.title}</div>
|
|
67
|
+
<Show when={local.subtitle}>
|
|
68
|
+
<div class="text-muted-foreground truncate text-xs">{local.subtitle}</div>
|
|
69
|
+
</Show>
|
|
70
|
+
</div>
|
|
71
|
+
<Show when={local.meta}>
|
|
72
|
+
<span
|
|
73
|
+
class={cn(
|
|
74
|
+
"text-muted-foreground max-w-24 shrink-0 truncate text-xs",
|
|
75
|
+
local.dimmed && "italic",
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
{local.meta}
|
|
79
|
+
</span>
|
|
80
|
+
</Show>
|
|
81
|
+
<Show
|
|
82
|
+
when={local.multi}
|
|
83
|
+
fallback={
|
|
84
|
+
<div class="flex size-4 shrink-0 items-center justify-center">
|
|
85
|
+
<Show when={local.selected}>
|
|
86
|
+
<Icon icon="lucide:check" width={16} height={16} class="text-primary" />
|
|
87
|
+
</Show>
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
90
|
+
>
|
|
91
|
+
<div aria-hidden="true" class="pointer-events-none shrink-0">
|
|
92
|
+
<Checkbox
|
|
93
|
+
checked={local.selected}
|
|
94
|
+
disabled
|
|
95
|
+
size="sm"
|
|
96
|
+
class="cursor-pointer opacity-100"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</Show>
|
|
100
|
+
</Dynamic>
|
|
101
|
+
);
|
|
102
102
|
}
|
|
@@ -4,19 +4,21 @@ import { CONTROL_H_TOUCH } from "../lib/picker-classes.js";
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Icon } from "./icon.js";
|
|
6
6
|
|
|
7
|
-
export interface PickerSearchProps
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
export interface PickerSearchProps extends Omit<
|
|
8
|
+
JSX.InputHTMLAttributes<HTMLInputElement>,
|
|
9
|
+
"value" | "onInput" | "class"
|
|
10
|
+
> {
|
|
11
|
+
value?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
|
+
/** Rendered leading; the row is a divider, not a nested field. */
|
|
14
|
+
icon?: string;
|
|
15
|
+
/** Trailing button that empties the query; hidden while it is empty. */
|
|
16
|
+
clearLabel?: string;
|
|
17
|
+
class?: string;
|
|
18
|
+
inputRef?: (el: HTMLInputElement) => void;
|
|
19
|
+
/** "touch" is the sheet row: a picker that opens as a bottom sheet makes this
|
|
20
|
+
* its primary control, so it takes the full touch target. */
|
|
21
|
+
size?: "default" | "touch";
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const SEARCH_H = { default: CONTROL_H.default, touch: CONTROL_H_TOUCH } as const;
|
|
@@ -25,54 +27,54 @@ const SEARCH_H = { default: CONTROL_H.default, touch: CONTROL_H_TOUCH } as const
|
|
|
25
27
|
* panel already wears the field surface, so a second one reads as a field in a
|
|
26
28
|
* field. */
|
|
27
29
|
export function PickerSearch(props: PickerSearchProps) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
30
|
+
const [local, rest] = splitProps(props, [
|
|
31
|
+
"value",
|
|
32
|
+
"onValueChange",
|
|
33
|
+
"icon",
|
|
34
|
+
"clearLabel",
|
|
35
|
+
"class",
|
|
36
|
+
"inputRef",
|
|
37
|
+
"size",
|
|
38
|
+
]);
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
data-slot="picker-search"
|
|
42
|
+
class={cn(
|
|
43
|
+
"border-border/50 flex shrink-0 items-center gap-2 border-b px-3",
|
|
44
|
+
SEARCH_H[local.size ?? "default"],
|
|
45
|
+
local.class,
|
|
46
|
+
)}
|
|
47
|
+
>
|
|
48
|
+
<Icon
|
|
49
|
+
icon={local.icon ?? "mdi:magnify"}
|
|
50
|
+
width={16}
|
|
51
|
+
height={16}
|
|
52
|
+
class="text-muted-foreground shrink-0"
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
/>
|
|
55
|
+
<input
|
|
56
|
+
ref={local.inputRef}
|
|
57
|
+
data-slot="picker-search-input"
|
|
58
|
+
type="text"
|
|
59
|
+
value={local.value ?? ""}
|
|
60
|
+
onInput={(e) => local.onValueChange?.(e.currentTarget.value)}
|
|
61
|
+
class={cn(
|
|
62
|
+
"placeholder:text-muted-foreground h-full w-full min-w-0 appearance-none bg-transparent outline-none",
|
|
63
|
+
FIELD_TEXT,
|
|
64
|
+
)}
|
|
65
|
+
{...rest}
|
|
66
|
+
/>
|
|
67
|
+
<Show when={local.clearLabel && local.value}>
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
data-slot="picker-search-clear"
|
|
71
|
+
aria-label={local.clearLabel}
|
|
72
|
+
class="text-muted-foreground hover:text-foreground shrink-0 rounded-sm p-1 transition-colors"
|
|
73
|
+
onClick={() => local.onValueChange?.("")}
|
|
74
|
+
>
|
|
75
|
+
<Icon icon="mdi:close-circle" width={16} height={16} />
|
|
76
|
+
</button>
|
|
77
|
+
</Show>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
78
80
|
}
|