@haiilo/catalyst 0.5.14 → 0.6.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/dist/catalyst/catalyst.css +1 -1
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/p-12486027.js.map +1 -1
- package/dist/catalyst/p-6a5f0d4a.entry.js +10 -0
- package/dist/catalyst/{p-e6491f33.entry.js.map → p-6a5f0d4a.entry.js.map} +1 -1
- package/dist/cjs/app-globals-aa29ad72.js.map +1 -1
- package/dist/cjs/{cat-alert_15.cjs.entry.js → cat-alert_16.cjs.entry.js} +109 -23
- package/dist/cjs/cat-alert_16.cjs.entry.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-avatar/cat-avatar.css +81 -0
- package/dist/collection/components/cat-avatar/cat-avatar.js +225 -0
- package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -0
- package/dist/collection/components/cat-badge/cat-badge.css +5 -5
- package/dist/collection/components/cat-button/cat-button.js +8 -8
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +44 -44
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/utils/load-img.js +16 -0
- package/dist/collection/utils/load-img.js.map +1 -0
- package/dist/components/cat-avatar.d.ts +11 -0
- package/dist/components/cat-avatar.js +125 -0
- package/dist/components/cat-avatar.js.map +1 -0
- package/dist/components/cat-badge.js +1 -1
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button2.js +5 -5
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-scrollable.js +23 -23
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/esm/app-globals-cf55f7f5.js.map +1 -1
- package/dist/esm/{cat-alert_15.entry.js → cat-alert_16.entry.js} +109 -24
- package/dist/esm/cat-alert_16.entry.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-avatar/cat-avatar.d.ts +46 -0
- package/dist/types/components/cat-button/cat-button.d.ts +2 -2
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +12 -12
- package/dist/types/components.d.ts +121 -44
- package/dist/types/utils/load-img.d.ts +8 -0
- package/package.json +2 -2
- package/dist/catalyst/p-e6491f33.entry.js +0 -10
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +0 -1
- package/dist/esm/cat-alert_15.entry.js.map +0 -1
|
@@ -35,7 +35,92 @@ const CatAlert = class {
|
|
|
35
35
|
};
|
|
36
36
|
CatAlert.style = catAlertCss;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Loads an image and wraps the result in a promise.
|
|
40
|
+
*
|
|
41
|
+
* @param src the image URL
|
|
42
|
+
* @returns a promise
|
|
43
|
+
*/
|
|
44
|
+
const loadImg = (src) => {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
const image = new Image();
|
|
47
|
+
image.addEventListener('load', resolve);
|
|
48
|
+
image.addEventListener('error', reject);
|
|
49
|
+
image.src = src;
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const catAvatarCss = ":host{display:inline-block;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.avatar{display:flex;align-items:center;justify-content:center;border-radius:0.25rem;text-decoration:inherit;color:var(--cat-avatar-fill, white);background-color:var(--cat-avatar-bg, #697687);background-size:cover;background-position:center;white-space:nowrap;overflow:hidden}.avatar:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.avatar-round{border-radius:50%}.avatar-xs{width:var(--cat-avatar-size, 1.5rem);height:var(--cat-avatar-size, 1.5rem);line-height:var(--cat-avatar-size, 1.5rem);font-size:var(--cat-avatar-font-size, 0.75rem)}.avatar-s{width:var(--cat-avatar-size, 2rem);height:var(--cat-avatar-size, 2rem);line-height:var(--cat-avatar-size, 2rem);font-size:var(--cat-avatar-font-size, 0.875rem)}.avatar-m{width:var(--cat-avatar-size, 2.5rem);height:var(--cat-avatar-size, 2.5rem);line-height:var(--cat-avatar-size, 2.5rem);font-size:var(--cat-avatar-font-size, 0.9375rem)}.avatar-l{width:var(--cat-avatar-size, 3rem);height:var(--cat-avatar-size, 3rem);line-height:var(--cat-avatar-size, 3rem);font-size:var(--cat-avatar-font-size, 1.125rem)}.avatar-xl{width:var(--cat-avatar-size, 3.5rem);height:var(--cat-avatar-size, 3.5rem);line-height:var(--cat-avatar-size, 3.5rem);font-size:var(--cat-avatar-font-size, 1.25rem)}";
|
|
54
|
+
|
|
55
|
+
const CatAvatar = class {
|
|
56
|
+
constructor(hostRef) {
|
|
57
|
+
index.registerInstance(this, hostRef);
|
|
58
|
+
/**
|
|
59
|
+
* The size of the avatar.
|
|
60
|
+
*/
|
|
61
|
+
this.size = 'm';
|
|
62
|
+
/**
|
|
63
|
+
* Use round avatar edges.
|
|
64
|
+
*/
|
|
65
|
+
this.round = false;
|
|
66
|
+
/**
|
|
67
|
+
* The label of the avatar.
|
|
68
|
+
*/
|
|
69
|
+
this.label = '';
|
|
70
|
+
}
|
|
71
|
+
onSrcChanged(value) {
|
|
72
|
+
if (value) {
|
|
73
|
+
loadImg(value).then(() => (this.backgroundImage = `url(${value})`), () => (this.backgroundImage = undefined));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.backgroundImage = undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
componentWillLoad() {
|
|
80
|
+
this.onSrcChanged(this.src);
|
|
81
|
+
}
|
|
82
|
+
componentWillRender() {
|
|
83
|
+
if (!this.label) {
|
|
84
|
+
loglevel.loglevel.warn('[A11y] Missing ARIA label on avatar', this);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
if (this.url) {
|
|
89
|
+
return (index.h("a", { href: this.url, target: this.urlTarget, style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return (index.h("span", { style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
get content() {
|
|
96
|
+
return !this.backgroundImage
|
|
97
|
+
? [this.icon ? index.h("cat-icon", { icon: this.icon, size: this.size }) : this.getInitials()]
|
|
98
|
+
: [];
|
|
99
|
+
}
|
|
100
|
+
get cssStyle() {
|
|
101
|
+
return { 'background-image': this.backgroundImage };
|
|
102
|
+
}
|
|
103
|
+
get cssClass() {
|
|
104
|
+
return {
|
|
105
|
+
avatar: true,
|
|
106
|
+
'avatar-round': this.round,
|
|
107
|
+
[`avatar-${this.size}`]: Boolean(this.size)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
getInitials() {
|
|
111
|
+
var _a;
|
|
112
|
+
return ((_a = this.initials) !== null && _a !== void 0 ? _a : this.label
|
|
113
|
+
.split(' ')
|
|
114
|
+
.map(n => n[0])
|
|
115
|
+
.join(''));
|
|
116
|
+
}
|
|
117
|
+
static get watchers() { return {
|
|
118
|
+
"src": ["onSrcChanged"]
|
|
119
|
+
}; }
|
|
120
|
+
};
|
|
121
|
+
CatAvatar.style = catAvatarCss;
|
|
122
|
+
|
|
123
|
+
const catBadgeCss = ":host{display:inline-flex;max-width:100%;vertical-align:baseline}:host([hidden]){display:none}.badge{font:inherit;flex:1 1 auto;display:inline-flex;align-items:center;justify-content:center;border-radius:0.125rem;text-decoration:none;width:100%;box-sizing:border-box;line-height:1;white-space:nowrap}.badge slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.badge-round{border-radius:10rem}.badge-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.badge-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}.badge-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.badge-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--border:105, 118, 135}.badge-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--border:0, 132, 88}.badge-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--border:159, 97, 0}.badge-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--border:217, 52, 13}.badge-xs{height:0.75rem;min-width:0.75rem;font-size:0.75rem;padding:0rem 0.25rem}.badge-s{height:1rem;min-width:1rem;font-size:0.75rem;padding:0.25rem 0.5rem}.badge-m{height:1.25rem;min-width:1.25rem;font-size:0.75rem;padding:0.5rem 0.75rem}.badge-l{height:1.5rem;min-width:1.5rem;font-size:0.875rem;padding:0.75rem 1rem}.badge-xl{height:1.75rem;min-width:1.75rem;font-size:0.9375rem;padding:1rem 1.25rem}.badge-pulse.badge-filled{animation:1.5s ease 0s infinite normal none running pulse}.badge-pulse.badge-outlined{animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0 0 0 0.5rem}100%{box-shadow:transparent 0 0 0 0}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0 0 0 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0 0 0 0, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
|
|
39
124
|
|
|
40
125
|
const CatBadge = class {
|
|
41
126
|
constructor(hostRef) {
|
|
@@ -230,9 +315,9 @@ const CatButton = class {
|
|
|
230
315
|
*/
|
|
231
316
|
this.submit = false;
|
|
232
317
|
/**
|
|
233
|
-
*
|
|
318
|
+
* Disables ellipse overflowing button content.
|
|
234
319
|
*/
|
|
235
|
-
this.
|
|
320
|
+
this.noEllipsis = false;
|
|
236
321
|
/**
|
|
237
322
|
* Use round button edges.
|
|
238
323
|
*/
|
|
@@ -297,7 +382,7 @@ const CatButton = class {
|
|
|
297
382
|
'cat-button-round': this.round,
|
|
298
383
|
'cat-button-loading': this.loading,
|
|
299
384
|
'cat-button-disabled': this.disabled,
|
|
300
|
-
'cat-button-ellipsed': this.
|
|
385
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
301
386
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
302
387
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
303
388
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -311,7 +396,7 @@ const CatButton = class {
|
|
|
311
396
|
'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
|
|
312
397
|
'cat-button-loading': this.loading,
|
|
313
398
|
'cat-button-disabled': this.disabled,
|
|
314
|
-
'cat-button-ellipsed': this.
|
|
399
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
315
400
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
316
401
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
317
402
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -4202,20 +4287,20 @@ const CatScrollable = class {
|
|
|
4202
4287
|
this.scrolledBottom = index.createEvent(this, "scrolledBottom", 7);
|
|
4203
4288
|
this.init = new Subject();
|
|
4204
4289
|
this.destroyed = new Subject();
|
|
4205
|
-
/** Flags to enable
|
|
4206
|
-
this.
|
|
4207
|
-
/** Flags to enable
|
|
4208
|
-
this.
|
|
4209
|
-
/** Flags to enable
|
|
4210
|
-
this.
|
|
4211
|
-
/** Flags to enable
|
|
4212
|
-
this.
|
|
4213
|
-
/** Flag to enable
|
|
4214
|
-
this.
|
|
4290
|
+
/** Flags to disable/enable scroll shadowX. */
|
|
4291
|
+
this.noShadowX = false;
|
|
4292
|
+
/** Flags to disable/enable scroll shadowY. */
|
|
4293
|
+
this.noShadowY = false;
|
|
4294
|
+
/** Flags to disable/enable overflowX. */
|
|
4295
|
+
this.noOverflowX = false;
|
|
4296
|
+
/** Flags to disable/enable overflowY. */
|
|
4297
|
+
this.noOverflowY = false;
|
|
4298
|
+
/** Flag to disable/enable overscroll behavior. */
|
|
4299
|
+
this.noOverscroll = false;
|
|
4215
4300
|
/**
|
|
4216
|
-
* Flag to fire an initial event after content initialization.
|
|
4301
|
+
* Flag to not fire an initial event after content initialization.
|
|
4217
4302
|
*/
|
|
4218
|
-
this.
|
|
4303
|
+
this.noScrolledInit = false;
|
|
4219
4304
|
/**
|
|
4220
4305
|
* Buffer to be used to calculate the scroll distance.
|
|
4221
4306
|
*/
|
|
@@ -4244,7 +4329,7 @@ const CatScrollable = class {
|
|
|
4244
4329
|
});
|
|
4245
4330
|
}
|
|
4246
4331
|
componentDidLoad() {
|
|
4247
|
-
if (this.
|
|
4332
|
+
if (!this.noScrolledInit) {
|
|
4248
4333
|
this.init.next();
|
|
4249
4334
|
}
|
|
4250
4335
|
}
|
|
@@ -4255,12 +4340,12 @@ const CatScrollable = class {
|
|
|
4255
4340
|
}
|
|
4256
4341
|
render() {
|
|
4257
4342
|
return [
|
|
4258
|
-
index.h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, this.
|
|
4343
|
+
index.h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, !this.noShadowY && index.h("div", { class: "shadow-top" }), !this.noShadowX && index.h("div", { class: "shadow-left" }), !this.noShadowX && index.h("div", { class: "shadow-right" }), !this.noShadowY && index.h("div", { class: "shadow-bottom" })),
|
|
4259
4344
|
index.h("div", { ref: el => (this.scrollElement = el), class: {
|
|
4260
4345
|
'scrollable-content': true,
|
|
4261
|
-
'scroll-x': this.
|
|
4262
|
-
'scroll-y': this.
|
|
4263
|
-
'no-overscroll':
|
|
4346
|
+
'scroll-x': !this.noOverflowX,
|
|
4347
|
+
'scroll-y': !this.noOverflowY,
|
|
4348
|
+
'no-overscroll': this.noOverscroll
|
|
4264
4349
|
} }, index.h("slot", null))
|
|
4265
4350
|
];
|
|
4266
4351
|
}
|
|
@@ -4597,6 +4682,7 @@ CatTooltip.OFFSET = 4;
|
|
|
4597
4682
|
CatTooltip.style = catTooltipCss;
|
|
4598
4683
|
|
|
4599
4684
|
exports.cat_alert = CatAlert;
|
|
4685
|
+
exports.cat_avatar = CatAvatar;
|
|
4600
4686
|
exports.cat_badge = CatBadge;
|
|
4601
4687
|
exports.cat_button = CatButton;
|
|
4602
4688
|
exports.cat_card = CatCard;
|
|
@@ -4612,4 +4698,4 @@ exports.cat_toast_demo = CatToastDemo;
|
|
|
4612
4698
|
exports.cat_toggle = CatToggle;
|
|
4613
4699
|
exports.cat_tooltip = CatTooltip;
|
|
4614
4700
|
|
|
4615
|
-
//# sourceMappingURL=cat-
|
|
4701
|
+
//# sourceMappingURL=cat-alert_16.cjs.entry.js.map
|