@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,71 @@
1
+ import { AvatarSize, AvatarVariant, AvatarVariantColor } from './avatar.types.mjs';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const avatarProps: {
6
+ id: {
7
+ type: PropType<string | undefined>;
8
+ };
9
+ name: {
10
+ type: PropType<string | undefined>;
11
+ default: string;
12
+ };
13
+ size: {
14
+ type: PropType<AvatarSize | undefined>;
15
+ default: string;
16
+ };
17
+ variant: {
18
+ type: PropType<AvatarVariant | undefined>;
19
+ default: string;
20
+ };
21
+ variantColor: {
22
+ type: PropType<AvatarVariantColor | undefined>;
23
+ };
24
+ hasBorder: {
25
+ type: PropType<boolean | undefined>;
26
+ default: boolean;
27
+ };
28
+ borderColor: {
29
+ type: PropType<string | undefined>;
30
+ };
31
+ src: {
32
+ type: PropType<string | undefined>;
33
+ };
34
+ icon: {
35
+ type: PropType<string | undefined>;
36
+ };
37
+ iconVariant: {
38
+ type: PropType<string | undefined>;
39
+ };
40
+ iconColor: {
41
+ type: PropType<string | undefined>;
42
+ };
43
+ spacing: {
44
+ type: PropType<number | undefined>;
45
+ default: number;
46
+ };
47
+ };
48
+ declare const avatarGroupProps: {
49
+ id: {
50
+ type: PropType<string | undefined>;
51
+ };
52
+ size: {
53
+ type: PropType<AvatarSize | undefined>;
54
+ default: string;
55
+ };
56
+ max: {
57
+ type: PropType<number | undefined>;
58
+ default: number;
59
+ };
60
+ spacing: {
61
+ type: PropType<number | undefined>;
62
+ default: number;
63
+ };
64
+ borderColor: {
65
+ type: PropType<string | undefined>;
66
+ };
67
+ };
68
+ declare const avatarEmits: "click"[];
69
+ declare const avatarGroupEmits: "click"[];
70
+
71
+ export { avatarEmits, avatarGroupEmits, avatarGroupProps, avatarProps };
@@ -0,0 +1,71 @@
1
+ import { AvatarSize, AvatarVariant, AvatarVariantColor } from './avatar.types.js';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const avatarProps: {
6
+ id: {
7
+ type: PropType<string | undefined>;
8
+ };
9
+ name: {
10
+ type: PropType<string | undefined>;
11
+ default: string;
12
+ };
13
+ size: {
14
+ type: PropType<AvatarSize | undefined>;
15
+ default: string;
16
+ };
17
+ variant: {
18
+ type: PropType<AvatarVariant | undefined>;
19
+ default: string;
20
+ };
21
+ variantColor: {
22
+ type: PropType<AvatarVariantColor | undefined>;
23
+ };
24
+ hasBorder: {
25
+ type: PropType<boolean | undefined>;
26
+ default: boolean;
27
+ };
28
+ borderColor: {
29
+ type: PropType<string | undefined>;
30
+ };
31
+ src: {
32
+ type: PropType<string | undefined>;
33
+ };
34
+ icon: {
35
+ type: PropType<string | undefined>;
36
+ };
37
+ iconVariant: {
38
+ type: PropType<string | undefined>;
39
+ };
40
+ iconColor: {
41
+ type: PropType<string | undefined>;
42
+ };
43
+ spacing: {
44
+ type: PropType<number | undefined>;
45
+ default: number;
46
+ };
47
+ };
48
+ declare const avatarGroupProps: {
49
+ id: {
50
+ type: PropType<string | undefined>;
51
+ };
52
+ size: {
53
+ type: PropType<AvatarSize | undefined>;
54
+ default: string;
55
+ };
56
+ max: {
57
+ type: PropType<number | undefined>;
58
+ default: number;
59
+ };
60
+ spacing: {
61
+ type: PropType<number | undefined>;
62
+ default: number;
63
+ };
64
+ borderColor: {
65
+ type: PropType<string | undefined>;
66
+ };
67
+ };
68
+ declare const avatarEmits: "click"[];
69
+ declare const avatarGroupEmits: "click"[];
70
+
71
+ export { avatarEmits, avatarGroupEmits, avatarGroupProps, avatarProps };
@@ -0,0 +1,101 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/avatar.props.ts
21
+ var avatar_props_exports = {};
22
+ __export(avatar_props_exports, {
23
+ avatarEmits: () => avatarEmits,
24
+ avatarGroupEmits: () => avatarGroupEmits,
25
+ avatarGroupProps: () => avatarGroupProps,
26
+ avatarProps: () => avatarProps
27
+ });
28
+ module.exports = __toCommonJS(avatar_props_exports);
29
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
30
+ var avatarProps = {
31
+ id: {
32
+ type: String
33
+ },
34
+ name: {
35
+ type: String,
36
+ default: ""
37
+ },
38
+ size: {
39
+ type: String,
40
+ default: "md"
41
+ },
42
+ variant: {
43
+ type: String,
44
+ default: "circle"
45
+ },
46
+ variantColor: {
47
+ type: String
48
+ },
49
+ hasBorder: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ borderColor: {
54
+ type: String
55
+ },
56
+ src: {
57
+ type: String
58
+ },
59
+ icon: {
60
+ type: String
61
+ },
62
+ iconVariant: {
63
+ type: String
64
+ },
65
+ iconColor: {
66
+ type: String
67
+ },
68
+ spacing: {
69
+ type: Number,
70
+ default: 0
71
+ }
72
+ };
73
+ var avatarGroupProps = {
74
+ id: {
75
+ type: String
76
+ },
77
+ size: {
78
+ type: String,
79
+ default: "md"
80
+ },
81
+ max: {
82
+ type: Number,
83
+ default: 3
84
+ },
85
+ spacing: {
86
+ type: Number,
87
+ default: -2
88
+ },
89
+ borderColor: {
90
+ type: String
91
+ }
92
+ };
93
+ var avatarEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
94
+ var avatarGroupEmits = (0, import_pixel3_utils.declareEmit)(["click"]);
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ avatarEmits,
98
+ avatarGroupEmits,
99
+ avatarGroupProps,
100
+ avatarProps
101
+ });
@@ -0,0 +1,13 @@
1
+ import {
2
+ avatarEmits,
3
+ avatarGroupEmits,
4
+ avatarGroupProps,
5
+ avatarProps
6
+ } from "../chunk-ITYXDMOF.mjs";
7
+ import "../chunk-QZ7VFGWC.mjs";
8
+ export {
9
+ avatarEmits,
10
+ avatarGroupEmits,
11
+ avatarGroupProps,
12
+ avatarProps
13
+ };
@@ -0,0 +1,65 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported avatar types.
5
+ */
6
+
7
+ type AvatarVariant = 'square' | 'circle';
8
+ type AvatarVariantColor = 'gray' | 'sky' | 'teal' | 'violet' | 'amber' | 'rose' | 'stone' | 'lime' | 'pink';
9
+ type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
10
+ interface AvatarProps {
11
+ id?: string;
12
+ name?: string;
13
+ size?: AvatarSize;
14
+ variant?: AvatarVariant;
15
+ variantColor?: AvatarVariantColor;
16
+ hasBorder?: boolean;
17
+ borderColor?: string;
18
+ src?: string;
19
+ icon?: string;
20
+ iconVariant?: string;
21
+ iconColor?: string;
22
+ spacing?: number;
23
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
24
+ }
25
+ interface AvatarGroupProps {
26
+ id?: string;
27
+ size?: AvatarSize;
28
+ max?: number;
29
+ spacing?: number;
30
+ borderColor?: string;
31
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
32
+ }
33
+ type AvatarDefinedContext = Optional<AvatarProps, 'id'>;
34
+ type AvatarGroupDefinedContext = Optional<AvatarGroupProps, 'id'>;
35
+ interface AvatarApiMachine<T extends PropTypes = PropTypes> {
36
+ name?: string;
37
+ src?: string;
38
+ icon?: string;
39
+ isLoaded?: boolean;
40
+ rootProps?: T['element'];
41
+ fallbackProps?: T['element'];
42
+ imageProps?: T['img'];
43
+ iconProps?: T['img'];
44
+ }
45
+ interface AvatarGroupApiMachine<T extends PropTypes = PropTypes> {
46
+ rootProps?: T['element'];
47
+ excessProps?: T['element'];
48
+ }
49
+ interface AvatarState {
50
+ matches(value: string): boolean;
51
+ context: AvatarProps;
52
+ }
53
+ interface AvatarGroupState {
54
+ context: AvatarGroupProps;
55
+ }
56
+ type AvatarSend = CallableFunction;
57
+ interface AvatarClasses {
58
+ root?: string;
59
+ fallback?: string;
60
+ image?: string;
61
+ icon?: string;
62
+ excess?: string;
63
+ }
64
+
65
+ export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps, AvatarSend, AvatarSize, AvatarState, AvatarVariant, AvatarVariantColor };
@@ -0,0 +1,65 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported avatar types.
5
+ */
6
+
7
+ type AvatarVariant = 'square' | 'circle';
8
+ type AvatarVariantColor = 'gray' | 'sky' | 'teal' | 'violet' | 'amber' | 'rose' | 'stone' | 'lime' | 'pink';
9
+ type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
10
+ interface AvatarProps {
11
+ id?: string;
12
+ name?: string;
13
+ size?: AvatarSize;
14
+ variant?: AvatarVariant;
15
+ variantColor?: AvatarVariantColor;
16
+ hasBorder?: boolean;
17
+ borderColor?: string;
18
+ src?: string;
19
+ icon?: string;
20
+ iconVariant?: string;
21
+ iconColor?: string;
22
+ spacing?: number;
23
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
24
+ }
25
+ interface AvatarGroupProps {
26
+ id?: string;
27
+ size?: AvatarSize;
28
+ max?: number;
29
+ spacing?: number;
30
+ borderColor?: string;
31
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
32
+ }
33
+ type AvatarDefinedContext = Optional<AvatarProps, 'id'>;
34
+ type AvatarGroupDefinedContext = Optional<AvatarGroupProps, 'id'>;
35
+ interface AvatarApiMachine<T extends PropTypes = PropTypes> {
36
+ name?: string;
37
+ src?: string;
38
+ icon?: string;
39
+ isLoaded?: boolean;
40
+ rootProps?: T['element'];
41
+ fallbackProps?: T['element'];
42
+ imageProps?: T['img'];
43
+ iconProps?: T['img'];
44
+ }
45
+ interface AvatarGroupApiMachine<T extends PropTypes = PropTypes> {
46
+ rootProps?: T['element'];
47
+ excessProps?: T['element'];
48
+ }
49
+ interface AvatarState {
50
+ matches(value: string): boolean;
51
+ context: AvatarProps;
52
+ }
53
+ interface AvatarGroupState {
54
+ context: AvatarGroupProps;
55
+ }
56
+ type AvatarSend = CallableFunction;
57
+ interface AvatarClasses {
58
+ root?: string;
59
+ fallback?: string;
60
+ image?: string;
61
+ icon?: string;
62
+ excess?: string;
63
+ }
64
+
65
+ export { AvatarApiMachine, AvatarClasses, AvatarDefinedContext, AvatarGroupApiMachine, AvatarGroupDefinedContext, AvatarGroupProps, AvatarGroupState, AvatarProps, AvatarSend, AvatarSize, AvatarState, AvatarVariant, AvatarVariantColor };
@@ -0,0 +1,18 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/modules/avatar.types.ts
17
+ var avatar_types_exports = {};
18
+ module.exports = __toCommonJS(avatar_types_exports);
File without changes
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Exported avatar utils.
3
+ */
4
+ declare const getInitial: (value: string) => string;
5
+ declare const getColor: () => string;
6
+ declare const isColorInList: (value: string) => boolean;
7
+
8
+ export { getColor, getInitial, isColorInList };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Exported avatar utils.
3
+ */
4
+ declare const getInitial: (value: string) => string;
5
+ declare const getColor: () => string;
6
+ declare const isColorInList: (value: string) => boolean;
7
+
8
+ export { getColor, getInitial, isColorInList };
@@ -0,0 +1,49 @@
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.utils.ts
22
+ var avatar_utils_exports = {};
23
+ __export(avatar_utils_exports, {
24
+ getColor: () => getColor,
25
+ getInitial: () => getInitial,
26
+ isColorInList: () => isColorInList
27
+ });
28
+ module.exports = __toCommonJS(avatar_utils_exports);
29
+ var getInitial = /* @__PURE__ */ __name((value) => {
30
+ const [first, last] = value.split(" ");
31
+ if (first && last)
32
+ return `${first.charAt(0)}${last.charAt(0)}`;
33
+ else
34
+ return first.charAt(0);
35
+ }, "getInitial");
36
+ var background = ["gray", "sky", "teal", "violet", "amber", "rose", "stone", "lime", "pink"];
37
+ var getColor = /* @__PURE__ */ __name(() => {
38
+ const order = Math.floor(Math.random() * background.length);
39
+ return `${background[order]}.400`;
40
+ }, "getColor");
41
+ var isColorInList = /* @__PURE__ */ __name((value) => {
42
+ return background.includes(value);
43
+ }, "isColorInList");
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ getColor,
47
+ getInitial,
48
+ isColorInList
49
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ getColor,
3
+ getInitial,
4
+ isColorInList
5
+ } from "../chunk-ZK47OSEJ.mjs";
6
+ import "../chunk-QZ7VFGWC.mjs";
7
+ export {
8
+ getColor,
9
+ getInitial,
10
+ isColorInList
11
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@mekari/pixel3-avatar",
3
+ "description": "Mekari Pixel 3 | Avatar component is used to display profile image, initial or fallback icon",
4
+ "version": "0.0.0",
5
+ "license": "LGPL-3.0",
6
+ "author": "Dirga Prakesha <dirga.prakesha@mekari.com>",
7
+ "sideEffects": false,
8
+ "main": "dist/index.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "dependencies": {
13
+ "@xstate/vue": "2.0.0",
14
+ "xstate": "4.35.0",
15
+ "@mekari/pixel3-icon": "0.0.0",
16
+ "@mekari/pixel3-styled-system": "0.0.0",
17
+ "@mekari/pixel3-utils": "0.0.0"
18
+ },
19
+ "peerDependencies": {
20
+ "vue": "^3.3.7"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "devDependencies": {
26
+ "vue": "^3.3.7",
27
+ "@pandacss/dev": "0.10.0"
28
+ },
29
+ "module": "dist/index.mjs",
30
+ "types": "dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "require": "./dist/index.js",
35
+ "default": "./dist/index.mjs"
36
+ }
37
+ },
38
+ "scripts": {
39
+ "clean": "rimraf dist .turbo",
40
+ "build": "tsup && pnpm build:types",
41
+ "build:css": "pnpm build && pnpm css:gen",
42
+ "build:fast": "tsup",
43
+ "build:types": "tsup src --dts-only",
44
+ "build:external": "tsup src/index.tsx --external @acme-org/styled-system",
45
+ "types:check": "tsc --noEmit",
46
+ "css:gen": "panda cssgen --outfile dist/styles.css",
47
+ "replace-config": "clean-package",
48
+ "restore-config": "clean-package restore"
49
+ }
50
+ }