@opencode/ui 0.0.0-reserved → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/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/animated-number.d.ts +4 -0
- package/dist/components/app-icon.d.ts +6 -0
- package/dist/components/app-icons/types.d.ts +2 -0
- package/dist/components/card.d.ts +22 -0
- package/dist/components/collapsible.d.ts +17 -0
- package/dist/components/context-menu.d.ts +80 -0
- package/dist/components/dock-surface.d.ts +7 -0
- package/dist/components/favicon.d.ts +1 -0
- package/dist/components/file-icon.d.ts +12 -0
- package/dist/components/file-icons/types.d.ts +2 -0
- package/dist/components/font.d.ts +1 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/image-preview.d.ts +5 -0
- package/dist/components/list.d.ts +45 -0
- package/dist/components/logo.d.ts +8 -0
- package/dist/components/motion-spring.d.ts +4 -0
- package/dist/components/popover.d.ts +14 -0
- package/dist/components/progress.d.ts +7 -0
- package/dist/components/provider-icon.d.ts +5 -0
- package/dist/components/provider-icons/types.d.ts +2 -0
- package/dist/components/resize-handle.d.ts +14 -0
- package/dist/components/scroll-view.d.ts +42 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/sticky-accordion-header.d.ts +5 -0
- package/dist/components/text-field.d.ts +13 -0
- package/dist/components/text-reveal.d.ts +13 -0
- package/dist/components/text-strikethrough.d.ts +11 -0
- package/dist/components/typewriter.d.ts +6 -0
- package/dist/context/dialog.d.ts +18 -0
- package/dist/context/file.d.ts +5 -0
- package/dist/context/helper.d.ts +14 -0
- package/dist/context/i18n.d.ts +24 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/marked-base.d.ts +3 -0
- package/dist/context/marked-parser.d.ts +1 -0
- package/dist/context/marked-theme-register.d.ts +1 -0
- package/dist/context/marked-theme.d.ts +2 -0
- package/dist/context/marked.d.ts +2 -0
- package/dist/context/worker-pool.d.ts +9 -0
- package/dist/data-display/accordion/accordion.d.ts +24 -0
- package/dist/data-display/avatar/avatar.d.ts +11 -0
- package/dist/data-display/badge/badge.d.ts +7 -0
- package/dist/data-display/diff-changes/diff-changes.d.ts +12 -0
- package/dist/data-display/keybind/keybind.d.ts +7 -0
- package/dist/data-display/line-comment/line-comment.d.ts +32 -0
- package/dist/data-display/project-avatar/project-avatar.d.ts +12 -0
- package/dist/feedback/loader/loader.d.ts +3 -0
- package/dist/feedback/progress-circle/progress-circle.d.ts +9 -0
- package/dist/feedback/toast/toast.d.ts +57 -0
- package/dist/forms/checkbox/checkbox.d.ts +8 -0
- package/dist/forms/field/field.d.ts +22 -0
- package/dist/forms/inline-input/inline-input.d.ts +5 -0
- package/dist/forms/radio/radio.d.ts +16 -0
- package/dist/forms/select/select.d.ts +23 -0
- package/dist/forms/switch/switch.d.ts +9 -0
- package/dist/forms/text-input/text-input.d.ts +24 -0
- package/dist/forms/textarea/textarea.d.ts +7 -0
- package/dist/hooks/create-auto-scroll.d.ts +17 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/use-filtered-list.d.ts +48 -0
- package/dist/i18n/am.d.ts +1 -0
- package/dist/i18n/ar.d.ts +209 -0
- package/dist/i18n/az.d.ts +1 -0
- package/dist/i18n/bg.d.ts +193 -0
- package/dist/i18n/bn.d.ts +1 -0
- package/dist/i18n/br.d.ts +197 -0
- package/dist/i18n/bs.d.ts +197 -0
- package/dist/i18n/ca.d.ts +1 -0
- package/dist/i18n/cs.d.ts +1 -0
- package/dist/i18n/da.d.ts +193 -0
- package/dist/i18n/de.d.ts +193 -0
- package/dist/i18n/dv.d.ts +1 -0
- package/dist/i18n/dz.d.ts +1 -0
- package/dist/i18n/el.d.ts +1 -0
- package/dist/i18n/en.d.ts +251 -0
- package/dist/i18n/es.d.ts +197 -0
- package/dist/i18n/et.d.ts +1 -0
- package/dist/i18n/fa.d.ts +1 -0
- package/dist/i18n/fi.d.ts +1 -0
- package/dist/i18n/fo.d.ts +1 -0
- package/dist/i18n/fr.d.ts +197 -0
- package/dist/i18n/he.d.ts +197 -0
- package/dist/i18n/hi.d.ts +1 -0
- package/dist/i18n/hr.d.ts +1 -0
- package/dist/i18n/hu.d.ts +1 -0
- package/dist/i18n/hy.d.ts +1 -0
- package/dist/i18n/id.d.ts +1 -0
- package/dist/i18n/is.d.ts +1 -0
- package/dist/i18n/it.d.ts +1 -0
- package/dist/i18n/ja.d.ts +193 -0
- package/dist/i18n/ka.d.ts +1 -0
- package/dist/i18n/km.d.ts +193 -0
- package/dist/i18n/ko.d.ts +193 -0
- package/dist/i18n/lo.d.ts +193 -0
- package/dist/i18n/lt.d.ts +1 -0
- package/dist/i18n/lv.d.ts +1 -0
- package/dist/i18n/mk.d.ts +193 -0
- package/dist/i18n/mn.d.ts +193 -0
- package/dist/i18n/ms.d.ts +1 -0
- package/dist/i18n/my.d.ts +193 -0
- package/dist/i18n/ne.d.ts +1 -0
- package/dist/i18n/nl.d.ts +1 -0
- package/dist/i18n/no.d.ts +4 -0
- package/dist/i18n/pa.d.ts +1 -0
- package/dist/i18n/pl.d.ts +201 -0
- package/dist/i18n/ro.d.ts +1 -0
- package/dist/i18n/ru.d.ts +201 -0
- package/dist/i18n/si.d.ts +1 -0
- package/dist/i18n/sk.d.ts +1 -0
- package/dist/i18n/sl.d.ts +1 -0
- package/dist/i18n/sq.d.ts +1 -0
- package/dist/i18n/sr.d.ts +197 -0
- package/dist/i18n/sv.d.ts +1 -0
- package/dist/i18n/tg.d.ts +193 -0
- package/dist/i18n/th.d.ts +193 -0
- package/dist/i18n/tk.d.ts +1 -0
- package/dist/i18n/tr.d.ts +193 -0
- package/dist/i18n/uk.d.ts +1 -0
- package/dist/i18n/ur.d.ts +1 -0
- package/dist/i18n/uz.d.ts +1 -0
- package/dist/i18n/vi.d.ts +1 -0
- package/dist/i18n/zh.d.ts +193 -0
- package/dist/i18n/zht.d.ts +193 -0
- package/dist/icons/icon/additional-icons.d.ts +105 -0
- package/dist/icons/icon/icon.d.ts +228 -0
- package/dist/layout/divider/divider.d.ts +5 -0
- package/dist/navigation/menu/menu.d.ts +59 -0
- package/dist/navigation/segmented-control/segmented-control.d.ts +21 -0
- package/dist/navigation/tab-state-indicator.d.ts +2 -0
- package/dist/navigation/tabs/tabs.d.ts +39 -0
- package/dist/overlays/dialog/dialog.d.ts +26 -0
- package/dist/overlays/tooltip/tooltip.d.ts +15 -0
- package/dist/storybook/fixtures.d.ts +19 -0
- package/dist/storybook/scaffold.d.ts +16 -0
- package/dist/theme/color.d.ts +30 -0
- package/dist/theme/context.d.ts +21 -0
- package/dist/theme/default-themes.d.ts +39 -0
- package/dist/theme/index.d.ts +7 -0
- package/dist/theme/loader.d.ts +6 -0
- package/dist/theme/resolve.d.ts +7 -0
- package/dist/theme/types.d.ts +56 -0
- package/dist/theme/v2/avatar.d.ts +5 -0
- package/dist/theme/v2/default-primitives.d.ts +3 -0
- package/dist/theme/v2/foreground.d.ts +2 -0
- package/dist/theme/v2/mapping.d.ts +3 -0
- package/dist/theme/v2/resolve.d.ts +9 -0
- package/dist/typography/text-shimmer/text-shimmer.d.ts +9 -0
- package/dist/typography/wordmark/wordmark.d.ts +5 -0
- package/package.json +252 -6
- package/src/actions/button/button.css +294 -0
- package/src/actions/button/button.tsx +42 -0
- package/src/actions/icon-button/icon-button.css +124 -0
- package/src/actions/icon-button/icon-button.tsx +32 -0
- package/src/actions/split-button/split-button.css +95 -0
- package/src/actions/split-button/split-button.tsx +48 -0
- package/src/actions/submit.css +74 -0
- package/src/assets/audio/alert-01.aac +0 -0
- package/src/assets/audio/alert-01.mp3 +0 -0
- package/src/assets/audio/alert-02.aac +0 -0
- package/src/assets/audio/alert-02.mp3 +0 -0
- package/src/assets/audio/alert-03.aac +0 -0
- package/src/assets/audio/alert-03.mp3 +0 -0
- package/src/assets/audio/alert-04.aac +0 -0
- package/src/assets/audio/alert-04.mp3 +0 -0
- package/src/assets/audio/alert-05.aac +0 -0
- package/src/assets/audio/alert-05.mp3 +0 -0
- package/src/assets/audio/alert-06.aac +0 -0
- package/src/assets/audio/alert-06.mp3 +0 -0
- package/src/assets/audio/alert-07.aac +0 -0
- package/src/assets/audio/alert-07.mp3 +0 -0
- package/src/assets/audio/alert-08.aac +0 -0
- package/src/assets/audio/alert-08.mp3 +0 -0
- package/src/assets/audio/alert-09.aac +0 -0
- package/src/assets/audio/alert-09.mp3 +0 -0
- package/src/assets/audio/alert-10.aac +0 -0
- package/src/assets/audio/alert-10.mp3 +0 -0
- package/src/assets/audio/bip-bop-01.aac +0 -0
- package/src/assets/audio/bip-bop-01.mp3 +0 -0
- package/src/assets/audio/bip-bop-02.aac +0 -0
- package/src/assets/audio/bip-bop-02.mp3 +0 -0
- package/src/assets/audio/bip-bop-03.aac +0 -0
- package/src/assets/audio/bip-bop-03.mp3 +0 -0
- package/src/assets/audio/bip-bop-04.aac +0 -0
- package/src/assets/audio/bip-bop-04.mp3 +0 -0
- package/src/assets/audio/bip-bop-05.aac +0 -0
- package/src/assets/audio/bip-bop-05.mp3 +0 -0
- package/src/assets/audio/bip-bop-06.aac +0 -0
- package/src/assets/audio/bip-bop-06.mp3 +0 -0
- package/src/assets/audio/bip-bop-07.aac +0 -0
- package/src/assets/audio/bip-bop-07.mp3 +0 -0
- package/src/assets/audio/bip-bop-08.aac +0 -0
- package/src/assets/audio/bip-bop-08.mp3 +0 -0
- package/src/assets/audio/bip-bop-09.aac +0 -0
- package/src/assets/audio/bip-bop-09.mp3 +0 -0
- package/src/assets/audio/bip-bop-10.aac +0 -0
- package/src/assets/audio/bip-bop-10.mp3 +0 -0
- package/src/assets/audio/nope-01.aac +0 -0
- package/src/assets/audio/nope-01.mp3 +0 -0
- package/src/assets/audio/nope-02.aac +0 -0
- package/src/assets/audio/nope-02.mp3 +0 -0
- package/src/assets/audio/nope-03.aac +0 -0
- package/src/assets/audio/nope-03.mp3 +0 -0
- package/src/assets/audio/nope-04.aac +0 -0
- package/src/assets/audio/nope-04.mp3 +0 -0
- package/src/assets/audio/nope-05.aac +0 -0
- package/src/assets/audio/nope-05.mp3 +0 -0
- package/src/assets/audio/nope-06.aac +0 -0
- package/src/assets/audio/nope-06.mp3 +0 -0
- package/src/assets/audio/nope-07.aac +0 -0
- package/src/assets/audio/nope-07.mp3 +0 -0
- package/src/assets/audio/nope-08.aac +0 -0
- package/src/assets/audio/nope-08.mp3 +0 -0
- package/src/assets/audio/nope-09.aac +0 -0
- package/src/assets/audio/nope-09.mp3 +0 -0
- package/src/assets/audio/nope-10.aac +0 -0
- package/src/assets/audio/nope-10.mp3 +0 -0
- package/src/assets/audio/nope-11.aac +0 -0
- package/src/assets/audio/nope-11.mp3 +0 -0
- package/src/assets/audio/nope-12.aac +0 -0
- package/src/assets/audio/nope-12.mp3 +0 -0
- package/src/assets/audio/staplebops-01.aac +0 -0
- package/src/assets/audio/staplebops-01.mp3 +0 -0
- package/src/assets/audio/staplebops-02.aac +0 -0
- package/src/assets/audio/staplebops-02.mp3 +0 -0
- package/src/assets/audio/staplebops-03.aac +0 -0
- package/src/assets/audio/staplebops-03.mp3 +0 -0
- package/src/assets/audio/staplebops-04.aac +0 -0
- package/src/assets/audio/staplebops-04.mp3 +0 -0
- package/src/assets/audio/staplebops-05.aac +0 -0
- package/src/assets/audio/staplebops-05.mp3 +0 -0
- package/src/assets/audio/staplebops-06.aac +0 -0
- package/src/assets/audio/staplebops-06.mp3 +0 -0
- package/src/assets/audio/staplebops-07.aac +0 -0
- package/src/assets/audio/staplebops-07.mp3 +0 -0
- package/src/assets/audio/yup-01.aac +0 -0
- package/src/assets/audio/yup-01.mp3 +0 -0
- package/src/assets/audio/yup-02.aac +0 -0
- package/src/assets/audio/yup-02.mp3 +0 -0
- package/src/assets/audio/yup-03.aac +0 -0
- package/src/assets/audio/yup-03.mp3 +0 -0
- package/src/assets/audio/yup-04.aac +0 -0
- package/src/assets/audio/yup-04.mp3 +0 -0
- package/src/assets/audio/yup-05.aac +0 -0
- package/src/assets/audio/yup-05.mp3 +0 -0
- package/src/assets/audio/yup-06.aac +0 -0
- package/src/assets/audio/yup-06.mp3 +0 -0
- package/src/assets/fonts/Inter.ttf +0 -0
- package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/src/assets/icons/app/android-studio.svg +369 -0
- package/src/assets/icons/app/antigravity.svg +97 -0
- package/src/assets/icons/app/cursor.svg +16 -0
- package/src/assets/icons/app/file-explorer.svg +20 -0
- package/src/assets/icons/app/finder.png +0 -0
- package/src/assets/icons/app/ghostty.svg +13 -0
- package/src/assets/icons/app/iterm2.svg +13 -0
- package/src/assets/icons/app/powershell.svg +14 -0
- package/src/assets/icons/app/sublimetext.svg +17 -0
- package/src/assets/icons/app/terminal.png +0 -0
- package/src/assets/icons/app/textmate.png +0 -0
- package/src/assets/icons/app/vscode.svg +39 -0
- package/src/assets/icons/app/warp.png +0 -0
- package/src/assets/icons/app/xcode.png +0 -0
- package/src/assets/icons/app/zed-dark.svg +15 -0
- package/src/assets/icons/app/zed.svg +15 -0
- package/src/components/animated-number.css +93 -0
- package/src/components/animated-number.tsx +109 -0
- package/src/components/app-icon.css +5 -0
- package/src/components/app-icon.tsx +85 -0
- package/src/components/app-icons/sprite.svg +114 -0
- package/src/components/app-icons/types.ts +21 -0
- package/src/components/card.css +94 -0
- package/src/components/card.tsx +123 -0
- package/src/components/collapsible.css +154 -0
- package/src/components/collapsible.tsx +48 -0
- package/src/components/context-menu.css +134 -0
- package/src/components/context-menu.tsx +308 -0
- package/src/components/dock-surface.css +30 -0
- package/src/components/dock-surface.tsx +54 -0
- package/src/components/favicon.tsx +13 -0
- package/src/components/file-icon.css +26 -0
- package/src/components/file-icon.tsx +588 -0
- package/src/components/file-icons/sprite.svg +11707 -0
- package/src/components/file-icons/types.ts +1095 -0
- package/src/components/font.tsx +1 -0
- package/src/components/hover-card.css +61 -0
- package/src/components/hover-card.tsx +32 -0
- package/src/components/image-preview.css +63 -0
- package/src/components/image-preview.tsx +33 -0
- package/src/components/list.css +331 -0
- package/src/components/list.tsx +396 -0
- package/src/components/logo.css +4 -0
- package/src/components/logo.tsx +62 -0
- package/src/components/motion-spring.tsx +58 -0
- package/src/components/popover.css +98 -0
- package/src/components/popover.tsx +154 -0
- package/src/components/progress.css +63 -0
- package/src/components/progress.tsx +39 -0
- package/src/components/provider-icon.css +5 -0
- package/src/components/provider-icon.tsx +25 -0
- package/src/components/provider-icons/sprite.svg +1110 -0
- package/src/components/provider-icons/types.ts +105 -0
- package/src/components/resize-handle.css +70 -0
- package/src/components/resize-handle.tsx +102 -0
- package/src/components/scroll-view.css +99 -0
- package/src/components/scroll-view.tsx +453 -0
- package/src/components/spinner.css +6 -0
- package/src/components/spinner.tsx +52 -0
- package/src/components/sticky-accordion-header.css +6 -0
- package/src/components/sticky-accordion-header.tsx +18 -0
- package/src/components/text-field.css +134 -0
- package/src/components/text-field.tsx +136 -0
- package/src/components/text-reveal.css +150 -0
- package/src/components/text-reveal.tsx +143 -0
- package/src/components/text-strikethrough.css +27 -0
- package/src/components/text-strikethrough.tsx +84 -0
- package/src/components/typewriter.css +14 -0
- package/src/components/typewriter.tsx +55 -0
- package/src/context/dialog.tsx +198 -0
- package/src/context/file.tsx +10 -0
- package/src/context/helper.tsx +38 -0
- package/src/context/i18n.tsx +77 -0
- package/src/context/index.ts +4 -0
- package/src/context/marked-base.tsx +55 -0
- package/src/context/marked-parser.tsx +58 -0
- package/src/context/marked-theme-register.tsx +10 -0
- package/src/context/marked-theme.tsx +372 -0
- package/src/context/marked.tsx +28 -0
- package/src/context/worker-pool.tsx +20 -0
- package/src/custom-elements.d.ts +17 -0
- package/src/data-display/accordion/accordion.css +121 -0
- package/src/data-display/accordion/accordion.tsx +92 -0
- package/src/data-display/avatar/avatar.css +70 -0
- package/src/data-display/avatar/avatar.tsx +59 -0
- package/src/data-display/badge/badge.css +52 -0
- package/src/data-display/badge/badge.tsx +25 -0
- package/src/data-display/diff-changes/diff-changes.css +47 -0
- package/src/data-display/diff-changes/diff-changes.tsx +33 -0
- package/src/data-display/keybind/keybind.css +76 -0
- package/src/data-display/keybind/keybind.tsx +30 -0
- package/src/data-display/line-comment/line-comment.css +258 -0
- package/src/data-display/line-comment/line-comment.tsx +308 -0
- package/src/data-display/project-avatar/project-avatar.css +132 -0
- package/src/data-display/project-avatar/project-avatar.tsx +66 -0
- package/src/feedback/loader/loader.css +32 -0
- package/src/feedback/loader/loader.tsx +31 -0
- package/src/feedback/progress-circle/progress-circle.css +28 -0
- package/src/feedback/progress-circle/progress-circle.tsx +64 -0
- package/src/feedback/toast/toast.css +225 -0
- package/src/feedback/toast/toast.tsx +283 -0
- package/src/forms/checkbox/checkbox.css +125 -0
- package/src/forms/checkbox/checkbox.tsx +43 -0
- package/src/forms/field/field.css +94 -0
- package/src/forms/field/field.tsx +263 -0
- package/src/forms/inline-input/inline-input.css +17 -0
- package/src/forms/inline-input/inline-input.tsx +22 -0
- package/src/forms/radio/radio.css +202 -0
- package/src/forms/radio/radio.tsx +82 -0
- package/src/forms/select/select.css +290 -0
- package/src/forms/select/select.tsx +219 -0
- package/src/forms/switch/switch.css +272 -0
- package/src/forms/switch/switch.tsx +34 -0
- package/src/forms/text-input/text-input.css +181 -0
- package/src/forms/text-input/text-input.tsx +99 -0
- package/src/forms/textarea/textarea.css +78 -0
- package/src/forms/textarea/textarea.tsx +31 -0
- package/src/hooks/create-auto-scroll.tsx +257 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-filtered-list.tsx +134 -0
- package/src/i18n/am.ts +194 -0
- package/src/i18n/ar.ts +231 -0
- package/src/i18n/az.ts +195 -0
- package/src/i18n/bg.ts +195 -0
- package/src/i18n/bn.ts +197 -0
- package/src/i18n/br.ts +219 -0
- package/src/i18n/bs.ts +223 -0
- package/src/i18n/ca.ts +199 -0
- package/src/i18n/cs.ts +203 -0
- package/src/i18n/da.ts +214 -0
- package/src/i18n/de.ts +219 -0
- package/src/i18n/dv.ts +196 -0
- package/src/i18n/dz.ts +197 -0
- package/src/i18n/el.ts +195 -0
- package/src/i18n/en.ts +276 -0
- package/src/i18n/es.ts +219 -0
- package/src/i18n/et.ts +195 -0
- package/src/i18n/fa.ts +195 -0
- package/src/i18n/fi.ts +195 -0
- package/src/i18n/fo.ts +195 -0
- package/src/i18n/fr.ts +221 -0
- package/src/i18n/he.ts +199 -0
- package/src/i18n/hi.ts +197 -0
- package/src/i18n/hr.ts +200 -0
- package/src/i18n/hu.ts +197 -0
- package/src/i18n/hy.ts +195 -0
- package/src/i18n/id.ts +217 -0
- package/src/i18n/is.ts +195 -0
- package/src/i18n/it.ts +200 -0
- package/src/i18n/ja.ts +214 -0
- package/src/i18n/ka.ts +195 -0
- package/src/i18n/km.ts +196 -0
- package/src/i18n/ko.ts +216 -0
- package/src/i18n/lo.ts +195 -0
- package/src/i18n/lt.ts +203 -0
- package/src/i18n/lv.ts +199 -0
- package/src/i18n/mk.ts +195 -0
- package/src/i18n/mn.ts +195 -0
- package/src/i18n/ms.ts +195 -0
- package/src/i18n/my.ts +196 -0
- package/src/i18n/ne.ts +197 -0
- package/src/i18n/nl.ts +195 -0
- package/src/i18n/no.ts +219 -0
- package/src/i18n/pa.ts +196 -0
- package/src/i18n/pl.ts +223 -0
- package/src/i18n/ro.ts +199 -0
- package/src/i18n/ru.ts +222 -0
- package/src/i18n/si.ts +195 -0
- package/src/i18n/sk.ts +203 -0
- package/src/i18n/sl.ts +204 -0
- package/src/i18n/sq.ts +195 -0
- package/src/i18n/sr.ts +200 -0
- package/src/i18n/sv.ts +195 -0
- package/src/i18n/tg.ts +195 -0
- package/src/i18n/th.ts +215 -0
- package/src/i18n/tk.ts +195 -0
- package/src/i18n/tr.ts +221 -0
- package/src/i18n/uk.ts +226 -0
- package/src/i18n/ur.ts +196 -0
- package/src/i18n/uz.ts +198 -0
- package/src/i18n/vi.ts +195 -0
- package/src/i18n/zh.ts +217 -0
- package/src/i18n/zht.ts +217 -0
- package/src/icons/icon/additional-icons.ts +115 -0
- package/src/icons/icon/icon.css +3 -0
- package/src/icons/icon/icon.tsx +305 -0
- package/src/layout/divider/divider.css +11 -0
- package/src/layout/divider/divider.tsx +20 -0
- package/src/navigation/menu/menu.css +311 -0
- package/src/navigation/menu/menu.tsx +289 -0
- package/src/navigation/segmented-control/segmented-control.css +80 -0
- package/src/navigation/segmented-control/segmented-control.tsx +209 -0
- package/src/navigation/tab-state-indicator.tsx +37 -0
- package/src/navigation/tabs/tabs-current.css +239 -0
- package/src/navigation/tabs/tabs.css +710 -0
- package/src/navigation/tabs/tabs.tsx +194 -0
- package/src/overlays/dialog/dialog.css +180 -0
- package/src/overlays/dialog/dialog.tsx +115 -0
- package/src/overlays/tooltip/tooltip.css +102 -0
- package/src/overlays/tooltip/tooltip.tsx +154 -0
- package/src/storybook/fixtures.ts +51 -0
- package/src/storybook/scaffold.tsx +62 -0
- package/src/styles/animations.css +141 -0
- package/src/styles/base.css +409 -0
- package/src/styles/colors.css +772 -0
- package/src/styles/file-tree.css +202 -0
- package/src/styles/index.css +37 -0
- package/src/styles/tailwind/colors.css +288 -0
- package/src/styles/tailwind/index.css +95 -0
- package/src/styles/tailwind/utilities.css +131 -0
- package/src/styles/theme.css +631 -0
- package/src/styles/tokens/colors.css +172 -0
- package/src/styles/tokens/index.css +2 -0
- package/src/styles/tokens/theme.css +510 -0
- package/src/styles/utilities.css +118 -0
- package/src/theme/color.ts +299 -0
- package/src/theme/context.tsx +381 -0
- package/src/theme/default-themes.ts +116 -0
- package/src/theme/index.ts +78 -0
- package/src/theme/loader.ts +112 -0
- package/src/theme/resolve.ts +540 -0
- package/src/theme/themes/amoled.json +49 -0
- package/src/theme/themes/aura.json +51 -0
- package/src/theme/themes/ayu.json +51 -0
- package/src/theme/themes/carbonfox.json +53 -0
- package/src/theme/themes/catppuccin-frappe.json +85 -0
- package/src/theme/themes/catppuccin-macchiato.json +85 -0
- package/src/theme/themes/catppuccin.json +45 -0
- package/src/theme/themes/cobalt2.json +87 -0
- package/src/theme/themes/cursor.json +91 -0
- package/src/theme/themes/dracula.json +49 -0
- package/src/theme/themes/everforest.json +89 -0
- package/src/theme/themes/flexoki.json +86 -0
- package/src/theme/themes/github.json +85 -0
- package/src/theme/themes/gruvbox.json +45 -0
- package/src/theme/themes/kanagawa.json +89 -0
- package/src/theme/themes/lucent-orng.json +87 -0
- package/src/theme/themes/material.json +87 -0
- package/src/theme/themes/matrix.json +113 -0
- package/src/theme/themes/mercury.json +86 -0
- package/src/theme/themes/monokai.json +49 -0
- package/src/theme/themes/nightowl.json +46 -0
- package/src/theme/themes/nord.json +46 -0
- package/src/theme/themes/oc-2.json +507 -0
- package/src/theme/themes/one-dark.json +89 -0
- package/src/theme/themes/onedarkpro.json +45 -0
- package/src/theme/themes/opencode.json +89 -0
- package/src/theme/themes/orng.json +87 -0
- package/src/theme/themes/osaka-jade.json +88 -0
- package/src/theme/themes/palenight.json +85 -0
- package/src/theme/themes/rosepine.json +85 -0
- package/src/theme/themes/shadesofpurple.json +51 -0
- package/src/theme/themes/solarized.json +49 -0
- package/src/theme/themes/synthwave84.json +87 -0
- package/src/theme/themes/tokyonight.json +47 -0
- package/src/theme/themes/vercel.json +90 -0
- package/src/theme/themes/vesper.json +51 -0
- package/src/theme/themes/zenburn.json +87 -0
- package/src/theme/types.ts +75 -0
- package/src/theme/v2/avatar.ts +48 -0
- package/src/theme/v2/default-primitives.ts +114 -0
- package/src/theme/v2/foreground.ts +61 -0
- package/src/theme/v2/mapping.ts +176 -0
- package/src/theme/v2/resolve.ts +153 -0
- package/src/typography/text-shimmer/text-shimmer.css +120 -0
- package/src/typography/text-shimmer/text-shimmer.tsx +63 -0
- package/src/typography/wordmark/wordmark.tsx +39 -0
- package/README.md +0 -5
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
.toast-v2-region {
|
|
2
|
+
z-index: 1000;
|
|
3
|
+
max-width: min(320px, calc(100vw - 64px));
|
|
4
|
+
pointer-events: none;
|
|
5
|
+
user-select: none;
|
|
6
|
+
-webkit-user-select: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.toast-v2 {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: minmax(0, 1fr) 20px;
|
|
12
|
+
column-gap: 12px;
|
|
13
|
+
row-gap: 12px;
|
|
14
|
+
width: 320px;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
padding: 12px;
|
|
17
|
+
max-height: min(420px, calc(100dvh - 96px));
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
pointer-events: auto;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
outline: none;
|
|
22
|
+
user-select: none;
|
|
23
|
+
-webkit-user-select: none;
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
color: var(--v2-text-text-base);
|
|
26
|
+
background: var(--v2-background-bg-layer-01);
|
|
27
|
+
box-shadow: var(--v2-elevation-floating);
|
|
28
|
+
transition:
|
|
29
|
+
transform 280ms cubic-bezier(0.2, 0, 0, 1),
|
|
30
|
+
opacity 160ms ease-out,
|
|
31
|
+
height 280ms cubic-bezier(0.2, 0, 0, 1),
|
|
32
|
+
box-shadow 160ms ease-out;
|
|
33
|
+
|
|
34
|
+
&:has(> [data-icon]) {
|
|
35
|
+
grid-template-columns: 16px minmax(0, 1fr) 20px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:focus-visible {
|
|
39
|
+
box-shadow:
|
|
40
|
+
var(--v2-elevation-floating),
|
|
41
|
+
0 0 0 2px var(--v2-border-border-focus);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-expanded="true"] {
|
|
45
|
+
overflow: visible;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[data-expanded="false"][data-front="false"] > * {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[data-expanded="false"][data-front="false"] {
|
|
53
|
+
--y: translateY(calc(-1 * var(--toasts-before) * 9.5px)) scale(calc(1 - var(--toasts-before) * 0.05));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
> [data-icon] {
|
|
57
|
+
grid-column: 1;
|
|
58
|
+
grid-row: 1;
|
|
59
|
+
align-self: start;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
width: 16px;
|
|
64
|
+
height: 20px;
|
|
65
|
+
color: var(--v2-icon-icon-base);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
> [data-content] {
|
|
69
|
+
grid-column: 1;
|
|
70
|
+
grid-row: 1;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 4px;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:has(> [data-icon]) > [data-content] {
|
|
79
|
+
grid-column: 2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
> [data-close-button] {
|
|
83
|
+
grid-column: 2;
|
|
84
|
+
grid-row: 1;
|
|
85
|
+
position: static;
|
|
86
|
+
align-self: start;
|
|
87
|
+
width: 20px;
|
|
88
|
+
height: 20px;
|
|
89
|
+
min-width: 20px;
|
|
90
|
+
min-height: 20px;
|
|
91
|
+
padding: 0;
|
|
92
|
+
border: 0;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
transform: none;
|
|
95
|
+
background: transparent;
|
|
96
|
+
color: var(--v2-icon-icon-muted);
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:has(> [data-icon]) > [data-close-button] {
|
|
104
|
+
grid-column: 3;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
> [data-close-button]:hover {
|
|
108
|
+
background: var(--v2-overlay-simple-overlay-hover);
|
|
109
|
+
color: var(--v2-icon-icon-base);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
> [data-close-button]:active {
|
|
113
|
+
background: var(--v2-overlay-simple-overlay-pressed);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
> [data-close-button]:focus-visible {
|
|
117
|
+
outline: 2px solid var(--v2-border-border-focus);
|
|
118
|
+
outline-offset: 2px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
> [data-icon] > *,
|
|
122
|
+
> [data-icon] svg,
|
|
123
|
+
> [data-close-button] svg {
|
|
124
|
+
width: 16px;
|
|
125
|
+
height: 16px;
|
|
126
|
+
display: block;
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[data-title],
|
|
131
|
+
[data-slot="toast-v2-title"] {
|
|
132
|
+
color: var(--v2-text-text-base);
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
font-size: 13px;
|
|
137
|
+
font-style: normal;
|
|
138
|
+
font-weight: 530;
|
|
139
|
+
line-height: 20px;
|
|
140
|
+
letter-spacing: -0.04px;
|
|
141
|
+
font-synthesis: none;
|
|
142
|
+
margin: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[data-description],
|
|
146
|
+
[data-slot="toast-v2-description"] {
|
|
147
|
+
color: var(--v2-text-text-muted);
|
|
148
|
+
text-wrap-style: pretty;
|
|
149
|
+
overflow-wrap: anywhere;
|
|
150
|
+
word-break: break-word;
|
|
151
|
+
font-size: 13px;
|
|
152
|
+
font-style: normal;
|
|
153
|
+
font-weight: 440;
|
|
154
|
+
line-height: 20px;
|
|
155
|
+
letter-spacing: -0.04px;
|
|
156
|
+
font-synthesis: none;
|
|
157
|
+
margin: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[data-slot="toast-v2-actions"] {
|
|
161
|
+
grid-column: 1;
|
|
162
|
+
grid-row: 2;
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-wrap: wrap;
|
|
165
|
+
gap: 8px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&:has(> [data-icon]) [data-slot="toast-v2-actions"] {
|
|
169
|
+
grid-column: 2;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[data-slot="toast-v2-actions"] [data-component="button-v2"] {
|
|
173
|
+
min-height: 24px;
|
|
174
|
+
font-size: 13px;
|
|
175
|
+
font-style: normal;
|
|
176
|
+
font-weight: 530;
|
|
177
|
+
line-height: 20px;
|
|
178
|
+
letter-spacing: -0.04px;
|
|
179
|
+
font-synthesis: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
[data-slot="toast-v2-header"] {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: flex-start;
|
|
185
|
+
gap: 12px;
|
|
186
|
+
width: 100%;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
[data-slot="toast-v2-icon"] {
|
|
190
|
+
flex-shrink: 0;
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
width: 16px;
|
|
195
|
+
height: 20px;
|
|
196
|
+
color: var(--v2-icon-icon-base);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
[data-slot="toast-v2-content"] {
|
|
200
|
+
flex: 1;
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
gap: 4px;
|
|
204
|
+
min-width: 0;
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (prefers-reduced-motion: reduce) {
|
|
210
|
+
.toast-v2,
|
|
211
|
+
.toast-v2 > * {
|
|
212
|
+
animation: none !important;
|
|
213
|
+
transition: none !important;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@media (max-width: 600px) {
|
|
218
|
+
.toast-v2-region {
|
|
219
|
+
max-width: calc(100vw - 32px);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.toast-v2 {
|
|
223
|
+
width: 100%;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Toaster, toast, type ToasterProps } from "solid-sonner"
|
|
2
|
+
import { isRTL } from "@kobalte/core/i18n"
|
|
3
|
+
import type { ComponentProps, JSX } from "solid-js"
|
|
4
|
+
import { createContext, onCleanup, onMount, splitProps, useContext } from "solid-js"
|
|
5
|
+
import { Portal } from "solid-js/web"
|
|
6
|
+
import { useI18n } from "../../context/i18n"
|
|
7
|
+
import "../../actions/button/button.css"
|
|
8
|
+
import "./toast.css"
|
|
9
|
+
|
|
10
|
+
export interface ToastRegionProps extends ToasterProps {}
|
|
11
|
+
|
|
12
|
+
function ToastRegion(props: ToastRegionProps) {
|
|
13
|
+
const i18n = useI18n()
|
|
14
|
+
const [local, rest] = splitProps(props, ["class", "className", "style", "toastOptions", "swipeDirections"])
|
|
15
|
+
onMount(() => {
|
|
16
|
+
const sync = () => {
|
|
17
|
+
document.querySelectorAll<HTMLElement>(".toast-v2-region .toast-v2").forEach((element) => {
|
|
18
|
+
const hidden = element.dataset.visible === "false"
|
|
19
|
+
element.inert = hidden
|
|
20
|
+
element.tabIndex = hidden ? -1 : 0
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
let connected = false
|
|
24
|
+
const connect = () => {
|
|
25
|
+
const regions = document.querySelectorAll(".toast-v2-region")
|
|
26
|
+
if (!regions.length) return
|
|
27
|
+
observer.disconnect()
|
|
28
|
+
regions.forEach((region) => {
|
|
29
|
+
observer.observe(region, {
|
|
30
|
+
subtree: true,
|
|
31
|
+
childList: true,
|
|
32
|
+
attributes: true,
|
|
33
|
+
attributeFilter: ["data-visible"],
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
connected = true
|
|
37
|
+
sync()
|
|
38
|
+
}
|
|
39
|
+
const observer = new MutationObserver(() => {
|
|
40
|
+
if (!connected) connect()
|
|
41
|
+
else sync()
|
|
42
|
+
})
|
|
43
|
+
observer.observe(document.body, { subtree: true, childList: true })
|
|
44
|
+
queueMicrotask(connect)
|
|
45
|
+
onCleanup(() => observer.disconnect())
|
|
46
|
+
})
|
|
47
|
+
return (
|
|
48
|
+
<Portal>
|
|
49
|
+
<Toaster
|
|
50
|
+
position={isRTL(i18n.locale()) ? "bottom-left" : "bottom-right"}
|
|
51
|
+
offset={isRTL(i18n.locale()) ? { left: 32, bottom: 48 } : { right: 32, bottom: 48 }}
|
|
52
|
+
mobileOffset={16}
|
|
53
|
+
gap={12}
|
|
54
|
+
duration={5000}
|
|
55
|
+
swipeDirections={["bottom"]}
|
|
56
|
+
className={["toast-v2-region", local.className, local.class].filter(Boolean).join(" ")}
|
|
57
|
+
style={{ "--width": "320px", ...local.style } as JSX.CSSProperties}
|
|
58
|
+
toastOptions={{
|
|
59
|
+
...local.toastOptions,
|
|
60
|
+
unstyled: true,
|
|
61
|
+
closeButton: true,
|
|
62
|
+
closeButtonAriaLabel: local.toastOptions?.closeButtonAriaLabel ?? i18n.t("ui.common.dismiss"),
|
|
63
|
+
}}
|
|
64
|
+
{...rest}
|
|
65
|
+
/>
|
|
66
|
+
</Portal>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const ToastContext = createContext<number>()
|
|
71
|
+
|
|
72
|
+
export interface ToastRootComponentProps {
|
|
73
|
+
toastId: number
|
|
74
|
+
children?: JSX.Element
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function ToastRoot(props: ToastRootComponentProps) {
|
|
78
|
+
return <ToastContext.Provider value={props.toastId}>{props.children}</ToastContext.Provider>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function ToastIcon(props: ComponentProps<"div">) {
|
|
82
|
+
return <div data-slot="toast-v2-icon" {...props} />
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function ToastContent(props: ComponentProps<"div">) {
|
|
86
|
+
return <div data-slot="toast-v2-content" {...props} />
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function ToastTitle(props: ComponentProps<"div">) {
|
|
90
|
+
return <div data-slot="toast-v2-title" {...props} />
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function ToastDescription(props: ComponentProps<"div">) {
|
|
94
|
+
return <div data-slot="toast-v2-description" {...props} />
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function ToastActions(props: ComponentProps<"div">) {
|
|
98
|
+
return <div data-slot="toast-v2-actions" {...props} />
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function ToastCloseButton(props: ComponentProps<"button">) {
|
|
102
|
+
const i18n = useI18n()
|
|
103
|
+
const toastId = useContext(ToastContext)
|
|
104
|
+
const [local, rest] = splitProps(props, ["children", "onClick"])
|
|
105
|
+
return (
|
|
106
|
+
<button
|
|
107
|
+
type="button"
|
|
108
|
+
data-slot="toast-v2-close-button"
|
|
109
|
+
aria-label={i18n.t("ui.common.dismiss")}
|
|
110
|
+
{...rest}
|
|
111
|
+
onClick={(event) => {
|
|
112
|
+
if (typeof local.onClick === "function") local.onClick(event)
|
|
113
|
+
if (!event.defaultPrevented && toastId !== undefined) toaster.dismiss(toastId)
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{local.children ?? <CloseIcon />}
|
|
117
|
+
</button>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function CloseIcon() {
|
|
122
|
+
return (
|
|
123
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
124
|
+
<path d="M4.25 11.75L11.75 4.25" stroke="currentColor" />
|
|
125
|
+
<path d="M11.75 11.75L4.25 4.25" stroke="currentColor" />
|
|
126
|
+
</svg>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const Toast = Object.assign(ToastRoot, {
|
|
131
|
+
Region: ToastRegion,
|
|
132
|
+
Icon: ToastIcon,
|
|
133
|
+
Content: ToastContent,
|
|
134
|
+
Title: ToastTitle,
|
|
135
|
+
Description: ToastDescription,
|
|
136
|
+
Actions: ToastActions,
|
|
137
|
+
CloseButton: ToastCloseButton,
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
let toastV2Id = 0
|
|
141
|
+
|
|
142
|
+
export const toaster = {
|
|
143
|
+
show(render: (props: { toastId: number }) => JSX.Element, options?: { duration?: number; persistent?: boolean }) {
|
|
144
|
+
const toastId = --toastV2Id
|
|
145
|
+
toast.custom((id) => render({ toastId: Number(id) }), {
|
|
146
|
+
id: toastId,
|
|
147
|
+
className: "toast-v2",
|
|
148
|
+
duration: options?.persistent ? Number.POSITIVE_INFINITY : options?.duration,
|
|
149
|
+
unstyled: true,
|
|
150
|
+
})
|
|
151
|
+
return toastId
|
|
152
|
+
},
|
|
153
|
+
dismiss(toastId?: number) {
|
|
154
|
+
if (toastId === undefined) {
|
|
155
|
+
activeToastByKey.clear()
|
|
156
|
+
activeToastById.clear()
|
|
157
|
+
} else {
|
|
158
|
+
releaseToast(activeToastById.get(toastId))
|
|
159
|
+
}
|
|
160
|
+
return toast.dismiss(toastId)
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface ToastAction {
|
|
165
|
+
label: string
|
|
166
|
+
variant?: "primary" | "secondary"
|
|
167
|
+
onClick: "dismiss" | (() => void)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ToastOptions {
|
|
171
|
+
title?: string
|
|
172
|
+
description?: string
|
|
173
|
+
icon?: JSX.Element
|
|
174
|
+
variant?: "default" | "success" | "error" | "loading"
|
|
175
|
+
duration?: number
|
|
176
|
+
persistent?: boolean
|
|
177
|
+
actions?: ToastAction[]
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface ActiveToast {
|
|
181
|
+
id: number
|
|
182
|
+
key: string
|
|
183
|
+
options: ToastOptions
|
|
184
|
+
actions?: JSX.Element
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const activeToastByKey = new Map<string, ActiveToast>()
|
|
188
|
+
const activeToastById = new Map<number, ActiveToast>()
|
|
189
|
+
|
|
190
|
+
export function showToast(options: ToastOptions | string) {
|
|
191
|
+
const opts: ToastOptions = typeof options === "string" ? { description: options } : options
|
|
192
|
+
const key = JSON.stringify({
|
|
193
|
+
title: opts.title,
|
|
194
|
+
description: opts.description,
|
|
195
|
+
variant: opts.variant,
|
|
196
|
+
duration: opts.duration,
|
|
197
|
+
persistent: opts.persistent,
|
|
198
|
+
actions: opts.actions?.map((action) => [action.label, action.variant]),
|
|
199
|
+
})
|
|
200
|
+
const active = activeToastByKey.get(key)
|
|
201
|
+
const toasts = toast.getToasts()
|
|
202
|
+
|
|
203
|
+
if (active && toasts.at(-1)?.id === active.id) {
|
|
204
|
+
active.options = opts
|
|
205
|
+
publishToast(active)
|
|
206
|
+
pulseToast(active.id)
|
|
207
|
+
return active.id
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (active && toasts.some((item) => item.id === active.id)) toaster.dismiss(active.id)
|
|
211
|
+
releaseToast(active)
|
|
212
|
+
|
|
213
|
+
const entry: ActiveToast = { id: --toastV2Id, key, options: opts }
|
|
214
|
+
entry.actions = createToastActions(entry)
|
|
215
|
+
activeToastByKey.set(key, entry)
|
|
216
|
+
activeToastById.set(entry.id, entry)
|
|
217
|
+
publishToast(entry)
|
|
218
|
+
return entry.id
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function publishToast(entry: ActiveToast) {
|
|
222
|
+
const release = () => releaseToast(entry)
|
|
223
|
+
toast(entry.options.title ?? "", {
|
|
224
|
+
id: entry.id,
|
|
225
|
+
description: entry.options.description,
|
|
226
|
+
icon: entry.options.icon,
|
|
227
|
+
action: entry.actions,
|
|
228
|
+
closeButton: true,
|
|
229
|
+
duration: entry.options.persistent ? Number.POSITIVE_INFINITY : entry.options.duration,
|
|
230
|
+
className: `toast-v2 toast-v2--${entry.options.variant ?? "default"}`,
|
|
231
|
+
testId: `toast-v2-${entry.id}`,
|
|
232
|
+
unstyled: true,
|
|
233
|
+
onDismiss: release,
|
|
234
|
+
onAutoClose: release,
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function createToastActions(entry: ActiveToast) {
|
|
239
|
+
if (!entry.options.actions?.length) return undefined
|
|
240
|
+
return (
|
|
241
|
+
<Toast.Actions>
|
|
242
|
+
{/* Static map, not <For>: this JSX is created imperatively outside any Solid
|
|
243
|
+
root, where a <For> computation would never be disposed. */}
|
|
244
|
+
{entry.options.actions.map((action, index) => (
|
|
245
|
+
<button
|
|
246
|
+
type="button"
|
|
247
|
+
data-component="button-v2"
|
|
248
|
+
data-variant={action.variant === "secondary" ? "ghost" : "neutral"}
|
|
249
|
+
data-size="small"
|
|
250
|
+
data-action-variant={action.variant ?? "primary"}
|
|
251
|
+
onClick={() => {
|
|
252
|
+
const onClick = entry.options.actions?.[index]?.onClick
|
|
253
|
+
if (typeof onClick === "function") onClick()
|
|
254
|
+
toaster.dismiss(entry.id)
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
{action.label}
|
|
258
|
+
</button>
|
|
259
|
+
))}
|
|
260
|
+
</Toast.Actions>
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function pulseToast(toastId: number) {
|
|
265
|
+
if (typeof document === "undefined" || typeof requestAnimationFrame === "undefined") return
|
|
266
|
+
requestAnimationFrame(() => {
|
|
267
|
+
const element = document.querySelector<HTMLElement>(`[data-testid="toast-v2-${toastId}"]`)
|
|
268
|
+
if (!element || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
269
|
+
element.animate([{ scale: 1 }, { scale: 1.025 }, { scale: 1 }], { duration: 160, easing: "ease-out" })
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function releaseToast(entry: ActiveToast | undefined) {
|
|
274
|
+
if (!entry) return
|
|
275
|
+
if (activeToastByKey.get(entry.key) === entry) activeToastByKey.delete(entry.key)
|
|
276
|
+
if (activeToastById.get(entry.id) === entry) activeToastById.delete(entry.id)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface ToastPromiseOptions<T, U = unknown> {
|
|
280
|
+
loading?: JSX.Element
|
|
281
|
+
success?: (data: T) => JSX.Element
|
|
282
|
+
error?: (error: U) => JSX.Element
|
|
283
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[data-component="checkbox"] {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: var(--checkbox-align, center);
|
|
4
|
+
gap: 12px;
|
|
5
|
+
cursor: default;
|
|
6
|
+
|
|
7
|
+
[data-slot="checkbox-checkbox-input"] {
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 1px;
|
|
10
|
+
height: 1px;
|
|
11
|
+
padding: 0;
|
|
12
|
+
margin: -1px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
clip: rect(0, 0, 0, 0);
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
border-width: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[data-slot="checkbox-checkbox-control"] {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
width: 16px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
padding: 2px;
|
|
26
|
+
margin-top: var(--checkbox-offset, 0px);
|
|
27
|
+
aspect-ratio: 1;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
border-radius: var(--radius-sm);
|
|
30
|
+
border: 1px solid var(--border-weak-base);
|
|
31
|
+
transition:
|
|
32
|
+
border-color 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
|
33
|
+
background-color 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
|
34
|
+
box-shadow 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-slot="checkbox-checkbox-indicator"] {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
color: var(--icon-base);
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transform: scale(0.9);
|
|
46
|
+
transition:
|
|
47
|
+
opacity 180ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)),
|
|
48
|
+
transform 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-slot="checkbox-checkbox-label"] {
|
|
52
|
+
user-select: none;
|
|
53
|
+
color: var(--text-base);
|
|
54
|
+
font-family: var(--font-family-sans);
|
|
55
|
+
font-size: var(--font-size-small);
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: var(--font-weight-regular);
|
|
58
|
+
line-height: var(--line-height-large);
|
|
59
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-slot="checkbox-checkbox-description"] {
|
|
63
|
+
color: var(--text-base);
|
|
64
|
+
font-family: var(--font-family-sans);
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
font-weight: var(--font-weight-regular);
|
|
67
|
+
line-height: var(--line-height-normal);
|
|
68
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-slot="checkbox-checkbox-error"] {
|
|
72
|
+
color: var(--text-error);
|
|
73
|
+
font-family: var(--font-family-sans);
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
font-weight: var(--font-weight-regular);
|
|
76
|
+
line-height: var(--line-height-normal);
|
|
77
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover:not([data-disabled], [data-readonly]) [data-slot="checkbox-checkbox-control"] {
|
|
81
|
+
border-color: var(--border-hover);
|
|
82
|
+
background-color: var(--surface-hover);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:not([data-readonly]) [data-slot="checkbox-checkbox-input"]:focus-visible + [data-slot="checkbox-checkbox-control"] {
|
|
86
|
+
border-color: var(--border-focus);
|
|
87
|
+
box-shadow: var(--shadow-xs-border-focus);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&[data-checked] [data-slot="checkbox-checkbox-control"],
|
|
91
|
+
&[data-indeterminate] [data-slot="checkbox-checkbox-control"] {
|
|
92
|
+
border-color: var(--border-base);
|
|
93
|
+
background-color: var(--surface-weak);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&[data-checked]:hover:not([data-disabled], [data-readonly]) [data-slot="checkbox-checkbox-control"],
|
|
97
|
+
&[data-indeterminate]:hover:not([data-disabled]) [data-slot="checkbox-checkbox-control"] {
|
|
98
|
+
border-color: var(--border-hover);
|
|
99
|
+
background-color: var(--surface-hover);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&[data-checked] [data-slot="checkbox-checkbox-indicator"],
|
|
103
|
+
&[data-indeterminate] [data-slot="checkbox-checkbox-indicator"] {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
transform: scale(1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&[data-disabled] {
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&[data-disabled] [data-slot="checkbox-checkbox-control"] {
|
|
113
|
+
border-color: var(--border-disabled);
|
|
114
|
+
background-color: var(--surface-disabled);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&[data-invalid] [data-slot="checkbox-checkbox-control"] {
|
|
118
|
+
border-color: var(--border-error);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&[data-readonly] {
|
|
122
|
+
cursor: default;
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Control, Description, ErrorMessage, Indicator, Input, Label, Root } from "@kobalte/core/checkbox"
|
|
2
|
+
import { Show, splitProps } from "solid-js"
|
|
3
|
+
import type { ComponentProps, JSX, ParentProps } from "solid-js"
|
|
4
|
+
|
|
5
|
+
export interface CheckboxProps extends ParentProps<ComponentProps<typeof Root>> {
|
|
6
|
+
hideLabel?: boolean
|
|
7
|
+
description?: string
|
|
8
|
+
icon?: JSX.Element
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function Checkbox(props: CheckboxProps) {
|
|
12
|
+
const [local, others] = splitProps(props, ["children", "class", "label", "hideLabel", "description", "icon"])
|
|
13
|
+
return (
|
|
14
|
+
<Root {...others} data-component="checkbox">
|
|
15
|
+
<Input data-slot="checkbox-checkbox-input" />
|
|
16
|
+
<Control data-slot="checkbox-checkbox-control">
|
|
17
|
+
<Indicator data-slot="checkbox-checkbox-indicator">
|
|
18
|
+
{local.icon || (
|
|
19
|
+
<svg viewBox="0 0 12 12" fill="none" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
20
|
+
<path
|
|
21
|
+
d="M3 7.17905L5.02703 8.85135L9 3.5"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
stroke-width="1.5"
|
|
24
|
+
stroke-linecap="square"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
)}
|
|
28
|
+
</Indicator>
|
|
29
|
+
</Control>
|
|
30
|
+
<div data-slot="checkbox-checkbox-content">
|
|
31
|
+
<Show when={props.children}>
|
|
32
|
+
<Label data-slot="checkbox-checkbox-label" classList={{ "sr-only": local.hideLabel }}>
|
|
33
|
+
{props.children}
|
|
34
|
+
</Label>
|
|
35
|
+
</Show>
|
|
36
|
+
<Show when={local.description}>
|
|
37
|
+
<Description data-slot="checkbox-checkbox-description">{local.description}</Description>
|
|
38
|
+
</Show>
|
|
39
|
+
<ErrorMessage data-slot="checkbox-checkbox-error" />
|
|
40
|
+
</div>
|
|
41
|
+
</Root>
|
|
42
|
+
)
|
|
43
|
+
}
|