@mekari/pixel3-avatar 0.0.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.
Files changed (62) hide show
  1. package/dist/avatar-excess.d.mts +8 -0
  2. package/dist/avatar-excess.d.ts +8 -0
  3. package/dist/avatar-excess.js +42 -0
  4. package/dist/avatar-excess.mjs +7 -0
  5. package/dist/avatar-fallback.d.mts +8 -0
  6. package/dist/avatar-fallback.d.ts +8 -0
  7. package/dist/avatar-fallback.js +45 -0
  8. package/dist/avatar-fallback.mjs +7 -0
  9. package/dist/avatar-group.d.mts +54 -0
  10. package/dist/avatar-group.d.ts +54 -0
  11. package/dist/avatar-group.js +166 -0
  12. package/dist/avatar-group.mjs +13 -0
  13. package/dist/avatar-image.d.mts +8 -0
  14. package/dist/avatar-image.d.ts +8 -0
  15. package/dist/avatar-image.js +37 -0
  16. package/dist/avatar-image.mjs +7 -0
  17. package/dist/avatar.d.mts +102 -0
  18. package/dist/avatar.d.ts +102 -0
  19. package/dist/avatar.js +284 -0
  20. package/dist/avatar.mjs +14 -0
  21. package/dist/chunk-43VB6T4V.mjs +36 -0
  22. package/dist/chunk-4VNSI4PL.mjs +13 -0
  23. package/dist/chunk-CY2Z6I23.mjs +18 -0
  24. package/dist/chunk-ITYXDMOF.mjs +74 -0
  25. package/dist/chunk-JVROEGO3.mjs +52 -0
  26. package/dist/chunk-NKXS73IR.mjs +21 -0
  27. package/dist/chunk-QZ7VFGWC.mjs +6 -0
  28. package/dist/chunk-RTYPPBOR.mjs +44 -0
  29. package/dist/chunk-U4MXRXR7.mjs +56 -0
  30. package/dist/chunk-ZK47OSEJ.mjs +26 -0
  31. package/dist/chunk-ZMUFXMG4.mjs +118 -0
  32. package/dist/index.d.mts +5 -0
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.js +406 -0
  35. package/dist/index.mjs +19 -0
  36. package/dist/metafile-cjs.json +1 -0
  37. package/dist/metafile-esm.json +1 -0
  38. package/dist/modules/avatar.connects.d.mts +11 -0
  39. package/dist/modules/avatar.connects.d.ts +11 -0
  40. package/dist/modules/avatar.connects.js +148 -0
  41. package/dist/modules/avatar.connects.mjs +10 -0
  42. package/dist/modules/avatar.hooks.d.mts +8 -0
  43. package/dist/modules/avatar.hooks.d.ts +8 -0
  44. package/dist/modules/avatar.hooks.js +234 -0
  45. package/dist/modules/avatar.hooks.mjs +12 -0
  46. package/dist/modules/avatar.machines.d.mts +14 -0
  47. package/dist/modules/avatar.machines.d.ts +14 -0
  48. package/dist/modules/avatar.machines.js +78 -0
  49. package/dist/modules/avatar.machines.mjs +9 -0
  50. package/dist/modules/avatar.props.d.mts +71 -0
  51. package/dist/modules/avatar.props.d.ts +71 -0
  52. package/dist/modules/avatar.props.js +101 -0
  53. package/dist/modules/avatar.props.mjs +13 -0
  54. package/dist/modules/avatar.types.d.mts +65 -0
  55. package/dist/modules/avatar.types.d.ts +65 -0
  56. package/dist/modules/avatar.types.js +18 -0
  57. package/dist/modules/avatar.types.mjs +0 -0
  58. package/dist/modules/avatar.utils.d.mts +8 -0
  59. package/dist/modules/avatar.utils.d.ts +8 -0
  60. package/dist/modules/avatar.utils.js +49 -0
  61. package/dist/modules/avatar.utils.mjs +11 -0
  62. package/package.json +50 -0
