@seedgrid/fe-components 2026.10.2 → 2026.10.3
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/ai/seedgrid-components.manifest.json +47 -0
- package/dist/generated/compiledStyles.d.ts +1 -1
- package/dist/generated/compiledStyles.d.ts.map +1 -1
- package/dist/generated/compiledStyles.js +1 -1
- package/dist/i18n/es.js +63 -63
- package/dist/i18n/fr.js +49 -49
- package/dist/i18n/pt-BR.js +9 -9
- package/dist/i18n/pt-PT.js +9 -9
- package/dist/inputs/SgInputCNPJ.d.ts.map +1 -1
- package/dist/inputs/SgInputCNPJ.js +1 -6
- package/dist/inputs/SgInputCPFCNPJ.d.ts +10 -0
- package/dist/inputs/SgInputCPFCNPJ.d.ts.map +1 -1
- package/dist/inputs/SgInputCPFCNPJ.js +55 -2
- package/dist/inputs/SgInputCPFCNPJ.meta.d.ts.map +1 -1
- package/dist/inputs/SgInputCPFCNPJ.meta.js +11 -0
- package/dist/inputs/SgInputPassword.d.ts.map +1 -1
- package/dist/inputs/SgInputPassword.js +6 -0
- package/dist/inputs/publicaCnpj.d.ts +3 -0
- package/dist/inputs/publicaCnpj.d.ts.map +1 -0
- package/dist/inputs/publicaCnpj.js +7 -0
- package/dist/overlay/SgDialog.d.ts.map +1 -1
- package/dist/overlay/SgDialog.js +15 -11
- package/dist/sandbox.cjs +47 -47
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/i18n/fr.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
const fr = {
|
|
2
2
|
"components.actions.clear": "Effacer",
|
|
3
3
|
"components.wizard.next": "Suivant",
|
|
4
|
-
"components.wizard.previous": "
|
|
4
|
+
"components.wizard.previous": "Précédent",
|
|
5
5
|
"components.wizard.finish": "Terminer",
|
|
6
6
|
"components.password.show": "Afficher le mot de passe",
|
|
7
7
|
"components.password.hide": "Masquer le mot de passe",
|
|
8
|
-
"components.password.generate": "
|
|
8
|
+
"components.password.generate": "Générer un mot de passe",
|
|
9
9
|
"components.password.common": "Le mot de passe est trop courant. Choisissez-en un plus fort.",
|
|
10
|
-
"components.password.minSize": "Minimum de {min}
|
|
10
|
+
"components.password.minSize": "Minimum de {min} caractères.",
|
|
11
11
|
"components.password.upper": "Au moins 1 lettre majuscule.",
|
|
12
12
|
"components.password.lower": "Au moins 1 lettre minuscule.",
|
|
13
13
|
"components.password.number": "Au moins 1 chiffre.",
|
|
14
|
-
"components.password.special": "Au moins 1
|
|
15
|
-
"components.password.noRepeat": "Ne
|
|
16
|
-
"components.password.noSeqAsc": "N'utilisez pas de
|
|
17
|
-
"components.password.noSeqDesc": "N'utilisez pas de
|
|
14
|
+
"components.password.special": "Au moins 1 caractère spécial.",
|
|
15
|
+
"components.password.noRepeat": "Ne répétez pas des caractères en séquence.",
|
|
16
|
+
"components.password.noSeqAsc": "N'utilisez pas de séquences ascendantes (ex. 1234, abcd).",
|
|
17
|
+
"components.password.noSeqDesc": "N'utilisez pas de séquences descendantes (ex. 4321, dcba).",
|
|
18
18
|
"components.inputs.required": "Champ obligatoire.",
|
|
19
|
-
"components.inputs.maxLength": "Le champ doit contenir au maximum {max}
|
|
20
|
-
"components.inputs.minLength": "Le champ doit contenir au moins {min}
|
|
19
|
+
"components.inputs.maxLength": "Le champ doit contenir au maximum {max} caractère(s).",
|
|
20
|
+
"components.inputs.minLength": "Le champ doit contenir au moins {min} caractère(s).",
|
|
21
21
|
"components.inputs.minWords": "Le champ doit contenir au moins {min} mot(s).",
|
|
22
22
|
"components.inputs.textarea.required": "Ce champ est obligatoire.",
|
|
23
|
-
"components.inputs.textarea.maxLength": "Le texte doit contenir au maximum {max}
|
|
24
|
-
"components.inputs.textarea.minLength": "Le texte doit contenir au moins {min}
|
|
23
|
+
"components.inputs.textarea.maxLength": "Le texte doit contenir au maximum {max} caractère(s).",
|
|
24
|
+
"components.inputs.textarea.minLength": "Le texte doit contenir au moins {min} caractère(s).",
|
|
25
25
|
"components.inputs.textarea.minWords": "Le texte doit contenir au moins {min} mot(s).",
|
|
26
26
|
"components.inputs.textarea.minLines": "Le texte doit contenir au moins {min} ligne(s).",
|
|
27
27
|
"components.inputs.cpf.length": "Le CPF doit contenir 11 chiffres.",
|
|
@@ -38,67 +38,67 @@ const fr = {
|
|
|
38
38
|
"components.inputs.postalCode.ES.invalid": "Code postal invalide.",
|
|
39
39
|
"components.inputs.postalCode.UY.length": "Le code postal doit contenir 5 chiffres.",
|
|
40
40
|
"components.inputs.postalCode.UY.invalid": "Code postal invalide.",
|
|
41
|
-
"components.inputs.postalCode.AR.length": "Le code postal doit contenir 4 ou 8
|
|
41
|
+
"components.inputs.postalCode.AR.length": "Le code postal doit contenir 4 ou 8 caractères.",
|
|
42
42
|
"components.inputs.postalCode.AR.invalid": "Code postal invalide.",
|
|
43
43
|
"components.inputs.postalCode.PY.length": "Le code postal doit contenir 6 chiffres.",
|
|
44
44
|
"components.inputs.postalCode.PY.invalid": "Code postal invalide.",
|
|
45
|
-
"components.inputs.phone.invalid": "
|
|
45
|
+
"components.inputs.phone.invalid": "Numéro de téléphone invalide.",
|
|
46
46
|
"components.inputs.email.invalid": "Email invalide.",
|
|
47
|
-
"components.inputs.otp.slot": "Code
|
|
48
|
-
"components.inputs.otp.group": "Code
|
|
47
|
+
"components.inputs.otp.slot": "Code à usage unique {slot}",
|
|
48
|
+
"components.inputs.otp.group": "Code à usage unique",
|
|
49
49
|
"components.inputs.toggle.ariaLabel": "Basculer option",
|
|
50
|
-
"components.inputs.email.tempInvalid": "Les emails temporaires ne sont pas
|
|
50
|
+
"components.inputs.email.tempInvalid": "Les emails temporaires ne sont pas autorisés.",
|
|
51
51
|
"components.inputs.date.invalid": "Date invalide.",
|
|
52
|
-
"components.inputs.date.range": "La date doit
|
|
53
|
-
"components.inputs.date.min": "La date doit
|
|
54
|
-
"components.inputs.date.max": "La date doit
|
|
52
|
+
"components.inputs.date.range": "La date doit être comprise entre {min} et {max}.",
|
|
53
|
+
"components.inputs.date.min": "La date doit être le {min} ou après.",
|
|
54
|
+
"components.inputs.date.max": "La date doit être le {max} ou avant.",
|
|
55
55
|
"components.inputs.birthdate.required": "Veuillez renseigner votre date de naissance.",
|
|
56
|
-
"components.validators.password.empty": "Le mot de passe ne peut pas
|
|
57
|
-
"components.validators.password.minSize": "minimum de {min}
|
|
56
|
+
"components.validators.password.empty": "Le mot de passe ne peut pas être vide.",
|
|
57
|
+
"components.validators.password.minSize": "minimum de {min} caractères",
|
|
58
58
|
"components.validators.password.upper": "doit inclure une lettre majuscule",
|
|
59
59
|
"components.validators.password.lower": "doit inclure une lettre minuscule",
|
|
60
60
|
"components.validators.password.number": "doit inclure un chiffre",
|
|
61
|
-
"components.validators.password.special": "doit inclure un
|
|
62
|
-
"components.validators.password.sequence": "ne peut pas contenir de
|
|
63
|
-
"components.validators.password.repeated": "ne peut pas contenir de
|
|
61
|
+
"components.validators.password.special": "doit inclure un caractère spécial",
|
|
62
|
+
"components.validators.password.sequence": "ne peut pas contenir de séquences (ex. abc, 123)",
|
|
63
|
+
"components.validators.password.repeated": "ne peut pas contenir de caractères répétés en séquence (ex. aaa, 1111)",
|
|
64
64
|
"components.validators.password.invalid": "Mot de passe invalide : {reasons}",
|
|
65
65
|
"components.validators.birthdate.configMissing": "Configuration invalide : fournissez minAge et/ou maxAge.",
|
|
66
|
-
"components.validators.birthdate.configRange": "Configuration invalide : minAge doit
|
|
66
|
+
"components.validators.birthdate.configRange": "Configuration invalide : minAge doit être <= maxAge.",
|
|
67
67
|
"components.validators.birthdate.invalidDate": "Date invalide.",
|
|
68
|
-
"components.validators.birthdate.ageBetween": "L'
|
|
69
|
-
"components.validators.birthdate.ageMin": "L'
|
|
70
|
-
"components.validators.birthdate.ageMax": "L'
|
|
71
|
-
"components.autocomplete.empty": "Aucun enregistrement trouv
|
|
68
|
+
"components.validators.birthdate.ageBetween": "L'âge doit être compris entre {min} et {max} ans.",
|
|
69
|
+
"components.validators.birthdate.ageMin": "L'âge doit être d'au moins {min} ans.",
|
|
70
|
+
"components.validators.birthdate.ageMax": "L'âge doit être d'au plus {max} ans.",
|
|
71
|
+
"components.autocomplete.empty": "Aucun enregistrement trouvé.",
|
|
72
72
|
"components.autocomplete.loading": "Chargement...",
|
|
73
|
-
"components.inputs.number.min": "La valeur doit
|
|
74
|
-
"components.inputs.number.max": "La valeur doit
|
|
75
|
-
"components.fab.resetConfirm": "
|
|
76
|
-
"components.fab.resetPosition": "
|
|
73
|
+
"components.inputs.number.min": "La valeur doit être au moins {min}.",
|
|
74
|
+
"components.inputs.number.max": "La valeur doit être au plus {max}.",
|
|
75
|
+
"components.fab.resetConfirm": "Réinitialiser la position du bouton ?",
|
|
76
|
+
"components.fab.resetPosition": "Réinitialiser la position",
|
|
77
77
|
"components.fab.yes": "Oui",
|
|
78
78
|
"components.fab.no": "Non",
|
|
79
|
-
"components.dock.resetPosition": "
|
|
80
|
-
"components.dock.resetConfirm": "Voulez-vous vraiment
|
|
81
|
-
"components.dock.dropHere": "
|
|
79
|
+
"components.dock.resetPosition": "Réinitialiser la position",
|
|
80
|
+
"components.dock.resetConfirm": "Voulez-vous vraiment réinitialiser la position du dock par défaut ?",
|
|
81
|
+
"components.dock.dropHere": "Déposer ici",
|
|
82
82
|
"components.actions.cancel": "Annuler",
|
|
83
83
|
"components.actions.confirm": "Confirmer",
|
|
84
84
|
"components.rating.required": "Veuillez fournir une note",
|
|
85
85
|
"components.rating.cancel": "Annuler la note",
|
|
86
86
|
"components.radiogroup.cancel": "Aucune option",
|
|
87
|
-
"components.checkboxgroup.checkAll": "Tout
|
|
88
|
-
"components.orderlist.moveTop": "
|
|
89
|
-
"components.orderlist.moveUp": "
|
|
90
|
-
"components.orderlist.moveDown": "
|
|
91
|
-
"components.orderlist.moveBottom": "
|
|
92
|
-
"components.orderlist.empty": "Aucun
|
|
93
|
-
"components.picklist.moveToTarget": "
|
|
94
|
-
"components.picklist.moveAllToTarget": "Tout
|
|
95
|
-
"components.picklist.moveToSource": "
|
|
96
|
-
"components.picklist.moveAllToSource": "Tout
|
|
87
|
+
"components.checkboxgroup.checkAll": "Tout sélectionner",
|
|
88
|
+
"components.orderlist.moveTop": "Déplacer en haut",
|
|
89
|
+
"components.orderlist.moveUp": "Déplacer vers le haut",
|
|
90
|
+
"components.orderlist.moveDown": "Déplacer vers le bas",
|
|
91
|
+
"components.orderlist.moveBottom": "Déplacer en bas",
|
|
92
|
+
"components.orderlist.empty": "Aucun élément disponible.",
|
|
93
|
+
"components.picklist.moveToTarget": "Déplacer la sélection vers la cible",
|
|
94
|
+
"components.picklist.moveAllToTarget": "Tout déplacer vers la cible",
|
|
95
|
+
"components.picklist.moveToSource": "Déplacer la sélection vers la source",
|
|
96
|
+
"components.picklist.moveAllToSource": "Tout déplacer vers la source",
|
|
97
97
|
"components.picklist.sourceHeader": "Source",
|
|
98
98
|
"components.picklist.targetHeader": "Cible",
|
|
99
99
|
"components.picklist.sourceFilterPlaceholder": "Rechercher dans la source",
|
|
100
100
|
"components.picklist.targetFilterPlaceholder": "Rechercher dans la cible",
|
|
101
|
-
"components.picklist.empty": "Aucun
|
|
101
|
+
"components.picklist.empty": "Aucun élément disponible.",
|
|
102
102
|
"components.gadgets.clock.title": "Horloge",
|
|
103
103
|
"components.gadgets.calendar.title": "Calendrier",
|
|
104
104
|
"components.gadgets.calendar.previousMonth": "Mois precedent",
|
|
@@ -108,8 +108,8 @@ const fr = {
|
|
|
108
108
|
"components.gadgets.gauge.radialAria": "Jauge radiale",
|
|
109
109
|
"components.gadgets.gauge.linearAria": "Jauge lineaire",
|
|
110
110
|
"components.gadgets.gauge.value": "Valeur",
|
|
111
|
-
"components.datatable.empty": "Aucun enregistrement trouv
|
|
112
|
-
"components.datatable.loading": "Chargement des
|
|
111
|
+
"components.datatable.empty": "Aucun enregistrement trouvé.",
|
|
112
|
+
"components.datatable.loading": "Chargement des données...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Rechercher dans toutes les colonnes",
|
|
114
114
|
"components.datatable.clearFilters": "Effacer les filtres",
|
|
115
115
|
"components.datatable.pagination": "Pagination",
|
package/dist/i18n/pt-BR.js
CHANGED
|
@@ -44,9 +44,9 @@ const ptBR = {
|
|
|
44
44
|
"components.inputs.postalCode.PY.invalid": "Código postal inválido.",
|
|
45
45
|
"components.inputs.phone.invalid": "Telefone inválido.",
|
|
46
46
|
"components.inputs.email.invalid": "Email inválido.",
|
|
47
|
-
"components.inputs.otp.slot": "
|
|
48
|
-
"components.inputs.otp.group": "
|
|
49
|
-
"components.inputs.toggle.ariaLabel": "Alternar
|
|
47
|
+
"components.inputs.otp.slot": "Código único {slot}",
|
|
48
|
+
"components.inputs.otp.group": "Código único",
|
|
49
|
+
"components.inputs.toggle.ariaLabel": "Alternar opção",
|
|
50
50
|
"components.inputs.email.tempInvalid": "Email temporário inválido.",
|
|
51
51
|
"components.inputs.date.invalid": "Data inválida.",
|
|
52
52
|
"components.inputs.date.range": "Data deve estar entre {min} e {max}.",
|
|
@@ -101,10 +101,10 @@ const ptBR = {
|
|
|
101
101
|
"components.picklist.empty": "Nenhum item disponivel.",
|
|
102
102
|
"components.gadgets.clock.title": "Rel\u00f3gio",
|
|
103
103
|
"components.gadgets.calendar.title": "Calend\u00e1rio",
|
|
104
|
-
"components.gadgets.calendar.previousMonth": "
|
|
105
|
-
"components.gadgets.calendar.nextMonth": "
|
|
104
|
+
"components.gadgets.calendar.previousMonth": "Mês anterior",
|
|
105
|
+
"components.gadgets.calendar.nextMonth": "Próximo mês",
|
|
106
106
|
"components.gadgets.calendar.goToday": "Ir para hoje",
|
|
107
|
-
"components.gadgets.qrcode.title": "
|
|
107
|
+
"components.gadgets.qrcode.title": "Código QR",
|
|
108
108
|
"components.gadgets.gauge.radialAria": "Medidor radial",
|
|
109
109
|
"components.gadgets.gauge.linearAria": "Medidor linear",
|
|
110
110
|
"components.gadgets.gauge.value": "Valor",
|
|
@@ -201,10 +201,10 @@ const ptBR = {
|
|
|
201
201
|
"components.menu.drag": "Arrastar menu",
|
|
202
202
|
"components.menu.ariaLabel": "Menu",
|
|
203
203
|
"components.toolbar.toggle": "Alternar barra de ferramentas",
|
|
204
|
-
"components.breadcrumb.ariaLabel": "
|
|
204
|
+
"components.breadcrumb.ariaLabel": "Navegação estrutural",
|
|
205
205
|
"components.breadcrumb.overflow": "Mais caminhos",
|
|
206
|
-
"components.pageControl.ariaLabel": "Controle de
|
|
207
|
-
"components.pageControl.empty": "Nenhuma
|
|
206
|
+
"components.pageControl.ariaLabel": "Controle de páginas",
|
|
207
|
+
"components.pageControl.empty": "Nenhuma página visível.",
|
|
208
208
|
"components.expandablePanel.ariaLabel": "Painel expansivel",
|
|
209
209
|
"components.carousel.goToSlide": "Ir para o slide {slide}",
|
|
210
210
|
"components.wizard.progress": "Progresso",
|
package/dist/i18n/pt-PT.js
CHANGED
|
@@ -44,9 +44,9 @@ const ptPT = {
|
|
|
44
44
|
"components.inputs.postalCode.PY.invalid": "Código postal inválido.",
|
|
45
45
|
"components.inputs.phone.invalid": "Telefone inválido.",
|
|
46
46
|
"components.inputs.email.invalid": "Email inválido.",
|
|
47
|
-
"components.inputs.otp.slot": "
|
|
48
|
-
"components.inputs.otp.group": "
|
|
49
|
-
"components.inputs.toggle.ariaLabel": "Alternar
|
|
47
|
+
"components.inputs.otp.slot": "Código único {slot}",
|
|
48
|
+
"components.inputs.otp.group": "Código único",
|
|
49
|
+
"components.inputs.toggle.ariaLabel": "Alternar opção",
|
|
50
50
|
"components.inputs.email.tempInvalid": "Email temporário inválido.",
|
|
51
51
|
"components.inputs.date.invalid": "Data inválida.",
|
|
52
52
|
"components.inputs.date.range": "Data deve estar entre {min} e {max}.",
|
|
@@ -101,10 +101,10 @@ const ptPT = {
|
|
|
101
101
|
"components.picklist.empty": "Nenhum item disponivel.",
|
|
102
102
|
"components.gadgets.clock.title": "Rel\u00f3gio",
|
|
103
103
|
"components.gadgets.calendar.title": "Calend\u00e1rio",
|
|
104
|
-
"components.gadgets.calendar.previousMonth": "
|
|
105
|
-
"components.gadgets.calendar.nextMonth": "
|
|
104
|
+
"components.gadgets.calendar.previousMonth": "Mês anterior",
|
|
105
|
+
"components.gadgets.calendar.nextMonth": "Próximo mês",
|
|
106
106
|
"components.gadgets.calendar.goToday": "Ir para hoje",
|
|
107
|
-
"components.gadgets.qrcode.title": "
|
|
107
|
+
"components.gadgets.qrcode.title": "Código QR",
|
|
108
108
|
"components.gadgets.gauge.radialAria": "Medidor radial",
|
|
109
109
|
"components.gadgets.gauge.linearAria": "Medidor linear",
|
|
110
110
|
"components.gadgets.gauge.value": "Valor",
|
|
@@ -201,10 +201,10 @@ const ptPT = {
|
|
|
201
201
|
"components.menu.drag": "Arrastar menu",
|
|
202
202
|
"components.menu.ariaLabel": "Menu",
|
|
203
203
|
"components.toolbar.toggle": "Alternar barra de ferramentas",
|
|
204
|
-
"components.breadcrumb.ariaLabel": "
|
|
204
|
+
"components.breadcrumb.ariaLabel": "Navegação estrutural",
|
|
205
205
|
"components.breadcrumb.overflow": "Mais caminhos",
|
|
206
|
-
"components.pageControl.ariaLabel": "Controlo de
|
|
207
|
-
"components.pageControl.empty": "Nenhuma
|
|
206
|
+
"components.pageControl.ariaLabel": "Controlo de páginas",
|
|
207
|
+
"components.pageControl.empty": "Nenhuma página visível.",
|
|
208
208
|
"components.expandablePanel.ariaLabel": "Painel expansivel",
|
|
209
209
|
"components.carousel.goToSlide": "Ir para o slide {slide}",
|
|
210
210
|
"components.wizard.progress": "Progresso",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputCNPJ.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCNPJ.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SgInputCNPJ.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCNPJ.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MA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ieldError } from "../rhf";
|
|
|
6
6
|
import { maskCnpj } from "../masks";
|
|
7
7
|
import { isValidCnpj } from "../validators";
|
|
8
8
|
import { t, useComponentsI18n } from "../i18n";
|
|
9
|
+
import { defaultPublicaCnpjFetch } from "./publicaCnpj";
|
|
9
10
|
function onlyAlnumUpper(value) {
|
|
10
11
|
return value.replace(/[^0-9A-Za-z]/g, "").toUpperCase();
|
|
11
12
|
}
|
|
12
13
|
function onlyDigits(value) {
|
|
13
14
|
return value.replace(/\D/g, "");
|
|
14
15
|
}
|
|
15
|
-
const defaultPublicaCnpjFetch = async (cnpj) => {
|
|
16
|
-
const response = await fetch(`https://publica.cnpj.ws/cnpj/${cnpj}`);
|
|
17
|
-
if (!response.ok)
|
|
18
|
-
return null;
|
|
19
|
-
return response.json();
|
|
20
|
-
};
|
|
21
16
|
export function SgInputCNPJ(props) {
|
|
22
17
|
const i18n = useComponentsI18n();
|
|
23
18
|
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, validation, validateWithPublicaCnpj, publicaCnpjErrorMessage, publicaCnpjFetch, onPublicaCnpjResult, onPublicaCnpjError, ...rest } = props;
|
|
@@ -16,6 +16,16 @@ export type SgInputCPFCNPJProps = Omit<SgInputTextProps, "inputProps" | "error">
|
|
|
16
16
|
validation?: (value: string) => string | null;
|
|
17
17
|
onValidation?: (message: string | null) => void;
|
|
18
18
|
validateOnBlur?: boolean;
|
|
19
|
+
/** Quando o documento e um CNPJ numerico valido, confirma na base publica (publica.cnpj.ws) que ele existe. */
|
|
20
|
+
validateWithPublicaCnpj?: boolean;
|
|
21
|
+
/** Mensagem quando a base publica nao encontra o CNPJ. */
|
|
22
|
+
publicaCnpjErrorMessage?: string;
|
|
23
|
+
/** Consulta injetavel (testes sem rede). Padrao: https://publica.cnpj.ws. */
|
|
24
|
+
publicaCnpjFetch?: (cnpj: string) => Promise<unknown | null>;
|
|
25
|
+
/** Recebe o resultado da consulta (`null` quando nao achou). */
|
|
26
|
+
onPublicaCnpjResult?: (data: unknown | null) => void;
|
|
27
|
+
/** Chamado quando a consulta falha (rede ou limite da API); a validacao passa. */
|
|
28
|
+
onPublicaCnpjError?: (error: unknown) => void;
|
|
19
29
|
};
|
|
20
30
|
export declare function SgInputCPFCNPJ(props: SgInputCPFCNPJProps): import("react/jsx-runtime").JSX.Element;
|
|
21
31
|
//# sourceMappingURL=SgInputCPFCNPJ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputCPFCNPJ.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCPFCNPJ.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SgInputCPFCNPJ.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCPFCNPJ.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAOnE,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG;IACjF,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;QACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;KACnC,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+GAA+G;IAC/G,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC7D,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C,CAAC;AAUF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAgKxD"}
|
|
@@ -6,6 +6,7 @@ import { resolveFieldError } from "../rhf";
|
|
|
6
6
|
import { maskCpfCnpj } from "../masks";
|
|
7
7
|
import { isValidCnpj, isValidCpf } from "../validators";
|
|
8
8
|
import { t, useComponentsI18n } from "../i18n";
|
|
9
|
+
import { defaultPublicaCnpjFetch } from "./publicaCnpj";
|
|
9
10
|
function onlyDigits(value) {
|
|
10
11
|
return value.replace(/\D/g, "");
|
|
11
12
|
}
|
|
@@ -14,8 +15,10 @@ function onlyAlnumUpper(value) {
|
|
|
14
15
|
}
|
|
15
16
|
export function SgInputCPFCNPJ(props) {
|
|
16
17
|
const i18n = useComponentsI18n();
|
|
17
|
-
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, validation, ...rest } = props;
|
|
18
|
+
const { required, requiredMessage, lengthMessage, invalidMessage, validateOnBlur, error, validation, validateWithPublicaCnpj, publicaCnpjErrorMessage, publicaCnpjFetch, onPublicaCnpjResult, onPublicaCnpjError, ...rest } = props;
|
|
18
19
|
const [internalError, setInternalError] = React.useState(null);
|
|
20
|
+
const lastValidatedCnpjRef = React.useRef(null);
|
|
21
|
+
const lastPublicaFoundRef = React.useRef(null);
|
|
19
22
|
const runValidation = React.useCallback((value) => {
|
|
20
23
|
const raw = onlyAlnumUpper(value);
|
|
21
24
|
if (!raw && !required) {
|
|
@@ -68,9 +71,59 @@ export function SgInputCPFCNPJ(props) {
|
|
|
68
71
|
props.onValidation?.(message);
|
|
69
72
|
return;
|
|
70
73
|
}
|
|
74
|
+
if (validateWithPublicaCnpj && !/[A-Z]/.test(raw)) {
|
|
75
|
+
const digits = onlyDigits(raw);
|
|
76
|
+
if (digits.length === 14) {
|
|
77
|
+
const message = publicaCnpjErrorMessage ?? invalidMessage ?? t(i18n, "components.inputs.cnpj.invalid");
|
|
78
|
+
if (lastValidatedCnpjRef.current === digits) {
|
|
79
|
+
if (lastPublicaFoundRef.current === false) {
|
|
80
|
+
setInternalError(message);
|
|
81
|
+
props.onValidation?.(message);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
setInternalError(null);
|
|
85
|
+
props.onValidation?.(null);
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
void (async () => {
|
|
90
|
+
try {
|
|
91
|
+
const checker = publicaCnpjFetch ?? defaultPublicaCnpjFetch;
|
|
92
|
+
const data = await checker(digits);
|
|
93
|
+
lastValidatedCnpjRef.current = digits;
|
|
94
|
+
lastPublicaFoundRef.current = Boolean(data);
|
|
95
|
+
onPublicaCnpjResult?.(data);
|
|
96
|
+
if (!data) {
|
|
97
|
+
setInternalError(message);
|
|
98
|
+
props.onValidation?.(message);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
onPublicaCnpjError?.(err);
|
|
104
|
+
}
|
|
105
|
+
setInternalError(null);
|
|
106
|
+
props.onValidation?.(null);
|
|
107
|
+
})();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
71
111
|
setInternalError(null);
|
|
72
112
|
props.onValidation?.(null);
|
|
73
|
-
}, [
|
|
113
|
+
}, [
|
|
114
|
+
i18n,
|
|
115
|
+
required,
|
|
116
|
+
requiredMessage,
|
|
117
|
+
lengthMessage,
|
|
118
|
+
invalidMessage,
|
|
119
|
+
validation,
|
|
120
|
+
props,
|
|
121
|
+
validateWithPublicaCnpj,
|
|
122
|
+
publicaCnpjErrorMessage,
|
|
123
|
+
publicaCnpjFetch,
|
|
124
|
+
onPublicaCnpjResult,
|
|
125
|
+
onPublicaCnpjError
|
|
126
|
+
]);
|
|
74
127
|
const inputProps = {
|
|
75
128
|
...rest.inputProps,
|
|
76
129
|
inputMode: rest.inputProps?.inputMode ?? "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputCPFCNPJ.meta.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCPFCNPJ.meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"SgInputCPFCNPJ.meta.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputCPFCNPJ.meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,MAAM,EAAE,QAiEpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAyBrB,CAAC"}
|
|
@@ -19,6 +19,11 @@ export const sgMeta = {
|
|
|
19
19
|
{ name: "lengthMessage", type: "string", description: "Mensagem para comprimento invalido.", semanticRole: "validation", bindable: true },
|
|
20
20
|
{ name: "invalidMessage", type: "string", description: "Mensagem para documento invalido.", semanticRole: "validation", bindable: true },
|
|
21
21
|
{ name: "validateOnBlur", type: "boolean", default: true, description: "Executa validacao no blur.", semanticRole: "behavior", bindable: true },
|
|
22
|
+
{ name: "validateWithPublicaCnpj", type: "boolean", default: false, description: "Confirma na base publica que o CNPJ numerico existe.", semanticRole: "behavior", bindable: true },
|
|
23
|
+
{ name: "publicaCnpjErrorMessage", type: "string", description: "Mensagem quando a base publica nao encontra o CNPJ.", semanticRole: "validation", bindable: true },
|
|
24
|
+
{ name: "publicaCnpjFetch", type: "(cnpj: string) => Promise<unknown | null>", description: "Consulta injetavel (padrao publica.cnpj.ws).", semanticRole: "behavior", bindable: false },
|
|
25
|
+
{ name: "onPublicaCnpjResult", type: "(data: unknown | null) => void", description: "Recebe o resultado da consulta.", semanticRole: "event", bindable: false },
|
|
26
|
+
{ name: "onPublicaCnpjError", type: "(error: unknown) => void", description: "Chamado quando a consulta falha.", semanticRole: "event", bindable: false },
|
|
22
27
|
{ name: "validation", type: "(value: string) => string | null", description: "Validacao customizada adicional.", semanticRole: "validation", bindable: false },
|
|
23
28
|
{ name: "onValidation", type: "(message: string | null) => void", description: "Callback para estado de validacao.", semanticRole: "event", bindable: false }
|
|
24
29
|
],
|
|
@@ -30,6 +35,12 @@ export const sgMeta = {
|
|
|
30
35
|
file: "apps/showcase/src/app/components/sg-input-cpf-cnpj/samples/basico.tsx.sample",
|
|
31
36
|
kind: "sample"
|
|
32
37
|
},
|
|
38
|
+
{
|
|
39
|
+
id: "publica-cnpj",
|
|
40
|
+
title: "Consulta na base publica",
|
|
41
|
+
file: "apps/showcase/src/app/components/sg-input-cpf-cnpj/samples/cnpj-publico.tsx.sample",
|
|
42
|
+
kind: "sample"
|
|
43
|
+
},
|
|
33
44
|
{
|
|
34
45
|
id: "playground",
|
|
35
46
|
title: "Playground",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputPassword.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputPassword.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAA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CAAC,EAAE,OAAO,CAAC;IACnC,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2CAqbpE"}
|
|
@@ -12,6 +12,8 @@ export function SgInputPassword(props) {
|
|
|
12
12
|
const [isHidden, setIsHidden] = React.useState(hidePassword ?? true);
|
|
13
13
|
const [hasInteracted, setHasInteracted] = React.useState(false);
|
|
14
14
|
const [unmetRequirements, setUnmetRequirements] = React.useState([]);
|
|
15
|
+
// Barra de forca: sem texto digitado nao ha o que medir (antes ficava toda verde com o campo vazio).
|
|
16
|
+
const [hasText, setHasText] = React.useState(false);
|
|
15
17
|
const inputRef = React.useRef(null);
|
|
16
18
|
const commonPasswordSet = React.useMemo(() => {
|
|
17
19
|
if (!commonPasswordCheck)
|
|
@@ -80,11 +82,14 @@ export function SgInputPassword(props) {
|
|
|
80
82
|
prohibitsSequentialAscCharacters,
|
|
81
83
|
prohibitsSequentialDescCharacters
|
|
82
84
|
];
|
|
85
|
+
if (!hasText)
|
|
86
|
+
return 0;
|
|
83
87
|
const activeChecks = totalChecks.filter((v) => v !== false).length;
|
|
84
88
|
if (activeChecks === 0)
|
|
85
89
|
return 0;
|
|
86
90
|
return activeChecks - unmetRequirements.length;
|
|
87
91
|
}, [
|
|
92
|
+
hasText,
|
|
88
93
|
lowerRequired,
|
|
89
94
|
minSize,
|
|
90
95
|
numberRequired,
|
|
@@ -174,6 +179,7 @@ export function SgInputPassword(props) {
|
|
|
174
179
|
upperRequired
|
|
175
180
|
]);
|
|
176
181
|
const runValidation = React.useCallback((value) => {
|
|
182
|
+
setHasText(value.length > 0);
|
|
177
183
|
if (!value && !required) {
|
|
178
184
|
setInternalError(null);
|
|
179
185
|
onValidation?.(null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicaCnpj.d.ts","sourceRoot":"","sources":["../../src/inputs/publicaCnpj.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,eAAO,MAAM,uBAAuB,GAAU,MAAM,MAAM,iBAIzD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Consulta padrao da base publica de CNPJ (publica.cnpj.ws). Resposta nao-2xx vira `null` ("nao achou"). */
|
|
2
|
+
export const defaultPublicaCnpjFetch = async (cnpj) => {
|
|
3
|
+
const response = await fetch(`https://publica.cnpj.ws/cnpj/${cnpj}`);
|
|
4
|
+
if (!response.ok)
|
|
5
|
+
return null;
|
|
6
|
+
return response.json();
|
|
7
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgDialog.d.ts","sourceRoot":"","sources":["../../src/overlay/SgDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IA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AAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAC3E,gCAAgC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsRF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,4BAwRtD;yBAxRe,QAAQ"}
|
package/dist/overlay/SgDialog.js
CHANGED
|
@@ -20,25 +20,25 @@ function sizeClass(size) {
|
|
|
20
20
|
return "max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)] max-h-none";
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/** Cor do acento da severidade: a mesma do fundo do SgButton da severidade (var do tema com fallback). `null` em "plain". */
|
|
24
|
+
function severityColor(severity) {
|
|
24
25
|
switch (severity) {
|
|
25
26
|
case "primary":
|
|
26
|
-
return "
|
|
27
|
+
return "var(--sg-btn-primary-bg, hsl(var(--primary)))";
|
|
27
28
|
case "secondary":
|
|
28
|
-
return "
|
|
29
|
+
return "var(--sg-btn-secondary-bg, hsl(var(--secondary)))";
|
|
29
30
|
case "success":
|
|
30
|
-
return "
|
|
31
|
+
return "var(--sg-btn-success-bg, hsl(var(--tertiary, var(--accent))))";
|
|
31
32
|
case "info":
|
|
32
|
-
return "
|
|
33
|
+
return "var(--sg-btn-info-bg, hsl(var(--secondary, var(--primary))))";
|
|
33
34
|
case "warning":
|
|
34
|
-
return "
|
|
35
|
+
return "var(--sg-btn-warning-bg, hsl(var(--secondary, var(--accent))))";
|
|
35
36
|
case "help":
|
|
36
|
-
return "
|
|
37
|
+
return "var(--sg-btn-help-bg, hsl(var(--secondary, var(--primary))))";
|
|
37
38
|
case "danger":
|
|
38
|
-
return "
|
|
39
|
-
case "plain":
|
|
39
|
+
return "var(--sg-btn-danger-bg, hsl(var(--destructive)))";
|
|
40
40
|
default:
|
|
41
|
-
return
|
|
41
|
+
return null;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function contentStateClass(animation, entered) {
|
|
@@ -400,11 +400,15 @@ export function SgDialog(props) {
|
|
|
400
400
|
const contentStyle = {
|
|
401
401
|
...dialogVars,
|
|
402
402
|
...transitionStyle,
|
|
403
|
+
...(customColor === undefined && severityColor(severity)
|
|
404
|
+
? { backgroundColor: `color-mix(in srgb, ${severityColor(severity)} 12%, hsl(var(--background)))` }
|
|
405
|
+
: {}),
|
|
406
|
+
...(showTopAccent ? { borderTopColor: severityColor(severity) ?? "hsl(var(--border))" } : {}),
|
|
403
407
|
...(customColor !== undefined ? { backgroundColor: customColor } : {}),
|
|
404
408
|
...(customPalette ? { color: customPalette.foreground, borderColor: customPalette.border } : {}),
|
|
405
409
|
...(resolvedShadow !== undefined ? { boxShadow: resolvedShadow } : {})
|
|
406
410
|
};
|
|
407
|
-
return createPortal(_jsxs("div", { className: cn("fixed inset-0 z-[1000]", className), style: style, role: "dialog", "aria-modal": "true", "aria-label": a11yLabel, children: [_jsx("div", { ref: overlayRef, onMouseDown: onOverlayMouseDown, className: cn(overlayBase, overlayState, overlayClassName), style: transitionStyle }), _jsx("div", { className: "fixed inset-0 flex items-center justify-center p-4", onMouseDown: onViewportMouseDown, children: _jsxs("div", { ref: contentRef, className: cn(contentBase, sizeClass(size), contentStateClass(animation, entered),
|
|
411
|
+
return createPortal(_jsxs("div", { className: cn("fixed inset-0 z-[1000]", className), style: style, role: "dialog", "aria-modal": "true", "aria-label": a11yLabel, children: [_jsx("div", { ref: overlayRef, onMouseDown: onOverlayMouseDown, className: cn(overlayBase, overlayState, overlayClassName), style: transitionStyle }), _jsx("div", { className: "fixed inset-0 flex items-center justify-center p-4", onMouseDown: onViewportMouseDown, children: _jsxs("div", { ref: contentRef, className: cn(contentBase, sizeClass(size), contentStateClass(animation, entered), contentClassName), style: contentStyle, children: [(title || subtitle || closeable || leading || trailing) && (_jsxs("div", { className: cn("px-5 py-4 border-b border-[var(--sg-dialog-divider)] flex items-start gap-3", headerClassName), children: [leading ? _jsx("div", { className: "shrink-0 pt-0.5", children: leading }) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [title ? _jsx("div", { className: "text-base font-semibold leading-6", children: title }) : null, subtitle ? _jsx("div", { className: "mt-1 text-sm text-[var(--sg-dialog-muted-foreground)]", children: subtitle }) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [trailing ? _jsx("div", { className: "shrink-0", children: trailing }) : null, closeable ? (_jsx("button", { type: "button", onClick: close, className: cn("inline-flex items-center justify-center h-9 w-9 rounded-lg", "hover:bg-[var(--sg-dialog-hover-bg)] active:bg-[var(--sg-dialog-active-bg)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--ring,var(--primary)))]"), "aria-label": t(i18n, "components.dialog.close"), children: _jsx(CloseIcon, {}) })) : null] })] })), _jsx("div", { className: cn("px-5 py-4 overflow-auto", bodyClassName), children: children }), footer ? (_jsx("div", { className: cn("px-5 py-4 border-t border-[var(--sg-dialog-divider)] flex items-center justify-end gap-2", footerClassName), children: footer })) : null] }) })] }), document.body);
|
|
408
412
|
}
|
|
409
413
|
function CloseIcon() {
|
|
410
414
|
return (_jsx("svg", { viewBox: "0 0 24 24", className: "size-5", "aria-hidden": "true", children: _jsx("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|