@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
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-499bad41.js');
|
|
6
6
|
const loglevel = require('./loglevel-c9b2d01f.js');
|
|
7
|
+
const catFormHint = require('./cat-form-hint-93a6936b.js');
|
|
7
8
|
const catIconRegistry = require('./cat-icon-registry-49b11b51.js');
|
|
8
9
|
const catNotification = require('./cat-notification-156f4cf5.js');
|
|
9
10
|
|
|
@@ -35,7 +36,92 @@ const CatAlert = class {
|
|
|
35
36
|
};
|
|
36
37
|
CatAlert.style = catAlertCss;
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Loads an image and wraps the result in a promise.
|
|
41
|
+
*
|
|
42
|
+
* @param src the image URL
|
|
43
|
+
* @returns a promise
|
|
44
|
+
*/
|
|
45
|
+
const loadImg = (src) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const image = new Image();
|
|
48
|
+
image.addEventListener('load', resolve);
|
|
49
|
+
image.addEventListener('error', reject);
|
|
50
|
+
image.src = src;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
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)}";
|
|
55
|
+
|
|
56
|
+
const CatAvatar = class {
|
|
57
|
+
constructor(hostRef) {
|
|
58
|
+
index.registerInstance(this, hostRef);
|
|
59
|
+
/**
|
|
60
|
+
* The size of the avatar.
|
|
61
|
+
*/
|
|
62
|
+
this.size = 'm';
|
|
63
|
+
/**
|
|
64
|
+
* Use round avatar edges.
|
|
65
|
+
*/
|
|
66
|
+
this.round = false;
|
|
67
|
+
/**
|
|
68
|
+
* The label of the avatar.
|
|
69
|
+
*/
|
|
70
|
+
this.label = '';
|
|
71
|
+
}
|
|
72
|
+
onSrcChanged(value) {
|
|
73
|
+
if (value) {
|
|
74
|
+
loadImg(value).then(() => (this.backgroundImage = `url(${value})`), () => (this.backgroundImage = undefined));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.backgroundImage = undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
componentWillLoad() {
|
|
81
|
+
this.onSrcChanged(this.src);
|
|
82
|
+
}
|
|
83
|
+
componentWillRender() {
|
|
84
|
+
if (!this.label) {
|
|
85
|
+
loglevel.loglevel.warn('[A11y] Missing ARIA label on avatar', this);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
if (this.url) {
|
|
90
|
+
return (index.h("a", { href: this.url, target: this.urlTarget, style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return (index.h("span", { style: this.cssStyle, class: this.cssClass, "aria-label": this.label }, this.content));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
get content() {
|
|
97
|
+
return !this.backgroundImage
|
|
98
|
+
? [this.icon ? index.h("cat-icon", { icon: this.icon, size: this.size }) : this.getInitials()]
|
|
99
|
+
: [];
|
|
100
|
+
}
|
|
101
|
+
get cssStyle() {
|
|
102
|
+
return { 'background-image': this.backgroundImage };
|
|
103
|
+
}
|
|
104
|
+
get cssClass() {
|
|
105
|
+
return {
|
|
106
|
+
avatar: true,
|
|
107
|
+
'avatar-round': this.round,
|
|
108
|
+
[`avatar-${this.size}`]: Boolean(this.size)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
getInitials() {
|
|
112
|
+
var _a;
|
|
113
|
+
return ((_a = this.initials) !== null && _a !== void 0 ? _a : this.label
|
|
114
|
+
.split(' ')
|
|
115
|
+
.map(n => n[0])
|
|
116
|
+
.join(''));
|
|
117
|
+
}
|
|
118
|
+
static get watchers() { return {
|
|
119
|
+
"src": ["onSrcChanged"]
|
|
120
|
+
}; }
|
|
121
|
+
};
|
|
122
|
+
CatAvatar.style = catAvatarCss;
|
|
123
|
+
|
|
124
|
+
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
125
|
|
|
40
126
|
const CatBadge = class {
|
|
41
127
|
constructor(hostRef) {
|
|
@@ -230,9 +316,9 @@ const CatButton = class {
|
|
|
230
316
|
*/
|
|
231
317
|
this.submit = false;
|
|
232
318
|
/**
|
|
233
|
-
*
|
|
319
|
+
* Disables ellipse overflowing button content.
|
|
234
320
|
*/
|
|
235
|
-
this.
|
|
321
|
+
this.noEllipsis = false;
|
|
236
322
|
/**
|
|
237
323
|
* Use round button edges.
|
|
238
324
|
*/
|
|
@@ -297,7 +383,7 @@ const CatButton = class {
|
|
|
297
383
|
'cat-button-round': this.round,
|
|
298
384
|
'cat-button-loading': this.loading,
|
|
299
385
|
'cat-button-disabled': this.disabled,
|
|
300
|
-
'cat-button-ellipsed': this.
|
|
386
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
301
387
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
302
388
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
303
389
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -311,7 +397,7 @@ const CatButton = class {
|
|
|
311
397
|
'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
|
|
312
398
|
'cat-button-loading': this.loading,
|
|
313
399
|
'cat-button-disabled': this.disabled,
|
|
314
|
-
'cat-button-ellipsed': this.
|
|
400
|
+
'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,
|
|
315
401
|
[`cat-button-${this.variant}`]: Boolean(this.variant),
|
|
316
402
|
[`cat-button-${this.color}`]: Boolean(this.color),
|
|
317
403
|
[`cat-button-${this.size}`]: Boolean(this.size)
|
|
@@ -378,16 +464,17 @@ const CatCard = class {
|
|
|
378
464
|
};
|
|
379
465
|
CatCard.style = catCardCss;
|
|
380
466
|
|
|
381
|
-
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))}";
|
|
467
|
+
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))}";
|
|
382
468
|
|
|
383
|
-
let nextUniqueId$
|
|
469
|
+
let nextUniqueId$6 = 0;
|
|
384
470
|
const CatCheckbox = class {
|
|
385
471
|
constructor(hostRef) {
|
|
386
472
|
index.registerInstance(this, hostRef);
|
|
387
473
|
this.catChange = index.createEvent(this, "catChange", 7);
|
|
388
474
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
389
475
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
390
|
-
this.id = `cat-checkbox-${nextUniqueId$
|
|
476
|
+
this.id = `cat-checkbox-${nextUniqueId$6++}`;
|
|
477
|
+
this.hasSlottedLabel = false;
|
|
391
478
|
/**
|
|
392
479
|
* Checked state of the checkbox
|
|
393
480
|
*/
|
|
@@ -419,7 +506,8 @@ const CatCheckbox = class {
|
|
|
419
506
|
}
|
|
420
507
|
}
|
|
421
508
|
componentWillRender() {
|
|
422
|
-
|
|
509
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
510
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
423
511
|
loglevel.loglevel.error('[A11y] Missing ARIA label on checkbox', this);
|
|
424
512
|
}
|
|
425
513
|
}
|
|
@@ -433,9 +521,14 @@ const CatCheckbox = class {
|
|
|
433
521
|
this.input.focus(options);
|
|
434
522
|
}
|
|
435
523
|
render() {
|
|
436
|
-
return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.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) }), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, this.label)));
|
|
524
|
+
return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.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) }), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
525
|
+
}
|
|
526
|
+
get hintSection() {
|
|
527
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
528
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
437
529
|
}
|
|
438
530
|
onInput(event) {
|
|
531
|
+
this.value = this.input.value;
|
|
439
532
|
this.catChange.emit(event);
|
|
440
533
|
}
|
|
441
534
|
onFocus(event) {
|
|
@@ -444,10 +537,11 @@ const CatCheckbox = class {
|
|
|
444
537
|
onBlur(event) {
|
|
445
538
|
this.catBlur.emit(event);
|
|
446
539
|
}
|
|
540
|
+
get hostElement() { return index.getElement(this); }
|
|
447
541
|
};
|
|
448
542
|
CatCheckbox.style = catCheckboxCss;
|
|
449
543
|
|
|
450
|
-
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;
|
|
544
|
+
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}";
|
|
451
545
|
|
|
452
546
|
const CatIcon = class {
|
|
453
547
|
constructor(hostRef) {
|
|
@@ -471,9 +565,9 @@ const CatIcon = class {
|
|
|
471
565
|
};
|
|
472
566
|
CatIcon.style = catIconCss;
|
|
473
567
|
|
|
474
|
-
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}
|
|
568
|
+
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}";
|
|
475
569
|
|
|
476
|
-
let nextUniqueId$
|
|
570
|
+
let nextUniqueId$5 = 0;
|
|
477
571
|
const CatInput = class {
|
|
478
572
|
constructor(hostRef) {
|
|
479
573
|
index.registerInstance(this, hostRef);
|
|
@@ -481,8 +575,8 @@ const CatInput = class {
|
|
|
481
575
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
482
576
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
483
577
|
this.i18n = catIconRegistry.CatI18nRegistry.getInstance();
|
|
484
|
-
this.id = `cat-input-${nextUniqueId$
|
|
485
|
-
this.
|
|
578
|
+
this.id = `cat-input-${nextUniqueId$5++}`;
|
|
579
|
+
this.hasSlottedLabel = false;
|
|
486
580
|
/**
|
|
487
581
|
* Whether the input should show a clear button.
|
|
488
582
|
*/
|
|
@@ -524,14 +618,9 @@ const CatInput = class {
|
|
|
524
618
|
*/
|
|
525
619
|
this.type = 'text';
|
|
526
620
|
}
|
|
527
|
-
onValueChange(value) {
|
|
528
|
-
this.inputValue = '' + (value !== null && value !== void 0 ? value : '');
|
|
529
|
-
}
|
|
530
|
-
componentWillLoad() {
|
|
531
|
-
this.onValueChange(this.value);
|
|
532
|
-
}
|
|
533
621
|
componentWillRender() {
|
|
534
|
-
|
|
622
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
623
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
535
624
|
loglevel.loglevel.error('[A11y] Missing ARIA label on input', this);
|
|
536
625
|
}
|
|
537
626
|
}
|
|
@@ -548,19 +637,23 @@ const CatInput = class {
|
|
|
548
637
|
* Clear the input.
|
|
549
638
|
*/
|
|
550
639
|
async clear() {
|
|
551
|
-
this.
|
|
640
|
+
this.value = '';
|
|
552
641
|
}
|
|
553
642
|
render() {
|
|
554
|
-
return (index.h(index.Host, null, this.label && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", this.i18n.getMessage('input.optional'), ")"))))), index.h("div", { class: {
|
|
643
|
+
return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", this.i18n.getMessage('input.optional'), ")"))))), index.h("div", { class: {
|
|
555
644
|
'input-wrapper': true,
|
|
556
645
|
'input-round': this.round,
|
|
557
646
|
'input-disabled': this.disabled
|
|
558
647
|
}, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && index.h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), index.h("div", { class: "input-inner-wrapper" }, index.h("input", { ref: el => (this.input = el), id: this.id, class: {
|
|
559
648
|
'has-clearable': this.clearable && !this.disabled
|
|
560
|
-
}, 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.
|
|
649
|
+
}, 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 && (index.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 && index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
|
|
650
|
+
}
|
|
651
|
+
get hintSection() {
|
|
652
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
653
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
561
654
|
}
|
|
562
655
|
onInput(event) {
|
|
563
|
-
this.
|
|
656
|
+
this.value = this.input.value;
|
|
564
657
|
this.catChange.emit(event);
|
|
565
658
|
}
|
|
566
659
|
onFocus(event) {
|
|
@@ -569,9 +662,7 @@ const CatInput = class {
|
|
|
569
662
|
onBlur(event) {
|
|
570
663
|
this.catBlur.emit(event);
|
|
571
664
|
}
|
|
572
|
-
|
|
573
|
-
"value": ["onValueChange"]
|
|
574
|
-
}; }
|
|
665
|
+
get hostElement() { return index.getElement(this); }
|
|
575
666
|
};
|
|
576
667
|
CatInput.style = catInputCss;
|
|
577
668
|
|
|
@@ -2810,13 +2901,13 @@ const firstTabbable = (container) => {
|
|
|
2810
2901
|
|
|
2811
2902
|
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}";
|
|
2812
2903
|
|
|
2813
|
-
let nextUniqueId$
|
|
2904
|
+
let nextUniqueId$4 = 0;
|
|
2814
2905
|
const CatMenu = class {
|
|
2815
2906
|
constructor(hostRef) {
|
|
2816
2907
|
index.registerInstance(this, hostRef);
|
|
2817
2908
|
this.catOpen = index.createEvent(this, "catOpen", 7);
|
|
2818
2909
|
this.catClose = index.createEvent(this, "catClose", 7);
|
|
2819
|
-
this.id = nextUniqueId$
|
|
2910
|
+
this.id = nextUniqueId$4++;
|
|
2820
2911
|
/**
|
|
2821
2912
|
* The placement of the menu.
|
|
2822
2913
|
*/
|
|
@@ -2911,16 +3002,17 @@ const CatMenu = class {
|
|
|
2911
3002
|
CatMenu.OFFSET = 4;
|
|
2912
3003
|
CatMenu.style = catMenuCss;
|
|
2913
3004
|
|
|
2914
|
-
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}";
|
|
3005
|
+
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}";
|
|
2915
3006
|
|
|
2916
|
-
let nextUniqueId$
|
|
3007
|
+
let nextUniqueId$3 = 0;
|
|
2917
3008
|
const CatRadio = class {
|
|
2918
3009
|
constructor(hostRef) {
|
|
2919
3010
|
index.registerInstance(this, hostRef);
|
|
2920
3011
|
this.catChange = index.createEvent(this, "catChange", 7);
|
|
2921
3012
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
2922
3013
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
2923
|
-
this.id = `cat-radio-${++nextUniqueId$
|
|
3014
|
+
this.id = `cat-radio-${++nextUniqueId$3}`;
|
|
3015
|
+
this.hasSlottedLabel = false;
|
|
2924
3016
|
/**
|
|
2925
3017
|
* Whether this radio is checked.
|
|
2926
3018
|
*/
|
|
@@ -2943,7 +3035,8 @@ const CatRadio = class {
|
|
|
2943
3035
|
this.required = false;
|
|
2944
3036
|
}
|
|
2945
3037
|
componentWillRender() {
|
|
2946
|
-
|
|
3038
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
3039
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
2947
3040
|
loglevel.loglevel.error('[A11y] Missing ARIA label on radio', this);
|
|
2948
3041
|
}
|
|
2949
3042
|
}
|
|
@@ -2957,9 +3050,14 @@ const CatRadio = class {
|
|
|
2957
3050
|
this.input.focus(options);
|
|
2958
3051
|
}
|
|
2959
3052
|
render() {
|
|
2960
|
-
return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.h("span", { class: "radio" }, index.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) }), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, this.label)));
|
|
3053
|
+
return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.h("span", { class: "radio" }, index.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) }), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
3054
|
+
}
|
|
3055
|
+
get hintSection() {
|
|
3056
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
3057
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
2961
3058
|
}
|
|
2962
3059
|
onChange(event) {
|
|
3060
|
+
this.value = this.input.value;
|
|
2963
3061
|
this.catChange.emit(event);
|
|
2964
3062
|
}
|
|
2965
3063
|
onFocus(event) {
|
|
@@ -2968,6 +3066,7 @@ const CatRadio = class {
|
|
|
2968
3066
|
onBlur(event) {
|
|
2969
3067
|
this.catBlur.emit(event);
|
|
2970
3068
|
}
|
|
3069
|
+
get hostElement() { return index.getElement(this); }
|
|
2971
3070
|
};
|
|
2972
3071
|
CatRadio.style = catRadioCss;
|
|
2973
3072
|
|
|
@@ -4202,20 +4301,20 @@ const CatScrollable = class {
|
|
|
4202
4301
|
this.scrolledBottom = index.createEvent(this, "scrolledBottom", 7);
|
|
4203
4302
|
this.init = new Subject();
|
|
4204
4303
|
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.
|
|
4304
|
+
/** Flags to disable/enable scroll shadowX. */
|
|
4305
|
+
this.noShadowX = false;
|
|
4306
|
+
/** Flags to disable/enable scroll shadowY. */
|
|
4307
|
+
this.noShadowY = false;
|
|
4308
|
+
/** Flags to disable/enable overflowX. */
|
|
4309
|
+
this.noOverflowX = false;
|
|
4310
|
+
/** Flags to disable/enable overflowY. */
|
|
4311
|
+
this.noOverflowY = false;
|
|
4312
|
+
/** Flag to disable/enable overscroll behavior. */
|
|
4313
|
+
this.noOverscroll = false;
|
|
4215
4314
|
/**
|
|
4216
|
-
* Flag to fire an initial event after content initialization.
|
|
4315
|
+
* Flag to not fire an initial event after content initialization.
|
|
4217
4316
|
*/
|
|
4218
|
-
this.
|
|
4317
|
+
this.noScrolledInit = false;
|
|
4219
4318
|
/**
|
|
4220
4319
|
* Buffer to be used to calculate the scroll distance.
|
|
4221
4320
|
*/
|
|
@@ -4244,7 +4343,7 @@ const CatScrollable = class {
|
|
|
4244
4343
|
});
|
|
4245
4344
|
}
|
|
4246
4345
|
componentDidLoad() {
|
|
4247
|
-
if (this.
|
|
4346
|
+
if (!this.noScrolledInit) {
|
|
4248
4347
|
this.init.next();
|
|
4249
4348
|
}
|
|
4250
4349
|
}
|
|
@@ -4255,12 +4354,12 @@ const CatScrollable = class {
|
|
|
4255
4354
|
}
|
|
4256
4355
|
render() {
|
|
4257
4356
|
return [
|
|
4258
|
-
index.h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, this.
|
|
4357
|
+
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
4358
|
index.h("div", { ref: el => (this.scrollElement = el), class: {
|
|
4260
4359
|
'scrollable-content': true,
|
|
4261
|
-
'scroll-x': this.
|
|
4262
|
-
'scroll-y': this.
|
|
4263
|
-
'no-overscroll':
|
|
4360
|
+
'scroll-x': !this.noOverflowX,
|
|
4361
|
+
'scroll-y': !this.noOverflowY,
|
|
4362
|
+
'no-overscroll': this.noOverscroll
|
|
4264
4363
|
} }, index.h("slot", null))
|
|
4265
4364
|
];
|
|
4266
4365
|
}
|
|
@@ -4370,6 +4469,107 @@ const CatSpinner = class {
|
|
|
4370
4469
|
};
|
|
4371
4470
|
CatSpinner.style = catSpinnerCss;
|
|
4372
4471
|
|
|
4472
|
+
const catTabCss = ":host{display:block}:host([hidden]){display:none}";
|
|
4473
|
+
|
|
4474
|
+
let nextUniqueId$2 = 0;
|
|
4475
|
+
const CatTab = class {
|
|
4476
|
+
constructor(hostRef) {
|
|
4477
|
+
index.registerInstance(this, hostRef);
|
|
4478
|
+
this.tabClick = index.createEvent(this, "tabClick", 7);
|
|
4479
|
+
/**
|
|
4480
|
+
* The label of the tab.
|
|
4481
|
+
*/
|
|
4482
|
+
this.label = '';
|
|
4483
|
+
/**
|
|
4484
|
+
* Hide the actual button content and only display the tab.
|
|
4485
|
+
*/
|
|
4486
|
+
this.iconOnly = false;
|
|
4487
|
+
/**
|
|
4488
|
+
* Display the icon on the right.
|
|
4489
|
+
*/
|
|
4490
|
+
this.iconRight = false;
|
|
4491
|
+
/**
|
|
4492
|
+
* Specifies that the tab should be deactivated.
|
|
4493
|
+
*/
|
|
4494
|
+
this.deactivated = false;
|
|
4495
|
+
}
|
|
4496
|
+
connectedCallback() {
|
|
4497
|
+
if (!this.hostElement.id) {
|
|
4498
|
+
this.hostElement.id = `cat-tab-${nextUniqueId$2++}`;
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
onClick(event) {
|
|
4502
|
+
this.tabClick.emit(event);
|
|
4503
|
+
}
|
|
4504
|
+
render() {
|
|
4505
|
+
return index.h(index.Host, null);
|
|
4506
|
+
}
|
|
4507
|
+
get hostElement() { return index.getElement(this); }
|
|
4508
|
+
};
|
|
4509
|
+
CatTab.style = catTabCss;
|
|
4510
|
+
|
|
4511
|
+
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}";
|
|
4512
|
+
|
|
4513
|
+
const CatTabs = class {
|
|
4514
|
+
constructor(hostRef) {
|
|
4515
|
+
index.registerInstance(this, hostRef);
|
|
4516
|
+
this.tabs = [];
|
|
4517
|
+
this.buttons = [];
|
|
4518
|
+
/**
|
|
4519
|
+
* The ID of the active tab.
|
|
4520
|
+
*/
|
|
4521
|
+
this.activeTab = '';
|
|
4522
|
+
/**
|
|
4523
|
+
* The alignment of the tabs.
|
|
4524
|
+
*/
|
|
4525
|
+
this.tabsAlign = 'left';
|
|
4526
|
+
}
|
|
4527
|
+
onActiveTabChanged(newActiveTab) {
|
|
4528
|
+
const activeTab = this.tabs.find(value => value.id === newActiveTab);
|
|
4529
|
+
activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
|
|
4530
|
+
}
|
|
4531
|
+
componentWillLoad() {
|
|
4532
|
+
this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
|
|
4533
|
+
if (this.tabs.length) {
|
|
4534
|
+
this.activeTabId = this.activeTab;
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
onKeydown(event) {
|
|
4538
|
+
var _a;
|
|
4539
|
+
if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
4540
|
+
const targetElements = this.buttons.filter(button => !button.disabled);
|
|
4541
|
+
const activeElement = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
4542
|
+
const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
|
|
4543
|
+
const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
|
|
4544
|
+
const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
|
|
4545
|
+
targetElements[targetIdx].setFocus();
|
|
4546
|
+
event.preventDefault();
|
|
4547
|
+
}
|
|
4548
|
+
}
|
|
4549
|
+
render() {
|
|
4550
|
+
return (index.h(index.Host, null, this.tabs.map((tab) => {
|
|
4551
|
+
return (index.h("cat-button", { ref: el => el && this.updateButtonsRef(el), buttonId: tab.id, role: "tab", part: "tab", class: {
|
|
4552
|
+
tab: true,
|
|
4553
|
+
'tab-active': Boolean(this.activeTabId && tab.id === this.activeTabId)
|
|
4554
|
+
}, 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));
|
|
4555
|
+
})));
|
|
4556
|
+
}
|
|
4557
|
+
updateButtonsRef(button) {
|
|
4558
|
+
const indexOf = this.buttons.indexOf(button);
|
|
4559
|
+
if (indexOf >= 0) {
|
|
4560
|
+
this.buttons[indexOf] = button;
|
|
4561
|
+
}
|
|
4562
|
+
else {
|
|
4563
|
+
this.buttons.push(button);
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
get hostElement() { return index.getElement(this); }
|
|
4567
|
+
static get watchers() { return {
|
|
4568
|
+
"activeTabId": ["onActiveTabChanged"]
|
|
4569
|
+
}; }
|
|
4570
|
+
};
|
|
4571
|
+
CatTabs.style = catTabsCss;
|
|
4572
|
+
|
|
4373
4573
|
const catToastDemoCss = ":host{display:block}";
|
|
4374
4574
|
|
|
4375
4575
|
const CatToastDemo = class {
|
|
@@ -4413,7 +4613,7 @@ const CatToastDemo = class {
|
|
|
4413
4613
|
};
|
|
4414
4614
|
CatToastDemo.style = catToastDemoCss;
|
|
4415
4615
|
|
|
4416
|
-
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))}";
|
|
4616
|
+
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))}";
|
|
4417
4617
|
|
|
4418
4618
|
let nextUniqueId$1 = 0;
|
|
4419
4619
|
const CatToggle = class {
|
|
@@ -4423,6 +4623,7 @@ const CatToggle = class {
|
|
|
4423
4623
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
4424
4624
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
4425
4625
|
this.id = `cat-toggle-${nextUniqueId$1++}`;
|
|
4626
|
+
this.hasSlottedLabel = false;
|
|
4426
4627
|
/**
|
|
4427
4628
|
* Checked state of the toggle.
|
|
4428
4629
|
*/
|
|
@@ -4445,7 +4646,8 @@ const CatToggle = class {
|
|
|
4445
4646
|
this.required = false;
|
|
4446
4647
|
}
|
|
4447
4648
|
componentWillRender() {
|
|
4448
|
-
|
|
4649
|
+
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
4650
|
+
if (!this.label && !this.hasSlottedLabel) {
|
|
4449
4651
|
loglevel.loglevel.error('[A11y] Missing ARIA label on toggle', this);
|
|
4450
4652
|
}
|
|
4451
4653
|
}
|
|
@@ -4459,9 +4661,14 @@ const CatToggle = class {
|
|
|
4459
4661
|
this.input.focus(options);
|
|
4460
4662
|
}
|
|
4461
4663
|
render() {
|
|
4462
|
-
return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.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) }), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, this.label)));
|
|
4664
|
+
return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.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) }), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
|
|
4665
|
+
}
|
|
4666
|
+
get hintSection() {
|
|
4667
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
4668
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
4463
4669
|
}
|
|
4464
4670
|
onInput(event) {
|
|
4671
|
+
this.value = this.input.value;
|
|
4465
4672
|
this.catChange.emit(event);
|
|
4466
4673
|
}
|
|
4467
4674
|
onFocus(event) {
|
|
@@ -4470,6 +4677,7 @@ const CatToggle = class {
|
|
|
4470
4677
|
onBlur(event) {
|
|
4471
4678
|
this.catBlur.emit(event);
|
|
4472
4679
|
}
|
|
4680
|
+
get hostElement() { return index.getElement(this); }
|
|
4473
4681
|
};
|
|
4474
4682
|
CatToggle.style = catToggleCss;
|
|
4475
4683
|
|
|
@@ -4521,6 +4729,7 @@ const CatTooltip = class {
|
|
|
4521
4729
|
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
4522
4730
|
}
|
|
4523
4731
|
if (isTouchDevice) {
|
|
4732
|
+
window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4524
4733
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4525
4734
|
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
4526
4735
|
}
|
|
@@ -4534,6 +4743,7 @@ const CatTooltip = class {
|
|
|
4534
4743
|
disconnectedCallback() {
|
|
4535
4744
|
var _a, _b, _c, _d, _e, _f;
|
|
4536
4745
|
if (isTouchDevice) {
|
|
4746
|
+
window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4537
4747
|
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4538
4748
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
|
|
4539
4749
|
}
|
|
@@ -4568,28 +4778,31 @@ const CatTooltip = class {
|
|
|
4568
4778
|
showListener() {
|
|
4569
4779
|
window.clearTimeout(this.hideTimeout);
|
|
4570
4780
|
this.showTimeout = window.setTimeout(() => {
|
|
4571
|
-
var _a
|
|
4572
|
-
(_a = this.
|
|
4573
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
|
|
4781
|
+
var _a;
|
|
4782
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
4574
4783
|
}, this.showDelay);
|
|
4575
4784
|
}
|
|
4576
4785
|
hideListener() {
|
|
4577
4786
|
window.clearTimeout(this.showTimeout);
|
|
4578
4787
|
this.hideTimeout = window.setTimeout(() => {
|
|
4579
|
-
var _a
|
|
4580
|
-
(_a = this.
|
|
4581
|
-
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
|
|
4788
|
+
var _a;
|
|
4789
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
4582
4790
|
}, this.hideDelay);
|
|
4583
4791
|
}
|
|
4584
|
-
touchStartListener() {
|
|
4792
|
+
touchStartListener(event) {
|
|
4793
|
+
event.stopPropagation();
|
|
4585
4794
|
this.touchTimeout = window.setTimeout(() => {
|
|
4586
4795
|
var _a;
|
|
4587
4796
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
4588
4797
|
}, this.longTouchDuration);
|
|
4589
4798
|
}
|
|
4590
4799
|
touchEndListener() {
|
|
4800
|
+
if (this.touchTimeout) {
|
|
4801
|
+
window.clearTimeout(this.touchTimeout);
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
windowTouchStartListener() {
|
|
4591
4805
|
var _a;
|
|
4592
|
-
window.clearTimeout(this.touchTimeout);
|
|
4593
4806
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
4594
4807
|
}
|
|
4595
4808
|
};
|
|
@@ -4597,6 +4810,7 @@ CatTooltip.OFFSET = 4;
|
|
|
4597
4810
|
CatTooltip.style = catTooltipCss;
|
|
4598
4811
|
|
|
4599
4812
|
exports.cat_alert = CatAlert;
|
|
4813
|
+
exports.cat_avatar = CatAvatar;
|
|
4600
4814
|
exports.cat_badge = CatBadge;
|
|
4601
4815
|
exports.cat_button = CatButton;
|
|
4602
4816
|
exports.cat_card = CatCard;
|
|
@@ -4608,8 +4822,10 @@ exports.cat_radio = CatRadio;
|
|
|
4608
4822
|
exports.cat_scrollable = CatScrollable;
|
|
4609
4823
|
exports.cat_skeleton = CatSkeleton;
|
|
4610
4824
|
exports.cat_spinner = CatSpinner;
|
|
4825
|
+
exports.cat_tab = CatTab;
|
|
4826
|
+
exports.cat_tabs = CatTabs;
|
|
4611
4827
|
exports.cat_toast_demo = CatToastDemo;
|
|
4612
4828
|
exports.cat_toggle = CatToggle;
|
|
4613
4829
|
exports.cat_tooltip = CatTooltip;
|
|
4614
4830
|
|
|
4615
|
-
//# sourceMappingURL=cat-
|
|
4831
|
+
//# sourceMappingURL=cat-alert_18.cjs.entry.js.map
|