@garantiabr/ui-kit 0.0.0-stage → 0.5.13
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/AGENTS.md +89 -0
- package/README.md +269 -2
- package/bin/init.mjs +238 -0
- package/dist/assets/produtos/agente-de-auditoria-icone.svg.js +6 -0
- package/dist/assets/produtos/agente-de-auditoria-icone.svg.js.map +1 -0
- package/dist/assets/produtos/avaliacao-de-bens-icone.svg.js +6 -0
- package/dist/assets/produtos/avaliacao-de-bens-icone.svg.js.map +1 -0
- package/dist/assets/produtos/central-de-conteudo-icone.svg.js +6 -0
- package/dist/assets/produtos/central-de-conteudo-icone.svg.js.map +1 -0
- package/dist/assets/produtos/registro-cartorario-icone.svg.js +6 -0
- package/dist/assets/produtos/registro-cartorario-icone.svg.js.map +1 -0
- package/dist/brand/apple-touch-icon.png +0 -0
- package/dist/brand/favicon-32.png +0 -0
- package/dist/brand/favicon.svg +11 -0
- package/dist/brand/icon-192.png +0 -0
- package/dist/brand/icon-512.png +0 -0
- package/dist/components/auth/OtpInput.d.ts +8 -0
- package/dist/components/auth/OtpInput.js +49 -0
- package/dist/components/auth/OtpInput.js.map +1 -0
- package/dist/components/chat/ChatConversationsDrawer.d.ts +29 -0
- package/dist/components/chat/ChatConversationsDrawer.js +156 -0
- package/dist/components/chat/ChatConversationsDrawer.js.map +1 -0
- package/dist/components/chat/chatFormatting.d.ts +2 -0
- package/dist/components/chat/chatFormatting.js +16 -0
- package/dist/components/chat/chatFormatting.js.map +1 -0
- package/dist/components/chat/types.d.ts +2 -0
- package/dist/components/chat/types.js +2 -0
- package/dist/components/chat/types.js.map +1 -0
- package/dist/components/chat/useChatWindowFrame.d.ts +23 -0
- package/dist/components/chat/useChatWindowFrame.js +42 -0
- package/dist/components/chat/useChatWindowFrame.js.map +1 -0
- package/dist/components/dashboard/DonutInsightCard.d.ts +11 -0
- package/dist/components/dashboard/DonutInsightCard.js +51 -0
- package/dist/components/dashboard/DonutInsightCard.js.map +1 -0
- package/dist/components/dashboard/FunilJornadaInsightCard.d.ts +22 -0
- package/dist/components/dashboard/FunilJornadaInsightCard.js +113 -0
- package/dist/components/dashboard/FunilJornadaInsightCard.js.map +1 -0
- package/dist/components/dashboard/InsightCard.d.ts +14 -0
- package/dist/components/dashboard/InsightCard.js +44 -0
- package/dist/components/dashboard/InsightCard.js.map +1 -0
- package/dist/components/dashboard/RankingList.d.ts +11 -0
- package/dist/components/dashboard/RankingList.js +28 -0
- package/dist/components/dashboard/RankingList.js.map +1 -0
- package/dist/components/documentos/AnaliseIaDialog.d.ts +114 -0
- package/dist/components/documentos/AnaliseIaDialog.js +923 -0
- package/dist/components/documentos/AnaliseIaDialog.js.map +1 -0
- package/dist/components/documentos/BatchPdfViewerDialog.d.ts +83 -0
- package/dist/components/documentos/BatchPdfViewerDialog.js +752 -0
- package/dist/components/documentos/BatchPdfViewerDialog.js.map +1 -0
- package/dist/components/documentos/DetalhesDocumentoConteudo.d.ts +31 -0
- package/dist/components/documentos/DetalhesDocumentoConteudo.js +301 -0
- package/dist/components/documentos/DetalhesDocumentoConteudo.js.map +1 -0
- package/dist/components/documentos/DocumentoErroIcon.d.ts +5 -0
- package/dist/components/documentos/DocumentoErroIcon.js +64 -0
- package/dist/components/documentos/DocumentoErroIcon.js.map +1 -0
- package/dist/components/documentos/PdfViewerDialog.d.ts +109 -0
- package/dist/components/documentos/PdfViewerDialog.js +704 -0
- package/dist/components/documentos/PdfViewerDialog.js.map +1 -0
- package/dist/components/documentos/TipoNaoConfirmadoBadge.d.ts +13 -0
- package/dist/components/documentos/TipoNaoConfirmadoBadge.js +30 -0
- package/dist/components/documentos/TipoNaoConfirmadoBadge.js.map +1 -0
- package/dist/components/documentos/notify.d.ts +6 -0
- package/dist/components/documentos/notify.js +9 -0
- package/dist/components/documentos/notify.js.map +1 -0
- package/dist/components/documentos/pdfDownload.d.ts +6 -0
- package/dist/components/documentos/pdfDownload.js +13 -0
- package/dist/components/documentos/pdfDownload.js.map +1 -0
- package/dist/components/documentos/pdfPageRenderers.d.ts +30 -0
- package/dist/components/documentos/pdfPageRenderers.js +38 -0
- package/dist/components/documentos/pdfPageRenderers.js.map +1 -0
- package/dist/components/documentos/pdfWorkerSetup.d.ts +1 -0
- package/dist/components/documentos/pdfWorkerSetup.js +4 -0
- package/dist/components/documentos/pdfWorkerSetup.js.map +1 -0
- package/dist/components/documentos/useDialogLayoutMode.d.ts +16 -0
- package/dist/components/documentos/useDialogLayoutMode.js +14 -0
- package/dist/components/documentos/useDialogLayoutMode.js.map +1 -0
- package/dist/components/documentos/useDockableDialogWindow.d.ts +66 -0
- package/dist/components/documentos/useDockableDialogWindow.js +105 -0
- package/dist/components/documentos/useDockableDialogWindow.js.map +1 -0
- package/dist/components/gia/GiaAudioPlayer.d.ts +9 -0
- package/dist/components/gia/GiaAudioPlayer.js +70 -0
- package/dist/components/gia/GiaAudioPlayer.js.map +1 -0
- package/dist/components/gia/GiaChatWindow.d.ts +44 -0
- package/dist/components/gia/GiaChatWindow.js +912 -0
- package/dist/components/gia/GiaChatWindow.js.map +1 -0
- package/dist/components/gia/GiaEmptyStateIllustration.d.ts +5 -0
- package/dist/components/gia/GiaEmptyStateIllustration.js +84 -0
- package/dist/components/gia/GiaEmptyStateIllustration.js.map +1 -0
- package/dist/components/gia/GiaMentionAutocomplete.d.ts +31 -0
- package/dist/components/gia/GiaMentionAutocomplete.js +115 -0
- package/dist/components/gia/GiaMentionAutocomplete.js.map +1 -0
- package/dist/components/gia/GiaMentionText.d.ts +10 -0
- package/dist/components/gia/GiaMentionText.js +66 -0
- package/dist/components/gia/GiaMentionText.js.map +1 -0
- package/dist/components/gia/mentionParsing.d.ts +79 -0
- package/dist/components/gia/mentionParsing.js +44 -0
- package/dist/components/gia/mentionParsing.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +66 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.js +68 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +45 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +105 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +58 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/calendar.js +175 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +33 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +148 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.js +233 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +23 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +24 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/pagination.js +120 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +82 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +33 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +62 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +28 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +129 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +116 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/tabs.js +93 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +20 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +57 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui-garantiabr/Alert.d.ts +17 -0
- package/dist/components/ui-garantiabr/Alert.js +77 -0
- package/dist/components/ui-garantiabr/Alert.js.map +1 -0
- package/dist/components/ui-garantiabr/accordion.d.ts +46 -0
- package/dist/components/ui-garantiabr/accordion.js +114 -0
- package/dist/components/ui-garantiabr/accordion.js.map +1 -0
- package/dist/components/ui-garantiabr/alertBanner.d.ts +14 -0
- package/dist/components/ui-garantiabr/alertBanner.js +49 -0
- package/dist/components/ui-garantiabr/alertBanner.js.map +1 -0
- package/dist/components/ui-garantiabr/altTabs.d.ts +19 -0
- package/dist/components/ui-garantiabr/altTabs.js +33 -0
- package/dist/components/ui-garantiabr/altTabs.js.map +1 -0
- package/dist/components/ui-garantiabr/appLayout.d.ts +56 -0
- package/dist/components/ui-garantiabr/appLayout.js +177 -0
- package/dist/components/ui-garantiabr/appLayout.js.map +1 -0
- package/dist/components/ui-garantiabr/avatar.d.ts +15 -0
- package/dist/components/ui-garantiabr/avatar.js +38 -0
- package/dist/components/ui-garantiabr/avatar.js.map +1 -0
- package/dist/components/ui-garantiabr/badge.d.ts +17 -0
- package/dist/components/ui-garantiabr/badge.js +54 -0
- package/dist/components/ui-garantiabr/badge.js.map +1 -0
- package/dist/components/ui-garantiabr/badgeNotification.d.ts +10 -0
- package/dist/components/ui-garantiabr/badgeNotification.js +41 -0
- package/dist/components/ui-garantiabr/badgeNotification.js.map +1 -0
- package/dist/components/ui-garantiabr/breadcrumb.d.ts +10 -0
- package/dist/components/ui-garantiabr/breadcrumb.js +61 -0
- package/dist/components/ui-garantiabr/breadcrumb.js.map +1 -0
- package/dist/components/ui-garantiabr/button.d.ts +23 -0
- package/dist/components/ui-garantiabr/button.js +71 -0
- package/dist/components/ui-garantiabr/button.js.map +1 -0
- package/dist/components/ui-garantiabr/buttonIcon.d.ts +15 -0
- package/dist/components/ui-garantiabr/buttonIcon.js +48 -0
- package/dist/components/ui-garantiabr/buttonIcon.js.map +1 -0
- package/dist/components/ui-garantiabr/calendar.d.ts +20 -0
- package/dist/components/ui-garantiabr/calendar.js +73 -0
- package/dist/components/ui-garantiabr/calendar.js.map +1 -0
- package/dist/components/ui-garantiabr/card.d.ts +12 -0
- package/dist/components/ui-garantiabr/card.js +31 -0
- package/dist/components/ui-garantiabr/card.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_area.d.ts +29 -0
- package/dist/components/ui-garantiabr/chart_area.js +62 -0
- package/dist/components/ui-garantiabr/chart_area.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_bar.d.ts +35 -0
- package/dist/components/ui-garantiabr/chart_bar.js +46 -0
- package/dist/components/ui-garantiabr/chart_bar.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_bar_disponibilidade.d.ts +28 -0
- package/dist/components/ui-garantiabr/chart_bar_disponibilidade.js +57 -0
- package/dist/components/ui-garantiabr/chart_bar_disponibilidade.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_bar_horizontal.d.ts +26 -0
- package/dist/components/ui-garantiabr/chart_bar_horizontal.js +44 -0
- package/dist/components/ui-garantiabr/chart_bar_horizontal.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_composed.d.ts +36 -0
- package/dist/components/ui-garantiabr/chart_composed.js +70 -0
- package/dist/components/ui-garantiabr/chart_composed.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_funnel.d.ts +13 -0
- package/dist/components/ui-garantiabr/chart_funnel.js +25 -0
- package/dist/components/ui-garantiabr/chart_funnel.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_line.d.ts +27 -0
- package/dist/components/ui-garantiabr/chart_line.js +43 -0
- package/dist/components/ui-garantiabr/chart_line.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_pie.d.ts +26 -0
- package/dist/components/ui-garantiabr/chart_pie.js +62 -0
- package/dist/components/ui-garantiabr/chart_pie.js.map +1 -0
- package/dist/components/ui-garantiabr/chart_statcard.d.ts +22 -0
- package/dist/components/ui-garantiabr/chart_statcard.js +175 -0
- package/dist/components/ui-garantiabr/chart_statcard.js.map +1 -0
- package/dist/components/ui-garantiabr/checkbox.d.ts +10 -0
- package/dist/components/ui-garantiabr/checkbox.js +31 -0
- package/dist/components/ui-garantiabr/checkbox.js.map +1 -0
- package/dist/components/ui-garantiabr/checkboxGroupField.d.ts +12 -0
- package/dist/components/ui-garantiabr/checkboxGroupField.js +40 -0
- package/dist/components/ui-garantiabr/checkboxGroupField.js.map +1 -0
- package/dist/components/ui-garantiabr/chip.d.ts +12 -0
- package/dist/components/ui-garantiabr/chip.js +49 -0
- package/dist/components/ui-garantiabr/chip.js.map +1 -0
- package/dist/components/ui-garantiabr/codeBlock.d.ts +27 -0
- package/dist/components/ui-garantiabr/codeBlock.js +100 -0
- package/dist/components/ui-garantiabr/codeBlock.js.map +1 -0
- package/dist/components/ui-garantiabr/commandPalette.d.ts +67 -0
- package/dist/components/ui-garantiabr/commandPalette.js +278 -0
- package/dist/components/ui-garantiabr/commandPalette.js.map +1 -0
- package/dist/components/ui-garantiabr/commandPaletteOrdem.d.ts +10 -0
- package/dist/components/ui-garantiabr/commandPaletteOrdem.js +13 -0
- package/dist/components/ui-garantiabr/commandPaletteOrdem.js.map +1 -0
- package/dist/components/ui-garantiabr/dashCard.d.ts +16 -0
- package/dist/components/ui-garantiabr/dashCard.js +51 -0
- package/dist/components/ui-garantiabr/dashCard.js.map +1 -0
- package/dist/components/ui-garantiabr/datePicker.d.ts +23 -0
- package/dist/components/ui-garantiabr/datePicker.js +143 -0
- package/dist/components/ui-garantiabr/datePicker.js.map +1 -0
- package/dist/components/ui-garantiabr/dialog.d.ts +14 -0
- package/dist/components/ui-garantiabr/dialog.js +69 -0
- package/dist/components/ui-garantiabr/dialog.js.map +1 -0
- package/dist/components/ui-garantiabr/divider.d.ts +7 -0
- package/dist/components/ui-garantiabr/divider.js +27 -0
- package/dist/components/ui-garantiabr/divider.js.map +1 -0
- package/dist/components/ui-garantiabr/dropdownMenu.d.ts +47 -0
- package/dist/components/ui-garantiabr/dropdownMenu.js +89 -0
- package/dist/components/ui-garantiabr/dropdownMenu.js.map +1 -0
- package/dist/components/ui-garantiabr/dropdownTrigger.d.ts +18 -0
- package/dist/components/ui-garantiabr/dropdownTrigger.js +66 -0
- package/dist/components/ui-garantiabr/dropdownTrigger.js.map +1 -0
- package/dist/components/ui-garantiabr/emptyState.d.ts +12 -0
- package/dist/components/ui-garantiabr/emptyState.js +68 -0
- package/dist/components/ui-garantiabr/emptyState.js.map +1 -0
- package/dist/components/ui-garantiabr/fileUpload.d.ts +78 -0
- package/dist/components/ui-garantiabr/fileUpload.js +552 -0
- package/dist/components/ui-garantiabr/fileUpload.js.map +1 -0
- package/dist/components/ui-garantiabr/floutNavetagionStep.d.ts +9 -0
- package/dist/components/ui-garantiabr/floutNavetagionStep.js +50 -0
- package/dist/components/ui-garantiabr/floutNavetagionStep.js.map +1 -0
- package/dist/components/ui-garantiabr/footer.d.ts +11 -0
- package/dist/components/ui-garantiabr/footer.js +31 -0
- package/dist/components/ui-garantiabr/footer.js.map +1 -0
- package/dist/components/ui-garantiabr/giaButton.d.ts +6 -0
- package/dist/components/ui-garantiabr/giaButton.js +22 -0
- package/dist/components/ui-garantiabr/giaButton.js.map +1 -0
- package/dist/components/ui-garantiabr/giaIcon.d.ts +6 -0
- package/dist/components/ui-garantiabr/giaIcon.js +49 -0
- package/dist/components/ui-garantiabr/giaIcon.js.map +1 -0
- package/dist/components/ui-garantiabr/helperText.d.ts +6 -0
- package/dist/components/ui-garantiabr/helperText.js +25 -0
- package/dist/components/ui-garantiabr/helperText.js.map +1 -0
- package/dist/components/ui-garantiabr/hoverCard.d.ts +12 -0
- package/dist/components/ui-garantiabr/hoverCard.js +33 -0
- package/dist/components/ui-garantiabr/hoverCard.js.map +1 -0
- package/dist/components/ui-garantiabr/iconesAvaliacao.d.ts +4 -0
- package/dist/components/ui-garantiabr/iconesAvaliacao.js +19 -0
- package/dist/components/ui-garantiabr/iconesAvaliacao.js.map +1 -0
- package/dist/components/ui-garantiabr/input.d.ts +4 -0
- package/dist/components/ui-garantiabr/input.js +21 -0
- package/dist/components/ui-garantiabr/input.js.map +1 -0
- package/dist/components/ui-garantiabr/inputCounter.d.ts +14 -0
- package/dist/components/ui-garantiabr/inputCounter.js +117 -0
- package/dist/components/ui-garantiabr/inputCounter.js.map +1 -0
- package/dist/components/ui-garantiabr/inputFormField.d.ts +22 -0
- package/dist/components/ui-garantiabr/inputFormField.js +129 -0
- package/dist/components/ui-garantiabr/inputFormField.js.map +1 -0
- package/dist/components/ui-garantiabr/inputMasked.d.ts +12 -0
- package/dist/components/ui-garantiabr/inputMasked.js +130 -0
- package/dist/components/ui-garantiabr/inputMasked.js.map +1 -0
- package/dist/components/ui-garantiabr/inputSearch.d.ts +16 -0
- package/dist/components/ui-garantiabr/inputSearch.js +104 -0
- package/dist/components/ui-garantiabr/inputSearch.js.map +1 -0
- package/dist/components/ui-garantiabr/listaColunasOrdenavel.d.ts +30 -0
- package/dist/components/ui-garantiabr/listaColunasOrdenavel.js +72 -0
- package/dist/components/ui-garantiabr/listaColunasOrdenavel.js.map +1 -0
- package/dist/components/ui-garantiabr/loadingSpinner.d.ts +9 -0
- package/dist/components/ui-garantiabr/loadingSpinner.js +57 -0
- package/dist/components/ui-garantiabr/loadingSpinner.js.map +1 -0
- package/dist/components/ui-garantiabr/messageComposer.d.ts +62 -0
- package/dist/components/ui-garantiabr/messageComposer.js +296 -0
- package/dist/components/ui-garantiabr/messageComposer.js.map +1 -0
- package/dist/components/ui-garantiabr/mobileDrawer.d.ts +11 -0
- package/dist/components/ui-garantiabr/mobileDrawer.js +102 -0
- package/dist/components/ui-garantiabr/mobileDrawer.js.map +1 -0
- package/dist/components/ui-garantiabr/multiSelectField.d.ts +27 -0
- package/dist/components/ui-garantiabr/multiSelectField.js +140 -0
- package/dist/components/ui-garantiabr/multiSelectField.js.map +1 -0
- package/dist/components/ui-garantiabr/navbar.d.ts +82 -0
- package/dist/components/ui-garantiabr/navbar.js +417 -0
- package/dist/components/ui-garantiabr/navbar.js.map +1 -0
- package/dist/components/ui-garantiabr/navbarMobileDrawer.d.ts +15 -0
- package/dist/components/ui-garantiabr/navbarMobileDrawer.js +146 -0
- package/dist/components/ui-garantiabr/navbarMobileDrawer.js.map +1 -0
- package/dist/components/ui-garantiabr/notificationCard.d.ts +35 -0
- package/dist/components/ui-garantiabr/notificationCard.js +70 -0
- package/dist/components/ui-garantiabr/notificationCard.js.map +1 -0
- package/dist/components/ui-garantiabr/optionSelect.d.ts +64 -0
- package/dist/components/ui-garantiabr/optionSelect.js +117 -0
- package/dist/components/ui-garantiabr/optionSelect.js.map +1 -0
- package/dist/components/ui-garantiabr/pagination.d.ts +13 -0
- package/dist/components/ui-garantiabr/pagination.js +141 -0
- package/dist/components/ui-garantiabr/pagination.js.map +1 -0
- package/dist/components/ui-garantiabr/popover.d.ts +18 -0
- package/dist/components/ui-garantiabr/popover.js +57 -0
- package/dist/components/ui-garantiabr/popover.js.map +1 -0
- package/dist/components/ui-garantiabr/productLogotype.d.ts +14 -0
- package/dist/components/ui-garantiabr/productLogotype.js +40 -0
- package/dist/components/ui-garantiabr/productLogotype.js.map +1 -0
- package/dist/components/ui-garantiabr/productSwitcher.d.ts +20 -0
- package/dist/components/ui-garantiabr/productSwitcher.js +62 -0
- package/dist/components/ui-garantiabr/productSwitcher.js.map +1 -0
- package/dist/components/ui-garantiabr/progressBar.d.ts +12 -0
- package/dist/components/ui-garantiabr/progressBar.js +32 -0
- package/dist/components/ui-garantiabr/progressBar.js.map +1 -0
- package/dist/components/ui-garantiabr/radioGroup.d.ts +14 -0
- package/dist/components/ui-garantiabr/radioGroup.js +47 -0
- package/dist/components/ui-garantiabr/radioGroup.js.map +1 -0
- package/dist/components/ui-garantiabr/segmentedControl.d.ts +28 -0
- package/dist/components/ui-garantiabr/segmentedControl.js +62 -0
- package/dist/components/ui-garantiabr/segmentedControl.js.map +1 -0
- package/dist/components/ui-garantiabr/select.d.ts +27 -0
- package/dist/components/ui-garantiabr/select.js +166 -0
- package/dist/components/ui-garantiabr/select.js.map +1 -0
- package/dist/components/ui-garantiabr/selectField.d.ts +12 -0
- package/dist/components/ui-garantiabr/selectField.js +38 -0
- package/dist/components/ui-garantiabr/selectField.js.map +1 -0
- package/dist/components/ui-garantiabr/sheet.d.ts +16 -0
- package/dist/components/ui-garantiabr/sheet.js +74 -0
- package/dist/components/ui-garantiabr/sheet.js.map +1 -0
- package/dist/components/ui-garantiabr/shinyButton.d.ts +24 -0
- package/dist/components/ui-garantiabr/shinyButton.js +34 -0
- package/dist/components/ui-garantiabr/shinyButton.js.map +1 -0
- package/dist/components/ui-garantiabr/shinyIconButton.d.ts +16 -0
- package/dist/components/ui-garantiabr/shinyIconButton.js +32 -0
- package/dist/components/ui-garantiabr/shinyIconButton.js.map +1 -0
- package/dist/components/ui-garantiabr/sideTrayNotification.d.ts +31 -0
- package/dist/components/ui-garantiabr/sideTrayNotification.js +87 -0
- package/dist/components/ui-garantiabr/sideTrayNotification.js.map +1 -0
- package/dist/components/ui-garantiabr/sidebar.d.ts +36 -0
- package/dist/components/ui-garantiabr/sidebar.js +231 -0
- package/dist/components/ui-garantiabr/sidebar.js.map +1 -0
- package/dist/components/ui-garantiabr/splitButton.d.ts +33 -0
- package/dist/components/ui-garantiabr/splitButton.js +67 -0
- package/dist/components/ui-garantiabr/splitButton.js.map +1 -0
- package/dist/components/ui-garantiabr/stepper.d.ts +9 -0
- package/dist/components/ui-garantiabr/stepper.js +31 -0
- package/dist/components/ui-garantiabr/stepper.js.map +1 -0
- package/dist/components/ui-garantiabr/switch.d.ts +9 -0
- package/dist/components/ui-garantiabr/switch.js +50 -0
- package/dist/components/ui-garantiabr/switch.js.map +1 -0
- package/dist/components/ui-garantiabr/table.d.ts +133 -0
- package/dist/components/ui-garantiabr/table.js +544 -0
- package/dist/components/ui-garantiabr/table.js.map +1 -0
- package/dist/components/ui-garantiabr/tabs.d.ts +27 -0
- package/dist/components/ui-garantiabr/tabs.js +53 -0
- package/dist/components/ui-garantiabr/tabs.js.map +1 -0
- package/dist/components/ui-garantiabr/tagInput.d.ts +13 -0
- package/dist/components/ui-garantiabr/tagInput.js +55 -0
- package/dist/components/ui-garantiabr/tagInput.js.map +1 -0
- package/dist/components/ui-garantiabr/textarea.d.ts +11 -0
- package/dist/components/ui-garantiabr/textarea.js +62 -0
- package/dist/components/ui-garantiabr/textarea.js.map +1 -0
- package/dist/components/ui-garantiabr/timeline.d.ts +29 -0
- package/dist/components/ui-garantiabr/timeline.js +38 -0
- package/dist/components/ui-garantiabr/timeline.js.map +1 -0
- package/dist/components/ui-garantiabr/toastDownload.d.ts +13 -0
- package/dist/components/ui-garantiabr/toastDownload.js +55 -0
- package/dist/components/ui-garantiabr/toastDownload.js.map +1 -0
- package/dist/components/ui-garantiabr/tooltip.d.ts +18 -0
- package/dist/components/ui-garantiabr/tooltip.js +34 -0
- package/dist/components/ui-garantiabr/tooltip.js.map +1 -0
- package/dist/components/ui-garantiabr/topNavegation.d.ts +32 -0
- package/dist/components/ui-garantiabr/topNavegation.js +267 -0
- package/dist/components/ui-garantiabr/topNavegation.js.map +1 -0
- package/dist/components/ui-garantiabr/truncatedText.d.ts +14 -0
- package/dist/components/ui-garantiabr/truncatedText.js +27 -0
- package/dist/components/ui-garantiabr/truncatedText.js.map +1 -0
- package/dist/components/ui-garantiabr/useTemRolagem.d.ts +4 -0
- package/dist/components/ui-garantiabr/useTemRolagem.js +17 -0
- package/dist/components/ui-garantiabr/useTemRolagem.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +7 -0
- package/dist/hooks/useTheme.js +31 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/lib/confianca.d.ts +4 -0
- package/dist/lib/confianca.js +16 -0
- package/dist/lib/confianca.js.map +1 -0
- package/dist/lib/protocolosSuporte.d.ts +29 -0
- package/dist/lib/protocolosSuporte.js +44 -0
- package/dist/lib/protocolosSuporte.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/theme.css +1072 -0
- package/dist/types/svg.d.js +2 -0
- package/dist/types/svg.d.js.map +1 -0
- package/dist/utils/inputMasks.d.ts +5 -0
- package/dist/utils/inputMasks.js +16 -0
- package/dist/utils/inputMasks.js.map +1 -0
- package/dist/utils/useMediaQuery.d.ts +6 -0
- package/dist/utils/useMediaQuery.js +14 -0
- package/dist/utils/useMediaQuery.js.map +1 -0
- package/package.json +94 -4
- package/tools/agent-config.mjs +51 -0
- package/tools/check.mjs +110 -0
- package/tools/eslint-plugin.mjs +115 -0
- package/tools/hooks.mjs +133 -0
- package/tools/mcp.mjs +132 -0
- package/tools/version.mjs +43 -0
- package/tools/workspace.mjs +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PatternFormatProps } from "react-number-format";
|
|
2
|
+
export type InputMaskType = "cpf" | "cpfCnpj" | "cnpj" | "phone" | "cnh" | "date" | "cep" | "conta" | "digito";
|
|
3
|
+
type MaskConfig = Pick<PatternFormatProps, "format" | "mask" | "allowEmptyFormatting">;
|
|
4
|
+
export declare const INPUT_MASKS: Record<InputMaskType, MaskConfig>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const a = {
|
|
3
|
+
cpf: { format: "###.###.###-##", mask: "_" },
|
|
4
|
+
cnpj: { format: "##.###.###/####-##", mask: "_" },
|
|
5
|
+
cpfCnpj: { format: "##.###.###/####-##", mask: "_" },
|
|
6
|
+
phone: { format: "(##) #####-####", mask: "_" },
|
|
7
|
+
cnh: { format: "###########", mask: "_" },
|
|
8
|
+
date: { format: "##/##/####", mask: "_" },
|
|
9
|
+
cep: { format: "#####-###", mask: "_" },
|
|
10
|
+
conta: { format: "########-#", mask: "_" },
|
|
11
|
+
digito: { format: "#", mask: "_" }
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
a as INPUT_MASKS
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=inputMasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputMasks.js","sources":["../../src/utils/inputMasks.ts"],"sourcesContent":["import type { PatternFormatProps } from \"react-number-format\";\n\nexport type InputMaskType =\n | \"cpf\"\n | \"cpfCnpj\"\n | \"cnpj\"\n | \"phone\"\n | \"cnh\"\n | \"date\"\n | \"cep\"\n | \"conta\"\n | \"digito\";\n\ntype MaskConfig = Pick<PatternFormatProps, \"format\" | \"mask\" | \"allowEmptyFormatting\">;\n\nexport const INPUT_MASKS: Record<InputMaskType, MaskConfig> = {\n cpf: { format: \"###.###.###-##\", mask: \"_\" },\n cnpj: { format: \"##.###.###/####-##\", mask: \"_\" },\n cpfCnpj: { format: \"##.###.###/####-##\", mask: \"_\" },\n phone: { format: \"(##) #####-####\", mask: \"_\" },\n cnh: { format: \"###########\", mask: \"_\" },\n date: { format: \"##/##/####\", mask: \"_\" },\n cep: { format: \"#####-###\", mask: \"_\" },\n conta: { format: \"########-#\", mask: \"_\" },\n digito: { format: \"#\", mask: \"_\" },\n};\n"],"names":["INPUT_MASKS"],"mappings":";AAeO,MAAMA,IAAiD;AAAA,EAC5D,KAAS,EAAE,QAAQ,kBAAqB,MAAM,IAAA;AAAA,EAC9C,MAAS,EAAE,QAAQ,sBAAsB,MAAM,IAAA;AAAA,EAC/C,SAAS,EAAE,QAAQ,sBAAsB,MAAM,IAAA;AAAA,EAC/C,OAAS,EAAE,QAAQ,mBAAqB,MAAM,IAAA;AAAA,EAC9C,KAAS,EAAE,QAAQ,eAAqB,MAAM,IAAA;AAAA,EAC9C,MAAS,EAAE,QAAQ,cAAqB,MAAM,IAAA;AAAA,EAC9C,KAAS,EAAE,QAAQ,aAAqB,MAAM,IAAA;AAAA,EAC9C,OAAS,EAAE,QAAQ,cAAqB,MAAM,IAAA;AAAA,EAC9C,QAAS,EAAE,QAAQ,KAAqB,MAAM,IAAA;AAChD;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Hook que retorna flags responsivas. API alinhada com o que o
|
|
2
|
+
* ui-garantiabr/topNavegation.tsx espera (sem args, retorna isDesktop).
|
|
3
|
+
* Stub criado porque o utilitario nao foi exportado pela DS sync. */
|
|
4
|
+
export declare function useMediaQuery(): {
|
|
5
|
+
isDesktop: boolean;
|
|
6
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as s, useEffect as d } from "react";
|
|
3
|
+
function u() {
|
|
4
|
+
const [i, t] = s(() => typeof window > "u" ? !0 : window.matchMedia("(min-width: 1024px)").matches);
|
|
5
|
+
return d(() => {
|
|
6
|
+
if (typeof window > "u") return;
|
|
7
|
+
const e = window.matchMedia("(min-width: 1024px)"), n = (r) => t(r.matches);
|
|
8
|
+
return t(e.matches), e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
9
|
+
}, []), { isDesktop: i };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
u as useMediaQuery
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useMediaQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaQuery.js","sources":["../../src/utils/useMediaQuery.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** Hook que retorna flags responsivas. API alinhada com o que o\n * ui-garantiabr/topNavegation.tsx espera (sem args, retorna isDesktop).\n * Stub criado porque o utilitario nao foi exportado pela DS sync. */\nexport function useMediaQuery() {\n const [isDesktop, setIsDesktop] = useState<boolean>(() => {\n if (typeof window === 'undefined') return true;\n return window.matchMedia('(min-width: 1024px)').matches;\n });\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n const mql = window.matchMedia('(min-width: 1024px)');\n const handler = (e: MediaQueryListEvent) => setIsDesktop(e.matches);\n setIsDesktop(mql.matches);\n mql.addEventListener('change', handler);\n return () => mql.removeEventListener('change', handler);\n }, []);\n\n return { isDesktop };\n}\n"],"names":["useMediaQuery","isDesktop","setIsDesktop","useState","useEffect","mql","handler","e"],"mappings":";;AAKO,SAASA,IAAgB;AAC9B,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAkB,MAC9C,OAAO,SAAW,MAAoB,KACnC,OAAO,WAAW,qBAAqB,EAAE,OACjD;AAED,SAAAC,EAAU,MAAM;AACd,QAAI,OAAO,SAAW,IAAa;AACnC,UAAMC,IAAM,OAAO,WAAW,qBAAqB,GAC7CC,IAAU,CAACC,MAA2BL,EAAaK,EAAE,OAAO;AAClE,WAAAL,EAAaG,EAAI,OAAO,GACxBA,EAAI,iBAAiB,UAAUC,CAAO,GAC/B,MAAMD,EAAI,oBAAoB,UAAUC,CAAO;AAAA,EACxD,GAAG,CAAA,CAAE,GAEE,EAAE,WAAAL,EAAA;AACX;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,96 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garantiabr/ui-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.13",
|
|
4
|
+
"description": "Design system SpotDS da GarantiaBR (registry do Storybook) empacotado para os apps: componentes React + tema Tailwind v4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/GarantiaBR/garantiabr-ui-kit.git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"tools",
|
|
15
|
+
"AGENTS.md",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"**/*.css"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
"./*": {
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"import": "./dist/*.js"
|
|
25
|
+
},
|
|
26
|
+
"./theme.css": "./dist/theme.css",
|
|
27
|
+
"./brand/*": "./dist/brand/*",
|
|
28
|
+
"./AGENTS.md": "./AGENTS.md",
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
"./eslint": "./tools/eslint-plugin.mjs"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"sync": "node scripts/sync-upstream.mjs",
|
|
34
|
+
"sync:check": "node scripts/sync-upstream.mjs --check",
|
|
35
|
+
"radar": "node scripts/radar-prototipo.mjs",
|
|
36
|
+
"build:src": "node scripts/build-src.mjs",
|
|
37
|
+
"test": "node --test tests/patches.test.mjs tests/sync.test.mjs tests/init.test.mjs tests/harness.test.mjs tests/monorepo.test.mjs tests/radar.test.mjs tests/dados-pessoais.test.mjs",
|
|
38
|
+
"build:lib": "npm run build:src && vite build -c vite.lib.config.ts && tsc -p tsconfig.lib.json && node scripts/build-lib.mjs",
|
|
39
|
+
"prepack": "npm run build:lib",
|
|
40
|
+
"lint": "eslint ."
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "^19.0.0",
|
|
44
|
+
"react-dom": "^19.0.0",
|
|
45
|
+
"tailwindcss": "^4.1.0",
|
|
46
|
+
"react-router-dom": "^7.0.0",
|
|
47
|
+
"eslint": ">=9"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"react-router-dom": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"eslint": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
59
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
60
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
61
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
62
|
+
"class-variance-authority": "^0.7.1",
|
|
63
|
+
"clsx": "^2.1.1",
|
|
64
|
+
"cn": "^0.4.0",
|
|
65
|
+
"date-fns": "^4.1.0",
|
|
66
|
+
"lucide-react": "^1.49.0",
|
|
67
|
+
"radix-ui": "^1.6.7",
|
|
68
|
+
"react-day-picker": "^10.0.0",
|
|
69
|
+
"react-number-format": "^5.4.4",
|
|
70
|
+
"react-pdf": "^11.0.0",
|
|
71
|
+
"recharts": "^3.10.1",
|
|
72
|
+
"tailwind-merge": "^3.7.0",
|
|
73
|
+
"tw-animate-css": "^1.4.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@eslint/js": "^9.39.1",
|
|
77
|
+
"@types/node": "^24.10.9",
|
|
78
|
+
"@types/react": "^19.2.5",
|
|
79
|
+
"@types/react-dom": "^19.2.3",
|
|
80
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
81
|
+
"eslint": "^9.39.1",
|
|
82
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
83
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
84
|
+
"globals": "^16.5.0",
|
|
85
|
+
"react": "^19.2.0",
|
|
86
|
+
"react-dom": "^19.2.0",
|
|
87
|
+
"react-router-dom": "^7.13.2",
|
|
88
|
+
"tailwindcss": "^4.1.18",
|
|
89
|
+
"typescript": "~5.9.3",
|
|
90
|
+
"typescript-eslint": "^8.46.4",
|
|
91
|
+
"vite": "^7.2.4"
|
|
92
|
+
},
|
|
93
|
+
"bin": {
|
|
94
|
+
"garantiabr-ui-kit": "./bin/init.mjs"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// O que o `init` mescla na configuração de agentes do projeto, sem tirar nada do que já existe:
|
|
2
|
+
// - .claude/settings.json: os 3 hooks do SpotDS (session-start, post-edit, stop);
|
|
3
|
+
// - .mcp.json: o servidor MCP local do pacote.
|
|
4
|
+
// Entrada já presente (reconhecida pelo comando com "garantiabr-ui-kit") não é duplicada.
|
|
5
|
+
// Num monorepo, a configuração fica na raiz e `bin` aponta para o node_modules de um dos apps
|
|
6
|
+
// (ex.: "components/f6/node_modules/@garantiabr/ui-kit/bin/init.mjs"); o segundo app reconhece a entrada e não duplica.
|
|
7
|
+
export const BIN = "node_modules/@garantiabr/ui-kit/bin/init.mjs";
|
|
8
|
+
const MARK = "garantiabr-ui-kit";
|
|
9
|
+
const hookCommand = (bin, name) => `node "$CLAUDE_PROJECT_DIR/${bin}" hook ${name}`;
|
|
10
|
+
|
|
11
|
+
const spotdsHooks = (bin) => [
|
|
12
|
+
{ event: "SessionStart", entry: { hooks: [{ type: "command", command: hookCommand(bin, "session-start") }] } },
|
|
13
|
+
{ event: "PostToolUse", entry: { matcher: "Edit|Write|MultiEdit", hooks: [{ type: "command", command: hookCommand(bin, "post-edit") }] } },
|
|
14
|
+
{ event: "Stop", entry: { hooks: [{ type: "command", command: hookCommand(bin, "stop") }] } },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const hasSpotds = (entries) => (entries ?? []).some((e) => (e.hooks ?? []).some((h) => String(h.command ?? "").includes(BIN)));
|
|
18
|
+
|
|
19
|
+
/** Settings com os hooks do SpotDS acrescentados. Ex.: mergeClaudeSettings({ hooks: { Stop: [...] } }). */
|
|
20
|
+
export function mergeClaudeSettings(settings, bin = BIN) {
|
|
21
|
+
const next = { ...settings, hooks: { ...(settings.hooks ?? {}) } };
|
|
22
|
+
for (const { event, entry } of spotdsHooks(bin)) {
|
|
23
|
+
if (!hasSpotds(next.hooks[event])) next.hooks[event] = [...(next.hooks[event] ?? []), entry];
|
|
24
|
+
}
|
|
25
|
+
return next;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** .mcp.json com o servidor do SpotDS acrescentado. */
|
|
29
|
+
export function mergeMcpConfig(config, bin = BIN) {
|
|
30
|
+
const servers = { ...(config.mcpServers ?? {}) };
|
|
31
|
+
if (!servers[MARK]) servers[MARK] = { command: "node", args: [bin, "mcp"] };
|
|
32
|
+
return { ...config, mcpServers: servers };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Conteúdo novo de um arquivo JSON, ou null se não muda; { error } se o JSON do projeto estiver inválido
|
|
37
|
+
* (aí o init não mexe e avisa).
|
|
38
|
+
*/
|
|
39
|
+
export function mergeJsonFile(current, merge) {
|
|
40
|
+
let parsed = {};
|
|
41
|
+
if (current !== null && current.trim()) {
|
|
42
|
+
try {
|
|
43
|
+
parsed = JSON.parse(current);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
return { error: err.message };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const merged = merge(parsed);
|
|
49
|
+
if (current !== null && JSON.stringify(merged) === JSON.stringify(parsed)) return { content: null };
|
|
50
|
+
return { content: JSON.stringify(merged, null, 2) + "\n" };
|
|
51
|
+
}
|
package/tools/check.mjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// `garantiabr-ui-kit check [arquivos…]`: as regras do SpotDS (tools/eslint-plugin.mjs) sobre os arquivos do
|
|
2
|
+
// projeto, com o ESLint e o parser de TypeScript que o próprio projeto já tem. Não depende do eslint.config do
|
|
3
|
+
// projeto: hooks, MCP e CI usam o mesmo verificador, mesmo antes de alguém ligar o plugin no editor.
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
|
|
8
|
+
import spotds from "./eslint-plugin.mjs";
|
|
9
|
+
import { groupByApp } from "./workspace.mjs";
|
|
10
|
+
|
|
11
|
+
const SOURCE = /\.(jsx?|tsx?)$/;
|
|
12
|
+
const IGNORED = /(^|[\\/])(node_modules|dist|build|\.next|out|coverage)[\\/]/;
|
|
13
|
+
const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
14
|
+
|
|
15
|
+
// Procura no projeto primeiro; no pacote, só como reserva (útil nos testes do próprio pacote).
|
|
16
|
+
async function importFrom(cwd, specifier) {
|
|
17
|
+
for (const base of [cwd, packageDir]) {
|
|
18
|
+
try {
|
|
19
|
+
const resolved = createRequire(path.join(base, "noop.js")).resolve(specifier);
|
|
20
|
+
return await import(pathToFileURL(resolved).href);
|
|
21
|
+
} catch {
|
|
22
|
+
// tenta a próxima base
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function typescriptParser(cwd) {
|
|
29
|
+
const parser = await importFrom(cwd, "@typescript-eslint/parser");
|
|
30
|
+
if (parser) return parser.default ?? parser;
|
|
31
|
+
const tseslint = await importFrom(cwd, "typescript-eslint");
|
|
32
|
+
return tseslint ? (tseslint.default ?? tseslint).parser : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Só arquivos de código do projeto, fora de node_modules/dist/.next. */
|
|
36
|
+
export function sourceFiles(files) {
|
|
37
|
+
return files.filter((f) => SOURCE.test(f) && !IGNORED.test(f.split(path.sep).join("/")));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Chave de caminho para comparar arquivos: absoluta e, no Windows, sem diferença de maiúscula. */
|
|
41
|
+
export function pathKey(file) {
|
|
42
|
+
const resolved = path.resolve(file);
|
|
43
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Só as regras do pacote contam. Um `eslint-disable` de regra que o projeto carrega e o pacote não
|
|
47
|
+
// (react-hooks, @next/next…) vira "Definition for rule … was not found", e isso não é violação do SpotDS.
|
|
48
|
+
const isSpotdsMessage = (m) => typeof m.ruleId === "string" && m.ruleId.startsWith("spotds/");
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Roda as regras do SpotDS. Ex.: `await runCheck(process.cwd(), ["src/app/page.tsx"])`.
|
|
52
|
+
* Devolve { errors, warnings, text } ou { skipped } quando o projeto não tem ESLint.
|
|
53
|
+
* `relativeTo` muda a base dos caminhos do relatório (num monorepo, a raiz em vez do app).
|
|
54
|
+
* `linesOf(arquivo)` devolve as linhas a considerar (Set) ou undefined para o arquivo inteiro; os hooks
|
|
55
|
+
* usam para olhar só o que a tarefa mudou, e o `check` do CI segue olhando o arquivo todo.
|
|
56
|
+
*/
|
|
57
|
+
export async function runCheck(cwd, files, { relativeTo = cwd, linesOf } = {}) {
|
|
58
|
+
const targets = sourceFiles(files);
|
|
59
|
+
if (!targets.length) return { errors: 0, warnings: 0, text: "" };
|
|
60
|
+
const eslintModule = await importFrom(cwd, "eslint");
|
|
61
|
+
if (!eslintModule) return { skipped: "o projeto não tem ESLint instalado (npm i -D eslint)" };
|
|
62
|
+
const parser = await typescriptParser(cwd);
|
|
63
|
+
const languageOptions = { ecmaVersion: "latest", sourceType: "module", parserOptions: { ecmaFeatures: { jsx: true } } };
|
|
64
|
+
const eslint = new eslintModule.ESLint({
|
|
65
|
+
cwd,
|
|
66
|
+
overrideConfigFile: true,
|
|
67
|
+
errorOnUnmatchedPattern: false,
|
|
68
|
+
overrideConfig: [
|
|
69
|
+
{ ...spotds.configs.recommended, languageOptions: parser ? { ...languageOptions, parser } : languageOptions },
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
const results = await eslint.lintFiles(targets);
|
|
73
|
+
const lines = [];
|
|
74
|
+
let errors = 0;
|
|
75
|
+
let warnings = 0;
|
|
76
|
+
for (const result of results) {
|
|
77
|
+
const consideredLines = linesOf?.(result.filePath);
|
|
78
|
+
for (const m of result.messages) {
|
|
79
|
+
if (m.fatal) continue; // arquivo que o parser não leu: não é violação do SpotDS
|
|
80
|
+
if (!isSpotdsMessage(m)) continue;
|
|
81
|
+
if (consideredLines && !consideredLines.has(m.line)) continue;
|
|
82
|
+
if (m.severity === 2) errors++;
|
|
83
|
+
else warnings++;
|
|
84
|
+
const rel = path.relative(relativeTo, result.filePath).split(path.sep).join("/");
|
|
85
|
+
lines.push(`${rel}:${m.line}:${m.column} ${m.severity === 2 ? "erro" : "aviso"} ${m.message} (${m.ruleId})`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { errors, warnings, text: lines.join("\n") };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* As regras do SpotDS em arquivos de um ou mais apps: cada grupo roda com o ESLint do app dono
|
|
93
|
+
* (tools/workspace.mjs). Ex.: `await runCheckByApp("/repo", ["/repo/components/f6/src/a.tsx"])`.
|
|
94
|
+
* App sem ESLint é pulado e aparece em `skipped`; os demais somam no mesmo relatório.
|
|
95
|
+
*/
|
|
96
|
+
export async function runCheckByApp(projectDir, files, { linesOf } = {}) {
|
|
97
|
+
const total = { errors: 0, warnings: 0, text: "", skipped: [] };
|
|
98
|
+
const texts = [];
|
|
99
|
+
for (const [app, group] of groupByApp(files, projectDir)) {
|
|
100
|
+
const result = await runCheck(app, group, { relativeTo: projectDir, linesOf });
|
|
101
|
+
if (result.skipped) {
|
|
102
|
+
total.skipped.push(`${path.relative(projectDir, app) || "."}: ${result.skipped}`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
total.errors += result.errors;
|
|
106
|
+
total.warnings += result.warnings;
|
|
107
|
+
if (result.text) texts.push(result.text);
|
|
108
|
+
}
|
|
109
|
+
return { ...total, text: texts.join("\n") };
|
|
110
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Plugin de ESLint do SpotDS: as regras de uso do @garantiabr/ui-kit no projeto que instala.
|
|
2
|
+
// Mesmo padrão dos design systems grandes (Atlassian, Primer, Polaris): o time do DS publica as regras dele.
|
|
3
|
+
//
|
|
4
|
+
// // eslint.config.mjs do projeto
|
|
5
|
+
// import spotds from "@garantiabr/ui-kit/eslint";
|
|
6
|
+
// export default [...outrasConfigs, spotds.configs.recommended];
|
|
7
|
+
|
|
8
|
+
const KIT_IMPORT = "@garantiabr/ui-kit/components/ui-garantiabr";
|
|
9
|
+
const CLASS_HELPERS = new Set(["cn", "clsx", "cva", "twMerge", "classNames"]);
|
|
10
|
+
const COLOR_UTILITIES =
|
|
11
|
+
"bg|text|border|ring|ring-offset|fill|stroke|from|to|via|outline|decoration|shadow|accent|caret|divide|placeholder";
|
|
12
|
+
const LITERAL_COLOR = new RegExp(`^(?:[\\w-]+:)*!?(?:${COLOR_UTILITIES})-\\[(?:#|rgba?\\(|hsla?\\(|oklch\\(|oklab\\(|color:)`);
|
|
13
|
+
const ARBITRARY_SPACING =
|
|
14
|
+
/^(?:[\w-]+:)*!?-?(?:p[xytblrse]?|m[xytblrse]?|gap(?:-[xy])?|space-[xy]|rounded(?:-[a-z]+)?)-\[[^\]]+\]$/;
|
|
15
|
+
const DARK_VARIANT = /(?:^|:)dark:/;
|
|
16
|
+
const RAW_ELEMENTS = { button: "button", input: "input", select: "select", textarea: "textarea" };
|
|
17
|
+
|
|
18
|
+
/** Classes de um texto de className: "p-md bg-[#fff]" → ["p-md", "bg-[#fff]"]. */
|
|
19
|
+
export function splitClasses(text) {
|
|
20
|
+
return text.split(/\s+/).filter(Boolean);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Texto que vira classe: valor de className/class ou argumento de cn/clsx/cva/twMerge (em qualquer profundidade).
|
|
24
|
+
function isClassText(node) {
|
|
25
|
+
for (let current = node.parent; current; current = current.parent) {
|
|
26
|
+
if (current.type === "JSXAttribute") return ["className", "class"].includes(current.name?.name);
|
|
27
|
+
if (current.type === "CallExpression" && CLASS_HELPERS.has(current.callee?.name)) return true;
|
|
28
|
+
if (current.type === "JSXElement" || current.type === "Program") return false;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function classRule({ description, test, message }) {
|
|
34
|
+
return {
|
|
35
|
+
meta: { type: "problem", docs: { description }, schema: [], messages: { found: message } },
|
|
36
|
+
create(context) {
|
|
37
|
+
const check = (node, text) => {
|
|
38
|
+
if (typeof text !== "string" || !isClassText(node)) return;
|
|
39
|
+
for (const cls of splitClasses(text).filter(test)) context.report({ node, messageId: "found", data: { cls } });
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
Literal: (node) => check(node, node.value),
|
|
43
|
+
TemplateElement: (node) => check(node, node.value.cooked),
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const rules = {
|
|
50
|
+
"no-literal-color": classRule({
|
|
51
|
+
description: "Cor do SpotDS só por token",
|
|
52
|
+
test: (cls) => LITERAL_COLOR.test(cls),
|
|
53
|
+
message: "`{{cls}}` usa cor literal. Use um token do SpotDS (ex.: bg-gray-0, text-gray-900, bg-primary-500).",
|
|
54
|
+
}),
|
|
55
|
+
"no-dark-variant": classRule({
|
|
56
|
+
description: "Tema escuro vem dos tokens",
|
|
57
|
+
test: (cls) => DARK_VARIANT.test(cls),
|
|
58
|
+
message: "`{{cls}}` troca cor com `dark:`. O tema escuro do SpotDS vem dos tokens (classe `dark` no <html>).",
|
|
59
|
+
}),
|
|
60
|
+
"no-arbitrary-spacing": classRule({
|
|
61
|
+
description: "Espaçamento e raio só pela escala do SpotDS",
|
|
62
|
+
test: (cls) => ARBITRARY_SPACING.test(cls),
|
|
63
|
+
message: "`{{cls}}` usa valor solto. Use a escala do SpotDS (ex.: p-md, gap-xs, rounded-lg).",
|
|
64
|
+
}),
|
|
65
|
+
"no-raw-element": {
|
|
66
|
+
meta: {
|
|
67
|
+
type: "suggestion",
|
|
68
|
+
docs: { description: "Elemento cru quando existe componente do SpotDS" },
|
|
69
|
+
schema: [],
|
|
70
|
+
messages: { found: `<{{tag}}> cru: use o componente do SpotDS (\`${KIT_IMPORT}/{{component}}\`).` },
|
|
71
|
+
},
|
|
72
|
+
create(context) {
|
|
73
|
+
return {
|
|
74
|
+
JSXOpeningElement(node) {
|
|
75
|
+
const tag = node.name?.type === "JSXIdentifier" ? node.name.name : null;
|
|
76
|
+
if (tag && RAW_ELEMENTS[tag]) context.report({ node, messageId: "found", data: { tag, component: RAW_ELEMENTS[tag] } });
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
"no-kit-copy": {
|
|
82
|
+
meta: {
|
|
83
|
+
type: "problem",
|
|
84
|
+
docs: { description: "Componente do kit copiado para dentro do projeto" },
|
|
85
|
+
schema: [],
|
|
86
|
+
messages: { found: `Este arquivo é uma cópia do kit (ui-garantiabr). Importe de \`${KIT_IMPORT}/…\`; ajuste por wrapper.` },
|
|
87
|
+
},
|
|
88
|
+
create(context) {
|
|
89
|
+
return {
|
|
90
|
+
Program(node) {
|
|
91
|
+
if (/[\\/]components[\\/]ui-garantiabr[\\/]/.test(context.filename ?? context.getFilename())) {
|
|
92
|
+
context.report({ node, messageId: "found" });
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const plugin = { meta: { name: "@garantiabr/ui-kit/eslint" }, rules, configs: {} };
|
|
101
|
+
|
|
102
|
+
plugin.configs.recommended = {
|
|
103
|
+
name: "@garantiabr/ui-kit/recommended",
|
|
104
|
+
files: ["**/*.{js,jsx,ts,tsx}"],
|
|
105
|
+
plugins: { spotds: plugin },
|
|
106
|
+
rules: {
|
|
107
|
+
"spotds/no-literal-color": "error",
|
|
108
|
+
"spotds/no-dark-variant": "error",
|
|
109
|
+
"spotds/no-raw-element": "error",
|
|
110
|
+
"spotds/no-kit-copy": "error",
|
|
111
|
+
"spotds/no-arbitrary-spacing": "warn",
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default plugin;
|
package/tools/hooks.mjs
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Hooks do Claude Code que o `init` liga no .claude/settings.json do projeto:
|
|
2
|
+
// session-start → avisa o agente se o pacote está desatualizado;
|
|
3
|
+
// post-edit → depois de cada Edit/Write, roda as regras do SpotDS no arquivo e devolve a violação na hora;
|
|
4
|
+
// stop → não deixa encerrar com violação nos arquivos que mudaram (libera na 2ª parada seguida, para
|
|
5
|
+
// não prender a sessão; o CI segue barrando).
|
|
6
|
+
// Os dois olham só as linhas que a tarefa mudou em relação ao HEAD: violação antiga numa linha que ninguém tocou
|
|
7
|
+
// não trava o agente (num projeto que está migrando para o pacote, isso seria o projeto inteiro). Arquivo novo,
|
|
8
|
+
// ou projeto fora do git, é olhado por inteiro.
|
|
9
|
+
// Num monorepo, cada arquivo é checado pelo app dono dele (tools/workspace.mjs); arquivo de app sem o pacote passa.
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
|
|
13
|
+
import { pathKey, runCheckByApp } from "./check.mjs";
|
|
14
|
+
import { versionReport } from "./version.mjs";
|
|
15
|
+
|
|
16
|
+
const EDIT_TOOLS = new Set(["Edit", "Write", "MultiEdit"]);
|
|
17
|
+
|
|
18
|
+
function projectDir() {
|
|
19
|
+
return process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function readStdin() {
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
let data = "";
|
|
25
|
+
process.stdin.setEncoding("utf8");
|
|
26
|
+
process.stdin.on("data", (chunk) => (data += chunk));
|
|
27
|
+
process.stdin.on("end", () => resolve(data ? JSON.parse(data) : {}));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function changedFiles(cwd) {
|
|
32
|
+
const git = (...args) => {
|
|
33
|
+
try {
|
|
34
|
+
return execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).split("\n").filter(Boolean);
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// --relative: o git devolve o caminho a partir da raiz do repositório; o projeto pode ser uma subpasta dele.
|
|
40
|
+
return [...new Set([...git("diff", "--name-only", "--relative", "HEAD"), ...git("ls-files", "--others", "--exclude-standard")])];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const HUNK = /^@@ -\S+ \+(\d+)(?:,(\d+))? @@/;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Linhas novas ou alteradas em relação ao HEAD, por arquivo (chave de pathKey).
|
|
47
|
+
* Ex.: um diff com `@@ -10,0 +11,2 @@` em src/a.tsx dá Map { ".../src/a.tsx" → Set {11, 12} }.
|
|
48
|
+
* Arquivo que não aparece no mapa (novo, fora do git) é olhado por inteiro.
|
|
49
|
+
*/
|
|
50
|
+
export function changedLinesFromDiff(diff, cwd) {
|
|
51
|
+
const byFile = new Map();
|
|
52
|
+
let current = null;
|
|
53
|
+
for (const raw of diff.split("\n")) {
|
|
54
|
+
const line = raw.replace(/\r$/, "");
|
|
55
|
+
if (line.startsWith("+++ ")) {
|
|
56
|
+
const target = line.slice(4);
|
|
57
|
+
current = target === "/dev/null" ? null : new Set();
|
|
58
|
+
if (current) byFile.set(pathKey(path.resolve(cwd, target.replace(/^b\//, ""))), current);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const hunk = current && HUNK.exec(line);
|
|
62
|
+
if (!hunk) continue;
|
|
63
|
+
const start = Number(hunk[1]);
|
|
64
|
+
const count = hunk[2] === undefined ? 1 : Number(hunk[2]);
|
|
65
|
+
for (let i = 0; i < count; i++) current.add(start + i);
|
|
66
|
+
}
|
|
67
|
+
return byFile;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// --ignore-all-space: linha que só mudou de recuo (o bloco foi parar dentro de outro componente) não conta.
|
|
71
|
+
// Arquivo rastreado que só mudou de recuo some desse diff; ele entra com nenhuma linha, e não por inteiro.
|
|
72
|
+
function changedLines(cwd) {
|
|
73
|
+
const git = (args) =>
|
|
74
|
+
execFileSync("git", ["-c", "core.quotePath=false", ...args], {
|
|
75
|
+
cwd,
|
|
76
|
+
encoding: "utf8",
|
|
77
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
78
|
+
maxBuffer: 512 * 1024 * 1024,
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
const byFile = changedLinesFromDiff(git(["diff", "-U0", "--ignore-all-space", "--no-color", "--relative", "HEAD"]), cwd);
|
|
82
|
+
for (const name of git(["diff", "--name-only", "--relative", "HEAD"]).split("\n").filter(Boolean)) {
|
|
83
|
+
const key = pathKey(path.resolve(cwd, name));
|
|
84
|
+
if (!byFile.has(key)) byFile.set(key, new Set());
|
|
85
|
+
}
|
|
86
|
+
return byFile;
|
|
87
|
+
} catch {
|
|
88
|
+
return new Map();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function linesOfChanged(cwd) {
|
|
93
|
+
const byFile = changedLines(cwd);
|
|
94
|
+
return (file) => byFile.get(pathKey(file));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function block(reason) {
|
|
98
|
+
return JSON.stringify({ decision: "block", reason });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function sessionStart() {
|
|
102
|
+
const report = await versionReport(projectDir());
|
|
103
|
+
if (!report.outdated) return "";
|
|
104
|
+
return JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: report.text } });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export async function postEdit(payload) {
|
|
108
|
+
const file = EDIT_TOOLS.has(payload.tool_name) ? payload.tool_input?.file_path : null;
|
|
109
|
+
if (!file) return "";
|
|
110
|
+
const cwd = projectDir();
|
|
111
|
+
const result = await runCheckByApp(cwd, [path.resolve(cwd, file)], { linesOf: linesOfChanged(cwd) });
|
|
112
|
+
if (!result.errors) return "";
|
|
113
|
+
return block(`Regras do SpotDS (@garantiabr/ui-kit) violadas nas linhas que você mudou. Corrija antes de seguir:\n\n${result.text}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export async function stop(payload) {
|
|
117
|
+
if (payload.stop_hook_active) return "";
|
|
118
|
+
const cwd = projectDir();
|
|
119
|
+
const files = changedFiles(cwd).map((f) => path.resolve(cwd, f));
|
|
120
|
+
const result = await runCheckByApp(cwd, files, { linesOf: linesOfChanged(cwd) });
|
|
121
|
+
if (!result.errors) return "";
|
|
122
|
+
return block(`Há violações das regras do SpotDS nas linhas que esta tarefa mudou. Corrija antes de encerrar:\n\n${result.text}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const HANDLERS = { "session-start": sessionStart, "post-edit": postEdit, stop };
|
|
126
|
+
|
|
127
|
+
/** `garantiabr-ui-kit hook <session-start|post-edit|stop>`: lê o payload do Claude Code no stdin. */
|
|
128
|
+
export async function runHook(name) {
|
|
129
|
+
const handler = HANDLERS[name];
|
|
130
|
+
if (!handler) throw new Error(`hook desconhecido: ${name}; esperado um de ${Object.keys(HANDLERS).join(", ")}`);
|
|
131
|
+
const output = await handler(name === "session-start" ? {} : await readStdin());
|
|
132
|
+
if (output) process.stdout.write(output + "\n");
|
|
133
|
+
}
|