@vifui/core 0.4.0-alpha.6
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 +204 -0
- package/dist/components/accordion/accordion-body.vue.d.ts +29 -0
- package/dist/components/accordion/accordion-body.vue.js +27 -0
- package/dist/components/accordion/accordion-body.vue2.js +5 -0
- package/dist/components/accordion/accordion-content.vue.d.ts +29 -0
- package/dist/components/accordion/accordion-content.vue.js +26 -0
- package/dist/components/accordion/accordion-content.vue2.js +5 -0
- package/dist/components/accordion/accordion-header.vue.d.ts +30 -0
- package/dist/components/accordion/accordion-header.vue.js +28 -0
- package/dist/components/accordion/accordion-header.vue2.js +5 -0
- package/dist/components/accordion/accordion-indicator.vue.d.ts +32 -0
- package/dist/components/accordion/accordion-indicator.vue.js +22 -0
- package/dist/components/accordion/accordion-indicator.vue2.js +5 -0
- package/dist/components/accordion/accordion-item.vue.d.ts +54 -0
- package/dist/components/accordion/accordion-item.vue.js +30 -0
- package/dist/components/accordion/accordion-item.vue2.js +5 -0
- package/dist/components/accordion/accordion-root.vue.d.ts +94 -0
- package/dist/components/accordion/accordion-root.vue.js +55 -0
- package/dist/components/accordion/accordion-root.vue2.js +5 -0
- package/dist/components/accordion/accordion-trigger.vue.d.ts +44 -0
- package/dist/components/accordion/accordion-trigger.vue.js +30 -0
- package/dist/components/accordion/accordion-trigger.vue2.js +5 -0
- package/dist/components/accordion/accordion.styles.d.ts +99 -0
- package/dist/components/accordion/accordion.styles.js +42 -0
- package/dist/components/accordion/index.d.ts +15 -0
- package/dist/components/accordion/index.js +8 -0
- package/dist/components/alert/alert-body.vue.d.ts +16 -0
- package/dist/components/alert/alert-body.vue.js +54 -0
- package/dist/components/alert/alert-body.vue2.js +5 -0
- package/dist/components/alert/alert-close.vue.d.ts +12 -0
- package/dist/components/alert/alert-close.vue.js +38 -0
- package/dist/components/alert/alert-close.vue2.js +5 -0
- package/dist/components/alert/alert-content.vue.d.ts +28 -0
- package/dist/components/alert/alert-content.vue.js +54 -0
- package/dist/components/alert/alert-content.vue2.js +5 -0
- package/dist/components/alert/alert-description.vue.d.ts +16 -0
- package/dist/components/alert/alert-description.vue.js +41 -0
- package/dist/components/alert/alert-description.vue2.js +5 -0
- package/dist/components/alert/alert-footer.vue.d.ts +16 -0
- package/dist/components/alert/alert-footer.vue.js +54 -0
- package/dist/components/alert/alert-footer.vue2.js +5 -0
- package/dist/components/alert/alert-header.vue.d.ts +16 -0
- package/dist/components/alert/alert-header.vue.js +54 -0
- package/dist/components/alert/alert-header.vue2.js +5 -0
- package/dist/components/alert/alert-icon.vue.d.ts +8 -0
- package/dist/components/alert/alert-icon.vue.js +43 -0
- package/dist/components/alert/alert-icon.vue2.js +5 -0
- package/dist/components/alert/alert-root.vue.d.ts +48 -0
- package/dist/components/alert/alert-root.vue.js +57 -0
- package/dist/components/alert/alert-root.vue2.js +5 -0
- package/dist/components/alert/alert-title.vue.d.ts +16 -0
- package/dist/components/alert/alert-title.vue.js +41 -0
- package/dist/components/alert/alert-title.vue2.js +5 -0
- package/dist/components/alert/alert.styles.d.ts +96 -0
- package/dist/components/alert/alert.styles.js +147 -0
- package/dist/components/alert/index.d.ts +19 -0
- package/dist/components/alert/index.js +10 -0
- package/dist/components/avatar/avatar-fallback.vue.d.ts +14 -0
- package/dist/components/avatar/avatar-fallback.vue.js +35 -0
- package/dist/components/avatar/avatar-fallback.vue2.js +5 -0
- package/dist/components/avatar/avatar-group.vue.d.ts +20 -0
- package/dist/components/avatar/avatar-group.vue.js +101 -0
- package/dist/components/avatar/avatar-group.vue2.js +5 -0
- package/dist/components/avatar/avatar-image.vue.d.ts +14 -0
- package/dist/components/avatar/avatar-image.vue.js +37 -0
- package/dist/components/avatar/avatar-image.vue2.js +5 -0
- package/dist/components/avatar/avatar-root.vue.d.ts +57 -0
- package/dist/components/avatar/avatar-root.vue.js +102 -0
- package/dist/components/avatar/avatar-root.vue2.js +5 -0
- package/dist/components/avatar/avatar.styles.d.ts +209 -0
- package/dist/components/avatar/avatar.styles.js +50 -0
- package/dist/components/avatar/index.d.ts +9 -0
- package/dist/components/avatar/index.js +5 -0
- package/dist/components/badge/badge.styles.d.ts +87 -0
- package/dist/components/badge/badge.styles.js +41 -0
- package/dist/components/badge/badge.vue.d.ts +116 -0
- package/dist/components/badge/badge.vue.js +79 -0
- package/dist/components/badge/badge.vue2.js +5 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/breadcrumb-current-link.vue.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb-current-link.vue.js +28 -0
- package/dist/components/breadcrumb/breadcrumb-current-link.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb-item.vue.d.ts +28 -0
- package/dist/components/breadcrumb/breadcrumb-item.vue.js +27 -0
- package/dist/components/breadcrumb/breadcrumb-item.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb-link.vue.d.ts +53 -0
- package/dist/components/breadcrumb/breadcrumb-link.vue.js +30 -0
- package/dist/components/breadcrumb/breadcrumb-link.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb-list.vue.d.ts +28 -0
- package/dist/components/breadcrumb/breadcrumb-list.vue.js +27 -0
- package/dist/components/breadcrumb/breadcrumb-list.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb-root.vue.d.ts +78 -0
- package/dist/components/breadcrumb/breadcrumb-root.vue.js +39 -0
- package/dist/components/breadcrumb/breadcrumb-root.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb-separator.vue.d.ts +41 -0
- package/dist/components/breadcrumb/breadcrumb-separator.vue.js +32 -0
- package/dist/components/breadcrumb/breadcrumb-separator.vue2.js +5 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +144 -0
- package/dist/components/breadcrumb/breadcrumb.styles.js +58 -0
- package/dist/components/breadcrumb/index.d.ts +13 -0
- package/dist/components/breadcrumb/index.js +7 -0
- package/dist/components/button/button.styles.d.ts +90 -0
- package/dist/components/button/button.styles.js +41 -0
- package/dist/components/button/button.vue.d.ts +144 -0
- package/dist/components/button/button.vue.js +131 -0
- package/dist/components/button/button.vue2.js +5 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/card/card-body.vue.d.ts +29 -0
- package/dist/components/card/card-body.vue.js +27 -0
- package/dist/components/card/card-body.vue2.js +5 -0
- package/dist/components/card/card-footer.vue.d.ts +29 -0
- package/dist/components/card/card-footer.vue.js +27 -0
- package/dist/components/card/card-footer.vue2.js +5 -0
- package/dist/components/card/card-header.vue.d.ts +29 -0
- package/dist/components/card/card-header.vue.js +27 -0
- package/dist/components/card/card-header.vue2.js +5 -0
- package/dist/components/card/card-media.vue.d.ts +44 -0
- package/dist/components/card/card-media.vue.js +56 -0
- package/dist/components/card/card-media.vue2.js +5 -0
- package/dist/components/card/card-root.vue.d.ts +128 -0
- package/dist/components/card/card-root.vue.js +58 -0
- package/dist/components/card/card-root.vue2.js +5 -0
- package/dist/components/card/card.styles.d.ts +216 -0
- package/dist/components/card/card.styles.js +86 -0
- package/dist/components/card/index.d.ts +11 -0
- package/dist/components/card/index.js +6 -0
- package/dist/components/checkbox/checkbox-group-item.vue.d.ts +22 -0
- package/dist/components/checkbox/checkbox-group-item.vue.js +27 -0
- package/dist/components/checkbox/checkbox-group-item.vue2.js +5 -0
- package/dist/components/checkbox/checkbox-group.vue.d.ts +35 -0
- package/dist/components/checkbox/checkbox-group.vue.js +53 -0
- package/dist/components/checkbox/checkbox-group.vue2.js +5 -0
- package/dist/components/checkbox/checkbox-indicator.vue.d.ts +40 -0
- package/dist/components/checkbox/checkbox-indicator.vue.js +58 -0
- package/dist/components/checkbox/checkbox-indicator.vue2.js +5 -0
- package/dist/components/checkbox/checkbox-label.vue.d.ts +27 -0
- package/dist/components/checkbox/checkbox-label.vue.js +24 -0
- package/dist/components/checkbox/checkbox-label.vue2.js +5 -0
- package/dist/components/checkbox/checkbox-root.vue.d.ts +42 -0
- package/dist/components/checkbox/checkbox-root.vue.js +51 -0
- package/dist/components/checkbox/checkbox-root.vue2.js +5 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +155 -0
- package/dist/components/checkbox/checkbox.styles.js +66 -0
- package/dist/components/checkbox/index.d.ts +11 -0
- package/dist/components/checkbox/index.js +6 -0
- package/dist/components/divider/divider.styles.d.ts +93 -0
- package/dist/components/divider/divider.styles.js +43 -0
- package/dist/components/divider/divider.vue.d.ts +89 -0
- package/dist/components/divider/divider.vue.js +51 -0
- package/dist/components/divider/divider.vue2.js +5 -0
- package/dist/components/divider/index.d.ts +3 -0
- package/dist/components/divider/index.js +2 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/spinner/index.d.ts +3 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/spinner/spinner.styles.d.ts +112 -0
- package/dist/components/spinner/spinner.styles.js +47 -0
- package/dist/components/spinner/spinner.vue.d.ts +31 -0
- package/dist/components/spinner/spinner.vue.js +102 -0
- package/dist/components/spinner/spinner.vue2.js +5 -0
- package/dist/components/types/shared-types.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +54 -0
- package/package.json +94 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot } from 'vue';
|
|
2
|
+
import { useForwardProps, AvatarFallback } from 'reka-ui';
|
|
3
|
+
import { avatarVariants } from './avatar.styles.js';
|
|
4
|
+
|
|
5
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "avatar-fallback",
|
|
7
|
+
props: {
|
|
8
|
+
class: { type: String, required: false },
|
|
9
|
+
delayMs: { type: Number, required: false },
|
|
10
|
+
asChild: { type: Boolean, required: false },
|
|
11
|
+
as: { type: null, required: false }
|
|
12
|
+
},
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const delegatedProps = computed(() => {
|
|
16
|
+
const { class: className, ...rest } = props;
|
|
17
|
+
return rest;
|
|
18
|
+
});
|
|
19
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
20
|
+
const classes = computed(() => avatarVariants({ class: props.class }));
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(AvatarFallback)), mergeProps(unref(forwardedProps), {
|
|
23
|
+
class: classes.value.fallback()
|
|
24
|
+
}), {
|
|
25
|
+
default: withCtx(() => [
|
|
26
|
+
renderSlot(_ctx.$slots, "default")
|
|
27
|
+
]),
|
|
28
|
+
_: 3
|
|
29
|
+
/* FORWARDED */
|
|
30
|
+
}, 16, ["class"]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type PrimitiveProps } from "reka-ui";
|
|
2
|
+
import { type Slot } from "vue";
|
|
3
|
+
export interface AvatarGroupProps extends PrimitiveProps {
|
|
4
|
+
class?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Limits the number of avatars displayed The rest is displayed as an `+n` avatar
|
|
7
|
+
*/
|
|
8
|
+
max?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AvatarGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarGroupProps> & Readonly<{}>, {
|
|
11
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
13
|
+
default: Slot;
|
|
14
|
+
}>;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { defineComponent, computed, useSlots, onMounted, createBlock, openBlock, unref, mergeProps, withCtx, createElementBlock, createCommentVNode, Fragment, renderList, resolveDynamicComponent, createVNode, createTextVNode, toDisplayString } from 'vue';
|
|
2
|
+
import { useForwardProps, Primitive } from 'reka-ui';
|
|
3
|
+
import { avatarGroupVariants } from './avatar.styles.js';
|
|
4
|
+
import _sfc_main$1 from './avatar-root.vue.js';
|
|
5
|
+
import _sfc_main$2 from './avatar-fallback.vue.js';
|
|
6
|
+
|
|
7
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "avatar-group",
|
|
9
|
+
props: {
|
|
10
|
+
class: { type: String, required: false },
|
|
11
|
+
max: { type: Number, required: false },
|
|
12
|
+
asChild: { type: Boolean, required: false },
|
|
13
|
+
as: { type: null, required: false, default: "div" }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const classes = computed(
|
|
18
|
+
() => avatarGroupVariants({
|
|
19
|
+
class: props.class
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
const delegatedProps = computed(() => {
|
|
23
|
+
const { class: className, max, ...rest } = props;
|
|
24
|
+
return rest;
|
|
25
|
+
});
|
|
26
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
27
|
+
const slots = useSlots();
|
|
28
|
+
const avatarChildren = computed(() => {
|
|
29
|
+
const defaultSlot = slots.default?.() ?? [];
|
|
30
|
+
return defaultSlot.filter((node) => node.type === _sfc_main$1);
|
|
31
|
+
});
|
|
32
|
+
const visibleAvatars = computed(() => {
|
|
33
|
+
if (!props.max || props.max <= 0) return avatarChildren.value;
|
|
34
|
+
return avatarChildren.value.slice(0, props.max);
|
|
35
|
+
});
|
|
36
|
+
const overflowCount = computed(() => {
|
|
37
|
+
const limit = props.max && props.max > 0 ? props.max : Number.POSITIVE_INFINITY;
|
|
38
|
+
return Math.max(0, avatarChildren.value.length - limit);
|
|
39
|
+
});
|
|
40
|
+
const overflowAvatarProps = computed(() => {
|
|
41
|
+
const hiddenAvatars = avatarChildren.value.slice(props.max);
|
|
42
|
+
if (hiddenAvatars.length === 0) return {};
|
|
43
|
+
return hiddenAvatars[0]?.props ?? {};
|
|
44
|
+
});
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
if (props.max != null && (!Number.isInteger(props.max) || props.max < 1)) {
|
|
47
|
+
console.warn(
|
|
48
|
+
`[AvatarGroup] Invalid 'max' value: ${props.max}. Must be a positive integer.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return (_ctx, _cache) => {
|
|
53
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps(unref(forwardedProps), { class: classes.value }), {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
(openBlock(true), createElementBlock(
|
|
56
|
+
Fragment,
|
|
57
|
+
null,
|
|
58
|
+
renderList(visibleAvatars.value, (avatar, index) => {
|
|
59
|
+
return openBlock(), createBlock(
|
|
60
|
+
resolveDynamicComponent(avatar),
|
|
61
|
+
mergeProps({ key: index }, { ref_for: true }, avatar.props, { "data-standalone": "false" }),
|
|
62
|
+
null,
|
|
63
|
+
16
|
|
64
|
+
/* FULL_PROPS */
|
|
65
|
+
);
|
|
66
|
+
}),
|
|
67
|
+
128
|
|
68
|
+
/* KEYED_FRAGMENT */
|
|
69
|
+
)),
|
|
70
|
+
overflowCount.value > 0 ? (openBlock(), createBlock(
|
|
71
|
+
resolveDynamicComponent(unref(_sfc_main$1)),
|
|
72
|
+
mergeProps({ key: 0 }, overflowAvatarProps.value, { "data-standalone": "false" }),
|
|
73
|
+
{
|
|
74
|
+
default: withCtx(() => [
|
|
75
|
+
createVNode(unref(_sfc_main$2), null, {
|
|
76
|
+
default: withCtx(() => [
|
|
77
|
+
createTextVNode(
|
|
78
|
+
"+" + toDisplayString(overflowCount.value),
|
|
79
|
+
1
|
|
80
|
+
/* TEXT */
|
|
81
|
+
)
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
/* STABLE */
|
|
85
|
+
})
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
/* STABLE */
|
|
89
|
+
},
|
|
90
|
+
16
|
|
91
|
+
/* FULL_PROPS */
|
|
92
|
+
)) : createCommentVNode("v-if", true)
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
/* STABLE */
|
|
96
|
+
}, 16, ["class"]);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AvatarImageProps as RekaAvatarImageProps } from "reka-ui";
|
|
2
|
+
import { type Slot } from "vue";
|
|
3
|
+
export interface AvatarImageProps extends RekaAvatarImageProps {
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AvatarImageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarImageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
7
|
+
default: Slot;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot } from 'vue';
|
|
2
|
+
import { useForwardProps, AvatarImage } from 'reka-ui';
|
|
3
|
+
import { avatarVariants } from './avatar.styles.js';
|
|
4
|
+
|
|
5
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "avatar-image",
|
|
7
|
+
props: {
|
|
8
|
+
class: { type: String, required: false },
|
|
9
|
+
src: { type: String, required: true },
|
|
10
|
+
referrerPolicy: { type: null, required: false },
|
|
11
|
+
crossOrigin: { type: null, required: false },
|
|
12
|
+
asChild: { type: Boolean, required: false },
|
|
13
|
+
as: { type: null, required: false }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const delegatedProps = computed(() => {
|
|
18
|
+
const { class: className, ...rest } = props;
|
|
19
|
+
return rest;
|
|
20
|
+
});
|
|
21
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
22
|
+
const classes = computed(() => avatarVariants({ class: props.class }));
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(AvatarImage)), mergeProps(unref(forwardedProps), {
|
|
25
|
+
class: classes.value.image()
|
|
26
|
+
}), {
|
|
27
|
+
default: withCtx(() => [
|
|
28
|
+
renderSlot(_ctx.$slots, "default")
|
|
29
|
+
]),
|
|
30
|
+
_: 3
|
|
31
|
+
/* FORWARDED */
|
|
32
|
+
}, 16, ["class"]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type AvatarRootProps as RekaAvatarRootProps } from "reka-ui";
|
|
2
|
+
import type { Sizes, Colors } from "src/components/types/shared-types";
|
|
3
|
+
import { type Slot } from "vue";
|
|
4
|
+
import { type SpinnerProps } from "../spinner";
|
|
5
|
+
export interface AvatarRootProps extends RekaAvatarRootProps {
|
|
6
|
+
/**
|
|
7
|
+
* The size of the avatar
|
|
8
|
+
* @default 'md'
|
|
9
|
+
*/
|
|
10
|
+
size?: Sizes;
|
|
11
|
+
/**
|
|
12
|
+
* The variant of the avatar
|
|
13
|
+
* @default 'flat'
|
|
14
|
+
*/
|
|
15
|
+
variant?: "flat" | "ringed";
|
|
16
|
+
class?: string;
|
|
17
|
+
/** The ring color of the avatar if `variant` prop is `ring`
|
|
18
|
+
* @default 'neutral'
|
|
19
|
+
*/
|
|
20
|
+
ringColor?: Colors;
|
|
21
|
+
/**
|
|
22
|
+
* The shape of the avatar
|
|
23
|
+
* @default 'circle'
|
|
24
|
+
*/
|
|
25
|
+
shape?: "default" | "circle" | "square";
|
|
26
|
+
/**
|
|
27
|
+
* The loading state of the avatar
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Control the spinner when `loading` prop is `true`.
|
|
33
|
+
*/
|
|
34
|
+
spinner?: SpinnerProps;
|
|
35
|
+
/**
|
|
36
|
+
* Disables the avatar, preventing interaction.
|
|
37
|
+
* Also sets `aria-disabled` for accessibility.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<AvatarRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AvatarRootProps> & Readonly<{}>, {
|
|
43
|
+
size: Sizes;
|
|
44
|
+
ringColor: Colors;
|
|
45
|
+
shape: "default" | "circle" | "square";
|
|
46
|
+
variant: "flat" | "ringed";
|
|
47
|
+
loading: boolean;
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
50
|
+
default: Slot;
|
|
51
|
+
}>;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, createBlock, openBlock, resolveDynamicComponent, unref, mergeProps, withCtx, createElementBlock, createCommentVNode, renderSlot, normalizeClass, createVNode, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
|
+
import { useForwardProps, AvatarRoot } from 'reka-ui';
|
|
3
|
+
import { avatarVariants } from './avatar.styles.js';
|
|
4
|
+
import _sfc_main$1 from '../spinner/spinner.vue.js';
|
|
5
|
+
|
|
6
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "avatar-root",
|
|
8
|
+
props: {
|
|
9
|
+
size: { type: String, required: false, default: "md" },
|
|
10
|
+
variant: { type: String, required: false, default: "flat" },
|
|
11
|
+
class: { type: String, required: false },
|
|
12
|
+
ringColor: { type: String, required: false, default: "neutral" },
|
|
13
|
+
shape: { type: String, required: false, default: "circle" },
|
|
14
|
+
loading: { type: Boolean, required: false, default: false },
|
|
15
|
+
spinner: { type: Object, required: false },
|
|
16
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
17
|
+
asChild: { type: Boolean, required: false },
|
|
18
|
+
as: { type: null, required: false }
|
|
19
|
+
},
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const delegatedProps = computed(() => {
|
|
23
|
+
const {
|
|
24
|
+
as,
|
|
25
|
+
asChild,
|
|
26
|
+
class: className,
|
|
27
|
+
size,
|
|
28
|
+
shape,
|
|
29
|
+
ringColor,
|
|
30
|
+
loading,
|
|
31
|
+
disabled,
|
|
32
|
+
variant,
|
|
33
|
+
...rest
|
|
34
|
+
} = props;
|
|
35
|
+
return rest;
|
|
36
|
+
});
|
|
37
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
38
|
+
const classes = computed(
|
|
39
|
+
() => avatarVariants({
|
|
40
|
+
size: props.size,
|
|
41
|
+
class: props.class,
|
|
42
|
+
ringColor: props.ringColor,
|
|
43
|
+
shape: props.shape,
|
|
44
|
+
loading: props.loading,
|
|
45
|
+
variant: props.variant
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
const isDisabled = computed(() => props.disabled || props.loading);
|
|
49
|
+
const loaderSize = computed(() => {
|
|
50
|
+
const sizeMap = ref({
|
|
51
|
+
xs: "xs",
|
|
52
|
+
sm: "xs",
|
|
53
|
+
md: "xs",
|
|
54
|
+
lg: "sm",
|
|
55
|
+
xl: "sm"
|
|
56
|
+
});
|
|
57
|
+
return sizeMap.value[props.size] ?? "xs";
|
|
58
|
+
});
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(AvatarRoot)), mergeProps({
|
|
61
|
+
"data-loading": __props.loading || void 0,
|
|
62
|
+
"aria-disabled": isDisabled.value
|
|
63
|
+
}, unref(forwardedProps), {
|
|
64
|
+
class: classes.value.base(),
|
|
65
|
+
"data-standalone": "true"
|
|
66
|
+
}), {
|
|
67
|
+
default: withCtx(() => [
|
|
68
|
+
__props.loading ? (openBlock(), createElementBlock(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
key: 0,
|
|
72
|
+
class: normalizeClass(classes.value.loader()),
|
|
73
|
+
"aria-hidden": "true"
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
createVNode(
|
|
77
|
+
unref(_sfc_main$1),
|
|
78
|
+
normalizeProps(guardReactiveProps({
|
|
79
|
+
...__props.spinner,
|
|
80
|
+
size: loaderSize.value
|
|
81
|
+
})),
|
|
82
|
+
null,
|
|
83
|
+
16
|
|
84
|
+
/* FULL_PROPS */
|
|
85
|
+
)
|
|
86
|
+
],
|
|
87
|
+
2
|
|
88
|
+
/* CLASS */
|
|
89
|
+
)) : createCommentVNode("v-if", true),
|
|
90
|
+
renderSlot(_ctx.$slots, "default", {
|
|
91
|
+
loading: __props.loading,
|
|
92
|
+
disabled: isDisabled.value
|
|
93
|
+
})
|
|
94
|
+
]),
|
|
95
|
+
_: 3
|
|
96
|
+
/* FORWARDED */
|
|
97
|
+
}, 16, ["data-loading", "aria-disabled", "class"]);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { VariantProps } from "tailwind-variants";
|
|
2
|
+
/**
|
|
3
|
+
* Avatar and Avatar Group component variant mapper
|
|
4
|
+
*
|
|
5
|
+
* Maps variant props to @vifui/styles CSS classes
|
|
6
|
+
* Inspired by Vuesax's avatar architecture
|
|
7
|
+
*/
|
|
8
|
+
export declare const avatarVariants: import("tailwind-variants").TVReturnType<{
|
|
9
|
+
size: {
|
|
10
|
+
xs: {
|
|
11
|
+
base: string;
|
|
12
|
+
};
|
|
13
|
+
sm: {
|
|
14
|
+
base: string;
|
|
15
|
+
};
|
|
16
|
+
md: {
|
|
17
|
+
base: string;
|
|
18
|
+
};
|
|
19
|
+
lg: {
|
|
20
|
+
base: string;
|
|
21
|
+
};
|
|
22
|
+
xl: {
|
|
23
|
+
base: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
variant: {
|
|
27
|
+
ringed: {
|
|
28
|
+
base: string;
|
|
29
|
+
};
|
|
30
|
+
flat: {
|
|
31
|
+
base: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
ringColor: {
|
|
35
|
+
brand: {
|
|
36
|
+
base: string;
|
|
37
|
+
};
|
|
38
|
+
success: {
|
|
39
|
+
base: string;
|
|
40
|
+
};
|
|
41
|
+
warning: {
|
|
42
|
+
base: string;
|
|
43
|
+
};
|
|
44
|
+
danger: {
|
|
45
|
+
base: string;
|
|
46
|
+
};
|
|
47
|
+
neutral: {
|
|
48
|
+
base: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
shape: {
|
|
52
|
+
default: {
|
|
53
|
+
base: string;
|
|
54
|
+
};
|
|
55
|
+
circle: {
|
|
56
|
+
base: string;
|
|
57
|
+
};
|
|
58
|
+
square: {
|
|
59
|
+
base: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
loading: {
|
|
63
|
+
true: {
|
|
64
|
+
base: string;
|
|
65
|
+
};
|
|
66
|
+
false: {
|
|
67
|
+
base: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
image: string;
|
|
72
|
+
fallback: string;
|
|
73
|
+
loader: string;
|
|
74
|
+
}, "vif-avatar", {
|
|
75
|
+
size: {
|
|
76
|
+
xs: {
|
|
77
|
+
base: string;
|
|
78
|
+
};
|
|
79
|
+
sm: {
|
|
80
|
+
base: string;
|
|
81
|
+
};
|
|
82
|
+
md: {
|
|
83
|
+
base: string;
|
|
84
|
+
};
|
|
85
|
+
lg: {
|
|
86
|
+
base: string;
|
|
87
|
+
};
|
|
88
|
+
xl: {
|
|
89
|
+
base: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
variant: {
|
|
93
|
+
ringed: {
|
|
94
|
+
base: string;
|
|
95
|
+
};
|
|
96
|
+
flat: {
|
|
97
|
+
base: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
ringColor: {
|
|
101
|
+
brand: {
|
|
102
|
+
base: string;
|
|
103
|
+
};
|
|
104
|
+
success: {
|
|
105
|
+
base: string;
|
|
106
|
+
};
|
|
107
|
+
warning: {
|
|
108
|
+
base: string;
|
|
109
|
+
};
|
|
110
|
+
danger: {
|
|
111
|
+
base: string;
|
|
112
|
+
};
|
|
113
|
+
neutral: {
|
|
114
|
+
base: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
shape: {
|
|
118
|
+
default: {
|
|
119
|
+
base: string;
|
|
120
|
+
};
|
|
121
|
+
circle: {
|
|
122
|
+
base: string;
|
|
123
|
+
};
|
|
124
|
+
square: {
|
|
125
|
+
base: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
loading: {
|
|
129
|
+
true: {
|
|
130
|
+
base: string;
|
|
131
|
+
};
|
|
132
|
+
false: {
|
|
133
|
+
base: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
137
|
+
image: string;
|
|
138
|
+
fallback: string;
|
|
139
|
+
loader: string;
|
|
140
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
141
|
+
size: {
|
|
142
|
+
xs: {
|
|
143
|
+
base: string;
|
|
144
|
+
};
|
|
145
|
+
sm: {
|
|
146
|
+
base: string;
|
|
147
|
+
};
|
|
148
|
+
md: {
|
|
149
|
+
base: string;
|
|
150
|
+
};
|
|
151
|
+
lg: {
|
|
152
|
+
base: string;
|
|
153
|
+
};
|
|
154
|
+
xl: {
|
|
155
|
+
base: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
variant: {
|
|
159
|
+
ringed: {
|
|
160
|
+
base: string;
|
|
161
|
+
};
|
|
162
|
+
flat: {
|
|
163
|
+
base: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
ringColor: {
|
|
167
|
+
brand: {
|
|
168
|
+
base: string;
|
|
169
|
+
};
|
|
170
|
+
success: {
|
|
171
|
+
base: string;
|
|
172
|
+
};
|
|
173
|
+
warning: {
|
|
174
|
+
base: string;
|
|
175
|
+
};
|
|
176
|
+
danger: {
|
|
177
|
+
base: string;
|
|
178
|
+
};
|
|
179
|
+
neutral: {
|
|
180
|
+
base: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
shape: {
|
|
184
|
+
default: {
|
|
185
|
+
base: string;
|
|
186
|
+
};
|
|
187
|
+
circle: {
|
|
188
|
+
base: string;
|
|
189
|
+
};
|
|
190
|
+
square: {
|
|
191
|
+
base: string;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
loading: {
|
|
195
|
+
true: {
|
|
196
|
+
base: string;
|
|
197
|
+
};
|
|
198
|
+
false: {
|
|
199
|
+
base: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
}, {
|
|
203
|
+
image: string;
|
|
204
|
+
fallback: string;
|
|
205
|
+
loader: string;
|
|
206
|
+
}, "vif-avatar", unknown, unknown, undefined>>;
|
|
207
|
+
export declare const avatarGroupVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "vif-avatar-group", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "vif-avatar-group", unknown, unknown, undefined>>;
|
|
208
|
+
export type AvatarVariantProps = VariantProps<typeof avatarVariants>;
|
|
209
|
+
export type AvatarGroupVariantProps = VariantProps<typeof avatarGroupVariants>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const avatarVariants = tv({
|
|
4
|
+
base: "vif-avatar",
|
|
5
|
+
slots: {
|
|
6
|
+
image: "vif-avatar__image",
|
|
7
|
+
fallback: "vif-avatar__fallback",
|
|
8
|
+
loader: "vif-avatar__loader"
|
|
9
|
+
},
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
xs: { base: "vif-avatar--xs" },
|
|
13
|
+
sm: { base: "vif-avatar--sm" },
|
|
14
|
+
md: { base: "vif-avatar--md" },
|
|
15
|
+
lg: { base: "vif-avatar--lg" },
|
|
16
|
+
xl: { base: "vif-avatar--xl" }
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
ringed: { base: "vif-avatar--ringed" },
|
|
20
|
+
flat: { base: "" }
|
|
21
|
+
},
|
|
22
|
+
ringColor: {
|
|
23
|
+
brand: { base: "vif-avatar--brand" },
|
|
24
|
+
success: { base: "vif-avatar--success" },
|
|
25
|
+
warning: { base: "vif-avatar--warning" },
|
|
26
|
+
danger: { base: "vif-avatar--danger" },
|
|
27
|
+
neutral: { base: "vif-avatar--neutral" }
|
|
28
|
+
},
|
|
29
|
+
shape: {
|
|
30
|
+
default: { base: "vif-avatar--default" },
|
|
31
|
+
circle: { base: "vif-avatar--circle" },
|
|
32
|
+
square: { base: "" }
|
|
33
|
+
},
|
|
34
|
+
loading: {
|
|
35
|
+
true: { base: "vif-avatar--loading" },
|
|
36
|
+
false: { base: "" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "md",
|
|
41
|
+
ringColor: "neutral",
|
|
42
|
+
shape: "circle",
|
|
43
|
+
variant: "flat"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const avatarGroupVariants = tv({
|
|
47
|
+
base: "vif-avatar-group"
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export { avatarGroupVariants, avatarVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as AvatarRoot } from './avatar-root.vue';
|
|
2
|
+
export { default as AvatarImage } from './avatar-image.vue';
|
|
3
|
+
export { default as AvatarFallback } from './avatar-fallback.vue';
|
|
4
|
+
export { default as AvatarGroup } from './avatar-group.vue';
|
|
5
|
+
export { avatarVariants, type AvatarVariantProps } from './avatar.styles';
|
|
6
|
+
export type { AvatarRootProps } from './avatar-root.vue';
|
|
7
|
+
export type { AvatarImageProps } from './avatar-image.vue';
|
|
8
|
+
export type { AvatarFallbackProps } from './avatar-fallback.vue';
|
|
9
|
+
export type { AvatarGroupProps } from './avatar-group.vue';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as AvatarRoot } from './avatar-root.vue.js';
|
|
2
|
+
export { default as AvatarImage } from './avatar-image.vue.js';
|
|
3
|
+
export { default as AvatarFallback } from './avatar-fallback.vue.js';
|
|
4
|
+
export { default as AvatarGroup } from './avatar-group.vue.js';
|
|
5
|
+
export { avatarVariants } from './avatar.styles.js';
|