@haiilo/catalyst 0.5.14 → 0.7.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/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-12b96af6.js +2 -0
- package/dist/catalyst/p-12b96af6.js.map +1 -0
- package/dist/catalyst/p-4254363e.entry.js +2 -0
- package/dist/catalyst/p-4254363e.entry.js.map +1 -0
- package/dist/catalyst/p-5616e2cd.js +2 -0
- package/dist/catalyst/p-5616e2cd.js.map +1 -0
- package/dist/catalyst/p-dda85567.entry.js +10 -0
- package/dist/catalyst/p-dda85567.entry.js.map +1 -0
- package/dist/cjs/app-globals-aa29ad72.js.map +1 -1
- package/dist/cjs/{cat-alert_15.cjs.entry.js → cat-alert_18.cjs.entry.js} +282 -66
- package/dist/cjs/cat-alert_18.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-form-hint-93a6936b.js +22 -0
- package/dist/cjs/cat-form-hint-93a6936b.js.map +1 -0
- package/dist/cjs/cat-textarea.cjs.entry.js +13 -12
- package/dist/cjs/cat-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +2 -2
- package/dist/cjs/{index-5d72f0e4.js → index-499bad41.js} +44 -1
- package/dist/cjs/index-499bad41.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -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-checkbox/cat-checkbox.css +14 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +44 -11
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-form-hint/cat-form-hint.js +16 -0
- package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon.css +4 -1
- package/dist/collection/components/cat-input/cat-input.css +12 -6
- package/dist/collection/components/cat-input/cat-input.js +24 -25
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +14 -0
- package/dist/collection/components/cat-radio/cat-radio.js +41 -8
- package/dist/collection/components/cat-radio/cat-radio.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/components/cat-tab/cat-tab.css +12 -0
- package/dist/collection/components/cat-tab/cat-tab.js +203 -0
- package/dist/collection/components/cat-tab/cat-tab.js.map +1 -0
- package/dist/collection/components/cat-tabs/cat-tabs.css +33 -0
- package/dist/collection/components/cat-tabs/cat-tabs.js +122 -0
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -0
- package/dist/collection/components/cat-textarea/cat-textarea.css +12 -6
- package/dist/collection/components/cat-textarea/cat-textarea.js +24 -18
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +14 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +40 -7
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +13 -8
- package/dist/collection/components/cat-tooltip/cat-tooltip.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-checkbox.js +16 -5
- package/dist/components/cat-checkbox.js.map +1 -1
- package/dist/components/cat-form-hint.js +20 -0
- package/dist/components/cat-form-hint.js.map +1 -0
- package/dist/components/cat-icon2.js +1 -1
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +16 -18
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-radio.js +16 -5
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable.js +23 -23
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/cat-tab.d.ts +11 -0
- package/dist/components/cat-tab.js +70 -0
- package/dist/components/cat-tab.js.map +1 -0
- package/dist/components/cat-tabs.d.ts +11 -0
- package/dist/components/cat-tabs.js +107 -0
- package/dist/components/cat-tabs.js.map +1 -0
- package/dist/components/cat-textarea.js +14 -12
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.js +16 -5
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +13 -8
- package/dist/components/cat-tooltip.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_18.entry.js} +280 -67
- package/dist/esm/cat-alert_18.entry.js.map +1 -0
- package/dist/esm/cat-form-hint-dc443c7c.js +20 -0
- package/dist/esm/cat-form-hint-dc443c7c.js.map +1 -0
- package/dist/esm/cat-textarea.entry.js +13 -12
- package/dist/esm/cat-textarea.entry.js.map +1 -1
- package/dist/esm/catalyst.js +2 -2
- package/dist/esm/{index-fd12be19.js → index-039e6f5f.js} +44 -2
- package/dist/esm/index-039e6f5f.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- 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-checkbox/cat-checkbox.d.ts +9 -0
- package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +19 -0
- package/dist/types/components/cat-input/cat-input.d.ts +7 -5
- package/dist/types/components/cat-radio/cat-radio.d.ts +9 -0
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +12 -12
- package/dist/types/components/cat-tab/cat-tab.d.ts +43 -0
- package/dist/types/components/cat-tabs/cat-tabs.d.ts +25 -0
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +7 -2
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +9 -0
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +1 -0
- package/dist/types/components.d.ts +255 -52
- package/dist/types/utils/load-img.d.ts +8 -0
- package/package.json +2 -2
- package/dist/catalyst/p-a8629c54.entry.js +0 -2
- package/dist/catalyst/p-a8629c54.entry.js.map +0 -1
- package/dist/catalyst/p-bfc656ca.js +0 -2
- package/dist/catalyst/p-bfc656ca.js.map +0 -1
- package/dist/catalyst/p-e6491f33.entry.js +0 -10
- package/dist/catalyst/p-e6491f33.entry.js.map +0 -1
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +0 -1
- package/dist/cjs/index-5d72f0e4.js.map +0 -1
- package/dist/esm/cat-alert_15.entry.js.map +0 -1
- package/dist/esm/index-fd12be19.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, c as createEvent } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-039e6f5f.js';
|
|
2
2
|
import { l as loglevel } from './loglevel-39a9e3f9.js';
|
|
3
|
+
import { C as CatFormHint } from './cat-form-hint-dc443c7c.js';
|
|
3
4
|
import { C as CatIconRegistry, a as CatI18nRegistry } from './cat-icon-registry-3ea75755.js';
|
|
4
5
|
import { N as NotificationsService } from './cat-notification-cd98c266.js';
|
|
5
6
|
|
|
@@ -31,7 +32,92 @@ const CatAlert = class {
|
|
|
31
32
|
};
|
|
32
33
|
CatAlert.style = catAlertCss;
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Loads an image and wraps the result in a promise.
|
|
37
|
+
*
|
|
38
|
+
* @param src the image URL
|
|
39
|
+
* @returns a promise
|
|
40
|
+
*/
|
|
41
|
+
const loadImg = (src) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const image = new Image();
|
|
44
|
+
image.addEventListener('load', resolve);
|
|
45
|
+
image.addEventListener('error', reject);
|
|
46
|
+
image.src = src;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
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)}";
|
|
51
|
+
|
|
52
|
+
const CatAvatar = class {
|
|
53
|
+
constructor(hostRef) {
|
|
54
|
+
registerInstance(this, hostRef);
|
|
55
|
+
/**
|
|
56
|
+
* The size of the avatar.
|
|
57
|
+
*/
|
|
58
|
+
this.size = 'm';
|
|
59
|
+
/**
|
|
60
|
+
* Use round avatar edges.
|
|
61
|
+
*/
|
|
62
|
+
this.round = false;
|
|
63
|
+
/**
|
|
64
|
+
* The label of the avatar.
|
|
65
|
+
*/
|
|
66
|
+
this.label = '';
|
|
67
|
+
}
|
|
68
|
+
onSrcChanged(value) {
|
|
69
|
+
if (value) {
|
|
70
|
+
loadImg(value).then(() => (this.backgroundImage = `url(${value})`), () => (this.backgroundImage = undefined));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.backgroundImage = undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
componentWillLoad() {
|
|
77
|
+
this.onSrcChanged(this.src);
|
|
78
|
+
}
|
|
79
|
+
componentWillRender() {
|
|
80
|
+
if (!this.label) {
|
|
81
|
+
loglevel.warn('[A11y] Missing ARIA label on avatar', this);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
if (this.url) {
|
|
86
|
+
return (h("a", { href: this.url, target: this.urlTarget, style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return (h("span", { style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
get content() {
|
|
93
|
+
return !this.backgroundImage
|
|
94
|
+
? [this.icon ? h("cat-icon", { icon: this.icon, size: this.size }) : this.getInitials()]
|
|
95
|
+
: [];
|
|
96
|
+
}
|
|
97
|
+
get cssStyle() {
|
|
98
|
+
return { 'background-image': this.backgroundImage };
|
|
99
|
+
}
|
|
100
|
+
get cssClass() {
|
|
101
|
+
return {
|
|
102
|
+
avatar: true,
|
|
103
|
+
'avatar-round': this.round,
|
|
104
|
+
[`avatar-${this.size}`]: Boolean(this.size)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
getInitials() {
|
|
108
|
+
var _a;
|
|
109
|
+
return ((_a = this.initials) !== null && _a !== void 0 ? _a : this.label
|
|
110
|
+
.split(' ')
|
|
111
|
+
.map(n => n[0])
|
|
112
|
+
.join(''));
|
|
113
|
+
}
|
|
114
|
+
static get watchers() { return {
|
|
115
|
+
"src": ["onSrcChanged"]
|
|
116
|
+
}; }
|
|
117
|
+
};
|
|
118
|
+
CatAvatar.style = catAvatarCss;
|
|
119
|
+
|
|
120
|
+
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)}}";
|
|
35
121
|
|
|
36
122
|
const CatBadge = class {
|
|
37
123
|
constructor(hostRef) {
|
|
@@ -226,9 +312,9 @@ const CatButton = class {
|
|
|
226
312
|
*/
|
|
227
313
|
this.submit = false;
|
|
228
314
|
/**
|
|
229
|
-
*
|
|
315
|
+
* Disables ellipse overflowing button content.
|
|
230
316
|
*/
|
|
231
|
-
this.
|
|
317
|
+
this.noEllipsis = false;
|
|
232
318
|
/**
|
|
233
319
|
* Use round button edges.
|
|
234
320
|
*/
|
|
@@ -293,7 +379,7 @@ const CatButton = class {
|
|
|
293
379
|
'cat-button-round': this.round,
|
|
294
380
|
'cat-button-loading': this.loading,
|
|
295
381
|
'cat-button-disabled': this.disabled,
|
|
296
|
-
'cat-button-ellipsed': this.
|
|
382
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
297
383
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
298
384
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
299
385
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -307,7 +393,7 @@ const CatButton = class {
|
|
|
307
393
|
'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
|
|
308
394
|
'cat-button-loading': this.loading,
|
|
309
395
|
'cat-button-disabled': this.disabled,
|
|
310
|
-
'cat-button-ellipsed': this.
|
|
396
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
311
397
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
312
398
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
313
399
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -374,16 +460,17 @@ const CatCard = class {
|
|
|
374
460
|
};
|
|
375
461
|
CatCard.style = catCardCss;
|
|
376
462
|
|
|
377
|
-
const catCheckboxCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid #d7dbe0;border-radius:0.125rem;transition:background-color 0.13s ease, border-color 0.13s ease}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 0.13s ease;width:70%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
|
|
463
|
+
const catCheckboxCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid #d7dbe0;border-radius:0.125rem;transition:background-color 0.13s ease, border-color 0.13s ease}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 0.13s ease;width:70%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
|
|
378
464
|
|
|
379
|
-
let nextUniqueId$
|
|
465
|
+
let nextUniqueId$6 = 0;
|
|
380
466
|
const CatCheckbox = class {
|
|
381
467
|
constructor(hostRef) {
|
|
382
468
|
registerInstance(this, hostRef);
|
|
383
469
|
this.catChange = createEvent(this, "catChange", 7);
|
|
384
470
|
this.catFocus = createEvent(this, "catFocus", 7);
|
|
385
471
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
386
|
-
this.id = `cat-checkbox-${nextUniqueId$
|
|
472
|
+
this.id = `cat-checkbox-${nextUniqueId$6++}`;
|
|
473
|
+
this.hasSlottedLabel = false;
|
|
387
474
|
/**
|
|
388
475
|
* Checked state of the checkbox
|
|
389
476
|
*/
|
|
@@ -415,7 +502,8 @@ const CatCheckbox = class {
|
|
|
415
502
|
}
|
|
416
503
|
}
|
|
417
504
|
componentWillRender() {
|
|
418
|
-
|
|
505
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
506
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
419
507
|
loglevel.error('[A11y] Missing ARIA label on checkbox', this);
|
|
420
508
|
}
|
|
421
509
|
}
|
|
@@ -429,9 +517,14 @@ const CatCheckbox = class {
|
|
|
429
517
|
this.input.focus(options);
|
|
430
518
|
}
|
|
431
519
|
render() {
|
|
432
|
-
return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, h("svg", { class: "check", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), h("svg", { class: "dash", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 5 10.5 5" }))), h("span", { class: "label", part: "label" }, this.label)));
|
|
520
|
+
return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, h("svg", { class: "check", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), h("svg", { class: "dash", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 5 10.5 5" }))), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
521
|
+
}
|
|
522
|
+
get hintSection() {
|
|
523
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
524
|
+
return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
|
|
433
525
|
}
|
|
434
526
|
onInput(event) {
|
|
527
|
+
this.value = this.input.value;
|
|
435
528
|
this.catChange.emit(event);
|
|
436
529
|
}
|
|
437
530
|
onFocus(event) {
|
|
@@ -440,10 +533,11 @@ const CatCheckbox = class {
|
|
|
440
533
|
onBlur(event) {
|
|
441
534
|
this.catBlur.emit(event);
|
|
442
535
|
}
|
|
536
|
+
get hostElement() { return getElement(this); }
|
|
443
537
|
};
|
|
444
538
|
CatCheckbox.style = catCheckboxCss;
|
|
445
539
|
|
|
446
|
-
const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;
|
|
540
|
+
const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;height:1em;width:calc(var(--cat-icon-ratio, 1) * 1em)}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
|
|
447
541
|
|
|
448
542
|
const CatIcon = class {
|
|
449
543
|
constructor(hostRef) {
|
|
@@ -467,9 +561,9 @@ const CatIcon = class {
|
|
|
467
561
|
};
|
|
468
562
|
CatIcon.style = catIconCss;
|
|
469
563
|
|
|
470
|
-
const catInputCss = ":host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;margin-bottom:1rem}:host([hidden]){display:none}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:0.25rem;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.input-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px #d7dbe0}.input-wrapper:not(.input-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid #d7dbe0;padding-right:0.75rem}.text-suffix{border-left:1px solid #d7dbe0;padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}
|
|
564
|
+
const catInputCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;margin-bottom:1rem}:host([hidden]){display:none}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:0.25rem;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.input-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px #d7dbe0}.input-wrapper:not(.input-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid #d7dbe0;padding-right:0.75rem}.text-suffix{border-left:1px solid #d7dbe0;padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}";
|
|
471
565
|
|
|
472
|
-
let nextUniqueId$
|
|
566
|
+
let nextUniqueId$5 = 0;
|
|
473
567
|
const CatInput = class {
|
|
474
568
|
constructor(hostRef) {
|
|
475
569
|
registerInstance(this, hostRef);
|
|
@@ -477,8 +571,8 @@ const CatInput = class {
|
|
|
477
571
|
this.catFocus = createEvent(this, "catFocus", 7);
|
|
478
572
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
479
573
|
this.i18n = CatI18nRegistry.getInstance();
|
|
480
|
-
this.id = `cat-input-${nextUniqueId$
|
|
481
|
-
this.
|
|
574
|
+
this.id = `cat-input-${nextUniqueId$5++}`;
|
|
575
|
+
this.hasSlottedLabel = false;
|
|
482
576
|
/**
|
|
483
577
|
* Whether the input should show a clear button.
|
|
484
578
|
*/
|
|
@@ -520,14 +614,9 @@ const CatInput = class {
|
|
|
520
614
|
*/
|
|
521
615
|
this.type = 'text';
|
|
522
616
|
}
|
|
523
|
-
onValueChange(value) {
|
|
524
|
-
this.inputValue = '' + (value !== null && value !== void 0 ? value : '');
|
|
525
|
-
}
|
|
526
|
-
componentWillLoad() {
|
|
527
|
-
this.onValueChange(this.value);
|
|
528
|
-
}
|
|
529
617
|
componentWillRender() {
|
|
530
|
-
|
|
618
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
619
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
531
620
|
loglevel.error('[A11y] Missing ARIA label on input', this);
|
|
532
621
|
}
|
|
533
622
|
}
|
|
@@ -544,19 +633,23 @@ const CatInput = class {
|
|
|
544
633
|
* Clear the input.
|
|
545
634
|
*/
|
|
546
635
|
async clear() {
|
|
547
|
-
this.
|
|
636
|
+
this.value = '';
|
|
548
637
|
}
|
|
549
638
|
render() {
|
|
550
|
-
return (h(Host, null, this.label && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, this.label, !this.required && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", this.i18n.getMessage('input.optional'), ")"))))), h("div", { class: {
|
|
639
|
+
return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(", this.i18n.getMessage('input.optional'), ")"))))), h("div", { class: {
|
|
551
640
|
'input-wrapper': true,
|
|
552
641
|
'input-round': this.round,
|
|
553
642
|
'input-disabled': this.disabled
|
|
554
643
|
}, onClick: () => this.input.focus() }, this.textPrefix && (h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), h("div", { class: "input-inner-wrapper" }, h("input", { ref: el => (this.input = el), id: this.id, class: {
|
|
555
644
|
'has-clearable': this.clearable && !this.disabled
|
|
556
|
-
}, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.max, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.
|
|
645
|
+
}, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.max, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.clearable && !this.disabled && this.value && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": this.i18n.getMessage('input.clear'), onClick: this.clear.bind(this) }))), this.icon && this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
|
|
646
|
+
}
|
|
647
|
+
get hintSection() {
|
|
648
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
649
|
+
return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
|
|
557
650
|
}
|
|
558
651
|
onInput(event) {
|
|
559
|
-
this.
|
|
652
|
+
this.value = this.input.value;
|
|
560
653
|
this.catChange.emit(event);
|
|
561
654
|
}
|
|
562
655
|
onFocus(event) {
|
|
@@ -565,9 +658,7 @@ const CatInput = class {
|
|
|
565
658
|
onBlur(event) {
|
|
566
659
|
this.catBlur.emit(event);
|
|
567
660
|
}
|
|
568
|
-
|
|
569
|
-
"value": ["onValueChange"]
|
|
570
|
-
}; }
|
|
661
|
+
get hostElement() { return getElement(this); }
|
|
571
662
|
};
|
|
572
663
|
CatInput.style = catInputCss;
|
|
573
664
|
|
|
@@ -2806,13 +2897,13 @@ const firstTabbable = (container) => {
|
|
|
2806
2897
|
|
|
2807
2898
|
const catMenuCss = ":host{display:contents}:host([hidden]){display:none}.content{padding-top:0.5rem;padding-bottom:0.5rem;position:absolute;background:white;display:none;overflow:auto;-webkit-overflow-scrolling:touch;min-width:8rem;max-width:16rem;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2);border-radius:0.25rem;z-index:100}";
|
|
2808
2899
|
|
|
2809
|
-
let nextUniqueId$
|
|
2900
|
+
let nextUniqueId$4 = 0;
|
|
2810
2901
|
const CatMenu = class {
|
|
2811
2902
|
constructor(hostRef) {
|
|
2812
2903
|
registerInstance(this, hostRef);
|
|
2813
2904
|
this.catOpen = createEvent(this, "catOpen", 7);
|
|
2814
2905
|
this.catClose = createEvent(this, "catClose", 7);
|
|
2815
|
-
this.id = nextUniqueId$
|
|
2906
|
+
this.id = nextUniqueId$4++;
|
|
2816
2907
|
/**
|
|
2817
2908
|
* The placement of the menu.
|
|
2818
2909
|
*/
|
|
@@ -2907,16 +2998,17 @@ const CatMenu = class {
|
|
|
2907
2998
|
CatMenu.OFFSET = 4;
|
|
2908
2999
|
CatMenu.style = catMenuCss;
|
|
2909
3000
|
|
|
2910
|
-
const catRadioCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;cursor:pointer}.radio{display:flex;position:relative}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid #d7dbe0;border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 32, 127, 138))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.is-disabled input{background-color:#f8f8fb}.is-disabled input:checked{border-color:#d7dbe0}.is-disabled .circle{background-color:#d7dbe0}";
|
|
3001
|
+
const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;cursor:pointer}.radio{display:flex;position:relative}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid #d7dbe0;border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 32, 127, 138))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.is-disabled input{background-color:#f8f8fb}.is-disabled input:checked{border-color:#d7dbe0}.is-disabled .circle{background-color:#d7dbe0}";
|
|
2911
3002
|
|
|
2912
|
-
let nextUniqueId$
|
|
3003
|
+
let nextUniqueId$3 = 0;
|
|
2913
3004
|
const CatRadio = class {
|
|
2914
3005
|
constructor(hostRef) {
|
|
2915
3006
|
registerInstance(this, hostRef);
|
|
2916
3007
|
this.catChange = createEvent(this, "catChange", 7);
|
|
2917
3008
|
this.catFocus = createEvent(this, "catFocus", 7);
|
|
2918
3009
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
2919
|
-
this.id = `cat-radio-${++nextUniqueId$
|
|
3010
|
+
this.id = `cat-radio-${++nextUniqueId$3}`;
|
|
3011
|
+
this.hasSlottedLabel = false;
|
|
2920
3012
|
/**
|
|
2921
3013
|
* Whether this radio is checked.
|
|
2922
3014
|
*/
|
|
@@ -2939,7 +3031,8 @@ const CatRadio = class {
|
|
|
2939
3031
|
this.required = false;
|
|
2940
3032
|
}
|
|
2941
3033
|
componentWillRender() {
|
|
2942
|
-
|
|
3034
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
3035
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
2943
3036
|
loglevel.error('[A11y] Missing ARIA label on radio', this);
|
|
2944
3037
|
}
|
|
2945
3038
|
}
|
|
@@ -2953,9 +3046,14 @@ const CatRadio = class {
|
|
|
2953
3046
|
this.input.focus(options);
|
|
2954
3047
|
}
|
|
2955
3048
|
render() {
|
|
2956
|
-
return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("span", { class: "radio" }, h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, this.label)));
|
|
3049
|
+
return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("span", { class: "radio" }, h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
3050
|
+
}
|
|
3051
|
+
get hintSection() {
|
|
3052
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
3053
|
+
return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
|
|
2957
3054
|
}
|
|
2958
3055
|
onChange(event) {
|
|
3056
|
+
this.value = this.input.value;
|
|
2959
3057
|
this.catChange.emit(event);
|
|
2960
3058
|
}
|
|
2961
3059
|
onFocus(event) {
|
|
@@ -2964,6 +3062,7 @@ const CatRadio = class {
|
|
|
2964
3062
|
onBlur(event) {
|
|
2965
3063
|
this.catBlur.emit(event);
|
|
2966
3064
|
}
|
|
3065
|
+
get hostElement() { return getElement(this); }
|
|
2967
3066
|
};
|
|
2968
3067
|
CatRadio.style = catRadioCss;
|
|
2969
3068
|
|
|
@@ -4198,20 +4297,20 @@ const CatScrollable = class {
|
|
|
4198
4297
|
this.scrolledBottom = createEvent(this, "scrolledBottom", 7);
|
|
4199
4298
|
this.init = new Subject();
|
|
4200
4299
|
this.destroyed = new Subject();
|
|
4201
|
-
/** Flags to enable
|
|
4202
|
-
this.
|
|
4203
|
-
/** Flags to enable
|
|
4204
|
-
this.
|
|
4205
|
-
/** Flags to enable
|
|
4206
|
-
this.
|
|
4207
|
-
/** Flags to enable
|
|
4208
|
-
this.
|
|
4209
|
-
/** Flag to enable
|
|
4210
|
-
this.
|
|
4300
|
+
/** Flags to disable/enable scroll shadowX. */
|
|
4301
|
+
this.noShadowX = false;
|
|
4302
|
+
/** Flags to disable/enable scroll shadowY. */
|
|
4303
|
+
this.noShadowY = false;
|
|
4304
|
+
/** Flags to disable/enable overflowX. */
|
|
4305
|
+
this.noOverflowX = false;
|
|
4306
|
+
/** Flags to disable/enable overflowY. */
|
|
4307
|
+
this.noOverflowY = false;
|
|
4308
|
+
/** Flag to disable/enable overscroll behavior. */
|
|
4309
|
+
this.noOverscroll = false;
|
|
4211
4310
|
/**
|
|
4212
|
-
* Flag to fire an initial event after content initialization.
|
|
4311
|
+
* Flag to not fire an initial event after content initialization.
|
|
4213
4312
|
*/
|
|
4214
|
-
this.
|
|
4313
|
+
this.noScrolledInit = false;
|
|
4215
4314
|
/**
|
|
4216
4315
|
* Buffer to be used to calculate the scroll distance.
|
|
4217
4316
|
*/
|
|
@@ -4240,7 +4339,7 @@ const CatScrollable = class {
|
|
|
4240
4339
|
});
|
|
4241
4340
|
}
|
|
4242
4341
|
componentDidLoad() {
|
|
4243
|
-
if (this.
|
|
4342
|
+
if (!this.noScrolledInit) {
|
|
4244
4343
|
this.init.next();
|
|
4245
4344
|
}
|
|
4246
4345
|
}
|
|
@@ -4251,12 +4350,12 @@ const CatScrollable = class {
|
|
|
4251
4350
|
}
|
|
4252
4351
|
render() {
|
|
4253
4352
|
return [
|
|
4254
|
-
h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, this.
|
|
4353
|
+
h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, !this.noShadowY && h("div", { class: "shadow-top" }), !this.noShadowX && h("div", { class: "shadow-left" }), !this.noShadowX && h("div", { class: "shadow-right" }), !this.noShadowY && h("div", { class: "shadow-bottom" })),
|
|
4255
4354
|
h("div", { ref: el => (this.scrollElement = el), class: {
|
|
4256
4355
|
'scrollable-content': true,
|
|
4257
|
-
'scroll-x': this.
|
|
4258
|
-
'scroll-y': this.
|
|
4259
|
-
'no-overscroll':
|
|
4356
|
+
'scroll-x': !this.noOverflowX,
|
|
4357
|
+
'scroll-y': !this.noOverflowY,
|
|
4358
|
+
'no-overscroll': this.noOverscroll
|
|
4260
4359
|
} }, h("slot", null))
|
|
4261
4360
|
];
|
|
4262
4361
|
}
|
|
@@ -4366,6 +4465,107 @@ const CatSpinner = class {
|
|
|
4366
4465
|
};
|
|
4367
4466
|
CatSpinner.style = catSpinnerCss;
|
|
4368
4467
|
|
|
4468
|
+
const catTabCss = ":host{display:block}:host([hidden]){display:none}";
|
|
4469
|
+
|
|
4470
|
+
let nextUniqueId$2 = 0;
|
|
4471
|
+
const CatTab = class {
|
|
4472
|
+
constructor(hostRef) {
|
|
4473
|
+
registerInstance(this, hostRef);
|
|
4474
|
+
this.tabClick = createEvent(this, "tabClick", 7);
|
|
4475
|
+
/**
|
|
4476
|
+
* The label of the tab.
|
|
4477
|
+
*/
|
|
4478
|
+
this.label = '';
|
|
4479
|
+
/**
|
|
4480
|
+
* Hide the actual button content and only display the tab.
|
|
4481
|
+
*/
|
|
4482
|
+
this.iconOnly = false;
|
|
4483
|
+
/**
|
|
4484
|
+
* Display the icon on the right.
|
|
4485
|
+
*/
|
|
4486
|
+
this.iconRight = false;
|
|
4487
|
+
/**
|
|
4488
|
+
* Specifies that the tab should be deactivated.
|
|
4489
|
+
*/
|
|
4490
|
+
this.deactivated = false;
|
|
4491
|
+
}
|
|
4492
|
+
connectedCallback() {
|
|
4493
|
+
if (!this.hostElement.id) {
|
|
4494
|
+
this.hostElement.id = `cat-tab-${nextUniqueId$2++}`;
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
onClick(event) {
|
|
4498
|
+
this.tabClick.emit(event);
|
|
4499
|
+
}
|
|
4500
|
+
render() {
|
|
4501
|
+
return h(Host, null);
|
|
4502
|
+
}
|
|
4503
|
+
get hostElement() { return getElement(this); }
|
|
4504
|
+
};
|
|
4505
|
+
CatTab.style = catTabCss;
|
|
4506
|
+
|
|
4507
|
+
const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1px 0 0 #d7dbe0}:host([hidden]){display:none}:host([tabs-align=center]){justify-content:center}:host([tabs-align=right]){justify-content:end}:host([tabs-align=justify]) cat-button{flex:1 0 auto}.tab{padding:0.5rem}.tab.tab-active{box-shadow:inset 0 -3px 0 0 #207f8a}";
|
|
4508
|
+
|
|
4509
|
+
const CatTabs = class {
|
|
4510
|
+
constructor(hostRef) {
|
|
4511
|
+
registerInstance(this, hostRef);
|
|
4512
|
+
this.tabs = [];
|
|
4513
|
+
this.buttons = [];
|
|
4514
|
+
/**
|
|
4515
|
+
* The ID of the active tab.
|
|
4516
|
+
*/
|
|
4517
|
+
this.activeTab = '';
|
|
4518
|
+
/**
|
|
4519
|
+
* The alignment of the tabs.
|
|
4520
|
+
*/
|
|
4521
|
+
this.tabsAlign = 'left';
|
|
4522
|
+
}
|
|
4523
|
+
onActiveTabChanged(newActiveTab) {
|
|
4524
|
+
const activeTab = this.tabs.find(value => value.id === newActiveTab);
|
|
4525
|
+
activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
|
|
4526
|
+
}
|
|
4527
|
+
componentWillLoad() {
|
|
4528
|
+
this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
|
|
4529
|
+
if (this.tabs.length) {
|
|
4530
|
+
this.activeTabId = this.activeTab;
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
onKeydown(event) {
|
|
4534
|
+
var _a;
|
|
4535
|
+
if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
4536
|
+
const targetElements = this.buttons.filter(button => !button.disabled);
|
|
4537
|
+
const activeElement = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
4538
|
+
const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
|
|
4539
|
+
const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
|
|
4540
|
+
const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
|
|
4541
|
+
targetElements[targetIdx].setFocus();
|
|
4542
|
+
event.preventDefault();
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
render() {
|
|
4546
|
+
return (h(Host, null, this.tabs.map((tab) => {
|
|
4547
|
+
return (h("cat-button", { ref: el => el && this.updateButtonsRef(el), buttonId: tab.id, role: "tab", part: "tab", class: {
|
|
4548
|
+
tab: true,
|
|
4549
|
+
'tab-active': Boolean(this.activeTabId && tab.id === this.activeTabId)
|
|
4550
|
+
}, color: this.activeTabId && tab.id === this.activeTabId ? 'primary' : 'secondary', variant: "text", icon: tab.icon, iconOnly: tab.iconOnly, iconRight: tab.iconRight, url: tab.url, disabled: tab.deactivated, urlTarget: tab.urlTarget, onCatClick: () => (this.activeTabId = tab.id) }, tab.label));
|
|
4551
|
+
})));
|
|
4552
|
+
}
|
|
4553
|
+
updateButtonsRef(button) {
|
|
4554
|
+
const indexOf = this.buttons.indexOf(button);
|
|
4555
|
+
if (indexOf >= 0) {
|
|
4556
|
+
this.buttons[indexOf] = button;
|
|
4557
|
+
}
|
|
4558
|
+
else {
|
|
4559
|
+
this.buttons.push(button);
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
get hostElement() { return getElement(this); }
|
|
4563
|
+
static get watchers() { return {
|
|
4564
|
+
"activeTabId": ["onActiveTabChanged"]
|
|
4565
|
+
}; }
|
|
4566
|
+
};
|
|
4567
|
+
CatTabs.style = catTabsCss;
|
|
4568
|
+
|
|
4369
4569
|
const catToastDemoCss = ":host{display:block}";
|
|
4370
4570
|
|
|
4371
4571
|
const CatToastDemo = class {
|
|
@@ -4409,7 +4609,7 @@ const CatToastDemo = class {
|
|
|
4409
4609
|
};
|
|
4410
4610
|
CatToastDemo.style = catToastDemoCss;
|
|
4411
4611
|
|
|
4412
|
-
const catToggleCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:#d7dbe0;transition:background-color 0.13s ease}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 32, 127, 138))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 0.13s linear;box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
|
|
4612
|
+
const catToggleCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:#d7dbe0;transition:background-color 0.13s ease}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 32, 127, 138))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 0.13s linear;box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
|
|
4413
4613
|
|
|
4414
4614
|
let nextUniqueId$1 = 0;
|
|
4415
4615
|
const CatToggle = class {
|
|
@@ -4419,6 +4619,7 @@ const CatToggle = class {
|
|
|
4419
4619
|
this.catFocus = createEvent(this, "catFocus", 7);
|
|
4420
4620
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
4421
4621
|
this.id = `cat-toggle-${nextUniqueId$1++}`;
|
|
4622
|
+
this.hasSlottedLabel = false;
|
|
4422
4623
|
/**
|
|
4423
4624
|
* Checked state of the toggle.
|
|
4424
4625
|
*/
|
|
@@ -4441,7 +4642,8 @@ const CatToggle = class {
|
|
|
4441
4642
|
this.required = false;
|
|
4442
4643
|
}
|
|
4443
4644
|
componentWillRender() {
|
|
4444
|
-
|
|
4645
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
4646
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
4445
4647
|
loglevel.error('[A11y] Missing ARIA label on toggle', this);
|
|
4446
4648
|
}
|
|
4447
4649
|
}
|
|
@@ -4455,9 +4657,14 @@ const CatToggle = class {
|
|
|
4455
4657
|
this.input.focus(options);
|
|
4456
4658
|
}
|
|
4457
4659
|
render() {
|
|
4458
|
-
return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, this.label)));
|
|
4660
|
+
return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
4661
|
+
}
|
|
4662
|
+
get hintSection() {
|
|
4663
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
4664
|
+
return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
|
|
4459
4665
|
}
|
|
4460
4666
|
onInput(event) {
|
|
4667
|
+
this.value = this.input.value;
|
|
4461
4668
|
this.catChange.emit(event);
|
|
4462
4669
|
}
|
|
4463
4670
|
onFocus(event) {
|
|
@@ -4466,6 +4673,7 @@ const CatToggle = class {
|
|
|
4466
4673
|
onBlur(event) {
|
|
4467
4674
|
this.catBlur.emit(event);
|
|
4468
4675
|
}
|
|
4676
|
+
get hostElement() { return getElement(this); }
|
|
4469
4677
|
};
|
|
4470
4678
|
CatToggle.style = catToggleCss;
|
|
4471
4679
|
|
|
@@ -4517,6 +4725,7 @@ const CatTooltip = class {
|
|
|
4517
4725
|
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
4518
4726
|
}
|
|
4519
4727
|
if (isTouchDevice) {
|
|
4728
|
+
window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4520
4729
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4521
4730
|
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
4522
4731
|
}
|
|
@@ -4530,6 +4739,7 @@ const CatTooltip = class {
|
|
|
4530
4739
|
disconnectedCallback() {
|
|
4531
4740
|
var _a, _b, _c, _d, _e, _f;
|
|
4532
4741
|
if (isTouchDevice) {
|
|
4742
|
+
window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4533
4743
|
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4534
4744
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
|
|
4535
4745
|
}
|
|
@@ -4564,34 +4774,37 @@ const CatTooltip = class {
|
|
|
4564
4774
|
showListener() {
|
|
4565
4775
|
window.clearTimeout(this.hideTimeout);
|
|
4566
4776
|
this.showTimeout = window.setTimeout(() => {
|
|
4567
|
-
var _a
|
|
4568
|
-
(_a = this.
|
|
4569
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
|
|
4777
|
+
var _a;
|
|
4778
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
4570
4779
|
}, this.showDelay);
|
|
4571
4780
|
}
|
|
4572
4781
|
hideListener() {
|
|
4573
4782
|
window.clearTimeout(this.showTimeout);
|
|
4574
4783
|
this.hideTimeout = window.setTimeout(() => {
|
|
4575
|
-
var _a
|
|
4576
|
-
(_a = this.
|
|
4577
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
|
|
4784
|
+
var _a;
|
|
4785
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
4578
4786
|
}, this.hideDelay);
|
|
4579
4787
|
}
|
|
4580
|
-
touchStartListener() {
|
|
4788
|
+
touchStartListener(event) {
|
|
4789
|
+
event.stopPropagation();
|
|
4581
4790
|
this.touchTimeout = window.setTimeout(() => {
|
|
4582
4791
|
var _a;
|
|
4583
4792
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
4584
4793
|
}, this.longTouchDuration);
|
|
4585
4794
|
}
|
|
4586
4795
|
touchEndListener() {
|
|
4796
|
+
if (this.touchTimeout) {
|
|
4797
|
+
window.clearTimeout(this.touchTimeout);
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
windowTouchStartListener() {
|
|
4587
4801
|
var _a;
|
|
4588
|
-
window.clearTimeout(this.touchTimeout);
|
|
4589
4802
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
4590
4803
|
}
|
|
4591
4804
|
};
|
|
4592
4805
|
CatTooltip.OFFSET = 4;
|
|
4593
4806
|
CatTooltip.style = catTooltipCss;
|
|
4594
4807
|
|
|
4595
|
-
export { CatAlert as cat_alert, CatBadge as cat_badge, CatButton as cat_button, CatCard as cat_card, CatCheckbox as cat_checkbox, CatIcon as cat_icon, CatInput as cat_input, CatMenu as cat_menu, CatRadio as cat_radio, CatScrollable as cat_scrollable, CatSkeleton as cat_skeleton, CatSpinner as cat_spinner, CatToastDemo as cat_toast_demo, CatToggle as cat_toggle, CatTooltip as cat_tooltip };
|
|
4808
|
+
export { CatAlert as cat_alert, CatAvatar as cat_avatar, CatBadge as cat_badge, CatButton as cat_button, CatCard as cat_card, CatCheckbox as cat_checkbox, CatIcon as cat_icon, CatInput as cat_input, CatMenu as cat_menu, CatRadio as cat_radio, CatScrollable as cat_scrollable, CatSkeleton as cat_skeleton, CatSpinner as cat_spinner, CatTab as cat_tab, CatTabs as cat_tabs, CatToastDemo as cat_toast_demo, CatToggle as cat_toggle, CatTooltip as cat_tooltip };
|
|
4596
4809
|
|
|
4597
|
-
//# sourceMappingURL=cat-
|
|
4810
|
+
//# sourceMappingURL=cat-alert_18.entry.js.map
|