@opencode-ai/ui 0.0.0-dev-17913 → 0.0.0-dev-202608221251
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/{data-display/accordion → components}/accordion.d.ts +6 -6
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/button.d.ts +9 -0
- package/dist/components/card.d.ts +1 -1
- package/dist/{forms/checkbox → components}/checkbox.d.ts +2 -2
- package/dist/components/dialog.d.ts +12 -0
- package/dist/{data-display/diff-changes → components}/diff-changes.d.ts +1 -2
- package/dist/components/dropdown-menu.d.ts +80 -0
- package/dist/components/icon-button.d.ts +10 -0
- package/dist/{icons/icon/additional-icons.d.ts → components/icon.d.ts} +8 -8
- package/dist/components/keybind.d.ts +6 -0
- package/dist/components/list.d.ts +1 -1
- package/dist/{feedback/progress-circle → components}/progress-circle.d.ts +0 -2
- package/dist/components/radio-group.d.ts +16 -0
- package/dist/components/scroll-view.d.ts +3 -3
- package/dist/components/select.d.ts +21 -0
- package/dist/{forms/switch → components}/switch.d.ts +2 -4
- package/dist/{navigation/tabs → components}/tabs.d.ts +8 -15
- package/dist/components/tag.d.ts +5 -0
- package/dist/{typography/text-shimmer → components}/text-shimmer.d.ts +0 -1
- package/dist/components/toast.d.ts +56 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/context/i18n.d.ts +7 -10
- package/dist/i18n/ar.d.ts +2 -0
- package/dist/i18n/bg.d.ts +2 -0
- package/dist/i18n/br.d.ts +2 -0
- package/dist/i18n/bs.d.ts +2 -0
- package/dist/i18n/da.d.ts +2 -0
- package/dist/i18n/de.d.ts +2 -0
- package/dist/i18n/en.d.ts +1 -218
- package/dist/i18n/es.d.ts +2 -0
- package/dist/i18n/fr.d.ts +2 -0
- package/dist/i18n/ja.d.ts +2 -0
- package/dist/i18n/km.d.ts +2 -0
- package/dist/i18n/ko.d.ts +2 -0
- package/dist/i18n/lo.d.ts +2 -0
- package/dist/i18n/mk.d.ts +2 -0
- package/dist/i18n/mn.d.ts +2 -0
- package/dist/i18n/my.d.ts +2 -0
- package/dist/i18n/pl.d.ts +2 -0
- package/dist/i18n/ru.d.ts +2 -0
- package/dist/i18n/sr.d.ts +2 -0
- package/dist/i18n/tg.d.ts +2 -0
- package/dist/i18n/th.d.ts +2 -0
- package/dist/i18n/tr.d.ts +2 -0
- package/dist/i18n/zh.d.ts +2 -0
- package/dist/i18n/zht.d.ts +2 -0
- package/dist/v2/components/accordion-v2.d.ts +26 -0
- package/dist/{data-display/avatar/avatar.d.ts → v2/components/avatar-v2.d.ts} +1 -1
- package/dist/v2/components/badge-v2.d.ts +6 -0
- package/dist/v2/components/button-v2.d.ts +10 -0
- package/dist/v2/components/checkbox-v2.d.ts +10 -0
- package/dist/{overlays/dialog/dialog.d.ts → v2/components/dialog-v2.d.ts} +2 -1
- package/dist/v2/components/diff-changes-v2.d.ts +11 -0
- package/dist/v2/components/divider-v2.d.ts +5 -0
- package/dist/{forms/field/field.d.ts → v2/components/field-v2.d.ts} +10 -4
- package/dist/v2/components/icon-button-v2.d.ts +11 -0
- package/dist/{icons/icon → v2/components}/icon.d.ts +1 -20
- package/dist/v2/components/inline-input-v2.d.ts +21 -0
- package/dist/v2/components/keybind-v2.d.ts +7 -0
- package/dist/{data-display/line-comment/line-comment.d.ts → v2/components/line-comment-v2.d.ts} +9 -9
- package/dist/v2/components/loader-v2.d.ts +3 -0
- package/dist/v2/components/menu-v2.d.ts +52 -0
- package/dist/v2/components/progress-circle-v2.d.ts +8 -0
- package/dist/{data-display/project-avatar/project-avatar.d.ts → v2/components/project-avatar-v2.d.ts} +1 -1
- package/dist/v2/components/radio-v2.d.ts +16 -0
- package/dist/{navigation/segmented-control/segmented-control.d.ts → v2/components/segmented-control-v2.d.ts} +5 -5
- package/dist/{forms/select/select.d.ts → v2/components/select-v2.d.ts} +6 -4
- package/dist/v2/components/split-button-v2.d.ts +5 -0
- package/dist/v2/components/switch-v2.d.ts +7 -0
- package/dist/v2/components/tabs-v2.d.ts +34 -0
- package/dist/{forms/text-input/text-input.d.ts → v2/components/text-input-v2.d.ts} +3 -3
- package/dist/v2/components/text-shimmer-v2.d.ts +9 -0
- package/dist/v2/components/textarea-v2.d.ts +7 -0
- package/dist/v2/components/toast-v2.d.ts +57 -0
- package/dist/v2/components/tooltip-v2.d.ts +13 -0
- package/dist/v2/components/wordmark-v2.d.ts +2 -0
- package/package.json +13 -131
- package/src/{data-display/accordion → components}/accordion.css +26 -1
- package/src/{data-display/accordion → components}/accordion.tsx +14 -14
- package/src/components/animated-number.css +11 -29
- package/src/components/animated-number.tsx +2 -2
- package/src/components/avatar.css +49 -0
- package/src/components/avatar.tsx +55 -0
- package/src/components/button.css +194 -0
- package/src/{actions/button → components}/button.tsx +11 -10
- package/src/components/card.css +23 -2
- package/src/components/card.tsx +4 -4
- package/src/{forms/checkbox → components}/checkbox.css +7 -1
- package/src/{forms/checkbox → components}/checkbox.tsx +13 -13
- package/src/components/collapsible.tsx +2 -2
- package/src/components/dialog.css +181 -0
- package/src/components/dialog.tsx +72 -0
- package/src/{data-display/diff-changes → components}/diff-changes.css +19 -22
- package/src/components/diff-changes.tsx +115 -0
- package/src/components/dock-surface.css +9 -2
- package/src/components/dropdown-menu.css +135 -0
- package/src/components/dropdown-menu.tsx +308 -0
- package/src/components/icon-button.css +181 -0
- package/src/components/icon-button.tsx +29 -0
- package/src/components/icon.css +39 -0
- package/src/{icons/icon/additional-icons.ts → components/icon.tsx} +74 -8
- package/src/components/image-preview.tsx +2 -3
- package/src/components/keybind.css +18 -0
- package/src/components/keybind.tsx +20 -0
- package/src/components/list.css +5 -5
- package/src/components/list.tsx +5 -7
- package/src/components/popover.tsx +2 -3
- package/src/components/progress-circle.css +16 -0
- package/src/components/progress-circle.tsx +64 -0
- package/src/components/provider-icon.tsx +1 -1
- package/src/components/radio-group.css +187 -0
- package/src/components/radio-group.tsx +83 -0
- package/src/components/scroll-view.tsx +20 -5
- package/src/components/select.css +201 -0
- package/src/components/select.tsx +174 -0
- package/src/components/sticky-accordion-header.tsx +1 -1
- package/src/components/switch.css +136 -0
- package/src/components/switch.tsx +29 -0
- package/src/{navigation/tabs → components}/tabs.css +229 -39
- package/src/components/tabs.tsx +126 -0
- package/src/components/tag.css +37 -0
- package/src/components/tag.tsx +22 -0
- package/src/components/text-field.tsx +4 -12
- package/src/{typography/text-shimmer → components}/text-shimmer.css +1 -2
- package/src/{typography/text-shimmer → components}/text-shimmer.tsx +0 -1
- 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 +163 -0
- package/src/context/i18n.tsx +14 -17
- package/src/hooks/create-auto-scroll.tsx +0 -20
- package/src/i18n/am.ts +2 -0
- package/src/i18n/ar.ts +2 -0
- package/src/i18n/az.ts +2 -0
- package/src/i18n/bg.ts +2 -0
- package/src/i18n/bn.ts +2 -0
- package/src/i18n/br.ts +2 -0
- package/src/i18n/bs.ts +2 -0
- package/src/i18n/ca.ts +2 -0
- package/src/i18n/cs.ts +2 -0
- package/src/i18n/da.ts +2 -0
- package/src/i18n/de.ts +2 -0
- package/src/i18n/dv.ts +2 -0
- package/src/i18n/dz.ts +2 -0
- package/src/i18n/el.ts +2 -0
- package/src/i18n/en.ts +4 -27
- package/src/i18n/es.ts +2 -0
- package/src/i18n/et.ts +2 -0
- package/src/i18n/fa.ts +2 -0
- package/src/i18n/fi.ts +2 -0
- package/src/i18n/fo.ts +2 -0
- package/src/i18n/fr.ts +2 -0
- package/src/i18n/hi.ts +2 -0
- package/src/i18n/hr.ts +2 -0
- package/src/i18n/hu.ts +2 -0
- package/src/i18n/hy.ts +2 -0
- package/src/i18n/id.ts +2 -0
- package/src/i18n/is.ts +2 -0
- package/src/i18n/it.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ka.ts +2 -0
- package/src/i18n/km.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/lo.ts +2 -0
- package/src/i18n/lt.ts +2 -0
- package/src/i18n/lv.ts +2 -0
- package/src/i18n/mk.ts +2 -0
- package/src/i18n/mn.ts +2 -0
- package/src/i18n/ms.ts +2 -0
- package/src/i18n/my.ts +2 -0
- package/src/i18n/ne.ts +2 -0
- package/src/i18n/nl.ts +2 -0
- package/src/i18n/no.ts +2 -0
- package/src/i18n/pa.ts +2 -0
- package/src/i18n/pl.ts +2 -0
- package/src/i18n/ro.ts +2 -0
- package/src/i18n/ru.ts +2 -0
- package/src/i18n/si.ts +2 -0
- package/src/i18n/sk.ts +2 -0
- package/src/i18n/sl.ts +2 -0
- package/src/i18n/sq.ts +2 -0
- package/src/i18n/sr.ts +2 -0
- package/src/i18n/sv.ts +2 -0
- package/src/i18n/tg.ts +2 -0
- package/src/i18n/th.ts +2 -0
- package/src/i18n/tk.ts +2 -0
- package/src/i18n/tr.ts +2 -0
- package/src/i18n/uk.ts +2 -0
- package/src/i18n/ur.ts +2 -0
- package/src/i18n/uz.ts +2 -0
- package/src/i18n/vi.ts +2 -0
- package/src/i18n/zh.ts +2 -0
- package/src/i18n/zht.ts +2 -0
- package/src/styles/index.css +20 -4
- package/src/styles/tailwind/colors.css +0 -1
- package/src/styles/tailwind/index.css +1 -15
- package/src/theme/context.tsx +11 -19
- package/src/theme/themes/oc-2.json +1 -3
- package/src/theme/v2/foreground.ts +0 -1
- package/src/v2/components/accordion-v2.css +139 -0
- package/src/v2/components/accordion-v2.tsx +86 -0
- package/src/{data-display/avatar/avatar.tsx → v2/components/avatar-v2.tsx} +1 -1
- package/src/{data-display/badge/badge.css → v2/components/badge-v2.css} +0 -19
- package/src/{data-display/badge/badge.tsx → v2/components/badge-v2.tsx} +4 -6
- 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/{overlays/dialog/dialog.css → v2/components/dialog-v2.css} +0 -3
- package/src/{overlays/dialog/dialog.tsx → v2/components/dialog-v2.tsx} +13 -11
- package/src/v2/components/diff-changes-v2.css +26 -0
- package/src/{data-display/diff-changes/diff-changes.tsx → v2/components/diff-changes-v2.tsx} +2 -7
- package/src/{layout/divider/divider.tsx → v2/components/divider-v2.tsx} +3 -3
- package/src/{forms/field/field.tsx → v2/components/field-v2.tsx} +11 -9
- package/src/v2/components/icon-button-v2.tsx +37 -0
- package/src/{icons/icon → v2/components}/icon.tsx +9 -46
- package/src/v2/components/inline-input-v2.css +225 -0
- package/src/v2/components/inline-input-v2.tsx +107 -0
- package/src/{data-display/keybind/keybind.css → v2/components/keybind-v2.css} +1 -1
- package/src/{data-display/keybind/keybind.tsx → v2/components/keybind-v2.tsx} +3 -3
- package/src/{data-display/line-comment/line-comment.tsx → v2/components/line-comment-v2.tsx} +15 -17
- package/src/{feedback/loader/loader.tsx → v2/components/loader-v2.tsx} +2 -2
- package/src/{navigation/menu/menu.css → v2/components/menu-v2.css} +0 -121
- package/src/{navigation/menu/menu.tsx → v2/components/menu-v2.tsx} +32 -96
- package/src/v2/components/progress-circle-v2.css +13 -0
- package/src/v2/components/progress-circle-v2.tsx +52 -0
- package/src/{data-display/project-avatar/project-avatar.tsx → v2/components/project-avatar-v2.tsx} +1 -1
- package/src/{forms/radio/radio.tsx → v2/components/radio-v2.tsx} +20 -30
- package/src/{navigation/segmented-control/segmented-control.tsx → v2/components/segmented-control-v2.tsx} +8 -9
- package/src/{forms/select/select.css → v2/components/select-v2.css} +8 -2
- package/src/{forms/select/select.tsx → v2/components/select-v2.tsx} +32 -38
- package/src/{actions/split-button/split-button.css → v2/components/split-button-v2.css} +6 -1
- package/src/{actions/split-button/split-button.tsx → v2/components/split-button-v2.tsx} +4 -4
- package/src/{forms/switch/switch.css → v2/components/switch-v2.css} +0 -110
- package/src/v2/components/switch-v2.tsx +28 -0
- package/src/{navigation/tabs/tabs-current.css → v2/components/tabs-v2.css} +9 -24
- package/src/v2/components/tabs-v2.tsx +149 -0
- package/src/{forms/text-input/text-input.tsx → v2/components/text-input-v2.tsx} +4 -4
- package/src/v2/components/text-shimmer-v2.css +125 -0
- package/src/v2/components/text-shimmer-v2.tsx +63 -0
- package/src/{forms/textarea/textarea.tsx → v2/components/textarea-v2.tsx} +3 -3
- package/src/{feedback/toast/toast.tsx → v2/components/toast-v2.tsx} +58 -60
- package/src/{overlays/tooltip/tooltip.css → v2/components/tooltip-v2.css} +0 -26
- package/src/{overlays/tooltip/tooltip.tsx → v2/components/tooltip-v2.tsx} +14 -21
- package/src/{typography/wordmark/wordmark.tsx → v2/components/wordmark-v2.tsx} +1 -1
- package/src/{styles/tokens → v2/styles}/theme.css +12 -4
- package/dist/actions/button/button.d.ts +0 -10
- package/dist/actions/icon-button/icon-button.d.ts +0 -11
- package/dist/actions/split-button/split-button.d.ts +0 -5
- package/dist/data-display/badge/badge.d.ts +0 -7
- package/dist/data-display/keybind/keybind.d.ts +0 -7
- package/dist/feedback/loader/loader.d.ts +0 -3
- package/dist/feedback/toast/toast.d.ts +0 -57
- package/dist/forms/radio/radio.d.ts +0 -16
- package/dist/forms/textarea/textarea.d.ts +0 -7
- package/dist/i18n/he.d.ts +0 -197
- package/dist/layout/divider/divider.d.ts +0 -5
- package/dist/navigation/menu/menu.d.ts +0 -59
- package/dist/overlays/tooltip/tooltip.d.ts +0 -15
- package/dist/typography/wordmark/wordmark.d.ts +0 -2
- package/src/actions/icon-button/icon-button.tsx +0 -32
- package/src/feedback/progress-circle/progress-circle.css +0 -28
- package/src/feedback/progress-circle/progress-circle.tsx +0 -64
- package/src/forms/switch/switch.tsx +0 -34
- package/src/i18n/he.ts +0 -199
- package/src/icons/icon/icon.css +0 -3
- package/src/navigation/tabs/tabs.tsx +0 -194
- /package/dist/{forms/inline-input → components}/inline-input.d.ts +0 -0
- /package/dist/{navigation → v2/components}/tab-state-indicator.d.ts +0 -0
- /package/src/{forms/inline-input → components}/inline-input.css +0 -0
- /package/src/{forms/inline-input → components}/inline-input.tsx +0 -0
- /package/src/{data-display/avatar/avatar.css → v2/components/avatar-v2.css} +0 -0
- /package/src/{actions/button/button.css → v2/components/button-v2.css} +0 -0
- /package/src/{layout/divider/divider.css → v2/components/divider-v2.css} +0 -0
- /package/src/{forms/field/field.css → v2/components/field-v2.css} +0 -0
- /package/src/{styles/file-tree.css → v2/components/file-tree-v2.css} +0 -0
- /package/src/{actions/icon-button/icon-button.css → v2/components/icon-button-v2.css} +0 -0
- /package/src/{data-display/line-comment/line-comment.css → v2/components/line-comment-v2.css} +0 -0
- /package/src/{feedback/loader/loader.css → v2/components/loader-v2.css} +0 -0
- /package/src/{data-display/project-avatar/project-avatar.css → v2/components/project-avatar-v2.css} +0 -0
- /package/src/{forms/radio/radio.css → v2/components/radio-v2.css} +0 -0
- /package/src/{navigation/segmented-control/segmented-control.css → v2/components/segmented-control-v2.css} +0 -0
- /package/src/{navigation → v2/components}/tab-state-indicator.tsx +0 -0
- /package/src/{forms/text-input/text-input.css → v2/components/text-input-v2.css} +0 -0
- /package/src/{forms/textarea/textarea.css → v2/components/textarea-v2.css} +0 -0
- /package/src/{feedback/toast/toast.css → v2/components/toast-v2.css} +0 -0
- /package/src/{styles/tokens → v2/styles}/colors.css +0 -0
- /package/src/{styles/tokens/index.css → v2/styles/tailwind.css} +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
[data-component="select"] {
|
|
2
|
+
[data-slot="select-select-trigger"] {
|
|
3
|
+
padding-block: 0;
|
|
4
|
+
padding-inline: 8px 4px;
|
|
5
|
+
box-shadow: none;
|
|
6
|
+
|
|
7
|
+
[data-slot="select-select-trigger-value"] {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
text-overflow: ellipsis;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
}
|
|
12
|
+
[data-slot="select-select-trigger-icon"] {
|
|
13
|
+
width: 16px;
|
|
14
|
+
height: 16px;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
color: var(--text-weak);
|
|
20
|
+
transition: transform 0.1s ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&[data-expanded] {
|
|
24
|
+
&[data-variant="secondary"] {
|
|
25
|
+
background-color: var(--button-secondary-hover);
|
|
26
|
+
}
|
|
27
|
+
&[data-variant="ghost"] {
|
|
28
|
+
background-color: var(--surface-raised-base-active);
|
|
29
|
+
}
|
|
30
|
+
&[data-variant="primary"] {
|
|
31
|
+
background-color: var(--icon-strong-active);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:not([data-expanded]):focus-visible {
|
|
36
|
+
&[data-variant="secondary"] {
|
|
37
|
+
background-color: var(--button-secondary-base);
|
|
38
|
+
}
|
|
39
|
+
&[data-variant="ghost"] {
|
|
40
|
+
background-color: var(--surface-raised-base-hover);
|
|
41
|
+
}
|
|
42
|
+
&[data-variant="primary"] {
|
|
43
|
+
background-color: var(--icon-strong-base);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[data-trigger-style="settings"] {
|
|
49
|
+
[data-slot="select-select-trigger"] {
|
|
50
|
+
padding-block: 6px;
|
|
51
|
+
padding-inline: 12px 6px;
|
|
52
|
+
box-shadow: none;
|
|
53
|
+
border-radius: 6px;
|
|
54
|
+
min-width: 160px;
|
|
55
|
+
height: 32px;
|
|
56
|
+
justify-content: flex-end;
|
|
57
|
+
gap: 12px;
|
|
58
|
+
background-color: transparent;
|
|
59
|
+
|
|
60
|
+
[data-slot="select-select-trigger-value"] {
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
font-size: var(--font-size-base);
|
|
65
|
+
font-weight: var(--font-weight-regular);
|
|
66
|
+
}
|
|
67
|
+
[data-slot="select-select-trigger-icon"] {
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 20px;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
color: var(--text-weak);
|
|
75
|
+
background-color: var(--surface-raised-base);
|
|
76
|
+
border-radius: 4px;
|
|
77
|
+
transition: transform 0.1s ease-in-out;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&[data-slot="select-select-trigger"]:hover:not(:disabled),
|
|
81
|
+
&[data-slot="select-select-trigger"][data-expanded],
|
|
82
|
+
&[data-slot="select-select-trigger"][data-expanded]:hover:not(:disabled) {
|
|
83
|
+
background-color: var(--input-base);
|
|
84
|
+
box-shadow: var(--shadow-xs-border-base);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:not([data-expanded]):not(:focus-visible):focus {
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
box-shadow: none;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[data-component="select-content"] {
|
|
96
|
+
min-width: 104px;
|
|
97
|
+
max-width: 23rem;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
border-radius: var(--radius-md);
|
|
100
|
+
background-color: var(--surface-raised-stronger-non-alpha);
|
|
101
|
+
padding: 4px;
|
|
102
|
+
box-shadow: var(--shadow-xs-border);
|
|
103
|
+
z-index: 60;
|
|
104
|
+
|
|
105
|
+
&[data-expanded] {
|
|
106
|
+
animation: select-open 0.15s ease-out;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-slot="select-select-content-list"] {
|
|
110
|
+
overflow-y: auto;
|
|
111
|
+
max-height: 12rem;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
overflow-x: hidden;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
|
|
117
|
+
&:focus {
|
|
118
|
+
outline: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
> *:not([role="presentation"]) + *:not([role="presentation"]) {
|
|
122
|
+
margin-top: 2px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
[data-slot="select-select-item"] {
|
|
127
|
+
position: relative;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
padding: 2px 8px;
|
|
131
|
+
gap: 12px;
|
|
132
|
+
border-radius: 4px;
|
|
133
|
+
cursor: default;
|
|
134
|
+
|
|
135
|
+
/* text-12-medium */
|
|
136
|
+
font-family: var(--font-family-sans);
|
|
137
|
+
font-size: var(--font-size-small);
|
|
138
|
+
font-style: normal;
|
|
139
|
+
font-weight: var(--font-weight-medium);
|
|
140
|
+
line-height: var(--line-height-large); /* 166.667% */
|
|
141
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
142
|
+
|
|
143
|
+
color: var(--text-strong);
|
|
144
|
+
|
|
145
|
+
outline: none;
|
|
146
|
+
user-select: none;
|
|
147
|
+
|
|
148
|
+
&[data-highlighted] {
|
|
149
|
+
background: var(--surface-raised-base-hover);
|
|
150
|
+
}
|
|
151
|
+
&[data-disabled] {
|
|
152
|
+
background-color: var(--surface-raised-base);
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
}
|
|
155
|
+
[data-slot="select-select-item-indicator"] {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
margin-inline-start: auto;
|
|
160
|
+
width: 16px;
|
|
161
|
+
height: 16px;
|
|
162
|
+
}
|
|
163
|
+
&:focus {
|
|
164
|
+
outline: none;
|
|
165
|
+
}
|
|
166
|
+
&:hover {
|
|
167
|
+
background: var(--surface-raised-base-hover);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[data-component="select-content"][data-trigger-style="settings"] {
|
|
173
|
+
min-width: 160px;
|
|
174
|
+
border-radius: 8px;
|
|
175
|
+
padding: 0;
|
|
176
|
+
|
|
177
|
+
[data-slot="select-select-content-list"] {
|
|
178
|
+
padding: 4px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[data-slot="select-select-item"] {
|
|
182
|
+
/* text-14-regular */
|
|
183
|
+
font-family: var(--font-family-sans);
|
|
184
|
+
font-size: var(--font-size-base);
|
|
185
|
+
font-style: normal;
|
|
186
|
+
font-weight: var(--font-weight-regular);
|
|
187
|
+
line-height: var(--line-height-large);
|
|
188
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@keyframes select-open {
|
|
193
|
+
from {
|
|
194
|
+
opacity: 0;
|
|
195
|
+
transform: scale(0.95);
|
|
196
|
+
}
|
|
197
|
+
to {
|
|
198
|
+
opacity: 1;
|
|
199
|
+
transform: scale(1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Select as Kobalte } from "@kobalte/core/select"
|
|
2
|
+
import { createMemo, onCleanup, splitProps, type ComponentProps, type JSX } from "solid-js"
|
|
3
|
+
import { pipe, groupBy, entries, map } from "remeda"
|
|
4
|
+
import { Button, ButtonProps } from "./button"
|
|
5
|
+
import { Icon } from "./icon"
|
|
6
|
+
|
|
7
|
+
export type SelectProps<T> = Omit<ComponentProps<typeof Kobalte<T>>, "value" | "onSelect" | "children"> & {
|
|
8
|
+
placeholder?: string
|
|
9
|
+
options: T[]
|
|
10
|
+
current?: T
|
|
11
|
+
value?: (x: T) => string
|
|
12
|
+
label?: (x: T) => string
|
|
13
|
+
groupBy?: (x: T) => string
|
|
14
|
+
valueClass?: ComponentProps<"div">["class"]
|
|
15
|
+
onSelect?: (value: T | undefined) => void
|
|
16
|
+
onHighlight?: (value: T | undefined) => (() => void) | void
|
|
17
|
+
class?: ComponentProps<"div">["class"]
|
|
18
|
+
classList?: ComponentProps<"div">["classList"]
|
|
19
|
+
children?: (item: T | undefined) => JSX.Element
|
|
20
|
+
triggerStyle?: JSX.CSSProperties
|
|
21
|
+
triggerVariant?: "settings"
|
|
22
|
+
triggerProps?: Record<string, string | number | boolean | undefined>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function Select<T>(props: SelectProps<T> & Omit<ButtonProps, "children">) {
|
|
26
|
+
const [local, others] = splitProps(props, [
|
|
27
|
+
"class",
|
|
28
|
+
"classList",
|
|
29
|
+
"placeholder",
|
|
30
|
+
"options",
|
|
31
|
+
"current",
|
|
32
|
+
"value",
|
|
33
|
+
"label",
|
|
34
|
+
"groupBy",
|
|
35
|
+
"valueClass",
|
|
36
|
+
"onSelect",
|
|
37
|
+
"onHighlight",
|
|
38
|
+
"onOpenChange",
|
|
39
|
+
"children",
|
|
40
|
+
"triggerStyle",
|
|
41
|
+
"triggerVariant",
|
|
42
|
+
"triggerProps",
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
const state = {
|
|
46
|
+
key: undefined as string | undefined,
|
|
47
|
+
cleanup: undefined as (() => void) | void,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const stop = () => {
|
|
51
|
+
state.cleanup?.()
|
|
52
|
+
state.cleanup = undefined
|
|
53
|
+
state.key = undefined
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const keyFor = (item: T) => (local.value ? local.value(item) : (item as string))
|
|
57
|
+
|
|
58
|
+
const move = (item: T | undefined) => {
|
|
59
|
+
if (!local.onHighlight) return
|
|
60
|
+
if (!item) {
|
|
61
|
+
stop()
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const key = keyFor(item)
|
|
66
|
+
if (state.key === key) return
|
|
67
|
+
state.cleanup?.()
|
|
68
|
+
state.cleanup = local.onHighlight(item)
|
|
69
|
+
state.key = key
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onCleanup(stop)
|
|
73
|
+
|
|
74
|
+
const grouped = createMemo(() => {
|
|
75
|
+
const result = pipe(
|
|
76
|
+
local.options,
|
|
77
|
+
groupBy((x) => (local.groupBy ? local.groupBy(x) : "")),
|
|
78
|
+
// mapValues((x) => x.sort((a, b) => a.title.localeCompare(b.title))),
|
|
79
|
+
entries(),
|
|
80
|
+
map(([k, v]) => ({ category: k, options: v })),
|
|
81
|
+
)
|
|
82
|
+
return result
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
<Kobalte<T, { category: string; options: T[] }>
|
|
88
|
+
{...others}
|
|
89
|
+
data-component="select"
|
|
90
|
+
data-trigger-style={local.triggerVariant}
|
|
91
|
+
placement={local.triggerVariant === "settings" ? "bottom-end" : "bottom-start"}
|
|
92
|
+
gutter={4}
|
|
93
|
+
value={local.current}
|
|
94
|
+
options={grouped()}
|
|
95
|
+
optionValue={(x) => (local.value ? local.value(x) : (x as string))}
|
|
96
|
+
optionTextValue={(x) => (local.label ? local.label(x) : (x as string))}
|
|
97
|
+
optionGroupChildren="options"
|
|
98
|
+
placeholder={local.placeholder}
|
|
99
|
+
sectionComponent={(local) => (
|
|
100
|
+
<Kobalte.Section data-slot="select-section">{local.section.rawValue.category}</Kobalte.Section>
|
|
101
|
+
)}
|
|
102
|
+
itemComponent={(itemProps) => (
|
|
103
|
+
<Kobalte.Item
|
|
104
|
+
{...itemProps}
|
|
105
|
+
data-slot="select-select-item"
|
|
106
|
+
classList={{
|
|
107
|
+
...local.classList,
|
|
108
|
+
[local.class ?? ""]: !!local.class,
|
|
109
|
+
}}
|
|
110
|
+
onPointerEnter={() => move(itemProps.item.rawValue)}
|
|
111
|
+
onPointerMove={() => move(itemProps.item.rawValue)}
|
|
112
|
+
onFocus={() => move(itemProps.item.rawValue)}
|
|
113
|
+
>
|
|
114
|
+
<Kobalte.ItemLabel data-slot="select-select-item-label">
|
|
115
|
+
{local.children
|
|
116
|
+
? local.children(itemProps.item.rawValue)
|
|
117
|
+
: local.label
|
|
118
|
+
? local.label(itemProps.item.rawValue)
|
|
119
|
+
: (itemProps.item.rawValue as string)}
|
|
120
|
+
</Kobalte.ItemLabel>
|
|
121
|
+
<Kobalte.ItemIndicator data-slot="select-select-item-indicator">
|
|
122
|
+
<Icon name="check-small" size="small" />
|
|
123
|
+
</Kobalte.ItemIndicator>
|
|
124
|
+
</Kobalte.Item>
|
|
125
|
+
)}
|
|
126
|
+
onChange={(v) => {
|
|
127
|
+
local.onSelect?.(v ?? undefined)
|
|
128
|
+
stop()
|
|
129
|
+
}}
|
|
130
|
+
onOpenChange={(open) => {
|
|
131
|
+
local.onOpenChange?.(open)
|
|
132
|
+
if (!open) stop()
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<Kobalte.Trigger
|
|
136
|
+
{...local.triggerProps}
|
|
137
|
+
disabled={props.disabled}
|
|
138
|
+
data-slot="select-select-trigger"
|
|
139
|
+
as={Button}
|
|
140
|
+
size={props.size}
|
|
141
|
+
variant={props.variant}
|
|
142
|
+
style={local.triggerStyle}
|
|
143
|
+
classList={{
|
|
144
|
+
...local.classList,
|
|
145
|
+
[local.class ?? ""]: !!local.class,
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<Kobalte.Value<T> data-slot="select-select-trigger-value" class={local.valueClass}>
|
|
149
|
+
{(state) => {
|
|
150
|
+
const selected = state.selectedOption() ?? local.current
|
|
151
|
+
if (!selected) return local.placeholder || ""
|
|
152
|
+
if (local.label) return local.label(selected)
|
|
153
|
+
return selected as string
|
|
154
|
+
}}
|
|
155
|
+
</Kobalte.Value>
|
|
156
|
+
<Kobalte.Icon data-slot="select-select-trigger-icon">
|
|
157
|
+
<Icon name={local.triggerVariant === "settings" ? "selector" : "chevron-down"} size="small" />
|
|
158
|
+
</Kobalte.Icon>
|
|
159
|
+
</Kobalte.Trigger>
|
|
160
|
+
<Kobalte.Portal>
|
|
161
|
+
<Kobalte.Content
|
|
162
|
+
classList={{
|
|
163
|
+
...local.classList,
|
|
164
|
+
[local.class ?? ""]: !!local.class,
|
|
165
|
+
}}
|
|
166
|
+
data-component="select-content"
|
|
167
|
+
data-trigger-style={local.triggerVariant}
|
|
168
|
+
>
|
|
169
|
+
<Kobalte.Listbox data-slot="select-select-content-list" />
|
|
170
|
+
</Kobalte.Content>
|
|
171
|
+
</Kobalte.Portal>
|
|
172
|
+
</Kobalte>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
[data-component="switch"] {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
cursor: default;
|
|
7
|
+
|
|
8
|
+
[data-slot="switch-input"] {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: 1px;
|
|
11
|
+
height: 1px;
|
|
12
|
+
padding: 0;
|
|
13
|
+
margin: -1px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
clip: rect(0, 0, 0, 0);
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
border-width: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-slot="switch-control"] {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
width: 28px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
border-radius: 3px;
|
|
27
|
+
border: 1px solid var(--border-weak-base);
|
|
28
|
+
background: var(--surface-base);
|
|
29
|
+
transition:
|
|
30
|
+
background-color 150ms,
|
|
31
|
+
border-color 150ms;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[data-slot="switch-thumb"] {
|
|
35
|
+
width: 14px;
|
|
36
|
+
height: 14px;
|
|
37
|
+
box-sizing: content-box;
|
|
38
|
+
|
|
39
|
+
border-radius: 2px;
|
|
40
|
+
border: 1px solid var(--border-base);
|
|
41
|
+
background: var(--icon-invert-base);
|
|
42
|
+
|
|
43
|
+
/* shadows/shadow-xs */
|
|
44
|
+
box-shadow:
|
|
45
|
+
0 1px 2px -1px rgba(19, 16, 16, 0.04),
|
|
46
|
+
0 1px 2px 0 rgba(19, 16, 16, 0.06),
|
|
47
|
+
0 1px 3px 0 rgba(19, 16, 16, 0.08);
|
|
48
|
+
|
|
49
|
+
transform: translateX(-1px);
|
|
50
|
+
transition:
|
|
51
|
+
transform 150ms,
|
|
52
|
+
background-color 150ms;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-slot="switch-label"] {
|
|
56
|
+
user-select: none;
|
|
57
|
+
color: var(--text-base);
|
|
58
|
+
font-family: var(--font-family-sans);
|
|
59
|
+
font-size: var(--font-size-small);
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: var(--font-weight-regular);
|
|
62
|
+
line-height: var(--line-height-large);
|
|
63
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-slot="switch-description"] {
|
|
67
|
+
color: var(--text-base);
|
|
68
|
+
font-family: var(--font-family-sans);
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
font-weight: var(--font-weight-regular);
|
|
71
|
+
line-height: var(--line-height-normal);
|
|
72
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[data-slot="switch-error"] {
|
|
76
|
+
color: var(--text-error);
|
|
77
|
+
font-family: var(--font-family-sans);
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
font-weight: var(--font-weight-regular);
|
|
80
|
+
line-height: var(--line-height-normal);
|
|
81
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:hover:not([data-disabled], [data-readonly]) [data-slot="switch-control"] {
|
|
85
|
+
border-color: var(--border-hover);
|
|
86
|
+
background-color: var(--surface-hover);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:not([data-readonly]) [data-slot="switch-input"]:focus-visible ~ [data-slot="switch-control"] {
|
|
90
|
+
border-color: var(--border-focus);
|
|
91
|
+
box-shadow: var(--shadow-xs-border-focus);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&[data-checked] [data-slot="switch-control"] {
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
border-color: var(--icon-strong-base);
|
|
97
|
+
background-color: var(--icon-strong-base);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&[data-checked] [data-slot="switch-thumb"] {
|
|
101
|
+
border: none;
|
|
102
|
+
transform: translateX(12px);
|
|
103
|
+
background-color: var(--icon-invert-base);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:dir(rtl)[data-checked] [data-slot="switch-thumb"] {
|
|
107
|
+
transform: translateX(-12px);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&[data-checked]:hover:not([data-disabled], [data-readonly]) [data-slot="switch-control"] {
|
|
111
|
+
border-color: var(--border-hover);
|
|
112
|
+
background-color: var(--surface-hover);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&[data-disabled] {
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&[data-disabled] [data-slot="switch-control"] {
|
|
120
|
+
border-color: var(--border-disabled);
|
|
121
|
+
background-color: var(--surface-disabled);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&[data-disabled] [data-slot="switch-thumb"] {
|
|
125
|
+
background-color: var(--icon-disabled);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&[data-invalid] [data-slot="switch-control"] {
|
|
129
|
+
border-color: var(--border-error);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&[data-readonly] {
|
|
133
|
+
cursor: default;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Switch as Kobalte } from "@kobalte/core/switch"
|
|
2
|
+
import { Show, splitProps } from "solid-js"
|
|
3
|
+
import type { ComponentProps, ParentProps } from "solid-js"
|
|
4
|
+
|
|
5
|
+
export interface SwitchProps extends ParentProps<ComponentProps<typeof Kobalte>> {
|
|
6
|
+
hideLabel?: boolean
|
|
7
|
+
description?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Switch(props: SwitchProps) {
|
|
11
|
+
const [local, others] = splitProps(props, ["children", "class", "hideLabel", "description"])
|
|
12
|
+
return (
|
|
13
|
+
<Kobalte {...others} class={local.class} data-component="switch">
|
|
14
|
+
<Kobalte.Input data-slot="switch-input" />
|
|
15
|
+
<Show when={local.children}>
|
|
16
|
+
<Kobalte.Label data-slot="switch-label" classList={{ "sr-only": local.hideLabel }}>
|
|
17
|
+
{local.children}
|
|
18
|
+
</Kobalte.Label>
|
|
19
|
+
</Show>
|
|
20
|
+
<Show when={local.description}>
|
|
21
|
+
<Kobalte.Description data-slot="switch-description">{local.description}</Kobalte.Description>
|
|
22
|
+
</Show>
|
|
23
|
+
<Kobalte.ErrorMessage data-slot="switch-error" />
|
|
24
|
+
<Kobalte.Control data-slot="switch-control">
|
|
25
|
+
<Kobalte.Thumb data-slot="switch-thumb" />
|
|
26
|
+
</Kobalte.Control>
|
|
27
|
+
</Kobalte>
|
|
28
|
+
)
|
|
29
|
+
}
|