@adea-ai/ui 0.61.0 → 0.62.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/README.md +44 -6
- package/dist/LICENSE +201 -0
- package/dist/NOTICE +50 -0
- package/dist/components/composites/account-menu/index.js +2 -0
- package/dist/components/composites/list-row/index.js +2 -0
- package/dist/components/composites/settings/index.js +2 -0
- package/dist/components/composites/stat/index.js +2 -0
- package/dist/components/composites/update-dialog/index.js +2 -0
- package/dist/components/composites/workspace-mark/index.js +2 -0
- package/dist/components/conversation/index.js +6 -0
- package/dist/components/layout/app-shell/index.js +2 -0
- package/dist/components/layout/page/index.js +2 -0
- package/dist/components/layout/panel/index.js +2 -0
- package/dist/components/layout/side-rail/index.js +3 -0
- package/dist/components/layout/sidebar-nav/index.js +2 -0
- package/dist/components/layout/status-bar/index.js +2 -0
- package/dist/components/layout/top-bar/index.js +2 -0
- package/dist/components/motion/index.js +2 -2
- package/dist/components/theme/index.js +5 -0
- package/dist/components/ui/accordion/index.js +2 -0
- package/dist/components/ui/alert/index.js +2 -0
- package/dist/components/ui/alert-dialog/index.js +2 -0
- package/dist/components/ui/aspect-ratio/index.js +2 -0
- package/dist/components/ui/avatar/index.js +2 -0
- package/dist/components/ui/badge/index.js +2 -0
- package/dist/components/ui/board/index.js +2 -0
- package/dist/components/ui/breadcrumb/index.js +2 -0
- package/dist/components/ui/button/index.js +2 -0
- package/dist/components/ui/button-group/index.js +2 -0
- package/dist/components/ui/calendar/index.js +2 -0
- package/dist/components/ui/card/index.js +2 -0
- package/dist/components/ui/carousel/index.js +2 -0
- package/dist/components/ui/chart/index.js +2 -0
- package/dist/components/ui/checkbox/index.js +2 -0
- package/dist/components/ui/code-block/index.js +2 -0
- package/dist/components/ui/collapsible/index.js +2 -0
- package/dist/components/ui/combobox/index.js +2 -0
- package/dist/components/ui/command/index.js +2 -0
- package/dist/components/ui/context-menu/index.js +2 -0
- package/dist/components/ui/detail-panel/index.js +2 -0
- package/dist/components/ui/dialog/index.js +2 -0
- package/dist/components/ui/diff-block/index.js +2 -0
- package/dist/components/ui/drawer/index.js +2 -0
- package/dist/components/ui/dropdown-menu/index.js +2 -0
- package/dist/components/ui/empty/index.js +2 -0
- package/dist/components/ui/entity-icon/index.js +2 -0
- package/dist/components/ui/field/index.js +2 -0
- package/dist/components/ui/hover-card/index.js +2 -0
- package/dist/components/ui/input/index.js +2 -0
- package/dist/components/ui/input-group/index.js +2 -0
- package/dist/components/ui/input-otp/index.js +2 -0
- package/dist/components/ui/item/index.js +2 -0
- package/dist/components/ui/kbd/index.js +2 -0
- package/dist/components/ui/label/index.js +2 -0
- package/dist/components/ui/menubar/index.js +2 -0
- package/dist/components/ui/modal-dialog/index.js +2 -0
- package/dist/components/ui/navigation-menu/index.js +2 -0
- package/dist/components/ui/pagination/index.js +2 -0
- package/dist/components/ui/popover/index.js +2 -0
- package/dist/components/ui/progress/index.js +2 -0
- package/dist/components/ui/radio-group/index.js +2 -0
- package/dist/components/ui/resizable/index.js +2 -0
- package/dist/components/ui/scroll-area/index.js +2 -0
- package/dist/components/ui/select/index.js +2 -0
- package/dist/components/ui/separator/index.js +2 -0
- package/dist/components/ui/sheet/index.js +2 -0
- package/dist/components/ui/skeleton/index.js +2 -0
- package/dist/components/ui/slider/index.js +2 -0
- package/dist/components/ui/spinner/index.js +2 -0
- package/dist/components/ui/status-chip/index.js +2 -0
- package/dist/components/ui/switch/index.js +2 -0
- package/dist/components/ui/table/index.js +2 -0
- package/dist/components/ui/tabs/index.js +2 -0
- package/dist/components/ui/textarea/index.js +2 -0
- package/dist/components/ui/toast/index.js +2 -0
- package/dist/components/ui/toggle/index.js +2 -0
- package/dist/components/ui/toggle-group/index.js +2 -0
- package/dist/components/ui/tooltip/index.js +2 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/r/accordion.json +3 -1
- package/dist/r/account-menu.json +2 -1
- package/dist/r/alert-dialog.json +3 -1
- package/dist/r/alert.json +3 -1
- package/dist/r/app-shell.json +3 -1
- package/dist/r/aspect-ratio.json +3 -1
- package/dist/r/avatar.json +3 -1
- package/dist/r/badge.json +3 -1
- package/dist/r/board.json +3 -1
- package/dist/r/breadcrumb.json +3 -1
- package/dist/r/button-group.json +2 -1
- package/dist/r/button.json +3 -1
- package/dist/r/calendar.json +2 -1
- package/dist/r/card.json +3 -1
- package/dist/r/carousel.json +2 -1
- package/dist/r/chart.json +3 -1
- package/dist/r/checkbox.json +3 -1
- package/dist/r/code-block.json +2 -1
- package/dist/r/collapsible.json +3 -1
- package/dist/r/combobox.json +3 -1
- package/dist/r/command.json +3 -1
- package/dist/r/context-menu.json +3 -1
- package/dist/r/conversation.json +2 -1
- package/dist/r/detail-panel.json +2 -1
- package/dist/r/dialog.json +3 -1
- package/dist/r/diff-block.json +3 -1
- package/dist/r/drawer.json +3 -1
- package/dist/r/dropdown-menu.json +3 -1
- package/dist/r/empty.json +3 -1
- package/dist/r/entity-icon.json +3 -1
- package/dist/r/field.json +3 -1
- package/dist/r/hover-card.json +3 -1
- package/dist/r/input-group.json +3 -1
- package/dist/r/input-otp.json +3 -1
- package/dist/r/input.json +3 -1
- package/dist/r/item.json +3 -1
- package/dist/r/kbd.json +3 -1
- package/dist/r/label.json +3 -1
- package/dist/r/lib.json +50 -0
- package/dist/r/list-row.json +3 -1
- package/dist/r/menubar.json +3 -1
- package/dist/r/modal-dialog.json +2 -1
- package/dist/r/motion.json +22 -0
- package/dist/r/navigation-menu.json +3 -1
- package/dist/r/page.json +3 -1
- package/dist/r/pagination.json +3 -1
- package/dist/r/panel.json +3 -1
- package/dist/r/popover.json +3 -1
- package/dist/r/progress.json +3 -1
- package/dist/r/radio-group.json +3 -1
- package/dist/r/registry.json +320 -73
- package/dist/r/resizable.json +3 -1
- package/dist/r/scroll-area.json +3 -1
- package/dist/r/select.json +3 -1
- package/dist/r/separator.json +3 -1
- package/dist/r/settings.json +3 -1
- package/dist/r/sheet.json +2 -1
- package/dist/r/side-rail.json +3 -1
- package/dist/r/sidebar-nav.json +3 -1
- package/dist/r/skeleton.json +3 -1
- package/dist/r/slider.json +3 -1
- package/dist/r/spinner.json +3 -1
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +150 -0
- package/dist/r/src/components/composites/account-menu/index.ts +1 -0
- package/dist/r/src/components/composites/list-row/index.ts +1 -0
- package/dist/r/src/components/composites/list-row/list-row.tsx +116 -0
- package/dist/r/src/components/composites/settings/index.ts +1 -0
- package/dist/r/src/components/composites/settings/settings.tsx +142 -0
- package/dist/r/src/components/composites/stat/index.ts +9 -0
- package/dist/r/src/components/composites/stat/stat.tsx +155 -0
- package/dist/r/src/components/composites/update-dialog/index.ts +7 -0
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +529 -0
- package/dist/r/src/components/composites/workspace-mark/index.ts +1 -0
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +72 -0
- package/dist/r/src/components/conversation/conversation-avatar.tsx +60 -0
- package/dist/r/src/components/conversation/conversation-surface.tsx +107 -0
- package/dist/r/src/components/conversation/index.ts +25 -0
- package/dist/r/src/components/conversation/message-composer.tsx +239 -0
- package/dist/r/src/components/conversation/message-row.tsx +387 -0
- package/dist/r/src/components/conversation/thread-panel.tsx +141 -0
- package/dist/r/src/components/layout/app-shell/app-shell.tsx +92 -0
- package/dist/r/src/components/layout/app-shell/index.ts +1 -0
- package/dist/r/src/components/layout/page/index.ts +9 -0
- package/dist/r/src/components/layout/page/page.tsx +122 -0
- package/dist/r/src/components/layout/panel/index.ts +12 -0
- package/dist/r/src/components/layout/panel/panel.tsx +166 -0
- package/dist/r/src/components/layout/side-rail/index.ts +12 -0
- package/dist/r/src/components/layout/side-rail/side-rail-context.ts +42 -0
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +405 -0
- package/dist/r/src/components/layout/sidebar-nav/index.ts +14 -0
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +244 -0
- package/dist/r/src/components/layout/status-bar/index.ts +1 -0
- package/dist/r/src/components/layout/status-bar/status-bar.tsx +73 -0
- package/dist/r/src/components/layout/top-bar/index.ts +10 -0
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +166 -0
- package/dist/r/src/components/motion/index.ts +2 -0
- package/dist/r/src/components/motion/presence.tsx +32 -0
- package/dist/r/src/components/theme/appearance-panel.tsx +179 -0
- package/dist/r/src/components/theme/index.ts +22 -0
- package/dist/r/src/components/theme/theme-picker.tsx +174 -0
- package/dist/r/src/components/theme/theme-provider.tsx +309 -0
- package/dist/r/src/components/theme/theme-toggle.tsx +64 -0
- package/dist/r/src/components/ui/accordion/accordion.tsx +66 -0
- package/dist/r/src/components/ui/accordion/index.ts +1 -0
- package/dist/r/src/components/ui/alert/alert.tsx +95 -0
- package/dist/r/src/components/ui/alert/index.ts +1 -0
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +176 -0
- package/dist/r/src/components/ui/alert-dialog/index.ts +13 -0
- package/dist/r/src/components/ui/aspect-ratio/aspect-ratio.tsx +38 -0
- package/dist/r/src/components/ui/aspect-ratio/index.ts +1 -0
- package/dist/r/src/components/ui/avatar/avatar.tsx +114 -0
- package/dist/r/src/components/ui/avatar/index.ts +9 -0
- package/dist/r/src/components/ui/badge/badge.tsx +59 -0
- package/dist/r/src/components/ui/badge/index.ts +1 -0
- package/dist/r/src/components/ui/board/board.tsx +254 -0
- package/dist/r/src/components/ui/board/index.ts +10 -0
- package/dist/r/src/components/ui/breadcrumb/breadcrumb.tsx +117 -0
- package/dist/r/src/components/ui/breadcrumb/index.ts +9 -0
- package/dist/r/src/components/ui/button/button.tsx +89 -0
- package/dist/r/src/components/ui/button/index.ts +1 -0
- package/dist/r/src/components/ui/button-group/button-group.tsx +92 -0
- package/dist/r/src/components/ui/button-group/index.ts +6 -0
- package/dist/r/src/components/ui/calendar/calendar.tsx +277 -0
- package/dist/r/src/components/ui/calendar/index.ts +1 -0
- package/dist/r/src/components/ui/card/card.tsx +82 -0
- package/dist/r/src/components/ui/card/index.ts +10 -0
- package/dist/r/src/components/ui/carousel/carousel.tsx +209 -0
- package/dist/r/src/components/ui/carousel/index.ts +1 -0
- package/dist/r/src/components/ui/chart/chart.tsx +413 -0
- package/dist/r/src/components/ui/chart/index.ts +17 -0
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +99 -0
- package/dist/r/src/components/ui/checkbox/index.ts +1 -0
- package/dist/r/src/components/ui/code-block/code-block.tsx +238 -0
- package/dist/r/src/components/ui/code-block/index.ts +1 -0
- package/dist/r/src/components/ui/collapsible/collapsible.tsx +54 -0
- package/dist/r/src/components/ui/collapsible/index.ts +1 -0
- package/dist/r/src/components/ui/combobox/combobox.tsx +142 -0
- package/dist/r/src/components/ui/combobox/index.ts +10 -0
- package/dist/r/src/components/ui/command/command.tsx +214 -0
- package/dist/r/src/components/ui/command/index.ts +12 -0
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +163 -0
- package/dist/r/src/components/ui/context-menu/index.ts +15 -0
- package/dist/r/src/components/ui/detail-panel/detail-panel.tsx +161 -0
- package/dist/r/src/components/ui/detail-panel/index.ts +9 -0
- package/dist/r/src/components/ui/dialog/dialog.tsx +138 -0
- package/dist/r/src/components/ui/dialog/index.ts +14 -0
- package/dist/r/src/components/ui/diff-block/diff-block.tsx +286 -0
- package/dist/r/src/components/ui/diff-block/index.ts +11 -0
- package/dist/r/src/components/ui/drawer/drawer.tsx +144 -0
- package/dist/r/src/components/ui/drawer/index.ts +13 -0
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +203 -0
- package/dist/r/src/components/ui/dropdown-menu/index.ts +18 -0
- package/dist/r/src/components/ui/empty/empty.tsx +104 -0
- package/dist/r/src/components/ui/empty/index.ts +10 -0
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +154 -0
- package/dist/r/src/components/ui/entity-icon/index.ts +1 -0
- package/dist/r/src/components/ui/field/field.tsx +131 -0
- package/dist/r/src/components/ui/field/index.ts +11 -0
- package/dist/r/src/components/ui/hover-card/hover-card.tsx +48 -0
- package/dist/r/src/components/ui/hover-card/index.ts +1 -0
- package/dist/r/src/components/ui/input/index.ts +1 -0
- package/dist/r/src/components/ui/input/input.tsx +41 -0
- package/dist/r/src/components/ui/input-group/index.ts +8 -0
- package/dist/r/src/components/ui/input-group/input-group.tsx +111 -0
- package/dist/r/src/components/ui/input-otp/index.ts +1 -0
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +108 -0
- package/dist/r/src/components/ui/item/index.ts +10 -0
- package/dist/r/src/components/ui/item/item.tsx +146 -0
- package/dist/r/src/components/ui/kbd/index.ts +1 -0
- package/dist/r/src/components/ui/kbd/kbd.tsx +42 -0
- package/dist/r/src/components/ui/label/index.ts +1 -0
- package/dist/r/src/components/ui/label/label.tsx +36 -0
- package/dist/r/src/components/ui/menubar/index.ts +16 -0
- package/dist/r/src/components/ui/menubar/menubar.tsx +190 -0
- package/dist/r/src/components/ui/modal-dialog/index.ts +1 -0
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +95 -0
- package/dist/r/src/components/ui/navigation-menu/index.ts +13 -0
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +229 -0
- package/dist/r/src/components/ui/pagination/index.ts +8 -0
- package/dist/r/src/components/ui/pagination/pagination.tsx +144 -0
- package/dist/r/src/components/ui/popover/index.ts +10 -0
- package/dist/r/src/components/ui/popover/popover.tsx +81 -0
- package/dist/r/src/components/ui/progress/index.ts +1 -0
- package/dist/r/src/components/ui/progress/progress.tsx +67 -0
- package/dist/r/src/components/ui/radio-group/index.ts +1 -0
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +78 -0
- package/dist/r/src/components/ui/resizable/index.ts +6 -0
- package/dist/r/src/components/ui/resizable/resizable.tsx +74 -0
- package/dist/r/src/components/ui/scroll-area/index.ts +1 -0
- package/dist/r/src/components/ui/scroll-area/scroll-area.tsx +66 -0
- package/dist/r/src/components/ui/select/index.ts +11 -0
- package/dist/r/src/components/ui/select/select.tsx +188 -0
- package/dist/r/src/components/ui/separator/index.ts +1 -0
- package/dist/r/src/components/ui/separator/separator.tsx +40 -0
- package/dist/r/src/components/ui/sheet/index.ts +13 -0
- package/dist/r/src/components/ui/sheet/sheet.tsx +132 -0
- package/dist/r/src/components/ui/skeleton/index.ts +1 -0
- package/dist/r/src/components/ui/skeleton/skeleton.tsx +28 -0
- package/dist/r/src/components/ui/slider/index.ts +1 -0
- package/dist/r/src/components/ui/slider/slider.tsx +81 -0
- package/dist/r/src/components/ui/spinner/index.ts +1 -0
- package/dist/r/src/components/ui/spinner/spinner.tsx +58 -0
- package/dist/r/src/components/ui/status-chip/index.ts +8 -0
- package/dist/r/src/components/ui/status-chip/status-chip.tsx +142 -0
- package/dist/r/src/components/ui/switch/index.ts +1 -0
- package/dist/r/src/components/ui/switch/switch.tsx +100 -0
- package/dist/r/src/components/ui/table/index.ts +11 -0
- package/dist/r/src/components/ui/table/table.tsx +125 -0
- package/dist/r/src/components/ui/tabs/index.ts +8 -0
- package/dist/r/src/components/ui/tabs/tabs.tsx +77 -0
- package/dist/r/src/components/ui/textarea/index.ts +1 -0
- package/dist/r/src/components/ui/textarea/textarea.tsx +36 -0
- package/dist/r/src/components/ui/toast/index.ts +1 -0
- package/dist/r/src/components/ui/toast/toast.tsx +220 -0
- package/dist/r/src/components/ui/toggle/index.ts +1 -0
- package/dist/r/src/components/ui/toggle/toggle.tsx +60 -0
- package/dist/r/src/components/ui/toggle-group/index.ts +6 -0
- package/dist/r/src/components/ui/toggle-group/toggle-group.tsx +66 -0
- package/dist/r/src/components/ui/tooltip/index.ts +9 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +102 -0
- package/dist/r/src/lib/keyed-rows.ts +68 -0
- package/dist/r/src/lib/overlay.ts +70 -0
- package/dist/r/src/lib/themes.ts +490 -0
- package/dist/r/src/lib/tokens.ts +688 -0
- package/dist/r/src/lib/utils.ts +76 -0
- package/dist/r/src/lib/variants.ts +62 -0
- package/dist/r/src/lib/version-notes.ts +65 -0
- package/dist/r/src/styles/base.css +644 -0
- package/dist/r/src/styles/fonts.css +26 -0
- package/dist/r/src/styles/globals.css +18 -0
- package/dist/r/src/styles/theme.css +864 -0
- package/dist/r/stat.json +3 -1
- package/dist/r/status-bar.json +3 -1
- package/dist/r/status-chip.json +2 -1
- package/dist/r/switch.json +3 -1
- package/dist/r/table.json +3 -1
- package/dist/r/tabs.json +3 -1
- package/dist/r/textarea.json +3 -1
- package/dist/r/theming.json +42 -0
- package/dist/r/toast.json +3 -1
- package/dist/r/toggle-group.json +2 -1
- package/dist/r/toggle.json +3 -1
- package/dist/r/tooltip.json +3 -1
- package/dist/r/top-bar.json +3 -1
- package/dist/r/update-dialog.json +2 -1
- package/dist/r/workspace-mark.json +2 -1
- package/package.json +10 -9
- package/registry.json +320 -73
- package/src/index.ts +2 -4
- package/dist/components/ui/diff-block/diff-block.test.d.ts +0 -2
- package/dist/components/ui/diff-block/diff-block.test.d.ts.map +0 -1
- package/dist/lib/keyed-rows.test.d.ts +0 -2
- package/dist/lib/keyed-rows.test.d.ts.map +0 -1
package/dist/r/resizable.json
CHANGED
package/dist/r/scroll-area.json
CHANGED
package/dist/r/select.json
CHANGED
package/dist/r/separator.json
CHANGED
package/dist/r/settings.json
CHANGED
package/dist/r/sheet.json
CHANGED
package/dist/r/side-rail.json
CHANGED
package/dist/r/sidebar-nav.json
CHANGED
package/dist/r/skeleton.json
CHANGED
package/dist/r/slider.json
CHANGED
package/dist/r/spinner.json
CHANGED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CircleHelp,
|
|
3
|
+
Info,
|
|
4
|
+
LogIn,
|
|
5
|
+
LogOut,
|
|
6
|
+
Megaphone,
|
|
7
|
+
RefreshCw,
|
|
8
|
+
Settings2,
|
|
9
|
+
Smartphone,
|
|
10
|
+
UserRound,
|
|
11
|
+
} from 'lucide-solid'
|
|
12
|
+
import type { JSX } from 'solid-js'
|
|
13
|
+
import { For, Show, splitProps } from 'solid-js'
|
|
14
|
+
import { cn } from '../../../lib/utils'
|
|
15
|
+
import { Button } from '../../ui/button/button'
|
|
16
|
+
import {
|
|
17
|
+
DropdownMenu,
|
|
18
|
+
DropdownMenuContent,
|
|
19
|
+
DropdownMenuGroup,
|
|
20
|
+
DropdownMenuItem,
|
|
21
|
+
DropdownMenuSeparator,
|
|
22
|
+
DropdownMenuTrigger,
|
|
23
|
+
} from '../../ui/dropdown-menu/dropdown-menu'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* AccountMenu.
|
|
27
|
+
*
|
|
28
|
+
* The trailing control in a rail or a top bar: the account, the way into settings,
|
|
29
|
+
* and the way out. Every desktop application has one and they are all the same menu,
|
|
30
|
+
* which is why it belongs here rather than being redrawn per app.
|
|
31
|
+
*
|
|
32
|
+
* ## The items are the caller's
|
|
33
|
+
*
|
|
34
|
+
* The menu takes a list rather than hard-coding one. An application adds and removes
|
|
35
|
+
* entries — a mobile hand-off that only makes sense on desktop, a feedback link that
|
|
36
|
+
* only exists once there is somewhere to send it — and a component that decided the
|
|
37
|
+
* list could not be used by two products.
|
|
38
|
+
*
|
|
39
|
+
* `disabled` on an item is deliberately visible rather than hidden: a greyed "Help
|
|
40
|
+
* Center" says the destination is coming, while an absent one says it does not exist.
|
|
41
|
+
*/
|
|
42
|
+
export type AccountMenuItem = {
|
|
43
|
+
id: string
|
|
44
|
+
label: string
|
|
45
|
+
icon?: JSX.Element
|
|
46
|
+
/** A chord drawn at the trailing edge, e.g. `⌘,`. */
|
|
47
|
+
shortcut?: string
|
|
48
|
+
disabled?: boolean
|
|
49
|
+
/** Render only on this platform. Omit to always render. */
|
|
50
|
+
platform?: 'desktop' | 'web'
|
|
51
|
+
onSelect?: () => void
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type AccountMenuProps = {
|
|
55
|
+
class?: string
|
|
56
|
+
/** The entries above the separator. */
|
|
57
|
+
items: readonly AccountMenuItem[]
|
|
58
|
+
/** Which platform this is rendered on, for items that declare one. */
|
|
59
|
+
platform?: 'desktop' | 'web'
|
|
60
|
+
/** Whether a session exists. Decides the sign-in/sign-out row. */
|
|
61
|
+
authenticated: boolean
|
|
62
|
+
/** Disable the session row while a sign-in or sign-out is in flight. */
|
|
63
|
+
busy?: boolean
|
|
64
|
+
/** The name shown on the trigger's accessible label. */
|
|
65
|
+
label?: string
|
|
66
|
+
onSignIn?: () => void
|
|
67
|
+
onSignOut?: () => void
|
|
68
|
+
/** Fires on hover or focus of the trigger — a chance to prefetch. */
|
|
69
|
+
onIntent?: () => void
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const FALLBACK_ICONS: Record<string, typeof Settings2> = {
|
|
73
|
+
mobile: Smartphone,
|
|
74
|
+
settings: Settings2,
|
|
75
|
+
about: Info,
|
|
76
|
+
help: CircleHelp,
|
|
77
|
+
feedback: Megaphone,
|
|
78
|
+
updates: RefreshCw,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function AccountMenu(props: AccountMenuProps) {
|
|
82
|
+
const [local, rest] = splitProps(props, [
|
|
83
|
+
'class',
|
|
84
|
+
'items',
|
|
85
|
+
'platform',
|
|
86
|
+
'authenticated',
|
|
87
|
+
'busy',
|
|
88
|
+
'label',
|
|
89
|
+
'onSignIn',
|
|
90
|
+
'onSignOut',
|
|
91
|
+
'onIntent',
|
|
92
|
+
])
|
|
93
|
+
|
|
94
|
+
const visible = () =>
|
|
95
|
+
local.items.filter((item) => !item.platform || item.platform === (local.platform ?? 'desktop'))
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<DropdownMenu modal={false}>
|
|
99
|
+
<DropdownMenuTrigger
|
|
100
|
+
as={Button}
|
|
101
|
+
variant="ghost"
|
|
102
|
+
size="icon-md"
|
|
103
|
+
class={cn('text-muted-foreground', local.class)}
|
|
104
|
+
aria-label={local.label ?? 'Account and settings'}
|
|
105
|
+
onFocus={() => local.onIntent?.()}
|
|
106
|
+
onPointerEnter={() => local.onIntent?.()}
|
|
107
|
+
{...rest}
|
|
108
|
+
>
|
|
109
|
+
<UserRound aria-hidden="true" />
|
|
110
|
+
</DropdownMenuTrigger>
|
|
111
|
+
<DropdownMenuContent side="top" align="start" class="min-w-56">
|
|
112
|
+
<DropdownMenuGroup>
|
|
113
|
+
<For each={visible()}>
|
|
114
|
+
{(item) => (
|
|
115
|
+
<DropdownMenuItem
|
|
116
|
+
disabled={item.disabled}
|
|
117
|
+
onSelect={() => item.onSelect?.()}
|
|
118
|
+
shortcut={item.shortcut}
|
|
119
|
+
>
|
|
120
|
+
{item.icon ?? renderFallbackIcon(item.id)}
|
|
121
|
+
<span>{item.label}</span>
|
|
122
|
+
</DropdownMenuItem>
|
|
123
|
+
)}
|
|
124
|
+
</For>
|
|
125
|
+
</DropdownMenuGroup>
|
|
126
|
+
<DropdownMenuSeparator />
|
|
127
|
+
<DropdownMenuGroup>
|
|
128
|
+
<DropdownMenuItem
|
|
129
|
+
disabled={local.busy}
|
|
130
|
+
onSelect={() => (local.authenticated ? local.onSignOut?.() : local.onSignIn?.())}
|
|
131
|
+
>
|
|
132
|
+
<Show when={local.authenticated} fallback={<LogIn aria-hidden="true" />}>
|
|
133
|
+
<LogOut aria-hidden="true" />
|
|
134
|
+
</Show>
|
|
135
|
+
<span>{local.authenticated ? 'Sign out' : 'Sign in'}</span>
|
|
136
|
+
</DropdownMenuItem>
|
|
137
|
+
</DropdownMenuGroup>
|
|
138
|
+
</DropdownMenuContent>
|
|
139
|
+
</DropdownMenu>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A known item id gets its conventional glyph, so a caller that only wants the
|
|
145
|
+
* standard menu does not have to import six icons to get it.
|
|
146
|
+
*/
|
|
147
|
+
function renderFallbackIcon(id: string): JSX.Element {
|
|
148
|
+
const Icon = FALLBACK_ICONS[id]
|
|
149
|
+
return Icon ? <Icon aria-hidden="true" /> : null
|
|
150
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountMenu, type AccountMenuItem, type AccountMenuProps } from './account-menu'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListGroup, ListRow, type ListRowProps } from './list-row'
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { PolymorphicProps } from '@kobalte/core/polymorphic'
|
|
2
|
+
import { Polymorphic } from '@kobalte/core/polymorphic'
|
|
3
|
+
import type { ComponentProps, JSX, ValidComponent } from 'solid-js'
|
|
4
|
+
import { Show, splitProps } from 'solid-js'
|
|
5
|
+
import { cn } from '../../../lib/utils'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ListRow.
|
|
9
|
+
*
|
|
10
|
+
* One row in a list of like things: a project, a session, a file, a person. It
|
|
11
|
+
* is the highest-frequency component in an application of this shape, and the
|
|
12
|
+
* one where a half-pixel of drift is most visible — twenty rows of a sidebar
|
|
13
|
+
* make any inconsistency in height or padding obvious.
|
|
14
|
+
*
|
|
15
|
+
* The structure is fixed at four slots — `leading`, `children`, `meta`,
|
|
16
|
+
* `trailing` — so rows that show an avatar, an icon, a status dot, a timestamp
|
|
17
|
+
* and an overflow menu all sit at the same height without the caller doing
|
|
18
|
+
* arithmetic.
|
|
19
|
+
*
|
|
20
|
+
* A row is only interactive when it is given an `as` that can be activated
|
|
21
|
+
* (an anchor, a button) or an `onClick`. Without either it renders as a
|
|
22
|
+
* `div` with no hover treatment, because a hover state on something that does
|
|
23
|
+
* nothing is a lie.
|
|
24
|
+
*/
|
|
25
|
+
export type ListRowProps<T extends ValidComponent = 'div'> = PolymorphicProps<
|
|
26
|
+
T,
|
|
27
|
+
{
|
|
28
|
+
class?: string
|
|
29
|
+
/** Marks the row as current. Sets `aria-current` for a link row. */
|
|
30
|
+
selected?: boolean
|
|
31
|
+
/** Draw the row at the compact height. */
|
|
32
|
+
dense?: boolean
|
|
33
|
+
/** Leading slot: an avatar, an icon, a checkbox. */
|
|
34
|
+
leading?: JSX.Element
|
|
35
|
+
/** Trailing slot: a count, a menu trigger, a timestamp. */
|
|
36
|
+
trailing?: JSX.Element
|
|
37
|
+
/** A dimmed second line under the main content. */
|
|
38
|
+
description?: string
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
export function ListRow<T extends ValidComponent = 'div'>(props: ListRowProps<T>) {
|
|
43
|
+
const [local, rest] = splitProps(props as ListRowProps, [
|
|
44
|
+
'class',
|
|
45
|
+
'selected',
|
|
46
|
+
'dense',
|
|
47
|
+
'leading',
|
|
48
|
+
'trailing',
|
|
49
|
+
'description',
|
|
50
|
+
'children',
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Polymorphic
|
|
55
|
+
as="div"
|
|
56
|
+
aria-current={local.selected ? 'true' : undefined}
|
|
57
|
+
data-selected={local.selected ? '' : undefined}
|
|
58
|
+
class={cn(
|
|
59
|
+
'group/row flex min-w-0 items-center gap-2.5 rounded-md px-2 text-sm',
|
|
60
|
+
'transition-colors ease-out outline-none',
|
|
61
|
+
'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',
|
|
62
|
+
{ 'h-row-sm': local.dense, 'h-row-md': !local.dense },
|
|
63
|
+
{
|
|
64
|
+
'bg-primary-subtle text-foreground': local.selected,
|
|
65
|
+
'hover:bg-surface-hover': !local.selected,
|
|
66
|
+
},
|
|
67
|
+
local.class
|
|
68
|
+
)}
|
|
69
|
+
{...(rest as ComponentProps<'div'>)}
|
|
70
|
+
>
|
|
71
|
+
<Show when={local.leading}>
|
|
72
|
+
<span class="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4">
|
|
73
|
+
{local.leading}
|
|
74
|
+
</span>
|
|
75
|
+
</Show>
|
|
76
|
+
<span class="flex min-w-0 flex-1 flex-col">
|
|
77
|
+
<span class="truncate">{local.children}</span>
|
|
78
|
+
<Show when={local.description}>
|
|
79
|
+
<span class="text-muted-foreground truncate text-xs">{local.description}</span>
|
|
80
|
+
</Show>
|
|
81
|
+
</span>
|
|
82
|
+
<Show when={local.trailing}>
|
|
83
|
+
<span class="ms-auto flex shrink-0 items-center gap-1 text-muted-foreground">
|
|
84
|
+
{local.trailing}
|
|
85
|
+
</span>
|
|
86
|
+
</Show>
|
|
87
|
+
</Polymorphic>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A group of rows with an optional heading and a scrolling body. The heading is
|
|
93
|
+
* a plain label rather than a control: grouping is for reading, and a
|
|
94
|
+
* disclosure on a list of five rows costs more attention than it saves.
|
|
95
|
+
*/
|
|
96
|
+
export function ListGroup(props: ComponentProps<'div'> & { label?: string; action?: JSX.Element }) {
|
|
97
|
+
const [local, rest] = splitProps(props, ['class', 'label', 'action', 'children'])
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div data-slot="list-group" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>
|
|
101
|
+
<Show when={local.label}>
|
|
102
|
+
<div class="group/list-header flex items-center gap-1 px-2 py-1">
|
|
103
|
+
<span class="min-w-0 flex-1 truncate text-2xs font-medium tracking-wide text-muted-foreground uppercase">
|
|
104
|
+
{local.label}
|
|
105
|
+
</span>
|
|
106
|
+
<Show when={local.action}>
|
|
107
|
+
<span class="shrink-0 opacity-0 transition-opacity ease-out group-hover/list-header:opacity-100 focus-within:opacity-100">
|
|
108
|
+
{local.action}
|
|
109
|
+
</span>
|
|
110
|
+
</Show>
|
|
111
|
+
</div>
|
|
112
|
+
</Show>
|
|
113
|
+
<div class="flex flex-col gap-0.5">{local.children}</div>
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingsField, SettingsPage, SettingsRow, SettingsSection } from './settings'
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { ComponentProps, JSX } from 'solid-js'
|
|
2
|
+
import { Show, splitProps } from 'solid-js'
|
|
3
|
+
import { cn } from '../../../lib/utils'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SettingsSection and SettingsRow.
|
|
7
|
+
*
|
|
8
|
+
* A settings page is the most repetitive surface in any application, and the
|
|
9
|
+
* one where drift is most visible: label sizes, control widths and description
|
|
10
|
+
* placement all wander unless something fixes them.
|
|
11
|
+
*
|
|
12
|
+
* The row is a two-column layout at a fixed label width, so controls line up
|
|
13
|
+
* down the page regardless of how long the labels are. That alignment is the
|
|
14
|
+
* difference between a settings page that reads as designed and one that reads
|
|
15
|
+
* as a form.
|
|
16
|
+
*
|
|
17
|
+
* `SettingsRow` puts the control on the trailing side and the label leading;
|
|
18
|
+
* `SettingsField` stacks them for a control too wide for a row (a textarea, a
|
|
19
|
+
* list). Both share the same label and description treatment.
|
|
20
|
+
*/
|
|
21
|
+
export function SettingsSection(
|
|
22
|
+
props: ComponentProps<'section'> & {
|
|
23
|
+
title: string
|
|
24
|
+
description?: string
|
|
25
|
+
/** A control for the section as a whole, e.g. a master toggle. */
|
|
26
|
+
action?: JSX.Element
|
|
27
|
+
}
|
|
28
|
+
) {
|
|
29
|
+
const [local, rest] = splitProps(props, ['class', 'title', 'description', 'action', 'children'])
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<section
|
|
33
|
+
data-slot="settings-section"
|
|
34
|
+
class={cn('flex flex-col gap-4 px-5 py-5', local.class)}
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
<div class="flex items-start justify-between gap-4">
|
|
38
|
+
<div class="flex min-w-0 flex-col gap-0.5">
|
|
39
|
+
<h2 class="text-base font-semibold tracking-tight">{local.title}</h2>
|
|
40
|
+
<Show when={local.description}>
|
|
41
|
+
<p class="max-w-prose text-sm text-muted-foreground text-pretty">{local.description}</p>
|
|
42
|
+
</Show>
|
|
43
|
+
</div>
|
|
44
|
+
<Show when={local.action}>
|
|
45
|
+
<div class="flex shrink-0 items-center gap-2">{local.action}</div>
|
|
46
|
+
</Show>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="divide-y divide-border rounded-xl border border-border">{local.children}</div>
|
|
49
|
+
</section>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* One setting: a label and description on the leading side, a control on the
|
|
55
|
+
* trailing side.
|
|
56
|
+
*
|
|
57
|
+
* `label` is wired to the control through `aria-labelledby` when the control is
|
|
58
|
+
* not already labelled, so a caller can pass a bare `Switch` and still get an
|
|
59
|
+
* accessible name. The row does not invent an id per render — it derives one
|
|
60
|
+
* from the label, which is stable across renders and readable in a snapshot.
|
|
61
|
+
*/
|
|
62
|
+
export function SettingsRow(
|
|
63
|
+
props: ComponentProps<'div'> & {
|
|
64
|
+
label: string
|
|
65
|
+
description?: string
|
|
66
|
+
/** Render a vertical stack when the control needs the full width. */
|
|
67
|
+
orientation?: 'horizontal' | 'vertical'
|
|
68
|
+
/** Hide the divider this row would otherwise contribute. */
|
|
69
|
+
bare?: boolean
|
|
70
|
+
}
|
|
71
|
+
) {
|
|
72
|
+
const [local, rest] = splitProps(props, [
|
|
73
|
+
'class',
|
|
74
|
+
'label',
|
|
75
|
+
'description',
|
|
76
|
+
'orientation',
|
|
77
|
+
'bare',
|
|
78
|
+
'children',
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
data-slot="settings-row"
|
|
84
|
+
class={cn(
|
|
85
|
+
'flex gap-4 p-4',
|
|
86
|
+
local.orientation === 'vertical'
|
|
87
|
+
? 'flex-col'
|
|
88
|
+
: 'flex-col sm:flex-row sm:items-center sm:justify-between',
|
|
89
|
+
local.class
|
|
90
|
+
)}
|
|
91
|
+
{...rest}
|
|
92
|
+
>
|
|
93
|
+
<div class="flex min-w-0 flex-col gap-0.5">
|
|
94
|
+
<div data-slot="settings-row-label" class="text-sm font-medium">
|
|
95
|
+
{local.label}
|
|
96
|
+
</div>
|
|
97
|
+
<Show when={local.description}>
|
|
98
|
+
<p class="max-w-prose text-sm text-muted-foreground text-pretty">{local.description}</p>
|
|
99
|
+
</Show>
|
|
100
|
+
</div>
|
|
101
|
+
<div
|
|
102
|
+
data-slot="settings-row-control"
|
|
103
|
+
class={cn('shrink-0', local.orientation === 'vertical' && 'w-full')}
|
|
104
|
+
>
|
|
105
|
+
{local.children}
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A stacked label-and-control pair, for a control too wide for a row. */
|
|
112
|
+
export function SettingsField(
|
|
113
|
+
props: ComponentProps<'div'> & { label: string; description?: string; htmlFor?: string }
|
|
114
|
+
) {
|
|
115
|
+
const [local, rest] = splitProps(props, ['class', 'label', 'description', 'htmlFor', 'children'])
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div data-slot="settings-field" class={cn('flex flex-col gap-2 p-4', local.class)} {...rest}>
|
|
119
|
+
<div class="flex flex-col gap-0.5">
|
|
120
|
+
<label for={local.htmlFor} class="text-sm font-medium">
|
|
121
|
+
{local.label}
|
|
122
|
+
</label>
|
|
123
|
+
<Show when={local.description}>
|
|
124
|
+
<p class="max-w-prose text-sm text-muted-foreground text-pretty">{local.description}</p>
|
|
125
|
+
</Show>
|
|
126
|
+
</div>
|
|
127
|
+
<div>{local.children}</div>
|
|
128
|
+
</div>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** A settings page's scrolling body, with the header sticky at the top. */
|
|
133
|
+
export function SettingsPage(props: ComponentProps<'div'>) {
|
|
134
|
+
const [local, rest] = splitProps(props, ['class'])
|
|
135
|
+
return (
|
|
136
|
+
<div
|
|
137
|
+
data-slot="settings-page"
|
|
138
|
+
class={cn('flex min-h-0 flex-1 flex-col overflow-y-auto', local.class)}
|
|
139
|
+
{...rest}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|