@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
@@ -0,0 +1,194 @@
1
+ export class MaskFormatter {
2
+ constructor(mask) {
3
+ this.mask = mask;
4
+ this.maskChars = {
5
+ '#': (char) => /\d/.test(char),
6
+ 'U': (char) => /[a-zA-Z]/.test(char),
7
+ 'L': (char) => /[a-zA-Z]/.test(char),
8
+ 'A': (char) => /[a-zA-Z0-9]/.test(char),
9
+ '?': (char) => /[a-zA-Z]/.test(char),
10
+ '*': () => true
11
+ };
12
+ }
13
+ /**
14
+ * Formata a string de acordo com a máscara
15
+ * @param value String a ser formatada
16
+ * @returns String formatada
17
+ */
18
+ format(value) {
19
+ if (!value || !this.mask)
20
+ return value;
21
+ const cleanedValue = this.removeIncompatibleChars(value);
22
+ let formattedValue = '';
23
+ let valueIndex = 0;
24
+ let maskIndex = 0;
25
+ while (maskIndex < this.mask.length && valueIndex < cleanedValue.length) {
26
+ const maskChar = this.mask[maskIndex];
27
+ const inputChar = cleanedValue[valueIndex];
28
+ if (maskChar === "'") {
29
+ maskIndex++;
30
+ if (maskIndex < this.mask.length) {
31
+ formattedValue += this.mask[maskIndex];
32
+ maskIndex++;
33
+ }
34
+ continue;
35
+ }
36
+ if (this.maskChars[maskChar]) {
37
+ if (this.maskChars[maskChar](inputChar)) {
38
+ if (maskChar === 'U') {
39
+ formattedValue += inputChar.toUpperCase();
40
+ }
41
+ else if (maskChar === 'L') {
42
+ formattedValue += inputChar.toLowerCase();
43
+ }
44
+ else {
45
+ formattedValue += inputChar;
46
+ }
47
+ valueIndex++;
48
+ }
49
+ else {
50
+ valueIndex++;
51
+ continue;
52
+ }
53
+ }
54
+ else {
55
+ formattedValue += maskChar;
56
+ if (inputChar === maskChar) {
57
+ valueIndex++;
58
+ }
59
+ }
60
+ maskIndex++;
61
+ }
62
+ return formattedValue;
63
+ }
64
+ /**
65
+ * Remove caracteres que não são compatíveis com nenhuma posição da máscara
66
+ */
67
+ removeIncompatibleChars(value) {
68
+ let cleanValue = '';
69
+ for (let i = 0; i < value.length; i++) {
70
+ const char = value[i];
71
+ let isValidChar = false;
72
+ for (const maskRule in this.maskChars) {
73
+ if (this.maskChars[maskRule](char)) {
74
+ isValidChar = true;
75
+ break;
76
+ }
77
+ }
78
+ if (!isValidChar) {
79
+ for (let j = 0; j < this.mask.length; j++) {
80
+ if (this.mask[j] === char && !this.maskChars[this.mask[j]]) {
81
+ isValidChar = true;
82
+ break;
83
+ }
84
+ }
85
+ }
86
+ if (isValidChar) {
87
+ cleanValue += char;
88
+ }
89
+ }
90
+ return cleanValue;
91
+ }
92
+ /**
93
+ * Remove a máscara de uma string formatada
94
+ * @param formattedValue String formatada
95
+ * @returns String sem máscara
96
+ */
97
+ removeMask(formattedValue) {
98
+ if (!formattedValue || !this.mask)
99
+ return formattedValue;
100
+ let cleanValue = '';
101
+ let valueIndex = 0;
102
+ let maskIndex = 0;
103
+ while (valueIndex < formattedValue.length && maskIndex < this.mask.length) {
104
+ const maskChar = this.mask[maskIndex];
105
+ const inputChar = formattedValue[valueIndex];
106
+ if (maskChar === "'") {
107
+ maskIndex++;
108
+ if (maskIndex < this.mask.length) {
109
+ if (inputChar === this.mask[maskIndex]) {
110
+ valueIndex++;
111
+ }
112
+ maskIndex++;
113
+ }
114
+ continue;
115
+ }
116
+ if (this.maskChars[maskChar]) {
117
+ if (this.maskChars[maskChar](inputChar)) {
118
+ cleanValue += inputChar;
119
+ }
120
+ valueIndex++;
121
+ }
122
+ else {
123
+ if (inputChar === maskChar) {
124
+ valueIndex++;
125
+ }
126
+ }
127
+ maskIndex++;
128
+ }
129
+ while (valueIndex < formattedValue.length) {
130
+ const remainingChar = formattedValue[valueIndex];
131
+ if (/[a-zA-Z0-9]/.test(remainingChar)) {
132
+ cleanValue += remainingChar;
133
+ }
134
+ valueIndex++;
135
+ }
136
+ return cleanValue;
137
+ }
138
+ /**
139
+ * Retorna a máscara configurada
140
+ */
141
+ getMask() {
142
+ return this.mask;
143
+ }
144
+ /**
145
+ * Gera um placeholder baseado na máscara
146
+ * @returns String com placeholder gerado
147
+ */
148
+ generatePlaceholder() {
149
+ if (!this.mask)
150
+ return '';
151
+ let placeholder = '';
152
+ let maskIndex = 0;
153
+ while (maskIndex < this.mask.length) {
154
+ const maskChar = this.mask[maskIndex];
155
+ if (maskChar === "'") {
156
+ maskIndex++;
157
+ if (maskIndex < this.mask.length) {
158
+ placeholder += this.mask[maskIndex];
159
+ maskIndex++;
160
+ }
161
+ continue;
162
+ }
163
+ if (this.maskChars[maskChar]) {
164
+ switch (maskChar) {
165
+ case '#':
166
+ placeholder += '0';
167
+ break;
168
+ case 'U':
169
+ case 'L':
170
+ case '?':
171
+ placeholder += 'A';
172
+ break;
173
+ case 'A':
174
+ placeholder += 'A';
175
+ break;
176
+ case '~':
177
+ placeholder += '0';
178
+ break;
179
+ case '*':
180
+ placeholder += '_';
181
+ break;
182
+ default:
183
+ placeholder += '_';
184
+ break;
185
+ }
186
+ }
187
+ else {
188
+ placeholder += maskChar;
189
+ }
190
+ maskIndex++;
191
+ }
192
+ return placeholder;
193
+ }
194
+ }
@@ -0,0 +1,179 @@
1
+ :host {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: flex-start;
5
+ box-sizing: border-box;
6
+ font-family: var(--font--pattern, Arial, sans-serif);
7
+ font-size: var(--font-size--default, 14px);
8
+ color: var(--color--ocean-green-1000, #00281D);
9
+ border: none;
10
+ padding: 0;
11
+
12
+ /* public */
13
+ --ez-classic-text-area--label-color: var(--color--ocean-green-1000, #00281D);
14
+ --ez-classic-text-area--border-color-default: var(--color--gray-200, #D2D2D3);
15
+ --ez-classic-text-area--border-color-focus: var(--color--gray-300, #A4A5A7);
16
+ --ez-classic-text-area--border-color-success: var(--color--green-600, #157A00);
17
+ --ez-classic-text-area--border-color-error: var(--color--red-600, #BD0025);
18
+ --ez-classic-text-area--border-color-warning: var(--color--yellow-600, #EFB103);
19
+ --ez-classic-text-area--background-color: var(--color--gray-70, #FFFFFF);
20
+ --ez-classic-text-area--background-color-disabled: var(--color--gray-90, #EAEAEA);
21
+ --ez-classic-text-area--text-color: var(--color--ocean-green-1000, #00281D);
22
+ --ez-classic-text-area--placeholder-color: #bdbdbd;
23
+ --ez-classic-text-area--icon-color: var(--color--gray-400, #77777A);
24
+ --ez-classic-text-area--helptext-color: var(--color--ocean-green-1000, #00281D);
25
+ }
26
+
27
+ .text-area-container {
28
+ display: flex;
29
+ flex-direction: row;
30
+ align-items: start;
31
+ width: 100%;
32
+ border: none;
33
+ border-radius: var(--border--radius-8, 8px);
34
+ padding: var(--space--16, 16px);
35
+ box-sizing: border-box;
36
+ gap: var(--space--10, 10px);
37
+ margin: var(--space--4, 4px) var(--space--2, 2px);
38
+ transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
39
+ resize: vertical;
40
+ overflow: auto;
41
+
42
+ /* public */
43
+ background-color: var(--ez-classic-text-area--background-color);
44
+ }
45
+
46
+ .text-area-container,
47
+ .text-area-container[data-state="default"] {
48
+ box-shadow: 0 0 0 1px var(--ez-classic-text-area--border-color-default);
49
+ }
50
+
51
+ .text-area-container[data-state="success"] {
52
+ box-shadow: 0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-success);
53
+ }
54
+
55
+ .text-area-container[data-state="error"] {
56
+ box-shadow: 0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-error);
57
+ }
58
+
59
+ .text-area-container[data-state="warning"] {
60
+ box-shadow: 0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-warning);
61
+ }
62
+
63
+ .text-area-container:focus-within {
64
+ box-shadow: 0 0 0 var(--space--2, 2px) var(--ez-classic-text-area--border-color-focus);
65
+ }
66
+
67
+ ez-icon {
68
+ min-width: var(--space--24, 24px);
69
+ color: var(--ez-classic-text-area--icon-color);
70
+ }
71
+
72
+ textarea {
73
+ flex: 1;
74
+ border: none;
75
+ outline: none;
76
+ background: transparent;
77
+ height: 100%;
78
+ width: 100%;
79
+ padding: 0;
80
+ font-family: var(--font--pattern, Arial, sans-serif);
81
+ font-size: var(--font-size--default, 14px);
82
+ color: var(--color--ocean-green-1000, #00281D);
83
+ text-overflow: ellipsis;
84
+ min-height: calc(var(--ez-classic-text-area--min-height) - var(--space--32, 32px));
85
+ resize: none;
86
+ scrollbar-width: thin;
87
+
88
+ /* public */
89
+ color: var(--ez-classic-text-area--text-color);
90
+ }
91
+
92
+ .text-area-container[data-disabled="true"] {
93
+ cursor: not-allowed;
94
+
95
+ /* public */
96
+ background: var(--ez-classic-text-area--background-color-disabled);
97
+ border-color: var(--ez-classic-text-area--border-color-default);
98
+ }
99
+
100
+ .text-area-container[data-disabled="true"] > *{
101
+ cursor: not-allowed;
102
+ }
103
+
104
+ @keyframes ez-helptext-fadein {
105
+ from {
106
+ opacity: 0;
107
+ transform: translateY(-4px);
108
+ }
109
+ to {
110
+ opacity: 1;
111
+ transform: translateY(0);
112
+ }
113
+ }
114
+
115
+ span {
116
+ font-size: var(--font-size--xsmall, 10px);
117
+ line-height: var(--line-height--16, 16px);
118
+ overflow: hidden;
119
+ text-overflow: ellipsis;
120
+ animation: ez-helptext-fadein 0.3s ease;
121
+
122
+ /* public */
123
+ color: var(--ez-classic-text-area--helptext-color);
124
+ }
125
+
126
+ label {
127
+ display: block;
128
+ width: 100%;
129
+ white-space: nowrap;
130
+ overflow: hidden;
131
+ text-overflow: ellipsis;
132
+ line-height: var(--line-height--20, 20px);
133
+ /* public */
134
+ color: var(--ez-classic-text-area--label-color);
135
+ }
136
+
137
+ .icon-clickable {
138
+ cursor: pointer;
139
+ }
140
+
141
+ /* Adicionar estados de resize baseados na prop */
142
+ .text-area-container[data-resize="none"] {
143
+ resize: none;
144
+ }
145
+
146
+ .text-area-container[data-resize="both"] {
147
+ resize: both;
148
+ }
149
+
150
+ .text-area-container[data-resize="horizontal"] {
151
+ resize: horizontal;
152
+ }
153
+
154
+ .text-area-container[data-resize="vertical"] {
155
+ resize: vertical;
156
+ }
157
+
158
+ .text-area-container::-webkit-resizer {
159
+ display: none;
160
+ }
161
+
162
+ .text-area-container::-moz-resizer {
163
+ display: none;
164
+ }
165
+
166
+ .text-area-container:not([data-resize="none"]) {
167
+ position: relative;
168
+ }
169
+
170
+ .text-area-container:not([data-resize="none"])::after {
171
+ content: '';
172
+ position: absolute;
173
+ bottom: var(--space--2, 2px);
174
+ right: var(--space--2, 2px);
175
+ width: var(--space--10, 10px);
176
+ height: var(--space--10, 10px);
177
+ 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%);
178
+ pointer-events: none;
179
+ }