@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,56 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-QZ7VFGWC.mjs";
4
+
5
+ // src/modules/avatar.machines.ts
6
+ import { createMachine } from "xstate";
7
+ function avatarMachine(context) {
8
+ return createMachine({
9
+ /** @xstate-layout N4IgpgJg5mDOIC5QEMBuyAuyBOA6ANgPbIQCWAdlAMQCSAsgOID6AMgPICCAIgKJcDaABgC6iUAAdCsUhlKFyYkAA9EARgAsATlwBWAMybBANgBMOgDQgAnojMncAdh0BfZ5bSYcBYmUq1GTDwASkFsQUKiSCCS0rLyiioIGtr6hqYW1ogAHA64gll6hUXFha7u6Fh4RCSQ-szBoeEiijEycgpRieoajnrqek6WNghZqrplIB6VuGDY2ITYdaycvALNUa1xHaBdgnq4mgMZw6p6Jq5uIOSEEHCKUzgtUm3xnYgAtEZDH0YTD1U+ChQJ6xdoJRDqEzfBCadR-Cpeaq3CAgl7bZSIHRGfajMzQ04uS7-GZzBaorbghB6QTabrqYx4zIjXI6AoldkXZxAA */
10
+ id: "avatar",
11
+ context,
12
+ initial: "loading",
13
+ states: {
14
+ loading: {
15
+ on: {
16
+ IMG_LOADED: {
17
+ target: "loaded"
18
+ },
19
+ IMG_ERROR: {
20
+ target: "error"
21
+ }
22
+ }
23
+ },
24
+ loaded: {
25
+ on: {
26
+ IMG_ERROR: {
27
+ target: "error"
28
+ }
29
+ }
30
+ },
31
+ error: {
32
+ on: {
33
+ IMG_LOADED: {
34
+ target: "loaded"
35
+ }
36
+ }
37
+ }
38
+ },
39
+ predictableActionArguments: true
40
+ });
41
+ }
42
+ __name(avatarMachine, "avatarMachine");
43
+ function avatarGroupMachine(context) {
44
+ return createMachine({
45
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
46
+ id: "avatar-group",
47
+ context,
48
+ predictableActionArguments: true
49
+ });
50
+ }
51
+ __name(avatarGroupMachine, "avatarGroupMachine");
52
+
53
+ export {
54
+ avatarMachine,
55
+ avatarGroupMachine
56
+ };
@@ -0,0 +1,26 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-QZ7VFGWC.mjs";
4
+
5
+ // src/modules/avatar.utils.ts
6
+ var getInitial = /* @__PURE__ */ __name((value) => {
7
+ const [first, last] = value.split(" ");
8
+ if (first && last)
9
+ return `${first.charAt(0)}${last.charAt(0)}`;
10
+ else
11
+ return first.charAt(0);
12
+ }, "getInitial");
13
+ var background = ["gray", "sky", "teal", "violet", "amber", "rose", "stone", "lime", "pink"];
14
+ var getColor = /* @__PURE__ */ __name(() => {
15
+ const order = Math.floor(Math.random() * background.length);
16
+ return `${background[order]}.400`;
17
+ }, "getColor");
18
+ var isColorInList = /* @__PURE__ */ __name((value) => {
19
+ return background.includes(value);
20
+ }, "isColorInList");
21
+
22
+ export {
23
+ getInitial,
24
+ getColor,
25
+ isColorInList
26
+ };
@@ -0,0 +1,118 @@
1
+ import {
2
+ getColor,
3
+ isColorInList
4
+ } from "./chunk-ZK47OSEJ.mjs";
5
+ import {
6
+ __name
7
+ } from "./chunk-QZ7VFGWC.mjs";
8
+
9
+ // src/modules/avatar.connects.ts
10
+ import { computed, getCurrentInstance } from "vue";
11
+ import { token } from "@mekari/pixel3-styled-system/tokens";
12
+ function avatarConnect(state, send, classes) {
13
+ const {
14
+ id,
15
+ name,
16
+ borderColor,
17
+ hasBorder,
18
+ variantColor,
19
+ src,
20
+ icon,
21
+ iconVariant,
22
+ iconColor,
23
+ spacing,
24
+ onClick
25
+ } = state.context;
26
+ const isLoaded = state.matches("loaded");
27
+ const isClickable = computed(() => {
28
+ var _a, _b;
29
+ return !!((_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
30
+ }).value;
31
+ const isRandomColor = isColorInList(variantColor);
32
+ return {
33
+ name,
34
+ src,
35
+ icon,
36
+ isLoaded,
37
+ rootProps: {
38
+ id,
39
+ onClick,
40
+ class: classes.root,
41
+ style: {
42
+ "--mp-avatar--cursor": isClickable ? "pointer" : void 0,
43
+ "--mp-avatar--margin-left": `calc(${token.var(`spacing.${spacing}`)} * -1)`,
44
+ "--mp-avatar--border-color": token.var(`colors.${hasBorder ? borderColor != null ? borderColor : "white" : "white"}`),
45
+ "--mp-avatar--background-color": token.var(`colors.${isRandomColor ? variantColor : getColor()}`)
46
+ },
47
+ "data-has-border": hasBorder,
48
+ "data-pixel-component": "MpAvatar"
49
+ },
50
+ fallbackProps: {
51
+ id: `${id}-fallback`,
52
+ class: classes.fallback,
53
+ "data-pixel-component": "MpAvatarFallback"
54
+ },
55
+ imageProps: {
56
+ id: `${id}-image`,
57
+ alt: name,
58
+ src,
59
+ onLoad() {
60
+ send({
61
+ type: "IMG_LOADED"
62
+ });
63
+ },
64
+ onError() {
65
+ send({
66
+ type: "IMG_ERROR"
67
+ });
68
+ },
69
+ class: classes.image,
70
+ style: {
71
+ "--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
72
+ "--mp-avatar--display": !isLoaded ? "contents" : void 0
73
+ },
74
+ "data-pixel-component": "MpAvatarImage"
75
+ },
76
+ iconProps: {
77
+ id: `${id}-icon`,
78
+ name: icon,
79
+ variant: iconVariant,
80
+ variantColor: iconColor,
81
+ class: classes.icon,
82
+ "data-pixel-component": "MpAvatarIcon"
83
+ }
84
+ };
85
+ }
86
+ __name(avatarConnect, "avatarConnect");
87
+ function avatarGroupConnect(state, send, classes) {
88
+ const {
89
+ id,
90
+ onClick
91
+ } = state.context;
92
+ const isClickable = computed(() => {
93
+ var _a, _b;
94
+ return !!((_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
95
+ }).value;
96
+ return {
97
+ rootProps: {
98
+ id,
99
+ class: classes.root,
100
+ "data-pixel-component": "MpAvatarGroup"
101
+ },
102
+ excessProps: {
103
+ id: `${id}-excess`,
104
+ onClick,
105
+ class: classes.excess,
106
+ style: {
107
+ "--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
108
+ },
109
+ "data-pixel-component": "MpAvatarExcess"
110
+ }
111
+ };
112
+ }
113
+ __name(avatarGroupConnect, "avatarGroupConnect");
114
+
115
+ export {
116
+ avatarConnect,
117
+ avatarGroupConnect
118
+ };
@@ -0,0 +1,5 @@
1
+ export { MpAvatar } from './avatar.mjs';
2
+ export { MpAvatarGroup } from './avatar-group.mjs';
3
+ export { AvatarGroupProps, AvatarProps, AvatarSize, AvatarVariant, AvatarVariantColor } from './modules/avatar.types.mjs';
4
+ import 'vue';
5
+ import '@mekari/pixel3-utils';
@@ -0,0 +1,5 @@
1
+ export { MpAvatar } from './avatar.js';
2
+ export { MpAvatarGroup } from './avatar-group.js';
3
+ export { AvatarGroupProps, AvatarProps, AvatarSize, AvatarVariant, AvatarVariantColor } from './modules/avatar.types.js';
4
+ import 'vue';
5
+ import '@mekari/pixel3-utils';
package/dist/index.js ADDED
@@ -0,0 +1,406 @@
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/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ MpAvatar: () => MpAvatar,
25
+ MpAvatarGroup: () => MpAvatarGroup
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
28
+
29
+ // src/avatar.tsx
30
+ var import_vue8 = require("vue");
31
+ var import_vue9 = require("vue");
32
+
33
+ // src/modules/avatar.props.ts
34
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
35
+ var avatarProps = {
36
+ id: {
37
+ type: String
38
+ },
39
+ name: {
40
+ type: String,
41
+ default: ""
42
+ },
43
+ size: {
44
+ type: String,
45
+ default: "md"
46
+ },
47
+ variant: {
48
+ type: String,
49
+ default: "circle"
50
+ },
51
+ variantColor: {
52
+ type: String
53
+ },
54
+ hasBorder: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ borderColor: {
59
+ type: String
60
+ },
61
+ src: {
62
+ type: String
63
+ },
64
+ icon: {
65
+ type: String
66
+ },
67
+ iconVariant: {
68
+ type: String
69
+ },
70
+ iconColor: {
71
+ type: String
72
+ },
73
+ spacing: {
74
+ type: Number,
75
+ default: 0
76
+ }
77
+ };
78
+ var avatarGroupProps = {
79
+ id: {
80
+ type: String
81
+ },
82
+ size: {
83
+ type: String,
84
+ default: "md"
85
+ },
86
+ max: {
87
+ type: Number,
88
+ default: 3
89
+ },
90
+ spacing: {
91
+ type: Number,
92
+ default: -2
93
+ },
94
+ borderColor: {
95
+ type: String
96
+ }
97
+ };
98
+ var avatarEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
99
+ var avatarGroupEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
100
+
101
+ // src/modules/avatar.hooks.ts
102
+ var import_vue2 = require("vue");
103
+ var import_vue3 = require("@xstate/vue");
104
+ var import_pixel3_utils2 = require("@mekari/pixel3-utils");
105
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
106
+
107
+ // src/modules/avatar.machines.ts
108
+ var import_xstate = require("xstate");
109
+ function avatarMachine(context) {
110
+ return (0, import_xstate.createMachine)({
111
+ /** @xstate-layout N4IgpgJg5mDOIC5QEMBuyAuyBOA6ANgPbIQCWAdlAMQCSAsgOID6AMgPICCAIgKJcDaABgC6iUAAdCsUhlKFyYkAA9EARgAsATlwBWAMybBANgBMOgDQgAnojMncAdh0BfZ5bSYcBYmUq1GTDwASkFsQUKiSCCS0rLyiioIGtr6hqYW1ogAHA64gll6hUXFha7u6Fh4RCSQ-szBoeEiijEycgpRieoajnrqek6WNghZqrplIB6VuGDY2ITYdaycvALNUa1xHaBdgnq4mgMZw6p6Jq5uIOSEEHCKUzgtUm3xnYgAtEZDH0YTD1U+ChQJ6xdoJRDqEzfBCadR-Cpeaq3CAgl7bZSIHRGfajMzQ04uS7-GZzBaorbghB6QTabrqYx4zIjXI6AoldkXZxAA */
112
+ id: "avatar",
113
+ context,
114
+ initial: "loading",
115
+ states: {
116
+ loading: {
117
+ on: {
118
+ IMG_LOADED: {
119
+ target: "loaded"
120
+ },
121
+ IMG_ERROR: {
122
+ target: "error"
123
+ }
124
+ }
125
+ },
126
+ loaded: {
127
+ on: {
128
+ IMG_ERROR: {
129
+ target: "error"
130
+ }
131
+ }
132
+ },
133
+ error: {
134
+ on: {
135
+ IMG_LOADED: {
136
+ target: "loaded"
137
+ }
138
+ }
139
+ }
140
+ },
141
+ predictableActionArguments: true
142
+ });
143
+ }
144
+ __name(avatarMachine, "avatarMachine");
145
+ function avatarGroupMachine(context) {
146
+ return (0, import_xstate.createMachine)({
147
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
148
+ id: "avatar-group",
149
+ context,
150
+ predictableActionArguments: true
151
+ });
152
+ }
153
+ __name(avatarGroupMachine, "avatarGroupMachine");
154
+
155
+ // src/modules/avatar.connects.ts
156
+ var import_vue = require("vue");
157
+ var import_tokens = require("@mekari/pixel3-styled-system/tokens");
158
+
159
+ // src/modules/avatar.utils.ts
160
+ var getInitial = /* @__PURE__ */ __name((value) => {
161
+ const [first, last] = value.split(" ");
162
+ if (first && last)
163
+ return `${first.charAt(0)}${last.charAt(0)}`;
164
+ else
165
+ return first.charAt(0);
166
+ }, "getInitial");
167
+ var background = ["gray", "sky", "teal", "violet", "amber", "rose", "stone", "lime", "pink"];
168
+ var getColor = /* @__PURE__ */ __name(() => {
169
+ const order = Math.floor(Math.random() * background.length);
170
+ return `${background[order]}.400`;
171
+ }, "getColor");
172
+ var isColorInList = /* @__PURE__ */ __name((value) => {
173
+ return background.includes(value);
174
+ }, "isColorInList");
175
+
176
+ // src/modules/avatar.connects.ts
177
+ function avatarConnect(state, send, classes) {
178
+ const {
179
+ id,
180
+ name,
181
+ borderColor,
182
+ hasBorder,
183
+ variantColor,
184
+ src,
185
+ icon,
186
+ iconVariant,
187
+ iconColor,
188
+ spacing,
189
+ onClick
190
+ } = state.context;
191
+ const isLoaded = state.matches("loaded");
192
+ const isClickable = (0, import_vue.computed)(() => {
193
+ var _a, _b;
194
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
195
+ }).value;
196
+ const isRandomColor = isColorInList(variantColor);
197
+ return {
198
+ name,
199
+ src,
200
+ icon,
201
+ isLoaded,
202
+ rootProps: {
203
+ id,
204
+ onClick,
205
+ class: classes.root,
206
+ style: {
207
+ "--mp-avatar--cursor": isClickable ? "pointer" : void 0,
208
+ "--mp-avatar--margin-left": `calc(${import_tokens.token.var(`spacing.${spacing}`)} * -1)`,
209
+ "--mp-avatar--border-color": import_tokens.token.var(`colors.${hasBorder ? borderColor != null ? borderColor : "white" : "white"}`),
210
+ "--mp-avatar--background-color": import_tokens.token.var(`colors.${isRandomColor ? variantColor : getColor()}`)
211
+ },
212
+ "data-has-border": hasBorder,
213
+ "data-pixel-component": "MpAvatar"
214
+ },
215
+ fallbackProps: {
216
+ id: `${id}-fallback`,
217
+ class: classes.fallback,
218
+ "data-pixel-component": "MpAvatarFallback"
219
+ },
220
+ imageProps: {
221
+ id: `${id}-image`,
222
+ alt: name,
223
+ src,
224
+ onLoad() {
225
+ send({
226
+ type: "IMG_LOADED"
227
+ });
228
+ },
229
+ onError() {
230
+ send({
231
+ type: "IMG_ERROR"
232
+ });
233
+ },
234
+ class: classes.image,
235
+ style: {
236
+ "--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
237
+ "--mp-avatar--display": !isLoaded ? "contents" : void 0
238
+ },
239
+ "data-pixel-component": "MpAvatarImage"
240
+ },
241
+ iconProps: {
242
+ id: `${id}-icon`,
243
+ name: icon,
244
+ variant: iconVariant,
245
+ variantColor: iconColor,
246
+ class: classes.icon,
247
+ "data-pixel-component": "MpAvatarIcon"
248
+ }
249
+ };
250
+ }
251
+ __name(avatarConnect, "avatarConnect");
252
+ function avatarGroupConnect(state, send, classes) {
253
+ const {
254
+ id,
255
+ onClick
256
+ } = state.context;
257
+ const isClickable = (0, import_vue.computed)(() => {
258
+ var _a, _b;
259
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
260
+ }).value;
261
+ return {
262
+ rootProps: {
263
+ id,
264
+ class: classes.root,
265
+ "data-pixel-component": "MpAvatarGroup"
266
+ },
267
+ excessProps: {
268
+ id: `${id}-excess`,
269
+ onClick,
270
+ class: classes.excess,
271
+ style: {
272
+ "--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
273
+ },
274
+ "data-pixel-component": "MpAvatarExcess"
275
+ }
276
+ };
277
+ }
278
+ __name(avatarGroupConnect, "avatarGroupConnect");
279
+
280
+ // src/modules/avatar.hooks.ts
281
+ var useAvatar = /* @__PURE__ */ __name((props, emit) => {
282
+ var _a;
283
+ const context = (0, import_vue2.ref)(props);
284
+ const {
285
+ state,
286
+ send
287
+ } = (0, import_vue3.useMachine)(avatarMachine({
288
+ ...context.value,
289
+ id: (_a = context.value.id) != null ? _a : `mp-avatar-${(0, import_pixel3_utils2.useId)()}`,
290
+ onClick: (evt) => emit("click", evt)
291
+ }));
292
+ const [avatarProps2] = import_recipes.avatarSlotRecipe.splitVariantProps(context.value);
293
+ const classes = (0, import_recipes.avatarSlotRecipe)(avatarProps2);
294
+ return (0, import_vue2.computed)(() => avatarConnect(state.value, send, classes));
295
+ }, "useAvatar");
296
+ var useAvatarGroup = /* @__PURE__ */ __name((props, emit) => {
297
+ var _a;
298
+ const context = (0, import_vue2.ref)(props);
299
+ const {
300
+ state,
301
+ send
302
+ } = (0, import_vue3.useMachine)(avatarGroupMachine({
303
+ ...context.value,
304
+ id: (_a = context.value.id) != null ? _a : `mp-avatar-group-${(0, import_pixel3_utils2.useId)()}`,
305
+ onClick: (evt) => emit("click", evt)
306
+ }));
307
+ const [avatarGroupProps2] = import_recipes.avatarGroupSlotRecipe.splitVariantProps(context.value);
308
+ const classes = (0, import_recipes.avatarGroupSlotRecipe)(avatarGroupProps2);
309
+ return (0, import_vue2.computed)(() => avatarGroupConnect(state.value, send, classes));
310
+ }, "useAvatarGroup");
311
+
312
+ // src/avatar.tsx
313
+ var import_pixel3_icon = require("@mekari/pixel3-icon");
314
+
315
+ // src/avatar-fallback.tsx
316
+ var import_vue4 = require("vue");
317
+ var import_vue5 = require("vue");
318
+ var MpAvatarFallback = (0, import_vue5.defineComponent)({
319
+ name: "MpAvatarFallback",
320
+ setup() {
321
+ return () => (0, import_vue4.createVNode)("div", null, [(0, import_vue4.createVNode)("svg", {
322
+ "fill": "#ffffff",
323
+ "viewBox": "0 0 128 128",
324
+ "role": "img"
325
+ }, [(0, import_vue4.createVNode)("path", {
326
+ "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"
327
+ }, null), (0, import_vue4.createVNode)("path", {
328
+ "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"
329
+ }, null)])]);
330
+ }
331
+ });
332
+
333
+ // src/avatar-image.tsx
334
+ var import_vue6 = require("vue");
335
+ var import_vue7 = require("vue");
336
+ var MpAvatarImage = (0, import_vue7.defineComponent)({
337
+ name: "MpAvatarImage",
338
+ setup() {
339
+ return () => (0, import_vue6.createVNode)("img", null, null);
340
+ }
341
+ });
342
+
343
+ // src/avatar.tsx
344
+ var MpAvatar = (0, import_vue9.defineComponent)({
345
+ name: "MpAvatar",
346
+ props: avatarProps,
347
+ emits: avatarEmits,
348
+ setup(props, {
349
+ emit
350
+ }) {
351
+ const api = useAvatar(props, emit);
352
+ 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)]);
353
+ }
354
+ });
355
+
356
+ // src/avatar-group.tsx
357
+ var import_vue12 = require("vue");
358
+ var import_vue13 = require("vue");
359
+ var import_pixel3_utils3 = require("@mekari/pixel3-utils");
360
+
361
+ // src/avatar-excess.tsx
362
+ var import_vue10 = require("vue");
363
+ var import_vue11 = require("vue");
364
+ var MpAvatarExcess = (0, import_vue11.defineComponent)({
365
+ name: "MpAvatarExcess",
366
+ setup(_, {
367
+ slots
368
+ }) {
369
+ return () => {
370
+ var _a;
371
+ return (0, import_vue10.createVNode)("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
372
+ };
373
+ }
374
+ });
375
+
376
+ // src/avatar-group.tsx
377
+ var MpAvatarGroup = (0, import_vue13.defineComponent)({
378
+ name: "MpAvatarGroup",
379
+ props: avatarGroupProps,
380
+ emits: avatarGroupEmits,
381
+ setup(props, {
382
+ slots,
383
+ emit
384
+ }) {
385
+ const api = useAvatarGroup(props, emit);
386
+ const children = (0, import_vue13.computed)(() => (0, import_pixel3_utils3.getChildren)(slots));
387
+ const count = (0, import_vue13.computed)(() => children.value.length - (props.max || 0));
388
+ const cloneChildren = (0, import_vue13.computed)(() => (0, import_vue13.computed)(() => children.value.slice(0, props.max)).value.map((vnode, index) => {
389
+ const overrideProps = (0, import_pixel3_utils3.objectFilterUndefined)({
390
+ size: props.size,
391
+ spacing: index === 0 ? 0 : props.spacing,
392
+ hasBorder: true,
393
+ borderColor: props.borderColor
394
+ });
395
+ return (0, import_vue13.cloneVNode)(vnode, overrideProps);
396
+ }));
397
+ return () => (0, import_vue12.createVNode)("div", api.value.rootProps, [cloneChildren.value, count.value > 0 && props.max !== 0 && (0, import_vue12.createVNode)(MpAvatarExcess, api.value.excessProps, {
398
+ default: () => [`+${count.value}`]
399
+ })]);
400
+ }
401
+ });
402
+ // Annotate the CommonJS export names for ESM import in node:
403
+ 0 && (module.exports = {
404
+ MpAvatar,
405
+ MpAvatarGroup
406
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import {
2
+ MpAvatarGroup
3
+ } from "./chunk-RTYPPBOR.mjs";
4
+ import "./chunk-CY2Z6I23.mjs";
5
+ import {
6
+ MpAvatar
7
+ } from "./chunk-43VB6T4V.mjs";
8
+ import "./chunk-NKXS73IR.mjs";
9
+ import "./chunk-ITYXDMOF.mjs";
10
+ import "./chunk-4VNSI4PL.mjs";
11
+ import "./chunk-JVROEGO3.mjs";
12
+ import "./chunk-U4MXRXR7.mjs";
13
+ import "./chunk-ZMUFXMG4.mjs";
14
+ import "./chunk-ZK47OSEJ.mjs";
15
+ import "./chunk-QZ7VFGWC.mjs";
16
+ export {
17
+ MpAvatar,
18
+ MpAvatarGroup
19
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/avatar-excess.tsx":{"bytes":424,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true}],"format":"esm"},"src/avatar-fallback.tsx":{"bytes":974,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true}],"format":"esm"},"src/modules/avatar.props.ts":{"bytes":1862,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./avatar.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/avatar.machines.ts":{"bytes":1580,"imports":[{"path":"xstate","kind":"import-statement","external":true},{"path":"./avatar.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/avatar.utils.ts":{"bytes":627,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/avatar.connects.ts":{"bytes":3024,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"import-statement","external":true},{"path":"src/modules/avatar.utils.ts","kind":"import-statement","original":"./avatar.utils"},{"path":"./avatar.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/avatar.hooks.ts":{"bytes":1599,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@xstate/vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/avatar.machines.ts","kind":"import-statement","original":"./avatar.machines"},{"path":"src/modules/avatar.connects.ts","kind":"import-statement","original":"./avatar.connects"},{"path":"./avatar.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/avatar-group.tsx":{"bytes":1488,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"src/modules/avatar.props.ts","kind":"import-statement","original":"./modules/avatar.props"},{"path":"src/modules/avatar.hooks.ts","kind":"import-statement","original":"./modules/avatar.hooks"},{"path":"src/avatar-excess.tsx","kind":"import-statement","original":"./avatar-excess"}],"format":"esm"},"src/avatar-image.tsx":{"bytes":383,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true}],"format":"esm"},"src/avatar.tsx":{"bytes":1179,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/avatar.props.ts","kind":"import-statement","original":"./modules/avatar.props"},{"path":"src/modules/avatar.hooks.ts","kind":"import-statement","original":"./modules/avatar.hooks"},{"path":"src/modules/avatar.utils.ts","kind":"import-statement","original":"./modules/avatar.utils"},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"src/avatar-fallback.tsx","kind":"import-statement","original":"./avatar-fallback"},{"path":"src/avatar-image.tsx","kind":"import-statement","original":"./avatar-image"}],"format":"esm"},"src/index.ts":{"bytes":359,"imports":[{"path":"src/avatar.tsx","kind":"import-statement","original":"./avatar"},{"path":"src/avatar-group.tsx","kind":"import-statement","original":"./avatar-group"}],"format":"esm"},"src/modules/avatar.types.ts":{"bytes":1788,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/avatar-excess.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/avatar-excess.tsx","inputs":{"src/avatar-excess.tsx":{"bytesInOutput":503}},"bytes":1436},"dist/avatar-fallback.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/avatar-fallback.tsx","inputs":{"src/avatar-fallback.tsx":{"bytesInOutput":1038}},"bytes":1975},"dist/avatar-group.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/avatar-group.tsx","inputs":{"src/avatar-group.tsx":{"bytesInOutput":1422},"src/modules/avatar.props.ts":{"bytesInOutput":444},"src/modules/avatar.hooks.ts":{"bytesInOutput":877},"src/modules/avatar.machines.ts":{"bytesInOutput":363},"src/modules/avatar.connects.ts":{"bytesInOutput":829},"src/avatar-excess.tsx":{"bytesInOutput":342}},"bytes":5515},"dist/avatar-image.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/avatar-image.tsx","inputs":{"src/avatar-image.tsx":{"bytesInOutput":390}},"bytes":1321},"dist/avatar.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/avatar.tsx","inputs":{"src/avatar.tsx":{"bytesInOutput":937},"src/modules/avatar.props.ts":{"bytesInOutput":735},"src/modules/avatar.hooks.ts":{"bytesInOutput":831},"src/modules/avatar.machines.ts":{"bytesInOutput":1111},"src/modules/avatar.connects.ts":{"bytesInOutput":2139},"src/modules/avatar.utils.ts":{"bytesInOutput":589},"src/avatar-fallback.tsx":{"bytesInOutput":870},"src/avatar-image.tsx":{"bytesInOutput":234}},"bytes":8780},"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":159},"src/avatar.tsx":{"bytesInOutput":807},"src/modules/avatar.props.ts":{"bytesInOutput":981},"src/modules/avatar.hooks.ts":{"bytesInOutput":1502},"src/modules/avatar.machines.ts":{"bytesInOutput":1435},"src/modules/avatar.connects.ts":{"bytesInOutput":2867},"src/modules/avatar.utils.ts":{"bytesInOutput":589},"src/avatar-fallback.tsx":{"bytesInOutput":870},"src/avatar-image.tsx":{"bytesInOutput":234},"src/avatar-group.tsx":{"bytesInOutput":1274},"src/avatar-excess.tsx":{"bytesInOutput":346}},"bytes":12508},"dist/modules/avatar.connects.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/avatar.connects.ts","inputs":{"src/modules/avatar.connects.ts":{"bytesInOutput":3082},"src/modules/avatar.utils.ts":{"bytesInOutput":370}},"bytes":4572},"dist/modules/avatar.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/avatar.hooks.ts","inputs":{"src/modules/avatar.hooks.ts":{"bytesInOutput":1685},"src/modules/avatar.machines.ts":{"bytesInOutput":1435},"src/modules/avatar.connects.ts":{"bytesInOutput":2867},"src/modules/avatar.utils.ts":{"bytesInOutput":370}},"bytes":7568},"dist/modules/avatar.machines.js":{"imports":[{"path":"xstate","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/avatar.machines.ts","inputs":{"src/modules/avatar.machines.ts":{"bytesInOutput":1650}},"bytes":2703},"dist/modules/avatar.props.js":{"imports":[{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/avatar.props.ts","inputs":{"src/modules/avatar.props.ts":{"bytesInOutput":1257}},"bytes":2248},"dist/modules/avatar.types.js":{"imports":[],"exports":[],"entryPoint":"src/modules/avatar.types.ts","inputs":{"src/modules/avatar.types.ts":{"bytesInOutput":84}},"bytes":787},"dist/modules/avatar.utils.js":{"imports":[],"exports":[],"entryPoint":"src/modules/avatar.utils.ts","inputs":{"src/modules/avatar.utils.ts":{"bytesInOutput":807}},"bytes":1861}}}