@glasshome/ui 1.21.1 → 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.
Files changed (145) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/use-is-mobile.d.ts +3 -1
  4. package/dist/solid/index.d.ts +9 -9
  5. package/dist/solid/index.js +5431 -5424
  6. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  7. package/package.json +128 -126
  8. package/scripts/check-gallery.ts +142 -142
  9. package/scripts/check-pack.ts +13 -13
  10. package/scripts/check-structural-classes.ts +20 -20
  11. package/scripts/check-tokens.ts +27 -27
  12. package/scripts/check-ui-drift.mjs +103 -103
  13. package/src/index.ts +75 -80
  14. package/src/lib/alert-tones.ts +41 -41
  15. package/src/lib/anchor-placement.ts +21 -21
  16. package/src/lib/button-variants.ts +28 -28
  17. package/src/lib/card-classes.ts +9 -9
  18. package/src/lib/carousel-classes.ts +14 -14
  19. package/src/lib/glass-tone.ts +11 -11
  20. package/src/lib/input-classes.ts +6 -6
  21. package/src/lib/layers.ts +4 -4
  22. package/src/lib/logo-lockup.ts +8 -8
  23. package/src/lib/menu-classes.ts +2 -2
  24. package/src/lib/motion-classes.ts +8 -8
  25. package/src/lib/motion-window.ts +24 -24
  26. package/src/lib/overlay-classes.ts +6 -6
  27. package/src/lib/pill-classes.ts +3 -3
  28. package/src/lib/position-bar-classes.ts +1 -1
  29. package/src/lib/spotlight-geometry.ts +67 -67
  30. package/src/lib/thumb-classes.ts +2 -2
  31. package/src/lib/tier-badge.ts +16 -16
  32. package/src/lib/use-is-mobile.ts +17 -14
  33. package/src/lib/utils.ts +1 -1
  34. package/src/solid/accordion.tsx +41 -41
  35. package/src/solid/alert-dialog.tsx +95 -95
  36. package/src/solid/alert.tsx +88 -88
  37. package/src/solid/area-picker.tsx +204 -204
  38. package/src/solid/aspect-ratio.tsx +13 -13
  39. package/src/solid/avatar.tsx +27 -27
  40. package/src/solid/badge.tsx +49 -49
  41. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  42. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  43. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  44. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  45. package/src/solid/bottom-sheet/index.ts +12 -12
  46. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  47. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  48. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  49. package/src/solid/bottom-sheet/velocity.ts +29 -29
  50. package/src/solid/breadcrumb.tsx +76 -76
  51. package/src/solid/button-group.tsx +46 -46
  52. package/src/solid/button.tsx +19 -19
  53. package/src/solid/card.tsx +67 -67
  54. package/src/solid/carousel.tsx +246 -246
  55. package/src/solid/charts.tsx +253 -253
  56. package/src/solid/checkbox.tsx +51 -51
  57. package/src/solid/collapsible.tsx +22 -22
  58. package/src/solid/color-disc.tsx +213 -213
  59. package/src/solid/color-slider.tsx +81 -81
  60. package/src/solid/color-wheel.tsx +61 -61
  61. package/src/solid/context-menu.tsx +63 -63
  62. package/src/solid/copy-button.tsx +31 -31
  63. package/src/solid/count-pill.tsx +11 -11
  64. package/src/solid/dashboard-preview.tsx +104 -104
  65. package/src/solid/data-table.tsx +228 -228
  66. package/src/solid/dialog-parts.tsx +127 -127
  67. package/src/solid/dialog.tsx +113 -113
  68. package/src/solid/dock-paging.ts +9 -9
  69. package/src/solid/dock.tsx +339 -339
  70. package/src/solid/docked-panel.tsx +35 -35
  71. package/src/solid/dropdown-menu.tsx +77 -77
  72. package/src/solid/empty.tsx +70 -70
  73. package/src/solid/entity-data.ts +38 -38
  74. package/src/solid/entity-selector.tsx +634 -634
  75. package/src/solid/field.tsx +205 -205
  76. package/src/solid/form.tsx +159 -159
  77. package/src/solid/hero-action.tsx +85 -85
  78. package/src/solid/hover-card.tsx +11 -11
  79. package/src/solid/icon-picker.tsx +401 -401
  80. package/src/solid/icon.tsx +101 -78
  81. package/src/solid/image-picker.tsx +416 -414
  82. package/src/solid/index.ts +265 -304
  83. package/src/solid/input-group.tsx +123 -123
  84. package/src/solid/input-otp.tsx +143 -143
  85. package/src/solid/input.tsx +4 -4
  86. package/src/solid/item.tsx +130 -130
  87. package/src/solid/kbd.tsx +20 -20
  88. package/src/solid/label.tsx +12 -12
  89. package/src/solid/list-reorder.ts +122 -122
  90. package/src/solid/logo.tsx +60 -60
  91. package/src/solid/media-copy.ts +21 -21
  92. package/src/solid/media-store.ts +56 -56
  93. package/src/solid/media-tile.tsx +85 -85
  94. package/src/solid/menu-parts.tsx +164 -164
  95. package/src/solid/number-field.tsx +56 -56
  96. package/src/solid/option-card.tsx +164 -164
  97. package/src/solid/ornament.tsx +43 -43
  98. package/src/solid/overlay.tsx +4 -4
  99. package/src/solid/page-header.tsx +75 -75
  100. package/src/solid/pagination.tsx +80 -80
  101. package/src/solid/password-input.tsx +51 -51
  102. package/src/solid/picker-row.tsx +83 -83
  103. package/src/solid/picker-search.tsx +65 -63
  104. package/src/solid/picker-trigger.tsx +59 -57
  105. package/src/solid/popover.tsx +54 -54
  106. package/src/solid/preview-tile.tsx +67 -67
  107. package/src/solid/progress.tsx +21 -21
  108. package/src/solid/radio-group.tsx +51 -51
  109. package/src/solid/resizable.tsx +128 -128
  110. package/src/solid/responsive-dialog.tsx +134 -134
  111. package/src/solid/schema-form.tsx +743 -743
  112. package/src/solid/scope-indicator.tsx +5 -5
  113. package/src/solid/scroll-area.tsx +16 -16
  114. package/src/solid/section-card.tsx +281 -281
  115. package/src/solid/select.tsx +101 -101
  116. package/src/solid/separator.tsx +25 -25
  117. package/src/solid/settings-row.tsx +122 -122
  118. package/src/solid/sheet.tsx +96 -96
  119. package/src/solid/skeleton.tsx +8 -8
  120. package/src/solid/slider.tsx +132 -132
  121. package/src/solid/sliding-indicator.tsx +280 -265
  122. package/src/solid/sonner.tsx +164 -164
  123. package/src/solid/spinner.tsx +12 -12
  124. package/src/solid/spotlight.tsx +140 -140
  125. package/src/solid/step-indicator.tsx +18 -18
  126. package/src/solid/swatch-picker.tsx +38 -38
  127. package/src/solid/switch.tsx +52 -52
  128. package/src/solid/table.tsx +63 -63
  129. package/src/solid/tabs.tsx +93 -93
  130. package/src/solid/textarea.tsx +8 -8
  131. package/src/solid/toggle-group.tsx +83 -83
  132. package/src/solid/toggle.tsx +33 -33
  133. package/src/solid/tooltip.tsx +16 -16
  134. package/src/solid/widget-card.tsx +90 -90
  135. package/src/solid/widget-identity.tsx +99 -99
  136. package/src/solid/widget-trust-badge.tsx +20 -20
  137. package/src/styles/globals.css +316 -319
  138. package/src/styles/theme.css +448 -448
  139. package/src/tokens/hex.ts +29 -29
  140. package/src/tokens/material.ts +75 -75
  141. package/src/tokens/presets.ts +303 -303
  142. package/src/tokens/readability.ts +32 -32
  143. package/src/tokens/theme-colors.ts +95 -95
  144. package/src/tokens/theme-css.ts +22 -22
  145. package/src/tokens/theme-recipe.ts +106 -106
