@glasshome/ui 1.21.1 → 1.22.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.
Files changed (146) 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/solid/sonner.d.ts +1 -0
  7. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  8. package/package.json +128 -126
  9. package/scripts/check-gallery.ts +142 -142
  10. package/scripts/check-pack.ts +13 -13
  11. package/scripts/check-structural-classes.ts +20 -20
  12. package/scripts/check-tokens.ts +27 -27
  13. package/scripts/check-ui-drift.mjs +103 -103
  14. package/src/index.ts +75 -80
  15. package/src/lib/alert-tones.ts +41 -41
  16. package/src/lib/anchor-placement.ts +21 -21
  17. package/src/lib/button-variants.ts +28 -28
  18. package/src/lib/card-classes.ts +9 -9
  19. package/src/lib/carousel-classes.ts +14 -14
  20. package/src/lib/glass-tone.ts +11 -11
  21. package/src/lib/input-classes.ts +6 -6
  22. package/src/lib/layers.ts +4 -4
  23. package/src/lib/logo-lockup.ts +8 -8
  24. package/src/lib/menu-classes.ts +2 -2
  25. package/src/lib/motion-classes.ts +8 -8
  26. package/src/lib/motion-window.ts +24 -24
  27. package/src/lib/overlay-classes.ts +6 -6
  28. package/src/lib/pill-classes.ts +3 -3
  29. package/src/lib/position-bar-classes.ts +1 -1
  30. package/src/lib/spotlight-geometry.ts +67 -67
  31. package/src/lib/thumb-classes.ts +2 -2
  32. package/src/lib/tier-badge.ts +16 -16
  33. package/src/lib/use-is-mobile.ts +17 -14
  34. package/src/lib/utils.ts +1 -1
  35. package/src/solid/accordion.tsx +41 -41
  36. package/src/solid/alert-dialog.tsx +95 -95
  37. package/src/solid/alert.tsx +88 -88
  38. package/src/solid/area-picker.tsx +204 -204
  39. package/src/solid/aspect-ratio.tsx +13 -13
  40. package/src/solid/avatar.tsx +27 -27
  41. package/src/solid/badge.tsx +49 -49
  42. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  43. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  44. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  45. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  46. package/src/solid/bottom-sheet/index.ts +12 -12
  47. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  48. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  49. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  50. package/src/solid/bottom-sheet/velocity.ts +29 -29
  51. package/src/solid/breadcrumb.tsx +76 -76
  52. package/src/solid/button-group.tsx +46 -46
  53. package/src/solid/button.tsx +19 -19
  54. package/src/solid/card.tsx +67 -67
  55. package/src/solid/carousel.tsx +246 -246
  56. package/src/solid/charts.tsx +253 -253
  57. package/src/solid/checkbox.tsx +51 -51
  58. package/src/solid/collapsible.tsx +22 -22
  59. package/src/solid/color-disc.tsx +213 -213
  60. package/src/solid/color-slider.tsx +81 -81
  61. package/src/solid/color-wheel.tsx +61 -61
  62. package/src/solid/context-menu.tsx +63 -63
  63. package/src/solid/copy-button.tsx +31 -31
  64. package/src/solid/count-pill.tsx +11 -11
  65. package/src/solid/dashboard-preview.tsx +104 -104
  66. package/src/solid/data-table.tsx +228 -228
  67. package/src/solid/dialog-parts.tsx +127 -127
  68. package/src/solid/dialog.tsx +113 -113
  69. package/src/solid/dock-paging.ts +9 -9
  70. package/src/solid/dock.tsx +339 -339
  71. package/src/solid/docked-panel.tsx +35 -35
  72. package/src/solid/dropdown-menu.tsx +77 -77
  73. package/src/solid/empty.tsx +70 -70
  74. package/src/solid/entity-data.ts +38 -38
  75. package/src/solid/entity-selector.tsx +634 -634
  76. package/src/solid/field.tsx +205 -205
  77. package/src/solid/form.tsx +159 -159
  78. package/src/solid/hero-action.tsx +85 -85
  79. package/src/solid/hover-card.tsx +11 -11
  80. package/src/solid/icon-picker.tsx +401 -401
  81. package/src/solid/icon.tsx +101 -78
  82. package/src/solid/image-picker.tsx +416 -414
  83. package/src/solid/index.ts +265 -304
  84. package/src/solid/input-group.tsx +123 -123
  85. package/src/solid/input-otp.tsx +143 -143
  86. package/src/solid/input.tsx +4 -4
  87. package/src/solid/item.tsx +130 -130
  88. package/src/solid/kbd.tsx +20 -20
  89. package/src/solid/label.tsx +12 -12
  90. package/src/solid/list-reorder.ts +122 -122
  91. package/src/solid/logo.tsx +60 -60
  92. package/src/solid/media-copy.ts +21 -21
  93. package/src/solid/media-store.ts +56 -56
  94. package/src/solid/media-tile.tsx +85 -85
  95. package/src/solid/menu-parts.tsx +164 -164
  96. package/src/solid/number-field.tsx +56 -56
  97. package/src/solid/option-card.tsx +164 -164
  98. package/src/solid/ornament.tsx +43 -43
  99. package/src/solid/overlay.tsx +4 -4
  100. package/src/solid/page-header.tsx +75 -75
  101. package/src/solid/pagination.tsx +80 -80
  102. package/src/solid/password-input.tsx +51 -51
  103. package/src/solid/picker-row.tsx +83 -83
  104. package/src/solid/picker-search.tsx +65 -63
  105. package/src/solid/picker-trigger.tsx +59 -57
  106. package/src/solid/popover.tsx +54 -54
  107. package/src/solid/preview-tile.tsx +67 -67
  108. package/src/solid/progress.tsx +21 -21
  109. package/src/solid/radio-group.tsx +51 -51
  110. package/src/solid/resizable.tsx +128 -128
  111. package/src/solid/responsive-dialog.tsx +134 -134
  112. package/src/solid/schema-form.tsx +743 -743
  113. package/src/solid/scope-indicator.tsx +5 -5
  114. package/src/solid/scroll-area.tsx +16 -16
  115. package/src/solid/section-card.tsx +281 -281
  116. package/src/solid/select.tsx +101 -101
  117. package/src/solid/separator.tsx +25 -25
  118. package/src/solid/settings-row.tsx +122 -122
  119. package/src/solid/sheet.tsx +96 -96
  120. package/src/solid/skeleton.tsx +8 -8
  121. package/src/solid/slider.tsx +132 -132
  122. package/src/solid/sliding-indicator.tsx +280 -265
  123. package/src/solid/sonner.tsx +165 -164
  124. package/src/solid/spinner.tsx +12 -12
  125. package/src/solid/spotlight.tsx +140 -140
  126. package/src/solid/step-indicator.tsx +18 -18
  127. package/src/solid/swatch-picker.tsx +38 -38
  128. package/src/solid/switch.tsx +52 -52
  129. package/src/solid/table.tsx +63 -63
  130. package/src/solid/tabs.tsx +93 -93
  131. package/src/solid/textarea.tsx +8 -8
  132. package/src/solid/toggle-group.tsx +83 -83
  133. package/src/solid/toggle.tsx +33 -33
  134. package/src/solid/tooltip.tsx +16 -16
  135. package/src/solid/widget-card.tsx +90 -90
  136. package/src/solid/widget-identity.tsx +99 -99
  137. package/src/solid/widget-trust-badge.tsx +20 -20
  138. package/src/styles/globals.css +316 -319
  139. package/src/styles/theme.css +448 -448
  140. package/src/tokens/hex.ts +29 -29
  141. package/src/tokens/material.ts +75 -75
  142. package/src/tokens/presets.ts +303 -303
  143. package/src/tokens/readability.ts +32 -32
  144. package/src/tokens/theme-colors.ts +95 -95
  145. package/src/tokens/theme-css.ts +22 -22
  146. package/src/tokens/theme-recipe.ts +106 -106
