@sankhyalabs/ezui 6.2.0-dev.2 → 6.2.0-dev.4

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 (52) 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-tree.cjs.entry.js +48 -7
  6. package/dist/cjs/ezui.cjs.js +2 -2
  7. package/dist/cjs/index-a7b0c73d.js +8 -0
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/collection/collection-manifest.json +2 -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-tree/ez-tree.css +4 -1
  19. package/dist/collection/components/ez-tree/ez-tree.js +21 -2
  20. package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +7 -1
  21. package/dist/collection/components/ez-tree/types/Tree.js +37 -3
  22. package/dist/collection/global/app-init.js +3 -1
  23. package/dist/custom-elements/index.d.ts +12 -0
  24. package/dist/custom-elements/index.js +454 -15
  25. package/dist/esm/{app-globals-8c57b015.js → app-globals-8a94d86c.js} +3 -1
  26. package/dist/esm/ez-classic-input.entry.js +314 -0
  27. package/dist/esm/ez-classic-text-area.entry.js +82 -0
  28. package/dist/esm/ez-icon.entry.js +1 -1
  29. package/dist/esm/ez-tree.entry.js +48 -7
  30. package/dist/esm/ezui.js +2 -2
  31. package/dist/esm/index-baa5e267.js +8 -0
  32. package/dist/esm/loader.js +2 -2
  33. package/dist/ezui/ezui.esm.js +1 -1
  34. package/dist/ezui/p-2d080bdc.entry.js +1 -0
  35. package/dist/ezui/p-48effc69.entry.js +1 -0
  36. package/dist/ezui/p-b2b1a1a7.entry.js +1 -0
  37. package/dist/ezui/p-e78e87f5.entry.js +1 -0
  38. package/dist/types/components/ez-classic-input/ez-classic-input.d.ts +78 -0
  39. package/dist/types/components/ez-classic-input/interfaces/optionsSetFocus.d.ts +4 -0
  40. package/dist/types/components/ez-classic-input/utils/maskFormatter.d.ts +30 -0
  41. package/dist/types/components/ez-classic-text-area/ez-classic-text-area.d.ts +61 -0
  42. package/dist/types/components/ez-classic-text-area/interfaces/optionsSetFocus.d.ts +4 -0
  43. package/dist/types/components/ez-tree/ez-tree.d.ts +4 -0
  44. package/dist/types/components/ez-tree/types/Tree.d.ts +2 -1
  45. package/dist/types/components.d.ts +372 -0
  46. package/package.json +1 -1
  47. package/react/components.d.ts +2 -0
  48. package/react/components.js +2 -0
  49. package/react/components.js.map +1 -1
  50. package/dist/ezui/p-7eb6115c.entry.js +0 -1
  51. package/dist/ezui/p-e78b5a16.entry.js +0 -1
  52. /package/dist/ezui/{p-76ad2e26.js → p-07819d50.js} +0 -0
@@ -2,7 +2,9 @@ import { i as initI18n } from './index-498e0126.js';
2
2
 
3
3
  async function initializeApp() {
4
4
  await initI18n();
5
- console.log('Global initialization ez-ui completed!');
5
+ {
6
+ console.log('Global initialization ez-ui completed!');
7
+ }
6
8
  }
7
9
 
8
10
  const globalScripts = initializeApp;
