@rotki/ui-library 2.18.0 → 2.19.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/dist/README.md +4 -2
- package/dist/components/avatars/RuiAvatar.js +7 -0
- package/dist/components/avatars/RuiAvatar.js.map +1 -0
- package/dist/components/avatars/RuiAvatar.vue.d.ts +31 -0
- package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js +188 -0
- package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/avatars/RuiAvatarGroup.js +7 -0
- package/dist/components/avatars/RuiAvatarGroup.js.map +1 -0
- package/dist/components/avatars/RuiAvatarGroup.vue.d.ts +24 -0
- package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/avatars/avatar-props.d.ts +33 -0
- package/dist/components/avatars/avatar-props.js +46 -0
- package/dist/components/avatars/avatar-props.js.map +1 -0
- package/dist/components/avatars/use-avatar-group.d.ts +3 -0
- package/dist/components/avatars/use-avatar-group.js +10 -0
- package/dist/components/avatars/use-avatar-group.js.map +1 -0
- package/dist/components/buttons/button/button-styles.js +1 -1
- package/dist/components/buttons/button/button-styles.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +3 -0
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js +12 -3
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +2 -0
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.vue.d.ts +25 -22
- package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js +27 -16
- package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.js +7 -0
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.js.map +1 -0
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue.d.ts +37 -0
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/forms/checkbox/checkbox-group/context.d.ts +10 -0
- package/dist/components/forms/checkbox/checkbox-group/context.js +6 -0
- package/dist/components/forms/checkbox/checkbox-group/context.js.map +1 -0
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +4 -1
- package/dist/icons/icons_1.js +4290 -473
- package/dist/icons/icons_1.js.map +1 -1
- package/dist/icons/icons_2.js +4358 -474
- package/dist/icons/icons_2.js.map +1 -1
- package/dist/icons/icons_3.js +4054 -474
- package/dist/icons/icons_3.js.map +1 -1
- package/dist/icons/icons_4.js +2188 -238
- package/dist/icons/icons_4.js.map +1 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/library-icons.json +32 -0
- package/dist/style.css +41 -16
- package/dist/vite-plugin/index.js +16 -1
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/web-types.json +377 -25
- package/package.json +3 -2
package/dist/README.md
CHANGED
|
@@ -344,10 +344,12 @@ When the dependency installed on the main project, it will run the `prepare` scr
|
|
|
344
344
|
|
|
345
345
|
### Generating the library icons
|
|
346
346
|
|
|
347
|
-
We use [Lucide](https://lucide.dev/) icons as the base icon set. Brand icons (Discord, Reddit, X/Twitter, etc.) in the `src/custom-icons/` directory are sourced from [Simple Icons](https://simpleicons.org/).
|
|
347
|
+
We use [Lucide](https://lucide.dev/) icons as the base icon set. Brand icons (Discord, Reddit, X/Twitter, etc.) in the `src/custom-icons/` directory are sourced from [Simple Icons](https://simpleicons.org/).
|
|
348
|
+
|
|
349
|
+
The generator (`scripts/generate-icons.ts`) reads each Lucide icon's pre-parsed component data and the parsed XML of every SVG in `src/custom-icons/`, and emits one `[tag, attrs]` tuple per renderable primitive into `src/icons/icons_*.ts`. Multi-path icons stay as multiple entries — they are not collapsed into a single concatenated path. The generated files are gitignored and rebuilt by the `build` script; run the command below if you need to regenerate them by hand.
|
|
348
350
|
|
|
349
351
|
```
|
|
350
|
-
pnpm run generate
|
|
352
|
+
pnpm run generate-icons
|
|
351
353
|
```
|
|
352
354
|
|
|
353
355
|
## License
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import RuiAvatar_vue_vue_type_script_setup_true_lang_default from "./RuiAvatar.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region src/components/avatars/RuiAvatar.vue
|
|
3
|
+
var RuiAvatar_default = RuiAvatar_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { RuiAvatar_default as default };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=RuiAvatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuiAvatar.js","names":[],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props>();\n\nconst emit = defineEmits<{\n load: [event: Event];\n error: [event: Event];\n}>();\n\nconst slots = defineSlots<{\n default?: () => any;\n}>();\n\nconst group = useAvatarGroup();\n\nconst resolvedSize = computed<AvatarSize | number>(() => {\n if (size !== undefined)\n return size;\n if (group)\n return get(group).size;\n return 'md';\n});\n\nconst resolvedVariant = computed<AvatarVariant>(() => {\n if (variant !== undefined)\n return variant;\n if (group)\n return get(group).variant;\n return 'circular';\n});\n\nconst sizeToken = computed<AvatarSize | undefined>(() => {\n const value = get(resolvedSize);\n return typeof value === 'string' ? value : undefined;\n});\n\nconst sizePx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\nconst iconPx = computed<number>(() => resolveAvatarIconPx(get(resolvedSize)));\n\nconst errored = ref<boolean>(false);\n\nwatch(() => src, () => {\n set(errored, false);\n});\n\nconst initials = computed<string>(() => {\n const explicit = computeInitials(text ?? undefined);\n if (explicit)\n return explicit;\n return computeInitials(alt);\n});\n\ntype DisplayMode = 'image' | 'slot' | 'initials' | 'icon' | 'empty';\n\nconst displayMode = computed<DisplayMode>(() => {\n if (src && !get(errored))\n return 'image';\n if (slots.default)\n return 'slot';\n if (icon)\n return 'icon';\n if (get(initials))\n return 'initials';\n return 'empty';\n});\n\nconst decorative = computed<boolean>(() => alt === '' && !text);\n\nconst ariaLabel = computed<string | undefined>(() => {\n if (get(displayMode) === 'image')\n return undefined;\n if (get(decorative))\n return undefined;\n return text ?? alt ?? undefined;\n});\n\nconst rootStyle = computed<Record<string, string>>(() => {\n const px = `${get(sizePx)}px`;\n return { width: px, height: px };\n});\n\nconst avatarStyles = tv({\n slots: {\n root: 'relative inline-flex items-center justify-center shrink-0 overflow-hidden select-none font-medium align-middle',\n image: 'w-full h-full object-cover',\n fallback: 'w-full h-full flex items-center justify-center',\n initials: 'uppercase leading-none',\n },\n variants: {\n variant: {\n circular: { root: 'rounded-full' },\n rounded: { root: 'rounded-md' },\n square: { root: 'rounded-none' },\n },\n color: {\n default: { root: 'bg-rui-grey-200 text-rui-text dark:bg-rui-grey-800' },\n primary: { root: 'bg-rui-primary text-white' },\n secondary: { root: 'bg-rui-secondary text-white' },\n error: { root: 'bg-rui-error text-white' },\n warning: { root: 'bg-rui-warning text-white' },\n info: { root: 'bg-rui-info text-white' },\n success: { root: 'bg-rui-success text-white' },\n },\n size: {\n 'xs': { initials: 'text-[0.625rem]' },\n 'sm': { initials: 'text-[0.6875rem]' },\n 'md': { initials: 'text-sm' },\n 'lg': { initials: 'text-base' },\n 'xl': { initials: 'text-lg' },\n '2xl': { initials: 'text-xl' },\n },\n },\n compoundSlots: [\n { slots: ['root'], color: ['warning', 'success', 'info'], class: 'dark:text-rui-light-text' },\n ],\n defaultVariants: {\n variant: 'circular',\n color: 'default',\n size: 'md',\n },\n});\n\nconst ui = computed<ReturnType<typeof avatarStyles>>(() => avatarStyles({\n variant: get(resolvedVariant),\n color,\n size: get(sizeToken),\n}));\n\nfunction onLoad(event: Event): void {\n set(errored, false);\n emit('load', event);\n}\n\nfunction onError(event: Event): void {\n set(errored, true);\n emit('error', event);\n}\n</script>\n\n<template>\n <span\n :class=\"ui.root()\"\n :style=\"rootStyle\"\n :role=\"displayMode === 'image' ? undefined : 'img'\"\n :aria-label=\"ariaLabel\"\n :data-id=\"$attrs['data-id'] ?? 'avatar-root'\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-color=\"color\"\n >\n <img\n v-if=\"displayMode === 'image' && src\"\n :class=\"ui.image()\"\n :src=\"src\"\n :alt=\"alt\"\n :loading=\"loading\"\n :width=\"sizePx\"\n :height=\"sizePx\"\n data-id=\"avatar-image\"\n @load=\"onLoad($event)\"\n @error=\"onError($event)\"\n />\n <span\n v-else\n :class=\"ui.fallback()\"\n data-id=\"avatar-fallback\"\n aria-hidden=\"true\"\n >\n <slot v-if=\"displayMode === 'slot'\" />\n <span\n v-else-if=\"displayMode === 'initials'\"\n :class=\"ui.initials()\"\n data-id=\"avatar-initials\"\n >\n {{ initials }}\n </span>\n <RuiIcon\n v-else-if=\"displayMode === 'icon' && icon\"\n :name=\"icon\"\n :size=\"iconPx\"\n data-id=\"avatar-icon\"\n />\n <span v-else> </span>\n </span>\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ContextColorsType } from '../../consts/colors.js';
|
|
2
|
+
import type { RuiIcons } from '../../icons/index.js';
|
|
3
|
+
import { type AvatarSize, type AvatarVariant } from '../../components/avatars/avatar-props.js';
|
|
4
|
+
export interface Props {
|
|
5
|
+
src?: string | null;
|
|
6
|
+
alt?: string;
|
|
7
|
+
text?: string | null;
|
|
8
|
+
icon?: RuiIcons | null;
|
|
9
|
+
size?: AvatarSize | number;
|
|
10
|
+
variant?: AvatarVariant;
|
|
11
|
+
color?: 'default' | ContextColorsType;
|
|
12
|
+
loading?: 'lazy' | 'eager';
|
|
13
|
+
}
|
|
14
|
+
type __VLS_Slots = {
|
|
15
|
+
default?: () => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
error: (event: Event) => any;
|
|
19
|
+
load: (event: Event) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
21
|
+
onError?: ((event: Event) => any) | undefined;
|
|
22
|
+
onLoad?: ((event: Event) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { tv } from "../../utils/tv.js";
|
|
2
|
+
import RuiIcon_default from "../icons/RuiIcon.js";
|
|
3
|
+
import { computeInitials, resolveAvatarIconPx, resolveAvatarSizePx } from "./avatar-props.js";
|
|
4
|
+
import { useAvatarGroup } from "./use-avatar-group.js";
|
|
5
|
+
import { computed, createBlock, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref, useSlots, watch } from "vue";
|
|
6
|
+
import { get, set } from "@vueuse/shared";
|
|
7
|
+
//#region src/components/avatars/RuiAvatar.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var _hoisted_1 = [
|
|
9
|
+
"role",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"data-id",
|
|
12
|
+
"data-size",
|
|
13
|
+
"data-variant",
|
|
14
|
+
"data-color"
|
|
15
|
+
];
|
|
16
|
+
var _hoisted_2 = [
|
|
17
|
+
"src",
|
|
18
|
+
"alt",
|
|
19
|
+
"loading",
|
|
20
|
+
"width",
|
|
21
|
+
"height"
|
|
22
|
+
];
|
|
23
|
+
var _hoisted_3 = { key: 3 };
|
|
24
|
+
var RuiAvatar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
25
|
+
name: "RuiAvatar",
|
|
26
|
+
__name: "RuiAvatar",
|
|
27
|
+
props: {
|
|
28
|
+
src: { default: null },
|
|
29
|
+
alt: { default: "" },
|
|
30
|
+
text: { default: null },
|
|
31
|
+
icon: { default: null },
|
|
32
|
+
size: {},
|
|
33
|
+
variant: {},
|
|
34
|
+
color: { default: "default" },
|
|
35
|
+
loading: { default: "lazy" }
|
|
36
|
+
},
|
|
37
|
+
emits: ["load", "error"],
|
|
38
|
+
setup(__props, { emit: __emit }) {
|
|
39
|
+
const emit = __emit;
|
|
40
|
+
const slots = useSlots();
|
|
41
|
+
const group = useAvatarGroup();
|
|
42
|
+
const resolvedSize = computed(() => {
|
|
43
|
+
if (__props.size !== void 0) return __props.size;
|
|
44
|
+
if (group) return get(group).size;
|
|
45
|
+
return "md";
|
|
46
|
+
});
|
|
47
|
+
const resolvedVariant = computed(() => {
|
|
48
|
+
if (__props.variant !== void 0) return __props.variant;
|
|
49
|
+
if (group) return get(group).variant;
|
|
50
|
+
return "circular";
|
|
51
|
+
});
|
|
52
|
+
const sizeToken = computed(() => {
|
|
53
|
+
const value = get(resolvedSize);
|
|
54
|
+
return typeof value === "string" ? value : void 0;
|
|
55
|
+
});
|
|
56
|
+
const sizePx = computed(() => resolveAvatarSizePx(get(resolvedSize)));
|
|
57
|
+
const iconPx = computed(() => resolveAvatarIconPx(get(resolvedSize)));
|
|
58
|
+
const errored = ref(false);
|
|
59
|
+
watch(() => __props.src, () => {
|
|
60
|
+
set(errored, false);
|
|
61
|
+
});
|
|
62
|
+
const initials = computed(() => {
|
|
63
|
+
const explicit = computeInitials(__props.text ?? void 0);
|
|
64
|
+
if (explicit) return explicit;
|
|
65
|
+
return computeInitials(__props.alt);
|
|
66
|
+
});
|
|
67
|
+
const displayMode = computed(() => {
|
|
68
|
+
if (__props.src && !get(errored)) return "image";
|
|
69
|
+
if (slots.default) return "slot";
|
|
70
|
+
if (__props.icon) return "icon";
|
|
71
|
+
if (get(initials)) return "initials";
|
|
72
|
+
return "empty";
|
|
73
|
+
});
|
|
74
|
+
const decorative = computed(() => __props.alt === "" && !__props.text);
|
|
75
|
+
const ariaLabel = computed(() => {
|
|
76
|
+
if (get(displayMode) === "image") return void 0;
|
|
77
|
+
if (get(decorative)) return void 0;
|
|
78
|
+
return __props.text ?? __props.alt ?? void 0;
|
|
79
|
+
});
|
|
80
|
+
const rootStyle = computed(() => {
|
|
81
|
+
const px = `${get(sizePx)}px`;
|
|
82
|
+
return {
|
|
83
|
+
width: px,
|
|
84
|
+
height: px
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const avatarStyles = tv({
|
|
88
|
+
slots: {
|
|
89
|
+
root: "relative inline-flex items-center justify-center shrink-0 overflow-hidden select-none font-medium align-middle",
|
|
90
|
+
image: "w-full h-full object-cover",
|
|
91
|
+
fallback: "w-full h-full flex items-center justify-center",
|
|
92
|
+
initials: "uppercase leading-none"
|
|
93
|
+
},
|
|
94
|
+
variants: {
|
|
95
|
+
variant: {
|
|
96
|
+
circular: { root: "rounded-full" },
|
|
97
|
+
rounded: { root: "rounded-md" },
|
|
98
|
+
square: { root: "rounded-none" }
|
|
99
|
+
},
|
|
100
|
+
color: {
|
|
101
|
+
default: { root: "bg-rui-grey-200 text-rui-text dark:bg-rui-grey-800" },
|
|
102
|
+
primary: { root: "bg-rui-primary text-white" },
|
|
103
|
+
secondary: { root: "bg-rui-secondary text-white" },
|
|
104
|
+
error: { root: "bg-rui-error text-white" },
|
|
105
|
+
warning: { root: "bg-rui-warning text-white" },
|
|
106
|
+
info: { root: "bg-rui-info text-white" },
|
|
107
|
+
success: { root: "bg-rui-success text-white" }
|
|
108
|
+
},
|
|
109
|
+
size: {
|
|
110
|
+
"xs": { initials: "text-[0.625rem]" },
|
|
111
|
+
"sm": { initials: "text-[0.6875rem]" },
|
|
112
|
+
"md": { initials: "text-sm" },
|
|
113
|
+
"lg": { initials: "text-base" },
|
|
114
|
+
"xl": { initials: "text-lg" },
|
|
115
|
+
"2xl": { initials: "text-xl" }
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
compoundSlots: [{
|
|
119
|
+
slots: ["root"],
|
|
120
|
+
color: [
|
|
121
|
+
"warning",
|
|
122
|
+
"success",
|
|
123
|
+
"info"
|
|
124
|
+
],
|
|
125
|
+
class: "dark:text-rui-light-text"
|
|
126
|
+
}],
|
|
127
|
+
defaultVariants: {
|
|
128
|
+
variant: "circular",
|
|
129
|
+
color: "default",
|
|
130
|
+
size: "md"
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const ui = computed(() => avatarStyles({
|
|
134
|
+
variant: get(resolvedVariant),
|
|
135
|
+
color: __props.color,
|
|
136
|
+
size: get(sizeToken)
|
|
137
|
+
}));
|
|
138
|
+
function onLoad(event) {
|
|
139
|
+
set(errored, false);
|
|
140
|
+
emit("load", event);
|
|
141
|
+
}
|
|
142
|
+
function onError(event) {
|
|
143
|
+
set(errored, true);
|
|
144
|
+
emit("error", event);
|
|
145
|
+
}
|
|
146
|
+
return (_ctx, _cache) => {
|
|
147
|
+
return openBlock(), createElementBlock("span", {
|
|
148
|
+
class: normalizeClass(unref(ui).root()),
|
|
149
|
+
style: normalizeStyle(unref(rootStyle)),
|
|
150
|
+
role: unref(displayMode) === "image" ? void 0 : "img",
|
|
151
|
+
"aria-label": unref(ariaLabel),
|
|
152
|
+
"data-id": _ctx.$attrs["data-id"] ?? "avatar-root",
|
|
153
|
+
"data-size": typeof unref(resolvedSize) === "string" ? unref(resolvedSize) : void 0,
|
|
154
|
+
"data-variant": unref(resolvedVariant),
|
|
155
|
+
"data-color": __props.color
|
|
156
|
+
}, [unref(displayMode) === "image" && __props.src ? (openBlock(), createElementBlock("img", {
|
|
157
|
+
key: 0,
|
|
158
|
+
class: normalizeClass(unref(ui).image()),
|
|
159
|
+
src: __props.src,
|
|
160
|
+
alt: __props.alt,
|
|
161
|
+
loading: __props.loading,
|
|
162
|
+
width: unref(sizePx),
|
|
163
|
+
height: unref(sizePx),
|
|
164
|
+
"data-id": "avatar-image",
|
|
165
|
+
onLoad: _cache[0] || (_cache[0] = ($event) => onLoad($event)),
|
|
166
|
+
onError: _cache[1] || (_cache[1] = ($event) => onError($event))
|
|
167
|
+
}, null, 42, _hoisted_2)) : (openBlock(), createElementBlock("span", {
|
|
168
|
+
key: 1,
|
|
169
|
+
class: normalizeClass(unref(ui).fallback()),
|
|
170
|
+
"data-id": "avatar-fallback",
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
}, [unref(displayMode) === "slot" ? renderSlot(_ctx.$slots, "default", { key: 0 }) : unref(displayMode) === "initials" ? (openBlock(), createElementBlock("span", {
|
|
173
|
+
key: 1,
|
|
174
|
+
class: normalizeClass(unref(ui).initials()),
|
|
175
|
+
"data-id": "avatar-initials"
|
|
176
|
+
}, toDisplayString(unref(initials)), 3)) : unref(displayMode) === "icon" && __props.icon ? (openBlock(), createBlock(RuiIcon_default, {
|
|
177
|
+
key: 2,
|
|
178
|
+
name: __props.icon,
|
|
179
|
+
size: unref(iconPx),
|
|
180
|
+
"data-id": "avatar-icon"
|
|
181
|
+
}, null, 8, ["name", "size"])) : (openBlock(), createElementBlock("span", _hoisted_3, "\xA0"))], 2))], 14, _hoisted_1);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
//#endregion
|
|
186
|
+
export { RuiAvatar_vue_vue_type_script_setup_true_lang_default as default };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=RuiAvatar.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuiAvatar.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props>();\n\nconst emit = defineEmits<{\n load: [event: Event];\n error: [event: Event];\n}>();\n\nconst slots = defineSlots<{\n default?: () => any;\n}>();\n\nconst group = useAvatarGroup();\n\nconst resolvedSize = computed<AvatarSize | number>(() => {\n if (size !== undefined)\n return size;\n if (group)\n return get(group).size;\n return 'md';\n});\n\nconst resolvedVariant = computed<AvatarVariant>(() => {\n if (variant !== undefined)\n return variant;\n if (group)\n return get(group).variant;\n return 'circular';\n});\n\nconst sizeToken = computed<AvatarSize | undefined>(() => {\n const value = get(resolvedSize);\n return typeof value === 'string' ? value : undefined;\n});\n\nconst sizePx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\nconst iconPx = computed<number>(() => resolveAvatarIconPx(get(resolvedSize)));\n\nconst errored = ref<boolean>(false);\n\nwatch(() => src, () => {\n set(errored, false);\n});\n\nconst initials = computed<string>(() => {\n const explicit = computeInitials(text ?? undefined);\n if (explicit)\n return explicit;\n return computeInitials(alt);\n});\n\ntype DisplayMode = 'image' | 'slot' | 'initials' | 'icon' | 'empty';\n\nconst displayMode = computed<DisplayMode>(() => {\n if (src && !get(errored))\n return 'image';\n if (slots.default)\n return 'slot';\n if (icon)\n return 'icon';\n if (get(initials))\n return 'initials';\n return 'empty';\n});\n\nconst decorative = computed<boolean>(() => alt === '' && !text);\n\nconst ariaLabel = computed<string | undefined>(() => {\n if (get(displayMode) === 'image')\n return undefined;\n if (get(decorative))\n return undefined;\n return text ?? alt ?? undefined;\n});\n\nconst rootStyle = computed<Record<string, string>>(() => {\n const px = `${get(sizePx)}px`;\n return { width: px, height: px };\n});\n\nconst avatarStyles = tv({\n slots: {\n root: 'relative inline-flex items-center justify-center shrink-0 overflow-hidden select-none font-medium align-middle',\n image: 'w-full h-full object-cover',\n fallback: 'w-full h-full flex items-center justify-center',\n initials: 'uppercase leading-none',\n },\n variants: {\n variant: {\n circular: { root: 'rounded-full' },\n rounded: { root: 'rounded-md' },\n square: { root: 'rounded-none' },\n },\n color: {\n default: { root: 'bg-rui-grey-200 text-rui-text dark:bg-rui-grey-800' },\n primary: { root: 'bg-rui-primary text-white' },\n secondary: { root: 'bg-rui-secondary text-white' },\n error: { root: 'bg-rui-error text-white' },\n warning: { root: 'bg-rui-warning text-white' },\n info: { root: 'bg-rui-info text-white' },\n success: { root: 'bg-rui-success text-white' },\n },\n size: {\n 'xs': { initials: 'text-[0.625rem]' },\n 'sm': { initials: 'text-[0.6875rem]' },\n 'md': { initials: 'text-sm' },\n 'lg': { initials: 'text-base' },\n 'xl': { initials: 'text-lg' },\n '2xl': { initials: 'text-xl' },\n },\n },\n compoundSlots: [\n { slots: ['root'], color: ['warning', 'success', 'info'], class: 'dark:text-rui-light-text' },\n ],\n defaultVariants: {\n variant: 'circular',\n color: 'default',\n size: 'md',\n },\n});\n\nconst ui = computed<ReturnType<typeof avatarStyles>>(() => avatarStyles({\n variant: get(resolvedVariant),\n color,\n size: get(sizeToken),\n}));\n\nfunction onLoad(event: Event): void {\n set(errored, false);\n emit('load', event);\n}\n\nfunction onError(event: Event): void {\n set(errored, true);\n emit('error', event);\n}\n</script>\n\n<template>\n <span\n :class=\"ui.root()\"\n :style=\"rootStyle\"\n :role=\"displayMode === 'image' ? undefined : 'img'\"\n :aria-label=\"ariaLabel\"\n :data-id=\"$attrs['data-id'] ?? 'avatar-root'\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-color=\"color\"\n >\n <img\n v-if=\"displayMode === 'image' && src\"\n :class=\"ui.image()\"\n :src=\"src\"\n :alt=\"alt\"\n :loading=\"loading\"\n :width=\"sizePx\"\n :height=\"sizePx\"\n data-id=\"avatar-image\"\n @load=\"onLoad($event)\"\n @error=\"onError($event)\"\n />\n <span\n v-else\n :class=\"ui.fallback()\"\n data-id=\"avatar-fallback\"\n aria-hidden=\"true\"\n >\n <slot v-if=\"displayMode === 'slot'\" />\n <span\n v-else-if=\"displayMode === 'initials'\"\n :class=\"ui.initials()\"\n data-id=\"avatar-initials\"\n >\n {{ initials }}\n </span>\n <RuiIcon\n v-else-if=\"displayMode === 'icon' && icon\"\n :name=\"icon\"\n :size=\"iconPx\"\n data-id=\"avatar-icon\"\n />\n <span v-else> </span>\n </span>\n </span>\n</template>\n"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import RuiAvatarGroup_vue_vue_type_script_setup_true_lang_default from "./RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region src/components/avatars/RuiAvatarGroup.vue
|
|
3
|
+
var RuiAvatarGroup_default = RuiAvatarGroup_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { RuiAvatarGroup_default as default };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=RuiAvatarGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuiAvatarGroup.js","names":[],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, Text, type VNode } from 'vue';\nimport {\n AVATAR_GROUP_SPACING_PX,\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props>();\n\nconst slots = defineSlots<{\n default?: () => VNode[];\n surplus?: (props: { count: number }) => any;\n}>();\n\nconst resolvedSize = computed<AvatarSize | number>(() => size ?? 'md');\n\nconst VNodeRenderer = defineComponent<{ vnode: VNode }>({\n props: ['vnode'],\n setup(props) {\n return (): VNode => props.vnode;\n },\n});\n\nprovide(avatarGroupInjectionKey, computed(() => ({ size: get(resolvedSize), variant })));\n\nconst groupStyles = tv({\n slots: {\n root: 'inline-flex items-center isolate',\n item: 'relative ring-2 ring-white dark:ring-rui-grey-900 rounded-full',\n },\n});\n\nfunction flattenChildren(nodes: VNode[] | undefined): VNode[] {\n if (!nodes)\n return [];\n const out: VNode[] = [];\n for (const node of nodes) {\n if (node.type === Comment)\n continue;\n if (node.type === Text && typeof node.children === 'string' && node.children.trim() === '')\n continue;\n if (node.type === Fragment && Array.isArray(node.children)) {\n const inner = node.children.filter((c): c is VNode => typeof c === 'object' && c !== null && 'type' in c);\n out.push(...flattenChildren(inner));\n continue;\n }\n out.push(node);\n }\n return out;\n}\n\nconst children = computed<VNode[]>(() => flattenChildren(slots.default?.()));\n\nconst visible = computed<VNode[]>(() => {\n if (max === undefined)\n return get(children);\n return get(children).slice(0, max);\n});\n\nconst surplusCount = computed<number>(() => {\n const totalCount = total ?? get(children).length;\n const shown = get(visible).length;\n return Math.max(0, totalCount - shown);\n});\n\nconst spacingPx = computed<number>(() => {\n if (typeof spacing === 'number')\n return spacing;\n return AVATAR_GROUP_SPACING_PX[spacing];\n});\n\nconst ringOffsetPx = computed<number>(() =>\n // ring-2 is 2px. Keep items overlapping by the configured spacing\n // (negative margin). spacing is already negative for tokens.\n get(spacingPx),\n);\n\nconst itemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: `${get(ringOffsetPx)}px`,\n}));\n\nconst firstItemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: '0',\n}));\n\nconst avatarPx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof groupStyles>>(() => groupStyles());\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n data-id=\"avatar-group\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"variant\"\n >\n <span\n v-for=\"(child, index) in visible\"\n :key=\"child.key ?? index\"\n :class=\"ui.item()\"\n :style=\"index === 0 ? firstItemStyle : itemStyle\"\n >\n <VNodeRenderer :vnode=\"child\" />\n </span>\n <span\n v-if=\"surplusCount > 0\"\n :class=\"ui.item()\"\n :style=\"visible.length === 0 ? firstItemStyle : itemStyle\"\n data-id=\"avatar-group-surplus\"\n >\n <slot\n name=\"surplus\"\n :count=\"surplusCount\"\n >\n <RuiAvatar\n :size=\"resolvedSize\"\n :variant=\"variant\"\n :alt=\"`+${surplusCount} more`\"\n :style=\"{ width: `${avatarPx}px`, height: `${avatarPx}px` }\"\n >\n <span class=\"leading-none\">+{{ surplusCount }}</span>\n </RuiAvatar>\n </slot>\n </span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
import { AvatarGroupSpacing, type AvatarSize, type AvatarVariant } from '../../components/avatars/avatar-props.js';
|
|
3
|
+
export interface Props {
|
|
4
|
+
size?: AvatarSize | number;
|
|
5
|
+
variant?: AvatarVariant;
|
|
6
|
+
max?: number;
|
|
7
|
+
total?: number;
|
|
8
|
+
spacing?: AvatarGroupSpacing | number;
|
|
9
|
+
}
|
|
10
|
+
type __VLS_Slots = {
|
|
11
|
+
default?: () => VNode[];
|
|
12
|
+
surplus?: (props: {
|
|
13
|
+
count: number;
|
|
14
|
+
}) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { tv } from "../../utils/tv.js";
|
|
2
|
+
import { AVATAR_GROUP_SPACING_PX, AvatarGroupSpacing, avatarGroupInjectionKey, resolveAvatarSizePx } from "./avatar-props.js";
|
|
3
|
+
import RuiAvatar_default from "./RuiAvatar.js";
|
|
4
|
+
import { Comment, Fragment, Text, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, provide, renderList, renderSlot, toDisplayString, unref, useSlots, withCtx } from "vue";
|
|
5
|
+
import { get } from "@vueuse/shared";
|
|
6
|
+
//#region src/components/avatars/RuiAvatarGroup.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = ["data-size", "data-variant"];
|
|
8
|
+
var _hoisted_2 = { class: "leading-none" };
|
|
9
|
+
var RuiAvatarGroup_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "RuiAvatarGroup",
|
|
11
|
+
__name: "RuiAvatarGroup",
|
|
12
|
+
props: {
|
|
13
|
+
size: {},
|
|
14
|
+
variant: { default: "circular" },
|
|
15
|
+
max: {},
|
|
16
|
+
total: {},
|
|
17
|
+
spacing: { default: () => AvatarGroupSpacing.md }
|
|
18
|
+
},
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const slots = useSlots();
|
|
21
|
+
const resolvedSize = computed(() => __props.size ?? "md");
|
|
22
|
+
const VNodeRenderer = defineComponent({
|
|
23
|
+
props: ["vnode"],
|
|
24
|
+
setup(props) {
|
|
25
|
+
return () => props.vnode;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
provide(avatarGroupInjectionKey, computed(() => ({
|
|
29
|
+
size: get(resolvedSize),
|
|
30
|
+
variant: __props.variant
|
|
31
|
+
})));
|
|
32
|
+
const groupStyles = tv({ slots: {
|
|
33
|
+
root: "inline-flex items-center isolate",
|
|
34
|
+
item: "relative ring-2 ring-white dark:ring-rui-grey-900 rounded-full"
|
|
35
|
+
} });
|
|
36
|
+
function flattenChildren(nodes) {
|
|
37
|
+
if (!nodes) return [];
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const node of nodes) {
|
|
40
|
+
if (node.type === Comment) continue;
|
|
41
|
+
if (node.type === Text && typeof node.children === "string" && node.children.trim() === "") continue;
|
|
42
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
43
|
+
const inner = node.children.filter((c) => typeof c === "object" && c !== null && "type" in c);
|
|
44
|
+
out.push(...flattenChildren(inner));
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
out.push(node);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
const children = computed(() => flattenChildren(slots.default?.()));
|
|
52
|
+
const visible = computed(() => {
|
|
53
|
+
if (__props.max === void 0) return get(children);
|
|
54
|
+
return get(children).slice(0, __props.max);
|
|
55
|
+
});
|
|
56
|
+
const surplusCount = computed(() => {
|
|
57
|
+
const totalCount = __props.total ?? get(children).length;
|
|
58
|
+
const shown = get(visible).length;
|
|
59
|
+
return Math.max(0, totalCount - shown);
|
|
60
|
+
});
|
|
61
|
+
const spacingPx = computed(() => {
|
|
62
|
+
if (typeof __props.spacing === "number") return __props.spacing;
|
|
63
|
+
return AVATAR_GROUP_SPACING_PX[__props.spacing];
|
|
64
|
+
});
|
|
65
|
+
const ringOffsetPx = computed(() => get(spacingPx));
|
|
66
|
+
const itemStyle = computed(() => ({ marginInlineStart: `${get(ringOffsetPx)}px` }));
|
|
67
|
+
const firstItemStyle = computed(() => ({ marginInlineStart: "0" }));
|
|
68
|
+
const avatarPx = computed(() => resolveAvatarSizePx(get(resolvedSize)));
|
|
69
|
+
const ui = computed(() => groupStyles());
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
return openBlock(), createElementBlock("div", {
|
|
72
|
+
class: normalizeClass(unref(ui).root()),
|
|
73
|
+
"data-id": "avatar-group",
|
|
74
|
+
"data-size": typeof unref(resolvedSize) === "string" ? unref(resolvedSize) : void 0,
|
|
75
|
+
"data-variant": __props.variant
|
|
76
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visible), (child, index) => {
|
|
77
|
+
return openBlock(), createElementBlock("span", {
|
|
78
|
+
key: child.key ?? index,
|
|
79
|
+
class: normalizeClass(unref(ui).item()),
|
|
80
|
+
style: normalizeStyle(index === 0 ? unref(firstItemStyle) : unref(itemStyle))
|
|
81
|
+
}, [createVNode(unref(VNodeRenderer), { vnode: child }, null, 8, ["vnode"])], 6);
|
|
82
|
+
}), 128)), unref(surplusCount) > 0 ? (openBlock(), createElementBlock("span", {
|
|
83
|
+
key: 0,
|
|
84
|
+
class: normalizeClass(unref(ui).item()),
|
|
85
|
+
style: normalizeStyle(unref(visible).length === 0 ? unref(firstItemStyle) : unref(itemStyle)),
|
|
86
|
+
"data-id": "avatar-group-surplus"
|
|
87
|
+
}, [renderSlot(_ctx.$slots, "surplus", { count: unref(surplusCount) }, () => [createVNode(RuiAvatar_default, {
|
|
88
|
+
size: unref(resolvedSize),
|
|
89
|
+
variant: __props.variant,
|
|
90
|
+
alt: `+${unref(surplusCount)} more`,
|
|
91
|
+
style: normalizeStyle({
|
|
92
|
+
width: `${unref(avatarPx)}px`,
|
|
93
|
+
height: `${unref(avatarPx)}px`
|
|
94
|
+
})
|
|
95
|
+
}, {
|
|
96
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_2, "+" + toDisplayString(unref(surplusCount)), 1)]),
|
|
97
|
+
_: 1
|
|
98
|
+
}, 8, [
|
|
99
|
+
"size",
|
|
100
|
+
"variant",
|
|
101
|
+
"alt",
|
|
102
|
+
"style"
|
|
103
|
+
])])], 6)) : createCommentVNode("", true)], 10, _hoisted_1);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
//#endregion
|
|
108
|
+
export { RuiAvatarGroup_vue_vue_type_script_setup_true_lang_default as default };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, Text, type VNode } from 'vue';\nimport {\n AVATAR_GROUP_SPACING_PX,\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props>();\n\nconst slots = defineSlots<{\n default?: () => VNode[];\n surplus?: (props: { count: number }) => any;\n}>();\n\nconst resolvedSize = computed<AvatarSize | number>(() => size ?? 'md');\n\nconst VNodeRenderer = defineComponent<{ vnode: VNode }>({\n props: ['vnode'],\n setup(props) {\n return (): VNode => props.vnode;\n },\n});\n\nprovide(avatarGroupInjectionKey, computed(() => ({ size: get(resolvedSize), variant })));\n\nconst groupStyles = tv({\n slots: {\n root: 'inline-flex items-center isolate',\n item: 'relative ring-2 ring-white dark:ring-rui-grey-900 rounded-full',\n },\n});\n\nfunction flattenChildren(nodes: VNode[] | undefined): VNode[] {\n if (!nodes)\n return [];\n const out: VNode[] = [];\n for (const node of nodes) {\n if (node.type === Comment)\n continue;\n if (node.type === Text && typeof node.children === 'string' && node.children.trim() === '')\n continue;\n if (node.type === Fragment && Array.isArray(node.children)) {\n const inner = node.children.filter((c): c is VNode => typeof c === 'object' && c !== null && 'type' in c);\n out.push(...flattenChildren(inner));\n continue;\n }\n out.push(node);\n }\n return out;\n}\n\nconst children = computed<VNode[]>(() => flattenChildren(slots.default?.()));\n\nconst visible = computed<VNode[]>(() => {\n if (max === undefined)\n return get(children);\n return get(children).slice(0, max);\n});\n\nconst surplusCount = computed<number>(() => {\n const totalCount = total ?? get(children).length;\n const shown = get(visible).length;\n return Math.max(0, totalCount - shown);\n});\n\nconst spacingPx = computed<number>(() => {\n if (typeof spacing === 'number')\n return spacing;\n return AVATAR_GROUP_SPACING_PX[spacing];\n});\n\nconst ringOffsetPx = computed<number>(() =>\n // ring-2 is 2px. Keep items overlapping by the configured spacing\n // (negative margin). spacing is already negative for tokens.\n get(spacingPx),\n);\n\nconst itemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: `${get(ringOffsetPx)}px`,\n}));\n\nconst firstItemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: '0',\n}));\n\nconst avatarPx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof groupStyles>>(() => groupStyles());\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n data-id=\"avatar-group\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"variant\"\n >\n <span\n v-for=\"(child, index) in visible\"\n :key=\"child.key ?? index\"\n :class=\"ui.item()\"\n :style=\"index === 0 ? firstItemStyle : itemStyle\"\n >\n <VNodeRenderer :vnode=\"child\" />\n </span>\n <span\n v-if=\"surplusCount > 0\"\n :class=\"ui.item()\"\n :style=\"visible.length === 0 ? firstItemStyle : itemStyle\"\n data-id=\"avatar-group-surplus\"\n >\n <slot\n name=\"surplus\"\n :count=\"surplusCount\"\n >\n <RuiAvatar\n :size=\"resolvedSize\"\n :variant=\"variant\"\n :alt=\"`+${surplusCount} more`\"\n :style=\"{ width: `${avatarPx}px`, height: `${avatarPx}px` }\"\n >\n <span class=\"leading-none\">+{{ surplusCount }}</span>\n </RuiAvatar>\n </slot>\n </span>\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
export declare const AvatarSize: {
|
|
3
|
+
readonly xs: "xs";
|
|
4
|
+
readonly sm: "sm";
|
|
5
|
+
readonly md: "md";
|
|
6
|
+
readonly lg: "lg";
|
|
7
|
+
readonly xl: "xl";
|
|
8
|
+
readonly '2xl': "2xl";
|
|
9
|
+
};
|
|
10
|
+
export type AvatarSize = (typeof AvatarSize)[keyof typeof AvatarSize];
|
|
11
|
+
export declare const AvatarVariant: {
|
|
12
|
+
readonly circular: "circular";
|
|
13
|
+
readonly rounded: "rounded";
|
|
14
|
+
readonly square: "square";
|
|
15
|
+
};
|
|
16
|
+
export type AvatarVariant = (typeof AvatarVariant)[keyof typeof AvatarVariant];
|
|
17
|
+
export declare const AvatarGroupSpacing: {
|
|
18
|
+
readonly sm: "sm";
|
|
19
|
+
readonly md: "md";
|
|
20
|
+
readonly lg: "lg";
|
|
21
|
+
};
|
|
22
|
+
export type AvatarGroupSpacing = (typeof AvatarGroupSpacing)[keyof typeof AvatarGroupSpacing];
|
|
23
|
+
export declare const AVATAR_SIZE_PX: Record<AvatarSize, number>;
|
|
24
|
+
export declare const AVATAR_ICON_PX: Record<AvatarSize, number>;
|
|
25
|
+
export declare const AVATAR_GROUP_SPACING_PX: Record<AvatarGroupSpacing, number>;
|
|
26
|
+
export declare function resolveAvatarSizePx(size: AvatarSize | number | undefined): number;
|
|
27
|
+
export declare function resolveAvatarIconPx(size: AvatarSize | number | undefined): number;
|
|
28
|
+
export declare function computeInitials(source: string | undefined | null): string;
|
|
29
|
+
export interface AvatarGroupContext {
|
|
30
|
+
size: AvatarSize | number;
|
|
31
|
+
variant: AvatarVariant;
|
|
32
|
+
}
|
|
33
|
+
export declare const avatarGroupInjectionKey: InjectionKey<ComputedRef<AvatarGroupContext>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/components/avatars/avatar-props.ts
|
|
2
|
+
var AvatarGroupSpacing = {
|
|
3
|
+
sm: "sm",
|
|
4
|
+
md: "md",
|
|
5
|
+
lg: "lg"
|
|
6
|
+
};
|
|
7
|
+
var AVATAR_SIZE_PX = {
|
|
8
|
+
"xs": 20,
|
|
9
|
+
"sm": 24,
|
|
10
|
+
"md": 32,
|
|
11
|
+
"lg": 40,
|
|
12
|
+
"xl": 48,
|
|
13
|
+
"2xl": 64
|
|
14
|
+
};
|
|
15
|
+
var AVATAR_ICON_PX = {
|
|
16
|
+
"xs": 12,
|
|
17
|
+
"sm": 14,
|
|
18
|
+
"md": 18,
|
|
19
|
+
"lg": 22,
|
|
20
|
+
"xl": 28,
|
|
21
|
+
"2xl": 36
|
|
22
|
+
};
|
|
23
|
+
var AVATAR_GROUP_SPACING_PX = {
|
|
24
|
+
sm: -4,
|
|
25
|
+
md: -8,
|
|
26
|
+
lg: -12
|
|
27
|
+
};
|
|
28
|
+
function resolveAvatarSizePx(size) {
|
|
29
|
+
if (typeof size === "number") return size;
|
|
30
|
+
return AVATAR_SIZE_PX[size ?? "md"];
|
|
31
|
+
}
|
|
32
|
+
function resolveAvatarIconPx(size) {
|
|
33
|
+
if (typeof size === "number") return Math.round(size * .56);
|
|
34
|
+
return AVATAR_ICON_PX[size ?? "md"];
|
|
35
|
+
}
|
|
36
|
+
function computeInitials(source) {
|
|
37
|
+
if (!source) return "";
|
|
38
|
+
const parts = source.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
39
|
+
if (parts.length === 0) return "";
|
|
40
|
+
return parts.map((p) => p.charAt(0).toUpperCase()).join("");
|
|
41
|
+
}
|
|
42
|
+
var avatarGroupInjectionKey = Symbol("avatarGroup");
|
|
43
|
+
//#endregion
|
|
44
|
+
export { AVATAR_GROUP_SPACING_PX, AvatarGroupSpacing, avatarGroupInjectionKey, computeInitials, resolveAvatarIconPx, resolveAvatarSizePx };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=avatar-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-props.js","names":[],"sources":["../../../src/components/avatars/avatar-props.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey } from 'vue';\n\nexport const AvatarSize = {\n 'xs': 'xs',\n 'sm': 'sm',\n 'md': 'md',\n 'lg': 'lg',\n 'xl': 'xl',\n '2xl': '2xl',\n} as const;\n\nexport type AvatarSize = (typeof AvatarSize)[keyof typeof AvatarSize];\n\nexport const AvatarVariant = {\n circular: 'circular',\n rounded: 'rounded',\n square: 'square',\n} as const;\n\nexport type AvatarVariant = (typeof AvatarVariant)[keyof typeof AvatarVariant];\n\nexport const AvatarGroupSpacing = {\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n} as const;\n\nexport type AvatarGroupSpacing = (typeof AvatarGroupSpacing)[keyof typeof AvatarGroupSpacing];\n\nexport const AVATAR_SIZE_PX: Record<AvatarSize, number> = {\n 'xs': 20,\n 'sm': 24,\n 'md': 32,\n 'lg': 40,\n 'xl': 48,\n '2xl': 64,\n};\n\nexport const AVATAR_ICON_PX: Record<AvatarSize, number> = {\n 'xs': 12,\n 'sm': 14,\n 'md': 18,\n 'lg': 22,\n 'xl': 28,\n '2xl': 36,\n};\n\nexport const AVATAR_GROUP_SPACING_PX: Record<AvatarGroupSpacing, number> = {\n sm: -4,\n md: -8,\n lg: -12,\n};\n\nexport function resolveAvatarSizePx(size: AvatarSize | number | undefined): number {\n if (typeof size === 'number')\n return size;\n return AVATAR_SIZE_PX[size ?? 'md'];\n}\n\nexport function resolveAvatarIconPx(size: AvatarSize | number | undefined): number {\n if (typeof size === 'number')\n return Math.round(size * 0.56);\n return AVATAR_ICON_PX[size ?? 'md'];\n}\n\nexport function computeInitials(source: string | undefined | null): string {\n if (!source)\n return '';\n const parts = source\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2);\n if (parts.length === 0)\n return '';\n return parts.map(p => p.charAt(0).toUpperCase()).join('');\n}\n\nexport interface AvatarGroupContext {\n size: AvatarSize | number;\n variant: AvatarVariant;\n}\n\nexport const avatarGroupInjectionKey: InjectionKey<ComputedRef<AvatarGroupContext>>\n = Symbol('avatarGroup');\n"],"mappings":";AAqBA,IAAa,qBAAqB;CAChC,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAID,IAAa,iBAA6C;CACxD,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACR;AAED,IAAa,iBAA6C;CACxD,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACR;AAED,IAAa,0BAA8D;CACzE,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAED,SAAgB,oBAAoB,MAA+C;AACjF,KAAI,OAAO,SAAS,SAClB,QAAO;AACT,QAAO,eAAe,QAAQ;;AAGhC,SAAgB,oBAAoB,MAA+C;AACjF,KAAI,OAAO,SAAS,SAClB,QAAO,KAAK,MAAM,OAAO,IAAK;AAChC,QAAO,eAAe,QAAQ;;AAGhC,SAAgB,gBAAgB,QAA2C;AACzE,KAAI,CAAC,OACH,QAAO;CACT,MAAM,QAAQ,OACX,MAAM,CACN,MAAM,MAAM,CACZ,OAAO,QAAQ,CACf,MAAM,GAAG,EAAE;AACd,KAAI,MAAM,WAAW,EACnB,QAAO;AACT,QAAO,MAAM,KAAI,MAAK,EAAE,OAAO,EAAE,CAAC,aAAa,CAAC,CAAC,KAAK,GAAG;;AAQ3D,IAAa,0BACT,OAAO,cAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { avatarGroupInjectionKey } from "./avatar-props.js";
|
|
2
|
+
import { inject } from "vue";
|
|
3
|
+
//#region src/components/avatars/use-avatar-group.ts
|
|
4
|
+
function useAvatarGroup() {
|
|
5
|
+
return inject(avatarGroupInjectionKey, void 0);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useAvatarGroup };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=use-avatar-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-avatar-group.js","names":[],"sources":["../../../src/components/avatars/use-avatar-group.ts"],"sourcesContent":["import type { ComputedRef } from 'vue';\nimport { type AvatarGroupContext, avatarGroupInjectionKey } from '@/components/avatars/avatar-props';\n\nexport function useAvatarGroup(): ComputedRef<AvatarGroupContext> | undefined {\n return inject(avatarGroupInjectionKey, undefined);\n}\n"],"mappings":";;;AAGA,SAAgB,iBAA8D;AAC5E,QAAO,OAAO,yBAAyB,KAAA,EAAU"}
|