@@ -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
- 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
- );
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
- 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
- );
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
- return <li data-slot="pagination-item" {...props} />;
30
+ return <li data-slot="pagination-item" {...props} />;
31
31
  };
32
32
 
33
33
  type PaginationLinkProps = ComponentProps<"a"> & {
34
- isActive?: boolean;
35
- size?: "default" | "sm" | "lg" | "icon";
34
+ isActive?: boolean;
35
+ size?: "default" | "sm" | "lg" | "icon";
36
36
  };
37
37
 
38
38
  const PaginationLink: Component<PaginationLinkProps> = (props) => {
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
- );
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
- 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
- );
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
- 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
- );
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
- 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
- );
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
- Pagination,
105
- PaginationContent,
106
- PaginationEllipsis,
107
- PaginationItem,
108
- PaginationLink,
109
- PaginationNext,
110
- PaginationPrevious,
104
+ Pagination,
105
+ PaginationContent,
106
+ PaginationEllipsis,
107
+ PaginationItem,
108
+ PaginationLink,
109
+ PaginationNext,
110
+ PaginationPrevious,
111
111
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
- type Component,
3
- type ComponentProps,
4
- createSignal,
5
- type JSX,
6
- Show,
7
- splitProps,
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
- 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
- }
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
- const [local, rest] = splitProps(props, ["class", "leading", "showLabel", "hideLabel"]);
28
- const [visible, setVisible] = createSignal(false);
27
+ const [local, rest] = splitProps(props, ["class", "leading", "showLabel", "hideLabel"]);
28
+ const [visible, setVisible] = createSignal(false);
29
29
 
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
- "pointer-events-none absolute inset-y-0 left-0 z-10 flex items-center justify-center text-primary/70",
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
- "absolute inset-y-0 right-0 z-10 flex items-center justify-center text-muted-foreground/70 transition-colors hover:text-foreground",
60
- AFFORDANCE_COLUMN,
61
- )}
62
- >
63
- <Icon icon={visible() ? "lucide:eye-off" : "lucide:eye"} width={20} aria-hidden="true" />
64
- </button>
65
- </div>
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 };
@@ -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
- 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;
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
- 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="truncate text-muted-foreground text-xs">{local.subtitle}</div>
69
- </Show>
70
- </div>
71
- <Show when={local.meta}>
72
- <span
73
- class={cn(
74
- "max-w-24 shrink-0 truncate text-muted-foreground 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
- );
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
- extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "value" | "onInput" | "class"> {
9
- value?: string;
10
- onValueChange?: (value: string) => void;
11
- /** Rendered leading; the row is a divider, not a nested field. */
12
- icon?: string;
13
- /** Trailing button that empties the query; hidden while it is empty. */
14
- clearLabel?: string;
15
- class?: string;
16
- inputRef?: (el: HTMLInputElement) => void;
17
- /** "touch" is the sheet row: a picker that opens as a bottom sheet makes this
18
- * its primary control, so it takes the full touch target. */
19
- size?: "default" | "touch";
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
- const [local, rest] = splitProps(props, [
29
- "value",
30
- "onValueChange",
31
- "icon",
32
- "clearLabel",
33
- "class",
34
- "inputRef",
35
- "size",
36
- ]);
37
- return (
38
- <div
39
- data-slot="picker-search"
40
- class={cn(
41
- "flex shrink-0 items-center gap-2 border-border/50 border-b px-3",
42
- SEARCH_H[local.size ?? "default"],
43
- local.class,
44
- )}
45
- >
46
- <Icon
47
- icon={local.icon ?? "mdi:magnify"}
48
- width={16}
49
- height={16}
50
- class="shrink-0 text-muted-foreground"
51
- aria-hidden="true"
52
- />
53
- <input
54
- ref={local.inputRef}
55
- data-slot="picker-search-input"
56
- type="text"
57
- value={local.value ?? ""}
58
- onInput={(e) => local.onValueChange?.(e.currentTarget.value)}
59
- class={cn(
60
- "h-full w-full min-w-0 appearance-none bg-transparent outline-none placeholder:text-muted-foreground",
61
- FIELD_TEXT,
62
- )}
63
- {...rest}
64
- />
65
- <Show when={local.clearLabel && local.value}>
66
- <button
67
- type="button"
68
- data-slot="picker-search-clear"
69
- aria-label={local.clearLabel}
70
- class="shrink-0 rounded-sm p-1 text-muted-foreground transition-colors hover:text-foreground"
71
- onClick={() => local.onValueChange?.("")}
72
- >
73
- <Icon icon="mdi:close-circle" width={16} height={16} />
74
- </button>
75
- </Show>
76
- </div>
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
  }