@byyuurin/ui 0.0.9 → 0.0.11
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 +2 -5
- package/dist/module.json +3 -3
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +9323 -3
- package/dist/runtime/app/injections.js +35 -0
- package/dist/runtime/components/Accordion.vue +36 -69
- package/dist/runtime/components/Accordion.vue.d.ts +52 -0
- package/dist/runtime/components/Alert.vue +37 -75
- package/dist/runtime/components/Alert.vue.d.ts +59 -0
- package/dist/runtime/components/App.vue +25 -40
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +31 -51
- package/dist/runtime/components/Avatar.vue.d.ts +25 -0
- package/dist/runtime/components/AvatarGroup.vue +38 -69
- package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
- package/dist/runtime/components/Badge.vue +25 -51
- package/dist/runtime/components/Badge.vue.d.ts +44 -0
- package/dist/runtime/components/Breadcrumb.vue +35 -77
- package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
- package/dist/runtime/components/Button.vue +62 -51
- package/dist/runtime/components/Button.vue.d.ts +29 -0
- package/dist/runtime/components/ButtonGroup.vue +17 -37
- package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
- package/dist/runtime/components/Calendar.vue +75 -101
- package/dist/runtime/components/Calendar.vue.d.ts +75 -0
- package/dist/runtime/components/Card.vue +25 -42
- package/dist/runtime/components/Card.vue.d.ts +30 -0
- package/dist/runtime/components/Carousel.vue +118 -223
- package/dist/runtime/components/Carousel.vue.d.ts +104 -0
- package/dist/runtime/components/Checkbox.vue +49 -71
- package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
- package/dist/runtime/components/Chip.vue +31 -48
- package/dist/runtime/components/Chip.vue.d.ts +30 -0
- package/dist/runtime/components/Collapsible.vue +22 -30
- package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
- package/dist/runtime/components/Drawer.vue +52 -102
- package/dist/runtime/components/Drawer.vue.d.ts +80 -0
- package/dist/runtime/components/DropdownMenu.vue +65 -0
- package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
- package/dist/runtime/components/DropdownMenuContent.vue +192 -0
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
- package/dist/runtime/components/Form.vue +197 -0
- package/dist/runtime/components/Form.vue.d.ts +78 -0
- package/dist/runtime/components/FormItem.vue +90 -0
- package/dist/runtime/components/FormItem.vue.d.ts +60 -0
- package/dist/runtime/components/Input.vue +93 -115
- package/dist/runtime/components/Input.vue.d.ts +64 -0
- package/dist/runtime/components/InputNumber.vue +81 -116
- package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
- package/dist/runtime/components/Kbd.vue +18 -39
- package/dist/runtime/components/Kbd.vue.d.ts +28 -0
- package/dist/runtime/components/Link.vue +170 -244
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +36 -54
- package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
- package/dist/runtime/components/Modal.vue +50 -85
- package/dist/runtime/components/Modal.vue.d.ts +66 -0
- package/dist/runtime/components/OverlayProvider.vue +10 -14
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +55 -121
- package/dist/runtime/components/Pagination.vue.d.ts +93 -0
- package/dist/runtime/components/PinInput.vue +57 -57
- package/dist/runtime/components/PinInput.vue.d.ts +35 -0
- package/dist/runtime/components/Popover.vue +39 -68
- package/dist/runtime/components/Popover.vue.d.ts +45 -0
- package/dist/runtime/components/Progress.vue +68 -120
- package/dist/runtime/components/Progress.vue.d.ts +54 -0
- package/dist/runtime/components/RadioGroup.vue +75 -129
- package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
- package/dist/runtime/components/ScrollArea.vue +31 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
- package/dist/runtime/components/Select.vue +119 -199
- package/dist/runtime/components/Select.vue.d.ts +119 -0
- package/dist/runtime/components/Separator.vue +26 -44
- package/dist/runtime/components/Separator.vue.d.ts +27 -0
- package/dist/runtime/components/Skeleton.vue +12 -21
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +54 -71
- package/dist/runtime/components/Slider.vue.d.ts +36 -0
- package/dist/runtime/components/Switch.vue +54 -68
- package/dist/runtime/components/Switch.vue.d.ts +49 -0
- package/dist/runtime/components/Table.vue +113 -186
- package/dist/runtime/components/Table.vue.d.ts +148 -0
- package/dist/runtime/components/Tabs.vue +35 -79
- package/dist/runtime/components/Tabs.vue.d.ts +65 -0
- package/dist/runtime/components/Textarea.vue +82 -123
- package/dist/runtime/components/Textarea.vue.d.ts +60 -0
- package/dist/runtime/components/Toast.vue +51 -76
- package/dist/runtime/components/Toast.vue.d.ts +131 -0
- package/dist/runtime/components/ToastProvider.vue +65 -101
- package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
- package/dist/runtime/components/Tooltip.vue +36 -47
- package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormItem.d.ts +27 -0
- package/dist/runtime/composables/useFormItem.js +64 -0
- package/dist/runtime/composables/useKbd.d.ts +1 -1
- package/dist/runtime/composables/useLocale.d.ts +3 -3
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +2 -1
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/locale/en.d.ts +1 -1
- package/dist/runtime/locale/zh-tw.d.ts +1 -1
- package/dist/runtime/theme/accordion.d.ts +45 -51
- package/dist/runtime/theme/accordion.js +1 -1
- package/dist/runtime/theme/alert.d.ts +115 -121
- package/dist/runtime/theme/alert.js +1 -1
- package/dist/runtime/theme/app.d.ts +1 -0
- package/dist/runtime/theme/app.js +2 -1
- package/dist/runtime/theme/avatar-group.d.ts +42 -48
- package/dist/runtime/theme/avatar-group.js +1 -1
- package/dist/runtime/theme/avatar.d.ts +46 -52
- package/dist/runtime/theme/avatar.js +1 -1
- package/dist/runtime/theme/badge.d.ts +63 -93
- package/dist/runtime/theme/badge.js +1 -1
- package/dist/runtime/theme/breadcrumb.d.ts +52 -58
- package/dist/runtime/theme/breadcrumb.js +1 -1
- package/dist/runtime/theme/button-group.d.ts +36 -42
- package/dist/runtime/theme/button.d.ts +165 -117
- package/dist/runtime/theme/button.js +1 -1
- package/dist/runtime/theme/calendar.d.ts +52 -50
- package/dist/runtime/theme/calendar.js +20 -3
- package/dist/runtime/theme/card.d.ts +52 -58
- package/dist/runtime/theme/card.js +1 -1
- package/dist/runtime/theme/carousel.d.ts +98 -104
- package/dist/runtime/theme/carousel.js +1 -1
- package/dist/runtime/theme/checkbox.d.ts +77 -83
- package/dist/runtime/theme/checkbox.js +1 -1
- package/dist/runtime/theme/chip.d.ts +50 -89
- package/dist/runtime/theme/chip.js +1 -1
- package/dist/runtime/theme/collapsible.d.ts +29 -35
- package/dist/runtime/theme/collapsible.js +1 -1
- package/dist/runtime/theme/drawer.d.ts +131 -102
- package/dist/runtime/theme/drawer.js +1 -1
- package/dist/runtime/theme/dropdown-menu.d.ts +65 -0
- package/dist/runtime/theme/dropdown-menu.js +83 -0
- package/dist/runtime/theme/form-item.d.ts +70 -0
- package/dist/runtime/theme/form-item.js +34 -0
- package/dist/runtime/theme/form.d.ts +2 -0
- package/dist/runtime/theme/form.js +7 -0
- package/dist/runtime/theme/index.d.ts +3 -0
- package/dist/runtime/theme/index.js +3 -0
- package/dist/runtime/theme/input-number.d.ts +100 -126
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.d.ts +153 -131
- package/dist/runtime/theme/input.js +3 -3
- package/dist/runtime/theme/kbd.d.ts +30 -36
- package/dist/runtime/theme/link.d.ts +37 -43
- package/dist/runtime/theme/modal.d.ts +35 -69
- package/dist/runtime/theme/modal.js +1 -1
- package/dist/runtime/theme/pagination.d.ts +71 -77
- package/dist/runtime/theme/pagination.js +1 -1
- package/dist/runtime/theme/pinInput.d.ts +82 -88
- package/dist/runtime/theme/pinInput.js +2 -2
- package/dist/runtime/theme/popover.d.ts +29 -35
- package/dist/runtime/theme/popover.js +1 -1
- package/dist/runtime/theme/progress.d.ts +167 -109
- package/dist/runtime/theme/progress.js +1 -1
- package/dist/runtime/theme/radio-group.d.ts +99 -105
- package/dist/runtime/theme/radio-group.js +1 -1
- package/dist/runtime/theme/scroll-area.d.ts +62 -68
- package/dist/runtime/theme/scroll-area.js +1 -1
- package/dist/runtime/theme/select.d.ts +168 -158
- package/dist/runtime/theme/select.js +3 -2
- package/dist/runtime/theme/separator.d.ts +64 -85
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/skeleton.d.ts +1 -7
- package/dist/runtime/theme/slider.d.ts +62 -68
- package/dist/runtime/theme/slider.js +1 -1
- package/dist/runtime/theme/switch.d.ts +111 -117
- package/dist/runtime/theme/switch.js +1 -1
- package/dist/runtime/theme/table.d.ts +75 -78
- package/dist/runtime/theme/table.js +3 -2
- package/dist/runtime/theme/tabs.d.ts +116 -139
- package/dist/runtime/theme/tabs.js +1 -1
- package/dist/runtime/theme/textarea.d.ts +78 -90
- package/dist/runtime/theme/textarea.js +2 -2
- package/dist/runtime/theme/toast-provider.d.ts +110 -131
- package/dist/runtime/theme/toast-provider.js +1 -1
- package/dist/runtime/theme/toast.d.ts +74 -80
- package/dist/runtime/theme/toast.js +1 -1
- package/dist/runtime/theme/tooltip.d.ts +35 -41
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +45 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/index.d.ts +5 -2
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +37 -16
- package/dist/runtime/utils/extend-theme.js +15 -4
- package/dist/runtime/utils/form.d.ts +5 -0
- package/dist/runtime/utils/form.js +24 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/link.d.ts +4 -28
- package/dist/runtime/utils/link.js +10 -3
- package/dist/runtime/utils/styler.d.ts +2 -2
- package/dist/runtime/utils/styler.js +2 -2
- package/dist/shared/ui.D1BTWZFB.mjs +5 -0
- package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/unocss.mjs +7 -6
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +78 -74
- package/dist/module.cjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
|
@@ -1,59 +1,41 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { SeparatorProps as RekaSeparatorProps } from 'reka-ui'
|
|
4
|
-
import type { separator } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface SeparatorSlots {
|
|
8
|
-
default?: (props: {}) => any
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type SeparatorVariants = VariantProps<typeof separator>
|
|
12
|
-
|
|
13
|
-
export interface SeparatorProps extends ComponentAttrs<typeof separator>, Pick<RekaSeparatorProps, 'as' | 'decorative'> {
|
|
14
|
-
orientation?: SeparatorVariants['orientation']
|
|
15
|
-
align?: 'start' | 'end' | 'center'
|
|
16
|
-
/** Display a label in the middle. */
|
|
17
|
-
label?: string
|
|
18
|
-
/**
|
|
19
|
-
* Display an icon in the middle.
|
|
20
|
-
*/
|
|
21
|
-
icon?: string
|
|
22
|
-
}
|
|
23
3
|
</script>
|
|
24
4
|
|
|
25
|
-
<script setup
|
|
26
|
-
import { reactivePick } from
|
|
27
|
-
import { Separator, useForwardProps } from
|
|
28
|
-
import { computed } from
|
|
29
|
-
import { useTheme } from
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { Separator, useForwardProps } from "reka-ui";
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
import { useTheme } from "../composables/useTheme";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
12
|
+
align: { type: String, required: false },
|
|
13
|
+
label: { type: String, required: false },
|
|
14
|
+
icon: { type: String, required: false },
|
|
15
|
+
class: { type: null, required: false },
|
|
16
|
+
ui: { type: null, required: false },
|
|
17
|
+
as: { type: null, required: false },
|
|
18
|
+
decorative: { type: Boolean, required: false }
|
|
19
|
+
});
|
|
20
|
+
const slots = defineSlots();
|
|
21
|
+
const rootProps = useForwardProps(reactivePick(props, "as", "decorative", "orientation"));
|
|
22
|
+
const { generateStyle } = useTheme();
|
|
23
|
+
const style = computed(() => generateStyle("separator", props));
|
|
42
24
|
</script>
|
|
43
25
|
|
|
44
26
|
<template>
|
|
45
|
-
<Separator v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
46
|
-
<div :class="style.line({ class: props.ui?.line, start: props.align === 'start' })"></div>
|
|
27
|
+
<Separator v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
|
|
28
|
+
<div :class="style.line({ class: props.ui?.line, start: props.align === 'start' })" data-part="line"></div>
|
|
47
29
|
|
|
48
30
|
<template v-if="props.label || props.icon || slots.default">
|
|
49
|
-
<div :class="style.container({ class: props.ui?.container })">
|
|
31
|
+
<div :class="style.container({ class: props.ui?.container })" data-part="container">
|
|
50
32
|
<slot>
|
|
51
|
-
<span v-if="props.label" :class="style.label({ class: props.ui?.label })">{{ props.label }}</span>
|
|
52
|
-
<span v-else-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
33
|
+
<span v-if="props.label" :class="style.label({ class: props.ui?.label })" data-part="label">{{ props.label }}</span>
|
|
34
|
+
<span v-else-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })" data-part="icon"></span>
|
|
53
35
|
</slot>
|
|
54
36
|
</div>
|
|
55
37
|
|
|
56
|
-
<div :class="style.line({ class: props.ui?.line, end: props.align === 'end' })"></div>
|
|
38
|
+
<div :class="style.line({ class: props.ui?.line, end: props.align === 'end' })" data-part="line"></div>
|
|
57
39
|
</template>
|
|
58
40
|
</Separator>
|
|
59
41
|
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { SeparatorProps as RekaSeparatorProps } from 'reka-ui';
|
|
3
|
+
import type { separator } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
export interface SeparatorSlots {
|
|
6
|
+
default?: (props: {}) => any;
|
|
7
|
+
}
|
|
8
|
+
type SeparatorVariants = VariantProps<typeof separator>;
|
|
9
|
+
export interface SeparatorProps extends ComponentAttrs<typeof separator>, Pick<RekaSeparatorProps, 'as' | 'decorative'> {
|
|
10
|
+
orientation?: SeparatorVariants['orientation'];
|
|
11
|
+
align?: 'start' | 'end' | 'center';
|
|
12
|
+
/** Display a label in the middle. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Display an icon in the middle.
|
|
16
|
+
*/
|
|
17
|
+
icon?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SeparatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SeparatorProps> & Readonly<{}>, {
|
|
20
|
+
orientation: "horizontal" | "vertical";
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SeparatorSlots>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { PrimitiveProps } from 'reka-ui'
|
|
3
|
-
import type { skeleton } from '../theme'
|
|
4
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
5
2
|
|
|
6
|
-
export interface SkeletonProps extends Omit<ComponentAttrs<typeof skeleton>, 'ui'> {
|
|
7
|
-
/**
|
|
8
|
-
* The element or component this component should render as.
|
|
9
|
-
* @default "div"
|
|
10
|
-
*/
|
|
11
|
-
as?: PrimitiveProps['as']
|
|
12
|
-
}
|
|
13
3
|
</script>
|
|
14
4
|
|
|
15
|
-
<script setup
|
|
16
|
-
import { Primitive } from
|
|
17
|
-
import { computed } from
|
|
18
|
-
import { useTheme } from
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { computed } from "vue";
|
|
8
|
+
import { useTheme } from "../composables/useTheme";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
as: { type: null, required: false },
|
|
11
|
+
class: { type: null, required: false }
|
|
12
|
+
});
|
|
13
|
+
const { generateStyle } = useTheme();
|
|
14
|
+
const styler = computed(() => generateStyle("skeleton", props));
|
|
24
15
|
</script>
|
|
25
16
|
|
|
26
17
|
<template>
|
|
27
|
-
<Primitive :as="props.as" :class="styler">
|
|
18
|
+
<Primitive :as="props.as" :class="styler" data-part="base">
|
|
28
19
|
<slot></slot>
|
|
29
20
|
</Primitive>
|
|
30
21
|
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
2
|
+
import type { skeleton } from '../theme/index.js';
|
|
3
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
4
|
+
export interface SkeletonProps extends Omit<ComponentAttrs<typeof skeleton>, 'ui'> {
|
|
5
|
+
/**
|
|
6
|
+
* The element or component this component should render as.
|
|
7
|
+
* @default "div"
|
|
8
|
+
*/
|
|
9
|
+
as?: PrimitiveProps['as'];
|
|
10
|
+
}
|
|
11
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SkeletonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SkeletonProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
12
|
+
default?: (props: {}) => any;
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,93 +1,76 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { SliderRootProps } from 'reka-ui'
|
|
4
|
-
import type { slider } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface SliderEmits {
|
|
8
|
-
(event: 'update:modelValue', payload: number | number[]): void
|
|
9
|
-
(event: 'change', payload: Event): void
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type SliderVariants = VariantProps<typeof slider>
|
|
13
|
-
|
|
14
|
-
export interface SliderProps extends ComponentAttrs<typeof slider>, Pick<SliderRootProps, 'as' | 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
|
|
15
|
-
modelValue?: number | number[]
|
|
16
|
-
size?: SliderVariants['size']
|
|
17
|
-
/**
|
|
18
|
-
* The orientation of the slider.
|
|
19
|
-
* @default "horizontal"
|
|
20
|
-
*/
|
|
21
|
-
orientation?: SliderVariants['orientation']
|
|
22
|
-
/** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
|
|
23
|
-
defaultValue?: number | number[]
|
|
24
|
-
}
|
|
25
3
|
</script>
|
|
26
4
|
|
|
27
|
-
<script setup
|
|
28
|
-
import { reactivePick } from
|
|
29
|
-
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from
|
|
30
|
-
import { computed } from
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
const props =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
import { useFormItem } from "../composables/useFormItem";
|
|
10
|
+
import { useTheme } from "../composables/useTheme";
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
modelValue: { type: [Number, Array], required: false },
|
|
13
|
+
size: { type: null, required: false },
|
|
14
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
15
|
+
defaultValue: { type: [Number, Array], required: false },
|
|
16
|
+
class: { type: null, required: false },
|
|
17
|
+
ui: { type: null, required: false },
|
|
18
|
+
as: { type: null, required: false },
|
|
19
|
+
name: { type: String, required: false },
|
|
20
|
+
disabled: { type: Boolean, required: false },
|
|
21
|
+
inverted: { type: Boolean, required: false },
|
|
22
|
+
min: { type: Number, required: false },
|
|
23
|
+
max: { type: Number, required: false, default: 100 },
|
|
24
|
+
step: { type: Number, required: false, default: 1 },
|
|
25
|
+
minStepsBetweenThumbs: { type: Number, required: false }
|
|
26
|
+
});
|
|
27
|
+
const emit = defineEmits(["update:modelValue", "change"]);
|
|
28
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted"), emit);
|
|
29
|
+
const modelValue = defineModel({ type: [Number, Array] });
|
|
45
30
|
const defaultSliderValue = computed(() => {
|
|
46
|
-
if (typeof props.defaultValue ===
|
|
47
|
-
return [props.defaultValue]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
|
|
31
|
+
if (typeof props.defaultValue === "number")
|
|
32
|
+
return [props.defaultValue];
|
|
33
|
+
return props.defaultValue;
|
|
34
|
+
});
|
|
52
35
|
const sliderValue = computed({
|
|
53
36
|
get() {
|
|
54
|
-
if (typeof modelValue.value ===
|
|
55
|
-
return [modelValue.value]
|
|
56
|
-
|
|
57
|
-
return modelValue.value ?? defaultSliderValue.value
|
|
37
|
+
if (typeof modelValue.value === "number")
|
|
38
|
+
return [modelValue.value];
|
|
39
|
+
return modelValue.value ?? defaultSliderValue.value;
|
|
58
40
|
},
|
|
59
41
|
set(value) {
|
|
60
|
-
modelValue.value = value?.length === 1 ? value[0] : value
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const event = new Event(
|
|
72
|
-
emit(
|
|
42
|
+
modelValue.value = value?.length === 1 ? value[0] : value;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const thumbsCount = computed(() => sliderValue.value?.length ?? 1);
|
|
46
|
+
const { id, size, name, disabled, ariaAttrs, emitFormChange, emitFormInput } = useFormItem(props);
|
|
47
|
+
const { generateStyle } = useTheme();
|
|
48
|
+
const style = computed(() => generateStyle("slider", {
|
|
49
|
+
...props,
|
|
50
|
+
size: size.value
|
|
51
|
+
}));
|
|
52
|
+
function onChange(value) {
|
|
53
|
+
const event = new Event("change", { target: { value } });
|
|
54
|
+
emit("change", event);
|
|
55
|
+
emitFormChange();
|
|
56
|
+
emitFormInput();
|
|
73
57
|
}
|
|
74
58
|
</script>
|
|
75
59
|
|
|
76
60
|
<template>
|
|
77
61
|
<SliderRoot
|
|
78
|
-
v-bind="rootProps"
|
|
62
|
+
v-bind="{ ...rootProps, ...ariaAttrs, id, name, disabled }"
|
|
79
63
|
v-model="sliderValue"
|
|
80
|
-
:name="props.name"
|
|
81
|
-
:disabled="props.disabled"
|
|
82
|
-
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
83
64
|
:default-value="defaultSliderValue"
|
|
65
|
+
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
66
|
+
data-part="root"
|
|
84
67
|
:data-steps="thumbsCount"
|
|
85
68
|
@value-commit="onChange"
|
|
86
69
|
>
|
|
87
|
-
<SliderTrack :class="style.track({ class: props.ui?.track })">
|
|
88
|
-
<SliderRange :class="style.range({ class: props.ui?.range })" />
|
|
70
|
+
<SliderTrack :class="style.track({ class: props.ui?.track })" data-part="track">
|
|
71
|
+
<SliderRange :class="style.range({ class: props.ui?.range })" data-part="range" />
|
|
89
72
|
</SliderTrack>
|
|
90
73
|
|
|
91
|
-
<SliderThumb v-for="count in thumbsCount" :key="count" :class="style.thumb({ class: props.ui?.thumb })" />
|
|
74
|
+
<SliderThumb v-for="count in thumbsCount" :key="count" :class="style.thumb({ class: props.ui?.thumb })" data-part="thumb" />
|
|
92
75
|
</SliderRoot>
|
|
93
76
|
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { SliderRootProps } from 'reka-ui';
|
|
3
|
+
import type { slider } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs, MaybeArray } from '../types/index.js';
|
|
5
|
+
export interface SliderEmits {
|
|
6
|
+
'update:modelValue': [payload: MaybeArray<number>];
|
|
7
|
+
'change': [payload: Event];
|
|
8
|
+
}
|
|
9
|
+
type SliderVariants = VariantProps<typeof slider>;
|
|
10
|
+
export interface SliderProps extends ComponentAttrs<typeof slider>, Pick<SliderRootProps, 'as' | 'name' | 'disabled' | 'inverted' | 'min' | 'max' | 'step' | 'minStepsBetweenThumbs'> {
|
|
11
|
+
modelValue?: number | number[];
|
|
12
|
+
size?: SliderVariants['size'];
|
|
13
|
+
/**
|
|
14
|
+
* The orientation of the slider.
|
|
15
|
+
* @default "horizontal"
|
|
16
|
+
*/
|
|
17
|
+
orientation?: SliderVariants['orientation'];
|
|
18
|
+
/** The value of the slider when initially rendered. Use when you do not need to control the state of the slider. */
|
|
19
|
+
defaultValue?: number | number[];
|
|
20
|
+
}
|
|
21
|
+
declare const _default: import("vue").DefineComponent<SliderProps & {
|
|
22
|
+
modelValue?: number | number[];
|
|
23
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
change: (payload: Event) => any;
|
|
25
|
+
"update:modelValue": (...args: unknown[]) => any;
|
|
26
|
+
}, string, import("vue").PublicProps, Readonly<SliderProps & {
|
|
27
|
+
modelValue?: number | number[];
|
|
28
|
+
}> & Readonly<{
|
|
29
|
+
onChange?: ((payload: Event) => any) | undefined;
|
|
30
|
+
"onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
orientation: "horizontal" | "vertical";
|
|
33
|
+
step: number;
|
|
34
|
+
max: number;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
export default _default;
|
|
@@ -1,92 +1,78 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { SwitchRootProps } from 'reka-ui'
|
|
4
|
-
import type { switch as _switch } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface SwitchEmits {
|
|
8
|
-
(event: 'change', payload: Event): void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface SwitchSlots {
|
|
12
|
-
label?: (props: { label?: string }) => any
|
|
13
|
-
description?: (props: { description?: string }) => any
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type SwitchVariants = VariantProps<typeof _switch>
|
|
17
|
-
|
|
18
|
-
export interface SwitchProps extends ComponentAttrs<typeof _switch>, Pick<SwitchRootProps, 'as' | 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
|
|
19
|
-
size?: SwitchVariants['size']
|
|
20
|
-
/** When `true`, the loading icon will be displayed. */
|
|
21
|
-
loading?: boolean
|
|
22
|
-
/**
|
|
23
|
-
* The icon when the `loading` prop is `true`.
|
|
24
|
-
* @default app.icons.loading
|
|
25
|
-
*/
|
|
26
|
-
loadingIcon?: string
|
|
27
|
-
/** Display an icon when the switch is checked. */
|
|
28
|
-
checkedIcon?: string
|
|
29
|
-
/** Display an icon when the switch is unchecked. */
|
|
30
|
-
uncheckedIcon?: string
|
|
31
|
-
label?: string
|
|
32
|
-
description?: string
|
|
33
|
-
}
|
|
34
3
|
</script>
|
|
35
4
|
|
|
36
|
-
<script
|
|
37
|
-
import { reactivePick } from
|
|
38
|
-
import { Label, Primitive, SwitchRoot, SwitchThumb, useForwardProps } from
|
|
39
|
-
import { computed, useId } from
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
const props =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { Label, Primitive, SwitchRoot, SwitchThumb, useForwardProps } from "reka-ui";
|
|
8
|
+
import { computed, useId } from "vue";
|
|
9
|
+
import { useFormItem } from "../composables/useFormItem";
|
|
10
|
+
import { useTheme } from "../composables/useTheme";
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
size: { type: null, required: false },
|
|
13
|
+
loading: { type: Boolean, required: false },
|
|
14
|
+
loadingIcon: { type: String, required: false },
|
|
15
|
+
checkedIcon: { type: String, required: false },
|
|
16
|
+
uncheckedIcon: { type: String, required: false },
|
|
17
|
+
label: { type: String, required: false },
|
|
18
|
+
description: { type: String, required: false },
|
|
19
|
+
class: { type: null, required: false },
|
|
20
|
+
ui: { type: null, required: false },
|
|
21
|
+
as: { type: null, required: false },
|
|
22
|
+
disabled: { type: Boolean, required: false },
|
|
23
|
+
id: { type: String, required: false },
|
|
24
|
+
name: { type: String, required: false },
|
|
25
|
+
required: { type: Boolean, required: false },
|
|
26
|
+
value: { type: String, required: false },
|
|
27
|
+
defaultValue: { type: Boolean, required: false }
|
|
28
|
+
});
|
|
29
|
+
const emit = defineEmits(["change"]);
|
|
30
|
+
const slots = defineSlots();
|
|
31
|
+
const modelValue = defineModel({ type: Boolean, ...{ default: void 0 } });
|
|
32
|
+
const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
|
|
33
|
+
const { id: _id, size, name, disabled, ariaAttrs, emitFormChange, emitFormInput } = useFormItem(props);
|
|
34
|
+
const id = _id.value ?? useId();
|
|
35
|
+
const { theme, generateStyle } = useTheme();
|
|
36
|
+
const style = computed(() => generateStyle("switch", {
|
|
52
37
|
...props,
|
|
38
|
+
size: size.value,
|
|
39
|
+
disabled: disabled.value,
|
|
53
40
|
checked: false,
|
|
54
|
-
unchecked: false
|
|
55
|
-
}))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
unchecked: false
|
|
42
|
+
}));
|
|
43
|
+
function onUpdate(value) {
|
|
44
|
+
const event = new Event("change", { target: { value } });
|
|
45
|
+
emit("change", event);
|
|
46
|
+
emitFormChange();
|
|
47
|
+
emitFormInput();
|
|
61
48
|
}
|
|
62
49
|
</script>
|
|
63
50
|
|
|
64
51
|
<template>
|
|
65
|
-
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
66
|
-
<div :class="style.container({ class: props.ui?.container })">
|
|
52
|
+
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
|
|
53
|
+
<div :class="style.container({ class: props.ui?.container })" data-part="container">
|
|
67
54
|
<SwitchRoot
|
|
68
|
-
|
|
69
|
-
v-bind="rootProps"
|
|
55
|
+
v-bind="{ ...rootProps, ...ariaAttrs, id, name }"
|
|
70
56
|
v-model="modelValue"
|
|
71
|
-
:
|
|
72
|
-
:disabled="props.disabled || props.loading"
|
|
57
|
+
:disabled="disabled || props.loading"
|
|
73
58
|
:class="style.base({ class: props.ui?.base })"
|
|
59
|
+
data-part="base"
|
|
74
60
|
@update:model-value="onUpdate"
|
|
75
61
|
>
|
|
76
|
-
<SwitchThumb :class="style.thumb({ class: props.ui?.thumb })">
|
|
77
|
-
<span v-if="props.loading" :class="style.icon({ class: [theme.app.icons.loading, props.ui?.icon], checked: true, unchecked: true })"></span>
|
|
62
|
+
<SwitchThumb :class="style.thumb({ class: props.ui?.thumb })" data-part="thumb">
|
|
63
|
+
<span v-if="props.loading" :class="style.icon({ class: [theme.app.icons.loading, props.ui?.icon], checked: true, unchecked: true })" data-part="icon"></span>
|
|
78
64
|
<template v-else>
|
|
79
|
-
<span v-if="props.checkedIcon" :class="style.icon({ class: [props.checkedIcon, props.ui?.icon], checked: true })"></span>
|
|
80
|
-
<span v-if="props.uncheckedIcon" :class="style.icon({ class: [props.uncheckedIcon, props.ui?.icon], unchecked: true })"></span>
|
|
65
|
+
<span v-if="props.checkedIcon" :class="style.icon({ class: [props.checkedIcon, props.ui?.icon], checked: true })" data-part="icon"></span>
|
|
66
|
+
<span v-if="props.uncheckedIcon" :class="style.icon({ class: [props.uncheckedIcon, props.ui?.icon], unchecked: true })" data-part="icon"></span>
|
|
81
67
|
</template>
|
|
82
68
|
</SwitchThumb>
|
|
83
69
|
</SwitchRoot>
|
|
84
70
|
</div>
|
|
85
|
-
<div v-if="props.label || slots.label || props.description || slots.description" :class="style.wrapper({ class: props.ui?.wrapper })">
|
|
86
|
-
<Label v-if="props.label || slots.label" :for="id" :class="style.label({ class: props.ui?.label })">
|
|
71
|
+
<div v-if="props.label || slots.label || props.description || slots.description" :class="style.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
72
|
+
<Label v-if="props.label || slots.label" :for="id" :class="style.label({ class: props.ui?.label })" data-part="label">
|
|
87
73
|
<slot name="label" :label="props.label">{{ props.label }}</slot>
|
|
88
74
|
</Label>
|
|
89
|
-
<p v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })">
|
|
75
|
+
<p v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })" data-part="description">
|
|
90
76
|
<slot name="description" :description="props.description">
|
|
91
77
|
{{ props.description }}
|
|
92
78
|
</slot>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { SwitchRootProps } from 'reka-ui';
|
|
3
|
+
import type { switch as _switch } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
export interface SwitchEmits {
|
|
6
|
+
change: [payload: Event];
|
|
7
|
+
}
|
|
8
|
+
export interface SwitchSlots {
|
|
9
|
+
label?: (props: {
|
|
10
|
+
label?: string;
|
|
11
|
+
}) => any;
|
|
12
|
+
description?: (props: {
|
|
13
|
+
description?: string;
|
|
14
|
+
}) => any;
|
|
15
|
+
}
|
|
16
|
+
type SwitchVariants = VariantProps<typeof _switch>;
|
|
17
|
+
export interface SwitchProps extends ComponentAttrs<typeof _switch>, Pick<SwitchRootProps, 'as' | 'disabled' | 'id' | 'name' | 'required' | 'value' | 'defaultValue'> {
|
|
18
|
+
size?: SwitchVariants['size'];
|
|
19
|
+
/** When `true`, the loading icon will be displayed. */
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The icon when the `loading` prop is `true`.
|
|
23
|
+
* @default app.icons.loading
|
|
24
|
+
*/
|
|
25
|
+
loadingIcon?: string;
|
|
26
|
+
/** Display an icon when the switch is checked. */
|
|
27
|
+
checkedIcon?: string;
|
|
28
|
+
/** Display an icon when the switch is unchecked. */
|
|
29
|
+
uncheckedIcon?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<SwitchProps & {
|
|
34
|
+
modelValue?: boolean;
|
|
35
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
change: (payload: Event) => any;
|
|
37
|
+
"update:modelValue": (value: boolean) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<SwitchProps & {
|
|
39
|
+
modelValue?: boolean;
|
|
40
|
+
}> & Readonly<{
|
|
41
|
+
onChange?: ((payload: Event) => any) | undefined;
|
|
42
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
43
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SwitchSlots>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|