@brumaombra/ui-vintage 0.7.8 → 0.7.9
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/README.md +308 -48
- package/module.mjs +1 -1
- package/package.json +2 -1
- package/src/components/background-grid/BackgroundGrid.vue +11 -2
- package/src/components/background-grid/index.ts +2 -2
- package/src/components/blog/AllPostsSection.vue +25 -9
- package/src/components/blog/BlogFAQSection.vue +8 -3
- package/src/components/blog/BlogHeaderSection.vue +14 -11
- package/src/components/blog/BlogInfoSection.vue +13 -11
- package/src/components/blog/BlogSectionTitle.vue +5 -5
- package/src/components/blog/CategoriesList.vue +11 -3
- package/src/components/blog/CategoriesSection.vue +11 -3
- package/src/components/blog/CategoryCard.vue +10 -8
- package/src/components/blog/HeaderCarousel.vue +24 -15
- package/src/components/blog/PostCard.vue +16 -11
- package/src/components/blog/PostsList.vue +12 -3
- package/src/components/blog/SocialShareSidebar.vue +11 -11
- package/src/components/blog/TableOfContents.vue +29 -13
- package/src/components/busy-indicator/BusyIndicator.vue +2 -2
- package/src/components/busy-indicator/busy-indicator-state.ts +11 -12
- package/src/components/busy-indicator/index.ts +3 -3
- package/src/components/card-grid/CardGrid.vue +25 -11
- package/src/components/chip/Chip.vue +15 -15
- package/src/components/chip/index.ts +2 -2
- package/src/components/confirm-dialog/ConfirmDialog.vue +9 -9
- package/src/components/confirm-dialog/confirm-dialog-state.ts +15 -14
- package/src/components/confirm-dialog/index.ts +3 -12
- package/src/components/content/BlogList.vue +11 -8
- package/src/components/content/BlogTable.vue +18 -14
- package/src/components/content/ProseHr.vue +10 -7
- package/src/components/content/Terminal.vue +70 -0
- package/src/components/content/index.ts +2 -1
- package/src/components/dashboard-shell/DashboardShell.vue +43 -64
- package/src/components/dashboard-shell/index.ts +2 -2
- package/src/components/data-list/DataList.vue +11 -13
- package/src/components/data-list/DataListItem.vue +9 -11
- package/src/components/data-list/DataListLabel.vue +9 -11
- package/src/components/data-list/DataListText.vue +9 -11
- package/src/components/data-list/DataListValue.vue +9 -11
- package/src/components/data-list/index.ts +5 -5
- package/src/components/empty-state-card/EmptyStateCard.vue +21 -11
- package/src/components/error-page/ErrorPage.vue +24 -27
- package/src/components/error-page/index.ts +2 -2
- package/src/components/info-card/InfoCard.vue +17 -11
- package/src/components/landing/index.ts +6 -6
- package/src/components/landing/landing-content/LandingContent.vue +5 -7
- package/src/components/landing/landing-content/index.ts +2 -2
- package/src/components/landing/landing-footer/LandingFooter.vue +26 -29
- package/src/components/landing/landing-footer/index.ts +3 -3
- package/src/components/landing/landing-navbar/LandingNavbar.vue +15 -17
- package/src/components/landing/landing-navbar/index.ts +2 -2
- package/src/components/landing/landing-shell/LandingShell.vue +10 -13
- package/src/components/landing/landing-shell/index.ts +2 -2
- package/src/components/language-flag/LanguageFlag.vue +6 -5
- package/src/components/language-flag/index.ts +1 -0
- package/src/components/language-selector/LanguageSelector.vue +20 -21
- package/src/components/load-more-button/LoadMoreButton.vue +18 -14
- package/src/components/loading-state-card/LoadingStateCard.vue +13 -9
- package/src/components/message-dialog/MessageDialog.vue +19 -19
- package/src/components/message-dialog/index.ts +3 -11
- package/src/components/message-dialog/message-dialog-state.ts +12 -11
- package/src/components/message-toast/MessageToast.vue +16 -16
- package/src/components/message-toast/index.ts +2 -9
- package/src/components/message-toast/message-toast-state.ts +9 -9
- package/src/components/page-header/PageHeader.vue +8 -5
- package/src/components/progress-component/ProgressComponent.vue +13 -10
- package/src/components/single-value-card/SingleValueCard.vue +22 -19
- package/src/components/slider-form-component/SliderFormComponent.vue +11 -20
- package/src/components/slider-form-component/index.ts +2 -2
- package/src/components/switch-form-component/SwitchFormComponent.vue +7 -9
- package/src/components/switch-form-component/index.ts +2 -2
- package/src/components/text-link/TextLink.vue +11 -7
- package/src/components/ui/accordion/Accordion.vue +10 -13
- package/src/components/ui/accordion/index.ts +1 -1
- package/src/components/ui/alert/Alert.vue +11 -10
- package/src/components/ui/alert/AlertDescription.vue +9 -8
- package/src/components/ui/alert/AlertTitle.vue +9 -8
- package/src/components/ui/alert/index.ts +10 -10
- package/src/components/ui/alert-dialog/AlertDialog.vue +13 -9
- package/src/components/ui/alert-dialog/AlertDialogAction.vue +14 -12
- package/src/components/ui/alert-dialog/AlertDialogCancel.vue +14 -16
- package/src/components/ui/alert-dialog/AlertDialogContent.vue +24 -27
- package/src/components/ui/alert-dialog/AlertDialogDescription.vue +13 -13
- package/src/components/ui/alert-dialog/AlertDialogFooter.vue +9 -12
- package/src/components/ui/alert-dialog/AlertDialogHeader.vue +9 -8
- package/src/components/ui/alert-dialog/AlertDialogTitle.vue +13 -11
- package/src/components/ui/alert-dialog/AlertDialogTrigger.vue +8 -7
- package/src/components/ui/alert-dialog/index.ts +9 -9
- package/src/components/ui/badge/Badge.vue +11 -12
- package/src/components/ui/badge/index.ts +1 -1
- package/src/components/ui/breadcrumb/Breadcrumb.vue +9 -12
- package/src/components/ui/breadcrumb/BreadcrumbEllipsis.vue +15 -19
- package/src/components/ui/breadcrumb/BreadcrumbItem.vue +10 -12
- package/src/components/ui/breadcrumb/BreadcrumbLink.vue +13 -17
- package/src/components/ui/breadcrumb/BreadcrumbList.vue +10 -12
- package/src/components/ui/breadcrumb/BreadcrumbPage.vue +10 -15
- package/src/components/ui/breadcrumb/BreadcrumbSeparator.vue +14 -18
- package/src/components/ui/breadcrumb/index.ts +7 -7
- package/src/components/ui/busy/Busy.vue +36 -29
- package/src/components/ui/busy/index.ts +1 -1
- package/src/components/ui/button/Button.vue +18 -19
- package/src/components/ui/button/index.ts +54 -35
- package/src/components/ui/calendar/Calendar.vue +167 -121
- package/src/components/ui/calendar/CalendarCell.vue +18 -17
- package/src/components/ui/calendar/CalendarCellTrigger.vue +31 -33
- package/src/components/ui/calendar/CalendarGrid.vue +14 -17
- package/src/components/ui/calendar/CalendarGridBody.vue +9 -11
- package/src/components/ui/calendar/CalendarGridHead.vue +10 -12
- package/src/components/ui/calendar/CalendarGridRow.vue +14 -16
- package/src/components/ui/calendar/CalendarHeadCell.vue +18 -17
- package/src/components/ui/calendar/CalendarHeader.vue +18 -17
- package/src/components/ui/calendar/CalendarHeading.vue +18 -22
- package/src/components/ui/calendar/CalendarNextButton.vue +29 -26
- package/src/components/ui/calendar/CalendarPrevButton.vue +29 -26
- package/src/components/ui/calendar/index.ts +17 -13
- package/src/components/ui/card/Card.vue +21 -13
- package/src/components/ui/card/CardAction.vue +12 -7
- package/src/components/ui/card/CardContent.vue +8 -7
- package/src/components/ui/card/CardDescription.vue +16 -7
- package/src/components/ui/card/CardFooter.vue +8 -7
- package/src/components/ui/card/CardHeader.vue +12 -7
- package/src/components/ui/card/CardText.vue +12 -7
- package/src/components/ui/card/CardTitle.vue +9 -7
- package/src/components/ui/card/index.ts +8 -8
- package/src/components/ui/command/Command.vue +71 -61
- package/src/components/ui/command/CommandDialog.vue +33 -23
- package/src/components/ui/command/CommandEmpty.vue +19 -20
- package/src/components/ui/command/CommandGroup.vue +32 -35
- package/src/components/ui/command/CommandInput.vue +25 -21
- package/src/components/ui/command/CommandItem.vue +62 -59
- package/src/components/ui/command/CommandList.vue +21 -18
- package/src/components/ui/command/CommandSeparator.vue +13 -11
- package/src/components/ui/command/CommandShortcut.vue +13 -8
- package/src/components/ui/command/index.ts +24 -20
- package/src/components/ui/date-picker/DatePicker.vue +46 -37
- package/src/components/ui/date-picker/index.ts +2 -2
- package/src/components/ui/date-time-picker/DateTimePicker.vue +99 -95
- package/src/components/ui/date-time-picker/index.ts +2 -2
- package/src/components/ui/dialog/Dialog.vue +12 -9
- package/src/components/ui/dialog/DialogClose.vue +8 -10
- package/src/components/ui/dialog/DialogContent.vue +36 -42
- package/src/components/ui/dialog/DialogDescription.vue +16 -11
- package/src/components/ui/dialog/DialogFooter.vue +13 -12
- package/src/components/ui/dialog/DialogHeader.vue +9 -8
- package/src/components/ui/dialog/DialogOverlay.vue +16 -11
- package/src/components/ui/dialog/DialogScrollContent.vue +47 -45
- package/src/components/ui/dialog/DialogTitle.vue +13 -12
- package/src/components/ui/dialog/DialogTrigger.vue +8 -7
- package/src/components/ui/dialog/index.ts +10 -10
- package/src/components/ui/field/Field.vue +12 -14
- package/src/components/ui/field/FieldContent.vue +13 -11
- package/src/components/ui/field/FieldDescription.vue +15 -13
- package/src/components/ui/field/FieldError.vue +43 -40
- package/src/components/ui/field/FieldGroup.vue +13 -11
- package/src/components/ui/field/FieldLabel.vue +16 -14
- package/src/components/ui/field/FieldLegend.vue +16 -14
- package/src/components/ui/field/FieldSeparator.vue +17 -15
- package/src/components/ui/field/FieldSet.vue +14 -12
- package/src/components/ui/field/FieldTitle.vue +13 -11
- package/src/components/ui/field/index.ts +36 -36
- package/src/components/ui/input/Input.vue +23 -20
- package/src/components/ui/input/index.ts +1 -1
- package/src/components/ui/label/Label.vue +16 -15
- package/src/components/ui/label/index.ts +1 -1
- package/src/components/ui/native-select/NativeSelect.vue +31 -41
- package/src/components/ui/native-select/NativeSelectOptGroup.vue +8 -7
- package/src/components/ui/native-select/NativeSelectOption.vue +8 -7
- package/src/components/ui/native-select/index.ts +3 -3
- package/src/components/ui/popover/Popover.vue +12 -9
- package/src/components/ui/popover/PopoverAnchor.vue +8 -7
- package/src/components/ui/popover/PopoverContent.vue +27 -31
- package/src/components/ui/popover/PopoverTrigger.vue +8 -7
- package/src/components/ui/popover/index.ts +4 -4
- package/src/components/ui/progress/Progress.vue +18 -32
- package/src/components/ui/progress/index.ts +1 -1
- package/src/components/ui/scroll-area/ScrollArea.vue +23 -26
- package/src/components/ui/scroll-area/ScrollBar.vue +22 -26
- package/src/components/ui/scroll-area/index.ts +2 -2
- package/src/components/ui/select/Select.vue +12 -9
- package/src/components/ui/select/SelectContent.vue +39 -40
- package/src/components/ui/select/SelectGroup.vue +8 -7
- package/src/components/ui/select/SelectItem.vue +36 -41
- package/src/components/ui/select/SelectItemContent.vue +22 -15
- package/src/components/ui/select/SelectItemText.vue +8 -7
- package/src/components/ui/select/SelectLabel.vue +10 -9
- package/src/components/ui/select/SelectScrollDownButton.vue +21 -17
- package/src/components/ui/select/SelectScrollUpButton.vue +21 -17
- package/src/components/ui/select/SelectSeparator.vue +11 -9
- package/src/components/ui/select/SelectTrigger.vue +27 -25
- package/src/components/ui/select/SelectValue.vue +8 -7
- package/src/components/ui/select/SelectValueContent.vue +30 -18
- package/src/components/ui/select/index.ts +13 -13
- package/src/components/ui/separator/Separator.vue +17 -18
- package/src/components/ui/separator/index.ts +1 -1
- package/src/components/ui/sheet/Sheet.vue +12 -9
- package/src/components/ui/sheet/SheetClose.vue +8 -7
- package/src/components/ui/sheet/SheetContent.vue +36 -37
- package/src/components/ui/sheet/SheetDescription.vue +12 -11
- package/src/components/ui/sheet/SheetFooter.vue +8 -7
- package/src/components/ui/sheet/SheetHeader.vue +8 -7
- package/src/components/ui/sheet/SheetOverlay.vue +16 -11
- package/src/components/ui/sheet/SheetTitle.vue +12 -11
- package/src/components/ui/sheet/SheetTrigger.vue +8 -7
- package/src/components/ui/sheet/index.ts +8 -8
- package/src/components/ui/sidebar/Sidebar.vue +68 -61
- package/src/components/ui/sidebar/SidebarContent.vue +13 -8
- package/src/components/ui/sidebar/SidebarFooter.vue +13 -8
- package/src/components/ui/sidebar/SidebarGroup.vue +13 -8
- package/src/components/ui/sidebar/SidebarGroupAction.vue +16 -16
- package/src/components/ui/sidebar/SidebarGroupContent.vue +9 -8
- package/src/components/ui/sidebar/SidebarGroupLabel.vue +15 -14
- package/src/components/ui/sidebar/SidebarHeader.vue +13 -8
- package/src/components/ui/sidebar/SidebarInput.vue +14 -12
- package/src/components/ui/sidebar/SidebarInset.vue +14 -12
- package/src/components/ui/sidebar/SidebarMenu.vue +9 -8
- package/src/components/ui/sidebar/SidebarMenuAction.vue +25 -23
- package/src/components/ui/sidebar/SidebarMenuBadge.vue +19 -17
- package/src/components/ui/sidebar/SidebarMenuButton.vue +33 -32
- package/src/components/ui/sidebar/SidebarMenuButtonChild.vue +19 -18
- package/src/components/ui/sidebar/SidebarMenuItem.vue +9 -8
- package/src/components/ui/sidebar/SidebarMenuSkeleton.vue +17 -12
- package/src/components/ui/sidebar/SidebarMenuSub.vue +14 -12
- package/src/components/ui/sidebar/SidebarMenuSubButton.vue +24 -21
- package/src/components/ui/sidebar/SidebarMenuSubItem.vue +9 -8
- package/src/components/ui/sidebar/SidebarProvider.vue +63 -53
- package/src/components/ui/sidebar/SidebarRail.vue +20 -18
- package/src/components/ui/sidebar/SidebarSeparator.vue +10 -9
- package/src/components/ui/sidebar/SidebarTrigger.vue +15 -14
- package/src/components/ui/sidebar/index.ts +62 -58
- package/src/components/ui/sidebar/utils.ts +16 -16
- package/src/components/ui/skeleton/Skeleton.vue +12 -9
- package/src/components/ui/skeleton/index.ts +1 -1
- package/src/components/ui/slider/Slider.vue +24 -19
- package/src/components/ui/slider/index.ts +1 -1
- package/src/components/ui/switch/Switch.vue +26 -23
- package/src/components/ui/switch/index.ts +1 -1
- package/src/components/ui/table/Table.vue +11 -10
- package/src/components/ui/table/TableBody.vue +9 -11
- package/src/components/ui/table/TableCaption.vue +9 -11
- package/src/components/ui/table/TableCell.vue +13 -16
- package/src/components/ui/table/TableEmpty.vue +22 -25
- package/src/components/ui/table/TableFooter.vue +13 -11
- package/src/components/ui/table/TableHead.vue +13 -11
- package/src/components/ui/table/TableHeader.vue +9 -11
- package/src/components/ui/table/TableRow.vue +13 -11
- package/src/components/ui/table/index.ts +9 -9
- package/src/components/ui/tabs/Tabs.vue +18 -18
- package/src/components/ui/tabs/TabsContent.vue +14 -15
- package/src/components/ui/tabs/TabsList.vue +18 -18
- package/src/components/ui/tabs/TabsTrigger.vue +19 -20
- package/src/components/ui/tabs/index.ts +4 -4
- package/src/components/ui/textarea/Textarea.vue +23 -20
- package/src/components/ui/textarea/index.ts +1 -1
- package/src/components/ui/time-picker/TimePicker.vue +33 -38
- package/src/components/ui/time-picker/index.ts +2 -2
- package/src/components/ui/tooltip/Tooltip.vue +12 -9
- package/src/components/ui/tooltip/TooltipContent.vue +28 -20
- package/src/components/ui/tooltip/TooltipProvider.vue +9 -8
- package/src/components/ui/tooltip/TooltipTrigger.vue +8 -7
- package/src/components/ui/tooltip/index.ts +4 -4
- package/src/i18n/de.json +5 -0
- package/src/i18n/en.json +5 -0
- package/src/i18n/es.json +5 -0
- package/src/i18n/fr.json +5 -0
- package/src/i18n/it.json +5 -0
- package/src/i18n/ja.json +5 -0
- package/src/i18n/pt.json +5 -0
- package/src/i18n/ru.json +5 -0
- package/src/i18n/zh.json +5 -0
- package/src/lib/common-types.ts +2 -0
- package/src/lib/i18n.ts +0 -5
- package/src/runtime/{ui-vintage-i18n-plugin.js → ui-vintage-i18n-plugin.ts} +30 -8
|
@@ -1,83 +1,93 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxRootEmits, ListboxRootProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { ListboxRoot, useFilter, useForwardPropsEmits } from
|
|
6
|
-
import { reactive, ref, watch } from
|
|
7
|
-
import { cn } from
|
|
8
|
-
import { provideCommandContext } from
|
|
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
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// Props
|
|
11
|
+
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes['class'] }>(), {
|
|
12
|
+
modelValue: ''
|
|
13
|
+
});
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
// Emits
|
|
16
|
+
const emits = defineEmits<ListboxRootEmits>();
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
// Omit local class from delegated props
|
|
19
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
// Forward props
|
|
22
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
19
23
|
|
|
20
|
-
const allItems = ref<Map<string, string>>(new Map())
|
|
21
|
-
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
|
24
|
+
const allItems = ref<Map<string, string>>(new Map());
|
|
25
|
+
const allGroups = ref<Map<string, Set<string>>>(new Map());
|
|
22
26
|
|
|
23
|
-
const { contains } = useFilter({ sensitivity:
|
|
27
|
+
const { contains } = useFilter({ sensitivity: 'base' });
|
|
24
28
|
const filterState = reactive({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
29
|
+
search: '',
|
|
30
|
+
filtered: {
|
|
31
|
+
/** The count of all visible items. */
|
|
32
|
+
count: 0,
|
|
33
|
+
/** Map from visible item id to its search score. */
|
|
34
|
+
items: new Map() as Map<string, number>,
|
|
35
|
+
/** Set of groups with at least one visible item. */
|
|
36
|
+
groups: new Set() as Set<string>,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
35
39
|
|
|
36
40
|
function filterItems() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
if (!filterState.search) {
|
|
42
|
+
filterState.filtered.count = allItems.value.size;
|
|
43
|
+
// Do nothing, each item will know to show itself because search is empty
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
// Reset the groups
|
|
48
|
+
filterState.filtered.groups = new Set();
|
|
49
|
+
let itemCount = 0;
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
// Check which items should be included
|
|
52
|
+
for (const [id, value] of allItems.value) {
|
|
53
|
+
const score = contains(value, filterState.search);
|
|
54
|
+
filterState.filtered.items.set(id, score ? 1 : 0);
|
|
55
|
+
if (score) itemCount++;
|
|
56
|
+
}
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
// Check which groups have at least 1 item shown
|
|
59
|
+
for (const [groupId, group] of allGroups.value) {
|
|
60
|
+
for (const itemId of group) {
|
|
61
|
+
if (filterState.filtered.items.get(itemId)! > 0) {
|
|
62
|
+
filterState.filtered.groups.add(groupId);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
|
-
}
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
filterState.filtered.count = itemCount;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
watch(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
watch(
|
|
72
|
+
() => filterState.search,
|
|
73
|
+
() => {
|
|
74
|
+
filterItems();
|
|
75
|
+
},
|
|
76
|
+
);
|
|
71
77
|
|
|
72
78
|
provideCommandContext({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})
|
|
79
|
+
allItems,
|
|
80
|
+
allGroups,
|
|
81
|
+
filterState,
|
|
82
|
+
});
|
|
77
83
|
</script>
|
|
78
84
|
|
|
79
85
|
<template>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
<ListboxRoot data-slot="command" v-bind="forwarded" :class="cn(
|
|
87
|
+
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded transition-colors duration-300 ease-in-out',
|
|
88
|
+
props.class,
|
|
89
|
+
)
|
|
90
|
+
">
|
|
91
|
+
<slot />
|
|
92
|
+
</ListboxRoot>
|
|
93
|
+
</template>
|
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { DialogRootEmits, DialogRootProps } from
|
|
3
|
-
import { useForwardPropsEmits } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
|
|
3
|
+
import { useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
} from '../dialog';
|
|
11
|
+
import Command from './Command.vue';
|
|
6
12
|
|
|
13
|
+
// Props
|
|
7
14
|
const props = withDefaults(defineProps<DialogRootProps & {
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
title?: string;
|
|
16
|
+
description?: string;
|
|
10
17
|
}>(), {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
const emits = defineEmits<DialogRootEmits>()
|
|
18
|
+
title: 'Command Palette',
|
|
19
|
+
description: 'Search for a command to run...'
|
|
20
|
+
});
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
// Emits
|
|
23
|
+
const emits = defineEmits<DialogRootEmits>();
|
|
24
|
+
|
|
25
|
+
// Forward props
|
|
26
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
17
27
|
</script>
|
|
18
28
|
|
|
19
29
|
<template>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</template>
|
|
30
|
+
<Dialog v-slot="slotProps" v-bind="forwarded">
|
|
31
|
+
<DialogContent class="overflow-hidden p-0">
|
|
32
|
+
<DialogHeader class="sr-only">
|
|
33
|
+
<DialogTitle>{{ title }}</DialogTitle>
|
|
34
|
+
<DialogDescription>{{ description }}</DialogDescription>
|
|
35
|
+
</DialogHeader>
|
|
36
|
+
<Command>
|
|
37
|
+
<slot v-bind="slotProps" />
|
|
38
|
+
</Command>
|
|
39
|
+
</DialogContent>
|
|
40
|
+
</Dialog>
|
|
41
|
+
</template>
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { PrimitiveProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { Primitive } from
|
|
6
|
-
import { computed } from
|
|
7
|
-
import { cn } from
|
|
8
|
-
import { useCommand } from
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
// Props
|
|
11
|
+
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>();
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
// Omit local class from delegated props
|
|
14
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
13
15
|
|
|
14
|
-
const { filterState } = useCommand()
|
|
15
|
-
const isRender = computed(
|
|
16
|
-
)
|
|
16
|
+
const { filterState } = useCommand();
|
|
17
|
+
const isRender = computed(
|
|
18
|
+
() => !!filterState.search && filterState.filtered.count === 0,
|
|
19
|
+
);
|
|
17
20
|
</script>
|
|
18
21
|
|
|
19
22
|
<template>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
>
|
|
25
|
-
<slot />
|
|
26
|
-
</Primitive>
|
|
27
|
-
</template>
|
|
23
|
+
<Primitive v-if="isRender" data-slot="command-empty" v-bind="delegatedProps" :class="cn('py-6 text-center text-sm', props.class)">
|
|
24
|
+
<slot />
|
|
25
|
+
</Primitive>
|
|
26
|
+
</template>
|
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxGroupProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { ListboxGroup, ListboxGroupLabel, useId } from
|
|
6
|
-
import { computed, onMounted, onUnmounted } from
|
|
7
|
-
import { cn } from
|
|
8
|
-
import { provideCommandGroupContext, useCommand } from
|
|
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
9
|
|
|
10
|
+
// Props
|
|
10
11
|
const props = defineProps<ListboxGroupProps & {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}>()
|
|
12
|
+
class?: HTMLAttributes['class'];
|
|
13
|
+
heading?: string;
|
|
14
|
+
}>();
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// Omit local class from delegated props
|
|
17
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
16
18
|
|
|
17
|
-
const { allGroups, filterState } = useCommand()
|
|
18
|
-
const id = useId()
|
|
19
|
+
const { allGroups, filterState } = useCommand();
|
|
20
|
+
const id = useId();
|
|
19
21
|
|
|
20
|
-
const isRender = computed(() =>
|
|
22
|
+
const isRender = computed(() =>
|
|
23
|
+
!filterState.search ? true : filterState.filtered.groups.has(id),
|
|
24
|
+
);
|
|
21
25
|
|
|
22
|
-
provideCommandGroupContext({ id })
|
|
26
|
+
provideCommandGroupContext({ id });
|
|
23
27
|
onMounted(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
28
|
+
if (!allGroups.value.has(id)) allGroups.value.set(id, new Set());
|
|
29
|
+
});
|
|
27
30
|
onUnmounted(() => {
|
|
28
|
-
|
|
29
|
-
})
|
|
31
|
+
allGroups.value.delete(id);
|
|
32
|
+
});
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
35
|
<template>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</ListboxGroupLabel>
|
|
43
|
-
<div class="p-2">
|
|
44
|
-
<slot />
|
|
45
|
-
</div>
|
|
46
|
-
</ListboxGroup>
|
|
47
|
-
</template>
|
|
36
|
+
<ListboxGroup v-bind="delegatedProps" :id="id" data-slot="command-group" :class="cn('text-foreground overflow-hidden', props.class)" :hidden="isRender ? undefined : true">
|
|
37
|
+
<ListboxGroupLabel v-if="heading" data-slot="command-group-heading" class="border-b border-(--border-light) px-3 py-2 text-xs font-semibold uppercase tracking-[0.16em] text-(--text-secondary-light) dark:border-(--border-dark) dark:text-(--text-secondary-dark)">
|
|
38
|
+
{{ heading }}
|
|
39
|
+
</ListboxGroupLabel>
|
|
40
|
+
<div class="p-2">
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
</ListboxGroup>
|
|
44
|
+
</template>
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxFilterProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { Search01Icon } from
|
|
6
|
-
import { HugeiconsIcon } from
|
|
7
|
-
import { ListboxFilter, useForwardProps } from
|
|
8
|
-
import { cn } from
|
|
9
|
-
import { useCommand } from
|
|
2
|
+
import type { ListboxFilterProps } from 'reka-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'vue';
|
|
4
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
5
|
+
import { Search01Icon } from '@hugeicons/core-free-icons';
|
|
6
|
+
import { HugeiconsIcon } from '@hugeicons/vue';
|
|
7
|
+
import { ListboxFilter, useForwardProps } from 'reka-ui';
|
|
8
|
+
import { cn } from '../../../lib/utils';
|
|
9
|
+
import { useCommand } from '.';
|
|
10
10
|
|
|
11
11
|
defineOptions({
|
|
12
|
-
|
|
13
|
-
})
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
});
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}>()
|
|
15
|
+
// Props
|
|
16
|
+
const props = defineProps<ListboxFilterProps & { class?: HTMLAttributes['class'] }>();
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
// Omit local class from delegated props
|
|
19
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
20
20
|
|
|
21
|
-
const forwardedProps = useForwardProps(delegatedProps)
|
|
21
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
22
22
|
|
|
23
|
-
const { filterState } = useCommand()
|
|
23
|
+
const { filterState } = useCommand();
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
<div data-slot="command-input-wrapper" class="flex h-9 items-center gap-2 border-b px-3">
|
|
28
|
+
<HugeiconsIcon :icon="Search01Icon" class="size-4 shrink-0 opacity-50" />
|
|
29
|
+
<ListboxFilter v-bind="{ ...forwardedProps, ...$attrs }" v-model="filterState.search" data-slot="command-input" auto-focus :class="cn(
|
|
30
|
+
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
31
|
+
props.class,
|
|
32
|
+
)
|
|
33
|
+
" />
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -1,76 +1,79 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxItemEmits, ListboxItemProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit, useCurrentElement } from
|
|
5
|
-
import { ListboxItem, useForwardPropsEmits, useId } from
|
|
6
|
-
import { computed, onMounted, onUnmounted, ref } from
|
|
7
|
-
import { cn } from
|
|
8
|
-
import { useCommand, useCommandGroup } from
|
|
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
9
|
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
// Props
|
|
11
|
+
const props = defineProps<ListboxItemProps & { class?: HTMLAttributes['class'] }>();
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Emits
|
|
14
|
+
const emits = defineEmits<ListboxItemEmits>();
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// Omit local class from delegated props
|
|
17
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
// Forward props
|
|
20
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
21
|
+
|
|
22
|
+
const id = useId();
|
|
23
|
+
const { filterState, allItems, allGroups } = useCommand();
|
|
24
|
+
const groupContext = useCommandGroup();
|
|
20
25
|
|
|
21
26
|
const isRender = computed(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
27
|
+
if (!filterState.search) {
|
|
28
|
+
return true;
|
|
29
|
+
} else {
|
|
30
|
+
const filteredCurrentItem = filterState.filtered.items.get(id);
|
|
31
|
+
// If the filtered items is undefined means not in the all times map yet
|
|
32
|
+
// Do the first render to add into the map
|
|
33
|
+
if (filteredCurrentItem === undefined) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
+
// Check with filter
|
|
38
|
+
return filteredCurrentItem > 0;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
37
41
|
|
|
38
|
-
const itemRef = ref()
|
|
39
|
-
const currentElement = useCurrentElement(itemRef)
|
|
42
|
+
const itemRef = ref();
|
|
43
|
+
const currentElement = useCurrentElement(itemRef);
|
|
40
44
|
onMounted(() => {
|
|
41
|
-
|
|
42
|
-
return
|
|
45
|
+
if (!(currentElement.value instanceof HTMLElement)) return;
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
// textValue to perform filter
|
|
48
|
+
allItems.value.set(
|
|
49
|
+
id,
|
|
50
|
+
currentElement.value.textContent ?? props.value?.toString() ?? '',
|
|
51
|
+
);
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const groupId = groupContext?.id;
|
|
54
|
+
if (groupId) {
|
|
55
|
+
if (!allGroups.value.has(groupId)) {
|
|
56
|
+
allGroups.value.set(groupId, new Set([id]));
|
|
57
|
+
} else {
|
|
58
|
+
allGroups.value.get(groupId)?.add(id);
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
|
-
|
|
56
|
-
})
|
|
61
|
+
});
|
|
57
62
|
onUnmounted(() => {
|
|
58
|
-
|
|
59
|
-
})
|
|
63
|
+
allItems.value.delete(id);
|
|
64
|
+
});
|
|
60
65
|
</script>
|
|
61
66
|
|
|
62
67
|
<template>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
</ListboxItem>
|
|
76
|
-
</template>
|
|
68
|
+
<ListboxItem v-if="isRender" v-bind="forwarded" :id="id" ref="itemRef" data-slot="command-item" :class="cn(
|
|
69
|
+
'relative flex cursor-pointer items-center gap-3 rounded px-3 py-2 text-left text-sm font-semibold text-(--text-secondary-light) outline-hidden transition-colors duration-200 select-none data-highlighted:bg-(--bg-selected-light) data-highlighted:text-(--text-primary-light) data-disabled:pointer-events-none data-disabled:opacity-50 dark:text-(--text-secondary-dark) dark:data-highlighted:bg-(--bg-selected-dark) dark:data-highlighted:text-(--text-primary-dark) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4 [&_svg:not([class*=\'text-\'])]:text-current',
|
|
70
|
+
props.class,
|
|
71
|
+
)
|
|
72
|
+
" @select="
|
|
73
|
+
() => {
|
|
74
|
+
filterState.search = '';
|
|
75
|
+
}
|
|
76
|
+
">
|
|
77
|
+
<slot />
|
|
78
|
+
</ListboxItem>
|
|
79
|
+
</template>
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { ListboxContentProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { ListboxContent, useForwardProps } from
|
|
6
|
-
import { cn } from
|
|
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
7
|
|
|
8
|
-
|
|
8
|
+
// Props
|
|
9
|
+
const props = defineProps<ListboxContentProps & { class?: HTMLAttributes['class'] }>();
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
// Omit local class from delegated props
|
|
12
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
// Forward props
|
|
15
|
+
const forwarded = useForwardProps(delegatedProps);
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
18
|
<template>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</template>
|
|
19
|
+
<ListboxContent data-slot="command-list" v-bind="forwarded" :class="cn(
|
|
20
|
+
'max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto',
|
|
21
|
+
props.class,
|
|
22
|
+
)
|
|
23
|
+
">
|
|
24
|
+
<div role="presentation">
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
</ListboxContent>
|
|
28
|
+
</template>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { SeparatorProps } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import { reactiveOmit } from
|
|
5
|
-
import { Separator } from
|
|
6
|
-
import { cn } from
|
|
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
7
|
|
|
8
|
-
|
|
8
|
+
// Props
|
|
9
|
+
const props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>();
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
// Omit local class from delegated props
|
|
12
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<template>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</template>
|
|
16
|
+
<Separator data-slot="command-separator" v-bind="delegatedProps" :class="cn('bg-border -mx-1 h-px', props.class)">
|
|
17
|
+
<slot />
|
|
18
|
+
</Separator>
|
|
19
|
+
</template>
|