@govbr-ds/webcomponents 2.0.0-next.45 → 2.0.0-next.47
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/br-avatar.cjs.entry.js +1 -1
- package/dist/cjs/br-avatar.cjs.entry.js.map +1 -1
- package/dist/cjs/br-avatar.entry.cjs.js.map +1 -1
- package/dist/cjs/br-button.br-icon.entry.cjs.js.map +1 -1
- package/dist/cjs/br-button_2.cjs.entry.js +15 -2
- package/dist/cjs/br-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/br-message.cjs.entry.js +2 -2
- package/dist/cjs/br-message.cjs.entry.js.map +1 -1
- package/dist/cjs/br-message.entry.cjs.js.map +1 -1
- package/dist/cjs/br-switch.cjs.entry.js +28 -2
- package/dist/cjs/br-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/br-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/br-tag.cjs.entry.js +151 -13
- package/dist/cjs/br-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/br-tag.entry.cjs.js.map +1 -1
- package/dist/cjs/br-textarea.cjs.entry.js +32 -5
- package/dist/cjs/br-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/br-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/br-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/br-upload.cjs.entry.js +15 -23
- package/dist/cjs/br-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/br-upload.entry.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/avatar/avatar.js +1 -1
- package/dist/collection/components/avatar/avatar.js.map +1 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/icon/icon.js +42 -1
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/message/message.css +1 -1
- package/dist/collection/components/message/message.js +1 -1
- package/dist/collection/components/message/message.js.map +1 -1
- package/dist/collection/components/switch/switch.css +1 -1
- package/dist/collection/components/switch/switch.js +27 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tag/tag.css +1 -1
- package/dist/collection/components/tag/tag.js +192 -14
- package/dist/collection/components/tag/tag.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +51 -5
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.js +1 -1
- package/dist/collection/components/upload/upload.js +46 -30
- package/dist/collection/components/upload/upload.js.map +1 -1
- package/dist/components/br-avatar.js +4 -3
- package/dist/components/br-avatar.js.map +1 -1
- package/dist/components/br-breadcrumb.js +4 -4
- package/dist/components/br-button.js +4 -4
- package/dist/components/br-collapse.js +4 -4
- package/dist/components/br-footer-category.js +3 -3
- package/dist/components/br-footer-social.js +2 -2
- package/dist/components/br-icon.js +1 -1
- package/dist/components/br-input.js +1 -1
- package/dist/components/br-list.js +1 -1
- package/dist/components/br-message.js +11 -9
- package/dist/components/br-message.js.map +1 -1
- package/dist/components/br-select.js +5 -5
- package/dist/components/br-step-item.js +2 -2
- package/dist/components/br-switch.js +35 -11
- package/dist/components/br-switch.js.map +1 -1
- package/dist/components/br-tab-item.js +1 -1
- package/dist/components/br-tag.js +167 -52
- package/dist/components/br-tag.js.map +1 -1
- package/dist/components/br-textarea.js +42 -15
- package/dist/components/br-textarea.js.map +1 -1
- package/dist/components/br-tooltip.js +31 -31
- package/dist/components/br-upload.js +57 -59
- package/dist/components/br-upload.js.map +1 -1
- package/dist/components/{p-Hceu1c6D.js → p-BUfNFi9N.js} +3 -3
- package/dist/components/{p-mX_ZX0bR.js → p-Bjt1OWm8.js} +4 -4
- package/dist/components/{p-ssSt5UuQ.js → p-Brhs7qAd.js} +6 -7
- package/dist/components/p-Brhs7qAd.js.map +1 -0
- package/dist/components/{p-xvM_htUS.js → p-CYtPDYp6.js} +22 -6
- package/dist/components/p-CYtPDYp6.js.map +1 -0
- package/dist/components/{p-3-jhm6pC.js → p-D0wwETCp.js} +4 -4
- package/dist/custom-elements.json +297 -9
- package/dist/esm/br-avatar.entry.js +1 -1
- package/dist/esm/br-avatar.entry.js.map +1 -1
- package/dist/esm/br-button.br-icon.entry.js.map +1 -1
- package/dist/esm/br-button_2.entry.js +15 -2
- package/dist/esm/br-button_2.entry.js.map +1 -1
- package/dist/esm/br-message.entry.js +2 -2
- package/dist/esm/br-message.entry.js.map +1 -1
- package/dist/esm/br-switch.entry.js +28 -2
- package/dist/esm/br-switch.entry.js.map +1 -1
- package/dist/esm/br-tag.entry.js +151 -13
- package/dist/esm/br-tag.entry.js.map +1 -1
- package/dist/esm/br-textarea.entry.js +32 -5
- package/dist/esm/br-textarea.entry.js.map +1 -1
- package/dist/esm/br-tooltip.entry.js +1 -1
- package/dist/esm/br-upload.entry.js +15 -23
- package/dist/esm/br-upload.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/hydrate/index.js +258 -55
- package/dist/hydrate/index.mjs +258 -55
- package/dist/types/components/icon/icon.d.ts +35 -0
- package/dist/types/components/switch/switch.d.ts +8 -3
- package/dist/types/components/tag/tag.d.ts +45 -3
- package/dist/types/components/textarea/textarea.d.ts +18 -0
- package/dist/types/components/upload/upload.d.ts +14 -4
- package/dist/types/components.d.ts +54 -6
- package/dist/webcomponents/br-avatar.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-button.br-icon.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-message.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-switch.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-tag.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-textarea.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-upload.entry.esm.js.map +1 -1
- package/dist/webcomponents/{p-9f9f80c1.entry.js → p-0b45efc3.entry.js} +6 -4
- package/dist/webcomponents/p-0b45efc3.entry.js.map +1 -0
- package/dist/webcomponents/{p-b019dfca.entry.js → p-3f18e20a.entry.js} +23 -9
- package/dist/webcomponents/p-3f18e20a.entry.js.map +1 -0
- package/dist/webcomponents/{p-8b15dfc8.entry.js → p-6dba4bb1.entry.js} +10 -10
- package/dist/webcomponents/{p-df6e707a.entry.js → p-7251c80f.entry.js} +4 -3
- package/dist/webcomponents/p-7251c80f.entry.js.map +1 -0
- package/dist/webcomponents/{p-24f6adad.entry.js → p-73794ac8.entry.js} +42 -16
- package/dist/webcomponents/p-73794ac8.entry.js.map +1 -0
- package/dist/webcomponents/{p-abf81334.entry.js → p-82dec3b6.entry.js} +36 -12
- package/dist/webcomponents/p-82dec3b6.entry.js.map +1 -0
- package/dist/webcomponents/{p-a802ca08.entry.js → p-861b8ebf.entry.js} +55 -58
- package/dist/webcomponents/p-861b8ebf.entry.js.map +1 -0
- package/dist/webcomponents/{p-761f7798.entry.js → p-d3463d4a.entry.js} +161 -48
- package/dist/webcomponents/p-d3463d4a.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/dist/webcomponents.html-custom-data.json +17 -4
- package/package.json +1 -1
- package/dist/components/p-ssSt5UuQ.js.map +0 -1
- package/dist/components/p-xvM_htUS.js.map +0 -1
- package/dist/webcomponents/p-24f6adad.entry.js.map +0 -1
- package/dist/webcomponents/p-761f7798.entry.js.map +0 -1
- package/dist/webcomponents/p-9f9f80c1.entry.js.map +0 -1
- package/dist/webcomponents/p-a802ca08.entry.js.map +0 -1
- package/dist/webcomponents/p-abf81334.entry.js.map +0 -1
- package/dist/webcomponents/p-b019dfca.entry.js.map +0 -1
- package/dist/webcomponents/p-df6e707a.entry.js.map +0 -1
- /package/dist/components/{p-Hceu1c6D.js.map → p-BUfNFi9N.js.map} +0 -0
- /package/dist/components/{p-mX_ZX0bR.js.map → p-Bjt1OWm8.js.map} +0 -0
- /package/dist/components/{p-3-jhm6pC.js.map → p-D0wwETCp.js.map} +0 -0
- /package/dist/webcomponents/{p-8b15dfc8.entry.js.map → p-6dba4bb1.entry.js.map} +0 -0
|
@@ -54,7 +54,7 @@ export class Tag {
|
|
|
54
54
|
* A propriedade 'density' permite definir a densidade do componente.
|
|
55
55
|
* Aceita valores como 'small', 'medium' e 'large', e é refletida no DOM.
|
|
56
56
|
*/
|
|
57
|
-
this.density =
|
|
57
|
+
this.density = DENSITY_MEDIUM;
|
|
58
58
|
/**
|
|
59
59
|
* A propriedade 'shape' define o formato do componente.
|
|
60
60
|
* Valores possíveis:
|
|
@@ -64,7 +64,8 @@ export class Tag {
|
|
|
64
64
|
*/
|
|
65
65
|
this.shape = SHAPE_DEFAULT;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Transforma a tag em um indicador de status, com aparência circular.
|
|
68
|
+
* É flexível podendo ser utilizado com label ou apenas a superfície circular (informação é transmitida por meio de cores).
|
|
68
69
|
*/
|
|
69
70
|
this.status = false;
|
|
70
71
|
/**
|
|
@@ -79,10 +80,41 @@ export class Tag {
|
|
|
79
80
|
* Tag deve estar desabilitado.
|
|
80
81
|
*/
|
|
81
82
|
this.disabled = false;
|
|
83
|
+
/**
|
|
84
|
+
* Rótulo personalizado para leitores de tela.
|
|
85
|
+
* Quando fornecido, substitui completamente o texto visível para usuários de leitores de tela.
|
|
86
|
+
* Útil quando o texto visível não é suficientemente descritivo (ex: ícones, abreviações).
|
|
87
|
+
*/
|
|
88
|
+
this.ariaLabel = null;
|
|
89
|
+
/**
|
|
90
|
+
* ID do elemento que fornece descrição adicional da tag.
|
|
91
|
+
* Referencia um elemento na página que contém informações complementares sobre a tag.
|
|
92
|
+
* A descrição é lida após o conteúdo principal, fornecendo contexto extra aos usuários de leitores de tela.
|
|
93
|
+
* Exemplo: aria-describedby="help-status" onde existe <div id="help-status">Aguardando aprovação</div>
|
|
94
|
+
*/
|
|
95
|
+
this.ariaDescribedby = null;
|
|
82
96
|
/**
|
|
83
97
|
* Tag está selecionada.
|
|
84
98
|
*/
|
|
85
99
|
this.selectedClassValue = false;
|
|
100
|
+
/**
|
|
101
|
+
* Permite navegação por teclado (setas) entre tags do tipo radio (seleção unica).
|
|
102
|
+
* Funciona apenas quando 'interactionSelect' é true e 'multiple' é false.
|
|
103
|
+
* Ignora tags desabilitadas.
|
|
104
|
+
* @param event - Evento de teclado
|
|
105
|
+
*/
|
|
106
|
+
this.handleKeyDown = (event) => {
|
|
107
|
+
if (!this.interactionSelect || this.multiple || this.disabled)
|
|
108
|
+
return;
|
|
109
|
+
if (event.key === 'ArrowRight') {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
this.selectNextRadio();
|
|
112
|
+
}
|
|
113
|
+
else if (event.key === 'ArrowLeft') {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
this.selectPreviousRadio();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
86
118
|
this.handleClose = () => {
|
|
87
119
|
this.el.remove();
|
|
88
120
|
};
|
|
@@ -98,6 +130,14 @@ export class Tag {
|
|
|
98
130
|
this.selected = event.target.checked;
|
|
99
131
|
}
|
|
100
132
|
};
|
|
133
|
+
this.handleInputChange = (event) => {
|
|
134
|
+
if (this.multiple) {
|
|
135
|
+
this.handleChangeValueChecked();
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.handleChangeRadioValue(event);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
101
141
|
}
|
|
102
142
|
handleInteractionChange(newValue) {
|
|
103
143
|
if (newValue && this.interactionSelect) {
|
|
@@ -111,6 +151,14 @@ export class Tag {
|
|
|
111
151
|
this.interaction = false;
|
|
112
152
|
}
|
|
113
153
|
}
|
|
154
|
+
handleSelectedChange(newValue) {
|
|
155
|
+
this.selectedClassValue = newValue;
|
|
156
|
+
}
|
|
157
|
+
handleCheckedChange(event) {
|
|
158
|
+
if (event.detail === this.name && this.el !== event.target) {
|
|
159
|
+
this.selected = false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
114
162
|
componentWillLoad() {
|
|
115
163
|
if (this.interaction && this.interactionSelect) {
|
|
116
164
|
console.warn("Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.");
|
|
@@ -119,9 +167,32 @@ export class Tag {
|
|
|
119
167
|
}
|
|
120
168
|
connectedCallback() {
|
|
121
169
|
this.selectedClassValue = this.selected;
|
|
170
|
+
this.el.addEventListener('keydown', this.handleKeyDown);
|
|
122
171
|
}
|
|
123
|
-
|
|
124
|
-
this.
|
|
172
|
+
disconnectedCallback() {
|
|
173
|
+
this.el.removeEventListener('keydown', this.handleKeyDown);
|
|
174
|
+
}
|
|
175
|
+
selectNextRadio() {
|
|
176
|
+
this.selectRadioByStep(1);
|
|
177
|
+
}
|
|
178
|
+
selectPreviousRadio() {
|
|
179
|
+
this.selectRadioByStep(-1);
|
|
180
|
+
}
|
|
181
|
+
selectRadioByStep(step) {
|
|
182
|
+
const radios = Array.from(document.querySelectorAll(`br-tag[interaction-select][name="${this.name}"]:not([disabled])`));
|
|
183
|
+
const currentIndex = radios.indexOf(this.el);
|
|
184
|
+
if (currentIndex === -1)
|
|
185
|
+
return;
|
|
186
|
+
const newIndex = (currentIndex + step + radios.length) % radios.length;
|
|
187
|
+
this.selectRadioByIndex(radios, newIndex);
|
|
188
|
+
}
|
|
189
|
+
selectRadioByIndex(radios, index) {
|
|
190
|
+
const nextRadio = radios[index];
|
|
191
|
+
const input = nextRadio.shadowRoot?.querySelector('input[type="radio"]');
|
|
192
|
+
if (input !== null) {
|
|
193
|
+
input.focus();
|
|
194
|
+
input.click();
|
|
195
|
+
}
|
|
125
196
|
}
|
|
126
197
|
getCssClassMap() {
|
|
127
198
|
return {
|
|
@@ -129,7 +200,8 @@ export class Tag {
|
|
|
129
200
|
interaction: this.interaction,
|
|
130
201
|
'interaction-select': this.interactionSelect,
|
|
131
202
|
selected: this.selectedClassValue,
|
|
132
|
-
|
|
203
|
+
disabled: this.disabled,
|
|
204
|
+
[this.color]: this.color !== '',
|
|
133
205
|
[DENSITY_SMALL]: this.density === DENSITY_SMALL,
|
|
134
206
|
[DENSITY_MEDIUM]: this.density === DENSITY_MEDIUM,
|
|
135
207
|
[DENSITY_LARGE]: this.density === DENSITY_LARGE,
|
|
@@ -138,28 +210,94 @@ export class Tag {
|
|
|
138
210
|
status: this.status,
|
|
139
211
|
};
|
|
140
212
|
}
|
|
213
|
+
getTagAttributes() {
|
|
214
|
+
if (this.interaction) {
|
|
215
|
+
return {
|
|
216
|
+
id: this.customId,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
id: this.customId,
|
|
221
|
+
role: this.getRole(),
|
|
222
|
+
'aria-label': this.getAriaLabel(),
|
|
223
|
+
'aria-describedby': this.getAriaDescribedBy(),
|
|
224
|
+
'aria-checked': this.getAriaChecked(),
|
|
225
|
+
'aria-disabled': this.getAriaDisabled(),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
getAriaDescribedBy() {
|
|
229
|
+
const hostTitle = this.el.getAttribute('title');
|
|
230
|
+
if (this.hasContent(hostTitle)) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
const hasInternalLabel = !this.status && this.label !== '';
|
|
234
|
+
if (this.ariaDescribedby && this.ariaDescribedby.trim() !== '') {
|
|
235
|
+
return this.ariaDescribedby;
|
|
236
|
+
}
|
|
237
|
+
if (hasInternalLabel && !this.hasContent(this.ariaLabel)) {
|
|
238
|
+
return `${this.customId}-label`;
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Verifica se uma string possui conteúdo válido (não vazia após remover espaços em branco).
|
|
244
|
+
* @param value - String a ser verificada
|
|
245
|
+
* @returns {boolean} true se a string possui conteúdo
|
|
246
|
+
*/
|
|
247
|
+
hasContent(value) {
|
|
248
|
+
return value?.trim().length > 0;
|
|
249
|
+
}
|
|
250
|
+
getAriaLabel() {
|
|
251
|
+
return this.ariaLabel && this.ariaLabel.trim() !== '' ? this.ariaLabel : null;
|
|
252
|
+
}
|
|
253
|
+
getRole() {
|
|
254
|
+
const hostTitle = this.el.getAttribute('title');
|
|
255
|
+
if (this.hasContent(hostTitle)) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
if (this.interactionSelect)
|
|
259
|
+
return this.multiple ? 'checkbox' : 'radio';
|
|
260
|
+
return 'status';
|
|
261
|
+
}
|
|
262
|
+
getAriaChecked() {
|
|
263
|
+
return this.interactionSelect ? (this.selected ? 'true' : 'false') : null;
|
|
264
|
+
}
|
|
265
|
+
getAriaDisabled() {
|
|
266
|
+
return this.disabled ? 'true' : null;
|
|
267
|
+
}
|
|
141
268
|
renderIcon() {
|
|
142
269
|
return this.iconName && this.iconName.trim() !== '' ? (h("br-icon", { "icon-name": this.iconName, "aria-hidden": "true" })) : null;
|
|
143
270
|
}
|
|
144
271
|
renderLabel() {
|
|
145
|
-
return this.shape !== SHAPE_CIRCLE && !this.status ? h("span",
|
|
272
|
+
return this.shape !== SHAPE_CIRCLE && !this.status ? h("span", { id: `${this.customId}-label` }, this.label) : null;
|
|
146
273
|
}
|
|
147
274
|
renderCloseButton() {
|
|
148
275
|
if (!this.interaction)
|
|
149
276
|
return null;
|
|
150
|
-
return (h("br-button", {
|
|
277
|
+
return (h("br-button", { shape: "circle", emphasis: "primary", density: "small", "aria-label": `Fechar ${this.label || 'tag'}`, onClick: this.handleClose, disabled: this.disabled }, h("br-icon", { "icon-name": "fa-solid:times", "aria-hidden": "true" })));
|
|
151
278
|
}
|
|
152
279
|
renderStatusLabel() {
|
|
153
280
|
return this.status ? h("span", { class: "tag-spacing-status" }, this.label) : null;
|
|
154
281
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
282
|
+
renderMainTagContent() {
|
|
283
|
+
return (h("span", { class: this.getCssClassMap(), ...this.getTagAttributes() }, this.renderIcon(), this.renderLabel(), this.renderCloseButton(), h("slot", null)));
|
|
284
|
+
}
|
|
285
|
+
renderStatusLayout(content) {
|
|
286
|
+
return (h("span", { style: { display: 'flex', alignItems: 'center' } }, content, this.renderStatusLabel()));
|
|
287
|
+
}
|
|
288
|
+
renderInteractionSelectTag() {
|
|
289
|
+
if (!this.interactionSelect) {
|
|
290
|
+
return null;
|
|
158
291
|
}
|
|
292
|
+
return (h("span", { class: this.getCssClassMap(), id: this.customId }, h("input", { id: `input-${this.customId}`, type: this.multiple ? 'checkbox' : 'radio', name: this.name, value: this.label, checked: this.selected, onClick: this.handleInputChange, disabled: this.disabled }), h("label", { htmlFor: `input-${this.customId}` }, this.renderIcon(), this.renderLabel())));
|
|
159
293
|
}
|
|
160
294
|
render() {
|
|
161
|
-
const
|
|
162
|
-
return (h(Host, { key: '
|
|
295
|
+
const mainContent = this.renderMainTagContent();
|
|
296
|
+
return (h(Host, { key: 'd93a1ef9a900e1e508f312768c4f850c9ef0528c' }, this.interactionSelect
|
|
297
|
+
? this.renderInteractionSelectTag()
|
|
298
|
+
: this.status
|
|
299
|
+
? this.renderStatusLayout(mainContent)
|
|
300
|
+
: mainContent));
|
|
163
301
|
}
|
|
164
302
|
static get is() { return "br-tag"; }
|
|
165
303
|
static get encapsulation() { return "shadow"; }
|
|
@@ -334,7 +472,7 @@ export class Tag {
|
|
|
334
472
|
"setter": false,
|
|
335
473
|
"attribute": "density",
|
|
336
474
|
"reflect": true,
|
|
337
|
-
"defaultValue": "
|
|
475
|
+
"defaultValue": "DENSITY_MEDIUM"
|
|
338
476
|
},
|
|
339
477
|
"shape": {
|
|
340
478
|
"type": "string",
|
|
@@ -368,7 +506,7 @@ export class Tag {
|
|
|
368
506
|
"optional": false,
|
|
369
507
|
"docs": {
|
|
370
508
|
"tags": [],
|
|
371
|
-
"text": "
|
|
509
|
+
"text": "Transforma a tag em um indicador de status, com apar\u00EAncia circular.\n\u00C9 flex\u00EDvel podendo ser utilizado com label ou apenas a superf\u00EDcie circular (informa\u00E7\u00E3o \u00E9 transmitida por meio de cores)."
|
|
372
510
|
},
|
|
373
511
|
"getter": false,
|
|
374
512
|
"setter": false,
|
|
@@ -435,6 +573,46 @@ export class Tag {
|
|
|
435
573
|
"attribute": "disabled",
|
|
436
574
|
"reflect": true,
|
|
437
575
|
"defaultValue": "false"
|
|
576
|
+
},
|
|
577
|
+
"ariaLabel": {
|
|
578
|
+
"type": "string",
|
|
579
|
+
"mutable": false,
|
|
580
|
+
"complexType": {
|
|
581
|
+
"original": "string",
|
|
582
|
+
"resolved": "string",
|
|
583
|
+
"references": {}
|
|
584
|
+
},
|
|
585
|
+
"required": false,
|
|
586
|
+
"optional": false,
|
|
587
|
+
"docs": {
|
|
588
|
+
"tags": [],
|
|
589
|
+
"text": "R\u00F3tulo personalizado para leitores de tela.\nQuando fornecido, substitui completamente o texto vis\u00EDvel para usu\u00E1rios de leitores de tela.\n\u00DAtil quando o texto vis\u00EDvel n\u00E3o \u00E9 suficientemente descritivo (ex: \u00EDcones, abrevia\u00E7\u00F5es)."
|
|
590
|
+
},
|
|
591
|
+
"getter": false,
|
|
592
|
+
"setter": false,
|
|
593
|
+
"attribute": "aria-label",
|
|
594
|
+
"reflect": true,
|
|
595
|
+
"defaultValue": "null"
|
|
596
|
+
},
|
|
597
|
+
"ariaDescribedby": {
|
|
598
|
+
"type": "string",
|
|
599
|
+
"mutable": false,
|
|
600
|
+
"complexType": {
|
|
601
|
+
"original": "string",
|
|
602
|
+
"resolved": "string",
|
|
603
|
+
"references": {}
|
|
604
|
+
},
|
|
605
|
+
"required": false,
|
|
606
|
+
"optional": false,
|
|
607
|
+
"docs": {
|
|
608
|
+
"tags": [],
|
|
609
|
+
"text": "ID do elemento que fornece descri\u00E7\u00E3o adicional da tag.\nReferencia um elemento na p\u00E1gina que cont\u00E9m informa\u00E7\u00F5es complementares sobre a tag.\nA descri\u00E7\u00E3o \u00E9 lida ap\u00F3s o conte\u00FAdo principal, fornecendo contexto extra aos usu\u00E1rios de leitores de tela.\nExemplo: aria-describedby=\"help-status\" onde existe <div id=\"help-status\">Aguardando aprova\u00E7\u00E3o</div>"
|
|
610
|
+
},
|
|
611
|
+
"getter": false,
|
|
612
|
+
"setter": false,
|
|
613
|
+
"attribute": "aria-describedby",
|
|
614
|
+
"reflect": true,
|
|
615
|
+
"defaultValue": "null"
|
|
438
616
|
}
|
|
439
617
|
};
|
|
440
618
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../../../../../packages/webcomponents/src/components/tag/tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAA;AAItB;;;;GAIG;AAEH,gCAAgC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAA;AAC7B,MAAM,cAAc,GAAG,QAAQ,CAAA;AAC/B,MAAM,aAAa,GAAG,OAAO,CAAA;AAE7B,MAAM,YAAY,GAAG,QAAQ,CAAA;AAC7B,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,aAAa,GAAG,SAAS,CAAA;AAQ/B,MAAM,OAAO,GAAG;IANhB;QAgBE;;;WAGG;QAC+B,UAAK,GAAW,EAAE,CAAA;QAEpD;;;WAGG;QAC+B,aAAQ,GAAW,EAAE,CAAA;QAEvD;;;WAGG;QAC+B,SAAI,GAAW,EAAE,CAAA;QAEnD;;aAEK;QAC6B,aAAQ,GAAY,KAAK,CAAA;QAE3D;;aAEK;QACmC,aAAQ,GAAY,KAAK,CAAA;QAEjE;;;WAGG;QAC+B,aAAQ,GAAW,UAAU,KAAK,EAAE,EAAE,CAAA;QAExE;;;WAGG;QAC+B,UAAK,GAAW,EAAE,CAAA;QAEpD;;;WAGG;QAC+B,YAAO,GAAiC,aAAa,CAAA;QAEvF;;;;;;WAMG;QAC+B,UAAK,GAAqC,aAAa,CAAA;QAEzF;;WAEG;QAC+B,WAAM,GAAY,KAAK,CAAA;QAEzD;;WAEG;QACqC,gBA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AI,KAAK,GAAG,CAAC,CAAA","sourcesContent":["import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/tag?tab=designer).\n *\n * @slot default - Espaço de conteúdo do tag. Geralmente usado para incluir o rótulo ou um ícone.\n */\n\n// Constantes para valores fixos\nconst DENSITY_SMALL = 'small'\nconst DENSITY_MEDIUM = 'medium'\nconst DENSITY_LARGE = 'large'\n\nconst SHAPE_CIRCLE = 'circle'\nconst SHAPE_ROUNDED = 'rounded'\nconst SHAPE_DEFAULT = 'default'\n\n@Component({\n tag: 'br-tag',\n styleUrl: 'tag.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Tag {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrTagElement\n\n /** API de controle de formulário nativa */\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * A propriedade 'label' é uma string que representa o texto a ser exibido no componente.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly label: string = ''\n\n /**\n * A propriedade 'iconName' define o nome do ícone que será exibido ao lado do texto.\n * O valor padrão é 'fa-solid:car', que corresponde a um ícone de carro da biblioteca Font Awesome.\n */\n @Prop({ reflect: true }) readonly iconName: string = ''\n\n /**\n * A propriedade 'name' é uma string que representa o nome do grupo da tag para seleção.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly name: string = ''\n\n /**\n * A tag permite seleção múltipla.\n * */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * A tag está selecionada.\n * */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-tag-${tagId++}`\n\n /**\n * A propriedade 'color' permite definir a cor do componente.\n * Aceita valores como 'red', 'blue', entre outros, e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly color: string = ''\n\n /**\n * A propriedade 'density' permite definir a densidade do componente.\n * Aceita valores como 'small', 'medium' e 'large', e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = DENSITY_SMALL\n\n /**\n * A propriedade 'shape' define o formato do componente.\n * Valores possíveis:\n * - 'circle': Componente com formato circular.\n * - 'rounded': Componente com bordas arredondadas.\n * - 'default': Componente com formato padrão.\n */\n @Prop({ reflect: true }) readonly shape: 'circle' | 'rounded' | 'default' = SHAPE_DEFAULT\n\n /**\n * Status deve ser exibido.\n */\n @Prop({ reflect: true }) readonly status: boolean = false\n\n /**\n * Interação deve ser habilitada.\n */\n @Prop({ reflect: true, mutable: true }) interaction: boolean = false\n\n /**\n * Interação de seleção deve ser habilitada.\n * */\n @Prop({ reflect: true }) interactionSelect: boolean = false\n\n /**\n * Tag deve estar desabilitado.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Tag está selecionada.\n */\n @State() selectedClassValue: boolean = false\n\n /**\n * Evento emitido quando a tag é selecionada.\n */\n @Event() radioSelected: EventEmitter<string>\n\n @Watch('interaction')\n handleInteractionChange(newValue: boolean) {\n if (newValue && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('interactionSelect')\n handleInteractionSelectChange(newValue: boolean) {\n if (newValue && this.interaction) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n componentWillLoad() {\n if (this.interaction && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n connectedCallback() {\n this.selectedClassValue = this.selected\n }\n\n @Watch('selected')\n handleSelectedChange(newValue: boolean) {\n this.selectedClassValue = newValue\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-tag': true,\n interaction: this.interaction,\n 'interaction-select': this.interactionSelect,\n selected: this.selectedClassValue,\n [this.color]: !!this.color,\n [DENSITY_SMALL]: this.density === DENSITY_SMALL,\n [DENSITY_MEDIUM]: this.density === DENSITY_MEDIUM,\n [DENSITY_LARGE]: this.density === DENSITY_LARGE,\n count: this.shape === SHAPE_ROUNDED,\n icon: this.shape === SHAPE_CIRCLE,\n status: this.status,\n }\n }\n\n private renderIcon() {\n return this.iconName && this.iconName.trim() !== '' ? (\n <br-icon icon-name={this.iconName} aria-hidden=\"true\" />\n ) : null\n }\n\n private renderLabel() {\n return this.shape !== SHAPE_CIRCLE && !this.status ? <span>{this.label}</span> : null\n }\n\n private renderCloseButton() {\n if (!this.interaction) return null\n return (\n <br-button\n type=\"button\"\n shape=\"circle\"\n emphasis=\"primary\"\n aria-label=\"Fechar\"\n onClick={this.handleClose}\n disabled={this.disabled}\n >\n <br-icon icon-name=\"fa-solid:times\"></br-icon>\n </br-button>\n )\n }\n\n private renderStatusLabel() {\n return this.status ? <span class=\"tag-spacing-status\">{this.label}</span> : null\n }\n\n private handleClose = () => {\n this.el.remove()\n }\n\n private handleChangeValueChecked = () => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n }\n this.selected = !this.selected\n }\n\n private handleChangeRadioValue = (event: MouseEvent) => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n this.selected = (event.target as HTMLInputElement).checked\n }\n }\n\n @Listen('radioSelected', { target: 'document' })\n handleCheckedChange(event: CustomEvent) {\n if (event.detail === this.name && this.el !== event.target) {\n this.selected = false\n }\n }\n\n render() {\n const mainTagContent = (\n <span class={this.getCssClassMap()} id={this.customId}>\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderCloseButton()}\n <slot></slot>\n </span>\n )\n\n return (\n <Host>\n {!this.status ? (\n mainTagContent\n ) : (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {mainTagContent}\n {this.renderStatusLabel()}\n </div>\n )}\n\n {this.interactionSelect && (\n <span class={this.getCssClassMap()} id={this.customId}>\n {this.multiple ? (\n <input\n id={this.label}\n type=\"checkbox\"\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleChangeValueChecked}\n disabled={this.disabled}\n />\n ) : (\n <input\n id={this.label}\n type=\"radio\"\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleChangeRadioValue}\n disabled={this.disabled}\n />\n )}\n <label htmlFor={this.label}>\n {this.renderIcon()}\n <span>{this.label}</span>\n </label>\n </span>\n )}\n </Host>\n )\n }\n}\n\nlet tagId = 0\n"]}
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../../../../../packages/webcomponents/src/components/tag/tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAA;AAItB;;;;GAIG;AAEH,gCAAgC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAA;AAC7B,MAAM,cAAc,GAAG,QAAQ,CAAA;AAC/B,MAAM,aAAa,GAAG,OAAO,CAAA;AAE7B,MAAM,YAAY,GAAG,QAAQ,CAAA;AAC7B,MAAM,aAAa,GAAG,SAAS,CAAA;AAC/B,MAAM,aAAa,GAAG,SAAS,CAAA;AAQ/B,MAAM,OAAO,GAAG;IANhB;QAgBE;;;WAGG;QAC+B,UAAK,GAAW,EAAE,CAAA;QAEpD;;;WAGG;QAC+B,aAAQ,GAAW,EAAE,C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AQ,GACvB;YACF,aAAO,OAAO,EAAE,SAAS,IAAI,CAAC,QAAQ,EAAE;gBACrC,IAAI,CAAC,UAAU,EAAE;gBACjB,IAAI,CAAC,WAAW,EAAE,CACb,CACH,CACR,CAAA;IACH,CAAC;IAED,MAAM;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAE/C,OAAO,CACL,EAAC,IAAI,uDACF,IAAI,CAAC,iBAAiB;YACrB,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE;YACnC,CAAC,CAAC,IAAI,CAAC,MAAM;gBACX,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC;gBACtC,CAAC,CAAC,WAAW,CACZ,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,KAAK,GAAG,CAAC,CAAA","sourcesContent":["import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/tag?tab=designer).\n *\n * @slot default - Espaço de conteúdo do tag. Geralmente usado para incluir o rótulo ou um ícone.\n */\n\n// Constantes para valores fixos\nconst DENSITY_SMALL = 'small'\nconst DENSITY_MEDIUM = 'medium'\nconst DENSITY_LARGE = 'large'\n\nconst SHAPE_CIRCLE = 'circle'\nconst SHAPE_ROUNDED = 'rounded'\nconst SHAPE_DEFAULT = 'default'\n\n@Component({\n tag: 'br-tag',\n styleUrl: 'tag.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Tag {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrTagElement\n\n /** API de controle de formulário nativa */\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * A propriedade 'label' é uma string que representa o texto a ser exibido no componente.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly label: string = ''\n\n /**\n * A propriedade 'iconName' define o nome do ícone que será exibido ao lado do texto.\n * O valor padrão é 'fa-solid:car', que corresponde a um ícone de carro da biblioteca Font Awesome.\n */\n @Prop({ reflect: true }) readonly iconName: string = ''\n\n /**\n * A propriedade 'name' é uma string que representa o nome do grupo da tag para seleção.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly name: string = ''\n\n /**\n * A tag permite seleção múltipla.\n * */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * A tag está selecionada.\n * */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-tag-${tagId++}`\n\n /**\n * A propriedade 'color' permite definir a cor do componente.\n * Aceita valores como 'red', 'blue', entre outros, e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly color: string = ''\n\n /**\n * A propriedade 'density' permite definir a densidade do componente.\n * Aceita valores como 'small', 'medium' e 'large', e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = DENSITY_MEDIUM\n\n /**\n * A propriedade 'shape' define o formato do componente.\n * Valores possíveis:\n * - 'circle': Componente com formato circular.\n * - 'rounded': Componente com bordas arredondadas.\n * - 'default': Componente com formato padrão.\n */\n @Prop({ reflect: true }) readonly shape: 'circle' | 'rounded' | 'default' = SHAPE_DEFAULT\n\n /**\n * Transforma a tag em um indicador de status, com aparência circular.\n * É flexível podendo ser utilizado com label ou apenas a superfície circular (informação é transmitida por meio de cores).\n */\n @Prop({ reflect: true }) readonly status: boolean = false\n\n /**\n * Interação deve ser habilitada.\n */\n @Prop({ reflect: true, mutable: true }) interaction: boolean = false\n\n /**\n * Interação de seleção deve ser habilitada.\n * */\n @Prop({ reflect: true }) interactionSelect: boolean = false\n\n /**\n * Tag deve estar desabilitado.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Rótulo personalizado para leitores de tela.\n * Quando fornecido, substitui completamente o texto visível para usuários de leitores de tela.\n * Útil quando o texto visível não é suficientemente descritivo (ex: ícones, abreviações).\n */\n @Prop({ reflect: true }) readonly ariaLabel: string = null\n\n /**\n * ID do elemento que fornece descrição adicional da tag.\n * Referencia um elemento na página que contém informações complementares sobre a tag.\n * A descrição é lida após o conteúdo principal, fornecendo contexto extra aos usuários de leitores de tela.\n * Exemplo: aria-describedby=\"help-status\" onde existe <div id=\"help-status\">Aguardando aprovação</div>\n */\n @Prop({ reflect: true }) readonly ariaDescribedby: string = null\n\n /**\n * Tag está selecionada.\n */\n @State() selectedClassValue: boolean = false\n\n /**\n * Evento emitido quando a tag é selecionada.\n */\n @Event() radioSelected: EventEmitter<string>\n\n @Watch('interaction')\n handleInteractionChange(newValue: boolean) {\n if (newValue && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('interactionSelect')\n handleInteractionSelectChange(newValue: boolean) {\n if (newValue && this.interaction) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('selected')\n handleSelectedChange(newValue: boolean) {\n this.selectedClassValue = newValue\n }\n\n @Listen('radioSelected', { target: 'document' })\n handleCheckedChange(event: CustomEvent) {\n if (event.detail === this.name && this.el !== event.target) {\n this.selected = false\n }\n }\n\n componentWillLoad() {\n if (this.interaction && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n connectedCallback() {\n this.selectedClassValue = this.selected\n this.el.addEventListener('keydown', this.handleKeyDown)\n }\n\n disconnectedCallback() {\n this.el.removeEventListener('keydown', this.handleKeyDown)\n }\n /**\n * Permite navegação por teclado (setas) entre tags do tipo radio (seleção unica).\n * Funciona apenas quando 'interactionSelect' é true e 'multiple' é false.\n * Ignora tags desabilitadas.\n * @param event - Evento de teclado\n */\n private handleKeyDown = (event: KeyboardEvent) => {\n if (!this.interactionSelect || this.multiple || this.disabled) return\n\n if (event.key === 'ArrowRight') {\n event.preventDefault()\n this.selectNextRadio()\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n this.selectPreviousRadio()\n }\n }\n\n private selectNextRadio() {\n this.selectRadioByStep(1)\n }\n\n private selectPreviousRadio() {\n this.selectRadioByStep(-1)\n }\n\n private selectRadioByStep(step: number) {\n const radios = Array.from(\n document.querySelectorAll(`br-tag[interaction-select][name=\"${this.name}\"]:not([disabled])`)\n ) as HTMLElement[]\n const currentIndex = radios.indexOf(this.el)\n if (currentIndex === -1) return\n const newIndex = (currentIndex + step + radios.length) % radios.length\n this.selectRadioByIndex(radios, newIndex)\n }\n\n private selectRadioByIndex(radios: HTMLElement[], index: number) {\n const nextRadio = radios[index] as HTMLBrTagElement\n const input = nextRadio.shadowRoot?.querySelector('input[type=\"radio\"]') as HTMLInputElement | null\n if (input !== null) {\n input.focus()\n input.click()\n }\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-tag': true,\n interaction: this.interaction,\n 'interaction-select': this.interactionSelect,\n selected: this.selectedClassValue,\n disabled: this.disabled,\n [this.color]: this.color !== '',\n [DENSITY_SMALL]: this.density === DENSITY_SMALL,\n [DENSITY_MEDIUM]: this.density === DENSITY_MEDIUM,\n [DENSITY_LARGE]: this.density === DENSITY_LARGE,\n count: this.shape === SHAPE_ROUNDED,\n icon: this.shape === SHAPE_CIRCLE,\n status: this.status,\n }\n }\n\n private getTagAttributes() {\n if (this.interaction) {\n return {\n id: this.customId,\n }\n }\n\n return {\n id: this.customId,\n role: this.getRole(),\n 'aria-label': this.getAriaLabel(),\n 'aria-describedby': this.getAriaDescribedBy(),\n 'aria-checked': this.getAriaChecked(),\n 'aria-disabled': this.getAriaDisabled(),\n }\n }\n\n private getAriaDescribedBy(): string | null {\n const hostTitle = this.el.getAttribute('title')\n if (this.hasContent(hostTitle)) {\n return null\n }\n\n const hasInternalLabel = !this.status && this.label !== ''\n\n if (this.ariaDescribedby && this.ariaDescribedby.trim() !== '') {\n return this.ariaDescribedby\n }\n\n if (hasInternalLabel && !this.hasContent(this.ariaLabel)) {\n return `${this.customId}-label`\n }\n\n return null\n }\n\n /**\n * Verifica se uma string possui conteúdo válido (não vazia após remover espaços em branco).\n * @param value - String a ser verificada\n * @returns {boolean} true se a string possui conteúdo\n */\n private hasContent(value: string): boolean {\n return value?.trim().length > 0\n }\n\n private getAriaLabel(): string | null {\n return this.ariaLabel && this.ariaLabel.trim() !== '' ? this.ariaLabel : null\n }\n\n private getRole(): string | null {\n const hostTitle = this.el.getAttribute('title')\n if (this.hasContent(hostTitle)) {\n return null\n }\n\n if (this.interactionSelect) return this.multiple ? 'checkbox' : 'radio'\n return 'status'\n }\n\n private getAriaChecked(): string | null {\n return this.interactionSelect ? (this.selected ? 'true' : 'false') : null\n }\n\n private getAriaDisabled(): string | null {\n return this.disabled ? 'true' : null\n }\n\n private renderIcon() {\n return this.iconName && this.iconName.trim() !== '' ? (\n <br-icon icon-name={this.iconName} aria-hidden=\"true\" />\n ) : null\n }\n\n private renderLabel() {\n return this.shape !== SHAPE_CIRCLE && !this.status ? <span id={`${this.customId}-label`}>{this.label}</span> : null\n }\n\n private renderCloseButton() {\n if (!this.interaction) return null\n return (\n <br-button\n shape=\"circle\"\n emphasis=\"primary\"\n density=\"small\"\n aria-label={`Fechar ${this.label || 'tag'}`}\n onClick={this.handleClose}\n disabled={this.disabled}\n >\n <br-icon icon-name=\"fa-solid:times\" aria-hidden=\"true\"></br-icon>\n </br-button>\n )\n }\n\n private renderStatusLabel() {\n return this.status ? <span class=\"tag-spacing-status\">{this.label}</span> : null\n }\n\n private handleClose = () => {\n this.el.remove()\n }\n\n private handleChangeValueChecked = () => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n }\n this.selected = !this.selected\n }\n\n private handleChangeRadioValue = (event: MouseEvent) => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n this.selected = (event.target as HTMLInputElement).checked\n }\n }\n\n private renderMainTagContent() {\n return (\n <span class={this.getCssClassMap()} {...this.getTagAttributes()}>\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderCloseButton()}\n <slot></slot>\n </span>\n )\n }\n\n private renderStatusLayout(content: JSX.Element) {\n return (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {content}\n {this.renderStatusLabel()}\n </span>\n )\n }\n\n private handleInputChange = (event: MouseEvent) => {\n if (this.multiple) {\n this.handleChangeValueChecked()\n } else {\n this.handleChangeRadioValue(event)\n }\n }\n\n private renderInteractionSelectTag() {\n if (!this.interactionSelect) {\n return null\n }\n\n return (\n <span class={this.getCssClassMap()} id={this.customId}>\n <input\n id={`input-${this.customId}`}\n type={this.multiple ? 'checkbox' : 'radio'}\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleInputChange}\n disabled={this.disabled}\n />\n <label htmlFor={`input-${this.customId}`}>\n {this.renderIcon()}\n {this.renderLabel()}\n </label>\n </span>\n )\n }\n\n render() {\n const mainContent = this.renderMainTagContent()\n\n return (\n <Host>\n {this.interactionSelect\n ? this.renderInteractionSelectTag()\n : this.status\n ? this.renderStatusLayout(mainContent)\n : mainContent}\n </Host>\n )\n }\n}\n\nlet tagId = 0\n"]}
|
|
@@ -37,15 +37,15 @@ export class Textarea {
|
|
|
37
37
|
this.isInline = false;
|
|
38
38
|
this.handleInput = (event) => {
|
|
39
39
|
this.value = event.target.value;
|
|
40
|
-
this.currentLength = this.value?.length;
|
|
40
|
+
this.currentLength = this.value?.length || 0;
|
|
41
41
|
this.valueChange.emit(this.value);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
componentWillLoad() {
|
|
45
|
-
this.currentLength = this.value?.length;
|
|
45
|
+
this.currentLength = this.value?.length || 0;
|
|
46
46
|
}
|
|
47
47
|
valueChanged() {
|
|
48
|
-
this.currentLength = this.value?.length;
|
|
48
|
+
this.currentLength = this.value?.length || 0;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Define um novo valor para o textarea.
|
|
@@ -53,9 +53,35 @@ export class Textarea {
|
|
|
53
53
|
*/
|
|
54
54
|
async setValue(newValue) {
|
|
55
55
|
this.value = newValue;
|
|
56
|
-
this.currentLength = this.value?.length;
|
|
56
|
+
this.currentLength = this.value?.length || 0;
|
|
57
57
|
this.valueChange.emit(this.value);
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Retorna os ids para o atributo aria-describedby do textarea
|
|
61
|
+
*/
|
|
62
|
+
getDescribedBy() {
|
|
63
|
+
return [this.showCounter ? `${this.customId}-limitMax` : null, `${this.customId}-slotInfo`]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(' ');
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determina o texto a ser usado para acessibilidade quando não há label
|
|
69
|
+
* Ordem de prioridade:
|
|
70
|
+
* - aria-label do elemento host
|
|
71
|
+
* - propriedade ariaLabel do componente
|
|
72
|
+
* - placeholder
|
|
73
|
+
* - texto padrão ("Campo de texto")
|
|
74
|
+
*/
|
|
75
|
+
getAccessibilityLabel() {
|
|
76
|
+
const hostAriaLabel = this.el.getAttribute('aria-label');
|
|
77
|
+
return hostAriaLabel && hostAriaLabel.trim() !== ''
|
|
78
|
+
? hostAriaLabel
|
|
79
|
+
: this.ariaLabel && this.ariaLabel.trim() !== ''
|
|
80
|
+
? this.ariaLabel
|
|
81
|
+
: this.placeholder && this.placeholder.trim() !== ''
|
|
82
|
+
? this.placeholder
|
|
83
|
+
: 'Campo de texto';
|
|
84
|
+
}
|
|
59
85
|
getCssClassMap() {
|
|
60
86
|
return {
|
|
61
87
|
'br-textarea': true,
|
|
@@ -70,7 +96,8 @@ export class Textarea {
|
|
|
70
96
|
render() {
|
|
71
97
|
const caracteresRestantes = this.maxlength - this.currentLength;
|
|
72
98
|
const mostrarLimite = this.currentLength > 0;
|
|
73
|
-
|
|
99
|
+
const hasLabel = !!this.label;
|
|
100
|
+
return (h(Host, { key: '2ef9c7541022573e6c1da8a05e5d10e4831d1348' }, h("div", { key: 'b8756f018a5517345ba33c746b8927dc7107ba5c', class: this.getCssClassMap() }, h("div", { key: 'ffa093877353602fdebe1f5d4e7c45c2fc3f63d3', class: this.isInline ? 'row' : '' }, this.isInline ? (h("div", { class: "col-auto pt-half" }, h("label", { htmlFor: this.customId }, this.label))) : (h("label", { htmlFor: this.customId }, this.label)), h("div", { key: '8afafd7535e57a978ead59165eb6b227b02820be', class: this.isInline ? 'col' : '' }, h("textarea", { key: '83772b0c42ea0d09991e4a622d8f86851bda2a8b', id: this.customId, value: this.value, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput, ...(this.maxlength > 0 ? { maxLength: this.maxlength } : {}), "aria-describedby": this.getDescribedBy(), ...(!hasLabel ? { 'aria-label': this.getAccessibilityLabel() } : {}) }), h("div", { key: '7e1a019e4186f4d888fd2898665aa3037f543a8e', class: "text-base mt-1" }, this.showCounter && (h("div", { key: '9e80a2b49f9f107acf8a07958c5ba15881bc0fd9' }, mostrarLimite ? (h("span", { class: "restantes", "aria-live": "polite", role: "status", id: `${this.customId}-limitMax` }, "Restam ", h("strong", null, caracteresRestantes), " caracteres")) : (h("span", { class: "limit", "aria-live": "polite", id: `${this.customId}-limitMax` }, "Limite m\u00E1ximo de ", h("strong", null, this.maxlength), " caracteres"))))), h("div", { key: 'cb5d661d80018f2e3a3159d7e3b427a26572e1c0', id: `${this.customId}-slotInfo`, "aria-live": "polite" }, h("slot", { key: '38bace1df619a710ba8474e19e21ff76cf27563c' })))))));
|
|
74
101
|
}
|
|
75
102
|
static get is() { return "br-textarea"; }
|
|
76
103
|
static get encapsulation() { return "shadow"; }
|
|
@@ -144,6 +171,25 @@ export class Textarea {
|
|
|
144
171
|
"attribute": "placeholder",
|
|
145
172
|
"reflect": true
|
|
146
173
|
},
|
|
174
|
+
"ariaLabel": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"mutable": false,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "string",
|
|
179
|
+
"resolved": "string",
|
|
180
|
+
"references": {}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "Texto alternativo para acessibilidade quando n\u00E3o h\u00E1 label vis\u00EDvel.\nFornece um r\u00F3tulo para tecnologias assistivas sem exibir visualmente."
|
|
187
|
+
},
|
|
188
|
+
"getter": false,
|
|
189
|
+
"setter": false,
|
|
190
|
+
"attribute": "aria-label",
|
|
191
|
+
"reflect": true
|
|
192
|
+
},
|
|
147
193
|
"customId": {
|
|
148
194
|
"type": "string",
|
|
149
195
|
"mutable": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../../../../packages/webcomponents/src/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL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C,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACnD;wBACZ,4DAAK,KAAK,EAAC,gBAAgB,IACxB,IAAI,CAAC,WAAW,IAAI,CACnB,8DACG,aAAa,CAAC,CAAC,CAAC,CACf,YAAM,KAAK,EAAC,WAAW,eAAW,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAC,UAAU;;4BAC7D,kBAAS,mBAAmB,CAAU;0CACxC,CACR,CAAC,CAAC,CAAC,CACF,YAAM,KAAK,EAAC,OAAO,eAAW,QAAQ;;4BACnB,kBAAS,IAAI,CAAC,SAAS,CAAU;0CAC7C,CACR,CACG,CACP,CACG;wBACN,8DAAa,CACT,CACF,CACF,CACD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,UAAU,GAAG,CAAC,CAAA","sourcesContent":["import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/textarea?tab=designer).\n *\n * @slot default - Espaço de conteúdo do textarea. Geralmente usado para incluir texto adicional ou instruções para o usuário.\n */\n@Component({\n tag: 'br-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Textarea {\n @Element() el: HTMLBrTextareaElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Valor exibido no textarea.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ mutable: true, reflect: true }) value: string\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) readonly placeholder: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-textarea-${textareaId++}`\n\n /**\n * Indica se o textarea está desabilitado. Quando verdadeiro, o usuário não pode interagir com o campo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Número máximo de caracteres permitidos no textarea. Se definido como 0, não há limite.\n */\n @Prop({ reflect: true }) readonly maxlength: number = 0\n\n /**\n * Mostra o contador com a quantidade máxima de caracteres.\n */\n @Prop({ reflect: true }) readonly showCounter: boolean = false\n\n /**\n * Define o estado visual do componente, podendo ser 'danger', 'success' ou 'warning'.\n */\n @Prop({ reflect: true }) readonly state: 'danger' | 'success' | 'warning'\n /**\n * Ajusta a densidade do componente, podendo ser 'small', 'medium' ou 'large'.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = 'medium'\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Comprimento atual do texto no textarea. É atualizado sempre que o valor do textarea muda.\n */\n @State() currentLength: number\n\n componentWillLoad() {\n this.currentLength = this.value?.length\n }\n\n /**\n * Valor atualizado do textarea\n */\n @Event() valueChange: EventEmitter<string>\n\n @Watch('value')\n valueChanged() {\n this.currentLength = this.value?.length\n }\n\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.currentLength = this.value?.length\n this.valueChange.emit(this.value)\n }\n\n /**\n * Define um novo valor para o textarea.\n * @param newValue - O novo valor a ser definido.\n */\n @Method()\n async setValue(newValue: string) {\n this.value = newValue\n this.currentLength = this.value?.length\n this.valueChange.emit(this.value)\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-textarea': true,\n small: this.density === 'small',\n medium: this.density === 'medium',\n large: this.density === 'large',\n success: this.state === 'success',\n danger: this.state === 'danger',\n warning: this.state === 'warning',\n }\n }\n\n render() {\n const caracteresRestantes: number = this.maxlength - this.currentLength\n const mostrarLimite = this.currentLength > 0\n\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <div class={this.isInline ? 'row' : ''}>\n {this.isInline ? (\n <div class=\"col-auto pt-half\">\n <label htmlFor={this.customId}>{this.label}</label>\n </div>\n ) : (\n <label htmlFor={this.customId}>{this.label}</label>\n )}\n <div class={this.isInline ? 'col' : ''}>\n <textarea\n id={this.customId}\n value={this.value}\n placeholder={this.placeholder}\n disabled={this.disabled}\n onInput={this.handleInput}\n {...(this.maxlength > 0 ? { maxLength: this.maxlength } : {})}\n ></textarea>\n <div class=\"text-base mt-1\">\n {this.showCounter && (\n <div>\n {mostrarLimite ? (\n <span class=\"restantes\" aria-live=\"polite\" role=\"status\" id=\"limitMax\">\n Restam <strong>{caracteresRestantes}</strong> caracteres\n </span>\n ) : (\n <span class=\"limit\" aria-live=\"polite\">\n Limite máximo de <strong>{this.maxlength}</strong> caracteres\n </span>\n )}\n </div>\n )}\n </div>\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n )\n }\n}\n\nlet textareaId = 0\n"]}
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../../../../packages/webcomponents/src/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAA;AAItB;;;;GAIG;AAOH,MAAM,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F,YAAM,KAAK,EAAC,OAAO,eAAW,QAAQ,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,WAAW;;4BACnD,kBAAS,IAAI,CAAC,SAAS,CAAU;0CAC7C,CACR,CACG,CACP,CACG;wBACN,4DAAK,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,WAAW,eAAY,QAAQ;4BACtD,8DAAa,CACT,CACF,CACF,CACF,CACD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,UAAU,GAAG,CAAC,CAAA","sourcesContent":["import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/textarea?tab=designer).\n *\n * @slot default - Espaço de conteúdo do textarea. Geralmente usado para incluir texto adicional ou instruções para o usuário.\n */\n@Component({\n tag: 'br-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Textarea {\n @Element() el: HTMLBrTextareaElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Valor exibido no textarea.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ mutable: true, reflect: true }) value: string\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) readonly placeholder: string\n\n /**\n * Texto alternativo para acessibilidade quando não há label visível.\n * Fornece um rótulo para tecnologias assistivas sem exibir visualmente.\n */\n @Prop({ reflect: true }) readonly ariaLabel: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-textarea-${textareaId++}`\n\n /**\n * Indica se o textarea está desabilitado. Quando verdadeiro, o usuário não pode interagir com o campo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Número máximo de caracteres permitidos no textarea. Se definido como 0, não há limite.\n */\n @Prop({ reflect: true }) readonly maxlength: number = 0\n\n /**\n * Mostra o contador com a quantidade máxima de caracteres.\n */\n @Prop({ reflect: true }) readonly showCounter: boolean = false\n\n /**\n * Define o estado visual do componente, podendo ser 'danger', 'success' ou 'warning'.\n */\n @Prop({ reflect: true }) readonly state: 'danger' | 'success' | 'warning'\n /**\n * Ajusta a densidade do componente, podendo ser 'small', 'medium' ou 'large'.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = 'medium'\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Comprimento atual do texto no textarea. É atualizado sempre que o valor do textarea muda.\n */\n @State() currentLength: number\n\n componentWillLoad() {\n this.currentLength = this.value?.length || 0\n }\n\n /**\n * Valor atualizado do textarea\n */\n @Event() valueChange: EventEmitter<string>\n\n @Watch('value')\n valueChanged() {\n this.currentLength = this.value?.length || 0\n }\n\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.currentLength = this.value?.length || 0\n this.valueChange.emit(this.value)\n }\n\n /**\n * Define um novo valor para o textarea.\n * @param newValue - O novo valor a ser definido.\n */\n @Method()\n async setValue(newValue: string) {\n this.value = newValue\n this.currentLength = this.value?.length || 0\n this.valueChange.emit(this.value)\n }\n\n /**\n * Retorna os ids para o atributo aria-describedby do textarea\n */\n private getDescribedBy(): string {\n return [this.showCounter ? `${this.customId}-limitMax` : null, `${this.customId}-slotInfo`]\n .filter(Boolean)\n .join(' ')\n }\n\n /**\n * Determina o texto a ser usado para acessibilidade quando não há label\n * Ordem de prioridade:\n * - aria-label do elemento host\n * - propriedade ariaLabel do componente\n * - placeholder\n * - texto padrão (\"Campo de texto\")\n */\n private getAccessibilityLabel(): string {\n const hostAriaLabel = this.el.getAttribute('aria-label')\n\n return hostAriaLabel && hostAriaLabel.trim() !== ''\n ? hostAriaLabel\n : this.ariaLabel && this.ariaLabel.trim() !== ''\n ? this.ariaLabel\n : this.placeholder && this.placeholder.trim() !== ''\n ? this.placeholder\n : 'Campo de texto'\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-textarea': true,\n small: this.density === 'small',\n medium: this.density === 'medium',\n large: this.density === 'large',\n success: this.state === 'success',\n danger: this.state === 'danger',\n warning: this.state === 'warning',\n }\n }\n\n render() {\n const caracteresRestantes: number = this.maxlength - this.currentLength\n const mostrarLimite = this.currentLength > 0\n const hasLabel = !!this.label\n\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <div class={this.isInline ? 'row' : ''}>\n {this.isInline ? (\n <div class=\"col-auto pt-half\">\n <label htmlFor={this.customId}>{this.label}</label>\n </div>\n ) : (\n <label htmlFor={this.customId}>{this.label}</label>\n )}\n\n <div class={this.isInline ? 'col' : ''}>\n <textarea\n id={this.customId}\n value={this.value}\n placeholder={this.placeholder}\n disabled={this.disabled}\n onInput={this.handleInput}\n {...(this.maxlength > 0 ? { maxLength: this.maxlength } : {})}\n aria-describedby={this.getDescribedBy()}\n {...(!hasLabel ? { 'aria-label': this.getAccessibilityLabel() } : {})}\n ></textarea>\n <div class=\"text-base mt-1\">\n {this.showCounter && (\n <div>\n {mostrarLimite ? (\n <span class=\"restantes\" aria-live=\"polite\" role=\"status\" id={`${this.customId}-limitMax`}>\n Restam <strong>{caracteresRestantes}</strong> caracteres\n </span>\n ) : (\n <span class=\"limit\" aria-live=\"polite\" id={`${this.customId}-limitMax`}>\n Limite máximo de <strong>{this.maxlength}</strong> caracteres\n </span>\n )}\n </div>\n )}\n </div>\n <div id={`${this.customId}-slotInfo`} aria-live=\"polite\">\n <slot></slot>\n </div>\n </div>\n </div>\n </div>\n </Host>\n )\n }\n}\n\nlet textareaId = 0\n"]}
|
|
@@ -345,7 +345,7 @@ export class Tooltip {
|
|
|
345
345
|
* @returns JSX.Element
|
|
346
346
|
*/
|
|
347
347
|
render() {
|
|
348
|
-
return (h(Host, { key: '
|
|
348
|
+
return (h(Host, { key: '3a99ff00895f77cf90574ccbd8ccae37ce68f9bb' }, h("div", { key: 'd642b5e8747633cd155a89afa3e84e5036dfdc10', id: this.customId, class: this.getCssClassMap() }, h("div", { key: 'bb6b81ac3460ffacbe071082f634d0482c4b106c', class: this.getTriggerCssClassMap(), ref: (el) => (this.triggerElement = el), "aria-describedby": `${this.customId}-content`, "aria-expanded": this.isVisible ? 'true' : 'false', "aria-controls": `${this.customId}-content`, role: "button", tabindex: "-1 " }, h("slot", { key: '30bc547b469bc666a58f2e04203df0b44e330fef', name: "trigger" })), h("div", { key: '67c59e644d3b88deab9553accc461c2f6136a312', id: `${this.customId}-content`, class: this.getContentCssClassMap(), ref: (el) => (this.contentElement = el), role: this.type === 'popover' ? 'dialog' : 'tooltip', tabindex: "-1" }, h("slot", { key: 'e3321ee00f78e6e7332c528029d9ea6f5ceabf9d', name: "content" }), this.type === 'popover' && (h("br-button", { key: '61a1e0732d23e3eec044788b9a9953d1229c3e14', class: "close", shape: "circle", density: "small", onClick: this.hideContent, "aria-label": "Fechar popover" }, h("br-icon", { key: '93357409f8f123d36708118dc23b368ff534e0d7', "icon-name": "fa6-solid:xmark" }))), h("div", { key: 'd3fd53e7146b4e01daa827c64f526fde5f78aef9', class: this.getArrowCssClassMap(), ref: (el) => (this.arrowElement = el) })))));
|
|
349
349
|
}
|
|
350
350
|
static get is() { return "br-tooltip"; }
|
|
351
351
|
static get encapsulation() { return "shadow"; }
|