@opencode-ai/ui 0.0.0-beta-202606251302
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/LICENSE +21 -0
- package/package.json +110 -0
- package/src/assets/audio/alert-01.aac +0 -0
- package/src/assets/audio/alert-01.mp3 +0 -0
- package/src/assets/audio/alert-02.aac +0 -0
- package/src/assets/audio/alert-02.mp3 +0 -0
- package/src/assets/audio/alert-03.aac +0 -0
- package/src/assets/audio/alert-03.mp3 +0 -0
- package/src/assets/audio/alert-04.aac +0 -0
- package/src/assets/audio/alert-04.mp3 +0 -0
- package/src/assets/audio/alert-05.aac +0 -0
- package/src/assets/audio/alert-05.mp3 +0 -0
- package/src/assets/audio/alert-06.aac +0 -0
- package/src/assets/audio/alert-06.mp3 +0 -0
- package/src/assets/audio/alert-07.aac +0 -0
- package/src/assets/audio/alert-07.mp3 +0 -0
- package/src/assets/audio/alert-08.aac +0 -0
- package/src/assets/audio/alert-08.mp3 +0 -0
- package/src/assets/audio/alert-09.aac +0 -0
- package/src/assets/audio/alert-09.mp3 +0 -0
- package/src/assets/audio/alert-10.aac +0 -0
- package/src/assets/audio/alert-10.mp3 +0 -0
- package/src/assets/audio/bip-bop-01.aac +0 -0
- package/src/assets/audio/bip-bop-01.mp3 +0 -0
- package/src/assets/audio/bip-bop-02.aac +0 -0
- package/src/assets/audio/bip-bop-02.mp3 +0 -0
- package/src/assets/audio/bip-bop-03.aac +0 -0
- package/src/assets/audio/bip-bop-03.mp3 +0 -0
- package/src/assets/audio/bip-bop-04.aac +0 -0
- package/src/assets/audio/bip-bop-04.mp3 +0 -0
- package/src/assets/audio/bip-bop-05.aac +0 -0
- package/src/assets/audio/bip-bop-05.mp3 +0 -0
- package/src/assets/audio/bip-bop-06.aac +0 -0
- package/src/assets/audio/bip-bop-06.mp3 +0 -0
- package/src/assets/audio/bip-bop-07.aac +0 -0
- package/src/assets/audio/bip-bop-07.mp3 +0 -0
- package/src/assets/audio/bip-bop-08.aac +0 -0
- package/src/assets/audio/bip-bop-08.mp3 +0 -0
- package/src/assets/audio/bip-bop-09.aac +0 -0
- package/src/assets/audio/bip-bop-09.mp3 +0 -0
- package/src/assets/audio/bip-bop-10.aac +0 -0
- package/src/assets/audio/bip-bop-10.mp3 +0 -0
- package/src/assets/audio/nope-01.aac +0 -0
- package/src/assets/audio/nope-01.mp3 +0 -0
- package/src/assets/audio/nope-02.aac +0 -0
- package/src/assets/audio/nope-02.mp3 +0 -0
- package/src/assets/audio/nope-03.aac +0 -0
- package/src/assets/audio/nope-03.mp3 +0 -0
- package/src/assets/audio/nope-04.aac +0 -0
- package/src/assets/audio/nope-04.mp3 +0 -0
- package/src/assets/audio/nope-05.aac +0 -0
- package/src/assets/audio/nope-05.mp3 +0 -0
- package/src/assets/audio/nope-06.aac +0 -0
- package/src/assets/audio/nope-06.mp3 +0 -0
- package/src/assets/audio/nope-07.aac +0 -0
- package/src/assets/audio/nope-07.mp3 +0 -0
- package/src/assets/audio/nope-08.aac +0 -0
- package/src/assets/audio/nope-08.mp3 +0 -0
- package/src/assets/audio/nope-09.aac +0 -0
- package/src/assets/audio/nope-09.mp3 +0 -0
- package/src/assets/audio/nope-10.aac +0 -0
- package/src/assets/audio/nope-10.mp3 +0 -0
- package/src/assets/audio/nope-11.aac +0 -0
- package/src/assets/audio/nope-11.mp3 +0 -0
- package/src/assets/audio/nope-12.aac +0 -0
- package/src/assets/audio/nope-12.mp3 +0 -0
- package/src/assets/audio/staplebops-01.aac +0 -0
- package/src/assets/audio/staplebops-01.mp3 +0 -0
- package/src/assets/audio/staplebops-02.aac +0 -0
- package/src/assets/audio/staplebops-02.mp3 +0 -0
- package/src/assets/audio/staplebops-03.aac +0 -0
- package/src/assets/audio/staplebops-03.mp3 +0 -0
- package/src/assets/audio/staplebops-04.aac +0 -0
- package/src/assets/audio/staplebops-04.mp3 +0 -0
- package/src/assets/audio/staplebops-05.aac +0 -0
- package/src/assets/audio/staplebops-05.mp3 +0 -0
- package/src/assets/audio/staplebops-06.aac +0 -0
- package/src/assets/audio/staplebops-06.mp3 +0 -0
- package/src/assets/audio/staplebops-07.aac +0 -0
- package/src/assets/audio/staplebops-07.mp3 +0 -0
- package/src/assets/audio/yup-01.aac +0 -0
- package/src/assets/audio/yup-01.mp3 +0 -0
- package/src/assets/audio/yup-02.aac +0 -0
- package/src/assets/audio/yup-02.mp3 +0 -0
- package/src/assets/audio/yup-03.aac +0 -0
- package/src/assets/audio/yup-03.mp3 +0 -0
- package/src/assets/audio/yup-04.aac +0 -0
- package/src/assets/audio/yup-04.mp3 +0 -0
- package/src/assets/audio/yup-05.aac +0 -0
- package/src/assets/audio/yup-05.mp3 +0 -0
- package/src/assets/audio/yup-06.aac +0 -0
- package/src/assets/audio/yup-06.mp3 +0 -0
- package/src/assets/fonts/Inter.ttf +0 -0
- package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/src/assets/icons/app/android-studio.svg +369 -0
- package/src/assets/icons/app/antigravity.svg +97 -0
- package/src/assets/icons/app/cursor.svg +16 -0
- package/src/assets/icons/app/file-explorer.svg +20 -0
- package/src/assets/icons/app/finder.png +0 -0
- package/src/assets/icons/app/ghostty.svg +13 -0
- package/src/assets/icons/app/iterm2.svg +13 -0
- package/src/assets/icons/app/powershell.svg +14 -0
- package/src/assets/icons/app/sublimetext.svg +17 -0
- package/src/assets/icons/app/terminal.png +0 -0
- package/src/assets/icons/app/textmate.png +0 -0
- package/src/assets/icons/app/vscode.svg +39 -0
- package/src/assets/icons/app/warp.png +0 -0
- package/src/assets/icons/app/xcode.png +0 -0
- package/src/assets/icons/app/zed-dark.svg +15 -0
- package/src/assets/icons/app/zed.svg +15 -0
- package/src/components/accordion.css +123 -0
- package/src/components/accordion.tsx +92 -0
- package/src/components/animated-number.css +75 -0
- package/src/components/animated-number.tsx +109 -0
- package/src/components/app-icon.css +5 -0
- package/src/components/app-icon.tsx +85 -0
- package/src/components/app-icons/sprite.svg +114 -0
- package/src/components/app-icons/types.ts +21 -0
- package/src/components/avatar.css +49 -0
- package/src/components/avatar.tsx +55 -0
- package/src/components/button.css +194 -0
- package/src/components/button.tsx +33 -0
- package/src/components/card.css +94 -0
- package/src/components/card.tsx +123 -0
- package/src/components/checkbox.css +131 -0
- package/src/components/checkbox.tsx +43 -0
- package/src/components/collapsible.css +148 -0
- package/src/components/collapsible.tsx +48 -0
- package/src/components/context-menu.css +134 -0
- package/src/components/context-menu.tsx +308 -0
- package/src/components/dialog.css +181 -0
- package/src/components/dialog.tsx +72 -0
- package/src/components/diff-changes.css +42 -0
- package/src/components/diff-changes.tsx +115 -0
- package/src/components/dock-surface.css +23 -0
- package/src/components/dock-surface.tsx +54 -0
- package/src/components/dropdown-menu.css +135 -0
- package/src/components/dropdown-menu.tsx +308 -0
- package/src/components/favicon.tsx +13 -0
- package/src/components/file-icon.css +26 -0
- package/src/components/file-icon.tsx +588 -0
- package/src/components/file-icons/sprite.svg +11707 -0
- package/src/components/file-icons/types.ts +1095 -0
- package/src/components/font.tsx +1 -0
- package/src/components/hover-card.css +61 -0
- package/src/components/hover-card.tsx +32 -0
- package/src/components/icon-button.css +181 -0
- package/src/components/icon-button.tsx +29 -0
- package/src/components/icon.css +34 -0
- package/src/components/icon.tsx +169 -0
- package/src/components/image-preview.css +63 -0
- package/src/components/image-preview.tsx +32 -0
- package/src/components/inline-input.css +17 -0
- package/src/components/inline-input.tsx +22 -0
- package/src/components/keybind.css +18 -0
- package/src/components/keybind.tsx +20 -0
- package/src/components/list.css +331 -0
- package/src/components/list.tsx +394 -0
- package/src/components/logo.css +4 -0
- package/src/components/logo.tsx +62 -0
- package/src/components/motion-spring.tsx +58 -0
- package/src/components/popover.css +98 -0
- package/src/components/popover.tsx +153 -0
- package/src/components/progress-circle.css +12 -0
- package/src/components/progress-circle.tsx +57 -0
- package/src/components/progress.css +63 -0
- package/src/components/progress.tsx +39 -0
- package/src/components/provider-icon.css +5 -0
- package/src/components/provider-icon.tsx +25 -0
- package/src/components/provider-icons/sprite.svg +1135 -0
- package/src/components/provider-icons/types.ts +105 -0
- package/src/components/radio-group.css +187 -0
- package/src/components/radio-group.tsx +83 -0
- package/src/components/resize-handle.css +58 -0
- package/src/components/resize-handle.tsx +82 -0
- package/src/components/scroll-view.css +66 -0
- package/src/components/scroll-view.tsx +250 -0
- package/src/components/select.css +202 -0
- package/src/components/select.tsx +174 -0
- package/src/components/spinner.css +6 -0
- package/src/components/spinner.tsx +52 -0
- package/src/components/sticky-accordion-header.css +6 -0
- package/src/components/sticky-accordion-header.tsx +18 -0
- package/src/components/switch.css +132 -0
- package/src/components/switch.tsx +29 -0
- package/src/components/tabs.css +635 -0
- package/src/components/tabs.tsx +125 -0
- package/src/components/tag.css +37 -0
- package/src/components/tag.tsx +22 -0
- package/src/components/text-field.css +134 -0
- package/src/components/text-field.tsx +128 -0
- package/src/components/text-reveal.css +150 -0
- package/src/components/text-reveal.tsx +143 -0
- package/src/components/text-shimmer.css +119 -0
- package/src/components/text-shimmer.tsx +62 -0
- package/src/components/text-strikethrough.css +27 -0
- package/src/components/text-strikethrough.tsx +84 -0
- package/src/components/toast.css +236 -0
- package/src/components/toast.tsx +185 -0
- package/src/components/tooltip.css +74 -0
- package/src/components/tooltip.tsx +161 -0
- package/src/components/typewriter.css +14 -0
- package/src/components/typewriter.tsx +55 -0
- package/src/context/dialog.tsx +197 -0
- package/src/context/file.tsx +10 -0
- package/src/context/helper.tsx +38 -0
- package/src/context/i18n.tsx +38 -0
- package/src/context/index.ts +4 -0
- package/src/context/marked.tsx +522 -0
- package/src/context/worker-pool.tsx +20 -0
- package/src/custom-elements.d.ts +17 -0
- package/src/hooks/create-auto-scroll.tsx +237 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-filtered-list.tsx +134 -0
- package/src/i18n/ar.ts +168 -0
- package/src/i18n/br.ts +168 -0
- package/src/i18n/bs.ts +172 -0
- package/src/i18n/da.ts +167 -0
- package/src/i18n/de.ts +173 -0
- package/src/i18n/en.ts +176 -0
- package/src/i18n/es.ts +168 -0
- package/src/i18n/fr.ts +168 -0
- package/src/i18n/ja.ts +167 -0
- package/src/i18n/ko.ts +168 -0
- package/src/i18n/no.ts +171 -0
- package/src/i18n/pl.ts +167 -0
- package/src/i18n/ru.ts +167 -0
- package/src/i18n/th.ts +169 -0
- package/src/i18n/tr.ts +174 -0
- package/src/i18n/uk.ts +167 -0
- package/src/i18n/zh.ts +171 -0
- package/src/i18n/zht.ts +171 -0
- package/src/storybook/fixtures.ts +51 -0
- package/src/storybook/scaffold.tsx +62 -0
- package/src/styles/animations.css +141 -0
- package/src/styles/base.css +404 -0
- package/src/styles/colors.css +772 -0
- package/src/styles/index.css +53 -0
- package/src/styles/tailwind/colors.css +285 -0
- package/src/styles/tailwind/index.css +78 -0
- package/src/styles/tailwind/utilities.css +131 -0
- package/src/styles/theme.css +609 -0
- package/src/styles/utilities.css +118 -0
- package/src/theme/color.ts +299 -0
- package/src/theme/context.tsx +370 -0
- package/src/theme/default-themes.ts +116 -0
- package/src/theme/index.ts +78 -0
- package/src/theme/loader.ts +112 -0
- package/src/theme/resolve.ts +540 -0
- package/src/theme/themes/amoled.json +49 -0
- package/src/theme/themes/aura.json +51 -0
- package/src/theme/themes/ayu.json +51 -0
- package/src/theme/themes/carbonfox.json +53 -0
- package/src/theme/themes/catppuccin-frappe.json +85 -0
- package/src/theme/themes/catppuccin-macchiato.json +85 -0
- package/src/theme/themes/catppuccin.json +45 -0
- package/src/theme/themes/cobalt2.json +87 -0
- package/src/theme/themes/cursor.json +91 -0
- package/src/theme/themes/dracula.json +49 -0
- package/src/theme/themes/everforest.json +89 -0
- package/src/theme/themes/flexoki.json +86 -0
- package/src/theme/themes/github.json +85 -0
- package/src/theme/themes/gruvbox.json +45 -0
- package/src/theme/themes/kanagawa.json +89 -0
- package/src/theme/themes/lucent-orng.json +87 -0
- package/src/theme/themes/material.json +87 -0
- package/src/theme/themes/matrix.json +113 -0
- package/src/theme/themes/mercury.json +86 -0
- package/src/theme/themes/monokai.json +49 -0
- package/src/theme/themes/nightowl.json +46 -0
- package/src/theme/themes/nord.json +46 -0
- package/src/theme/themes/oc-2.json +468 -0
- package/src/theme/themes/one-dark.json +89 -0
- package/src/theme/themes/onedarkpro.json +45 -0
- package/src/theme/themes/opencode.json +89 -0
- package/src/theme/themes/orng.json +87 -0
- package/src/theme/themes/osaka-jade.json +88 -0
- package/src/theme/themes/palenight.json +85 -0
- package/src/theme/themes/rosepine.json +85 -0
- package/src/theme/themes/shadesofpurple.json +51 -0
- package/src/theme/themes/solarized.json +49 -0
- package/src/theme/themes/synthwave84.json +87 -0
- package/src/theme/themes/tokyonight.json +47 -0
- package/src/theme/themes/vercel.json +90 -0
- package/src/theme/themes/vesper.json +51 -0
- package/src/theme/themes/zenburn.json +87 -0
- package/src/theme/types.ts +75 -0
- package/src/theme/v2/avatar.ts +48 -0
- package/src/theme/v2/default-primitives.ts +114 -0
- package/src/theme/v2/foreground.ts +60 -0
- package/src/theme/v2/mapping.ts +138 -0
- package/src/theme/v2/resolve.ts +153 -0
- package/src/v2/components/accordion-v2.css +139 -0
- package/src/v2/components/accordion-v2.tsx +86 -0
- package/src/v2/components/avatar-v2.css +70 -0
- package/src/v2/components/avatar-v2.tsx +59 -0
- package/src/v2/components/badge-v2.css +27 -0
- package/src/v2/components/badge-v2.tsx +20 -0
- package/src/v2/components/button-v2.css +186 -0
- package/src/v2/components/button-v2.tsx +35 -0
- package/src/v2/components/checkbox-v2.css +184 -0
- package/src/v2/components/checkbox-v2.tsx +65 -0
- package/src/v2/components/dialog-v2.css +150 -0
- package/src/v2/components/dialog-v2.tsx +93 -0
- package/src/v2/components/diff-changes-v2.css +24 -0
- package/src/v2/components/diff-changes-v2.tsx +28 -0
- package/src/v2/components/field-v2.css +94 -0
- package/src/v2/components/field-v2.tsx +265 -0
- package/src/v2/components/icon-button-v2.css +155 -0
- package/src/v2/components/icon-button-v2.tsx +37 -0
- package/src/v2/components/icon.tsx +129 -0
- package/src/v2/components/inline-input-v2.css +218 -0
- package/src/v2/components/inline-input-v2.tsx +90 -0
- package/src/v2/components/keybind-v2.css +76 -0
- package/src/v2/components/keybind-v2.tsx +30 -0
- package/src/v2/components/line-comment-v2.css +204 -0
- package/src/v2/components/line-comment-v2.tsx +155 -0
- package/src/v2/components/menu-v2.css +190 -0
- package/src/v2/components/menu-v2.tsx +225 -0
- package/src/v2/components/project-avatar-v2.css +126 -0
- package/src/v2/components/project-avatar-v2.tsx +64 -0
- package/src/v2/components/radio-v2.css +202 -0
- package/src/v2/components/radio-v2.tsx +72 -0
- package/src/v2/components/segmented-control-v2.css +80 -0
- package/src/v2/components/segmented-control-v2.tsx +208 -0
- package/src/v2/components/select-v2.css +285 -0
- package/src/v2/components/select-v2.tsx +208 -0
- package/src/v2/components/switch-v2.css +154 -0
- package/src/v2/components/switch-v2.tsx +28 -0
- package/src/v2/components/tab-state-indicator.tsx +37 -0
- package/src/v2/components/tabs-v2.css +225 -0
- package/src/v2/components/tabs-v2.tsx +147 -0
- package/src/v2/components/text-input-v2.css +145 -0
- package/src/v2/components/text-input-v2.tsx +67 -0
- package/src/v2/components/text-shimmer-v2.css +125 -0
- package/src/v2/components/text-shimmer-v2.tsx +63 -0
- package/src/v2/components/textarea-v2.css +78 -0
- package/src/v2/components/textarea-v2.tsx +31 -0
- package/src/v2/components/toast-v2.css +215 -0
- package/src/v2/components/toast-v2.tsx +144 -0
- package/src/v2/components/tooltip-v2.css +53 -0
- package/src/v2/components/tooltip-v2.tsx +146 -0
- package/src/v2/components/wordmark-v2.tsx +92 -0
- package/src/v2/styles/colors.css +172 -0
- package/src/v2/styles/tailwind.css +2 -0
- package/src/v2/styles/theme.css +441 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { DropdownMenu } from "@kobalte/core/dropdown-menu"
|
|
2
|
+
import { ContextMenu } from "@kobalte/core/context-menu"
|
|
3
|
+
import { Show, splitProps, type Component, type ComponentProps, type JSX, type ParentProps } from "solid-js"
|
|
4
|
+
import "./menu-v2.css"
|
|
5
|
+
|
|
6
|
+
const ChevronRight: Component = () => (
|
|
7
|
+
<svg
|
|
8
|
+
data-slot="menu-v2-item-chevron"
|
|
9
|
+
width="16"
|
|
10
|
+
height="16"
|
|
11
|
+
viewBox="0 0 16 16"
|
|
12
|
+
fill="none"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
<path d="M6 4L10 8L6 12V4Z" fill="currentColor" />
|
|
17
|
+
</svg>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const CheckMark: Component = () => (
|
|
21
|
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
22
|
+
<path
|
|
23
|
+
d="M3.53564 8.17857L6.39279 11.75L12.4642 4.25"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
stroke-width="1"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
function ItemBody(
|
|
33
|
+
props: ParentProps<{
|
|
34
|
+
shortcut?: JSX.Element | string
|
|
35
|
+
badge?: JSX.Element | string
|
|
36
|
+
trailing?: JSX.Element
|
|
37
|
+
}>,
|
|
38
|
+
) {
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<span data-slot="menu-v2-item-content">{props.children}</span>
|
|
42
|
+
<Show when={props.shortcut}>{(shortcut) => <span data-slot="menu-v2-item-shortcut">{shortcut()}</span>}</Show>
|
|
43
|
+
<Show when={props.badge}>{(badge) => <span data-slot="menu-v2-item-badge">{badge()}</span>}</Show>
|
|
44
|
+
{props.trailing}
|
|
45
|
+
</>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface MenuV2ItemProps extends ComponentProps<typeof DropdownMenu.Item> {
|
|
50
|
+
shortcut?: JSX.Element | string
|
|
51
|
+
badge?: JSX.Element | string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function MenuV2Item(props: ParentProps<MenuV2ItemProps>) {
|
|
55
|
+
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
56
|
+
return (
|
|
57
|
+
<DropdownMenu.Item {...r} data-component="menu-v2-item" classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}>
|
|
58
|
+
<ItemBody shortcut={s.shortcut} badge={s.badge}>
|
|
59
|
+
{s.children}
|
|
60
|
+
</ItemBody>
|
|
61
|
+
</DropdownMenu.Item>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface MenuV2CheckboxItemProps extends ComponentProps<typeof DropdownMenu.CheckboxItem> {
|
|
66
|
+
shortcut?: JSX.Element | string
|
|
67
|
+
badge?: JSX.Element | string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function MenuV2CheckboxItem(props: ParentProps<MenuV2CheckboxItemProps>) {
|
|
71
|
+
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
72
|
+
return (
|
|
73
|
+
<DropdownMenu.CheckboxItem
|
|
74
|
+
{...r}
|
|
75
|
+
data-component="menu-v2-item"
|
|
76
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
77
|
+
>
|
|
78
|
+
<ItemBody
|
|
79
|
+
shortcut={s.shortcut}
|
|
80
|
+
badge={s.badge}
|
|
81
|
+
trailing={
|
|
82
|
+
<DropdownMenu.ItemIndicator data-slot="menu-v2-item-indicator" forceMount>
|
|
83
|
+
<CheckMark />
|
|
84
|
+
</DropdownMenu.ItemIndicator>
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
{s.children}
|
|
88
|
+
</ItemBody>
|
|
89
|
+
</DropdownMenu.CheckboxItem>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface MenuV2RadioItemProps extends ComponentProps<typeof DropdownMenu.RadioItem> {
|
|
94
|
+
shortcut?: JSX.Element | string
|
|
95
|
+
badge?: JSX.Element | string
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function MenuV2RadioItem(props: ParentProps<MenuV2RadioItemProps>) {
|
|
99
|
+
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
100
|
+
return (
|
|
101
|
+
<DropdownMenu.RadioItem
|
|
102
|
+
{...r}
|
|
103
|
+
data-component="menu-v2-item"
|
|
104
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
105
|
+
>
|
|
106
|
+
<ItemBody
|
|
107
|
+
shortcut={s.shortcut}
|
|
108
|
+
badge={s.badge}
|
|
109
|
+
trailing={
|
|
110
|
+
<DropdownMenu.ItemIndicator data-slot="menu-v2-item-indicator" forceMount>
|
|
111
|
+
<CheckMark />
|
|
112
|
+
</DropdownMenu.ItemIndicator>
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
{s.children}
|
|
116
|
+
</ItemBody>
|
|
117
|
+
</DropdownMenu.RadioItem>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MenuV2SubTriggerProps extends ComponentProps<typeof DropdownMenu.SubTrigger> {
|
|
122
|
+
shortcut?: JSX.Element | string
|
|
123
|
+
badge?: JSX.Element | string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function MenuV2SubTrigger(props: ParentProps<MenuV2SubTriggerProps>) {
|
|
127
|
+
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
128
|
+
return (
|
|
129
|
+
<DropdownMenu.SubTrigger
|
|
130
|
+
{...r}
|
|
131
|
+
data-component="menu-v2-item"
|
|
132
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
133
|
+
>
|
|
134
|
+
<ItemBody shortcut={s.shortcut} badge={s.badge} trailing={<ChevronRight />}>
|
|
135
|
+
{s.children}
|
|
136
|
+
</ItemBody>
|
|
137
|
+
</DropdownMenu.SubTrigger>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function MenuV2SubContent(props: ComponentProps<typeof DropdownMenu.SubContent>) {
|
|
142
|
+
const [s, r] = splitProps(props, ["class", "classList"])
|
|
143
|
+
return (
|
|
144
|
+
<DropdownMenu.SubContent
|
|
145
|
+
{...r}
|
|
146
|
+
data-component="menu-v2-content"
|
|
147
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function MenuV2GroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>) {
|
|
153
|
+
const [s, r] = splitProps(props, ["class", "classList"])
|
|
154
|
+
return (
|
|
155
|
+
<DropdownMenu.GroupLabel
|
|
156
|
+
{...r}
|
|
157
|
+
data-slot="menu-v2-group-label"
|
|
158
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
159
|
+
/>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function MenuV2Separator(props: ComponentProps<typeof DropdownMenu.Separator>) {
|
|
164
|
+
const [s, r] = splitProps(props, ["class", "classList"])
|
|
165
|
+
return (
|
|
166
|
+
<DropdownMenu.Separator
|
|
167
|
+
{...r}
|
|
168
|
+
data-slot="menu-v2-separator"
|
|
169
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function MenuV2Content(props: ComponentProps<typeof DropdownMenu.Content>) {
|
|
175
|
+
const [s, r] = splitProps(props, ["class", "classList"])
|
|
176
|
+
return (
|
|
177
|
+
<DropdownMenu.Content
|
|
178
|
+
{...r}
|
|
179
|
+
data-component="menu-v2-content"
|
|
180
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function MenuV2Root(props: ComponentProps<typeof DropdownMenu>) {
|
|
186
|
+
return <DropdownMenu {...props} />
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function MenuV2ContextRoot(props: ComponentProps<typeof ContextMenu>) {
|
|
190
|
+
return <ContextMenu {...props} />
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function MenuV2ContextContent(props: ComponentProps<typeof ContextMenu.Content>) {
|
|
194
|
+
const [s, r] = splitProps(props, ["class", "classList"])
|
|
195
|
+
return (
|
|
196
|
+
<ContextMenu.Content
|
|
197
|
+
{...r}
|
|
198
|
+
data-component="menu-v2-content"
|
|
199
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
200
|
+
/>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const MenuV2Context = Object.assign(MenuV2ContextRoot, {
|
|
205
|
+
Trigger: ContextMenu.Trigger,
|
|
206
|
+
Portal: ContextMenu.Portal,
|
|
207
|
+
Content: MenuV2ContextContent,
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
export const MenuV2 = Object.assign(MenuV2Root, {
|
|
211
|
+
Trigger: DropdownMenu.Trigger,
|
|
212
|
+
Portal: DropdownMenu.Portal,
|
|
213
|
+
Content: MenuV2Content,
|
|
214
|
+
Item: MenuV2Item,
|
|
215
|
+
CheckboxItem: MenuV2CheckboxItem,
|
|
216
|
+
RadioGroup: DropdownMenu.RadioGroup,
|
|
217
|
+
RadioItem: MenuV2RadioItem,
|
|
218
|
+
Group: DropdownMenu.Group,
|
|
219
|
+
GroupLabel: MenuV2GroupLabel,
|
|
220
|
+
Separator: MenuV2Separator,
|
|
221
|
+
Sub: DropdownMenu.Sub,
|
|
222
|
+
SubTrigger: MenuV2SubTrigger,
|
|
223
|
+
SubContent: MenuV2SubContent,
|
|
224
|
+
Context: MenuV2Context,
|
|
225
|
+
})
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
[data-component="project-avatar-v2"] {
|
|
2
|
+
position: relative;
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
width: 16px;
|
|
5
|
+
height: 16px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-component="project-avatar-v2"][data-unread] {
|
|
9
|
+
overflow: visible;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[data-slot="project-avatar-surface"] {
|
|
13
|
+
--project-avatar-bg: var(--v2-avatar-bg-gray);
|
|
14
|
+
--project-avatar-border: var(--v2-avatar-border-gray);
|
|
15
|
+
position: relative;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
display: flex;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
background:
|
|
25
|
+
linear-gradient(180deg, var(--v2-alpha-light-16) 0%, var(--v2-alpha-light-0) 100%), var(--project-avatar-bg);
|
|
26
|
+
box-shadow: inset 0 0 0 0.5px var(--project-avatar-border);
|
|
27
|
+
font-weight: 530;
|
|
28
|
+
font-size: 11px;
|
|
29
|
+
line-height: 1;
|
|
30
|
+
letter-spacing: 0.05px;
|
|
31
|
+
font-variant-numeric: tabular-nums;
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
color: var(--v2-avatar-fg);
|
|
34
|
+
text-shadow: 0 0 4px var(--v2-alpha-dark-20);
|
|
35
|
+
user-select: none;
|
|
36
|
+
-webkit-user-select: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-slot="project-avatar-surface"][data-variant="orange"] {
|
|
40
|
+
--project-avatar-bg: var(--v2-avatar-bg-orange);
|
|
41
|
+
--project-avatar-border: var(--v2-avatar-border-orange);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-slot="project-avatar-surface"][data-variant="yellow"] {
|
|
45
|
+
--project-avatar-bg: var(--v2-avatar-bg-yellow);
|
|
46
|
+
--project-avatar-border: var(--v2-avatar-border-yellow);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-slot="project-avatar-surface"][data-variant="cyan"] {
|
|
50
|
+
--project-avatar-bg: var(--v2-avatar-bg-cyan);
|
|
51
|
+
--project-avatar-border: var(--v2-avatar-border-cyan);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-slot="project-avatar-surface"][data-variant="green"] {
|
|
55
|
+
--project-avatar-bg: var(--v2-avatar-bg-green);
|
|
56
|
+
--project-avatar-border: var(--v2-avatar-border-green);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-slot="project-avatar-surface"][data-variant="red"] {
|
|
60
|
+
--project-avatar-bg: var(--v2-avatar-bg-red);
|
|
61
|
+
--project-avatar-border: var(--v2-avatar-border-red);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[data-slot="project-avatar-surface"][data-variant="pink"] {
|
|
65
|
+
--project-avatar-bg: var(--v2-avatar-bg-pink);
|
|
66
|
+
--project-avatar-border: var(--v2-avatar-border-pink);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[data-slot="project-avatar-surface"][data-variant="blue"] {
|
|
70
|
+
--project-avatar-bg: var(--v2-avatar-bg-blue);
|
|
71
|
+
--project-avatar-border: var(--v2-avatar-border-blue);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-slot="project-avatar-surface"][data-variant="purple"] {
|
|
75
|
+
--project-avatar-bg: var(--v2-avatar-bg-purple);
|
|
76
|
+
--project-avatar-border: var(--v2-avatar-border-purple);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-slot="project-avatar-surface"][data-variant="gray"] {
|
|
80
|
+
--project-avatar-bg: var(--v2-avatar-bg-gray);
|
|
81
|
+
--project-avatar-border: var(--v2-avatar-border-gray);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[data-slot="project-avatar-surface"][data-has-image] {
|
|
85
|
+
background: var(--project-avatar-bg);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-slot="project-avatar-surface"] [data-slot="project-avatar-image"] {
|
|
89
|
+
position: relative;
|
|
90
|
+
z-index: 1;
|
|
91
|
+
display: block;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
border-radius: inherit;
|
|
95
|
+
object-fit: cover;
|
|
96
|
+
user-select: none;
|
|
97
|
+
-webkit-user-select: none;
|
|
98
|
+
-webkit-user-drag: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[data-component="project-avatar-v2"][data-unread] [data-slot="project-avatar-surface"] {
|
|
102
|
+
-webkit-mask-image: radial-gradient(circle 4.5px at calc(100% - 1px) 1px, transparent 4.5px, black 4.5px);
|
|
103
|
+
mask-image: radial-gradient(circle 4.5px at calc(100% - 1px) 1px, transparent 4.5px, black 4.5px);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[data-slot="project-avatar-unread-dot"] {
|
|
107
|
+
position: absolute;
|
|
108
|
+
z-index: 3;
|
|
109
|
+
width: 6px;
|
|
110
|
+
height: 6px;
|
|
111
|
+
right: -2px;
|
|
112
|
+
top: -2px;
|
|
113
|
+
border-radius: 9999px;
|
|
114
|
+
background: var(--v2-background-bg-accent);
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[data-slot="project-avatar-slot"] {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
width: 16px;
|
|
124
|
+
height: 16px;
|
|
125
|
+
overflow: visible;
|
|
126
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ComponentProps, splitProps, Show } from "solid-js"
|
|
2
|
+
import "./project-avatar-v2.css"
|
|
3
|
+
|
|
4
|
+
const segmenter =
|
|
5
|
+
typeof Intl !== "undefined" && "Segmenter" in Intl
|
|
6
|
+
? new Intl.Segmenter(undefined, { granularity: "grapheme" })
|
|
7
|
+
: undefined
|
|
8
|
+
|
|
9
|
+
function first(value: string) {
|
|
10
|
+
if (!value) return ""
|
|
11
|
+
if (!segmenter) return Array.from(value)[0] ?? ""
|
|
12
|
+
return segmenter.segment(value)[Symbol.iterator]().next().value?.segment ?? Array.from(value)[0] ?? ""
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PROJECT_AVATAR_VARIANTS = [
|
|
16
|
+
"orange",
|
|
17
|
+
"yellow",
|
|
18
|
+
"cyan",
|
|
19
|
+
"green",
|
|
20
|
+
"red",
|
|
21
|
+
"pink",
|
|
22
|
+
"blue",
|
|
23
|
+
"purple",
|
|
24
|
+
"gray",
|
|
25
|
+
] as const
|
|
26
|
+
|
|
27
|
+
export type ProjectAvatarVariant = (typeof PROJECT_AVATAR_VARIANTS)[number]
|
|
28
|
+
|
|
29
|
+
export interface ProjectAvatarProps extends ComponentProps<"div"> {
|
|
30
|
+
fallback: string
|
|
31
|
+
src?: string
|
|
32
|
+
variant?: ProjectAvatarVariant
|
|
33
|
+
unread?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function ProjectAvatar(props: ProjectAvatarProps) {
|
|
37
|
+
const [split, rest] = splitProps(props, ["fallback", "src", "variant", "unread", "class", "classList", "style"])
|
|
38
|
+
const src = split.src
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
{...rest}
|
|
42
|
+
data-component="project-avatar-v2"
|
|
43
|
+
data-unread={split.unread ? "" : undefined}
|
|
44
|
+
classList={{
|
|
45
|
+
...split.classList,
|
|
46
|
+
[split.class ?? ""]: !!split.class,
|
|
47
|
+
}}
|
|
48
|
+
style={typeof split.style === "object" ? split.style : undefined}
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
data-slot="project-avatar-surface"
|
|
52
|
+
data-variant={split.variant ?? "gray"}
|
|
53
|
+
data-has-image={src ? "" : undefined}
|
|
54
|
+
>
|
|
55
|
+
<Show when={src} fallback={first(split.fallback)}>
|
|
56
|
+
{(value) => <img src={value()} draggable={false} data-slot="project-avatar-image" />}
|
|
57
|
+
</Show>
|
|
58
|
+
</div>
|
|
59
|
+
<Show when={split.unread}>
|
|
60
|
+
<span data-slot="project-avatar-unread-dot" aria-hidden="true" />
|
|
61
|
+
</Show>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
[data-component="radio-v2"] {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
cursor: default;
|
|
6
|
+
|
|
7
|
+
[data-slot="radio-v2-label"] {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
user-select: none;
|
|
11
|
+
color: var(--v2-text-text-faint);
|
|
12
|
+
font-size: 11px;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 440;
|
|
15
|
+
line-height: 1;
|
|
16
|
+
letter-spacing: 0.05px;
|
|
17
|
+
font-variation-settings: "slnt" 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-slot="radio-v2-description"] {
|
|
21
|
+
color: var(--v2-text-text-faint);
|
|
22
|
+
font-size: 11px;
|
|
23
|
+
font-weight: 440;
|
|
24
|
+
line-height: 1.2;
|
|
25
|
+
letter-spacing: 0.05px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-slot="radio-v2-items"] {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[data-slot="radio-v2-error"] {
|
|
35
|
+
color: var(--v2-state-fg-danger);
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: var(--font-weight-regular);
|
|
38
|
+
line-height: var(--line-height-normal);
|
|
39
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-slot="radio-v2-error"]:empty {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-slot="radio-v2-item"] {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
padding: 0px;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
|
|
54
|
+
&:where([data-disabled]) {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[data-slot="radio-v2-item-input"] {
|
|
59
|
+
position: absolute;
|
|
60
|
+
width: 1px;
|
|
61
|
+
height: 1px;
|
|
62
|
+
padding: 0;
|
|
63
|
+
margin: -1px;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
clip: rect(0, 0, 0, 0);
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
border-width: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-slot="radio-v2-item-control-stack"] {
|
|
71
|
+
position: relative;
|
|
72
|
+
width: 16px;
|
|
73
|
+
height: 20px;
|
|
74
|
+
flex: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[data-slot="radio-v2-item-control"] {
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
position: absolute;
|
|
80
|
+
width: 16px;
|
|
81
|
+
height: 16px;
|
|
82
|
+
flex: none;
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
left: 0;
|
|
85
|
+
top: calc(50% - 16px / 2);
|
|
86
|
+
|
|
87
|
+
border-radius: 9999px;
|
|
88
|
+
border: none;
|
|
89
|
+
box-shadow: inset 0 0 0 0.5px var(--v2-border-border-strong);
|
|
90
|
+
|
|
91
|
+
background:
|
|
92
|
+
linear-gradient(180deg, var(--v2-alpha-light-6) 0%, var(--v2-alpha-light-0) 100%), var(--v2-background-bg-base);
|
|
93
|
+
transition:
|
|
94
|
+
background 170ms ease-out,
|
|
95
|
+
opacity 170ms ease-out,
|
|
96
|
+
outline-color 170ms ease-out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:where(:not([data-readonly]))
|
|
100
|
+
[data-slot="radio-v2-item-input"]:focus-visible
|
|
101
|
+
~ [data-slot="radio-v2-item-control-stack"]
|
|
102
|
+
[data-slot="radio-v2-item-control"] {
|
|
103
|
+
outline: 2px solid var(--v2-border-border-focus);
|
|
104
|
+
outline-offset: 1px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:where(:hover):where(:not([data-disabled], [data-readonly])):where(:not([data-checked]))
|
|
108
|
+
[data-slot="radio-v2-item-control"] {
|
|
109
|
+
background:
|
|
110
|
+
linear-gradient(0deg, var(--v2-overlay-simple-overlay-hover), var(--v2-overlay-simple-overlay-hover)),
|
|
111
|
+
linear-gradient(180deg, var(--v2-alpha-light-6) 0%, var(--v2-alpha-light-0) 100%), var(--v2-background-bg-base);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:where([data-disabled]) [data-slot="radio-v2-item-control"] {
|
|
115
|
+
opacity: 0.5;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:where([data-checked]) [data-slot="radio-v2-item-control"] {
|
|
119
|
+
background:
|
|
120
|
+
linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%), var(--v2-background-bg-accent);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&:where([data-checked]):where(:hover):where(:not([data-disabled], [data-readonly]))
|
|
124
|
+
[data-slot="radio-v2-item-control"] {
|
|
125
|
+
background:
|
|
126
|
+
linear-gradient(
|
|
127
|
+
0deg,
|
|
128
|
+
var(--v2-overlay-simple-overlay-contrast-hover),
|
|
129
|
+
var(--v2-overlay-simple-overlay-contrast-hover)
|
|
130
|
+
),
|
|
131
|
+
linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%), var(--v2-background-bg-accent);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&:where([data-checked][data-disabled]) [data-slot="radio-v2-item-control"] {
|
|
135
|
+
opacity: 0.5;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:where([data-invalid]):where(:not([data-checked])) [data-slot="radio-v2-item-control"] {
|
|
139
|
+
background: var(--v2-state-bg-danger);
|
|
140
|
+
box-shadow: inset 0 0 0 0.5px var(--v2-state-border-danger);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-slot="radio-v2-item-indicator"] {
|
|
144
|
+
box-sizing: border-box;
|
|
145
|
+
position: absolute;
|
|
146
|
+
width: 6px;
|
|
147
|
+
height: 6px;
|
|
148
|
+
left: calc(50% - 6px / 2);
|
|
149
|
+
top: calc(50% - 6px / 2);
|
|
150
|
+
border-radius: 9999px;
|
|
151
|
+
|
|
152
|
+
background: var(--v2-grey-300);
|
|
153
|
+
border: none;
|
|
154
|
+
box-shadow:
|
|
155
|
+
inset 0 0 0 0.5px var(--v2-overlay-gradient-depth-overlay-depth-top),
|
|
156
|
+
0px 0.5px 0.5px rgba(0, 0, 0, 0.4);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
[data-slot="radio-v2-item-text"] {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
align-items: flex-start;
|
|
164
|
+
padding: 0px;
|
|
165
|
+
gap: 6px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
[data-slot="radio-v2-item-label"] {
|
|
169
|
+
display: inline-flex;
|
|
170
|
+
user-select: none;
|
|
171
|
+
color: inherit;
|
|
172
|
+
font-style: normal;
|
|
173
|
+
font-weight: 440;
|
|
174
|
+
font-variant-numeric: tabular-nums;
|
|
175
|
+
font-variation-settings: "slnt" 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
[data-slot="radio-v2-item-label-text"] {
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
user-select: none;
|
|
182
|
+
color: var(--v2-text-text-base);
|
|
183
|
+
font-size: 13px;
|
|
184
|
+
line-height: 20px;
|
|
185
|
+
letter-spacing: -0.04px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[data-slot="radio-v2-item-description"] {
|
|
189
|
+
color: var(--v2-text-text-muted);
|
|
190
|
+
font-size: 11px;
|
|
191
|
+
font-weight: 440;
|
|
192
|
+
line-height: 1;
|
|
193
|
+
letter-spacing: 0.05px;
|
|
194
|
+
font-variant-numeric: tabular-nums;
|
|
195
|
+
user-select: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&:where([data-disabled]) [data-slot="radio-v2-item-label"],
|
|
199
|
+
&:where([data-disabled]) [data-slot="radio-v2-item-description"] {
|
|
200
|
+
opacity: 0.5;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { RadioGroup as Kobalte } from "@kobalte/core/radio-group"
|
|
2
|
+
import { Show, splitProps, type JSX } from "solid-js"
|
|
3
|
+
import type { ComponentProps, ParentProps } from "solid-js"
|
|
4
|
+
import "./radio-v2.css"
|
|
5
|
+
|
|
6
|
+
export interface RadioGroupV2Props extends ParentProps<ComponentProps<typeof Kobalte>> {
|
|
7
|
+
label?: JSX.Element
|
|
8
|
+
description?: JSX.Element
|
|
9
|
+
hideLabel?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function RadioGroupV2(props: RadioGroupV2Props) {
|
|
13
|
+
const [local, others] = splitProps(props, ["class", "classList", "children", "label", "description", "hideLabel"])
|
|
14
|
+
return (
|
|
15
|
+
<Kobalte
|
|
16
|
+
{...others}
|
|
17
|
+
data-component="radio-v2"
|
|
18
|
+
classList={{
|
|
19
|
+
...local.classList,
|
|
20
|
+
[local.class ?? ""]: !!local.class,
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<Show when={local.label}>
|
|
24
|
+
{(label) => (
|
|
25
|
+
<Kobalte.Label data-slot="radio-v2-label" classList={{ "sr-only": local.hideLabel }}>
|
|
26
|
+
{label()}
|
|
27
|
+
</Kobalte.Label>
|
|
28
|
+
)}
|
|
29
|
+
</Show>
|
|
30
|
+
<Show when={local.description}>
|
|
31
|
+
{(description) => <Kobalte.Description data-slot="radio-v2-description">{description()}</Kobalte.Description>}
|
|
32
|
+
</Show>
|
|
33
|
+
<div data-slot="radio-v2-items">{local.children}</div>
|
|
34
|
+
<Kobalte.ErrorMessage data-slot="radio-v2-error" />
|
|
35
|
+
</Kobalte>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface RadioItemV2Props extends ComponentProps<typeof Kobalte.Item> {
|
|
40
|
+
label: JSX.Element
|
|
41
|
+
description?: JSX.Element
|
|
42
|
+
hideLabel?: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function RadioItemV2(props: RadioItemV2Props) {
|
|
46
|
+
const [local, others] = splitProps(props, ["class", "classList", "label", "description", "hideLabel"])
|
|
47
|
+
return (
|
|
48
|
+
<Kobalte.Item
|
|
49
|
+
{...others}
|
|
50
|
+
data-slot="radio-v2-item"
|
|
51
|
+
classList={{
|
|
52
|
+
...local.classList,
|
|
53
|
+
[local.class ?? ""]: !!local.class,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Kobalte.ItemInput data-slot="radio-v2-item-input" />
|
|
57
|
+
<div data-slot="radio-v2-item-control-stack">
|
|
58
|
+
<Kobalte.ItemControl data-slot="radio-v2-item-control">
|
|
59
|
+
<Kobalte.ItemIndicator data-slot="radio-v2-item-indicator" />
|
|
60
|
+
</Kobalte.ItemControl>
|
|
61
|
+
</div>
|
|
62
|
+
<Kobalte.ItemLabel data-slot="radio-v2-item-label" classList={{ "sr-only": local.hideLabel }}>
|
|
63
|
+
<div data-slot="radio-v2-item-text">
|
|
64
|
+
<span data-slot="radio-v2-item-label-text">{local.label}</span>
|
|
65
|
+
<Show when={local.description}>
|
|
66
|
+
{(description) => <span data-slot="radio-v2-item-description">{description()}</span>}
|
|
67
|
+
</Show>
|
|
68
|
+
</div>
|
|
69
|
+
</Kobalte.ItemLabel>
|
|
70
|
+
</Kobalte.Item>
|
|
71
|
+
)
|
|
72
|
+
}
|