@mekari/pixel3-avatar 0.0.0 → 0.0.1
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-group.d.mts +1 -1
- package/dist/avatar-group.d.ts +1 -1
- package/dist/avatar-group.js +21 -43
- package/dist/avatar-group.mjs +3 -4
- package/dist/avatar.d.mts +3 -3
- package/dist/avatar.d.ts +3 -3
- 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.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 -6
- 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
|
@@ -26,6 +26,7 @@ __export(avatar_connects_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(avatar_connects_exports);
|
|
28
28
|
var import_vue = require("vue");
|
|
29
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
29
30
|
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
30
31
|
|
|
31
32
|
// src/modules/avatar.utils.ts
|
|
@@ -39,7 +40,7 @@ var isColorInList = /* @__PURE__ */ __name((value) => {
|
|
|
39
40
|
}, "isColorInList");
|
|
40
41
|
|
|
41
42
|
// src/modules/avatar.connects.ts
|
|
42
|
-
function avatarConnect(state,
|
|
43
|
+
function avatarConnect(state, emit, classes) {
|
|
43
44
|
const {
|
|
44
45
|
id,
|
|
45
46
|
name,
|
|
@@ -50,10 +51,10 @@ function avatarConnect(state, send, classes) {
|
|
|
50
51
|
icon,
|
|
51
52
|
iconVariant,
|
|
52
53
|
iconColor,
|
|
53
|
-
spacing
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const isLoaded =
|
|
54
|
+
spacing
|
|
55
|
+
} = state;
|
|
56
|
+
const idx = id != null ? id : `mp-avatar-${(0, import_pixel3_utils.useId)()}`;
|
|
57
|
+
const isLoaded = (0, import_vue.ref)(false);
|
|
57
58
|
const isClickable = (0, import_vue.computed)(() => {
|
|
58
59
|
var _a, _b;
|
|
59
60
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
@@ -65,8 +66,8 @@ function avatarConnect(state, send, classes) {
|
|
|
65
66
|
icon,
|
|
66
67
|
isLoaded,
|
|
67
68
|
rootProps: {
|
|
68
|
-
id,
|
|
69
|
-
onClick,
|
|
69
|
+
id: idx,
|
|
70
|
+
onClick: (evt) => emit("click", evt),
|
|
70
71
|
class: classes.root,
|
|
71
72
|
style: {
|
|
72
73
|
"--mp-avatar--cursor": isClickable ? "pointer" : void 0,
|
|
@@ -78,33 +79,31 @@ function avatarConnect(state, send, classes) {
|
|
|
78
79
|
"data-pixel-component": "MpAvatar"
|
|
79
80
|
},
|
|
80
81
|
fallbackProps: {
|
|
81
|
-
id: `${
|
|
82
|
+
id: `${idx}-fallback`,
|
|
82
83
|
class: classes.fallback,
|
|
83
84
|
"data-pixel-component": "MpAvatarFallback"
|
|
84
85
|
},
|
|
85
86
|
imageProps: {
|
|
86
|
-
id: `${
|
|
87
|
+
id: `${idx}-image`,
|
|
87
88
|
alt: name,
|
|
88
89
|
src,
|
|
89
|
-
onLoad() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
90
|
+
onLoad: (evt) => {
|
|
91
|
+
isLoaded.value = true;
|
|
92
|
+
emit("load", evt);
|
|
93
93
|
},
|
|
94
|
-
onError() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
94
|
+
onError: (evt) => {
|
|
95
|
+
isLoaded.value = false;
|
|
96
|
+
emit("error", evt);
|
|
98
97
|
},
|
|
99
98
|
class: classes.image,
|
|
100
99
|
style: {
|
|
101
|
-
"--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
|
|
102
|
-
"--mp-avatar--display": !isLoaded ? "contents" : void 0
|
|
100
|
+
"--mp-avatar--visibility": !isLoaded.value ? "hidden" : void 0,
|
|
101
|
+
"--mp-avatar--display": !isLoaded.value ? "contents" : void 0
|
|
103
102
|
},
|
|
104
103
|
"data-pixel-component": "MpAvatarImage"
|
|
105
104
|
},
|
|
106
105
|
iconProps: {
|
|
107
|
-
id: `${
|
|
106
|
+
id: `${idx}-icon`,
|
|
108
107
|
name: icon,
|
|
109
108
|
variant: iconVariant,
|
|
110
109
|
variantColor: iconColor,
|
|
@@ -114,24 +113,24 @@ function avatarConnect(state, send, classes) {
|
|
|
114
113
|
};
|
|
115
114
|
}
|
|
116
115
|
__name(avatarConnect, "avatarConnect");
|
|
117
|
-
function avatarGroupConnect(state,
|
|
116
|
+
function avatarGroupConnect(state, emit, classes) {
|
|
118
117
|
const {
|
|
119
|
-
id
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
id
|
|
119
|
+
} = state;
|
|
120
|
+
const idx = id != null ? id : `mp-avatar-group-${(0, import_pixel3_utils.useId)()}`;
|
|
122
121
|
const isClickable = (0, import_vue.computed)(() => {
|
|
123
122
|
var _a, _b;
|
|
124
123
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
125
124
|
}).value;
|
|
126
125
|
return {
|
|
127
126
|
rootProps: {
|
|
128
|
-
id,
|
|
127
|
+
id: idx,
|
|
129
128
|
class: classes.root,
|
|
130
129
|
"data-pixel-component": "MpAvatarGroup"
|
|
131
130
|
},
|
|
132
131
|
excessProps: {
|
|
133
|
-
id: `${
|
|
134
|
-
onClick,
|
|
132
|
+
id: `${idx}-excess`,
|
|
133
|
+
onClick: (evt) => emit("click", evt),
|
|
135
134
|
class: classes.excess,
|
|
136
135
|
style: {
|
|
137
136
|
"--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
|
|
@@ -26,60 +26,11 @@ __export(avatar_hooks_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(avatar_hooks_exports);
|
|
28
28
|
var import_vue2 = require("vue");
|
|
29
|
-
var import_vue3 = require("@xstate/vue");
|
|
30
|
-
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
31
29
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
32
30
|
|
|
33
|
-
// src/modules/avatar.machines.ts
|
|
34
|
-
var import_xstate = require("xstate");
|
|
35
|
-
function avatarMachine(context) {
|
|
36
|
-
return (0, import_xstate.createMachine)({
|
|
37
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QEMBuyAuyBOA6ANgPbIQCWAdlAMQCSAsgOID6AMgPICCAIgKJcDaABgC6iUAAdCsUhlKFyYkAA9EARgAsATlwBWAMybBANgBMOgDQgAnojMncAdh0BfZ5bSYcBYmUq1GTDwASkFsQUKiSCCS0rLyiioIGtr6hqYW1ogAHA64gll6hUXFha7u6Fh4RCSQ-szBoeEiijEycgpRieoajnrqek6WNghZqrplIB6VuGDY2ITYdaycvALNUa1xHaBdgnq4mgMZw6p6Jq5uIOSEEHCKUzgtUm3xnYgAtEZDH0YTD1U+ChQJ6xdoJRDqEzfBCadR-Cpeaq3CAgl7bZSIHRGfajMzQ04uS7-GZzBaorbghB6QTabrqYx4zIjXI6AoldkXZxAA */
|
|
38
|
-
id: "avatar",
|
|
39
|
-
context,
|
|
40
|
-
initial: "loading",
|
|
41
|
-
states: {
|
|
42
|
-
loading: {
|
|
43
|
-
on: {
|
|
44
|
-
IMG_LOADED: {
|
|
45
|
-
target: "loaded"
|
|
46
|
-
},
|
|
47
|
-
IMG_ERROR: {
|
|
48
|
-
target: "error"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
loaded: {
|
|
53
|
-
on: {
|
|
54
|
-
IMG_ERROR: {
|
|
55
|
-
target: "error"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
error: {
|
|
60
|
-
on: {
|
|
61
|
-
IMG_LOADED: {
|
|
62
|
-
target: "loaded"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
predictableActionArguments: true
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
__name(avatarMachine, "avatarMachine");
|
|
71
|
-
function avatarGroupMachine(context) {
|
|
72
|
-
return (0, import_xstate.createMachine)({
|
|
73
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
74
|
-
id: "avatar-group",
|
|
75
|
-
context,
|
|
76
|
-
predictableActionArguments: true
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
__name(avatarGroupMachine, "avatarGroupMachine");
|
|
80
|
-
|
|
81
31
|
// src/modules/avatar.connects.ts
|
|
82
32
|
var import_vue = require("vue");
|
|
33
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
83
34
|
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
84
35
|
|
|
85
36
|
// src/modules/avatar.utils.ts
|
|
@@ -93,7 +44,7 @@ var isColorInList = /* @__PURE__ */ __name((value) => {
|
|
|
93
44
|
}, "isColorInList");
|
|
94
45
|
|
|
95
46
|
// src/modules/avatar.connects.ts
|
|
96
|
-
function avatarConnect(state,
|
|
47
|
+
function avatarConnect(state, emit, classes) {
|
|
97
48
|
const {
|
|
98
49
|
id,
|
|
99
50
|
name,
|
|
@@ -104,10 +55,10 @@ function avatarConnect(state, send, classes) {
|
|
|
104
55
|
icon,
|
|
105
56
|
iconVariant,
|
|
106
57
|
iconColor,
|
|
107
|
-
spacing
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const isLoaded =
|
|
58
|
+
spacing
|
|
59
|
+
} = state;
|
|
60
|
+
const idx = id != null ? id : `mp-avatar-${(0, import_pixel3_utils.useId)()}`;
|
|
61
|
+
const isLoaded = (0, import_vue.ref)(false);
|
|
111
62
|
const isClickable = (0, import_vue.computed)(() => {
|
|
112
63
|
var _a, _b;
|
|
113
64
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
@@ -119,8 +70,8 @@ function avatarConnect(state, send, classes) {
|
|
|
119
70
|
icon,
|
|
120
71
|
isLoaded,
|
|
121
72
|
rootProps: {
|
|
122
|
-
id,
|
|
123
|
-
onClick,
|
|
73
|
+
id: idx,
|
|
74
|
+
onClick: (evt) => emit("click", evt),
|
|
124
75
|
class: classes.root,
|
|
125
76
|
style: {
|
|
126
77
|
"--mp-avatar--cursor": isClickable ? "pointer" : void 0,
|
|
@@ -132,33 +83,31 @@ function avatarConnect(state, send, classes) {
|
|
|
132
83
|
"data-pixel-component": "MpAvatar"
|
|
133
84
|
},
|
|
134
85
|
fallbackProps: {
|
|
135
|
-
id: `${
|
|
86
|
+
id: `${idx}-fallback`,
|
|
136
87
|
class: classes.fallback,
|
|
137
88
|
"data-pixel-component": "MpAvatarFallback"
|
|
138
89
|
},
|
|
139
90
|
imageProps: {
|
|
140
|
-
id: `${
|
|
91
|
+
id: `${idx}-image`,
|
|
141
92
|
alt: name,
|
|
142
93
|
src,
|
|
143
|
-
onLoad() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
94
|
+
onLoad: (evt) => {
|
|
95
|
+
isLoaded.value = true;
|
|
96
|
+
emit("load", evt);
|
|
147
97
|
},
|
|
148
|
-
onError() {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
98
|
+
onError: (evt) => {
|
|
99
|
+
isLoaded.value = false;
|
|
100
|
+
emit("error", evt);
|
|
152
101
|
},
|
|
153
102
|
class: classes.image,
|
|
154
103
|
style: {
|
|
155
|
-
"--mp-avatar--visibility": !isLoaded ? "hidden" : void 0,
|
|
156
|
-
"--mp-avatar--display": !isLoaded ? "contents" : void 0
|
|
104
|
+
"--mp-avatar--visibility": !isLoaded.value ? "hidden" : void 0,
|
|
105
|
+
"--mp-avatar--display": !isLoaded.value ? "contents" : void 0
|
|
157
106
|
},
|
|
158
107
|
"data-pixel-component": "MpAvatarImage"
|
|
159
108
|
},
|
|
160
109
|
iconProps: {
|
|
161
|
-
id: `${
|
|
110
|
+
id: `${idx}-icon`,
|
|
162
111
|
name: icon,
|
|
163
112
|
variant: iconVariant,
|
|
164
113
|
variantColor: iconColor,
|
|
@@ -168,24 +117,24 @@ function avatarConnect(state, send, classes) {
|
|
|
168
117
|
};
|
|
169
118
|
}
|
|
170
119
|
__name(avatarConnect, "avatarConnect");
|
|
171
|
-
function avatarGroupConnect(state,
|
|
120
|
+
function avatarGroupConnect(state, emit, classes) {
|
|
172
121
|
const {
|
|
173
|
-
id
|
|
174
|
-
|
|
175
|
-
|
|
122
|
+
id
|
|
123
|
+
} = state;
|
|
124
|
+
const idx = id != null ? id : `mp-avatar-group-${(0, import_pixel3_utils.useId)()}`;
|
|
176
125
|
const isClickable = (0, import_vue.computed)(() => {
|
|
177
126
|
var _a, _b;
|
|
178
127
|
return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
|
|
179
128
|
}).value;
|
|
180
129
|
return {
|
|
181
130
|
rootProps: {
|
|
182
|
-
id,
|
|
131
|
+
id: idx,
|
|
183
132
|
class: classes.root,
|
|
184
133
|
"data-pixel-component": "MpAvatarGroup"
|
|
185
134
|
},
|
|
186
135
|
excessProps: {
|
|
187
|
-
id: `${
|
|
188
|
-
onClick,
|
|
136
|
+
id: `${idx}-excess`,
|
|
137
|
+
onClick: (evt) => emit("click", evt),
|
|
189
138
|
class: classes.excess,
|
|
190
139
|
style: {
|
|
191
140
|
"--mp-avatar-group--cursor": isClickable ? "pointer" : void 0
|
|
@@ -198,34 +147,16 @@ __name(avatarGroupConnect, "avatarGroupConnect");
|
|
|
198
147
|
|
|
199
148
|
// src/modules/avatar.hooks.ts
|
|
200
149
|
var useAvatar = /* @__PURE__ */ __name((props, emit) => {
|
|
201
|
-
var _a;
|
|
202
150
|
const context = (0, import_vue2.ref)(props);
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
} = (0, import_vue3.useMachine)(avatarMachine({
|
|
207
|
-
...context.value,
|
|
208
|
-
id: (_a = context.value.id) != null ? _a : `mp-avatar-${(0, import_pixel3_utils.useId)()}`,
|
|
209
|
-
onClick: (evt) => emit("click", evt)
|
|
210
|
-
}));
|
|
211
|
-
const [avatarProps] = import_recipes.avatarSlotRecipe.splitVariantProps(context.value);
|
|
212
|
-
const classes = (0, import_recipes.avatarSlotRecipe)(avatarProps);
|
|
213
|
-
return (0, import_vue2.computed)(() => avatarConnect(state.value, send, classes));
|
|
151
|
+
const [value] = import_recipes.avatarSlotRecipe.splitVariantProps(context.value);
|
|
152
|
+
const classes = (0, import_recipes.avatarSlotRecipe)(value);
|
|
153
|
+
return (0, import_vue2.computed)(() => avatarConnect(context.value, emit, classes));
|
|
214
154
|
}, "useAvatar");
|
|
215
155
|
var useAvatarGroup = /* @__PURE__ */ __name((props, emit) => {
|
|
216
|
-
var _a;
|
|
217
156
|
const context = (0, import_vue2.ref)(props);
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} = (0, import_vue3.useMachine)(avatarGroupMachine({
|
|
222
|
-
...context.value,
|
|
223
|
-
id: (_a = context.value.id) != null ? _a : `mp-avatar-group-${(0, import_pixel3_utils.useId)()}`,
|
|
224
|
-
onClick: (evt) => emit("click", evt)
|
|
225
|
-
}));
|
|
226
|
-
const [avatarGroupProps] = import_recipes.avatarGroupSlotRecipe.splitVariantProps(context.value);
|
|
227
|
-
const classes = (0, import_recipes.avatarGroupSlotRecipe)(avatarGroupProps);
|
|
228
|
-
return (0, import_vue2.computed)(() => avatarGroupConnect(state.value, send, classes));
|
|
157
|
+
const [value] = import_recipes.avatarGroupSlotRecipe.splitVariantProps(context.value);
|
|
158
|
+
const classes = (0, import_recipes.avatarGroupSlotRecipe)(value);
|
|
159
|
+
return (0, import_vue2.computed)(() => avatarGroupConnect(context.value, emit, classes));
|
|
229
160
|
}, "useAvatarGroup");
|
|
230
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
231
162
|
0 && (module.exports = {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAvatar,
|
|
3
3
|
useAvatarGroup
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-ZMUFXMG4.mjs";
|
|
4
|
+
} from "../chunk-O4GQNW3M.mjs";
|
|
5
|
+
import "../chunk-7XAF53OT.mjs";
|
|
7
6
|
import "../chunk-ZK47OSEJ.mjs";
|
|
8
7
|
import "../chunk-QZ7VFGWC.mjs";
|
|
9
8
|
export {
|
|
@@ -36,7 +36,7 @@ interface AvatarApiMachine<T extends PropTypes = PropTypes> {
|
|
|
36
36
|
name?: string;
|
|
37
37
|
src?: string;
|
|
38
38
|
icon?: string;
|
|
39
|
-
isLoaded?:
|
|
39
|
+
isLoaded?: object;
|
|
40
40
|
rootProps?: T['element'];
|
|
41
41
|
fallbackProps?: T['element'];
|
|
42
42
|
imageProps?: T['img'];
|
|
@@ -46,14 +46,10 @@ interface AvatarGroupApiMachine<T extends PropTypes = PropTypes> {
|
|
|
46
46
|
rootProps?: T['element'];
|
|
47
47
|
excessProps?: T['element'];
|
|
48
48
|
}
|
|
49
|
-
interface AvatarState {
|
|
50
|
-
matches(value: string): boolean;
|
|
51
|
-
context: AvatarProps;
|
|
49
|
+
interface AvatarState extends AvatarProps {
|
|
52
50
|
}
|
|
53
|
-
interface AvatarGroupState {
|
|
54
|
-
context: AvatarGroupProps;
|
|
51
|
+
interface AvatarGroupState extends AvatarGroupProps {
|
|
55
52
|
}
|
|
56
|
-
type AvatarSend = CallableFunction;
|
|
57
53
|
interface AvatarClasses {
|
|
58
54
|
root?: string;
|
|
59
55
|
fallback?: string;
|
|
@@ -62,4 +58,4 @@ interface AvatarClasses {
|
|
|
62
58
|
excess?: string;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps,
|
|
61
|
+
export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps, AvatarSize, AvatarState, AvatarVariant, AvatarVariantColor };
|
|
@@ -36,7 +36,7 @@ interface AvatarApiMachine<T extends PropTypes = PropTypes> {
|
|
|
36
36
|
name?: string;
|
|
37
37
|
src?: string;
|
|
38
38
|
icon?: string;
|
|
39
|
-
isLoaded?:
|
|
39
|
+
isLoaded?: object;
|
|
40
40
|
rootProps?: T['element'];
|
|
41
41
|
fallbackProps?: T['element'];
|
|
42
42
|
imageProps?: T['img'];
|
|
@@ -46,14 +46,10 @@ interface AvatarGroupApiMachine<T extends PropTypes = PropTypes> {
|
|
|
46
46
|
rootProps?: T['element'];
|
|
47
47
|
excessProps?: T['element'];
|
|
48
48
|
}
|
|
49
|
-
interface AvatarState {
|
|
50
|
-
matches(value: string): boolean;
|
|
51
|
-
context: AvatarProps;
|
|
49
|
+
interface AvatarState extends AvatarProps {
|
|
52
50
|
}
|
|
53
|
-
interface AvatarGroupState {
|
|
54
|
-
context: AvatarGroupProps;
|
|
51
|
+
interface AvatarGroupState extends AvatarGroupProps {
|
|
55
52
|
}
|
|
56
|
-
type AvatarSend = CallableFunction;
|
|
57
53
|
interface AvatarClasses {
|
|
58
54
|
root?: string;
|
|
59
55
|
fallback?: string;
|
|
@@ -62,4 +58,4 @@ interface AvatarClasses {
|
|
|
62
58
|
excess?: string;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps,
|
|
61
|
+
export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps, AvatarSize, AvatarState, AvatarVariant, AvatarVariantColor };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mekari/pixel3-avatar",
|
|
3
3
|
"description": "Mekari Pixel 3 | Avatar component is used to display profile image, initial or fallback icon",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1",
|
|
5
5
|
"license": "LGPL-3.0",
|
|
6
6
|
"author": "Dirga Prakesha <dirga.prakesha@mekari.com>",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"
|
|
15
|
-
"@mekari/pixel3-
|
|
16
|
-
"@mekari/pixel3-styled-system": "0.0.0",
|
|
17
|
-
"@mekari/pixel3-utils": "0.0.0"
|
|
13
|
+
"@mekari/pixel3-icon": "0.0.1",
|
|
14
|
+
"@mekari/pixel3-styled-system": "0.0.1",
|
|
15
|
+
"@mekari/pixel3-utils": "0.0.1"
|
|
18
16
|
},
|
|
19
17
|
"peerDependencies": {
|
|
20
18
|
"vue": "^3.3.7"
|
package/dist/chunk-JVROEGO3.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/chunk-U4MXRXR7.mjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as xstate from 'xstate';
|
|
2
|
-
import { AvatarDefinedContext, AvatarProps, AvatarGroupDefinedContext, AvatarGroupProps } from './avatar.types.mjs';
|
|
3
|
-
import '@mekari/pixel3-utils';
|
|
4
|
-
|
|
5
|
-
declare function avatarMachine(context: AvatarDefinedContext): xstate.StateMachine<Pick<Partial<AvatarProps>, "id"> & Omit<AvatarProps, "id">, any, xstate.AnyEventObject, {
|
|
6
|
-
value: any;
|
|
7
|
-
context: Pick<Partial<AvatarProps>, "id"> & Omit<AvatarProps, "id">;
|
|
8
|
-
}, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
|
|
9
|
-
declare function avatarGroupMachine(context: AvatarGroupDefinedContext): xstate.StateMachine<Pick<Partial<AvatarGroupProps>, "id"> & Omit<AvatarGroupProps, "id">, any, xstate.AnyEventObject, {
|
|
10
|
-
value: any;
|
|
11
|
-
context: Pick<Partial<AvatarGroupProps>, "id"> & Omit<AvatarGroupProps, "id">;
|
|
12
|
-
}, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
|
|
13
|
-
|
|
14
|
-
export { avatarGroupMachine, avatarMachine };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as xstate from 'xstate';
|
|
2
|
-
import { AvatarDefinedContext, AvatarProps, AvatarGroupDefinedContext, AvatarGroupProps } from './avatar.types.js';
|
|
3
|
-
import '@mekari/pixel3-utils';
|
|
4
|
-
|
|
5
|
-
declare function avatarMachine(context: AvatarDefinedContext): xstate.StateMachine<Pick<Partial<AvatarProps>, "id"> & Omit<AvatarProps, "id">, any, xstate.AnyEventObject, {
|
|
6
|
-
value: any;
|
|
7
|
-
context: Pick<Partial<AvatarProps>, "id"> & Omit<AvatarProps, "id">;
|
|
8
|
-
}, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
|
|
9
|
-
declare function avatarGroupMachine(context: AvatarGroupDefinedContext): xstate.StateMachine<Pick<Partial<AvatarGroupProps>, "id"> & Omit<AvatarGroupProps, "id">, any, xstate.AnyEventObject, {
|
|
10
|
-
value: any;
|
|
11
|
-
context: Pick<Partial<AvatarGroupProps>, "id"> & Omit<AvatarGroupProps, "id">;
|
|
12
|
-
}, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
|
|
13
|
-
|
|
14
|
-
export { avatarGroupMachine, avatarMachine };
|
|
@@ -1,78 +0,0 @@
|
|
|
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/modules/avatar.machines.ts
|
|
22
|
-
var avatar_machines_exports = {};
|
|
23
|
-
__export(avatar_machines_exports, {
|
|
24
|
-
avatarGroupMachine: () => avatarGroupMachine,
|
|
25
|
-
avatarMachine: () => avatarMachine
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(avatar_machines_exports);
|
|
28
|
-
var import_xstate = require("xstate");
|
|
29
|
-
function avatarMachine(context) {
|
|
30
|
-
return (0, import_xstate.createMachine)({
|
|
31
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QEMBuyAuyBOA6ANgPbIQCWAdlAMQCSAsgOID6AMgPICCAIgKJcDaABgC6iUAAdCsUhlKFyYkAA9EARgAsATlwBWAMybBANgBMOgDQgAnojMncAdh0BfZ5bSYcBYmUq1GTDwASkFsQUKiSCCS0rLyiioIGtr6hqYW1ogAHA64gll6hUXFha7u6Fh4RCSQ-szBoeEiijEycgpRieoajnrqek6WNghZqrplIB6VuGDY2ITYdaycvALNUa1xHaBdgnq4mgMZw6p6Jq5uIOSEEHCKUzgtUm3xnYgAtEZDH0YTD1U+ChQJ6xdoJRDqEzfBCadR-Cpeaq3CAgl7bZSIHRGfajMzQ04uS7-GZzBaorbghB6QTabrqYx4zIjXI6AoldkXZxAA */
|
|
32
|
-
id: "avatar",
|
|
33
|
-
context,
|
|
34
|
-
initial: "loading",
|
|
35
|
-
states: {
|
|
36
|
-
loading: {
|
|
37
|
-
on: {
|
|
38
|
-
IMG_LOADED: {
|
|
39
|
-
target: "loaded"
|
|
40
|
-
},
|
|
41
|
-
IMG_ERROR: {
|
|
42
|
-
target: "error"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
loaded: {
|
|
47
|
-
on: {
|
|
48
|
-
IMG_ERROR: {
|
|
49
|
-
target: "error"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
error: {
|
|
54
|
-
on: {
|
|
55
|
-
IMG_LOADED: {
|
|
56
|
-
target: "loaded"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
predictableActionArguments: true
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
__name(avatarMachine, "avatarMachine");
|
|
65
|
-
function avatarGroupMachine(context) {
|
|
66
|
-
return (0, import_xstate.createMachine)({
|
|
67
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
68
|
-
id: "avatar-group",
|
|
69
|
-
context,
|
|
70
|
-
predictableActionArguments: true
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
__name(avatarGroupMachine, "avatarGroupMachine");
|
|
74
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
avatarGroupMachine,
|
|
77
|
-
avatarMachine
|
|
78
|
-
});
|