@@ -1,20 +1,20 @@
1
1
  import {
2
- type Component,
3
- type ComponentProps,
4
- children,
5
- createContext,
6
- createEffect,
7
- createMemo,
8
- createSignal,
9
- createUniqueId,
10
- type JSX,
11
- onCleanup,
12
- onMount,
13
- type ParentComponent,
14
- Show,
15
- splitProps,
16
- useContext,
17
- type ValidComponent,
2
+ type Component,
3
+ type ComponentProps,
4
+ children,
5
+ createContext,
6
+ createEffect,
7
+ createMemo,
8
+ createSignal,
9
+ createUniqueId,
10
+ type JSX,
11
+ onCleanup,
12
+ onMount,
13
+ type ParentComponent,
14
+ Show,
15
+ splitProps,
16
+ useContext,
17
+ type ValidComponent,
18
18
  } from "solid-js";
19
19
  import { Dynamic } from "solid-js/web";
20
20
  import { cn } from "../lib/utils.js";
@@ -22,19 +22,19 @@ import { Field, FieldDescription, FieldError, FieldLabel } from "./field.js";
22
22
  import { Input } from "./input.js";
23
23
 
24
24
  interface FormFieldContextValue {
25
- name: string;
25
+ name: string;
26
26
  }
27
27
 
