@adea-ai/ui 0.110.1 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/action-button/action-button.d.ts +8 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +9 -3
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +17 -2
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +47 -122
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +0 -4
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +60 -68
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +0 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +2 -2
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +1 -1
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +2 -2
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +1 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +22 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +79 -30
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +2 -2
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/select/index.d.ts +1 -0
- package/dist/components/ui/select/index.d.ts.map +1 -1
- package/dist/components/ui/select/select.d.ts +7 -1
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.js +34 -20
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +1 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +16 -6
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +15 -4
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/overlay.d.ts +30 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +37 -2
- package/dist/lib/overlay.js.map +1 -1
- package/dist/r/src/components/composites/action-button/action-button.tsx +10 -1
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +33 -86
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +0 -3
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +20 -7
- package/dist/r/src/components/theme/appearance-panel.tsx +0 -1
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +2 -2
- package/dist/r/src/components/ui/combobox/combobox.tsx +3 -1
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +6 -2
- package/dist/r/src/components/ui/dialog/dialog.tsx +2 -2
- package/dist/r/src/components/ui/drawer/drawer.tsx +1 -1
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +44 -6
- package/dist/r/src/components/ui/dropdown-menu/index.ts +1 -0
- package/dist/r/src/components/ui/menubar/menubar.tsx +6 -2
- package/dist/r/src/components/ui/select/index.ts +1 -0
- package/dist/r/src/components/ui/select/select.tsx +31 -6
- package/dist/r/src/components/ui/sheet/sheet.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +28 -2
- package/dist/r/src/lib/overlay.ts +45 -1
- package/package.json +1 -1
- package/src/components/composites/action-button/action-button.tsx +10 -1
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +33 -86
- package/src/components/composites/appearance-editor/appearance-choices.tsx +0 -3
- package/src/components/composites/appearance-editor/font-settings-group.tsx +20 -7
- package/src/components/theme/appearance-panel.tsx +0 -1
- package/src/components/ui/alert-dialog/alert-dialog.tsx +2 -2
- package/src/components/ui/combobox/combobox.tsx +3 -1
- package/src/components/ui/context-menu/context-menu.tsx +6 -2
- package/src/components/ui/dialog/dialog.tsx +2 -2
- package/src/components/ui/drawer/drawer.tsx +1 -1
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +44 -6
- package/src/components/ui/dropdown-menu/index.ts +1 -0
- package/src/components/ui/menubar/menubar.tsx +6 -2
- package/src/components/ui/select/index.ts +1 -0
- package/src/components/ui/select/select.tsx +31 -6
- package/src/components/ui/sheet/sheet.tsx +1 -1
- package/src/components/ui/tooltip/tooltip.tsx +28 -2
- package/src/lib/overlay.ts +45 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'
|
|
2
2
|
import { Check, ChevronRight, Circle } from 'lucide-solid'
|
|
3
3
|
import type { Accessor, ComponentProps } from 'solid-js'
|
|
4
|
-
import { createContext, splitProps, useContext } from 'solid-js'
|
|
4
|
+
import { createContext, Show, splitProps, useContext } from 'solid-js'
|
|
5
5
|
import {
|
|
6
6
|
menuContentPadding,
|
|
7
7
|
destructiveMenuItem,
|
|
8
8
|
menuItem,
|
|
9
9
|
menuLabel,
|
|
10
|
+
menuSwatchTone,
|
|
11
|
+
type MenuSwatchTone,
|
|
10
12
|
menuSeparator,
|
|
11
13
|
overlayMotion,
|
|
12
14
|
overlaySurface,
|
|
@@ -192,6 +194,13 @@ export function DropdownMenuPortal(props: ComponentProps<typeof KobalteDropdownM
|
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
export type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & {
|
|
197
|
+
/**
|
|
198
|
+
* Kept for callers that hid the arrow explicitly; the arrow is now hidden by
|
|
199
|
+
* default. Pass `false` to draw one. The default flipped because Kobalte
|
|
200
|
+
* reserves half of the arrow's 30px box as popper gutter — a menu anchored to
|
|
201
|
+
* its trigger floated 15px off it, which read as a gap rather than as a
|
|
202
|
+
* pointer, and every anchored caller already passed `hideArrow`.
|
|
203
|
+
*/
|
|
195
204
|
hideArrow?: boolean
|
|
196
205
|
/** Mount under an owner element such as a modal, keeping the menu in its accessible subtree. */
|
|
197
206
|
portalMount?: HTMLElement
|
|
@@ -213,7 +222,12 @@ export function DropdownMenuContent(props: DropdownMenuContentProps) {
|
|
|
213
222
|
)}
|
|
214
223
|
{...rest}
|
|
215
224
|
>
|
|
216
|
-
{
|
|
225
|
+
{local.hideArrow === false && (
|
|
226
|
+
/* Rendered only when a caller asks for it back: the popper folds half
|
|
227
|
+
the arrow's box into the content's gutter, so an arrow and a flush
|
|
228
|
+
menu have never been true at once. */
|
|
229
|
+
<KobalteDropdownMenu.Arrow aria-hidden="true" class={popoverArrow} />
|
|
230
|
+
)}
|
|
217
231
|
{local.children}
|
|
218
232
|
</KobalteDropdownMenu.Content>
|
|
219
233
|
</KobalteDropdownMenu.Portal>
|
|
@@ -233,6 +247,10 @@ export function DropdownMenuItem(
|
|
|
233
247
|
* whenever `shortcut` is drawn.
|
|
234
248
|
*/
|
|
235
249
|
keyshortcuts?: string
|
|
250
|
+
/** Draw a leading colour dot from the shared tone ladder — the accent or
|
|
251
|
+
* status role the option's card badge carries. `aria-hidden`; the label
|
|
252
|
+
* carries the meaning. */
|
|
253
|
+
swatch?: MenuSwatchTone
|
|
236
254
|
}
|
|
237
255
|
) {
|
|
238
256
|
const [local, rest] = splitProps(props, [
|
|
@@ -240,6 +258,7 @@ export function DropdownMenuItem(
|
|
|
240
258
|
'variant',
|
|
241
259
|
'shortcut',
|
|
242
260
|
'keyshortcuts',
|
|
261
|
+
'swatch',
|
|
243
262
|
'children',
|
|
244
263
|
])
|
|
245
264
|
|
|
@@ -255,6 +274,9 @@ export function DropdownMenuItem(
|
|
|
255
274
|
aria-keyshortcuts={local.keyshortcuts}
|
|
256
275
|
{...rest}
|
|
257
276
|
>
|
|
277
|
+
<Show when={local.swatch}>
|
|
278
|
+
<span aria-hidden="true" class={menuSwatchTone({ tone: local.swatch })} />
|
|
279
|
+
</Show>
|
|
258
280
|
{local.children}
|
|
259
281
|
{local.shortcut ? (
|
|
260
282
|
<span
|
|
@@ -292,12 +314,19 @@ export function DropdownMenuShortcut(props: ComponentProps<'span'>) {
|
|
|
292
314
|
}
|
|
293
315
|
|
|
294
316
|
export function DropdownMenuCheckboxItem(
|
|
295
|
-
props: ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>
|
|
317
|
+
props: ComponentProps<typeof KobalteDropdownMenu.CheckboxItem> & {
|
|
318
|
+
/** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;
|
|
319
|
+
* the label carries the meaning. */
|
|
320
|
+
swatch?: MenuSwatchTone
|
|
321
|
+
}
|
|
296
322
|
) {
|
|
297
|
-
const [local, rest] = splitProps(props, ['class', 'children'])
|
|
323
|
+
const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])
|
|
298
324
|
|
|
299
325
|
return (
|
|
300
326
|
<KobalteDropdownMenu.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>
|
|
327
|
+
<Show when={local.swatch}>
|
|
328
|
+
<span aria-hidden="true" class={menuSwatchTone({ tone: local.swatch })} />
|
|
329
|
+
</Show>
|
|
301
330
|
{local.children}
|
|
302
331
|
<KobalteDropdownMenu.ItemIndicator
|
|
303
332
|
data-slot="dropdown-menu-indicator"
|
|
@@ -315,11 +344,20 @@ export function DropdownMenuRadioGroup(
|
|
|
315
344
|
return <KobalteDropdownMenu.RadioGroup {...props} />
|
|
316
345
|
}
|
|
317
346
|
|
|
318
|
-
export function DropdownMenuRadioItem(
|
|
319
|
-
|
|
347
|
+
export function DropdownMenuRadioItem(
|
|
348
|
+
props: ComponentProps<typeof KobalteDropdownMenu.RadioItem> & {
|
|
349
|
+
/** Draw a leading colour dot from the shared tone ladder. `aria-hidden`;
|
|
350
|
+
* the label carries the meaning. */
|
|
351
|
+
swatch?: MenuSwatchTone
|
|
352
|
+
}
|
|
353
|
+
) {
|
|
354
|
+
const [local, rest] = splitProps(props, ['class', 'swatch', 'children'])
|
|
320
355
|
|
|
321
356
|
return (
|
|
322
357
|
<KobalteDropdownMenu.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>
|
|
358
|
+
<Show when={local.swatch}>
|
|
359
|
+
<span aria-hidden="true" class={menuSwatchTone({ tone: local.swatch })} />
|
|
360
|
+
</Show>
|
|
323
361
|
{local.children}
|
|
324
362
|
{/* The indicator reads in the accent, like every other selected state in
|
|
325
363
|
the system — a canvas-colored dot on a checked row reads as decoration. */}
|
|
@@ -139,7 +139,9 @@ export function MenubarCheckboxItem(props: ComponentProps<typeof KobalteMenubar.
|
|
|
139
139
|
return (
|
|
140
140
|
<KobalteMenubar.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>
|
|
141
141
|
{local.children}
|
|
142
|
-
|
|
142
|
+
{/* The indicator reads in the accent, like every other selected state in
|
|
143
|
+
the system. */}
|
|
144
|
+
<KobalteMenubar.ItemIndicator class="absolute end-2 flex size-4 items-center justify-center text-primary">
|
|
143
145
|
<Check class="size-4" />
|
|
144
146
|
</KobalteMenubar.ItemIndicator>
|
|
145
147
|
</KobalteMenubar.CheckboxItem>
|
|
@@ -155,7 +157,9 @@ export function MenubarRadioItem(props: ComponentProps<typeof KobalteMenubar.Rad
|
|
|
155
157
|
return (
|
|
156
158
|
<KobalteMenubar.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>
|
|
157
159
|
{local.children}
|
|
158
|
-
|
|
160
|
+
{/* The indicator reads in the accent, like every other selected state in
|
|
161
|
+
the system. */}
|
|
162
|
+
<KobalteMenubar.ItemIndicator class="absolute end-2 flex size-4 items-center justify-center text-primary">
|
|
159
163
|
<Circle class="size-2 fill-current" />
|
|
160
164
|
</KobalteMenubar.ItemIndicator>
|
|
161
165
|
</KobalteMenubar.RadioItem>
|
|
@@ -2,7 +2,13 @@ import { Select as KobalteSelect } from '@kobalte/core/select'
|
|
|
2
2
|
import { Check, ChevronDown, ChevronsUpDown } from 'lucide-solid'
|
|
3
3
|
import type { ComponentProps } from 'solid-js'
|
|
4
4
|
import { Show, splitProps } from 'solid-js'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
menuContentPadding,
|
|
7
|
+
menuItem,
|
|
8
|
+
menuSwatchTone,
|
|
9
|
+
type MenuSwatchTone,
|
|
10
|
+
topLayerProps,
|
|
11
|
+
} from '../../../lib/overlay'
|
|
6
12
|
import { cn } from '../../../lib/utils'
|
|
7
13
|
|
|
8
14
|
/**
|
|
@@ -21,7 +27,12 @@ import { cn } from '../../../lib/utils'
|
|
|
21
27
|
export function Select<Option, OptGroup = never>(
|
|
22
28
|
props: ComponentProps<typeof KobalteSelect<Option, OptGroup>>
|
|
23
29
|
) {
|
|
24
|
-
|
|
30
|
+
// Kobalte's own default gutter is 8px; without the arrow (removed below) the
|
|
31
|
+
// popper no longer folds half an arrow box into that offset, and 8px read as
|
|
32
|
+
// a detached list. Four pixels is shadcn's `sideOffset` — attached, with
|
|
33
|
+
// room for the trigger's own border.
|
|
34
|
+
const [local, rest] = splitProps(props, ['gutter'])
|
|
35
|
+
return <KobalteSelect gutter={local.gutter ?? 4} {...rest} />
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
export type SelectTriggerProps = ComponentProps<typeof KobalteSelect.Trigger> & {
|
|
@@ -153,20 +164,34 @@ export function SelectContent(props: SelectContentProps) {
|
|
|
153
164
|
{...rest}
|
|
154
165
|
>
|
|
155
166
|
{local.children}
|
|
167
|
+
{/* No arrow: the list is the trigger's own value opened up, and Kobalte
|
|
168
|
+
reserves half the arrow's 30px box as popper gutter, which is where
|
|
169
|
+
the reported gap between a form trigger and its options came from. */}
|
|
156
170
|
<KobalteSelect.Listbox class="flex flex-col" />
|
|
157
|
-
<KobalteSelect.Arrow aria-hidden="true" class={popoverArrow} />
|
|
158
171
|
</KobalteSelect.Content>
|
|
159
172
|
</KobalteSelect.Portal>
|
|
160
173
|
)
|
|
161
174
|
}
|
|
162
175
|
|
|
163
|
-
export function SelectItem(
|
|
164
|
-
|
|
176
|
+
export function SelectItem(
|
|
177
|
+
props: ComponentProps<typeof KobalteSelect.Item> & {
|
|
178
|
+
/** Draw a leading colour dot from the shared tone ladder — the accent or
|
|
179
|
+
* status role the option's card badge carries. `aria-hidden`; the label
|
|
180
|
+
* carries the meaning. */
|
|
181
|
+
swatch?: MenuSwatchTone
|
|
182
|
+
}
|
|
183
|
+
) {
|
|
184
|
+
const [local, rest] = splitProps(props, ['class', 'children', 'swatch'])
|
|
165
185
|
|
|
166
186
|
return (
|
|
167
187
|
<KobalteSelect.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>
|
|
188
|
+
<Show when={local.swatch}>
|
|
189
|
+
<span aria-hidden="true" class={menuSwatchTone({ tone: local.swatch })} />
|
|
190
|
+
</Show>
|
|
168
191
|
<KobalteSelect.ItemLabel>{local.children}</KobalteSelect.ItemLabel>
|
|
169
|
-
|
|
192
|
+
{/* The indicator reads in the accent, like every other selected state in
|
|
193
|
+
the system — the row's own foreground reads as decoration. */}
|
|
194
|
+
<KobalteSelect.ItemIndicator class="absolute end-2 flex size-4 items-center justify-center text-primary">
|
|
170
195
|
<Check class="size-4" />
|
|
171
196
|
</KobalteSelect.ItemIndicator>
|
|
172
197
|
</KobalteSelect.Item>
|
|
@@ -46,7 +46,7 @@ import { createDialogFocusRestoration, DialogOverlay } from '../dialog/dialog'
|
|
|
46
46
|
// scrolled programmatically (focus, scrollIntoView, scrollTop), which slid the
|
|
47
47
|
// pinned footer out of view. Only SheetBody scrolls.
|
|
48
48
|
const sheetVariants = cva(
|
|
49
|
-
'bg-
|
|
49
|
+
'bg-background text-foreground fixed z-(--z-dialog) flex flex-col overflow-clip border-border shadow-lg',
|
|
50
50
|
{
|
|
51
51
|
variants: {
|
|
52
52
|
side: {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Tooltip as KobalteTooltip, useTooltipContext } from '@kobalte/core/tooltip'
|
|
2
|
-
import type { ComponentProps } from 'solid-js'
|
|
2
|
+
import type { ComponentProps, JSX } from 'solid-js'
|
|
3
3
|
import {
|
|
4
4
|
createContext,
|
|
5
5
|
createEffect,
|
|
6
6
|
createSignal,
|
|
7
7
|
createUniqueId,
|
|
8
8
|
onCleanup,
|
|
9
|
+
Show,
|
|
9
10
|
splitProps,
|
|
10
11
|
useContext,
|
|
11
12
|
} from 'solid-js'
|
|
@@ -349,13 +350,24 @@ export function TooltipTrigger(props: ComponentProps<typeof KobalteTooltip.Trigg
|
|
|
349
350
|
)
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
export type TooltipContentProps = ComponentProps<typeof KobalteTooltip.Content>
|
|
353
|
+
export type TooltipContentProps = ComponentProps<typeof KobalteTooltip.Content> & {
|
|
354
|
+
/**
|
|
355
|
+
* A leading icon, repeating the trigger's glyph inside the tip — the side
|
|
356
|
+
* rail's icon+label treatment, offered so a toolbar or rail tooltip does not
|
|
357
|
+
* have to hand-roll it. Decorative by contract: the tip is `aria-hidden`
|
|
358
|
+
* while closed and never the accessible name, so the icon must not be the
|
|
359
|
+
* only carrier of meaning. Size it by leaving the svg bare; the slot fixes
|
|
360
|
+
* it to the system's control size.
|
|
361
|
+
*/
|
|
362
|
+
icon?: JSX.Element
|
|
363
|
+
}
|
|
353
364
|
|
|
354
365
|
export function TooltipContent(props: TooltipContentProps) {
|
|
355
366
|
const interaction = useContext(TooltipInteractionContext)
|
|
356
367
|
const [local, rest] = splitProps(props, [
|
|
357
368
|
'class',
|
|
358
369
|
'children',
|
|
370
|
+
'icon',
|
|
359
371
|
'aria-hidden',
|
|
360
372
|
'onEscapeKeyDown',
|
|
361
373
|
'onPointerDownOutside',
|
|
@@ -380,6 +392,9 @@ export function TooltipContent(props: TooltipContentProps) {
|
|
|
380
392
|
'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',
|
|
381
393
|
'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
382
394
|
'data-expanded:duration-150 data-closed:duration-100',
|
|
395
|
+
// An icon+label tip is one row that reads as a unit, so the label
|
|
396
|
+
// never wraps under the glyph.
|
|
397
|
+
{ 'flex items-center gap-2 whitespace-nowrap': !!local.icon },
|
|
383
398
|
local.class
|
|
384
399
|
)}
|
|
385
400
|
// A tooltip is never interactive: the content is plain text, and the
|
|
@@ -404,6 +419,17 @@ export function TooltipContent(props: TooltipContentProps) {
|
|
|
404
419
|
{...topLayerProps}
|
|
405
420
|
{...rest}
|
|
406
421
|
>
|
|
422
|
+
<Show when={local.icon}>
|
|
423
|
+
{(icon) => (
|
|
424
|
+
<span
|
|
425
|
+
data-slot="tooltip-icon"
|
|
426
|
+
aria-hidden="true"
|
|
427
|
+
class="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4"
|
|
428
|
+
>
|
|
429
|
+
{icon()}
|
|
430
|
+
</span>
|
|
431
|
+
)}
|
|
432
|
+
</Show>
|
|
407
433
|
{local.children}
|
|
408
434
|
</KobalteTooltip.Content>
|
|
409
435
|
</KobalteTooltip.Portal>
|
|
@@ -10,10 +10,29 @@
|
|
|
10
10
|
* "an overlay looks like this" a fact rather than a convention.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { cva, type VariantProps } from './variants'
|
|
14
|
+
|
|
15
|
+
/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers
|
|
16
|
+
* and the command palette float on the elevated overlay rung (`--popover`). */
|
|
14
17
|
export const overlaySurface =
|
|
15
18
|
'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The modal panel: the same hairline edge, radius and elevation, painted on the
|
|
22
|
+
* *neutral* theme surface instead of the elevated overlay rung.
|
|
23
|
+
*
|
|
24
|
+
* `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies
|
|
25
|
+
* the canvas hue's chroma on the elevated step. On the dark default's violet
|
|
26
|
+
* canvas that makes the dialog the most chromatic surface in the ladder —
|
|
27
|
+
* `oklch(0.2406 0.0088 300.91)`, red above green in sRGB — and on a full dialog
|
|
28
|
+
* panel that cast reads as a warm tint the canvas never has. shadcn's own
|
|
29
|
+
* convention already splits the two: a Dialog paints `bg-background`, menus and
|
|
30
|
+
* popovers paint `bg-popover`. The veil, the hairline and the elevation shadow
|
|
31
|
+
* carry the separation the lighter fill no longer provides.
|
|
32
|
+
*/
|
|
33
|
+
export const dialogSurface =
|
|
34
|
+
'bg-background text-foreground rounded-xl border border-border shadow-lg'
|
|
35
|
+
|
|
17
36
|
/**
|
|
18
37
|
* Overlay titles have one fixed typography role. Keep this small recipe shared
|
|
19
38
|
* without loading the configurable Heading component into every dialog.
|
|
@@ -85,6 +104,31 @@ export const menuLabel =
|
|
|
85
104
|
/** The rule between menu groups. */
|
|
86
105
|
export const menuSeparator = 'bg-border -mx-1 my-1 h-px'
|
|
87
106
|
|
|
107
|
+
/**
|
|
108
|
+
* A leading colour swatch on a menu or select row: the sanctioned way to carry
|
|
109
|
+
* a card-tone colour into a list of options. The tones are the system's accent
|
|
110
|
+
* and status roles — the vocabulary a Badge already speaks — so the colour an
|
|
111
|
+
* option shows in a menu is the colour its badge carries on a card, and a
|
|
112
|
+
* caller never passes a raw colour into a list. The dot is `aria-hidden`; the
|
|
113
|
+
* label carries the meaning, so a tone is never the only signal.
|
|
114
|
+
*/
|
|
115
|
+
export const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {
|
|
116
|
+
variants: {
|
|
117
|
+
tone: {
|
|
118
|
+
neutral: 'bg-muted-foreground',
|
|
119
|
+
primary: 'bg-primary',
|
|
120
|
+
success: 'bg-success',
|
|
121
|
+
warning: 'bg-warning',
|
|
122
|
+
destructive: 'bg-destructive',
|
|
123
|
+
info: 'bg-info',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
defaultVariants: { tone: 'neutral' },
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
/** The tones a menu row's swatch can take. */
|
|
130
|
+
export type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>
|
|
131
|
+
|
|
88
132
|
/** Padding shared by every menu-list surface. */
|
|
89
133
|
export const menuContentPadding = 'p-1'
|
|
90
134
|
|
package/package.json
CHANGED
|
@@ -29,6 +29,14 @@ export type ActionButtonProps<T extends ValidComponent = 'button'> = ButtonProps
|
|
|
29
29
|
tooltip?: string
|
|
30
30
|
/** Placement of the explanation; icon actions live in bars, so it defaults below the control. */
|
|
31
31
|
tooltipSide?: 'top' | 'right' | 'bottom' | 'left'
|
|
32
|
+
/**
|
|
33
|
+
* A leading icon repeated inside the explanation, forwarded to the shared
|
|
34
|
+
* tooltip's `icon` slot so a bar of icon actions gets the icon+label tip
|
|
35
|
+
* without hand-composing Button and Tooltip. Decorative by contract: the tip
|
|
36
|
+
* is never the accessible name, so the icon must not carry meaning the label
|
|
37
|
+
* lacks. Size it by leaving the svg bare; the slot fixes it to control size.
|
|
38
|
+
*/
|
|
39
|
+
tooltipIcon?: JSX.Element
|
|
32
40
|
/** Disables the action and announces the busy label through a polite status region. */
|
|
33
41
|
busy?: boolean
|
|
34
42
|
/** The activity announced while busy. The Button's accessible name stays unchanged. */
|
|
@@ -92,6 +100,7 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
|
|
|
92
100
|
'aria-busy',
|
|
93
101
|
'tooltip',
|
|
94
102
|
'tooltipSide',
|
|
103
|
+
'tooltipIcon',
|
|
95
104
|
'busy',
|
|
96
105
|
'busyLabel',
|
|
97
106
|
])
|
|
@@ -175,7 +184,7 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
|
|
|
175
184
|
>
|
|
176
185
|
{contents()}
|
|
177
186
|
</TooltipTrigger>
|
|
178
|
-
<TooltipContent>{local.tooltip}</TooltipContent>
|
|
187
|
+
<TooltipContent icon={local.tooltipIcon}>{local.tooltip}</TooltipContent>
|
|
179
188
|
</Tooltip>
|
|
180
189
|
</Show>
|
|
181
190
|
<Show when={busy()}>
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { RadioGroup as Radio } from '@kobalte/core/radio-group'
|
|
25
|
-
import { For
|
|
26
|
-
import { cn } from '#lib/utils'
|
|
27
|
-
|
|
28
|
-
export const PRIMARY_ACCENT_IDS = ['blue', 'green', 'amber', 'cyan', 'pink'] as const
|
|
29
|
-
const primaryAccentIds: ReadonlySet<string> = new Set(PRIMARY_ACCENT_IDS)
|
|
25
|
+
import { For } from 'solid-js'
|
|
30
26
|
|
|
31
27
|
type AccentOption = Readonly<{
|
|
32
28
|
id: string
|
|
@@ -37,104 +33,55 @@ type AccentOption = Readonly<{
|
|
|
37
33
|
|
|
38
34
|
type AccentSwatchGroupsProps = {
|
|
39
35
|
accentOptions: readonly AccentOption[]
|
|
40
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Accepted for host compatibility and no longer rendered. The picker offers
|
|
38
|
+
* one theme-scoped group — the theme's own primary followed by the presets —
|
|
39
|
+
* instead of splitting additional presets and the theme pair's accent slots
|
|
40
|
+
* into labelled groups of their own. A stored theme-accent id still resolves
|
|
41
|
+
* (`resolveAccentPreset`) and is still described by the row; it is just no
|
|
42
|
+
* longer offered as a swatch, and a host can stop feeding this list.
|
|
43
|
+
*/
|
|
44
|
+
themeAccentOptions?: readonly AccentOption[]
|
|
41
45
|
resolvedAppearance: 'light' | 'dark'
|
|
42
46
|
themeDefaultColor: string
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/**
|
|
50
|
+
* The accent choices, as ONE group: the theme's own primary first, then every
|
|
51
|
+
* preset the host feeds, each painted with its value for the resolved
|
|
52
|
+
* appearance — which is what makes the group theme-scoped rather than a
|
|
53
|
+
* catalogue table. The custom-color entry is the host's (`AccentChoices`
|
|
54
|
+
* renders it beside this grid), because whether a free-form colour is accepted
|
|
55
|
+
* is the host's validation to own.
|
|
56
|
+
*/
|
|
45
57
|
export function AccentSwatchGroups(props: AccentSwatchGroupsProps) {
|
|
46
|
-
const
|
|
47
|
-
PRIMARY_ACCENT_IDS.flatMap((id) => {
|
|
48
|
-
const option = props.accentOptions.find((candidate) => candidate.id === id)
|
|
49
|
-
return option ? [option] : []
|
|
50
|
-
})
|
|
51
|
-
const additionalAccents = () =>
|
|
52
|
-
props.accentOptions.filter(
|
|
53
|
-
(option) => option.id !== 'theme' && !primaryAccentIds.has(option.id)
|
|
54
|
-
)
|
|
58
|
+
const presets = () => props.accentOptions.filter((option) => option.id !== 'theme')
|
|
55
59
|
|
|
56
60
|
return (
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
label={option.label}
|
|
70
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
71
|
-
group="primary"
|
|
72
|
-
/>
|
|
73
|
-
)}
|
|
74
|
-
</For>
|
|
75
|
-
</div>
|
|
76
|
-
<Show when={additionalAccents().length > 0}>
|
|
77
|
-
<div class="flex flex-col gap-1">
|
|
78
|
-
<span class="text-xs font-medium text-muted-foreground">Additional colors</span>
|
|
79
|
-
<div class="flex flex-wrap gap-2">
|
|
80
|
-
<For each={additionalAccents()}>
|
|
81
|
-
{(option) => (
|
|
82
|
-
<AccentSwatch
|
|
83
|
-
id={option.id}
|
|
84
|
-
label={option.label}
|
|
85
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
86
|
-
group="additional"
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
</For>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
</Show>
|
|
93
|
-
<Show when={props.themeAccentOptions.length > 0}>
|
|
94
|
-
<div class="flex flex-col gap-1">
|
|
95
|
-
<span class="text-xs font-medium text-muted-foreground">Theme accents</span>
|
|
96
|
-
<div class="grid grid-cols-3 gap-2">
|
|
97
|
-
<For each={props.themeAccentOptions}>
|
|
98
|
-
{(option) => (
|
|
99
|
-
<AccentSwatch
|
|
100
|
-
id={option.id}
|
|
101
|
-
label={'Theme ' + option.label.toLowerCase()}
|
|
102
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
103
|
-
group="theme"
|
|
104
|
-
dashed
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
107
|
-
</For>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</Show>
|
|
111
|
-
</>
|
|
61
|
+
<div class="grid grid-cols-4 gap-2" data-accent-grid>
|
|
62
|
+
<AccentSwatch id="theme" label="Theme default" color={props.themeDefaultColor} />
|
|
63
|
+
<For each={presets()}>
|
|
64
|
+
{(option) => (
|
|
65
|
+
<AccentSwatch
|
|
66
|
+
id={option.id}
|
|
67
|
+
label={option.label}
|
|
68
|
+
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</For>
|
|
72
|
+
</div>
|
|
112
73
|
)
|
|
113
74
|
}
|
|
114
75
|
|
|
115
|
-
function AccentSwatch(props: {
|
|
116
|
-
id: string
|
|
117
|
-
label: string
|
|
118
|
-
color: string
|
|
119
|
-
group: 'primary' | 'additional' | 'theme'
|
|
120
|
-
dashed?: boolean
|
|
121
|
-
}) {
|
|
76
|
+
function AccentSwatch(props: { id: string; label: string; color: string }) {
|
|
122
77
|
return (
|
|
123
78
|
<Radio.Item
|
|
124
79
|
value={props.id}
|
|
125
80
|
data-accent-option={props.id}
|
|
126
|
-
data-primary-accent={props.group === 'primary' ? props.id : undefined}
|
|
127
|
-
data-additional-accent={props.group === 'additional' ? props.id : undefined}
|
|
128
|
-
data-theme-accent={props.group === 'theme' ? props.id : undefined}
|
|
129
81
|
class="rounded-full focus-within:ring-3 focus-within:ring-ring/50"
|
|
130
82
|
>
|
|
131
83
|
<Radio.ItemInput />
|
|
132
|
-
<Radio.ItemLabel
|
|
133
|
-
class={cn(
|
|
134
|
-
'block size-7 cursor-pointer rounded-full border p-0.5 data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary',
|
|
135
|
-
{ 'border-dashed data-[checked]:border-solid': props.dashed }
|
|
136
|
-
)}
|
|
137
|
-
>
|
|
84
|
+
<Radio.ItemLabel class="block size-7 cursor-pointer rounded-full border p-0.5 data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
|
|
138
85
|
<span
|
|
139
86
|
class="block size-full rounded-full"
|
|
140
87
|
aria-hidden="true"
|
|
@@ -104,8 +104,6 @@ export function AccentChoices(props: AppearanceEditorProps) {
|
|
|
104
104
|
// user will see it.
|
|
105
105
|
const resolvedAppearance = () =>
|
|
106
106
|
props.draft.mode === 'system' ? props.resolvedAppearance : props.draft.mode
|
|
107
|
-
// The accents the previewed theme pair carries, offered after the presets.
|
|
108
|
-
const themeAccents = () => props.themeAccentOptions ?? []
|
|
109
107
|
const accentSelection = () => (isCustomAccent(props) ? 'custom' : props.draft.accent)
|
|
110
108
|
return (
|
|
111
109
|
<Radio
|
|
@@ -122,7 +120,6 @@ export function AccentChoices(props: AppearanceEditorProps) {
|
|
|
122
120
|
>
|
|
123
121
|
<AccentSwatchGroups
|
|
124
122
|
accentOptions={props.accentOptions}
|
|
125
|
-
themeAccentOptions={themeAccents()}
|
|
126
123
|
resolvedAppearance={resolvedAppearance()}
|
|
127
124
|
themeDefaultColor={
|
|
128
125
|
resolvedAppearance() === 'light'
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
DropdownMenuTrigger,
|
|
12
12
|
} from '../../ui/dropdown-menu/dropdown-menu'
|
|
13
13
|
import { InputControl } from '../../ui/input/input-control'
|
|
14
|
-
import { SettingsRow } from './appearance-rows'
|
|
15
14
|
import {
|
|
16
15
|
APPEARANCE_EDITOR_FONT_SIZE_MAX,
|
|
17
16
|
APPEARANCE_EDITOR_FONT_SIZE_MIN,
|
|
@@ -142,7 +141,7 @@ function FontFamilyMenu(props: {
|
|
|
142
141
|
size="sm"
|
|
143
142
|
aria-label={`${props.label} font family`}
|
|
144
143
|
disabled={props.disabled}
|
|
145
|
-
class="w-
|
|
144
|
+
class="w-32 max-w-full justify-between"
|
|
146
145
|
>
|
|
147
146
|
<span class="truncate">{selectedLabel()}</span>
|
|
148
147
|
<ChevronDown aria-hidden="true" class="ms-2 size-4 shrink-0 text-muted-foreground" />
|
|
@@ -298,8 +297,22 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
298
297
|
)
|
|
299
298
|
}
|
|
300
299
|
return (
|
|
301
|
-
<
|
|
302
|
-
<
|
|
300
|
+
<section class="flex items-center gap-3 px-4 py-4" data-font-settings-row={row.axis}>
|
|
301
|
+
<span
|
|
302
|
+
class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
|
|
303
|
+
aria-hidden="true"
|
|
304
|
+
>
|
|
305
|
+
<Icon />
|
|
306
|
+
</span>
|
|
307
|
+
{/* One line, always: the copy truncates rather than wrapping the
|
|
308
|
+
controls to a second line, so the family menu, the size field
|
|
309
|
+
and the title/subtitle stay aligned. The compact widths keep
|
|
310
|
+
that true at the appearance sheet's own width. */}
|
|
311
|
+
<div class="min-w-0 flex-1">
|
|
312
|
+
<h3 class="text-sm font-medium">{row.label}</h3>
|
|
313
|
+
<div class="mt-0.5 truncate text-xs text-muted-foreground">{row.description}</div>
|
|
314
|
+
</div>
|
|
315
|
+
<div class="flex shrink-0 items-center gap-2">
|
|
303
316
|
<FontFamilyMenu
|
|
304
317
|
label={row.label}
|
|
305
318
|
family={value().family}
|
|
@@ -307,7 +320,7 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
307
320
|
disabled={props.disabled}
|
|
308
321
|
onSelect={(family) => updateAxis(row.axis, { family })}
|
|
309
322
|
/>
|
|
310
|
-
<div class="flex
|
|
323
|
+
<div class="flex items-center gap-1">
|
|
311
324
|
<InputControl
|
|
312
325
|
type="number"
|
|
313
326
|
min={APPEARANCE_EDITOR_FONT_SIZE_MIN}
|
|
@@ -318,7 +331,7 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
318
331
|
aria-label={`${row.label} font size in pixels`}
|
|
319
332
|
aria-describedby={sizeHintId}
|
|
320
333
|
aria-invalid={sizeIsInvalid()}
|
|
321
|
-
class="w-
|
|
334
|
+
class="w-12"
|
|
322
335
|
onInput={(event) =>
|
|
323
336
|
setSizeDrafts((current) => ({
|
|
324
337
|
...current,
|
|
@@ -341,7 +354,7 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
341
354
|
{APPEARANCE_EDITOR_FONT_SIZE_MAX} pixels.
|
|
342
355
|
</span>
|
|
343
356
|
</div>
|
|
344
|
-
</
|
|
357
|
+
</section>
|
|
345
358
|
)
|
|
346
359
|
}}
|
|
347
360
|
</For>
|
|
@@ -118,7 +118,6 @@ export function AppearancePanel(props: AppearancePanelProps) {
|
|
|
118
118
|
>
|
|
119
119
|
<AccentSwatchGroups
|
|
120
120
|
accentOptions={accentPresets}
|
|
121
|
-
themeAccentOptions={themeAccents()}
|
|
122
121
|
resolvedAppearance={resolvedAppearance()}
|
|
123
122
|
themeDefaultColor="var(--primary)"
|
|
124
123
|
/>
|