@@ -0,0 +1,314 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
2
+ import { ElementIDUtils } from '@sankhyalabs/core';
3
+
4
+ class MaskFormatter {
5
+ constructor(mask) {
6
+ this.mask = mask;
7
+ this.maskChars = {
8
+ '#': (char) => /\d/.test(char),
9
+ 'U': (char) => /[a-zA-Z]/.test(char),
10
+ 'L': (char) => /[a-zA-Z]/.test(char),
11
+ 'A': (char) => /[a-zA-Z0-9]/.test(char),
12
+ '?': (char) => /[a-zA-Z]/.test(char),
13
+ '*': () => true
14
+ };
15
+ }
16
+ /**
17
+ * Formata a string de acordo com a máscara
18
+ * @param value String a ser formatada
19
+ * @returns String formatada
20
+ */
21
+ format(value) {
22
+ if (!value || !this.mask)
23
+ return value;
24
+ const cleanedValue = this.removeIncompatibleChars(value);
25
+ let formattedValue = '';
26
+ let valueIndex = 0;
27
+ let maskIndex = 0;
28
+ while (maskIndex < this.mask.length && valueIndex < cleanedValue.length) {
29
+ const maskChar = this.mask[maskIndex];
30
+ const inputChar = cleanedValue[valueIndex];
31
+ if (maskChar === "'") {
32
+ maskIndex++;
33
+ if (maskIndex < this.mask.length) {
34
+ formattedValue += this.mask[maskIndex];
35
+ maskIndex++;
36
+ }
37
+ continue;
38
+ }
39
+ if (this.maskChars[maskChar]) {
40
+ if (this.maskChars[maskChar](inputChar)) {
41
+ if (maskChar === 'U') {
42
+ formattedValue += inputChar.toUpperCase();
43
+ }
44
+ else if (maskChar === 'L') {
45
+ formattedValue += inputChar.toLowerCase();
46
+ }
47
+ else {
48
+ formattedValue += inputChar;
49
+ }
50
+ valueIndex++;
51
+ }
52
+ else {
53
+ valueIndex++;
54
+ continue;
55
+ }
56
+ }
57
+ else {
58
+ formattedValue += maskChar;
59
+ if (inputChar === maskChar) {
60
+ valueIndex++;
61
+ }
62
+ }
63
+ maskIndex++;
64
+ }
65
+ return formattedValue;
66
+ }
67
+ /**
68
+ * Remove caracteres que não são compatíveis com nenhuma posição da máscara
69
+ */
70
+ removeIncompatibleChars(value) {
71
+ let cleanValue = '';
72
+ for (let i = 0; i < value.length; i++) {
73
+ const char = value[i];
74
+ let isValidChar = false;
75
+ for (const maskRule in this.maskChars) {
76
+ if (this.maskChars[maskRule](char)) {
77
+ isValidChar = true;
78
+ break;
79
+ }
80
+ }
81
+ if (!isValidChar) {
82
+ for (let j = 0; j < this.mask.length; j++) {
83
+ if (this.mask[j] === char && !this.maskChars[this.mask[j]]) {
84
+ isValidChar = true;
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ if (isValidChar) {
90
+ cleanValue += char;
91
+ }
92
+ }
93
+ return cleanValue;
94
+ }
95
+ /**
96
+ * Remove a máscara de uma string formatada
97
+ * @param formattedValue String formatada
98
+ * @returns String sem máscara
99
+ */
100
+ removeMask(formattedValue) {
101
+ if (!formattedValue || !this.mask)
102
+ return formattedValue;
103
+ let cleanValue = '';
104
+ let valueIndex = 0;
105
+ let maskIndex = 0;
106
+ while (valueIndex < formattedValue.length && maskIndex < this.mask.length) {
107
+ const maskChar = this.mask[maskIndex];
108
+ const inputChar = formattedValue[valueIndex];
109
+ if (maskChar === "'") {
110
+ maskIndex++;
111
+ if (maskIndex < this.mask.length) {
112
+ if (inputChar === this.mask[maskIndex]) {
113
+ valueIndex++;
114
+ }
115
+ maskIndex++;
116
+ }
117
+ continue;
118
+ }
119
+ if (this.maskChars[maskChar]) {
120
+ if (this.maskChars[maskChar](inputChar)) {
121
+ cleanValue += inputChar;
122
+ }
123
+ valueIndex++;
124
+ }
125
+ else {
126
+ if (inputChar === maskChar) {
127
+ valueIndex++;
128
+ }
129
+ }
130
+ maskIndex++;
131
+ }
132
+ while (valueIndex < formattedValue.length) {
133
+ const remainingChar = formattedValue[valueIndex];
134
+ if (/[a-zA-Z0-9]/.test(remainingChar)) {
135
+ cleanValue += remainingChar;
136
+ }
137
+ valueIndex++;
138
+ }
139
+ return cleanValue;
140
+ }
141
+ /**
142
+ * Retorna a máscara configurada
143
+ */
144
+ getMask() {
145
+ return this.mask;
146
+ }
147
+ /**
148
+ * Gera um placeholder baseado na máscara
149
+ * @returns String com placeholder gerado
150
+ */
151
+ generatePlaceholder() {
152
+ if (!this.mask)
153
+ return '';
154
+ let placeholder = '';
155
+ let maskIndex = 0;
156
+ while (maskIndex < this.mask.length) {
157
+ const maskChar = this.mask[maskIndex];
158
+ if (maskChar === "'") {
159
+ maskIndex++;
160
+ if (maskIndex < this.mask.length) {
161
+ placeholder += this.mask[maskIndex];
162
+ maskIndex++;
163
+ }
164
+ continue;
165
+ }
166
+ if (this.maskChars[maskChar]) {
167
+ switch (maskChar) {
168
+ case '#':
169
+ placeholder += '0';
170
+ break;
171
+ case 'U':
172
+ case 'L':
173
+ case '?':
174
+ placeholder += 'A';
175
+ break;
176
+ case 'A':
177
+ placeholder += 'A';
178
+ break;
179
+ case '~':
180
+ placeholder += '0';
181
+ break;
182
+ case '*':
183
+ placeholder += '_';
184
+ break;
185
+ default:
186
+ placeholder += '_';
187
+ break;
188
+ }
189
+ }
190
+ else {
191
+ placeholder += maskChar;
192
+ }
193
+ maskIndex++;
194
+ }
195
+ return placeholder;
196
+ }
197
+ }
198
+
199
+ 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}";
200
+
201
+ const EzClassicInput = class {
202
+ constructor(hostRef) {
203
+ registerInstance(this, hostRef);
204
+ this.ezChange = createEvent(this, "ezChange", 7);
205
+ this.ezBlur = createEvent(this, "ezBlur", 7);
206
+ this.iconClick = createEvent(this, "iconClick", 7);
207
+ this.type = 'text';
208
+ this.value = undefined;
209
+ this.label = undefined;
210
+ this.helpText = undefined;
211
+ this.placeholder = undefined;
212
+ this.enabled = true;
213
+ this.readonly = false;
214
+ this.name = undefined;
215
+ this.minlength = undefined;
216
+ this.maxlength = undefined;
217
+ this.leftIconName = undefined;
218
+ this.rightIconName = undefined;
219
+ this.rightIconTooltip = undefined;
220
+ this.leftIconTooltip = undefined;
221
+ this.state = "default";
222
+ this.leftIconClickable = false;
223
+ this.rightIconClickable = false;
224
+ this.mask = undefined;
225
+ this.emitMaskedValue = false;
226
+ }
227
+ /**
228
+ * Aplica o foco no campo.
229
+ */
230
+ async setFocus(option) {
231
+ if (option === null || option === void 0 ? void 0 : option.selectText) {
232
+ this._inputElem.select();
233
+ }
234
+ if (!(option === null || option === void 0 ? void 0 : option.preventScroll)) {
235
+ this._inputElem.scrollIntoView({ behavior: "smooth", block: "center" });
236
+ }
237
+ this._inputElem.focus({ preventScroll: true });
238
+ }
239
+ /**
240
+ * Remove o foco do campo.
241
+ */
242
+ async setBlur() {
243
+ this._inputElem.blur();
244
+ }
245
+ onInput(event) {
246
+ try {
247
+ const inputElement = event.target;
248
+ let inputValue = inputElement.value;
249
+ if (this._maskFormatter) {
250
+ const formattedValue = this._maskFormatter.format(inputValue);
251
+ const cleanValue = this._maskFormatter.removeMask(formattedValue);
252
+ inputElement.value = formattedValue;
253
+ this.value = cleanValue;
254
+ const emitValue = this.emitMaskedValue ? formattedValue : cleanValue;
255
+ this.ezChange.emit(emitValue);
256
+ }
257
+ else {
258
+ this.value = inputValue;
259
+ this.ezChange.emit(inputValue);
260
+ }
261
+ }
262
+ catch (error) {
263
+ console.error("Error processing input event:", error);
264
+ }
265
+ }
266
+ onBlur() {
267
+ this.ezBlur.emit(this.value);
268
+ }
269
+ handleIconClick(event, icon) {
270
+ if (!this.enabled) {
271
+ return;
272
+ }
273
+ if ((icon === "left" && !this.leftIconClickable) || (icon === "right" && !this.rightIconClickable)) {
274
+ this.setFocus({ preventScroll: true });
275
+ return;
276
+ }
277
+ event.stopPropagation();
278
+ this.iconClick.emit({ icon });
279
+ }
280
+ addInfoId() {
281
+ if (this._element) {
282
+ ElementIDUtils.addIDInfo(this._element);
283
+ }
284
+ if (this._inputElem) {
285
+ const dataInfo = { id: 'embedded' };
286
+ ElementIDUtils.addIDInfo(this._inputElem, 'classic-input', dataInfo);
287
+ }
288
+ }
289
+ componentWillLoad() {
290
+ if (this.mask && !this._maskFormatter) {
291
+ this._maskFormatter = new MaskFormatter(this.mask);
292
+ }
293
+ if (!this.placeholder && this._maskFormatter) {
294
+ this.placeholder = this._maskFormatter.generatePlaceholder();
295
+ }
296
+ }
297
+ componentDidLoad() {
298
+ if (this.value && this._maskFormatter && this._inputElem) {
299
+ const formattedValue = this._maskFormatter.format(this.value);
300
+ this._inputElem.value = formattedValue;
301
+ }
302
+ else {
303
+ this._inputElem.value = this.value || '';
304
+ }
305
+ this.addInfoId();
306
+ }
307
+ render() {
308
+ return (h(Host, null, h("label", { title: this.label, htmlFor: this.name }, this.label), h("div", { class: "input-container", "data-state": this.state, "data-disabled": (!this.enabled).toString(), onClick: () => this.setFocus({ preventScroll: true }) }, this.leftIconName && (h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), 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 && (h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (h("span", { title: this.helpText }, this.helpText))));
309
+ }
310
+ get _element() { return getElement(this); }
311
+ };
312
+ EzClassicInput.style = ezClassicInputCss;
313
+
314
+ export { EzClassicInput as ez_classic_input };
@@ -0,0 +1,82 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-baa5e267.js';
2
+ import { StringUtils, ElementIDUtils } from '@sankhyalabs/core';
3
+
4
+ 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}";
5
+
6
+ const EzClassicTextArea = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.ezChange = createEvent(this, "ezChange", 7);
10
+ this.ezBlur = createEvent(this, "ezBlur", 7);
11
+ this.iconClick = createEvent(this, "iconClick", 7);
12
+ this.name = StringUtils.generateUUID();
13
+ this.label = '';
14
+ this.placeholder = '';
15
+ this.value = '';
16
+ this.helpText = undefined;
17
+ this.state = "default";
18
+ this.enabled = true;
19
+ this.readonly = false;
20
+ this.maxlength = undefined;
21
+ this.resize = 'vertical';
22
+ this.leftIconName = undefined;
23
+ this.rightIconName = undefined;
24
+ this.rightIconTooltip = undefined;
25
+ this.leftIconTooltip = undefined;
26
+ this.leftIconClickable = false;
27
+ this.rightIconClickable = false;
28
+ this.rows = 5;
29
+ }
30
+ /** Aplica o foco no campo. */
31
+ async setFocus(option) {
32
+ if (option === null || option === void 0 ? void 0 : option.selectText) {
33
+ this._textAreaElem.select();
34
+ }
35
+ if (!(option === null || option === void 0 ? void 0 : option.preventScroll)) {
36
+ this._textAreaElem.scrollIntoView({ behavior: "smooth", block: "center" });
37
+ }
38
+ this._textAreaElem.focus({ preventScroll: true });
39
+ }
40
+ /** Remove o foco do campo. */
41
+ async setBlur() {
42
+ this._textAreaElem.blur();
43
+ }
44
+ onBlur() {
45
+ this.ezBlur.emit(this.value);
46
+ }
47
+ handleInput(event) {
48
+ const target = event.target;
49
+ this.ezChange.emit(target.value);
50
+ }
51
+ ;
52
+ handleIconClick(event, icon) {
53
+ if (!this.enabled) {
54
+ return;
55
+ }
56
+ if ((icon === "left" && !this.leftIconClickable) || (icon === "right" && !this.rightIconClickable)) {
57
+ this.setFocus({ preventScroll: true });
58
+ return;
59
+ }
60
+ event.stopPropagation();
61
+ this.iconClick.emit({ icon });
62
+ }
63
+ addInfoId() {
64
+ if (this._element) {
65
+ ElementIDUtils.addIDInfo(this._element);
66
+ }
67
+ if (this._textAreaElem) {
68
+ const dataInfo = { id: 'embedded' };
69
+ ElementIDUtils.addIDInfo(this._textAreaElem, 'classic-text-area', dataInfo);
70
+ }
71
+ }
72
+ componentDidLoad() {
73
+ this.addInfoId();
74
+ }
75
+ render() {
76
+ return (h(Host, null, this.label && (h("label", { title: this.label, htmlFor: this.name }, this.label)), 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 && (h("ez-icon", { iconName: this.leftIconName, title: this.leftIconTooltip, onClick: (event) => this.handleIconClick(event, "left"), class: { 'icon-clickable': this.leftIconClickable } })), 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 && (h("ez-icon", { iconName: this.rightIconName, title: this.rightIconTooltip, onClick: (event) => this.handleIconClick(event, "right"), class: { 'icon-clickable': this.rightIconClickable } }))), this.helpText && (h("span", { title: this.helpText }, this.helpText))));
77
+ }
78
+ get _element() { return getElement(this); }
79
+ };
80
+ EzClassicTextArea.style = ezClassicTextAreaCss;
81
+
82
+ export { EzClassicTextArea as ez_classic_text_area };