@sula-tech/webcomponents 0.1.1 → 0.2.1
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/{index-7973b779.js → index-87eec792.js} +126 -5
- package/dist/cjs/index-87eec792.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{sula-avatar_3.cjs.entry.js → sula-avatar_9.cjs.entry.js} +652 -7
- package/dist/cjs/sula-avatar_9.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +7 -1
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js +14 -17
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js.map +1 -1
- package/dist/collection/components/sula-badge/model/sula-badge.model.js +23 -0
- package/dist/collection/components/sula-badge/model/sula-badge.model.js.map +1 -0
- package/dist/collection/components/sula-badge/sula-badge.css +1 -0
- package/dist/collection/components/sula-badge/sula-badge.js +230 -0
- package/dist/collection/components/sula-badge/sula-badge.js.map +1 -0
- package/dist/collection/components/sula-badge/sula-badge.stories.js +148 -0
- package/dist/collection/components/sula-badge/sula-badge.stories.js.map +1 -0
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-button/sula-button.js +1 -1
- package/dist/collection/components/sula-button/sula-button.stories.js +36 -9
- package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
- package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js +6 -0
- package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js.map +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +233 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.js.map +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js +113 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js.map +1 -0
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.js +1 -1
- package/dist/collection/components/sula-icon/sula-icon.stories.js +35 -14
- package/dist/collection/components/sula-icon/sula-icon.stories.js.map +1 -1
- package/dist/collection/components/sula-switch/model/sula-switch.model.js +6 -0
- package/dist/collection/components/sula-switch/model/sula-switch.model.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.css +1 -0
- package/dist/collection/components/sula-switch/sula-switch.js +235 -0
- package/dist/collection/components/sula-switch/sula-switch.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.stories.js +111 -0
- package/dist/collection/components/sula-switch/sula-switch.stories.js.map +1 -0
- package/dist/collection/components/sula-tag/model/sula-tag.model.js +28 -0
- package/dist/collection/components/sula-tag/model/sula-tag.model.js.map +1 -0
- package/dist/collection/components/sula-tag/sula-tag.css +1 -0
- package/dist/collection/components/sula-tag/sula-tag.js +249 -0
- package/dist/collection/components/sula-tag/sula-tag.js.map +1 -0
- package/dist/collection/components/sula-tag/sula-tag.stories.js +201 -0
- package/dist/collection/components/sula-tag/sula-tag.stories.js.map +1 -0
- package/dist/collection/components/sula-textarea/model/sula-textarea.model.js +6 -0
- package/dist/collection/components/sula-textarea/model/sula-textarea.model.js.map +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.css +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.js +358 -0
- package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js +138 -0
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js.map +1 -0
- package/dist/collection/components/sula-textfield/model/sula-textfield.model.js +11 -0
- package/dist/collection/components/sula-textfield/model/sula-textfield.model.js.map +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.js +376 -0
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js +148 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-81fcc74a.js → p-2d5f97d1.js} +4 -4
- package/dist/components/{p-81fcc74a.js.map → p-2d5f97d1.js.map} +1 -1
- package/dist/components/{p-d3ba6302.js → p-881c6b35.js} +114 -6
- package/dist/components/p-881c6b35.js.map +1 -0
- package/dist/components/sula-avatar.js +3 -3
- package/dist/components/sula-avatar.js.map +1 -1
- package/dist/components/sula-badge.d.ts +11 -0
- package/dist/components/sula-badge.js +154 -0
- package/dist/components/sula-badge.js.map +1 -0
- package/dist/components/sula-button.js +4 -4
- package/dist/components/sula-button.js.map +1 -1
- package/dist/components/sula-checkbox.d.ts +11 -0
- package/dist/components/sula-checkbox.js +109 -0
- package/dist/components/sula-checkbox.js.map +1 -0
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-switch.d.ts +11 -0
- package/dist/components/sula-switch.js +105 -0
- package/dist/components/sula-switch.js.map +1 -0
- package/dist/components/sula-tag.d.ts +11 -0
- package/dist/components/sula-tag.js +157 -0
- package/dist/components/sula-tag.js.map +1 -0
- package/dist/components/sula-textarea.d.ts +11 -0
- package/dist/components/sula-textarea.js +166 -0
- package/dist/components/sula-textarea.js.map +1 -0
- package/dist/components/sula-textfield.d.ts +11 -0
- package/dist/components/sula-textfield.js +171 -0
- package/dist/components/sula-textfield.js.map +1 -0
- package/dist/esm/{index-9bf8f892.js → index-aa1c5f36.js} +126 -6
- package/dist/esm/index-aa1c5f36.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{sula-avatar_3.entry.js → sula-avatar_9.entry.js} +647 -8
- package/dist/esm/sula-avatar_9.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/sula-avatar/sula-avatar.stories.d.ts +0 -1
- package/dist/types/components/sula-badge/model/sula-badge.model.d.ts +19 -0
- package/dist/types/components/sula-badge/sula-badge.d.ts +33 -0
- package/dist/types/components/sula-badge/sula-badge.stories.d.ts +65 -0
- package/dist/types/components/sula-button/sula-button.stories.d.ts +2 -0
- package/dist/types/components/sula-checkbox/model/sula-checkbox.model.d.ts +4 -0
- package/dist/types/components/sula-checkbox/sula-checkbox.d.ts +42 -0
- package/dist/types/components/sula-checkbox/sula-checkbox.stories.d.ts +73 -0
- package/dist/types/components/sula-icon/sula-icon.stories.d.ts +5 -2
- package/dist/types/components/sula-switch/model/sula-switch.model.d.ts +4 -0
- package/dist/types/components/sula-switch/sula-switch.d.ts +41 -0
- package/dist/types/components/sula-switch/sula-switch.stories.d.ts +72 -0
- package/dist/types/components/sula-tag/model/sula-tag.model.d.ts +23 -0
- package/dist/types/components/sula-tag/sula-tag.d.ts +33 -0
- package/dist/types/components/sula-tag/sula-tag.stories.d.ts +82 -0
- package/dist/types/components/sula-textarea/model/sula-textarea.model.d.ts +4 -0
- package/dist/types/components/sula-textarea/sula-textarea.d.ts +65 -0
- package/dist/types/components/sula-textarea/sula-textarea.stories.d.ts +98 -0
- package/dist/types/components/sula-textfield/model/sula-textfield.model.d.ts +8 -0
- package/dist/types/components/sula-textfield/sula-textfield.d.ts +74 -0
- package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +108 -0
- package/dist/types/components.d.ts +510 -0
- package/dist/webcomponents/{p-82d7a024.entry.js → p-1c8457aa.entry.js} +917 -64
- package/dist/webcomponents/p-1c8457aa.entry.js.map +1 -0
- package/dist/webcomponents/{p-cca32e44.js → p-5a36af0f.js} +343 -220
- package/dist/webcomponents/p-5a36af0f.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +68 -13
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/package.json +21 -13
- package/readme.md +36 -18
- package/dist/cjs/index-7973b779.js.map +0 -1
- package/dist/cjs/sula-avatar_3.cjs.entry.js.map +0 -1
- package/dist/components/p-d3ba6302.js.map +0 -1
- package/dist/esm/index-9bf8f892.js.map +0 -1
- package/dist/esm/sula-avatar_3.entry.js.map +0 -1
- package/dist/webcomponents/p-82d7a024.entry.js.map +0 -1
- package/dist/webcomponents/p-cca32e44.js.map +0 -1
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SulaTextareaStatus } from "./model/sula-textarea.model";
|
|
3
|
+
export class SulaTextarea {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* The textarea status
|
|
7
|
+
*/
|
|
8
|
+
this.status = SulaTextareaStatus.Default;
|
|
9
|
+
/**
|
|
10
|
+
* The textarea rows (height)
|
|
11
|
+
*/
|
|
12
|
+
this.rows = 4;
|
|
13
|
+
this.isActive = false;
|
|
14
|
+
this.textValue = '';
|
|
15
|
+
this.textareaIsFocused = false;
|
|
16
|
+
this.labelAnimationClass = '';
|
|
17
|
+
this.handleTextareaClick = () => {
|
|
18
|
+
if (this.disabled)
|
|
19
|
+
return;
|
|
20
|
+
this.setLabelUp();
|
|
21
|
+
this.focusOnTextarea();
|
|
22
|
+
};
|
|
23
|
+
this.handleTextareaChanges = (event) => {
|
|
24
|
+
const newValue = event.target.value;
|
|
25
|
+
this.textValue = newValue;
|
|
26
|
+
this.value = newValue;
|
|
27
|
+
if (newValue.length > 0 || this.textareaIsFocused) {
|
|
28
|
+
this.setLabelUp();
|
|
29
|
+
}
|
|
30
|
+
this.valueChanged.emit(newValue);
|
|
31
|
+
};
|
|
32
|
+
this.handleFocus = () => {
|
|
33
|
+
if (this.disabled)
|
|
34
|
+
return;
|
|
35
|
+
this.setLabelUp();
|
|
36
|
+
this.focusOnTextarea();
|
|
37
|
+
};
|
|
38
|
+
this.handleBlur = () => {
|
|
39
|
+
if (!this.textValue || this.textValue.trim().length === 0) {
|
|
40
|
+
this.setLabelDown();
|
|
41
|
+
}
|
|
42
|
+
this.focusedOut.emit();
|
|
43
|
+
this.textareaIsFocused = false;
|
|
44
|
+
};
|
|
45
|
+
this.handleTextareaFocus = () => {
|
|
46
|
+
this.focusedOn.emit();
|
|
47
|
+
this.textareaIsFocused = true;
|
|
48
|
+
this.setLabelUp();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
handleClick(event) {
|
|
52
|
+
if (!this.node)
|
|
53
|
+
return;
|
|
54
|
+
const clickInside = this.node.contains(event.target);
|
|
55
|
+
if (!clickInside && (!this.textValue || this.textValue.trim().length === 0)) {
|
|
56
|
+
this.setLabelDown();
|
|
57
|
+
this.focusedOut.emit();
|
|
58
|
+
this.textareaIsFocused = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
focusOnTextarea() {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.textareaElement.focus();
|
|
64
|
+
}, 0);
|
|
65
|
+
}
|
|
66
|
+
componentWillLoad() {
|
|
67
|
+
if (this.value && this.value.trim().length > 0) {
|
|
68
|
+
this.textValue = this.value;
|
|
69
|
+
this.isActive = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
setLabelUp() {
|
|
73
|
+
if (!this.isActive) {
|
|
74
|
+
this.labelAnimationClass = 'label-up';
|
|
75
|
+
this.isActive = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
setLabelDown() {
|
|
79
|
+
if (this.isActive && (!this.textValue || this.textValue.trim().length === 0)) {
|
|
80
|
+
this.labelAnimationClass = 'label-down';
|
|
81
|
+
this.isActive = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
const containerHeight = this.rows * 24 + 48;
|
|
86
|
+
return (h(Host, { key: '69db08ba2dfa48ab4972febe5fb1ece24574c0d1', ref: node => (this.node = node) }, h("div", { key: '2aa2f346436687068696e73f9a8a4d89b24d69ec' }, h("div", { key: '35c9c074790112d6622b032f0dff0f54c99ab7f8', id: "textarea-container", class: {
|
|
87
|
+
'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,
|
|
88
|
+
'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,
|
|
89
|
+
'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
90
|
+
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
91
|
+
'bg-surface-body border-line-input cursor-text': !this.disabled,
|
|
92
|
+
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: 'fe14082916a84da099bfc0798a10eee16169b9f7', class: {
|
|
93
|
+
'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,
|
|
94
|
+
'text-sm top-12 left-16': this.isActive,
|
|
95
|
+
'text-base top-16 left-12': !this.isActive,
|
|
96
|
+
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
97
|
+
'text-text-disabled': this.disabled,
|
|
98
|
+
'bg-surface-body': !this.disabled && this.isActive,
|
|
99
|
+
[this.labelAnimationClass]: true,
|
|
100
|
+
}, style: this.isActive ? { padding: '0 4px', marginLeft: '-4px' } : {} }, this.label), h("textarea", { key: 'a0a611ffc887e3b5a751e93bd994feb4f63a0ad6', ref: node => (this.textareaElement = node), placeholder: this.isActive ? this.placeholder : '', rows: this.rows, maxLength: this.maxLength, disabled: this.disabled, class: {
|
|
101
|
+
'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,
|
|
102
|
+
'pt-6': this.isActive,
|
|
103
|
+
'pt-0': !this.isActive,
|
|
104
|
+
'text-text-primary': !this.disabled,
|
|
105
|
+
'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,
|
|
106
|
+
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: 'a80df9745209ff2116815600e8077ab0c81dc122', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: '0882feb0b690fd6b56ea8911f1ddea994ef27228', id: "textarea-help-text", class: {
|
|
107
|
+
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
108
|
+
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
109
|
+
'text-text-disabled': this.disabled,
|
|
110
|
+
} }, this.helpText)), this.maxLength && (h("div", { key: '2f4150bec1a2cff4e484b35f6c92d5ee90791a6c', id: "max-length-container", class: {
|
|
111
|
+
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
112
|
+
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
113
|
+
'text-text-disabled': this.disabled,
|
|
114
|
+
} }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
|
|
115
|
+
}
|
|
116
|
+
static get is() { return "sula-textarea"; }
|
|
117
|
+
static get encapsulation() { return "shadow"; }
|
|
118
|
+
static get originalStyleUrls() {
|
|
119
|
+
return {
|
|
120
|
+
"$": ["sula-textarea.scss"]
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
static get styleUrls() {
|
|
124
|
+
return {
|
|
125
|
+
"$": ["sula-textarea.css"]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
static get properties() {
|
|
129
|
+
return {
|
|
130
|
+
"value": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": true,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": true,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "Value for the textarea."
|
|
143
|
+
},
|
|
144
|
+
"getter": false,
|
|
145
|
+
"setter": false,
|
|
146
|
+
"attribute": "value",
|
|
147
|
+
"reflect": false
|
|
148
|
+
},
|
|
149
|
+
"status": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"mutable": true,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "SulaTextareaStatus",
|
|
154
|
+
"resolved": "SulaTextareaStatus.Default | SulaTextareaStatus.Error",
|
|
155
|
+
"references": {
|
|
156
|
+
"SulaTextareaStatus": {
|
|
157
|
+
"location": "import",
|
|
158
|
+
"path": "./model/sula-textarea.model",
|
|
159
|
+
"id": "src/components/sula-textarea/model/sula-textarea.model.ts::SulaTextareaStatus"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": "The textarea status"
|
|
168
|
+
},
|
|
169
|
+
"getter": false,
|
|
170
|
+
"setter": false,
|
|
171
|
+
"attribute": "status",
|
|
172
|
+
"reflect": false,
|
|
173
|
+
"defaultValue": "SulaTextareaStatus.Default"
|
|
174
|
+
},
|
|
175
|
+
"label": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "string",
|
|
180
|
+
"resolved": "string",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": "The textarea label"
|
|
188
|
+
},
|
|
189
|
+
"getter": false,
|
|
190
|
+
"setter": false,
|
|
191
|
+
"attribute": "label",
|
|
192
|
+
"reflect": false
|
|
193
|
+
},
|
|
194
|
+
"placeholder": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"mutable": false,
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "string",
|
|
199
|
+
"resolved": "string",
|
|
200
|
+
"references": {}
|
|
201
|
+
},
|
|
202
|
+
"required": false,
|
|
203
|
+
"optional": false,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "The textarea placeholder"
|
|
207
|
+
},
|
|
208
|
+
"getter": false,
|
|
209
|
+
"setter": false,
|
|
210
|
+
"attribute": "placeholder",
|
|
211
|
+
"reflect": false
|
|
212
|
+
},
|
|
213
|
+
"disabled": {
|
|
214
|
+
"type": "boolean",
|
|
215
|
+
"mutable": true,
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "boolean",
|
|
218
|
+
"resolved": "boolean",
|
|
219
|
+
"references": {}
|
|
220
|
+
},
|
|
221
|
+
"required": false,
|
|
222
|
+
"optional": false,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "The textarea is disabled"
|
|
226
|
+
},
|
|
227
|
+
"getter": false,
|
|
228
|
+
"setter": false,
|
|
229
|
+
"attribute": "disabled",
|
|
230
|
+
"reflect": false
|
|
231
|
+
},
|
|
232
|
+
"helpText": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"mutable": false,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "string",
|
|
237
|
+
"resolved": "string",
|
|
238
|
+
"references": {}
|
|
239
|
+
},
|
|
240
|
+
"required": false,
|
|
241
|
+
"optional": true,
|
|
242
|
+
"docs": {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": "The help text for textarea"
|
|
245
|
+
},
|
|
246
|
+
"getter": false,
|
|
247
|
+
"setter": false,
|
|
248
|
+
"attribute": "help-text",
|
|
249
|
+
"reflect": false
|
|
250
|
+
},
|
|
251
|
+
"maxLength": {
|
|
252
|
+
"type": "number",
|
|
253
|
+
"mutable": false,
|
|
254
|
+
"complexType": {
|
|
255
|
+
"original": "number",
|
|
256
|
+
"resolved": "number",
|
|
257
|
+
"references": {}
|
|
258
|
+
},
|
|
259
|
+
"required": false,
|
|
260
|
+
"optional": true,
|
|
261
|
+
"docs": {
|
|
262
|
+
"tags": [],
|
|
263
|
+
"text": "The textarea max length"
|
|
264
|
+
},
|
|
265
|
+
"getter": false,
|
|
266
|
+
"setter": false,
|
|
267
|
+
"attribute": "max-length",
|
|
268
|
+
"reflect": false
|
|
269
|
+
},
|
|
270
|
+
"rows": {
|
|
271
|
+
"type": "number",
|
|
272
|
+
"mutable": false,
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "number",
|
|
275
|
+
"resolved": "number",
|
|
276
|
+
"references": {}
|
|
277
|
+
},
|
|
278
|
+
"required": false,
|
|
279
|
+
"optional": false,
|
|
280
|
+
"docs": {
|
|
281
|
+
"tags": [],
|
|
282
|
+
"text": "The textarea rows (height)"
|
|
283
|
+
},
|
|
284
|
+
"getter": false,
|
|
285
|
+
"setter": false,
|
|
286
|
+
"attribute": "rows",
|
|
287
|
+
"reflect": false,
|
|
288
|
+
"defaultValue": "4"
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
static get states() {
|
|
293
|
+
return {
|
|
294
|
+
"isActive": {},
|
|
295
|
+
"textValue": {},
|
|
296
|
+
"textareaIsFocused": {},
|
|
297
|
+
"labelAnimationClass": {}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
static get events() {
|
|
301
|
+
return [{
|
|
302
|
+
"method": "valueChanged",
|
|
303
|
+
"name": "valueChanged",
|
|
304
|
+
"bubbles": true,
|
|
305
|
+
"cancelable": true,
|
|
306
|
+
"composed": true,
|
|
307
|
+
"docs": {
|
|
308
|
+
"tags": [],
|
|
309
|
+
"text": "Event emitted when textarea value changes."
|
|
310
|
+
},
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "string",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {}
|
|
315
|
+
}
|
|
316
|
+
}, {
|
|
317
|
+
"method": "focusedOn",
|
|
318
|
+
"name": "focusedOn",
|
|
319
|
+
"bubbles": true,
|
|
320
|
+
"cancelable": true,
|
|
321
|
+
"composed": true,
|
|
322
|
+
"docs": {
|
|
323
|
+
"tags": [],
|
|
324
|
+
"text": "Event emitted when textarea is focused."
|
|
325
|
+
},
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "void",
|
|
328
|
+
"resolved": "void",
|
|
329
|
+
"references": {}
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
"method": "focusedOut",
|
|
333
|
+
"name": "focusedOut",
|
|
334
|
+
"bubbles": true,
|
|
335
|
+
"cancelable": true,
|
|
336
|
+
"composed": true,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": "Event emitted when textarea is focused out."
|
|
340
|
+
},
|
|
341
|
+
"complexType": {
|
|
342
|
+
"original": "void",
|
|
343
|
+
"resolved": "void",
|
|
344
|
+
"references": {}
|
|
345
|
+
}
|
|
346
|
+
}];
|
|
347
|
+
}
|
|
348
|
+
static get listeners() {
|
|
349
|
+
return [{
|
|
350
|
+
"name": "click",
|
|
351
|
+
"method": "handleClick",
|
|
352
|
+
"target": "document",
|
|
353
|
+
"capture": false,
|
|
354
|
+
"passive": false
|
|
355
|
+
}];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=sula-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-textarea.js","sourceRoot":"","sources":["../../../src/components/sula-textarea/sula-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAOjE,MAAM,OAAO,YAAY;IALzB;QAYE;;WAEG;QACsB,WAAM,GAAuB,kBAAkB,CAAC,OAAO,CAAC;QA2BjF;;WAEG;QACK,SAAI,GAAW,CAAC,CAAC;QAqBzB,aAAQ,GAAG,KAAK,CAAC;QAGjB,cAAS,GAAW,EAAE,CAAC;QAGvB,sBAAiB,GAAG,KAAK,CAAC;QAG1B,wBAAmB,GAAG,EAAE,CAAC;QA8CzB,wBAAmB,GAAG,GAAG,EAAE;YACzB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,UAAU,EAA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ACP;oBACA,IAAI,CAAC,SAAS,IAAI,CACjB,4DACE,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE;4BACL,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,kBAAkB,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ;4BACjF,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,kBAAkB,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ;4BACjF,oBAAoB,EAAE,IAAI,CAAC,QAAQ;yBACpC;wBAEA,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;;wBAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaTextareaStatus } from './model/sula-textarea.model';\n\n@Component({\n tag: 'sula-textarea',\n styleUrl: 'sula-textarea.scss',\n shadow: true,\n})\nexport class SulaTextarea {\n /**\n * Value for the textarea.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * The textarea status\n */\n @Prop({ mutable: true }) status: SulaTextareaStatus = SulaTextareaStatus.Default;\n\n /**\n * The textarea label\n */\n @Prop() label: string;\n\n /**\n * The textarea placeholder\n */\n @Prop() placeholder: string;\n\n /**\n * The textarea is disabled\n */\n @Prop({ mutable: true }) disabled: boolean;\n\n /**\n * The help text for textarea\n */\n @Prop() helpText?: string;\n\n /**\n * The textarea max length\n */\n @Prop() maxLength?: number;\n\n /**\n * The textarea rows (height)\n */\n @Prop() rows: number = 4;\n\n /**\n * Event emitted when textarea value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when textarea is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when textarea is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n isActive = false;\n\n @State()\n textValue: string = '';\n\n @State()\n textareaIsFocused = false;\n\n @State()\n labelAnimationClass = '';\n\n textareaElement: HTMLTextAreaElement;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside && (!this.textValue || this.textValue.trim().length === 0)) {\n this.setLabelDown();\n this.focusedOut.emit();\n this.textareaIsFocused = false;\n }\n }\n\n focusOnTextarea() {\n setTimeout(() => {\n this.textareaElement.focus();\n }, 0);\n }\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n this.isActive = true;\n }\n }\n\n setLabelUp() {\n if (!this.isActive) {\n this.labelAnimationClass = 'label-up';\n this.isActive = true;\n }\n }\n\n setLabelDown() {\n if (this.isActive && (!this.textValue || this.textValue.trim().length === 0)) {\n this.labelAnimationClass = 'label-down';\n this.isActive = false;\n }\n }\n\n handleTextareaClick = () => {\n if (this.disabled) return;\n this.setLabelUp();\n this.focusOnTextarea();\n };\n\n handleTextareaChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLTextAreaElement).value;\n this.textValue = newValue;\n this.value = newValue;\n\n if (newValue.length > 0 || this.textareaIsFocused) {\n this.setLabelUp();\n }\n\n this.valueChanged.emit(newValue);\n };\n\n handleFocus = () => {\n if (this.disabled) return;\n\n this.setLabelUp();\n this.focusOnTextarea();\n };\n\n handleBlur = () => {\n if (!this.textValue || this.textValue.trim().length === 0) {\n this.setLabelDown();\n }\n\n this.focusedOut.emit();\n this.textareaIsFocused = false;\n };\n\n handleTextareaFocus = () => {\n this.focusedOn.emit();\n this.textareaIsFocused = true;\n this.setLabelUp();\n };\n\n render() {\n const containerHeight = this.rows * 24 + 48;\n\n return (\n <Host ref={node => (this.node = node)}>\n <div>\n <div\n id=\"textarea-container\"\n class={{\n 'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,\n 'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,\n 'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,\n 'bg-surface-body border-line-input cursor-text': !this.disabled,\n }}\n style={{ height: `${containerHeight}px` }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onClick={this.handleTextareaClick}\n >\n <label\n class={{\n 'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,\n 'text-sm top-12 left-16': this.isActive,\n 'text-base top-16 left-12': !this.isActive,\n 'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),\n 'text-text-disabled': this.disabled,\n 'bg-surface-body': !this.disabled && this.isActive,\n [this.labelAnimationClass]: true,\n }}\n style={this.isActive ? { padding: '0 4px', marginLeft: '-4px' } : {}}\n >\n {this.label}\n </label>\n\n <textarea\n ref={node => (this.textareaElement = node)}\n placeholder={this.isActive ? this.placeholder : ''}\n rows={this.rows}\n maxLength={this.maxLength}\n disabled={this.disabled}\n class={{\n 'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,\n 'pt-6': this.isActive,\n 'pt-0': !this.isActive,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,\n }}\n onInput={this.handleTextareaChanges}\n onFocus={this.handleTextareaFocus}\n onBlur={this.handleBlur}\n value={this.textValue}\n />\n </div>\n\n {(this.helpText || this.maxLength) && (\n <div class=\"flex justify-between items-center px-16 mt-4 text-sm\">\n {this.helpText && (\n <div\n id=\"textarea-help-text\"\n class={{\n 'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,\n 'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.helpText}\n </div>\n )}\n {this.maxLength && (\n <div\n id=\"max-length-container\"\n class={{\n 'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,\n 'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.textValue ? this.textValue.length : 0}/{this.maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { SulaTextareaStatus } from "./model/sula-textarea.model";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/sula-textarea',
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
argTypes: {
|
|
6
|
+
value: {
|
|
7
|
+
control: 'text',
|
|
8
|
+
defaultValue: '',
|
|
9
|
+
description: 'Value for the textarea',
|
|
10
|
+
type: {
|
|
11
|
+
required: false,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
status: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: Object.values(SulaTextareaStatus),
|
|
17
|
+
defaultValue: SulaTextareaStatus.Default,
|
|
18
|
+
description: 'The textarea status',
|
|
19
|
+
type: {
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
defaultValue: 'Label',
|
|
26
|
+
description: 'The textarea label',
|
|
27
|
+
type: {
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
placeholder: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
defaultValue: 'Placeholder',
|
|
34
|
+
description: 'The textarea placeholder',
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
defaultValue: false,
|
|
42
|
+
description: 'The textarea is disabled',
|
|
43
|
+
type: {
|
|
44
|
+
required: false,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
helpText: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
defaultValue: '',
|
|
50
|
+
description: 'The help text for textarea',
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
maxLength: {
|
|
56
|
+
control: 'number',
|
|
57
|
+
defaultValue: 0,
|
|
58
|
+
description: 'The textarea max length',
|
|
59
|
+
type: {
|
|
60
|
+
required: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
rows: {
|
|
64
|
+
control: 'number',
|
|
65
|
+
defaultValue: 4,
|
|
66
|
+
description: 'The textarea rows (height)',
|
|
67
|
+
type: {
|
|
68
|
+
required: false,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
valueChanged: {
|
|
72
|
+
action: 'valueChanged',
|
|
73
|
+
description: 'Evento emitido quando o valor do textarea muda',
|
|
74
|
+
},
|
|
75
|
+
focusedOn: {
|
|
76
|
+
action: 'focusedOn',
|
|
77
|
+
description: 'Evento emitido quando o textarea recebe foco',
|
|
78
|
+
},
|
|
79
|
+
focusedOut: {
|
|
80
|
+
action: 'focusedOut',
|
|
81
|
+
description: 'Evento emitido quando o textarea perde foco',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const Template = args => {
|
|
86
|
+
const container = document.createElement('div');
|
|
87
|
+
container.style.maxWidth = '400px';
|
|
88
|
+
container.style.margin = '20px';
|
|
89
|
+
const el = document.createElement('sula-textarea');
|
|
90
|
+
if (args.value)
|
|
91
|
+
el.setAttribute('value', args.value);
|
|
92
|
+
el.setAttribute('status', args.status);
|
|
93
|
+
el.setAttribute('label', args.label);
|
|
94
|
+
el.setAttribute('placeholder', args.placeholder);
|
|
95
|
+
el.setAttribute('disabled', args.disabled.toString());
|
|
96
|
+
el.setAttribute('rows', args.rows.toString());
|
|
97
|
+
if (args.helpText)
|
|
98
|
+
el.setAttribute('help-text', args.helpText);
|
|
99
|
+
if (args.maxLength > 0)
|
|
100
|
+
el.setAttribute('max-length', args.maxLength.toString());
|
|
101
|
+
el.addEventListener('valueChanged', args.valueChanged);
|
|
102
|
+
el.addEventListener('focusedOn', args.focusedOn);
|
|
103
|
+
el.addEventListener('focusedOut', args.focusedOut);
|
|
104
|
+
container.appendChild(el);
|
|
105
|
+
return container;
|
|
106
|
+
};
|
|
107
|
+
export const Default = Template.bind({});
|
|
108
|
+
Default.args = {
|
|
109
|
+
value: '',
|
|
110
|
+
status: SulaTextareaStatus.Default,
|
|
111
|
+
label: 'Comentário',
|
|
112
|
+
placeholder: 'Digite seu comentário',
|
|
113
|
+
disabled: false,
|
|
114
|
+
helpText: '',
|
|
115
|
+
maxLength: 0,
|
|
116
|
+
rows: 4,
|
|
117
|
+
};
|
|
118
|
+
export const WithValue = Template.bind({});
|
|
119
|
+
WithValue.args = Object.assign(Object.assign({}, Default.args), { value: 'Este é um texto de exemplo já preenchido no textarea.', label: 'Descrição', placeholder: 'Digite uma descrição' });
|
|
120
|
+
export const WithHelpText = Template.bind({});
|
|
121
|
+
WithHelpText.args = Object.assign(Object.assign({}, Default.args), { label: 'Feedback', placeholder: 'Compartilhe seu feedback', helpText: 'Sua opinião é muito importante para nós' });
|
|
122
|
+
export const WithMaxLength = Template.bind({});
|
|
123
|
+
WithMaxLength.args = Object.assign(Object.assign({}, Default.args), { label: 'Mensagem', placeholder: 'Digite sua mensagem', maxLength: 200, helpText: 'Máximo de 200 caracteres' });
|
|
124
|
+
export const LargeTextarea = Template.bind({});
|
|
125
|
+
LargeTextarea.args = Object.assign(Object.assign({}, Default.args), { label: 'Artigo', placeholder: 'Escreva seu artigo aqui', rows: 8, helpText: 'Área maior para textos longos' });
|
|
126
|
+
export const SmallTextarea = Template.bind({});
|
|
127
|
+
SmallTextarea.args = Object.assign(Object.assign({}, Default.args), { label: 'Nota rápida', placeholder: 'Adicione uma nota', rows: 2, helpText: 'Área compacta para notas curtas' });
|
|
128
|
+
export const Error = Template.bind({});
|
|
129
|
+
Error.args = Object.assign(Object.assign({}, Default.args), { status: SulaTextareaStatus.Error, label: 'Comentário obrigatório', placeholder: 'Digite seu comentário', helpText: 'Este campo é obrigatório' });
|
|
130
|
+
export const Disabled = Template.bind({});
|
|
131
|
+
Disabled.args = Object.assign(Object.assign({}, Default.args), { disabled: true, label: 'Campo desabilitado', value: 'Este textarea está desabilitado', helpText: 'Este campo não pode ser editado' });
|
|
132
|
+
export const WithMaxLengthAndValue = Template.bind({});
|
|
133
|
+
WithMaxLengthAndValue.args = Object.assign(Object.assign({}, Default.args), { label: 'Resumo', placeholder: 'Digite um resumo', maxLength: 100, value: 'Este é um exemplo de texto que mostra como o contador de caracteres funciona.', helpText: 'Mantenha o resumo conciso' });
|
|
134
|
+
export const ErrorWithMaxLength = Template.bind({});
|
|
135
|
+
ErrorWithMaxLength.args = Object.assign(Object.assign({}, Default.args), { status: SulaTextareaStatus.Error, label: 'Descrição do problema', placeholder: 'Descreva o problema', maxLength: 150, helpText: 'Descrição muito longa. Reduza o texto.', value: 'Esta é uma descrição muito longa que excede o limite de caracteres permitido para este campo, demonstrando o estado de erro quando há muito texto.' });
|
|
136
|
+
export const CompleteExample = Template.bind({});
|
|
137
|
+
CompleteExample.args = Object.assign(Object.assign({}, Default.args), { label: 'Avaliação do produto', placeholder: 'Conte-nos sua experiência com o produto', maxLength: 500, rows: 6, helpText: 'Sua avaliação nos ajuda a melhorar nossos produtos', value: 'Produto excelente! A qualidade superou minhas expectativas.' });
|
|
138
|
+
//# sourceMappingURL=sula-textarea.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-textarea.stories.js","sourceRoot":"","sources":["../../../src/components/sula-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AAE,IAAI,EACd,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,iCAAiC,EACxC,QAAQ,EAAE,iCAAiC,GAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvD,qBAAqB,CAAC,IAAI,mCACrB,OAAO,CAAC,IAAI,KACf,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,kBAAkB,EAC/B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,+EAA+E,EACtF,QAAQ,EAAE,2BAA2B,GACtC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,mCAClB,OAAO,CAAC,IAAI,KACf,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAChC,KAAK,EAAE,uBAAuB,EAC9B,WAAW,EAAE,qBAAqB,EAClC,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,wCAAwC,EAClD,KAAK,EAAE,oJAAoJ,GAC5J,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjD,eAAe,CAAC,IAAI,mCACf,OAAO,CAAC,IAAI,KACf,KAAK,EAAE,sBAAsB,EAC7B,WAAW,EAAE,yCAAyC,EACtD,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,oDAAoD,EAC9D,KAAK,EAAE,6DAA6D,GACrE,CAAC","sourcesContent":["import { SulaTextareaStatus } from './model/sula-textarea.model';\n\nexport default {\n title: 'Components/sula-textarea',\n tags: ['autodocs'],\n argTypes: {\n value: {\n control: 'text',\n defaultValue: '',\n description: 'Value for the textarea',\n type: {\n required: false,\n },\n },\n status: {\n control: { type: 'select' },\n options: Object.values(SulaTextareaStatus),\n defaultValue: SulaTextareaStatus.Default,\n description: 'The textarea status',\n type: {\n required: false,\n },\n },\n label: {\n control: 'text',\n defaultValue: 'Label',\n description: 'The textarea label',\n type: {\n required: false,\n },\n },\n placeholder: {\n control: 'text',\n defaultValue: 'Placeholder',\n description: 'The textarea placeholder',\n type: {\n required: false,\n },\n },\n disabled: {\n control: 'boolean',\n defaultValue: false,\n description: 'The textarea is disabled',\n type: {\n required: false,\n },\n },\n helpText: {\n control: 'text',\n defaultValue: '',\n description: 'The help text for textarea',\n type: {\n required: false,\n },\n },\n maxLength: {\n control: 'number',\n defaultValue: 0,\n description: 'The textarea max length',\n type: {\n required: false,\n },\n },\n rows: {\n control: 'number',\n defaultValue: 4,\n description: 'The textarea rows (height)',\n type: {\n required: false,\n },\n },\n valueChanged: {\n action: 'valueChanged',\n description: 'Evento emitido quando o valor do textarea muda',\n },\n focusedOn: {\n action: 'focusedOn',\n description: 'Evento emitido quando o textarea recebe foco',\n },\n focusedOut: {\n action: 'focusedOut',\n description: 'Evento emitido quando o textarea perde foco',\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.maxWidth = '400px';\n container.style.margin = '20px';\n\n const el = document.createElement('sula-textarea');\n\n if (args.value) el.setAttribute('value', args.value);\n el.setAttribute('status', args.status);\n el.setAttribute('label', args.label);\n el.setAttribute('placeholder', args.placeholder);\n el.setAttribute('disabled', args.disabled.toString());\n el.setAttribute('rows', args.rows.toString());\n\n if (args.helpText) el.setAttribute('help-text', args.helpText);\n if (args.maxLength > 0) el.setAttribute('max-length', args.maxLength.toString());\n\n el.addEventListener('valueChanged', args.valueChanged);\n el.addEventListener('focusedOn', args.focusedOn);\n el.addEventListener('focusedOut', args.focusedOut);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n value: '',\n status: SulaTextareaStatus.Default,\n label: 'Comentário',\n placeholder: 'Digite seu comentário',\n disabled: false,\n helpText: '',\n maxLength: 0,\n rows: 4,\n};\n\nexport const WithValue = Template.bind({});\nWithValue.args = {\n ...Default.args,\n value: 'Este é um texto de exemplo já preenchido no textarea.',\n label: 'Descrição',\n placeholder: 'Digite uma descrição',\n};\n\nexport const WithHelpText = Template.bind({});\nWithHelpText.args = {\n ...Default.args,\n label: 'Feedback',\n placeholder: 'Compartilhe seu feedback',\n helpText: 'Sua opinião é muito importante para nós',\n};\n\nexport const WithMaxLength = Template.bind({});\nWithMaxLength.args = {\n ...Default.args,\n label: 'Mensagem',\n placeholder: 'Digite sua mensagem',\n maxLength: 200,\n helpText: 'Máximo de 200 caracteres',\n};\n\nexport const LargeTextarea = Template.bind({});\nLargeTextarea.args = {\n ...Default.args,\n label: 'Artigo',\n placeholder: 'Escreva seu artigo aqui',\n rows: 8,\n helpText: 'Área maior para textos longos',\n};\n\nexport const SmallTextarea = Template.bind({});\nSmallTextarea.args = {\n ...Default.args,\n label: 'Nota rápida',\n placeholder: 'Adicione uma nota',\n rows: 2,\n helpText: 'Área compacta para notas curtas',\n};\n\nexport const Error = Template.bind({});\nError.args = {\n ...Default.args,\n status: SulaTextareaStatus.Error,\n label: 'Comentário obrigatório',\n placeholder: 'Digite seu comentário',\n helpText: 'Este campo é obrigatório',\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n ...Default.args,\n disabled: true,\n label: 'Campo desabilitado',\n value: 'Este textarea está desabilitado',\n helpText: 'Este campo não pode ser editado',\n};\n\nexport const WithMaxLengthAndValue = Template.bind({});\nWithMaxLengthAndValue.args = {\n ...Default.args,\n label: 'Resumo',\n placeholder: 'Digite um resumo',\n maxLength: 100,\n value: 'Este é um exemplo de texto que mostra como o contador de caracteres funciona.',\n helpText: 'Mantenha o resumo conciso',\n};\n\nexport const ErrorWithMaxLength = Template.bind({});\nErrorWithMaxLength.args = {\n ...Default.args,\n status: SulaTextareaStatus.Error,\n label: 'Descrição do problema',\n placeholder: 'Descreva o problema',\n maxLength: 150,\n helpText: 'Descrição muito longa. Reduza o texto.',\n value: 'Esta é uma descrição muito longa que excede o limite de caracteres permitido para este campo, demonstrando o estado de erro quando há muito texto.',\n};\n\nexport const CompleteExample = Template.bind({});\nCompleteExample.args = {\n ...Default.args,\n label: 'Avaliação do produto',\n placeholder: 'Conte-nos sua experiência com o produto',\n maxLength: 500,\n rows: 6,\n helpText: 'Sua avaliação nos ajuda a melhorar nossos produtos',\n value: 'Produto excelente! A qualidade superou minhas expectativas.',\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var SulaTextfieldType;
|
|
2
|
+
(function (SulaTextfieldType) {
|
|
3
|
+
SulaTextfieldType["Text"] = "text";
|
|
4
|
+
SulaTextfieldType["Password"] = "password";
|
|
5
|
+
})(SulaTextfieldType || (SulaTextfieldType = {}));
|
|
6
|
+
export var SulaTextfieldStatus;
|
|
7
|
+
(function (SulaTextfieldStatus) {
|
|
8
|
+
SulaTextfieldStatus["Default"] = "default";
|
|
9
|
+
SulaTextfieldStatus["Error"] = "error";
|
|
10
|
+
})(SulaTextfieldStatus || (SulaTextfieldStatus = {}));
|
|
11
|
+
//# sourceMappingURL=sula-textfield.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-textfield.model.js","sourceRoot":"","sources":["../../../../src/components/sula-textfield/model/sula-textfield.model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,0CAAqB,CAAA;AACvB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,sCAAe,CAAA;AACjB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B","sourcesContent":["export enum SulaTextfieldType {\n Text = 'text',\n Password = 'password',\n}\n\nexport enum SulaTextfieldStatus {\n Default = 'default',\n Error = 'error',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.outline{outline-style:solid}:host{display:block}.button-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}.button-error{outline:2px solid var(--color-feedback-error)!important;outline-offset:2px!important}.from-down{animation:from-down .2s ease-in-out}.from-up{animation:from-up .2s ease-in-out}@keyframes from-down{0%{opacity:0;transform:translateY(75%)}to{opacity:1;transform:translateY(0)}}@keyframes from-up{0%{opacity:0;transform:translateY(-75%)}to{opacity:1;transform:translateY(0)}}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.static{position:static}.mt-4{margin-top:.25rem}.flex{display:flex}.hidden{display:none}.h-\[72px\]{height:72px}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-sm{border-radius:.75rem}.border{border-width:1px}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.px-16{padding-left:1rem;padding-right:1rem}.pr-12{padding-right:.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-feedback-error{color:var(--color-feedback-error)}.text-icon-disabled{color:var(--color-icon-disabled)}.text-icon-primary{color:var(--color-icon-primary)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.caret-brand-primary{caret-color:var(--color-brand-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}
|