@cscfi/csc-ui 1.2.2 → 1.2.4
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/cjs/{c-autocomplete_16.cjs.entry.js → c-autocomplete_23.cjs.entry.js} +665 -9
- package/dist/cjs/c-autocomplete_23.cjs.entry.js.map +1 -0
- package/dist/cjs/{c-checkbox_3.cjs.entry.js → c-pagination_2.cjs.entry.js} +1 -115
- package/dist/cjs/c-pagination_2.cjs.entry.js.map +1 -0
- package/dist/cjs/csc-ui.cjs.js +1 -1
- package/dist/cjs/index-91ba22ab.js +4 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/c-autocomplete/c-autocomplete.js +6 -13
- package/dist/collection/components/c-autocomplete/c-autocomplete.js.map +1 -1
- package/dist/collection/components/c-checkbox/c-checkbox.js +3 -11
- package/dist/collection/components/c-checkbox/c-checkbox.js.map +1 -1
- package/dist/collection/components/c-dropdown/c-dropdown.js +0 -1
- package/dist/collection/components/c-dropdown/c-dropdown.js.map +1 -1
- package/dist/collection/components/c-radio-group/c-radio-group.js +7 -1
- package/dist/collection/components/c-radio-group/c-radio-group.js.map +1 -1
- package/dist/collection/components/c-switch/c-switch.js +3 -11
- package/dist/collection/components/c-switch/c-switch.js.map +1 -1
- package/dist/collection/components/c-table/c-table.css +3 -0
- package/dist/collection/components/c-table/c-table.js +4 -1
- package/dist/collection/components/c-table/c-table.js.map +1 -1
- package/dist/components/c-autocomplete.js +7 -8
- package/dist/components/c-autocomplete.js.map +1 -1
- package/dist/components/c-checkbox2.js +3 -11
- package/dist/components/c-checkbox2.js.map +1 -1
- package/dist/components/c-dropdown2.js +0 -1
- package/dist/components/c-dropdown2.js.map +1 -1
- package/dist/components/c-radio-group.js +7 -1
- package/dist/components/c-radio-group.js.map +1 -1
- package/dist/components/c-switch.js +3 -11
- package/dist/components/c-switch.js.map +1 -1
- package/dist/components/c-table.js +5 -2
- package/dist/components/c-table.js.map +1 -1
- package/dist/csc-ui/csc-ui.esm.js +1 -1
- package/dist/csc-ui/csc-ui.esm.js.map +1 -1
- package/dist/csc-ui/{p-ae16b1f4.entry.js → p-1b181fd3.entry.js} +2 -2
- package/dist/csc-ui/{p-1d6c84df.entry.js → p-2e28b0cc.entry.js} +2 -2
- package/dist/csc-ui/{p-56b1e1ea.entry.js → p-34027974.entry.js} +2 -2
- package/dist/csc-ui/{p-9c80f35e.entry.js → p-367d3bd3.entry.js} +2 -2
- package/dist/csc-ui/{p-f24b9d97.js → p-667da79a.js} +2 -2
- package/dist/csc-ui/{p-b0fa27b6.entry.js → p-6ff81ae0.entry.js} +2 -2
- package/dist/csc-ui/{p-3bb67f38.entry.js → p-74a176e6.entry.js} +2 -2
- package/dist/csc-ui/p-8f36c6ba.entry.js +2 -0
- package/dist/csc-ui/{p-ab62f9b5.entry.js.map → p-8f36c6ba.entry.js.map} +1 -1
- package/dist/csc-ui/p-9ba0ed23.entry.js +2 -0
- package/dist/csc-ui/p-9ba0ed23.entry.js.map +1 -0
- package/dist/csc-ui/{p-c8a7a751.entry.js → p-a8a04dff.entry.js} +2 -2
- package/dist/csc-ui/{p-682782b1.entry.js → p-adaace9b.entry.js} +2 -2
- package/dist/csc-ui/{p-468d9583.entry.js → p-d074c6db.entry.js} +2 -2
- package/dist/csc-ui/{p-ccef8a49.entry.js → p-d22cd2a7.entry.js} +2 -2
- package/dist/csc-ui/p-e1955a0e.entry.js +2 -0
- package/dist/csc-ui/p-e1955a0e.entry.js.map +1 -0
- package/dist/esm/c-accordion-item.entry.js +1 -1
- package/dist/esm/c-alert.entry.js +1 -1
- package/dist/esm/{c-autocomplete_16.entry.js → c-autocomplete_23.entry.js} +660 -11
- package/dist/esm/c-autocomplete_23.entry.js.map +1 -0
- package/dist/esm/c-data-table.entry.js +1 -1
- package/dist/esm/c-menu_2.entry.js +1 -1
- package/dist/esm/c-navigation-button.entry.js +1 -1
- package/dist/esm/{c-checkbox_3.entry.js → c-pagination_2.entry.js} +4 -117
- package/dist/esm/c-pagination_2.entry.js.map +1 -0
- package/dist/esm/c-side-navigation-item.entry.js +1 -1
- package/dist/esm/c-side-navigation.entry.js +1 -1
- package/dist/esm/c-swiper.entry.js +1 -1
- package/dist/esm/c-tabs.entry.js +1 -1
- package/dist/esm/c-tag.entry.js +1 -1
- package/dist/esm/c-toast.entry.js +1 -1
- package/dist/esm/csc-ui.js +1 -1
- package/dist/esm/index-47956d53.js +4 -28
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mdi-8656e74a.js → mdi-e483616d.js} +2 -2
- package/dist/esm/{mdi-8656e74a.js.map → mdi-e483616d.js.map} +1 -1
- package/dist/types/components/c-autocomplete/c-autocomplete.d.ts +1 -1
- package/dist/types/components/c-table/c-table.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/c-autocomplete_16.cjs.entry.js.map +0 -1
- package/dist/cjs/c-checkbox_3.cjs.entry.js.map +0 -1
- package/dist/cjs/c-otp-input.cjs.entry.js +0 -154
- package/dist/cjs/c-otp-input.cjs.entry.js.map +0 -1
- package/dist/cjs/c-radio-group.cjs.entry.js +0 -154
- package/dist/cjs/c-radio-group.cjs.entry.js.map +0 -1
- package/dist/cjs/c-radio.cjs.entry.js +0 -24
- package/dist/cjs/c-radio.cjs.entry.js.map +0 -1
- package/dist/cjs/c-switch.cjs.entry.js +0 -71
- package/dist/cjs/c-switch.cjs.entry.js.map +0 -1
- package/dist/cjs/c-table.cjs.entry.js +0 -47
- package/dist/cjs/c-table.cjs.entry.js.map +0 -1
- package/dist/cjs/c-text-field.cjs.entry.js +0 -151
- package/dist/cjs/c-text-field.cjs.entry.js.map +0 -1
- package/dist/csc-ui/p-494a4f19.entry.js +0 -2
- package/dist/csc-ui/p-494a4f19.entry.js.map +0 -1
- package/dist/csc-ui/p-6e046723.entry.js +0 -2
- package/dist/csc-ui/p-6e046723.entry.js.map +0 -1
- package/dist/csc-ui/p-7ea05669.entry.js +0 -2
- package/dist/csc-ui/p-7ea05669.entry.js.map +0 -1
- package/dist/csc-ui/p-ab62f9b5.entry.js +0 -2
- package/dist/csc-ui/p-b83651f8.entry.js +0 -2
- package/dist/csc-ui/p-b83651f8.entry.js.map +0 -1
- package/dist/csc-ui/p-bda722d5.entry.js +0 -2
- package/dist/csc-ui/p-bda722d5.entry.js.map +0 -1
- package/dist/csc-ui/p-caa58a64.entry.js +0 -2
- package/dist/csc-ui/p-caa58a64.entry.js.map +0 -1
- package/dist/csc-ui/p-d7ca1f65.entry.js +0 -2
- package/dist/csc-ui/p-d7ca1f65.entry.js.map +0 -1
- package/dist/csc-ui/p-ee753bac.entry.js +0 -2
- package/dist/csc-ui/p-ee753bac.entry.js.map +0 -1
- package/dist/esm/c-autocomplete_16.entry.js.map +0 -1
- package/dist/esm/c-checkbox_3.entry.js.map +0 -1
- package/dist/esm/c-otp-input.entry.js +0 -150
- package/dist/esm/c-otp-input.entry.js.map +0 -1
- package/dist/esm/c-radio-group.entry.js +0 -150
- package/dist/esm/c-radio-group.entry.js.map +0 -1
- package/dist/esm/c-radio.entry.js +0 -20
- package/dist/esm/c-radio.entry.js.map +0 -1
- package/dist/esm/c-switch.entry.js +0 -67
- package/dist/esm/c-switch.entry.js.map +0 -1
- package/dist/esm/c-table.entry.js +0 -43
- package/dist/esm/c-table.entry.js.map +0 -1
- package/dist/esm/c-text-field.entry.js +0 -147
- package/dist/esm/c-text-field.entry.js.map +0 -1
- /package/dist/csc-ui/{p-ae16b1f4.entry.js.map → p-1b181fd3.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-1d6c84df.entry.js.map → p-2e28b0cc.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-56b1e1ea.entry.js.map → p-34027974.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-9c80f35e.entry.js.map → p-367d3bd3.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-f24b9d97.js.map → p-667da79a.js.map} +0 -0
- /package/dist/csc-ui/{p-b0fa27b6.entry.js.map → p-6ff81ae0.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-3bb67f38.entry.js.map → p-74a176e6.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-c8a7a751.entry.js.map → p-a8a04dff.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-682782b1.entry.js.map → p-adaace9b.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-468d9583.entry.js.map → p-d074c6db.entry.js.map} +0 -0
- /package/dist/csc-ui/{p-ccef8a49.entry.js.map → p-d22cd2a7.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-47956d53.js';
|
|
2
|
-
import { m as mdiChevronDown, a as mdiClose, b as mdiFullscreenExit, c as mdiFullscreen, d as
|
|
2
|
+
import { m as mdiChevronDown, a as mdiClose, b as mdiFullscreenExit, c as mdiFullscreen, d as mdiCloseCircle, e as mdiAlert, f as mdiEye, g as mdiEyeOff, h as mdiCalendar } from './mdi-e483616d.js';
|
|
3
3
|
import { g as getScrollParent } from './getScrollParent-f876ad1b.js';
|
|
4
4
|
|
|
5
5
|
const cAutocompleteCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host(c-autocomplete){--_c-autocomplete-option-background-color:var(\n --c-autocomplete-option-background-color,\n var(--c-white)\n );--_c-autocomplete-option-background-hover-color:var(\n --c-autocomplete-option-background-hover-color,\n var(--c-primary-100)\n );--_c-autocomplete-active-color:var(\n --c-autocomplete-active-color,\n var(--c-primary-600)\n );--_c-autocomplete-inactive-color:var(\n --c-autocomplete-inactive-color,\n var(--c-tertiary-600)\n );--_c-autocomplete-background-color:var(\n --c-autocomplete-background-color,\n var(--c-transparent)\n );--_c-autocomplete-text-color:var(\n --c-autocomplete-text-color,\n var(--c-text-body)\n );--_c-autocomplete-option-text-color:var(\n --c-autocomplete-option-text-color,\n var(--c-text-body)\n );--_c-autocomplete-placeholder-color:var(\n --c-autocomplete-placeholder-color,\n var(--c-tertiary-500)\n );--c-select-option-background-color:var(\n --_c-autocomplete-option-background-color\n );--c-select-option-background-color-hover:var(\n --_c-autocomplete-option-background-hover-color\n );--c-select-option-text-color:var(--_c-autocomplete-option-text-color);--_c-input-active-color:var(--_c-autocomplete-active-color);--_c-input-inactive-color:var(--_c-autocomplete-inactive-color);--_c-input-background-color:var(--_c-autocomplete-background-color);--_c-input-text-color:var(--_c-autocomplete-text-color);--_c-input-placeholder-color:var(--_c-autocomplete-placeholder-color)}:host{display:block;cursor:text}.c-input-menu__chevron{fill:currentColor;transform:rotate(0deg);transition:transform 0.3s ease-in-out}.c-input-menu__chevron--active{transform:rotate(180deg)}.c-input-menu__input{width:100%;display:flex;justify-items:stretch}.c-input-menu__selection{display:none;pointer-events:none}.c-input-menu__selection--show{align-items:center;display:flex;width:100%;color:var(--_c-select-active-color)}.c-input-menu__item-wrapper{position:absolute;width:100%;top:44px;z-index:10;margin-left:calc(var(--_c-input-label-position) * -1)}.c-input-menu__item-wrapper--shadow{top:47px}.c-input-menu__items{position:absolute;background-color:var(--_c-select-option-background-color);min-width:calc(100% + 24px);box-shadow:0 8px 16px 0 rgba(0, 0, 0, 0.2);z-index:10;user-select:none;border-radius:4px;margin:0 -12px;overflow-y:scroll;list-style:none;padding:0}.c-input-menu__items--hidden{display:none}.c-input-menu__items li{cursor:pointer;display:flex;min-height:48px;padding:0 12px;transition:background-color 0.3s;font-size:14px;align-items:center;justify-content:flex-start;color:var(--_c-select-option-text-color)}.c-input-menu__items li.disabled{background-color:var(--c-tertiary-100);filter:grayscale(1) opacity(0.6);cursor:default}.c-input-menu__items li.disabled:hover{background-color:var(--c-tertiary-100)}.c-input-menu__items li.dense{padding:10px 14px}.c-input-menu__items li:hover{background-color:var(--_c-select-option-background-color-hover)}.c-input-menu__items li[aria-selected=true]{background-color:var(--_c-select-option-background-color-hover);box-shadow:inset 0 0 0 1px var(--_c-select-active-color);border-radius:4px;backface-visibility:hidden;transform:translate3d(0, 0, 0)}.c-input-menu__items li.none{color:rgba(0, 0, 0, 0.5)}.c-input-menu__items--empty li{color:var(--c-text-system);cursor:default;gap:8px;pointer-events:none}.c-input-menu__items--empty li svg{fill:var(--c-warning-600);height:18px;width:18px}input{max-height:32px;padding:8px 0;background-color:transparent;border:none;color:var(--c-text-body);flex:1 1 auto;font-family:var(--c-font-family);font-size:16px;line-height:20px;max-width:100%;min-width:0;width:100%;pointer-events:none}input:focus,input:active{outline:none}input::-ms-reveal{display:none}svg{fill:currentColor;height:22px;width:22px}.c-input--disabled{color:var(--c-tertiary-400)}.c-input:focus-within{color:var(--c-primary-600)}.c-input--error{color:var(--c-error-600)}.c-input--error:focus-within{color:var(--c-error-600)}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}";
|
|
@@ -26,8 +26,7 @@ const CAutocomplete = class {
|
|
|
26
26
|
? { name: selection.name, value: selection.value }
|
|
27
27
|
: selection.value;
|
|
28
28
|
this.changeValue.emit(this.value);
|
|
29
|
-
this.
|
|
30
|
-
this.changeQuery.emit(selection.value);
|
|
29
|
+
this.changeQuery.emit(this.query);
|
|
31
30
|
this.internals.setFormValue(selection.value.toString());
|
|
32
31
|
}
|
|
33
32
|
if (this.optionElements.length && !this.optionElementsExist) {
|
|
@@ -110,7 +109,7 @@ const CAutocomplete = class {
|
|
|
110
109
|
this.changeQuery.emit('');
|
|
111
110
|
this._dropdownElement.updateList();
|
|
112
111
|
}
|
|
113
|
-
|
|
112
|
+
_handleKeyDown(event) {
|
|
114
113
|
const alphanumeric = /^[0-9a-zA-Z ]+$/;
|
|
115
114
|
if (event.key.match(alphanumeric) && event.key.length === 1) {
|
|
116
115
|
if (!this.dropdownVisible) {
|
|
@@ -207,9 +206,9 @@ const CAutocomplete = class {
|
|
|
207
206
|
handleQueryChange() {
|
|
208
207
|
this._updateStatusText();
|
|
209
208
|
}
|
|
210
|
-
_updateInput(
|
|
209
|
+
_updateInput() {
|
|
211
210
|
this._dropdownElement.open();
|
|
212
|
-
this.query =
|
|
211
|
+
this.query = this._inputElement.value;
|
|
213
212
|
this.changeQuery.emit(this.query);
|
|
214
213
|
this._dropdownElement.updateList();
|
|
215
214
|
}
|
|
@@ -228,7 +227,7 @@ const CAutocomplete = class {
|
|
|
228
227
|
}
|
|
229
228
|
_renderInputElement() {
|
|
230
229
|
var _a;
|
|
231
|
-
return (h("div", { class: "c-input-menu__input" }, h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: (
|
|
230
|
+
return (h("div", { class: "c-input-menu__input" }, h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() })));
|
|
232
231
|
}
|
|
233
232
|
componentWillLoad() {
|
|
234
233
|
CAutocomplete._uniqueId += 1;
|
|
@@ -262,7 +261,7 @@ const CAutocomplete = class {
|
|
|
262
261
|
}
|
|
263
262
|
render() {
|
|
264
263
|
const itemType = this.optionElementsExist ? 'option' : 'item';
|
|
265
|
-
return (h(Host, null, h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "autocomplete" }, h("c-input", { slot: "default", ref: (el) => (this._cInputElement = el), active: this.dropdownVisible, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, shadow: this.shadow, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.query, variant: "select" }, h("slot", { name: "pre", slot: "pre" }), h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading && this.value && this._renderReset(), !this.loading && !this.value && this._renderChevron(), h("slot", { onSlotchange: () => this._handleSlotChange() })), h("slot", { name: "post", slot: "post" })))));
|
|
264
|
+
return (h(Host, null, h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "autocomplete", onKeyDown: (event) => this._handleKeyDown(event) }, h("c-input", { slot: "default", ref: (el) => (this._cInputElement = el), active: this.dropdownVisible, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, shadow: this.shadow, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.query, variant: "select" }, h("slot", { name: "pre", slot: "pre" }), h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading && this.value && this._renderReset(), !this.loading && !this.value && this._renderChevron(), h("slot", { onSlotchange: () => this._handleSlotChange() })), h("slot", { name: "post", slot: "post" })))));
|
|
266
265
|
}
|
|
267
266
|
static get formAssociated() { return true; }
|
|
268
267
|
get el() { return getElement(this); }
|
|
@@ -526,6 +525,111 @@ const CCardTitle = class {
|
|
|
526
525
|
};
|
|
527
526
|
CCardTitle.style = cCardTitleCss;
|
|
528
527
|
|
|
528
|
+
const cCheckboxCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host{--_c-checkbox-background-color-hover:var(--c-checkbox-background-color-hover, rgba(var(--c-primary-rgb), 0.1));--_c-checkbox-color-active:var(--c-checkbox-color-active, var(--_c-checkbox-color));--_c-checkbox-color-disabled:var(--c-checkbox-color-disabled, var(--c-tertiary-500));--_c-checkbox-color:var(--c-checkbox-color, var(--c-primary-600));--_c-checkbox-color-error:var(--c-error-600)}.c-checkbox{position:relative;width:fit-content}.c-checkbox__details{line-height:1;padding:0 12px}.c-checkbox__details.active .c-checkbox__message{opacity:1;transform:translateY(0)}.c-checkbox__message{font-size:12px;opacity:0;transform:translateY(-4px);transition:all 0.2s cubic-bezier(0.25, 0.8, 0.5, 1)}.c-checkbox__message--hint{color:var(--c-tertiary-500)}.c-checkbox__message--error{color:var(--_c-checkbox-color-error)}.c-checkbox__message span{align-items:flex-start;color:currentColor;display:flex;gap:4px;height:16px}.c-checkbox__message svg{fill:currentColor;min-height:16px;min-width:16px;position:relative;top:-2px}.c-checkbox__label-content{padding-top:10px;text-align:left;user-select:none}.c-checkbox__label-content span.required{color:var(--c-error-600)}.c-checkbox--disabled{--_c-checkbox-color:var(--_c-checkbox-color-disabled);--c-error-600:var(--_c-checkbox-color);--_c-checkbox-color-active:var(--_c-checkbox-color-disabled);color:var(--_c-checkbox-color);opacity:0.75}.c-checkbox--disabled .c-checkbox__label{cursor:default}.c-checkbox--error{--_c-checkbox-color:var(--c-error-600);--_c-checkbox-color-active:var(--_c-checkbox-color-error);color:var(--_c-checkbox-color-error)}.c-checkbox input:focus{outline:none}.c-checkbox input:focus+.c-checkbox__label .ripple{outline:2px var(--_c-checkbox-color-active) solid}@supports selector(:focus-visible){.c-checkbox input:focus+.c-checkbox__label .ripple{outline:none}}.c-checkbox input:focus-visible+.c-checkbox__label .ripple{outline:2px var(--_c-checkbox-color-active) solid}.c-checkbox:not(.c-checkbox--disabled) .ripple:hover{background-color:var(--_c-checkbox-background-color-hover)}.c-checkbox .visuallyhidden{border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.c-checkbox input:checked+.c-checkbox__label .ripple::before{background:var(--_c-checkbox-color-active);border-color:var(--_c-checkbox-color-active)}.c-checkbox input:checked+.c-checkbox__label .path{stroke:#ffffff;fill:#ffffff;stroke-dashoffset:0;stroke-width:13;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10}.c-checkbox__label{cursor:pointer;display:flex;gap:4px;position:relative;user-select:none}.c-checkbox__label svg{height:14px;left:14px;position:absolute;top:14px;width:14px}.c-checkbox__label--indeterminate .path{stroke-dasharray:0 !important;stroke-dashoffset:0 !important;stroke:transparent}.c-checkbox__label .ripple{border-radius:50%;color:var(--_c-checkbox-color-active);display:grid;height:42px;min-width:42px;overflow:hidden;place-content:center;position:relative;transform:translateZ(0);width:42px}.c-checkbox__label .ripple::before{border-radius:2px;border:2px solid var(--_c-checkbox-color);content:\"\";display:inline-block;height:18px;left:12px;position:absolute;top:12px;transition:all 0.25s ease-out;vertical-align:middle;width:18px}";
|
|
529
|
+
|
|
530
|
+
const CCheckbox = class {
|
|
531
|
+
constructor(hostRef) {
|
|
532
|
+
registerInstance(this, hostRef);
|
|
533
|
+
this.changeValue = createEvent(this, "changeValue", 3);
|
|
534
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
535
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
539
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
540
|
+
}
|
|
541
|
+
this._validationIcon = (h("svg", { height: "16px", width: "16px", viewBox: "0 0 24 24" }, h("path", { d: mdiCloseCircle })));
|
|
542
|
+
this.checked = false;
|
|
543
|
+
this.disabled = false;
|
|
544
|
+
this.hideDetails = false;
|
|
545
|
+
this.hint = '';
|
|
546
|
+
this.indeterminate = false;
|
|
547
|
+
this.label = '';
|
|
548
|
+
this.required = false;
|
|
549
|
+
this.valid = true;
|
|
550
|
+
this.validation = 'Required field';
|
|
551
|
+
this.value = false;
|
|
552
|
+
this.trueValue = true;
|
|
553
|
+
this.falseValue = false;
|
|
554
|
+
this.hostName = undefined;
|
|
555
|
+
this.messageOptions = {
|
|
556
|
+
show: false,
|
|
557
|
+
type: 'hint',
|
|
558
|
+
content: '',
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
onValidationMessageChange(message) {
|
|
562
|
+
this.onValidChange(message.length === 0);
|
|
563
|
+
}
|
|
564
|
+
onValidChange(valid) {
|
|
565
|
+
this._handleValidation(valid || this.valid);
|
|
566
|
+
}
|
|
567
|
+
handleKeyDown(event) {
|
|
568
|
+
if (['Space'].includes(event.code)) {
|
|
569
|
+
event.preventDefault();
|
|
570
|
+
this._toggleState(event);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
componentWillLoad() {
|
|
574
|
+
this.checked = this.checked || this.value === this.trueValue;
|
|
575
|
+
this.internals.setFormValue(this.checked ? this.trueValue.toString() : this.falseValue.toString());
|
|
576
|
+
}
|
|
577
|
+
componentDidLoad() {
|
|
578
|
+
this._handleMessageOptions(this.valid);
|
|
579
|
+
}
|
|
580
|
+
_handleMessageOptions(valid) {
|
|
581
|
+
requestAnimationFrame(() => {
|
|
582
|
+
this.messageOptions = Object.assign(Object.assign({}, this.messageOptions), { type: valid ? 'hint' : 'error', show: true, content: valid ? (h("span", null, this.hint)) : (h("span", null, this._validationIcon, " ", this.validation)) });
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
_handleValidation(valid, timeout = 200) {
|
|
586
|
+
setTimeout(() => {
|
|
587
|
+
this._handleMessageOptions(valid);
|
|
588
|
+
}, timeout);
|
|
589
|
+
}
|
|
590
|
+
_toggleState(event) {
|
|
591
|
+
if (this.disabled)
|
|
592
|
+
return;
|
|
593
|
+
this._rippleElement.createRipple(event, this._container, true);
|
|
594
|
+
this.checked = !this.checked;
|
|
595
|
+
this.changeValue.emit(this.checked ? this.trueValue : this.falseValue);
|
|
596
|
+
this.internals.setFormValue(this.checked ? this.trueValue.toString() : this.falseValue.toString());
|
|
597
|
+
}
|
|
598
|
+
_renderMessages() {
|
|
599
|
+
if (this.hideDetails)
|
|
600
|
+
return;
|
|
601
|
+
const classes = {
|
|
602
|
+
'c-checkbox__details': true,
|
|
603
|
+
active: this.messageOptions.show,
|
|
604
|
+
};
|
|
605
|
+
const messageClasses = {
|
|
606
|
+
'c-checkbox__message': true,
|
|
607
|
+
[`c-checkbox__message--${this.messageOptions.type}`]: true,
|
|
608
|
+
};
|
|
609
|
+
return (h("div", { class: classes }, h("div", { class: messageClasses }, this.messageOptions.content)));
|
|
610
|
+
}
|
|
611
|
+
render() {
|
|
612
|
+
const wrapperClasses = {
|
|
613
|
+
'c-checkbox': true,
|
|
614
|
+
'c-checkbox--disabled': this.disabled,
|
|
615
|
+
'c-checkbox--error': this.messageOptions.type === 'error',
|
|
616
|
+
};
|
|
617
|
+
const labelClasses = {
|
|
618
|
+
'c-checkbox__label': true,
|
|
619
|
+
'c-checkbox__label--indeterminate': this.indeterminate,
|
|
620
|
+
};
|
|
621
|
+
const slotHasContent = !!this.el.childNodes.length;
|
|
622
|
+
return (h(Host, null, h("div", { class: wrapperClasses }, h("input", Object.assign({ class: "visuallyhidden", id: "checkbox" }, (!!this.hostName ? { name: this.hostName } : {}), { type: "checkbox", "aria-checked": this.checked.toString(), "aria-disabled": this.disabled.toString(), checked: this.checked ? true : undefined, disabled: this.disabled, onChange: (event) => this._toggleState(event) })), h("label", { class: labelClasses, htmlFor: "checkbox" }, h("div", { class: "ripple", ref: (el) => (this._container = el) }, h("svg", { viewBox: "0 0 100 100" }, !this.indeterminate && this.checked && (h("path", { class: "path", d: "M 12 52 l 24 24 l 47 -47 l -3 -3 l -44 44 l -21 -21 l -3 3" })), this.indeterminate && (h("path", { class: "path", d: "M20 56 h60 v-8 h-60 z" }))), h("c-ripple", { ref: (el) => (this._rippleElement = el) })), (!!this.label || slotHasContent) && (h("div", { class: "c-checkbox__label-content" }, !!this.label ? this.label : h("slot", null), this.required && h("span", { class: "required" }, "\u00A0*"))))), this._renderMessages()));
|
|
623
|
+
}
|
|
624
|
+
static get formAssociated() { return true; }
|
|
625
|
+
get el() { return getElement(this); }
|
|
626
|
+
static get watchers() { return {
|
|
627
|
+
"validation": ["onValidationMessageChange"],
|
|
628
|
+
"valid": ["onValidChange"]
|
|
629
|
+
}; }
|
|
630
|
+
};
|
|
631
|
+
CCheckbox.style = cCheckboxCss;
|
|
632
|
+
|
|
529
633
|
const cDropdownCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host(c-dropdown){--_c-dropdown-background-color:var(\n --c-dropdown-background-color,\n var(--c-white)\n );--_c-dropdown-background-color-hover:var(\n --c-dropdown-background-color-hover,\n var(--c-primary-200)\n );--_c-dropdown-text-color:var(--c-dropdown-text-color, var(--c-text-body));--_c-dropdown-text-color-active:var(\n --c-dropdown-text-color-active,\n var(--c-primary-600)\n );--_c-dropdown-font-size:14px;--_c-dropdown-height:42px;display:block;position:relative}:host(c-dropdown) mark{background-color:transparent;box-shadow:0 2px 0 0 var(--_c-dropdown-text-color-active);color:inherit}:host(c-dropdown) dialog{border-radius:4px;background-color:transparent;border:none;margin:-4px 0 0;overflow:visible;padding:4px 0 0;position:fixed}:host(c-dropdown) dialog::backdrop{display:none}:host(c-dropdown) dialog[open].mobile{background-color:var(--_c-dropdown-background-color);width:100vw;max-width:100vw;height:100vh;max-height:100svh;inset:0}:host(c-dropdown) dialog[open].mobile .input-top-wrapper{padding:8px}:host(c-dropdown) dialog .input-bottom-wrapper.active{padding-top:8px}:host(c-dropdown) .dummy{display:none}:host(c-dropdown) ul{background-color:var(--_c-dropdown-background-color);box-shadow:2px 4px 10px rgba(0, 0, 0, 0.1607843137);border-radius:4px;list-style:none;margin:0;outline:none;padding:0;pointer-events:auto;visibility:hidden;width:100%;height:max-content;overflow-y:scroll}:host(c-dropdown) ul.active{visibility:visible;animation:0.2s 1 fade-in cubic-bezier(0.25, 0.8, 0.5, 1)}:host(c-dropdown) ul.active.mobile{width:100vw;max-width:100vw;height:100vh;max-height:calc(100svh - 60px)}:host(c-dropdown) li{align-items:center;column-gap:12px;cursor:pointer;display:flex;flex-wrap:nowrap;font-size:var(--_c-dropdown-font-size);min-height:var(--_c-dropdown-height);outline:none;padding-left:10px;padding-right:10px;pointer-events:auto;white-space:nowrap;width:100%;border-radius:4px}:host(c-dropdown) li span,:host(c-dropdown) li c-option-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}:host(c-dropdown) li:hover,:host(c-dropdown) li:focus,:host(c-dropdown) li.active{background:var(--_c-dropdown-background-color-hover);color:var(--_c-dropdown-text-color-active);box-shadow:inset 0 0 0 1px var(--_c-dropdown-text-color-active)}:host(c-dropdown) li:not(.disabled,:hover,:focus)[aria-selected=true]{background:var(--_c-dropdown-background-color-hover);color:var(--_c-dropdown-text-color-active);border-radius:0}:host(c-dropdown) li.disabled{background-color:rgba(var(--c-tertiary-rgb), 0.05);cursor:default;filter:grayscale(1) opacity(0.75)}:host(c-dropdown) .visuallyhidden{border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}@keyframes fade-in{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}";
|
|
530
634
|
|
|
531
635
|
const CDropdown = class {
|
|
@@ -691,7 +795,6 @@ const CDropdown = class {
|
|
|
691
795
|
inputSlot = 'input-bottom';
|
|
692
796
|
this._dialog.style.top = 'auto';
|
|
693
797
|
this._dialog.style.bottom = `${innerHeight - inputSize.top - 44}px`;
|
|
694
|
-
this._inputElement.scrollIntoView();
|
|
695
798
|
}
|
|
696
799
|
}
|
|
697
800
|
this._dummyElement.style.width = `${this._getParentPosition().width}px`;
|
|
@@ -1163,6 +1266,316 @@ const COption = class {
|
|
|
1163
1266
|
};
|
|
1164
1267
|
COption.style = cOptionCss;
|
|
1165
1268
|
|
|
1269
|
+
const cOtpInputCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host{--_c-otp-input-border-color:var(--c-otp-input-border-color, var(--c-tertiary-500));--_c-otp-input-border-color-active:var(--c-otp-input-border-color-active, var(--c-primary-600));--_c-otp-input-height:var(--c-otp-input-height, 56px);--_c-otp-input-width:var(--c-otp-input-width, 42px);--_c-otp-input-font-size:var(--c-otp-input-font-size, 24px);--_c-otp-input-text-color:var(--c-otp-input-text-color, var(--c-text-body));--_c-otp-input-border-width:1px;display:block}:host(.error){--_c-otp-input-border-color:var(--c-error-600);--_c-otp-input-border-color-active:var(--c-error-600)}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.c-otp-input{backface-visibility:hidden;display:inline-grid;gap:8px;grid-auto-columns:minmax(auto, var(--_c-otp-input-width));grid-auto-flow:column;margin-bottom:8px;transform:translate3d(0, 0, 0)}.c-otp-input--hide-details{margin-bottom:0}.c-otp-input input{border-radius:4px;border:none;box-shadow:inset 0 0 0 var(--_c-otp-input-border-width) var(--_c-otp-input-border-color);color:var(--_c-otp-input-text-color);font-size:var(--_c-otp-input-font-size);height:var(--_c-otp-input-height);max-width:var(--_c-otp-input-width);min-width:24px;text-align:center;width:100%}.c-otp-input input:focus{--_c-otp-input-border-width:2px;--_c-otp-input-border-color:var(--_c-otp-input-border-color-active);outline:none}.c-otp-input c-message{grid-column:1/span var(--_c-otp-input-count);grid-row:2}";
|
|
1270
|
+
|
|
1271
|
+
const COtpInput = class {
|
|
1272
|
+
constructor(hostRef) {
|
|
1273
|
+
registerInstance(this, hostRef);
|
|
1274
|
+
this.changeValue = createEvent(this, "changeValue", 3);
|
|
1275
|
+
this.completion = createEvent(this, "completion", 3);
|
|
1276
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
1277
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
1281
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
1282
|
+
}
|
|
1283
|
+
this._backSpacePressed = false;
|
|
1284
|
+
this._debounce = null;
|
|
1285
|
+
this._isPasting = false;
|
|
1286
|
+
this._inputs = new Array(this.length).fill(null);
|
|
1287
|
+
this._value = '';
|
|
1288
|
+
this.hideDetails = false;
|
|
1289
|
+
this.hint = '';
|
|
1290
|
+
this.elementId = undefined;
|
|
1291
|
+
this.length = 6;
|
|
1292
|
+
this.valid = true;
|
|
1293
|
+
this.validation = 'Required field';
|
|
1294
|
+
this.statusText = '';
|
|
1295
|
+
}
|
|
1296
|
+
onValidationMessageChange() {
|
|
1297
|
+
this._updateStatusText();
|
|
1298
|
+
}
|
|
1299
|
+
_emitValue() {
|
|
1300
|
+
requestAnimationFrame(() => {
|
|
1301
|
+
this._value = [...this._inputs].map((input) => input.value).join('');
|
|
1302
|
+
const isFullyFilled = this._value.length === this.length;
|
|
1303
|
+
this.changeValue.emit(isFullyFilled ? this._value : null);
|
|
1304
|
+
if (isFullyFilled) {
|
|
1305
|
+
this.completion.emit(this._value || null);
|
|
1306
|
+
}
|
|
1307
|
+
this.internals.setFormValue(this._value);
|
|
1308
|
+
this._updateStatusText();
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
_getElements(event) {
|
|
1312
|
+
const target = event.target;
|
|
1313
|
+
const nextElement = target.nextElementSibling;
|
|
1314
|
+
const previousElement = target.previousElementSibling;
|
|
1315
|
+
return { target, nextElement, previousElement };
|
|
1316
|
+
}
|
|
1317
|
+
_onFocus(index) {
|
|
1318
|
+
this._inputs[index].select();
|
|
1319
|
+
}
|
|
1320
|
+
_onKeyDown(event) {
|
|
1321
|
+
this._backSpacePressed = false;
|
|
1322
|
+
const { target, previousElement } = this._getElements(event);
|
|
1323
|
+
if (event.key === 'Backspace') {
|
|
1324
|
+
this._backSpacePressed = true;
|
|
1325
|
+
if (previousElement && !target.value) {
|
|
1326
|
+
previousElement.focus();
|
|
1327
|
+
}
|
|
1328
|
+
this._emitValue();
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
get id() {
|
|
1332
|
+
return this.elementId || `c-otp-input--${COtpInput._uniqueId}`;
|
|
1333
|
+
}
|
|
1334
|
+
_onInput(event) {
|
|
1335
|
+
const { target, nextElement, previousElement } = this._getElements(event);
|
|
1336
|
+
if (isNaN(+target.value)) {
|
|
1337
|
+
event.preventDefault();
|
|
1338
|
+
target.value = null;
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
if (this._isPasting) {
|
|
1342
|
+
this._isPasting = false;
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (this._backSpacePressed) {
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
if (event.data) {
|
|
1349
|
+
nextElement === null || nextElement === void 0 ? void 0 : nextElement.focus();
|
|
1350
|
+
}
|
|
1351
|
+
else {
|
|
1352
|
+
previousElement === null || previousElement === void 0 ? void 0 : previousElement.focus();
|
|
1353
|
+
}
|
|
1354
|
+
this._emitValue();
|
|
1355
|
+
}
|
|
1356
|
+
_onPaste(event) {
|
|
1357
|
+
event.preventDefault();
|
|
1358
|
+
const pasteData = event.clipboardData.getData('text');
|
|
1359
|
+
if (isNaN(+pasteData)) {
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
this._isPasting = true;
|
|
1363
|
+
for (const [index, value] of pasteData.split('').entries()) {
|
|
1364
|
+
if (index >= this._inputs.length) {
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
this._inputs[index].value = null;
|
|
1368
|
+
this._inputs[index].value = value;
|
|
1369
|
+
}
|
|
1370
|
+
const nextElementIndex = Math.min(this.length, pasteData.length) - 1;
|
|
1371
|
+
requestAnimationFrame(() => {
|
|
1372
|
+
this._inputs[nextElementIndex].focus();
|
|
1373
|
+
this._emitValue();
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
_updateStatusText() {
|
|
1377
|
+
if (this._debounce !== null) {
|
|
1378
|
+
clearTimeout(this._debounce);
|
|
1379
|
+
this._debounce = null;
|
|
1380
|
+
}
|
|
1381
|
+
this._debounce = window.setTimeout(() => {
|
|
1382
|
+
this.statusText = this.valid ? '' : `Error: ${this.validation} `;
|
|
1383
|
+
this.statusText += `Currently entered - ${this._value
|
|
1384
|
+
.split('')
|
|
1385
|
+
.join(' - ')}`;
|
|
1386
|
+
this.statusText = this.statusText.trim();
|
|
1387
|
+
this._debounce = null;
|
|
1388
|
+
}, 1400);
|
|
1389
|
+
}
|
|
1390
|
+
_renderInput(index) {
|
|
1391
|
+
return (h("input", { id: `${this.id}--input-${index + 1}`, ref: (el) => (this._inputs[index] = el), "aria-label": `Enter code - digit number - ${index + 1} of ${this.length}`, type: "tel", maxlength: "1", onFocus: () => this._onFocus(index), onInput: (event) => this._onInput(event), onKeyDown: (event) => this._onKeyDown(event), onPaste: (event) => index === 0 && this._onPaste(event) }));
|
|
1392
|
+
}
|
|
1393
|
+
componentWillLoad() {
|
|
1394
|
+
COtpInput._uniqueId += 1;
|
|
1395
|
+
this.internals.setFormValue(this._value);
|
|
1396
|
+
}
|
|
1397
|
+
render() {
|
|
1398
|
+
const classes = {
|
|
1399
|
+
'c-otp-input': true,
|
|
1400
|
+
'c-otp-input--hide-details': this.hideDetails,
|
|
1401
|
+
};
|
|
1402
|
+
return (h(Host, { id: this.id, style: { '--_c-otp-input-count': this.length.toString() }, class: { error: !this.valid } }, h("div", { id: 'announce-' + this.id, class: "visuallyhidden", "aria-live": "polite", "aria-atomic": "true" }, this.statusText), h("div", { class: classes }, new Array(this.length)
|
|
1403
|
+
.fill(0)
|
|
1404
|
+
.map((_, index) => this._renderInput(index)), h("c-message", { hint: this.hint, inputId: this.elementId, valid: this.valid, validation: this.validation }))));
|
|
1405
|
+
}
|
|
1406
|
+
static get formAssociated() { return true; }
|
|
1407
|
+
static get watchers() { return {
|
|
1408
|
+
"validation": ["onValidationMessageChange"]
|
|
1409
|
+
}; }
|
|
1410
|
+
};
|
|
1411
|
+
COtpInput._uniqueId = 0;
|
|
1412
|
+
COtpInput.style = cOtpInputCss;
|
|
1413
|
+
|
|
1414
|
+
const cRadioCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host{display:block}";
|
|
1415
|
+
|
|
1416
|
+
const CRadio = class {
|
|
1417
|
+
constructor(hostRef) {
|
|
1418
|
+
registerInstance(this, hostRef);
|
|
1419
|
+
this.checked = false;
|
|
1420
|
+
this.disabled = false;
|
|
1421
|
+
this.value = undefined;
|
|
1422
|
+
}
|
|
1423
|
+
render() {
|
|
1424
|
+
return h(Host, null);
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
CRadio.style = cRadioCss;
|
|
1428
|
+
|
|
1429
|
+
const cRadioGroupCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host{--_c-radio-group-background-color-hover:var(--c-radio-group-background-color-hover, rgba(var(--c-primary-rgb), 0.1));--_c-radio-group-color:var(--c-radio-group-color, var(--c-primary-600));--_c-radio-group-color-active:var(--c-radio-group-color-active, var(--_c-radio-group-color));--_c-radio-group-color-disabled:var(--c-radio-group-color-disabled, var(--c-tertiary-500));display:flex;flex-direction:column;gap:4px;width:fit-content}.c-radio-group{--_c-radio-group-error-color:var(--c-error-600);--_c-radio-flex-direction:column;--_c-radio-item-gap:2px}.c-radio-group__items{display:flex;flex-flow:var(--_c-radio-flex-direction) wrap;gap:var(--_c-radio-item-gap)}.c-radio-group__label span.required{color:var(--_c-radio-group-error-color)}.c-radio-group--disabled{--_c-radio-group-color:var(--_c-radio-group-color-disabled);--_c-radio-group-error-color:var(--_c-radio-group-color-disabled);color:var(--_c-radio-group-color-disabled);cursor:default;opacity:0.75}.c-radio-group--error{--_c-radio-group-color:var(--_c-radio-group-error-color);--_c-radio-group-color-active:var(--_c-radio-group-error-color);color:var(--_c-radio-group-error-color)}.c-radio-group--inline{--_c-radio-flex-direction:row;--_c-radio-item-gap:12px}.c-radio{align-items:flex-start;display:flex;position:relative;cursor:pointer;font-size:16px;user-select:none;gap:4px;line-height:1.2}.c-radio input{position:absolute;opacity:0;cursor:pointer;height:0;width:0}.c-radio input:checked~.ripple .selection::after{display:block;transform:scale(1)}.c-radio .ripple{position:relative;height:42px;width:42px;min-width:42px;border-radius:50%;overflow:hidden;transition:translateZ(0);color:var(--_c-radio-group-color)}.c-radio .selection{position:absolute;top:11px;left:11px;height:20px;width:20px;background-color:transparent;box-shadow:inset 0 0 0 2px var(--_c-radio-group-color);border-radius:50%;transition:box-shadow 0.15s ease-in-out}.c-radio .selection::after{content:\"\";position:absolute;transform:scale(0);transition:transform 0.15s ease-in-out;top:5px;left:5px;width:10px;height:10px;border-radius:50%;background:var(--_c-radio-group-color-active)}.c-radio__details{line-height:1;padding:0 12px}.c-radio__details.active .c-radio__message{opacity:1;transform:translateY(0)}.c-radio__message{font-size:12px;opacity:0;transform:translateY(-4px);transition:all 0.2s cubic-bezier(0.25, 0.8, 0.5, 1)}.c-radio__message--hint{color:var(--c-tertiary-500)}.c-radio__message--error{color:var(--_c-radio-group-error-color) !important}.c-radio__message span{align-items:flex-start;display:flex;gap:4px;height:16px}.c-radio__message span.error{color:var(--_c-radio-group-error-color)}.c-radio__message span.hint{color:var(--c-tertiary-500)}.c-radio__message svg{fill:currentColor;min-height:16px;min-width:16px;position:relative;top:-2px}.c-radio__label{padding-top:12px}.c-radio--disabled{--_c-radio-group-color:var(--_c-radio-group-color-disabled);--_c-radio-group-color-active:var(--_c-radio-group-color-disabled);color:var(--_c-radio-group-color);cursor:default;opacity:0.75}.c-radio--error{--_c-radio-group-color:var(--_c-radio-group-error-color);color:var(--_c-radio-group-error-color)}.c-radio--error span,.c-radio--error svg{fill:var(--_c-radio-group-error-color);color:var(--_c-radio-group-error-color)}.c-radio input:focus{outline:none}.c-radio input:focus+.ripple{outline:2px var(--_c-radio-group-color-active) solid}@supports selector(:focus-visible){.c-radio input:focus+.ripple{outline:none}}.c-radio input:focus-visible+.ripple{outline:2px var(--_c-radio-group-color) solid}.c-radio:not(.c-radio--disabled) .ripple:hover{background-color:var(--_c-radio-group-background-color-hover)}";
|
|
1430
|
+
|
|
1431
|
+
const CRadioGroup = class {
|
|
1432
|
+
constructor(hostRef) {
|
|
1433
|
+
registerInstance(this, hostRef);
|
|
1434
|
+
this.changeValue = createEvent(this, "changeValue", 3);
|
|
1435
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
1436
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
1437
|
+
}
|
|
1438
|
+
else {
|
|
1439
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
1440
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
1441
|
+
}
|
|
1442
|
+
this._containers = [];
|
|
1443
|
+
this._rippleElements = [];
|
|
1444
|
+
this._handleSlotChange = () => {
|
|
1445
|
+
this._getRadioButtons();
|
|
1446
|
+
};
|
|
1447
|
+
this._getRadioButtons = () => {
|
|
1448
|
+
const radios = this.el.querySelectorAll('c-radio');
|
|
1449
|
+
if (radios.length) {
|
|
1450
|
+
this.returnObject = false;
|
|
1451
|
+
this.items = [
|
|
1452
|
+
...Array.from(radios).map((radio) => {
|
|
1453
|
+
if (!!radio.checked) {
|
|
1454
|
+
this.value = radio.value;
|
|
1455
|
+
this.changeValue.emit(this.value);
|
|
1456
|
+
}
|
|
1457
|
+
radio.style.display = 'none';
|
|
1458
|
+
return {
|
|
1459
|
+
name: radio.textContent,
|
|
1460
|
+
value: radio.value,
|
|
1461
|
+
disabled: !!radio.disabled,
|
|
1462
|
+
};
|
|
1463
|
+
}),
|
|
1464
|
+
];
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
this._getRadioButton = (item, index) => {
|
|
1468
|
+
var _a, _b, _c;
|
|
1469
|
+
const itemId = item.value.toString().replace(/[^a-zA-Z0-9-_]/g, '');
|
|
1470
|
+
const isChecked = !this.returnObject
|
|
1471
|
+
? ((_b = (_a = this.items) === null || _a === void 0 ? void 0 : _a.find((i) => i.value === item.value)) === null || _b === void 0 ? void 0 : _b.value) === this.value
|
|
1472
|
+
: ((_c = this.value) === null || _c === void 0 ? void 0 : _c.value) === item.value;
|
|
1473
|
+
const classes = {
|
|
1474
|
+
'c-radio': true,
|
|
1475
|
+
'c-radio--disabled': !!item.disabled || this.disabled,
|
|
1476
|
+
'c-radio--error': this.messageOptions.type === 'error',
|
|
1477
|
+
};
|
|
1478
|
+
return (h("label", { class: classes, id: itemId, onKeyDown: (event) => this._handleKeyDown(event, item, index) }, h("input", { type: "radio", "aria-checked": (this.value === item).toString(), "aria-disabled": (!!item.disabled || this.disabled).toString(), "aria-labelledby": itemId, disabled: !!item.disabled || this.disabled, checked: isChecked, name: CRadioGroup._uniqueId.toString(), onChange: (event) => this._select(event, item, index) }), h("span", { class: "ripple", ref: (el) => (this._containers[index] = el) }, h("span", { class: "selection" }), h("c-ripple", { ref: (el) => (this._rippleElements[index] = el) })), h("div", { class: "c-radio__label" }, item.name)));
|
|
1479
|
+
};
|
|
1480
|
+
this._validationIcon = (h("svg", { height: "16px", width: "16px", viewBox: "0 0 24 24" }, h("path", { d: mdiCloseCircle })));
|
|
1481
|
+
this.value = undefined;
|
|
1482
|
+
this.hideDetails = false;
|
|
1483
|
+
this.hint = '';
|
|
1484
|
+
this.inline = false;
|
|
1485
|
+
this.label = undefined;
|
|
1486
|
+
this.color = '';
|
|
1487
|
+
this.items = [];
|
|
1488
|
+
this.disabled = false;
|
|
1489
|
+
this.returnObject = false;
|
|
1490
|
+
this.required = false;
|
|
1491
|
+
this.valid = true;
|
|
1492
|
+
this.validation = 'Required field';
|
|
1493
|
+
this.messageOptions = {
|
|
1494
|
+
show: true,
|
|
1495
|
+
type: 'hint',
|
|
1496
|
+
content: '',
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
onValidationMessageChange(message) {
|
|
1500
|
+
this.onValidChange(message.length === 0);
|
|
1501
|
+
}
|
|
1502
|
+
onValidChange(valid) {
|
|
1503
|
+
this._handleValidation(valid || this.valid);
|
|
1504
|
+
}
|
|
1505
|
+
componentDidLoad() {
|
|
1506
|
+
this._handleValidation(this.valid, 0);
|
|
1507
|
+
}
|
|
1508
|
+
_handleKeyDown(event, item, index) {
|
|
1509
|
+
if (['Space', 'Enter'].includes(event.code)) {
|
|
1510
|
+
event.preventDefault();
|
|
1511
|
+
this._select(event, item, index);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
_handleValidation(valid, timeout = 200) {
|
|
1515
|
+
this.messageOptions = Object.assign(Object.assign({}, this.messageOptions), { show: false });
|
|
1516
|
+
setTimeout(() => {
|
|
1517
|
+
this.messageOptions = Object.assign(Object.assign({}, this.messageOptions), { type: valid ? 'hint' : 'error', show: true, content: valid ? (h("span", null, this.hint)) : (h("span", null, this._validationIcon, " ", this.validation)) });
|
|
1518
|
+
}, timeout);
|
|
1519
|
+
}
|
|
1520
|
+
_select(event, item, index) {
|
|
1521
|
+
if (!!item.disabled || this.disabled)
|
|
1522
|
+
return;
|
|
1523
|
+
this._rippleElements[index].createRipple(event, this._containers[index], true);
|
|
1524
|
+
this.value = !this.returnObject ? item === null || item === void 0 ? void 0 : item.value : item;
|
|
1525
|
+
this.changeValue.emit(this.value);
|
|
1526
|
+
const value = !this.returnObject
|
|
1527
|
+
? this.value
|
|
1528
|
+
: this.value.value;
|
|
1529
|
+
this.internals.setFormValue(value);
|
|
1530
|
+
}
|
|
1531
|
+
_renderMessages() {
|
|
1532
|
+
if (this.hideDetails)
|
|
1533
|
+
return;
|
|
1534
|
+
const classes = {
|
|
1535
|
+
'c-radio__details': true,
|
|
1536
|
+
active: this.messageOptions.show,
|
|
1537
|
+
};
|
|
1538
|
+
const messageClasses = {
|
|
1539
|
+
'c-radio__message': true,
|
|
1540
|
+
[`c-radio__message--${this.messageOptions.type}`]: true,
|
|
1541
|
+
};
|
|
1542
|
+
return (h("div", { class: classes }, h("div", { class: messageClasses }, this.messageOptions.content)));
|
|
1543
|
+
}
|
|
1544
|
+
componentWillLoad() {
|
|
1545
|
+
CRadioGroup._uniqueId += 1;
|
|
1546
|
+
const radios = this.el.querySelectorAll('c-radio');
|
|
1547
|
+
const checkedRadio = Array.from(radios).find((item) => item.checked);
|
|
1548
|
+
if (checkedRadio) {
|
|
1549
|
+
const value = checkedRadio.value;
|
|
1550
|
+
this.internals.setFormValue(value);
|
|
1551
|
+
}
|
|
1552
|
+
else if (this.value) {
|
|
1553
|
+
const value = !this.returnObject
|
|
1554
|
+
? this.value
|
|
1555
|
+
: this.value.value;
|
|
1556
|
+
this.internals.setFormValue(value);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
render() {
|
|
1560
|
+
const slotHasContent = !!this.el.childNodes.length;
|
|
1561
|
+
const wrapperClasses = {
|
|
1562
|
+
'c-radio-group': true,
|
|
1563
|
+
'c-radio-group--disabled': this.disabled,
|
|
1564
|
+
'c-radio-group--inline': this.inline,
|
|
1565
|
+
'c-radio-group--error': this.messageOptions.type === 'error',
|
|
1566
|
+
};
|
|
1567
|
+
return (h("div", { class: wrapperClasses, role: "radiogroup", "aria-labelledby": "c-radio-group__label" }, (!!this.label || slotHasContent) && (h("label", { class: "c-radio-group__label" }, !!this.label && this.label, h("slot", { onSlotchange: this._handleSlotChange }), this.required && h("span", { class: "required" }, "\u00A0*"))), h("div", { class: "c-radio-group__items" }, this.items.map((item, index) => this._getRadioButton(item, index))), this._renderMessages()));
|
|
1568
|
+
}
|
|
1569
|
+
static get formAssociated() { return true; }
|
|
1570
|
+
get el() { return getElement(this); }
|
|
1571
|
+
static get watchers() { return {
|
|
1572
|
+
"validation": ["onValidationMessageChange"],
|
|
1573
|
+
"valid": ["onValidChange"]
|
|
1574
|
+
}; }
|
|
1575
|
+
};
|
|
1576
|
+
CRadioGroup._uniqueId = 0;
|
|
1577
|
+
CRadioGroup.style = cRadioGroupCss;
|
|
1578
|
+
|
|
1166
1579
|
const cRippleCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host{pointer-events:none;user-select:none;display:block;overflow:hidden;position:absolute;top:0;left:0;border-radius:inherit;z-index:1}.c-ripple{position:absolute;pointer-events:none;border-radius:50%;transform:scale(0);background:currentColor;opacity:0}.c-ripple.animate{animation:ripple 0.5s backwards linear;opacity:0.3}@keyframes ripple{100%{opacity:0;transform:scale(5)}}";
|
|
1167
1580
|
|
|
1168
1581
|
const CRipple = class {
|
|
@@ -1541,6 +1954,242 @@ const CSpinner = class {
|
|
|
1541
1954
|
};
|
|
1542
1955
|
CSpinner.style = cSpinnerCss;
|
|
1543
1956
|
|
|
1544
|
-
|
|
1957
|
+
const cSwitchCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host(c-switch){--_c-switch-border-color:var(--c-switch-border-color, var(--c-tertiary-600));--_c-switch-handle-color:var(--c-switch-handle-color, var(--c-tertiary-600));--_c-switch-slider-color:var(--c-switch-slider-color, var(--c-transparent));--_c-switch-border-color-disabled:var(--c-switch-border-color-disabled, var(--c-transparent));--_c-switch-handle-color-disabled:var(--c-switch-handle-color-disabled, var(--c-tertiary-500));--_c-switch-slider-color-disabled:var(--c-switch-slider-color-disabled, var(--c-tertiary-200));--_c-switch-border-color-active:var(--c-switch-border-color-active, var(--c-primary-600));--_c-switch-handle-color-active:var(--c-switch-handle-color-active, var(--c-white));--_c-switch-slider-color-active:var(--c-switch-slider-color-active, var(--c-primary-600));--_c-switch-border-color-active-disabled:var(--c-switch-border-color-active-disabled, var(--c-tertiary-400));--_c-switch-handle-color-active-disabled:var(--c-switch-handle-color-active-disabled, var(--c-white));--_c-switch-slider-color-active-disabled:var(--c-switch-slider-color-active-disabled, var(--c-tertiary-400));display:inline-block}.c-switch{--_c-switch-handle-margin:5px;--_c-switch-pointer:pointer;--_c-switch-height:22px;--_c-switch-width:44px;--_c-switch-handle-size:calc(var(--_c-switch-height) - 2 * var(--_c-switch-handle-margin));--_c-switch-handle-position-active:calc(\n var(--_c-switch-width) - var(--_c-switch-handle-size) - 2 * var(--_c-switch-handle-margin)\n );backface-visibility:hidden;transform:translate3d(0, 0, 0);display:inline-grid;height:var(--_c-switch-height);position:relative;grid-template-columns:1fr;gap:12px;align-items:center}.c-switch--disabled{--_c-switch-pointer:default;--_c-switch-handle-color:var(--_c-switch-handle-color-disabled);--_c-switch-slider-color:var(--_c-switch-slider-color-disabled);--_c-switch-border-color:var(--_c-switch-border-color-disabled);--c-error-600:var(--c-tertiary-400);color:var(--c-tertiary-500)}.c-switch--label{grid-template-columns:var(--_c-switch-width) auto}.c-switch__label span.required{color:var(--c-error-600)}.c-switch__input{height:var(--_c-switch-height);position:relative;width:var(--_c-switch-width);align-self:start}.c-switch__slider{background-color:var(--_c-switch-slider-color);border-radius:var(--_c-switch-height);box-shadow:inset 0 0 0 2px var(--_c-switch-border-color);inset:0;cursor:var(--_c-switch-pointer);position:absolute;transform-origin:50% 50%;transition:0.3s cubic-bezier(0.25, 0.8, 0.5, 1)}.c-switch__slider::before{background-color:var(--_c-switch-handle-color);border-radius:50%;bottom:var(--_c-switch-handle-margin);content:\"\";height:var(--_c-switch-handle-size);left:var(--_c-switch-handle-margin);position:absolute;transition:0.3s cubic-bezier(0.25, 0.8, 0.5, 1);width:var(--_c-switch-handle-size)}.c-switch input{height:0;opacity:0;width:0}.c-switch input:checked+.c-switch__slider{--_c-switch-handle-color:var(--_c-switch-handle-color-active);--_c-switch-slider-color:var(--_c-switch-slider-color-active);--_c-switch-border-color:var(--_c-switch-border-color-active)}.c-switch input:checked+.c-switch__slider::before{transform:translateX(var(--_c-switch-handle-position-active))}.c-switch input:checked+.c-switch__slider--disabled{--_c-switch-handle-color:var(--_c-switch-handle-color-active-disabled);--_c-switch-slider-color:var(--_c-switch-slider-color-active-disabled);--_c-switch-border-color:var(--_c-switch-border-color-active-disabled)}.c-switch input:focus+.c-switch__slider{outline:none}.c-switch input:focus-visible+.c-switch__slider{outline:2px var(--c-primary-600) solid;outline-offset:2px}";
|
|
1958
|
+
|
|
1959
|
+
const CSwitch = class {
|
|
1960
|
+
constructor(hostRef) {
|
|
1961
|
+
registerInstance(this, hostRef);
|
|
1962
|
+
this.changeValue = createEvent(this, "changeValue", 3);
|
|
1963
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
1964
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
1965
|
+
}
|
|
1966
|
+
else {
|
|
1967
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
1968
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
1969
|
+
}
|
|
1970
|
+
this._toggleState = () => {
|
|
1971
|
+
if (this.hostDisabled)
|
|
1972
|
+
return;
|
|
1973
|
+
this.checked = !this.checked;
|
|
1974
|
+
this.changeValue.emit(this.checked ? this.trueValue : this.falseValue);
|
|
1975
|
+
this.internals.setFormValue(this.checked ? this.trueValue.toString() : this.falseValue.toString());
|
|
1976
|
+
};
|
|
1977
|
+
this.checked = false;
|
|
1978
|
+
this.value = false;
|
|
1979
|
+
this.trueValue = true;
|
|
1980
|
+
this.falseValue = false;
|
|
1981
|
+
this.hostDisabled = false;
|
|
1982
|
+
this.hostId = undefined;
|
|
1983
|
+
this.required = false;
|
|
1984
|
+
this.hasLabel = false;
|
|
1985
|
+
}
|
|
1986
|
+
componentWillLoad() {
|
|
1987
|
+
this.checked = this.checked || this.value === this.trueValue;
|
|
1988
|
+
this.internals.setFormValue(this.checked ? this.trueValue.toString() : this.falseValue.toString());
|
|
1989
|
+
}
|
|
1990
|
+
componentDidLoad() {
|
|
1991
|
+
const slotted = this.host.childNodes;
|
|
1992
|
+
this.hasLabel = slotted && slotted.length > 0;
|
|
1993
|
+
}
|
|
1994
|
+
render() {
|
|
1995
|
+
const classes = {
|
|
1996
|
+
'c-switch': true,
|
|
1997
|
+
'c-switch--disabled': !!this.hostDisabled,
|
|
1998
|
+
'c-switch--label': this.hasLabel,
|
|
1999
|
+
};
|
|
2000
|
+
const sliderClasses = {
|
|
2001
|
+
'c-switch__slider': true,
|
|
2002
|
+
'c-switch__slider--disabled': !!this.hostDisabled,
|
|
2003
|
+
};
|
|
2004
|
+
return (h("label", { class: classes, htmlFor: this.hostId }, h("div", { class: "c-switch__input" }, h("input", { id: this.hostId, "aria-checked": this.checked.toString(), type: "checkbox", role: "switch", disabled: this.hostDisabled, checked: this.checked ? true : undefined, onChange: () => this._toggleState() }), h("span", { class: sliderClasses })), this.hasLabel ? (h("div", { class: "c-switch__label" }, h("slot", null), this.required && h("span", { class: "required" }, "\u00A0*"))) : null));
|
|
2005
|
+
}
|
|
2006
|
+
static get formAssociated() { return true; }
|
|
2007
|
+
get host() { return getElement(this); }
|
|
2008
|
+
};
|
|
2009
|
+
CSwitch.style = cSwitchCss;
|
|
2010
|
+
|
|
2011
|
+
const cTableCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:host,:root{--_c-table-border-color:var(--c-table-border-color, var(--c-tertiary-200));--_c-table-header-text-color:var(--c-table-header-text-color, var(--c-text-system));--_c-table-row-background-color-mobile:var(--c-table-row-background-color-mobile, rgba(var(--c-primary-rgb), 0.05))}table.c-table{border-collapse:collapse;border-spacing:0;border:0;font-size:100%;font-family:var(--c-font-family);margin:0;padding:0;width:100%}table.c-table slot{display:table}table.c-table caption,table.c-table tbody,table.c-table tfoot,table.c-table thead,table.c-table tr,table.c-table th,table.c-table td{border:0;font-size:100%;font-family:var(--c-font-family);margin:0;padding:0}table.c-table thead{background-color:var(--c-white);position:relative}table.c-table thead th{border-bottom:2px solid var(--_c-table-border-color);text-align:left}table.c-table tbody{box-shadow:inset 1px 0 0 0 var(--_c-table-border-color), inset -1px 0 0 0 var(--_c-table-border-color), inset 0 1px 0 0 var(--_c-table-border-color), inset 0 -1px 0 0 var(--_c-table-border-color);}@supports (-webkit-hyphens: none){table.c-table tbody{border:1px solid var(--_c-table-border-color)}table.c-table tbody tr{border-bottom:1px solid var(--_c-table-border-color)}}table.c-table tbody tr{box-shadow:inset 0 1px 0 0 var(--_c-table-border-color)}table.c-table tfoot{background-color:var(--c-white)}table.c-table tfoot tr{box-shadow:inset 0 1px 0 0 var(--_c-table-border-color)}table.c-table tfoot td{min-height:48px}table.c-table tfoot td c-pagination{flex:1}table.c-table th,table.c-table td{font-weight:400;box-sizing:border-box;line-height:normal;padding:16px}table.c-table th{height:48px;font-size:14px;color:var(--_c-table-header-text-color)}table.c-table td{font-size:16px;color:var(--c-text-body)}table.c-table--mobile{border-spacing:0 16px;border-collapse:separate}table.c-table--mobile tbody{box-shadow:none}table.c-table--mobile tbody tr{border-radius:4px;box-shadow:inset 0 0 0 1px var(--_c-table-border-color)}@supports (-webkit-hyphens: none){table.c-table--mobile tbody tr{display:grid;margin-bottom:16px;border:none}}table.c-table--mobile thead{display:none}table.c-table--mobile td{display:grid;gap:4px;padding:12px;min-height:62px}table.c-table--mobile td::before{font-size:14px;color:var(--_c-table-header-text-color);content:attr(data-title);display:inline-block;text-align:start;padding-right:8px}table.c-table--mobile td:nth-of-type(even){background-color:var(--_c-table-row-background-color-mobile)}";
|
|
2012
|
+
|
|
2013
|
+
const CTable = class {
|
|
2014
|
+
constructor(hostRef) {
|
|
2015
|
+
registerInstance(this, hostRef);
|
|
2016
|
+
this.mobileBreakpoint = 600;
|
|
2017
|
+
this.responsive = false;
|
|
2018
|
+
}
|
|
2019
|
+
get cells() {
|
|
2020
|
+
return Array.from(this._tableElement.querySelectorAll('td'));
|
|
2021
|
+
}
|
|
2022
|
+
get headers() {
|
|
2023
|
+
return Array.from(this._tableElement.querySelectorAll('th')).map((th) => th.innerHTML);
|
|
2024
|
+
}
|
|
2025
|
+
_handleResize(width) {
|
|
2026
|
+
const isMobile = width <= this.mobileBreakpoint;
|
|
2027
|
+
this._tableElement.classList.toggle('c-table--mobile', isMobile);
|
|
2028
|
+
}
|
|
2029
|
+
componentWillLoad() {
|
|
2030
|
+
this._tableElement = this.el.querySelector('table');
|
|
2031
|
+
this._tableElement.classList.add('c-table');
|
|
2032
|
+
this._observer = new ResizeObserver(([entry]) => {
|
|
2033
|
+
const { width } = entry.contentRect;
|
|
2034
|
+
this._handleResize(width);
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
componentDidLoad() {
|
|
2038
|
+
if (this.responsive) {
|
|
2039
|
+
this._observer.observe(this._tableElement);
|
|
2040
|
+
}
|
|
2041
|
+
this.cells.forEach((cell, index) => {
|
|
2042
|
+
cell.dataset.title = this.headers[+index % this.headers.length];
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
render() {
|
|
2046
|
+
return (h(Host, null, h("slot", null)));
|
|
2047
|
+
}
|
|
2048
|
+
get el() { return getElement(this); }
|
|
2049
|
+
};
|
|
2050
|
+
CTable.style = cTableCss;
|
|
2051
|
+
|
|
2052
|
+
const cTextFieldCss = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;-webkit-tap-highlight-color:transparent}:host{font-family:var(--c-font-family)}::-ms-reveal{display:none}:root,:host{--_c-text-field-active-color:var(--c-text-field-active-color, var(--c-primary-600));--_c-text-field-inactive-color:var(--c-text-field-inactive-color, var(--c-tertiary-600));--_c-text-field-background-color:var(--c-text-field-background-color, var(--c-transparent));--_c-text-field-text-color:var(--c-text-field-text-color, var(--c-text-body));--_c-text-field-placeholder-color:var(--c-text-field-placeholder-color, var(--c-tertiary-500));--_c-text-field-shadow-active-color:var(--c-text-field-shadow-active-color, var(--_c-text-field-active-color));--_c-text-field-shadow-background-color:var(--c-text-field-shadow-background-color, var(--c-white));--_c-text-field-shadow-text-color:var(--c-text-field-shadow-text-color, var(--_c-text-field-text-color));--_c-text-field-shadow-placeholder-color:var(--c-text-field-shadow-placeholder-color, var(--_c-text-field-placeholder-color))}.c-input{--_c-input-active-color:var(--_c-text-field-active-color);--_c-input-inactive-color:var(--_c-text-field-inactive-color);--_c-input-background-color:var(--_c-text-field-background-color);--_c-input-text-color:var(--_c-text-field-text-color);--_c-input-placeholder-color:var(--_c-text-field-placeholder-color);--_c-input-shadow-active-color:var(--_c-text-field-shadow-active-color);--_c-input-shadow-background-color:var(--_c-text-field-shadow-background-color);--_c-input-shadow-text-color:var(--_c-text-field-shadow-text-color);--_c-input-shadow-placeholder-color:var(--_c-text-field-shadow-placeholder-color)}.c-input__password-toggle,.c-input__date-toggle{cursor:pointer;fill:currentColor;height:22px;width:22px}.c-input__password-toggle--disabled,.c-input__date-toggle--disabled{cursor:not-allowed;fill:var(--c-tertiary-500)}.c-input input[type=date]{opacity:0}.c-input input[type=date]::-webkit-calendar-picker-indicator,.c-input input[type=date]::-webkit-inner-spin-button{display:none;appearance:none}.c-input input[type=date]:focus,.c-input input[type=date].c-input__input--filled{opacity:1}";
|
|
2053
|
+
|
|
2054
|
+
const CTextField = class {
|
|
2055
|
+
constructor(hostRef) {
|
|
2056
|
+
registerInstance(this, hostRef);
|
|
2057
|
+
this.changeValue = createEvent(this, "changeValue", 3);
|
|
2058
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
2059
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
2060
|
+
}
|
|
2061
|
+
else {
|
|
2062
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
2063
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
2064
|
+
}
|
|
2065
|
+
this._originalType = '';
|
|
2066
|
+
this._handleChange = (event) => {
|
|
2067
|
+
this.value = this.trimWhitespace
|
|
2068
|
+
? event.target.value.trim()
|
|
2069
|
+
: event.target.value;
|
|
2070
|
+
this.changeValue.emit(this.value);
|
|
2071
|
+
this.internals.setFormValue(this.value);
|
|
2072
|
+
};
|
|
2073
|
+
this._handleBlur = (event) => {
|
|
2074
|
+
if (this.trimWhitespace) {
|
|
2075
|
+
const trimmedValue = event.target.value.trim();
|
|
2076
|
+
event.target.value = trimmedValue;
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2079
|
+
this._togglePasswordVisibility = () => {
|
|
2080
|
+
if (this.disabled)
|
|
2081
|
+
return;
|
|
2082
|
+
this.type = this.type === 'password' ? 'text' : 'password';
|
|
2083
|
+
};
|
|
2084
|
+
this.autofocus = false;
|
|
2085
|
+
this.autocapitalize = '';
|
|
2086
|
+
this.autocorrect = '';
|
|
2087
|
+
this.autocomplete = '';
|
|
2088
|
+
this.disabled = false;
|
|
2089
|
+
this.hideDetails = false;
|
|
2090
|
+
this.hint = '';
|
|
2091
|
+
this.hostId = undefined;
|
|
2092
|
+
this.trimWhitespace = false;
|
|
2093
|
+
this.label = undefined;
|
|
2094
|
+
this.max = null;
|
|
2095
|
+
this.min = null;
|
|
2096
|
+
this.name = undefined;
|
|
2097
|
+
this.number = false;
|
|
2098
|
+
this.placeholder = undefined;
|
|
2099
|
+
this.readonly = false;
|
|
2100
|
+
this.required = false;
|
|
2101
|
+
this.rows = 1;
|
|
2102
|
+
this.shadow = false;
|
|
2103
|
+
this.step = null;
|
|
2104
|
+
this.type = undefined;
|
|
2105
|
+
this.valid = true;
|
|
2106
|
+
this.validate = false;
|
|
2107
|
+
this.validateOnBlur = false;
|
|
2108
|
+
this.validation = 'Required field';
|
|
2109
|
+
this.value = undefined;
|
|
2110
|
+
this.isFocused = false;
|
|
2111
|
+
this.labelWidth = 0;
|
|
2112
|
+
this.preSlotWidth = 0;
|
|
2113
|
+
this.messageOptions = {
|
|
2114
|
+
show: true,
|
|
2115
|
+
type: 'hint',
|
|
2116
|
+
content: '',
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
componentWillLoad() {
|
|
2120
|
+
CTextField._uniqueId += 1;
|
|
2121
|
+
this._originalType = this.type;
|
|
2122
|
+
this._inputId = `${(this.hostId ||
|
|
2123
|
+
this.label ||
|
|
2124
|
+
this.placeholder ||
|
|
2125
|
+
'').replace(/[^a-zA-Z0-9-_]/g, '')}_${CTextField._uniqueId}`;
|
|
2126
|
+
this.internals.setFormValue(this.value);
|
|
2127
|
+
}
|
|
2128
|
+
get isActive() {
|
|
2129
|
+
return !!this.value || this.isFocused;
|
|
2130
|
+
}
|
|
2131
|
+
get passwordIcon() {
|
|
2132
|
+
return this.type === 'password' ? mdiEye : mdiEyeOff;
|
|
2133
|
+
}
|
|
2134
|
+
_renderInputElement() {
|
|
2135
|
+
const props = {
|
|
2136
|
+
classes: {
|
|
2137
|
+
'c-input__input': true,
|
|
2138
|
+
'c-input__input--filled': !!this.value,
|
|
2139
|
+
},
|
|
2140
|
+
shared: {
|
|
2141
|
+
id: this._inputId,
|
|
2142
|
+
name: this.name,
|
|
2143
|
+
disabled: this.disabled,
|
|
2144
|
+
readonly: this.readonly,
|
|
2145
|
+
value: this.value,
|
|
2146
|
+
onInput: this._handleChange,
|
|
2147
|
+
onChange: this._handleChange,
|
|
2148
|
+
onBlur: this._handleBlur,
|
|
2149
|
+
},
|
|
2150
|
+
input: Object.assign(Object.assign(Object.assign({ type: this.number ? 'number' : this.type || 'text', min: this.min, max: this.max, step: this.step }, (!!this.autocomplete && { autocomplete: this.autocomplete })), (!!this.autocapitalize && { autocapitalize: this.autocapitalize })), (!!this.autocorrect && { autocorrect: this.autocorrect })),
|
|
2151
|
+
textArea: {
|
|
2152
|
+
rows: this.rows,
|
|
2153
|
+
},
|
|
2154
|
+
};
|
|
2155
|
+
const textInput = (h("input", Object.assign({ class: props.classes }, props.input, props.shared, { ref: (el) => (this._inputElement = el) })));
|
|
2156
|
+
const textArea = (h("textarea", Object.assign({ class: props.classes }, props.shared, props.textArea)));
|
|
2157
|
+
return this.rows > 1 ? textArea : textInput;
|
|
2158
|
+
}
|
|
2159
|
+
_isFirefox() {
|
|
2160
|
+
return !!navigator.userAgent.match(/firefox|fxios/i);
|
|
2161
|
+
}
|
|
2162
|
+
_renderDateToggle() {
|
|
2163
|
+
if (this._originalType !== 'date' || this._isFirefox())
|
|
2164
|
+
return;
|
|
2165
|
+
const classes = {
|
|
2166
|
+
'c-input__date-toggle': true,
|
|
2167
|
+
'c-input__date-toggle--disabled': this.disabled,
|
|
2168
|
+
};
|
|
2169
|
+
return (h("svg", { class: classes, viewBox: "0 0 24 24", onClick: this._toggleDatepicker.bind(this) }, h("path", { d: mdiCalendar })));
|
|
2170
|
+
}
|
|
2171
|
+
_toggleDatepicker() {
|
|
2172
|
+
var _a;
|
|
2173
|
+
(_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.showPicker();
|
|
2174
|
+
}
|
|
2175
|
+
_renderPasswordToggle() {
|
|
2176
|
+
if (this._originalType !== 'password')
|
|
2177
|
+
return;
|
|
2178
|
+
const classes = {
|
|
2179
|
+
'c-input__password-toggle': true,
|
|
2180
|
+
'c-input__password-toggle--disabled': this.disabled,
|
|
2181
|
+
};
|
|
2182
|
+
return (h("svg", { class: classes, viewBox: "0 0 24 24", onClick: this._togglePasswordVisibility }, h("path", { d: this.passwordIcon })));
|
|
2183
|
+
}
|
|
2184
|
+
render() {
|
|
2185
|
+
return (h(Host, null, h("c-input", { autofocus: this.autofocus, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, shadow: this.shadow, type: this.type, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.value }, h("slot", { name: "pre", slot: "pre" }), this._renderInputElement(), this._renderPasswordToggle(), this._renderDateToggle(), h("slot", { name: "post" }))));
|
|
2186
|
+
}
|
|
2187
|
+
static get formAssociated() { return true; }
|
|
2188
|
+
get hiddenEl() { return getElement(this); }
|
|
2189
|
+
};
|
|
2190
|
+
CTextField._uniqueId = 0;
|
|
2191
|
+
CTextField.style = cTextFieldCss;
|
|
2192
|
+
|
|
2193
|
+
export { CAutocomplete as c_autocomplete, CBadge as c_badge, CButton as c_button, CCard as c_card, CCardActions as c_card_actions, CCardContent as c_card_content, CCardTitle as c_card_title, CCheckbox as c_checkbox, CDropdown as c_dropdown, CIcon as c_icon, CIconButton as c_icon_button, CInput as c_input, CMessage as c_message, COption as c_option, COtpInput as c_otp_input, CRadio as c_radio, CRadioGroup as c_radio_group, CRipple as c_ripple, CSelect as c_select, CSpinner as c_spinner, CSwitch as c_switch, CTable as c_table, CTextField as c_text_field };
|
|
1545
2194
|
|
|
1546
|
-
//# sourceMappingURL=c-
|
|
2195
|
+
//# sourceMappingURL=c-autocomplete_23.entry.js.map
|