28
28
  interface FormItemContextValue {
29
- id: string;
30
- hasDescription: () => boolean;
31
- setHasDescription: (value: boolean) => void;
29
+ id: string;
30
+ hasDescription: () => boolean;
31
+ setHasDescription: (value: boolean) => void;
32
32
  }
33
33
 
34
34
  interface FormContextValue {
35
- errors: () => Record<string, string>;
36
- setError: (name: string, error: string) => void;
37
- clearError: (name: string) => void;
35
+ errors: () => Record<string, string>;
36
+ setError: (name: string, error: string) => void;
37
+ clearError: (name: string) => void;
38
38
  }
39
39
 
40
40
  const FormFieldContext = createContext<FormFieldContextValue>();
@@ -42,100 +42,100 @@ const FormItemContext = createContext<FormItemContextValue>();
42
42
  const FormContext = createContext<FormContextValue>();
43
43
 
44
44
  const Form: ParentComponent<
45
- ComponentProps<"form"> & {
46
- /** Headless: the parent's validation lib owns these; label, control aria-invalid and message all react to them. */
47
- errors?: Record<string, string>;
48
- onSetError?: (name: string, error: string) => void;
49
- onClearError?: (name: string) => void;
50
- }
45
+ ComponentProps<"form"> & {
46
+ /** Headless: the parent's validation lib owns these; label, control aria-invalid and message all react to them. */
47
+ errors?: Record<string, string>;
48
+ onSetError?: (name: string, error: string) => void;
49
+ onClearError?: (name: string) => void;
50
+ }
51
51
  > = (props) => {
52
- const [local, rest] = splitProps(props, ["children", "errors", "onSetError", "onClearError"]);
53
- const errors = () => local.errors ?? {};
54
-
55
- return (
56
- <FormContext.Provider
57
- value={{
58
- errors,
59
- setError: (name, error) => local.onSetError?.(name, error),
60
- clearError: (name) => local.onClearError?.(name),
61
- }}
62
- >
63
- <form data-slot="form" {...rest}>
64
- {local.children}
65
- </form>
66
- </FormContext.Provider>
67
- );
52
+ const [local, rest] = splitProps(props, ["children", "errors", "onSetError", "onClearError"]);
53
+ const errors = () => local.errors ?? {};
54
+
55
+ return (
56
+ <FormContext.Provider
57
+ value={{
58
+ errors,
59
+ setError: (name, error) => local.onSetError?.(name, error),
60
+ clearError: (name) => local.onClearError?.(name),
61
+ }}
62
+ >
63
+ <form data-slot="form" {...rest}>
64
+ {local.children}
65
+ </form>
66
+ </FormContext.Provider>
67
+ );
68
68
  };
69
69
 
