@opencode-ai/ui 0.0.0-dev-202609040530 → 0.0.0-dev-19079
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/context/marked-base.d.ts +3 -0
- package/dist/context/marked-parser.d.ts +1 -2
- 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/hooks/use-filtered-list.d.ts +9 -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 +238 -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 +44 -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 +140 -34
- package/src/{v2/components/button-v2.css → actions/button/button.css} +29 -0
- package/src/{components → actions/button}/button.tsx +19 -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} +2 -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/context/marked-base.tsx +27 -0
- package/src/context/marked-parser.tsx +3 -13
- package/src/{components → data-display/accordion}/accordion.css +5 -31
- 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} +4 -4
- 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} +40 -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} +3 -3
- 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 +7 -9
- package/src/i18n/ar.ts +7 -9
- package/src/i18n/az.ts +7 -9
- package/src/i18n/bg.ts +7 -9
- package/src/i18n/bn.ts +7 -9
- package/src/i18n/br.ts +7 -9
- package/src/i18n/bs.ts +7 -9
- package/src/i18n/ca.ts +7 -9
- package/src/i18n/cs.ts +7 -9
- package/src/i18n/da.ts +7 -9
- package/src/i18n/de.ts +1 -3
- package/src/i18n/dv.ts +7 -9
- package/src/i18n/dz.ts +5 -7
- package/src/i18n/el.ts +7 -9
- package/src/i18n/en.ts +54 -11
- package/src/i18n/es.ts +6 -8
- package/src/i18n/et.ts +7 -9
- package/src/i18n/fa.ts +7 -9
- package/src/i18n/fi.ts +7 -9
- package/src/i18n/fo.ts +7 -9
- package/src/i18n/fr.ts +6 -8
- package/src/i18n/he.ts +199 -0
- package/src/i18n/hi.ts +7 -9
- package/src/i18n/hr.ts +7 -9
- package/src/i18n/hu.ts +7 -9
- package/src/i18n/hy.ts +7 -9
- package/src/i18n/id.ts +7 -9
- package/src/i18n/is.ts +7 -9
- package/src/i18n/it.ts +7 -9
- package/src/i18n/ja.ts +7 -9
- package/src/i18n/ka.ts +7 -9
- package/src/i18n/km.ts +7 -9
- package/src/i18n/ko.ts +7 -9
- package/src/i18n/lo.ts +7 -9
- package/src/i18n/lt.ts +7 -9
- package/src/i18n/lv.ts +7 -9
- package/src/i18n/mk.ts +7 -9
- package/src/i18n/mn.ts +7 -9
- package/src/i18n/ms.ts +7 -9
- package/src/i18n/my.ts +7 -9
- package/src/i18n/ne.ts +7 -9
- package/src/i18n/nl.ts +7 -9
- package/src/i18n/no.ts +7 -9
- package/src/i18n/pa.ts +7 -9
- package/src/i18n/pl.ts +7 -9
- package/src/i18n/ro.ts +7 -9
- package/src/i18n/ru.ts +7 -9
- package/src/i18n/si.ts +7 -9
- package/src/i18n/sk.ts +7 -9
- package/src/i18n/sl.ts +7 -9
- package/src/i18n/sq.ts +7 -9
- package/src/i18n/sr.ts +7 -9
- package/src/i18n/sv.ts +7 -9
- package/src/i18n/tg.ts +7 -9
- package/src/i18n/th.ts +7 -9
- package/src/i18n/tk.ts +7 -9
- package/src/i18n/tr.ts +7 -9
- package/src/i18n/uk.ts +7 -9
- package/src/i18n/ur.ts +7 -9
- package/src/i18n/uz.ts +7 -9
- package/src/i18n/vi.ts +7 -9
- package/src/i18n/zh.ts +7 -9
- package/src/i18n/zht.ts +7 -9
- 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 +80 -12
- package/src/{v2/components/divider-v2.tsx → layout/divider/divider.tsx} +3 -3
- package/src/{v2/components/menu-v2.css → navigation/menu/menu.css} +124 -2
- 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 +53 -232
- 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} +24 -17
- package/src/styles/base.css +5 -0
- 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}/colors.css +8 -8
- package/src/{v2/styles → styles/tokens}/theme.css +20 -16
- package/src/theme/context.tsx +19 -11
- package/src/theme/themes/oc-2.json +48 -19
- package/src/theme/v2/default-primitives.ts +8 -8
- package/src/theme/v2/foreground.ts +1 -0
- package/src/theme/v2/mapping.ts +5 -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} +2 -2
- 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/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/tailwind.css → styles/tokens/index.css} +0 -0
package/src/components/toast.tsx
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { Toast as Kobalte, toaster } from "@kobalte/core/toast"
|
|
2
|
-
import type { ToastRootProps, ToastCloseButtonProps, ToastTitleProps, ToastDescriptionProps } from "@kobalte/core/toast"
|
|
3
|
-
import type { ComponentProps, JSX } from "solid-js"
|
|
4
|
-
import { Show } from "solid-js"
|
|
5
|
-
import { Portal } from "solid-js/web"
|
|
6
|
-
import { useI18n } from "../context/i18n"
|
|
7
|
-
import { Icon, type IconProps } from "./icon"
|
|
8
|
-
import { IconButton } from "./icon-button"
|
|
9
|
-
|
|
10
|
-
export interface ToastRegionProps extends ComponentProps<typeof Kobalte.Region> {}
|
|
11
|
-
|
|
12
|
-
function ToastRegion(props: ToastRegionProps) {
|
|
13
|
-
return (
|
|
14
|
-
<Portal>
|
|
15
|
-
<Kobalte.Region data-component="toast-region" {...props}>
|
|
16
|
-
<Kobalte.List data-slot="toast-list" />
|
|
17
|
-
</Kobalte.Region>
|
|
18
|
-
</Portal>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ToastRootComponentProps extends ToastRootProps {
|
|
23
|
-
class?: string
|
|
24
|
-
classList?: ComponentProps<"li">["classList"]
|
|
25
|
-
children?: JSX.Element
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function ToastRoot(props: ToastRootComponentProps) {
|
|
29
|
-
return (
|
|
30
|
-
<Kobalte
|
|
31
|
-
data-component="toast"
|
|
32
|
-
classList={{
|
|
33
|
-
...props.classList,
|
|
34
|
-
[props.class ?? ""]: !!props.class,
|
|
35
|
-
}}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function ToastIcon(props: { name: IconProps["name"] }) {
|
|
42
|
-
return (
|
|
43
|
-
<div data-slot="toast-icon">
|
|
44
|
-
<Icon name={props.name} />
|
|
45
|
-
</div>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function ToastContent(props: ComponentProps<"div">) {
|
|
50
|
-
return <div data-slot="toast-content" {...props} />
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function ToastTitle(props: ToastTitleProps & ComponentProps<"div">) {
|
|
54
|
-
return <Kobalte.Title data-slot="toast-title" {...props} />
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function ToastDescription(props: ToastDescriptionProps & ComponentProps<"div">) {
|
|
58
|
-
return <Kobalte.Description data-slot="toast-description" {...props} />
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function ToastActions(props: ComponentProps<"div">) {
|
|
62
|
-
return <div data-slot="toast-actions" {...props} />
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function ToastCloseButton(props: ToastCloseButtonProps & ComponentProps<"button">) {
|
|
66
|
-
const i18n = useI18n()
|
|
67
|
-
return (
|
|
68
|
-
<Kobalte.CloseButton
|
|
69
|
-
data-slot="toast-close-button"
|
|
70
|
-
as={IconButton}
|
|
71
|
-
icon="close"
|
|
72
|
-
variant="ghost"
|
|
73
|
-
aria-label={i18n.t("ui.common.dismiss")}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function ToastProgressTrack(props: ComponentProps<typeof Kobalte.ProgressTrack>) {
|
|
80
|
-
return <Kobalte.ProgressTrack data-slot="toast-progress-track" {...props} />
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function ToastProgressFill(props: ComponentProps<typeof Kobalte.ProgressFill>) {
|
|
84
|
-
return <Kobalte.ProgressFill data-slot="toast-progress-fill" {...props} />
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const Toast = Object.assign(ToastRoot, {
|
|
88
|
-
Region: ToastRegion,
|
|
89
|
-
Icon: ToastIcon,
|
|
90
|
-
Content: ToastContent,
|
|
91
|
-
Title: ToastTitle,
|
|
92
|
-
Description: ToastDescription,
|
|
93
|
-
Actions: ToastActions,
|
|
94
|
-
CloseButton: ToastCloseButton,
|
|
95
|
-
ProgressTrack: ToastProgressTrack,
|
|
96
|
-
ProgressFill: ToastProgressFill,
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
export { toaster }
|
|
100
|
-
|
|
101
|
-
export type ToastVariant = "default" | "success" | "error" | "loading"
|
|
102
|
-
|
|
103
|
-
export interface ToastAction {
|
|
104
|
-
label: string
|
|
105
|
-
onClick: "dismiss" | (() => void)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface ToastOptions {
|
|
109
|
-
title?: string
|
|
110
|
-
description?: string
|
|
111
|
-
icon?: IconProps["name"]
|
|
112
|
-
variant?: ToastVariant
|
|
113
|
-
duration?: number
|
|
114
|
-
persistent?: boolean
|
|
115
|
-
actions?: ToastAction[]
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function showToast(options: ToastOptions | string) {
|
|
119
|
-
const opts = typeof options === "string" ? { description: options } : options
|
|
120
|
-
return toaster.show((props) => (
|
|
121
|
-
<Toast
|
|
122
|
-
toastId={props.toastId}
|
|
123
|
-
duration={opts.duration}
|
|
124
|
-
persistent={opts.persistent}
|
|
125
|
-
data-variant={opts.variant ?? "default"}
|
|
126
|
-
>
|
|
127
|
-
<Show when={opts.icon}>
|
|
128
|
-
<Toast.Icon name={opts.icon!} />
|
|
129
|
-
</Show>
|
|
130
|
-
<Toast.Content>
|
|
131
|
-
<Show when={opts.title}>
|
|
132
|
-
<Toast.Title>{opts.title}</Toast.Title>
|
|
133
|
-
</Show>
|
|
134
|
-
<Show when={opts.description}>
|
|
135
|
-
<Toast.Description>{opts.description}</Toast.Description>
|
|
136
|
-
</Show>
|
|
137
|
-
<Show when={opts.actions?.length}>
|
|
138
|
-
<Toast.Actions>
|
|
139
|
-
{opts.actions!.map((action) => (
|
|
140
|
-
<button
|
|
141
|
-
data-slot="toast-action"
|
|
142
|
-
onClick={() => {
|
|
143
|
-
if (typeof action.onClick === "function") {
|
|
144
|
-
action.onClick()
|
|
145
|
-
}
|
|
146
|
-
toaster.dismiss(props.toastId)
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
{action.label}
|
|
150
|
-
</button>
|
|
151
|
-
))}
|
|
152
|
-
</Toast.Actions>
|
|
153
|
-
</Show>
|
|
154
|
-
</Toast.Content>
|
|
155
|
-
<Toast.CloseButton />
|
|
156
|
-
</Toast>
|
|
157
|
-
))
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface ToastPromiseOptions<T, U = unknown> {
|
|
161
|
-
loading?: JSX.Element
|
|
162
|
-
success?: (data: T) => JSX.Element
|
|
163
|
-
error?: (error: U) => JSX.Element
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function showPromiseToast<T, U = unknown>(
|
|
167
|
-
promise: Promise<T> | (() => Promise<T>),
|
|
168
|
-
options: ToastPromiseOptions<T, U>,
|
|
169
|
-
) {
|
|
170
|
-
return toaster.promise(promise, (props) => (
|
|
171
|
-
<Toast
|
|
172
|
-
toastId={props.toastId}
|
|
173
|
-
data-variant={props.state === "pending" ? "loading" : props.state === "fulfilled" ? "success" : "error"}
|
|
174
|
-
>
|
|
175
|
-
<Toast.Content>
|
|
176
|
-
<Toast.Description>
|
|
177
|
-
{props.state === "pending" && options.loading}
|
|
178
|
-
{props.state === "fulfilled" && options.success?.(props.data!)}
|
|
179
|
-
{props.state === "rejected" && options.error?.(props.error)}
|
|
180
|
-
</Toast.Description>
|
|
181
|
-
</Toast.Content>
|
|
182
|
-
<Toast.CloseButton />
|
|
183
|
-
</Toast>
|
|
184
|
-
))
|
|
185
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
[data-component="tooltip-trigger"] {
|
|
2
|
-
display: flex;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
[data-slot="tooltip-keybind"] {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
gap: 12px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
[data-slot="tooltip-keybind-key"] {
|
|
12
|
-
color: var(--text-invert-base);
|
|
13
|
-
font-size: var(--font-size-small);
|
|
14
|
-
font-weight: var(--font-weight-medium);
|
|
15
|
-
line-height: var(--line-height-large);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[data-component="tooltip"] {
|
|
19
|
-
z-index: 1000;
|
|
20
|
-
max-width: 320px;
|
|
21
|
-
border-radius: var(--radius-sm);
|
|
22
|
-
background-color: var(--surface-float-base);
|
|
23
|
-
color: var(--text-invert-strong);
|
|
24
|
-
background: var(--surface-float-base);
|
|
25
|
-
padding: 2px 8px;
|
|
26
|
-
border: 1px solid var(--border-weak-base, rgba(0, 0, 0, 0.07));
|
|
27
|
-
|
|
28
|
-
box-shadow: var(--shadow-md);
|
|
29
|
-
pointer-events: none !important;
|
|
30
|
-
/* transition: all 150ms ease-out; */
|
|
31
|
-
/* transform: translate3d(0, 0, 0); */
|
|
32
|
-
/* transform-origin: var(--kb-tooltip-content-transform-origin); */
|
|
33
|
-
|
|
34
|
-
/* text-12-medium */
|
|
35
|
-
font-family: var(--font-family-sans);
|
|
36
|
-
font-size: var(--font-size-small);
|
|
37
|
-
font-style: normal;
|
|
38
|
-
font-weight: var(--font-weight-medium);
|
|
39
|
-
line-height: var(--line-height-large); /* 166.667% */
|
|
40
|
-
letter-spacing: var(--letter-spacing-normal);
|
|
41
|
-
|
|
42
|
-
&[data-expanded] {
|
|
43
|
-
opacity: 1;
|
|
44
|
-
/* transform: translate3d(0, 0, 0); */
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&[data-closed]:not([data-force-open="true"]) {
|
|
48
|
-
opacity: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* &[data-placement="top"] { */
|
|
52
|
-
/* &[data-closed] { */
|
|
53
|
-
/* transform: translate3d(0, 4px, 0); */
|
|
54
|
-
/* } */
|
|
55
|
-
/* } */
|
|
56
|
-
/**/
|
|
57
|
-
/* &[data-placement="bottom"] { */
|
|
58
|
-
/* &[data-closed] { */
|
|
59
|
-
/* transform: translate3d(0, -4px, 0); */
|
|
60
|
-
/* } */
|
|
61
|
-
/* } */
|
|
62
|
-
/**/
|
|
63
|
-
/* &[data-placement="left"] { */
|
|
64
|
-
/* &[data-closed] { */
|
|
65
|
-
/* transform: translate3d(4px, 0, 0); */
|
|
66
|
-
/* } */
|
|
67
|
-
/* } */
|
|
68
|
-
/**/
|
|
69
|
-
/* &[data-placement="right"] { */
|
|
70
|
-
/* &[data-closed] { */
|
|
71
|
-
/* transform: translate3d(-4px, 0, 0); */
|
|
72
|
-
/* } */
|
|
73
|
-
/* } */
|
|
74
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Tooltip as KobalteTooltip } from "@kobalte/core/tooltip"
|
|
2
|
-
import { createEffect, Match, onCleanup, splitProps, Switch, type JSX } from "solid-js"
|
|
3
|
-
import type { ComponentProps } from "solid-js"
|
|
4
|
-
import { createStore } from "solid-js/store"
|
|
5
|
-
|
|
6
|
-
export interface TooltipProps extends ComponentProps<typeof KobalteTooltip> {
|
|
7
|
-
value: JSX.Element
|
|
8
|
-
class?: string
|
|
9
|
-
contentClass?: string
|
|
10
|
-
contentStyle?: JSX.CSSProperties
|
|
11
|
-
inactive?: boolean
|
|
12
|
-
forceOpen?: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface TooltipKeybindProps extends Omit<TooltipProps, "value"> {
|
|
16
|
-
title: string
|
|
17
|
-
keybind: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function TooltipKeybind(props: TooltipKeybindProps) {
|
|
21
|
-
const [local, others] = splitProps(props, ["title", "keybind"])
|
|
22
|
-
return (
|
|
23
|
-
<Tooltip
|
|
24
|
-
{...others}
|
|
25
|
-
value={
|
|
26
|
-
<div data-slot="tooltip-keybind">
|
|
27
|
-
<span>{local.title}</span>
|
|
28
|
-
<span data-slot="tooltip-keybind-key">{local.keybind}</span>
|
|
29
|
-
</div>
|
|
30
|
-
}
|
|
31
|
-
/>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function Tooltip(props: TooltipProps) {
|
|
36
|
-
let ref: HTMLDivElement | undefined
|
|
37
|
-
const [state, setState] = createStore({
|
|
38
|
-
open: false,
|
|
39
|
-
block: false,
|
|
40
|
-
expand: false,
|
|
41
|
-
})
|
|
42
|
-
const [local, others] = splitProps(props, [
|
|
43
|
-
"children",
|
|
44
|
-
"class",
|
|
45
|
-
"contentClass",
|
|
46
|
-
"contentStyle",
|
|
47
|
-
"inactive",
|
|
48
|
-
"forceOpen",
|
|
49
|
-
"ignoreSafeArea",
|
|
50
|
-
"value",
|
|
51
|
-
])
|
|
52
|
-
|
|
53
|
-
const close = () => setState("open", false)
|
|
54
|
-
|
|
55
|
-
const inside = () => {
|
|
56
|
-
const active = document.activeElement
|
|
57
|
-
if (!ref || !active) return false
|
|
58
|
-
return ref.contains(active)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const drop = (expand = state.expand) => {
|
|
62
|
-
if (expand) return
|
|
63
|
-
if (ref?.matches(":hover")) return
|
|
64
|
-
if (inside()) return
|
|
65
|
-
setState("block", false)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const sync = () => {
|
|
69
|
-
const expand = !!ref?.querySelector('[aria-expanded="true"], [data-expanded]')
|
|
70
|
-
setState("expand", expand)
|
|
71
|
-
if (expand) {
|
|
72
|
-
setState("block", true)
|
|
73
|
-
close()
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
drop(expand)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const arm = () => {
|
|
80
|
-
setState("block", true)
|
|
81
|
-
close()
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const leave = () => {
|
|
85
|
-
if (!inside()) close()
|
|
86
|
-
drop()
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
createEffect(() => {
|
|
90
|
-
if (!ref) return
|
|
91
|
-
sync()
|
|
92
|
-
const obs = new MutationObserver(sync)
|
|
93
|
-
obs.observe(ref, {
|
|
94
|
-
subtree: true,
|
|
95
|
-
childList: true,
|
|
96
|
-
attributes: true,
|
|
97
|
-
attributeFilter: ["aria-expanded", "data-expanded"],
|
|
98
|
-
})
|
|
99
|
-
onCleanup(() => obs.disconnect())
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
let justClickedTrigger = false
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<Switch>
|
|
106
|
-
<Match when={local.inactive}>{local.children}</Match>
|
|
107
|
-
<Match when={true}>
|
|
108
|
-
<KobalteTooltip
|
|
109
|
-
gutter={4}
|
|
110
|
-
openDelay={400}
|
|
111
|
-
skipDelayDuration={300}
|
|
112
|
-
{...others}
|
|
113
|
-
closeDelay={0}
|
|
114
|
-
ignoreSafeArea={local.ignoreSafeArea ?? true}
|
|
115
|
-
open={local.forceOpen || state.open}
|
|
116
|
-
onOpenChange={(open) => {
|
|
117
|
-
if (local.forceOpen) return
|
|
118
|
-
if (state.block && open) return
|
|
119
|
-
if (justClickedTrigger) {
|
|
120
|
-
justClickedTrigger = false
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
setState("open", open)
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<KobalteTooltip.Trigger
|
|
127
|
-
ref={ref}
|
|
128
|
-
as={"div"}
|
|
129
|
-
data-component="tooltip-trigger"
|
|
130
|
-
class={local.class}
|
|
131
|
-
onPointerDownCapture={arm}
|
|
132
|
-
onKeyDownCapture={(event: KeyboardEvent) => {
|
|
133
|
-
if (event.key !== "Enter" && event.key !== " ") return
|
|
134
|
-
arm()
|
|
135
|
-
}}
|
|
136
|
-
onPointerLeave={leave}
|
|
137
|
-
onFocusOut={() => requestAnimationFrame(() => drop())}
|
|
138
|
-
>
|
|
139
|
-
{local.children}
|
|
140
|
-
</KobalteTooltip.Trigger>
|
|
141
|
-
<KobalteTooltip.Portal>
|
|
142
|
-
<KobalteTooltip.Content
|
|
143
|
-
data-component="tooltip"
|
|
144
|
-
data-placement={props.placement}
|
|
145
|
-
data-force-open={local.forceOpen}
|
|
146
|
-
class={local.contentClass}
|
|
147
|
-
style={local.contentStyle}
|
|
148
|
-
onPointerDownOutside={(e) => {
|
|
149
|
-
if (ref === e.target || (e.target instanceof Node && ref?.contains(e.target))) {
|
|
150
|
-
justClickedTrigger = true
|
|
151
|
-
}
|
|
152
|
-
e.preventDefault()
|
|
153
|
-
}}
|
|
154
|
-
>
|
|
155
|
-
{local.value}
|
|
156
|
-
{/* <KobalteTooltip.Arrow data-slot="tooltip-arrow" /> */}
|
|
157
|
-
</KobalteTooltip.Content>
|
|
158
|
-
</KobalteTooltip.Portal>
|
|
159
|
-
</KobalteTooltip>
|
|
160
|
-
</Match>
|
|
161
|
-
</Switch>
|
|
162
|
-
)
|
|
163
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
[data-component="accordion-v2"] {
|
|
2
|
-
--accordion-v2-fg: var(--v2-text-text-base);
|
|
3
|
-
--accordion-v2-icon: var(--v2-icon-icon-base);
|
|
4
|
-
--accordion-v2-border: var(--v2-border-border-strong);
|
|
5
|
-
--accordion-v2-bg: var(--v2-background-bg-base);
|
|
6
|
-
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
align-items: stretch;
|
|
11
|
-
|
|
12
|
-
width: 100%;
|
|
13
|
-
background: var(--accordion-v2-bg);
|
|
14
|
-
border-radius: 6px;
|
|
15
|
-
box-shadow: 0 0 0 0.5px var(--accordion-v2-border);
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
|
|
18
|
-
color: var(--accordion-v2-fg);
|
|
19
|
-
|
|
20
|
-
-webkit-font-smoothing: antialiased;
|
|
21
|
-
-moz-osx-font-smoothing: grayscale;
|
|
22
|
-
text-rendering: geometricPrecision;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[data-component="accordion-v2-item"] {
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
align-items: stretch;
|
|
30
|
-
width: 100%;
|
|
31
|
-
background: var(--accordion-v2-bg);
|
|
32
|
-
box-shadow: inset 0 -0.5px 0 var(--accordion-v2-border);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-component="accordion-v2-item"]:last-child {
|
|
36
|
-
box-shadow: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
[data-slot="accordion-v2-header"] {
|
|
40
|
-
display: flex;
|
|
41
|
-
margin: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
[data-component="accordion-v2-trigger"] {
|
|
45
|
-
box-sizing: border-box;
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: row;
|
|
48
|
-
align-items: center;
|
|
49
|
-
gap: 4px;
|
|
50
|
-
|
|
51
|
-
width: 100%;
|
|
52
|
-
min-height: 30px;
|
|
53
|
-
padding: 0 12px;
|
|
54
|
-
|
|
55
|
-
background: transparent;
|
|
56
|
-
border: 0;
|
|
57
|
-
outline: none;
|
|
58
|
-
cursor: default;
|
|
59
|
-
user-select: none;
|
|
60
|
-
|
|
61
|
-
font-size: 13px;
|
|
62
|
-
font-weight: 440;
|
|
63
|
-
line-height: 100%;
|
|
64
|
-
letter-spacing: -0.04px;
|
|
65
|
-
color: var(--accordion-v2-fg);
|
|
66
|
-
text-align: left;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
[data-component="accordion-v2-trigger"] [data-slot="accordion-v2-trigger-content"] {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex: 1 1 auto;
|
|
72
|
-
flex-direction: row;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 8px;
|
|
75
|
-
min-width: 0;
|
|
76
|
-
height: 30px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[data-component="accordion-v2-trigger"] [data-slot="accordion-v2-chevron"] {
|
|
80
|
-
flex: none;
|
|
81
|
-
width: 14px;
|
|
82
|
-
height: 14px;
|
|
83
|
-
color: var(--accordion-v2-icon);
|
|
84
|
-
transition: transform 150ms ease;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
[data-component="accordion-v2-trigger"][data-expanded] [data-slot="accordion-v2-chevron"] {
|
|
88
|
-
transform: rotate(180deg);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
[data-component="accordion-v2-item"][data-expanded] [data-component="accordion-v2-trigger"] {
|
|
92
|
-
box-shadow: inset 0 -0.5px 0 var(--accordion-v2-border);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
[data-component="accordion-v2-trigger"][data-disabled] {
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
opacity: 0.5;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
[data-component="accordion-v2-content"] {
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
font-size: 13px;
|
|
103
|
-
line-height: 140%;
|
|
104
|
-
color: var(--accordion-v2-fg);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
[data-component="accordion-v2-content"][data-expanded] {
|
|
108
|
-
animation: accordion-v2-down 180ms ease-out;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[data-component="accordion-v2-content"][data-closed] {
|
|
112
|
-
animation: accordion-v2-up 180ms ease-out;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
[data-component="accordion-v2-content"] [data-slot="accordion-v2-content-inner"] {
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: row;
|
|
118
|
-
align-items: flex-start;
|
|
119
|
-
width: 100%;
|
|
120
|
-
padding: 12px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@keyframes accordion-v2-down {
|
|
124
|
-
from {
|
|
125
|
-
height: 0;
|
|
126
|
-
}
|
|
127
|
-
to {
|
|
128
|
-
height: var(--kb-collapsible-content-height);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
@keyframes accordion-v2-up {
|
|
133
|
-
from {
|
|
134
|
-
height: var(--kb-collapsible-content-height);
|
|
135
|
-
}
|
|
136
|
-
to {
|
|
137
|
-
height: 0;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Accordion as Kobalte } from "@kobalte/core/accordion"
|
|
2
|
-
import { Show, splitProps, type Component, type ComponentProps, type ParentProps } from "solid-js"
|
|
3
|
-
import "./accordion-v2.css"
|
|
4
|
-
|
|
5
|
-
const ChevronDown: Component = () => (
|
|
6
|
-
<svg
|
|
7
|
-
data-slot="accordion-v2-chevron"
|
|
8
|
-
width="14"
|
|
9
|
-
height="14"
|
|
10
|
-
viewBox="0 0 14 14"
|
|
11
|
-
fill="none"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
>
|
|
15
|
-
<path d="M4 5.5L7 8.5L10 5.5" stroke="currentColor" />
|
|
16
|
-
</svg>
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
export interface AccordionV2Props extends ComponentProps<typeof Kobalte> {}
|
|
20
|
-
export interface AccordionV2ItemProps extends ComponentProps<typeof Kobalte.Item> {}
|
|
21
|
-
export interface AccordionV2HeaderProps extends ComponentProps<typeof Kobalte.Header> {}
|
|
22
|
-
export interface AccordionV2TriggerProps extends ComponentProps<typeof Kobalte.Trigger> {
|
|
23
|
-
hideChevron?: boolean
|
|
24
|
-
}
|
|
25
|
-
export interface AccordionV2ContentProps extends ComponentProps<typeof Kobalte.Content> {}
|
|
26
|
-
|
|
27
|
-
function AccordionV2Root(props: ParentProps<AccordionV2Props>) {
|
|
28
|
-
const [s, r] = splitProps(props, ["class", "classList"])
|
|
29
|
-
return <Kobalte {...r} data-component="accordion-v2" classList={{ ...s.classList, [s.class ?? ""]: !!s.class }} />
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function AccordionV2Item(props: ParentProps<AccordionV2ItemProps>) {
|
|
33
|
-
const [s, r] = splitProps(props, ["class", "classList"])
|
|
34
|
-
return (
|
|
35
|
-
<Kobalte.Item
|
|
36
|
-
{...r}
|
|
37
|
-
data-component="accordion-v2-item"
|
|
38
|
-
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
39
|
-
/>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function AccordionV2Header(props: ParentProps<AccordionV2HeaderProps>) {
|
|
44
|
-
const [s, r] = splitProps(props, ["class", "classList", "children"])
|
|
45
|
-
return (
|
|
46
|
-
<Kobalte.Header {...r} data-slot="accordion-v2-header" classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}>
|
|
47
|
-
{s.children}
|
|
48
|
-
</Kobalte.Header>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function AccordionV2Trigger(props: ParentProps<AccordionV2TriggerProps>) {
|
|
53
|
-
const [s, r] = splitProps(props, ["class", "classList", "children", "hideChevron"])
|
|
54
|
-
return (
|
|
55
|
-
<Kobalte.Trigger
|
|
56
|
-
{...r}
|
|
57
|
-
data-component="accordion-v2-trigger"
|
|
58
|
-
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
59
|
-
>
|
|
60
|
-
<span data-slot="accordion-v2-trigger-content">{s.children}</span>
|
|
61
|
-
<Show when={!s.hideChevron}>
|
|
62
|
-
<ChevronDown />
|
|
63
|
-
</Show>
|
|
64
|
-
</Kobalte.Trigger>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function AccordionV2Content(props: ParentProps<AccordionV2ContentProps>) {
|
|
69
|
-
const [s, r] = splitProps(props, ["class", "classList", "children"])
|
|
70
|
-
return (
|
|
71
|
-
<Kobalte.Content
|
|
72
|
-
{...r}
|
|
73
|
-
data-component="accordion-v2-content"
|
|
74
|
-
classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
|
|
75
|
-
>
|
|
76
|
-
<div data-slot="accordion-v2-content-inner">{s.children}</div>
|
|
77
|
-
</Kobalte.Content>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export const AccordionV2 = Object.assign(AccordionV2Root, {
|
|
82
|
-
Item: AccordionV2Item,
|
|
83
|
-
Header: AccordionV2Header,
|
|
84
|
-
Trigger: AccordionV2Trigger,
|
|
85
|
-
Content: AccordionV2Content,
|
|
86
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Button as Kobalte } from "@kobalte/core/button"
|
|
2
|
-
import { type ComponentProps, Show, createMemo, splitProps } from "solid-js"
|
|
3
|
-
import { Icon, type IconProps } from "./icon"
|
|
4
|
-
import "./button-v2.css"
|
|
5
|
-
|
|
6
|
-
export interface ButtonV2Props
|
|
7
|
-
extends ComponentProps<typeof Kobalte>,
|
|
8
|
-
Pick<ComponentProps<"button">, "class" | "classList" | "children"> {
|
|
9
|
-
size?: "small" | "normal" | "large"
|
|
10
|
-
variant?: "neutral" | "danger" | "warning" | "outline" | "contrast" | "ghost" | "ghost-muted" | "loading"
|
|
11
|
-
icon?: IconProps["name"]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function ButtonV2(props: ButtonV2Props) {
|
|
15
|
-
const [split, rest] = splitProps(props, ["variant", "size", "icon", "class", "classList"])
|
|
16
|
-
const resolvedIcon = createMemo(() => split.icon)
|
|
17
|
-
return (
|
|
18
|
-
<Kobalte
|
|
19
|
-
{...rest}
|
|
20
|
-
data-component="button-v2"
|
|
21
|
-
data-size={split.size || "normal"}
|
|
22
|
-
data-variant={split.variant || "neutral"}
|
|
23
|
-
data-icon={resolvedIcon()}
|
|
24
|
-
classList={{
|
|
25
|
-
...split.classList,
|
|
26
|
-
[split.class ?? ""]: !!split.class,
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
<Show when={resolvedIcon()}>
|
|
30
|
-
<Icon name={resolvedIcon()!} />
|
|
31
|
-
</Show>
|
|
32
|
-
{props.children}
|
|
33
|
-
</Kobalte>
|
|
34
|
-
)
|
|
35
|
-
}
|