@nuxt/ui 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/accordion.ts +25 -4
- package/.nuxt/ui/alert.ts +52 -31
- package/.nuxt/ui/avatar-group.ts +24 -3
- package/.nuxt/ui/avatar.ts +26 -5
- package/.nuxt/ui/badge.ts +56 -35
- package/.nuxt/ui/breadcrumb.ts +28 -7
- package/.nuxt/ui/button-group.ts +23 -2
- package/.nuxt/ui/button.ts +66 -45
- package/.nuxt/ui/calendar.ts +39 -18
- package/.nuxt/ui/card.ts +28 -7
- package/.nuxt/ui/carousel.ts +29 -8
- package/.nuxt/ui/checkbox-group.ts +82 -0
- package/.nuxt/ui/checkbox.ts +163 -29
- package/.nuxt/ui/chip.ts +31 -10
- package/.nuxt/ui/collapsible.ts +23 -2
- package/.nuxt/ui/color-picker.ts +26 -5
- package/.nuxt/ui/command-palette.ts +37 -16
- package/.nuxt/ui/container.ts +23 -2
- package/.nuxt/ui/context-menu.ts +56 -35
- package/.nuxt/ui/drawer.ts +33 -12
- package/.nuxt/ui/dropdown-menu.ts +57 -36
- package/.nuxt/ui/form-field.ts +29 -8
- package/.nuxt/ui/form.ts +23 -2
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +65 -44
- package/.nuxt/ui/input-number.ts +43 -22
- package/.nuxt/ui/input.ts +46 -25
- package/.nuxt/ui/kbd.ts +27 -6
- package/.nuxt/ui/link.ts +26 -5
- package/.nuxt/ui/modal.ts +28 -7
- package/.nuxt/ui/navigation-menu.ts +102 -83
- package/.nuxt/ui/pagination.ts +23 -2
- package/.nuxt/ui/pin-input.ts +43 -22
- package/.nuxt/ui/popover.ts +25 -4
- package/.nuxt/ui/progress.ts +40 -19
- package/.nuxt/ui/radio-group.ts +273 -37
- package/.nuxt/ui/select-menu.ts +59 -35
- package/.nuxt/ui/select.ts +55 -34
- package/.nuxt/ui/separator.ts +31 -10
- package/.nuxt/ui/skeleton.ts +24 -3
- package/.nuxt/ui/slideover.ts +27 -6
- package/.nuxt/ui/slider.ts +39 -18
- package/.nuxt/ui/stepper.ts +41 -20
- package/.nuxt/ui/switch.ts +43 -22
- package/.nuxt/ui/table.ts +38 -17
- package/.nuxt/ui/tabs.ts +55 -34
- package/.nuxt/ui/textarea.ts +63 -37
- package/.nuxt/ui/toast.ts +47 -26
- package/.nuxt/ui/toaster.ts +23 -2
- package/.nuxt/ui/tooltip.ts +25 -4
- package/.nuxt/ui/tree.ts +41 -20
- package/.nuxt/ui.css +56 -12
- package/README.md +11 -0
- package/cli/templates.mjs +18 -17
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Accordion.vue +36 -93
- package/dist/runtime/components/Accordion.vue.d.ts +91 -0
- package/dist/runtime/components/Alert.vue +37 -100
- package/dist/runtime/components/Alert.vue.d.ts +96 -0
- package/dist/runtime/components/App.vue +28 -34
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +42 -75
- package/dist/runtime/components/Avatar.vue.d.ts +60 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +33 -62
- package/dist/runtime/components/Badge.vue.d.ts +62 -0
- package/dist/runtime/components/Breadcrumb.vue +37 -90
- package/dist/runtime/components/Breadcrumb.vue.d.ts +82 -0
- package/dist/runtime/components/Button.vue +95 -104
- package/dist/runtime/components/Button.vue.d.ts +73 -0
- package/dist/runtime/components/ButtonGroup.vue +20 -46
- package/dist/runtime/components/ButtonGroup.vue.d.ts +55 -0
- package/dist/runtime/components/Calendar.vue +67 -150
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Card.vue +18 -40
- package/dist/runtime/components/Card.vue.d.ts +38 -0
- package/dist/runtime/components/Carousel.vue +112 -234
- package/dist/runtime/components/Carousel.vue.d.ts +120 -0
- package/dist/runtime/components/Checkbox.vue +52 -93
- package/dist/runtime/components/Checkbox.vue.d.ts +76 -0
- package/dist/runtime/components/CheckboxGroup.vue +121 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +75 -0
- package/dist/runtime/components/Chip.vue +26 -69
- package/dist/runtime/components/Chip.vue.d.ts +71 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/ColorPicker.vue +111 -197
- package/dist/runtime/components/ColorPicker.vue.d.ts +63 -0
- package/dist/runtime/components/CommandPalette.vue +96 -237
- package/dist/runtime/components/CommandPalette.vue.d.ts +173 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/ContextMenu.vue +34 -133
- package/dist/runtime/components/ContextMenu.vue.d.ts +127 -0
- package/dist/runtime/components/ContextMenuContent.vue +73 -81
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +105 -0
- package/dist/runtime/components/Drawer.vue +49 -83
- package/dist/runtime/components/Drawer.vue.d.ts +88 -0
- package/dist/runtime/components/DropdownMenu.vue +39 -142
- package/dist/runtime/components/DropdownMenu.vue.d.ts +141 -0
- package/dist/runtime/components/DropdownMenuContent.vue +78 -88
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +55 -0
- package/dist/runtime/components/Form.vue +135 -220
- package/dist/runtime/components/Form.vue.d.ts +66 -0
- package/dist/runtime/components/FormField.vue +35 -77
- package/dist/runtime/components/FormField.vue.d.ts +70 -0
- package/dist/runtime/components/Icon.vue +12 -19
- package/dist/runtime/components/Icon.vue.d.ts +17 -0
- package/dist/runtime/components/Input.vue +82 -140
- package/dist/runtime/components/Input.vue.d.ts +91 -0
- package/dist/runtime/components/InputMenu.vue +185 -332
- package/dist/runtime/components/InputMenu.vue.d.ts +312 -0
- package/dist/runtime/components/InputNumber.vue +71 -133
- package/dist/runtime/components/InputNumber.vue.d.ts +193 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +98 -176
- package/dist/runtime/components/Link.vue.d.ts +124 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +53 -116
- package/dist/runtime/components/Modal.vue.d.ts +109 -0
- package/dist/runtime/components/NavigationMenu.vue +77 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +46 -140
- package/dist/runtime/components/Pagination.vue.d.ts +143 -0
- package/dist/runtime/components/PinInput.vue +61 -78
- package/dist/runtime/components/PinInput.vue.d.ts +68 -0
- package/dist/runtime/components/Popover.vue +47 -84
- package/dist/runtime/components/Popover.vue.d.ts +80 -0
- package/dist/runtime/components/Progress.vue +70 -131
- package/dist/runtime/components/Progress.vue.d.ts +97 -0
- package/dist/runtime/components/RadioGroup.vue +70 -132
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Select.vue +110 -224
- package/dist/runtime/components/Select.vue.d.ts +139 -0
- package/dist/runtime/components/SelectMenu.vue +161 -310
- package/dist/runtime/components/SelectMenu.vue.d.ts +184 -0
- package/dist/runtime/components/Separator.vue +29 -71
- package/dist/runtime/components/Separator.vue.d.ts +75 -0
- package/dist/runtime/components/Skeleton.vue +21 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +53 -120
- package/dist/runtime/components/Slideover.vue.d.ts +111 -0
- package/dist/runtime/components/Slider.vue +46 -84
- package/dist/runtime/components/Slider.vue.d.ts +71 -0
- package/dist/runtime/components/Stepper.vue +45 -115
- package/dist/runtime/components/Stepper.vue.d.ts +89 -0
- package/dist/runtime/components/Switch.vue +45 -93
- package/dist/runtime/components/Switch.vue.d.ts +73 -0
- package/dist/runtime/components/Table.vue +163 -267
- package/dist/runtime/components/Table.vue.d.ts +183 -0
- package/dist/runtime/components/Tabs.vue +41 -107
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +113 -158
- package/dist/runtime/components/Textarea.vue.d.ts +95 -0
- package/dist/runtime/components/Toast.vue +49 -110
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -107
- package/dist/runtime/components/Toaster.vue.d.ts +63 -0
- package/dist/runtime/components/Tooltip.vue +38 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/Tree.vue +59 -166
- package/dist/runtime/components/Tree.vue.d.ts +128 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/inertia/components/Link.vue +146 -0
- package/dist/runtime/inertia/components/Link.vue.d.ts +92 -0
- package/dist/runtime/inertia/stubs.d.ts +43 -0
- package/dist/runtime/inertia/stubs.js +82 -0
- package/dist/runtime/locale/bg.d.ts +3 -0
- package/dist/runtime/locale/bg.js +54 -0
- package/dist/runtime/locale/index.d.ts +5 -1
- package/dist/runtime/locale/index.js +5 -1
- package/dist/runtime/locale/kk.d.ts +3 -0
- package/dist/runtime/locale/kk.js +54 -0
- package/dist/runtime/locale/tj.d.ts +3 -0
- package/dist/runtime/locale/tj.js +54 -0
- package/dist/runtime/locale/ug_cn.d.ts +3 -0
- package/dist/runtime/locale/ug_cn.js +55 -0
- package/dist/runtime/types/form.d.ts +4 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +47 -7
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Icon.vue +7 -8
- package/dist/runtime/vue/components/Icon.vue.d.ts +14 -0
- package/dist/runtime/vue/components/Link.vue +118 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +124 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{ui.BkNUP964.mjs → ui.D7lOOabO.mjs} +621 -362
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.d.mts +4 -0
- package/dist/unplugin.mjs +25 -4
- package/dist/vite.mjs +1 -1
- package/package.json +94 -53
- package/dist/module.cjs +0 -62
- package/dist/module.d.cts +0 -45
- package/dist/module.d.ts +0 -45
- package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -232
- package/dist/unplugin.d.cts +0 -62
- package/dist/unplugin.d.ts +0 -62
- package/dist/vite.cjs +0 -23
- package/dist/vite.d.cts +0 -15
- package/dist/vite.d.ts +0 -15
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { DialogRootProps, DialogRootEmits, DialogContentProps, DialogContentEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/slideover';
|
|
4
|
+
import type { ButtonProps } from '../types';
|
|
5
|
+
import type { EmitsToProps, ComponentConfig } from '../types/utils';
|
|
6
|
+
type Slideover = ComponentConfig<typeof theme, AppConfig, 'slideover'>;
|
|
7
|
+
export interface SlideoverProps extends DialogRootProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
/** The content of the slideover. */
|
|
11
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>;
|
|
12
|
+
/**
|
|
13
|
+
* Render an overlay behind the slideover.
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
overlay?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Animate the slideover when opening or closing.
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
transition?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The side of the slideover.
|
|
24
|
+
* @defaultValue 'right'
|
|
25
|
+
*/
|
|
26
|
+
side?: Slideover['variants']['side'];
|
|
27
|
+
/**
|
|
28
|
+
* Render the slideover in a portal.
|
|
29
|
+
* @defaultValue true
|
|
30
|
+
*/
|
|
31
|
+
portal?: boolean | string | HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* Display a close button to dismiss the slideover.
|
|
34
|
+
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
35
|
+
* @defaultValue true
|
|
36
|
+
*/
|
|
37
|
+
close?: boolean | Partial<ButtonProps>;
|
|
38
|
+
/**
|
|
39
|
+
* The icon displayed in the close button.
|
|
40
|
+
* @defaultValue appConfig.ui.icons.close
|
|
41
|
+
* @IconifyIcon
|
|
42
|
+
*/
|
|
43
|
+
closeIcon?: string;
|
|
44
|
+
/**
|
|
45
|
+
* When `false`, the slideover will not close when clicking outside or pressing escape.
|
|
46
|
+
* @defaultValue true
|
|
47
|
+
*/
|
|
48
|
+
dismissible?: boolean;
|
|
49
|
+
class?: any;
|
|
50
|
+
ui?: Slideover['slots'];
|
|
51
|
+
}
|
|
52
|
+
export interface SlideoverEmits extends DialogRootEmits {
|
|
53
|
+
'after:leave': [];
|
|
54
|
+
'close:prevent': [];
|
|
55
|
+
}
|
|
56
|
+
export interface SlideoverSlots {
|
|
57
|
+
default(props: {
|
|
58
|
+
open: boolean;
|
|
59
|
+
}): any;
|
|
60
|
+
content(props?: {}): any;
|
|
61
|
+
header(props?: {}): any;
|
|
62
|
+
title(props?: {}): any;
|
|
63
|
+
description(props?: {}): any;
|
|
64
|
+
close(props: {
|
|
65
|
+
ui: {
|
|
66
|
+
[K in keyof Required<Slideover['slots']>]: (props?: Record<string, any>) => string;
|
|
67
|
+
};
|
|
68
|
+
}): any;
|
|
69
|
+
body(props?: {}): any;
|
|
70
|
+
footer(props?: {}): any;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<SlideoverProps>, {
|
|
73
|
+
close: boolean;
|
|
74
|
+
portal: boolean;
|
|
75
|
+
overlay: boolean;
|
|
76
|
+
transition: boolean;
|
|
77
|
+
modal: boolean;
|
|
78
|
+
dismissible: boolean;
|
|
79
|
+
side: string;
|
|
80
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
|
|
81
|
+
close: boolean | Partial<ButtonProps>;
|
|
82
|
+
modal: boolean;
|
|
83
|
+
transition: boolean;
|
|
84
|
+
portal: boolean | string | HTMLElement;
|
|
85
|
+
overlay: boolean;
|
|
86
|
+
side: Slideover["variants"]["side"];
|
|
87
|
+
dismissible: boolean;
|
|
88
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<SlideoverSlots> & SlideoverSlots>;
|
|
89
|
+
export default _default;
|
|
90
|
+
type __VLS_WithDefaults<P, D> = {
|
|
91
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
92
|
+
default: D[K];
|
|
93
|
+
}> : P[K];
|
|
94
|
+
};
|
|
95
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
96
|
+
type __VLS_TypePropsToOption<T> = {
|
|
97
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
98
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
99
|
+
} : {
|
|
100
|
+
type: import('vue').PropType<T[K]>;
|
|
101
|
+
required: true;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
105
|
+
new (): {
|
|
106
|
+
$slots: S;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
type __VLS_PrettifyLocal<T> = {
|
|
110
|
+
[K in keyof T]: T[K];
|
|
111
|
+
} & {};
|
|
@@ -1,101 +1,63 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { SliderRootProps } from 'reka-ui'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import theme from '#build/ui/slider'
|
|
7
|
-
import { tv } from '../utils/tv'
|
|
8
|
-
|
|
9
|
-
const appConfigSlider = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
|
|
10
|
-
|
|
11
|
-
const slider = tv({ extend: tv(theme), ...(appConfigSlider.ui?.slider || {}) })
|
|
12
|
-
|
|
13
|
-
type SliderVariants = VariantProps<typeof slider>
|
|
14
|
-
|
|
15
|
-
export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
|
|
16
|
-
/**
|
|
17
|
-
* The element or component this component should render as.
|
|
18
|
-
* @defaultValue 'div'
|
|
19
|
-
*/
|
|
20
|
-
as?: any
|
|
21
|
-
/**
|
|
22
|
-
* @defaultValue 'md'
|
|
23
|
-
*/
|
|
24
|
-
size?: SliderVariants['size']
|
|
25
|
-
/**
|
|
26
|
-
* @defaultValue 'primary'
|
|
27
|
-
*/
|
|
28
|
-
color?: SliderVariants['color']
|
|
29
|
-
/**
|
|
30
|
-
* The orientation of the slider.
|
|
31
|
-
* @defaultValue 'horizontal'
|
|
32
|
-
*/
|
|
33
|
-
orientation?: SliderRootProps['orientation']
|
|
34
|
-
/** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
|
|
35
|
-
defaultValue?: number | number[]
|
|
36
|
-
class?: any
|
|
37
|
-
ui?: Partial<typeof slider.slots>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface SliderEmits {
|
|
41
|
-
(e: 'update:modelValue', payload: number | number[]): void
|
|
42
|
-
(e: 'change', payload: Event): void
|
|
43
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/slider";
|
|
44
3
|
</script>
|
|
45
4
|
|
|
46
|
-
<script setup
|
|
47
|
-
import { computed } from
|
|
48
|
-
import { SliderRoot, SliderRange, SliderTrack, SliderThumb, useForwardPropsEmits } from
|
|
49
|
-
import { reactivePick } from
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { SliderRoot, SliderRange, SliderTrack, SliderThumb, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { reactivePick } from "@vueuse/core";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useFormField } from "../composables/useFormField";
|
|
11
|
+
import { tv } from "../utils/tv";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
size: { type: null, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
17
|
+
defaultValue: { type: [Number, Array], required: false },
|
|
18
|
+
class: { type: null, required: false },
|
|
19
|
+
ui: { type: null, required: false },
|
|
20
|
+
name: { type: String, required: false },
|
|
21
|
+
disabled: { type: Boolean, required: false },
|
|
22
|
+
inverted: { type: Boolean, required: false },
|
|
23
|
+
min: { type: Number, required: false, default: 0 },
|
|
24
|
+
max: { type: Number, required: false, default: 100 },
|
|
25
|
+
step: { type: Number, required: false, default: 1 },
|
|
26
|
+
minStepsBetweenThumbs: { type: Number, required: false }
|
|
27
|
+
});
|
|
28
|
+
const emits = defineEmits(["update:modelValue", "change"]);
|
|
29
|
+
const modelValue = defineModel({ type: [Number, Array] });
|
|
30
|
+
const appConfig = useAppConfig();
|
|
31
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted"), emits);
|
|
32
|
+
const { id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
|
|
66
33
|
const defaultSliderValue = computed(() => {
|
|
67
|
-
if (typeof props.defaultValue ===
|
|
68
|
-
return [props.defaultValue]
|
|
34
|
+
if (typeof props.defaultValue === "number") {
|
|
35
|
+
return [props.defaultValue];
|
|
69
36
|
}
|
|
70
|
-
return props.defaultValue
|
|
71
|
-
})
|
|
72
|
-
|
|
37
|
+
return props.defaultValue;
|
|
38
|
+
});
|
|
73
39
|
const sliderValue = computed({
|
|
74
40
|
get() {
|
|
75
|
-
if (typeof modelValue.value ===
|
|
76
|
-
return [modelValue.value]
|
|
41
|
+
if (typeof modelValue.value === "number") {
|
|
42
|
+
return [modelValue.value];
|
|
77
43
|
}
|
|
78
|
-
return modelValue.value ?? defaultSliderValue.value
|
|
44
|
+
return modelValue.value ?? defaultSliderValue.value;
|
|
79
45
|
},
|
|
80
46
|
set(value) {
|
|
81
|
-
modelValue.value = value?.length !== 1 ? value : value[0]
|
|
47
|
+
modelValue.value = value?.length !== 1 ? value : value[0];
|
|
82
48
|
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
const ui = computed(() => slider({
|
|
49
|
+
});
|
|
50
|
+
const thumbsCount = computed(() => sliderValue.value?.length ?? 1);
|
|
51
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.slider || {} })({
|
|
88
52
|
disabled: disabled.value,
|
|
89
53
|
size: size.value,
|
|
90
54
|
color: color.value,
|
|
91
55
|
orientation: props.orientation
|
|
92
|
-
}))
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
emits('change', event)
|
|
98
|
-
emitFormChange()
|
|
56
|
+
}));
|
|
57
|
+
function onChange(value) {
|
|
58
|
+
const event = new Event("change", { target: { value } });
|
|
59
|
+
emits("change", event);
|
|
60
|
+
emitFormChange();
|
|
99
61
|
}
|
|
100
62
|
</script>
|
|
101
63
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { SliderRootProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/slider';
|
|
4
|
+
import type { ComponentConfig } from '../types/utils';
|
|
5
|
+
type Slider = ComponentConfig<typeof theme, AppConfig, 'slider'>;
|
|
6
|
+
export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
|
|
7
|
+
/**
|
|
8
|
+
* The element or component this component should render as.
|
|
9
|
+
* @defaultValue 'div'
|
|
10
|
+
*/
|
|
11
|
+
as?: any;
|
|
12
|
+
/**
|
|
13
|
+
* @defaultValue 'md'
|
|
14
|
+
*/
|
|
15
|
+
size?: Slider['variants']['size'];
|
|
16
|
+
/**
|
|
17
|
+
* @defaultValue 'primary'
|
|
18
|
+
*/
|
|
19
|
+
color?: Slider['variants']['color'];
|
|
20
|
+
/**
|
|
21
|
+
* The orientation of the slider.
|
|
22
|
+
* @defaultValue 'horizontal'
|
|
23
|
+
*/
|
|
24
|
+
orientation?: SliderRootProps['orientation'];
|
|
25
|
+
/** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
|
|
26
|
+
defaultValue?: number | number[];
|
|
27
|
+
class?: any;
|
|
28
|
+
ui?: Slider['slots'];
|
|
29
|
+
}
|
|
30
|
+
export interface SliderEmits {
|
|
31
|
+
(e: 'update:modelValue', payload: number | number[]): void;
|
|
32
|
+
(e: 'change', payload: Event): void;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
35
|
+
modelValue?: number | number[];
|
|
36
|
+
} & SliderProps>, {
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
step: number;
|
|
40
|
+
orientation: string;
|
|
41
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
42
|
+
modelValue?: number | number[];
|
|
43
|
+
} & SliderProps>, {
|
|
44
|
+
min: number;
|
|
45
|
+
max: number;
|
|
46
|
+
step: number;
|
|
47
|
+
orientation: string;
|
|
48
|
+
}>>> & Readonly<{}>, {
|
|
49
|
+
orientation: "horizontal" | "vertical";
|
|
50
|
+
step: number;
|
|
51
|
+
max: number;
|
|
52
|
+
min: number;
|
|
53
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
+
export default _default;
|
|
55
|
+
type __VLS_WithDefaults<P, D> = {
|
|
56
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
57
|
+
default: D[K];
|
|
58
|
+
}> : P[K];
|
|
59
|
+
};
|
|
60
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
61
|
+
type __VLS_TypePropsToOption<T> = {
|
|
62
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
63
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
64
|
+
} : {
|
|
65
|
+
type: import('vue').PropType<T[K]>;
|
|
66
|
+
required: true;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type __VLS_PrettifyLocal<T> = {
|
|
70
|
+
[K in keyof T]: T[K];
|
|
71
|
+
} & {};
|
|
@@ -1,134 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { VariantProps } from 'tailwind-variants'
|
|
4
|
-
import type { StepperRootProps, StepperRootEmits } from 'reka-ui'
|
|
5
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
-
import _appConfig from '#build/app.config'
|
|
7
|
-
import theme from '#build/ui/stepper'
|
|
8
|
-
import { tv } from '../utils/tv'
|
|
9
|
-
import type { DynamicSlots } from '../types/utils'
|
|
10
|
-
|
|
11
|
-
const appConfigStepper = _appConfig as AppConfig & { ui: { stepper: Partial<typeof theme> } }
|
|
12
|
-
|
|
13
|
-
const stepper = tv({ extend: tv(theme), ...(appConfigStepper.ui?.stepper || {}) })
|
|
14
|
-
|
|
15
|
-
type StepperVariants = VariantProps<typeof stepper>
|
|
16
|
-
|
|
17
|
-
export interface StepperItem {
|
|
18
|
-
slot?: string
|
|
19
|
-
value?: string | number
|
|
20
|
-
title?: string
|
|
21
|
-
description?: string
|
|
22
|
-
/**
|
|
23
|
-
* @IconifyIcon
|
|
24
|
-
*/
|
|
25
|
-
icon?: string
|
|
26
|
-
content?: string
|
|
27
|
-
disabled?: boolean
|
|
28
|
-
[key: string]: any
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface StepperProps<T extends StepperItem = StepperItem> extends Pick<StepperRootProps, 'linear'> {
|
|
32
|
-
/**
|
|
33
|
-
* The element or component this component should render as.
|
|
34
|
-
* @defaultValue 'div'
|
|
35
|
-
*/
|
|
36
|
-
as?: any
|
|
37
|
-
items: T[]
|
|
38
|
-
/**
|
|
39
|
-
* @defaultValue 'md'
|
|
40
|
-
*/
|
|
41
|
-
size?: StepperVariants['size']
|
|
42
|
-
/**
|
|
43
|
-
* @defaultValue 'primary'
|
|
44
|
-
*/
|
|
45
|
-
color?: StepperVariants['color']
|
|
46
|
-
/**
|
|
47
|
-
* The orientation of the stepper.
|
|
48
|
-
* @defaultValue 'horizontal'
|
|
49
|
-
*/
|
|
50
|
-
orientation?: StepperVariants['orientation']
|
|
51
|
-
/**
|
|
52
|
-
* The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.
|
|
53
|
-
*/
|
|
54
|
-
defaultValue?: string | number
|
|
55
|
-
disabled?: boolean
|
|
56
|
-
ui?: Partial<typeof stepper.slots>
|
|
57
|
-
class?: any
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type StepperEmits<T extends StepperItem = StepperItem> = Omit<StepperRootEmits, 'update:modelValue'> & {
|
|
61
|
-
next: [payload: T]
|
|
62
|
-
prev: [payload: T]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
type SlotProps<T extends StepperItem> = (props: { item: T }) => any
|
|
66
|
-
|
|
67
|
-
export type StepperSlots<T extends StepperItem = StepperItem> = {
|
|
68
|
-
indicator: SlotProps<T>
|
|
69
|
-
title: SlotProps<T>
|
|
70
|
-
description: SlotProps<T>
|
|
71
|
-
content: SlotProps<T>
|
|
72
|
-
} & DynamicSlots<T>
|
|
73
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/stepper";
|
|
74
3
|
</script>
|
|
75
4
|
|
|
76
|
-
<script setup
|
|
77
|
-
import { computed } from
|
|
78
|
-
import { StepperRoot, StepperItem, StepperTrigger, StepperIndicator, StepperSeparator, StepperTitle, StepperDescription, useForwardProps } from
|
|
79
|
-
import { reactivePick } from
|
|
80
|
-
import
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { StepperRoot, StepperItem, StepperTrigger, StepperIndicator, StepperSeparator, StepperTitle, StepperDescription, useForwardProps } from "reka-ui";
|
|
8
|
+
import { reactivePick } from "@vueuse/core";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { tv } from "../utils/tv";
|
|
11
|
+
import UIcon from "./Icon.vue";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
items: { type: Array, required: true },
|
|
15
|
+
size: { type: null, required: false },
|
|
16
|
+
color: { type: null, required: false },
|
|
17
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
18
|
+
defaultValue: { type: [String, Number], required: false },
|
|
19
|
+
disabled: { type: Boolean, required: false },
|
|
20
|
+
class: { type: null, required: false },
|
|
21
|
+
ui: { type: null, required: false },
|
|
22
|
+
linear: { type: Boolean, required: false, default: true }
|
|
23
|
+
});
|
|
24
|
+
const emits = defineEmits(["next", "prev"]);
|
|
25
|
+
const slots = defineSlots();
|
|
26
|
+
const modelValue = defineModel({ type: [String, Number] });
|
|
27
|
+
const appConfig = useAppConfig();
|
|
28
|
+
const rootProps = useForwardProps(reactivePick(props, "as", "orientation", "linear"));
|
|
29
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.stepper || {} })({
|
|
94
30
|
orientation: props.orientation,
|
|
95
31
|
size: props.size,
|
|
96
32
|
color: props.color
|
|
97
|
-
}))
|
|
98
|
-
|
|
33
|
+
}));
|
|
99
34
|
const currentStepIndex = computed({
|
|
100
35
|
get() {
|
|
101
|
-
const value = modelValue.value ?? props.defaultValue
|
|
102
|
-
|
|
103
|
-
return ((typeof value === 'string')
|
|
104
|
-
? props.items.findIndex(item => item.value === value)
|
|
105
|
-
: value) ?? 0
|
|
36
|
+
const value = modelValue.value ?? props.defaultValue;
|
|
37
|
+
return (typeof value === "string" ? props.items.findIndex((item) => item.value === value) : value) ?? 0;
|
|
106
38
|
},
|
|
107
|
-
set(value
|
|
108
|
-
modelValue.value = props.items?.[value]?.value ?? value
|
|
39
|
+
set(value) {
|
|
40
|
+
modelValue.value = props.items?.[value]?.value ?? value;
|
|
109
41
|
}
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const hasPrev = computed(() => currentStepIndex.value > 0)
|
|
115
|
-
|
|
42
|
+
});
|
|
43
|
+
const currentStep = computed(() => props.items?.[currentStepIndex.value]);
|
|
44
|
+
const hasNext = computed(() => currentStepIndex.value < props.items?.length - 1);
|
|
45
|
+
const hasPrev = computed(() => currentStepIndex.value > 0);
|
|
116
46
|
defineExpose({
|
|
117
47
|
next() {
|
|
118
48
|
if (hasNext.value) {
|
|
119
|
-
currentStepIndex.value += 1
|
|
120
|
-
emits(
|
|
49
|
+
currentStepIndex.value += 1;
|
|
50
|
+
emits("next", currentStep.value);
|
|
121
51
|
}
|
|
122
52
|
},
|
|
123
53
|
prev() {
|
|
124
54
|
if (hasPrev.value) {
|
|
125
|
-
currentStepIndex.value -= 1
|
|
126
|
-
emits(
|
|
55
|
+
currentStepIndex.value -= 1;
|
|
56
|
+
emits("prev", currentStep.value);
|
|
127
57
|
}
|
|
128
58
|
},
|
|
129
59
|
hasNext,
|
|
130
60
|
hasPrev
|
|
131
|
-
})
|
|
61
|
+
});
|
|
132
62
|
</script>
|
|
133
63
|
|
|
134
64
|
<template>
|
|
@@ -145,7 +75,7 @@ defineExpose({
|
|
|
145
75
|
<StepperTrigger :class="ui.trigger({ class: props.ui?.trigger })">
|
|
146
76
|
<StepperIndicator :class="ui.indicator({ class: props.ui?.indicator })">
|
|
147
77
|
<slot name="indicator" :item="item">
|
|
148
|
-
<UIcon v-if="item.icon" :name="item.icon" :class="ui.icon({ class: props.ui?.
|
|
78
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
149
79
|
<template v-else>
|
|
150
80
|
{{ count + 1 }}
|
|
151
81
|
</template>
|
|
@@ -174,10 +104,10 @@ defineExpose({
|
|
|
174
104
|
</StepperItem>
|
|
175
105
|
</div>
|
|
176
106
|
|
|
177
|
-
<div v-if="currentStep?.content || !!slots.content || currentStep?.slot" :class="ui.content({ class: props.ui?.
|
|
107
|
+
<div v-if="currentStep?.content || !!slots.content || currentStep?.slot" :class="ui.content({ class: props.ui?.content })">
|
|
178
108
|
<slot
|
|
179
|
-
:name="
|
|
180
|
-
:item="
|
|
109
|
+
:name="currentStep?.slot || 'content'"
|
|
110
|
+
:item="currentStep"
|
|
181
111
|
>
|
|
182
112
|
{{ currentStep?.content }}
|
|
183
113
|
</slot>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { StepperRootProps, StepperRootEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/stepper';
|
|
4
|
+
import type { DynamicSlots, ComponentConfig } from '../types/utils';
|
|
5
|
+
type Stepper = ComponentConfig<typeof theme, AppConfig, 'stepper'>;
|
|
6
|
+
export interface StepperItem {
|
|
7
|
+
slot?: string;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @IconifyIcon
|
|
13
|
+
*/
|
|
14
|
+
icon?: string;
|
|
15
|
+
content?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export interface StepperProps<T extends StepperItem = StepperItem> extends Pick<StepperRootProps, 'linear'> {
|
|
20
|
+
/**
|
|
21
|
+
* The element or component this component should render as.
|
|
22
|
+
* @defaultValue 'div'
|
|
23
|
+
*/
|
|
24
|
+
as?: any;
|
|
25
|
+
items: T[];
|
|
26
|
+
/**
|
|
27
|
+
* @defaultValue 'md'
|
|
28
|
+
*/
|
|
29
|
+
size?: Stepper['variants']['size'];
|
|
30
|
+
/**
|
|
31
|
+
* @defaultValue 'primary'
|
|
32
|
+
*/
|
|
33
|
+
color?: Stepper['variants']['color'];
|
|
34
|
+
/**
|
|
35
|
+
* The orientation of the stepper.
|
|
36
|
+
* @defaultValue 'horizontal'
|
|
37
|
+
*/
|
|
38
|
+
orientation?: Stepper['variants']['orientation'];
|
|
39
|
+
/**
|
|
40
|
+
* The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: string | number;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
class?: any;
|
|
45
|
+
ui?: Stepper['slots'];
|
|
46
|
+
}
|
|
47
|
+
export type StepperEmits<T extends StepperItem = StepperItem> = Omit<StepperRootEmits, 'update:modelValue'> & {
|
|
48
|
+
next: [payload: T];
|
|
49
|
+
prev: [payload: T];
|
|
50
|
+
};
|
|
51
|
+
type SlotProps<T extends StepperItem> = (props: {
|
|
52
|
+
item: T;
|
|
53
|
+
}) => any;
|
|
54
|
+
export type StepperSlots<T extends StepperItem = StepperItem> = {
|
|
55
|
+
indicator: SlotProps<T>;
|
|
56
|
+
title: SlotProps<T>;
|
|
57
|
+
description: SlotProps<T>;
|
|
58
|
+
content: SlotProps<T>;
|
|
59
|
+
} & DynamicSlots<T>;
|
|
60
|
+
declare const _default: <T extends StepperItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
61
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ({
|
|
62
|
+
modelValue?: string | number;
|
|
63
|
+
} & StepperProps<T>) & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
64
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
65
|
+
next(): void;
|
|
66
|
+
prev(): void;
|
|
67
|
+
hasNext: import("vue").ComputedRef<boolean>;
|
|
68
|
+
hasPrev: import("vue").ComputedRef<boolean>;
|
|
69
|
+
}>): void;
|
|
70
|
+
attrs: any;
|
|
71
|
+
slots: Readonly<{
|
|
72
|
+
indicator: SlotProps<T>;
|
|
73
|
+
title: SlotProps<T>;
|
|
74
|
+
description: SlotProps<T>;
|
|
75
|
+
content: SlotProps<T>;
|
|
76
|
+
} & DynamicSlots<T>> & {
|
|
77
|
+
indicator: SlotProps<T>;
|
|
78
|
+
title: SlotProps<T>;
|
|
79
|
+
description: SlotProps<T>;
|
|
80
|
+
content: SlotProps<T>;
|
|
81
|
+
} & DynamicSlots<T>;
|
|
82
|
+
emit: (((evt: "prev", payload: T) => void) & ((evt: "next", payload: T) => void)) & ((evt: "update:modelValue", value: string | number) => void);
|
|
83
|
+
}>) => import("vue").VNode & {
|
|
84
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
85
|
+
};
|
|
86
|
+
export default _default;
|
|
87
|
+
type __VLS_PrettifyLocal<T> = {
|
|
88
|
+
[K in keyof T]: T[K];
|
|
89
|
+
} & {};
|