70
70
  function useFormField() {
71
- const fieldContext = useContext(FormFieldContext);
72
- const itemContext = useContext(FormItemContext);
73
- const formContext = useContext(FormContext);
74
-
75
- const id = () => itemContext?.id ?? "";
76
- const name = () => fieldContext?.name ?? "";
77
- const error = createMemo(() => formContext?.errors()[name()] ?? "");
78
-
79
- return {
80
- id,
81
- name,
82
- hasDescription: () => itemContext?.hasDescription() ?? false,
83
- formItemId: () => `${id()}-form-item`,
84
- formDescriptionId: () => `${id()}-form-item-description`,
85
- formMessageId: () => `${id()}-form-item-message`,
86
- error,
87
- };
71
+ const fieldContext = useContext(FormFieldContext);
72
+ const itemContext = useContext(FormItemContext);
73
+ const formContext = useContext(FormContext);
74
+
75
+ const id = () => itemContext?.id ?? "";
76
+ const name = () => fieldContext?.name ?? "";
77
+ const error = createMemo(() => formContext?.errors()[name()] ?? "");
78
+
79
+ return {
80
+ id,
81
+ name,
82
+ hasDescription: () => itemContext?.hasDescription() ?? false,
83
+ formItemId: () => `${id()}-form-item`,
84
+ formDescriptionId: () => `${id()}-form-item-description`,
85
+ formMessageId: () => `${id()}-form-item-message`,
86
+ error,
87
+ };
88
88
  }
89
89
 
90
90
  const FormField: ParentComponent<{ name: string }> = (props) => {
91
- return (
92
- <FormFieldContext.Provider value={{ name: props.name }}>
93
- {props.children}
94
- </FormFieldContext.Provider>
95
- );
91
+ return (
92
+ <FormFieldContext.Provider value={{ name: props.name }}>
93
+ {props.children}
94
+ </FormFieldContext.Provider>
95
+ );
96
96
  };
97
97
 
98
98
  /** @deprecated Use `Field`. Form* is the same stack with the id wiring attached. */
99
99
  const FormItem: ParentComponent<ComponentProps<typeof Field>> = (props) => {
100
- const id = createUniqueId();
101
- const [hasDescription, setHasDescription] = createSignal(false);
102
-
103
- return (
104
- <FormItemContext.Provider value={{ id, hasDescription, setHasDescription }}>
105
- <Field {...props} />
106
- </FormItemContext.Provider>
107
- );
100
+ const id = createUniqueId();
101
+ const [hasDescription, setHasDescription] = createSignal(false);
102
+
103
+ return (
104
+ <FormItemContext.Provider value={{ id, hasDescription, setHasDescription }}>
105
+ <Field {...props} />
106
+ </FormItemContext.Provider>
107
+ );
108
108
  };
109
109
 
110
110
  /** @deprecated Use `FieldLabel`. */
111
111
  const FormLabel: Component<ComponentProps<typeof FieldLabel>> = (props) => {
112
- const [local, rest] = splitProps(props, ["class"]);
113
- const { error, formItemId } = useFormField();
114
-
115
- return (
116
- <FieldLabel
117
- data-error={!!error()}
118
- class={cn("data-[error=true]:text-destructive", local.class)}
119
- for={formItemId()}
120
- {...rest}
121
- />
122
- );
112
+ const [local, rest] = splitProps(props, ["class"]);
113
+ const { error, formItemId } = useFormField();
114
+
115
+ return (
116
+ <FieldLabel
117
+ data-error={!!error()}
118
+ class={cn("data-[error=true]:text-destructive", local.class)}
119
+ for={formItemId()}
120
+ {...rest}
121
+ />
122
+ );
123
123
  };
124
124
 
125
125
  let warnedFormControlWrapper = false;
126
126
 
127
127
  /** @internal Lets a test assert the once-per-process warning more than once. */
128
128
  export function resetFormControlWrapperWarning() {
129
- warnedFormControlWrapper = false;
129
+ warnedFormControlWrapper = false;
130
130
  }
131
131
 
