forlogic-core 1.20.1 → 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/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,204 +0,0 @@
|
|
|
1
|
-
import{j as e,B as l,f as t,bp as j,P as c,g as I,bx as d,h as b,l as i,cf as n,bG as U,w as D,v as L,c3 as z,a7 as G,G as A,bl as P,F as B,bq as H,r as m,c$ as F,et as k,d0 as p,d1 as x,d2 as u,c5 as q,bJ as W,bR as O}from"./index-CE0k7Rdh.js";import{C as V}from"./ComponentDocTemplate-CRbRY-v5.js";import{P as M,a as E}from"./pin-CMYagNhs.js";const Q=[{icon:d,label:"Visão geral"},{icon:q,label:"Showcase"},{icon:n,label:"Liderança"},{icon:W,label:"Locais"},{icon:L,label:"Gestão",children:[{icon:n,label:"Usuários"},{icon:z,label:"Permissões"}]},{icon:O,label:"Design System"}];function J(){const[a,r]=m.useState(!0),[N,h]=m.useState(!0),[y,g]=m.useState("Visão geral"),[T,R]=m.useState(["Gestão"]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(t,{variant:a?"primary":"outline",size:"sm",onClick:()=>{r(!0),h(!0)},children:"Expandido"}),e.jsx(t,{variant:a?"outline":"primary",size:"sm",onClick:()=>{r(!1),h(!1)},children:"Colapsado"}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[N?e.jsx(M,{className:"inline h-3 w-3 mr-1"}):e.jsx(E,{className:"inline h-3 w-3 mr-1"}),N?"Pinada":"Despinada"]})]}),e.jsx(F,{children:e.jsx("div",{className:"relative inline-block",children:e.jsxs("div",{className:i("bg-background border border-border rounded-lg py-4 space-y-3 transition-all duration-300 overflow-visible relative",a?"w-64 px-3":"w-16 px-1.5"),children:[a?e.jsxs("div",{className:"flex flex-col gap-3 pl-2",children:[e.jsx("div",{className:"flex items-center h-10",children:e.jsx("img",{src:k.logo,alt:"Logo",className:"h-5 object-contain",onError:s=>{s.target.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 24"%3E%3Ctext x="0" y="18" font-family="system-ui" font-size="16" font-weight="bold" fill="%23333"%3EForlogic%3C/text%3E%3C/svg%3E'}})}),e.jsxs(t,{variant:"secondary",size:"default",className:"h-10 gap-2 px-3 justify-start w-full",children:[e.jsx(j,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:"Meu Módulo"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full gap-3",children:[e.jsx("div",{className:"flex items-center justify-center h-10 w-8",children:e.jsx("img",{src:k.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain",onError:s=>{s.target.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34"%3E%3Crect width="34" height="34" rx="6" fill="%23e5e7eb"/%3E%3Ctext x="50%25" y="55%25" text-anchor="middle" font-family="system-ui" font-size="14" font-weight="bold" fill="%23333"%3EF%3C/text%3E%3C/svg%3E'}})}),e.jsxs(p,{children:[e.jsx(x,{asChild:!0,children:e.jsx("button",{className:"flex items-center justify-center h-10 w-8 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors",children:e.jsx(j,{className:"h-4 w-4"})})}),e.jsx(u,{side:"right",children:"Módulos"})]})]}),a?e.jsxs(t,{variant:"outline",className:"w-full gap-2 justify-start h-10",children:[e.jsx(c,{className:"h-4 w-4"}),"Novo Processo"]}):e.jsxs(p,{children:[e.jsx(x,{asChild:!0,children:e.jsx(t,{variant:"outline",size:"icon",className:"w-full h-10",children:e.jsx(c,{className:"h-4 w-4"})})}),e.jsx(u,{side:"right",children:"Novo Processo"})]}),e.jsxs("div",{className:"relative py-2",children:[e.jsx("div",{className:"border-t border-border"}),e.jsxs(p,{children:[e.jsx(x,{asChild:!0,children:e.jsx("button",{onClick:()=>{const s=!a;r(s),h(s)},className:i("absolute top-1/2 -translate-y-1/2 z-[100] h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",a?"-right-6":"-right-[18px]"),children:a?e.jsx(I,{className:"h-3.5 w-3.5 text-primary-foreground"}):e.jsx(b,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),e.jsx(u,{side:"right",children:e.jsx("p",{children:a?"Recolher":"Expandir"})})]})]}),e.jsx("div",{className:"space-y-1",children:Q.map(s=>{const w=s.label===y,f="children"in s&&s.children,S=T.includes(s.label),C=()=>{R(o=>o.includes(s.label)?o.filter(v=>v!==s.label):[...o,s.label])};return a?f?e.jsxs("div",{children:[e.jsxs("div",{onClick:C,className:i("flex items-center justify-between h-10 px-3 rounded-md transition-colors cursor-pointer","hover:bg-muted text-foreground"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:e.jsx(s.icon,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),e.jsx(b,{className:i("h-4 w-4 transition-transform",S&&"rotate-90")})]}),S&&e.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l border-border pl-3",children:s.children.map(o=>{const v=o.label===y;return e.jsxs("div",{onClick:()=>g(o.label),className:i("flex items-center gap-2 h-8 px-2 rounded-md transition-colors cursor-pointer text-sm",v?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[e.jsx(o.icon,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:o.label})]},o.label)})})]},s.label):e.jsxs("div",{onClick:()=>g(s.label),className:i("flex items-center gap-3 h-10 px-3 rounded-md transition-colors cursor-pointer",w?"bg-primary/10 text-primary font-medium":"hover:bg-muted text-foreground"),children:[e.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:e.jsx(s.icon,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm",children:s.label})]},s.label):e.jsxs(p,{children:[e.jsx(x,{asChild:!0,children:e.jsx("div",{onClick:()=>{f?C():g(s.label)},className:i("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer",w?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:e.jsx(s.icon,{className:"h-4 w-4"})})}),e.jsxs(u,{side:"right",children:[s.label,f&&" (expandir para ver subitens)"]})]},s.label)})}),a&&e.jsx("div",{className:"absolute inset-y-0 right-0 w-1 hover:bg-primary/20 transition-colors cursor-ew-resize"})]})})})]})}function K(){return e.jsxs("div",{className:"flex gap-8 items-start flex-wrap",children:[e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"w-64 bg-background border border-border rounded-lg py-4 px-3 space-y-3 relative overflow-visible",children:[e.jsxs("div",{className:"flex flex-col gap-2 px-2 py-2 border border-dashed border-primary/50 rounded relative",children:[e.jsx(l,{variant:"outline",className:"absolute -top-2.5 left-2 text-xs bg-background",children:"SidebarHeader"}),e.jsx("div",{className:"h-8 w-14 bg-muted rounded flex items-center justify-center text-[10px]",children:"Logo"}),e.jsxs(t,{variant:"secondary",size:"sm",className:"h-8 text-[10px] gap-2 px-3 justify-start",children:[e.jsx(j,{className:"h-3 w-3"}),"Módulos"]})]}),e.jsxs("div",{className:"border border-dashed border-green-500/50 rounded p-2 relative",children:[e.jsx(l,{variant:"outline",className:"absolute -top-2.5 left-2 text-xs bg-background text-green-600",children:"SidebarActionTrigger"}),e.jsxs(t,{variant:"outline",size:"sm",className:"w-full gap-1 text-xs h-7 justify-start",children:[e.jsx(c,{className:"h-3 w-3"}),"Ação"]})]}),e.jsxs("div",{className:"relative py-2",children:[e.jsx("div",{className:"border-t border-dashed border-blue-500/50 relative",children:e.jsx(l,{variant:"outline",className:"absolute -top-2.5 right-0 text-[8px] bg-background text-blue-600 whitespace-nowrap",children:"Pin/Unpin"})}),e.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -right-5 h-5 w-5 rounded-full bg-primary flex items-center justify-center",children:e.jsx(I,{className:"h-2.5 w-2.5 text-primary-foreground"})})]}),e.jsxs("div",{className:"border border-dashed border-orange-500/50 rounded p-2 relative space-y-1",children:[e.jsx(l,{variant:"outline",className:"absolute -top-2.5 left-2 text-xs bg-background text-orange-600",children:"NavigationItems"}),[{label:"Item simples",active:!0},{label:"Item com children",hasChildren:!0}].map((a,r)=>e.jsxs("div",{className:i("flex items-center justify-between px-2 py-1.5 rounded text-xs",a.active?"bg-primary/10 text-primary":"bg-muted/50"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{className:"h-3 w-3"}),e.jsx("span",{children:a.label})]}),a.hasChildren&&e.jsx(b,{className:"h-3 w-3"})]},r))]}),e.jsx("div",{className:"absolute inset-y-0 right-0 w-1 border-r-2 border-dashed border-purple-400/50 rounded-r"}),e.jsx(l,{variant:"outline",className:"absolute top-1/2 -right-16 text-[8px] bg-background text-purple-600 whitespace-nowrap",children:"Resize rail"})]})}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsx("p",{className:"font-medium text-sm mb-3",children:"Hierarquia:"}),e.jsx("pre",{className:"bg-muted p-3 rounded text-xs font-mono leading-relaxed",children:`<Sidebar collapsible="icon">
|
|
2
|
-
├── SidebarHeader
|
|
3
|
-
│ ├── Logo / SmallLogo
|
|
4
|
-
│ └── ModulesButton (appName)
|
|
5
|
-
│
|
|
6
|
-
├── SidebarActionTrigger (opcional)
|
|
7
|
-
│ ├── variant='button' (padrão)
|
|
8
|
-
│ │ ├── Ação única → executa direto
|
|
9
|
-
│ │ └── Múltiplas → dropdown
|
|
10
|
-
│ └── variant='split-button'
|
|
11
|
-
│ ├── Primeira ação → botão principal
|
|
12
|
-
│ └── Demais ações → dropdown
|
|
13
|
-
│
|
|
14
|
-
├── Separator + Pin/Unpin button
|
|
15
|
-
│
|
|
16
|
-
└── SidebarContent
|
|
17
|
-
└── NavigationItems
|
|
18
|
-
├── Item simples (Link)
|
|
19
|
-
├── Item com permissionCheck
|
|
20
|
-
└── Item com children
|
|
21
|
-
└── Collapsible > SidebarMenuSub`})]})]})}function $(){return e.jsx("div",{className:"flex gap-4 items-start flex-wrap",children:[{title:"Ativo",className:"bg-primary/10 text-primary font-medium",icon:d,label:"Início"},{title:"Hover",className:"bg-muted",icon:n,label:"Usuários"},{title:"Desabilitado",className:"opacity-50 cursor-not-allowed border",icon:U,label:"Admin"},{title:"Carregando",className:"opacity-50 border",icon:D,label:"Verificando...",spin:!0}].map(a=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:a.title}),e.jsxs("div",{className:i("flex items-center gap-3 px-3 py-2 rounded-md w-40",a.className),children:[e.jsx(a.icon,{className:i("h-4 w-4",a.spin&&"animate-spin")}),e.jsx("span",{className:"text-sm",children:a.label})]})]},a.title))})}function X(){return e.jsxs("div",{className:"p-3 border rounded-md w-56 space-y-1 bg-background",children:[e.jsxs("div",{className:"flex items-center gap-3 h-10 px-3 rounded-md hover:bg-muted",children:[e.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:e.jsx(d,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-medium",children:"Início"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between h-10 px-3 rounded-md hover:bg-muted cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:e.jsx(L,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-medium",children:"Configurações"})]}),e.jsx(b,{className:"h-4 w-4 rotate-90"})]}),e.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l border-border pl-3",children:[{icon:n,label:"Perfil",active:!0},{icon:z,label:"Segurança"}].map(a=>e.jsxs("div",{className:i("flex items-center gap-2 h-8 px-2 rounded-md text-sm",a.active?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-muted"),children:[e.jsx(a.icon,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:a.label})]},a.label))})]})]})}function Y(){return e.jsxs("div",{className:"flex gap-6 items-start flex-wrap",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-center",children:"Uma Ação"}),e.jsxs("div",{className:"w-56 bg-background border rounded-lg p-3 space-y-3",children:[e.jsxs(t,{variant:"outline",className:"w-full gap-2 justify-start",children:[e.jsx(c,{className:"h-4 w-4"}),"Novo Processo"]}),e.jsx("div",{className:"border-t pt-2 space-y-1",children:[{icon:d,label:"Início",active:!0},{icon:n,label:"Usuários"}].map((a,r)=>e.jsxs("div",{className:i("flex items-center gap-3 px-3 py-2 rounded-md text-sm",a.active?"bg-primary/10 text-primary font-medium":"hover:bg-muted"),children:[e.jsx(a.icon,{className:"h-4 w-4"}),e.jsx("span",{children:a.label})]},r))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-center",children:"Múltiplas Ações"}),e.jsxs("div",{className:"w-56 bg-background border rounded-lg p-3 space-y-1",children:[e.jsxs(t,{variant:"outline",className:"w-full gap-2 justify-start",children:[e.jsx(c,{className:"h-4 w-4"}),"Criar",e.jsx(G,{className:"ml-auto h-4 w-4 rotate-180"})]}),e.jsx("div",{className:"border rounded-md bg-popover p-1 shadow-md",children:[{icon:A,label:"Novo Documento"},{icon:P,label:"Nova Pasta"},{icon:n,label:"Novo Grupo"}].map((a,r)=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-sm hover:bg-muted cursor-pointer",children:[e.jsx(a.icon,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:a.label})]},r))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-center",children:"Split Button"}),e.jsxs("div",{className:"w-56 bg-background border rounded-lg p-3 space-y-3",children:[e.jsx(B,{label:"Novo Documento",onClick:()=>{},icon:A,variant:"outline",actions:[{id:"folder",label:"Nova Pasta",icon:P,onClick:()=>{}},{id:"group",label:"Novo Grupo",icon:n,onClick:()=>{}}],className:"w-full",menuAlign:"start"}),e.jsx("div",{className:"border-t pt-2 space-y-1",children:[{icon:d,label:"Início",active:!0},{icon:n,label:"Usuários"}].map((a,r)=>e.jsxs("div",{className:i("flex items-center gap-3 px-3 py-2 rounded-md text-sm",a.active?"bg-primary/10 text-primary font-medium":"hover:bg-muted"),children:[e.jsx(a.icon,{className:"h-4 w-4"}),e.jsx("span",{children:a.label})]},r))})]})]})]})}function Z(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-md bg-muted/30",children:[e.jsx(H,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Redimensionamento"}),e.jsxs("p",{className:"text-muted-foreground",children:["Quando ",e.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:"resizable=true"}),", um rail aparece na borda direita. Arraste para redimensionar entre ",e.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:"minWidth"})," e"," ",e.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:"maxWidth"}),"."]}),e.jsxs("p",{className:"text-muted-foreground",children:["A largura é persistida automaticamente em ",e.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:"localStorage"}),"."]})]})]}),e.jsx("pre",{className:"bg-muted p-3 rounded text-xs font-mono",children:`<AppSidebar
|
|
22
|
-
config={sidebarConfig}
|
|
23
|
-
resizable={true}
|
|
24
|
-
minWidth={224} // padrão: 224px (14rem)
|
|
25
|
-
maxWidth={384} // padrão: 384px (24rem)
|
|
26
|
-
/>`})]})}function _(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 items-start flex-wrap",children:[e.jsxs("div",{className:"p-3 border rounded-md space-y-2 w-64",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Pinada"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sidebar permanece aberta. Estado salvo em ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"localStorage"}),"."]})]}),e.jsxs("div",{className:"p-3 border rounded-md space-y-2 w-64",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Despinada"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sidebar inicia colapsada. Expande ao hover (desktop) ou toggle (mobile)."})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["O botão circular na borda do separador controla pin/unpin. Em telas ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"<768px"})," (mobile), o botão é ocultado."]})]})}function ee(){return e.jsx("div",{className:"space-y-3 w-full",children:[{badge:"Desktop ≥1024px",variant:"default",text:"Sidebar visível, pode ser pinada ou colapsar"},{badge:"Tablet 768-1023px",variant:"secondary",text:"Sidebar inicia colapsada, expande ao hover/click"},{badge:"Mobile <768px",variant:"outline",text:"Sidebar como drawer/sheet lateral (oculta por padrão)"}].map(a=>e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(l,{variant:a.variant,className:"shrink-0",children:a.badge}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a.text})]},a.badge))})}function re(){return e.jsxs(V,{title:"AppSidebar",description:"Sidebar de navegação principal da aplicação com suporte a pin/unpin, permissões assíncronas, ações de módulo (SidebarActionTrigger), redimensionamento e navegação hierárquica.",component:e.jsx(J,{}),usage:`import { AppLayout } from 'forlogic-core';
|
|
27
|
-
import type { SidebarConfig } from 'forlogic-core';
|
|
28
|
-
import { Home, Users, Settings, Shield, Plus, FileText, Folder } from 'lucide-react';
|
|
29
|
-
|
|
30
|
-
const sidebarConfig: SidebarConfig = {
|
|
31
|
-
appName: 'Minha Aplicação',
|
|
32
|
-
|
|
33
|
-
// Ações do módulo (opcional)
|
|
34
|
-
moduleActions: {
|
|
35
|
-
triggerLabel: 'Criar',
|
|
36
|
-
triggerIcon: Plus,
|
|
37
|
-
actions: [
|
|
38
|
-
{ id: 'new-doc', label: 'Novo Documento', icon: FileText, onClick: () => {} },
|
|
39
|
-
{ id: 'new-folder', label: 'Nova Pasta', icon: Folder, onClick: () => {} },
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
// Navegação (com suporte a hierarquia)
|
|
44
|
-
navigation: [
|
|
45
|
-
{ label: 'Início', path: '/', icon: Home },
|
|
46
|
-
{ label: 'Usuários', path: '/users', icon: Users },
|
|
47
|
-
{
|
|
48
|
-
label: 'Configurações',
|
|
49
|
-
path: '/settings',
|
|
50
|
-
icon: Settings,
|
|
51
|
-
children: [
|
|
52
|
-
{ label: 'Perfil', path: '/settings/profile', icon: Users },
|
|
53
|
-
{ label: 'Segurança', path: '/settings/security', icon: Shield },
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Uso via AppLayout (recomendado)
|
|
60
|
-
<AppLayout sidebarConfig={sidebarConfig}>
|
|
61
|
-
<Routes>...</Routes>
|
|
62
|
-
</AppLayout>
|
|
63
|
-
|
|
64
|
-
// Uso direto (casos avançados)
|
|
65
|
-
<AppSidebar
|
|
66
|
-
config={sidebarConfig}
|
|
67
|
-
resizable={true}
|
|
68
|
-
minWidth={224}
|
|
69
|
-
maxWidth={384}
|
|
70
|
-
/>`,tocItems:[{id:"tipos-typescript",label:"Tipos TypeScript"},{id:"componente-base",label:"Componente Base: Sidebar"}],examples:[{title:"Anatomia do Sidebar",description:"Estrutura hierárquica completa: Header, Actions, Separator com Pin, Navigation, e Resize rail.",preview:e.jsx(K,{}),code:`// Estrutura do AppSidebar
|
|
71
|
-
<Sidebar collapsible="icon">
|
|
72
|
-
├── SidebarHeader (Logo + ModulesButton)
|
|
73
|
-
├── SidebarActionTrigger (ações de módulo)
|
|
74
|
-
├── Separator + Pin/Unpin button (borda)
|
|
75
|
-
└── SidebarContent
|
|
76
|
-
└── NavigationItems
|
|
77
|
-
├── Item simples (Link)
|
|
78
|
-
├── Item com permissionCheck
|
|
79
|
-
└── Item com children (Collapsible)
|
|
80
|
-
└── SidebarMenuSub`},{title:"Estados Visuais",description:"Itens de navegação possuem 4 estados: Ativo (bg-primary/10), Hover (bg-muted), Desabilitado (opacity-50 + Lock icon), e Carregando (spinner durante permissionCheck).",preview:e.jsx($,{}),code:`// Matching de rota ativa (hierárquico)
|
|
81
|
-
const isActive = (path: string) =>
|
|
82
|
-
location.pathname === path ||
|
|
83
|
-
location.pathname.startsWith(path + '/');
|
|
84
|
-
|
|
85
|
-
// Item com verificação de permissão assíncrona
|
|
86
|
-
{
|
|
87
|
-
label: 'Gestão',
|
|
88
|
-
path: '/management',
|
|
89
|
-
icon: Settings,
|
|
90
|
-
permissionCheck: async () => {
|
|
91
|
-
return await checkUserPermission('management');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// → Exibe Loader2 (spin) enquanto verifica
|
|
95
|
-
// → Exibe Lock + "Acesso restrito" se false`},{title:"Navegação Hierárquica",description:"Suporte a itens com children (máximo 2 níveis). No modo expandido, usa Collapsible com ChevronRight. No modo colapsado, exibe tooltip.",preview:e.jsx(X,{}),code:`const navigation: SidebarNavigationItem[] = [
|
|
96
|
-
{ label: 'Início', path: '/', icon: Home },
|
|
97
|
-
{
|
|
98
|
-
label: 'Configurações',
|
|
99
|
-
path: '/settings',
|
|
100
|
-
icon: Settings,
|
|
101
|
-
children: [
|
|
102
|
-
{ label: 'Perfil', path: '/settings/profile', icon: Users },
|
|
103
|
-
{ label: 'Segurança', path: '/settings/security', icon: Shield },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
];`},{title:"Ações de Módulo (SidebarActionTrigger)",description:'Suporta duas variantes: "button" (padrão) com ação direta ou dropdown, e "split-button" com ação principal + dropdown de ações secundárias. No modo colapsado, ambas exibem ícone com tooltip.',preview:e.jsx(Y,{}),code:`// variant='button' (padrão) — ação única ou dropdown
|
|
107
|
-
moduleActions: {
|
|
108
|
-
triggerLabel: 'Criar',
|
|
109
|
-
triggerIcon: Plus,
|
|
110
|
-
actions: [
|
|
111
|
-
{ id: 'new-doc', label: 'Novo Documento', icon: FileText, onClick: handleNewDoc },
|
|
112
|
-
{ id: 'new-folder', label: 'Nova Pasta', icon: Folder, onClick: handleNewFolder },
|
|
113
|
-
],
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// variant='split-button' — primeira ação = botão principal, demais = dropdown
|
|
117
|
-
moduleActions: {
|
|
118
|
-
variant: 'split-button',
|
|
119
|
-
actions: [
|
|
120
|
-
{ id: 'new-doc', label: 'Novo Documento', icon: FileText, onClick: handleNewDoc },
|
|
121
|
-
{ id: 'new-folder', label: 'Nova Pasta', icon: Folder, onClick: handleNewFolder },
|
|
122
|
-
{ id: 'import', label: 'Importar', icon: Upload, onClick: handleImport },
|
|
123
|
-
],
|
|
124
|
-
}`},{title:"Pin / Unpin",description:"O botão circular na borda do separador controla se a sidebar permanece aberta (pinada) ou colapsa automaticamente.",preview:e.jsx(_,{}),code:`// Internamente o AppSidebar usa:
|
|
125
|
-
import { getSidebarPinnedPreference, setSidebarPinnedPreference }
|
|
126
|
-
from './sidebar-utils';
|
|
127
|
-
|
|
128
|
-
// Persistência em localStorage ('forlogic-sidebar-pinned')
|
|
129
|
-
// Botão circular usa bg-primary com ChevronLeft/Right
|
|
130
|
-
// Oculto em mobile (hidden md:block)`},{title:"Redimensionamento",description:"Quando resizable=true, um rail aparece na borda direita para arrastar. A largura é persistida em localStorage.",preview:e.jsx(Z,{}),code:`// useSidebarResize hook
|
|
131
|
-
import { useSidebarResize } from 'forlogic-core';
|
|
132
|
-
|
|
133
|
-
const resize = useSidebarResize({
|
|
134
|
-
minWidth: 224, // Mínimo (14rem)
|
|
135
|
-
maxWidth: 384, // Máximo (24rem)
|
|
136
|
-
defaultWidth: 240, // Padrão (15rem)
|
|
137
|
-
storageKey: 'app-sidebar-width',
|
|
138
|
-
isOpen: true,
|
|
139
|
-
onResize: (width) => console.log(width),
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// resize.width, resize.isDragging,
|
|
143
|
-
// resize.dragRef, resize.handleMouseDown`},{title:"Comportamento Responsivo",description:"A sidebar adapta-se automaticamente ao tamanho da tela.",preview:e.jsx(ee,{}),code:`// O AppSidebar usa collapsible="icon"
|
|
144
|
-
// Em desktop: colapsa para 16px (ícones apenas)
|
|
145
|
-
// Em mobile: comportamento de drawer
|
|
146
|
-
|
|
147
|
-
// useSidebar() hook disponível para controle externo
|
|
148
|
-
import { useSidebar } from 'forlogic-core';
|
|
149
|
-
|
|
150
|
-
const { open, setOpen, state, toggleSidebar } = useSidebar();
|
|
151
|
-
// state: "expanded" | "collapsed"`}],props:[{name:"config",type:"SidebarConfig",description:"Configuração principal: appName, navigation[], moduleActions"},{name:"config.appName",type:"string",description:'Nome exibido no botão de módulos (fallback: "Módulos")'},{name:"config.navigation",type:"SidebarNavigationItem[]",description:"Itens de navegação com label, path, icon e children opcionais"},{name:"config.moduleActions",type:"SidebarActionsConfig",description:"Ações do módulo: triggerLabel, triggerIcon, actions[]"},{name:"customContent",type:"ReactNode",description:"Conteúdo customizado que substitui a navegação padrão"},{name:"resizable",type:"boolean",default:"false",description:"Habilita redimensionamento com drag na borda direita"},{name:"minWidth",type:"number",default:"224",description:"Largura mínima em pixels (resizable=true)"},{name:"maxWidth",type:"number",default:"384",description:"Largura máxima em pixels (resizable=true)"}],accessibility:["Navegação acessível via teclado (Tab, Arrow keys, Enter)","Submenus expansíveis com Enter ou Space (via Collapsible)","Estado ativo comunicado via isActive no SidebarMenuButton","Itens desabilitados com cursor-not-allowed e opacity reduzida","Tooltips em modo colapsado para identificação de todos os itens","Botão pin/unpin oculto em mobile (hidden md:block) para evitar conflito com drawer","Contraste adequado entre estados ativo/inativo usando tokens semânticos"],notes:["✅ Use ícones consistentes do Lucide React para todos os itens","✅ Máximo 2 níveis de aninhamento (item → children)","✅ Labels curtas: 1-3 palavras, máximo 20 caracteres","✅ Agrupe itens relacionados logicamente","✅ Use permissionCheck para controle de acesso assíncrono","✅ Use moduleActions para ações de criação/adição do módulo","✅ Prefira AppLayout ao invés de usar AppSidebar diretamente","❌ Não use mais de 10 itens no nível raiz","❌ Não crie 3+ níveis de submenu (hierarquia profunda)","❌ Não deixe itens sem ícones","❌ Não misture ícones de bibliotecas diferentes","❌ Não use labels com mais de 20 caracteres"],children:[e.jsxs("div",{id:"tipos-typescript",className:"space-y-6 scroll-mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight border-b pb-2",children:"Tipos TypeScript"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"SidebarConfig"}),e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:`interface SidebarConfig {
|
|
152
|
-
appName?: string;
|
|
153
|
-
navigation?: SidebarNavigationItem[];
|
|
154
|
-
moduleActions?: SidebarActionsConfig;
|
|
155
|
-
}`})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"SidebarNavigationItem"}),e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:`interface SidebarNavigationItem {
|
|
156
|
-
label: string; // Texto do item
|
|
157
|
-
path: string; // Rota de navegação
|
|
158
|
-
icon: LucideIcon; // Ícone obrigatório
|
|
159
|
-
complementaryText?: string; // Texto complementar
|
|
160
|
-
permissionCheck?: () => Promise<boolean>; // Verificação assíncrona
|
|
161
|
-
children?: SidebarNavigationItem[]; // Subitens (máx. 2 níveis)
|
|
162
|
-
}`})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"SidebarActionsConfig"}),e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:`interface SidebarActionsConfig {
|
|
163
|
-
triggerLabel?: string; // Rótulo do gatilho (default: 'Criar')
|
|
164
|
-
triggerIcon?: LucideIcon; // Ícone do gatilho (default: Plus)
|
|
165
|
-
actions: SidebarModuleAction[];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
interface SidebarModuleAction {
|
|
169
|
-
id: string; // ID único
|
|
170
|
-
label: string; // Texto exibido
|
|
171
|
-
icon?: LucideIcon; // Ícone opcional
|
|
172
|
-
onClick: () => void; // Callback
|
|
173
|
-
disabled?: boolean; // Desabilitar ação
|
|
174
|
-
permissionCheck?: () => Promise<boolean>; // Verificação de permissão
|
|
175
|
-
}`})]})]}),e.jsxs("div",{id:"componente-base",className:"space-y-6 scroll-mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight border-b pb-2",children:"Componente Base: Sidebar"}),e.jsxs("p",{className:"text-muted-foreground",children:["O AppSidebar utiliza internamente o componente base ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"Sidebar"})," do Shadcn/Radix. Para sidebars customizadas fora do AppLayout, use o componente base diretamente."]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Uso do Base"}),e.jsx("pre",{className:"bg-muted p-4 rounded-lg overflow-x-auto text-sm",children:`import {
|
|
176
|
-
Sidebar, SidebarProvider, SidebarHeader, SidebarContent,
|
|
177
|
-
SidebarFooter, SidebarGroup, SidebarGroupLabel,
|
|
178
|
-
SidebarGroupContent, SidebarMenu, SidebarMenuItem,
|
|
179
|
-
SidebarMenuButton, SidebarTrigger,
|
|
180
|
-
} from 'forlogic-core';
|
|
181
|
-
|
|
182
|
-
<SidebarProvider>
|
|
183
|
-
<Sidebar collapsible="icon">
|
|
184
|
-
<SidebarHeader>Logo</SidebarHeader>
|
|
185
|
-
<SidebarContent>
|
|
186
|
-
<SidebarGroup>
|
|
187
|
-
<SidebarGroupLabel>Menu</SidebarGroupLabel>
|
|
188
|
-
<SidebarGroupContent>
|
|
189
|
-
<SidebarMenu>
|
|
190
|
-
<SidebarMenuItem>
|
|
191
|
-
<SidebarMenuButton isActive>
|
|
192
|
-
<Home className="mr-2" /> Home
|
|
193
|
-
</SidebarMenuButton>
|
|
194
|
-
</SidebarMenuItem>
|
|
195
|
-
</SidebarMenu>
|
|
196
|
-
</SidebarGroupContent>
|
|
197
|
-
</SidebarGroup>
|
|
198
|
-
</SidebarContent>
|
|
199
|
-
</Sidebar>
|
|
200
|
-
<main>
|
|
201
|
-
<SidebarTrigger />
|
|
202
|
-
{/* Content */}
|
|
203
|
-
</main>
|
|
204
|
-
</SidebarProvider>`})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Props do Sidebar Base"}),e.jsx("div",{className:"rounded-lg border",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold",children:"Prop"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold",children:"Tipo"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold",children:"Padrão"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-semibold",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"px-4 py-3 font-mono text-sm font-medium",children:"side"}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"left" | "right"'}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"left"'}),e.jsx("td",{className:"px-4 py-3 text-sm",children:"Lado da tela"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"px-4 py-3 font-mono text-sm font-medium",children:"variant"}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"sidebar" | "floating" | "inset"'}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"sidebar"'}),e.jsx("td",{className:"px-4 py-3 text-sm",children:"Estilo visual"})]}),e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"px-4 py-3 font-mono text-sm font-medium",children:"collapsible"}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"offcanvas" | "icon" | "none"'}),e.jsx("td",{className:"px-4 py-3 font-mono text-sm text-muted-foreground",children:'"offcanvas"'}),e.jsx("td",{className:"px-4 py-3 text-sm",children:"Comportamento de collapse"})]})]})]})})]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg border",children:e.jsxs("p",{className:"text-sm",children:[e.jsx("strong",{children:"💡 Recomendação:"})," Para a maioria dos casos, prefira"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"AppSidebar"})," via"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"AppLayout"}),", que já inclui permissões, módulos, resize e pin/unpin. Use o Sidebar base apenas para customizações avançadas."]})})]})]})}export{re as AppSidebarDoc};
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import{j as e,C as a,bG as s,b0 as i,B as o,f as t,aA as r,b9 as n,aC as c,c3 as d,bz as l}from"./index-CE0k7Rdh.js";import{C as u}from"./ComponentDocTemplate-CRbRY-v5.js";function m(){return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(a,{className:"p-4 border-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-green-500/10",children:e.jsx(d,{className:"h-5 w-5 text-green-500"})}),e.jsx("h4",{className:"font-semibold",children:"AuthProvider"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Context provider que gerencia estado de autenticação global"})]}),e.jsxs(a,{className:"p-4 border-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:e.jsx(s,{className:"h-5 w-5 text-blue-500"})}),e.jsx("h4",{className:"font-semibold",children:"ProtectedRoute"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Componente que protege rotas e redireciona usuários não autenticados"})]}),e.jsxs(a,{className:"p-4 border-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-orange-500/10",children:e.jsx(l,{className:"h-5 w-5 text-orange-500"})}),e.jsx("h4",{className:"font-semibold",children:"TokenManager"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Gerenciador de tokens JWT com validação e refresh automático"})]}),e.jsxs(a,{className:"p-4 border-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10",children:e.jsx(i,{className:"h-5 w-5 text-purple-500"})}),e.jsx("h4",{className:"font-semibold",children:"Multi-Tenant"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Suporte a múltiplas unidades/empresas com troca dinâmica"})]})]})})}function p(){return e.jsxs(a,{className:"p-4 space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Estado de Autenticação (AuthState):"}),e.jsxs("div",{className:"text-sm space-y-2",children:[e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"user"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"User | null"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"companies"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"Company[]"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"alias"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"string | null"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"isAuthenticated"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"boolean"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"isLoading"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"boolean"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"selectedUnit"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"SelectedUnit | null"})]}),e.jsxs("div",{className:"flex justify-between py-1 border-b",children:[e.jsx("code",{className:"text-xs",children:"placeId / placeName"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"string | null"})]}),e.jsxs("div",{className:"flex justify-between py-1",children:[e.jsx("code",{className:"text-xs",children:"activePlaceId / activePlaceName"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"string | null"})]})]})]})}function x(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"Usuário acessa rota protegida"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ProtectedRoute verifica isAuthenticated"})]})]}),e.jsx("div",{className:"w-8 border-l-2 border-dashed h-4 ml-4"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"Redirecionamento para OAuth"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Dev: Token local | Prod: Qualiex OAuth"})]})]}),e.jsx("div",{className:"w-8 border-l-2 border-dashed h-4 ml-4"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"Callback processa tokens"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CallbackPage valida e armazena tokens"})]})]}),e.jsx("div",{className:"w-8 border-l-2 border-dashed h-4 ml-4"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-green-500 text-white text-sm font-medium",children:"✓"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"Usuário autenticado"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Token Supabase gerado, dados carregados"})]})]})]})}function f(){return e.jsx(u,{title:"Autenticação (Auth)",description:"Sistema completo de autenticação OAuth integrado com Qualiex. Inclui gerenciamento de tokens, rotas protegidas, suporte multi-tenant e troca de unidades.",installation:`import {
|
|
2
|
-
useAuth,
|
|
3
|
-
AuthProvider,
|
|
4
|
-
ProtectedRoute,
|
|
5
|
-
LoginPage,
|
|
6
|
-
CallbackPage
|
|
7
|
-
} from 'forlogic-core';`,component:e.jsx(m,{}),usage:`// App.tsx - Setup básico
|
|
8
|
-
import { CoreProviders, ProtectedRoute } from 'forlogic-core';
|
|
9
|
-
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
10
|
-
|
|
11
|
-
function App() {
|
|
12
|
-
return (
|
|
13
|
-
<CoreProviders>
|
|
14
|
-
<BrowserRouter>
|
|
15
|
-
<Routes>
|
|
16
|
-
<Route path="/callback" element={<CallbackPage />} />
|
|
17
|
-
<Route path="/login" element={<LoginPage />} />
|
|
18
|
-
<Route
|
|
19
|
-
path="/*"
|
|
20
|
-
element={
|
|
21
|
-
<ProtectedRoute>
|
|
22
|
-
<MainApp />
|
|
23
|
-
</ProtectedRoute>
|
|
24
|
-
}
|
|
25
|
-
/>
|
|
26
|
-
</Routes>
|
|
27
|
-
</BrowserRouter>
|
|
28
|
-
</CoreProviders>
|
|
29
|
-
);
|
|
30
|
-
}`,examples:[{title:"useAuth Hook",description:"Hook principal para acessar dados de autenticação e funções de controle.",preview:e.jsx(p,{}),code:`import { useAuth } from 'forlogic-core';
|
|
31
|
-
|
|
32
|
-
function UserProfile() {
|
|
33
|
-
const {
|
|
34
|
-
user, // Dados do usuário logado
|
|
35
|
-
alias, // Alias da empresa/unidade ativa
|
|
36
|
-
companies, // Lista de empresas disponíveis
|
|
37
|
-
selectedUnit, // Unidade atualmente selecionada
|
|
38
|
-
isAuthenticated, // true se está logado
|
|
39
|
-
isLoading, // true durante inicialização
|
|
40
|
-
logout, // Função para fazer logout
|
|
41
|
-
switchUnit, // Função para trocar de unidade
|
|
42
|
-
placeId, // ID do local do usuário
|
|
43
|
-
placeName, // Nome do local do usuário
|
|
44
|
-
} = useAuth();
|
|
45
|
-
|
|
46
|
-
if (isLoading) return <div>Carregando...</div>;
|
|
47
|
-
if (!isAuthenticated) return <div>Não autenticado</div>;
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div>
|
|
51
|
-
<p>Olá, {user?.name}</p>
|
|
52
|
-
<p>Empresa: {selectedUnit?.name} ({alias})</p>
|
|
53
|
-
<p>Local: {placeName}</p>
|
|
54
|
-
<button onClick={logout}>Sair</button>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}`},{title:"Fluxo de Autenticação",description:"Sequência completa desde acesso até autenticação.",preview:e.jsx(x,{}),code:`// O fluxo é gerenciado automaticamente:
|
|
58
|
-
|
|
59
|
-
// 1. ProtectedRoute detecta usuário não autenticado
|
|
60
|
-
// 2. AuthService.loginProd() redireciona para Qualiex OAuth
|
|
61
|
-
// 3. Usuário faz login no Qualiex
|
|
62
|
-
// 4. Callback recebe tokens na URL
|
|
63
|
-
// 5. CallbackPage processa e valida tokens
|
|
64
|
-
// 6. AuthService.initialize() carrega dados do usuário
|
|
65
|
-
// 7. Token Supabase é gerado via SupabaseTokenService
|
|
66
|
-
// 8. Usuário é redirecionado para página original
|
|
67
|
-
|
|
68
|
-
// Em desenvolvimento, usa tokens de dev:
|
|
69
|
-
// AuthService.loginDev() gera token via edge function dev-tokens`},{title:"ProtectedRoute",description:"Componente que protege rotas e gerencia redirecionamentos.",preview:e.jsxs(a,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{className:"font-medium",children:"Proteção Automática"})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("li",{children:"• Verifica isAuthenticated do AuthContext"}),e.jsx("li",{children:"• Mostra loading durante inicialização"}),e.jsx("li",{children:"• Redireciona para login se não autenticado"}),e.jsx("li",{children:"• Valida tokens periodicamente (5 min)"}),e.jsx("li",{children:"• Força logout se tokens expirarem"})]})]}),code:`import { ProtectedRoute } from 'forlogic-core';
|
|
70
|
-
|
|
71
|
-
// Proteger todas as rotas da aplicação
|
|
72
|
-
function App() {
|
|
73
|
-
return (
|
|
74
|
-
<Routes>
|
|
75
|
-
{/* Rotas públicas */}
|
|
76
|
-
<Route path="/login" element={<LoginPage />} />
|
|
77
|
-
<Route path="/callback" element={<CallbackPage />} />
|
|
78
|
-
|
|
79
|
-
{/* Rotas protegidas */}
|
|
80
|
-
<Route
|
|
81
|
-
path="/*"
|
|
82
|
-
element={
|
|
83
|
-
<ProtectedRoute>
|
|
84
|
-
<MainLayout>
|
|
85
|
-
<Routes>
|
|
86
|
-
<Route path="/" element={<HomePage />} />
|
|
87
|
-
<Route path="/settings" element={<SettingsPage />} />
|
|
88
|
-
</Routes>
|
|
89
|
-
</MainLayout>
|
|
90
|
-
</ProtectedRoute>
|
|
91
|
-
}
|
|
92
|
-
/>
|
|
93
|
-
</Routes>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// ProtectedRoute mostra automaticamente:
|
|
98
|
-
// - Loading durante isLoading
|
|
99
|
-
// - Redirecionamento para OAuth se !isAuthenticated
|
|
100
|
-
// - Conteúdo protegido se autenticado`},{title:"Troca de Unidade (Multi-Tenant)",description:"Suporte a múltiplas empresas/unidades com troca dinâmica.",preview:e.jsxs(a,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{className:"font-medium",children:"Unidades Disponíveis:"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between p-2 border rounded bg-accent/50",children:[e.jsx("span",{className:"text-sm font-medium",children:"Empresa A"}),e.jsx(o,{variant:"secondary",children:"Ativa"})]}),e.jsxs("div",{className:"flex items-center justify-between p-2 border rounded hover:bg-accent/30 cursor-pointer",children:[e.jsx("span",{className:"text-sm",children:"Empresa B"}),e.jsx(t,{size:"sm",variant:"ghost",children:"Trocar"})]})]})]}),code:`import { useAuth } from 'forlogic-core';
|
|
101
|
-
|
|
102
|
-
function UnitSelector() {
|
|
103
|
-
const { companies, alias, switchUnit, isLoading } = useAuth();
|
|
104
|
-
|
|
105
|
-
const handleSwitch = async (company: Company) => {
|
|
106
|
-
await switchUnit(company);
|
|
107
|
-
// Automaticamente:
|
|
108
|
-
// 1. Gera novo token Supabase com novo alias
|
|
109
|
-
// 2. Limpa cache de queries (React Query)
|
|
110
|
-
// 3. Atualiza placeId/placeName
|
|
111
|
-
// 4. Dispara re-fetch de dados
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Select
|
|
116
|
-
value={alias || ''}
|
|
117
|
-
onValueChange={(value) => {
|
|
118
|
-
const company = companies.find(c => c.alias === value);
|
|
119
|
-
if (company) handleSwitch(company);
|
|
120
|
-
}}
|
|
121
|
-
disabled={isLoading}
|
|
122
|
-
>
|
|
123
|
-
<SelectTrigger>
|
|
124
|
-
<SelectValue placeholder="Selecione a unidade" />
|
|
125
|
-
</SelectTrigger>
|
|
126
|
-
<SelectContent>
|
|
127
|
-
{companies.map(company => (
|
|
128
|
-
<SelectItem key={company.id} value={company.alias}>
|
|
129
|
-
{company.name}
|
|
130
|
-
</SelectItem>
|
|
131
|
-
))}
|
|
132
|
-
</SelectContent>
|
|
133
|
-
</Select>
|
|
134
|
-
);
|
|
135
|
-
}`},{title:"LoginPage",description:"Página de login pronta para uso com suporte a dev/prod.",preview:e.jsxs(a,{className:"p-6 text-center space-y-4 max-w-sm mx-auto",children:[e.jsx("h3",{className:"text-xl font-bold",children:"Acesso ao Sistema"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Faça login para acessar o sistema"}),e.jsx(t,{className:"w-full",children:"Entrar com Qualiex"})]}),code:`import { LoginPage } from 'forlogic-core';
|
|
136
|
-
|
|
137
|
-
// Uso direto - página pronta
|
|
138
|
-
<Route path="/login" element={<LoginPage />} />
|
|
139
|
-
|
|
140
|
-
// A LoginPage detecta automaticamente o ambiente:
|
|
141
|
-
// - Desenvolvimento: "Login Desenvolvimento" (usa dev-tokens)
|
|
142
|
-
// - Produção: "Entrar com Qualiex" (OAuth)
|
|
143
|
-
|
|
144
|
-
// Para customizar, crie sua própria página:
|
|
145
|
-
import { AuthService, isDevEnvironment } from 'forlogic-core';
|
|
146
|
-
|
|
147
|
-
function CustomLoginPage() {
|
|
148
|
-
const handleLogin = async () => {
|
|
149
|
-
if (isDevEnvironment()) {
|
|
150
|
-
await AuthService.loginDev();
|
|
151
|
-
} else {
|
|
152
|
-
AuthService.loginProd();
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<div>
|
|
158
|
-
<h1>Meu Login Customizado</h1>
|
|
159
|
-
<Button onClick={handleLogin}>Entrar</Button>
|
|
160
|
-
</div>
|
|
161
|
-
);
|
|
162
|
-
}`},{title:"CallbackPage",description:"Página de callback que processa tokens OAuth.",preview:e.jsxs(a,{className:"p-6 text-center space-y-4 max-w-sm mx-auto",children:[e.jsx("div",{className:"h-8 w-8 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),e.jsx("h3",{className:"font-semibold",children:"Processando Autenticação"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Processando tokens e redirecionando..."})]}),code:`import { CallbackPage } from 'forlogic-core';
|
|
163
|
-
|
|
164
|
-
// Adicionar rota para callback OAuth
|
|
165
|
-
<Route path="/callback" element={<CallbackPage />} />
|
|
166
|
-
|
|
167
|
-
// A CallbackPage automaticamente:
|
|
168
|
-
// 1. Extrai tokens da URL (query string ou hash)
|
|
169
|
-
// 2. Valida tokens com o AuthService
|
|
170
|
-
// 3. Gera token Supabase
|
|
171
|
-
// 4. Redireciona para página de origem (se salva)
|
|
172
|
-
// 5. Mostra erro com opção de retry se falhar
|
|
173
|
-
|
|
174
|
-
// A URL de callback deve ser configurada no Qualiex:
|
|
175
|
-
// https://seu-app.com/callback`},{title:"Configuração de Ambiente",description:"Variáveis de ambiente necessárias para autenticação.",preview:e.jsxs(r,{children:[e.jsx(n,{className:"h-4 w-4 text-green-500"}),e.jsx(c,{children:e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsx("p",{className:"font-medium",children:"Variáveis obrigatórias:"}),e.jsxs("code",{className:"block text-xs bg-muted p-2 rounded mt-2",children:["VITE_SUPABASE_URL",e.jsx("br",{}),"VITE_SUPABASE_PUBLISHABLE_KEY",e.jsx("br",{}),"VITE_QUALIEX_API_URL",e.jsx("br",{}),"VITE_QUALIEX_APP_ID"]})]})})]}),code:`# .env - Variáveis de ambiente
|
|
176
|
-
|
|
177
|
-
# Supabase
|
|
178
|
-
VITE_SUPABASE_URL=https://xyz.supabase.co
|
|
179
|
-
VITE_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
|
180
|
-
VITE_SUPABASE_PROJECT_ID=xyz
|
|
181
|
-
|
|
182
|
-
# Qualiex OAuth
|
|
183
|
-
VITE_QUALIEX_API_URL=https://api.qualiex.com
|
|
184
|
-
VITE_QUALIEX_APP_ID=minha-aplicacao
|
|
185
|
-
|
|
186
|
-
# Ambiente (opcional)
|
|
187
|
-
VITE_ENV=development # ou production
|
|
188
|
-
|
|
189
|
-
# A lib detecta automaticamente o ambiente:
|
|
190
|
-
// isDevEnvironment() retorna true se:
|
|
191
|
-
// - VITE_ENV === 'development'
|
|
192
|
-
// - ou hostname inclui 'localhost' ou 'preview'`}],props:[{name:"useAuth().user",type:"User | null",default:"null",description:"Dados do usuário autenticado."},{name:"useAuth().companies",type:"Company[]",default:"[]",description:"Lista de empresas/unidades disponíveis."},{name:"useAuth().alias",type:"string | null",default:"null",description:"Alias da empresa/unidade ativa."},{name:"useAuth().isAuthenticated",type:"boolean",default:"false",description:"Indica se usuário está autenticado."},{name:"useAuth().isLoading",type:"boolean",default:"true",description:"Indica se está inicializando."},{name:"useAuth().selectedUnit",type:"SelectedUnit | null",default:"null",description:"Unidade atualmente selecionada."},{name:"useAuth().logout",type:"() => void",default:"-",description:"Função para fazer logout."},{name:"useAuth().switchUnit",type:"(company: Company) => Promise<void>",default:"-",description:"Função para trocar de unidade."},{name:"useAuth().placeId",type:"string | null",default:"null",description:"ID do local do usuário."},{name:"useAuth().placeName",type:"string | null",default:"null",description:"Nome do local do usuário."},{name:"ProtectedRoute.children",type:"ReactNode",default:"-",description:"Conteúdo protegido a ser renderizado."}],accessibility:["Loading states são anunciados para leitores de tela.","Botões de login seguem padrões de acessibilidade.","Feedback de erro é apresentado de forma clara.","Focus management correto durante redirecionamentos."],notes:["**CoreProviders** já inclui AuthProvider - não precisa configurar separadamente.","Tokens são validados automaticamente a cada **5-10 minutos**.","Troca de unidade limpa automaticamente o cache do **React Query**.","Em **desenvolvimento**, use a edge function `dev-tokens` para gerar tokens de teste.","A URL de callback (/callback) deve estar configurada no **Qualiex OAuth**.","Locale fixo em **pt-BR** — preferências do usuário serão implementadas futuramente via API externa."]})}export{f as AuthDoc};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as a,ac as t,ad as r,ae as e}from"./index-CE0k7Rdh.js";import{C as s}from"./ComponentDocTemplate-CRbRY-v5.js";function i(){return a.jsx(s,{title:"Avatar",description:"Um elemento de imagem com fallback para representar o usuário.",component:a.jsxs("div",{className:"flex gap-4 items-center",children:[a.jsxs(t,{children:[a.jsx(r,{src:"https://github.com/shadcn.png",alt:"@shadcn"}),a.jsx(e,{children:"CN"})]}),a.jsx(t,{children:a.jsx(e,{children:"JD"})})]}),usage:`import { Avatar, AvatarImage, AvatarFallback } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<Avatar>
|
|
4
|
-
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
5
|
-
<AvatarFallback>CN</AvatarFallback>
|
|
6
|
-
</Avatar>`,examples:[{title:"Com Imagem",preview:a.jsxs(t,{children:[a.jsx(r,{src:"https://github.com/shadcn.png",alt:"User"}),a.jsx(e,{children:"CN"})]}),code:`<Avatar>
|
|
7
|
-
<AvatarImage src="..." />
|
|
8
|
-
<AvatarFallback>CN</AvatarFallback>
|
|
9
|
-
</Avatar>`},{title:"Apenas Fallback",preview:a.jsx(t,{children:a.jsx(e,{children:"JD"})}),code:`<Avatar>
|
|
10
|
-
<AvatarFallback>JD</AvatarFallback>
|
|
11
|
-
</Avatar>`}],props:[{name:"src",type:"string",default:"-",description:"A URL da fonte da imagem (AvatarImage)."},{name:"alt",type:"string",default:"-",description:"Texto alternativo para a imagem (AvatarImage)."}],accessibility:["Texto alternativo adequado para imagens","Fallback garante que o conteúdo seja sempre exibido","Estrutura HTML semântica"]})}export{i as AvatarDoc};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{j as a,B as e}from"./index-CE0k7Rdh.js";import{C as n}from"./ComponentDocTemplate-CRbRY-v5.js";function r(){return a.jsx(n,{title:"Badge",description:"Exibe um badge ou um componente que se parece com um badge.",component:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(e,{children:"Default"}),a.jsx(e,{variant:"secondary",children:"Secondary"}),a.jsx(e,{variant:"info",children:"Info"}),a.jsx(e,{variant:"success",children:"Success"}),a.jsx(e,{variant:"warning",children:"Warning"}),a.jsx(e,{variant:"danger",children:"Danger"}),a.jsx(e,{variant:"outline",children:"Outline"}),a.jsx(e,{variant:"sharp",children:"Sharp"})]}),usage:`import { Badge } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<Badge>Badge</Badge>
|
|
4
|
-
<Badge variant="secondary">Secondary</Badge>
|
|
5
|
-
<Badge variant="info">Info</Badge>
|
|
6
|
-
<Badge variant="success">Success</Badge>
|
|
7
|
-
<Badge variant="warning">Warning</Badge>
|
|
8
|
-
<Badge variant="danger">Danger</Badge>
|
|
9
|
-
<Badge variant="outline">Outline</Badge>
|
|
10
|
-
<Badge variant="sharp">Sharp</Badge>`,examples:[{title:"Todas as Variantes",preview:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(e,{children:"Default"}),a.jsx(e,{variant:"secondary",children:"Secondary"}),a.jsx(e,{variant:"info",children:"Info"}),a.jsx(e,{variant:"success",children:"Success"}),a.jsx(e,{variant:"warning",children:"Warning"}),a.jsx(e,{variant:"danger",children:"Danger"}),a.jsx(e,{variant:"outline",children:"Outline"}),a.jsx(e,{variant:"sharp",children:"Sharp"})]}),code:`<Badge>Default</Badge>
|
|
11
|
-
<Badge variant="secondary">Secondary</Badge>
|
|
12
|
-
<Badge variant="info">Info</Badge>
|
|
13
|
-
<Badge variant="success">Success</Badge>
|
|
14
|
-
<Badge variant="warning">Warning</Badge>
|
|
15
|
-
<Badge variant="danger">Danger</Badge>
|
|
16
|
-
<Badge variant="outline">Outline</Badge>
|
|
17
|
-
<Badge variant="sharp">Sharp</Badge>`},{title:"Variantes Semânticas",preview:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(e,{variant:"info",children:"Informativo"}),a.jsx(e,{variant:"success",children:"Aprovado"}),a.jsx(e,{variant:"warning",children:"Pendente"}),a.jsx(e,{variant:"danger",children:"Rejeitado"})]}),code:`<Badge variant="info">Informativo</Badge>
|
|
18
|
-
<Badge variant="success">Aprovado</Badge>
|
|
19
|
-
<Badge variant="warning">Pendente</Badge>
|
|
20
|
-
<Badge variant="danger">Rejeitado</Badge>`},{title:"Casos de Uso - Status",preview:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(e,{variant:"success",children:"Active"}),a.jsx(e,{variant:"warning",children:"Pending"}),a.jsx(e,{variant:"danger",children:"Inactive"}),a.jsx(e,{variant:"info",children:"Processing"})]}),code:`<Badge variant="success">Active</Badge>
|
|
21
|
-
<Badge variant="warning">Pending</Badge>
|
|
22
|
-
<Badge variant="danger">Inactive</Badge>
|
|
23
|
-
<Badge variant="info">Processing</Badge>`},{title:"Casos de Uso - Contadores",preview:a.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm",children:"Inbox"}),a.jsx(e,{variant:"secondary",children:"12"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm",children:"Notifications"}),a.jsx(e,{variant:"danger",children:"3"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm",children:"Updates"}),a.jsx(e,{variant:"info",children:"New"})]})]}),code:`<div className="flex items-center gap-2">
|
|
24
|
-
<span>Inbox</span>
|
|
25
|
-
<Badge variant="secondary">12</Badge>
|
|
26
|
-
</div>
|
|
27
|
-
<div className="flex items-center gap-2">
|
|
28
|
-
<span>Notifications</span>
|
|
29
|
-
<Badge variant="danger">3</Badge>
|
|
30
|
-
</div>
|
|
31
|
-
<div className="flex items-center gap-2">
|
|
32
|
-
<span>Updates</span>
|
|
33
|
-
<Badge variant="info">New</Badge>
|
|
34
|
-
</div>`},{title:"Casos de Uso - Tags",preview:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(e,{variant:"outline",children:"React"}),a.jsx(e,{variant:"outline",children:"TypeScript"}),a.jsx(e,{variant:"outline",children:"Tailwind CSS"}),a.jsx(e,{variant:"outline",children:"Supabase"})]}),code:`<Badge variant="outline">React</Badge>
|
|
35
|
-
<Badge variant="outline">TypeScript</Badge>
|
|
36
|
-
<Badge variant="outline">Tailwind CSS</Badge>`}],props:[{name:"variant",type:'"default" | "secondary" | "info" | "success" | "warning" | "danger" | "outline" | "sharp"',default:'"default"',description:"O estilo visual do badge."}],accessibility:["HTML semântico com taxas de contraste adequadas","Funciona com leitores de tela","Pode ser tornado interativo com labels ARIA adequadas se necessário"]})}export{r as BadgeDoc};
|