@opencode-ai/ui 0.0.0-dev-202608261632 → 0.0.0-dev-18313
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/actions/button/button.d.ts +10 -0
- package/dist/actions/icon-button/icon-button.d.ts +11 -0
- package/dist/actions/split-button/split-button.d.ts +5 -0
- package/dist/components/card.d.ts +1 -1
- package/dist/components/list.d.ts +1 -1
- package/dist/components/scroll-view.d.ts +3 -3
- package/dist/context/i18n.d.ts +10 -7
- package/dist/{components → data-display/accordion}/accordion.d.ts +6 -6
- package/dist/{v2/components/avatar-v2.d.ts → data-display/avatar/avatar.d.ts} +1 -1
- package/dist/data-display/badge/badge.d.ts +7 -0
- package/dist/{components → data-display/diff-changes}/diff-changes.d.ts +2 -1
- package/dist/data-display/keybind/keybind.d.ts +7 -0
- package/dist/{v2/components/line-comment-v2.d.ts → data-display/line-comment/line-comment.d.ts} +9 -9
- package/dist/{v2/components/project-avatar-v2.d.ts → data-display/project-avatar/project-avatar.d.ts} +1 -1
- package/dist/feedback/loader/loader.d.ts +3 -0
- package/dist/{components → feedback/progress-circle}/progress-circle.d.ts +2 -0
- package/dist/feedback/toast/toast.d.ts +57 -0
- package/dist/{components → forms/checkbox}/checkbox.d.ts +2 -2
- package/dist/{v2/components/field-v2.d.ts → forms/field/field.d.ts} +4 -10
- package/dist/forms/radio/radio.d.ts +16 -0
- package/dist/{v2/components/select-v2.d.ts → forms/select/select.d.ts} +4 -6
- package/dist/{components → forms/switch}/switch.d.ts +4 -2
- package/dist/{v2/components/text-input-v2.d.ts → forms/text-input/text-input.d.ts} +3 -3
- package/dist/forms/textarea/textarea.d.ts +7 -0
- package/dist/i18n/ar.d.ts +0 -2
- package/dist/i18n/bg.d.ts +0 -2
- package/dist/i18n/br.d.ts +0 -2
- package/dist/i18n/bs.d.ts +0 -2
- package/dist/i18n/da.d.ts +0 -2
- package/dist/i18n/de.d.ts +0 -2
- package/dist/i18n/en.d.ts +226 -1
- package/dist/i18n/es.d.ts +0 -2
- package/dist/i18n/fr.d.ts +0 -2
- package/dist/i18n/he.d.ts +197 -0
- package/dist/i18n/ja.d.ts +0 -2
- package/dist/i18n/km.d.ts +0 -2
- package/dist/i18n/ko.d.ts +0 -2
- package/dist/i18n/lo.d.ts +0 -2
- package/dist/i18n/mk.d.ts +0 -2
- package/dist/i18n/mn.d.ts +0 -2
- package/dist/i18n/my.d.ts +0 -2
- package/dist/i18n/pl.d.ts +0 -2
- package/dist/i18n/ru.d.ts +0 -2
- package/dist/i18n/sr.d.ts +0 -2
- package/dist/i18n/tg.d.ts +0 -2
- package/dist/i18n/th.d.ts +0 -2
- package/dist/i18n/tr.d.ts +0 -2
- package/dist/i18n/zh.d.ts +0 -2
- package/dist/i18n/zht.d.ts +0 -2
- package/dist/{components/icon.d.ts → icons/icon/additional-icons.d.ts} +8 -8
- package/dist/{v2/components → icons/icon}/icon.d.ts +24 -1
- package/dist/layout/divider/divider.d.ts +5 -0
- package/dist/navigation/menu/menu.d.ts +59 -0
- package/dist/{v2/components/segmented-control-v2.d.ts → navigation/segmented-control/segmented-control.d.ts} +5 -5
- package/dist/{components → navigation/tabs}/tabs.d.ts +15 -8
- package/dist/{v2/components/dialog-v2.d.ts → overlays/dialog/dialog.d.ts} +1 -2
- package/dist/overlays/tooltip/tooltip.d.ts +15 -0
- package/dist/{components → typography/text-shimmer}/text-shimmer.d.ts +1 -0
- package/dist/typography/wordmark/wordmark.d.ts +2 -0
- package/package.json +131 -13
- package/src/{components → actions/button}/button.tsx +10 -11
- package/src/actions/icon-button/icon-button.tsx +32 -0
- package/src/{v2/components/split-button-v2.css → actions/split-button/split-button.css} +1 -6
- package/src/{v2/components/split-button-v2.tsx → actions/split-button/split-button.tsx} +4 -4
- package/src/components/animated-number.css +29 -11
- package/src/components/animated-number.tsx +2 -2
- package/src/components/card.css +2 -23
- package/src/components/card.tsx +4 -4
- package/src/components/collapsible.tsx +2 -2
- package/src/components/dock-surface.css +2 -9
- package/src/components/image-preview.tsx +3 -2
- package/src/components/list.css +5 -5
- package/src/components/list.tsx +7 -5
- package/src/components/popover.tsx +3 -2
- package/src/components/scroll-view.tsx +5 -20
- package/src/components/sticky-accordion-header.tsx +1 -1
- package/src/components/text-field.tsx +12 -4
- package/src/context/dialog.tsx +1 -0
- package/src/context/i18n.tsx +17 -14
- package/src/{components → data-display/accordion}/accordion.css +1 -26
- package/src/{components → data-display/accordion}/accordion.tsx +14 -14
- package/src/{v2/components/avatar-v2.tsx → data-display/avatar/avatar.tsx} +1 -1
- package/src/{v2/components/badge-v2.css → data-display/badge/badge.css} +19 -0
- package/src/{v2/components/badge-v2.tsx → data-display/badge/badge.tsx} +6 -4
- package/src/{components → data-display/diff-changes}/diff-changes.css +22 -19
- package/src/{v2/components/diff-changes-v2.tsx → data-display/diff-changes/diff-changes.tsx} +7 -2
- package/src/{v2/components/keybind-v2.css → data-display/keybind/keybind.css} +1 -1
- package/src/{v2/components/keybind-v2.tsx → data-display/keybind/keybind.tsx} +3 -3
- package/src/{v2/components/line-comment-v2.css → data-display/line-comment/line-comment.css} +3 -3
- package/src/{v2/components/line-comment-v2.tsx → data-display/line-comment/line-comment.tsx} +17 -15
- package/src/{v2/components/project-avatar-v2.tsx → data-display/project-avatar/project-avatar.tsx} +1 -1
- package/src/{v2/components/loader-v2.tsx → feedback/loader/loader.tsx} +2 -2
- package/src/feedback/progress-circle/progress-circle.css +28 -0
- package/src/feedback/progress-circle/progress-circle.tsx +64 -0
- package/src/{v2/components/toast-v2.tsx → feedback/toast/toast.tsx} +60 -58
- package/src/{components → forms/checkbox}/checkbox.css +1 -7
- package/src/{components → forms/checkbox}/checkbox.tsx +13 -13
- package/src/{v2/components/field-v2.css → forms/field/field.css} +1 -1
- package/src/{v2/components/field-v2.tsx → forms/field/field.tsx} +9 -11
- package/src/{v2/components/radio-v2.tsx → forms/radio/radio.tsx} +30 -20
- package/src/{v2/components/select-v2.css → forms/select/select.css} +2 -8
- package/src/{v2/components/select-v2.tsx → forms/select/select.tsx} +38 -32
- package/src/{v2/components/switch-v2.css → forms/switch/switch.css} +110 -0
- package/src/forms/switch/switch.tsx +34 -0
- package/src/{v2/components/text-input-v2.css → forms/text-input/text-input.css} +1 -1
- package/src/{v2/components/text-input-v2.tsx → forms/text-input/text-input.tsx} +4 -4
- package/src/{v2/components/textarea-v2.tsx → forms/textarea/textarea.tsx} +3 -3
- package/src/hooks/create-auto-scroll.tsx +20 -0
- package/src/i18n/am.ts +1 -3
- package/src/i18n/ar.ts +1 -3
- package/src/i18n/az.ts +1 -3
- package/src/i18n/bg.ts +1 -3
- package/src/i18n/bn.ts +1 -3
- package/src/i18n/br.ts +1 -3
- package/src/i18n/bs.ts +1 -3
- package/src/i18n/ca.ts +1 -3
- package/src/i18n/cs.ts +1 -3
- package/src/i18n/da.ts +1 -3
- package/src/i18n/de.ts +1 -3
- package/src/i18n/dv.ts +1 -3
- package/src/i18n/dz.ts +1 -3
- package/src/i18n/el.ts +1 -3
- package/src/i18n/en.ts +36 -5
- package/src/i18n/es.ts +1 -3
- package/src/i18n/et.ts +1 -3
- package/src/i18n/fa.ts +1 -3
- package/src/i18n/fi.ts +1 -3
- package/src/i18n/fo.ts +1 -3
- package/src/i18n/fr.ts +1 -3
- package/src/i18n/he.ts +199 -0
- package/src/i18n/hi.ts +1 -3
- package/src/i18n/hr.ts +1 -3
- package/src/i18n/hu.ts +1 -3
- package/src/i18n/hy.ts +1 -3
- package/src/i18n/id.ts +1 -3
- package/src/i18n/is.ts +1 -3
- package/src/i18n/it.ts +1 -3
- package/src/i18n/ja.ts +1 -3
- package/src/i18n/ka.ts +1 -3
- package/src/i18n/km.ts +1 -3
- package/src/i18n/ko.ts +1 -3
- package/src/i18n/lo.ts +1 -3
- package/src/i18n/lt.ts +1 -3
- package/src/i18n/lv.ts +1 -3
- package/src/i18n/mk.ts +1 -3
- package/src/i18n/mn.ts +1 -3
- package/src/i18n/ms.ts +1 -3
- package/src/i18n/my.ts +1 -3
- package/src/i18n/ne.ts +1 -3
- package/src/i18n/nl.ts +1 -3
- package/src/i18n/no.ts +1 -3
- package/src/i18n/pa.ts +1 -3
- package/src/i18n/pl.ts +1 -3
- package/src/i18n/ro.ts +1 -3
- package/src/i18n/ru.ts +1 -3
- package/src/i18n/si.ts +1 -3
- package/src/i18n/sk.ts +1 -3
- package/src/i18n/sl.ts +1 -3
- package/src/i18n/sq.ts +1 -3
- package/src/i18n/sr.ts +1 -3
- package/src/i18n/sv.ts +1 -3
- package/src/i18n/tg.ts +1 -3
- package/src/i18n/th.ts +1 -3
- package/src/i18n/tk.ts +1 -3
- package/src/i18n/tr.ts +1 -3
- package/src/i18n/uk.ts +1 -3
- package/src/i18n/ur.ts +1 -3
- package/src/i18n/uz.ts +1 -3
- package/src/i18n/vi.ts +1 -3
- package/src/i18n/zh.ts +1 -3
- package/src/i18n/zht.ts +1 -3
- package/src/{components/icon.tsx → icons/icon/additional-icons.ts} +8 -74
- package/src/icons/icon/icon.css +3 -0
- package/src/{v2/components → icons/icon}/icon.tsx +50 -9
- package/src/{v2/components/divider-v2.tsx → layout/divider/divider.tsx} +3 -3
- package/src/{v2/components/menu-v2.css → navigation/menu/menu.css} +122 -1
- package/src/{v2/components/menu-v2.tsx → navigation/menu/menu.tsx} +96 -32
- package/src/{v2/components/segmented-control-v2.css → navigation/segmented-control/segmented-control.css} +1 -1
- package/src/{v2/components/segmented-control-v2.tsx → navigation/segmented-control/segmented-control.tsx} +9 -8
- package/src/{v2/components/tabs-v2.css → navigation/tabs/tabs-current.css} +25 -10
- package/src/{components → navigation/tabs}/tabs.css +39 -229
- package/src/navigation/tabs/tabs.tsx +194 -0
- package/src/{v2/components/dialog-v2.css → overlays/dialog/dialog.css} +3 -0
- package/src/{v2/components/dialog-v2.tsx → overlays/dialog/dialog.tsx} +11 -13
- package/src/{v2/components/tooltip-v2.css → overlays/tooltip/tooltip.css} +26 -0
- package/src/{v2/components/tooltip-v2.tsx → overlays/tooltip/tooltip.tsx} +21 -14
- package/src/styles/index.css +4 -20
- package/src/styles/tailwind/colors.css +1 -0
- package/src/styles/tailwind/index.css +18 -1
- package/src/styles/theme.css +2 -2
- package/src/{v2/styles → styles/tokens}/theme.css +10 -14
- package/src/theme/context.tsx +19 -11
- package/src/theme/themes/oc-2.json +3 -1
- package/src/theme/v2/foreground.ts +1 -0
- package/src/{components → typography/text-shimmer}/text-shimmer.css +2 -1
- package/src/{components → typography/text-shimmer}/text-shimmer.tsx +1 -0
- package/src/{v2/components/wordmark-v2.tsx → typography/wordmark/wordmark.tsx} +1 -1
- package/dist/components/avatar.d.ts +0 -9
- package/dist/components/button.d.ts +0 -9
- package/dist/components/dialog.d.ts +0 -12
- package/dist/components/dropdown-menu.d.ts +0 -80
- package/dist/components/icon-button.d.ts +0 -10
- package/dist/components/keybind.d.ts +0 -6
- package/dist/components/radio-group.d.ts +0 -16
- package/dist/components/select.d.ts +0 -21
- package/dist/components/tag.d.ts +0 -5
- package/dist/components/toast.d.ts +0 -56
- package/dist/components/tooltip.d.ts +0 -17
- package/dist/v2/components/accordion-v2.d.ts +0 -26
- package/dist/v2/components/badge-v2.d.ts +0 -6
- package/dist/v2/components/button-v2.d.ts +0 -10
- package/dist/v2/components/checkbox-v2.d.ts +0 -10
- package/dist/v2/components/diff-changes-v2.d.ts +0 -11
- package/dist/v2/components/divider-v2.d.ts +0 -5
- package/dist/v2/components/icon-button-v2.d.ts +0 -11
- package/dist/v2/components/inline-input-v2.d.ts +0 -21
- package/dist/v2/components/keybind-v2.d.ts +0 -7
- package/dist/v2/components/loader-v2.d.ts +0 -3
- package/dist/v2/components/menu-v2.d.ts +0 -52
- package/dist/v2/components/progress-circle-v2.d.ts +0 -8
- package/dist/v2/components/radio-v2.d.ts +0 -16
- package/dist/v2/components/split-button-v2.d.ts +0 -5
- package/dist/v2/components/switch-v2.d.ts +0 -7
- package/dist/v2/components/tabs-v2.d.ts +0 -34
- package/dist/v2/components/text-shimmer-v2.d.ts +0 -9
- package/dist/v2/components/textarea-v2.d.ts +0 -7
- package/dist/v2/components/toast-v2.d.ts +0 -57
- package/dist/v2/components/tooltip-v2.d.ts +0 -13
- package/dist/v2/components/wordmark-v2.d.ts +0 -2
- package/src/components/avatar.css +0 -49
- package/src/components/avatar.tsx +0 -55
- package/src/components/button.css +0 -194
- package/src/components/dialog.css +0 -181
- package/src/components/dialog.tsx +0 -72
- package/src/components/diff-changes.tsx +0 -115
- package/src/components/dropdown-menu.css +0 -135
- package/src/components/dropdown-menu.tsx +0 -308
- package/src/components/icon-button.css +0 -181
- package/src/components/icon-button.tsx +0 -29
- package/src/components/icon.css +0 -39
- package/src/components/keybind.css +0 -18
- package/src/components/keybind.tsx +0 -20
- package/src/components/progress-circle.css +0 -16
- package/src/components/progress-circle.tsx +0 -64
- package/src/components/radio-group.css +0 -187
- package/src/components/radio-group.tsx +0 -83
- package/src/components/select.css +0 -201
- package/src/components/select.tsx +0 -174
- package/src/components/switch.css +0 -136
- package/src/components/switch.tsx +0 -29
- package/src/components/tabs.tsx +0 -126
- package/src/components/tag.css +0 -37
- package/src/components/tag.tsx +0 -22
- package/src/components/toast.css +0 -236
- package/src/components/toast.tsx +0 -185
- package/src/components/tooltip.css +0 -74
- package/src/components/tooltip.tsx +0 -163
- package/src/v2/components/accordion-v2.css +0 -139
- package/src/v2/components/accordion-v2.tsx +0 -86
- package/src/v2/components/button-v2.tsx +0 -35
- package/src/v2/components/checkbox-v2.css +0 -184
- package/src/v2/components/checkbox-v2.tsx +0 -65
- package/src/v2/components/diff-changes-v2.css +0 -26
- package/src/v2/components/icon-button-v2.tsx +0 -37
- package/src/v2/components/inline-input-v2.css +0 -225
- package/src/v2/components/inline-input-v2.tsx +0 -107
- package/src/v2/components/progress-circle-v2.css +0 -13
- package/src/v2/components/progress-circle-v2.tsx +0 -52
- package/src/v2/components/switch-v2.tsx +0 -28
- package/src/v2/components/tabs-v2.tsx +0 -149
- package/src/v2/components/text-shimmer-v2.css +0 -125
- package/src/v2/components/text-shimmer-v2.tsx +0 -63
- /package/dist/{components → forms/inline-input}/inline-input.d.ts +0 -0
- /package/dist/{v2/components → navigation}/tab-state-indicator.d.ts +0 -0
- /package/src/{v2/components/button-v2.css → actions/button/button.css} +0 -0
- /package/src/{v2/components/icon-button-v2.css → actions/icon-button/icon-button.css} +0 -0
- /package/src/{v2/components/avatar-v2.css → data-display/avatar/avatar.css} +0 -0
- /package/src/{v2/components/project-avatar-v2.css → data-display/project-avatar/project-avatar.css} +0 -0
- /package/src/{v2/components/loader-v2.css → feedback/loader/loader.css} +0 -0
- /package/src/{v2/components/toast-v2.css → feedback/toast/toast.css} +0 -0
- /package/src/{components → forms/inline-input}/inline-input.css +0 -0
- /package/src/{components → forms/inline-input}/inline-input.tsx +0 -0
- /package/src/{v2/components/radio-v2.css → forms/radio/radio.css} +0 -0
- /package/src/{v2/components/textarea-v2.css → forms/textarea/textarea.css} +0 -0
- /package/src/{v2/components/divider-v2.css → layout/divider/divider.css} +0 -0
- /package/src/{v2/components → navigation}/tab-state-indicator.tsx +0 -0
- /package/src/{v2/components/file-tree-v2.css → styles/file-tree.css} +0 -0
- /package/src/{v2/styles → styles/tokens}/colors.css +0 -0
- /package/src/{v2/styles/tailwind.css → styles/tokens/index.css} +0 -0
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { DropdownMenu } from "@kobalte/core/dropdown-menu"
|
|
2
2
|
import { ContextMenu } from "@kobalte/core/context-menu"
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
Show,
|
|
6
|
+
splitProps,
|
|
7
|
+
useContext,
|
|
8
|
+
type Accessor,
|
|
9
|
+
type Component,
|
|
10
|
+
type ComponentProps,
|
|
11
|
+
type JSX,
|
|
12
|
+
type ParentProps,
|
|
13
|
+
} from "solid-js"
|
|
14
|
+
import "./menu.css"
|
|
5
15
|
|
|
6
16
|
const ChevronRight: Component = () => (
|
|
7
17
|
<svg
|
|
@@ -29,6 +39,18 @@ const CheckMark: Component = () => (
|
|
|
29
39
|
</svg>
|
|
30
40
|
)
|
|
31
41
|
|
|
42
|
+
export type MenuAppearance = "standard" | "compact"
|
|
43
|
+
|
|
44
|
+
const MenuAppearanceContext = createContext<{ appearance: Accessor<MenuAppearance> }>({
|
|
45
|
+
appearance: (): MenuAppearance => "compact",
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
function useMenuContext() {
|
|
49
|
+
const ctx = useContext(MenuAppearanceContext)
|
|
50
|
+
if (!ctx) throw new Error("Menu components must be used inside Menu or Menu.Context")
|
|
51
|
+
return ctx
|
|
52
|
+
}
|
|
53
|
+
|
|
32
54
|
function ItemBody(
|
|
33
55
|
props: ParentProps<{
|
|
34
56
|
shortcut?: JSX.Element | string
|
|
@@ -46,15 +68,21 @@ function ItemBody(
|
|
|
46
68
|
)
|
|
47
69
|
}
|
|
48
70
|
|
|
49
|
-
export interface
|
|
71
|
+
export interface MenuItemProps extends ComponentProps<typeof DropdownMenu.Item> {
|
|
50
72
|
shortcut?: JSX.Element | string
|
|
51
73
|
badge?: JSX.Element | string
|
|
52
74
|
}
|
|
53
75
|
|
|
54
|
-
function
|
|
76
|
+
function MenuItem(props: ParentProps<MenuItemProps>) {
|
|
77
|
+
const ctx = useMenuContext()
|
|
55
78
|
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
56
79
|
return (
|
|
57
|
-
<DropdownMenu.Item
|
|
80
|
+
<DropdownMenu.Item
|
|
81
|
+
{...r}
|
|
82
|
+
data-component="menu-v2-item"
|
|
83
|
+
data-appearance={ctx.appearance()}
|
|
84
|
+
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
85
|
+
>
|
|
58
86
|
<ItemBody shortcut={s.shortcut} badge={s.badge}>
|
|
59
87
|
{s.children}
|
|
60
88
|
</ItemBody>
|
|
@@ -62,17 +90,19 @@ function MenuV2Item(props: ParentProps<MenuV2ItemProps>) {
|
|
|
62
90
|
)
|
|
63
91
|
}
|
|
64
92
|
|
|
65
|
-
export interface
|
|
93
|
+
export interface MenuCheckboxItemProps extends ComponentProps<typeof DropdownMenu.CheckboxItem> {
|
|
66
94
|
shortcut?: JSX.Element | string
|
|
67
95
|
badge?: JSX.Element | string
|
|
68
96
|
}
|
|
69
97
|
|
|
70
|
-
function
|
|
98
|
+
function MenuCheckboxItem(props: ParentProps<MenuCheckboxItemProps>) {
|
|
99
|
+
const ctx = useMenuContext()
|
|
71
100
|
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
72
101
|
return (
|
|
73
102
|
<DropdownMenu.CheckboxItem
|
|
74
103
|
{...r}
|
|
75
104
|
data-component="menu-v2-item"
|
|
105
|
+
data-appearance={ctx.appearance()}
|
|
76
106
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
77
107
|
>
|
|
78
108
|
<ItemBody
|
|
@@ -90,17 +120,19 @@ function MenuV2CheckboxItem(props: ParentProps<MenuV2CheckboxItemProps>) {
|
|
|
90
120
|
)
|
|
91
121
|
}
|
|
92
122
|
|
|
93
|
-
export interface
|
|
123
|
+
export interface MenuRadioItemProps extends ComponentProps<typeof DropdownMenu.RadioItem> {
|
|
94
124
|
shortcut?: JSX.Element | string
|
|
95
125
|
badge?: JSX.Element | string
|
|
96
126
|
}
|
|
97
127
|
|
|
98
|
-
function
|
|
128
|
+
function MenuRadioItem(props: ParentProps<MenuRadioItemProps>) {
|
|
129
|
+
const ctx = useMenuContext()
|
|
99
130
|
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
100
131
|
return (
|
|
101
132
|
<DropdownMenu.RadioItem
|
|
102
133
|
{...r}
|
|
103
134
|
data-component="menu-v2-item"
|
|
135
|
+
data-appearance={ctx.appearance()}
|
|
104
136
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
105
137
|
>
|
|
106
138
|
<ItemBody
|
|
@@ -118,17 +150,19 @@ function MenuV2RadioItem(props: ParentProps<MenuV2RadioItemProps>) {
|
|
|
118
150
|
)
|
|
119
151
|
}
|
|
120
152
|
|
|
121
|
-
export interface
|
|
153
|
+
export interface MenuSubTriggerProps extends ComponentProps<typeof DropdownMenu.SubTrigger> {
|
|
122
154
|
shortcut?: JSX.Element | string
|
|
123
155
|
badge?: JSX.Element | string
|
|
124
156
|
}
|
|
125
157
|
|
|
126
|
-
function
|
|
158
|
+
function MenuSubTrigger(props: ParentProps<MenuSubTriggerProps>) {
|
|
159
|
+
const ctx = useMenuContext()
|
|
127
160
|
const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
|
|
128
161
|
return (
|
|
129
162
|
<DropdownMenu.SubTrigger
|
|
130
163
|
{...r}
|
|
131
164
|
data-component="menu-v2-item"
|
|
165
|
+
data-appearance={ctx.appearance()}
|
|
132
166
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
133
167
|
>
|
|
134
168
|
<ItemBody shortcut={s.shortcut} badge={s.badge} trailing={<ChevronRight />}>
|
|
@@ -138,88 +172,118 @@ function MenuV2SubTrigger(props: ParentProps<MenuV2SubTriggerProps>) {
|
|
|
138
172
|
)
|
|
139
173
|
}
|
|
140
174
|
|
|
141
|
-
function
|
|
175
|
+
function MenuSubContent(props: ComponentProps<typeof DropdownMenu.SubContent>) {
|
|
176
|
+
const ctx = useMenuContext()
|
|
142
177
|
const [s, r] = splitProps(props, ["class", "classList"])
|
|
143
178
|
return (
|
|
144
179
|
<DropdownMenu.SubContent
|
|
145
180
|
{...r}
|
|
146
181
|
data-component="menu-v2-content"
|
|
182
|
+
data-appearance={ctx.appearance()}
|
|
147
183
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
148
184
|
/>
|
|
149
185
|
)
|
|
150
186
|
}
|
|
151
187
|
|
|
152
|
-
function
|
|
188
|
+
function MenuGroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>) {
|
|
189
|
+
const ctx = useMenuContext()
|
|
153
190
|
const [s, r] = splitProps(props, ["class", "classList"])
|
|
154
191
|
return (
|
|
155
192
|
<DropdownMenu.GroupLabel
|
|
156
193
|
{...r}
|
|
157
194
|
data-slot="menu-v2-group-label"
|
|
195
|
+
data-appearance={ctx.appearance()}
|
|
158
196
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
159
197
|
/>
|
|
160
198
|
)
|
|
161
199
|
}
|
|
162
200
|
|
|
163
|
-
function
|
|
201
|
+
function MenuSeparator(props: ComponentProps<typeof DropdownMenu.Separator>) {
|
|
202
|
+
const ctx = useMenuContext()
|
|
164
203
|
const [s, r] = splitProps(props, ["class", "classList"])
|
|
165
204
|
return (
|
|
166
205
|
<DropdownMenu.Separator
|
|
167
206
|
{...r}
|
|
168
207
|
data-slot="menu-v2-separator"
|
|
208
|
+
data-appearance={ctx.appearance()}
|
|
169
209
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
170
210
|
/>
|
|
171
211
|
)
|
|
172
212
|
}
|
|
173
213
|
|
|
174
|
-
function
|
|
214
|
+
function MenuContent(props: ComponentProps<typeof DropdownMenu.Content>) {
|
|
215
|
+
const ctx = useMenuContext()
|
|
175
216
|
const [s, r] = splitProps(props, ["class", "classList"])
|
|
176
217
|
return (
|
|
177
218
|
<DropdownMenu.Content
|
|
178
219
|
{...r}
|
|
179
220
|
data-component="menu-v2-content"
|
|
221
|
+
data-appearance={ctx.appearance()}
|
|
180
222
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
181
223
|
/>
|
|
182
224
|
)
|
|
183
225
|
}
|
|
184
226
|
|
|
185
|
-
|
|
186
|
-
|
|
227
|
+
export interface MenuProps extends ComponentProps<typeof DropdownMenu> {
|
|
228
|
+
appearance?: MenuAppearance
|
|
187
229
|
}
|
|
188
230
|
|
|
189
|
-
function
|
|
190
|
-
|
|
231
|
+
function MenuRoot(props: MenuProps) {
|
|
232
|
+
const [local, rest] = splitProps(props, ["appearance", "children"])
|
|
233
|
+
const appearance = () => local.appearance ?? "compact"
|
|
234
|
+
return (
|
|
235
|
+
<MenuAppearanceContext.Provider value={{ appearance }}>
|
|
236
|
+
<DropdownMenu {...rest}>{local.children}</DropdownMenu>
|
|
237
|
+
</MenuAppearanceContext.Provider>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface MenuContextProps extends ComponentProps<typeof ContextMenu> {
|
|
242
|
+
appearance?: MenuAppearance
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function MenuContextRoot(props: MenuContextProps) {
|
|
246
|
+
const [local, rest] = splitProps(props, ["appearance", "children"])
|
|
247
|
+
const appearance = () => local.appearance ?? "compact"
|
|
248
|
+
return (
|
|
249
|
+
<MenuAppearanceContext.Provider value={{ appearance }}>
|
|
250
|
+
<ContextMenu {...rest}>{local.children}</ContextMenu>
|
|
251
|
+
</MenuAppearanceContext.Provider>
|
|
252
|
+
)
|
|
191
253
|
}
|
|
192
254
|
|
|
193
|
-
function
|
|
255
|
+
function MenuContextContent(props: ComponentProps<typeof ContextMenu.Content>) {
|
|
256
|
+
const ctx = useMenuContext()
|
|
194
257
|
const [s, r] = splitProps(props, ["class", "classList"])
|
|
195
258
|
return (
|
|
196
259
|
<ContextMenu.Content
|
|
197
260
|
{...r}
|
|
198
261
|
data-component="menu-v2-content"
|
|
262
|
+
data-appearance={ctx.appearance()}
|
|
199
263
|
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
200
264
|
/>
|
|
201
265
|
)
|
|
202
266
|
}
|
|
203
267
|
|
|
204
|
-
const
|
|
268
|
+
const MenuContext = Object.assign(MenuContextRoot, {
|
|
205
269
|
Trigger: ContextMenu.Trigger,
|
|
206
270
|
Portal: ContextMenu.Portal,
|
|
207
|
-
Content:
|
|
271
|
+
Content: MenuContextContent,
|
|
208
272
|
})
|
|
209
273
|
|
|
210
|
-
export const
|
|
274
|
+
export const Menu = Object.assign(MenuRoot, {
|
|
211
275
|
Trigger: DropdownMenu.Trigger,
|
|
212
276
|
Portal: DropdownMenu.Portal,
|
|
213
|
-
Content:
|
|
214
|
-
Item:
|
|
215
|
-
CheckboxItem:
|
|
277
|
+
Content: MenuContent,
|
|
278
|
+
Item: MenuItem,
|
|
279
|
+
CheckboxItem: MenuCheckboxItem,
|
|
216
280
|
RadioGroup: DropdownMenu.RadioGroup,
|
|
217
|
-
RadioItem:
|
|
281
|
+
RadioItem: MenuRadioItem,
|
|
218
282
|
Group: DropdownMenu.Group,
|
|
219
|
-
GroupLabel:
|
|
220
|
-
Separator:
|
|
283
|
+
GroupLabel: MenuGroupLabel,
|
|
284
|
+
Separator: MenuSeparator,
|
|
221
285
|
Sub: DropdownMenu.Sub,
|
|
222
|
-
SubTrigger:
|
|
223
|
-
SubContent:
|
|
224
|
-
Context:
|
|
286
|
+
SubTrigger: MenuSubTrigger,
|
|
287
|
+
SubContent: MenuSubContent,
|
|
288
|
+
Context: MenuContext,
|
|
225
289
|
})
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type ParentProps,
|
|
11
11
|
} from "solid-js"
|
|
12
12
|
import type { ComponentProps } from "solid-js"
|
|
13
|
-
import "./segmented-control
|
|
13
|
+
import "./segmented-control.css"
|
|
14
14
|
|
|
15
15
|
type OnChange = (value: string | null) => void
|
|
16
16
|
|
|
@@ -26,11 +26,11 @@ const SegmentedControlContext = createContext<SegmentedControlContextValue>()
|
|
|
26
26
|
|
|
27
27
|
function useSegmentedControlContext() {
|
|
28
28
|
const ctx = useContext(SegmentedControlContext)
|
|
29
|
-
if (!ctx) throw new Error("
|
|
29
|
+
if (!ctx) throw new Error("SegmentedControlItem must be used inside SegmentedControl")
|
|
30
30
|
return ctx
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export type
|
|
33
|
+
export type SegmentedControlProps = Omit<ComponentProps<"div">, "onChange"> &
|
|
34
34
|
ParentProps<{
|
|
35
35
|
/** Selected value when controlled (including `null` when empty). Omit key for uncontrolled. */
|
|
36
36
|
value?: string | null
|
|
@@ -42,7 +42,7 @@ export type SegmentedControlV2Props = Omit<ComponentProps<"div">, "onChange"> &
|
|
|
42
42
|
disabled?: boolean
|
|
43
43
|
}>
|
|
44
44
|
|
|
45
|
-
export function
|
|
45
|
+
export function SegmentedControl(props: SegmentedControlProps) {
|
|
46
46
|
const isControlled = createMemo(() => Object.hasOwn(props as object, "value"))
|
|
47
47
|
const merged = mergeProps({ allowDeselect: false, disabled: false }, props)
|
|
48
48
|
const [local, rest] = splitProps(merged, [
|
|
@@ -119,7 +119,7 @@ export function SegmentedControlV2(props: SegmentedControlV2Props) {
|
|
|
119
119
|
)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export type
|
|
122
|
+
export type SegmentedControlItemProps = Omit<ComponentProps<"button">, "type" | "children"> &
|
|
123
123
|
ParentProps<{
|
|
124
124
|
value: string
|
|
125
125
|
children: JSX.Element
|
|
@@ -132,7 +132,7 @@ function invokeButtonHandler<E extends Event>(
|
|
|
132
132
|
if (typeof handler === "function") (handler as (ev: typeof e) => void)(e)
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
export function
|
|
135
|
+
export function SegmentedControlItem(props: SegmentedControlItemProps) {
|
|
136
136
|
const merged = mergeProps({ disabled: false }, props)
|
|
137
137
|
const [local, rest] = splitProps(merged, [
|
|
138
138
|
"class",
|
|
@@ -159,13 +159,14 @@ export function SegmentedControlItemV2(props: SegmentedControlItemV2Props) {
|
|
|
159
159
|
invokeButtonHandler(local.onKeyDown, e)
|
|
160
160
|
if (e.defaultPrevented || disabled()) return
|
|
161
161
|
const t = e.currentTarget
|
|
162
|
+
const horizontal = t.closest(`[data-slot="segmented-control-v2"]`)?.matches(":dir(rtl)") ? -1 : 1
|
|
162
163
|
|
|
163
164
|
if (e.key === "ArrowRight") {
|
|
164
165
|
e.preventDefault()
|
|
165
|
-
ctx.focusNext(t,
|
|
166
|
+
ctx.focusNext(t, horizontal)
|
|
166
167
|
} else if (e.key === "ArrowLeft") {
|
|
167
168
|
e.preventDefault()
|
|
168
|
-
ctx.focusNext(t, -1)
|
|
169
|
+
ctx.focusNext(t, -horizontal as 1 | -1)
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
// accessibility stuff
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
font-size: 13px;
|
|
61
61
|
font-weight: 440;
|
|
62
|
-
line-height:
|
|
62
|
+
line-height: var(--line-height-compact);
|
|
63
63
|
letter-spacing: -0.04px;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -68,22 +68,29 @@
|
|
|
68
68
|
box-shadow: none;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
[data-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
[data-slot="tabs-v2-trigger-close-button"] {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
74
75
|
margin-inline-start: -5px;
|
|
75
76
|
flex: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-slot="tabs-v2-trigger-close-button"] [data-slot="tabs-close-button"] {
|
|
80
|
+
width: 20px;
|
|
81
|
+
height: 20px;
|
|
82
|
+
padding: 0;
|
|
76
83
|
display: flex;
|
|
77
84
|
align-items: center;
|
|
78
85
|
justify-content: center;
|
|
79
86
|
color: var(--v2-text-text-faint);
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
[data-
|
|
89
|
+
[data-slot="tabs-v2-trigger-close-button"] [data-slot="tabs-close-button"]:hover {
|
|
83
90
|
color: var(--v2-text-text-muted);
|
|
84
91
|
}
|
|
85
92
|
|
|
86
|
-
[data-component="tabs-v2"] [data-component="icon-button"] {
|
|
93
|
+
[data-component="tabs-v2"] [data-component="icon-button-v2"] {
|
|
87
94
|
margin: 0;
|
|
88
95
|
}
|
|
89
96
|
|
|
@@ -175,7 +182,7 @@
|
|
|
175
182
|
border: 0.5px solid var(--v2-border-border-muted);
|
|
176
183
|
}
|
|
177
184
|
|
|
178
|
-
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"] [data-slot="tabs-v2-list"] {
|
|
185
|
+
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"] > [data-slot="tabs-v2-list"] {
|
|
179
186
|
flex-direction: column;
|
|
180
187
|
width: 240px;
|
|
181
188
|
min-width: 200px;
|
|
@@ -186,7 +193,9 @@
|
|
|
186
193
|
border-inline-end: 1px solid var(--v2-border-border-base);
|
|
187
194
|
}
|
|
188
195
|
|
|
189
|
-
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
196
|
+
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
197
|
+
> [data-slot="tabs-v2-list"]
|
|
198
|
+
[data-slot="tabs-v2-section-title"] {
|
|
190
199
|
width: 100%;
|
|
191
200
|
padding-inline-start: 4px;
|
|
192
201
|
color: var(--v2-text-text-muted);
|
|
@@ -195,7 +204,9 @@
|
|
|
195
204
|
user-select: none;
|
|
196
205
|
}
|
|
197
206
|
|
|
198
|
-
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
207
|
+
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
208
|
+
> [data-slot="tabs-v2-list"]
|
|
209
|
+
[data-slot="tabs-v2-trigger-wrapper"] {
|
|
199
210
|
width: 100%;
|
|
200
211
|
height: 28px;
|
|
201
212
|
border-radius: 4px;
|
|
@@ -203,7 +214,9 @@
|
|
|
203
214
|
color: var(--v2-text-text-muted);
|
|
204
215
|
}
|
|
205
216
|
|
|
206
|
-
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
217
|
+
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
218
|
+
> [data-slot="tabs-v2-list"]
|
|
219
|
+
[data-slot="tabs-v2-trigger"] {
|
|
207
220
|
width: 100%;
|
|
208
221
|
height: 100%;
|
|
209
222
|
justify-content: flex-start;
|
|
@@ -212,12 +225,14 @@
|
|
|
212
225
|
}
|
|
213
226
|
|
|
214
227
|
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
228
|
+
> [data-slot="tabs-v2-list"]
|
|
215
229
|
[data-slot="tabs-v2-trigger-wrapper"]:hover:not(:disabled):not(:has([data-selected])) {
|
|
216
230
|
background-color: var(--v2-background-bg-layer-03);
|
|
217
231
|
color: var(--v2-text-text-base);
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
[data-component="tabs-v2"][data-variant="settings"][data-orientation="vertical"]
|
|
235
|
+
> [data-slot="tabs-v2-list"]
|
|
221
236
|
[data-slot="tabs-v2-trigger-wrapper"]:has([data-selected]) {
|
|
222
237
|
background-color: var(--v2-background-bg-layer-03);
|
|
223
238
|
color: var(--v2-text-text-base);
|