forlogic-core 1.20.0 → 2.0.0
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/.note/memory/patterns/alias-url-resolution.md +5 -2
- package/.note/memory/patterns/single-scroll-pattern.md +30 -12
- package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanCostTab.d.ts +10 -0
- package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +18 -0
- package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +13 -0
- package/dist/action-plans/components/ActionPlanPage.d.ts +25 -0
- package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +10 -0
- package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +13 -0
- package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
- package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +11 -0
- package/dist/action-plans/constants.d.ts +42 -0
- package/dist/action-plans/hooks/useActionPlan.d.ts +14 -0
- package/dist/action-plans/hooks/useActionPlanProgress.d.ts +15 -0
- package/dist/action-plans/index.d.ts +15 -0
- package/dist/action-plans/types.d.ts +353 -0
- package/dist/action-plans/utils/formatTime.d.ts +15 -0
- package/dist/approval-flow/components/ApprovalSidenav.d.ts +16 -0
- package/dist/approval-flow/components/ApproveDialog.d.ts +13 -0
- package/dist/approval-flow/components/SelectApproverDialog.d.ts +11 -0
- package/dist/approval-flow/index.d.ts +4 -0
- package/dist/approval-flow/types.d.ts +76 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/audit-trail/components/AuditTrailDetails.d.ts +17 -0
- package/dist/audit-trail/components/AuditTrailFilter.d.ts +19 -0
- package/dist/audit-trail/components/AuditTrailPage.d.ts +30 -0
- package/dist/audit-trail/index.d.ts +9 -0
- package/dist/audit-trail/types.d.ts +151 -0
- package/dist/audit-trail/utils.d.ts +38 -0
- package/dist/components/dashboards/dashboard-form.d.ts +50 -0
- package/dist/components/dashboards/dashboard-general-view.d.ts +109 -0
- package/dist/components/dashboards/dashboard-grid.d.ts +41 -0
- package/dist/components/dashboards/dashboard-list.d.ts +31 -0
- package/dist/components/dashboards/dashboard-panel-renderer.d.ts +21 -0
- package/dist/components/dashboards/dashboard-view.d.ts +38 -0
- package/dist/components/dashboards/helpers.d.ts +47 -0
- package/dist/components/dashboards/index.d.ts +9 -0
- package/dist/components/dashboards/panels/burndown-panel.d.ts +26 -0
- package/dist/components/dashboards/panels/cartesian-panel.d.ts +46 -0
- package/dist/components/dashboards/panels/index.d.ts +14 -0
- package/dist/components/dashboards/panels/list-panel.d.ts +30 -0
- package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +49 -0
- package/dist/components/dashboards/panels/numeric-panel.d.ts +22 -0
- package/dist/components/dashboards/panels/panel-error.d.ts +8 -0
- package/dist/components/dashboards/panels/panel-header.d.ts +17 -0
- package/dist/components/dashboards/panels/panel-loader.d.ts +7 -0
- package/dist/components/dashboards/panels/panel-no-data.d.ts +6 -0
- package/dist/components/dashboards/panels/panel-unavailable.d.ts +6 -0
- package/dist/components/dashboards/panels/pareto-panel.d.ts +20 -0
- package/dist/components/dashboards/panels/performance-panel.d.ts +24 -0
- package/dist/components/dashboards/panels/pie-panel.d.ts +19 -0
- package/dist/components/dashboards/panels/text-panel.d.ts +18 -0
- package/dist/components/dashboards/types.d.ts +525 -0
- package/dist/components/ui/electronic-signature-dialog.d.ts +21 -0
- package/dist/components/ui/export-dialog.d.ts +28 -0
- package/dist/components/ui/iframe-dialog.d.ts +14 -0
- package/dist/components/ui/multiselect-permissions.d.ts +59 -0
- package/dist/components/ui/online-editor-dialog.d.ts +18 -0
- package/dist/components/ui/report-request-list.d.ts +44 -0
- package/dist/components/ui/stimulsoft-viewer.d.ts +20 -0
- package/dist/components/ui/terms-of-use-dialog.d.ts +56 -0
- package/dist/components/ui/timepicker.d.ts +11 -0
- package/dist/components/ui/users-groups-selector.d.ts +44 -0
- package/dist/components/ui/viewer-dialog.d.ts +77 -0
- package/dist/custom-form-fields/components/CustomFormFields.d.ts +8 -0
- package/dist/custom-form-fields/fields/FormDateField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormNumericField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormTextField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormTimeField.d.ts +6 -0
- package/dist/custom-form-fields/fields/FormUrlField.d.ts +6 -0
- package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +6 -0
- package/dist/custom-form-fields/index.d.ts +13 -0
- package/dist/custom-form-fields/types.d.ts +143 -0
- package/dist/exports/action-plans.d.ts +16 -0
- package/dist/exports/audit-trail.d.ts +1 -0
- package/dist/exports/custom-form-fields.d.ts +1 -0
- package/dist/exports/file-upload.d.ts +1 -0
- package/dist/exports/ui.d.ts +12 -0
- package/dist/file-upload/components/SingleFileUpload.d.ts +43 -0
- package/dist/file-upload/index.d.ts +6 -0
- package/dist/file-upload/types.d.ts +11 -0
- package/dist/file-upload/utils/formatBytes.d.ts +1 -0
- package/dist/file-upload/utils/getFileExtension.d.ts +1 -0
- package/dist/hooks/useSidebarResize.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/team-selector/components/TeamSelector.d.ts +24 -0
- package/dist/team-selector/index.d.ts +2 -0
- package/dist/team-selector/types.d.ts +10 -0
- package/docs/ICON_MIGRATION_GUIDE.md +177 -0
- package/package.json +1 -1
- package/dist/assets/AccordionDoc-BVPUJk8G.js +0 -31
- package/dist/assets/ActionButtonDoc-DLJ_K9ib.js +0 -47
- package/dist/assets/AlertDoc-CY1ybZeG.js +0 -37
- package/dist/assets/AppHeaderDoc-Crkw4dA9.js +0 -67
- package/dist/assets/AppSidebarDoc-ET-4j6wV.js +0 -204
- package/dist/assets/AuthDoc-B4v4Nci5.js +0 -192
- package/dist/assets/AvatarDoc-BLdMoyJd.js +0 -11
- package/dist/assets/BadgeDoc-CSNM1b6b.js +0 -36
- package/dist/assets/BaseFormDoc-DXiYuN6-.js +0 -169
- package/dist/assets/BodyContentDoc-Bp6YmUWX.js +0 -83
- package/dist/assets/BreadcrumbDoc-D7tqqTvo.js +0 -75
- package/dist/assets/ButtonDoc-C4JwIvU3.js +0 -41
- package/dist/assets/ButtonGroupDoc-QFfjC7Pm.js +0 -7
- package/dist/assets/CalendarDoc-COlEKqmv.js +0 -81
- package/dist/assets/CardDoc-BVhMoC2w.js +0 -49
- package/dist/assets/ChartDoc-BJ14EjI2.js +0 -111
- package/dist/assets/CheckboxDoc-Bcqpln9_.js +0 -55
- package/dist/assets/ColorPickerDoc-CcfmSwyC.js +0 -10
- package/dist/assets/ColorsFoundationDoc-uO6IiJbS.js +0 -13
- package/dist/assets/ComboTreeDoc-R4qE6XwB.js +0 -46
- package/dist/assets/ComboboxDoc-JIo_-gSN.js +0 -134
- package/dist/assets/ComponentDocTemplate-CRbRY-v5.js +0 -1
- package/dist/assets/ContextMenuDoc-C4-_0NLp.js +0 -182
- package/dist/assets/ContextsDoc-Cj9Aaoyo.js +0 -184
- package/dist/assets/CreateCrudPageDoc-D_SnMRJ2.js +0 -106
- package/dist/assets/CrudActionBarDoc-BYqtIabp.js +0 -112
- package/dist/assets/CrudGridDoc-DspxQrq5.js +0 -85
- package/dist/assets/CrudOverviewDoc-DLcOL_HZ.js +0 -14
- package/dist/assets/CrudPrimitivesDoc-BRS86nWg.js +0 -164
- package/dist/assets/CrudTableDoc-Daw8u2G_.js +0 -113
- package/dist/assets/DataListDoc-BrgVNhhR.js +0 -13
- package/dist/assets/DesignSystemHome-BFBNqq1J.js +0 -1
- package/dist/assets/DialogDoc-DCpRy4rg.js +0 -981
- package/dist/assets/DropdownMenuDoc-DT6LBa8Z.js +0 -175
- package/dist/assets/EmptyStateDoc-wydc09gG.js +0 -35
- package/dist/assets/EnvironmentsDoc-amIriwDD.js +0 -96
- package/dist/assets/ErrorBoundaryDoc-BEixy_Gl.js +0 -111
- package/dist/assets/FormDoc-DxoRt6p7.js +0 -81
- package/dist/assets/FoundationOverview-CxSbumIt.js +0 -1
- package/dist/assets/GridDoc-BpQqCMUE.js +0 -28
- package/dist/assets/HooksDoc-JNODhbaF.js +0 -665
- package/dist/assets/HoverCardDoc-CdqiYrIb.js +0 -31
- package/dist/assets/I18nDoc-B6LMXnE3.js +0 -232
- package/dist/assets/IconPickerDoc-BRdy58IC.js +0 -10
- package/dist/assets/IconsFoundationDoc-CrymfxTI.js +0 -33
- package/dist/assets/InputDoc-BK-SdpJ7.js +0 -211
- package/dist/assets/LabelDoc-DHvgzhaJ.js +0 -42
- package/dist/assets/LeadershipDoc-DRiB0spL.js +0 -416
- package/dist/assets/MediaDoc-B_vqnf72.js +0 -459
- package/dist/assets/MenubarDoc-Zvgczxe2.js +0 -165
- package/dist/assets/ModuleAccessDoc-Nuxb4S27.js +0 -153
- package/dist/assets/ModulesDialogDoc-iJWLkOZo.js +0 -46
- package/dist/assets/NavigationMenuDoc-CeWun1VF.js +0 -116
- package/dist/assets/OnboardingDialogDoc-xBL-rXeZ.js +0 -55
- package/dist/assets/PaginationDoc-CfvwxCMe.js +0 -98
- package/dist/assets/PaginationDoc-DqtRgXnF.js +0 -27
- package/dist/assets/PlacesDoc-nckioEzg.js +0 -226
- package/dist/assets/PopoverDoc-C3o2CZCT.js +0 -64
- package/dist/assets/ProgressDoc-BmWBNMPA.js +0 -29
- package/dist/assets/QualiexUserFieldDoc-CE1e4mx6.js +0 -149
- package/dist/assets/RadioGroupDoc-DMZH6NmR.js +0 -57
- package/dist/assets/RadiusDoc-BOZD3gPV.js +0 -7
- package/dist/assets/RequiredFieldsCounterDoc-CG-lmSSy.js +0 -58
- package/dist/assets/ResizableDoc-CqGkv6Cd.js +0 -104
- package/dist/assets/RichTextEditorDoc-m50ll-Od.js +0 -24
- package/dist/assets/ScrollAreaDoc-BzJ-APXo.js +0 -28
- package/dist/assets/SecurityDoc-B34gVeiV.js +0 -204
- package/dist/assets/SelectDoc-DXRv7QHK.js +0 -80
- package/dist/assets/SeparatorDoc-DcNh8k0P.js +0 -4
- package/dist/assets/ServicesDoc-8aXBd6yg.js +0 -308
- package/dist/assets/ShadowsDoc-Brl4hIDI.js +0 -9
- package/dist/assets/SignDoc-BdwerR-2.js +0 -66
- package/dist/assets/SkeletonDoc-BWgqgbDY.js +0 -54
- package/dist/assets/SliderDoc-E-NjbYVk.js +0 -41
- package/dist/assets/SpacingDoc-BzburM-r.js +0 -12
- package/dist/assets/SplitButtonDoc-BYUysmJp.js +0 -53
- package/dist/assets/StepSelectorDoc-PB1k4v7F.js +0 -41
- package/dist/assets/SwitchDoc-BLOG6kfj.js +0 -56
- package/dist/assets/TableDoc-Dwcs-lop.js +0 -128
- package/dist/assets/TabsDoc-Ovkh8ArV.js +0 -42
- package/dist/assets/TextareaDoc-DsBYxmbr.js +0 -46
- package/dist/assets/ToastDoc-BbZaFE_A.js +0 -157
- package/dist/assets/ToggleDoc-C28vbvhp.js +0 -51
- package/dist/assets/TooltipDoc-DL5cnLak.js +0 -58
- package/dist/assets/TruncatedCellDoc-BuDA8QcY.js +0 -12
- package/dist/assets/TypographyFoundationDoc-CPdH4PHa.js +0 -7
- package/dist/assets/UtilitiesDoc-CrQhyEfz.js +0 -145
- package/dist/assets/blocks-DO93nPjs.js +0 -1
- package/dist/assets/calendar-days-cMfwBSZx.js +0 -1
- package/dist/assets/circle-plus-D3NftMzS.js +0 -1
- package/dist/assets/circle-x-BVAVJ_oz.js +0 -1
- package/dist/assets/crown-B2MTZDnM.js +0 -1
- package/dist/assets/date-picker-zhJU-_kM.js +0 -1
- package/dist/assets/disabled-menu-item-C16xsaVs.js +0 -1
- package/dist/assets/drawer-oTqCOtsC.js +0 -3
- package/dist/assets/file-pen-line-CXv-Eye-.js +0 -1
- package/dist/assets/git-branch-V6-h6P9K.js +0 -1
- package/dist/assets/globe-CaUBIJU8.js +0 -1
- package/dist/assets/hash-B4MTXppl.js +0 -1
- package/dist/assets/hover-card-DEuucfxP.js +0 -1
- package/dist/assets/index-CE0k7Rdh.js +0 -312
- package/dist/assets/index-Cx3adT_u.css +0 -1
- package/dist/assets/life-buoy-BRndExxh.js +0 -1
- package/dist/assets/lucide-react-t7dCa4lv.js +0 -1
- package/dist/assets/monitor-Dg3HKTSE.js +0 -1
- package/dist/assets/package-3G45ARQh.js +0 -1
- package/dist/assets/pen-BYSSwjK4.js +0 -1
- package/dist/assets/pin-CMYagNhs.js +0 -1
- package/dist/assets/radio-group-BVun_Tmt.js +0 -1
- package/dist/assets/server-p0Sb0mKI.js +0 -1
- package/dist/assets/share-2-D-ZhCCq2.js +0 -1
- package/dist/assets/shield-x-Q7hAXWsG.js +0 -1
- package/dist/assets/step-selector-DHxgT2FL.js +0 -1
- package/dist/assets/text-align-start-6aYQqbX4.js +0 -1
- package/dist/assets/trash-DveAOiLF.js +0 -1
- package/dist/assets/useMockCrud-GY0KxHXr.js +0 -1
- package/dist/assets/user-check-CoGNBfIk.js +0 -1
- package/dist/assets/user-plus-Bad2xWIT.js +0 -1
- package/dist/index.html +0 -35
- package/dist/leadership/components/LeaderRow.d.ts +0 -9
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{j as e,C as s,a,bA as m,B as n,b as r,c as i,d,b9 as t,c7 as x,y as l,bo as u,G as p}from"./index-CE0k7Rdh.js";import{B as h}from"./blocks-DO93nPjs.js";function b({onNavigate:o}){const c=j=>{o&&o(j)};return e.jsxs("div",{className:"space-y-12",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Sistema CRUD"}),e.jsx("p",{className:"text-lg text-muted-foreground mt-2",children:"Componentes padronizados para operações Create, Read, Update e Delete com arquitetura em 3 níveis de abstração."})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Arquitetura em 3 Níveis"}),e.jsxs("p",{className:"text-muted-foreground",children:["O sistema CRUD da ",e.jsx("code",{children:"forlogic-core"})," é organizado em 3 níveis de abstração, permitindo desde implementações rápidas até personalizações completas."]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[e.jsxs(s,{className:"border-primary/50 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>c("crud-create-page"),children:[e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(m,{className:"h-5 w-5 text-primary"})}),e.jsx(n,{variant:"default",children:"Alto Nível"})]}),e.jsx(r,{className:"mt-4",children:"createCrudPage"}),e.jsx(i,{children:"Página CRUD completa gerada automaticamente"})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"Inclui automaticamente:"}),e.jsxs("ul",{className:"space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-green-500"}),"Tabela com ordenação"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-green-500"}),"Formulário em dialog"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-green-500"}),"Filtros e busca"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-green-500"}),"Paginação"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-green-500"}),"Ações em massa"]})]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Esforço:"})," ~10 linhas de configuração"]})})]})]}),e.jsxs(s,{className:"border-blue-500/50 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>c("crud-table"),children:[e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:e.jsx(x,{className:"h-5 w-5 text-blue-500"})}),e.jsx(n,{variant:"secondary",className:"bg-blue-500/10 text-blue-500",children:"Médio Nível"})]}),e.jsx(r,{className:"mt-4",children:"Componentes CRUD"}),e.jsx(i,{children:"Componentes individuais para composição"})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"Componentes disponíveis:"}),e.jsxs("ul",{className:"space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudTable"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudGrid"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"BaseForm"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudPagination"]})]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Esforço:"})," ~50-100 linhas de código"]})})]})]}),e.jsxs(s,{className:"border-orange-500/50 cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>c("crud-primitives"),children:[e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-orange-500/10",children:e.jsx(h,{className:"h-5 w-5 text-orange-500"})}),e.jsx(n,{variant:"outline",className:"border-orange-500/50 text-orange-500",children:"Baixo Nível"})]}),e.jsx(r,{className:"mt-4",children:"Primitives"}),e.jsx(i,{children:"Blocos básicos para UIs totalmente customizadas"})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"Primitives disponíveis:"}),e.jsxs("ul",{className:"space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"Table + ActionButton"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudPrimitivePagination"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudPrimitiveFilterBar"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"CrudPrimitiveFilterPopover"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-3.5 w-3.5"}),"TableResizeHandle + useColumnResize"]})]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Esforço:"})," 200+ linhas de código"]})})]})]})]})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Quando Usar Qual Componente?"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[e.jsx("th",{className:"text-left p-4 font-medium",children:"Cenário"}),e.jsx("th",{className:"text-left p-4 font-medium",children:"Componente"}),e.jsx("th",{className:"text-left p-4 font-medium",children:"Esforço"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-4",children:"CRUD padrão (lista + formulário + filtros)"}),e.jsx("td",{className:"p-4",children:e.jsx("code",{className:"text-sm bg-primary/10 text-primary px-2 py-1 rounded",children:"createCrudPage"})}),e.jsx("td",{className:"p-4 text-muted-foreground",children:"~10 linhas"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-4",children:"Tabela com layout customizado"}),e.jsx("td",{className:"p-4",children:e.jsx("code",{className:"text-sm bg-blue-500/10 text-blue-500 px-2 py-1 rounded",children:"CrudTable + useCrud"})}),e.jsx("td",{className:"p-4 text-muted-foreground",children:"~50 linhas"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-4",children:"Visualização em grid/cards"}),e.jsx("td",{className:"p-4",children:e.jsx("code",{className:"text-sm bg-blue-500/10 text-blue-500 px-2 py-1 rounded",children:"CrudGrid"})}),e.jsx("td",{className:"p-4 text-muted-foreground",children:"~50 linhas"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-4",children:"Formulário multi-step"}),e.jsx("td",{className:"p-4",children:e.jsx("code",{className:"text-sm bg-blue-500/10 text-blue-500 px-2 py-1 rounded",children:"WizardForm"})}),e.jsx("td",{className:"p-4 text-muted-foreground",children:"~30 linhas"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-4",children:"UI totalmente customizada"}),e.jsx("td",{className:"p-4",children:e.jsx("code",{className:"text-sm bg-orange-500/10 text-orange-500 px-2 py-1 rounded",children:"Primitives"})}),e.jsx("td",{className:"p-4 text-muted-foreground",children:"200+ linhas"})]})]})]})})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Boas Práticas"}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(s,{className:"border-green-500/20 bg-green-500/5",children:[e.jsx(a,{children:e.jsxs(r,{className:"text-green-600 flex items-center gap-2",children:[e.jsx(t,{className:"h-5 w-5"}),"Faça"]})}),e.jsx(d,{children:e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsxs("li",{children:["✅ Use ",e.jsx("code",{children:"createCrudPage"})," para CRUDs padrão"]}),e.jsxs("li",{children:["✅ Use ",e.jsx("code",{children:"CrudTable"})," para customizações de layout"]}),e.jsxs("li",{children:["✅ Use ",e.jsx("code",{children:"CrudGrid"})," para visualização em cards"]}),e.jsxs("li",{children:["✅ Use ",e.jsx("code",{children:"BaseForm"})," para formulários com validação Zod"]}),e.jsxs("li",{children:["✅ Use ",e.jsx("code",{children:"useCrud"})," para gerenciamento de estado"]}),e.jsx("li",{children:"✅ Reutilize os hooks existentes"})]})})]}),e.jsxs(s,{className:"border-red-500/20 bg-red-500/5",children:[e.jsx(a,{children:e.jsxs(r,{className:"text-red-600 flex items-center gap-2",children:[e.jsx("span",{className:"h-5 w-5 flex items-center justify-center",children:"✕"}),"Evite"]})}),e.jsx(d,{children:e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsxs("li",{children:["❌ Recriar tabelas do zero com ",e.jsx("code",{children:"<Table>"})," base"]}),e.jsx("li",{children:"❌ Implementar paginação manual"}),e.jsxs("li",{children:["❌ Criar formulários sem ",e.jsx("code",{children:"BaseForm"})]}),e.jsx("li",{children:"❌ Duplicar lógica CRUD em cada página"}),e.jsx("li",{children:"❌ Usar Primitives quando componentes de alto nível servem"})]})})]})]})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Integração com useCrud"}),e.jsxs("p",{className:"text-muted-foreground",children:["O hook ",e.jsx("code",{children:"useCrud"})," gerencia todo o estado do CRUD: busca, ordenação, paginação, seleção e operações de create/update/delete. Ele é usado internamente pelo ",e.jsx("code",{children:"createCrudPage"}),"e pode ser usado diretamente com os componentes de nível médio."]}),e.jsxs(s,{children:[e.jsx(a,{children:e.jsx(r,{children:"Exemplo de uso com createSimpleService"})}),e.jsx(d,{children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:`// 1. Criar o serviço
|
|
2
|
-
const notesService = createSimpleService<Note>({
|
|
3
|
-
tableName: 'notes',
|
|
4
|
-
entityName: 'nota',
|
|
5
|
-
searchFields: ['title', 'content'],
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// 2. Usar o hook em um componente
|
|
9
|
-
function NotesPage() {
|
|
10
|
-
const manager = notesService.useCrudHook();
|
|
11
|
-
|
|
12
|
-
// 3. Usar createCrudPage ou componentes individuais
|
|
13
|
-
return <CrudTable manager={manager} columns={columns} />;
|
|
14
|
-
}`})})]})]}),e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Documentação Detalhada"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[e.jsx(s,{className:"hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c("crud-create-page"),children:e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5 text-primary"}),e.jsx(r,{className:"text-base",children:"createCrudPage"})]}),e.jsx(i,{children:"Gerador de página CRUD completa"})]})}),e.jsx(s,{className:"hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c("crud-table"),children:e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-5 w-5 text-blue-500"}),e.jsx(r,{className:"text-base",children:"CrudTable"})]}),e.jsx(i,{children:"Tabela CRUD com ordenação, seleção e ações"})]})}),e.jsx(s,{className:"hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c("crud-grid"),children:e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"h-5 w-5 text-blue-500"}),e.jsx(r,{className:"text-base",children:"CrudGrid"})]}),e.jsx(i,{children:"Visualização em cards com lista/grid toggle"})]})}),e.jsx(s,{className:"hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c("crud-primitives"),children:e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"h-5 w-5 text-orange-500"}),e.jsx(r,{className:"text-base",children:"Primitives"})]}),e.jsx(i,{children:"Blocos de baixo nível para UIs customizadas"})]})}),e.jsx(s,{className:"hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>c("crud-baseform"),children:e.jsxs(a,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5 text-blue-500"}),e.jsx(r,{className:"text-base",children:"BaseForm"})]}),e.jsx(i,{children:"Formulário com validação Zod e tipos de campo"})]})})]})]})]})}export{b as CrudOverviewDoc};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import{cR as _,j as e,c0 as $,I as Y,f as c,ci as Q,eE as Z,r as l,C as t,a as r,b as d,d as i,cl as M,cm as A,cn as o,t as T,bc as R,co as m,ar as ee,at as se,au as L,av as O,ay as ae,aw as le,ax as P,B as K,n as te,o as re,A as de,p as ie,q as D,s as ce,J as ne,T as oe,d4 as j,d5 as p,d6 as N,d7 as g,d8 as a,cs as me,ct as xe,bn as he,cu as ue,aq as je}from"./index-CE0k7Rdh.js";import{C as pe}from"./ComponentDocTemplate-CRbRY-v5.js";function X({searchValue:b="",onSearchChange:x,customFilters:v=[],onClearFilters:f,showClearButton:z=!0,layout:h="horizontal"}){const{t:u}=_(),C=b||v.length>0;return e.jsxs("div",{className:`flex ${h==="vertical"?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[x&&e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx($,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Y,{type:"text",placeholder:u("search","Pesquisar"),value:b,onChange:n=>x(n.target.value),className:"pl-9 h-9"})]}),v.map((n,w)=>e.jsx("div",{className:h==="vertical"?"w-full":"",children:n},w)),z&&C&&f&&e.jsxs(c,{variant:"ghost",size:"sm",onClick:f,className:"h-9 px-3 whitespace-nowrap",children:[e.jsx(Q,{size:14,className:"mr-1"}),u("clear_filters","Limpar filtros")]})]})}function be(){const b=[{id:"1",name:"Item Alpha",category:"Categoria A",status:"active"},{id:"2",name:"Item Beta",category:"Categoria B",status:"active"},{id:"3",name:"Item Gamma",category:"Categoria A",status:"inactive"},{id:"4",name:"Item Delta",category:"Categoria C",status:"active"},{id:"5",name:"Item Epsilon",category:"Categoria B",status:"inactive"}],x=[{key:"name",header:"Nome",minWidth:150},{key:"category",header:"Categoria",minWidth:120},{key:"status",header:"Status",minWidth:100}],{columnWidths:v,isDragging:f,handleMouseDown:z}=Z({columns:x.map(s=>({key:s.key,minWidth:s.minWidth,defaultWidth:s.minWidth})),storageKey:"crud-primitives-table"}),[h,u]=l.useState(""),[C,n]=l.useState("all"),[w,V]=l.useState("all"),[W,H]=l.useState(""),[B,E]=l.useState("all"),[F,q]=l.useState("all"),[I,U]=l.useState("all"),S=(s,k)=>v[s]||k,G=()=>{u(""),n("all"),V("all")},J=()=>{H(""),E("all"),q("all"),U("all")},y=[B,F,I].filter(s=>s!=="all").length+(W?1:0);return e.jsxs(pe,{title:"CRUD Primitives",description:"Componentes de baixo nível para interfaces CRUD totalmente customizadas com controle total sobre layout e comportamento.",tocItems:[{id:"table-actionbutton",label:"Table + ActionButton"},{id:"filterbar",label:"CrudPrimitiveFilterBar"},{id:"filterpopover",label:"CrudPrimitiveFilterPopover"},{id:"props",label:"Props"},{id:"acessibilidade",label:"Acessibilidade"},{id:"quando-usar",label:"Quando Usar"}],children:[e.jsxs(t,{id:"table-actionbutton",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"Table + ActionButton"})}),e.jsx(i,{children:e.jsxs(M,{defaultValue:"preview",className:"w-full",children:[e.jsxs(A,{className:"mb-4",children:[e.jsxs(o,{value:"preview",className:"gap-2",children:[e.jsx(T,{size:16}),"Preview"]}),e.jsxs(o,{value:"code",className:"gap-2",children:[e.jsx(R,{size:16}),"Código"]})]}),e.jsx(m,{value:"preview",className:"mt-0",children:e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs(L,{children:[x.map(s=>e.jsxs(O,{className:"relative",style:{width:S(s.key,s.minWidth),minWidth:s.minWidth},children:[s.header,e.jsx(ae,{direction:"horizontal",onMouseDown:k=>z(s.key,k),isDragging:f})]},s.key)),e.jsx(O,{className:"w-16",children:"Ações"})]})}),e.jsx(le,{children:b.map(s=>e.jsxs(L,{children:[e.jsx(P,{style:{width:S("name",150)},children:s.name}),e.jsx(P,{style:{width:S("category",120)},children:s.category}),e.jsx(P,{style:{width:S("status",100)},children:e.jsx(K,{variant:s.status==="active"?"default":"secondary",children:s.status==="active"?"Ativo":"Inativo"})}),e.jsx(P,{children:e.jsxs(te,{children:[e.jsx(re,{asChild:!0,children:e.jsx(de,{})}),e.jsxs(ie,{align:"end",children:[e.jsxs(D,{children:[e.jsx(T,{className:"h-4 w-4 mr-2"}),"Visualizar"]}),e.jsxs(D,{children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"Editar"]}),e.jsxs(D,{children:[e.jsx(ne,{className:"h-4 w-4 mr-2"}),"Duplicar"]}),e.jsxs(D,{className:"text-destructive",children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Excluir"]})]})]})})]},s.id))})]})})}),e.jsx(m,{value:"code",className:"mt-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg text-sm overflow-x-auto",children:`import {
|
|
2
|
-
Table, TableHeader, TableBody, TableRow, TableHead, TableCell,
|
|
3
|
-
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem,
|
|
4
|
-
ActionButton, Badge, TableResizeHandle, useColumnResize
|
|
5
|
-
} from 'forlogic-core';
|
|
6
|
-
|
|
7
|
-
function MyTable({ data }) {
|
|
8
|
-
const columns = [
|
|
9
|
-
{ key: 'name', minWidth: 150 },
|
|
10
|
-
{ key: 'category', minWidth: 120 },
|
|
11
|
-
{ key: 'status', minWidth: 100 },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
const { columnWidths, isDragging, handleMouseDown } = useColumnResize({
|
|
15
|
-
columns: columns.map(c => ({ key: c.key, minWidth: c.minWidth })),
|
|
16
|
-
storageKey: 'my-table-columns',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Table>
|
|
21
|
-
<TableHeader>
|
|
22
|
-
<TableRow>
|
|
23
|
-
<TableHead className="relative" style={{ width: columnWidths['name'] || 150 }}>
|
|
24
|
-
Nome
|
|
25
|
-
<TableResizeHandle
|
|
26
|
-
direction="horizontal"
|
|
27
|
-
onMouseDown={(e) => handleMouseDown('name', e)}
|
|
28
|
-
isDragging={isDragging}
|
|
29
|
-
/>
|
|
30
|
-
</TableHead>
|
|
31
|
-
{/* ... outras colunas */}
|
|
32
|
-
<TableHead className="w-12"></TableHead>
|
|
33
|
-
</TableRow>
|
|
34
|
-
</TableHeader>
|
|
35
|
-
<TableBody>
|
|
36
|
-
{data.map((item) => (
|
|
37
|
-
<TableRow key={item.id}>
|
|
38
|
-
<TableCell>{item.name}</TableCell>
|
|
39
|
-
{/* ... outras células */}
|
|
40
|
-
<TableCell>
|
|
41
|
-
<DropdownMenu>
|
|
42
|
-
<DropdownMenuTrigger asChild>
|
|
43
|
-
<ActionButton />
|
|
44
|
-
</DropdownMenuTrigger>
|
|
45
|
-
<DropdownMenuContent align="end">
|
|
46
|
-
<DropdownMenuItem>Editar</DropdownMenuItem>
|
|
47
|
-
<DropdownMenuItem className="text-destructive">Excluir</DropdownMenuItem>
|
|
48
|
-
</DropdownMenuContent>
|
|
49
|
-
</DropdownMenu>
|
|
50
|
-
</TableCell>
|
|
51
|
-
</TableRow>
|
|
52
|
-
))}
|
|
53
|
-
</TableBody>
|
|
54
|
-
</Table>
|
|
55
|
-
);
|
|
56
|
-
}`})})]})})]}),e.jsxs(t,{id:"filterbar",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"CrudPrimitiveFilterBar"})}),e.jsxs(i,{children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Barra de filtros reutilizável com campo de busca e slots para filtros customizados."}),e.jsxs(M,{defaultValue:"preview",className:"w-full",children:[e.jsxs(A,{className:"mb-4",children:[e.jsxs(o,{value:"preview",className:"gap-2",children:[e.jsx(T,{size:16}),"Preview"]}),e.jsxs(o,{value:"code",className:"gap-2",children:[e.jsx(R,{size:16}),"Código"]})]}),e.jsxs(m,{value:"preview",className:"mt-0",children:[e.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:e.jsx(X,{searchValue:h,onSearchChange:u,customFilters:[e.jsxs(j,{value:C,onValueChange:n,children:[e.jsx(p,{className:"w-[140px] h-9",children:e.jsx(N,{placeholder:"Status"})}),e.jsxs(g,{children:[e.jsx(a,{value:"all",children:"Todos"}),e.jsx(a,{value:"active",children:"Ativo"}),e.jsx(a,{value:"inactive",children:"Inativo"})]})]},"status"),e.jsxs(j,{value:w,onValueChange:V,children:[e.jsx(p,{className:"w-[160px] h-9",children:e.jsx(N,{placeholder:"Categoria"})}),e.jsxs(g,{children:[e.jsx(a,{value:"all",children:"Todas"}),e.jsx(a,{value:"a",children:"Categoria A"}),e.jsx(a,{value:"b",children:"Categoria B"}),e.jsx(a,{value:"c",children:"Categoria C"})]})]},"category")],onClearFilters:G,showClearButton:!0,layout:"horizontal"})}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:['Busca: "',h,'" | Status: ',C," | Categoria: ",w]})]}),e.jsx(m,{value:"code",className:"mt-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg text-sm overflow-x-auto",children:`import { CrudPrimitiveFilterBar, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from 'forlogic-core';
|
|
57
|
-
|
|
58
|
-
function MyFilters() {
|
|
59
|
-
const [searchValue, setSearchValue] = useState('');
|
|
60
|
-
const [statusFilter, setStatusFilter] = useState('all');
|
|
61
|
-
const [categoryFilter, setCategoryFilter] = useState('all');
|
|
62
|
-
|
|
63
|
-
const handleClearFilters = () => {
|
|
64
|
-
setSearchValue('');
|
|
65
|
-
setStatusFilter('all');
|
|
66
|
-
setCategoryFilter('all');
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<CrudPrimitiveFilterBar
|
|
71
|
-
searchValue={searchValue}
|
|
72
|
-
onSearchChange={setSearchValue}
|
|
73
|
-
customFilters={[
|
|
74
|
-
<Select key="status" value={statusFilter} onValueChange={setStatusFilter}>
|
|
75
|
-
<SelectTrigger className="w-[140px] h-9">
|
|
76
|
-
<SelectValue placeholder="Status" />
|
|
77
|
-
</SelectTrigger>
|
|
78
|
-
<SelectContent>
|
|
79
|
-
<SelectItem value="all">Todos</SelectItem>
|
|
80
|
-
<SelectItem value="active">Ativo</SelectItem>
|
|
81
|
-
<SelectItem value="inactive">Inativo</SelectItem>
|
|
82
|
-
</SelectContent>
|
|
83
|
-
</Select>,
|
|
84
|
-
<Select key="category" value={categoryFilter} onValueChange={setCategoryFilter}>
|
|
85
|
-
<SelectTrigger className="w-[160px] h-9">
|
|
86
|
-
<SelectValue placeholder="Categoria" />
|
|
87
|
-
</SelectTrigger>
|
|
88
|
-
<SelectContent>
|
|
89
|
-
<SelectItem value="all">Todas</SelectItem>
|
|
90
|
-
<SelectItem value="a">Categoria A</SelectItem>
|
|
91
|
-
<SelectItem value="b">Categoria B</SelectItem>
|
|
92
|
-
</SelectContent>
|
|
93
|
-
</Select>
|
|
94
|
-
]}
|
|
95
|
-
onClearFilters={handleClearFilters}
|
|
96
|
-
showClearButton={true}
|
|
97
|
-
layout="horizontal"
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
}`})})]})]})]}),e.jsxs(t,{id:"filterpopover",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"CrudPrimitiveFilterPopover"})}),e.jsxs(i,{children:[e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Para interfaces com muitos filtros, agrupe-os em um Popover para manter a toolbar limpa. Este padrão é usado no ",e.jsx("code",{children:"CrudTable"})," quando há múltiplos filtros configurados."]}),e.jsxs(M,{defaultValue:"preview",className:"w-full",children:[e.jsxs(A,{className:"mb-4",children:[e.jsxs(o,{value:"preview",className:"gap-2",children:[e.jsx(T,{size:16}),"Preview"]}),e.jsxs(o,{value:"code",className:"gap-2",children:[e.jsx(R,{size:16}),"Código"]})]}),e.jsxs(m,{value:"preview",className:"mt-0",children:[e.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{searchValue:W,onSearchChange:H,showClearButton:!1}),e.jsxs(me,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs(c,{variant:"outline",size:"sm",className:"h-9 gap-2",children:[e.jsx(he,{size:16}),"Filtrar",y>0&&e.jsx(K,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:y})]})}),e.jsx(ue,{className:"w-80",align:"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"Filtros"}),y>0&&e.jsxs(c,{variant:"ghost",size:"sm",onClick:J,className:"h-7 text-xs",children:[e.jsx(Q,{size:12,className:"mr-1"}),"Limpar"]})]}),e.jsx(je,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Status"}),e.jsxs(j,{value:B,onValueChange:E,children:[e.jsx(p,{className:"h-9",children:e.jsx(N,{placeholder:"Todos"})}),e.jsxs(g,{children:[e.jsx(a,{value:"all",children:"Todos"}),e.jsx(a,{value:"active",children:"Ativo"}),e.jsx(a,{value:"inactive",children:"Inativo"}),e.jsx(a,{value:"pending",children:"Pendente"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Categoria"}),e.jsxs(j,{value:F,onValueChange:q,children:[e.jsx(p,{className:"h-9",children:e.jsx(N,{placeholder:"Todas"})}),e.jsxs(g,{children:[e.jsx(a,{value:"all",children:"Todas"}),e.jsx(a,{value:"a",children:"Categoria A"}),e.jsx(a,{value:"b",children:"Categoria B"}),e.jsx(a,{value:"c",children:"Categoria C"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Prioridade"}),e.jsxs(j,{value:I,onValueChange:U,children:[e.jsx(p,{className:"h-9",children:e.jsx(N,{placeholder:"Todas"})}),e.jsxs(g,{children:[e.jsx(a,{value:"all",children:"Todas"}),e.jsx(a,{value:"high",children:"Alta"}),e.jsx(a,{value:"medium",children:"Média"}),e.jsx(a,{value:"low",children:"Baixa"})]})]})]})]})]})})]})]})}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Filtros ativos: ",y," | Status: ",B," | Categoria: ",F," | Prioridade: ",I]})]}),e.jsx(m,{value:"code",className:"mt-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg text-sm overflow-x-auto",children:`import {
|
|
101
|
-
Button, Badge, Popover, PopoverContent, PopoverTrigger,
|
|
102
|
-
Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator
|
|
103
|
-
} from 'forlogic-core';
|
|
104
|
-
import { Filter, X } from 'lucide-react';
|
|
105
|
-
|
|
106
|
-
function FiltersInPopover() {
|
|
107
|
-
const [status, setStatus] = useState('all');
|
|
108
|
-
const [category, setCategory] = useState('all');
|
|
109
|
-
const [priority, setPriority] = useState('all');
|
|
110
|
-
|
|
111
|
-
const activeFiltersCount = [status, category, priority]
|
|
112
|
-
.filter(v => v !== 'all').length;
|
|
113
|
-
|
|
114
|
-
const handleClear = () => {
|
|
115
|
-
setStatus('all');
|
|
116
|
-
setCategory('all');
|
|
117
|
-
setPriority('all');
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<Popover>
|
|
122
|
-
<PopoverTrigger asChild>
|
|
123
|
-
<Button variant="outline" size="sm" className="h-9 gap-2">
|
|
124
|
-
<Filter size={16} />
|
|
125
|
-
Filtrar
|
|
126
|
-
{activeFiltersCount > 0 && (
|
|
127
|
-
<Badge variant="secondary" className="ml-1 h-5 px-1.5 text-xs">
|
|
128
|
-
{activeFiltersCount}
|
|
129
|
-
</Badge>
|
|
130
|
-
)}
|
|
131
|
-
</Button>
|
|
132
|
-
</PopoverTrigger>
|
|
133
|
-
<PopoverContent className="w-80" align="end">
|
|
134
|
-
<div className="space-y-4">
|
|
135
|
-
<div className="flex items-center justify-between">
|
|
136
|
-
<h4 className="font-medium">Filtros</h4>
|
|
137
|
-
{activeFiltersCount > 0 && (
|
|
138
|
-
<Button variant="ghost" size="sm" onClick={handleClear}>
|
|
139
|
-
<X size={12} className="mr-1" />
|
|
140
|
-
Limpar
|
|
141
|
-
</Button>
|
|
142
|
-
)}
|
|
143
|
-
</div>
|
|
144
|
-
<Separator />
|
|
145
|
-
|
|
146
|
-
<div className="space-y-3">
|
|
147
|
-
<div className="space-y-1.5">
|
|
148
|
-
<label className="text-sm font-medium">Status</label>
|
|
149
|
-
<Select value={status} onValueChange={setStatus}>
|
|
150
|
-
<SelectTrigger><SelectValue /></SelectTrigger>
|
|
151
|
-
<SelectContent>
|
|
152
|
-
<SelectItem value="all">Todos</SelectItem>
|
|
153
|
-
<SelectItem value="active">Ativo</SelectItem>
|
|
154
|
-
<SelectItem value="inactive">Inativo</SelectItem>
|
|
155
|
-
</SelectContent>
|
|
156
|
-
</Select>
|
|
157
|
-
</div>
|
|
158
|
-
{/* Repita para outros filtros... */}
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
</PopoverContent>
|
|
162
|
-
</Popover>
|
|
163
|
-
);
|
|
164
|
-
}`})})]})]})]}),e.jsxs(t,{id:"props",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"Props"})}),e.jsxs(i,{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"CrudPrimitiveFilterBar"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Default"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"searchValue"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"''"}),e.jsx("td",{className:"p-2",children:"Valor atual do campo de busca"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onSearchChange"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(value: string) => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Callback ao digitar na busca"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"customFilters"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"ReactNode[]"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"[]"}),e.jsx("td",{className:"p-2",children:"Array de componentes de filtro customizados (Select, Combobox, etc.)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onClearFilters"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"() => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:'Callback ao clicar em "Limpar filtros"'})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"showClearButton"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"true"}),e.jsx("td",{className:"p-2",children:"Exibir botão de limpar quando há filtros ativos"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"layout"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'horizontal' | 'vertical'"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'horizontal'"}),e.jsx("td",{className:"p-2",children:"Orientação dos filtros"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"CrudPrimitivePagination"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Default"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"currentPage"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"number"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Página atual (1-indexed)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"totalPages"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"number"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Total de páginas"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"totalItems"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"number"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Total de itens"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"itemsPerPage"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"number"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Itens por página"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onPageChange"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(page: number) => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Callback ao mudar página"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onItemsPerPageChange"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(value: number) => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Callback ao mudar itens por página"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"variant"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'full' | 'compact'"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'full'"}),e.jsx("td",{className:"p-2",children:"Variante de exibição. 'full' inclui seletor de itens por página"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"BulkActionBar"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Default"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"selectedCount"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"number"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Quantidade de itens selecionados"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onClearSelection"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"() => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Callback para limpar seleção"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onBulkDelete"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"() => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:'Callback para exclusão em massa (exibe botão "Excluir")'})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"customActions"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"BulkAction[]"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"[]"}),e.jsx("td",{className:"p-2",children:"Ações customizadas (exportar, enviar email, etc.)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"isLoading"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"false"}),e.jsx("td",{className:"p-2",children:"Desabilita ações durante loading"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"BulkAction (tipo)"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"label"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string"}),e.jsx("td",{className:"p-2",children:"Texto do botão"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"icon"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"ComponentType"}),e.jsx("td",{className:"p-2",children:"Ícone Lucide (opcional)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"variant"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'default' | 'destructive' | 'outline'"}),e.jsx("td",{className:"p-2",children:"Estilo do botão"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"action"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(items: T[]) => void | Promise"}),e.jsx("td",{className:"p-2",children:"Callback executado ao clicar"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"disabled"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Se a ação está desabilitada"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"disabledReason"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string"}),e.jsx("td",{className:"p-2",children:"Tooltip exibido quando disabled=true"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"useColumnResize (Opções)"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Opção"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Default"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"columns"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"ColumnConfig[]"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Configuração das colunas (key, minWidth, maxWidth, defaultWidth)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"storageKey"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string?"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Chave para persistência no localStorage"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onResize"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(widths: Record<string, number>) => void"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"-"}),e.jsx("td",{className:"p-2",children:"Callback executado ao redimensionar"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"enabled"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"true"}),e.jsx("td",{className:"p-2",children:"Habilitar/desabilitar redimensionamento"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"useColumnResize (Retornos)"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Retorno"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"columnWidths"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"Record<string, number>"}),e.jsx("td",{className:"p-2",children:"Larguras atuais das colunas (mapa key → width)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"isDragging"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Se está arrastando no momento"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"activeColumn"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string | null"}),e.jsx("td",{className:"p-2",children:"Key da coluna sendo redimensionada"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"handleMouseDown"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(key: string, e: MouseEvent) => void"}),e.jsx("td",{className:"p-2",children:"Handler para iniciar o resize (passar para TableResizeHandle)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"resetWidths"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"() => void"}),e.jsx("td",{className:"p-2",children:"Restaurar larguras padrão e limpar localStorage"})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"TableResizeHandle"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"direction"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'horizontal' | 'vertical'"}),e.jsx("td",{className:"p-2",children:"Direção do resize (colunas = horizontal, linhas = vertical)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onMouseDown"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(e: MouseEvent) => void"}),e.jsx("td",{className:"p-2",children:"Handler para iniciar o arraste (usar handleMouseDown do useColumnResize)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"isDragging"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean?"}),e.jsx("td",{className:"p-2",children:"Se está em modo de arraste (muda aparência visual)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"className"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string?"}),e.jsx("td",{className:"p-2",children:"Classes CSS adicionais"})]})]})]})})]})]})]}),e.jsxs(t,{id:"acessibilidade",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"Acessibilidade"})}),e.jsx(i,{children:e.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[e.jsx("li",{children:'Tabela com role="table" e estrutura semântica (thead, tbody)'}),e.jsx("li",{children:'Cabeçalhos de coluna com scope="col" para leitores de tela'}),e.jsx("li",{children:"Menu de ações acessível via teclado (Enter/Space para abrir)"}),e.jsx("li",{children:"Navegação por teclado entre itens do menu (Arrow Up/Down)"}),e.jsx("li",{children:"Paginação com botões focáveis e aria-labels descritivos"}),e.jsx("li",{children:"Handles de redimensionamento com cursor visual e feedback"}),e.jsx("li",{children:"Contraste adequado para badges de status (WCAG AA)"}),e.jsx("li",{children:"Campo de busca com placeholder descritivo e ícone de contexto"}),e.jsx("li",{children:"Popover de filtros acessível via teclado (Escape para fechar)"}),e.jsx("li",{children:"Badge de contagem de filtros com contraste adequado"})]})})]}),e.jsxs(t,{id:"quando-usar",className:"scroll-mt-4",children:[e.jsx(r,{children:e.jsx(d,{children:"Quando Usar Primitives?"})}),e.jsxs(i,{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Os primitives são ideais quando você precisa de controle total sobre a UI, mas quer aproveitar os blocos básicos já estilizados e funcionais."}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 border rounded-lg bg-green-500/5 border-green-500/30",children:[e.jsx("h4",{className:"font-medium text-green-700 dark:text-green-400 mb-2",children:"✓ Use Primitives quando:"}),e.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"• Layout completamente customizado"}),e.jsx("li",{children:"• Integração com sistemas externos"}),e.jsx("li",{children:"• UX muito específica do projeto"}),e.jsx("li",{children:"• Múltiplas tabelas na mesma página"}),e.jsx("li",{children:"• Filtros em locais não convencionais"})]})]}),e.jsxs("div",{className:"p-4 border rounded-lg bg-orange-500/5 border-orange-500/30",children:[e.jsx("h4",{className:"font-medium text-orange-700 dark:text-orange-400 mb-2",children:"✗ Use CrudTable/createCrudPage quando:"}),e.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"• CRUD padrão com lista + form"}),e.jsx("li",{children:"• Produtividade é prioridade"}),e.jsx("li",{children:"• Consistência com outras páginas"}),e.jsx("li",{children:"• Menos código para manter"}),e.jsx("li",{children:"• Filtros padrão são suficientes"})]})]})]})]})]}),e.jsxs(t,{children:[e.jsx(r,{children:e.jsx(d,{children:"Ver Também"})}),e.jsxs(i,{children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Componentes relacionados com documentação detalhada:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(c,{variant:"outline",size:"sm",onClick:()=>window.location.href="/ds/crud-pagination",children:"Pagination →"}),e.jsx(c,{variant:"outline",size:"sm",onClick:()=>window.location.href="/ds/crud-bulk-action-bar",children:"BulkActionBar →"}),e.jsx(c,{variant:"outline",size:"sm",onClick:()=>window.location.href="/ds/crud-table",children:"CrudTable →"}),e.jsx(c,{variant:"outline",size:"sm",onClick:()=>window.location.href="/ds/crud-overview",children:"CRUD Overview →"})]})]})]})]})}export{be as CrudPrimitivesDoc};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{j as e,cl as re,cm as te,cn as A,t as ie,bc as ne,co as I,C as y,d as F,a as W,b as $,r as c,ez as de,T as oe,eA as me,d$ as M,e1 as O,e2 as L,e3 as U,L as x,I as E,d4 as j,d5 as p,d6 as g,d7 as v,d8 as t,cU as Ee,e5 as J,f as u,u as n,P as Ae,c0 as Ie,n as je,o as pe,p as ge,q as D,x as ve,ce as fe,cs as Ne,ct as Ce,bn as be,B as K,cu as Se,ci as ye}from"./index-CE0k7Rdh.js";import{D as xe}from"./disabled-menu-item-C16xsaVs.js";import{u as he,c as Fe}from"./useMockCrud-GY0KxHXr.js";import{C as De}from"./ComponentDocTemplate-CRbRY-v5.js";import{P as ce}from"./pen-BYSSwjK4.js";const we=Array.from({length:200},(o,h)=>{const r=h+1,C=`Tipo ${r%3+1}`,m=`Fornecedor ${["A","B","C"][r%3]}`,b=r%4===0?"Inativo":"Ativo";return Fe({id:String(r),item:`Item ${String(r).padStart(3,"0")}`,tipo:C,fornecedor:m,detalhes:`Detalhes do item ${r} (exemplo para demonstrar paginação)`,status:b})}),Te=[{key:"item",header:"Item",sortable:!0,minWidth:120,hideable:!1},{key:"tipo",header:"Tipo",sortable:!0,minWidth:100,groupable:!0},{key:"fornecedor",header:"Fornecedor",sortable:!0,minWidth:120,groupable:!0},{key:"detalhes",header:"Detalhes",minWidth:200},{key:"status",header:"Status",sortable:!0,minWidth:80,groupable:!0,render:o=>e.jsx(K,{variant:o.status==="Ativo"?"default":"secondary",children:o.status})}],H=["SP","RJ","MG","RS","PR","SC","BA","PE"],ke={SP:["São Paulo","Campinas","Santos","Ribeirão Preto"],RJ:["Rio de Janeiro","Niterói","Petrópolis"],MG:["Belo Horizonte","Uberlândia","Juiz de Fora"],RS:["Porto Alegre","Caxias do Sul","Pelotas"],PR:["Curitiba","Londrina","Maringá"],SC:["Florianópolis","Joinville","Blumenau"],BA:["Salvador","Feira de Santana"],PE:["Recife","Olinda"]},q=["Matéria Prima","Serviços","Logística","Equipamentos","Tecnologia"],ze=Array.from({length:150},(o,h)=>{const r=h+1,C=H[r%H.length],m=ke[C],b=m[r%m.length],f=q[r%q.length],z=r%5===0?"Inativo":"Ativo";return Fe({id:String(r),cnpj:`${String(r).padStart(2,"0")}.${String(r*3).padStart(3,"0")}.${String(r*7).padStart(3,"0")}/0001-${String(r%100).padStart(2,"0")}`,razaoSocial:`Empresa ${String(r).padStart(3,"0")} LTDA`,nomeFantasia:`Fornecedor ${String(r).padStart(3,"0")}`,email:`contato@fornecedor${r}.com.br`,telefone:`(${String(11+r%89).padStart(2,"0")}) ${String(9e4+r).slice(0,5)}-${String(1e3+r).slice(0,4)}`,cidade:b,estado:C,categoria:f,status:z})}),Pe=[{key:"cnpj",header:"CNPJ",minWidth:160},{key:"razaoSocial",header:"Razão Social",sortable:!0,minWidth:200},{key:"nomeFantasia",header:"Nome Fantasia",sortable:!0,minWidth:150},{key:"email",header:"Email",minWidth:180},{key:"cidade",header:"Cidade",sortable:!0,minWidth:120},{key:"estado",header:"UF",sortable:!0,minWidth:60},{key:"categoria",header:"Categoria",sortable:!0,minWidth:120},{key:"status",header:"Status",sortable:!0,minWidth:80,render:o=>e.jsx(K,{variant:o.status==="Ativo"?"default":"secondary",children:o.status})}];function Be(){const[o,h]=c.useState(""),[r,C]=c.useState(""),[m,b]=c.useState(""),[f,z]=c.useState(""),G=c.useCallback(a=>{if(o&&a.tipo!==o||r&&a.fornecedor!==r||m&&a.status!==m)return!1;if(f){const ue=f.toLowerCase();return a.item.toLowerCase().includes(ue)||a.detalhes.toLowerCase().includes(ue)}return!0},[o,r,m,f]),i=he(we,{searchFields:["item","tipo","fornecedor","detalhes"],pageSize:10,filterFn:G}),w=[o,r,m].filter(Boolean).length,Q=()=>{h(""),C(""),b("")},[_,N]=c.useState(!1),[T,P]=c.useState(null),[X,S]=c.useState(!1),[k,B]=c.useState(null),[l,d]=c.useState({item:"",tipo:"",fornecedor:"",detalhes:"",status:"Ativo"}),Y=()=>{P(null),d({item:"",tipo:"",fornecedor:"",detalhes:"",status:"Ativo"}),N(!0)},Z=a=>{P(a),d({item:a.item,tipo:a.tipo,fornecedor:a.fornecedor,detalhes:a.detalhes,status:a.status}),N(!0)},ee=async()=>{if(!l.item){n.error("Nome do item é obrigatório");return}T?(await i.updateEntity(T.id,l),n.success("Item atualizado!")):(await i.createEntity(l),n.success("Item criado!")),N(!1)},se=async a=>{await i.updateEntity(a.id,{status:a.status==="Ativo"?"Inativo":"Ativo"}),n.success("Status alterado!")},ae=a=>{B(a),S(!0)},le=()=>{k&&(i.deleteEntity(k.id),n.success("Item excluído!")),S(!1),B(null)},V=a=>{if(i.selectedIds.length<2){n.info("Selecione dois ou mais itens");return}a==="edit"?n.info(`Editando ${i.selectedIds.length} itens em massa...`):(i.bulkDelete(i.selectedIds),n.success(`${i.selectedIds.length} itens excluídos!`))},s=e.jsxs(e.Fragment,{children:[e.jsxs(je,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(u,{variant:"outline",className:"shrink-0",children:"Ações"})}),e.jsxs(ge,{children:[e.jsxs(D,{onClick:()=>n.info("Exportando..."),children:[e.jsx(ve,{className:"h-4 w-4 mr-2"}),"Exportar"]}),e.jsxs(D,{onClick:()=>n.info("Importando..."),children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Importar"]})]})]}),e.jsxs(Ne,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:"shrink-0",children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),"Filtrar",w>0&&e.jsx(K,{variant:"secondary",className:"ml-2 h-5 w-5 p-0 flex items-center justify-center",children:w})]})}),e.jsx(Se,{className:"w-80",align:"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"Filtros"}),w>0&&e.jsxs(u,{variant:"ghost",size:"sm",onClick:Q,className:"h-8 px-2 text-muted-foreground",children:[e.jsx(ye,{className:"h-4 w-4 mr-1"}),"Limpar"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Tipo"}),e.jsxs(j,{value:o||"all",onValueChange:a=>h(a==="all"?"":a),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todos"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todos"}),e.jsx(t,{value:"Tipo 1",children:"Tipo 1"}),e.jsx(t,{value:"Tipo 2",children:"Tipo 2"}),e.jsx(t,{value:"Tipo 3",children:"Tipo 3"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Fornecedor"}),e.jsxs(j,{value:r||"all",onValueChange:a=>C(a==="all"?"":a),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todos"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todos"}),e.jsx(t,{value:"Fornecedor A",children:"Fornecedor A"}),e.jsx(t,{value:"Fornecedor B",children:"Fornecedor B"}),e.jsx(t,{value:"Fornecedor C",children:"Fornecedor C"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Status"}),e.jsxs(j,{value:m||"all",onValueChange:a=>b(a==="all"?"":a),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todos"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todos"}),e.jsx(t,{value:"Ativo",children:"Ativo"}),e.jsx(t,{value:"Inativo",children:"Inativo"})]})]})]})]})]})})]})]}),R=[{label:"Editar em massa",icon:ce,action:()=>V("edit")},{label:"Excluir em massa",icon:oe,variant:"destructive",action:()=>V("delete")}];return e.jsxs("div",{className:"border rounded-lg overflow-hidden bg-background",children:[e.jsx(de,{manager:i,columns:Te,onNew:Y,newButtonLabel:"Adicionar item",onEdit:Z,onToggleStatus:se,onDelete:ae,enableBulkActions:!0,bulkActions:R,showSearch:!0,searchValue:f,onSearchChange:z,searchPlaceholder:"Buscar itens...",filters:s,resizeStorageKey:"crud-table-doc",enableColumnManager:!0,columnManagerStorageKey:"ds-crud-table-demo"}),e.jsx("div",{className:"border-t p-2",children:e.jsx(me,{manager:i})}),e.jsx(M,{open:_,onOpenChange:N,children:e.jsxs(O,{children:[e.jsx(L,{children:e.jsx(U,{children:T?"Editar Item":"Novo Item"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"item",children:"Nome"}),e.jsx(E,{id:"item",value:l.item,onChange:a=>d({...l,item:a.target.value}),placeholder:"Nome do item"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"tipo",children:"Tipo"}),e.jsxs(j,{value:l.tipo,onValueChange:a=>d({...l,tipo:a}),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Selecione"})}),e.jsxs(v,{children:[e.jsx(t,{value:"Tipo 1",children:"Tipo 1"}),e.jsx(t,{value:"Tipo 2",children:"Tipo 2"}),e.jsx(t,{value:"Tipo 3",children:"Tipo 3"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"fornecedor",children:"Fornecedor"}),e.jsxs(j,{value:l.fornecedor,onValueChange:a=>d({...l,fornecedor:a}),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Selecione"})}),e.jsxs(v,{children:[e.jsx(t,{value:"Fornecedor A",children:"Fornecedor A"}),e.jsx(t,{value:"Fornecedor B",children:"Fornecedor B"}),e.jsx(t,{value:"Fornecedor C",children:"Fornecedor C"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"status",children:"Status"}),e.jsxs(j,{value:l.status,onValueChange:a=>d({...l,status:a}),children:[e.jsx(p,{children:e.jsx(g,{})}),e.jsxs(v,{children:[e.jsx(t,{value:"Ativo",children:"Ativo"}),e.jsx(t,{value:"Inativo",children:"Inativo"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"detalhes",children:"Detalhes"}),e.jsx(Ee,{id:"detalhes",value:l.detalhes,onChange:a=>d({...l,detalhes:a.target.value}),placeholder:"Detalhes adicionais..."})]})]}),e.jsxs(J,{children:[e.jsx(u,{variant:"outline",onClick:()=>N(!1),children:"Cancelar"}),e.jsx(u,{onClick:ee,children:"Salvar"})]})]})}),e.jsx(M,{open:X,onOpenChange:S,children:e.jsxs(O,{size:"sm",children:[e.jsx(L,{showSeparator:!0,children:e.jsx(U,{className:"text-center",children:"Confirmar exclusão"})}),e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsxs("p",{children:['Você está prestes a excluir o item "',k?.item,'".']}),e.jsx("p",{className:"text-muted-foreground",children:"Esta ação não pode ser desfeita."})]}),e.jsxs(J,{className:"justify-center gap-2",children:[e.jsx(u,{variant:"outline",onClick:()=>S(!1),children:"Cancelar"}),e.jsx(u,{variant:"destructive",onClick:le,children:"Sim, excluir"})]})]})})]})}const Ve=`import { CrudTable, CrudPagination, useCrud } from 'forlogic-core';
|
|
2
|
-
import type { CrudColumn, BaseEntity } from 'forlogic-core';
|
|
3
|
-
|
|
4
|
-
interface Item extends BaseEntity {
|
|
5
|
-
item: string;
|
|
6
|
-
tipo: string;
|
|
7
|
-
fornecedor: string;
|
|
8
|
-
detalhes: string;
|
|
9
|
-
status: 'Ativo' | 'Inativo';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const columns: CrudColumn<Item>[] = [
|
|
13
|
-
{ key: 'item', header: 'Item', sortable: true, minWidth: 120 },
|
|
14
|
-
{ key: 'tipo', header: 'Tipo', sortable: true, minWidth: 100 },
|
|
15
|
-
{ key: 'fornecedor', header: 'Fornecedor', sortable: true },
|
|
16
|
-
{ key: 'detalhes', header: 'Detalhes', minWidth: 200 },
|
|
17
|
-
{
|
|
18
|
-
key: 'status',
|
|
19
|
-
header: 'Status',
|
|
20
|
-
render: (item) => (
|
|
21
|
-
<Badge variant={item.status === 'Ativo' ? 'default' : 'secondary'}>
|
|
22
|
-
{item.status}
|
|
23
|
-
</Badge>
|
|
24
|
-
),
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
function ItemsPage() {
|
|
29
|
-
const manager = useCrud<Item>({
|
|
30
|
-
tableName: 'items',
|
|
31
|
-
searchFields: ['item', 'tipo', 'fornecedor']
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div>
|
|
36
|
-
<CrudTable
|
|
37
|
-
manager={manager}
|
|
38
|
-
columns={columns}
|
|
39
|
-
onNew={() => openForm()}
|
|
40
|
-
onEdit={(item) => openForm(item)}
|
|
41
|
-
onToggleStatus={(item) => toggleStatus(item)}
|
|
42
|
-
onDelete={(item) => deleteItem(item)}
|
|
43
|
-
enableBulkActions
|
|
44
|
-
/>
|
|
45
|
-
<CrudPagination manager={manager} />
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}`;function Re(){const[o,h]=c.useState(""),[r,C]=c.useState(""),[m,b]=c.useState(""),[f,z]=c.useState(""),G=c.useCallback(s=>{if(o&&s.categoria!==o||r&&s.estado!==r||m&&s.status!==m)return!1;if(f){const R=f.toLowerCase();return s.razaoSocial.toLowerCase().includes(R)||s.nomeFantasia.toLowerCase().includes(R)||s.cnpj.includes(f)||s.email.toLowerCase().includes(R)}return!0},[o,r,m,f]),i=he(ze,{searchFields:["razaoSocial","nomeFantasia","cnpj","email","cidade"],pageSize:10,filterFn:G}),w=[o,r,m].filter(Boolean).length,Q=()=>{h(""),C(""),b("")},[_,N]=c.useState(!1),[T,P]=c.useState(null),[X,S]=c.useState(!1),[k,B]=c.useState(null),[l,d]=c.useState({cnpj:"",razaoSocial:"",nomeFantasia:"",email:"",telefone:"",cidade:"",estado:"",categoria:"",status:"Ativo"}),Y=()=>{P(null),d({cnpj:"",razaoSocial:"",nomeFantasia:"",email:"",telefone:"",cidade:"",estado:"",categoria:"",status:"Ativo"}),N(!0)},Z=s=>{P(s),d({cnpj:s.cnpj,razaoSocial:s.razaoSocial,nomeFantasia:s.nomeFantasia,email:s.email,telefone:s.telefone,cidade:s.cidade,estado:s.estado,categoria:s.categoria,status:s.status}),N(!0)},ee=async()=>{if(!l.razaoSocial){n.error("Razão Social é obrigatório");return}T?(await i.updateEntity(T.id,l),n.success("Fornecedor atualizado!")):(await i.createEntity(l),n.success("Fornecedor criado!")),N(!1)},se=async s=>{await i.updateEntity(s.id,{status:s.status==="Ativo"?"Inativo":"Ativo"}),n.success("Status alterado!")},ae=s=>{B(s),S(!0)},le=()=>{k&&(i.deleteEntity(k.id),n.success("Fornecedor excluído!")),S(!1),B(null)},V=s=>{if(i.selectedIds.length<2){n.info("Selecione dois ou mais itens");return}s==="edit"?n.info(`Editando ${i.selectedIds.length} fornecedores em massa...`):(i.bulkDelete(i.selectedIds),n.success(`${i.selectedIds.length} fornecedores excluídos!`))};return e.jsxs("div",{className:"border rounded-lg overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4 border-b",children:[e.jsxs(u,{className:"shrink-0",onClick:Y,children:[e.jsx(Ae,{className:"h-4 w-4 mr-2"}),"Novo Fornecedor"]}),e.jsx("div",{className:"flex-1 max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(E,{placeholder:"Buscar por razão social, CNPJ, email...",value:f,onChange:s=>z(s.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(je,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(u,{variant:"outline",className:"shrink-0",children:"Ações"})}),e.jsxs(ge,{children:[e.jsxs(D,{onClick:()=>n.info("Exportando..."),children:[e.jsx(ve,{className:"h-4 w-4 mr-2"}),"Exportar"]}),e.jsxs(D,{onClick:()=>n.info("Importando..."),children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Importar"]}),i.selectedIds.length<2?e.jsxs(xe,{disabledReason:"Selecione ao menos 2 itens",children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"Edição em massa"]}):e.jsxs(D,{onClick:()=>V("edit"),children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"Edição em massa"]}),i.selectedIds.length<2?e.jsxs(xe,{disabledReason:"Selecione ao menos 2 itens",className:"text-destructive",children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Exclusão em massa"]}):e.jsxs(D,{onClick:()=>V("delete"),className:"text-destructive",children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),"Exclusão em massa"]})]})]}),e.jsxs(Ne,{children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:"shrink-0",children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),"Filtrar",w>0&&e.jsx(K,{variant:"secondary",className:"ml-2 h-5 w-5 p-0 flex items-center justify-center",children:w})]})}),e.jsx(Se,{className:"w-80",align:"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"Filtros"}),w>0&&e.jsxs(u,{variant:"ghost",size:"sm",onClick:Q,className:"h-8 px-2 text-muted-foreground",children:[e.jsx(ye,{className:"h-4 w-4 mr-1"}),"Limpar"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Categoria"}),e.jsxs(j,{value:o||"all",onValueChange:s=>h(s==="all"?"":s),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todas"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todas"}),q.map(s=>e.jsx(t,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Estado"}),e.jsxs(j,{value:r||"all",onValueChange:s=>C(s==="all"?"":s),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todos"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todos"}),H.map(s=>e.jsx(t,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium",children:"Status"}),e.jsxs(j,{value:m||"all",onValueChange:s=>b(s==="all"?"":s),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Todos"})}),e.jsxs(v,{children:[e.jsx(t,{value:"all",children:"Todos"}),e.jsx(t,{value:"Ativo",children:"Ativo"}),e.jsx(t,{value:"Inativo",children:"Inativo"})]})]})]})]})]})})]})]})]}),e.jsx(de,{manager:i,columns:Pe,onEdit:Z,onToggleStatus:se,onDelete:ae,enableBulkActions:!0,hideActionBar:!0,resizeStorageKey:"crud-table-doc-fornecedores"}),e.jsx("div",{className:"border-t p-2",children:e.jsx(me,{manager:i})}),e.jsx(M,{open:_,onOpenChange:N,children:e.jsxs(O,{className:"max-w-2xl",children:[e.jsx(L,{children:e.jsx(U,{children:T?"Editar Fornecedor":"Novo Fornecedor"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Dados da Empresa"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"cnpj",children:"CNPJ"}),e.jsx(E,{id:"cnpj",value:l.cnpj,onChange:s=>d({...l,cnpj:s.target.value}),placeholder:"00.000.000/0001-00"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"razaoSocial",children:"Razão Social *"}),e.jsx(E,{id:"razaoSocial",value:l.razaoSocial,onChange:s=>d({...l,razaoSocial:s.target.value}),placeholder:"Nome da empresa"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"nomeFantasia",children:"Nome Fantasia"}),e.jsx(E,{id:"nomeFantasia",value:l.nomeFantasia,onChange:s=>d({...l,nomeFantasia:s.target.value}),placeholder:"Nome fantasia"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Contato"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"email",children:"Email"}),e.jsx(E,{id:"email",type:"email",value:l.email,onChange:s=>d({...l,email:s.target.value}),placeholder:"contato@empresa.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"telefone",children:"Telefone"}),e.jsx(E,{id:"telefone",value:l.telefone,onChange:s=>d({...l,telefone:s.target.value}),placeholder:"(00) 00000-0000"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Localização e Classificação"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"estado",children:"Estado"}),e.jsxs(j,{value:l.estado,onValueChange:s=>d({...l,estado:s,cidade:""}),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"UF"})}),e.jsx(v,{children:H.map(s=>e.jsx(t,{value:s,children:s},s))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"cidade",children:"Cidade"}),e.jsxs(j,{value:l.cidade,onValueChange:s=>d({...l,cidade:s}),disabled:!l.estado,children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Selecione"})}),e.jsx(v,{children:(ke[l.estado]||[]).map(s=>e.jsx(t,{value:s,children:s},s))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"categoria",children:"Categoria"}),e.jsxs(j,{value:l.categoria,onValueChange:s=>d({...l,categoria:s}),children:[e.jsx(p,{children:e.jsx(g,{placeholder:"Selecione"})}),e.jsx(v,{children:q.map(s=>e.jsx(t,{value:s,children:s},s))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"status",children:"Status"}),e.jsxs(j,{value:l.status,onValueChange:s=>d({...l,status:s}),children:[e.jsx(p,{children:e.jsx(g,{})}),e.jsxs(v,{children:[e.jsx(t,{value:"Ativo",children:"Ativo"}),e.jsx(t,{value:"Inativo",children:"Inativo"})]})]})]})]})]})]}),e.jsxs(J,{children:[e.jsx(u,{variant:"outline",onClick:()=>N(!1),children:"Cancelar"}),e.jsx(u,{onClick:ee,children:"Salvar"})]})]})}),e.jsx(M,{open:X,onOpenChange:S,children:e.jsxs(O,{size:"sm",children:[e.jsx(L,{showSeparator:!0,children:e.jsx(U,{className:"text-center",children:"Confirmar exclusão"})}),e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsxs("p",{children:['Você está prestes a excluir "',k?.nomeFantasia,'".']}),e.jsx("p",{className:"text-muted-foreground",children:"Esta ação não pode ser desfeita."})]}),e.jsxs(J,{className:"justify-center gap-2",children:[e.jsx(u,{variant:"outline",onClick:()=>S(!1),children:"Cancelar"}),e.jsx(u,{variant:"destructive",onClick:le,children:"Sim, excluir"})]})]})})]})}const We=`interface Fornecedor extends BaseEntity {
|
|
49
|
-
cnpj: string;
|
|
50
|
-
razaoSocial: string;
|
|
51
|
-
nomeFantasia: string;
|
|
52
|
-
email: string;
|
|
53
|
-
telefone: string;
|
|
54
|
-
cidade: string;
|
|
55
|
-
estado: string;
|
|
56
|
-
categoria: string;
|
|
57
|
-
status: 'Ativo' | 'Inativo';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const fornecedorColumns: CrudColumn<Fornecedor>[] = [
|
|
61
|
-
{ key: 'cnpj', header: 'CNPJ', minWidth: 160 },
|
|
62
|
-
{ key: 'razaoSocial', header: 'Razão Social', sortable: true, minWidth: 200 },
|
|
63
|
-
{ key: 'nomeFantasia', header: 'Nome Fantasia', sortable: true, minWidth: 150 },
|
|
64
|
-
{ key: 'email', header: 'Email', minWidth: 180 },
|
|
65
|
-
{ key: 'cidade', header: 'Cidade', sortable: true, minWidth: 120 },
|
|
66
|
-
{ key: 'estado', header: 'UF', sortable: true, minWidth: 60 },
|
|
67
|
-
{ key: 'categoria', header: 'Categoria', sortable: true, minWidth: 120 },
|
|
68
|
-
{
|
|
69
|
-
key: 'status',
|
|
70
|
-
header: 'Status',
|
|
71
|
-
render: (item) => <Badge variant={item.status === 'Ativo' ? 'default' : 'secondary'}>{item.status}</Badge>,
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
function FornecedoresPage() {
|
|
76
|
-
const manager = useCrud<Fornecedor>({
|
|
77
|
-
tableName: 'fornecedores',
|
|
78
|
-
searchFields: ['razaoSocial', 'nomeFantasia', 'cnpj', 'email']
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div>
|
|
83
|
-
<CrudTable
|
|
84
|
-
manager={manager}
|
|
85
|
-
columns={fornecedorColumns}
|
|
86
|
-
onEdit={(item) => openForm(item)}
|
|
87
|
-
onToggleStatus={(item) => toggleStatus(item)}
|
|
88
|
-
onDelete={(item) => confirmDelete(item)}
|
|
89
|
-
enableBulkActions
|
|
90
|
-
hideActionBar // Usa toolbar customizada
|
|
91
|
-
/>
|
|
92
|
-
<CrudPagination manager={manager} />
|
|
93
|
-
</div>
|
|
94
|
-
);
|
|
95
|
-
}`;function $e(){const o=he(we.slice(0,20),{searchFields:["item","tipo","fornecedor","detalhes"],pageSize:5});return e.jsxs("div",{className:"border rounded-lg overflow-hidden bg-background",children:[e.jsx(de,{manager:o,columns:Te,onEdit:h=>n.info(`Editando: ${h.item}`),onToggleStatus:h=>n.info(`Toggle: ${h.item}`),onDelete:h=>n.info(`Excluindo: ${h.item}`),rowActionsVariant:"inline",hideActionBar:!0,resizeStorageKey:"crud-table-inline-doc"}),e.jsx("div",{className:"border-t p-2",children:e.jsx(me,{manager:o})})]})}const Me=`<CrudTable
|
|
96
|
-
manager={manager}
|
|
97
|
-
columns={columns}
|
|
98
|
-
onEdit={(item) => handleEdit(item)}
|
|
99
|
-
onToggleStatus={(item) => handleToggle(item)}
|
|
100
|
-
onDelete={(item) => handleDelete(item)}
|
|
101
|
-
rowActionsVariant="inline" // Ações aparecem on-hover
|
|
102
|
-
/>`;function qe(){return e.jsxs(De,{title:"CrudTable",description:"Componente de tabela CRUD completo com ordenação, seleção, resize de colunas, ações em massa e paginação integrada com useCrud.",tocItems:[{id:"exemplo-interativo",label:"Exemplo Interativo"},{id:"exemplo-inline-actions",label:"Ações Inline (Hover)"},{id:"exemplo-avancado",label:"Exemplo Avançado"},{id:"funcionalidades",label:"Funcionalidades"},{id:"props-principais",label:"Props Principais"},{id:"quando-usar",label:"Quando Usar"},{id:"notas",label:"Notas"}],children:[e.jsxs("section",{id:"exemplo-interativo",className:"space-y-4 scroll-mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Exemplo Interativo"}),e.jsxs(re,{defaultValue:"preview",className:"w-full",children:[e.jsxs(te,{className:"mb-4",children:[e.jsxs(A,{value:"preview",className:"gap-2",children:[e.jsx(ie,{size:16}),"Preview"]}),e.jsxs(A,{value:"code",className:"gap-2",children:[e.jsx(ne,{size:16}),"Código"]})]}),e.jsx(I,{value:"preview",className:"mt-0",children:e.jsx(Be,{})}),e.jsx(I,{value:"code",className:"mt-0",children:e.jsx(y,{children:e.jsx(F,{className:"p-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm max-h-[500px]",children:e.jsx("code",{children:Ve})})})})})]})]}),e.jsxs("section",{id:"exemplo-inline-actions",className:"space-y-4 scroll-mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Ações Inline (Hover)"}),e.jsxs("p",{className:"text-muted-foreground",children:["Com ",e.jsx("code",{children:'rowActionsVariant="inline"'}),", as ações aparecem como ícones diretamente na linha ao passar o mouse, similar ao Google Drive. O menu de contexto (clique-direito) continua disponível como fallback."]}),e.jsxs(re,{defaultValue:"preview",className:"w-full",children:[e.jsxs(te,{className:"mb-4",children:[e.jsxs(A,{value:"preview",className:"gap-2",children:[e.jsx(ie,{size:16}),"Preview"]}),e.jsxs(A,{value:"code",className:"gap-2",children:[e.jsx(ne,{size:16}),"Código"]})]}),e.jsx(I,{value:"preview",className:"mt-0",children:e.jsx($e,{})}),e.jsx(I,{value:"code",className:"mt-0",children:e.jsx(y,{children:e.jsx(F,{className:"p-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm max-h-[500px]",children:e.jsx("code",{children:Me})})})})})]})]}),e.jsxs("section",{id:"exemplo-avancado",className:"space-y-4 scroll-mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:"Exemplo Avançado: Fornecedores"}),e.jsx("p",{className:"text-muted-foreground",children:"Exemplo de CRUD com muitos campos (CNPJ, Razão Social, Email, Telefone, Cidade, Estado, Categoria), demonstrando tabelas complexas com múltiplos filtros e formulários extensos."}),e.jsxs(re,{defaultValue:"preview",className:"w-full",children:[e.jsxs(te,{className:"mb-4",children:[e.jsxs(A,{value:"preview",className:"gap-2",children:[e.jsx(ie,{size:16}),"Preview"]}),e.jsxs(A,{value:"code",className:"gap-2",children:[e.jsx(ne,{size:16}),"Código"]})]}),e.jsx(I,{value:"preview",className:"mt-0",children:e.jsx(Re,{})}),e.jsx(I,{value:"code",className:"mt-0",children:e.jsx(y,{children:e.jsx(F,{className:"p-0",children:e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm max-h-[500px]",children:e.jsx("code",{children:We})})})})})]})]}),e.jsxs(y,{id:"gerenciamento-colunas",className:"scroll-mt-4",children:[e.jsx(W,{children:e.jsx($,{children:"Gerenciamento de Colunas"})}),e.jsxs(F,{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Ative ",e.jsx("code",{children:"enableColumnManager"})," para permitir ocultar, reordenar e agrupar colunas. O ícone de colunas aparece na zona direita do action bar."]}),e.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Ocultar/exibir:"})," Checkbox no popover para cada coluna. Colunas com ",e.jsx("code",{children:"hideable: false"})," ficam sempre visíveis."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Reordenar:"})," Drag-and-drop no popover (arrastar pelo ícone ☰)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Agrupar:"})," Clique no ícone de grupo em colunas com ",e.jsx("code",{children:"groupable: true"}),". Os dados são agrupados com linhas colapsáveis."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Persistência:"})," Use ",e.jsx("code",{children:"columnManagerStorageKey"})," para salvar estado em localStorage."]})]}),e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:e.jsx("code",{children:`const columns: CrudColumn<Item>[] = [
|
|
103
|
-
{ key: 'nome', header: 'Nome', hideable: false }, // sempre visível
|
|
104
|
-
{ key: 'tipo', header: 'Tipo', groupable: true }, // pode agrupar
|
|
105
|
-
{ key: 'status', header: 'Status', groupable: true },
|
|
106
|
-
];
|
|
107
|
-
|
|
108
|
-
<CrudTable
|
|
109
|
-
manager={manager}
|
|
110
|
-
columns={columns}
|
|
111
|
-
enableColumnManager
|
|
112
|
-
columnManagerStorageKey="minha-tabela"
|
|
113
|
-
/>`})})]})]}),e.jsxs(y,{id:"funcionalidades",className:"scroll-mt-4",children:[e.jsx(W,{children:e.jsx($,{children:"Funcionalidades Incluídas"})}),e.jsx(F,{children:e.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Ordenação:"})," Clique nos headers das colunas para ordenar"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Resize:"})," Arraste as bordas das colunas para redimensionar"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Seleção em massa:"})," Checkbox para selecionar múltiplos itens"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"CRUD completo:"})," Criar, editar, visualizar e excluir"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Paginação:"})," Navegação entre páginas e controle de itens por página"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Ações por linha:"})," Menu de contexto com ações rápidas"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Gerenciamento de colunas:"})," Ocultar, reordenar e agrupar via popover"]})]})})]}),e.jsxs(y,{id:"props-principais",className:"scroll-mt-4",children:[e.jsx(W,{children:e.jsx($,{children:"Props Principais"})}),e.jsx(F,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Prop"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Tipo"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"manager"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"CrudManager<T>"}),e.jsx("td",{className:"p-2",children:"Hook useCrud com estado e operações"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"columns"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"CrudColumn<T>[]"}),e.jsx("td",{className:"p-2",children:"Definição das colunas da tabela"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onEdit"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(item: T) => void"}),e.jsx("td",{className:"p-2",children:"Callback ao clicar em editar"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onDelete"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(item: T) => void"}),e.jsx("td",{className:"p-2",children:"Callback ao clicar em excluir"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"onToggleStatus"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"(item: T) => void"}),e.jsx("td",{className:"p-2",children:"Callback para alternar status ativo/inativo"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"enableColumnResize"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Habilita redimensionamento de colunas (padrão: true)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"enableBulkActions"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Habilita seleção e ações em massa"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"rowActionsVariant"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"'dropdown' | 'inline'"}),e.jsx("td",{className:"p-2",children:"Variante de ações por linha: dropdown (padrão) ou inline on-hover (estilo Google Drive)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"hideActionBar"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Oculta a barra de ações interna (para usar toolbar customizada)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"enableColumnManager"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"p-2",children:"Habilita popover de gerenciamento de colunas (ocultar, reordenar, agrupar)"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2",children:e.jsx("code",{children:"columnManagerStorageKey"})}),e.jsx("td",{className:"p-2 text-muted-foreground",children:"string"}),e.jsx("td",{className:"p-2",children:"Chave para persistir configuração de colunas em localStorage"})]})]})]})})})]}),e.jsxs(y,{id:"quando-usar",className:"scroll-mt-4",children:[e.jsx(W,{children:e.jsx($,{children:"Quando Usar"})}),e.jsxs(F,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Use o ",e.jsx("code",{children:"CrudTable"})," quando precisar de uma tabela completa com todas as funcionalidades padrão. Para casos mais específicos, considere:"]}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:[e.jsx("code",{children:"createCrudPage"})," - Para gerar página completa automaticamente"]}),e.jsxs("li",{children:[e.jsx("code",{children:"Primitives"})," - Para UI totalmente customizada"]})]})]})]}),e.jsxs(y,{id:"notas",className:"scroll-mt-4",children:[e.jsx(W,{children:e.jsx($,{children:"Notas"})}),e.jsx(F,{children:e.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["Use junto com ",e.jsx("code",{children:"useCrud"})," ou ",e.jsx("code",{children:"createSimpleService"})]}),e.jsxs("li",{children:["Colunas com ",e.jsx("code",{children:"sortable: true"})," permitem ordenação"]}),e.jsxs("li",{children:["Use ",e.jsx("code",{children:"render: (item) => ..."})," para formatação customizada"]}),e.jsxs("li",{children:["Combine com ",e.jsx("code",{children:"CrudPagination"})," para paginação"]})]})})]})]})}export{qe as CrudTableDoc};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{j as e,l as s,C as d,d as r,B as l}from"./index-CE0k7Rdh.js";import{C as n}from"./ComponentDocTemplate-CRbRY-v5.js";function c({children:i,className:t}){return e.jsx("div",{className:s("space-y-4",t),children:i})}function m({children:i,onClick:t,className:o}){return e.jsx(d,{className:s("transition-colors",t&&"cursor-pointer hover:bg-muted/50",o),onClick:t,children:e.jsx(r,{className:"p-4",children:i})})}function u({label:i,value:t,className:o}){return e.jsxs("div",{className:s("flex justify-between items-center text-sm",o),children:[e.jsxs("span",{className:"text-muted-foreground font-medium",children:[i,":"]}),e.jsx("span",{className:"text-foreground",children:t})]})}const a={Root:c,Item:m,Field:u};function x(){return e.jsx(n,{title:"DataList",description:"Sistema de lista de dados com composição de componentes. Ideal para exibir informações estruturadas em formato de cards.",component:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs(a.Root,{children:[e.jsxs(a.Item,{onClick:()=>alert("Clicou!"),children:[e.jsx(a.Field,{label:"Nome",value:"João Silva"}),e.jsx(a.Field,{label:"Email",value:"joao@exemplo.com"}),e.jsx(a.Field,{label:"Status",value:e.jsx(l,{variant:"success",children:"Ativo"})})]}),e.jsxs(a.Item,{children:[e.jsx(a.Field,{label:"Nome",value:"Maria Santos"}),e.jsx(a.Field,{label:"Email",value:"maria@exemplo.com"}),e.jsx(a.Field,{label:"Status",value:e.jsx(l,{variant:"secondary",children:"Pendente"})})]})]})}),usage:`import { DataList, Badge } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<DataList.Root>
|
|
4
|
-
<DataList.Item onClick={() => console.log('clicked')}>
|
|
5
|
-
<DataList.Field label="Nome" value="João Silva" />
|
|
6
|
-
<DataList.Field label="Email" value="joao@exemplo.com" />
|
|
7
|
-
<DataList.Field label="Status" value={<Badge>Ativo</Badge>} />
|
|
8
|
-
</DataList.Item>
|
|
9
|
-
<DataList.Item>
|
|
10
|
-
<DataList.Field label="Nome" value="Maria Santos" />
|
|
11
|
-
<DataList.Field label="Email" value="maria@exemplo.com" />
|
|
12
|
-
</DataList.Item>
|
|
13
|
-
</DataList.Root>`,props:[{name:"DataList.Root",type:"ReactNode",default:"-",description:"Container principal com espaçamento vertical."},{name:"DataList.Item",type:"ReactNode",default:"-",description:"Item individual renderizado como Card."},{name:"DataList.Item.onClick",type:"() => void",default:"-",description:"Handler de clique (adiciona hover state)."},{name:"DataList.Field",type:"{ label, value }",default:"-",description:"Par label/value formatado horizontalmente."},{name:"DataList.Field.value",type:"ReactNode",default:"-",description:"Valor pode ser texto ou componentes (Badge, etc.)."}],accessibility:["Items clicáveis tem cursor pointer","Hover state visual para feedback","Estrutura semântica com Cards"],notes:["💡 Use para listas de dados estruturados","💡 Field.value aceita ReactNode - use Badge, Button, etc.","💡 onClick em Item adiciona hover state automaticamente"]})}export{x as DataListDoc};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as i,j as s}from"./index-CE0k7Rdh.js";function a({onNavigate:o}){const n=i.reduce((e,t)=>e+t.items.length,0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-4xl font-bold tracking-tight",children:"Design System"}),s.jsxs("p",{className:"text-xl text-muted-foreground mt-2",children:["Explore todos os ",n," componentes organizados por categoria"]})]}),s.jsx("div",{className:"grid gap-8 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:i.map(e=>{const t=e.icon;return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-foreground",children:[s.jsx(t,{className:"h-5 w-5 text-primary"}),s.jsx("h2",{className:"font-semibold text-lg",children:e.title})]}),s.jsx("div",{className:"space-y-1",children:e.items.map(l=>s.jsx("button",{onClick:()=>o(l.id),className:"block w-full text-left px-2 py-1.5 text-sm text-primary hover:text-primary/80 hover:bg-accent rounded-md transition-colors",children:l.label},l.id))})]},e.id)})})]})}export{a as DesignSystemHome};
|