@wordup-md/nuxt-layer-shadcn-unocss 0.2.0
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/.cursor/rules/active-context-rule.mdc +8 -0
- package/.cursor/rules/memory-bank-overview.mdc +17 -0
- package/.cursor/rules/product-context-rule.mdc +8 -0
- package/.cursor/rules/progress-rule.mdc +8 -0
- package/.cursor/rules/projectbrief-rule.mdc +8 -0
- package/.cursor/rules/system-patterns-rule.mdc +8 -0
- package/.cursor/rules/tech-context-rule.mdc +8 -0
- package/.cursorrules +52 -0
- package/.editorconfig +12 -0
- package/.nuxtrc +1 -0
- package/.playground/app.config.ts +189 -0
- package/.playground/assets/style.css +15 -0
- package/.playground/components/content/MdcExample.vue +81 -0
- package/.playground/components/content/MdcReplay.vue +319 -0
- package/.playground/content/1.getting-started/1.introduction.md +8 -0
- package/.playground/content/1.getting-started/2.writing/1.markdown.md +56 -0
- package/.playground/content/1.getting-started/2.writing/2.pages.md +177 -0
- package/.playground/content/1.getting-started/2.writing/3.folders.md +56 -0
- package/.playground/content/1.getting-started/2.writing/_dir.yml +3 -0
- package/.playground/content/1.getting-started/_dir.yml +3 -0
- package/.playground/content/2.content-elements/1.text-formatting.md +60 -0
- package/.playground/content/2.content-elements/10.horizontal-rule.md +25 -0
- package/.playground/content/2.content-elements/11.tables.md +25 -0
- package/.playground/content/2.content-elements/12.overview.md +93 -0
- package/.playground/content/2.content-elements/13.text-components.md +36 -0
- package/.playground/content/2.content-elements/2.headings.md +32 -0
- package/.playground/content/2.content-elements/3.paragraphs.md +39 -0
- package/.playground/content/2.content-elements/4.lists.md +37 -0
- package/.playground/content/2.content-elements/5.links.md +17 -0
- package/.playground/content/2.content-elements/6.images.md +17 -0
- package/.playground/content/2.content-elements/7.blockquotes.md +17 -0
- package/.playground/content/2.content-elements/8.code-blocks.md +141 -0
- package/.playground/content/2.content-elements/9.inline-code.md +21 -0
- package/.playground/content/2.content-elements/_dir.yml +3 -0
- package/.playground/content/2.content-elements/index.md +8 -0
- package/.playground/content/3.components/1.index.md +187 -0
- package/.playground/content/3.components/2.docs/_dir.yml +3 -0
- package/.playground/content/3.components/2.docs/alert.md +152 -0
- package/.playground/content/3.components/2.docs/badge.md +131 -0
- package/.playground/content/3.components/2.docs/button-link.md +53 -0
- package/.playground/content/3.components/2.docs/callout.md +16 -0
- package/.playground/content/3.components/2.docs/code-group.md +77 -0
- package/.playground/content/3.components/2.docs/code-snippet.md +129 -0
- package/.playground/content/3.components/2.docs/field-group.md +62 -0
- package/.playground/content/3.components/2.docs/field.md +39 -0
- package/.playground/content/3.components/2.docs/file-tree.md +144 -0
- package/.playground/content/3.components/2.docs/icon.md +94 -0
- package/.playground/content/3.components/2.docs/pm.md +67 -0
- package/.playground/content/3.components/2.docs/read-more.md +44 -0
- package/.playground/content/3.components/2.docs/shortcut.md +36 -0
- package/.playground/content/3.components/2.docs/stack.md +81 -0
- package/.playground/content/3.components/2.docs/steps.md +148 -0
- package/.playground/content/3.components/2.docs/tabs.md +375 -0
- package/.playground/content/3.components/3.page/_dir.yml +2 -0
- package/.playground/content/3.components/3.page/accordion.md +74 -0
- package/.playground/content/3.components/3.page/card-group.md +115 -0
- package/.playground/content/3.components/3.page/card.md +142 -0
- package/.playground/content/3.components/3.page/collapsible.md +61 -0
- package/.playground/content/3.components/3.page/hero-alt.md +118 -0
- package/.playground/content/3.components/3.page/hero.md +60 -0
- package/.playground/content/3.components/3.page/team-card.md +82 -0
- package/.playground/content/3.components/_dir.yml +2 -0
- package/.playground/content/4.development/1.configuration/1.overview.md +297 -0
- package/.playground/content/4.development/1.configuration/2.nuxt-content.md +105 -0
- package/.playground/content/4.development/1.configuration/3.og-image.md +86 -0
- package/.playground/content/4.development/1.configuration/4.edit-link.md +63 -0
- package/.playground/content/4.development/1.configuration/5.banner.md +52 -0
- package/.playground/content/4.development/1.configuration/6.carbon-ads.md +65 -0
- package/.playground/content/4.development/1.configuration/7.umami.md +41 -0
- package/.playground/content/4.development/1.configuration/_dir.yml +3 -0
- package/.playground/content/4.development/2.advanced/1.override.md +49 -0
- package/.playground/content/4.development/2.advanced/2.math.md +89 -0
- package/.playground/content/4.development/2.advanced/_dir.yml +3 -0
- package/.playground/content/4.development/3.themes.md +9 -0
- package/.playground/content/4.development/4.composables.md +38 -0
- package/.playground/content/4.development/5.installation.md +36 -0
- package/.playground/content/4.development/_dir.yml +3 -0
- package/.playground/content/_menu-footer.md +5 -0
- package/.playground/content/index.md +67 -0
- package/.playground/content/test-card.md +187 -0
- package/.playground/content/test.md +88 -0
- package/.playground/content/test2.md +12 -0
- package/.playground/content/test3.md +187 -0
- package/.playground/nuxt.config.ts +52 -0
- package/.playground/public/banner-preview.png +0 -0
- package/.playground/public/favicon.ico +0 -0
- package/.playground/public/front-matter-showcase/authors.png +0 -0
- package/.playground/public/front-matter-showcase/badges.png +0 -0
- package/.playground/public/front-matter-showcase/nav-badges.png +0 -0
- package/.playground/public/hero.png +0 -0
- package/.playground/public/logo-dark.svg +12 -0
- package/.playground/public/logo.svg +12 -0
- package/.playground/public/og-nuxt-seo.png +0 -0
- package/.playground/public/og-nuxt.png +0 -0
- package/.playground/public/og-shadcn-docs-dark.png +0 -0
- package/.playground/public/og-shadcn-docs.png +0 -0
- package/.playground/public/sidebar-default.png +0 -0
- package/.playground/public/sidebar-group.png +0 -0
- package/.playground/public/sidebar-tree.png +0 -0
- package/.playground/uno.config.ts +16 -0
- package/README.md +93 -0
- package/app.vue +59 -0
- package/assets/css/a11y.css +48 -0
- package/assets/css/mdc-editor.css +91 -0
- package/components/A11yModeToggle.vue +23 -0
- package/components/DarkModeToggle.vue +26 -0
- package/components/LinkIcon.vue +32 -0
- package/components/OgImage/ShadcnDocs.vue +55 -0
- package/components/ThemeCustomizer.vue +156 -0
- package/components/ThemePopover.vue +27 -0
- package/components/content/Accordion.vue +18 -0
- package/components/content/AccordionItem.vue +32 -0
- package/components/content/Alert.vue +100 -0
- package/components/content/Badge.vue +52 -0
- package/components/content/ButtonLink.vue +38 -0
- package/components/content/Callout.vue +17 -0
- package/components/content/Card.vue +173 -0
- package/components/content/CardGroup.vue +38 -0
- package/components/content/CodeCopy.vue +52 -0
- package/components/content/CodeGroup._vue +27 -0
- package/components/content/CodeSnippet._vue +78 -0
- package/components/content/Collapsible.vue +80 -0
- package/components/content/Field.vue +53 -0
- package/components/content/FieldGroup.vue +5 -0
- package/components/content/FileTree.vue +110 -0
- package/components/content/FileTreeItem.vue +64 -0
- package/components/content/FileTreeRoot.vue +27 -0
- package/components/content/Hero.vue +154 -0
- package/components/content/HeroAlt.vue +116 -0
- package/components/content/Icon.vue +69 -0
- package/components/content/Kbd.vue +20 -0
- package/components/content/PmInstall.vue +35 -0
- package/components/content/PmRun.vue +31 -0
- package/components/content/PmX.vue +31 -0
- package/components/content/ProseA.vue +21 -0
- package/components/content/ProseBlockquote.vue +5 -0
- package/components/content/ProseCode.vue +121 -0
- package/components/content/ProseCodeInline.vue +24 -0
- package/components/content/ProseEm.vue +5 -0
- package/components/content/ProseH1.vue +27 -0
- package/components/content/ProseH2.vue +22 -0
- package/components/content/ProseH3.vue +21 -0
- package/components/content/ProseH4.vue +21 -0
- package/components/content/ProseH5.vue +21 -0
- package/components/content/ProseH6.vue +21 -0
- package/components/content/ProseHr.vue +3 -0
- package/components/content/ProseImg.vue +42 -0
- package/components/content/ProseLi.vue +5 -0
- package/components/content/ProseOl.vue +5 -0
- package/components/content/ProseP.vue +5 -0
- package/components/content/ProsePre.vue +56 -0
- package/components/content/ProseSection.vue +27 -0
- package/components/content/ProseStrong.vue +5 -0
- package/components/content/ProseTable.vue +7 -0
- package/components/content/ProseTbody.vue +5 -0
- package/components/content/ProseTd.vue +5 -0
- package/components/content/ProseTh.vue +5 -0
- package/components/content/ProseThead.vue +5 -0
- package/components/content/ProseTr.vue +5 -0
- package/components/content/ProseUl.vue +5 -0
- package/components/content/ReadMore.vue +41 -0
- package/components/content/Shortcut.vue +20 -0
- package/components/content/Stack.vue +17 -0
- package/components/content/Steps.vue +23 -0
- package/components/content/Tabs.vue +52 -0
- package/components/content/TabsInner.vue +263 -0
- package/components/content/TeamCard.vue +52 -0
- package/components/content/TeamCardGroup.vue +5 -0
- package/components/content/global/AlertEditor.vue +58 -0
- package/components/content/global/BadgeEditor.vue +56 -0
- package/components/content/global/BrEditor.vue +3 -0
- package/components/content/global/CardEditor.vue +142 -0
- package/components/content/global/CardGroupEditor.vue +50 -0
- package/components/content/global/CodeGroup.vue +13 -0
- package/components/content/global/CodeGroupEditor.vue +50 -0
- package/components/content/global/DivEditor.vue +22 -0
- package/components/content/global/FieldEditor.vue +38 -0
- package/components/content/global/FieldGroupEditor.vue +24 -0
- package/components/content/global/HeroEditor.vue +67 -0
- package/components/content/global/ProseSectionEditor.vue +180 -0
- package/components/content/global/ReadMoreEditor.vue +70 -0
- package/components/content/global/SectionEditor.vue +22 -0
- package/components/content/global/StackEditor.vue +35 -0
- package/components/content/global/StepsEditor.vue +55 -0
- package/components/content/global/Tabs._vue +97 -0
- package/components/content/global/TabsEditor.vue +38 -0
- package/components/layout/Aside.vue +83 -0
- package/components/layout/AsideTree.vue +25 -0
- package/components/layout/AsideTreeItem.vue +86 -0
- package/components/layout/AsideTreeItemButton.vue +32 -0
- package/components/layout/Banner.vue +77 -0
- package/components/layout/Breadcrumb.vue +34 -0
- package/components/layout/DocsFooter.vue +6 -0
- package/components/layout/EditLink.vue +23 -0
- package/components/layout/Footer.vue +80 -0
- package/components/layout/FooterItem.vue +50 -0
- package/components/layout/FooterSubmenuItem.vue +39 -0
- package/components/layout/Header/Logo.vue +30 -0
- package/components/layout/Header/MenuItem.vue +83 -0
- package/components/layout/Header/Nav.vue +112 -0
- package/components/layout/Header/NavMobile.vue +14 -0
- package/components/layout/Header/NavMobileItem.vue +79 -0
- package/components/layout/Header/SubmenuItem.vue +39 -0
- package/components/layout/Header.vue +160 -0
- package/components/layout/LangSwitcher.vue +90 -0
- package/components/layout/MobileNav.vue +44 -0
- package/components/layout/PrevNext.vue +24 -0
- package/components/layout/PrevNextButton.vue +50 -0
- package/components/layout/SearchButton.vue +46 -0
- package/components/layout/SearchDialog.vue +217 -0
- package/components/layout/Title.vue +98 -0
- package/components/layout/Toc.vue +99 -0
- package/components/layout/TocTree.vue +42 -0
- package/components/ui/accordion/Accordion.vue +19 -0
- package/components/ui/accordion/AccordionContent.vue +24 -0
- package/components/ui/accordion/AccordionItem.vue +24 -0
- package/components/ui/accordion/AccordionTrigger.vue +39 -0
- package/components/ui/accordion/index.ts +4 -0
- package/components/ui/alert/Alert.vue +19 -0
- package/components/ui/alert/AlertDescription.vue +14 -0
- package/components/ui/alert/AlertTitle.vue +14 -0
- package/components/ui/alert/index.ts +23 -0
- package/components/ui/avatar/Avatar.vue +25 -0
- package/components/ui/avatar/AvatarFallback.vue +11 -0
- package/components/ui/avatar/AvatarImage.vue +12 -0
- package/components/ui/avatar/index.ts +24 -0
- package/components/ui/badge/Badge.vue +17 -0
- package/components/ui/badge/index.ts +71 -0
- package/components/ui/breadcrumb/Breadcrumb.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbItem.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbLink.vue +23 -0
- package/components/ui/breadcrumb/BreadcrumbList.vue +16 -0
- package/components/ui/breadcrumb/BreadcrumbPage.vue +19 -0
- package/components/ui/breadcrumb/BreadcrumbSeparator.vue +23 -0
- package/components/ui/breadcrumb/index.ts +6 -0
- package/components/ui/button/Button.vue +29 -0
- package/components/ui/button/index.ts +35 -0
- package/components/ui/card/Card.vue +21 -0
- package/components/ui/card/CardContent.vue +14 -0
- package/components/ui/card/CardDescription.vue +14 -0
- package/components/ui/card/CardFooter.vue +14 -0
- package/components/ui/card/CardHeader.vue +14 -0
- package/components/ui/card/CardTitle.vue +18 -0
- package/components/ui/card/index.ts +6 -0
- package/components/ui/collapsible/Collapsible.vue +18 -0
- package/components/ui/collapsible/CollapsibleContent.vue +14 -0
- package/components/ui/collapsible/CollapsibleTrigger.vue +11 -0
- package/components/ui/collapsible/index.ts +3 -0
- package/components/ui/command/Command.vue +89 -0
- package/components/ui/command/CommandEmpty.vue +30 -0
- package/components/ui/command/CommandGroup.vue +50 -0
- package/components/ui/command/CommandInput.vue +44 -0
- package/components/ui/command/CommandInputOnly.vue +50 -0
- package/components/ui/command/CommandItem.vue +79 -0
- package/components/ui/command/CommandList.vue +28 -0
- package/components/ui/command/CommandSeparator.vue +24 -0
- package/components/ui/command/index.ts +24 -0
- package/components/ui/dialog/Dialog.vue +14 -0
- package/components/ui/dialog/DialogClose.vue +11 -0
- package/components/ui/dialog/DialogContent.vue +52 -0
- package/components/ui/dialog/DialogDescription.vue +24 -0
- package/components/ui/dialog/DialogFooter.vue +19 -0
- package/components/ui/dialog/DialogHeader.vue +16 -0
- package/components/ui/dialog/DialogScrollContent.vue +61 -0
- package/components/ui/dialog/DialogTitle.vue +29 -0
- package/components/ui/dialog/DialogTrigger.vue +11 -0
- package/components/ui/dialog/index.ts +9 -0
- package/components/ui/input/Input.vue +27 -0
- package/components/ui/input/index.ts +1 -0
- package/components/ui/label/Label.vue +27 -0
- package/components/ui/label/index.ts +1 -0
- package/components/ui/navigation-menu/NavigationMenu.vue +33 -0
- package/components/ui/navigation-menu/NavigationMenuContent.vue +34 -0
- package/components/ui/navigation-menu/NavigationMenuIndicator.vue +24 -0
- package/components/ui/navigation-menu/NavigationMenuItem.vue +11 -0
- package/components/ui/navigation-menu/NavigationMenuLink.vue +19 -0
- package/components/ui/navigation-menu/NavigationMenuList.vue +33 -0
- package/components/ui/navigation-menu/NavigationMenuTrigger.vue +34 -0
- package/components/ui/navigation-menu/NavigationMenuViewport.vue +33 -0
- package/components/ui/navigation-menu/index.ts +14 -0
- package/components/ui/popover/Popover.vue +15 -0
- package/components/ui/popover/PopoverContent.vue +49 -0
- package/components/ui/popover/PopoverTrigger.vue +11 -0
- package/components/ui/popover/index.ts +4 -0
- package/components/ui/scroll-area/ScrollArea.vue +32 -0
- package/components/ui/scroll-area/ScrollBar.vue +41 -0
- package/components/ui/scroll-area/index.ts +2 -0
- package/components/ui/separator/Separator.vue +20 -0
- package/components/ui/separator/index.ts +1 -0
- package/components/ui/sheet/Sheet.vue +14 -0
- package/components/ui/sheet/SheetClose.vue +11 -0
- package/components/ui/sheet/SheetContent.vue +58 -0
- package/components/ui/sheet/SheetDescription.vue +22 -0
- package/components/ui/sheet/SheetFooter.vue +19 -0
- package/components/ui/sheet/SheetHeader.vue +16 -0
- package/components/ui/sheet/SheetTitle.vue +22 -0
- package/components/ui/sheet/SheetTrigger.vue +11 -0
- package/components/ui/sheet/index.ts +31 -0
- package/components/ui/slider/Slider.vue +36 -0
- package/components/ui/slider/index.ts +1 -0
- package/components/ui/tabs/Tabs.vue +15 -0
- package/components/ui/tabs/TabsContent.vue +22 -0
- package/components/ui/tabs/TabsList.vue +25 -0
- package/components/ui/tabs/TabsTrigger.vue +27 -0
- package/components/ui/tabs/index.ts +4 -0
- package/components/ui/textarea/Textarea.vue +27 -0
- package/components/ui/textarea/index.ts +1 -0
- package/components/ui/toast/Toast.vue +28 -0
- package/components/ui/toast/ToastAction.vue +22 -0
- package/components/ui/toast/ToastClose.vue +27 -0
- package/components/ui/toast/ToastDescription.vue +22 -0
- package/components/ui/toast/ToastProvider.vue +11 -0
- package/components/ui/toast/ToastTitle.vue +22 -0
- package/components/ui/toast/ToastViewport.vue +20 -0
- package/components/ui/toast/Toaster.vue +34 -0
- package/components/ui/toast/index.ts +38 -0
- package/components/ui/toast/use-toast.ts +165 -0
- package/components.json +18 -0
- package/composables/useBreadcrumb.ts +47 -0
- package/composables/useCollapsedMap.ts +3 -0
- package/composables/useConfig.ts +227 -0
- package/composables/useEditLink.ts +27 -0
- package/composables/useI18nDocs.ts +114 -0
- package/composables/useMdcMenu.ts +204 -0
- package/composables/usePm.ts +58 -0
- package/composables/useScrollspy.ts +51 -0
- package/composables/useThemes.ts +46 -0
- package/composables/useToast.ts +1 -0
- package/content/index.md +45 -0
- package/eslint.config.js +3 -0
- package/i18n/i18n.config.ts +414 -0
- package/index.d.ts +610 -0
- package/layouts/blank.vue +5 -0
- package/layouts/default.vue +9 -0
- package/layouts/editorial.vue +83 -0
- package/lib/registry/themes.ts +636 -0
- package/lib/uno-preset.ts +143 -0
- package/memory-bank/activeContext.md +17 -0
- package/memory-bank/productContext.md +21 -0
- package/memory-bank/progress.md +16 -0
- package/memory-bank/projectbrief.md +20 -0
- package/memory-bank/systemPatterns.md +25 -0
- package/memory-bank/techContext.md +29 -0
- package/modules/inject-css.ts +40 -0
- package/nuxt.config.ts +124 -0
- package/package.json +71 -0
- package/pages/[...slug].vue +109 -0
- package/pages/admin/[...slug].vue +145 -0
- package/pages/index.vue +24 -0
- package/plugins/injectCssHmr.ts +26 -0
- package/plugins/wordup.ts +130 -0
- package/public/content-doc.json +792 -0
- package/public/iconesjs.svg +4 -0
- package/scripts/buildContentDoc-cli.ts +8 -0
- package/scripts/buildContentDoc.ts +165 -0
- package/tailwind.config.js +1 -0
- package/tsconfig.json +3 -0
- package/uno.config.mjs +58 -0
- package/utils/index.ts +12 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export { default as Avatar } from './Avatar.vue'
|
|
4
|
+
export { default as AvatarFallback } from './AvatarFallback.vue'
|
|
5
|
+
export { default as AvatarImage } from './AvatarImage.vue'
|
|
6
|
+
|
|
7
|
+
export const avatarVariant = cva(
|
|
8
|
+
'inline-flex shrink-0 select-none items-center justify-center overflow-hidden bg-secondary font-normal text-foreground',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
sm: 'size-10 text-xs',
|
|
13
|
+
base: 'size-16 text-2xl',
|
|
14
|
+
lg: 'size-32 text-5xl',
|
|
15
|
+
},
|
|
16
|
+
shape: {
|
|
17
|
+
circle: 'rounded-full',
|
|
18
|
+
square: 'rounded-md',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export type AvatarVariants = VariantProps<typeof avatarVariant>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cn(badgeVariants({ variant, type }), props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { type BadgeVariants, badgeVariants } from '.'
|
|
10
|
+
import { cn } from '@/lib/utils'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
type?: BadgeVariants['type']
|
|
14
|
+
variant?: BadgeVariants['variant']
|
|
15
|
+
class?: HTMLAttributes['class']
|
|
16
|
+
}>()
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export { default as Badge } from './Badge.vue'
|
|
4
|
+
|
|
5
|
+
export const badgeVariants = cva(
|
|
6
|
+
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
type: {
|
|
10
|
+
default: 'bg-muted',
|
|
11
|
+
primary: 'bg-primary text-primary border-primary',
|
|
12
|
+
secondary: 'bg-secondary-foreground dark:bg-secondary text-secondary-foreground border-secondary-foreground',
|
|
13
|
+
info: 'bg-info text-info border-info',
|
|
14
|
+
warning: 'bg-warning text-warning border-warning',
|
|
15
|
+
success: 'bg-success text-success border-success',
|
|
16
|
+
danger: 'bg-danger text-danger border-danger',
|
|
17
|
+
new: 'bg-new text-new-foreground border-new',
|
|
18
|
+
// info: 'bg-sky-500 text-sky-500 border-sky-500',
|
|
19
|
+
// warning: 'bg-yellow-400 text-yellow-500 border-yellow-500',
|
|
20
|
+
// success: 'bg-green-500 text-green-600 border-green-600',
|
|
21
|
+
// danger: 'bg-red-500 text-red-500 border-red-500',
|
|
22
|
+
// new: 'bg-[#adfa1d] dark:text-[#adfa1d] border-[#adfa1d]',
|
|
23
|
+
},
|
|
24
|
+
variant: {
|
|
25
|
+
default:
|
|
26
|
+
'border-transparent !bg-opacity-15 !dark:bg-opacity-20', // cva breaks bg-opacity-* without !
|
|
27
|
+
fill:
|
|
28
|
+
'text-white border-transparent',
|
|
29
|
+
outline:
|
|
30
|
+
'!bg-opacity-0',
|
|
31
|
+
text:
|
|
32
|
+
'!bg-transparent border-transparent',
|
|
33
|
+
// default:
|
|
34
|
+
// 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
35
|
+
// secondary:
|
|
36
|
+
// 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
37
|
+
// destructive:
|
|
38
|
+
// 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
39
|
+
// outline: 'text-foreground',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
type: 'default',
|
|
44
|
+
variant: 'default',
|
|
45
|
+
},
|
|
46
|
+
compoundVariants: [
|
|
47
|
+
{
|
|
48
|
+
type: ['default', 'new'],
|
|
49
|
+
variant: 'default',
|
|
50
|
+
class: '!bg-opacity-80 !dark:bg-opacity-80',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: ['default'],
|
|
54
|
+
variant: 'fill',
|
|
55
|
+
class: 'text-inherit',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: ['new'],
|
|
59
|
+
variant: 'fill',
|
|
60
|
+
class: '!text-new-foreground',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: ['new'],
|
|
64
|
+
variant: ['outline', 'text'],
|
|
65
|
+
class: 'dark:text-new',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav
|
|
3
|
+
aria-label="breadcrumb"
|
|
4
|
+
:class="props.class"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</nav>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import type { HTMLAttributes } from 'vue'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
class?: HTMLAttributes['class']
|
|
15
|
+
}>()
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
:class="cn('inline-flex items-center gap-1.5', props.class)"
|
|
4
|
+
>
|
|
5
|
+
<slot />
|
|
6
|
+
</li>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import type { HTMLAttributes } from 'vue'
|
|
11
|
+
import { cn } from '@/lib/utils'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
class?: HTMLAttributes['class']
|
|
15
|
+
}>()
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Primitive
|
|
3
|
+
:as="as"
|
|
4
|
+
:as-child="asChild"
|
|
5
|
+
:class="cn('transition-colors hover:text-foreground', props.class)"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</Primitive>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import type { HTMLAttributes } from 'vue'
|
|
13
|
+
import { Primitive, type PrimitiveProps } from 'reka-ui'
|
|
14
|
+
import { cn } from '@/lib/utils'
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>(),
|
|
18
|
+
{
|
|
19
|
+
as: 'a',
|
|
20
|
+
class: '',
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ol
|
|
3
|
+
:class="cn('flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5', props.class)"
|
|
4
|
+
>
|
|
5
|
+
<slot />
|
|
6
|
+
</ol>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import type { HTMLAttributes } from 'vue'
|
|
11
|
+
import { cn } from '@/lib/utils'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
class?: HTMLAttributes['class']
|
|
15
|
+
}>()
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
role="link"
|
|
4
|
+
aria-disabled="true"
|
|
5
|
+
aria-current="page"
|
|
6
|
+
:class="cn('font-normal text-foreground', props.class)"
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
</span>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import type { HTMLAttributes } from 'vue'
|
|
14
|
+
import { cn } from '@/lib/utils'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
class?: HTMLAttributes['class']
|
|
18
|
+
}>()
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
role="presentation"
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
:class="cn('[&>svg]:size-3.5', props.class)"
|
|
6
|
+
>
|
|
7
|
+
<slot>
|
|
8
|
+
<NuxtIcon
|
|
9
|
+
name="lucide:chevron-right"
|
|
10
|
+
class="block size-3.5 mt-0.5"
|
|
11
|
+
/>
|
|
12
|
+
</slot>
|
|
13
|
+
</li>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import type { HTMLAttributes } from 'vue'
|
|
18
|
+
import { cn } from '@/lib/utils'
|
|
19
|
+
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
class?: HTMLAttributes['class']
|
|
22
|
+
}>()
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Breadcrumb } from './Breadcrumb.vue'
|
|
2
|
+
export { default as BreadcrumbItem } from './BreadcrumbItem.vue'
|
|
3
|
+
export { default as BreadcrumbLink } from './BreadcrumbLink.vue'
|
|
4
|
+
export { default as BreadcrumbList } from './BreadcrumbList.vue'
|
|
5
|
+
export { default as BreadcrumbPage } from './BreadcrumbPage.vue'
|
|
6
|
+
export { default as BreadcrumbSeparator } from './BreadcrumbSeparator.vue'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Primitive
|
|
3
|
+
:as="as"
|
|
4
|
+
:as-child="asChild"
|
|
5
|
+
:class="cn(buttonVariants({ variant, size }), props.class)"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</Primitive>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { HTMLAttributes } from 'vue'
|
|
13
|
+
import { Primitive, type PrimitiveProps } from 'reka-ui'
|
|
14
|
+
import { type ButtonVariants, buttonVariants } from '.'
|
|
15
|
+
import { cn } from '@/lib/utils'
|
|
16
|
+
|
|
17
|
+
interface Props extends PrimitiveProps {
|
|
18
|
+
variant?: ButtonVariants['variant']
|
|
19
|
+
size?: ButtonVariants['size']
|
|
20
|
+
class?: HTMLAttributes['class']
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
24
|
+
variant: 'default',
|
|
25
|
+
size: 'default',
|
|
26
|
+
class: '',
|
|
27
|
+
as: 'button',
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
export { default as Button } from './Button.vue'
|
|
4
|
+
|
|
5
|
+
export const buttonVariants = cva(
|
|
6
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
11
|
+
destructive:
|
|
12
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
13
|
+
outline:
|
|
14
|
+
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
15
|
+
secondary:
|
|
16
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
17
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: 'h-10 px-4 py-2',
|
|
22
|
+
xs: 'h-7 rounded px-2',
|
|
23
|
+
sm: 'h-9 rounded-md px-3',
|
|
24
|
+
lg: 'h-11 rounded-md px-8',
|
|
25
|
+
icon: 'size-10',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: 'default',
|
|
30
|
+
size: 'default',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="
|
|
4
|
+
cn(
|
|
5
|
+
'rounded-lg border bg-card text-card-foreground shadow-sm',
|
|
6
|
+
props.class,
|
|
7
|
+
)
|
|
8
|
+
"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import type { HTMLAttributes } from 'vue'
|
|
16
|
+
import { cn } from '@/lib/utils'
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
class?: HTMLAttributes['class']
|
|
20
|
+
}>()
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cn('p-6 pt-0', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/lib/utils'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p :class="cn('text-sm text-muted-foreground', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</p>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/lib/utils'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cn('flex items-center p-6 pt-0', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/lib/utils'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cn('flex flex-col gap-y-1.5 p-6', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/lib/utils'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h3
|
|
3
|
+
:class="
|
|
4
|
+
cn('text-2xl font-semibold leading-none tracking-tight', props.class)
|
|
5
|
+
"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</h3>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { HTMLAttributes } from 'vue'
|
|
13
|
+
import { cn } from '@/lib/utils'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
class?: HTMLAttributes['class']
|
|
17
|
+
}>()
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Card } from './Card.vue'
|
|
2
|
+
export { default as CardContent } from './CardContent.vue'
|
|
3
|
+
export { default as CardDescription } from './CardDescription.vue'
|
|
4
|
+
export { default as CardFooter } from './CardFooter.vue'
|
|
5
|
+
export { default as CardHeader } from './CardHeader.vue'
|
|
6
|
+
export { default as CardTitle } from './CardTitle.vue'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CollapsibleRoot
|
|
3
|
+
v-slot="{ open }"
|
|
4
|
+
v-bind="forwarded"
|
|
5
|
+
>
|
|
6
|
+
<slot :open="open" />
|
|
7
|
+
</CollapsibleRoot>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui'
|
|
12
|
+
import { CollapsibleRoot, useForwardPropsEmits } from 'reka-ui'
|
|
13
|
+
|
|
14
|
+
const props = defineProps<CollapsibleRootProps>()
|
|
15
|
+
const emits = defineEmits<CollapsibleRootEmits>()
|
|
16
|
+
|
|
17
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CollapsibleContent
|
|
3
|
+
v-bind="props"
|
|
4
|
+
class="overflow-hidden transition-all data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</CollapsibleContent>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { CollapsibleContent, type CollapsibleContentProps } from 'reka-ui'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<CollapsibleContentProps>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CollapsibleTrigger v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</CollapsibleTrigger>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { CollapsibleTrigger, type CollapsibleTriggerProps } from 'reka-ui'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<CollapsibleTriggerProps>()
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListboxRoot
|
|
3
|
+
v-bind="forwarded"
|
|
4
|
+
:class="cn('flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</ListboxRoot>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type { ListboxRootEmits, ListboxRootProps } from 'reka-ui'
|
|
12
|
+
import type { HTMLAttributes } from 'vue'
|
|
13
|
+
import { ListboxRoot, useFilter, useForwardPropsEmits } from 'reka-ui'
|
|
14
|
+
import { computed, reactive, ref, watch } from 'vue'
|
|
15
|
+
import { provideCommandContext } from '.'
|
|
16
|
+
import { cn } from '@/lib/utils'
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes['class'] }>(), {
|
|
19
|
+
modelValue: '',
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const emits = defineEmits<ListboxRootEmits>()
|
|
23
|
+
|
|
24
|
+
const delegatedProps = computed(() => {
|
|
25
|
+
const { class: _, ...delegated } = props
|
|
26
|
+
|
|
27
|
+
return delegated
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
31
|
+
|
|
32
|
+
const allItems = ref<Map<string, string>>(new Map())
|
|
33
|
+
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
|
34
|
+
|
|
35
|
+
const { contains } = useFilter({ sensitivity: 'base' })
|
|
36
|
+
const filterState = reactive({
|
|
37
|
+
search: '',
|
|
38
|
+
filtered: {
|
|
39
|
+
/** The count of all visible items. */
|
|
40
|
+
count: 0,
|
|
41
|
+
/** Map from visible item id to its search score. */
|
|
42
|
+
items: new Map() as Map<string, number>,
|
|
43
|
+
/** Set of groups with at least one visible item. */
|
|
44
|
+
groups: new Set() as Set<string>,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
function filterItems() {
|
|
49
|
+
if (!filterState.search) {
|
|
50
|
+
filterState.filtered.count = allItems.value.size
|
|
51
|
+
// Do nothing, each item will know to show itself because search is empty
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Reset the groups
|
|
56
|
+
filterState.filtered.groups = new Set()
|
|
57
|
+
let itemCount = 0
|
|
58
|
+
|
|
59
|
+
// Check which items should be included
|
|
60
|
+
for (const [id, value] of allItems.value) {
|
|
61
|
+
const score = contains(value, filterState.search)
|
|
62
|
+
filterState.filtered.items.set(id, score ? 1 : 0)
|
|
63
|
+
if (score)
|
|
64
|
+
itemCount++
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check which groups have at least 1 item shown
|
|
68
|
+
for (const [groupId, group] of allGroups.value) {
|
|
69
|
+
for (const itemId of group) {
|
|
70
|
+
if (filterState.filtered.items.get(itemId)! > 0) {
|
|
71
|
+
filterState.filtered.groups.add(groupId)
|
|
72
|
+
break
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
filterState.filtered.count = itemCount
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
watch(() => filterState.search, () => {
|
|
81
|
+
filterItems()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
provideCommandContext({
|
|
85
|
+
allItems,
|
|
86
|
+
allGroups,
|
|
87
|
+
filterState,
|
|
88
|
+
})
|
|
89
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Primitive
|
|
3
|
+
v-if="isRender"
|
|
4
|
+
v-bind="delegatedProps"
|
|
5
|
+
:class="cn('py-6 text-center text-sm', props.class)"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</Primitive>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
13
|
+
import type { HTMLAttributes } from 'vue'
|
|
14
|
+
import { Primitive } from 'reka-ui'
|
|
15
|
+
import { computed } from 'vue'
|
|
16
|
+
import { useCommand } from '.'
|
|
17
|
+
import { cn } from '@/lib/utils'
|
|
18
|
+
|
|
19
|
+
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>()
|
|
20
|
+
|
|
21
|
+
const delegatedProps = computed(() => {
|
|
22
|
+
const { class: _, ...delegated } = props
|
|
23
|
+
|
|
24
|
+
return delegated
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const { filterState } = useCommand()
|
|
28
|
+
const isRender = computed(() => !!filterState.search && filterState.filtered.count === 0,
|
|
29
|
+
)
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListboxGroup
|
|
3
|
+
v-bind="delegatedProps"
|
|
4
|
+
:id="id"
|
|
5
|
+
:class="cn('overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground', props.class)"
|
|
6
|
+
:hidden="isRender ? undefined : true"
|
|
7
|
+
>
|
|
8
|
+
<ListboxGroupLabel
|
|
9
|
+
v-if="heading"
|
|
10
|
+
class="text-muted-foreground px-2 py-1.5 text-xs font-medium"
|
|
11
|
+
>
|
|
12
|
+
{{ heading }}
|
|
13
|
+
</ListboxGroupLabel>
|
|
14
|
+
<slot />
|
|
15
|
+
</ListboxGroup>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import type { ListboxGroupProps } from 'reka-ui'
|
|
20
|
+
import type { HTMLAttributes } from 'vue'
|
|
21
|
+
import { ListboxGroup, ListboxGroupLabel, useId } from 'reka-ui'
|
|
22
|
+
import { computed, onMounted, onUnmounted } from 'vue'
|
|
23
|
+
import { provideCommandGroupContext, useCommand } from '.'
|
|
24
|
+
import { cn } from '@/lib/utils'
|
|
25
|
+
|
|
26
|
+
const props = defineProps<ListboxGroupProps & {
|
|
27
|
+
class?: HTMLAttributes['class']
|
|
28
|
+
heading?: string
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const delegatedProps = computed(() => {
|
|
32
|
+
const { class: _, ...delegated } = props
|
|
33
|
+
|
|
34
|
+
return delegated
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const { allGroups, filterState } = useCommand()
|
|
38
|
+
const id = useId()
|
|
39
|
+
|
|
40
|
+
const isRender = computed(() => !filterState.search ? true : filterState.filtered.groups.has(id))
|
|
41
|
+
|
|
42
|
+
provideCommandGroupContext({ id })
|
|
43
|
+
onMounted(() => {
|
|
44
|
+
if (!allGroups.value.has(id))
|
|
45
|
+
allGroups.value.set(id, new Set())
|
|
46
|
+
})
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
allGroups.value.delete(id)
|
|
49
|
+
})
|
|
50
|
+
</script>
|