@@ -0,0 +1,102 @@
1
+ import * as vue from 'vue';
2
+ import { AvatarSize, AvatarVariant, AvatarVariantColor } from './modules/avatar.types.js';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ /**
6
+ * MpAvatar component used to display profile image, initial or fallback icon.
7
+ */
8
+ declare const MpAvatar: vue.DefineComponent<{
9
+ id: {
10
+ type: vue.PropType<string | undefined>;
11
+ };
12
+ name: {
13
+ type: vue.PropType<string | undefined>;
14
+ default: string;
15
+ };
16
+ size: {
17
+ type: vue.PropType<AvatarSize | undefined>;
18
+ default: string;
19
+ };
20
+ variant: {
21
+ type: vue.PropType<AvatarVariant | undefined>;
22
+ default: string;
23
+ };
24
+ variantColor: {
25
+ type: vue.PropType<AvatarVariantColor | undefined>;
26
+ };
27
+ hasBorder: {
28
+ type: vue.PropType<boolean | undefined>;
29
+ default: boolean;
30
+ };
31
+ borderColor: {
32
+ type: vue.PropType<string | undefined>;
33
+ };
34
+ src: {
35
+ type: vue.PropType<string | undefined>;
36
+ };
37
+ icon: {
38
+ type: vue.PropType<string | undefined>;
39
+ };
40
+ iconVariant: {
41
+ type: vue.PropType<string | undefined>;
42
+ };
43
+ iconColor: {
44
+ type: vue.PropType<string | undefined>;
45
+ };
46
+ spacing: {
47
+ type: vue.PropType<number | undefined>;
48
+ default: number;
49
+ };
50
+ }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
51
+ id: {
52
+ type: vue.PropType<string | undefined>;
53
+ };
54
+ name: {
55
+ type: vue.PropType<string | undefined>;
56
+ default: string;
57
+ };
58
+ size: {
59
+ type: vue.PropType<AvatarSize | undefined>;
60
+ default: string;
61
+ };
62
+ variant: {
63
+ type: vue.PropType<AvatarVariant | undefined>;
64
+ default: string;
65
+ };
66
+ variantColor: {
67
+ type: vue.PropType<AvatarVariantColor | undefined>;
68
+ };
69
+ hasBorder: {
70
+ type: vue.PropType<boolean | undefined>;
71
+ default: boolean;
72
+ };
73
+ borderColor: {
74
+ type: vue.PropType<string | undefined>;
75
+ };
76
+ src: {
77
+ type: vue.PropType<string | undefined>;
78
+ };
79
+ icon: {
80
+ type: vue.PropType<string | undefined>;
81
+ };
82
+ iconVariant: {
83
+ type: vue.PropType<string | undefined>;
84
+ };
85
+ iconColor: {
86
+ type: vue.PropType<string | undefined>;
87
+ };
88
+ spacing: {
89
+ type: vue.PropType<number | undefined>;
90
+ default: number;
91
+ };
92
+ }>> & {
93
+ onClick?: ((...args: any[]) => any) | undefined;
94
+ }, {
95
+ name: string | undefined;
96
+ size: AvatarSize | undefined;
97
+ variant: AvatarVariant | undefined;
98
+ hasBorder: boolean | undefined;
99
+ spacing: number | undefined;
100
+ }, {}>;
101
+
102
+ export { MpAvatar };
package/dist/avatar.js ADDED
@@ -0,0 +1,284 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/avatar.tsx
22
+ var avatar_exports = {};
23
+ __export(avatar_exports, {
24
+ MpAvatar: () => MpAvatar
25
+ });
26
+ module.exports = __toCommonJS(avatar_exports);
27
+ var import_vue8 = require("vue");
28
+ var import_vue9 = require("vue");
29
+
30
+ // src/modules/avatar.props.ts
31
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
32
+ var avatarProps = {
33
+ id: {
34
+ type: String
35
+ },
36
+ name: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ size: {
41
+ type: String,
42
+ default: "md"
43
+ },
44
+ variant: {
45
+ type: String,
46
+ default: "circle"
47
+ },
48
+ variantColor: {
49
+ type: String
50
+ },
51
+ hasBorder: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ borderColor: {
56
+ type: String
57
+ },
58
+ src: {
59
+ type: String
60
+ },
61
+ icon: {
62
+ type: String
63
+ },
64
+ iconVariant: {
65
+ type: String
66
+ },
67
+ iconColor: {
68
+ type: String
69
+ },
70
+ spacing: {
71
+ type: Number,
72
+ default: 0
73
+ }
74
+ };
75
+ var avatarEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
76
+ var avatarGroupEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
77
+
78
+ // src/modules/avatar.hooks.ts
79
+ var import_vue2 = require("vue");
80
+ var import_vue3 = require("@xstate/vue");
81
+ var import_pixel3_utils2 = require("@mekari/pixel3-utils");
82
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
83
+
84
+ // src/modules/avatar.machines.ts
85
+ var import_xstate = require("xstate");
86
+ function avatarMachine(context) {
87
+ return (0, import_xstate.createMachine)({
88
+ /** @xstate-layout N4IgpgJg5mDOIC5QEMBuyAuyBOA6ANgPbIQCWAdlAMQCSAsgOID6AMgPICCAIgKJcDaABgC6iUAAdCsUhlKFyYkAA9EARgAsATlwBWAMybBANgBMOgDQgAnojMncAdh0BfZ5bSYcBYmUq1GTDwASkFsQUKiSCCS0rLyiioIGtr6hqYW1ogAHA64gll6hUXFha7u6Fh4RCSQ-szBoeEiijEycgpRieoajnrqek6WNghZqrplIB6VuGDY2ITYdaycvALNUa1xHaBdgnq4mgMZw6p6Jq5uIOSEEHCKUzgtUm3xnYgAtEZDH0YTD1U+ChQJ6xdoJRDqEzfBCadR-Cpeaq3CAgl7bZSIHRGfajMzQ04uS7-GZzBaorbghB6QTabrqYx4zIjXI6AoldkXZxAA */
89
+ id: "avatar",
90
+ context,
91
+ initial: "loading",
92
+ states: {
93
+ loading: {
94
+ on: {
95
+ IMG_LOADED: {
96
+ target: "loaded"
97
+ },
98
+ IMG_ERROR: {
99
+ target: "error"
100
+ }
101
+ }
102
+ },
103
+ loaded: {
104
+ on: {
105
+ IMG_ERROR: {
106
+ target: "error"
107
+ }
108
+ }
109
+ },
110
+ error: {
111
+ on: {
112
+ IMG_LOADED: {
113
+ target: "loaded"
114
+ }
115
+ }
116
+ }
117
+ },
118
+ predictableActionArguments: true
119
+ });
120
+ }
121
+ __name(avatarMachine, "avatarMachine");
122
+
123
+ // src/modules/avatar.connects.ts
124
+ var import_vue = require("vue");
125
+ var import_tokens = require("@mekari/pixel3-styled-system/tokens");
126
+
127
+ // src/modules/avatar.utils.ts
128
+ var getInitial = /* @__PURE__ */ __name((value) => {
129
+ const [first, last] = value.split(" ");
130
+ if (first && last)
131
+ return `${first.charAt(0)}${last.charAt(0)}`;
132
+ else
133
+ return first.charAt(0);
134
+ }, "getInitial");
135
+ var background = ["gray", "sky", "teal", "violet", "amber", "rose", "stone", "lime", "pink"];
136
+ var getColor = /* @__PURE__ */ __name(() => {
137
+ const order = Math.floor(Math.random() * background.length);
138
+ return `${background[order]}.400`;
139
+ }, "getColor");
140
+ var isColorInList = /* @__PURE__ */ __name((value) => {
141
+ return background.includes(value);
142
+ }, "isColorInList");
143
+
144
+ // src/modules/avatar.connects.ts
145
+ function avatarConnect(state, send, classes) {
146
+ const {
147
+ id,
148
+ name,
149
+ borderColor,
150
+ hasBorder,
151
+ variantColor,
152
+ src,
153
+ icon,
154
+ iconVariant,
155
+ iconColor,
156
+ spacing,
157
+ onClick
158
+ } = state.context;
159
+ const isLoaded = state.matches("loaded");
160
+ const isClickable = (0, import_vue.computed)(() => {
161
+ var _a, _b;
162
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
163
+ }).value;
164
+ const isRandomColor = isColorInList(variantColor);
165
+ return {
166
+ name,
167
+ src,
168
+ icon,
169
+ isLoaded,
170
+ rootProps: {
171
+ id,
172
+ onClick,
173
+ class: classes.root,
174
+ style: {
175
+ "--mp-avatar--cursor": isClickable ? "pointer" : void 0,
176
+ "--mp-avatar--margin-left": `calc(${import_tokens.token.var(`spacing.${spacing}`)} * -1)`,
177
+ "--mp-avatar--border-color": import_tokens.token.var(`colors.${hasBorder ? borderColor != null ? borderColor : "white" : "white"}`),
178
+ "--mp-avatar--background-color": import_tokens.token.var(`colors.${isRandomColor ? variantColor : getColor()}`)
179
+ },
180
+ "data-has-border": hasBorder,
181
+ "data-pixel-component": "MpAvatar"
182
+ },
183
+ fallbackProps: {
184
+ id: `${id}-fallback`,
185
+ class: classes.fallback,
186
+ "data-pixel-component": "MpAvatarFallback"
187
+ },
188
+ imageProps: {
189
+ id: `${id}-image`,
190
+ alt: name,
191
+ src,
192
+ onLoad() {
193
+ send({
194
+ type: "IMG_LOADED"
195
+ });
196
+ },
197
+ onError() {
198
+ send({
199
+ type: "IMG_ERROR"
200
+ });
201
+ },
202
+ class: classes.image,
203
+ style: {
204
+ "--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
205
+ "--mp-avatar--display": !isLoaded ? "contents" : void 0
206
+ },
207
+ "data-pixel-component": "MpAvatarImage"
208
+ },
209
+ iconProps: {
210
+ id: `${id}-icon`,
211
+ name: icon,
212
+ variant: iconVariant,
213
+ variantColor: iconColor,
214
+ class: classes.icon,
215
+ "data-pixel-component": "MpAvatarIcon"
216
+ }
217
+ };
218
+ }
219
+ __name(avatarConnect, "avatarConnect");
220
+
221
+ // src/modules/avatar.hooks.ts
222
+ var useAvatar = /* @__PURE__ */ __name((props, emit) => {
223
+ var _a;
224
+ const context = (0, import_vue2.ref)(props);
225
+ const {
226
+ state,
227
+ send
228
+ } = (0, import_vue3.useMachine)(avatarMachine({
229
+ ...context.value,
230
+ id: (_a = context.value.id) != null ? _a : `mp-avatar-${(0, import_pixel3_utils2.useId)()}`,
231
+ onClick: (evt) => emit("click", evt)
232
+ }));
233
+ const [avatarProps2] = import_recipes.avatarSlotRecipe.splitVariantProps(context.value);
234
+ const classes = (0, import_recipes.avatarSlotRecipe)(avatarProps2);
235
+ return (0, import_vue2.computed)(() => avatarConnect(state.value, send, classes));
236
+ }, "useAvatar");
237
+
238
+ // src/avatar.tsx
239
+ var import_pixel3_icon = require("@mekari/pixel3-icon");
240
+
241
+ // src/avatar-fallback.tsx
242
+ var import_vue4 = require("vue");
243
+ var import_vue5 = require("vue");
244
+ var MpAvatarFallback = (0, import_vue5.defineComponent)({
245
+ name: "MpAvatarFallback",
246
+ setup() {
247
+ return () => (0, import_vue4.createVNode)("div", null, [(0, import_vue4.createVNode)("svg", {
248
+ "fill": "#ffffff",
249
+ "viewBox": "0 0 128 128",
250
+ "role": "img"
251
+ }, [(0, import_vue4.createVNode)("path", {
252
+ "d": "M103,102.1388 C93.094,111.92 79.3504,118 64.1638,118 C48.8056,118 34.9294,111.768 25,101.7892 L25,95.2 C25,86.8096 31.981,80 40.6,80 L87.4,80 C96.019,80 103,86.8096 103,95.2 L103,102.1388 Z"
253
+ }, null), (0, import_vue4.createVNode)("path", {
254
+ "d": "M63.9961647,24 C51.2938136,24 41,34.2938136 41,46.9961647 C41,59.7061864 51.2938136,70 63.9961647,70 C76.6985159,70 87,59.7061864 87,46.9961647 C87,34.2938136 76.6985159,24 63.9961647,24"
255
+ }, null)])]);
256
+ }
257
+ });
258
+
259
+ // src/avatar-image.tsx
260
+ var import_vue6 = require("vue");
261
+ var import_vue7 = require("vue");
262
+ var MpAvatarImage = (0, import_vue7.defineComponent)({
263
+ name: "MpAvatarImage",
264
+ setup() {
265
+ return () => (0, import_vue6.createVNode)("img", null, null);
266
+ }
267
+ });
268
+
269
+ // src/avatar.tsx
270
+ var MpAvatar = (0, import_vue9.defineComponent)({
271
+ name: "MpAvatar",
272
+ props: avatarProps,
273
+ emits: avatarEmits,
274
+ setup(props, {
275
+ emit
276
+ }) {
277
+ const api = useAvatar(props, emit);
278
+ return () => (0, import_vue8.createVNode)("div", api.value.rootProps, [api.value.src ? (0, import_vue8.createVNode)(MpAvatarImage, api.value.imageProps, null) : void 0, !api.value.icon && !api.value.src || api.value.src && !api.value.isLoaded ? api.value.name ? getInitial(api.value.name) : (0, import_vue8.createVNode)(MpAvatarFallback, api.value.fallbackProps, null) : void 0, api.value.icon && (0, import_vue8.createVNode)(import_pixel3_icon.MpIcon, api.value.iconProps, null)]);
279
+ }
280
+ });
281
+ // Annotate the CommonJS export names for ESM import in node:
282
+ 0 && (module.exports = {
283
+ MpAvatar
284
+ });
@@ -0,0 +1,14 @@
1
+ import {
2
+ MpAvatar
3
+ } from "./chunk-43VB6T4V.mjs";
4
+ import "./chunk-NKXS73IR.mjs";
5
+ import "./chunk-ITYXDMOF.mjs";
6
+ import "./chunk-4VNSI4PL.mjs";
7
+ import "./chunk-JVROEGO3.mjs";
8
+ import "./chunk-U4MXRXR7.mjs";
9
+ import "./chunk-ZMUFXMG4.mjs";
10
+ import "./chunk-ZK47OSEJ.mjs";
11
+ import "./chunk-QZ7VFGWC.mjs";
12
+ export {
13
+ MpAvatar
14
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ MpAvatarFallback
3
+ } from "./chunk-NKXS73IR.mjs";
4
+ import {
5
+ avatarEmits,
6
+ avatarProps
7
+ } from "./chunk-ITYXDMOF.mjs";
8
+ import {
9
+ MpAvatarImage
10
+ } from "./chunk-4VNSI4PL.mjs";
11
+ import {
12
+ useAvatar
13
+ } from "./chunk-JVROEGO3.mjs";
14
+ import {
15
+ getInitial
16
+ } from "./chunk-ZK47OSEJ.mjs";
17
+
18
+ // src/avatar.tsx
19
+ import { createVNode as _createVNode } from "vue";
20
+ import { defineComponent } from "vue";
21
+ import { MpIcon } from "@mekari/pixel3-icon";
22
+ var MpAvatar = defineComponent({
23
+ name: "MpAvatar",
24
+ props: avatarProps,
25
+ emits: avatarEmits,
26
+ setup(props, {
27
+ emit
28
+ }) {
29
+ const api = useAvatar(props, emit);
30
+ return () => _createVNode("div", api.value.rootProps, [api.value.src ? _createVNode(MpAvatarImage, api.value.imageProps, null) : void 0, !api.value.icon && !api.value.src || api.value.src && !api.value.isLoaded ? api.value.name ? getInitial(api.value.name) : _createVNode(MpAvatarFallback, api.value.fallbackProps, null) : void 0, api.value.icon && _createVNode(MpIcon, api.value.iconProps, null)]);
31
+ }
32
+ });
33
+
34
+ export {
35
+ MpAvatar
36
+ };
@@ -0,0 +1,13 @@
1
+ // src/avatar-image.tsx
2
+ import { createVNode as _createVNode } from "vue";
3
+ import { defineComponent } from "vue";
4
+ var MpAvatarImage = defineComponent({
5
+ name: "MpAvatarImage",
6
+ setup() {
7
+ return () => _createVNode("img", null, null);
8
+ }
9
+ });
10
+
11
+ export {
12
+ MpAvatarImage
13
+ };
@@ -0,0 +1,18 @@
1
+ // src/avatar-excess.tsx
2
+ import { createVNode as _createVNode } from "vue";
3
+ import { defineComponent } from "vue";
4
+ var MpAvatarExcess = defineComponent({
5
+ name: "MpAvatarExcess",
6
+ setup(_, {
7
+ slots
8
+ }) {
9
+ return () => {
10
+ var _a;
11
+ return _createVNode("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
12
+ };
13
+ }
14
+ });
15
+
16
+ export {
17
+ MpAvatarExcess
18
+ };
@@ -0,0 +1,74 @@
1
+ // src/modules/avatar.props.ts
2
+ import { declareEmit } from "@mekari/pixel3-utils";
3
+ var avatarProps = {
4
+ id: {
5
+ type: String
6
+ },
7
+ name: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ size: {
12
+ type: String,
13
+ default: "md"
14
+ },
15
+ variant: {
16
+ type: String,
17
+ default: "circle"
18
+ },
19
+ variantColor: {
20
+ type: String
21
+ },
22
+ hasBorder: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ borderColor: {
27
+ type: String
28
+ },
29
+ src: {
30
+ type: String
31
+ },
32
+ icon: {
33
+ type: String
34
+ },
35
+ iconVariant: {
36
+ type: String
37
+ },
38
+ iconColor: {
39
+ type: String
40
+ },
41
+ spacing: {
42
+ type: Number,
43
+ default: 0
44
+ }
45
+ };
46
+ var avatarGroupProps = {
47
+ id: {
48
+ type: String
49
+ },
50
+ size: {
51
+ type: String,
52
+ default: "md"
53
+ },
54
+ max: {
55
+ type: Number,
56
+ default: 3
57
+ },
58
+ spacing: {
59
+ type: Number,
60
+ default: -2
61
+ },
62
+ borderColor: {
63
+ type: String
64
+ }
65
+ };
66
+ var avatarEmits = declareEmit(["click"]);
67
+ var avatarGroupEmits = declareEmit(["click"]);
68
+
69
+ export {
70
+ avatarProps,
71
+ avatarGroupProps,
72
+ avatarEmits,
73
+ avatarGroupEmits
74
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ avatarGroupMachine,
3
+ avatarMachine
4
+ } from "./chunk-U4MXRXR7.mjs";
5
+ import {
6
+ avatarConnect,
7
+ avatarGroupConnect
8
+ } from "./chunk-ZMUFXMG4.mjs";
9
+ import {
10
+ __name
11
+ } from "./chunk-QZ7VFGWC.mjs";
12
+
13
+ // src/modules/avatar.hooks.ts
14
+ import { computed, ref } from "vue";
15
+ import { useMachine } from "@xstate/vue";
16
+ import { useId } from "@mekari/pixel3-utils";
17
+ import { avatarSlotRecipe, avatarGroupSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
18
+ var useAvatar = /* @__PURE__ */ __name((props, emit) => {
19
+ var _a;
20
+ const context = ref(props);
21
+ const {
22
+ state,
23
+ send
24
+ } = useMachine(avatarMachine({
25
+ ...context.value,
26
+ id: (_a = context.value.id) != null ? _a : `mp-avatar-${useId()}`,
27
+ onClick: (evt) => emit("click", evt)
28
+ }));
29
+ const [avatarProps] = avatarSlotRecipe.splitVariantProps(context.value);
30
+ const classes = avatarSlotRecipe(avatarProps);
31
+ return computed(() => avatarConnect(state.value, send, classes));
32
+ }, "useAvatar");
33
+ var useAvatarGroup = /* @__PURE__ */ __name((props, emit) => {
34
+ var _a;
35
+ const context = ref(props);
36
+ const {
37
+ state,
38
+ send
39
+ } = useMachine(avatarGroupMachine({
40
+ ...context.value,
41
+ id: (_a = context.value.id) != null ? _a : `mp-avatar-group-${useId()}`,
42
+ onClick: (evt) => emit("click", evt)
43
+ }));
44
+ const [avatarGroupProps] = avatarGroupSlotRecipe.splitVariantProps(context.value);
45
+ const classes = avatarGroupSlotRecipe(avatarGroupProps);
46
+ return computed(() => avatarGroupConnect(state.value, send, classes));
47
+ }, "useAvatarGroup");
48
+
49
+ export {
50
+ useAvatar,
51
+ useAvatarGroup
52
+ };
@@ -0,0 +1,21 @@
1
+ // src/avatar-fallback.tsx
2
+ import { createVNode as _createVNode } from "vue";
3
+ import { defineComponent } from "vue";
4
+ var MpAvatarFallback = defineComponent({
5
+ name: "MpAvatarFallback",
6
+ setup() {
7
+ return () => _createVNode("div", null, [_createVNode("svg", {
8
+ "fill": "#ffffff",
9
+ "viewBox": "0 0 128 128",
10
+ "role": "img"
11
+ }, [_createVNode("path", {
12
+ "d": "M103,102.1388 C93.094,111.92 79.3504,118 64.1638,118 C48.8056,118 34.9294,111.768 25,101.7892 L25,95.2 C25,86.8096 31.981,80 40.6,80 L87.4,80 C96.019,80 103,86.8096 103,95.2 L103,102.1388 Z"
13
+ }, null), _createVNode("path", {
14
+ "d": "M63.9961647,24 C51.2938136,24 41,34.2938136 41,46.9961647 C41,59.7061864 51.2938136,70 63.9961647,70 C76.6985159,70 87,59.7061864 87,46.9961647 C87,34.2938136 76.6985159,24 63.9961647,24"
15
+ }, null)])]);
16
+ }
17
+ });
18
+
19
+ export {
20
+ MpAvatarFallback
21
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export {
5
+ __name
6
+ };
@@ -0,0 +1,44 @@
1
+ import {
2
+ MpAvatarExcess
3
+ } from "./chunk-CY2Z6I23.mjs";
4
+ import {
5
+ avatarGroupEmits,
6
+ avatarGroupProps
7
+ } from "./chunk-ITYXDMOF.mjs";
8
+ import {
9
+ useAvatarGroup
10
+ } from "./chunk-JVROEGO3.mjs";
11
+
12
+ // src/avatar-group.tsx
13
+ import { createVNode as _createVNode } from "vue";
14
+ import { defineComponent, computed, cloneVNode } from "vue";
15
+ import { objectFilterUndefined, getChildren } from "@mekari/pixel3-utils";
16
+ var MpAvatarGroup = defineComponent({
17
+ name: "MpAvatarGroup",
18
+ props: avatarGroupProps,
19
+ emits: avatarGroupEmits,
20
+ setup(props, {
21
+ slots,
22
+ emit
23
+ }) {
24
+ const api = useAvatarGroup(props, emit);
25
+ const children = computed(() => getChildren(slots));
26
+ const count = computed(() => children.value.length - (props.max || 0));
27
+ const cloneChildren = computed(() => computed(() => children.value.slice(0, props.max)).value.map((vnode, index) => {
28
+ const overrideProps = objectFilterUndefined({
29
+ size: props.size,
30
+ spacing: index === 0 ? 0 : props.spacing,
31
+ hasBorder: true,
32
+ borderColor: props.borderColor
33
+ });
34
+ return cloneVNode(vnode, overrideProps);
35
+ }));
36
+ return () => _createVNode("div", api.value.rootProps, [cloneChildren.value, count.value > 0 && props.max !== 0 && _createVNode(MpAvatarExcess, api.value.excessProps, {
37
+ default: () => [`+${count.value}`]
38
+ })]);
39
+ }
40
+ });
41
+
42
+ export {
43
+ MpAvatarGroup
44
+ };