@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
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Yuurin<https://github.com/byyuurin>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Yuurin<https://github.com/byyuurin>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
|
-
import { v as version, n as name, a as addTemplates } from './shared/ui.
|
|
4
|
-
import { d as defaultOptions, r as resolveColors, g as getDefaultUIConfig } from './shared/ui.
|
|
3
|
+
import { v as version, n as name, a as addTemplates } from './shared/ui.DcEKQd0n.mjs';
|
|
4
|
+
import { d as defaultOptions, r as resolveColors, g as getDefaultUIConfig } from './shared/ui.DYMXCXO6.mjs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import '@unocss/config';
|
|
@@ -7,7 +7,7 @@ import { reactivePick } from "@vueuse/core";
|
|
|
7
7
|
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { computed } from "vue";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
|
-
import { get } from "../utils";
|
|
10
|
+
import { get, pick } from "../utils";
|
|
11
11
|
import { cv, merge } from "../utils/style";
|
|
12
12
|
import Icon from "./Icon.vue";
|
|
13
13
|
const props = defineProps({
|
|
@@ -30,52 +30,52 @@ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "collapsible",
|
|
|
30
30
|
const appConfig = useAppConfig();
|
|
31
31
|
const ui = computed(() => {
|
|
32
32
|
const styler = cv(merge(theme, appConfig.ui.accordion));
|
|
33
|
-
return styler(props);
|
|
33
|
+
return styler(pick(props, ["disabled"]));
|
|
34
34
|
});
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<template>
|
|
38
|
-
<AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
39
|
-
<AccordionItem
|
|
40
|
-
v-for="(item, index) in props.items"
|
|
41
|
-
v-slot="{ open }"
|
|
42
|
-
:key="index"
|
|
43
|
-
:value="item.value || String(index)"
|
|
44
|
-
:disabled="item.disabled"
|
|
45
|
-
:class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
|
|
46
|
-
data-part="item"
|
|
47
|
-
>
|
|
48
|
-
<AccordionHeader as="div" :class="ui.header({ class: [props.ui?.header, item.ui?.header] })" data-part="header">
|
|
49
|
-
<AccordionTrigger :class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger], disabled: item.disabled })" data-part="trigger">
|
|
50
|
-
<slot name="leading" v-bind="{ item, index, open, ui }">
|
|
51
|
-
<Icon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" data-part="leadingIcon" />
|
|
52
|
-
</slot>
|
|
53
|
-
|
|
54
|
-
<span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })" data-part="label">
|
|
55
|
-
<slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
|
|
56
|
-
</span>
|
|
57
|
-
|
|
58
|
-
<slot name="trailing" v-bind="{ item, index, open, ui }">
|
|
59
|
-
<Icon :name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.trailingIcon({ class: [props.ui?.trailingIcon, item.ui?.trailingIcon] })" data-part="trailingIcon" />
|
|
60
|
-
</slot>
|
|
61
|
-
</AccordionTrigger>
|
|
62
|
-
</AccordionHeader>
|
|
63
|
-
|
|
64
|
-
<AccordionContent
|
|
65
|
-
v-if="item.content || !!slots.content || item.slot && slots[item.slot] || !!slots.body || item.slot && slots[`${item.slot}-body`]"
|
|
66
|
-
:class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
|
|
67
|
-
data-part="content"
|
|
68
|
-
>
|
|
69
|
-
<slot :name="item.slot || 'content'" :item="item" :index="index" :open="open" :ui="ui">
|
|
70
|
-
<div :class="ui.body({ class: [props.ui?.body, item.ui?.body] })" data-part="body">
|
|
71
|
-
<slot :name="item.slot ? `${item.slot}-body` : 'body'" :item="item" :index="index" :open="open" :ui="ui">
|
|
72
|
-
{{ item.content }}
|
|
73
|
-
</slot>
|
|
74
|
-
</div>
|
|
75
|
-
</slot>
|
|
76
|
-
</AccordionContent>
|
|
77
|
-
</AccordionItem>
|
|
78
|
-
</AccordionRoot>
|
|
38
|
+
<AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
39
|
+
<AccordionItem
|
|
40
|
+
v-for="(item, index) in props.items"
|
|
41
|
+
v-slot="{ open }"
|
|
42
|
+
:key="index"
|
|
43
|
+
:value="item.value || String(index)"
|
|
44
|
+
:disabled="item.disabled"
|
|
45
|
+
:class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
|
|
46
|
+
data-part="item"
|
|
47
|
+
>
|
|
48
|
+
<AccordionHeader as="div" :class="ui.header({ class: [props.ui?.header, item.ui?.header] })" data-part="header">
|
|
49
|
+
<AccordionTrigger :class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger], disabled: item.disabled })" data-part="trigger">
|
|
50
|
+
<slot name="leading" v-bind="{ item, index, open, ui }">
|
|
51
|
+
<Icon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" data-part="leadingIcon" />
|
|
52
|
+
</slot>
|
|
53
|
+
|
|
54
|
+
<span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })" data-part="label">
|
|
55
|
+
<slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
|
|
56
|
+
</span>
|
|
57
|
+
|
|
58
|
+
<slot name="trailing" v-bind="{ item, index, open, ui }">
|
|
59
|
+
<Icon :name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.trailingIcon({ class: [props.ui?.trailingIcon, item.ui?.trailingIcon] })" data-part="trailingIcon" />
|
|
60
|
+
</slot>
|
|
61
|
+
</AccordionTrigger>
|
|
62
|
+
</AccordionHeader>
|
|
63
|
+
|
|
64
|
+
<AccordionContent
|
|
65
|
+
v-if="item.content || !!slots.content || item.slot && slots[item.slot] || !!slots.body || item.slot && slots[`${item.slot}-body`]"
|
|
66
|
+
:class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
|
|
67
|
+
data-part="content"
|
|
68
|
+
>
|
|
69
|
+
<slot :name="item.slot || 'content'" :item="item" :index="index" :open="open" :ui="ui">
|
|
70
|
+
<div :class="ui.body({ class: [props.ui?.body, item.ui?.body] })" data-part="body">
|
|
71
|
+
<slot :name="item.slot ? `${item.slot}-body` : 'body'" :item="item" :index="index" :open="open" :ui="ui">
|
|
72
|
+
{{ item.content }}
|
|
73
|
+
</slot>
|
|
74
|
+
</div>
|
|
75
|
+
</slot>
|
|
76
|
+
</AccordionContent>
|
|
77
|
+
</AccordionItem>
|
|
78
|
+
</AccordionRoot>
|
|
79
79
|
</template>
|
|
80
80
|
|
|
81
81
|
<style>
|
|
@@ -7,6 +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 { pick } from "../utils";
|
|
10
11
|
import { cv, merge } from "../utils/style";
|
|
11
12
|
import Avatar from "./Avatar.vue";
|
|
12
13
|
import Button from "./Button.vue";
|
|
@@ -33,74 +34,74 @@ const appConfig = useAppConfig();
|
|
|
33
34
|
const ui = computed(() => {
|
|
34
35
|
const styler = cv(merge(theme, appConfig.ui.alert));
|
|
35
36
|
return styler({
|
|
36
|
-
...props,
|
|
37
|
+
...pick(props, ["color", "variant", "orientation"]),
|
|
37
38
|
title: !!props.title || !!slots.title
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
</script>
|
|
41
42
|
|
|
42
43
|
<template>
|
|
43
|
-
<Primitive
|
|
44
|
-
:as="props.as"
|
|
45
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
46
|
-
:data-orientation="props.orientation"
|
|
47
|
-
data-part="root"
|
|
48
|
-
>
|
|
49
|
-
<slot name="leading" :ui="ui">
|
|
50
|
-
<Avatar
|
|
51
|
-
v-if="props.avatar"
|
|
52
|
-
:size="props.ui?.avatarSize || ui.avatarSize()"
|
|
53
|
-
v-bind="props.avatar"
|
|
54
|
-
:class="ui.avatar({ class: props.ui?.avatar })"
|
|
55
|
-
data-part="avatar"
|
|
56
|
-
/>
|
|
57
|
-
<Icon
|
|
58
|
-
v-else-if="props.icon"
|
|
59
|
-
:name="props.icon"
|
|
60
|
-
:class="ui.icon({ class: props.ui?.icon })"
|
|
61
|
-
data-part="icon"
|
|
62
|
-
/>
|
|
63
|
-
</slot>
|
|
64
|
-
|
|
65
|
-
<div :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
66
|
-
<div v-if="props.title || slots.title" :class="ui.title({ class: props.ui?.title })" data-part="title">
|
|
67
|
-
<slot name="title">
|
|
68
|
-
{{ props.title }}
|
|
69
|
-
</slot>
|
|
70
|
-
</div>
|
|
71
|
-
<div v-if="props.description || slots.description" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
72
|
-
<slot name="description">
|
|
73
|
-
{{ props.description }}
|
|
74
|
-
</slot>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<div v-if="props.orientation === 'vertical' && (props.actions?.length || slots.actions)" :class="ui.actions({ class: props.ui?.actions })" data-part="actions">
|
|
78
|
-
<slot name="actions">
|
|
79
|
-
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
80
|
-
</slot>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div v-if="props.orientation === 'horizontal' && (props.actions?.length || slots.actions) || props.close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })" data-part="actions">
|
|
85
|
-
<template v-if="props.orientation === 'horizontal' && (props.actions?.length || slots.actions)">
|
|
86
|
-
<slot name="actions">
|
|
87
|
-
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
88
|
-
</slot>
|
|
89
|
-
</template>
|
|
90
|
-
|
|
91
|
-
<slot name="close" :ui="ui">
|
|
92
|
-
<Button
|
|
93
|
-
v-if="props.close"
|
|
94
|
-
:icon="props.closeIcon || appConfig.ui.icons.close"
|
|
95
|
-
color="neutral"
|
|
96
|
-
variant="link"
|
|
97
|
-
:aria-label="t('alert.close')"
|
|
98
|
-
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
99
|
-
:class="ui.close({ class: props.ui?.close })"
|
|
100
|
-
data-part="close"
|
|
101
|
-
@click="emit('update:open', false)"
|
|
102
|
-
/>
|
|
103
|
-
</slot>
|
|
104
|
-
</div>
|
|
105
|
-
</Primitive>
|
|
44
|
+
<Primitive
|
|
45
|
+
:as="props.as"
|
|
46
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
47
|
+
:data-orientation="props.orientation"
|
|
48
|
+
data-part="root"
|
|
49
|
+
>
|
|
50
|
+
<slot name="leading" :ui="ui">
|
|
51
|
+
<Avatar
|
|
52
|
+
v-if="props.avatar"
|
|
53
|
+
:size="props.ui?.avatarSize || ui.avatarSize()"
|
|
54
|
+
v-bind="props.avatar"
|
|
55
|
+
:class="ui.avatar({ class: props.ui?.avatar })"
|
|
56
|
+
data-part="avatar"
|
|
57
|
+
/>
|
|
58
|
+
<Icon
|
|
59
|
+
v-else-if="props.icon"
|
|
60
|
+
:name="props.icon"
|
|
61
|
+
:class="ui.icon({ class: props.ui?.icon })"
|
|
62
|
+
data-part="icon"
|
|
63
|
+
/>
|
|
64
|
+
</slot>
|
|
65
|
+
|
|
66
|
+
<div :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
67
|
+
<div v-if="props.title || slots.title" :class="ui.title({ class: props.ui?.title })" data-part="title">
|
|
68
|
+
<slot name="title">
|
|
69
|
+
{{ props.title }}
|
|
70
|
+
</slot>
|
|
71
|
+
</div>
|
|
72
|
+
<div v-if="props.description || slots.description" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
73
|
+
<slot name="description">
|
|
74
|
+
{{ props.description }}
|
|
75
|
+
</slot>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div v-if="props.orientation === 'vertical' && (props.actions?.length || slots.actions)" :class="ui.actions({ class: props.ui?.actions })" data-part="actions">
|
|
79
|
+
<slot name="actions">
|
|
80
|
+
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
81
|
+
</slot>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div v-if="props.orientation === 'horizontal' && (props.actions?.length || slots.actions) || props.close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })" data-part="actions">
|
|
86
|
+
<template v-if="props.orientation === 'horizontal' && (props.actions?.length || slots.actions)">
|
|
87
|
+
<slot name="actions">
|
|
88
|
+
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
89
|
+
</slot>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<slot name="close" :ui="ui">
|
|
93
|
+
<Button
|
|
94
|
+
v-if="props.close"
|
|
95
|
+
:icon="props.closeIcon || appConfig.ui.icons.close"
|
|
96
|
+
color="neutral"
|
|
97
|
+
variant="link"
|
|
98
|
+
:aria-label="t('alert.close')"
|
|
99
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
100
|
+
:class="ui.close({ class: props.ui?.close })"
|
|
101
|
+
data-part="close"
|
|
102
|
+
@click="emit('update:open', false)"
|
|
103
|
+
/>
|
|
104
|
+
</slot>
|
|
105
|
+
</div>
|
|
106
|
+
</Primitive>
|
|
106
107
|
</template>
|
|
@@ -30,14 +30,14 @@ providePortalTarget(portal);
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<template>
|
|
33
|
-
<ConfigProvider :use-id="() => useId()" :dir="props.dir || locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
34
|
-
<TooltipProvider v-bind="tooltipProps">
|
|
35
|
-
<ToastProvider v-if="props.toaster !== null" v-bind="toastProviderProps">
|
|
36
|
-
<slot></slot>
|
|
37
|
-
</ToastProvider>
|
|
38
|
-
<slot v-else></slot>
|
|
39
|
-
|
|
40
|
-
<OverlayProvider />
|
|
41
|
-
</TooltipProvider>
|
|
42
|
-
</ConfigProvider>
|
|
33
|
+
<ConfigProvider :use-id="() => useId()" :dir="props.dir || locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
34
|
+
<TooltipProvider v-bind="tooltipProps">
|
|
35
|
+
<ToastProvider v-if="props.toaster !== null" v-bind="toastProviderProps">
|
|
36
|
+
<slot></slot>
|
|
37
|
+
</ToastProvider>
|
|
38
|
+
<slot v-else></slot>
|
|
39
|
+
|
|
40
|
+
<OverlayProvider />
|
|
41
|
+
</TooltipProvider>
|
|
42
|
+
</ConfigProvider>
|
|
43
43
|
</template>
|
|
@@ -9,6 +9,7 @@ import { computed, shallowRef, watch } from "vue";
|
|
|
9
9
|
import ImageComponent from "#build/ui-image-component";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useAvatarGroup } from "../composables/useAvatarGroup";
|
|
12
|
+
import { pick } from "../utils";
|
|
12
13
|
import { cv, merge } from "../utils/style";
|
|
13
14
|
import Chip from "./Chip.vue";
|
|
14
15
|
import Icon from "./Icon.vue";
|
|
@@ -36,7 +37,7 @@ const appConfig = useAppConfig();
|
|
|
36
37
|
const ui = computed(() => {
|
|
37
38
|
const styler = cv(merge(theme, appConfig.ui.avatar));
|
|
38
39
|
return styler({
|
|
39
|
-
...props,
|
|
40
|
+
...pick(props, []),
|
|
40
41
|
size: size.value
|
|
41
42
|
});
|
|
42
43
|
});
|
|
@@ -62,33 +63,33 @@ function onError() {
|
|
|
62
63
|
</script>
|
|
63
64
|
|
|
64
65
|
<template>
|
|
65
|
-
<component
|
|
66
|
-
:is="props.chip ? Chip : Primitive"
|
|
67
|
-
:as="as.root"
|
|
68
|
-
v-bind="props.chip ? typeof props.chip === 'object' ? { inset: true, ...props.chip } : { inset: true } : {}"
|
|
69
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
70
|
-
data-part="root"
|
|
71
|
-
:style="props.style"
|
|
72
|
-
>
|
|
73
|
-
<component
|
|
74
|
-
:is="as.img || ImageComponent"
|
|
75
|
-
v-if="props.src && !error"
|
|
76
|
-
:src="props.src"
|
|
77
|
-
:alt="props.alt"
|
|
78
|
-
:width="sizePx"
|
|
79
|
-
:height="sizePx"
|
|
80
|
-
v-bind="$attrs"
|
|
81
|
-
:class="ui.image({ class: props.ui?.image })"
|
|
82
|
-
data-part="image"
|
|
83
|
-
@error="onError"
|
|
84
|
-
/>
|
|
85
|
-
|
|
86
|
-
<slot v-else v-bind="$attrs">
|
|
87
|
-
<Icon v-if="props.icon" :name="props.icon" :class="ui.icon({ class: props.ui?.icon })" data-part="icon" />
|
|
88
|
-
<span v-else :class="ui.fallback({ class: props.ui?.fallback })" data-part="fallback">
|
|
89
|
-
<template v-if="fallback">{{ fallback }}</template>
|
|
90
|
-
<template v-else> </template>
|
|
91
|
-
</span>
|
|
92
|
-
</slot>
|
|
93
|
-
</component>
|
|
66
|
+
<component
|
|
67
|
+
:is="props.chip ? Chip : Primitive"
|
|
68
|
+
:as="as.root"
|
|
69
|
+
v-bind="props.chip ? typeof props.chip === 'object' ? { inset: true, ...props.chip } : { inset: true } : {}"
|
|
70
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
71
|
+
data-part="root"
|
|
72
|
+
:style="props.style"
|
|
73
|
+
>
|
|
74
|
+
<component
|
|
75
|
+
:is="as.img || ImageComponent"
|
|
76
|
+
v-if="props.src && !error"
|
|
77
|
+
:src="props.src"
|
|
78
|
+
:alt="props.alt"
|
|
79
|
+
:width="sizePx"
|
|
80
|
+
:height="sizePx"
|
|
81
|
+
v-bind="$attrs"
|
|
82
|
+
:class="ui.image({ class: props.ui?.image })"
|
|
83
|
+
data-part="image"
|
|
84
|
+
@error="onError"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<slot v-else v-bind="$attrs">
|
|
88
|
+
<Icon v-if="props.icon" :name="props.icon" :class="ui.icon({ class: props.ui?.icon })" data-part="icon" />
|
|
89
|
+
<span v-else :class="ui.fallback({ class: props.ui?.fallback })" data-part="fallback">
|
|
90
|
+
<template v-if="fallback">{{ fallback }}</template>
|
|
91
|
+
<template v-else> </template>
|
|
92
|
+
</span>
|
|
93
|
+
</slot>
|
|
94
|
+
</component>
|
|
94
95
|
</template>
|
|
@@ -7,6 +7,7 @@ import { Primitive } from "reka-ui";
|
|
|
7
7
|
import { computed } from "vue";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import { provideAvatarGroup } from "../composables/useAvatarGroup";
|
|
10
|
+
import { pick } from "../utils";
|
|
10
11
|
import { cv, merge } from "../utils/style";
|
|
11
12
|
import Avatar from "./Avatar.vue";
|
|
12
13
|
const props = defineProps({
|
|
@@ -47,14 +48,14 @@ const hiddenCount = computed(() => {
|
|
|
47
48
|
const appConfig = useAppConfig();
|
|
48
49
|
const ui = computed(() => {
|
|
49
50
|
const styler = cv(merge(theme, appConfig.ui.avatarGroup));
|
|
50
|
-
return styler(props);
|
|
51
|
+
return styler(pick(props, ["size"]));
|
|
51
52
|
});
|
|
52
53
|
provideAvatarGroup(computed(() => props));
|
|
53
54
|
</script>
|
|
54
55
|
|
|
55
56
|
<template>
|
|
56
|
-
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
57
|
-
<Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" data-part="base" />
|
|
58
|
-
<component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="ui.base({ class: props.ui?.base })" data-part="base" />
|
|
59
|
-
</Primitive>
|
|
57
|
+
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
58
|
+
<Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" data-part="base" />
|
|
59
|
+
<component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="ui.base({ class: props.ui?.base })" data-part="base" />
|
|
60
|
+
</Primitive>
|
|
60
61
|
</template>
|
|
@@ -8,6 +8,7 @@ import { computed } from "vue";
|
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
10
10
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
11
|
+
import { pick } from "../utils";
|
|
11
12
|
import { cv, merge } from "../utils/style";
|
|
12
13
|
import Avatar from "./Avatar.vue";
|
|
13
14
|
import Icon from "./Icon.vue";
|
|
@@ -34,45 +35,45 @@ const appConfig = useAppConfig();
|
|
|
34
35
|
const ui = computed(() => {
|
|
35
36
|
const styler = cv(merge(theme, appConfig.ui.badge));
|
|
36
37
|
return styler({
|
|
37
|
-
...props,
|
|
38
|
+
...pick(props, ["color", "variant"]),
|
|
38
39
|
size: size.value,
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
square: props.square || !slots.default && !props.label,
|
|
41
|
+
fieldGroup: orientation.value
|
|
41
42
|
});
|
|
42
43
|
});
|
|
43
44
|
</script>
|
|
44
45
|
|
|
45
46
|
<template>
|
|
46
|
-
<Primitive :as="props.as" :class="ui.base({ class: [props.ui?.base, props.class] })" data-part="base">
|
|
47
|
-
<slot name="leading" :ui="ui">
|
|
48
|
-
<Icon
|
|
49
|
-
v-if="isLeading && leadingIconName"
|
|
50
|
-
:name="leadingIconName"
|
|
51
|
-
:class="ui.leadingIcon({ class: props.ui?.leadingIcon })"
|
|
52
|
-
data-part="leadingIcon"
|
|
53
|
-
/>
|
|
54
|
-
<Avatar
|
|
55
|
-
v-else-if="props.avatar"
|
|
56
|
-
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
57
|
-
v-bind="props.avatar"
|
|
58
|
-
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })"
|
|
59
|
-
data-part="leadingAvatar"
|
|
60
|
-
/>
|
|
61
|
-
</slot>
|
|
62
|
-
|
|
63
|
-
<slot :ui="ui">
|
|
64
|
-
<span v-if="props.label" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
65
|
-
{{ props.label }}
|
|
66
|
-
</span>
|
|
67
|
-
</slot>
|
|
68
|
-
|
|
69
|
-
<slot name="trailing" :ui="ui">
|
|
70
|
-
<Icon
|
|
71
|
-
v-if="isTrailing && trailingIconName"
|
|
72
|
-
:name="trailingIconName"
|
|
73
|
-
:class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
|
|
74
|
-
data-part="trailingIcon"
|
|
75
|
-
/>
|
|
76
|
-
</slot>
|
|
77
|
-
</Primitive>
|
|
47
|
+
<Primitive :as="props.as" :class="ui.base({ class: [props.ui?.base, props.class] })" data-part="base">
|
|
48
|
+
<slot name="leading" :ui="ui">
|
|
49
|
+
<Icon
|
|
50
|
+
v-if="isLeading && leadingIconName"
|
|
51
|
+
:name="leadingIconName"
|
|
52
|
+
:class="ui.leadingIcon({ class: props.ui?.leadingIcon })"
|
|
53
|
+
data-part="leadingIcon"
|
|
54
|
+
/>
|
|
55
|
+
<Avatar
|
|
56
|
+
v-else-if="props.avatar"
|
|
57
|
+
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
58
|
+
v-bind="props.avatar"
|
|
59
|
+
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })"
|
|
60
|
+
data-part="leadingAvatar"
|
|
61
|
+
/>
|
|
62
|
+
</slot>
|
|
63
|
+
|
|
64
|
+
<slot :ui="ui">
|
|
65
|
+
<span v-if="props.label" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
66
|
+
{{ props.label }}
|
|
67
|
+
</span>
|
|
68
|
+
</slot>
|
|
69
|
+
|
|
70
|
+
<slot name="trailing" :ui="ui">
|
|
71
|
+
<Icon
|
|
72
|
+
v-if="isTrailing && trailingIconName"
|
|
73
|
+
:name="trailingIconName"
|
|
74
|
+
:class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
|
|
75
|
+
data-part="trailingIcon"
|
|
76
|
+
/>
|
|
77
|
+
</slot>
|
|
78
|
+
</Primitive>
|
|
78
79
|
</template>
|