@mekari/pixel3-avatar 0.0.1-alpha.0 → 0.0.2
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/avatar-excess.d.mts +2 -1
- package/dist/avatar-excess.d.ts +2 -1
- package/dist/avatar-fallback.d.mts +2 -1
- package/dist/avatar-fallback.d.ts +2 -1
- package/dist/avatar-group.d.mts +2 -1
- package/dist/avatar-group.d.ts +2 -1
- package/dist/avatar-group.js +21 -43
- package/dist/avatar-group.mjs +3 -4
- package/dist/avatar-image.d.mts +2 -1
- package/dist/avatar-image.d.ts +2 -1
- package/dist/avatar.d.mts +2 -1
- package/dist/avatar.d.ts +2 -1
- package/dist/avatar.js +33 -84
- package/dist/avatar.mjs +3 -4
- package/dist/{chunk-ZMUFXMG4.mjs → chunk-7XAF53OT.mjs} +27 -28
- package/dist/{chunk-RTYPPBOR.mjs → chunk-EVJ6EN34.mjs} +1 -1
- package/dist/chunk-O4GQNW3M.mjs +28 -0
- package/dist/{chunk-43VB6T4V.mjs → chunk-W3IXO3TE.mjs} +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +53 -122
- package/dist/index.mjs +4 -5
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/avatar.connects.d.mts +3 -3
- package/dist/modules/avatar.connects.d.ts +3 -3
- package/dist/modules/avatar.connects.js +26 -27
- package/dist/modules/avatar.connects.mjs +1 -1
- package/dist/modules/avatar.hooks.js +32 -101
- package/dist/modules/avatar.hooks.mjs +2 -3
- package/dist/modules/avatar.types.d.mts +4 -8
- package/dist/modules/avatar.types.d.ts +4 -8
- package/package.json +4 -8
- package/dist/chunk-JVROEGO3.mjs +0 -52
- package/dist/chunk-U4MXRXR7.mjs +0 -56
- package/dist/modules/avatar.machines.d.mts +0 -14
- package/dist/modules/avatar.machines.d.ts +0 -14
- package/dist/modules/avatar.machines.js +0 -78
- package/dist/modules/avatar.machines.mjs +0 -9
package/dist/avatar-excess.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarExcess component used to display more label counter.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarExcess: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarExcess: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarExcess };
|
package/dist/avatar-excess.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarExcess component used to display more label counter.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarExcess: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarExcess: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarExcess };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarFallback component used to display fallback icon.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarFallback: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarFallback: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarFallback };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarFallback component used to display fallback icon.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarFallback: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarFallback: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarFallback };
|
package/dist/avatar-group.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import * as vue from 'vue';
|
|
2
3
|
import { AvatarSize } from './modules/avatar.types.mjs';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -24,7 +25,7 @@ declare const MpAvatarGroup: vue.DefineComponent<{
|
|
|
24
25
|
borderColor: {
|
|
25
26
|
type: vue.PropType<string | undefined>;
|
|
26
27
|
};
|
|
27
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.
|
|
28
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
28
29
|
id: {
|
|
29
30
|
type: vue.PropType<string | undefined>;
|
|
30
31
|
};
|
package/dist/avatar-group.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import * as vue from 'vue';
|
|
2
3
|
import { AvatarSize } from './modules/avatar.types.js';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -24,7 +25,7 @@ declare const MpAvatarGroup: vue.DefineComponent<{
|
|
|
24
25
|
borderColor: {
|
|
25
26
|
type: vue.PropType<string | undefined>;
|
|
26
27
|
};
|
|
27
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.
|
|
28
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
28
29
|
id: {
|
|
29
30
|
type: vue.PropType<string | undefined>;
|
|
30
31
|
};
|
package/dist/avatar-group.js
CHANGED
|
@@ -24,8 +24,8 @@ __export(avatar_group_exports, {
|
|
|
24
24
|
MpAvatarGroup: () => MpAvatarGroup
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(avatar_group_exports);
|
|
27
|
+
var import_vue5 = require("vue");
|
|
27
28
|
var import_vue6 = require("vue");
|
|
28
|
-
var import_vue7 = require("vue");
|
|
29
29
|
var import_pixel3_utils3 = require("@mekari/pixel3-utils");
|
|
30
30
|
|
|
31
31
|
// src/modules/avatar.props.ts
|
|
@@ -55,43 +55,30 @@ var avatarGroupEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
|
|
|
55
55
|
|
|
56
56
|
// src/modules/avatar.hooks.ts
|
|
57
57
|
var import_vue2 = require("vue");
|
|
58
|
-
var import_vue3 = require("@xstate/vue");
|
|
59
|
-
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
60
58
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
61
59
|
|
|
62
|
-
// src/modules/avatar.machines.ts
|
|
63
|
-
var import_xstate = require("xstate");
|
|
64
|
-
function avatarGroupMachine(context) {
|
|
65
|
-
return (0, import_xstate.createMachine)({
|
|
66
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
67
|
-
id: "avatar-group",
|
|
68
|
-
context,
|
|
69
|
-
predictableActionArguments: true
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
__name(avatarGroupMachine, "avatarGroupMachine");
|
|
73
|
-
|
|
74
60
|
// src/modules/avatar.connects.ts
|
|
75
61
|
var import_vue = require("vue");
|
|
62
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
76
63
|
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
77
|
-
function avatarGroupConnect(state,
|
|
64
|
+
function avatarGroupConnect(state, emit, classes) {
|
|
78
65
|
const {
|
|
79
|
-
id
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
id
|
|
67
|
+
} = state;
|
|
68
|
+
const idx = id != null ? id : `mp-avatar-group-${(0, import_pixel3_utils2.useId)()}`;
|
|
82
69
|
const isClickable = (0, import_vue.computed)(() => {
|
|
83
70
|
var _a, _b;
|
|
84
71
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
85
72
|
}).value;
|
|
86
73
|
return {
|
|
87
74
|
rootProps: {
|
|
88
|
-
id,
|
|
75
|
+
id: idx,
|
|
89
76
|
class: classes.root,
|
|
90
77
|
"data-pixel-component": "MpAvatarGroup"
|
|
91
78
|
},
|
|
92
79
|
excessProps: {
|
|
93
|
-
id: `${
|
|
94
|
-
onClick,
|
|
80
|
+
id: `${idx}-excess`,
|
|
81
|
+
onClick: (evt) => emit("click", evt),
|
|
95
82
|
class: classes.excess,
|
|
96
83
|
style: {
|
|
97
84
|
"--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
|
|
@@ -104,38 +91,29 @@ __name(avatarGroupConnect, "avatarGroupConnect");
|
|
|
104
91
|
|
|
105
92
|
// src/modules/avatar.hooks.ts
|
|
106
93
|
var useAvatarGroup = /* @__PURE__ */ __name((props, emit) => {
|
|
107
|
-
var _a;
|
|
108
94
|
const context = (0, import_vue2.ref)(props);
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
} = (0, import_vue3.useMachine)(avatarGroupMachine({
|
|
113
|
-
...context.value,
|
|
114
|
-
id: (_a = context.value.id) != null ? _a : `mp-avatar-group-${(0, import_pixel3_utils2.useId)()}`,
|
|
115
|
-
onClick: (evt) => emit("click", evt)
|
|
116
|
-
}));
|
|
117
|
-
const [avatarGroupProps2] = import_recipes.avatarGroupSlotRecipe.splitVariantProps(context.value);
|
|
118
|
-
const classes = (0, import_recipes.avatarGroupSlotRecipe)(avatarGroupProps2);
|
|
119
|
-
return (0, import_vue2.computed)(() => avatarGroupConnect(state.value, send, classes));
|
|
95
|
+
const [value] = import_recipes.avatarGroupSlotRecipe.splitVariantProps(context.value);
|
|
96
|
+
const classes = (0, import_recipes.avatarGroupSlotRecipe)(value);
|
|
97
|
+
return (0, import_vue2.computed)(() => avatarGroupConnect(context.value, emit, classes));
|
|
120
98
|
}, "useAvatarGroup");
|
|
121
99
|
|
|
122
100
|
// src/avatar-excess.tsx
|
|
101
|
+
var import_vue3 = require("vue");
|
|
123
102
|
var import_vue4 = require("vue");
|
|
124
|
-
var
|
|
125
|
-
var MpAvatarExcess = (0, import_vue5.defineComponent)({
|
|
103
|
+
var MpAvatarExcess = (0, import_vue4.defineComponent)({
|
|
126
104
|
name: "MpAvatarExcess",
|
|
127
105
|
setup(_, {
|
|
128
106
|
slots
|
|
129
107
|
}) {
|
|
130
108
|
return () => {
|
|
131
109
|
var _a;
|
|
132
|
-
return (0,
|
|
110
|
+
return (0, import_vue3.createVNode)("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
133
111
|
};
|
|
134
112
|
}
|
|
135
113
|
});
|
|
136
114
|
|
|
137
115
|
// src/avatar-group.tsx
|
|
138
|
-
var MpAvatarGroup = (0,
|
|
116
|
+
var MpAvatarGroup = (0, import_vue6.defineComponent)({
|
|
139
117
|
name: "MpAvatarGroup",
|
|
140
118
|
props: avatarGroupProps,
|
|
141
119
|
emits: avatarGroupEmits,
|
|
@@ -144,18 +122,18 @@ var MpAvatarGroup = (0, import_vue7.defineComponent)({
|
|
|
144
122
|
emit
|
|
145
123
|
}) {
|
|
146
124
|
const api = useAvatarGroup(props, emit);
|
|
147
|
-
const children = (0,
|
|
148
|
-
const count = (0,
|
|
149
|
-
const cloneChildren = (0,
|
|
125
|
+
const children = (0, import_vue6.computed)(() => (0, import_pixel3_utils3.getChildren)(slots));
|
|
126
|
+
const count = (0, import_vue6.computed)(() => children.value.length - (props.max || 0));
|
|
127
|
+
const cloneChildren = (0, import_vue6.computed)(() => (0, import_vue6.computed)(() => children.value.slice(0, props.max)).value.map((vnode, index) => {
|
|
150
128
|
const overrideProps = (0, import_pixel3_utils3.objectFilterUndefined)({
|
|
151
129
|
size: props.size,
|
|
152
130
|
spacing: index === 0 ? 0 : props.spacing,
|
|
153
131
|
hasBorder: true,
|
|
154
132
|
borderColor: props.borderColor
|
|
155
133
|
});
|
|
156
|
-
return (0,
|
|
134
|
+
return (0, import_vue6.cloneVNode)(vnode, overrideProps);
|
|
157
135
|
}));
|
|
158
|
-
return () => (0,
|
|
136
|
+
return () => (0, import_vue5.createVNode)("div", api.value.rootProps, [cloneChildren.value, count.value > 0 && props.max !== 0 && (0, import_vue5.createVNode)(MpAvatarExcess, api.value.excessProps, {
|
|
159
137
|
default: () => [`+${count.value}`]
|
|
160
138
|
})]);
|
|
161
139
|
}
|
package/dist/avatar-group.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpAvatarGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EVJ6EN34.mjs";
|
|
4
4
|
import "./chunk-CY2Z6I23.mjs";
|
|
5
5
|
import "./chunk-ITYXDMOF.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-ZMUFXMG4.mjs";
|
|
6
|
+
import "./chunk-O4GQNW3M.mjs";
|
|
7
|
+
import "./chunk-7XAF53OT.mjs";
|
|
9
8
|
import "./chunk-ZK47OSEJ.mjs";
|
|
10
9
|
import "./chunk-QZ7VFGWC.mjs";
|
|
11
10
|
export {
|
package/dist/avatar-image.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarImage component used to display profile image.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarImage: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarImage: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarImage };
|
package/dist/avatar-image.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* MpAvatarImage component used to display profile image.
|
|
5
6
|
*/
|
|
6
|
-
declare const MpAvatarImage: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
7
|
+
declare const MpAvatarImage: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
7
8
|
|
|
8
9
|
export { MpAvatarImage };
|
package/dist/avatar.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import * as vue from 'vue';
|
|
2
3
|
import { AvatarSize, AvatarVariant, AvatarVariantColor } from './modules/avatar.types.mjs';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -47,7 +48,7 @@ declare const MpAvatar: vue.DefineComponent<{
|
|
|
47
48
|
type: vue.PropType<number | undefined>;
|
|
48
49
|
default: number;
|
|
49
50
|
};
|
|
50
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.
|
|
51
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
51
52
|
id: {
|
|
52
53
|
type: vue.PropType<string | undefined>;
|
|
53
54
|
};
|
package/dist/avatar.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import * as vue from 'vue';
|
|
2
3
|
import { AvatarSize, AvatarVariant, AvatarVariantColor } from './modules/avatar.types.js';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -47,7 +48,7 @@ declare const MpAvatar: vue.DefineComponent<{
|
|
|
47
48
|
type: vue.PropType<number | undefined>;
|
|
48
49
|
default: number;
|
|
49
50
|
};
|
|
50
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.
|
|
51
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
51
52
|
id: {
|
|
52
53
|
type: vue.PropType<string | undefined>;
|
|
53
54
|
};
|
package/dist/avatar.js
CHANGED
|
@@ -24,8 +24,8 @@ __export(avatar_exports, {
|
|
|
24
24
|
MpAvatar: () => MpAvatar
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(avatar_exports);
|
|
27
|
+
var import_vue7 = require("vue");
|
|
27
28
|
var import_vue8 = require("vue");
|
|
28
|
-
var import_vue9 = require("vue");
|
|
29
29
|
|
|
30
30
|
// src/modules/avatar.props.ts
|
|
31
31
|
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
@@ -77,51 +77,11 @@ var avatarGroupEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
|
|
|
77
77
|
|
|
78
78
|
// src/modules/avatar.hooks.ts
|
|
79
79
|
var import_vue2 = require("vue");
|
|
80
|
-
var import_vue3 = require("@xstate/vue");
|
|
81
|
-
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
82
80
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
83
81
|
|
|
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
82
|
// src/modules/avatar.connects.ts
|
|
124
83
|
var import_vue = require("vue");
|
|
84
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
125
85
|
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
126
86
|
|
|
127
87
|
// src/modules/avatar.utils.ts
|
|
@@ -142,7 +102,7 @@ var isColorInList = /* @__PURE__ */ __name((value) => {
|
|
|
142
102
|
}, "isColorInList");
|
|
143
103
|
|
|
144
104
|
// src/modules/avatar.connects.ts
|
|
145
|
-
function avatarConnect(state,
|
|
105
|
+
function avatarConnect(state, emit, classes) {
|
|
146
106
|
const {
|
|
147
107
|
id,
|
|
148
108
|
name,
|
|
@@ -153,10 +113,10 @@ function avatarConnect(state, send, classes) {
|
|
|
153
113
|
icon,
|
|
154
114
|
iconVariant,
|
|
155
115
|
iconColor,
|
|
156
|
-
spacing
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const isLoaded =
|
|
116
|
+
spacing
|
|
117
|
+
} = state;
|
|
118
|
+
const idx = id != null ? id : `mp-avatar-${(0, import_pixel3_utils2.useId)()}`;
|
|
119
|
+
const isLoaded = (0, import_vue.ref)(false);
|
|
160
120
|
const isClickable = (0, import_vue.computed)(() => {
|
|
161
121
|
var _a, _b;
|
|
162
122
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
@@ -168,8 +128,8 @@ function avatarConnect(state, send, classes) {
|
|
|
168
128
|
icon,
|
|
169
129
|
isLoaded,
|
|
170
130
|
rootProps: {
|
|
171
|
-
id,
|
|
172
|
-
onClick,
|
|
131
|
+
id: idx,
|
|
132
|
+
onClick: (evt) => emit("click", evt),
|
|
173
133
|
class: classes.root,
|
|
174
134
|
style: {
|
|
175
135
|
"--mp-avatar--cursor": isClickable ? "pointer" : void 0,
|
|
@@ -181,33 +141,31 @@ function avatarConnect(state, send, classes) {
|
|
|
181
141
|
"data-pixel-component": "MpAvatar"
|
|
182
142
|
},
|
|
183
143
|
fallbackProps: {
|
|
184
|
-
id: `${
|
|
144
|
+
id: `${idx}-fallback`,
|
|
185
145
|
class: classes.fallback,
|
|
186
146
|
"data-pixel-component": "MpAvatarFallback"
|
|
187
147
|
},
|
|
188
148
|
imageProps: {
|
|
189
|
-
id: `${
|
|
149
|
+
id: `${idx}-image`,
|
|
190
150
|
alt: name,
|
|
191
151
|
src,
|
|
192
|
-
onLoad() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
152
|
+
onLoad: (evt) => {
|
|
153
|
+
isLoaded.value = true;
|
|
154
|
+
emit("load", evt);
|
|
196
155
|
},
|
|
197
|
-
onError() {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
156
|
+
onError: (evt) => {
|
|
157
|
+
isLoaded.value = false;
|
|
158
|
+
emit("error", evt);
|
|
201
159
|
},
|
|
202
160
|
class: classes.image,
|
|
203
161
|
style: {
|
|
204
|
-
"--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
|
|
205
|
-
"--mp-avatar--display": !isLoaded ? "contents" : void 0
|
|
162
|
+
"--mp-avatar--visibility": !isLoaded.value ? "hidden" : void 0,
|
|
163
|
+
"--mp-avatar--display": !isLoaded.value ? "contents" : void 0
|
|
206
164
|
},
|
|
207
165
|
"data-pixel-component": "MpAvatarImage"
|
|
208
166
|
},
|
|
209
167
|
iconProps: {
|
|
210
|
-
id: `${
|
|
168
|
+
id: `${idx}-icon`,
|
|
211
169
|
name: icon,
|
|
212
170
|
variant: iconVariant,
|
|
213
171
|
variantColor: iconColor,
|
|
@@ -220,54 +178,45 @@ __name(avatarConnect, "avatarConnect");
|
|
|
220
178
|
|
|
221
179
|
// src/modules/avatar.hooks.ts
|
|
222
180
|
var useAvatar = /* @__PURE__ */ __name((props, emit) => {
|
|
223
|
-
var _a;
|
|
224
181
|
const context = (0, import_vue2.ref)(props);
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
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));
|
|
182
|
+
const [value] = import_recipes.avatarSlotRecipe.splitVariantProps(context.value);
|
|
183
|
+
const classes = (0, import_recipes.avatarSlotRecipe)(value);
|
|
184
|
+
return (0, import_vue2.computed)(() => avatarConnect(context.value, emit, classes));
|
|
236
185
|
}, "useAvatar");
|
|
237
186
|
|
|
238
187
|
// src/avatar.tsx
|
|
239
188
|
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
240
189
|
|
|
241
190
|
// src/avatar-fallback.tsx
|
|
191
|
+
var import_vue3 = require("vue");
|
|
242
192
|
var import_vue4 = require("vue");
|
|
243
|
-
var
|
|
244
|
-
var MpAvatarFallback = (0, import_vue5.defineComponent)({
|
|
193
|
+
var MpAvatarFallback = (0, import_vue4.defineComponent)({
|
|
245
194
|
name: "MpAvatarFallback",
|
|
246
195
|
setup() {
|
|
247
|
-
return () => (0,
|
|
196
|
+
return () => (0, import_vue3.createVNode)("div", null, [(0, import_vue3.createVNode)("svg", {
|
|
248
197
|
"fill": "#ffffff",
|
|
249
198
|
"viewBox": "0 0 128 128",
|
|
250
199
|
"role": "img"
|
|
251
|
-
}, [(0,
|
|
200
|
+
}, [(0, import_vue3.createVNode)("path", {
|
|
252
201
|
"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,
|
|
202
|
+
}, null), (0, import_vue3.createVNode)("path", {
|
|
254
203
|
"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
204
|
}, null)])]);
|
|
256
205
|
}
|
|
257
206
|
});
|
|
258
207
|
|
|
259
208
|
// src/avatar-image.tsx
|
|
209
|
+
var import_vue5 = require("vue");
|
|
260
210
|
var import_vue6 = require("vue");
|
|
261
|
-
var
|
|
262
|
-
var MpAvatarImage = (0, import_vue7.defineComponent)({
|
|
211
|
+
var MpAvatarImage = (0, import_vue6.defineComponent)({
|
|
263
212
|
name: "MpAvatarImage",
|
|
264
213
|
setup() {
|
|
265
|
-
return () => (0,
|
|
214
|
+
return () => (0, import_vue5.createVNode)("img", null, null);
|
|
266
215
|
}
|
|
267
216
|
});
|
|
268
217
|
|
|
269
218
|
// src/avatar.tsx
|
|
270
|
-
var MpAvatar = (0,
|
|
219
|
+
var MpAvatar = (0, import_vue8.defineComponent)({
|
|
271
220
|
name: "MpAvatar",
|
|
272
221
|
props: avatarProps,
|
|
273
222
|
emits: avatarEmits,
|
|
@@ -275,7 +224,7 @@ var MpAvatar = (0, import_vue9.defineComponent)({
|
|
|
275
224
|
emit
|
|
276
225
|
}) {
|
|
277
226
|
const api = useAvatar(props, emit);
|
|
278
|
-
return () => (0,
|
|
227
|
+
return () => (0, import_vue7.createVNode)("div", api.value.rootProps, [api.value.src ? (0, import_vue7.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_vue7.createVNode)(MpAvatarFallback, api.value.fallbackProps, null) : void 0, api.value.icon && (0, import_vue7.createVNode)(import_pixel3_icon.MpIcon, api.value.iconProps, null)]);
|
|
279
228
|
}
|
|
280
229
|
});
|
|
281
230
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/avatar.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpAvatar
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3IXO3TE.mjs";
|
|
4
4
|
import "./chunk-NKXS73IR.mjs";
|
|
5
5
|
import "./chunk-ITYXDMOF.mjs";
|
|
6
6
|
import "./chunk-4VNSI4PL.mjs";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-ZMUFXMG4.mjs";
|
|
7
|
+
import "./chunk-O4GQNW3M.mjs";
|
|
8
|
+
import "./chunk-7XAF53OT.mjs";
|
|
10
9
|
import "./chunk-ZK47OSEJ.mjs";
|
|
11
10
|
import "./chunk-QZ7VFGWC.mjs";
|
|
12
11
|
export {
|
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-QZ7VFGWC.mjs";
|
|
8
8
|
|
|
9
9
|
// src/modules/avatar.connects.ts
|
|
10
|
-
import { computed, getCurrentInstance } from "vue";
|
|
10
|
+
import { computed, ref, getCurrentInstance } from "vue";
|
|
11
|
+
import { useId } from "@mekari/pixel3-utils";
|
|
11
12
|
import { token } from "@mekari/pixel3-styled-system/tokens";
|
|
12
|
-
function avatarConnect(state,
|
|
13
|
+
function avatarConnect(state, emit, classes) {
|
|
13
14
|
const {
|
|
14
15
|
id,
|
|
15
16
|
name,
|
|
@@ -20,10 +21,10 @@ function avatarConnect(state, send, classes) {
|
|
|
20
21
|
icon,
|
|
21
22
|
iconVariant,
|
|
22
23
|
iconColor,
|
|
23
|
-
spacing
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const isLoaded =
|
|
24
|
+
spacing
|
|
25
|
+
} = state;
|
|
26
|
+
const idx = id != null ? id : `mp-avatar-${useId()}`;
|
|
27
|
+
const isLoaded = ref(false);
|
|
27
28
|
const isClickable = computed(() => {
|
|
28
29
|
var _a, _b;
|
|
29
30
|
return !!((_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
@@ -35,8 +36,8 @@ function avatarConnect(state, send, classes) {
|
|
|
35
36
|
icon,
|
|
36
37
|
isLoaded,
|
|
37
38
|
rootProps: {
|
|
38
|
-
id,
|
|
39
|
-
onClick,
|
|
39
|
+
id: idx,
|
|
40
|
+
onClick: (evt) => emit("click", evt),
|
|
40
41
|
class: classes.root,
|
|
41
42
|
style: {
|
|
42
43
|
"--mp-avatar--cursor": isClickable ? "pointer" : void 0,
|
|
@@ -48,33 +49,31 @@ function avatarConnect(state, send, classes) {
|
|
|
48
49
|
"data-pixel-component": "MpAvatar"
|
|
49
50
|
},
|
|
50
51
|
fallbackProps: {
|
|
51
|
-
id: `${
|
|
52
|
+
id: `${idx}-fallback`,
|
|
52
53
|
class: classes.fallback,
|
|
53
54
|
"data-pixel-component": "MpAvatarFallback"
|
|
54
55
|
},
|
|
55
56
|
imageProps: {
|
|
56
|
-
id: `${
|
|
57
|
+
id: `${idx}-image`,
|
|
57
58
|
alt: name,
|
|
58
59
|
src,
|
|
59
|
-
onLoad() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
60
|
+
onLoad: (evt) => {
|
|
61
|
+
isLoaded.value = true;
|
|
62
|
+
emit("load", evt);
|
|
63
63
|
},
|
|
64
|
-
onError() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
64
|
+
onError: (evt) => {
|
|
65
|
+
isLoaded.value = false;
|
|
66
|
+
emit("error", evt);
|
|
68
67
|
},
|
|
69
68
|
class: classes.image,
|
|
70
69
|
style: {
|
|
71
|
-
"--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
|
|
72
|
-
"--mp-avatar--display": !isLoaded ? "contents" : void 0
|
|
70
|
+
"--mp-avatar--visibility": !isLoaded.value ? "hidden" : void 0,
|
|
71
|
+
"--mp-avatar--display": !isLoaded.value ? "contents" : void 0
|
|
73
72
|
},
|
|
74
73
|
"data-pixel-component": "MpAvatarImage"
|
|
75
74
|
},
|
|
76
75
|
iconProps: {
|
|
77
|
-
id: `${
|
|
76
|
+
id: `${idx}-icon`,
|
|
78
77
|
name: icon,
|
|
79
78
|
variant: iconVariant,
|
|
80
79
|
variantColor: iconColor,
|
|
@@ -84,24 +83,24 @@ function avatarConnect(state, send, classes) {
|
|
|
84
83
|
};
|
|
85
84
|
}
|
|
86
85
|
__name(avatarConnect, "avatarConnect");
|
|
87
|
-
function avatarGroupConnect(state,
|
|
86
|
+
function avatarGroupConnect(state, emit, classes) {
|
|
88
87
|
const {
|
|
89
|
-
id
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
id
|
|
89
|
+
} = state;
|
|
90
|
+
const idx = id != null ? id : `mp-avatar-group-${useId()}`;
|
|
92
91
|
const isClickable = computed(() => {
|
|
93
92
|
var _a, _b;
|
|
94
93
|
return !!((_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
95
94
|
}).value;
|
|
96
95
|
return {
|
|
97
96
|
rootProps: {
|
|
98
|
-
id,
|
|
97
|
+
id: idx,
|
|
99
98
|
class: classes.root,
|
|
100
99
|
"data-pixel-component": "MpAvatarGroup"
|
|
101
100
|
},
|
|
102
101
|
excessProps: {
|
|
103
|
-
id: `${
|
|
104
|
-
onClick,
|
|
102
|
+
id: `${idx}-excess`,
|
|
103
|
+
onClick: (evt) => emit("click", evt),
|
|
105
104
|
class: classes.excess,
|
|
106
105
|
style: {
|
|
107
106
|
"--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
|