132
132
  function warnFormControlWrapper() {
133
- if (warnedFormControlWrapper) return;
134
- if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
135
- warnedFormControlWrapper = true;
136
- console.warn(
137
- '[FormControl] The wrapper shape (<FormControl><Input /></FormControl>) is deprecated: an aria-describedby on a div around an input is read by nothing. Render the control itself instead: <FormControl type="email" /> or <FormControl as={Textarea} />.',
138
- );
133
+ if (warnedFormControlWrapper) return;
134
+ if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
135
+ warnedFormControlWrapper = true;
136
+ console.warn(
137
+ '[FormControl] The wrapper shape (<FormControl><Input /></FormControl>) is deprecated: an aria-describedby on a div around an input is read by nothing. Render the control itself instead: <FormControl type="email" /> or <FormControl as={Textarea} />.',
138
+ );
139
139
  }
140
140
 
141
141
  /**
@@ -149,84 +149,84 @@ function warnFormControlWrapper() {
149
149
  * describedby land on the element a screen reader announces.
150
150
  */
151
151
  const FormControl = <T extends ValidComponent = typeof Input>(
152
- props: { as?: T } & ComponentProps<T>,
152
+ props: { as?: T } & ComponentProps<T>,
153
153
  ) => {
154
- const { error, hasDescription, formItemId, formDescriptionId, formMessageId } = useFormField();
155
- const [local, rest] = splitProps(props as { as?: ValidComponent; children?: JSX.Element }, [
156
- "as",
157
- "children",
158
- ]);
159
- // Only the ids that actually render: a dangling idref reads as nothing.
160
- const describedBy = () => {
161
- const ids = [hasDescription() ? formDescriptionId() : "", error() ? formMessageId() : ""];
162
- const rendered = ids.filter((id) => id !== "");
163
- return rendered.length > 0 ? rendered.join(" ") : undefined;
164
- };
165
- // Resolved once: `local.children` is a getter, so reading it for the presence
166
- // check and again in the JSX would instantiate the child component twice.
167
- const body = children(() => local.children);
168
- const wrapped = createMemo(() => body() !== undefined);
169
- createEffect(() => {
170
- if (wrapped()) warnFormControlWrapper();
171
- });
172
-
173
- return (
174
- <Show
175
- when={wrapped()}
176
- fallback={
177
- <Dynamic
178
- component={local.as ?? Input}
179
- id={formItemId()}
180
- aria-describedby={describedBy()}
181
- aria-invalid={error() ? true : undefined}
182
- {...rest}
183
- />
184
- }
185
- >
186
- <div
187
- data-slot="form-control"
188
- id={formItemId()}
189
- aria-describedby={describedBy()}
190
- aria-invalid={error() ? true : undefined}
191
- {...(rest as ComponentProps<"div">)}
192
- >
193
- {body()}
194
- </div>
195
- </Show>
196
- );
154
+ const { error, hasDescription, formItemId, formDescriptionId, formMessageId } = useFormField();
155
+ const [local, rest] = splitProps(props as { as?: ValidComponent; children?: JSX.Element }, [
156
+ "as",
157
+ "children",
158
+ ]);
159
+ // Only the ids that actually render: a dangling idref reads as nothing.
160
+ const describedBy = () => {
161
+ const ids = [hasDescription() ? formDescriptionId() : "", error() ? formMessageId() : ""];
162
+ const rendered = ids.filter((id) => id !== "");
163
+ return rendered.length > 0 ? rendered.join(" ") : undefined;
164
+ };
165
+ // Resolved once: `local.children` is a getter, so reading it for the presence
166
+ // check and again in the JSX would instantiate the child component twice.
167
+ const body = children(() => local.children);
168
+ const wrapped = createMemo(() => body() !== undefined);
169
+ createEffect(() => {
170
+ if (wrapped()) warnFormControlWrapper();
171
+ });
172
+
173
+ return (
174
+ <Show
175
+ when={wrapped()}
176
+ fallback={
177
+ <Dynamic
178
+ component={local.as ?? Input}
179
+ id={formItemId()}
180
+ aria-describedby={describedBy()}
181
+ aria-invalid={error() ? true : undefined}
182
+ {...rest}
183
+ />
184
+ }
185
+ >
186
+ <div
187
+ data-slot="form-control"
188
+ id={formItemId()}
189
+ aria-describedby={describedBy()}
190
+ aria-invalid={error() ? true : undefined}
191
+ {...(rest as ComponentProps<"div">)}
192
+ >
193
+ {body()}
194
+ </div>
195
+ </Show>
196
+ );
197
197
  };
