@getflip/swirl-components 0.39.1 → 0.40.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 +17 -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 +7 -5
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-text-input/swirl-text-input.css +4 -0
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +23 -4
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-text-input2.js +8 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-text-input.entry.js +7 -5
- package/dist/swirl-components/p-3ce8a38c.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 +1 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-9d64ed48.entry.js +0 -1
|
@@ -68,6 +68,7 @@ export class SwirlTextInput {
|
|
|
68
68
|
};
|
|
69
69
|
this.autoComplete = "on";
|
|
70
70
|
this.autoFocus = undefined;
|
|
71
|
+
this.autoGrow = undefined;
|
|
71
72
|
this.autoSelect = undefined;
|
|
72
73
|
this.clearable = undefined;
|
|
73
74
|
this.clearButtonLabel = "Clear input";
|
|
@@ -113,12 +114,12 @@ export class SwirlTextInput {
|
|
|
113
114
|
this.iconSize = smallIcon ? 20 : 24;
|
|
114
115
|
}
|
|
115
116
|
adjustInputSize() {
|
|
116
|
-
if (this.rows > 1) {
|
|
117
|
+
if (this.rows > 1 || this.autoGrow) {
|
|
117
118
|
this.inputEl.style.width = "";
|
|
118
119
|
this.inputEl.style.height = "";
|
|
119
120
|
this.inputEl.style.height = this.inputEl.scrollHeight / 16 + "rem";
|
|
120
121
|
}
|
|
121
|
-
if (this.rows === 1) {
|
|
122
|
+
if (this.rows === 1 && !this.autoGrow) {
|
|
122
123
|
this.inputEl.style.height = "";
|
|
123
124
|
this.inputEl.style.width = "";
|
|
124
125
|
if (this.type !== "password" && !this.disableDynamicWidth) {
|
|
@@ -134,7 +135,7 @@ export class SwirlTextInput {
|
|
|
134
135
|
}
|
|
135
136
|
render() {
|
|
136
137
|
var _a;
|
|
137
|
-
const Tag = this.rows === 1 ? "input" : "textarea";
|
|
138
|
+
const Tag = this.rows === 1 && !this.autoGrow ? "input" : "textarea";
|
|
138
139
|
const ariaInvalid = this.invalid === true || this.invalid === false
|
|
139
140
|
? String(this.invalid)
|
|
140
141
|
: undefined;
|
|
@@ -148,13 +149,14 @@ export class SwirlTextInput {
|
|
|
148
149
|
!this.showCharacterCounter;
|
|
149
150
|
const type = this.type === "password" && this.showPassword ? "text" : this.type;
|
|
150
151
|
const className = classnames("text-input", `text-input--type-${this.type}`, {
|
|
152
|
+
"text-input--auto-grow": this.autoGrow,
|
|
151
153
|
"text-input--clearable": this.clearable,
|
|
152
154
|
"text-input--disabled": this.disabled,
|
|
153
155
|
"text-input--disable-dynamic-width": this.disableDynamicWidth,
|
|
154
156
|
"text-input--inline": this.inline,
|
|
155
157
|
"text-input--show-password": this.type === "password" && this.showPassword,
|
|
156
158
|
});
|
|
157
|
-
return (h(Host, null, h("div", { class: className }, this.prefixLabel && (h("span", { class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { "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, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, rows: this.rows > 1 ? this.rows : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.rows === 1 ? this.value : undefined }, this.rows > 1 && this.value), this.suffixLabel && (h("span", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (h("button", { "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", { class: "text-input__stepper" }, h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { size: this.iconSize })), h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (h("span", { class: "text-input__character-counter" }, ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
|
|
159
|
+
return (h(Host, null, h("div", { class: className }, this.prefixLabel && (h("span", { class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { "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, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, rows: this.rows > 1 ? this.rows : this.autoGrow ? 1 : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.rows === 1 ? this.value : undefined }, this.rows > 1 && this.value), this.suffixLabel && (h("span", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (h("button", { "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", { class: "text-input__stepper" }, h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { size: this.iconSize })), h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (h("span", { class: "text-input__character-counter" }, ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
|
|
158
160
|
}
|
|
159
161
|
static get is() { return "swirl-text-input"; }
|
|
160
162
|
static get encapsulation() { return "scoped"; }
|
|
@@ -205,6 +207,23 @@ export class SwirlTextInput {
|
|
|
205
207
|
"attribute": "auto-focus",
|
|
206
208
|
"reflect": false
|
|
207
209
|
},
|
|
210
|
+
"autoGrow": {
|
|
211
|
+
"type": "boolean",
|
|
212
|
+
"mutable": false,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "boolean",
|
|
215
|
+
"resolved": "boolean",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": true,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": ""
|
|
223
|
+
},
|
|
224
|
+
"attribute": "auto-grow",
|
|
225
|
+
"reflect": false
|
|
226
|
+
},
|
|
208
227
|
"autoSelect": {
|
|
209
228
|
"type": "boolean",
|
|
210
229
|
"mutable": false,
|