bromcom-ui-next 0.1.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.
- package/LICENSE +21 -0
- package/dist/bromcom-ui/bromcom-ui.css +1 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js +2 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js.map +1 -0
- package/dist/bromcom-ui/global/global.js +40 -0
- package/dist/bromcom-ui/index.esm.js +2 -0
- package/dist/bromcom-ui/index.esm.js.map +1 -0
- package/dist/bromcom-ui/p-27c997d8.js +3 -0
- package/dist/bromcom-ui/p-27c997d8.js.map +1 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js +2 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js.map +1 -0
- package/dist/bromcom-ui/p-40643b53.js +2 -0
- package/dist/bromcom-ui/p-40643b53.js.map +1 -0
- package/dist/bromcom-ui/p-5fcf77f9.js +2 -0
- package/dist/bromcom-ui/p-5fcf77f9.js.map +1 -0
- package/dist/bromcom-ui/p-997f314c.entry.js +2 -0
- package/dist/bromcom-ui/p-997f314c.entry.js.map +1 -0
- package/dist/bromcom-ui/p-b36f4f44.js +7 -0
- package/dist/bromcom-ui/p-b36f4f44.js.map +1 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js +2 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js.map +1 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js +2 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js.map +1 -0
- package/dist/cjs/app-globals-e8faea0d.js +43 -0
- package/dist/cjs/app-globals-e8faea0d.js.map +1 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js +623 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-alert.cjs.entry.js +99 -0
- package/dist/cjs/bcm-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js +89 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-text.cjs.entry.js +119 -0
- package/dist/cjs/bcm-text.cjs.entry.js.map +1 -0
- package/dist/cjs/bromcom-ui.cjs.js +27 -0
- package/dist/cjs/bromcom-ui.cjs.js.map +1 -0
- package/dist/cjs/index-310db2a6.js +2584 -0
- package/dist/cjs/index-310db2a6.js.map +1 -0
- package/dist/cjs/index-638f2d15.js +1441 -0
- package/dist/cjs/index-638f2d15.js.map +1 -0
- package/dist/cjs/index-a4eea4bb.js +84 -0
- package/dist/cjs/index-a4eea4bb.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +18 -0
- package/dist/collection/components/accordion/accordion.component.js +399 -0
- package/dist/collection/components/accordion/accordion.component.js.map +1 -0
- package/dist/collection/components/accordion/accordion.css +1 -0
- package/dist/collection/components/accordion/types.js +2 -0
- package/dist/collection/components/accordion/types.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js +269 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.css +1 -0
- package/dist/collection/components/accordion-group/types.js +2 -0
- package/dist/collection/components/accordion-group/types.js.map +1 -0
- package/dist/collection/components/alert/alert.component.js +241 -0
- package/dist/collection/components/alert/alert.component.js.map +1 -0
- package/dist/collection/components/alert/alert.css +1 -0
- package/dist/collection/components/alert/types.js +2 -0
- package/dist/collection/components/alert/types.js.map +1 -0
- package/dist/collection/components/avatar/avatar.component.js +290 -0
- package/dist/collection/components/avatar/avatar.component.js.map +1 -0
- package/dist/collection/components/avatar/avatar.css +1 -0
- package/dist/collection/components/avatar/types.js +2 -0
- package/dist/collection/components/avatar/types.js.map +1 -0
- package/dist/collection/components/button/button.component.js +628 -0
- package/dist/collection/components/button/button.component.js.map +1 -0
- package/dist/collection/components/button/button.css +1 -0
- package/dist/collection/components/button/types.js +142 -0
- package/dist/collection/components/button/types.js.map +1 -0
- package/dist/collection/components/chip/chip.component.js +308 -0
- package/dist/collection/components/chip/chip.component.js.map +1 -0
- package/dist/collection/components/chip/chip.css +1 -0
- package/dist/collection/components/chip/types.js +7 -0
- package/dist/collection/components/chip/types.js.map +1 -0
- package/dist/collection/components/text/text.component.js +176 -0
- package/dist/collection/components/text/text.component.js.map +1 -0
- package/dist/collection/components/text/text.css +1 -0
- package/dist/collection/components/text/text.types.js +2 -0
- package/dist/collection/components/text/text.types.js.map +1 -0
- package/dist/collection/components/text/text.utils.js +18 -0
- package/dist/collection/components/text/text.utils.js.map +1 -0
- package/dist/collection/global/global.js +40 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/styles/theme-variables.js +355 -0
- package/dist/collection/styles/theme-variables.js.map +1 -0
- package/dist/components/bcm-accordion-group.d.ts +11 -0
- package/dist/components/bcm-accordion-group.js +113 -0
- package/dist/components/bcm-accordion-group.js.map +1 -0
- package/dist/components/bcm-accordion.d.ts +11 -0
- package/dist/components/bcm-accordion.js +152 -0
- package/dist/components/bcm-accordion.js.map +1 -0
- package/dist/components/bcm-alert.d.ts +11 -0
- package/dist/components/bcm-alert.js +120 -0
- package/dist/components/bcm-alert.js.map +1 -0
- package/dist/components/bcm-avatar.d.ts +11 -0
- package/dist/components/bcm-avatar.js +115 -0
- package/dist/components/bcm-avatar.js.map +1 -0
- package/dist/components/bcm-button.d.ts +11 -0
- package/dist/components/bcm-button.js +334 -0
- package/dist/components/bcm-button.js.map +1 -0
- package/dist/components/bcm-chip.d.ts +11 -0
- package/dist/components/bcm-chip.js +152 -0
- package/dist/components/bcm-chip.js.map +1 -0
- package/dist/components/bcm-text.d.ts +11 -0
- package/dist/components/bcm-text.js +138 -0
- package/dist/components/bcm-text.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +38 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-0adcc84f.js +1222 -0
- package/dist/components/p-0adcc84f.js.map +1 -0
- package/dist/components/p-5fcf77f9.js +2582 -0
- package/dist/components/p-5fcf77f9.js.map +1 -0
- package/dist/components/p-b36f4f44.js +82 -0
- package/dist/components/p-b36f4f44.js.map +1 -0
- package/dist/esm/app-globals-f781c325.js +41 -0
- package/dist/esm/app-globals-f781c325.js.map +1 -0
- package/dist/esm/bcm-accordion_4.entry.js +616 -0
- package/dist/esm/bcm-accordion_4.entry.js.map +1 -0
- package/dist/esm/bcm-alert.entry.js +95 -0
- package/dist/esm/bcm-alert.entry.js.map +1 -0
- package/dist/esm/bcm-avatar.entry.js +85 -0
- package/dist/esm/bcm-avatar.entry.js.map +1 -0
- package/dist/esm/bcm-text.entry.js +115 -0
- package/dist/esm/bcm-text.entry.js.map +1 -0
- package/dist/esm/bromcom-ui.js +22 -0
- package/dist/esm/bromcom-ui.js.map +1 -0
- package/dist/esm/index-ce2fac11.js +1412 -0
- package/dist/esm/index-ce2fac11.js.map +1 -0
- package/dist/esm/index-f0e9d579.js +82 -0
- package/dist/esm/index-f0e9d579.js.map +1 -0
- package/dist/esm/index-f3b17e60.js +2582 -0
- package/dist/esm/index-f3b17e60.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/accordion/accordion.component.d.ts +137 -0
- package/dist/types/components/accordion/types.d.ts +16 -0
- package/dist/types/components/accordion-group/accordion-group.component.d.ts +95 -0
- package/dist/types/components/accordion-group/types.d.ts +13 -0
- package/dist/types/components/alert/alert.component.d.ts +28 -0
- package/dist/types/components/alert/types.d.ts +3 -0
- package/dist/types/components/avatar/avatar.component.d.ts +24 -0
- package/dist/types/components/avatar/types.d.ts +3 -0
- package/dist/types/components/button/button.component.d.ts +52 -0
- package/dist/types/components/button/types.d.ts +15 -0
- package/dist/types/components/chip/chip.component.d.ts +48 -0
- package/dist/types/components/chip/types.d.ts +9 -0
- package/dist/types/components/text/text.component.d.ts +12 -0
- package/dist/types/components/text/text.types.d.ts +3 -0
- package/dist/types/components/text/text.utils.d.ts +2 -0
- package/dist/types/components.d.ts +1116 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/styles/theme-variables.d.ts +384 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +49 -0
- package/readme.md +170 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import cs from "classnames";
|
|
3
|
+
export class BcmAvatar {
|
|
4
|
+
constructor() {
|
|
5
|
+
/** Shape of the avatar (ellipse/square) */
|
|
6
|
+
this.shape = 'ellipse';
|
|
7
|
+
/** Size of the avatar */
|
|
8
|
+
this.size = 'medium';
|
|
9
|
+
/** Fallback icon class */
|
|
10
|
+
this.icon = 'fas fa-user';
|
|
11
|
+
/** Status indicator animation */
|
|
12
|
+
this.blink = false;
|
|
13
|
+
this.isFallback = false;
|
|
14
|
+
}
|
|
15
|
+
getFirstLetters(name) {
|
|
16
|
+
const words = name.split(' ');
|
|
17
|
+
const initials = words.map(word => word.charAt(0).toUpperCase()).join('');
|
|
18
|
+
return initials.substring(0, 2);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
const baseClass = cs('bcm-avatar bcm-ui-element bcm-ui-content-display', 'uppercase font-medium', 'inline-flex items-center justify-center', 'bg-[--bcm-avatar-bg] text-[--bcm-avatar-text]', {
|
|
22
|
+
'shape-ellipse rounded-full': this.shape === 'ellipse',
|
|
23
|
+
'shape-square rounded-[--bcm-ui-radius]': this.shape === 'square',
|
|
24
|
+
'size-small text-size-4 w-6 h-6': this.size === 'small',
|
|
25
|
+
'size-medium text-size-5 w-8 h-8': this.size === 'medium',
|
|
26
|
+
'size-large text-size-6 w-10 h-10': this.size === 'large',
|
|
27
|
+
});
|
|
28
|
+
const badgeClass = cs('badge', {
|
|
29
|
+
'top-0 right-0': this.shape === 'ellipse',
|
|
30
|
+
'-top-0.5 -right-0.5': this.shape === 'square',
|
|
31
|
+
});
|
|
32
|
+
const imageClass = cs('image w-full h-full', {
|
|
33
|
+
'rounded-full': this.shape === 'ellipse',
|
|
34
|
+
'rounded-[--bcm-ui-radius]': this.shape === 'square',
|
|
35
|
+
});
|
|
36
|
+
let style = {};
|
|
37
|
+
if (this.color) {
|
|
38
|
+
const isColorTone = this.color.includes('-');
|
|
39
|
+
const _color = isColorTone ? this.color.split('-')[0] : this.color;
|
|
40
|
+
const bgColor = `var(--bcm-ui-color-background-palette-${_color}-default)`;
|
|
41
|
+
const textColor = `var(--bcm-ui-color-text-palette-${_color}`;
|
|
42
|
+
style = {
|
|
43
|
+
'--bcm-avatar-bg': bgColor,
|
|
44
|
+
'--bcm-avatar-text': textColor,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const customSize = !Object.keys(['small', 'medium', 'large']).includes(this.size)
|
|
48
|
+
? {
|
|
49
|
+
width: `${this.size}px`,
|
|
50
|
+
height: `${this.size}px`,
|
|
51
|
+
fontSize: `${+this.size / 2}px`,
|
|
52
|
+
}
|
|
53
|
+
: {};
|
|
54
|
+
const RenderContent = () => {
|
|
55
|
+
if (this.isFallback) {
|
|
56
|
+
if (this.name) {
|
|
57
|
+
return this.getFirstLetters(this.name);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return h("i", { class: this.icon });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (this.image) {
|
|
64
|
+
return h("img", { class: imageClass, onError: () => (this.isFallback = true), src: this.image, alt: this.alt, "aria-label": this.alt || this.name || 'Avatar' });
|
|
65
|
+
}
|
|
66
|
+
else if (this.name) {
|
|
67
|
+
return this.getFirstLetters(this.name);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return h("i", { class: this.icon });
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return (h("div", { role: "img", "aria-label": this.alt || this.name || 'Avatar', class: baseClass, style: Object.assign(Object.assign({}, style), customSize) }, h(RenderContent, null), this.status && h("bcm-badge", { class: badgeClass, status: this.status, blink: this.blink, "aria-hidden": "true" }), h("slot", null)));
|
|
74
|
+
}
|
|
75
|
+
static get is() { return "bcm-avatar"; }
|
|
76
|
+
static get encapsulation() { return "shadow"; }
|
|
77
|
+
static get originalStyleUrls() {
|
|
78
|
+
return {
|
|
79
|
+
"$": ["avatar.css"]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static get styleUrls() {
|
|
83
|
+
return {
|
|
84
|
+
"$": ["avatar.css"]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
static get properties() {
|
|
88
|
+
return {
|
|
89
|
+
"image": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "string",
|
|
94
|
+
"resolved": "string",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": "Source URL for avatar image"
|
|
102
|
+
},
|
|
103
|
+
"getter": false,
|
|
104
|
+
"setter": false,
|
|
105
|
+
"attribute": "image",
|
|
106
|
+
"reflect": false
|
|
107
|
+
},
|
|
108
|
+
"alt": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"mutable": false,
|
|
111
|
+
"complexType": {
|
|
112
|
+
"original": "string",
|
|
113
|
+
"resolved": "string",
|
|
114
|
+
"references": {}
|
|
115
|
+
},
|
|
116
|
+
"required": false,
|
|
117
|
+
"optional": false,
|
|
118
|
+
"docs": {
|
|
119
|
+
"tags": [],
|
|
120
|
+
"text": "Alternative text for image"
|
|
121
|
+
},
|
|
122
|
+
"getter": false,
|
|
123
|
+
"setter": false,
|
|
124
|
+
"attribute": "alt",
|
|
125
|
+
"reflect": false
|
|
126
|
+
},
|
|
127
|
+
"shape": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "AvatarShape",
|
|
132
|
+
"resolved": "\"ellipse\" | \"square\"",
|
|
133
|
+
"references": {
|
|
134
|
+
"AvatarShape": {
|
|
135
|
+
"location": "import",
|
|
136
|
+
"path": "./types",
|
|
137
|
+
"id": "src/components/avatar/types.ts::AvatarShape"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": "Shape of the avatar (ellipse/square)"
|
|
146
|
+
},
|
|
147
|
+
"getter": false,
|
|
148
|
+
"setter": false,
|
|
149
|
+
"attribute": "shape",
|
|
150
|
+
"reflect": false,
|
|
151
|
+
"defaultValue": "'ellipse'"
|
|
152
|
+
},
|
|
153
|
+
"size": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "AvatarSize",
|
|
158
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
159
|
+
"references": {
|
|
160
|
+
"AvatarSize": {
|
|
161
|
+
"location": "import",
|
|
162
|
+
"path": "./types",
|
|
163
|
+
"id": "src/components/avatar/types.ts::AvatarSize"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": false,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": "Size of the avatar"
|
|
172
|
+
},
|
|
173
|
+
"getter": false,
|
|
174
|
+
"setter": false,
|
|
175
|
+
"attribute": "size",
|
|
176
|
+
"reflect": false,
|
|
177
|
+
"defaultValue": "'medium'"
|
|
178
|
+
},
|
|
179
|
+
"color": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": "Custom background color"
|
|
192
|
+
},
|
|
193
|
+
"getter": false,
|
|
194
|
+
"setter": false,
|
|
195
|
+
"attribute": "color",
|
|
196
|
+
"reflect": false
|
|
197
|
+
},
|
|
198
|
+
"icon": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "string",
|
|
203
|
+
"resolved": "string",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": false,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Fallback icon class"
|
|
211
|
+
},
|
|
212
|
+
"getter": false,
|
|
213
|
+
"setter": false,
|
|
214
|
+
"attribute": "icon",
|
|
215
|
+
"reflect": false,
|
|
216
|
+
"defaultValue": "'fas fa-user'"
|
|
217
|
+
},
|
|
218
|
+
"status": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "AvatarStatus",
|
|
223
|
+
"resolved": "\"default\" | \"error\" | \"info\" | \"success\" | \"warning\"",
|
|
224
|
+
"references": {
|
|
225
|
+
"AvatarStatus": {
|
|
226
|
+
"location": "import",
|
|
227
|
+
"path": "./types",
|
|
228
|
+
"id": "src/components/avatar/types.ts::AvatarStatus"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Status indicator type"
|
|
237
|
+
},
|
|
238
|
+
"getter": false,
|
|
239
|
+
"setter": false,
|
|
240
|
+
"attribute": "status",
|
|
241
|
+
"reflect": false
|
|
242
|
+
},
|
|
243
|
+
"blink": {
|
|
244
|
+
"type": "boolean",
|
|
245
|
+
"mutable": false,
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "boolean",
|
|
248
|
+
"resolved": "boolean",
|
|
249
|
+
"references": {}
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"optional": false,
|
|
253
|
+
"docs": {
|
|
254
|
+
"tags": [],
|
|
255
|
+
"text": "Status indicator animation"
|
|
256
|
+
},
|
|
257
|
+
"getter": false,
|
|
258
|
+
"setter": false,
|
|
259
|
+
"attribute": "blink",
|
|
260
|
+
"reflect": false,
|
|
261
|
+
"defaultValue": "false"
|
|
262
|
+
},
|
|
263
|
+
"name": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "string",
|
|
268
|
+
"resolved": "string",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "Display name (used for initials)"
|
|
276
|
+
},
|
|
277
|
+
"getter": false,
|
|
278
|
+
"setter": false,
|
|
279
|
+
"attribute": "name",
|
|
280
|
+
"reflect": false
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
static get states() {
|
|
285
|
+
return {
|
|
286
|
+
"isFallback": {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=avatar.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.component.js","sourceRoot":"","sources":["../../../src/components/avatar/avatar.component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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport cs from 'classnames';\nimport { AvatarShape, AvatarSize, AvatarStatus } from './types';\n\n@Component({\n tag: 'bcm-avatar',\n styleUrl: 'avatar.css',\n shadow: true,\n})\nexport class BcmAvatar {\n /** Source URL for avatar image */\n @Prop()\n image: string;\n\n /** Alternative text for image */\n @Prop()\n alt: string;\n\n /** Shape of the avatar (ellipse/square) */\n @Prop()\n shape: AvatarShape = 'ellipse';\n\n /** Size of the avatar */\n @Prop()\n size: AvatarSize = 'medium';\n\n /** Custom background color */\n @Prop()\n color: string;\n\n /** Fallback icon class */\n @Prop()\n icon: string = 'fas fa-user';\n\n /** Status indicator type */\n @Prop()\n status: AvatarStatus;\n\n /** Status indicator animation */\n @Prop()\n blink = false;\n\n /** Display name (used for initials) */\n @Prop()\n name: string;\n\n @State() isFallback: boolean = false;\n\n private getFirstLetters(name: string): string {\n const words = name.split(' ');\n const initials = words.map(word => word.charAt(0).toUpperCase()).join('');\n return initials.substring(0, 2);\n }\n\n render() {\n const baseClass = cs(\n 'bcm-avatar bcm-ui-element bcm-ui-content-display',\n 'uppercase font-medium',\n 'inline-flex items-center justify-center',\n 'bg-[--bcm-avatar-bg] text-[--bcm-avatar-text]',\n {\n 'shape-ellipse rounded-full': this.shape === 'ellipse',\n 'shape-square rounded-[--bcm-ui-radius]': this.shape === 'square',\n 'size-small text-size-4 w-6 h-6': this.size === 'small',\n 'size-medium text-size-5 w-8 h-8': this.size === 'medium',\n 'size-large text-size-6 w-10 h-10': this.size === 'large',\n },\n );\n\n const badgeClass = cs('badge', {\n 'top-0 right-0': this.shape === 'ellipse',\n '-top-0.5 -right-0.5': this.shape === 'square',\n });\n\n const imageClass = cs('image w-full h-full', {\n 'rounded-full': this.shape === 'ellipse',\n 'rounded-[--bcm-ui-radius]': this.shape === 'square',\n });\n\n let style = {};\n\n if (this.color) {\n const isColorTone = this.color.includes('-');\n const _color = isColorTone ? this.color.split('-')[0] : this.color;\n\n const bgColor = `var(--bcm-ui-color-background-palette-${_color}-default)`;\n const textColor = `var(--bcm-ui-color-text-palette-${_color}`;\n style = {\n '--bcm-avatar-bg': bgColor,\n '--bcm-avatar-text': textColor,\n };\n }\n\n const customSize = !Object.keys(['small', 'medium', 'large']).includes(this.size)\n ? {\n width: `${this.size}px`,\n height: `${this.size}px`,\n fontSize: `${+this.size / 2}px`,\n }\n : {};\n\n const RenderContent = () => {\n if (this.isFallback) {\n if (this.name) {\n return this.getFirstLetters(this.name);\n } else {\n return <i class={this.icon}></i>;\n }\n } else if (this.image) {\n return <img class={imageClass} onError={() => (this.isFallback = true)} src={this.image} alt={this.alt} aria-label={this.alt || this.name || 'Avatar'} />;\n } else if (this.name) {\n return this.getFirstLetters(this.name);\n } else {\n return <i class={this.icon}></i>;\n }\n };\n\n return (\n <div role=\"img\" aria-label={this.alt || this.name || 'Avatar'} class={baseClass} style={{ ...style, ...customSize }}>\n <RenderContent />\n {this.status && <bcm-badge class={badgeClass} status={this.status} blink={this.blink} aria-hidden=\"true\"></bcm-badge>}\n <slot></slot>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid oklch(.928 .006 264.531);box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:oklch(.707 .022 261.325);opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:host{--bcm-avatar-bg:var(--bcm-ui-color-background-default-default);--bcm-avatar-text:var(--bcm-ui-color-text-default);--bcm-avatar-radius:50%}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.static{position:static}.-right-0\.5{right:-.125rem}.-top-0\.5{top:-.125rem}.right-0{right:0}.top-0{top:0}.inline-flex{display:inline-flex}.h-10{height:2.5rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.w-10{width:2.5rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-\[--bcm-ui-radius\]{border-radius:var(--bcm-ui-radius)}.rounded-full{border-radius:9999px}.bg-\[--bcm-avatar-bg\]{background-color:var(--bcm-avatar-bg)}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.font-medium{font-weight:500}.uppercase{text-transform:uppercase}.text-\[--bcm-avatar-text\]{color:var(--bcm-avatar-text)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/avatar/types.ts"],"names":[],"mappings":"","sourcesContent":["export type AvatarShape = 'ellipse' | 'square';\nexport type AvatarSize = 'small' | 'medium' | 'large';\nexport type AvatarStatus = 'info' | 'error' | 'warning' | 'success' | 'default';\n"]}
|