198
198
 
199
199
  /** @deprecated Use `FieldDescription`. */
200
200
  const FormDescription: Component<ComponentProps<typeof FieldDescription>> = (props) => {
201
- const itemContext = useContext(FormItemContext);
202
- const { formDescriptionId } = useFormField();
201
+ const itemContext = useContext(FormItemContext);
202
+ const { formDescriptionId } = useFormField();
203
203
 
204
- onMount(() => itemContext?.setHasDescription(true));
205
- onCleanup(() => itemContext?.setHasDescription(false));
204
+ onMount(() => itemContext?.setHasDescription(true));
205
+ onCleanup(() => itemContext?.setHasDescription(false));
206
206
 
207
- return <FieldDescription id={formDescriptionId()} {...props} />;
207
+ return <FieldDescription id={formDescriptionId()} {...props} />;
208
208
  };
209
209
 
210
210
  /** @deprecated Use `FieldError`. */
211
211
  const FormMessage: ParentComponent<ComponentProps<typeof FieldError>> = (props) => {
212
- const [local, rest] = splitProps(props, ["children"]);
213
- const { error, formMessageId } = useFormField();
214
- const body = () => error() || local.children;
215
-
216
- return (
217
- <FieldError id={formMessageId()} {...rest}>
218
- {body()}
219
- </FieldError>
220
- );
212
+ const [local, rest] = splitProps(props, ["children"]);
213
+ const { error, formMessageId } = useFormField();
214
+ const body = () => error() || local.children;
215
+
216
+ return (
217
+ <FieldError id={formMessageId()} {...rest}>
218
+ {body()}
219
+ </FieldError>
220
+ );
221
221
  };
222
222
 
223
223
  export {
224
- Form,
225
- FormControl,
226
- FormDescription,
227
- FormField,
228
- FormItem,
229
- FormLabel,
230
- FormMessage,
231
- useFormField,
224
+ Form,
225
+ FormControl,
226
+ FormDescription,
227
+ FormField,
228
+ FormItem,
229
+ FormLabel,
230
+ FormMessage,
231
+ useFormField,
232
232
  };
@@ -11,107 +11,107 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
11
11
  * here once; the two call shapes below (nav button vs. grouped radio item)
12
12
  * share it so neither surface can drift from the other. */
13
13
  const HERO_ACTION_CHROME =
14
- "glass group relative flex min-h-[6.25rem] items-center gap-4 overflow-hidden rounded-[calc(var(--radius)+8px)] p-4 text-left transition-glass duration-200 [--glass-lift:0.4] [--glass-wash:20%] hover:[--glass-wash:30%] [--glass-edge:oklch(from_var(--glass-tone)_l_c_h/0.5)] [&_[data-slot=ornament-arrow]]:opacity-35 hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 hover:[--glass-lift:0.85] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:translate-y-0";
14
+ "glass group relative flex min-h-[6.25rem] items-center gap-4 overflow-hidden rounded-[calc(var(--radius)+8px)] p-4 text-left transition-glass duration-200 [--glass-lift:0.4] [--glass-wash:20%] hover:[--glass-wash:30%] [--glass-edge:oklch(from_var(--glass-tone)_l_c_h/0.5)] [&_[data-slot=ornament-arrow]]:opacity-35 hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 hover:[--glass-lift:0.85] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:translate-y-0";
15
15
 
16
16
  /* glassToneText tints a label toward its own tone, which stops being legible
17
17
  * on a dark surface once the tone itself is dark (the GlassHome deep blue).
18
18
  * Lift dark tones to a readable lightness first; light tones pass through. */
