eai-frontend-components 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +299 -0
- package/dist/components/accordion.d.ts +8 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +13 -0
- package/dist/components/alert-dialog.d.ts +25 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +27 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +22 -0
- package/dist/components/avatar.d.ts +7 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +11 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +26 -0
- package/dist/components/breadcrumb.d.ts +20 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +23 -0
- package/dist/components/button.d.ts +12 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +33 -0
- package/dist/components/calendar.d.ts +9 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +70 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +16 -0
- package/dist/components/carousel.d.ts +19 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +98 -0
- package/dist/components/chart.d.ts +63 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +130 -0
- package/dist/components/checkbox.d.ts +5 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +8 -0
- package/dist/components/collapsible.d.ts +6 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +5 -0
- package/dist/components/command.d.ts +81 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +28 -0
- package/dist/components/context-menu.d.ts +28 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +33 -0
- package/dist/components/custom/date-picker.d.ts +12 -0
- package/dist/components/custom/date-picker.d.ts.map +1 -0
- package/dist/components/custom/date-picker.js +35 -0
- package/dist/components/custom/form/checkbox.d.ts +13 -0
- package/dist/components/custom/form/checkbox.d.ts.map +1 -0
- package/dist/components/custom/form/checkbox.js +15 -0
- package/dist/components/custom/form/color.d.ts +15 -0
- package/dist/components/custom/form/color.d.ts.map +1 -0
- package/dist/components/custom/form/color.js +40 -0
- package/dist/components/custom/form/combobox.d.ts +37 -0
- package/dist/components/custom/form/combobox.d.ts.map +1 -0
- package/dist/components/custom/form/combobox.js +82 -0
- package/dist/components/custom/form/cpf-cnpj.d.ts +16 -0
- package/dist/components/custom/form/cpf-cnpj.d.ts.map +1 -0
- package/dist/components/custom/form/cpf-cnpj.js +32 -0
- package/dist/components/custom/form/currency.d.ts +14 -0
- package/dist/components/custom/form/currency.d.ts.map +1 -0
- package/dist/components/custom/form/currency.js +15 -0
- package/dist/components/custom/form/date-range.d.ts +16 -0
- package/dist/components/custom/form/date-range.d.ts.map +1 -0
- package/dist/components/custom/form/date-range.js +24 -0
- package/dist/components/custom/form/date.d.ts +16 -0
- package/dist/components/custom/form/date.d.ts.map +1 -0
- package/dist/components/custom/form/date.js +35 -0
- package/dist/components/custom/form/decimal.d.ts +14 -0
- package/dist/components/custom/form/decimal.d.ts.map +1 -0
- package/dist/components/custom/form/decimal.js +15 -0
- package/dist/components/custom/form/file.d.ts +15 -0
- package/dist/components/custom/form/file.d.ts.map +1 -0
- package/dist/components/custom/form/file.js +18 -0
- package/dist/components/custom/form/form-help-text.d.ts +3 -0
- package/dist/components/custom/form/form-help-text.d.ts.map +1 -0
- package/dist/components/custom/form/form-help-text.js +7 -0
- package/dist/components/custom/form/form-label.d.ts +4 -0
- package/dist/components/custom/form/form-label.d.ts.map +1 -0
- package/dist/components/custom/form/form-label.js +9 -0
- package/dist/components/custom/form/form-message.d.ts +3 -0
- package/dist/components/custom/form/form-message.d.ts.map +1 -0
- package/dist/components/custom/form/form-message.js +5 -0
- package/dist/components/custom/form/ghost.d.ts +8 -0
- package/dist/components/custom/form/ghost.d.ts.map +1 -0
- package/dist/components/custom/form/ghost.js +8 -0
- package/dist/components/custom/form/input.d.ts +18 -0
- package/dist/components/custom/form/input.d.ts.map +1 -0
- package/dist/components/custom/form/input.js +14 -0
- package/dist/components/custom/form/mask.d.ts +19 -0
- package/dist/components/custom/form/mask.d.ts.map +1 -0
- package/dist/components/custom/form/mask.js +19 -0
- package/dist/components/custom/form/multi-select-old.d.ts +19 -0
- package/dist/components/custom/form/multi-select-old.d.ts.map +1 -0
- package/dist/components/custom/form/multi-select-old.js +30 -0
- package/dist/components/custom/form/multi-select.d.ts +26 -0
- package/dist/components/custom/form/multi-select.d.ts.map +1 -0
- package/dist/components/custom/form/multi-select.js +66 -0
- package/dist/components/custom/form/password.d.ts +16 -0
- package/dist/components/custom/form/password.d.ts.map +1 -0
- package/dist/components/custom/form/password.js +14 -0
- package/dist/components/custom/form/percent.d.ts +14 -0
- package/dist/components/custom/form/percent.d.ts.map +1 -0
- package/dist/components/custom/form/percent.js +15 -0
- package/dist/components/custom/form/phone.d.ts +16 -0
- package/dist/components/custom/form/phone.d.ts.map +1 -0
- package/dist/components/custom/form/phone.js +23 -0
- package/dist/components/custom/form/radio-group.d.ts +23 -0
- package/dist/components/custom/form/radio-group.d.ts.map +1 -0
- package/dist/components/custom/form/radio-group.js +15 -0
- package/dist/components/custom/form/select.d.ts +20 -0
- package/dist/components/custom/form/select.d.ts.map +1 -0
- package/dist/components/custom/form/select.js +12 -0
- package/dist/components/custom/form/step-new-form.d.ts +10 -0
- package/dist/components/custom/form/step-new-form.d.ts.map +1 -0
- package/dist/components/custom/form/step-new-form.js +13 -0
- package/dist/components/custom/form/switch.d.ts +13 -0
- package/dist/components/custom/form/switch.d.ts.map +1 -0
- package/dist/components/custom/form/switch.js +16 -0
- package/dist/components/custom/form/text.d.ts +18 -0
- package/dist/components/custom/form/text.d.ts.map +1 -0
- package/dist/components/custom/form/text.js +14 -0
- package/dist/components/custom/form/textarea.d.ts +16 -0
- package/dist/components/custom/form/textarea.d.ts.map +1 -0
- package/dist/components/custom/form/textarea.js +19 -0
- package/dist/components/custom/form/utils.d.ts +18 -0
- package/dist/components/custom/form/utils.d.ts.map +1 -0
- package/dist/components/custom/form/utils.js +88 -0
- package/dist/components/custom/header.d.ts +3 -0
- package/dist/components/custom/header.d.ts.map +1 -0
- package/dist/components/custom/header.js +94 -0
- package/dist/components/custom/label.d.ts +13 -0
- package/dist/components/custom/label.d.ts.map +1 -0
- package/dist/components/custom/label.js +20 -0
- package/dist/components/custom/not-found.d.ts +3 -0
- package/dist/components/custom/not-found.d.ts.map +1 -0
- package/dist/components/custom/not-found.js +9 -0
- package/dist/components/custom/sidebar/app-sidebar.d.ts +5 -0
- package/dist/components/custom/sidebar/app-sidebar.d.ts.map +1 -0
- package/dist/components/custom/sidebar/app-sidebar.js +26 -0
- package/dist/components/custom/sidebar/module-switcher.d.ts +3 -0
- package/dist/components/custom/sidebar/module-switcher.d.ts.map +1 -0
- package/dist/components/custom/sidebar/module-switcher.js +55 -0
- package/dist/components/custom/sidebar/nav-footer.d.ts +3 -0
- package/dist/components/custom/sidebar/nav-footer.d.ts.map +1 -0
- package/dist/components/custom/sidebar/nav-footer.js +17 -0
- package/dist/components/custom/sidebar/nav-main.d.ts +3 -0
- package/dist/components/custom/sidebar/nav-main.d.ts.map +1 -0
- package/dist/components/custom/sidebar/nav-main.js +32 -0
- package/dist/components/custom/sidebar/nav-submenu-collapsible.d.ts +9 -0
- package/dist/components/custom/sidebar/nav-submenu-collapsible.d.ts.map +1 -0
- package/dist/components/custom/sidebar/nav-submenu-collapsible.js +21 -0
- package/dist/components/custom/sidebar/nav-submenu-dropdown.d.ts +10 -0
- package/dist/components/custom/sidebar/nav-submenu-dropdown.d.ts.map +1 -0
- package/dist/components/custom/sidebar/nav-submenu-dropdown.js +13 -0
- package/dist/components/custom/sidebar/nav-user.d.ts +3 -0
- package/dist/components/custom/sidebar/nav-user.d.ts.map +1 -0
- package/dist/components/custom/sidebar/nav-user.js +51 -0
- package/dist/components/custom/sidebar/sidebar-button.d.ts +9 -0
- package/dist/components/custom/sidebar/sidebar-button.d.ts.map +1 -0
- package/dist/components/custom/sidebar/sidebar-button.js +7 -0
- package/dist/components/custom/sidebar/sidebar-item-two-lines.d.ts +12 -0
- package/dist/components/custom/sidebar/sidebar-item-two-lines.d.ts.map +1 -0
- package/dist/components/custom/sidebar/sidebar-item-two-lines.js +5 -0
- package/dist/components/custom/sidebar/sidebar-item.d.ts +9 -0
- package/dist/components/custom/sidebar/sidebar-item.d.ts.map +1 -0
- package/dist/components/custom/sidebar/sidebar-item.js +7 -0
- package/dist/components/custom/sidebar/types/sidebar.d.ts +29 -0
- package/dist/components/custom/sidebar/types/sidebar.d.ts.map +1 -0
- package/dist/components/custom/sidebar/types/sidebar.js +5 -0
- package/dist/components/custom/table/data-table-export.d.ts +8 -0
- package/dist/components/custom/table/data-table-export.d.ts.map +1 -0
- package/dist/components/custom/table/data-table-export.js +65 -0
- package/dist/components/custom/table/data-table-footer.d.ts +25 -0
- package/dist/components/custom/table/data-table-footer.d.ts.map +1 -0
- package/dist/components/custom/table/data-table-footer.js +39 -0
- package/dist/components/custom/table/data-table-header.d.ts +9 -0
- package/dist/components/custom/table/data-table-header.d.ts.map +1 -0
- package/dist/components/custom/table/data-table-header.js +11 -0
- package/dist/components/custom/table/data-table-rows.d.ts +13 -0
- package/dist/components/custom/table/data-table-rows.d.ts.map +1 -0
- package/dist/components/custom/table/data-table-rows.js +25 -0
- package/dist/components/custom/table/data-table.d.ts +35 -0
- package/dist/components/custom/table/data-table.d.ts.map +1 -0
- package/dist/components/custom/table/data-table.js +99 -0
- package/dist/components/custom/table/types/data-table.d.ts +29 -0
- package/dist/components/custom/table/types/data-table.d.ts.map +1 -0
- package/dist/components/custom/table/types/data-table.js +1 -0
- package/dist/components/custom/theme-provider.d.ts +24 -0
- package/dist/components/custom/theme-provider.d.ts.map +1 -0
- package/dist/components/custom/theme-provider.js +79 -0
- package/dist/components/dateRangePicker.d.ts +3 -0
- package/dist/components/dateRangePicker.d.ts.map +1 -0
- package/dist/components/dateRangePicker.js +15 -0
- package/dist/components/dialog.d.ts +23 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +23 -0
- package/dist/components/drawer.d.ts +23 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +22 -0
- package/dist/components/dropdown-menu.d.ts +28 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +32 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +60 -0
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +9 -0
- package/dist/components/input.d.ts +24 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +71 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +9 -0
- package/dist/components/masks.d.ts +17 -0
- package/dist/components/masks.d.ts.map +1 -0
- package/dist/components/masks.js +25 -0
- package/dist/components/pagination.d.ts +30 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +23 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +11 -0
- package/dist/components/progress.d.ts +5 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +7 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +14 -0
- package/dist/components/scroll-area.d.ts +6 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +11 -0
- package/dist/components/select.d.ts +14 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +24 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/sheet.d.ts +26 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +37 -0
- package/dist/components/sidebar.d.ts +67 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +221 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +6 -0
- package/dist/components/slider.d.ts +5 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +7 -0
- package/dist/components/switch.d.ts +5 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +7 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +20 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +12 -0
- package/dist/components/textarea.d.ts +4 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +14 -0
- package/dist/components/toast.d.ts +16 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +34 -0
- package/dist/components/toaster.d.ts +2 -0
- package/dist/components/toaster.d.ts.map +1 -0
- package/dist/components/toaster.js +21 -0
- package/dist/components/tooltip.d.ts +8 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +10 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +13 -0
- package/dist/components/ui/alert-dialog.d.ts +25 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +27 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +22 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +11 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +26 -0
- package/dist/components/ui/breadcrumb.d.ts +20 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +23 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/calendar.d.ts +9 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +70 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +16 -0
- package/dist/components/ui/carousel.d.ts +19 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +98 -0
- package/dist/components/ui/chart.d.ts +63 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/chart.js +130 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +8 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/command.d.ts +81 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +28 -0
- package/dist/components/ui/context-menu.d.ts +28 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +33 -0
- package/dist/components/ui/custom/date-picker.d.ts +12 -0
- package/dist/components/ui/custom/date-picker.d.ts.map +1 -0
- package/dist/components/ui/custom/date-picker.js +35 -0
- package/dist/components/ui/custom/form/checkbox.d.ts +13 -0
- package/dist/components/ui/custom/form/checkbox.d.ts.map +1 -0
- package/dist/components/ui/custom/form/checkbox.js +15 -0
- package/dist/components/ui/custom/form/color.d.ts +15 -0
- package/dist/components/ui/custom/form/color.d.ts.map +1 -0
- package/dist/components/ui/custom/form/color.js +40 -0
- package/dist/components/ui/custom/form/combobox.d.ts +37 -0
- package/dist/components/ui/custom/form/combobox.d.ts.map +1 -0
- package/dist/components/ui/custom/form/combobox.js +82 -0
- package/dist/components/ui/custom/form/cpf-cnpj.d.ts +16 -0
- package/dist/components/ui/custom/form/cpf-cnpj.d.ts.map +1 -0
- package/dist/components/ui/custom/form/cpf-cnpj.js +32 -0
- package/dist/components/ui/custom/form/currency.d.ts +14 -0
- package/dist/components/ui/custom/form/currency.d.ts.map +1 -0
- package/dist/components/ui/custom/form/currency.js +15 -0
- package/dist/components/ui/custom/form/date-range.d.ts +16 -0
- package/dist/components/ui/custom/form/date-range.d.ts.map +1 -0
- package/dist/components/ui/custom/form/date-range.js +24 -0
- package/dist/components/ui/custom/form/date.d.ts +16 -0
- package/dist/components/ui/custom/form/date.d.ts.map +1 -0
- package/dist/components/ui/custom/form/date.js +35 -0
- package/dist/components/ui/custom/form/decimal.d.ts +14 -0
- package/dist/components/ui/custom/form/decimal.d.ts.map +1 -0
- package/dist/components/ui/custom/form/decimal.js +15 -0
- package/dist/components/ui/custom/form/file.d.ts +15 -0
- package/dist/components/ui/custom/form/file.d.ts.map +1 -0
- package/dist/components/ui/custom/form/file.js +18 -0
- package/dist/components/ui/custom/form/form-help-text.d.ts +3 -0
- package/dist/components/ui/custom/form/form-help-text.d.ts.map +1 -0
- package/dist/components/ui/custom/form/form-help-text.js +7 -0
- package/dist/components/ui/custom/form/form-label.d.ts +7 -0
- package/dist/components/ui/custom/form/form-label.d.ts.map +1 -0
- package/dist/components/ui/custom/form/form-label.js +9 -0
- package/dist/components/ui/custom/form/form-message.d.ts +5 -0
- package/dist/components/ui/custom/form/form-message.d.ts.map +1 -0
- package/dist/components/ui/custom/form/form-message.js +5 -0
- package/dist/components/ui/custom/form/ghost.d.ts +8 -0
- package/dist/components/ui/custom/form/ghost.d.ts.map +1 -0
- package/dist/components/ui/custom/form/ghost.js +8 -0
- package/dist/components/ui/custom/form/input.d.ts +18 -0
- package/dist/components/ui/custom/form/input.d.ts.map +1 -0
- package/dist/components/ui/custom/form/input.js +14 -0
- package/dist/components/ui/custom/form/mask.d.ts +19 -0
- package/dist/components/ui/custom/form/mask.d.ts.map +1 -0
- package/dist/components/ui/custom/form/mask.js +19 -0
- package/dist/components/ui/custom/form/multi-select-old.d.ts +19 -0
- package/dist/components/ui/custom/form/multi-select-old.d.ts.map +1 -0
- package/dist/components/ui/custom/form/multi-select-old.js +30 -0
- package/dist/components/ui/custom/form/multi-select.d.ts +26 -0
- package/dist/components/ui/custom/form/multi-select.d.ts.map +1 -0
- package/dist/components/ui/custom/form/multi-select.js +66 -0
- package/dist/components/ui/custom/form/password.d.ts +16 -0
- package/dist/components/ui/custom/form/password.d.ts.map +1 -0
- package/dist/components/ui/custom/form/password.js +14 -0
- package/dist/components/ui/custom/form/percent.d.ts +14 -0
- package/dist/components/ui/custom/form/percent.d.ts.map +1 -0
- package/dist/components/ui/custom/form/percent.js +15 -0
- package/dist/components/ui/custom/form/phone.d.ts +16 -0
- package/dist/components/ui/custom/form/phone.d.ts.map +1 -0
- package/dist/components/ui/custom/form/phone.js +23 -0
- package/dist/components/ui/custom/form/radio-group.d.ts +23 -0
- package/dist/components/ui/custom/form/radio-group.d.ts.map +1 -0
- package/dist/components/ui/custom/form/radio-group.js +15 -0
- package/dist/components/ui/custom/form/select.d.ts +20 -0
- package/dist/components/ui/custom/form/select.d.ts.map +1 -0
- package/dist/components/ui/custom/form/select.js +12 -0
- package/dist/components/ui/custom/form/step-new-form.d.ts +10 -0
- package/dist/components/ui/custom/form/step-new-form.d.ts.map +1 -0
- package/dist/components/ui/custom/form/step-new-form.js +13 -0
- package/dist/components/ui/custom/form/switch.d.ts +13 -0
- package/dist/components/ui/custom/form/switch.d.ts.map +1 -0
- package/dist/components/ui/custom/form/switch.js +16 -0
- package/dist/components/ui/custom/form/text.d.ts +18 -0
- package/dist/components/ui/custom/form/text.d.ts.map +1 -0
- package/dist/components/ui/custom/form/text.js +14 -0
- package/dist/components/ui/custom/form/textarea.d.ts +16 -0
- package/dist/components/ui/custom/form/textarea.d.ts.map +1 -0
- package/dist/components/ui/custom/form/textarea.js +19 -0
- package/dist/components/ui/custom/form/utils.d.ts +18 -0
- package/dist/components/ui/custom/form/utils.d.ts.map +1 -0
- package/dist/components/ui/custom/form/utils.js +88 -0
- package/dist/components/ui/custom/header.d.ts +11 -0
- package/dist/components/ui/custom/header.d.ts.map +1 -0
- package/dist/components/ui/custom/header.js +74 -0
- package/dist/components/ui/custom/label.d.ts +13 -0
- package/dist/components/ui/custom/label.d.ts.map +1 -0
- package/dist/components/ui/custom/label.js +20 -0
- package/dist/components/ui/custom/not-found.d.ts +3 -0
- package/dist/components/ui/custom/not-found.d.ts.map +1 -0
- package/dist/components/ui/custom/not-found.js +9 -0
- package/dist/components/ui/custom/sidebar/app-sidebar.d.ts +5 -0
- package/dist/components/ui/custom/sidebar/app-sidebar.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/app-sidebar.js +26 -0
- package/dist/components/ui/custom/sidebar/module-switcher.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/module-switcher.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/module-switcher.js +55 -0
- package/dist/components/ui/custom/sidebar/nav-footer.d.ts +7 -0
- package/dist/components/ui/custom/sidebar/nav-footer.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/nav-footer.js +13 -0
- package/dist/components/ui/custom/sidebar/nav-main.d.ts +7 -0
- package/dist/components/ui/custom/sidebar/nav-main.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/nav-main.js +27 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-collapsible.js +18 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.d.ts +10 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/nav-submenu-dropdown.js +10 -0
- package/dist/components/ui/custom/sidebar/nav-user.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/nav-user.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/nav-user.js +24 -0
- package/dist/components/ui/custom/sidebar/sidebar-button.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/sidebar-button.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/sidebar-button.js +7 -0
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.d.ts +12 -0
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/sidebar-item-two-lines.js +5 -0
- package/dist/components/ui/custom/sidebar/sidebar-item.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/sidebar-item.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/sidebar-item.js +7 -0
- package/dist/components/ui/custom/sidebar/sidebar-module-switcher.d.ts +9 -0
- package/dist/components/ui/custom/sidebar/sidebar-module-switcher.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/sidebar-module-switcher.js +20 -0
- package/dist/components/ui/custom/sidebar/types/sidebar.d.ts +29 -0
- package/dist/components/ui/custom/sidebar/types/sidebar.d.ts.map +1 -0
- package/dist/components/ui/custom/sidebar/types/sidebar.js +5 -0
- package/dist/components/ui/custom/table/data-table-export.d.ts +8 -0
- package/dist/components/ui/custom/table/data-table-export.d.ts.map +1 -0
- package/dist/components/ui/custom/table/data-table-export.js +65 -0
- package/dist/components/ui/custom/table/data-table-footer.d.ts +25 -0
- package/dist/components/ui/custom/table/data-table-footer.d.ts.map +1 -0
- package/dist/components/ui/custom/table/data-table-footer.js +39 -0
- package/dist/components/ui/custom/table/data-table-header.d.ts +9 -0
- package/dist/components/ui/custom/table/data-table-header.d.ts.map +1 -0
- package/dist/components/ui/custom/table/data-table-header.js +11 -0
- package/dist/components/ui/custom/table/data-table-rows.d.ts +13 -0
- package/dist/components/ui/custom/table/data-table-rows.d.ts.map +1 -0
- package/dist/components/ui/custom/table/data-table-rows.js +25 -0
- package/dist/components/ui/custom/table/data-table.d.ts +35 -0
- package/dist/components/ui/custom/table/data-table.d.ts.map +1 -0
- package/dist/components/ui/custom/table/data-table.js +99 -0
- package/dist/components/ui/custom/table/types/data-table.d.ts +29 -0
- package/dist/components/ui/custom/table/types/data-table.d.ts.map +1 -0
- package/dist/components/ui/custom/table/types/data-table.js +1 -0
- package/dist/components/ui/custom/theme-provider.d.ts +24 -0
- package/dist/components/ui/custom/theme-provider.d.ts.map +1 -0
- package/dist/components/ui/custom/theme-provider.js +79 -0
- package/dist/components/ui/dateRangePicker.d.ts +3 -0
- package/dist/components/ui/dateRangePicker.d.ts.map +1 -0
- package/dist/components/ui/dateRangePicker.js +15 -0
- package/dist/components/ui/dialog.d.ts +23 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +23 -0
- package/dist/components/ui/drawer.d.ts +23 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +22 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +32 -0
- package/dist/components/ui/form.d.ts +24 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +60 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +9 -0
- package/dist/components/ui/input.d.ts +24 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +71 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +9 -0
- package/dist/components/ui/masks.d.ts +17 -0
- package/dist/components/ui/masks.d.ts.map +1 -0
- package/dist/components/ui/masks.js +25 -0
- package/dist/components/ui/pagination.d.ts +30 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +23 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +7 -0
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +14 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +24 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +7 -0
- package/dist/components/ui/sheet.d.ts +26 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +37 -0
- package/dist/components/ui/sidebar.d.ts +67 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +221 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +7 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +7 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +20 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +12 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +14 -0
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +34 -0
- package/dist/components/ui/toaster.d.ts +2 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +21 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +10 -0
- package/dist/components/ui/use-calendar.d.ts +7 -0
- package/dist/components/ui/use-calendar.d.ts.map +1 -0
- package/dist/components/ui/use-calendar.js +23 -0
- package/dist/components/ui/use-toast.d.ts +46 -0
- package/dist/components/ui/use-toast.d.ts.map +1 -0
- package/dist/components/ui/use-toast.js +125 -0
- package/dist/components/use-calendar.d.ts +7 -0
- package/dist/components/use-calendar.d.ts.map +1 -0
- package/dist/components/use-calendar.js +23 -0
- package/dist/components/use-toast.d.ts +46 -0
- package/dist/components/use-toast.d.ts.map +1 -0
- package/dist/components/use-toast.js +125 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/index.d.ts +1514 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3233 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3558 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/help/date-utils.d.ts +7 -0
- package/dist/lib/help/date-utils.d.ts.map +1 -0
- package/dist/lib/help/date-utils.js +34 -0
- package/dist/lib/help/format.d.ts +22 -0
- package/dist/lib/help/format.d.ts.map +1 -0
- package/dist/lib/help/format.js +140 -0
- package/dist/lib/help/theme.d.ts +291 -0
- package/dist/lib/help/theme.d.ts.map +1 -0
- package/dist/lib/help/theme.js +340 -0
- package/dist/lib/help/uuid.d.ts +2 -0
- package/dist/lib/help/uuid.d.ts.map +1 -0
- package/dist/lib/help/uuid.js +4 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +5 -0
- package/package.json +146 -0
- package/src/components/ui/accordion.tsx +48 -0
- package/src/components/ui/alert-dialog.tsx +138 -0
- package/src/components/ui/alert.tsx +36 -0
- package/src/components/ui/avatar.tsx +48 -0
- package/src/components/ui/badge.tsx +35 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.tsx +43 -0
- package/src/components/ui/calendar.tsx +142 -0
- package/src/components/ui/card.tsx +35 -0
- package/src/components/ui/carousel.tsx +257 -0
- package/src/components/ui/chart.tsx +364 -0
- package/src/components/ui/checkbox.tsx +26 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/command.tsx +145 -0
- package/src/components/ui/context-menu.tsx +198 -0
- package/src/components/ui/custom/date-picker.tsx +97 -0
- package/src/components/ui/custom/form/checkbox.tsx +53 -0
- package/src/components/ui/custom/form/color.tsx +140 -0
- package/src/components/ui/custom/form/combobox.tsx +259 -0
- package/src/components/ui/custom/form/cpf-cnpj.tsx +85 -0
- package/src/components/ui/custom/form/currency.tsx +51 -0
- package/src/components/ui/custom/form/date-range.tsx +110 -0
- package/src/components/ui/custom/form/date.tsx +109 -0
- package/src/components/ui/custom/form/decimal.tsx +50 -0
- package/src/components/ui/custom/form/file.tsx +65 -0
- package/src/components/ui/custom/form/form-help-text.tsx +20 -0
- package/src/components/ui/custom/form/form-label.tsx +24 -0
- package/src/components/ui/custom/form/form-message.tsx +10 -0
- package/src/components/ui/custom/form/ghost.tsx +28 -0
- package/src/components/ui/custom/form/input.tsx +69 -0
- package/src/components/ui/custom/form/mask.tsx +78 -0
- package/src/components/ui/custom/form/multi-select.tsx +209 -0
- package/src/components/ui/custom/form/password.tsx +70 -0
- package/src/components/ui/custom/form/percent.tsx +52 -0
- package/src/components/ui/custom/form/phone.tsx +79 -0
- package/src/components/ui/custom/form/radio-group.tsx +94 -0
- package/src/components/ui/custom/form/select.tsx +62 -0
- package/src/components/ui/custom/form/step-new-form.tsx +49 -0
- package/src/components/ui/custom/form/switch.tsx +51 -0
- package/src/components/ui/custom/form/text.tsx +71 -0
- package/src/components/ui/custom/form/textarea.tsx +71 -0
- package/src/components/ui/custom/form/utils.ts +100 -0
- package/src/components/ui/custom/header.tsx +128 -0
- package/src/components/ui/custom/label.tsx +79 -0
- package/src/components/ui/custom/not-found.tsx +30 -0
- package/src/components/ui/custom/sidebar/module-switcher.tsx +58 -0
- package/src/components/ui/custom/sidebar/nav-footer.tsx +35 -0
- package/src/components/ui/custom/sidebar/nav-main.tsx +64 -0
- package/src/components/ui/custom/sidebar/nav-submenu-collapsible.tsx +60 -0
- package/src/components/ui/custom/sidebar/nav-submenu-dropdown.tsx +56 -0
- package/src/components/ui/custom/sidebar/nav-user.tsx +77 -0
- package/src/components/ui/custom/sidebar/sidebar-button.tsx +30 -0
- package/src/components/ui/custom/sidebar/sidebar-item-two-lines.tsx +25 -0
- package/src/components/ui/custom/sidebar/sidebar-item.tsx +19 -0
- package/src/components/ui/custom/sidebar/types/sidebar.ts +31 -0
- package/src/components/ui/custom/table/data-table-export.tsx +126 -0
- package/src/components/ui/custom/table/data-table-footer.tsx +148 -0
- package/src/components/ui/custom/table/data-table-header.tsx +58 -0
- package/src/components/ui/custom/table/data-table-rows.tsx +94 -0
- package/src/components/ui/custom/table/data-table.tsx +285 -0
- package/src/components/ui/custom/table/types/data-table.ts +31 -0
- package/src/components/ui/custom/theme-provider.tsx +121 -0
- package/src/components/ui/dateRangePicker.tsx +63 -0
- package/src/components/ui/dialog.tsx +84 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.tsx +173 -0
- package/src/components/ui/form.tsx +114 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/input.tsx +265 -0
- package/src/components/ui/label.tsx +15 -0
- package/src/components/ui/masks.ts +35 -0
- package/src/components/ui/pagination.tsx +78 -0
- package/src/components/ui/popover.tsx +32 -0
- package/src/components/ui/progress.tsx +22 -0
- package/src/components/ui/radio-group.tsx +36 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/select.tsx +130 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +90 -0
- package/src/components/ui/sidebar.tsx +598 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +18 -0
- package/src/components/ui/switch.tsx +26 -0
- package/src/components/ui/table.tsx +53 -0
- package/src/components/ui/tabs.tsx +47 -0
- package/src/components/ui/textarea.tsx +27 -0
- package/src/components/ui/toast.tsx +88 -0
- package/src/components/ui/toaster.tsx +49 -0
- package/src/components/ui/tooltip.tsx +31 -0
- package/src/components/ui/use-calendar.tsx +61 -0
- package/src/components/ui/use-toast.ts +186 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.ts +299 -0
- package/src/lib/help/date-utils.ts +41 -0
- package/src/lib/help/format.ts +171 -0
- package/src/lib/help/theme.ts +346 -0
- package/src/lib/help/uuid.ts +4 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/globals.css +59 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Check, ChevronsUpDown, LoaderCircle, X } from 'lucide-react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ControllerRenderProps, FieldValues } from 'react-hook-form';
|
|
4
|
+
import { cn } from '../../../../lib/utils';
|
|
5
|
+
import { Button } from '../../button';
|
|
6
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../command';
|
|
7
|
+
import * as FormComponents from '../../form';
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../popover';
|
|
9
|
+
import { formHelpText } from './form-help-text';
|
|
10
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
11
|
+
import { formMessage } from './form-message';
|
|
12
|
+
|
|
13
|
+
export interface ComboboxOption {
|
|
14
|
+
value: string | undefined;
|
|
15
|
+
icon?: React.ReactNode | undefined;
|
|
16
|
+
title: string;
|
|
17
|
+
subTitle?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
control: any;
|
|
23
|
+
name: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
subLabel?: string;
|
|
26
|
+
helpText?: JSX.Element;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
options: ComboboxOption[];
|
|
32
|
+
selectedOption?: ComboboxOption;
|
|
33
|
+
iconLeft?: React.ReactNode | null;
|
|
34
|
+
iconRight?: React.ReactNode | null;
|
|
35
|
+
addEmptyOption?: boolean;
|
|
36
|
+
canUnselect?: boolean;
|
|
37
|
+
closePopUpOnChange?: boolean;
|
|
38
|
+
runInternalSearch?: boolean;
|
|
39
|
+
disabledSearch?: boolean;
|
|
40
|
+
onChange?: (option: ComboboxOption | undefined) => void;
|
|
41
|
+
onSearch?: (searchString: string) => void;
|
|
42
|
+
footerAction?: {
|
|
43
|
+
label: string;
|
|
44
|
+
icon?: React.ReactNode;
|
|
45
|
+
onClick: () => void;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const FormCombobox: React.FC<Props> = ({
|
|
50
|
+
control,
|
|
51
|
+
name,
|
|
52
|
+
label,
|
|
53
|
+
subLabel,
|
|
54
|
+
helpText,
|
|
55
|
+
placeholder,
|
|
56
|
+
className,
|
|
57
|
+
disabled,
|
|
58
|
+
required,
|
|
59
|
+
options,
|
|
60
|
+
selectedOption,
|
|
61
|
+
iconLeft,
|
|
62
|
+
iconRight,
|
|
63
|
+
addEmptyOption,
|
|
64
|
+
canUnselect = false,
|
|
65
|
+
closePopUpOnChange = true,
|
|
66
|
+
runInternalSearch = true,
|
|
67
|
+
disabledSearch = false,
|
|
68
|
+
onChange,
|
|
69
|
+
onSearch,
|
|
70
|
+
footerAction,
|
|
71
|
+
}) => {
|
|
72
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
73
|
+
|
|
74
|
+
const [open, setOpen] = useState(false);
|
|
75
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
76
|
+
const [searchString, setSearchString] = useState<string>('');
|
|
77
|
+
const DEFAULT_PLACEHOLDER = 'Digite para buscar...';
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setLoading(false);
|
|
81
|
+
}, [options]);
|
|
82
|
+
|
|
83
|
+
const getOptions = () => {
|
|
84
|
+
if (options.length === 0) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let filteredOptions = options;
|
|
89
|
+
if (runInternalSearch) {
|
|
90
|
+
filteredOptions = options.filter((option) => {
|
|
91
|
+
const title = option.title
|
|
92
|
+
.toLowerCase()
|
|
93
|
+
.normalize('NFD')
|
|
94
|
+
.replace(/[^a-z0-9\s]/gi, '');
|
|
95
|
+
const subTitle = option.subTitle
|
|
96
|
+
?.toLowerCase()
|
|
97
|
+
.normalize('NFD')
|
|
98
|
+
.replace(/[^a-z0-9\s]/gi, '');
|
|
99
|
+
const search = searchString
|
|
100
|
+
.toLowerCase()
|
|
101
|
+
.normalize('NFD')
|
|
102
|
+
.replace(/[^a-z0-9\s]/gi, '');
|
|
103
|
+
|
|
104
|
+
return title.includes(search) || subTitle?.includes(search);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (addEmptyOption) {
|
|
109
|
+
filteredOptions.unshift({ value: undefined, title: '--Selecione--', subTitle: '' });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return filteredOptions;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const getSelectedOption = (value: string | undefined): ComboboxOption | undefined => {
|
|
116
|
+
const option = options.find((option) => option.value === value);
|
|
117
|
+
|
|
118
|
+
if (option) {
|
|
119
|
+
return option;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return selectedOption;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const handleSelect = (value: string | undefined, field: ControllerRenderProps<FieldValues, string>) => {
|
|
126
|
+
const option = value ? getSelectedOption(value) : undefined;
|
|
127
|
+
|
|
128
|
+
if (canUnselect) {
|
|
129
|
+
field.onChange(field.value === value ? undefined : value);
|
|
130
|
+
} else {
|
|
131
|
+
field.onChange(value);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (onChange) {
|
|
135
|
+
onChange(option);
|
|
136
|
+
}
|
|
137
|
+
if (closePopUpOnChange) {
|
|
138
|
+
setOpen(false);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
143
|
+
const searchString = (event.target as HTMLInputElement).value;
|
|
144
|
+
|
|
145
|
+
if (onSearch) {
|
|
146
|
+
setLoading(true);
|
|
147
|
+
onSearch(searchString);
|
|
148
|
+
}
|
|
149
|
+
setSearchString(searchString);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<FormField
|
|
154
|
+
control={control}
|
|
155
|
+
name={name}
|
|
156
|
+
render={({ field, formState }) => (
|
|
157
|
+
<FormItem className={className}>
|
|
158
|
+
<div className='flex items-center space-x-1.5'>
|
|
159
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
160
|
+
{helpText && formHelpText(helpText)}
|
|
161
|
+
</div>
|
|
162
|
+
<Popover
|
|
163
|
+
open={open}
|
|
164
|
+
onOpenChange={(open) => {
|
|
165
|
+
if (!disabled) setOpen(open);
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<PopoverTrigger asChild>
|
|
169
|
+
<FormControl>
|
|
170
|
+
<div className={cn(`rounded-sm outline-none ${open ? 'ring-2 ring-ring ring-offset-2' : 'ring-0'}`, className)}>
|
|
171
|
+
<Button
|
|
172
|
+
type='button'
|
|
173
|
+
variant='outline'
|
|
174
|
+
role='combobox'
|
|
175
|
+
aria-expanded={open}
|
|
176
|
+
className={cn(
|
|
177
|
+
'justify-between disabled:border-disabled disabled:cursor-not-allowed disabled:opacity-50',
|
|
178
|
+
formState.errors[name] ? 'border-red-600' : '',
|
|
179
|
+
className,
|
|
180
|
+
)}
|
|
181
|
+
disabled={disabled || formState.isSubmitting}
|
|
182
|
+
>
|
|
183
|
+
{iconLeft}
|
|
184
|
+
<div className='grid flex-1 text-left text-sm leading-tight'>
|
|
185
|
+
<span className='truncate font-normal'>
|
|
186
|
+
{getSelectedOption(field.value) ? (
|
|
187
|
+
<div className='flex gap-2'>
|
|
188
|
+
{getSelectedOption(field.value)?.icon}
|
|
189
|
+
{getSelectedOption(field.value)?.title}
|
|
190
|
+
</div>
|
|
191
|
+
) : (
|
|
192
|
+
<span className='text-zinc-500'>{placeholder ?? DEFAULT_PLACEHOLDER}</span>
|
|
193
|
+
)}
|
|
194
|
+
</span>
|
|
195
|
+
</div>
|
|
196
|
+
{iconRight ?? <ChevronsUpDown size={20} className='stroke-zinc-500' />}
|
|
197
|
+
</Button>
|
|
198
|
+
</div>
|
|
199
|
+
</FormControl>
|
|
200
|
+
</PopoverTrigger>
|
|
201
|
+
<PopoverContent className={cn('p-0', className, 'w-[--radix-popover-trigger-width]')}>
|
|
202
|
+
<Command shouldFilter={false}>
|
|
203
|
+
{!disabledSearch && <CommandInput placeholder={placeholder ?? DEFAULT_PLACEHOLDER} onKeyUp={handleKeyUp} />}
|
|
204
|
+
<CommandList>
|
|
205
|
+
<CommandEmpty className='flex flex-col justify-between items-center p-3 font-normal text-sm'>
|
|
206
|
+
{loading ? (
|
|
207
|
+
<LoaderCircle size={16} className='text-sidebar-foreground animate-spin mr-2' />
|
|
208
|
+
) : getOptions()?.length === 0 && (searchString !== '' || disabledSearch) ? (
|
|
209
|
+
'Nenhum resultado encontrado'
|
|
210
|
+
) : (
|
|
211
|
+
'Utilize o campo de busca acima'
|
|
212
|
+
)}
|
|
213
|
+
</CommandEmpty>
|
|
214
|
+
{options.length > 0 && (
|
|
215
|
+
<CommandGroup>
|
|
216
|
+
{getOptions().map((option) => (
|
|
217
|
+
<CommandItem
|
|
218
|
+
key={`key-opt-${option.value}`}
|
|
219
|
+
value={option.value}
|
|
220
|
+
className='group'
|
|
221
|
+
onSelect={() => handleSelect(option.value, field)}
|
|
222
|
+
>
|
|
223
|
+
<div className={cn('grid flex-1 text-left text-sm leading-tight', option.className)}>
|
|
224
|
+
<div className='flex gap-2'>
|
|
225
|
+
{option.icon}
|
|
226
|
+
<span className='truncate font-normal'>{option.title}</span>
|
|
227
|
+
</div>
|
|
228
|
+
<span className='truncate text-xs text-zinc-500'>{option.subTitle}</span>
|
|
229
|
+
</div>
|
|
230
|
+
<div
|
|
231
|
+
className={`ml-auto text-zinc-500 ${
|
|
232
|
+
field.value === option.value ? 'opacity-100' : 'opacity-0'
|
|
233
|
+
}`}
|
|
234
|
+
>
|
|
235
|
+
<Check className={cn('flex', canUnselect && 'group-hover:hidden hover:hidden')} size={16} />
|
|
236
|
+
<X className={cn('hidden', canUnselect && 'group-hover:flex hover:flex')} size={16} />
|
|
237
|
+
</div>
|
|
238
|
+
</CommandItem>
|
|
239
|
+
))}
|
|
240
|
+
</CommandGroup>
|
|
241
|
+
)}
|
|
242
|
+
</CommandList>
|
|
243
|
+
</Command>
|
|
244
|
+
{footerAction && (
|
|
245
|
+
<div className='grid w-full p-1 border-t'>
|
|
246
|
+
<Button type='button' variant='ghost' className='h-8' onClick={() => footerAction.onClick()}>
|
|
247
|
+
{footerAction.icon}
|
|
248
|
+
{footerAction.label}
|
|
249
|
+
</Button>
|
|
250
|
+
</div>
|
|
251
|
+
)}
|
|
252
|
+
</PopoverContent>
|
|
253
|
+
</Popover>
|
|
254
|
+
{formMessage(FormMessage)}
|
|
255
|
+
</FormItem>
|
|
256
|
+
)}
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import * as FormComponents from '../../form';
|
|
3
|
+
import { MaskInputCpfCnpj } from '../../input';
|
|
4
|
+
import { formHelpText } from './form-help-text';
|
|
5
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
6
|
+
import { formMessage } from './form-message';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
control: any;
|
|
10
|
+
name: string;
|
|
11
|
+
label: string;
|
|
12
|
+
subLabel?: string;
|
|
13
|
+
helpText?: JSX.Element;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const masks = ['999.999.999-999', '99.999.999/9999-99'];
|
|
23
|
+
|
|
24
|
+
export const FormInputCpfCnpj: React.FC<Props> = ({
|
|
25
|
+
control,
|
|
26
|
+
name,
|
|
27
|
+
label,
|
|
28
|
+
subLabel,
|
|
29
|
+
helpText,
|
|
30
|
+
placeholder,
|
|
31
|
+
className,
|
|
32
|
+
disabled,
|
|
33
|
+
required,
|
|
34
|
+
onChange,
|
|
35
|
+
onKeyUp,
|
|
36
|
+
}) => {
|
|
37
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
38
|
+
const [mask, setMask] = useState(masks[0]);
|
|
39
|
+
|
|
40
|
+
const handleMaskChange = (value: string) => {
|
|
41
|
+
const numericValue = value.replace(/\D/g, '');
|
|
42
|
+
if (numericValue.length > 11) {
|
|
43
|
+
setMask(masks[1]);
|
|
44
|
+
} else {
|
|
45
|
+
setMask(masks[0]);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<FormField
|
|
51
|
+
control={control}
|
|
52
|
+
name={name}
|
|
53
|
+
render={({ field, formState }) => (
|
|
54
|
+
<FormItem className={className}>
|
|
55
|
+
<div className='flex items-center space-x-1.5'>
|
|
56
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
57
|
+
{helpText && formHelpText(helpText)}
|
|
58
|
+
</div>
|
|
59
|
+
<FormControl>
|
|
60
|
+
<MaskInputCpfCnpj
|
|
61
|
+
{...field}
|
|
62
|
+
className={`${className}`}
|
|
63
|
+
placeholder={placeholder}
|
|
64
|
+
disabled={disabled || formState.isSubmitting}
|
|
65
|
+
mask={mask}
|
|
66
|
+
onChange={(e) => {
|
|
67
|
+
field.onChange(e);
|
|
68
|
+
handleMaskChange(e.target.value);
|
|
69
|
+
if (onChange) {
|
|
70
|
+
onChange(e);
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
onKeyUp={(e) => {
|
|
74
|
+
if (onKeyUp) {
|
|
75
|
+
onKeyUp(e);
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</FormControl>
|
|
80
|
+
{formMessage(FormMessage)}
|
|
81
|
+
</FormItem>
|
|
82
|
+
)}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as FormComponents from '../../form';
|
|
2
|
+
import { MaskInputDecimal } from '../../input';
|
|
3
|
+
import { formHelpText } from './form-help-text';
|
|
4
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
5
|
+
import { formMessage } from './form-message';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
control: any;
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
subLabel?: string;
|
|
12
|
+
helpText?: JSX.Element;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const FormInputCurrency: React.FC<Props> = ({ control, name, label, subLabel, helpText, className, disabled, required, onChange }) => {
|
|
20
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<FormField
|
|
24
|
+
control={control}
|
|
25
|
+
name={name}
|
|
26
|
+
render={({ field, formState }) => (
|
|
27
|
+
<FormItem className={className}>
|
|
28
|
+
<div className='flex items-center space-x-1.5'>
|
|
29
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
30
|
+
{helpText && formHelpText(helpText)}
|
|
31
|
+
</div>
|
|
32
|
+
<FormControl>
|
|
33
|
+
<MaskInputDecimal
|
|
34
|
+
{...field}
|
|
35
|
+
symbol='R$'
|
|
36
|
+
className={`${className}`}
|
|
37
|
+
disabled={disabled || formState.isSubmitting}
|
|
38
|
+
onChange={(e) => {
|
|
39
|
+
field.onChange(e);
|
|
40
|
+
if (onChange) {
|
|
41
|
+
onChange(e);
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
</FormControl>
|
|
46
|
+
{formMessage(FormMessage)}
|
|
47
|
+
</FormItem>
|
|
48
|
+
)}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
|
+
import { CalendarIcon } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { DateRange } from 'react-day-picker';
|
|
5
|
+
import { cn } from '../../../../lib/utils';
|
|
6
|
+
import { Button } from '../../button';
|
|
7
|
+
import { Calendar } from '../../calendar';
|
|
8
|
+
import * as FormComponents from '../../form';
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../popover';
|
|
10
|
+
import { formHelpText } from './form-help-text';
|
|
11
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
12
|
+
import { formMessage } from './form-message';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
control: any;
|
|
16
|
+
name: string;
|
|
17
|
+
label: string;
|
|
18
|
+
subLabel?: string;
|
|
19
|
+
helpText?: JSX.Element;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement> | DateRange | undefined) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const FormDataRange: React.FC<Props> = ({
|
|
28
|
+
control,
|
|
29
|
+
name,
|
|
30
|
+
label,
|
|
31
|
+
subLabel,
|
|
32
|
+
helpText,
|
|
33
|
+
placeholder,
|
|
34
|
+
className,
|
|
35
|
+
disabled,
|
|
36
|
+
required,
|
|
37
|
+
onChange,
|
|
38
|
+
}) => {
|
|
39
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
40
|
+
|
|
41
|
+
// const [date, setDate] = useState<DateRange | undefined>(field.value);
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
|
|
44
|
+
const handleDateChange = (newDate: DateRange | undefined, field: any) => {
|
|
45
|
+
// setDate(newDate);
|
|
46
|
+
field.onChange(newDate);
|
|
47
|
+
if (onChange) onChange(newDate);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<FormField
|
|
52
|
+
control={control}
|
|
53
|
+
name={name}
|
|
54
|
+
render={({ field, formState }) => (
|
|
55
|
+
<FormItem className={className}>
|
|
56
|
+
<div className='flex items-center space-x-1.5'>
|
|
57
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
58
|
+
{helpText && formHelpText(helpText)}
|
|
59
|
+
</div>
|
|
60
|
+
<FormControl>
|
|
61
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
62
|
+
<PopoverTrigger asChild className='w-full'>
|
|
63
|
+
<div className={` rounded-sm outline-none ${open ? 'ring-2 ring-ring ring-offset-2' : 'ring-0'}`}>
|
|
64
|
+
<Button
|
|
65
|
+
type='button'
|
|
66
|
+
variant='outline'
|
|
67
|
+
role='combobox'
|
|
68
|
+
aria-expanded={open}
|
|
69
|
+
className={cn(
|
|
70
|
+
` ${className} justify-start disabled:border-disabled disabled:cursor-not-allowed disabled:opacity-50`,
|
|
71
|
+
formState.errors[name] ? 'border-red-600' : '',
|
|
72
|
+
)}
|
|
73
|
+
disabled={disabled || formState.isSubmitting}
|
|
74
|
+
>
|
|
75
|
+
<CalendarIcon className='text-zinc-500' />
|
|
76
|
+
{field.value?.from ? (
|
|
77
|
+
field.value?.to ? (
|
|
78
|
+
<>
|
|
79
|
+
{format(field.value?.from, 'dd/MM/yyyy')} - {format(field.value?.to, 'dd/MM/yyyy')}
|
|
80
|
+
</>
|
|
81
|
+
) : (
|
|
82
|
+
format(field.value?.from, 'dd/MM/yyyy')
|
|
83
|
+
)
|
|
84
|
+
) : (
|
|
85
|
+
<span className='font-normal text-zinc-500'>Escolha um Período</span>
|
|
86
|
+
)}
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</PopoverTrigger>
|
|
90
|
+
<PopoverContent className='flex w-auto p-0' align='start'>
|
|
91
|
+
<div className='flex flex-row space-x-4'>
|
|
92
|
+
<Calendar
|
|
93
|
+
initialFocus
|
|
94
|
+
mode='range'
|
|
95
|
+
defaultMonth={field.value?.from}
|
|
96
|
+
selected={field.value}
|
|
97
|
+
numberOfMonths={2}
|
|
98
|
+
className='flex'
|
|
99
|
+
onSelect={(newDate) => handleDateChange(newDate, field)}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</PopoverContent>
|
|
103
|
+
</Popover>
|
|
104
|
+
</FormControl>
|
|
105
|
+
{formMessage(FormMessage)}
|
|
106
|
+
</FormItem>
|
|
107
|
+
)}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ptBR } from 'date-fns/locale';
|
|
2
|
+
import { CalendarIcon } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { stringToDate } from '../../../../lib/help/date-utils';
|
|
5
|
+
import { cn } from '../../../../lib/utils';
|
|
6
|
+
import { Calendar } from '../../calendar';
|
|
7
|
+
import * as FormComponents from '../../form';
|
|
8
|
+
import { MaskInput } from '../../input';
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../popover';
|
|
10
|
+
import { formHelpText } from './form-help-text';
|
|
11
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
12
|
+
import { formMessage } from './form-message';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
control: any;
|
|
16
|
+
name: string;
|
|
17
|
+
label: string;
|
|
18
|
+
subLabel?: string;
|
|
19
|
+
helpText?: JSX.Element;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
25
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const FormInputDate: React.FC<Props> = ({
|
|
29
|
+
control,
|
|
30
|
+
name,
|
|
31
|
+
label,
|
|
32
|
+
subLabel,
|
|
33
|
+
helpText,
|
|
34
|
+
placeholder = '01/01/2023',
|
|
35
|
+
className,
|
|
36
|
+
disabled,
|
|
37
|
+
required,
|
|
38
|
+
onChange,
|
|
39
|
+
onKeyUp,
|
|
40
|
+
}) => {
|
|
41
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<FormField
|
|
46
|
+
control={control}
|
|
47
|
+
name={name}
|
|
48
|
+
render={({ field, formState }) => (
|
|
49
|
+
<FormItem className={className}>
|
|
50
|
+
<div className='flex items-center space-x-1.5'>
|
|
51
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
52
|
+
{helpText && formHelpText(helpText)}
|
|
53
|
+
</div>
|
|
54
|
+
<FormControl>
|
|
55
|
+
<div className='relative w-full'>
|
|
56
|
+
<MaskInput
|
|
57
|
+
{...field}
|
|
58
|
+
mask={'99/99/9999'}
|
|
59
|
+
maskPlaceholder={null}
|
|
60
|
+
placeholder={placeholder}
|
|
61
|
+
disabled={disabled || formState.isSubmitting}
|
|
62
|
+
className={cn('pl-9', className)}
|
|
63
|
+
onChange={(e) => {
|
|
64
|
+
field.onChange(e);
|
|
65
|
+
if (onChange) {
|
|
66
|
+
onChange(e);
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
onKeyUp={(e) => {
|
|
70
|
+
if (onKeyUp) {
|
|
71
|
+
onKeyUp(e);
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<div className='absolute left-3 top-1/2 -translate-y-1/2 cursor-pointer'>
|
|
77
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
78
|
+
<PopoverTrigger asChild>
|
|
79
|
+
<CalendarIcon size={16} className='cursor-pointer text-gray-500' />
|
|
80
|
+
</PopoverTrigger>
|
|
81
|
+
<PopoverContent className='w-[250px] p-0' align='start'>
|
|
82
|
+
<Calendar
|
|
83
|
+
mode='single'
|
|
84
|
+
locale={ptBR}
|
|
85
|
+
required={true}
|
|
86
|
+
selected={stringToDate(field.value) ?? new Date()}
|
|
87
|
+
onSelect={(date) => {
|
|
88
|
+
field.onChange(date ? date.toLocaleDateString('pt-BR') : '');
|
|
89
|
+
if (onChange) {
|
|
90
|
+
onChange({
|
|
91
|
+
target: { value: date ? date.toLocaleDateString('pt-BR') : '' },
|
|
92
|
+
} as React.ChangeEvent<HTMLInputElement>);
|
|
93
|
+
}
|
|
94
|
+
setOpen(false);
|
|
95
|
+
}}
|
|
96
|
+
className='rounded-md'
|
|
97
|
+
captionLayout='dropdown'
|
|
98
|
+
/>
|
|
99
|
+
</PopoverContent>
|
|
100
|
+
</Popover>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</FormControl>
|
|
104
|
+
{formMessage(FormMessage)}
|
|
105
|
+
</FormItem>
|
|
106
|
+
)}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as FormComponents from '../../form';
|
|
2
|
+
import { MaskInputDecimal } from '../../input';
|
|
3
|
+
import { formHelpText } from './form-help-text';
|
|
4
|
+
import { formLabelAndSubLabel } from './form-label';
|
|
5
|
+
import { formMessage } from './form-message';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
control: any;
|
|
9
|
+
name: string;
|
|
10
|
+
label: string;
|
|
11
|
+
subLabel?: string;
|
|
12
|
+
helpText?: JSX.Element;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const FormInputDecimal: React.FC<Props> = ({ control, name, label, subLabel, helpText, className, disabled, required, onChange }) => {
|
|
20
|
+
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<FormField
|
|
24
|
+
control={control}
|
|
25
|
+
name={name}
|
|
26
|
+
render={({ field, formState }) => (
|
|
27
|
+
<FormItem className={className}>
|
|
28
|
+
<div className='flex items-center space-x-1.5'>
|
|
29
|
+
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
30
|
+
{helpText && formHelpText(helpText)}
|
|
31
|
+
</div>
|
|
32
|
+
<FormControl>
|
|
33
|
+
<MaskInputDecimal
|
|
34
|
+
{...field}
|
|
35
|
+
className={`${className}`}
|
|
36
|
+
disabled={disabled || formState.isSubmitting}
|
|
37
|
+
onChange={(e) => {
|
|
38
|
+
field.onChange(e);
|
|
39
|
+
if (onChange) {
|
|
40
|
+
onChange(e);
|
|
41
|
+
}
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
</FormControl>
|
|
45
|
+
{formMessage(FormMessage)}
|
|
46
|
+
</FormItem>
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
};
|