@opencode-ai/ui 0.0.0-dev-202608201855 → 0.0.0-dev-17751
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 +209 -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 +16 -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 +14 -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/{v2/components/button-v2.tsx → actions/button/button.tsx} +8 -8
- 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 +1 -1
- 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/provider-icon.tsx +1 -1
- 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/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.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.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.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 +0 -2
- package/src/i18n/ar.ts +0 -2
- package/src/i18n/az.ts +0 -2
- package/src/i18n/bg.ts +0 -2
- package/src/i18n/bn.ts +0 -2
- package/src/i18n/br.ts +0 -2
- package/src/i18n/bs.ts +0 -2
- package/src/i18n/ca.ts +0 -2
- package/src/i18n/cs.ts +0 -2
- package/src/i18n/da.ts +0 -2
- package/src/i18n/de.ts +0 -2
- package/src/i18n/dv.ts +0 -2
- package/src/i18n/dz.ts +0 -2
- package/src/i18n/el.ts +0 -2
- package/src/i18n/en.ts +18 -4
- package/src/i18n/es.ts +0 -2
- package/src/i18n/et.ts +0 -2
- package/src/i18n/fa.ts +0 -2
- package/src/i18n/fi.ts +0 -2
- package/src/i18n/fo.ts +0 -2
- package/src/i18n/fr.ts +0 -2
- package/src/i18n/he.ts +199 -0
- package/src/i18n/hi.ts +0 -2
- package/src/i18n/hr.ts +0 -2
- package/src/i18n/hu.ts +0 -2
- package/src/i18n/hy.ts +0 -2
- package/src/i18n/id.ts +0 -2
- package/src/i18n/is.ts +0 -2
- package/src/i18n/it.ts +0 -2
- package/src/i18n/ja.ts +0 -2
- package/src/i18n/ka.ts +0 -2
- package/src/i18n/km.ts +0 -2
- package/src/i18n/ko.ts +0 -2
- package/src/i18n/lo.ts +0 -2
- package/src/i18n/lt.ts +0 -2
- package/src/i18n/lv.ts +0 -2
- package/src/i18n/mk.ts +0 -2
- package/src/i18n/mn.ts +0 -2
- package/src/i18n/ms.ts +0 -2
- package/src/i18n/my.ts +0 -2
- package/src/i18n/ne.ts +0 -2
- package/src/i18n/nl.ts +0 -2
- package/src/i18n/no.ts +0 -2
- package/src/i18n/pa.ts +0 -2
- package/src/i18n/pl.ts +0 -2
- package/src/i18n/ro.ts +0 -2
- package/src/i18n/ru.ts +0 -2
- package/src/i18n/si.ts +0 -2
- package/src/i18n/sk.ts +0 -2
- package/src/i18n/sl.ts +0 -2
- package/src/i18n/sq.ts +0 -2
- package/src/i18n/sr.ts +0 -2
- package/src/i18n/sv.ts +0 -2
- package/src/i18n/tg.ts +0 -2
- package/src/i18n/th.ts +0 -2
- package/src/i18n/tk.ts +0 -2
- package/src/i18n/tr.ts +0 -2
- package/src/i18n/uk.ts +0 -2
- package/src/i18n/ur.ts +0 -2
- package/src/i18n/uz.ts +0 -2
- package/src/i18n/vi.ts +0 -2
- package/src/i18n/zh.ts +0 -2
- package/src/i18n/zht.ts +0 -2
- 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 +42 -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} +121 -0
- package/src/{v2/components/menu-v2.tsx → navigation/menu/menu.tsx} +96 -32
- 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} +24 -9
- 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} +18 -14
- package/src/styles/index.css +4 -20
- package/src/styles/tailwind/index.css +15 -1
- package/src/{v2/styles → styles/tokens}/theme.css +0 -12
- package/src/theme/context.tsx +19 -11
- package/src/theme/themes/oc-2.json +1 -1
- 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/button.tsx +0 -33
- 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/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/line-comment-v2.css → data-display/line-comment/line-comment.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/{v2/components/field-v2.css → forms/field/field.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/text-input-v2.css → forms/text-input/text-input.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/segmented-control-v2.css → navigation/segmented-control/segmented-control.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,174 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
package/src/components/tabs.tsx
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Tabs as Kobalte } from "@kobalte/core/tabs"
|
|
2
|
-
import { Show, splitProps, type JSX } from "solid-js"
|
|
3
|
-
import type { ComponentProps, ParentProps, Component } from "solid-js"
|
|
4
|
-
|
|
5
|
-
export interface TabsProps extends ComponentProps<typeof Kobalte> {
|
|
6
|
-
variant?: "normal" | "alt" | "pill" | "settings"
|
|
7
|
-
orientation?: "horizontal" | "vertical"
|
|
8
|
-
}
|
|
9
|
-
export interface TabsListProps extends ComponentProps<typeof Kobalte.List> {}
|
|
10
|
-
export interface TabsTriggerProps extends ComponentProps<typeof Kobalte.Trigger> {
|
|
11
|
-
classes?: {
|
|
12
|
-
button?: string
|
|
13
|
-
}
|
|
14
|
-
hideCloseButton?: boolean
|
|
15
|
-
closeButton?: JSX.Element
|
|
16
|
-
onMiddleClick?: () => void
|
|
17
|
-
}
|
|
18
|
-
export interface TabsContentProps extends ComponentProps<typeof Kobalte.Content> {}
|
|
19
|
-
|
|
20
|
-
function TabsRoot(props: TabsProps) {
|
|
21
|
-
const [split, rest] = splitProps(props, ["class", "classList", "variant", "orientation"])
|
|
22
|
-
return (
|
|
23
|
-
<Kobalte
|
|
24
|
-
{...rest}
|
|
25
|
-
orientation={split.orientation}
|
|
26
|
-
data-component="tabs"
|
|
27
|
-
data-variant={split.variant || "normal"}
|
|
28
|
-
data-orientation={split.orientation || "horizontal"}
|
|
29
|
-
classList={{
|
|
30
|
-
...split.classList,
|
|
31
|
-
[split.class ?? ""]: !!split.class,
|
|
32
|
-
}}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function TabsList(props: TabsListProps) {
|
|
38
|
-
const [split, rest] = splitProps(props, ["class", "classList"])
|
|
39
|
-
return (
|
|
40
|
-
<Kobalte.List
|
|
41
|
-
{...rest}
|
|
42
|
-
data-slot="tabs-list"
|
|
43
|
-
classList={{
|
|
44
|
-
...split.classList,
|
|
45
|
-
[split.class ?? ""]: !!split.class,
|
|
46
|
-
}}
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function TabsTrigger(props: ParentProps<TabsTriggerProps>) {
|
|
52
|
-
const [split, rest] = splitProps(props, [
|
|
53
|
-
"class",
|
|
54
|
-
"classList",
|
|
55
|
-
"classes",
|
|
56
|
-
"children",
|
|
57
|
-
"closeButton",
|
|
58
|
-
"hideCloseButton",
|
|
59
|
-
"onMiddleClick",
|
|
60
|
-
])
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
data-slot="tabs-trigger-wrapper"
|
|
64
|
-
data-value={props.value}
|
|
65
|
-
classList={{
|
|
66
|
-
...split.classList,
|
|
67
|
-
[split.class ?? ""]: !!split.class,
|
|
68
|
-
}}
|
|
69
|
-
onMouseDown={(e) => {
|
|
70
|
-
if (e.button === 1 && split.onMiddleClick) {
|
|
71
|
-
e.preventDefault()
|
|
72
|
-
}
|
|
73
|
-
}}
|
|
74
|
-
onAuxClick={(e) => {
|
|
75
|
-
if (e.button === 1 && split.onMiddleClick) {
|
|
76
|
-
e.preventDefault()
|
|
77
|
-
split.onMiddleClick()
|
|
78
|
-
}
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
<Kobalte.Trigger
|
|
82
|
-
{...rest}
|
|
83
|
-
dir={rest.dir ?? "auto"}
|
|
84
|
-
data-slot="tabs-trigger"
|
|
85
|
-
data-value={props.value}
|
|
86
|
-
classList={{ [split.classes?.button ?? ""]: split.classes?.button }}
|
|
87
|
-
>
|
|
88
|
-
{split.children}
|
|
89
|
-
</Kobalte.Trigger>
|
|
90
|
-
<Show when={split.closeButton}>
|
|
91
|
-
{(closeButton) => (
|
|
92
|
-
<div data-slot="tabs-trigger-close-button" data-hidden={split.hideCloseButton}>
|
|
93
|
-
{closeButton()}
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
</Show>
|
|
97
|
-
</div>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function TabsContent(props: ParentProps<TabsContentProps>) {
|
|
102
|
-
const [split, rest] = splitProps(props, ["class", "classList", "children"])
|
|
103
|
-
return (
|
|
104
|
-
<Kobalte.Content
|
|
105
|
-
{...rest}
|
|
106
|
-
data-slot="tabs-content"
|
|
107
|
-
classList={{
|
|
108
|
-
...split.classList,
|
|
109
|
-
[split.class ?? ""]: !!split.class,
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
{split.children}
|
|
113
|
-
</Kobalte.Content>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const TabsSectionTitle: Component<ParentProps> = (props) => {
|
|
118
|
-
return <div data-slot="tabs-section-title">{props.children}</div>
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export const Tabs = Object.assign(TabsRoot, {
|
|
122
|
-
List: TabsList,
|
|
123
|
-
Trigger: TabsTrigger,
|
|
124
|
-
Content: TabsContent,
|
|
125
|
-
SectionTitle: TabsSectionTitle,
|
|
126
|
-
})
|
package/src/components/tag.css
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
[data-component="tag"] {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
user-select: none;
|
|
6
|
-
|
|
7
|
-
border-radius: var(--radius-xs);
|
|
8
|
-
border: 0.5px solid var(--border-weak-base);
|
|
9
|
-
background: var(--surface-raised-base);
|
|
10
|
-
color: var(--text-base);
|
|
11
|
-
|
|
12
|
-
&[data-size="normal"] {
|
|
13
|
-
height: 18px;
|
|
14
|
-
padding: 0 6px;
|
|
15
|
-
|
|
16
|
-
/* text-12-medium */
|
|
17
|
-
font-family: var(--font-family-sans);
|
|
18
|
-
font-size: var(--font-size-small);
|
|
19
|
-
font-style: normal;
|
|
20
|
-
font-weight: var(--font-weight-medium);
|
|
21
|
-
line-height: var(--line-height-large); /* 166.667% */
|
|
22
|
-
letter-spacing: var(--letter-spacing-normal);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&[data-size="large"] {
|
|
26
|
-
height: 22px;
|
|
27
|
-
padding: 0 8px;
|
|
28
|
-
|
|
29
|
-
/* text-14-medium */
|
|
30
|
-
font-family: var(--font-family-sans);
|
|
31
|
-
font-size: 14px;
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-weight: var(--font-weight-medium);
|
|
34
|
-
line-height: var(--line-height-large); /* 142.857% */
|
|
35
|
-
letter-spacing: var(--letter-spacing-normal);
|
|
36
|
-
}
|
|
37
|
-
}
|
package/src/components/tag.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type ComponentProps, splitProps } from "solid-js"
|
|
2
|
-
|
|
3
|
-
export interface TagProps extends ComponentProps<"span"> {
|
|
4
|
-
size?: "normal" | "large"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function Tag(props: TagProps) {
|
|
8
|
-
const [split, rest] = splitProps(props, ["size", "class", "classList", "children"])
|
|
9
|
-
return (
|
|
10
|
-
<span
|
|
11
|
-
{...rest}
|
|
12
|
-
data-component="tag"
|
|
13
|
-
data-size={split.size || "normal"}
|
|
14
|
-
classList={{
|
|
15
|
-
...split.classList,
|
|
16
|
-
[split.class ?? ""]: !!split.class,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
{split.children}
|
|
20
|
-
</span>
|
|
21
|
-
)
|
|
22
|
-
}
|