@rededor/cura 2.0.0-alpha.13 → 2.0.0-alpha.16
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/cura-accordion_22.cjs.entry.js +65 -74
- package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/cura-display.cjs.entry.js +1 -1
- package/dist/cjs/cura-dropdown-search-not-found.cjs.entry.js +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +1 -1
- package/dist/cjs/cura-input-date.cjs.entry.js +1 -1
- package/dist/cjs/cura-input-textarea.cjs.entry.js +236 -0
- package/dist/cjs/cura-loader-bar.cjs.entry.js +1 -1
- package/dist/cjs/cura-modal.cjs.entry.js +1 -1
- package/dist/cjs/cura-progress-bar_2.cjs.entry.js +2 -2
- package/dist/cjs/cura-radio.cjs.entry.js +1 -1
- package/dist/cjs/cura-stepper.cjs.entry.js +1 -1
- package/dist/cjs/cura-switch.cjs.entry.js +1 -1
- package/dist/cjs/cura-tabs-button.cjs.entry.js +1 -1
- package/dist/cjs/cura-tabs-transparent.cjs.entry.js +1 -1
- package/dist/cjs/cura-toast.cjs.entry.js +1 -1
- package/dist/cjs/cura-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/utils-DMHZ2n4p.js +47 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cura-calendar/cura-calendar.css +13 -1
- package/dist/collection/components/cura-calendar/cura-calendar.js +92 -11
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js +29 -1
- package/dist/collection/components/cura-calendar/cura-calendar.type.js +1 -0
- package/dist/collection/components/cura-card/cura-card.js +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search-category/cura-dropdown-search-category.js +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search-not-found/cura-dropdown-search-not-found.js +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +1 -1
- package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.js +1 -1
- package/dist/collection/components/cura-icon/cura-icon.js +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +1 -1
- package/dist/collection/components/cura-modal/cura-modal.js +1 -1
- package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
- package/dist/collection/components/cura-stepper/cura-progress-bar/cura-progress-bar.js +1 -1
- package/dist/collection/components/cura-stepper/cura-stepper-item/cura-stepper-item.js +1 -1
- package/dist/collection/components/cura-stepper/cura-stepper.js +1 -1
- package/dist/collection/components/cura-toast/cura-toast.js +1 -1
- package/dist/collection/components/cura-tooltip/cura-tooltip.js +1 -1
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js +1 -1
- package/dist/collection/components/forms/cura-input-textarea/cura-input-textarea.css +174 -0
- package/dist/collection/components/forms/cura-input-textarea/cura-input-textarea.js +613 -0
- package/dist/collection/components/forms/cura-input-textarea/cura-input-textarea.stories.js +222 -0
- package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +1 -1
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
- package/dist/collection/components/tabs/cura-tabs/cura-tabs.js +1 -1
- package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.js +1 -1
- package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.js +1 -1
- package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.js +1 -1
- package/dist/collection/components/text/cura-display/cura-display.js +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
- package/dist/components/cura-accordion-item.js +1 -1
- package/dist/components/cura-alert.js +1 -1
- package/dist/components/cura-badge-counter.js +1 -1
- package/dist/components/cura-badge-distance.js +1 -1
- package/dist/components/cura-badge-pill.js +1 -1
- package/dist/components/cura-button-outline.js +1 -1
- package/dist/components/cura-button-select.js +1 -1
- package/dist/components/cura-button-transparent.js +1 -1
- package/dist/components/cura-button.js +1 -1
- package/dist/components/cura-calendar.js +1 -1
- package/dist/components/cura-card.js +1 -1
- package/dist/components/cura-checkbox.js +1 -1
- package/dist/components/cura-display.js +1 -1
- package/dist/components/cura-dropdown-search-category.js +1 -1
- package/dist/components/cura-dropdown-search-not-found.js +1 -1
- package/dist/components/cura-dropdown-search-option.js +1 -1
- package/dist/components/cura-dropdown-search.js +1 -1
- package/dist/components/cura-heading.js +1 -1
- package/dist/components/cura-icon.js +1 -1
- package/dist/components/cura-icons-view.js +1 -1
- package/dist/components/cura-input-date.js +1 -1
- package/dist/components/cura-input-text.js +1 -1
- package/dist/components/cura-input-textarea.d.ts +11 -0
- package/dist/components/cura-input-textarea.js +1 -0
- package/dist/components/cura-label.js +1 -1
- package/dist/components/cura-loader-bar.js +1 -1
- package/dist/components/cura-loader-circle.js +1 -1
- package/dist/components/cura-modal.js +1 -1
- package/dist/components/cura-page-template.js +1 -1
- package/dist/components/cura-paragraph.js +1 -1
- package/dist/components/cura-progress-bar.js +1 -1
- package/dist/components/cura-radio.js +1 -1
- package/dist/components/cura-select-option.js +1 -1
- package/dist/components/cura-select.js +1 -1
- package/dist/components/cura-stepper-item.js +1 -1
- package/dist/components/cura-stepper.js +1 -1
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-tabs-button.js +1 -1
- package/dist/components/cura-tabs-group.js +1 -1
- package/dist/components/cura-tabs-transparent.js +1 -1
- package/dist/components/cura-tabs.js +1 -1
- package/dist/components/cura-toast.js +1 -1
- package/dist/components/cura-tooltip.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-B2TDH4aP.js +1 -0
- package/dist/components/{p-C05r6CQV.js → p-BHVSbubb.js} +1 -1
- package/dist/components/{p-B2RN7oe_.js → p-BKDpza6x.js} +1 -1
- package/dist/components/{p-BYA8glxD.js → p-BuETJyzc.js} +1 -1
- package/dist/components/p-CalvBU-U.js +1 -0
- package/dist/components/{p-CCkEqDZb.js → p-CksTHXxZ.js} +1 -1
- package/dist/components/{p-DxJedO3K.js → p-D4hCuriT.js} +1 -1
- package/dist/components/{p-fn4zJrKE.js → p-DI66_jP6.js} +1 -1
- package/dist/components/{p-Bf21UQXV.js → p-DQP7jRHp.js} +1 -1
- package/dist/components/p-DgK8dEko.js +1 -0
- package/dist/components/{p-DXlGQp3a.js → p-DgQJ968V.js} +1 -1
- package/dist/components/{p-fR02COZb.js → p-Dmalf4Oj.js} +1 -1
- package/dist/components/{p-D6xuYQiO.js → p-KovUKiTX.js} +1 -1
- package/dist/components/{p-D7WNwjv-.js → p-PiUhcFob.js} +1 -1
- package/dist/components/{p-C7so9xnO.js → p-TnCIk87O.js} +1 -1
- package/dist/components/{p-BSdkRryc.js → p-i55vIhdM.js} +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/{p-bf99e8bf.entry.js → p-18a1cadf.entry.js} +1 -1
- package/dist/cura/{p-ddf4d240.entry.js → p-1c48aaa7.entry.js} +1 -1
- package/dist/cura/{p-b7369d04.entry.js → p-4178e3e6.entry.js} +1 -1
- package/dist/cura/p-5b26a166.entry.js +1 -0
- package/dist/cura/{p-42e72d12.entry.js → p-604f1c1d.entry.js} +1 -1
- package/dist/cura/{p-9de85de6.entry.js → p-906c8b66.entry.js} +1 -1
- package/dist/cura/p-CUmwazb8.js +1 -0
- package/dist/cura/p-a305e17a.entry.js +1 -0
- package/dist/cura/{p-3a3202f0.entry.js → p-a72db13d.entry.js} +1 -1
- package/dist/cura/{p-c247c93b.entry.js → p-b157025d.entry.js} +1 -1
- package/dist/cura/{p-f911a6c5.entry.js → p-b447fca2.entry.js} +1 -1
- package/dist/cura/{p-2e2e2b4d.entry.js → p-bd649bed.entry.js} +1 -1
- package/dist/cura/{p-c18d7f16.entry.js → p-c987ddde.entry.js} +1 -1
- package/dist/cura/{p-b14ae206.entry.js → p-d43fb791.entry.js} +1 -1
- package/dist/cura/{p-7965fe63.entry.js → p-d64ef37d.entry.js} +1 -1
- package/dist/cura/{p-1dc9c478.entry.js → p-f072b011.entry.js} +1 -1
- package/dist/cura/{p-5357f7bd.entry.js → p-f407bd73.entry.js} +1 -1
- package/dist/cura/p-f638eda8.entry.js +1 -0
- package/dist/esm/cura-accordion_22.entry.js +58 -67
- package/dist/esm/cura-checkbox.entry.js +1 -1
- package/dist/esm/cura-display.entry.js +1 -1
- package/dist/esm/cura-dropdown-search-not-found.entry.js +1 -1
- package/dist/esm/cura-icons-view.entry.js +1 -1
- package/dist/esm/cura-input-date.entry.js +1 -1
- package/dist/esm/cura-input-textarea.entry.js +234 -0
- package/dist/esm/cura-loader-bar.entry.js +1 -1
- package/dist/esm/cura-modal.entry.js +1 -1
- package/dist/esm/cura-progress-bar_2.entry.js +2 -2
- package/dist/esm/cura-radio.entry.js +1 -1
- package/dist/esm/cura-stepper.entry.js +1 -1
- package/dist/esm/cura-switch.entry.js +1 -1
- package/dist/esm/cura-tabs-button.entry.js +1 -1
- package/dist/esm/cura-tabs-transparent.entry.js +1 -1
- package/dist/esm/cura-toast.entry.js +1 -1
- package/dist/esm/cura-tooltip.entry.js +1 -1
- package/dist/esm/cura.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/utils-BZCR971L.js +41 -0
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +20 -2
- package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +29 -0
- package/dist/types/components/cura-calendar/cura-calendar.type.d.ts +4 -0
- package/dist/types/components/forms/cura-input-textarea/cura-input-textarea.d.ts +116 -0
- package/dist/types/components/forms/cura-input-textarea/cura-input-textarea.stories.d.ts +188 -0
- package/dist/types/components.d.ts +232 -0
- package/package.json +2 -2
- package/dist/components/p-B8xnU6YS.js +0 -1
- package/dist/components/p-CG1lz5DR.js +0 -1
- package/dist/cura/p-47fdb124.entry.js +0 -1
- package/dist/cura/p-cbe8c690.entry.js +0 -1
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { checkMobile, checkIOS, fakeInputIOSHack } from "../../../utils/utils";
|
|
3
|
+
export class CuraInputTextArea {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates input status (default: 'default')
|
|
7
|
+
*/
|
|
8
|
+
this.status = 'default';
|
|
9
|
+
/**
|
|
10
|
+
* Size of the textarea: 'small', 'medium', or 'large' (default: 'medium')
|
|
11
|
+
*/
|
|
12
|
+
this.size = 'medium';
|
|
13
|
+
/**
|
|
14
|
+
* Label text for the textarea
|
|
15
|
+
*/
|
|
16
|
+
this.label = '';
|
|
17
|
+
/**
|
|
18
|
+
* Name for the textarea
|
|
19
|
+
*/
|
|
20
|
+
this.name = '';
|
|
21
|
+
/**
|
|
22
|
+
* Placeholder text
|
|
23
|
+
*/
|
|
24
|
+
this.placeholder = null;
|
|
25
|
+
/**
|
|
26
|
+
* Initial value of the textarea
|
|
27
|
+
*/
|
|
28
|
+
this.value = '';
|
|
29
|
+
/**
|
|
30
|
+
* Cura icon name to display
|
|
31
|
+
*/
|
|
32
|
+
this.iconName = '';
|
|
33
|
+
/**
|
|
34
|
+
* Whether the textarea is disabled (default: false)
|
|
35
|
+
*/
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the textarea is required (default: false)
|
|
39
|
+
*/
|
|
40
|
+
this.required = false;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the textarea is read-only (default: false)
|
|
43
|
+
*/
|
|
44
|
+
this.readOnly = false;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the textarea is resizable (default: true)
|
|
47
|
+
*/
|
|
48
|
+
this.resizable = true;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the textarea is in loading state (default: false)
|
|
51
|
+
*/
|
|
52
|
+
this.isLoading = false;
|
|
53
|
+
this.isHovered = false;
|
|
54
|
+
this.isFocused = false;
|
|
55
|
+
this.currentValue = '';
|
|
56
|
+
this.fieldStyles = { height: 'auto' };
|
|
57
|
+
/**
|
|
58
|
+
* Removes the alertCircle icon when necessary (as used in CuraDropdownSearch)
|
|
59
|
+
*/
|
|
60
|
+
this.hideErrorIcon = false;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the textarea should have autocomplete
|
|
63
|
+
*/
|
|
64
|
+
this.autocomplete = 'on';
|
|
65
|
+
this.styles = {};
|
|
66
|
+
}
|
|
67
|
+
async setFocus() {
|
|
68
|
+
const timeoutMs = checkMobile() && checkIOS() ? 1000 : 200;
|
|
69
|
+
let fakeInput = fakeInputIOSHack(this.host);
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
this.inputRef.focus();
|
|
72
|
+
if (fakeInput)
|
|
73
|
+
fakeInput.remove();
|
|
74
|
+
}, timeoutMs);
|
|
75
|
+
}
|
|
76
|
+
formStateRestoreCallback(state) {
|
|
77
|
+
this.currentValue = state.value;
|
|
78
|
+
this.internals.setFormValue(this.currentValue);
|
|
79
|
+
}
|
|
80
|
+
formAssociatedCallback(form) {
|
|
81
|
+
form.ariaLabel = this.label;
|
|
82
|
+
}
|
|
83
|
+
formResetCallback() {
|
|
84
|
+
this.handleClearInput();
|
|
85
|
+
this.internals.setValidity({});
|
|
86
|
+
this.internals.setFormValue('');
|
|
87
|
+
}
|
|
88
|
+
formDisabledCallback(disabled) {
|
|
89
|
+
this.disabled = disabled;
|
|
90
|
+
}
|
|
91
|
+
connectedCallback() {
|
|
92
|
+
this.styles['--primary-base'] = window.CuraAPI.theme.colors.getColor(`primary-base`);
|
|
93
|
+
this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);
|
|
94
|
+
this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);
|
|
95
|
+
this.styles['--neutral-black'] = window.CuraAPI.theme.colors.getColor(`neutral-black`);
|
|
96
|
+
this.styles['--neutral-medium'] = window.CuraAPI.theme.colors.getColor(`neutral-medium`);
|
|
97
|
+
this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
|
|
98
|
+
this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);
|
|
99
|
+
this.styles['--success-dark'] = window.CuraAPI.theme.colors.getColor(`success-dark`);
|
|
100
|
+
this.styles['--success-darker'] = window.CuraAPI.theme.colors.getColor(`success-darker`);
|
|
101
|
+
this.styles['--success-lighter'] = window.CuraAPI.theme.colors.getColor(`success-lighter`);
|
|
102
|
+
this.styles['--error-lighter'] = window.CuraAPI.theme.colors.getColor(`error-lighter`);
|
|
103
|
+
this.styles['--error-dark'] = window.CuraAPI.theme.colors.getColor(`error-dark`);
|
|
104
|
+
this.styles['--error-darker'] = window.CuraAPI.theme.colors.getColor(`error-darker`);
|
|
105
|
+
this.styles['--error-base'] = window.CuraAPI.theme.colors.getColor(`error-base`);
|
|
106
|
+
this.styles['--info-base'] = window.CuraAPI.theme.colors.getColor(`info-base`);
|
|
107
|
+
this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
|
|
108
|
+
this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
|
|
109
|
+
this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();
|
|
110
|
+
this.weights = window.CuraAPI.theme.fonts.getWeights();
|
|
111
|
+
this.breakpoints = window.CuraAPI.theme.breakpoints.get();
|
|
112
|
+
this.styles['--font-weight-medium'] = this.weights.medium;
|
|
113
|
+
this.styles['--font-weight-bold'] = this.weights.bold;
|
|
114
|
+
this.styles['--font-weight-regular'] = this.weights.regular;
|
|
115
|
+
}
|
|
116
|
+
componentWillLoad() {
|
|
117
|
+
this.currentValue = this.value;
|
|
118
|
+
}
|
|
119
|
+
getClasses() {
|
|
120
|
+
return {
|
|
121
|
+
[this.size.toLowerCase()]: true,
|
|
122
|
+
disabled: !!this.disabled,
|
|
123
|
+
isLoading: !!this.isLoading,
|
|
124
|
+
isFocused: this.isFocused && !this.disabled && !this.readOnly && !this.isLoading,
|
|
125
|
+
isHovered: this.isHovered,
|
|
126
|
+
[this.status]: true,
|
|
127
|
+
resizable: !!this.resizable,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
getLabelColor() {
|
|
131
|
+
if (!!this.disabled) {
|
|
132
|
+
return 'neutral-medium';
|
|
133
|
+
}
|
|
134
|
+
else if (((this.isFocused || this.isHovered || this.status === 'success' || this.status === 'error') && !this.readOnly) || this.isHovered) {
|
|
135
|
+
return 'neutral-black';
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return 'neutral-dark';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
renderIcon() {
|
|
142
|
+
if (this.iconName === '' && this.status === 'default') {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (this.status === 'error' && this.hideErrorIcon) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const baseIconSize = this.size === 'large' ? 20 : 16;
|
|
149
|
+
const iconMap = {
|
|
150
|
+
loading: { name: this.iconName, color: 'primary-base' },
|
|
151
|
+
success: { name: 'checkCircle', color: 'success-dark' },
|
|
152
|
+
error: { name: 'alertCircle', color: 'error-dark' },
|
|
153
|
+
default: { name: this.iconName, color: 'neutral-dark' },
|
|
154
|
+
disabled: { name: this.iconName, color: 'neutral-medium' },
|
|
155
|
+
};
|
|
156
|
+
const iconConfig = iconMap[this.isLoading ? 'loading' : this.disabled ? 'disabled' : this.status || 'default'];
|
|
157
|
+
return (h("div", { class: "feedback-icon", style: this.styles }, h("cura-icon", { name: iconConfig.name, iconset: "default", size: baseIconSize, color: iconConfig.color })));
|
|
158
|
+
}
|
|
159
|
+
renderHelperText() {
|
|
160
|
+
const isError = this.status === 'error';
|
|
161
|
+
const isSuccess = this.status === 'success';
|
|
162
|
+
const isDefault = this.status === 'default';
|
|
163
|
+
const helperTextSize = this.size === 'large' ? 'small' : 'xsmall';
|
|
164
|
+
const colorText = (() => {
|
|
165
|
+
if (this.disabled)
|
|
166
|
+
return 'neutral-medium';
|
|
167
|
+
if (this.isLoading)
|
|
168
|
+
return 'primary-base';
|
|
169
|
+
if (this.isFocused || this.isHovered)
|
|
170
|
+
return 'neutral-black';
|
|
171
|
+
return 'neutral-dark';
|
|
172
|
+
})();
|
|
173
|
+
return (h("div", { style: this.styles, class: "helper-text", part: "cura-input-text-helper" }, isDefault && (h("cura-label", { size: helperTextSize, color: colorText }, h("slot", null))), isError && (h("cura-label", { size: helperTextSize, lineHeight: "xsmall", color: "error-dark" }, h("slot", null))), isSuccess && (h("cura-label", { size: helperTextSize, lineHeight: "xsmall", color: "success-dark" }, h("slot", null)))));
|
|
174
|
+
}
|
|
175
|
+
renderMaxLength() {
|
|
176
|
+
var _a;
|
|
177
|
+
if (!this.maxlength)
|
|
178
|
+
return null;
|
|
179
|
+
return (h("div", { class: "max-length" }, h("cura-label", { size: "xsmall", weight: 'bold', color: "neutral-dark" }, `${((_a = this.currentValue) === null || _a === void 0 ? void 0 : _a.toString().length) || 0}`), h("cura-label", { size: "xsmall", weight: 'bold', color: "neutral-darker" }, `/${this.maxlength}`)));
|
|
180
|
+
}
|
|
181
|
+
handleMouseEnter() {
|
|
182
|
+
this.isHovered = true;
|
|
183
|
+
}
|
|
184
|
+
handleMouseLeave() {
|
|
185
|
+
this.isHovered = false;
|
|
186
|
+
}
|
|
187
|
+
handleClearInput() {
|
|
188
|
+
this.currentValue = '';
|
|
189
|
+
this.inputRef.value = '';
|
|
190
|
+
this.valueChange.emit(this.currentValue);
|
|
191
|
+
this.inputClear.emit(this.currentValue);
|
|
192
|
+
this.setFocus();
|
|
193
|
+
}
|
|
194
|
+
handleInputFocus() {
|
|
195
|
+
this.isFocused = true;
|
|
196
|
+
}
|
|
197
|
+
handleInputBlur() {
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
this.isFocused = false;
|
|
200
|
+
}, 150);
|
|
201
|
+
}
|
|
202
|
+
handleInputChange(event) {
|
|
203
|
+
const inputValue = event.target.value;
|
|
204
|
+
this.valueChange.emit(inputValue);
|
|
205
|
+
this.handleTextInputChange(inputValue);
|
|
206
|
+
this.internals.setFormValue(this.currentValue);
|
|
207
|
+
}
|
|
208
|
+
handleTextInputChange(inputValue) {
|
|
209
|
+
this.currentValue = inputValue;
|
|
210
|
+
}
|
|
211
|
+
render() {
|
|
212
|
+
return (h(Host, { key: '05f1a1a3b51e4bb1bc54cab3c8d5b6062a95d32a', role: "textbox", "aria-disabled": this.disabled, "aria-required": this.required, "aria-invalid": this.status === 'error' }, h("div", { key: '47eb10b6f3c3e697ae1558fd53d4d9cb9a2b6065', style: this.styles, onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave(), class: Object.assign({ 'cura-textarea-group': true }, this.getClasses()) }, h("div", { key: 'c090b7b2eb353dbe929810c4835f49860bfe9c80', class: "input-wrapper" }, this.label && (h("cura-label", { key: 'a957db2fb6e2779d3c33f7504124cff353e41c2c', class: "label", weight: "bold", size: this.size === 'large' ? 'small' : 'xsmall', color: this.getLabelColor() }, this.label, " ", this.required && h("span", { key: '1928a3597976bd5b1f4076c49dae803a69139cb5', class: "required" }, "* "))), h("div", { key: '58c1cab70c203e9ca106ddec09d606943814b65c', class: "cura-textarea-field", part: "cura-textarea-field", style: this.fieldStyles }, this.renderIcon(), h("textarea", { key: 'd6a59a727dfc5a8655ea496111dd46718101b0be', name: this.name ? this.name : '', onBlur: this.handleInputBlur.bind(this), onFocus: this.handleInputFocus.bind(this), onInput: event => this.handleInputChange(event), class: this.getClasses(), style: this.styles, placeholder: this.placeholder, disabled: this.disabled || this.isLoading, required: this.required, readonly: this.readOnly, maxlength: this.maxlength, value: this.currentValue !== undefined && this.currentValue !== null ? this.currentValue : '', autocomplete: this.autocomplete }), this.isLoading && h("cura-loader-circle", { key: '0476538f94ba6ffc0dc89b4bd125c048f420d415', size: this.size === 'large' ? 'medium' : 'small', color: "primary-base" })), h("div", { key: '84b14a2904cfa97adc766bd65cbbf48cb390d6c6', class: "helper-max-wrapper" }, this.renderHelperText(), " ", this.renderMaxLength())))));
|
|
213
|
+
}
|
|
214
|
+
static get is() { return "cura-input-textarea"; }
|
|
215
|
+
static get encapsulation() { return "shadow"; }
|
|
216
|
+
static get formAssociated() { return true; }
|
|
217
|
+
static get originalStyleUrls() {
|
|
218
|
+
return {
|
|
219
|
+
"$": ["cura-input-textarea.scss"]
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
static get styleUrls() {
|
|
223
|
+
return {
|
|
224
|
+
"$": ["cura-input-textarea.css"]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
static get properties() {
|
|
228
|
+
return {
|
|
229
|
+
"status": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"mutable": false,
|
|
232
|
+
"complexType": {
|
|
233
|
+
"original": "'error' | 'success' | 'default' | string",
|
|
234
|
+
"resolved": "string",
|
|
235
|
+
"references": {}
|
|
236
|
+
},
|
|
237
|
+
"required": false,
|
|
238
|
+
"optional": false,
|
|
239
|
+
"docs": {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": "Indicates input status (default: 'default')"
|
|
242
|
+
},
|
|
243
|
+
"getter": false,
|
|
244
|
+
"setter": false,
|
|
245
|
+
"reflect": true,
|
|
246
|
+
"attribute": "status",
|
|
247
|
+
"defaultValue": "'default'"
|
|
248
|
+
},
|
|
249
|
+
"size": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"mutable": false,
|
|
252
|
+
"complexType": {
|
|
253
|
+
"original": "'small' | 'medium' | 'large' | string",
|
|
254
|
+
"resolved": "string",
|
|
255
|
+
"references": {}
|
|
256
|
+
},
|
|
257
|
+
"required": false,
|
|
258
|
+
"optional": false,
|
|
259
|
+
"docs": {
|
|
260
|
+
"tags": [],
|
|
261
|
+
"text": "Size of the textarea: 'small', 'medium', or 'large' (default: 'medium')"
|
|
262
|
+
},
|
|
263
|
+
"getter": false,
|
|
264
|
+
"setter": false,
|
|
265
|
+
"reflect": true,
|
|
266
|
+
"attribute": "size",
|
|
267
|
+
"defaultValue": "'medium'"
|
|
268
|
+
},
|
|
269
|
+
"label": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"mutable": false,
|
|
272
|
+
"complexType": {
|
|
273
|
+
"original": "string",
|
|
274
|
+
"resolved": "string",
|
|
275
|
+
"references": {}
|
|
276
|
+
},
|
|
277
|
+
"required": false,
|
|
278
|
+
"optional": true,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [],
|
|
281
|
+
"text": "Label text for the textarea"
|
|
282
|
+
},
|
|
283
|
+
"getter": false,
|
|
284
|
+
"setter": false,
|
|
285
|
+
"reflect": true,
|
|
286
|
+
"attribute": "label",
|
|
287
|
+
"defaultValue": "''"
|
|
288
|
+
},
|
|
289
|
+
"name": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "string",
|
|
294
|
+
"resolved": "string",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": true,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": "Name for the textarea"
|
|
302
|
+
},
|
|
303
|
+
"getter": false,
|
|
304
|
+
"setter": false,
|
|
305
|
+
"reflect": true,
|
|
306
|
+
"attribute": "name",
|
|
307
|
+
"defaultValue": "''"
|
|
308
|
+
},
|
|
309
|
+
"placeholder": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"mutable": false,
|
|
312
|
+
"complexType": {
|
|
313
|
+
"original": "string | null",
|
|
314
|
+
"resolved": "string",
|
|
315
|
+
"references": {}
|
|
316
|
+
},
|
|
317
|
+
"required": false,
|
|
318
|
+
"optional": true,
|
|
319
|
+
"docs": {
|
|
320
|
+
"tags": [],
|
|
321
|
+
"text": "Placeholder text"
|
|
322
|
+
},
|
|
323
|
+
"getter": false,
|
|
324
|
+
"setter": false,
|
|
325
|
+
"reflect": true,
|
|
326
|
+
"attribute": "placeholder",
|
|
327
|
+
"defaultValue": "null"
|
|
328
|
+
},
|
|
329
|
+
"value": {
|
|
330
|
+
"type": "any",
|
|
331
|
+
"mutable": false,
|
|
332
|
+
"complexType": {
|
|
333
|
+
"original": "string | number",
|
|
334
|
+
"resolved": "number | string",
|
|
335
|
+
"references": {}
|
|
336
|
+
},
|
|
337
|
+
"required": false,
|
|
338
|
+
"optional": false,
|
|
339
|
+
"docs": {
|
|
340
|
+
"tags": [],
|
|
341
|
+
"text": "Initial value of the textarea"
|
|
342
|
+
},
|
|
343
|
+
"getter": false,
|
|
344
|
+
"setter": false,
|
|
345
|
+
"reflect": true,
|
|
346
|
+
"attribute": "value",
|
|
347
|
+
"defaultValue": "''"
|
|
348
|
+
},
|
|
349
|
+
"iconName": {
|
|
350
|
+
"type": "string",
|
|
351
|
+
"mutable": false,
|
|
352
|
+
"complexType": {
|
|
353
|
+
"original": "string",
|
|
354
|
+
"resolved": "string",
|
|
355
|
+
"references": {}
|
|
356
|
+
},
|
|
357
|
+
"required": false,
|
|
358
|
+
"optional": true,
|
|
359
|
+
"docs": {
|
|
360
|
+
"tags": [],
|
|
361
|
+
"text": "Cura icon name to display"
|
|
362
|
+
},
|
|
363
|
+
"getter": false,
|
|
364
|
+
"setter": false,
|
|
365
|
+
"reflect": true,
|
|
366
|
+
"attribute": "icon-name",
|
|
367
|
+
"defaultValue": "''"
|
|
368
|
+
},
|
|
369
|
+
"helperText": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"mutable": false,
|
|
372
|
+
"complexType": {
|
|
373
|
+
"original": "string",
|
|
374
|
+
"resolved": "string",
|
|
375
|
+
"references": {}
|
|
376
|
+
},
|
|
377
|
+
"required": false,
|
|
378
|
+
"optional": true,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": "Helper text displayed below the textarea"
|
|
382
|
+
},
|
|
383
|
+
"getter": false,
|
|
384
|
+
"setter": false,
|
|
385
|
+
"reflect": true,
|
|
386
|
+
"attribute": "helper-text"
|
|
387
|
+
},
|
|
388
|
+
"disabled": {
|
|
389
|
+
"type": "boolean",
|
|
390
|
+
"mutable": true,
|
|
391
|
+
"complexType": {
|
|
392
|
+
"original": "boolean",
|
|
393
|
+
"resolved": "boolean",
|
|
394
|
+
"references": {}
|
|
395
|
+
},
|
|
396
|
+
"required": false,
|
|
397
|
+
"optional": true,
|
|
398
|
+
"docs": {
|
|
399
|
+
"tags": [],
|
|
400
|
+
"text": "Whether the textarea is disabled (default: false)"
|
|
401
|
+
},
|
|
402
|
+
"getter": false,
|
|
403
|
+
"setter": false,
|
|
404
|
+
"reflect": true,
|
|
405
|
+
"attribute": "disabled",
|
|
406
|
+
"defaultValue": "false"
|
|
407
|
+
},
|
|
408
|
+
"required": {
|
|
409
|
+
"type": "boolean",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "boolean",
|
|
413
|
+
"resolved": "boolean",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": true,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": "Whether the textarea is required (default: false)"
|
|
421
|
+
},
|
|
422
|
+
"getter": false,
|
|
423
|
+
"setter": false,
|
|
424
|
+
"reflect": true,
|
|
425
|
+
"attribute": "required",
|
|
426
|
+
"defaultValue": "false"
|
|
427
|
+
},
|
|
428
|
+
"maxlength": {
|
|
429
|
+
"type": "number",
|
|
430
|
+
"mutable": false,
|
|
431
|
+
"complexType": {
|
|
432
|
+
"original": "number | undefined",
|
|
433
|
+
"resolved": "number",
|
|
434
|
+
"references": {}
|
|
435
|
+
},
|
|
436
|
+
"required": false,
|
|
437
|
+
"optional": true,
|
|
438
|
+
"docs": {
|
|
439
|
+
"tags": [],
|
|
440
|
+
"text": "Maximum length of the textarea value"
|
|
441
|
+
},
|
|
442
|
+
"getter": false,
|
|
443
|
+
"setter": false,
|
|
444
|
+
"reflect": true,
|
|
445
|
+
"attribute": "maxlength"
|
|
446
|
+
},
|
|
447
|
+
"readOnly": {
|
|
448
|
+
"type": "boolean",
|
|
449
|
+
"mutable": false,
|
|
450
|
+
"complexType": {
|
|
451
|
+
"original": "boolean",
|
|
452
|
+
"resolved": "boolean",
|
|
453
|
+
"references": {}
|
|
454
|
+
},
|
|
455
|
+
"required": false,
|
|
456
|
+
"optional": true,
|
|
457
|
+
"docs": {
|
|
458
|
+
"tags": [],
|
|
459
|
+
"text": "Whether the textarea is read-only (default: false)"
|
|
460
|
+
},
|
|
461
|
+
"getter": false,
|
|
462
|
+
"setter": false,
|
|
463
|
+
"reflect": true,
|
|
464
|
+
"attribute": "read-only",
|
|
465
|
+
"defaultValue": "false"
|
|
466
|
+
},
|
|
467
|
+
"resizable": {
|
|
468
|
+
"type": "boolean",
|
|
469
|
+
"mutable": false,
|
|
470
|
+
"complexType": {
|
|
471
|
+
"original": "boolean",
|
|
472
|
+
"resolved": "boolean",
|
|
473
|
+
"references": {}
|
|
474
|
+
},
|
|
475
|
+
"required": false,
|
|
476
|
+
"optional": true,
|
|
477
|
+
"docs": {
|
|
478
|
+
"tags": [],
|
|
479
|
+
"text": "Whether the textarea is resizable (default: true)"
|
|
480
|
+
},
|
|
481
|
+
"getter": false,
|
|
482
|
+
"setter": false,
|
|
483
|
+
"reflect": true,
|
|
484
|
+
"attribute": "resizable",
|
|
485
|
+
"defaultValue": "true"
|
|
486
|
+
},
|
|
487
|
+
"isLoading": {
|
|
488
|
+
"type": "boolean",
|
|
489
|
+
"mutable": false,
|
|
490
|
+
"complexType": {
|
|
491
|
+
"original": "boolean",
|
|
492
|
+
"resolved": "boolean",
|
|
493
|
+
"references": {}
|
|
494
|
+
},
|
|
495
|
+
"required": false,
|
|
496
|
+
"optional": true,
|
|
497
|
+
"docs": {
|
|
498
|
+
"tags": [],
|
|
499
|
+
"text": "Whether the textarea is in loading state (default: false)"
|
|
500
|
+
},
|
|
501
|
+
"getter": false,
|
|
502
|
+
"setter": false,
|
|
503
|
+
"reflect": true,
|
|
504
|
+
"attribute": "is-loading",
|
|
505
|
+
"defaultValue": "false"
|
|
506
|
+
},
|
|
507
|
+
"hideErrorIcon": {
|
|
508
|
+
"type": "boolean",
|
|
509
|
+
"mutable": false,
|
|
510
|
+
"complexType": {
|
|
511
|
+
"original": "boolean",
|
|
512
|
+
"resolved": "boolean",
|
|
513
|
+
"references": {}
|
|
514
|
+
},
|
|
515
|
+
"required": false,
|
|
516
|
+
"optional": false,
|
|
517
|
+
"docs": {
|
|
518
|
+
"tags": [],
|
|
519
|
+
"text": "Removes the alertCircle icon when necessary (as used in CuraDropdownSearch)"
|
|
520
|
+
},
|
|
521
|
+
"getter": false,
|
|
522
|
+
"setter": false,
|
|
523
|
+
"reflect": false,
|
|
524
|
+
"attribute": "hide-error-icon",
|
|
525
|
+
"defaultValue": "false"
|
|
526
|
+
},
|
|
527
|
+
"autocomplete": {
|
|
528
|
+
"type": "string",
|
|
529
|
+
"mutable": false,
|
|
530
|
+
"complexType": {
|
|
531
|
+
"original": "string",
|
|
532
|
+
"resolved": "string",
|
|
533
|
+
"references": {}
|
|
534
|
+
},
|
|
535
|
+
"required": false,
|
|
536
|
+
"optional": true,
|
|
537
|
+
"docs": {
|
|
538
|
+
"tags": [],
|
|
539
|
+
"text": "Whether the textarea should have autocomplete"
|
|
540
|
+
},
|
|
541
|
+
"getter": false,
|
|
542
|
+
"setter": false,
|
|
543
|
+
"reflect": true,
|
|
544
|
+
"attribute": "autocomplete",
|
|
545
|
+
"defaultValue": "'on'"
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
static get states() {
|
|
550
|
+
return {
|
|
551
|
+
"isHovered": {},
|
|
552
|
+
"isFocused": {},
|
|
553
|
+
"currentValue": {},
|
|
554
|
+
"fieldStyles": {}
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
static get events() {
|
|
558
|
+
return [{
|
|
559
|
+
"method": "valueChange",
|
|
560
|
+
"name": "valueChange",
|
|
561
|
+
"bubbles": true,
|
|
562
|
+
"cancelable": true,
|
|
563
|
+
"composed": true,
|
|
564
|
+
"docs": {
|
|
565
|
+
"tags": [],
|
|
566
|
+
"text": ""
|
|
567
|
+
},
|
|
568
|
+
"complexType": {
|
|
569
|
+
"original": "string | number",
|
|
570
|
+
"resolved": "number | string",
|
|
571
|
+
"references": {}
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
"method": "inputClear",
|
|
575
|
+
"name": "inputClear",
|
|
576
|
+
"bubbles": true,
|
|
577
|
+
"cancelable": true,
|
|
578
|
+
"composed": true,
|
|
579
|
+
"docs": {
|
|
580
|
+
"tags": [],
|
|
581
|
+
"text": ""
|
|
582
|
+
},
|
|
583
|
+
"complexType": {
|
|
584
|
+
"original": "string | number",
|
|
585
|
+
"resolved": "number | string",
|
|
586
|
+
"references": {}
|
|
587
|
+
}
|
|
588
|
+
}];
|
|
589
|
+
}
|
|
590
|
+
static get methods() {
|
|
591
|
+
return {
|
|
592
|
+
"setFocus": {
|
|
593
|
+
"complexType": {
|
|
594
|
+
"signature": "() => Promise<void>",
|
|
595
|
+
"parameters": [],
|
|
596
|
+
"references": {
|
|
597
|
+
"Promise": {
|
|
598
|
+
"location": "global",
|
|
599
|
+
"id": "global::Promise"
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
"return": "Promise<void>"
|
|
603
|
+
},
|
|
604
|
+
"docs": {
|
|
605
|
+
"text": "",
|
|
606
|
+
"tags": []
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
static get elementRef() { return "host"; }
|
|
612
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
613
|
+
}
|