@haiilo/catalyst 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.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-4c9cd203.entry.js +2 -0
- package/dist/catalyst/p-4c9cd203.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-9d2eab4f.entry.js +10 -0
- package/dist/catalyst/p-9d2eab4f.entry.js.map +1 -0
- package/dist/cjs/app-globals-aa29ad72.js.map +1 -1
- package/dist/cjs/{cat-alert_16.cjs.entry.js → cat-alert_18.cjs.entry.js} +169 -43
- 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 +12 -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 +2 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +14 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +43 -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-input/cat-input.css +12 -6
- package/dist/collection/components/cat-input/cat-input.js +23 -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 +40 -8
- package/dist/collection/components/cat-radio/cat-radio.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 +23 -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 +39 -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/components/cat-checkbox.js +15 -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-input.js +15 -18
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-radio.js +15 -5
- package/dist/components/cat-radio.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 +13 -12
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toggle.js +15 -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_16.entry.js → cat-alert_18.entry.js} +168 -44
- 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 +12 -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-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-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 +134 -8
- package/package.json +2 -2
- package/dist/catalyst/p-6a5f0d4a.entry.js +0 -10
- package/dist/catalyst/p-6a5f0d4a.entry.js.map +0 -1
- 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/cjs/cat-alert_16.cjs.entry.js.map +0 -1
- package/dist/cjs/index-5d72f0e4.js.map +0 -1
- package/dist/esm/cat-alert_16.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
|
|
|
@@ -463,16 +464,17 @@ const CatCard = class {
|
|
|
463
464
|
};
|
|
464
465
|
CatCard.style = catCardCss;
|
|
465
466
|
|
|
466
|
-
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))}";
|
|
467
468
|
|
|
468
|
-
let nextUniqueId$
|
|
469
|
+
let nextUniqueId$6 = 0;
|
|
469
470
|
const CatCheckbox = class {
|
|
470
471
|
constructor(hostRef) {
|
|
471
472
|
index.registerInstance(this, hostRef);
|
|
472
473
|
this.catChange = index.createEvent(this, "catChange", 7);
|
|
473
474
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
474
475
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
475
|
-
this.id = `cat-checkbox-${nextUniqueId$
|
|
476
|
+
this.id = `cat-checkbox-${nextUniqueId$6++}`;
|
|
477
|
+
this.hasSlottedLabel = false;
|
|
476
478
|
/**
|
|
477
479
|
* Checked state of the checkbox
|
|
478
480
|
*/
|
|
@@ -504,7 +506,7 @@ const CatCheckbox = class {
|
|
|
504
506
|
}
|
|
505
507
|
}
|
|
506
508
|
componentWillRender() {
|
|
507
|
-
if (!this.label) {
|
|
509
|
+
if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
|
|
508
510
|
loglevel.loglevel.error('[A11y] Missing ARIA label on checkbox', this);
|
|
509
511
|
}
|
|
510
512
|
}
|
|
@@ -518,9 +520,14 @@ const CatCheckbox = class {
|
|
|
518
520
|
this.input.focus(options);
|
|
519
521
|
}
|
|
520
522
|
render() {
|
|
521
|
-
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)));
|
|
523
|
+
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));
|
|
524
|
+
}
|
|
525
|
+
get hintSection() {
|
|
526
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
527
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
522
528
|
}
|
|
523
529
|
onInput(event) {
|
|
530
|
+
this.value = this.input.value;
|
|
524
531
|
this.catChange.emit(event);
|
|
525
532
|
}
|
|
526
533
|
onFocus(event) {
|
|
@@ -529,6 +536,7 @@ const CatCheckbox = class {
|
|
|
529
536
|
onBlur(event) {
|
|
530
537
|
this.catBlur.emit(event);
|
|
531
538
|
}
|
|
539
|
+
get hostElement() { return index.getElement(this); }
|
|
532
540
|
};
|
|
533
541
|
CatCheckbox.style = catCheckboxCss;
|
|
534
542
|
|
|
@@ -556,9 +564,9 @@ const CatIcon = class {
|
|
|
556
564
|
};
|
|
557
565
|
CatIcon.style = catIconCss;
|
|
558
566
|
|
|
559
|
-
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}
|
|
567
|
+
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}";
|
|
560
568
|
|
|
561
|
-
let nextUniqueId$
|
|
569
|
+
let nextUniqueId$5 = 0;
|
|
562
570
|
const CatInput = class {
|
|
563
571
|
constructor(hostRef) {
|
|
564
572
|
index.registerInstance(this, hostRef);
|
|
@@ -566,8 +574,8 @@ const CatInput = class {
|
|
|
566
574
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
567
575
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
568
576
|
this.i18n = catIconRegistry.CatI18nRegistry.getInstance();
|
|
569
|
-
this.id = `cat-input-${nextUniqueId$
|
|
570
|
-
this.
|
|
577
|
+
this.id = `cat-input-${nextUniqueId$5++}`;
|
|
578
|
+
this.hasSlottedLabel = false;
|
|
571
579
|
/**
|
|
572
580
|
* Whether the input should show a clear button.
|
|
573
581
|
*/
|
|
@@ -609,14 +617,8 @@ const CatInput = class {
|
|
|
609
617
|
*/
|
|
610
618
|
this.type = 'text';
|
|
611
619
|
}
|
|
612
|
-
onValueChange(value) {
|
|
613
|
-
this.inputValue = '' + (value !== null && value !== void 0 ? value : '');
|
|
614
|
-
}
|
|
615
|
-
componentWillLoad() {
|
|
616
|
-
this.onValueChange(this.value);
|
|
617
|
-
}
|
|
618
620
|
componentWillRender() {
|
|
619
|
-
if (!this.label) {
|
|
621
|
+
if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
|
|
620
622
|
loglevel.loglevel.error('[A11y] Missing ARIA label on input', this);
|
|
621
623
|
}
|
|
622
624
|
}
|
|
@@ -633,19 +635,23 @@ const CatInput = class {
|
|
|
633
635
|
* Clear the input.
|
|
634
636
|
*/
|
|
635
637
|
async clear() {
|
|
636
|
-
this.
|
|
638
|
+
this.value = '';
|
|
637
639
|
}
|
|
638
640
|
render() {
|
|
639
|
-
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: {
|
|
641
|
+
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: {
|
|
640
642
|
'input-wrapper': true,
|
|
641
643
|
'input-round': this.round,
|
|
642
644
|
'input-disabled': this.disabled
|
|
643
645
|
}, 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: {
|
|
644
646
|
'has-clearable': this.clearable && !this.disabled
|
|
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.
|
|
647
|
+
}, 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));
|
|
648
|
+
}
|
|
649
|
+
get hintSection() {
|
|
650
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
651
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
646
652
|
}
|
|
647
653
|
onInput(event) {
|
|
648
|
-
this.
|
|
654
|
+
this.value = this.input.value;
|
|
649
655
|
this.catChange.emit(event);
|
|
650
656
|
}
|
|
651
657
|
onFocus(event) {
|
|
@@ -654,9 +660,7 @@ const CatInput = class {
|
|
|
654
660
|
onBlur(event) {
|
|
655
661
|
this.catBlur.emit(event);
|
|
656
662
|
}
|
|
657
|
-
|
|
658
|
-
"value": ["onValueChange"]
|
|
659
|
-
}; }
|
|
663
|
+
get hostElement() { return index.getElement(this); }
|
|
660
664
|
};
|
|
661
665
|
CatInput.style = catInputCss;
|
|
662
666
|
|
|
@@ -2895,13 +2899,13 @@ const firstTabbable = (container) => {
|
|
|
2895
2899
|
|
|
2896
2900
|
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}";
|
|
2897
2901
|
|
|
2898
|
-
let nextUniqueId$
|
|
2902
|
+
let nextUniqueId$4 = 0;
|
|
2899
2903
|
const CatMenu = class {
|
|
2900
2904
|
constructor(hostRef) {
|
|
2901
2905
|
index.registerInstance(this, hostRef);
|
|
2902
2906
|
this.catOpen = index.createEvent(this, "catOpen", 7);
|
|
2903
2907
|
this.catClose = index.createEvent(this, "catClose", 7);
|
|
2904
|
-
this.id = nextUniqueId$
|
|
2908
|
+
this.id = nextUniqueId$4++;
|
|
2905
2909
|
/**
|
|
2906
2910
|
* The placement of the menu.
|
|
2907
2911
|
*/
|
|
@@ -2996,16 +3000,17 @@ const CatMenu = class {
|
|
|
2996
3000
|
CatMenu.OFFSET = 4;
|
|
2997
3001
|
CatMenu.style = catMenuCss;
|
|
2998
3002
|
|
|
2999
|
-
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}";
|
|
3003
|
+
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}";
|
|
3000
3004
|
|
|
3001
|
-
let nextUniqueId$
|
|
3005
|
+
let nextUniqueId$3 = 0;
|
|
3002
3006
|
const CatRadio = class {
|
|
3003
3007
|
constructor(hostRef) {
|
|
3004
3008
|
index.registerInstance(this, hostRef);
|
|
3005
3009
|
this.catChange = index.createEvent(this, "catChange", 7);
|
|
3006
3010
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
3007
3011
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
3008
|
-
this.id = `cat-radio-${++nextUniqueId$
|
|
3012
|
+
this.id = `cat-radio-${++nextUniqueId$3}`;
|
|
3013
|
+
this.hasSlottedLabel = false;
|
|
3009
3014
|
/**
|
|
3010
3015
|
* Whether this radio is checked.
|
|
3011
3016
|
*/
|
|
@@ -3028,7 +3033,7 @@ const CatRadio = class {
|
|
|
3028
3033
|
this.required = false;
|
|
3029
3034
|
}
|
|
3030
3035
|
componentWillRender() {
|
|
3031
|
-
if (!this.label) {
|
|
3036
|
+
if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
|
|
3032
3037
|
loglevel.loglevel.error('[A11y] Missing ARIA label on radio', this);
|
|
3033
3038
|
}
|
|
3034
3039
|
}
|
|
@@ -3042,9 +3047,14 @@ const CatRadio = class {
|
|
|
3042
3047
|
this.input.focus(options);
|
|
3043
3048
|
}
|
|
3044
3049
|
render() {
|
|
3045
|
-
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)));
|
|
3050
|
+
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));
|
|
3051
|
+
}
|
|
3052
|
+
get hintSection() {
|
|
3053
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
3054
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
3046
3055
|
}
|
|
3047
3056
|
onChange(event) {
|
|
3057
|
+
this.value = this.input.value;
|
|
3048
3058
|
this.catChange.emit(event);
|
|
3049
3059
|
}
|
|
3050
3060
|
onFocus(event) {
|
|
@@ -3053,6 +3063,7 @@ const CatRadio = class {
|
|
|
3053
3063
|
onBlur(event) {
|
|
3054
3064
|
this.catBlur.emit(event);
|
|
3055
3065
|
}
|
|
3066
|
+
get hostElement() { return index.getElement(this); }
|
|
3056
3067
|
};
|
|
3057
3068
|
CatRadio.style = catRadioCss;
|
|
3058
3069
|
|
|
@@ -4455,6 +4466,107 @@ const CatSpinner = class {
|
|
|
4455
4466
|
};
|
|
4456
4467
|
CatSpinner.style = catSpinnerCss;
|
|
4457
4468
|
|
|
4469
|
+
const catTabCss = ":host{display:block}:host([hidden]){display:none}";
|
|
4470
|
+
|
|
4471
|
+
let nextUniqueId$2 = 0;
|
|
4472
|
+
const CatTab = class {
|
|
4473
|
+
constructor(hostRef) {
|
|
4474
|
+
index.registerInstance(this, hostRef);
|
|
4475
|
+
this.tabClick = index.createEvent(this, "tabClick", 7);
|
|
4476
|
+
/**
|
|
4477
|
+
* The label of the tab.
|
|
4478
|
+
*/
|
|
4479
|
+
this.label = '';
|
|
4480
|
+
/**
|
|
4481
|
+
* Hide the actual button content and only display the tab.
|
|
4482
|
+
*/
|
|
4483
|
+
this.iconOnly = false;
|
|
4484
|
+
/**
|
|
4485
|
+
* Display the icon on the right.
|
|
4486
|
+
*/
|
|
4487
|
+
this.iconRight = false;
|
|
4488
|
+
/**
|
|
4489
|
+
* Specifies that the tab should be deactivated.
|
|
4490
|
+
*/
|
|
4491
|
+
this.deactivated = false;
|
|
4492
|
+
}
|
|
4493
|
+
connectedCallback() {
|
|
4494
|
+
if (!this.hostElement.id) {
|
|
4495
|
+
this.hostElement.id = `cat-tab-${nextUniqueId$2++}`;
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
onClick(event) {
|
|
4499
|
+
this.tabClick.emit(event);
|
|
4500
|
+
}
|
|
4501
|
+
render() {
|
|
4502
|
+
return index.h(index.Host, null);
|
|
4503
|
+
}
|
|
4504
|
+
get hostElement() { return index.getElement(this); }
|
|
4505
|
+
};
|
|
4506
|
+
CatTab.style = catTabCss;
|
|
4507
|
+
|
|
4508
|
+
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}";
|
|
4509
|
+
|
|
4510
|
+
const CatTabs = class {
|
|
4511
|
+
constructor(hostRef) {
|
|
4512
|
+
index.registerInstance(this, hostRef);
|
|
4513
|
+
this.tabs = [];
|
|
4514
|
+
this.buttons = [];
|
|
4515
|
+
/**
|
|
4516
|
+
* The ID of the active tab.
|
|
4517
|
+
*/
|
|
4518
|
+
this.activeTab = '';
|
|
4519
|
+
/**
|
|
4520
|
+
* The alignment of the tabs.
|
|
4521
|
+
*/
|
|
4522
|
+
this.tabsAlign = 'left';
|
|
4523
|
+
}
|
|
4524
|
+
onActiveTabChanged(newActiveTab) {
|
|
4525
|
+
const activeTab = this.tabs.find(value => value.id === newActiveTab);
|
|
4526
|
+
activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
|
|
4527
|
+
}
|
|
4528
|
+
componentWillLoad() {
|
|
4529
|
+
this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
|
|
4530
|
+
if (this.tabs.length) {
|
|
4531
|
+
this.activeTabId = this.activeTab;
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
onKeydown(event) {
|
|
4535
|
+
var _a;
|
|
4536
|
+
if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
4537
|
+
const targetElements = this.buttons.filter(button => !button.disabled);
|
|
4538
|
+
const activeElement = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
4539
|
+
const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
|
|
4540
|
+
const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
|
|
4541
|
+
const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
|
|
4542
|
+
targetElements[targetIdx].setFocus();
|
|
4543
|
+
event.preventDefault();
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
render() {
|
|
4547
|
+
return (index.h(index.Host, null, this.tabs.map((tab) => {
|
|
4548
|
+
return (index.h("cat-button", { ref: el => el && this.updateButtonsRef(el), buttonId: tab.id, role: "tab", part: "tab", class: {
|
|
4549
|
+
tab: true,
|
|
4550
|
+
'tab-active': Boolean(this.activeTabId && tab.id === this.activeTabId)
|
|
4551
|
+
}, 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));
|
|
4552
|
+
})));
|
|
4553
|
+
}
|
|
4554
|
+
updateButtonsRef(button) {
|
|
4555
|
+
const indexOf = this.buttons.indexOf(button);
|
|
4556
|
+
if (indexOf >= 0) {
|
|
4557
|
+
this.buttons[indexOf] = button;
|
|
4558
|
+
}
|
|
4559
|
+
else {
|
|
4560
|
+
this.buttons.push(button);
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
get hostElement() { return index.getElement(this); }
|
|
4564
|
+
static get watchers() { return {
|
|
4565
|
+
"activeTabId": ["onActiveTabChanged"]
|
|
4566
|
+
}; }
|
|
4567
|
+
};
|
|
4568
|
+
CatTabs.style = catTabsCss;
|
|
4569
|
+
|
|
4458
4570
|
const catToastDemoCss = ":host{display:block}";
|
|
4459
4571
|
|
|
4460
4572
|
const CatToastDemo = class {
|
|
@@ -4498,7 +4610,7 @@ const CatToastDemo = class {
|
|
|
4498
4610
|
};
|
|
4499
4611
|
CatToastDemo.style = catToastDemoCss;
|
|
4500
4612
|
|
|
4501
|
-
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))}";
|
|
4613
|
+
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))}";
|
|
4502
4614
|
|
|
4503
4615
|
let nextUniqueId$1 = 0;
|
|
4504
4616
|
const CatToggle = class {
|
|
@@ -4508,6 +4620,7 @@ const CatToggle = class {
|
|
|
4508
4620
|
this.catFocus = index.createEvent(this, "catFocus", 7);
|
|
4509
4621
|
this.catBlur = index.createEvent(this, "catBlur", 7);
|
|
4510
4622
|
this.id = `cat-toggle-${nextUniqueId$1++}`;
|
|
4623
|
+
this.hasSlottedLabel = false;
|
|
4511
4624
|
/**
|
|
4512
4625
|
* Checked state of the toggle.
|
|
4513
4626
|
*/
|
|
@@ -4530,7 +4643,7 @@ const CatToggle = class {
|
|
|
4530
4643
|
this.required = false;
|
|
4531
4644
|
}
|
|
4532
4645
|
componentWillRender() {
|
|
4533
|
-
if (!this.label) {
|
|
4646
|
+
if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
|
|
4534
4647
|
loglevel.loglevel.error('[A11y] Missing ARIA label on toggle', this);
|
|
4535
4648
|
}
|
|
4536
4649
|
}
|
|
@@ -4544,9 +4657,14 @@ const CatToggle = class {
|
|
|
4544
4657
|
this.input.focus(options);
|
|
4545
4658
|
}
|
|
4546
4659
|
render() {
|
|
4547
|
-
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)));
|
|
4660
|
+
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));
|
|
4661
|
+
}
|
|
4662
|
+
get hintSection() {
|
|
4663
|
+
const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
|
|
4664
|
+
return ((this.hint || hasSlottedHint) && (index.h(catFormHint.CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
|
|
4548
4665
|
}
|
|
4549
4666
|
onInput(event) {
|
|
4667
|
+
this.value = this.input.value;
|
|
4550
4668
|
this.catChange.emit(event);
|
|
4551
4669
|
}
|
|
4552
4670
|
onFocus(event) {
|
|
@@ -4555,6 +4673,7 @@ const CatToggle = class {
|
|
|
4555
4673
|
onBlur(event) {
|
|
4556
4674
|
this.catBlur.emit(event);
|
|
4557
4675
|
}
|
|
4676
|
+
get hostElement() { return index.getElement(this); }
|
|
4558
4677
|
};
|
|
4559
4678
|
CatToggle.style = catToggleCss;
|
|
4560
4679
|
|
|
@@ -4606,6 +4725,7 @@ const CatTooltip = class {
|
|
|
4606
4725
|
autoUpdate(this.trigger, this.tooltip, () => this.update());
|
|
4607
4726
|
}
|
|
4608
4727
|
if (isTouchDevice) {
|
|
4728
|
+
window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4609
4729
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4610
4730
|
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
|
|
4611
4731
|
}
|
|
@@ -4619,6 +4739,7 @@ const CatTooltip = class {
|
|
|
4619
4739
|
disconnectedCallback() {
|
|
4620
4740
|
var _a, _b, _c, _d, _e, _f;
|
|
4621
4741
|
if (isTouchDevice) {
|
|
4742
|
+
window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));
|
|
4622
4743
|
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
|
|
4623
4744
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
|
|
4624
4745
|
}
|
|
@@ -4653,28 +4774,31 @@ const CatTooltip = class {
|
|
|
4653
4774
|
showListener() {
|
|
4654
4775
|
window.clearTimeout(this.hideTimeout);
|
|
4655
4776
|
this.showTimeout = window.setTimeout(() => {
|
|
4656
|
-
var _a
|
|
4657
|
-
(_a = this.
|
|
4658
|
-
(_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');
|
|
4659
4779
|
}, this.showDelay);
|
|
4660
4780
|
}
|
|
4661
4781
|
hideListener() {
|
|
4662
4782
|
window.clearTimeout(this.showTimeout);
|
|
4663
4783
|
this.hideTimeout = window.setTimeout(() => {
|
|
4664
|
-
var _a
|
|
4665
|
-
(_a = this.
|
|
4666
|
-
(_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');
|
|
4667
4786
|
}, this.hideDelay);
|
|
4668
4787
|
}
|
|
4669
|
-
touchStartListener() {
|
|
4788
|
+
touchStartListener(event) {
|
|
4789
|
+
event.stopPropagation();
|
|
4670
4790
|
this.touchTimeout = window.setTimeout(() => {
|
|
4671
4791
|
var _a;
|
|
4672
4792
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
|
|
4673
4793
|
}, this.longTouchDuration);
|
|
4674
4794
|
}
|
|
4675
4795
|
touchEndListener() {
|
|
4796
|
+
if (this.touchTimeout) {
|
|
4797
|
+
window.clearTimeout(this.touchTimeout);
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
windowTouchStartListener() {
|
|
4676
4801
|
var _a;
|
|
4677
|
-
window.clearTimeout(this.touchTimeout);
|
|
4678
4802
|
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
|
|
4679
4803
|
}
|
|
4680
4804
|
};
|
|
@@ -4694,8 +4818,10 @@ exports.cat_radio = CatRadio;
|
|
|
4694
4818
|
exports.cat_scrollable = CatScrollable;
|
|
4695
4819
|
exports.cat_skeleton = CatSkeleton;
|
|
4696
4820
|
exports.cat_spinner = CatSpinner;
|
|
4821
|
+
exports.cat_tab = CatTab;
|
|
4822
|
+
exports.cat_tabs = CatTabs;
|
|
4697
4823
|
exports.cat_toast_demo = CatToastDemo;
|
|
4698
4824
|
exports.cat_toggle = CatToggle;
|
|
4699
4825
|
exports.cat_tooltip = CatTooltip;
|
|
4700
4826
|
|
|
4701
|
-
//# sourceMappingURL=cat-
|
|
4827
|
+
//# sourceMappingURL=cat-alert_18.cjs.entry.js.map
|