19
19
  function titleTone(tone: string): string {
20
- const l = Number.parseFloat(tone.match(/oklch\(\s*([0-9.]+)/)?.[1] ?? "");
21
- if (Number.isNaN(l) || l >= 0.68) return tone;
22
- return tone.replace(/oklch\(\s*[0-9.]+/, "oklch(0.76");
20
+ const l = Number.parseFloat(tone.match(/oklch\(\s*([0-9.]+)/)?.[1] ?? "");
21
+ if (Number.isNaN(l) || l >= 0.68) return tone;
22
+ return tone.replace(/oklch\(\s*[0-9.]+/, "oklch(0.76");
23
23
  }
24
24
 
25
25
  interface HeroActionContentProps {
26
- icon: string;
27
- iconImage?: string;
28
- title: string;
29
- description: string;
30
- accentVar: string;
31
- recommended?: boolean;
32
- recommendedHint?: string;
33
- /** "arrow" is the go-somewhere-else watermark (setup); "check" is the
34
- * picked-state glyph for a grouped radio item; "none" suits a picker whose
35
- * click already moves the step on. */
36
- ornament: "arrow" | "check" | "none";
26
+ icon: string;
27
+ iconImage?: string;
28
+ title: string;
29
+ description: string;
30
+ accentVar: string;
31
+ recommended?: boolean;
32
+ recommendedHint?: string;
33
+ /** "arrow" is the go-somewhere-else watermark (setup); "check" is the
34
+ * picked-state glyph for a grouped radio item; "none" suits a picker whose
35
+ * click already moves the step on. */
36
+ ornament: "arrow" | "check" | "none";
37
37
  }
38
38
 
39
39
  function HeroActionContent(props: HeroActionContentProps) {
40
- return (
41
- <>
42
- <Ornament kind={props.ornament} />
40
+ return (
41
+ <>
42
+ <Ornament kind={props.ornament} />
43
43
 
44
- <div class="flex w-full items-center gap-4">
45
- <span
46
- class="relative flex shrink-0 items-center justify-center"
47
- style={{ color: "var(--surface-tone)" }}
48
- >
49
- <Show
50
- when={props.iconImage}
51
- fallback={<Icon icon={props.icon} width={52} aria-hidden="true" />}
52
- >
53
- {(src) => <img src={src()} alt="" class="size-14 object-contain" aria-hidden="true" />}
54
- </Show>
55
- </span>
56
- <div class="relative flex min-w-0 flex-1 flex-col gap-1">
57
- <div class="flex items-center gap-2">
58
- <h3
59
- class="font-semibold text-lg leading-tight"
60
- style={{ color: glassToneText(titleTone(props.accentVar)) }}
61
- >
62
- {props.title}
63
- </h3>
64
- <Show when={props.recommended}>
65
- <Tooltip openDelay={150}>
66
- <TooltipTrigger as={Badge} tone="var(--success)">
67
- Recommended
68
- </TooltipTrigger>
69
- <Show when={props.recommendedHint}>
70
- {(hint) => <TooltipContent>{hint()}</TooltipContent>}
71
- </Show>
72
- </Tooltip>
73
- </Show>
74
- </div>
75
- <p class="truncate text-foreground/80 text-sm">{props.description}</p>
76
- </div>
77
- </div>
78
- </>
79
- );
44
+ <div class="flex w-full items-center gap-4">
45
+ <span
46
+ class="relative flex shrink-0 items-center justify-center"
47
+ style={{ color: "var(--surface-tone)" }}
48
+ >
49
+ <Show
50
+ when={props.iconImage}
51
+ fallback={<Icon icon={props.icon} width={52} aria-hidden="true" />}
52
+ >
53
+ {(src) => <img src={src()} alt="" class="size-14 object-contain" aria-hidden="true" />}
54
+ </Show>
55
+ </span>
56
+ <div class="relative flex min-w-0 flex-1 flex-col gap-1">
57
+ <div class="flex items-center gap-2">
58
+ <h3
59
+ class="text-lg leading-tight font-semibold"
60
+ style={{ color: glassToneText(titleTone(props.accentVar)) }}
61
+ >
62
+ {props.title}
63
+ </h3>
64
+ <Show when={props.recommended}>
65
+ <Tooltip openDelay={150}>
66
+ <TooltipTrigger as={Badge} tone="var(--success)">
67
+ Recommended
68
+ </TooltipTrigger>
69
+ <Show when={props.recommendedHint}>
70
+ {(hint) => <TooltipContent>{hint()}</TooltipContent>}
71
+ </Show>
72
+ </Tooltip>
73
+ </Show>
74
+ </div>
75
+ <p class="text-foreground/80 truncate text-sm">{props.description}</p>
76
+ </div>
77
+ </div>
78
+ </>
79
+ );
80
80
  }
81
81
 
82
82
  /** Navigates away immediately on click — the setup wizard's connect/sign-in
83
83
  * steps. Not part of a group, no persisted selection. */
84
84
  export function HeroAction(props: {
85
- icon: string;
86
- iconImage?: string;
87
- title: string;
88
- description: string;
89
- onClick: () => void;
90
- accentVar: string;
91
- disabled?: boolean;
92
- recommended?: boolean;
93
- recommendedHint?: string;
94
- class?: string;
85
+ icon: string;
86
+ iconImage?: string;
87
+ title: string;
88
+ description: string;
89
+ onClick: () => void;
90
+ accentVar: string;
91
+ disabled?: boolean;
92
+ recommended?: boolean;
93
+ recommendedHint?: string;
94
+ class?: string;
95
95
  }) {
96
- return (
97
- <button
98
- type="button"
99
- data-slot="hero-action"
100
- onClick={() => !props.disabled && props.onClick()}
101
- disabled={props.disabled}
102
- class={cn(HERO_ACTION_CHROME, isNeutralTone(props.accentVar) && NEUTRAL_KNOBS, props.class)}
103
- style={{ "--glass-tone": props.accentVar } as JSX.CSSProperties}
104
- >
105
- <HeroActionContent
106
- icon={props.icon}
107
- iconImage={props.iconImage}
108
- title={props.title}
109
- description={props.description}
110
- accentVar={props.accentVar}
111
- recommended={props.recommended}
112
- recommendedHint={props.recommendedHint}
113
- ornament="arrow"
114
- />
115
- </button>
116
- );
96
+ return (
97
+ <button
98
+ type="button"
99
+ data-slot="hero-action"
100
+ onClick={() => !props.disabled && props.onClick()}
101
+ disabled={props.disabled}
102
+ class={cn(HERO_ACTION_CHROME, isNeutralTone(props.accentVar) && NEUTRAL_KNOBS, props.class)}
103
+ style={{ "--glass-tone": props.accentVar } as JSX.CSSProperties}
104
+ >
105
+ <HeroActionContent
106
+ icon={props.icon}
107
+ iconImage={props.iconImage}
108
+ title={props.title}
109
+ description={props.description}
110
+ accentVar={props.accentVar}
111
+ recommended={props.recommended}
112
+ recommendedHint={props.recommendedHint}
113
+ ornament="arrow"
114
+ />
115
+ </button>
116
+ );
117
117
  }
@@ -7,20 +7,20 @@ import { cn } from "../lib/utils.js";
7
7
  const HoverCard = HoverCardPrimitive;
8
8
 
9
9
  const HoverCardTrigger: Component<ComponentProps<typeof HoverCardPrimitive.Trigger>> = (props) => {
10
- return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
10
+ return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
11
11
  };
12
12
 
13
13
  const HoverCardContent: Component<ComponentProps<typeof HoverCardPrimitive.Content>> = (props) => {
14
- const [local, rest] = splitProps(props, ["class"]);
15
- return (
16
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
17
- <HoverCardPrimitive.Content
18
- data-slot="hover-card-content"
19
- class={cn(FLOATING_PANEL, OVERLAY_MOTION, "w-64 p-4", local.class)}
20
- {...rest}
21
- />
22
- </HoverCardPrimitive.Portal>
23
- );
14
+ const [local, rest] = splitProps(props, ["class"]);
15
+ return (
16
+ <HoverCardPrimitive.Portal data-slot="hover-card-portal">
17
+ <HoverCardPrimitive.Content
18
+ data-slot="hover-card-content"
19
+ class={cn(FLOATING_PANEL, OVERLAY_MOTION, "w-64 p-4", local.class)}
20
+ {...rest}
21
+ />
22
+ </HoverCardPrimitive.Portal>
23
+ );
24
24
  };
25
25
 
26
26
  export { HoverCard, HoverCardContent, HoverCardTrigger };