@byyuurin/ui 0.3.0 → 0.4.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/LICENSE +20 -20
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +43 -43
- package/dist/runtime/components/Alert.vue +65 -64
- package/dist/runtime/components/App.vue +10 -10
- package/dist/runtime/components/Avatar.vue +31 -30
- package/dist/runtime/components/AvatarGroup.vue +6 -5
- package/dist/runtime/components/Badge.vue +36 -35
- package/dist/runtime/components/Breadcrumb.vue +51 -51
- package/dist/runtime/components/Button.vue +54 -55
- package/dist/runtime/components/Calendar.vue +76 -75
- package/dist/runtime/components/Card.vue +43 -42
- package/dist/runtime/components/Carousel.vue +68 -67
- package/dist/runtime/components/Checkbox.vue +50 -48
- package/dist/runtime/components/CheckboxGroup.vue +33 -32
- package/dist/runtime/components/Chip.vue +20 -16
- package/dist/runtime/components/Collapsible.vue +16 -15
- package/dist/runtime/components/Drawer.vue +78 -77
- package/dist/runtime/components/DropdownMenu.vue +29 -29
- package/dist/runtime/components/DropdownMenuContent.vue +152 -152
- package/dist/runtime/components/FieldGroup.vue +5 -4
- package/dist/runtime/components/FileUpload.vue +267 -0
- package/dist/runtime/components/FileUpload.vue.d.ts +178 -0
- package/dist/runtime/components/Form.vue +11 -10
- package/dist/runtime/components/FormField.vue +39 -38
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/Input.vue +52 -52
- package/dist/runtime/components/InputNumber.vue +50 -49
- package/dist/runtime/components/InputTags.vue +55 -55
- package/dist/runtime/components/Kbd.vue +5 -4
- package/dist/runtime/components/Link.vue +25 -24
- package/dist/runtime/components/LinkBase.vue +3 -3
- package/dist/runtime/components/Marquee.vue +7 -6
- package/dist/runtime/components/Modal.vue +76 -75
- package/dist/runtime/components/NavigationMenu.vue +230 -230
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Pagination.vue +49 -48
- package/dist/runtime/components/PinInput.vue +25 -25
- package/dist/runtime/components/Popover.vue +23 -23
- package/dist/runtime/components/Progress.vue +27 -26
- package/dist/runtime/components/RadioGroup.vue +53 -53
- package/dist/runtime/components/ScrollArea.vue +34 -33
- package/dist/runtime/components/Select.vue +203 -203
- package/dist/runtime/components/Separator.vue +32 -31
- package/dist/runtime/components/Skeleton.vue +13 -12
- package/dist/runtime/components/Slider.vue +27 -26
- package/dist/runtime/components/Stepper.vue +53 -52
- package/dist/runtime/components/Stepper.vue.d.ts +2 -2
- package/dist/runtime/components/Switch.vue +33 -34
- package/dist/runtime/components/Table.vue +139 -138
- package/dist/runtime/components/Tabs.vue +76 -76
- package/dist/runtime/components/Textarea.vue +50 -50
- package/dist/runtime/components/Timeline.vue +49 -48
- package/dist/runtime/components/Toast.vue +95 -94
- package/dist/runtime/components/ToastProvider.vue +31 -31
- package/dist/runtime/components/Tooltip.vue +26 -25
- package/dist/runtime/components/Tree.vue +133 -133
- package/dist/runtime/composables/useFileUpload.d.ts +19 -0
- package/dist/runtime/composables/useFileUpload.js +79 -0
- package/dist/runtime/composables/useLocale.d.ts +6 -0
- package/dist/runtime/locale/en.d.ts +3 -0
- package/dist/runtime/locale/en.js +3 -0
- package/dist/runtime/locale/zh_tw.d.ts +3 -0
- package/dist/runtime/locale/zh_tw.js +3 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +3 -0
- package/dist/runtime/types/unocss.d.ts +4 -4
- package/dist/runtime/types/utils.d.ts +1 -1
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/setup.d.mts +1 -1
- package/dist/shared/{ui.D8Bg1HWt.d.mts → ui.CGCKYv7g.d.mts} +4 -2
- package/dist/shared/{ui.9kQouwss.mjs → ui.DYMXCXO6.mjs} +4 -2
- package/dist/shared/{ui.DpkP12cX.mjs → ui.DcEKQd0n.mjs} +230 -5
- package/dist/unocss.mjs +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +10 -10
- package/vue-plugin.d.ts +5 -5
|
@@ -7,7 +7,7 @@ import { Primitive } from "reka-ui";
|
|
|
7
7
|
import { computed } from "vue";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import { useLocale } from "../composables/useLocale";
|
|
10
|
-
import { get, pickLinkProps } from "../utils";
|
|
10
|
+
import { get, pick, pickLinkProps } from "../utils";
|
|
11
11
|
import { cv, merge } from "../utils/style";
|
|
12
12
|
import Avatar from "./Avatar.vue";
|
|
13
13
|
import Icon from "./Icon.vue";
|
|
@@ -27,58 +27,58 @@ const appConfig = useAppConfig();
|
|
|
27
27
|
const separatorIcon = computed(() => props.separatorIcon || (dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight));
|
|
28
28
|
const ui = computed(() => {
|
|
29
29
|
const styler = cv(merge(theme, appConfig.ui.breadcrumb));
|
|
30
|
-
return styler(props);
|
|
30
|
+
return styler(pick(props, []));
|
|
31
31
|
});
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<template>
|
|
35
|
-
<Primitive :as="props.as" aria-label="breadcrumb" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
36
|
-
<ol :class="ui.list({ class: props.ui?.list })" data-part="list">
|
|
37
|
-
<template v-for="(item, index) in props.items" :key="index">
|
|
38
|
-
<li :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item">
|
|
39
|
-
<Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
40
|
-
<LinkBase
|
|
41
|
-
v-bind="slotProps"
|
|
42
|
-
as="span"
|
|
43
|
-
:aria-current="(item.active ?? active) && index === items.length - 1 ? 'page' : void 0"
|
|
44
|
-
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: item.active ?? index === items.length - 1, disabled: item.disabled, to: !!item.to })"
|
|
45
|
-
data-part="link"
|
|
46
|
-
>
|
|
47
|
-
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="item.active ?? index === items.length - 1" :ui="ui">
|
|
48
|
-
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="item.active ?? index === items.length - 1" :index="index" :ui="ui">
|
|
49
|
-
<Icon
|
|
50
|
-
v-if="item.icon"
|
|
51
|
-
:name="item.icon"
|
|
52
|
-
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: item.active ?? index === items.length - 1 })"
|
|
53
|
-
data-part="linkLeadingIcon"
|
|
54
|
-
/>
|
|
55
|
-
<Avatar
|
|
56
|
-
v-else-if="item.avatar"
|
|
57
|
-
:size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
|
|
58
|
-
v-bind="item.avatar"
|
|
59
|
-
:class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: item.active ?? index === items.length - 1 })"
|
|
60
|
-
data-part="linkLeadingAvatar"
|
|
61
|
-
/>
|
|
62
|
-
</slot>
|
|
63
|
-
|
|
64
|
-
<span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })" data-part="linkLabel">
|
|
65
|
-
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="item.active ?? index === items.length - 1" :index="index">
|
|
66
|
-
{{ get(item, props.labelKey) }}
|
|
67
|
-
</slot>
|
|
68
|
-
</span>
|
|
69
|
-
|
|
70
|
-
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="item.active ?? index === items.length - 1" :index="index"></slot>
|
|
71
|
-
</slot>
|
|
72
|
-
</LinkBase>
|
|
73
|
-
</Link>
|
|
74
|
-
</li>
|
|
75
|
-
|
|
76
|
-
<li v-if="index < items.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })" data-part="separator">
|
|
77
|
-
<slot name="separator" :ui="ui">
|
|
78
|
-
<Icon :name="separatorIcon" :class="ui.separatorIcon({ class: [props.ui?.separatorIcon, item.ui?.separatorIcon] })" data-part="separatorIcon" />
|
|
79
|
-
</slot>
|
|
80
|
-
</li>
|
|
81
|
-
</template>
|
|
82
|
-
</ol>
|
|
83
|
-
</Primitive>
|
|
35
|
+
<Primitive :as="props.as" aria-label="breadcrumb" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
36
|
+
<ol :class="ui.list({ class: props.ui?.list })" data-part="list">
|
|
37
|
+
<template v-for="(item, index) in props.items" :key="index">
|
|
38
|
+
<li :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item">
|
|
39
|
+
<Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
40
|
+
<LinkBase
|
|
41
|
+
v-bind="slotProps"
|
|
42
|
+
as="span"
|
|
43
|
+
:aria-current="(item.active ?? active) && index === items.length - 1 ? 'page' : void 0"
|
|
44
|
+
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: item.active ?? index === items.length - 1, disabled: item.disabled, to: !!item.to })"
|
|
45
|
+
data-part="link"
|
|
46
|
+
>
|
|
47
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="item.active ?? index === items.length - 1" :ui="ui">
|
|
48
|
+
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="item.active ?? index === items.length - 1" :index="index" :ui="ui">
|
|
49
|
+
<Icon
|
|
50
|
+
v-if="item.icon"
|
|
51
|
+
:name="item.icon"
|
|
52
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: item.active ?? index === items.length - 1 })"
|
|
53
|
+
data-part="linkLeadingIcon"
|
|
54
|
+
/>
|
|
55
|
+
<Avatar
|
|
56
|
+
v-else-if="item.avatar"
|
|
57
|
+
:size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
|
|
58
|
+
v-bind="item.avatar"
|
|
59
|
+
:class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: item.active ?? index === items.length - 1 })"
|
|
60
|
+
data-part="linkLeadingAvatar"
|
|
61
|
+
/>
|
|
62
|
+
</slot>
|
|
63
|
+
|
|
64
|
+
<span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })" data-part="linkLabel">
|
|
65
|
+
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="item.active ?? index === items.length - 1" :index="index">
|
|
66
|
+
{{ get(item, props.labelKey) }}
|
|
67
|
+
</slot>
|
|
68
|
+
</span>
|
|
69
|
+
|
|
70
|
+
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="item.active ?? index === items.length - 1" :index="index"></slot>
|
|
71
|
+
</slot>
|
|
72
|
+
</LinkBase>
|
|
73
|
+
</Link>
|
|
74
|
+
</li>
|
|
75
|
+
|
|
76
|
+
<li v-if="index < items.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })" data-part="separator">
|
|
77
|
+
<slot name="separator" :ui="ui">
|
|
78
|
+
<Icon :name="separatorIcon" :class="ui.separatorIcon({ class: [props.ui?.separatorIcon, item.ui?.separatorIcon] })" data-part="separatorIcon" />
|
|
79
|
+
</slot>
|
|
80
|
+
</li>
|
|
81
|
+
</template>
|
|
82
|
+
</ol>
|
|
83
|
+
</Primitive>
|
|
84
84
|
</template>
|
|
@@ -9,7 +9,7 @@ import { useAppConfig } from "#imports";
|
|
|
9
9
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
10
10
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
11
11
|
import { injectFormLoading } from "../composables/useFormField";
|
|
12
|
-
import { omit, pickLinkProps } from "../utils";
|
|
12
|
+
import { omit, pick, pickLinkProps } from "../utils";
|
|
13
13
|
import { cv, merge } from "../utils/style";
|
|
14
14
|
import Avatar from "./Avatar.vue";
|
|
15
15
|
import Icon from "./Icon.vue";
|
|
@@ -97,71 +97,70 @@ const ui = computed(() => {
|
|
|
97
97
|
};
|
|
98
98
|
const styler = cv(merge(theme, uiConfig));
|
|
99
99
|
return styler({
|
|
100
|
-
...props,
|
|
101
|
-
loading: isLoading.value,
|
|
100
|
+
...pick(props, ["color", "variant", "block"]),
|
|
102
101
|
size: size.value,
|
|
103
|
-
|
|
104
|
-
block: props.block,
|
|
102
|
+
loading: isLoading.value,
|
|
105
103
|
square: props.square || !slots.default && !props.label,
|
|
106
104
|
leading: isLeading.value,
|
|
107
|
-
trailing: isTrailing.value
|
|
105
|
+
trailing: isTrailing.value,
|
|
106
|
+
fieldGroup: orientation.value
|
|
108
107
|
});
|
|
109
108
|
});
|
|
110
109
|
</script>
|
|
111
110
|
|
|
112
111
|
<template>
|
|
113
|
-
<Link
|
|
114
|
-
v-slot="{ active, ...slotProps }"
|
|
115
|
-
:type="props.type"
|
|
116
|
-
:disabled="props.disabled || props.loading"
|
|
117
|
-
v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
|
|
118
|
-
data-part="base"
|
|
119
|
-
custom
|
|
120
|
-
>
|
|
121
|
-
<LinkBase
|
|
122
|
-
v-bind="slotProps"
|
|
112
|
+
<Link
|
|
113
|
+
v-slot="{ active, ...slotProps }"
|
|
114
|
+
:type="props.type"
|
|
115
|
+
:disabled="props.disabled || props.loading"
|
|
116
|
+
v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
|
|
117
|
+
data-part="base"
|
|
118
|
+
custom
|
|
119
|
+
>
|
|
120
|
+
<LinkBase
|
|
121
|
+
v-bind="slotProps"
|
|
123
122
|
:class="ui.base({
|
|
124
123
|
class: [props.ui?.base, props.class],
|
|
125
124
|
active,
|
|
126
125
|
...props.active && props.activeVariant ? { variant: props.activeVariant } : {},
|
|
127
126
|
...props.active && props.activeColor ? { color: props.activeColor } : {}
|
|
128
|
-
})"
|
|
129
|
-
@click="onClickWrapper"
|
|
130
|
-
>
|
|
131
|
-
<slot name="leading" :ui="ui">
|
|
132
|
-
<Icon
|
|
133
|
-
v-if="isLeading && leadingIconName"
|
|
134
|
-
:name="leadingIconName"
|
|
135
|
-
:class="ui.leadingIcon({ class: props.ui?.leadingIcon, active })"
|
|
136
|
-
data-part="leadingIcon"
|
|
137
|
-
/>
|
|
138
|
-
<Avatar
|
|
139
|
-
v-else-if="props.avatar"
|
|
140
|
-
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
141
|
-
v-bind="props.avatar"
|
|
142
|
-
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })"
|
|
143
|
-
data-part="leadingAvatar"
|
|
144
|
-
/>
|
|
145
|
-
</slot>
|
|
146
|
-
|
|
147
|
-
<slot :ui="ui">
|
|
148
|
-
<span
|
|
149
|
-
v-if="props.label"
|
|
150
|
-
:class="ui.label({ class: props.ui?.label, active })"
|
|
151
|
-
data-part="label"
|
|
152
|
-
>
|
|
153
|
-
{{ label }}
|
|
154
|
-
</span>
|
|
155
|
-
</slot>
|
|
156
|
-
|
|
157
|
-
<slot name="trailing" :ui="ui">
|
|
158
|
-
<Icon
|
|
159
|
-
v-if="isTrailing && trailingIconName"
|
|
160
|
-
:name="trailingIconName"
|
|
161
|
-
:class="ui.trailingIcon({ class: props.ui?.trailingIcon, active })"
|
|
162
|
-
data-part="trailingIcon"
|
|
163
|
-
/>
|
|
164
|
-
</slot>
|
|
165
|
-
</LinkBase>
|
|
166
|
-
</Link>
|
|
127
|
+
})"
|
|
128
|
+
@click="onClickWrapper"
|
|
129
|
+
>
|
|
130
|
+
<slot name="leading" :ui="ui">
|
|
131
|
+
<Icon
|
|
132
|
+
v-if="isLeading && leadingIconName"
|
|
133
|
+
:name="leadingIconName"
|
|
134
|
+
:class="ui.leadingIcon({ class: props.ui?.leadingIcon, active })"
|
|
135
|
+
data-part="leadingIcon"
|
|
136
|
+
/>
|
|
137
|
+
<Avatar
|
|
138
|
+
v-else-if="props.avatar"
|
|
139
|
+
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
140
|
+
v-bind="props.avatar"
|
|
141
|
+
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })"
|
|
142
|
+
data-part="leadingAvatar"
|
|
143
|
+
/>
|
|
144
|
+
</slot>
|
|
145
|
+
|
|
146
|
+
<slot :ui="ui">
|
|
147
|
+
<span
|
|
148
|
+
v-if="props.label"
|
|
149
|
+
:class="ui.label({ class: props.ui?.label, active })"
|
|
150
|
+
data-part="label"
|
|
151
|
+
>
|
|
152
|
+
{{ label }}
|
|
153
|
+
</span>
|
|
154
|
+
</slot>
|
|
155
|
+
|
|
156
|
+
<slot name="trailing" :ui="ui">
|
|
157
|
+
<Icon
|
|
158
|
+
v-if="isTrailing && trailingIconName"
|
|
159
|
+
:name="trailingIconName"
|
|
160
|
+
:class="ui.trailingIcon({ class: props.ui?.trailingIcon, active })"
|
|
161
|
+
data-part="trailingIcon"
|
|
162
|
+
/>
|
|
163
|
+
</slot>
|
|
164
|
+
</LinkBase>
|
|
165
|
+
</Link>
|
|
167
166
|
</template>
|
|
@@ -9,6 +9,7 @@ import { Calendar as BaseCalendar, RangeCalendar } from "reka-ui/namespaced";
|
|
|
9
9
|
import { computed } from "vue";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useLocale } from "../composables/useLocale";
|
|
12
|
+
import { pick } from "../utils";
|
|
12
13
|
import { cv, merge } from "../utils/style";
|
|
13
14
|
import Button from "./Button.vue";
|
|
14
15
|
const props = defineProps({
|
|
@@ -63,7 +64,7 @@ const appConfig = useAppConfig();
|
|
|
63
64
|
const ui = computed(() => {
|
|
64
65
|
const styler = cv(merge(theme, appConfig.ui.calendar));
|
|
65
66
|
return styler({
|
|
66
|
-
...props,
|
|
67
|
+
...pick(props, ["color", "variant", "size"]),
|
|
67
68
|
outsideView: props.numberOfMonths === 1
|
|
68
69
|
});
|
|
69
70
|
});
|
|
@@ -80,78 +81,78 @@ const Calendar = computed(() => props.range ? RangeCalendar : BaseCalendar);
|
|
|
80
81
|
</script>
|
|
81
82
|
|
|
82
83
|
<template>
|
|
83
|
-
<Calendar.Root
|
|
84
|
-
v-slot="{ weekDays, grid }"
|
|
85
|
-
v-bind="rootProps"
|
|
86
|
-
:model-value="props.modelValue"
|
|
87
|
-
:default-value="props.defaultValue"
|
|
88
|
-
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
89
|
-
data-part="root"
|
|
90
|
-
>
|
|
91
|
-
<Calendar.Header :class="ui.header({ class: props.ui?.header })" data-part="header">
|
|
92
|
-
<Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
93
|
-
<Button :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevYear" />
|
|
94
|
-
</Calendar.Prev>
|
|
95
|
-
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
96
|
-
<Button :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevMonth" />
|
|
97
|
-
</Calendar.Prev>
|
|
98
|
-
|
|
99
|
-
<Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })" data-part="heading">
|
|
100
|
-
<slot name="heading" :value="headingValue">
|
|
101
|
-
{{ headingValue }}
|
|
102
|
-
</slot>
|
|
103
|
-
</Calendar.Heading>
|
|
104
|
-
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
105
|
-
<Button :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextMonth" />
|
|
106
|
-
</Calendar.Next>
|
|
107
|
-
<Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
108
|
-
<Button :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextYear" />
|
|
109
|
-
</Calendar.Next>
|
|
110
|
-
</Calendar.Header>
|
|
111
|
-
<div :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
112
|
-
<Calendar.Grid
|
|
113
|
-
v-for="month in grid"
|
|
114
|
-
:key="month.value.toString()"
|
|
115
|
-
:class="ui.grid({ class: props.ui?.grid })"
|
|
116
|
-
data-part="grid"
|
|
117
|
-
>
|
|
118
|
-
<Calendar.GridHead>
|
|
119
|
-
<Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })" data-part="gridWeekDaysRow">
|
|
120
|
-
<Calendar.HeadCell v-for="day in weekDays" :key="day" :class="ui.headCell({ class: props.ui?.headCell })" data-part="headCell">
|
|
121
|
-
<slot name="week-day" :day="day">
|
|
122
|
-
{{ day }}
|
|
123
|
-
</slot>
|
|
124
|
-
</Calendar.HeadCell>
|
|
125
|
-
</Calendar.GridRow>
|
|
126
|
-
</Calendar.GridHead>
|
|
127
|
-
<Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })" data-part="gridBody">
|
|
128
|
-
<Calendar.GridRow
|
|
129
|
-
v-for="(weekDates, index) in month.rows"
|
|
130
|
-
:key="`weekDates-${index}`"
|
|
131
|
-
:class="ui.gridRow({ class: props.ui?.gridRow })"
|
|
132
|
-
data-part="gridRow"
|
|
133
|
-
>
|
|
134
|
-
<Calendar.Cell
|
|
135
|
-
v-for="weekDate in weekDates"
|
|
136
|
-
:key="weekDate.toString()"
|
|
137
|
-
:date="weekDate"
|
|
138
|
-
:class="ui.cell({ class: props.ui?.cell })"
|
|
139
|
-
data-part="cell"
|
|
140
|
-
>
|
|
141
|
-
<Calendar.CellTrigger
|
|
142
|
-
:day="weekDate"
|
|
143
|
-
:month="month.value"
|
|
144
|
-
:class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
|
|
145
|
-
data-part="cellTrigger"
|
|
146
|
-
>
|
|
147
|
-
<slot name="day" :day="weekDate">
|
|
148
|
-
{{ weekDate.day }}
|
|
149
|
-
</slot>
|
|
150
|
-
</Calendar.CellTrigger>
|
|
151
|
-
</Calendar.Cell>
|
|
152
|
-
</Calendar.GridRow>
|
|
153
|
-
</Calendar.GridBody>
|
|
154
|
-
</Calendar.Grid>
|
|
155
|
-
</div>
|
|
156
|
-
</Calendar.Root>
|
|
84
|
+
<Calendar.Root
|
|
85
|
+
v-slot="{ weekDays, grid }"
|
|
86
|
+
v-bind="rootProps"
|
|
87
|
+
:model-value="props.modelValue"
|
|
88
|
+
:default-value="props.defaultValue"
|
|
89
|
+
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
90
|
+
data-part="root"
|
|
91
|
+
>
|
|
92
|
+
<Calendar.Header :class="ui.header({ class: props.ui?.header })" data-part="header">
|
|
93
|
+
<Calendar.Prev v-if="props.yearControls" :prev-page="(date) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
|
94
|
+
<Button :icon="prevYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevYear" />
|
|
95
|
+
</Calendar.Prev>
|
|
96
|
+
<Calendar.Prev v-if="props.monthControls" :aria-label="t('calendar.prevMonth')" as-child>
|
|
97
|
+
<Button :icon="prevMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.prevMonth" />
|
|
98
|
+
</Calendar.Prev>
|
|
99
|
+
|
|
100
|
+
<Calendar.Heading v-slot="{ headingValue }" :class="ui.heading({ class: props.ui?.heading })" data-part="heading">
|
|
101
|
+
<slot name="heading" :value="headingValue">
|
|
102
|
+
{{ headingValue }}
|
|
103
|
+
</slot>
|
|
104
|
+
</Calendar.Heading>
|
|
105
|
+
<Calendar.Next v-if="props.monthControls" :aria-label="t('calendar.nextMonth')" as-child>
|
|
106
|
+
<Button :icon="nextMonthIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextMonth" />
|
|
107
|
+
</Calendar.Next>
|
|
108
|
+
<Calendar.Next v-if="props.yearControls" :next-page="(date) => paginateYear(date, 1)" :aria-label="t('calendar.nextYear')" as-child>
|
|
109
|
+
<Button :icon="nextYearIcon" :size="props.size" color="neutral" variant="ghost" v-bind="props.nextYear" />
|
|
110
|
+
</Calendar.Next>
|
|
111
|
+
</Calendar.Header>
|
|
112
|
+
<div :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
113
|
+
<Calendar.Grid
|
|
114
|
+
v-for="month in grid"
|
|
115
|
+
:key="month.value.toString()"
|
|
116
|
+
:class="ui.grid({ class: props.ui?.grid })"
|
|
117
|
+
data-part="grid"
|
|
118
|
+
>
|
|
119
|
+
<Calendar.GridHead>
|
|
120
|
+
<Calendar.GridRow :class="ui.gridWeekDaysRow({ class: props.ui?.gridWeekDaysRow })" data-part="gridWeekDaysRow">
|
|
121
|
+
<Calendar.HeadCell v-for="day in weekDays" :key="day" :class="ui.headCell({ class: props.ui?.headCell })" data-part="headCell">
|
|
122
|
+
<slot name="week-day" :day="day">
|
|
123
|
+
{{ day }}
|
|
124
|
+
</slot>
|
|
125
|
+
</Calendar.HeadCell>
|
|
126
|
+
</Calendar.GridRow>
|
|
127
|
+
</Calendar.GridHead>
|
|
128
|
+
<Calendar.GridBody :class="ui.gridBody({ class: props.ui?.gridBody })" data-part="gridBody">
|
|
129
|
+
<Calendar.GridRow
|
|
130
|
+
v-for="(weekDates, index) in month.rows"
|
|
131
|
+
:key="`weekDates-${index}`"
|
|
132
|
+
:class="ui.gridRow({ class: props.ui?.gridRow })"
|
|
133
|
+
data-part="gridRow"
|
|
134
|
+
>
|
|
135
|
+
<Calendar.Cell
|
|
136
|
+
v-for="weekDate in weekDates"
|
|
137
|
+
:key="weekDate.toString()"
|
|
138
|
+
:date="weekDate"
|
|
139
|
+
:class="ui.cell({ class: props.ui?.cell })"
|
|
140
|
+
data-part="cell"
|
|
141
|
+
>
|
|
142
|
+
<Calendar.CellTrigger
|
|
143
|
+
:day="weekDate"
|
|
144
|
+
:month="month.value"
|
|
145
|
+
:class="ui.cellTrigger({ class: props.ui?.cellTrigger })"
|
|
146
|
+
data-part="cellTrigger"
|
|
147
|
+
>
|
|
148
|
+
<slot name="day" :day="weekDate">
|
|
149
|
+
{{ weekDate.day }}
|
|
150
|
+
</slot>
|
|
151
|
+
</Calendar.CellTrigger>
|
|
152
|
+
</Calendar.Cell>
|
|
153
|
+
</Calendar.GridRow>
|
|
154
|
+
</Calendar.GridBody>
|
|
155
|
+
</Calendar.Grid>
|
|
156
|
+
</div>
|
|
157
|
+
</Calendar.Root>
|
|
157
158
|
</template>
|
|
@@ -6,6 +6,7 @@ import theme from "#build/ui/card";
|
|
|
6
6
|
import { Primitive } from "reka-ui";
|
|
7
7
|
import { computed } from "vue";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
|
+
import { pick } from "../utils";
|
|
9
10
|
import { cv, merge } from "../utils/style";
|
|
10
11
|
const props = defineProps({
|
|
11
12
|
as: { type: null, required: false },
|
|
@@ -19,50 +20,50 @@ const slots = defineSlots();
|
|
|
19
20
|
const appConfig = useAppConfig();
|
|
20
21
|
const ui = computed(() => {
|
|
21
22
|
const styler = cv(merge(theme, appConfig.ui.card));
|
|
22
|
-
return styler(props);
|
|
23
|
+
return styler(pick(props, ["variant"]));
|
|
23
24
|
});
|
|
24
25
|
</script>
|
|
25
26
|
|
|
26
27
|
<template>
|
|
27
|
-
<Primitive :as="props.as" :class="ui.root({ class: [props.class, props.ui?.root] })" data-part="root">
|
|
28
|
-
<slot name="content">
|
|
29
|
-
<div
|
|
30
|
-
v-if="slots.header || props.title || slots.title || props.description || slots.description"
|
|
31
|
-
:class="ui.header({ class: props.ui?.header })"
|
|
32
|
-
data-part="header"
|
|
33
|
-
>
|
|
34
|
-
<slot name="header">
|
|
35
|
-
<Primitive
|
|
36
|
-
v-if="props.title || slots.title"
|
|
37
|
-
:as="!!slots.title ? void 0 : 'h2'"
|
|
38
|
-
:class="ui.title({ class: props.ui?.title })"
|
|
39
|
-
data-part="title"
|
|
40
|
-
>
|
|
41
|
-
<slot name="title">
|
|
42
|
-
{{ props.title }}
|
|
43
|
-
</slot>
|
|
44
|
-
</Primitive>
|
|
45
|
-
<Primitive
|
|
46
|
-
v-if="props.description || slots.description"
|
|
47
|
-
:as="!!slots.description ? void 0 : 'p'"
|
|
48
|
-
:as-child="!!slots.description"
|
|
49
|
-
:class="ui.description({ class: props.ui?.description })"
|
|
50
|
-
data-part="description"
|
|
51
|
-
>
|
|
52
|
-
<slot name="description">
|
|
53
|
-
{{ props.description }}
|
|
54
|
-
</slot>
|
|
55
|
-
</Primitive>
|
|
56
|
-
</slot>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div v-if="!!slots.default" :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
60
|
-
<slot></slot>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })" data-part="footer">
|
|
64
|
-
<slot name="footer"></slot>
|
|
65
|
-
</div>
|
|
66
|
-
</slot>
|
|
67
|
-
</Primitive>
|
|
28
|
+
<Primitive :as="props.as" :class="ui.root({ class: [props.class, props.ui?.root] })" data-part="root">
|
|
29
|
+
<slot name="content">
|
|
30
|
+
<div
|
|
31
|
+
v-if="slots.header || props.title || slots.title || props.description || slots.description"
|
|
32
|
+
:class="ui.header({ class: props.ui?.header })"
|
|
33
|
+
data-part="header"
|
|
34
|
+
>
|
|
35
|
+
<slot name="header">
|
|
36
|
+
<Primitive
|
|
37
|
+
v-if="props.title || slots.title"
|
|
38
|
+
:as="!!slots.title ? void 0 : 'h2'"
|
|
39
|
+
:class="ui.title({ class: props.ui?.title })"
|
|
40
|
+
data-part="title"
|
|
41
|
+
>
|
|
42
|
+
<slot name="title">
|
|
43
|
+
{{ props.title }}
|
|
44
|
+
</slot>
|
|
45
|
+
</Primitive>
|
|
46
|
+
<Primitive
|
|
47
|
+
v-if="props.description || slots.description"
|
|
48
|
+
:as="!!slots.description ? void 0 : 'p'"
|
|
49
|
+
:as-child="!!slots.description"
|
|
50
|
+
:class="ui.description({ class: props.ui?.description })"
|
|
51
|
+
data-part="description"
|
|
52
|
+
>
|
|
53
|
+
<slot name="description">
|
|
54
|
+
{{ props.description }}
|
|
55
|
+
</slot>
|
|
56
|
+
</Primitive>
|
|
57
|
+
</slot>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div v-if="!!slots.default" :class="ui.body({ class: props.ui?.body })" data-part="body">
|
|
61
|
+
<slot></slot>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })" data-part="footer">
|
|
65
|
+
<slot name="footer"></slot>
|
|
66
|
+
</div>
|
|
67
|
+
</slot>
|
|
68
|
+
</Primitive>
|
|
68
69
|
</template>
|