@personizely/ui 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +1 -0
- package/dist/personizely-ui.css +6 -0
- package/dist/personizely-ui.js +26854 -0
- package/dist/personizely-ui.umd.cjs +111 -0
- package/package.json +117 -0
- package/src/assets/index.css +136 -0
- package/src/components/ui/accordion/Accordion.vue +19 -0
- package/src/components/ui/accordion/AccordionContent.vue +24 -0
- package/src/components/ui/accordion/AccordionItem.vue +37 -0
- package/src/components/ui/accordion/AccordionTrigger.vue +39 -0
- package/src/components/ui/accordion/index.ts +2 -0
- package/src/components/ui/alert/Alert.vue +68 -0
- package/src/components/ui/alert/index.ts +22 -0
- package/src/components/ui/alert-dialog/AlertDialog.vue +66 -0
- package/src/components/ui/alert-dialog/AlertDialogContent.vue +44 -0
- package/src/components/ui/alert-dialog/AlertDialogProvider.vue +27 -0
- package/src/components/ui/alert-dialog/AlertDialogTrigger.vue +11 -0
- package/src/components/ui/alert-dialog/index.ts +3 -0
- package/src/components/ui/alert-dialog/useAlertDialog.ts +19 -0
- package/src/components/ui/autocomplete/Autocomplete.vue +170 -0
- package/src/components/ui/autocomplete/AutocompleteContent.vue +27 -0
- package/src/components/ui/autocomplete/AutocompleteEmpty.vue +20 -0
- package/src/components/ui/autocomplete/AutocompleteGroup.vue +29 -0
- package/src/components/ui/autocomplete/AutocompleteItem.vue +26 -0
- package/src/components/ui/autocomplete/AutocompleteRoot.vue +31 -0
- package/src/components/ui/autocomplete/AutocompleteSeparator.vue +23 -0
- package/src/components/ui/autocomplete/index.ts +1 -0
- package/src/components/ui/avatar/Avatar.vue +31 -0
- package/src/components/ui/avatar/AvatarFallback.vue +11 -0
- package/src/components/ui/avatar/AvatarImage.vue +9 -0
- package/src/components/ui/avatar/index.ts +19 -0
- package/src/components/ui/badge/Badge.vue +16 -0
- package/src/components/ui/badge/index.ts +22 -0
- package/src/components/ui/button/Button.vue +123 -0
- package/src/components/ui/button/index.ts +78 -0
- package/src/components/ui/calendar/Calendar.vue +76 -0
- package/src/components/ui/calendar/CalendarCell.vue +24 -0
- package/src/components/ui/calendar/CalendarCellTrigger.vue +38 -0
- package/src/components/ui/calendar/CalendarGrid.vue +24 -0
- package/src/components/ui/calendar/CalendarGridBody.vue +11 -0
- package/src/components/ui/calendar/CalendarGridHead.vue +11 -0
- package/src/components/ui/calendar/CalendarGridRow.vue +21 -0
- package/src/components/ui/calendar/CalendarHeadCell.vue +21 -0
- package/src/components/ui/calendar/CalendarHeader.vue +21 -0
- package/src/components/ui/calendar/CalendarHeading.vue +27 -0
- package/src/components/ui/calendar/CalendarNextButton.vue +32 -0
- package/src/components/ui/calendar/CalendarPrevButton.vue +32 -0
- package/src/components/ui/calendar/index.ts +1 -0
- package/src/components/ui/card/Card.vue +57 -0
- package/src/components/ui/card/CardContent.vue +14 -0
- package/src/components/ui/card/CardDescription.vue +14 -0
- package/src/components/ui/card/CardFooter.vue +14 -0
- package/src/components/ui/card/CardHeader.vue +14 -0
- package/src/components/ui/card/CardTitle.vue +18 -0
- package/src/components/ui/card/CardTray.vue +14 -0
- package/src/components/ui/card/index.ts +1 -0
- package/src/components/ui/checkbox/Checkbox.vue +63 -0
- package/src/components/ui/checkbox/CheckboxBase.vue +39 -0
- package/src/components/ui/checkbox/index.ts +1 -0
- package/src/components/ui/checkbox-group/CheckboxGroup.vue +65 -0
- package/src/components/ui/checkbox-group/index.ts +15 -0
- package/src/components/ui/color-picker/Alpha.vue +63 -0
- package/src/components/ui/color-picker/Angle.vue +145 -0
- package/src/components/ui/color-picker/Checkboard.vue +43 -0
- package/src/components/ui/color-picker/Color.vue +255 -0
- package/src/components/ui/color-picker/ColorPicker.vue +25 -0
- package/src/components/ui/color-picker/Gradient.vue +172 -0
- package/src/components/ui/color-picker/Handle.vue +19 -0
- package/src/components/ui/color-picker/Hue.vue +80 -0
- package/src/components/ui/color-picker/LabelInput.vue +16 -0
- package/src/components/ui/color-picker/Rail.vue +100 -0
- package/src/components/ui/color-picker/Saturation.vue +142 -0
- package/src/components/ui/color-picker/index.ts +4 -0
- package/src/components/ui/combobox/Combobox.vue +202 -0
- package/src/components/ui/combobox/ComboboxContent.vue +27 -0
- package/src/components/ui/combobox/ComboboxEmpty.vue +20 -0
- package/src/components/ui/combobox/ComboboxGroup.vue +29 -0
- package/src/components/ui/combobox/ComboboxInput.vue +52 -0
- package/src/components/ui/combobox/ComboboxItem.vue +26 -0
- package/src/components/ui/combobox/ComboboxRoot.vue +31 -0
- package/src/components/ui/combobox/ComboboxSeparator.vue +23 -0
- package/src/components/ui/combobox/index.ts +1 -0
- package/src/components/ui/date-picker/DatePicker.vue +55 -0
- package/src/components/ui/date-picker/index.ts +1 -0
- package/src/components/ui/date-range-picker/DateRangePicker.vue +137 -0
- package/src/components/ui/date-range-picker/index.ts +1 -0
- package/src/components/ui/dialog/Dialog.vue +78 -0
- package/src/components/ui/dialog/DialogContent.vue +46 -0
- package/src/components/ui/dialog/DialogDescription.vue +24 -0
- package/src/components/ui/dialog/DialogFooter.vue +19 -0
- package/src/components/ui/dialog/DialogHeader.vue +16 -0
- package/src/components/ui/dialog/DialogTitle.vue +29 -0
- package/src/components/ui/dialog/DialogTrigger.vue +11 -0
- package/src/components/ui/dialog/index.ts +1 -0
- package/src/components/ui/drawer/Drawer.vue +88 -0
- package/src/components/ui/drawer/DrawerContent.vue +57 -0
- package/src/components/ui/drawer/DrawerDescription.vue +22 -0
- package/src/components/ui/drawer/DrawerFooter.vue +19 -0
- package/src/components/ui/drawer/DrawerHeader.vue +16 -0
- package/src/components/ui/drawer/DrawerTitle.vue +22 -0
- package/src/components/ui/drawer/DrawerTrigger.vue +11 -0
- package/src/components/ui/drawer/index.ts +21 -0
- package/src/components/ui/dropdown-menu/DropdownCheckboxGroupMenu.vue +87 -0
- package/src/components/ui/dropdown-menu/DropdownMenu.vue +72 -0
- package/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuContent.vue +37 -0
- package/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +11 -0
- package/src/components/ui/dropdown-menu/DropdownMenuHelp.vue +14 -0
- package/src/components/ui/dropdown-menu/DropdownMenuItem.vue +28 -0
- package/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +24 -0
- package/src/components/ui/dropdown-menu/DropdownMenuPart.vue +64 -0
- package/src/components/ui/dropdown-menu/DropdownMenuPartItem.vue +76 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +41 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +22 -0
- package/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +14 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +30 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +33 -0
- package/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +13 -0
- package/src/components/ui/dropdown-menu/DropdownRadioGroupMenu.vue +75 -0
- package/src/components/ui/dropdown-menu/index.ts +36 -0
- package/src/components/ui/file-upload-button/FileUploadButton.vue +55 -0
- package/src/components/ui/file-upload-button/index.ts +1 -0
- package/src/components/ui/form/Form.vue +13 -0
- package/src/components/ui/form/FormControl.vue +16 -0
- package/src/components/ui/form/FormDescription.vue +20 -0
- package/src/components/ui/form/FormField.vue +61 -0
- package/src/components/ui/form/FormLabel.vue +23 -0
- package/src/components/ui/form/FormMessage.vue +16 -0
- package/src/components/ui/form/index.ts +2 -0
- package/src/components/ui/form/useFormField.ts +30 -0
- package/src/components/ui/icon/Icon.vue +16 -0
- package/src/components/ui/icon/index.ts +1 -0
- package/src/components/ui/input/Input.vue +51 -0
- package/src/components/ui/input/InputBase.vue +18 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/label/Label.vue +27 -0
- package/src/components/ui/label/index.ts +1 -0
- package/src/components/ui/pagination/Pagination.vue +50 -0
- package/src/components/ui/pagination/PaginationContent.vue +21 -0
- package/src/components/ui/pagination/PaginationEllipsis.vue +24 -0
- package/src/components/ui/pagination/PaginationFirst.vue +32 -0
- package/src/components/ui/pagination/PaginationItem.vue +32 -0
- package/src/components/ui/pagination/PaginationLast.vue +32 -0
- package/src/components/ui/pagination/PaginationNext.vue +32 -0
- package/src/components/ui/pagination/PaginationPrevious.vue +32 -0
- package/src/components/ui/pagination/index.ts +1 -0
- package/src/components/ui/popover/Popover.vue +57 -0
- package/src/components/ui/popover/PopoverTrigger.vue +15 -0
- package/src/components/ui/popover/index.ts +1 -0
- package/src/components/ui/progress/Progress.vue +35 -0
- package/src/components/ui/progress/ProgressIndicator.vue +19 -0
- package/src/components/ui/progress/index.ts +2 -0
- package/src/components/ui/progress-circular/ProgressCircular.vue +85 -0
- package/src/components/ui/progress-circular/index.ts +1 -0
- package/src/components/ui/radio-group/RadioGroup.vue +81 -0
- package/src/components/ui/radio-group/RadioGroupItem.vue +39 -0
- package/src/components/ui/radio-group/index.ts +15 -0
- package/src/components/ui/range-calendar/RangeCalendar.vue +71 -0
- package/src/components/ui/range-calendar/RangeCalendarCell.vue +28 -0
- package/src/components/ui/range-calendar/RangeCalendarCellTrigger.vue +40 -0
- package/src/components/ui/range-calendar/RangeCalendarGrid.vue +24 -0
- package/src/components/ui/range-calendar/RangeCalendarGridBody.vue +11 -0
- package/src/components/ui/range-calendar/RangeCalendarGridHead.vue +11 -0
- package/src/components/ui/range-calendar/RangeCalendarGridRow.vue +21 -0
- package/src/components/ui/range-calendar/RangeCalendarHeadCell.vue +21 -0
- package/src/components/ui/range-calendar/RangeCalendarHeader.vue +21 -0
- package/src/components/ui/range-calendar/RangeCalendarHeading.vue +27 -0
- package/src/components/ui/range-calendar/RangeCalendarNextButton.vue +32 -0
- package/src/components/ui/range-calendar/RangeCalendarPrevButton.vue +32 -0
- package/src/components/ui/range-calendar/index.ts +1 -0
- package/src/components/ui/select/Select.vue +120 -0
- package/src/components/ui/select/SelectContent.vue +45 -0
- package/src/components/ui/select/SelectGroup.vue +19 -0
- package/src/components/ui/select/SelectItem.vue +43 -0
- package/src/components/ui/select/SelectLabel.vue +13 -0
- package/src/components/ui/select/SelectSeparator.vue +17 -0
- package/src/components/ui/select/SelectTrigger.vue +31 -0
- package/src/components/ui/select/SelectValue.vue +11 -0
- package/src/components/ui/select/index.ts +1 -0
- package/src/components/ui/slider/Slider.vue +100 -0
- package/src/components/ui/slider/index.ts +1 -0
- package/src/components/ui/switch/Switch.vue +40 -0
- package/src/components/ui/switch/SwitchBase.vue +36 -0
- package/src/components/ui/switch/index.ts +1 -0
- package/src/components/ui/tabs/Tabs.vue +63 -0
- package/src/components/ui/tabs/TabsContent.vue +26 -0
- package/src/components/ui/tabs/TabsTrigger.vue +27 -0
- package/src/components/ui/tabs/index.ts +28 -0
- package/src/components/ui/textarea/Textarea.vue +13 -0
- package/src/components/ui/textarea/index.ts +1 -0
- package/src/components/ui/toast/Toast.vue +28 -0
- package/src/components/ui/toast/ToastAction.vue +26 -0
- package/src/components/ui/toast/ToastClose.vue +29 -0
- package/src/components/ui/toast/ToastDescription.vue +19 -0
- package/src/components/ui/toast/ToastProvider.vue +11 -0
- package/src/components/ui/toast/ToastTitle.vue +19 -0
- package/src/components/ui/toast/ToastViewport.vue +17 -0
- package/src/components/ui/toast/Toaster.vue +30 -0
- package/src/components/ui/toast/index.ts +34 -0
- package/src/components/ui/toast/useToast.ts +163 -0
- package/src/components/ui/toggle/Toggle.vue +51 -0
- package/src/components/ui/toggle/index.ts +71 -0
- package/src/components/ui/toggle-group/ToggleGroup.vue +58 -0
- package/src/components/ui/toggle-group/ToggleGroupItem.vue +54 -0
- package/src/components/ui/toggle-group/index.ts +1 -0
- package/src/components/ui/tooltip/Tooltip.vue +42 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +11 -0
- package/src/components/ui/tooltip/index.ts +2 -0
- package/src/composables/delegated-props.ts +6 -0
- package/src/composables/emits-as-props.ts +17 -0
- package/src/composables/forward-props-emits.ts +11 -0
- package/src/directives/autofocus.ts +7 -0
- package/src/index.ts +159 -0
- package/src/options-provider.ts +19 -0
- package/src/utils/gradient.ts +158 -0
- package/src/utils/options.ts +40 -0
- package/src/utils/tailwind.ts +14 -0
- package/web-types.json +10560 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuCheckboxItem
|
|
3
|
+
v-bind="forwarded"
|
|
4
|
+
:class=" cn(
|
|
5
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50',
|
|
6
|
+
props.class,
|
|
7
|
+
)"
|
|
8
|
+
>
|
|
9
|
+
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
10
|
+
<DropdownMenuItemIndicator>
|
|
11
|
+
<Check class="w-4 h-4" />
|
|
12
|
+
</DropdownMenuItemIndicator>
|
|
13
|
+
</span>
|
|
14
|
+
<slot />
|
|
15
|
+
</DropdownMenuCheckboxItem>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
20
|
+
import {
|
|
21
|
+
DropdownMenuCheckboxItem,
|
|
22
|
+
type DropdownMenuCheckboxItemEmits,
|
|
23
|
+
type DropdownMenuCheckboxItemProps,
|
|
24
|
+
DropdownMenuItemIndicator,
|
|
25
|
+
useForwardPropsEmits
|
|
26
|
+
} from 'reka-ui'
|
|
27
|
+
import { Check } from 'lucide-vue-next'
|
|
28
|
+
import { cn } from '@/utils/tailwind'
|
|
29
|
+
|
|
30
|
+
const props = defineProps<DropdownMenuCheckboxItemProps & { class?: HTMLAttributes['class'] }>()
|
|
31
|
+
const emits = defineEmits<DropdownMenuCheckboxItemEmits>()
|
|
32
|
+
|
|
33
|
+
const delegatedProps = computed(() => {
|
|
34
|
+
const { class: _, ...delegated } = props
|
|
35
|
+
|
|
36
|
+
return delegated
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuPortal :to="options.portalTo">
|
|
3
|
+
<DropdownMenuContent
|
|
4
|
+
v-bind="forwarded"
|
|
5
|
+
:class="cn('z-50 min-w-32 overflow-auto max-h-[calc(var(--reka-popper-available-height)-4px)] rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</DropdownMenuContent>
|
|
9
|
+
</DropdownMenuPortal>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
14
|
+
import {
|
|
15
|
+
DropdownMenuContent,
|
|
16
|
+
type DropdownMenuContentEmits,
|
|
17
|
+
type DropdownMenuContentProps,
|
|
18
|
+
DropdownMenuPortal,
|
|
19
|
+
useForwardPropsEmits
|
|
20
|
+
} from 'reka-ui'
|
|
21
|
+
import { cn } from '@/utils/tailwind'
|
|
22
|
+
import { getOptions } from '@/options-provider'
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<DropdownMenuContentProps & { class?: HTMLAttributes['class'] }>(), {
|
|
25
|
+
sideOffset: 4
|
|
26
|
+
})
|
|
27
|
+
const emits = defineEmits<DropdownMenuContentEmits>()
|
|
28
|
+
|
|
29
|
+
const delegatedProps = computed(() => {
|
|
30
|
+
const { class: _, ...delegated } = props
|
|
31
|
+
|
|
32
|
+
return delegated
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
36
|
+
const options = getOptions()
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuGroup v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</DropdownMenuGroup>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { DropdownMenuGroup, type DropdownMenuGroupProps } from 'reka-ui'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<DropdownMenuGroupProps>()
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="cn('ml-auto pl-4 text-xs text-secondary-foreground', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/utils/tailwind'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuItem
|
|
3
|
+
v-bind="forwardedProps"
|
|
4
|
+
:class="cn(
|
|
5
|
+
'relative flex gap-2 cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50',
|
|
6
|
+
inset && 'pl-8',
|
|
7
|
+
props.class,
|
|
8
|
+
)"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</DropdownMenuItem>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
16
|
+
import { DropdownMenuItem, type DropdownMenuItemProps, useForwardProps } from 'reka-ui'
|
|
17
|
+
import { cn } from '@/utils/tailwind'
|
|
18
|
+
|
|
19
|
+
const props = defineProps<DropdownMenuItemProps & { class?: HTMLAttributes['class'], inset?: boolean }>()
|
|
20
|
+
|
|
21
|
+
const delegatedProps = computed(() => {
|
|
22
|
+
const { class: _, ...delegated } = props
|
|
23
|
+
|
|
24
|
+
return delegated
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuLabel
|
|
3
|
+
v-bind="forwardedProps"
|
|
4
|
+
:class="cn('px-2 py-1.5 text-sm font-medium', inset && 'pl-8', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</DropdownMenuLabel>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
12
|
+
import { DropdownMenuLabel, type DropdownMenuLabelProps, useForwardProps } from 'reka-ui'
|
|
13
|
+
import { cn } from '@/utils/tailwind'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<DropdownMenuLabelProps & { class?: HTMLAttributes['class'], inset?: boolean }>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
|
+
|
|
20
|
+
return delegated
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="'items' in item">
|
|
3
|
+
<template v-if="item.label">
|
|
4
|
+
<DropdownMenuLabel>
|
|
5
|
+
<slot name="label" v-bind="{ item }">
|
|
6
|
+
{{ item.label }}
|
|
7
|
+
</slot>
|
|
8
|
+
</DropdownMenuLabel>
|
|
9
|
+
<DropdownMenuSeparator />
|
|
10
|
+
</template>
|
|
11
|
+
<DropdownMenuGroup>
|
|
12
|
+
<DropdownMenuPartItem
|
|
13
|
+
v-for="(groupItem, index) in item.items"
|
|
14
|
+
:key="index"
|
|
15
|
+
:item="groupItem"
|
|
16
|
+
@select="$emit('select', $event)"
|
|
17
|
+
>
|
|
18
|
+
<template v-if="$slots['item-icon']" #icon="{ item }">
|
|
19
|
+
<slot name="item-icon" v-bind="{ item }" />
|
|
20
|
+
</template>
|
|
21
|
+
<template v-if="$slots['item-label']" #label="{ item }">
|
|
22
|
+
<slot name="item-label" v-bind="{ item }" />
|
|
23
|
+
</template>
|
|
24
|
+
<template v-if="$slots['item-help']" #help="{ item }">
|
|
25
|
+
<slot name="item-help" v-bind="{ item }" />
|
|
26
|
+
</template>
|
|
27
|
+
</DropdownMenuPartItem>
|
|
28
|
+
</DropdownMenuGroup>
|
|
29
|
+
</template>
|
|
30
|
+
<DropdownMenuPartItem v-else :item="item" @select="$emit('select', $event)">
|
|
31
|
+
<template v-if="$slots['item-icon']" #icon="{ item }">
|
|
32
|
+
<slot name="item-icon" v-bind="{ item }" />
|
|
33
|
+
</template>
|
|
34
|
+
<template v-if="$slots['item-label']" #label="{ item }">
|
|
35
|
+
<slot name="item-label" v-bind="{ item }" />
|
|
36
|
+
</template>
|
|
37
|
+
<template v-if="$slots['item-help']" #help="{ item }">
|
|
38
|
+
<slot name="item-help" v-bind="{ item }" />
|
|
39
|
+
</template>
|
|
40
|
+
</DropdownMenuPartItem>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import DropdownMenuSeparator from './DropdownMenuSeparator.vue'
|
|
45
|
+
import DropdownMenuGroup from './DropdownMenuGroup.vue'
|
|
46
|
+
import DropdownMenuLabel from './DropdownMenuLabel.vue'
|
|
47
|
+
import DropdownMenuPartItem from './DropdownMenuPartItem.vue'
|
|
48
|
+
import type { MenuItem, MenuItemWithChildren, MenuGroupItem } from './'
|
|
49
|
+
|
|
50
|
+
defineProps<{
|
|
51
|
+
item: MenuItem | MenuItemWithChildren | MenuGroupItem
|
|
52
|
+
}>()
|
|
53
|
+
|
|
54
|
+
defineEmits<{
|
|
55
|
+
select: [item: MenuItem]
|
|
56
|
+
}>()
|
|
57
|
+
|
|
58
|
+
defineSlots<{
|
|
59
|
+
'label'(props: { item: MenuGroupItem }): any
|
|
60
|
+
'item-icon'(props: { item: MenuItem }): any
|
|
61
|
+
'item-label'(props: { item: MenuItem }): any
|
|
62
|
+
'item-help'(props: { item: MenuItem }): any
|
|
63
|
+
}>()
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSub v-if="'children' in item">
|
|
3
|
+
<DropdownMenuSubTrigger>
|
|
4
|
+
<slot name="icon" v-bind="{ item }">
|
|
5
|
+
<Icon v-if="item.icon" :icon="item.icon" class="h-4 w-4" />
|
|
6
|
+
</slot>
|
|
7
|
+
<span>
|
|
8
|
+
<slot name="label" v-bind="{ item }">{{ item.label }}</slot>
|
|
9
|
+
</span>
|
|
10
|
+
</DropdownMenuSubTrigger>
|
|
11
|
+
<DropdownMenuPortal :to="options.portalTo">
|
|
12
|
+
<DropdownMenuSubContent>
|
|
13
|
+
<template v-for="(child, index) in item.children" :key="index">
|
|
14
|
+
<DropdownMenuPart :item="child" @select="$emit('select', $event)">
|
|
15
|
+
<template v-if="$slots.icon" #item-icon="{ item }">
|
|
16
|
+
<slot name="icon" v-bind="{ item }" />
|
|
17
|
+
</template>
|
|
18
|
+
<template v-if="$slots.label" #item-label="{ item }">
|
|
19
|
+
<slot name="label" v-bind="{ item }" />
|
|
20
|
+
</template>
|
|
21
|
+
<template v-if="$slots.help" #item-help="{ item }">
|
|
22
|
+
<slot name="help" v-bind="{ item }" />
|
|
23
|
+
</template>
|
|
24
|
+
</DropdownMenuPart>
|
|
25
|
+
<DropdownMenuSeparator v-if="index !== item.children.length - 1 && ('items' in child || 'items' in item.children[index + 1])" />
|
|
26
|
+
</template>
|
|
27
|
+
</DropdownMenuSubContent>
|
|
28
|
+
</DropdownMenuPortal>
|
|
29
|
+
</DropdownMenuSub>
|
|
30
|
+
<DropdownMenuItem v-else :disabled="item.disabled" @select="$emit('select', item)">
|
|
31
|
+
<slot name="icon" v-bind="{ item }">
|
|
32
|
+
<Icon v-if="item.icon" :icon="item.icon" class="h-4 w-4" />
|
|
33
|
+
</slot>
|
|
34
|
+
<span>
|
|
35
|
+
<slot name="label" v-bind="{ item }">{{ item.label }}</slot>
|
|
36
|
+
</span>
|
|
37
|
+
<slot name="help" v-bind="{ item }">
|
|
38
|
+
<DropdownMenuShortcut v-if="item.shortcut">
|
|
39
|
+
{{ item.help }}
|
|
40
|
+
</DropdownMenuShortcut>
|
|
41
|
+
<DropdownMenuHelp v-else-if="item.help">
|
|
42
|
+
{{ item.help }}
|
|
43
|
+
</DropdownMenuHelp>
|
|
44
|
+
</slot>
|
|
45
|
+
</DropdownMenuItem>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import DropdownMenuPart from './DropdownMenuPart.vue'
|
|
50
|
+
import DropdownMenuItem from './DropdownMenuItem.vue'
|
|
51
|
+
import DropdownMenuShortcut from './DropdownMenuShortcut.vue'
|
|
52
|
+
import DropdownMenuHelp from './DropdownMenuHelp.vue'
|
|
53
|
+
import DropdownMenuSub from './DropdownMenuSub.vue'
|
|
54
|
+
import DropdownMenuSubContent from './DropdownMenuSubContent.vue'
|
|
55
|
+
import DropdownMenuSubTrigger from './DropdownMenuSubTrigger.vue'
|
|
56
|
+
import DropdownMenuSeparator from './DropdownMenuSeparator.vue'
|
|
57
|
+
import { DropdownMenuPortal } from 'reka-ui'
|
|
58
|
+
import { Icon } from '@/components/ui/icon'
|
|
59
|
+
import type { MenuItem, MenuItemWithChildren } from './'
|
|
60
|
+
import { getOptions } from '@/options-provider'
|
|
61
|
+
|
|
62
|
+
defineProps<{
|
|
63
|
+
item: MenuItem | MenuItemWithChildren
|
|
64
|
+
}>()
|
|
65
|
+
|
|
66
|
+
defineEmits<{
|
|
67
|
+
select: [item: MenuItem]
|
|
68
|
+
}>()
|
|
69
|
+
|
|
70
|
+
defineSlots<{
|
|
71
|
+
'icon'(props: { item: MenuItem }): any
|
|
72
|
+
'label'(props: { item: MenuItem }): any
|
|
73
|
+
'help'(props: { item: MenuItem }): any
|
|
74
|
+
}>()
|
|
75
|
+
const options = getOptions()
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuRadioGroup v-bind="forwarded">
|
|
3
|
+
<slot />
|
|
4
|
+
</DropdownMenuRadioGroup>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenuRadioGroup,
|
|
10
|
+
type DropdownMenuRadioGroupEmits,
|
|
11
|
+
type DropdownMenuRadioGroupProps,
|
|
12
|
+
useForwardPropsEmits
|
|
13
|
+
} from 'reka-ui'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<DropdownMenuRadioGroupProps>()
|
|
16
|
+
const emits = defineEmits<DropdownMenuRadioGroupEmits>()
|
|
17
|
+
|
|
18
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuRadioItem
|
|
3
|
+
v-bind="forwarded"
|
|
4
|
+
:class="cn(
|
|
5
|
+
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50',
|
|
6
|
+
props.class,
|
|
7
|
+
)"
|
|
8
|
+
>
|
|
9
|
+
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
10
|
+
<DropdownMenuItemIndicator>
|
|
11
|
+
<Circle class="h-2 w-2 fill-current" />
|
|
12
|
+
</DropdownMenuItemIndicator>
|
|
13
|
+
</span>
|
|
14
|
+
<slot />
|
|
15
|
+
</DropdownMenuRadioItem>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
20
|
+
import {
|
|
21
|
+
DropdownMenuItemIndicator,
|
|
22
|
+
DropdownMenuRadioItem,
|
|
23
|
+
type DropdownMenuRadioItemEmits,
|
|
24
|
+
type DropdownMenuRadioItemProps,
|
|
25
|
+
useForwardPropsEmits
|
|
26
|
+
} from 'reka-ui'
|
|
27
|
+
import { Circle } from 'lucide-vue-next'
|
|
28
|
+
import { cn } from '@/utils/tailwind'
|
|
29
|
+
|
|
30
|
+
const props = defineProps<DropdownMenuRadioItemProps & { class?: HTMLAttributes['class'] }>()
|
|
31
|
+
|
|
32
|
+
const emits = defineEmits<DropdownMenuRadioItemEmits>()
|
|
33
|
+
|
|
34
|
+
const delegatedProps = computed(() => {
|
|
35
|
+
const { class: _, ...delegated } = props
|
|
36
|
+
|
|
37
|
+
return delegated
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSeparator v-bind="delegatedProps" :class="cn('-mx-1 my-1 h-px bg-muted', props.class)" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
7
|
+
import {
|
|
8
|
+
DropdownMenuSeparator,
|
|
9
|
+
type DropdownMenuSeparatorProps
|
|
10
|
+
} from 'reka-ui'
|
|
11
|
+
import { cn } from '@/utils/tailwind'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<DropdownMenuSeparatorProps & {
|
|
14
|
+
class?: HTMLAttributes['class']
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
|
+
|
|
20
|
+
return delegated
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="cn('ml-auto pl-4 text-xs tracking-widest opacity-60', props.class)">
|
|
3
|
+
<slot />
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { HTMLAttributes } from 'vue'
|
|
9
|
+
import { cn } from '@/utils/tailwind'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSub v-bind="forwarded">
|
|
3
|
+
<slot />
|
|
4
|
+
</DropdownMenuSub>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenuSub,
|
|
10
|
+
type DropdownMenuSubEmits,
|
|
11
|
+
type DropdownMenuSubProps,
|
|
12
|
+
useForwardPropsEmits
|
|
13
|
+
} from 'reka-ui'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<DropdownMenuSubProps>()
|
|
16
|
+
const emits = defineEmits<DropdownMenuSubEmits>()
|
|
17
|
+
|
|
18
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSubContent
|
|
3
|
+
v-bind="forwarded"
|
|
4
|
+
:class="cn('z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</DropdownMenuSubContent>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
12
|
+
import {
|
|
13
|
+
DropdownMenuSubContent,
|
|
14
|
+
type DropdownMenuSubContentEmits,
|
|
15
|
+
type DropdownMenuSubContentProps,
|
|
16
|
+
useForwardPropsEmits
|
|
17
|
+
} from 'reka-ui'
|
|
18
|
+
import { cn } from '@/utils/tailwind'
|
|
19
|
+
|
|
20
|
+
const props = defineProps<DropdownMenuSubContentProps & { class?: HTMLAttributes['class'] }>()
|
|
21
|
+
const emits = defineEmits<DropdownMenuSubContentEmits>()
|
|
22
|
+
|
|
23
|
+
const delegatedProps = computed(() => {
|
|
24
|
+
const { class: _, ...delegated } = props
|
|
25
|
+
|
|
26
|
+
return delegated
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuSubTrigger
|
|
3
|
+
v-bind="forwardedProps"
|
|
4
|
+
:class="cn(
|
|
5
|
+
'flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent',
|
|
6
|
+
props.class,
|
|
7
|
+
)"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
<ChevronRight class="ml-auto h-4 w-4" />
|
|
11
|
+
</DropdownMenuSubTrigger>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
16
|
+
import {
|
|
17
|
+
DropdownMenuSubTrigger,
|
|
18
|
+
type DropdownMenuSubTriggerProps,
|
|
19
|
+
useForwardProps
|
|
20
|
+
} from 'reka-ui'
|
|
21
|
+
import { ChevronRight } from 'lucide-vue-next'
|
|
22
|
+
import { cn } from '@/utils/tailwind'
|
|
23
|
+
|
|
24
|
+
const props = defineProps<DropdownMenuSubTriggerProps & { class?: HTMLAttributes['class'] }>()
|
|
25
|
+
|
|
26
|
+
const delegatedProps = computed(() => {
|
|
27
|
+
const { class: _, ...delegated } = props
|
|
28
|
+
|
|
29
|
+
return delegated
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuTrigger class="outline-hidden" v-bind="forwardedProps">
|
|
3
|
+
<slot />
|
|
4
|
+
</DropdownMenuTrigger>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { DropdownMenuTrigger, type DropdownMenuTriggerProps, useForwardProps } from 'reka-ui'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<DropdownMenuTriggerProps>()
|
|
11
|
+
|
|
12
|
+
const forwardedProps = useForwardProps(props)
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DropdownMenuRoot v-bind="forwarded">
|
|
3
|
+
<DropdownMenuTrigger as-child>
|
|
4
|
+
<slot name="trigger" />
|
|
5
|
+
</DropdownMenuTrigger>
|
|
6
|
+
|
|
7
|
+
<DropdownMenuContent
|
|
8
|
+
:class="cn('min-w-32', props.class)"
|
|
9
|
+
:side-offset="4"
|
|
10
|
+
:align-offset="4"
|
|
11
|
+
:align="align"
|
|
12
|
+
:side="side"
|
|
13
|
+
>
|
|
14
|
+
<template v-if="label || $slots.label">
|
|
15
|
+
<DropdownMenuLabel>
|
|
16
|
+
<slot name="label">
|
|
17
|
+
{{ label }}
|
|
18
|
+
</slot>
|
|
19
|
+
</DropdownMenuLabel>
|
|
20
|
+
<DropdownMenuSeparator />
|
|
21
|
+
</template>
|
|
22
|
+
<DropdownMenuRadioGroup v-model="modelValue">
|
|
23
|
+
<DropdownMenuRadioGroupItem
|
|
24
|
+
v-for="(item, index) in items"
|
|
25
|
+
:key="index"
|
|
26
|
+
:value="item.value"
|
|
27
|
+
@select="$emit('select', item)"
|
|
28
|
+
>
|
|
29
|
+
<span>{{ item.label }}</span>
|
|
30
|
+
<DropdownMenuHelp v-if="item.help">
|
|
31
|
+
{{ item.help }}
|
|
32
|
+
</DropdownMenuHelp>
|
|
33
|
+
</DropdownMenuRadioGroupItem>
|
|
34
|
+
</DropdownMenuRadioGroup>
|
|
35
|
+
</DropdownMenuContent>
|
|
36
|
+
</DropdownMenuRoot>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import {
|
|
41
|
+
DropdownMenuRoot,
|
|
42
|
+
type DropdownMenuRootEmits,
|
|
43
|
+
type DropdownMenuRootProps,
|
|
44
|
+
type DropdownMenuContentProps
|
|
45
|
+
} from 'reka-ui'
|
|
46
|
+
import DropdownMenuTrigger from './DropdownMenuTrigger.vue'
|
|
47
|
+
import DropdownMenuContent from './DropdownMenuContent.vue'
|
|
48
|
+
import DropdownMenuSeparator from './DropdownMenuSeparator.vue'
|
|
49
|
+
import DropdownMenuRadioGroup from './DropdownMenuRadioGroup.vue'
|
|
50
|
+
import DropdownMenuRadioGroupItem from './DropdownMenuRadioItem.vue'
|
|
51
|
+
import DropdownMenuHelp from './DropdownMenuHelp.vue'
|
|
52
|
+
import DropdownMenuLabel from './DropdownMenuLabel.vue'
|
|
53
|
+
import type { MenuRadioItem } from './'
|
|
54
|
+
import { cn } from '@/utils/tailwind'
|
|
55
|
+
import { type HTMLAttributes, provide } from 'vue'
|
|
56
|
+
import { useDelegatedProps } from '@/composables/delegated-props'
|
|
57
|
+
import { useEmitAsProps } from '@/composables/emits-as-props'
|
|
58
|
+
import { useForwardPropsEmits } from '@/composables/forward-props-emits'
|
|
59
|
+
|
|
60
|
+
const modelValue = defineModel<any>()
|
|
61
|
+
const props = defineProps<DropdownMenuRootProps & Pick<DropdownMenuContentProps, 'side' | 'align'> & {
|
|
62
|
+
items: MenuRadioItem[]
|
|
63
|
+
label?: string,
|
|
64
|
+
class?: HTMLAttributes['class']
|
|
65
|
+
}>()
|
|
66
|
+
const emits = defineEmits<DropdownMenuRootEmits & {
|
|
67
|
+
select: [item: MenuRadioItem]
|
|
68
|
+
}>()
|
|
69
|
+
|
|
70
|
+
provide('hasDropdown', true)
|
|
71
|
+
|
|
72
|
+
const delegatedProps = useDelegatedProps(props, ['align', 'side', 'label', 'items', 'class', 'modelValue'])
|
|
73
|
+
const delegatedEmits = useEmitAsProps(emits, ['select', 'update:modelValue'])
|
|
74
|
+
const forwarded = useForwardPropsEmits(delegatedProps, delegatedEmits)
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { default as DropdownMenu } from './DropdownMenu.vue'
|
|
2
|
+
export { default as DropdownRadioGroupMenu } from './DropdownRadioGroupMenu.vue'
|
|
3
|
+
export { default as DropdownCheckboxGroupMenu } from './DropdownCheckboxGroupMenu.vue'
|
|
4
|
+
|
|
5
|
+
export interface MenuItem {
|
|
6
|
+
label: string
|
|
7
|
+
icon?: string
|
|
8
|
+
help?: string
|
|
9
|
+
shortcut?: string
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface MenuRadioItem {
|
|
14
|
+
label: string
|
|
15
|
+
help?: string
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
value: any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface MenuCheckboxItem {
|
|
21
|
+
label: string
|
|
22
|
+
help?: string
|
|
23
|
+
disabled?: boolean
|
|
24
|
+
value: any
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface MenuItemWithChildren {
|
|
28
|
+
label: string
|
|
29
|
+
icon?: string
|
|
30
|
+
children: MenuItem[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MenuGroupItem {
|
|
34
|
+
items: (MenuItem | MenuItemWithChildren)[]
|
|
35
|
+
label?: string
|
|
36
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="inline-flex">
|
|
3
|
+
<Button
|
|
4
|
+
v-bind="forwardedProps"
|
|
5
|
+
@click="input!.click()"
|
|
6
|
+
>
|
|
7
|
+
<template v-if="$slots.default" #default>
|
|
8
|
+
<slot />
|
|
9
|
+
</template>
|
|
10
|
+
<template v-if="$slots.icon" #icon>
|
|
11
|
+
<slot name="icon" />
|
|
12
|
+
</template>
|
|
13
|
+
<template v-if="$slots.tooltip" #tooltip>
|
|
14
|
+
<slot name="tooltip" />
|
|
15
|
+
</template>
|
|
16
|
+
</Button>
|
|
17
|
+
<input
|
|
18
|
+
v-show="false"
|
|
19
|
+
ref="input"
|
|
20
|
+
type="file"
|
|
21
|
+
:accept="accept"
|
|
22
|
+
:name="name"
|
|
23
|
+
:multiple="multiple"
|
|
24
|
+
@change="$emit('change', $event)"
|
|
25
|
+
>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { Button } from '@/components/ui/button'
|
|
31
|
+
import { type ButtonProps } from '@/components/ui/button/Button.vue'
|
|
32
|
+
import { ref } from 'vue'
|
|
33
|
+
import { useDelegatedProps } from '@/composables/delegated-props'
|
|
34
|
+
import { useForwardProps } from 'reka-ui'
|
|
35
|
+
|
|
36
|
+
const input = ref<HTMLElement | null>(null)
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<ButtonProps & {
|
|
39
|
+
accept?: string
|
|
40
|
+
name: string,
|
|
41
|
+
multiple?: boolean
|
|
42
|
+
}>(), {
|
|
43
|
+
loading: false,
|
|
44
|
+
disabled: false,
|
|
45
|
+
iconPosition: 'left',
|
|
46
|
+
multiple: false,
|
|
47
|
+
icon: 'upload'
|
|
48
|
+
})
|
|
49
|
+
defineEmits<{
|
|
50
|
+
change: [event: Event]
|
|
51
|
+
}>()
|
|
52
|
+
|
|
53
|
+
const delegatedProps = useDelegatedProps(props, ['accept', 'name', 'multiple'])
|
|
54
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
55
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FileUploadButton } from './FileUploadButton.vue'
|