@sankhyalabs/ezui 6.2.0-dev.3 → 6.2.0-dev.5

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.
Files changed (48) hide show
  1. package/dist/cjs/{app-globals-cdb08d04.js → app-globals-0a67e214.js} +3 -1
  2. package/dist/cjs/ez-classic-input.cjs.entry.js +318 -0
  3. package/dist/cjs/ez-classic-text-area.cjs.entry.js +86 -0
  4. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-list-item.cjs.entry.js +22 -0
  6. package/dist/cjs/ezui.cjs.js +2 -2
  7. package/dist/cjs/index-a7b0c73d.js +12 -0
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/collection/collection-manifest.json +3 -0
  10. package/dist/collection/components/ez-classic-input/ez-classic-input.css +140 -0
  11. package/dist/collection/components/ez-classic-input/ez-classic-input.js +547 -0
  12. package/dist/collection/components/ez-classic-input/interfaces/optionsSetFocus.js +1 -0
  13. package/dist/collection/components/ez-classic-input/utils/maskFormatter.js +194 -0
  14. package/dist/collection/components/ez-classic-text-area/ez-classic-text-area.css +179 -0
  15. package/dist/collection/components/ez-classic-text-area/ez-classic-text-area.js +479 -0
  16. package/dist/collection/components/ez-classic-text-area/interfaces/optionsSetFocus.js +1 -0
  17. package/dist/collection/components/ez-icon/ez-icon.css +23 -18
  18. package/dist/collection/components/ez-list-item/ez-list-item.css +61 -0
  19. package/dist/collection/components/ez-list-item/ez-list-item.js +78 -0
  20. package/dist/collection/global/app-init.js +3 -1
  21. package/dist/custom-elements/index.d.ts +18 -0
  22. package/dist/custom-elements/index.js +423 -7
  23. package/dist/esm/{app-globals-8c57b015.js → app-globals-8a94d86c.js} +3 -1
  24. package/dist/esm/ez-classic-input.entry.js +314 -0
  25. package/dist/esm/ez-classic-text-area.entry.js +82 -0
  26. package/dist/esm/ez-icon.entry.js +1 -1
  27. package/dist/esm/ez-list-item.entry.js +18 -0
  28. package/dist/esm/ezui.js +2 -2
  29. package/dist/esm/index-baa5e267.js +12 -0
  30. package/dist/esm/loader.js +2 -2
  31. package/dist/ezui/ezui.esm.js +1 -1
  32. package/dist/ezui/p-48effc69.entry.js +1 -0
  33. package/dist/ezui/p-b2b1a1a7.entry.js +1 -0
  34. package/dist/ezui/p-d6742c1e.entry.js +1 -0
  35. package/dist/ezui/p-e78e87f5.entry.js +1 -0
  36. package/dist/types/components/ez-classic-input/ez-classic-input.d.ts +78 -0
  37. package/dist/types/components/ez-classic-input/interfaces/optionsSetFocus.d.ts +4 -0
  38. package/dist/types/components/ez-classic-input/utils/maskFormatter.d.ts +30 -0
  39. package/dist/types/components/ez-classic-text-area/ez-classic-text-area.d.ts +61 -0
  40. package/dist/types/components/ez-classic-text-area/interfaces/optionsSetFocus.d.ts +4 -0
  41. package/dist/types/components/ez-list-item/ez-list-item.d.ts +9 -0
  42. package/dist/types/components.d.ts +401 -0
  43. package/package.json +1 -1
  44. package/react/components.d.ts +3 -0
  45. package/react/components.js +3 -0
  46. package/react/components.js.map +1 -1
  47. package/dist/ezui/p-7eb6115c.entry.js +0 -1
  48. /package/dist/ezui/{p-76ad2e26.js → p-07819d50.js} +0 -0
@@ -4,7 +4,9 @@ const index = require('./index-425b1f67.js');
4
4
 
5
5
  async function initializeApp() {
6
6
  await index.initI18n();
7
- console.log('Global initialization ez-ui completed!');
7
+ {
8
+ console.log('Global initialization ez-ui completed!');
9
+ }
8
10
  }
9
11
 
10
12
  const globalScripts = initializeApp;
