create-nala 3.0.3 → 3.0.4
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/package.json +6 -6
- package/template/package.json +1 -1
- package/template/src/components/ui/alert/Alert.vue +8 -8
- package/template/src/components/ui/alert/AlertDescription.vue +5 -5
- package/template/src/components/ui/alert/AlertTitle.vue +5 -5
- package/template/src/components/ui/alert-dialog/AlertDialog.vue +6 -6
- package/template/src/components/ui/alert-dialog/AlertDialogAction.vue +9 -9
- package/template/src/components/ui/alert-dialog/AlertDialogCancel.vue +9 -9
- package/template/src/components/ui/alert-dialog/AlertDialogContent.vue +20 -20
- package/template/src/components/ui/alert-dialog/AlertDialogDescription.vue +10 -10
- package/template/src/components/ui/alert-dialog/AlertDialogFooter.vue +5 -5
- package/template/src/components/ui/alert-dialog/AlertDialogHeader.vue +5 -5
- package/template/src/components/ui/alert-dialog/AlertDialogTitle.vue +8 -8
- package/template/src/components/ui/alert-dialog/AlertDialogTrigger.vue +3 -3
- package/template/src/components/ui/alert-dialog/index.ts +8 -8
- package/template/src/components/ui/avatar/AvatarFallback.vue +8 -8
- package/template/src/components/ui/avatar/AvatarImage.vue +3 -3
- package/template/src/components/ui/breadcrumb/Breadcrumb.vue +4 -4
- package/template/src/components/ui/breadcrumb/BreadcrumbEllipsis.vue +6 -6
- package/template/src/components/ui/breadcrumb/BreadcrumbItem.vue +5 -5
- package/template/src/components/ui/breadcrumb/BreadcrumbLink.vue +7 -7
- package/template/src/components/ui/breadcrumb/BreadcrumbList.vue +5 -5
- package/template/src/components/ui/breadcrumb/BreadcrumbPage.vue +5 -5
- package/template/src/components/ui/breadcrumb/BreadcrumbSeparator.vue +6 -6
- package/template/src/components/ui/breadcrumb/index.ts +6 -6
- package/template/src/components/ui/button/Button.vue +15 -15
- package/template/src/components/ui/card/CardAction.vue +5 -5
- package/template/src/components/ui/card/CardContent.vue +5 -5
- package/template/src/components/ui/card/CardDescription.vue +5 -5
- package/template/src/components/ui/card/CardFooter.vue +5 -5
- package/template/src/components/ui/card/CardTitle.vue +5 -5
- package/template/src/components/ui/card/index.ts +6 -6
- package/template/src/components/ui/command/Command.vue +75 -75
- package/template/src/components/ui/command/CommandDialog.vue +14 -14
- package/template/src/components/ui/command/CommandEmpty.vue +14 -14
- package/template/src/components/ui/command/CommandGroup.vue +27 -27
- package/template/src/components/ui/command/CommandInput.vue +20 -20
- package/template/src/components/ui/command/CommandItem.vue +57 -57
- package/template/src/components/ui/command/CommandList.vue +10 -10
- package/template/src/components/ui/command/CommandSeparator.vue +8 -8
- package/template/src/components/ui/command/CommandShortcut.vue +5 -5
- package/template/src/components/ui/command/index.ts +24 -24
- package/template/src/components/ui/dialog/Dialog.vue +6 -6
- package/template/src/components/ui/dialog/DialogClose.vue +3 -3
- package/template/src/components/ui/dialog/DialogContent.vue +24 -24
- package/template/src/components/ui/dialog/DialogDescription.vue +10 -10
- package/template/src/components/ui/dialog/DialogFooter.vue +10 -10
- package/template/src/components/ui/dialog/DialogHeader.vue +5 -5
- package/template/src/components/ui/dialog/DialogOverlay.vue +8 -8
- package/template/src/components/ui/dialog/DialogScrollContent.vue +22 -22
- package/template/src/components/ui/dialog/DialogTitle.vue +10 -10
- package/template/src/components/ui/dialog/DialogTrigger.vue +3 -3
- package/template/src/components/ui/dialog/index.ts +9 -9
- package/template/src/components/ui/dropdown-menu/DropdownMenu.vue +6 -6
- package/template/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +16 -16
- package/template/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +3 -3
- package/template/src/components/ui/dropdown-menu/DropdownMenuItem.vue +16 -16
- package/template/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +9 -9
- package/template/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +9 -9
- package/template/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +17 -17
- package/template/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +12 -12
- package/template/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +5 -5
- package/template/src/components/ui/dropdown-menu/DropdownMenuSub.vue +9 -9
- package/template/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +14 -14
- package/template/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +13 -13
- package/template/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +5 -5
- package/template/src/components/ui/dropdown-menu/index.ts +15 -15
- package/template/src/components/ui/form/FormControl.vue +3 -3
- package/template/src/components/ui/form/FormDescription.vue +8 -8
- package/template/src/components/ui/form/FormItem.vue +11 -11
- package/template/src/components/ui/form/FormLabel.vue +8 -8
- package/template/src/components/ui/form/FormMessage.vue +10 -10
- package/template/src/components/ui/form/index.ts +6 -6
- package/template/src/components/ui/form/injectionKeys.ts +3 -3
- package/template/src/components/ui/form/useFormField.ts +29 -29
- package/template/src/components/ui/input/Input.vue +17 -17
- package/template/src/components/ui/label/Label.vue +8 -8
- package/template/src/components/ui/pagination/Pagination.vue +12 -12
- package/template/src/components/ui/pagination/PaginationContent.vue +8 -8
- package/template/src/components/ui/pagination/PaginationEllipsis.vue +9 -9
- package/template/src/components/ui/pagination/PaginationFirst.vue +17 -17
- package/template/src/components/ui/pagination/PaginationItem.vue +16 -16
- package/template/src/components/ui/pagination/PaginationLast.vue +17 -17
- package/template/src/components/ui/pagination/PaginationNext.vue +17 -17
- package/template/src/components/ui/pagination/PaginationPrevious.vue +17 -17
- package/template/src/components/ui/pagination/index.ts +7 -7
- package/template/src/components/ui/popover/Popover.vue +6 -6
- package/template/src/components/ui/popover/PopoverAnchor.vue +3 -3
- package/template/src/components/ui/popover/PopoverContent.vue +25 -25
- package/template/src/components/ui/popover/PopoverTrigger.vue +3 -3
- package/template/src/components/ui/popover/index.ts +3 -3
- package/template/src/components/ui/select/Select.vue +6 -6
- package/template/src/components/ui/select/SelectContent.vue +26 -26
- package/template/src/components/ui/select/SelectGroup.vue +3 -3
- package/template/src/components/ui/select/SelectItem.vue +16 -16
- package/template/src/components/ui/select/SelectItemText.vue +3 -3
- package/template/src/components/ui/select/SelectLabel.vue +5 -5
- package/template/src/components/ui/select/SelectScrollDownButton.vue +11 -11
- package/template/src/components/ui/select/SelectScrollUpButton.vue +11 -11
- package/template/src/components/ui/select/SelectSeparator.vue +8 -8
- package/template/src/components/ui/select/SelectTrigger.vue +13 -13
- package/template/src/components/ui/select/SelectValue.vue +3 -3
- package/template/src/components/ui/select/index.ts +10 -10
- package/template/src/components/ui/separator/Separator.vue +13 -13
- package/template/src/components/ui/sheet/Sheet.vue +6 -6
- package/template/src/components/ui/sheet/SheetClose.vue +3 -3
- package/template/src/components/ui/sheet/SheetContent.vue +29 -29
- package/template/src/components/ui/sheet/SheetDescription.vue +8 -8
- package/template/src/components/ui/sheet/SheetFooter.vue +3 -3
- package/template/src/components/ui/sheet/SheetHeader.vue +3 -3
- package/template/src/components/ui/sheet/SheetOverlay.vue +8 -8
- package/template/src/components/ui/sheet/SheetTitle.vue +8 -8
- package/template/src/components/ui/sheet/SheetTrigger.vue +3 -3
- package/template/src/components/ui/sheet/index.ts +7 -7
- package/template/src/components/ui/sidebar/Sidebar.vue +18 -18
- package/template/src/components/ui/sidebar/SidebarContent.vue +6 -6
- package/template/src/components/ui/sidebar/SidebarControl.vue +0 -3
- package/template/src/components/ui/sidebar/SidebarFooter.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarGroup.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarGroupAction.vue +7 -7
- package/template/src/components/ui/sidebar/SidebarGroupContent.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarGroupLabel.vue +7 -7
- package/template/src/components/ui/sidebar/SidebarHeader.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarInput.vue +6 -6
- package/template/src/components/ui/sidebar/SidebarInset.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarMenu.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarMenuAction.vue +10 -10
- package/template/src/components/ui/sidebar/SidebarMenuBadge.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarMenuButton.vue +21 -21
- package/template/src/components/ui/sidebar/SidebarMenuButtonChild.vue +18 -18
- package/template/src/components/ui/sidebar/SidebarMenuItem.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarMenuSkeleton.vue +12 -12
- package/template/src/components/ui/sidebar/SidebarMenuSub.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarMenuSubButton.vue +12 -12
- package/template/src/components/ui/sidebar/SidebarMenuSubItem.vue +5 -5
- package/template/src/components/ui/sidebar/SidebarProvider.vue +4 -8
- package/template/src/components/ui/sidebar/SidebarRail.vue +8 -8
- package/template/src/components/ui/sidebar/SidebarSeparator.vue +6 -6
- package/template/src/components/ui/sidebar/SidebarTrigger.vue +10 -10
- package/template/src/components/ui/sidebar/utils.ts +1 -1
- package/template/src/components/ui/skeleton/Skeleton.vue +7 -7
- package/template/src/components/ui/sonner/Sonner.vue +5 -5
- package/template/src/components/ui/switch/Switch.vue +16 -16
- package/template/src/components/ui/table/Table.vue +5 -5
- package/template/src/components/ui/table/TableBody.vue +5 -5
- package/template/src/components/ui/table/TableCaption.vue +5 -5
- package/template/src/components/ui/table/TableCell.vue +5 -5
- package/template/src/components/ui/table/TableEmpty.vue +13 -13
- package/template/src/components/ui/table/TableFooter.vue +5 -5
- package/template/src/components/ui/table/TableHead.vue +5 -5
- package/template/src/components/ui/table/TableHeader.vue +5 -5
- package/template/src/components/ui/table/TableRow.vue +5 -5
- package/template/src/components/ui/table/index.ts +8 -8
- package/template/src/components/ui/table/utils.ts +9 -9
- package/template/src/components/ui/tabs/Tabs.vue +10 -10
- package/template/src/components/ui/tabs/TabsContent.vue +8 -8
- package/template/src/components/ui/tabs/TabsList.vue +8 -8
- package/template/src/components/ui/tabs/TabsTrigger.vue +10 -10
- package/template/src/components/ui/tabs/index.ts +3 -3
- package/template/src/components/ui/textarea/Textarea.vue +17 -17
- package/template/src/components/ui/tooltip/Tooltip.vue +6 -6
- package/template/src/components/ui/tooltip/TooltipContent.vue +17 -17
- package/template/src/components/ui/tooltip/TooltipProvider.vue +5 -5
- package/template/src/components/ui/tooltip/TooltipTrigger.vue +3 -3
- package/template/src/components/ui/tooltip/index.ts +3 -3
- package/template/src/lib/utils.ts +6 -6
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxRootEmits, ListboxRootProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
-
import { ListboxRoot, useFilter, useForwardPropsEmits } from "reka-ui"
|
|
6
|
-
import { reactive, ref, watch } from "vue"
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
import { provideCommandContext } from "."
|
|
9
|
-
|
|
10
|
-
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes["class"] }>(), {
|
|
11
|
-
modelValue: "",
|
|
12
|
-
highlightOnHover: true,
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const emits = defineEmits<ListboxRootEmits>()
|
|
16
|
-
|
|
17
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
18
|
-
|
|
19
|
-
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
20
|
-
|
|
21
|
-
const allItems = ref<Map<string, string>>(new Map())
|
|
22
|
-
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
|
23
|
-
|
|
24
|
-
const { contains } = useFilter({ sensitivity: "base" })
|
|
25
|
-
const filterState = reactive({
|
|
26
|
-
search: "",
|
|
27
|
-
filtered: {
|
|
28
|
-
/** The count of all visible items. */
|
|
29
|
-
count: 0,
|
|
30
|
-
/** Map from visible item id to its search score. */
|
|
31
|
-
items: new Map() as Map<string, number>,
|
|
32
|
-
/** Set of groups with at least one visible item. */
|
|
33
|
-
groups: new Set() as Set<string>,
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
function filterItems() {
|
|
38
|
-
if (!filterState.search) {
|
|
39
|
-
filterState.filtered.count = allItems.value.size
|
|
40
|
-
// Do nothing, each item will know to show itself because search is empty
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Reset the groups
|
|
45
|
-
filterState.filtered.groups = new Set()
|
|
46
|
-
let itemCount = 0
|
|
47
|
-
|
|
48
|
-
// Check which items should be included
|
|
49
|
-
for (const [id, value] of allItems.value) {
|
|
50
|
-
const score = contains(value, filterState.search)
|
|
51
|
-
filterState.filtered.items.set(id, score ? 1 : 0)
|
|
52
|
-
if (score)
|
|
53
|
-
itemCount++
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Check which groups have at least 1 item shown
|
|
57
|
-
for (const [groupId, group] of allGroups.value) {
|
|
58
|
-
for (const itemId of group) {
|
|
59
|
-
if (filterState.filtered.items.get(itemId)! > 0) {
|
|
60
|
-
filterState.filtered.groups.add(groupId)
|
|
61
|
-
break
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
filterState.filtered.count = itemCount
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
watch(() => filterState.search, () => {
|
|
70
|
-
filterItems()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
provideCommandContext({
|
|
74
|
-
allItems,
|
|
75
|
-
allGroups,
|
|
76
|
-
filterState,
|
|
2
|
+
import type { ListboxRootEmits, ListboxRootProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxRoot, useFilter, useForwardPropsEmits } from "reka-ui"
|
|
6
|
+
import { reactive, ref, watch } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { provideCommandContext } from "."
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes["class"] }>(), {
|
|
11
|
+
modelValue: "",
|
|
12
|
+
highlightOnHover: true,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const emits = defineEmits<ListboxRootEmits>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
18
|
+
|
|
19
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
20
|
+
|
|
21
|
+
const allItems = ref<Map<string, string>>(new Map())
|
|
22
|
+
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
|
23
|
+
|
|
24
|
+
const { contains } = useFilter({ sensitivity: "base" })
|
|
25
|
+
const filterState = reactive({
|
|
26
|
+
search: "",
|
|
27
|
+
filtered: {
|
|
28
|
+
/** The count of all visible items. */
|
|
29
|
+
count: 0,
|
|
30
|
+
/** Map from visible item id to its search score. */
|
|
31
|
+
items: new Map() as Map<string, number>,
|
|
32
|
+
/** Set of groups with at least one visible item. */
|
|
33
|
+
groups: new Set() as Set<string>,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function filterItems() {
|
|
38
|
+
if (!filterState.search) {
|
|
39
|
+
filterState.filtered.count = allItems.value.size
|
|
40
|
+
// Do nothing, each item will know to show itself because search is empty
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Reset the groups
|
|
45
|
+
filterState.filtered.groups = new Set()
|
|
46
|
+
let itemCount = 0
|
|
47
|
+
|
|
48
|
+
// Check which items should be included
|
|
49
|
+
for (const [id, value] of allItems.value) {
|
|
50
|
+
const score = contains(value, filterState.search)
|
|
51
|
+
filterState.filtered.items.set(id, score ? 1 : 0)
|
|
52
|
+
if (score)
|
|
53
|
+
itemCount++
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Check which groups have at least 1 item shown
|
|
57
|
+
for (const [groupId, group] of allGroups.value) {
|
|
58
|
+
for (const itemId of group) {
|
|
59
|
+
if (filterState.filtered.items.get(itemId)! > 0) {
|
|
60
|
+
filterState.filtered.groups.add(groupId)
|
|
61
|
+
break
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
filterState.filtered.count = itemCount
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
watch(() => filterState.search, () => {
|
|
70
|
+
filterItems()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
provideCommandContext({
|
|
74
|
+
allItems,
|
|
75
|
+
allGroups,
|
|
76
|
+
filterState,
|
|
77
77
|
})
|
|
78
78
|
</script>
|
|
79
79
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
-
import { useForwardPropsEmits } from "reka-ui"
|
|
4
|
-
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
|
5
|
-
import Command from "./Command.vue"
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<DialogRootProps & {
|
|
8
|
-
title?: string
|
|
9
|
-
description?: string
|
|
10
|
-
}>(), {
|
|
11
|
-
title: "Command Palette",
|
|
12
|
-
description: "Search for a command to run...",
|
|
13
|
-
})
|
|
14
|
-
const emits = defineEmits<DialogRootEmits>()
|
|
15
|
-
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
+
import { useForwardPropsEmits } from "reka-ui"
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
|
5
|
+
import Command from "./Command.vue"
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<DialogRootProps & {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
}>(), {
|
|
11
|
+
title: "Command Palette",
|
|
12
|
+
description: "Search for a command to run...",
|
|
13
|
+
})
|
|
14
|
+
const emits = defineEmits<DialogRootEmits>()
|
|
15
|
+
|
|
16
16
|
const forwarded = useForwardPropsEmits(props, emits)
|
|
17
17
|
</script>
|
|
18
18
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { PrimitiveProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
-
import { Primitive } from "reka-ui"
|
|
6
|
-
import { computed } from "vue"
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
import { useCommand } from "."
|
|
9
|
-
|
|
10
|
-
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
-
|
|
12
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
13
|
-
|
|
14
|
-
const { filterState } = useCommand()
|
|
15
|
-
const isRender = computed(() => !!filterState.search && filterState.filtered.count === 0,
|
|
2
|
+
import type { PrimitiveProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { Primitive } from "reka-ui"
|
|
6
|
+
import { computed } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
+
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
13
|
+
|
|
14
|
+
const { filterState } = useCommand()
|
|
15
|
+
const isRender = computed(() => !!filterState.search && filterState.filtered.count === 0,
|
|
16
16
|
)
|
|
17
17
|
</script>
|
|
18
18
|
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxGroupProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
-
import { ListboxGroup, ListboxGroupLabel, useId } from "reka-ui"
|
|
6
|
-
import { computed, onMounted, onUnmounted } from "vue"
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
import { provideCommandGroupContext, useCommand } from "."
|
|
9
|
-
|
|
10
|
-
const props = defineProps<ListboxGroupProps & {
|
|
11
|
-
class?: HTMLAttributes["class"]
|
|
12
|
-
heading?: string
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
16
|
-
|
|
17
|
-
const { allGroups, filterState } = useCommand()
|
|
18
|
-
const id = useId()
|
|
19
|
-
|
|
20
|
-
const isRender = computed(() => !filterState.search ? true : filterState.filtered.groups.has(id))
|
|
21
|
-
|
|
22
|
-
provideCommandGroupContext({ id })
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
if (!allGroups.value.has(id))
|
|
25
|
-
allGroups.value.set(id, new Set())
|
|
26
|
-
})
|
|
27
|
-
onUnmounted(() => {
|
|
28
|
-
allGroups.value.delete(id)
|
|
2
|
+
import type { ListboxGroupProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxGroup, ListboxGroupLabel, useId } from "reka-ui"
|
|
6
|
+
import { computed, onMounted, onUnmounted } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { provideCommandGroupContext, useCommand } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<ListboxGroupProps & {
|
|
11
|
+
class?: HTMLAttributes["class"]
|
|
12
|
+
heading?: string
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
16
|
+
|
|
17
|
+
const { allGroups, filterState } = useCommand()
|
|
18
|
+
const id = useId()
|
|
19
|
+
|
|
20
|
+
const isRender = computed(() => !filterState.search ? true : filterState.filtered.groups.has(id))
|
|
21
|
+
|
|
22
|
+
provideCommandGroupContext({ id })
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
if (!allGroups.value.has(id))
|
|
25
|
+
allGroups.value.set(id, new Set())
|
|
26
|
+
})
|
|
27
|
+
onUnmounted(() => {
|
|
28
|
+
allGroups.value.delete(id)
|
|
29
29
|
})
|
|
30
30
|
</script>
|
|
31
31
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxFilterProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { Search } from "@lucide/vue"
|
|
5
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
6
|
-
import { ListboxFilter, useForwardProps } from "reka-ui"
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
import { useCommand } from "."
|
|
9
|
-
|
|
10
|
-
defineOptions({
|
|
11
|
-
inheritAttrs: false,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const props = defineProps<ListboxFilterProps & {
|
|
15
|
-
class?: HTMLAttributes["class"]
|
|
16
|
-
}>()
|
|
17
|
-
|
|
18
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
19
|
-
|
|
20
|
-
const forwardedProps = useForwardProps(delegatedProps)
|
|
21
|
-
|
|
2
|
+
import type { ListboxFilterProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { Search } from "@lucide/vue"
|
|
5
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
6
|
+
import { ListboxFilter, useForwardProps } from "reka-ui"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand } from "."
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const props = defineProps<ListboxFilterProps & {
|
|
15
|
+
class?: HTMLAttributes["class"]
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
19
|
+
|
|
20
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
21
|
+
|
|
22
22
|
const { filterState } = useCommand()
|
|
23
23
|
</script>
|
|
24
24
|
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxItemEmits, ListboxItemProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit, useCurrentElement } from "@vueuse/core"
|
|
5
|
-
import { ListboxItem, useForwardPropsEmits, useId } from "reka-ui"
|
|
6
|
-
import { computed, onMounted, onUnmounted, ref } from "vue"
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
import { useCommand, useCommandGroup } from "."
|
|
9
|
-
|
|
10
|
-
const props = defineProps<ListboxItemProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
-
const emits = defineEmits<ListboxItemEmits>()
|
|
12
|
-
|
|
13
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
14
|
-
|
|
15
|
-
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
16
|
-
|
|
17
|
-
const id = useId()
|
|
18
|
-
const { filterState, allItems, allGroups } = useCommand()
|
|
19
|
-
const groupContext = useCommandGroup()
|
|
20
|
-
|
|
21
|
-
const isRender = computed(() => {
|
|
22
|
-
if (!filterState.search) {
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const filteredCurrentItem = filterState.filtered.items.get(id)
|
|
27
|
-
// If the filtered items is undefined means not in the all times map yet
|
|
28
|
-
// Do the first render to add into the map
|
|
29
|
-
if (filteredCurrentItem === undefined) {
|
|
30
|
-
return true
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Check with filter
|
|
34
|
-
return filteredCurrentItem > 0
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const itemRef = ref()
|
|
39
|
-
const currentElement = useCurrentElement(itemRef)
|
|
40
|
-
onMounted(() => {
|
|
41
|
-
if (!(currentElement.value instanceof HTMLElement))
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
// textValue to perform filter
|
|
45
|
-
allItems.value.set(id, currentElement.value.textContent ?? (props.value?.toString() ?? ""))
|
|
46
|
-
|
|
47
|
-
const groupId = groupContext?.id
|
|
48
|
-
if (groupId) {
|
|
49
|
-
if (!allGroups.value.has(groupId)) {
|
|
50
|
-
allGroups.value.set(groupId, new Set([id]))
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
allGroups.value.get(groupId)?.add(id)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
onUnmounted(() => {
|
|
58
|
-
allItems.value.delete(id)
|
|
2
|
+
import type { ListboxItemEmits, ListboxItemProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit, useCurrentElement } from "@vueuse/core"
|
|
5
|
+
import { ListboxItem, useForwardPropsEmits, useId } from "reka-ui"
|
|
6
|
+
import { computed, onMounted, onUnmounted, ref } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand, useCommandGroup } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<ListboxItemProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
+
const emits = defineEmits<ListboxItemEmits>()
|
|
12
|
+
|
|
13
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
14
|
+
|
|
15
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
16
|
+
|
|
17
|
+
const id = useId()
|
|
18
|
+
const { filterState, allItems, allGroups } = useCommand()
|
|
19
|
+
const groupContext = useCommandGroup()
|
|
20
|
+
|
|
21
|
+
const isRender = computed(() => {
|
|
22
|
+
if (!filterState.search) {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const filteredCurrentItem = filterState.filtered.items.get(id)
|
|
27
|
+
// If the filtered items is undefined means not in the all times map yet
|
|
28
|
+
// Do the first render to add into the map
|
|
29
|
+
if (filteredCurrentItem === undefined) {
|
|
30
|
+
return true
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check with filter
|
|
34
|
+
return filteredCurrentItem > 0
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const itemRef = ref()
|
|
39
|
+
const currentElement = useCurrentElement(itemRef)
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (!(currentElement.value instanceof HTMLElement))
|
|
42
|
+
return
|
|
43
|
+
|
|
44
|
+
// textValue to perform filter
|
|
45
|
+
allItems.value.set(id, currentElement.value.textContent ?? (props.value?.toString() ?? ""))
|
|
46
|
+
|
|
47
|
+
const groupId = groupContext?.id
|
|
48
|
+
if (groupId) {
|
|
49
|
+
if (!allGroups.value.has(groupId)) {
|
|
50
|
+
allGroups.value.set(groupId, new Set([id]))
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
allGroups.value.get(groupId)?.add(id)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
onUnmounted(() => {
|
|
58
|
+
allItems.value.delete(id)
|
|
59
59
|
})
|
|
60
60
|
</script>
|
|
61
61
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxContentProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
-
import { ListboxContent, useForwardProps } from "reka-ui"
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
const props = defineProps<ListboxContentProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
-
|
|
10
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
11
|
-
|
|
2
|
+
import type { ListboxContentProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxContent, useForwardProps } from "reka-ui"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<ListboxContentProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
11
|
+
|
|
12
12
|
const forwarded = useForwardProps(delegatedProps)
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { SeparatorProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
-
import { Separator } from "reka-ui"
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
const props = defineProps<SeparatorProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
-
|
|
2
|
+
import type { SeparatorProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { Separator } from "reka-ui"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<SeparatorProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
+
|
|
10
10
|
const delegatedProps = reactiveOmit(props, "class")
|
|
11
11
|
</script>
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from "vue"
|
|
3
|
-
import { cn } from "@/lib/utils"
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes["class"]
|
|
2
|
+
import type { HTMLAttributes } from "vue"
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes["class"]
|
|
7
7
|
}>()
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Ref } from "vue"
|
|
2
|
-
import { createContext } from "reka-ui"
|
|
3
|
-
|
|
4
|
-
export { default as Command } from "./Command.vue"
|
|
5
|
-
export { default as CommandDialog } from "./CommandDialog.vue"
|
|
6
|
-
export { default as CommandEmpty } from "./CommandEmpty.vue"
|
|
7
|
-
export { default as CommandGroup } from "./CommandGroup.vue"
|
|
8
|
-
export { default as CommandInput } from "./CommandInput.vue"
|
|
9
|
-
export { default as CommandItem } from "./CommandItem.vue"
|
|
10
|
-
export { default as CommandList } from "./CommandList.vue"
|
|
11
|
-
export { default as CommandSeparator } from "./CommandSeparator.vue"
|
|
12
|
-
export { default as CommandShortcut } from "./CommandShortcut.vue"
|
|
13
|
-
|
|
14
|
-
export const [useCommand, provideCommandContext] = createContext<{
|
|
15
|
-
allItems: Ref<Map<string, string>>
|
|
16
|
-
allGroups: Ref<Map<string, Set<string>>>
|
|
17
|
-
filterState: {
|
|
18
|
-
search: string
|
|
19
|
-
filtered: { count: number, items: Map<string, number>, groups: Set<string> }
|
|
20
|
-
}
|
|
21
|
-
}>("Command")
|
|
22
|
-
|
|
23
|
-
export const [useCommandGroup, provideCommandGroupContext] = createContext<{
|
|
24
|
-
id?: string
|
|
1
|
+
import type { Ref } from "vue"
|
|
2
|
+
import { createContext } from "reka-ui"
|
|
3
|
+
|
|
4
|
+
export { default as Command } from "./Command.vue"
|
|
5
|
+
export { default as CommandDialog } from "./CommandDialog.vue"
|
|
6
|
+
export { default as CommandEmpty } from "./CommandEmpty.vue"
|
|
7
|
+
export { default as CommandGroup } from "./CommandGroup.vue"
|
|
8
|
+
export { default as CommandInput } from "./CommandInput.vue"
|
|
9
|
+
export { default as CommandItem } from "./CommandItem.vue"
|
|
10
|
+
export { default as CommandList } from "./CommandList.vue"
|
|
11
|
+
export { default as CommandSeparator } from "./CommandSeparator.vue"
|
|
12
|
+
export { default as CommandShortcut } from "./CommandShortcut.vue"
|
|
13
|
+
|
|
14
|
+
export const [useCommand, provideCommandContext] = createContext<{
|
|
15
|
+
allItems: Ref<Map<string, string>>
|
|
16
|
+
allGroups: Ref<Map<string, Set<string>>>
|
|
17
|
+
filterState: {
|
|
18
|
+
search: string
|
|
19
|
+
filtered: { count: number, items: Map<string, number>, groups: Set<string> }
|
|
20
|
+
}
|
|
21
|
+
}>("Command")
|
|
22
|
+
|
|
23
|
+
export const [useCommandGroup, provideCommandGroupContext] = createContext<{
|
|
24
|
+
id?: string
|
|
25
25
|
}>("CommandGroup")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
-
import { DialogRoot, useForwardPropsEmits } from "reka-ui"
|
|
4
|
-
|
|
5
|
-
const props = defineProps<DialogRootProps>()
|
|
6
|
-
const emits = defineEmits<DialogRootEmits>()
|
|
7
|
-
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
+
import { DialogRoot, useForwardPropsEmits } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<DialogRootProps>()
|
|
6
|
+
const emits = defineEmits<DialogRootEmits>()
|
|
7
|
+
|
|
8
8
|
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { DialogCloseProps } from "reka-ui"
|
|
3
|
-
import { DialogClose } from "reka-ui"
|
|
4
|
-
|
|
2
|
+
import type { DialogCloseProps } from "reka-ui"
|
|
3
|
+
import { DialogClose } from "reka-ui"
|
|
4
|
+
|
|
5
5
|
const props = defineProps<DialogCloseProps>()
|
|
6
6
|
</script>
|
|
7
7
|
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { DialogContentEmits, DialogContentProps } from "reka-ui"
|
|
3
|
-
import type { HTMLAttributes } from "vue"
|
|
4
|
-
import { X } from "@lucide/vue"
|
|
5
|
-
import { reactiveOmit } from "@vueuse/core"
|
|
6
|
-
import {
|
|
7
|
-
DialogClose,
|
|
8
|
-
DialogContent,
|
|
9
|
-
DialogPortal,
|
|
10
|
-
useForwardPropsEmits,
|
|
11
|
-
} from "reka-ui"
|
|
12
|
-
import { cn } from "@/lib/utils"
|
|
13
|
-
import DialogOverlay from "./DialogOverlay.vue"
|
|
14
|
-
|
|
15
|
-
defineOptions({
|
|
16
|
-
inheritAttrs: false,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const props = withDefaults(defineProps<DialogContentProps & { class?: HTMLAttributes["class"], showCloseButton?: boolean }>(), {
|
|
20
|
-
showCloseButton: true,
|
|
21
|
-
})
|
|
22
|
-
const emits = defineEmits<DialogContentEmits>()
|
|
23
|
-
|
|
24
|
-
const delegatedProps = reactiveOmit(props, "class")
|
|
25
|
-
|
|
2
|
+
import type { DialogContentEmits, DialogContentProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { X } from "@lucide/vue"
|
|
5
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
6
|
+
import {
|
|
7
|
+
DialogClose,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogPortal,
|
|
10
|
+
useForwardPropsEmits,
|
|
11
|
+
} from "reka-ui"
|
|
12
|
+
import { cn } from "@/lib/utils"
|
|
13
|
+
import DialogOverlay from "./DialogOverlay.vue"
|
|
14
|
+
|
|
15
|
+
defineOptions({
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<DialogContentProps & { class?: HTMLAttributes["class"], showCloseButton?: boolean }>(), {
|
|
20
|
+
showCloseButton: true,
|
|
21
|
+
})
|
|
22
|
+
const emits = defineEmits<DialogContentEmits>()
|
|
23
|
+
|
|
24
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
25
|
+
|
|
26
26
|
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
27
27
|
</script>
|
|
28
28
|
|