@byyuurin/ui 0.0.10 → 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 -2
- 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 +388 -364
- package/dist/runtime/components/Accordion.vue +38 -67
- 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 +36 -74
- 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 -110
- 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 -225
- package/dist/runtime/components/Carousel.vue.d.ts +104 -0
- package/dist/runtime/components/Checkbox.vue +46 -73
- 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 +51 -101
- package/dist/runtime/components/Drawer.vue.d.ts +80 -0
- package/dist/runtime/components/DropdownMenu.vue +37 -115
- package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
- package/dist/runtime/components/DropdownMenuContent.vue +81 -77
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
- package/dist/runtime/components/Form.vue +140 -254
- package/dist/runtime/components/Form.vue.d.ts +78 -0
- package/dist/runtime/components/FormItem.vue +50 -89
- package/dist/runtime/components/FormItem.vue.d.ts +60 -0
- package/dist/runtime/components/Input.vue +79 -115
- package/dist/runtime/components/Input.vue.d.ts +64 -0
- package/dist/runtime/components/InputNumber.vue +74 -117
- 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 +168 -257
- 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 +49 -84
- 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 +49 -58
- 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 +67 -125
- 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 +114 -204
- 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 +52 -74
- package/dist/runtime/components/Slider.vue.d.ts +36 -0
- package/dist/runtime/components/Switch.vue +51 -71
- package/dist/runtime/components/Switch.vue.d.ts +49 -0
- package/dist/runtime/components/Table.vue +108 -194
- package/dist/runtime/components/Table.vue.d.ts +148 -0
- package/dist/runtime/components/Tabs.vue +36 -81
- package/dist/runtime/components/Tabs.vue.d.ts +65 -0
- package/dist/runtime/components/Textarea.vue +77 -124
- package/dist/runtime/components/Textarea.vue.d.ts +60 -0
- package/dist/runtime/components/Toast.vue +47 -75
- 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 +2 -2
- 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/useToast.d.ts +1 -1
- 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/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 +60 -66
- 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 +162 -168
- 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 -56
- 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 +120 -126
- package/dist/runtime/theme/drawer.js +1 -1
- package/dist/runtime/theme/dropdown-menu.d.ts +55 -61
- package/dist/runtime/theme/dropdown-menu.js +1 -1
- package/dist/runtime/theme/form-item.d.ts +63 -69
- package/dist/runtime/theme/form-item.js +1 -1
- package/dist/runtime/theme/form.d.ts +1 -7
- package/dist/runtime/theme/input-number.d.ts +98 -104
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.d.ts +153 -159
- package/dist/runtime/theme/input.js +1 -1
- 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 +36 -42
- 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 +80 -86
- package/dist/runtime/theme/pinInput.js +1 -1
- package/dist/runtime/theme/popover.d.ts +29 -35
- package/dist/runtime/theme/popover.js +1 -1
- package/dist/runtime/theme/progress.d.ts +163 -169
- 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 +165 -171
- package/dist/runtime/theme/select.js +1 -1
- package/dist/runtime/theme/separator.d.ts +62 -68
- 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 -81
- package/dist/runtime/theme/table.js +1 -1
- package/dist/runtime/theme/tabs.d.ts +114 -120
- package/dist/runtime/theme/tabs.js +1 -1
- package/dist/runtime/theme/textarea.d.ts +76 -82
- package/dist/runtime/theme/textarea.js +1 -1
- package/dist/runtime/theme/toast-provider.d.ts +106 -112
- 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/utils.d.ts +5 -5
- package/dist/runtime/utils/link.d.ts +3 -5
- 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 +5 -4
- 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 +77 -75
- package/dist/module.cjs +0 -5
- package/dist/shared/ui.3e7fad19.mjs +0 -5
- package/dist/shared/ui.3e7fad19.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons.js';
|
|
3
|
+
import type { button } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
import type { LinkProps } from './Link.vue.js';
|
|
6
|
+
export interface ButtonSlots {
|
|
7
|
+
default?: (props?: {}) => any;
|
|
8
|
+
leading?: (props?: {}) => any;
|
|
9
|
+
trailing?: (props?: {}) => any;
|
|
10
|
+
}
|
|
11
|
+
type ButtonVariants = VariantProps<typeof button>;
|
|
12
|
+
export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom' | 'underline'> {
|
|
13
|
+
icon?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
variant?: ButtonVariants['variant'];
|
|
16
|
+
size?: ButtonVariants['size'];
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
active?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
|
|
22
|
+
variant: "solid" | "outline" | "soft" | "soft-outline" | "link" | "ghost";
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
-
import type { buttonGroup } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface ButtonGroupSlots {
|
|
8
|
-
default?: (props?: {}) => any
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type ButtonGroupVariant = VariantProps<typeof buttonGroup>
|
|
12
|
-
|
|
13
|
-
export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'> {
|
|
14
|
-
/**
|
|
15
|
-
* The element or component this component should render as.
|
|
16
|
-
* @default "div"
|
|
17
|
-
*/
|
|
18
|
-
as?: PrimitiveProps['as']
|
|
19
|
-
size?: ButtonGroupVariant['size']
|
|
20
|
-
orientation?: ButtonGroupVariant['orientation']
|
|
21
|
-
}
|
|
22
3
|
</script>
|
|
23
4
|
|
|
24
|
-
<script setup
|
|
25
|
-
import { Primitive } from
|
|
26
|
-
import { computed } from
|
|
27
|
-
import { provideButtonGroup } from
|
|
28
|
-
import { useTheme } from
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
provideButtonGroup(computed(() => props))
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const style = computed(() => generateStyle('buttonGroup', props))
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { computed } from "vue";
|
|
8
|
+
import { provideButtonGroup } from "../app/injections";
|
|
9
|
+
import { useTheme } from "../composables/useTheme";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
as: { type: null, required: false },
|
|
12
|
+
size: { type: null, required: false },
|
|
13
|
+
orientation: { type: null, required: false, default: "horizontal" },
|
|
14
|
+
class: { type: null, required: false }
|
|
15
|
+
});
|
|
16
|
+
defineSlots();
|
|
17
|
+
provideButtonGroup(computed(() => props));
|
|
18
|
+
const { generateStyle } = useTheme();
|
|
19
|
+
const style = computed(() => generateStyle("buttonGroup", props));
|
|
40
20
|
</script>
|
|
41
21
|
|
|
42
22
|
<template>
|
|
43
|
-
<Primitive :as="props.as" :class="style">
|
|
23
|
+
<Primitive :as="props.as" :class="style.base()" data-part="base">
|
|
44
24
|
<slot></slot>
|
|
45
25
|
</Primitive>
|
|
46
26
|
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
+
import type { buttonGroup } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
export interface ButtonGroupSlots {
|
|
6
|
+
default?: (props?: {}) => any;
|
|
7
|
+
}
|
|
8
|
+
type ButtonGroupVariant = VariantProps<typeof buttonGroup>;
|
|
9
|
+
export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'> {
|
|
10
|
+
/**
|
|
11
|
+
* The element or component this component should render as.
|
|
12
|
+
* @default "div"
|
|
13
|
+
*/
|
|
14
|
+
as?: PrimitiveProps['as'];
|
|
15
|
+
size?: ButtonGroupVariant['size'];
|
|
16
|
+
orientation?: ButtonGroupVariant['orientation'];
|
|
17
|
+
}
|
|
18
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ButtonGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonGroupProps> & Readonly<{}>, {
|
|
19
|
+
orientation: "horizontal" | "vertical";
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonGroupSlots>;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -1,110 +1,71 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { DateValue } from '@internationalized/date'
|
|
4
|
-
import type { CalendarCellTriggerProps, CalendarRootEmits, CalendarRootProps, DateRange, RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui'
|
|
5
|
-
import type { calendar } from '../theme'
|
|
6
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
7
2
|
|
|
8
|
-
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
9
|
-
'update:modelValue': [date: CalendarModelValue<R, M>]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface CalendarSlots {
|
|
13
|
-
'heading'?: (props: { value: string }) => any
|
|
14
|
-
'day'?: (props: Pick<CalendarCellTriggerProps, 'day'>) => any
|
|
15
|
-
'week-day'?: (props: { day: string }) => any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type CalendarVariants = VariantProps<typeof calendar>
|
|
19
|
-
|
|
20
|
-
type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true
|
|
21
|
-
? DateRange
|
|
22
|
-
: M extends true ? DateValue[] : DateValue
|
|
23
|
-
|
|
24
|
-
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true
|
|
25
|
-
? (DateRange | null)
|
|
26
|
-
: M extends true
|
|
27
|
-
? (DateValue[] | undefined)
|
|
28
|
-
: (DateValue | undefined)
|
|
29
|
-
|
|
30
|
-
type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
|
|
31
|
-
type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>
|
|
32
|
-
|
|
33
|
-
export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends ComponentAttrs<typeof calendar>, _CalendarRootProps, _RangeCalendarRootProps {
|
|
34
|
-
/**
|
|
35
|
-
* The icon to use for the next year control.
|
|
36
|
-
* @default app.icons.chevronDoubleRight
|
|
37
|
-
*/
|
|
38
|
-
nextYearIcon?: string
|
|
39
|
-
/**
|
|
40
|
-
* The icon to use for the next month control.
|
|
41
|
-
* @default app.icons.chevronRight
|
|
42
|
-
*/
|
|
43
|
-
nextMonthIcon?: string
|
|
44
|
-
/**
|
|
45
|
-
* The icon to use for the previous year control.
|
|
46
|
-
* @default app.icons.chevronDoubleLeft
|
|
47
|
-
*/
|
|
48
|
-
prevYearIcon?: string
|
|
49
|
-
/**
|
|
50
|
-
* The icon to use for the previous month control.
|
|
51
|
-
* @default app.icons.chevronLeft
|
|
52
|
-
*/
|
|
53
|
-
prevMonthIcon?: string
|
|
54
|
-
/**
|
|
55
|
-
* @default "md"
|
|
56
|
-
*/
|
|
57
|
-
size?: CalendarVariants['size']
|
|
58
|
-
/** Whether or not a range of dates can be selected */
|
|
59
|
-
range?: R & boolean
|
|
60
|
-
/** Whether or not multiple dates can be selected */
|
|
61
|
-
multiple?: M & boolean
|
|
62
|
-
/** Show month controls */
|
|
63
|
-
monthControls?: boolean
|
|
64
|
-
/** Show year controls */
|
|
65
|
-
yearControls?: boolean
|
|
66
|
-
defaultValue?: CalendarDefaultValue<R, M>
|
|
67
|
-
modelValue?: CalendarDefaultValue<R, M>
|
|
68
|
-
}
|
|
69
3
|
</script>
|
|
70
4
|
|
|
71
|
-
<script setup
|
|
72
|
-
import { reactiveOmit } from
|
|
73
|
-
import { useForwardPropsEmits } from
|
|
74
|
-
import { Calendar as BaseCalendar, RangeCalendar } from
|
|
75
|
-
import { computed } from
|
|
76
|
-
import { useLocale } from
|
|
77
|
-
import { useTheme } from
|
|
78
|
-
import Button from
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
7
|
+
import { useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { Calendar as BaseCalendar, RangeCalendar } from "reka-ui/namespaced";
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
import { useLocale } from "../composables/useLocale";
|
|
11
|
+
import { useTheme } from "../composables/useTheme";
|
|
12
|
+
import Button from "./Button.vue";
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
nextYearIcon: { type: String, required: false },
|
|
15
|
+
nextMonthIcon: { type: String, required: false },
|
|
16
|
+
prevYearIcon: { type: String, required: false },
|
|
17
|
+
prevMonthIcon: { type: String, required: false },
|
|
18
|
+
size: { type: null, required: false },
|
|
19
|
+
range: { type: Boolean, required: false },
|
|
20
|
+
multiple: { type: Boolean, required: false },
|
|
21
|
+
monthControls: { type: Boolean, required: false, default: true },
|
|
22
|
+
yearControls: { type: Boolean, required: false, default: true },
|
|
23
|
+
defaultValue: { type: null, required: false },
|
|
24
|
+
modelValue: { type: null, required: false },
|
|
25
|
+
class: { type: null, required: false },
|
|
26
|
+
ui: { type: null, required: false },
|
|
27
|
+
defaultPlaceholder: { type: null, required: false },
|
|
28
|
+
placeholder: { type: null, required: false },
|
|
29
|
+
pagedNavigation: { type: Boolean, required: false },
|
|
30
|
+
preventDeselect: { type: Boolean, required: false },
|
|
31
|
+
weekStartsOn: { type: Number, required: false },
|
|
32
|
+
weekdayFormat: { type: String, required: false },
|
|
33
|
+
fixedWeeks: { type: Boolean, required: false, default: true },
|
|
34
|
+
maxValue: { type: null, required: false },
|
|
35
|
+
minValue: { type: null, required: false },
|
|
36
|
+
numberOfMonths: { type: Number, required: false, default: 1 },
|
|
37
|
+
disabled: { type: Boolean, required: false },
|
|
38
|
+
readonly: { type: Boolean, required: false },
|
|
39
|
+
initialFocus: { type: Boolean, required: false },
|
|
40
|
+
isDateDisabled: { type: Function, required: false },
|
|
41
|
+
isDateUnavailable: { type: Function, required: false },
|
|
42
|
+
nextPage: { type: Function, required: false },
|
|
43
|
+
prevPage: { type: Function, required: false },
|
|
44
|
+
disableDaysOutsideCurrentView: { type: Boolean, required: false },
|
|
45
|
+
allowNonContiguousRanges: { type: Boolean, required: false },
|
|
46
|
+
maximumDays: { type: Number, required: false },
|
|
47
|
+
isDateHighlightable: { type: Function, required: false },
|
|
48
|
+
fixedDate: { type: String, required: false }
|
|
49
|
+
});
|
|
50
|
+
const emit = defineEmits(["update:modelValue", "update:placeholder", "update:startValue"]);
|
|
51
|
+
defineSlots();
|
|
52
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, "range", "modelValue", "defaultValue", "size", "monthControls", "yearControls", "class", "ui"), emit);
|
|
53
|
+
const { code: locale, dir, t } = useLocale();
|
|
54
|
+
const { theme, generateStyle } = useTheme();
|
|
55
|
+
const nextYearIcon = computed(() => props.nextYearIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleLeft : theme.value.app.icons.chevronDoubleRight));
|
|
56
|
+
const nextMonthIcon = computed(() => props.nextMonthIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight));
|
|
57
|
+
const prevYearIcon = computed(() => props.prevYearIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronDoubleRight : theme.value.app.icons.chevronDoubleLeft));
|
|
58
|
+
const prevMonthIcon = computed(() => props.prevMonthIcon || (dir.value === "rtl" ? theme.value.app.icons.chevronRight : theme.value.app.icons.chevronLeft));
|
|
59
|
+
function paginateYear(date, sign) {
|
|
99
60
|
if (sign === -1)
|
|
100
|
-
return date.subtract({ years: 1 })
|
|
101
|
-
|
|
102
|
-
return date.add({ years: 1 })
|
|
61
|
+
return date.subtract({ years: 1 });
|
|
62
|
+
return date.add({ years: 1 });
|
|
103
63
|
}
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
64
|
+
const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar);
|
|
65
|
+
const style = computed(() => generateStyle("calendar", {
|
|
66
|
+
...props,
|
|
67
|
+
multipleMonths: props.numberOfMonths > 1
|
|
68
|
+
}));
|
|
108
69
|
</script>
|
|
109
70
|
|
|
110
71
|
<template>
|
|
@@ -116,16 +77,17 @@ const style = computed(() => generateStyle('calendar', props))
|
|
|
116
77
|
:locale="locale"
|
|
117
78
|
:dir="dir"
|
|
118
79
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
80
|
+
data-part="root"
|
|
119
81
|
>
|
|
120
|
-
<Calendar.Header :class="style.header({ class: props.ui?.header })">
|
|
121
|
-
<Calendar.Prev v-if="props.yearControls" :prev-page="date => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
82
|
+
<Calendar.Header :class="style.header({ class: props.ui?.header })" data-part="header">
|
|
83
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
122
84
|
<Button :icon="prevYearIcon" :size="props.size" variant="ghost" />
|
|
123
85
|
</Calendar.Prev>
|
|
124
86
|
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
125
87
|
<Button :icon="prevMonthIcon" :size="props.size" variant="ghost" />
|
|
126
88
|
</Calendar.Prev>
|
|
127
89
|
|
|
128
|
-
<Calendar.Heading v-slot="{ headingValue }" :class="style.heading({ class: props.ui?.heading })">
|
|
90
|
+
<Calendar.Heading v-slot="{ headingValue }" :class="style.heading({ class: props.ui?.heading })" data-part="heading">
|
|
129
91
|
<slot name="heading" :value="headingValue">
|
|
130
92
|
{{ headingValue }}
|
|
131
93
|
</slot>
|
|
@@ -137,32 +99,35 @@ const style = computed(() => generateStyle('calendar', props))
|
|
|
137
99
|
<Button :icon="nextYearIcon" :size="props.size" variant="ghost" />
|
|
138
100
|
</Calendar.Next>
|
|
139
101
|
</Calendar.Header>
|
|
140
|
-
<div :class="style.body({ class: props.ui?.body })">
|
|
102
|
+
<div :class="style.body({ class: props.ui?.body })" data-part="body">
|
|
141
103
|
<Calendar.Grid
|
|
142
104
|
v-for="month in grid"
|
|
143
105
|
:key="month.value.toString()"
|
|
144
106
|
:class="style.grid({ class: props.ui?.grid })"
|
|
107
|
+
data-part="grid"
|
|
145
108
|
>
|
|
146
109
|
<Calendar.GridHead>
|
|
147
|
-
<Calendar.GridRow :class="style.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })">
|
|
148
|
-
<Calendar.HeadCell v-for="day in weekDays" :key="day" :class="style.headCell({ class: props.ui?.headCell })">
|
|
110
|
+
<Calendar.GridRow :class="style.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })" data-part="grid-week-day-row">
|
|
111
|
+
<Calendar.HeadCell v-for="day in weekDays" :key="day" :class="style.headCell({ class: props.ui?.headCell })" data-part="head-cell">
|
|
149
112
|
<slot name="week-day" :day="day">
|
|
150
113
|
{{ day }}
|
|
151
114
|
</slot>
|
|
152
115
|
</Calendar.HeadCell>
|
|
153
116
|
</Calendar.GridRow>
|
|
154
117
|
</Calendar.GridHead>
|
|
155
|
-
<Calendar.GridBody :class="style.gridBody({ class: props.ui?.gridBody })">
|
|
118
|
+
<Calendar.GridBody :class="style.gridBody({ class: props.ui?.gridBody })" data-part="grid-body">
|
|
156
119
|
<Calendar.GridRow
|
|
157
120
|
v-for="(weekDates, index) in month.rows"
|
|
158
121
|
:key="`weekDates-${index}`"
|
|
159
122
|
:class="style.gridRow({ class: props.ui?.gridRow })"
|
|
123
|
+
data-part="grid-row"
|
|
160
124
|
>
|
|
161
125
|
<Calendar.Cell
|
|
162
126
|
v-for="weekDate in weekDates"
|
|
163
127
|
:key="weekDate.toString()"
|
|
164
128
|
:date="weekDate"
|
|
165
129
|
:class="style.cell({ class: props.ui?.cell })"
|
|
130
|
+
data-part="cell"
|
|
166
131
|
>
|
|
167
132
|
<Calendar.CellTrigger
|
|
168
133
|
v-slot="{ disabled, unavailable }"
|
|
@@ -170,7 +135,7 @@ const style = computed(() => generateStyle('calendar', props))
|
|
|
170
135
|
:month="month.value"
|
|
171
136
|
as-child
|
|
172
137
|
>
|
|
173
|
-
<div :class="style.cellTrigger({ class: props.ui?.cellTrigger, disabled: disabled || unavailable })">
|
|
138
|
+
<div :class="style.cellTrigger({ class: props.ui?.cellTrigger, disabled: disabled || unavailable })" data-part="cell-trigger">
|
|
174
139
|
<slot name="day" :day="weekDate">
|
|
175
140
|
{{ weekDate.day }}
|
|
176
141
|
</slot>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { DateValue } from '@internationalized/date';
|
|
3
|
+
import type { CalendarCellTriggerProps, CalendarRootEmits, CalendarRootProps, DateRange, RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui';
|
|
4
|
+
import type { calendar } from '../theme/index.js';
|
|
5
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
6
|
+
export interface CalendarEmits<R extends boolean, M extends boolean> extends Omit<CalendarRootEmits & RangeCalendarRootEmits, 'update:modelValue'> {
|
|
7
|
+
'update:modelValue': [date: CalendarModelValue<R, M>];
|
|
8
|
+
}
|
|
9
|
+
export interface CalendarSlots {
|
|
10
|
+
'heading'?: (props: {
|
|
11
|
+
value: string;
|
|
12
|
+
}) => any;
|
|
13
|
+
'day'?: (props: Pick<CalendarCellTriggerProps, 'day'>) => any;
|
|
14
|
+
'week-day'?: (props: {
|
|
15
|
+
day: string;
|
|
16
|
+
}) => any;
|
|
17
|
+
}
|
|
18
|
+
type CalendarVariants = VariantProps<typeof calendar>;
|
|
19
|
+
type CalendarDefaultValue<R extends boolean = false, M extends boolean = false> = R extends true ? DateRange : M extends true ? DateValue[] : DateValue;
|
|
20
|
+
type CalendarModelValue<R extends boolean = false, M extends boolean = false> = R extends true ? (DateRange | null) : M extends true ? (DateValue[] | undefined) : (DateValue | undefined);
|
|
21
|
+
type _CalendarRootProps = Omit<CalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
|
|
22
|
+
type _RangeCalendarRootProps = Omit<RangeCalendarRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale' | 'calendarLabel' | 'multiple'>;
|
|
23
|
+
export interface CalendarProps<R extends boolean = false, M extends boolean = false> extends ComponentAttrs<typeof calendar>, _CalendarRootProps, _RangeCalendarRootProps {
|
|
24
|
+
/**
|
|
25
|
+
* The icon to use for the next year control.
|
|
26
|
+
* @default app.icons.chevronDoubleRight
|
|
27
|
+
*/
|
|
28
|
+
nextYearIcon?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The icon to use for the next month control.
|
|
31
|
+
* @default app.icons.chevronRight
|
|
32
|
+
*/
|
|
33
|
+
nextMonthIcon?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The icon to use for the previous year control.
|
|
36
|
+
* @default app.icons.chevronDoubleLeft
|
|
37
|
+
*/
|
|
38
|
+
prevYearIcon?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The icon to use for the previous month control.
|
|
41
|
+
* @default app.icons.chevronLeft
|
|
42
|
+
*/
|
|
43
|
+
prevMonthIcon?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @default "md"
|
|
46
|
+
*/
|
|
47
|
+
size?: CalendarVariants['size'];
|
|
48
|
+
/** Whether or not a range of dates can be selected */
|
|
49
|
+
range?: R & boolean;
|
|
50
|
+
/** Whether or not multiple dates can be selected */
|
|
51
|
+
multiple?: M & boolean;
|
|
52
|
+
/** Show month controls */
|
|
53
|
+
monthControls?: boolean;
|
|
54
|
+
/** Show year controls */
|
|
55
|
+
yearControls?: boolean;
|
|
56
|
+
defaultValue?: CalendarDefaultValue<R, M>;
|
|
57
|
+
modelValue?: CalendarDefaultValue<R, M>;
|
|
58
|
+
}
|
|
59
|
+
declare const _default: <R extends boolean, M extends boolean>(__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<{
|
|
60
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
61
|
+
readonly "onUpdate:modelValue"?: ((date: CalendarModelValue<R, M>) => any) | undefined;
|
|
62
|
+
readonly "onUpdate:placeholder"?: ((...args: unknown[]) => any) | undefined;
|
|
63
|
+
readonly "onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
64
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:placeholder" | "onUpdate:startValue"> & CalendarProps<R, M> & Partial<{}>> & import("vue").PublicProps;
|
|
65
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
66
|
+
attrs: any;
|
|
67
|
+
slots: CalendarSlots;
|
|
68
|
+
emit: ((evt: "update:modelValue", date: CalendarModelValue<R, M>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void);
|
|
69
|
+
}>) => import("vue").VNode & {
|
|
70
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
71
|
+
};
|
|
72
|
+
export default _default;
|
|
73
|
+
type __VLS_PrettifyLocal<T> = {
|
|
74
|
+
[K in keyof T]: T[K];
|
|
75
|
+
} & {};
|
|
@@ -1,56 +1,38 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
-
import type { card } from '../theme'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
export interface CardSlots {
|
|
8
|
-
default?: (props?: {}) => any
|
|
9
|
-
content?: (props?: {}) => any
|
|
10
|
-
header?: (props?: {}) => any
|
|
11
|
-
title?: (props?: {}) => any
|
|
12
|
-
description?: (props?: {}) => any
|
|
13
|
-
footer?: (props?: {}) => any
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type CardVariants = VariantProps<typeof card>
|
|
17
|
-
|
|
18
|
-
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
19
|
-
/**
|
|
20
|
-
* The element or component this component should render as.
|
|
21
|
-
* @default "div"
|
|
22
|
-
*/
|
|
23
|
-
as?: PrimitiveProps['as']
|
|
24
|
-
variant?: CardVariants['variant']
|
|
25
|
-
title?: string
|
|
26
|
-
description?: string
|
|
27
|
-
}
|
|
28
3
|
</script>
|
|
29
4
|
|
|
30
|
-
<script setup
|
|
31
|
-
import { Primitive } from
|
|
32
|
-
import { computed } from
|
|
33
|
-
import { useTheme } from
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
+
variant: { type: null, required: false },
|
|
12
|
+
title: { type: String, required: false },
|
|
13
|
+
description: { type: String, required: false },
|
|
14
|
+
class: { type: null, required: false },
|
|
15
|
+
ui: { type: null, required: false }
|
|
16
|
+
});
|
|
17
|
+
const slots = defineSlots();
|
|
18
|
+
const { generateStyle } = useTheme();
|
|
19
|
+
const style = computed(() => generateStyle("card", props));
|
|
40
20
|
</script>
|
|
41
21
|
|
|
42
22
|
<template>
|
|
43
|
-
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
23
|
+
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
|
|
44
24
|
<slot name="content">
|
|
45
25
|
<div
|
|
46
|
-
v-if="slots.header || props.title || slots.title || props.description || slots.description
|
|
26
|
+
v-if="slots.header || props.title || slots.title || props.description || slots.description"
|
|
47
27
|
:class="style.header({ class: props.ui?.header })"
|
|
28
|
+
data-part="header"
|
|
48
29
|
>
|
|
49
30
|
<slot name="header">
|
|
50
31
|
<Primitive
|
|
51
32
|
v-if="props.title || slots.title"
|
|
52
|
-
:as="slots.title ?
|
|
33
|
+
:as="slots.title ? void 0 : 'h2'"
|
|
53
34
|
:class="style.title({ class: props.ui?.title })"
|
|
35
|
+
data-part="title"
|
|
54
36
|
>
|
|
55
37
|
<slot name="title">
|
|
56
38
|
{{ props.title }}
|
|
@@ -58,9 +40,10 @@ const style = computed(() => generateStyle('card', props))
|
|
|
58
40
|
</Primitive>
|
|
59
41
|
<Primitive
|
|
60
42
|
v-if="props.description || slots.description"
|
|
61
|
-
:as="slots.description ?
|
|
43
|
+
:as="slots.description ? void 0 : 'p'"
|
|
62
44
|
:as-child="!!slots.description"
|
|
63
45
|
:class="style.description({ class: props.ui?.description })"
|
|
46
|
+
data-part="description"
|
|
64
47
|
>
|
|
65
48
|
<slot name="description">
|
|
66
49
|
{{ props.description }}
|
|
@@ -69,11 +52,11 @@ const style = computed(() => generateStyle('card', props))
|
|
|
69
52
|
</slot>
|
|
70
53
|
</div>
|
|
71
54
|
|
|
72
|
-
<div v-if="slots.default" :class="style.body({ class: props.ui?.body })">
|
|
55
|
+
<div v-if="slots.default" :class="style.body({ class: props.ui?.body })" data-part="body">
|
|
73
56
|
<slot></slot>
|
|
74
57
|
</div>
|
|
75
58
|
|
|
76
|
-
<div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })">
|
|
59
|
+
<div v-if="slots.footer" :class="style.footer({ class: props.ui?.footer })" data-part="footer">
|
|
77
60
|
<slot name="footer"></slot>
|
|
78
61
|
</div>
|
|
79
62
|
</slot>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
+
import type { card } from '../theme/index.js';
|
|
4
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
5
|
+
export interface CardSlots {
|
|
6
|
+
default?: (props?: {}) => any;
|
|
7
|
+
content?: (props?: {}) => any;
|
|
8
|
+
header?: (props?: {}) => any;
|
|
9
|
+
title?: (props?: {}) => any;
|
|
10
|
+
description?: (props?: {}) => any;
|
|
11
|
+
footer?: (props?: {}) => any;
|
|
12
|
+
}
|
|
13
|
+
type CardVariants = VariantProps<typeof card>;
|
|
14
|
+
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @default "div"
|
|
18
|
+
*/
|
|
19
|
+
as?: PrimitiveProps['as'];
|
|
20
|
+
variant?: CardVariants['variant'];
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<CardProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CardProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CardSlots>;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|