@@ -0,0 +1,318 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+
8
+ class MaskFormatter {
9
+ constructor(mask) {
10
+ this.mask = mask;
11
+ this.maskChars = {
12
+ '#': (char) => /\d/.test(char),
13
+ 'U': (char) => /[a-zA-Z]/.test(char),
14
+ 'L': (char) => /[a-zA-Z]/.test(char),
15
+ 'A': (char) => /[a-zA-Z0-9]/.test(char),
16
+ '?': (char) => /[a-zA-Z]/.test(char),
17
+ '*': () => true
18
+ };
19
+ }
20
+ /**
21
+ * Formata a string de acordo com a máscara
22
+ * @param value String a ser formatada
23
+ * @returns String formatada
24
+ */
25
+ format(value) {
26
+ if (!value || !this.mask)
27
+ return value;
28
+ const cleanedValue = this.removeIncompatibleChars(value);
29
+ let formattedValue = '';
30
+ let valueIndex = 0;
31
+ let maskIndex = 0;
32
+ while (maskIndex < this.mask.length && valueIndex < cleanedValue.length) {
33
+ const maskChar = this.mask[maskIndex];
34
+ const inputChar = cleanedValue[valueIndex];
35
+ if (maskChar === "'") {
36
+ maskIndex++;
37
+ if (maskIndex < this.mask.length) {
38
+ formattedValue += this.mask[maskIndex];
39
+ maskIndex++;
40
+ }
41
+ continue;
42
+ }
43
+ if (this.maskChars[maskChar]) {
44
+ if (this.maskChars[maskChar](inputChar)) {
45
+ if (maskChar === 'U') {
46
+ formattedValue += inputChar.toUpperCase();
47
+ }
48
+ else if (maskChar === 'L') {
49
+ formattedValue += inputChar.toLowerCase();
50
+ }
51
+ else {
52
+ formattedValue += inputChar;
53
+ }
54
+ valueIndex++;
55
+ }
56
+ else {
57
+ valueIndex++;
58
+ continue;
59
+ }
60
+ }
61
+ else {
62
+ formattedValue += maskChar;
63
+ if (inputChar === maskChar) {
64
+ valueIndex++;
65
+ }
66
+ }
67
+ maskIndex++;
68
+ }
69
+ return formattedValue;
70
+ }
71
+ /**
72
+ * Remove caracteres que não são compatíveis com nenhuma posição da máscara
73
+ */
74
+ removeIncompatibleChars(value) {
75
+ let cleanValue = '';
76
+ for (let i = 0; i < value.length; i++) {
77
+ const char = value[i];
78
+ let isValidChar = false;
79
+ for (const maskRule in this.maskChars) {
80
+ if (this.maskChars[maskRule](char)) {
81
+ isValidChar = true;
82
+ break;
83
+ }
84
+ }
85
+ if (!isValidChar) {
86
+ for (let j = 0; j < this.mask.length; j++) {
87
+ if (this.mask[j] === char && !this.maskChars[this.mask[j]]) {
88
+ isValidChar = true;
89
+ break;
90
+ }
91
+ }
92
+ }
93
+ if (isValidChar) {
94
+ cleanValue += char;
95
+ }
96
+ }
97
+ return cleanValue;
98
+ }
99
+ /**
100
+ * Remove a máscara de uma string formatada
101
+ * @param formattedValue String formatada
102
+ * @returns String sem máscara
103
+ */
104
+ removeMask(formattedValue) {
105
+ if (!formattedValue || !this.mask)
106
+ return formattedValue;
107
+ let cleanValue = '';
108
+ let valueIndex = 0;
109
+ let maskIndex = 0;
110
+ while (valueIndex < formattedValue.length && maskIndex < this.mask.length) {
111
+ const maskChar = this.mask[maskIndex];
112
+ const inputChar = formattedValue[valueIndex];
113
+ if (maskChar === "'") {
114
+ maskIndex++;
115
+ if (maskIndex < this.mask.length) {
116
+ if (inputChar === this.mask[maskIndex]) {
117
+ valueIndex++;
118
+ }
119
+ maskIndex++;
120
+ }
121
+ continue;
122
+ }
123
+ if (this.maskChars[maskChar]) {
124
+ if (this.maskChars[maskChar](inputChar)) {
125
+ cleanValue += inputChar;
126
+ }
127
+ valueIndex++;
128
+ }
129
+ else {
130
+ if (inputChar === maskChar) {
131
+ valueIndex++;
132
+ }
133
+ }
134
+ maskIndex++;
135
+ }
136
+ while (valueIndex < formattedValue.length) {
137
+ const remainingChar = formattedValue[valueIndex];
138
+ if (/[a-zA-Z0-9]/.test(remainingChar)) {
139
+ cleanValue += remainingChar;
140
+ }
141
+ valueIndex++;
142
+ }
143
+ return cleanValue;
144
+ }
145
+ /**
146
+ * Retorna a máscara configurada
147
+ */
148
+ getMask() {
149
+ return this.mask;
150
+ }
151
+ /**
152
+ * Gera um placeholder baseado na máscara
153
+ * @returns String com placeholder gerado
154
+ */
155
+ generatePlaceholder() {
156
+ if (!this.mask)
157
+ return '';
158
+ let placeholder = '';
159
+ let maskIndex = 0;
160
+ while (maskIndex < this.mask.length) {
161
+ const maskChar = this.mask[maskIndex];
162
+ if (maskChar === "'") {
163
+ maskIndex++;
164
+ if (maskIndex < this.mask.length) {
165
+ placeholder += this.mask[maskIndex];
166
+ maskIndex++;
167
+ }
168
+ continue;
169
+ }
170
+ if (this.maskChars[maskChar]) {
171
+ switch (maskChar) {
172
+ case '#':
173
+ placeholder += '0';
174
+ break;
175
+ case 'U':
176
+ case 'L':
177
+ case '?':
178
+ placeholder += 'A';
179
+ break;
180
+ case 'A':
181
+ placeholder += 'A';
182
+ break;
183
+ case '~':
184
+ placeholder += '0';
185
+ break;
186
+ case '*':
187
+ placeholder += '_';
188
+ break;
189
+ default:
190
+ placeholder += '_';
191
+ break;
192
+ }
193
+ }
194
+ else {
195
+ placeholder += maskChar;
196
+ }
197
+ maskIndex++;
198
+ }
199
+ return placeholder;
200
+ }
201
+ }
202
+
203
+ const ezClassicInputCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:56px}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding:var(--space--16, 16px);box-sizing:border-box;gap:var(--space--10, 10px);margin:var(--space--4, 4px) var(--space--2, 2px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container,.input-container[data-state=\"default\"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state=\"success\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state=\"error\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state=\"warning\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled=\"true\"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled=\"true\"]>*{cursor:not-allowed}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:var(--line-height--20, 20px);color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}";
204
+
205
+ const EzClassicInput = class {
206
+ constructor(hostRef) {
207
+ index.registerInstance(this, hostRef);
208
+ this.ezChange = index.createEvent(this, "ezChange", 7);
209
+ this.ezBlur = index.createEvent(this, "ezBlur", 7);
210
+ this.iconClick = index.createEvent(this, "iconClick", 7);
211
+ this.type = 'text';
212
+ this.value = undefined;
213
+ this.label = undefined;
214
+ this.helpText = undefined;
215
+ this.placeholder = undefined;
216
+ this.enabled = true;
217
+ this.readonly = false;
218
+ this.name = undefined;
219
+ this.minlength = undefined;
220
+ this.maxlength = undefined;
221
+ this.leftIconName = undefined;
222
+ this.rightIconName = undefined;
223
+ this.rightIconTooltip = undefined;
224
+ this.leftIconTooltip = undefined;
225
+ this.state = "default";
226
+ this.leftIconClickable = false;
227
+ this.rightIconClickable = false;
228
+ this.mask = undefined;
229
+ this.emitMaskedValue = false;
230
+ }
231
+ /**
232
+ * Aplica o foco no campo.
233
+ */
234
+ async setFocus(option) {
235
+ if (option === null || option === void 0 ? void 0 : option.selectText) {
236
+ this._inputElem.select();
237
+ }
238
+ if (!(option === null || option === void 0 ? void 0 : option.preventScroll)) {
239
+ this._inputElem.scrollIntoView({ behavior: "smooth", block: "center" });
240
+ }
241
+ this._inputElem.focus({ preventScroll: true });
242
+ }
243
+ /**
244
+ * Remove o foco do campo.
245
+ */
246
+ async setBlur() {
247
+ this._inputElem.blur();
248
+ }
249
+ onInput(event) {
250
+ try {
251
+ const inputElement = event.target;
252
+ let inputValue = inputElement.value;
253
+ if (this._maskFormatter) {
254
+ const formattedValue = this._maskFormatter.format(inputValue);
255
+ const cleanValue = this._maskFormatter.removeMask(formattedValue);
256
+ inputElement.value = formattedValue;
257
+ this.value = cleanValue;
258
+ const emitValue = this.emitMaskedValue ? formattedValue : cleanValue;
259
+ this.ezChange.emit(emitValue);
260
+ }
261
+ else {
262
+ this.value = inputValue;
263
+ this.ezChange.emit(inputValue);
264
+ }
265
+ }
266
+ catch (error) {
267
+ console.error("Error processing input event:", error);
268
+ }
269
+ }
270
+ onBlur() {
271
+ this.ezBlur.emit(this.value);
272
+ }
273
+ handleIconClick(event, icon) {
274
+ if (!this.enabled) {
275
+ return;
276
+ }
277
+ if ((icon === "left" && !this.leftIconClickable) || (icon === "right" && !this.rightIconClickable)) {
278
+ this.setFocus({ preventScroll: true });
279
+ return;
280
+ }
281
+ event.stopPropagation();
282
+ this.iconClick.emit({ icon });
283
+ }
284
+ addInfoId() {
285
+ if (this._element) {
286
+ core.ElementIDUtils.addIDInfo(this._element);
287
+ }
288
+ if (this._inputElem) {
289
+ const dataInfo = { id: 'embedded' };
290
+ core.ElementIDUtils.addIDInfo(this._inputElem, 'classic-input', dataInfo);
291
+ }
292
+ }
293
+ componentWillLoad() {
294
+ if (this.mask && !this._maskFormatter) {
295
+ this._maskFormatter = new MaskFormatter(this.mask);
296
+ }
297
+ if (!this.placeholder && this._maskFormatter) {
298
+ this.placeholder = this._maskFormatter.generatePlaceholder();
299
+ }
300
+ }
301
+ componentDidLoad() {
302
+ if (this.value && this._maskFormatter && this._inputElem) {
303
+ const formattedValue = this._maskFormatter.format(this.value);
304
+ this._inputElem.value = formattedValue;
305
+ }
306
+ else {
307
+ this._inputElem.value = this.value || '';
308
+ }
309
+ this.addInfoId();
310
+ }
311
+ render() {
312
+ return (index.h(index.Host, null, index.h("label", { title: this.label, htmlFor: this.name }, this.label), index.h("div", { class: "input-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (index.h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), index.h("input", { ref: el => this._inputElem = el, id: this.name, type: this.type, title: this.value, placeholder: this.placeholder, disabled: !this.enabled, readonly: this.readonly, name: this.name, minlength: this.minlength, maxlength: this.maxlength, onInput: this.onInput.bind(this), onBlur: this.onBlur.bind(this) }), this.rightIconName && (index.h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (index.h("span", { title: this.helpText }, this.helpText))));
313
+ }
314
+ get _element() { return index.getElement(this); }
315
+ };
316
+ EzClassicInput.style = ezClassicInputCss;
317
+
318
+ exports.ez_classic_input = EzClassicInput;
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+
8
+ const ezClassicTextAreaCss = ":host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;--ez-classic-text-area--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-text-area--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-text-area--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-text-area--border-color-success:var(--color--green-600, #157A00);--ez-classic-text-area--border-color-error:var(--color--red-600, #BD0025);--ez-classic-text-area--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-text-area--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-text-area--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-text-area--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-text-area--placeholder-color:#bdbdbd;--ez-classic-text-area--icon-color:var(--color--gray-400, #77777A);--ez-classic-text-area--helptext-color:var(--color--ocean-green-1000, #00281D)}.text-area-container{display:flex;flex-direction:row;align-items:start;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding:var(--space--16, 16px);box-sizing:border-box;gap:var(--space--10, 10px);margin:var(--space--4, 4px) var(--space--2, 2px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);resize:vertical;overflow:auto;background-color:var(--ez-classic-text-area--background-color)}.text-area-container,.text-area-container[data-state=\"default\"]{box-shadow:0 0 0 1px var(--ez-classic-text-area--border-color-default)}.text-area-container[data-state=\"success\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-success)}.text-area-container[data-state=\"error\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-error)}.text-area-container[data-state=\"warning\"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-warning)}.text-area-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-text-area--icon-color)}textarea{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;min-height:calc(var(--ez-classic-text-area--min-height) - var(--space--32, 32px));resize:none;scrollbar-width:thin;color:var(--ez-classic-text-area--text-color)}.text-area-container[data-disabled=\"true\"]{cursor:not-allowed;background:var(--ez-classic-text-area--background-color-disabled);border-color:var(--ez-classic-text-area--border-color-default)}.text-area-container[data-disabled=\"true\"]>*{cursor:not-allowed}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-text-area--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:var(--line-height--20, 20px);color:var(--ez-classic-text-area--label-color)}.icon-clickable{cursor:pointer}.text-area-container[data-resize=\"none\"]{resize:none}.text-area-container[data-resize=\"both\"]{resize:both}.text-area-container[data-resize=\"horizontal\"]{resize:horizontal}.text-area-container[data-resize=\"vertical\"]{resize:vertical}.text-area-container::-webkit-resizer{display:none}.text-area-container::-moz-resizer{display:none}.text-area-container:not([data-resize=\"none\"]){position:relative}.text-area-container:not([data-resize=\"none\"])::after{content:'';position:absolute;bottom:var(--space--2, 2px);right:var(--space--2, 2px);width:var(--space--10, 10px);height:var(--space--10, 10px);background:linear-gradient(135deg, transparent 0% 50%, var(--ez-classic-text-area--border-color-default) 50% 58%, transparent 58% 70%, var(--ez-classic-text-area--border-color-default) 70% 78%, transparent 78% 100%);pointer-events:none}";
9
+
10
+ const EzClassicTextArea = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.ezChange = index.createEvent(this, "ezChange", 7);
14
+ this.ezBlur = index.createEvent(this, "ezBlur", 7);
15
+ this.iconClick = index.createEvent(this, "iconClick", 7);
16
+ this.name = core.StringUtils.generateUUID();
17
+ this.label = '';
18
+ this.placeholder = '';
19
+ this.value = '';
20
+ this.helpText = undefined;
21
+ this.state = "default";
22
+ this.enabled = true;
23
+ this.readonly = false;
24
+ this.maxlength = undefined;
25
+ this.resize = 'vertical';
26
+ this.leftIconName = undefined;
27
+ this.rightIconName = undefined;
28
+ this.rightIconTooltip = undefined;
29
+ this.leftIconTooltip = undefined;
30
+ this.leftIconClickable = false;
31
+ this.rightIconClickable = false;
32
+ this.rows = 5;
33
+ }
34
+ /** Aplica o foco no campo. */
35
+ async setFocus(option) {
36
+ if (option === null || option === void 0 ? void 0 : option.selectText) {
37
+ this._textAreaElem.select();
38
+ }
39
+ if (!(option === null || option === void 0 ? void 0 : option.preventScroll)) {
40
+ this._textAreaElem.scrollIntoView({ behavior: "smooth", block: "center" });
41
+ }
42
+ this._textAreaElem.focus({ preventScroll: true });
43
+ }
44
+ /** Remove o foco do campo. */
45
+ async setBlur() {
46
+ this._textAreaElem.blur();
47
+ }
48
+ onBlur() {
49
+ this.ezBlur.emit(this.value);
50
+ }
51
+ handleInput(event) {
52
+ const target = event.target;
53
+ this.ezChange.emit(target.value);
54
+ }
55
+ ;
56
+ handleIconClick(event, icon) {
57
+ if (!this.enabled) {
58
+ return;
59
+ }
60
+ if ((icon === "left" && !this.leftIconClickable) || (icon === "right" && !this.rightIconClickable)) {
61
+ this.setFocus({ preventScroll: true });
62
+ return;
63
+ }
64
+ event.stopPropagation();
65
+ this.iconClick.emit({ icon });
66
+ }
67
+ addInfoId() {
68
+ if (this._element) {
69
+ core.ElementIDUtils.addIDInfo(this._element);
70
+ }
71
+ if (this._textAreaElem) {
72
+ const dataInfo = { id: 'embedded' };
73
+ core.ElementIDUtils.addIDInfo(this._textAreaElem, 'classic-text-area', dataInfo);
74
+ }
75
+ }
76
+ componentDidLoad() {
77
+ this.addInfoId();
78
+ }
79
+ render() {
80
+ return (index.h(index.Host, null, this.label && (index.h("label", { title: this.label, htmlFor: this.name }, this.label)), index.h("div", { class: "text-area-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), "data-resize": this.resize, onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (index.h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), index.h("textarea", { ref: (el) => (this._textAreaElem = el), id: this.name, name: this.name, placeholder: this.placeholder, value: this.value, disabled: !this.enabled, readOnly: this.readonly, maxLength: this.maxlength, rows: this.rows, onInput: this.handleInput.bind(this), onBlur: this.onBlur.bind(this) }), this.rightIconName && (index.h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (index.h("span", { title: this.helpText }, this.helpText))));
81
+ }
82
+ get _element() { return index.getElement(this); }
83
+ };
84
+ EzClassicTextArea.style = ezClassicTextAreaCss;
85
+
86
+ exports.ez_classic_text_area = EzClassicTextArea;