@getflip/swirl-components 0.394.1 → 0.395.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/components.json +38 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-text-input.cjs.entry.js +11 -6
- package/dist/collection/components/swirl-text-input/swirl-text-input.css +4 -0
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +43 -5
- package/dist/components/assets/pdfjs/pdf.worker.min.mjs +1 -4
- package/dist/components/swirl-text-input2.js +12 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-text-input.entry.js +11 -6
- package/dist/swirl-components/p-363c660d.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-text-input/swirl-text-input.d.ts +3 -1
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-492d52f6.entry.js +0 -1
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
padding-right: calc(1.5rem + var(--s-space-8));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
.text-input--clearable .text-input__character-counter, .text-input--type-number .text-input__character-counter, .text-input--type-password .text-input__character-counter {
|
|
32
|
+
padding-right: calc(1.5rem + var(--s-space-8));
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
.text-input--show-password .text-input__input {
|
|
32
36
|
width: 100%;
|
|
33
37
|
}
|
|
@@ -13,11 +13,12 @@ export class SwirlTextInput {
|
|
|
13
13
|
this.iconSize = 24;
|
|
14
14
|
this.showPassword = false;
|
|
15
15
|
this.mediaQueryUnsubscribe = () => { };
|
|
16
|
-
this.
|
|
16
|
+
this.handleClearClick = () => {
|
|
17
17
|
this.inputEl.value = "";
|
|
18
18
|
this.value = "";
|
|
19
19
|
this.valueChange.emit("");
|
|
20
20
|
this.inputEl.focus();
|
|
21
|
+
this.clear.emit();
|
|
21
22
|
};
|
|
22
23
|
this.onChange = (event) => {
|
|
23
24
|
const el = event.target;
|
|
@@ -140,18 +141,21 @@ export class SwirlTextInput {
|
|
|
140
141
|
!this.readonly &&
|
|
141
142
|
Boolean(this.value) &&
|
|
142
143
|
!showPasswordToggle &&
|
|
143
|
-
!showStepper
|
|
144
|
-
|
|
144
|
+
!showStepper;
|
|
145
|
+
const characterCount = this.value?.length ?? 0;
|
|
146
|
+
const showCharacterCounter = this.showCharacterCounter &&
|
|
147
|
+
(!this.showCharacterCounterNearLimit ||
|
|
148
|
+
characterCount >= this.maxLength * 0.8);
|
|
145
149
|
const type = this.type === "password" && this.showPassword ? "text" : this.type;
|
|
146
150
|
const className = classnames("text-input", `text-input--font-size-${this.fontSize}`, `text-input--type-${this.type}`, {
|
|
147
151
|
"text-input--auto-grow": this.autoGrow,
|
|
148
|
-
"text-input--clearable":
|
|
152
|
+
"text-input--clearable": showClearButton,
|
|
149
153
|
"text-input--disable-dynamic-width": this.disableDynamicWidth || Boolean(this.placeholder),
|
|
150
154
|
"text-input--has-suffix": Boolean(this.suffixLabel),
|
|
151
155
|
"text-input--inline": this.inline,
|
|
152
156
|
"text-input--show-password": this.type === "password" && this.showPassword,
|
|
153
157
|
});
|
|
154
|
-
return (h(Host, { key: '
|
|
158
|
+
return (h(Host, { key: '288582bcca41f2ae8cf3c904ed02fcb0a976be7b' }, h("div", { key: '817b0708b7bebf147ded143b4f0dea6206959d49', class: className }, this.prefixLabel && (h("span", { key: '1e1bd63e29fb41cdc58237b78e55b6744bb28cda', class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { key: '731a75748b874b5414668e4c4d412fa078b54b3e', "aria-autocomplete": this.swirlAriaAutocomplete, "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-invalid": ariaInvalid, autoComplete: this.autoComplete, autoFocus: this.autoFocus, class: "text-input__input", disabled: this.disabled, inputMode: this.mode, maxLength: this.maxLength, max: this.type === "number" ? this.max : undefined, min: this.type === "number" ? this.min : undefined, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, onKeyPress: this.onKeyPress, placeholder: !Boolean(this.suffixLabel) ? this.placeholder : undefined, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, name: this.inputName, rows: this.rows > 1 ? this.rows : this.autoGrow ? 1 : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.value, readonly: this.readonly }, this.rows > 1 && this.value), this.suffixLabel && (h("span", { key: '2ac53e8616fba0f233c51e95b7a0686d03dc552c', class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { key: '48f457dfb8c41726623a34b68ba5f7622705145f', "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.handleClearClick, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { key: '5f853517b77fcb680f985c5a4624732026c7d39a', size: this.iconSize }))), showPasswordToggle && (h("button", { key: 'a11670fac677c71297420e1ab2b7ce23dfe99671', "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (h("swirl-icon-visibility-off", { size: this.iconSize })) : (h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (h("span", { key: 'e098155b27a7d5dd49019b2c1956b0b94e0c3035', class: "text-input__stepper" }, h("button", { key: '008c30c8f3bc1d7b4227db185b367d0216c051da', "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { key: '656e442c33bd16d69057fb59158d0900e8640b2c', size: this.iconSize })), h("button", { key: 'f1123bb4c9440e71727846782135c31a912cebf5', "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { key: 'bbd40a1605fa6b3757d308fd5fca6ef5cd133b59', size: this.iconSize })))), showCharacterCounter && (h("span", { key: '98b9121e7b79872e05cd4d4d1c956405118ba0b8', class: "text-input__character-counter", "aria-live": "polite" }, h("swirl-visually-hidden", { key: '339c0dd5c187d8e7818ae3dc4a75a878b3f81f6c' }, this.characterCounterLabel), characterCount, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
|
|
155
159
|
}
|
|
156
160
|
static get is() { return "swirl-text-input"; }
|
|
157
161
|
static get encapsulation() { return "scoped"; }
|
|
@@ -622,6 +626,25 @@ export class SwirlTextInput {
|
|
|
622
626
|
"setter": false,
|
|
623
627
|
"reflect": false
|
|
624
628
|
},
|
|
629
|
+
"showCharacterCounterNearLimit": {
|
|
630
|
+
"type": "boolean",
|
|
631
|
+
"attribute": "show-character-counter-near-limit",
|
|
632
|
+
"mutable": false,
|
|
633
|
+
"complexType": {
|
|
634
|
+
"original": "boolean",
|
|
635
|
+
"resolved": "boolean",
|
|
636
|
+
"references": {}
|
|
637
|
+
},
|
|
638
|
+
"required": false,
|
|
639
|
+
"optional": true,
|
|
640
|
+
"docs": {
|
|
641
|
+
"tags": [],
|
|
642
|
+
"text": ""
|
|
643
|
+
},
|
|
644
|
+
"getter": false,
|
|
645
|
+
"setter": false,
|
|
646
|
+
"reflect": false
|
|
647
|
+
},
|
|
625
648
|
"spellCheck": {
|
|
626
649
|
"type": "boolean",
|
|
627
650
|
"attribute": "spell-check",
|
|
@@ -848,6 +871,21 @@ export class SwirlTextInput {
|
|
|
848
871
|
}
|
|
849
872
|
static get events() {
|
|
850
873
|
return [{
|
|
874
|
+
"method": "clear",
|
|
875
|
+
"name": "clear",
|
|
876
|
+
"bubbles": true,
|
|
877
|
+
"cancelable": true,
|
|
878
|
+
"composed": true,
|
|
879
|
+
"docs": {
|
|
880
|
+
"tags": [],
|
|
881
|
+
"text": ""
|
|
882
|
+
},
|
|
883
|
+
"complexType": {
|
|
884
|
+
"original": "void",
|
|
885
|
+
"resolved": "void",
|
|
886
|
+
"references": {}
|
|
887
|
+
}
|
|
888
|
+
}, {
|
|
851
889
|
"method": "inputBlur",
|
|
852
890
|
"name": "inputBlur",
|
|
853
891
|
"bubbles": true,
|