forlogic-core 2.0.3 → 2.0.5
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/features/crud-defaults-batteries-included.md +1 -1
- package/README.md +187 -917
- package/dist/components/ui/dialog-wizard.d.ts +82 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/input.d.ts +5 -23
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/step-selector.d.ts +11 -9
- package/dist/components/ui/textarea.d.ts +1 -0
- package/dist/crud/components/CrudTable.d.ts +3 -1
- package/dist/crud/createCrudPage.d.ts +2 -0
- package/dist/crud/hooks/useColumnManager.d.ts +3 -1
- package/dist/exports/ui.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/sidebar.d.ts +2 -1
- package/dist/types.d.ts +3 -0
- package/docs/AUDIT_PROMPT.md +74 -0
- package/docs/PROJECT_KNOWLEDGE_TEMPLATE.md +117 -0
- package/docs/PROMPT_TEMPLATE.md +77 -0
- package/docs/STARTER_TEMPLATE.md +114 -0
- package/docs/design-system/README.md +45 -0
- package/docs/design-system/buttons-actions.md +433 -0
- package/docs/design-system/charts-dashboards.md +547 -0
- package/docs/design-system/crud.md +243 -0
- package/docs/design-system/data-display.md +360 -0
- package/docs/design-system/dialogs.md +588 -0
- package/docs/design-system/domain.md +661 -0
- package/docs/design-system/examples.md +275 -0
- package/docs/design-system/foundation.md +82 -0
- package/docs/design-system/infra-utils.md +36 -0
- package/docs/design-system/inputs.md +556 -0
- package/docs/design-system/layout.md +351 -0
- package/docs/design-system/navigation.md +604 -0
- package/docs/design-system/notifications-feedback.md +139 -0
- package/docs/design-system/platform.md +95 -0
- package/docs/design-system/selectors.md +424 -0
- package/docs/design-system/tables-grids.md +114 -0
- package/package.json +2 -2
- package/dist/assets/AccordionDoc-CGNlubG3.js +0 -31
- package/dist/assets/ActionButtonDoc-CYtkXR0k.js +0 -47
- package/dist/assets/ActionPlanDoc-BSuPRftQ.js +0 -65
- package/dist/assets/AlertDoc-Cpvxneqg.js +0 -37
- package/dist/assets/AliasUrlDoc-DIpUWf4Y.js +0 -189
- package/dist/assets/AppHeaderDoc-DNQErj_t.js +0 -74
- package/dist/assets/AppSidebarDoc-DkeQarDu.js +0 -221
- package/dist/assets/ApprovalFlowDoc-8YgXbhKJ.js +0 -31
- package/dist/assets/AuditLogDoc-BBvNcHIo.js +0 -67
- package/dist/assets/AuditTrailDoc-DgFHO-uo.js +0 -17
- package/dist/assets/AuthDoc-WIA_Aetl.js +0 -200
- package/dist/assets/AvatarDoc-B6go1C1T.js +0 -11
- package/dist/assets/BadgeDoc-BONhfqB_.js +0 -36
- package/dist/assets/BaseFormDoc-CuyUArcj.js +0 -169
- package/dist/assets/BodyContentDoc-CterHC1E.js +0 -83
- package/dist/assets/BreadcrumbDoc-Dwn9nLeO.js +0 -75
- package/dist/assets/ButtonDoc-BOjRseZT.js +0 -41
- package/dist/assets/ButtonGroupDoc-8IS6PPh4.js +0 -7
- package/dist/assets/CalendarDoc-CMwIEqgT.js +0 -81
- package/dist/assets/CardDoc-BZz1CVg2.js +0 -49
- package/dist/assets/ChartDoc-B5vZVtqD.js +0 -76
- package/dist/assets/CheckboxDoc-lAbYO9I5.js +0 -55
- package/dist/assets/ColorPickerDoc-Dpsprp4N.js +0 -10
- package/dist/assets/ColorsFoundationDoc-CCHeSL3p.js +0 -13
- package/dist/assets/ComboTreeDoc-D4dTkIt-.js +0 -46
- package/dist/assets/ComboboxDoc-CqqZPvZq.js +0 -134
- package/dist/assets/ComponentDocTemplate-CQbBhfvZ.js +0 -1
- package/dist/assets/ContextMenuDoc-D3jC-MVA.js +0 -182
- package/dist/assets/ContextsDoc-XFH0-JdS.js +0 -211
- package/dist/assets/CreateCrudPageDoc-CpuiWI-g.js +0 -106
- package/dist/assets/CrudActionBarDoc-wuBGXD9Y.js +0 -112
- package/dist/assets/CrudGridDoc-BYWqSXBH.js +0 -85
- package/dist/assets/CrudOverviewDoc-B_bk2a2t.js +0 -14
- package/dist/assets/CrudPrimitivesDoc-CxaTB94A.js +0 -164
- package/dist/assets/CrudTableDoc-Dga1VgCu.js +0 -113
- package/dist/assets/CustomFormFieldsDoc-C1hwwSl3.js +0 -33
- package/dist/assets/DashboardFormDoc-BUDCmrMl.js +0 -49
- package/dist/assets/DashboardGeneralViewDoc-Cyg1SIiG.js +0 -71
- package/dist/assets/DashboardGridDoc-BavePiRF.js +0 -49
- package/dist/assets/DashboardListDoc-CLyMA6UK.js +0 -37
- package/dist/assets/DashboardOverviewDoc-DRVvNIF1.js +0 -35
- package/dist/assets/DashboardPanelRendererDoc--mfwb8Nc.js +0 -60
- package/dist/assets/DashboardPanelsBasicDoc-BQ2V_52D.js +0 -62
- package/dist/assets/DashboardPanelsCartesianDoc-sy-hcVQY.js +0 -75
- package/dist/assets/DashboardPanelsSpecialDoc-DsIUCRRP.js +0 -83
- package/dist/assets/DashboardViewDoc-CtlCNlEF.js +0 -45
- package/dist/assets/DataListDoc-DUy88lCQ.js +0 -13
- package/dist/assets/DesignSystemHome-DHl9YtbH.js +0 -1
- package/dist/assets/DialogDoc-CMQqnTV-.js +0 -981
- package/dist/assets/DropdownMenuDoc-S7X9csGt.js +0 -175
- package/dist/assets/ElectronicSignatureDialogDoc-BfithaL_.js +0 -57
- package/dist/assets/EmptyStateDoc-CHGCiGIk.js +0 -35
- package/dist/assets/EnvironmentsDoc-DZHJZ2nm.js +0 -96
- package/dist/assets/ErrorBoundaryDoc-DoaAg68p.js +0 -111
- package/dist/assets/ExampleActionPlanPage-C0fIMZCD.js +0 -1
- package/dist/assets/ExampleAppDoc-DzIU81Fn.js +0 -1
- package/dist/assets/ExampleCard-DuLrb3t-.js +0 -1
- package/dist/assets/ExampleCrudReportsPage-M0pz6tdM.js +0 -1
- package/dist/assets/ExampleDashboardPage-CRG5r3Vw.js +0 -1
- package/dist/assets/ExampleIdeasPage-I84ZMLY4.js +0 -1
- package/dist/assets/ExampleImportWizardPage-h4YqrrSe.js +0 -1
- package/dist/assets/ExampleSettingsPage-CwdWqoaP.js +0 -1
- package/dist/assets/FileUploadDoc-9-UujFNX.js +0 -34
- package/dist/assets/FilterBar-DDTqqUfZ.js +0 -1
- package/dist/assets/FormDoc-CVES6n3d.js +0 -81
- package/dist/assets/FoundationOverview-DT0u11Gz.js +0 -1
- package/dist/assets/GridDoc-CbHFSILF.js +0 -28
- package/dist/assets/HooksDoc-Ctxdk6Wq.js +0 -665
- package/dist/assets/HoverCardDoc-8Wkaafdj.js +0 -31
- package/dist/assets/I18nDoc-D3Q2m7ik.js +0 -167
- package/dist/assets/IconPickerDoc-DZ26Gdpg.js +0 -10
- package/dist/assets/IconsFoundationDoc-xOxtC7CW.js +0 -33
- package/dist/assets/InputDoc-BhztAiuJ.js +0 -211
- package/dist/assets/LabelDoc-A4hmTRRV.js +0 -42
- package/dist/assets/LeadershipDoc-CqOSfWsP.js +0 -452
- package/dist/assets/MediaDoc-C78gvC8p.js +0 -459
- package/dist/assets/MenubarDoc-DCnmd2tO.js +0 -165
- package/dist/assets/ModuleAccessDoc-CmD5nHDp.js +0 -153
- package/dist/assets/ModulesDialogDoc-DVit1CA-.js +0 -46
- package/dist/assets/MultiselectPermissionsDoc-tlJMs04L.js +0 -34
- package/dist/assets/NavigationMenuDoc-q1fbc89j.js +0 -116
- package/dist/assets/OnboardingDialogDoc-3A3eBYrq.js +0 -55
- package/dist/assets/PaginationDoc-B8-bMz5J.js +0 -27
- package/dist/assets/PaginationDoc-BkGdxHL3.js +0 -98
- package/dist/assets/PlacesDoc-CKPO6ATs.js +0 -226
- package/dist/assets/PopoverDoc-CJPU4Ags.js +0 -64
- package/dist/assets/ProgressDoc-CpjbTL4o.js +0 -29
- package/dist/assets/QualiexUserFieldDoc-DDwumlRw.js +0 -149
- package/dist/assets/RadioGroupDoc-D6tSZz8G.js +0 -57
- package/dist/assets/RadiusDoc-B4xSnajw.js +0 -7
- package/dist/assets/ReportRequestListDoc-C0LIaU8P.js +0 -15
- package/dist/assets/RequiredFieldsCounterDoc-COesoSdx.js +0 -58
- package/dist/assets/ResizableDoc-CW0-XQuB.js +0 -104
- package/dist/assets/RichTextEditorDoc-C8c_XA9P.js +0 -24
- package/dist/assets/ScrollAreaDoc-BxtoAPaZ.js +0 -28
- package/dist/assets/SecurityDoc-wOVqpg2F.js +0 -204
- package/dist/assets/SelectDoc-C75gtY9D.js +0 -80
- package/dist/assets/SeparatorDoc-BjQBPB1P.js +0 -4
- package/dist/assets/ServicesDoc-CXTctwBl.js +0 -308
- package/dist/assets/ShadowsDoc-C6Lw8_x2.js +0 -9
- package/dist/assets/SignDoc-Bh5ZUg5x.js +0 -66
- package/dist/assets/SkeletonDoc-rTLGK5VE.js +0 -54
- package/dist/assets/SliderDoc-JMAMDub7.js +0 -41
- package/dist/assets/SpacingDoc-RljOrpwA.js +0 -12
- package/dist/assets/SplitButtonDoc-CvShUW3w.js +0 -53
- package/dist/assets/StepSelectorDoc-C-nAap9H.js +0 -41
- package/dist/assets/SwitchDoc-DLnqmkPr.js +0 -56
- package/dist/assets/TableDoc-B8EpWLVg.js +0 -128
- package/dist/assets/TabsDoc-DIBtl_uC.js +0 -42
- package/dist/assets/TeamSelectorDoc-B7OnCbL7.js +0 -10
- package/dist/assets/TermsOfUseDoc-Bb-pw08s.js +0 -16
- package/dist/assets/TextareaDoc-DGnqMqEC.js +0 -46
- package/dist/assets/ToastDoc-DjYyc7ae.js +0 -157
- package/dist/assets/ToggleDoc-C9ZOVjkY.js +0 -51
- package/dist/assets/TooltipDoc-BEx4l9-i.js +0 -58
- package/dist/assets/TruncatedCellDoc-BbV1bRSY.js +0 -12
- package/dist/assets/TypographyFoundationDoc-CUDYjRo9.js +0 -7
- package/dist/assets/UpdatesNotificationDoc-7nyjzLMJ.js +0 -29
- package/dist/assets/UsersGroupsSelectorDoc-C0KlTAL5.js +0 -18
- package/dist/assets/UtilitiesDoc-DGxaHVV1.js +0 -145
- package/dist/assets/ViewerDialogsDoc-CnTPTEz0.js +0 -1
- package/dist/assets/blocks-B6LrJeAM.js +0 -1
- package/dist/assets/building-DeVappnD.js +0 -1
- package/dist/assets/calendar-days-BQ0na5kM.js +0 -1
- package/dist/assets/check-check-C_-PJCJa.js +0 -1
- package/dist/assets/circle-plus-CpIcep-O.js +0 -1
- package/dist/assets/circle-x-jPpBPew0.js +0 -1
- package/dist/assets/clipboard-list-CXNPdciZ.js +0 -1
- package/dist/assets/cloud-upload-BEjzumjl.js +0 -1
- package/dist/assets/crown-CqNsQIsm.js +0 -1
- package/dist/assets/date-picker-BW3eGOe_.js +0 -1
- package/dist/assets/disabled-menu-item-C2YaMvSt.js +0 -1
- package/dist/assets/drawer-D5rflIcD.js +0 -3
- package/dist/assets/file-braces-DFb5X9so.js +0 -1
- package/dist/assets/file-pen-line-CyUGKkEN.js +0 -1
- package/dist/assets/git-branch-BcXv9mpp.js +0 -1
- package/dist/assets/globe-CpMIWAcv.js +0 -1
- package/dist/assets/hash-cQWdKjya.js +0 -1
- package/dist/assets/hourglass-BahQ3eDv.js +0 -1
- package/dist/assets/hover-card-R66N85sZ.js +0 -1
- package/dist/assets/iframe-dialog-V0mW5aBb.js +0 -1
- package/dist/assets/index-DkiftrvI.js +0 -352
- package/dist/assets/index-nmBjO9Th.css +0 -1
- package/dist/assets/life-buoy-ByXiPddz.js +0 -1
- package/dist/assets/loading-state-Cb5_t5uE.js +0 -1
- package/dist/assets/lucide-react-Cp3Yw3Zm.js +0 -1
- package/dist/assets/package-B3-pVvPM.js +0 -1
- package/dist/assets/pen-Bi_lmmKT.js +0 -1
- package/dist/assets/pin-DVsSl8QA.js +0 -1
- package/dist/assets/printer-BnJ8B6m-.js +0 -1
- package/dist/assets/radio-group-BHAaNGsm.js +0 -1
- package/dist/assets/server-CtzFTfKR.js +0 -1
- package/dist/assets/share-2-Dv8Do445.js +0 -1
- package/dist/assets/shield-check-CFXjOV_w.js +0 -1
- package/dist/assets/shield-x-DJTRfVux.js +0 -1
- package/dist/assets/slider-v9tXBSnB.js +0 -1
- package/dist/assets/smartphone-BSNR60L7.js +0 -1
- package/dist/assets/step-selector-ATTh_9Wa.js +0 -1
- package/dist/assets/text-align-start-qE-MbYYw.js +0 -1
- package/dist/assets/thumbs-up-D_XIW_uX.js +0 -1
- package/dist/assets/trash-DTWQwpwA.js +0 -1
- package/dist/assets/trending-up-jip5-leJ.js +0 -1
- package/dist/assets/useMockCrud-CN4vjyOZ.js +0 -1
- package/dist/assets/user-check-BlH3EDWK.js +0 -1
- package/dist/assets/user-plus-BqwXwD-c.js +0 -1
- package/dist/index.html +0 -33
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import{j as e,x as a,aH as t,bp as n,aI as i}from"./index-DkiftrvI.js";import{C as d}from"./ComponentDocTemplate-CQbBhfvZ.js";import{H as r,a as o,b as s}from"./hover-card-R66N85sZ.js";import{C as l}from"./calendar-days-BQ0na5kM.js";import"./ExampleCard-DuLrb3t-.js";function C(){return e.jsx(d,{title:"Hover Card",description:"Para usuários com visão visualizarem conteúdo disponível por trás de um link. Exibe informações adicionais ao passar o mouse.",component:e.jsxs(r,{children:[e.jsx(o,{asChild:!0,children:e.jsx(a,{variant:"link",className:"p-0 h-auto",children:"@nextjs"})}),e.jsx(s,{className:"w-80",children:e.jsxs("div",{className:"flex justify-between space-x-4",children:[e.jsxs(t,{children:[e.jsx(n,{src:"https://github.com/vercel.png"}),e.jsx(i,{children:"VC"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"@nextjs"}),e.jsx("p",{className:"text-sm",children:"O framework React para a Web – utilizado por algumas das maiores empresas do mundo."}),e.jsxs("div",{className:"flex items-center pt-2",children:[e.jsx(l,{className:"mr-2 h-4 w-4 opacity-70"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Entrou em Dezembro de 2021"})]})]})]})})]}),usage:`import {
|
|
2
|
-
HoverCard,
|
|
3
|
-
HoverCardTrigger,
|
|
4
|
-
HoverCardContent,
|
|
5
|
-
Button
|
|
6
|
-
} from "forlogic-core"
|
|
7
|
-
|
|
8
|
-
<HoverCard>
|
|
9
|
-
<HoverCardTrigger asChild>
|
|
10
|
-
<Button variant="link">@nextjs</Button>
|
|
11
|
-
</HoverCardTrigger>
|
|
12
|
-
<HoverCardContent className="w-80">
|
|
13
|
-
<div className="flex space-x-4">
|
|
14
|
-
<Avatar>
|
|
15
|
-
<AvatarImage src="..." />
|
|
16
|
-
<AvatarFallback>VC</AvatarFallback>
|
|
17
|
-
</Avatar>
|
|
18
|
-
<div className="space-y-1">
|
|
19
|
-
<h4 className="text-sm font-semibold">@nextjs</h4>
|
|
20
|
-
<p className="text-sm">Descrição...</p>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</HoverCardContent>
|
|
24
|
-
</HoverCard>`,examples:[{title:"Uso Básico",preview:e.jsxs(r,{children:[e.jsx(o,{asChild:!0,children:e.jsx(a,{variant:"link",children:"Passe o mouse aqui"})}),e.jsx(s,{children:e.jsx("p",{className:"text-sm",children:"Conteúdo adicional exibido ao passar o mouse."})})]}),code:`<HoverCard>
|
|
25
|
-
<HoverCardTrigger asChild>
|
|
26
|
-
<Button variant="link">Passe o mouse</Button>
|
|
27
|
-
</HoverCardTrigger>
|
|
28
|
-
<HoverCardContent>
|
|
29
|
-
<p>Conteúdo adicional...</p>
|
|
30
|
-
</HoverCardContent>
|
|
31
|
-
</HoverCard>`}],props:[{name:"HoverCard.open",type:"boolean",default:"-",description:"Estado aberto controlado."},{name:"HoverCard.defaultOpen",type:"boolean",default:"false",description:"Estado aberto padrão."},{name:"HoverCard.onOpenChange",type:"(open: boolean) => void",default:"-",description:"Callback quando o estado muda."},{name:"HoverCard.openDelay",type:"number",default:"700",description:"Atraso para abrir (ms)."},{name:"HoverCard.closeDelay",type:"number",default:"300",description:"Atraso para fechar (ms)."},{name:"HoverCardTrigger.asChild",type:"boolean",default:"false",description:"Mescla props no elemento filho."},{name:"HoverCardContent.side",type:'"top" | "right" | "bottom" | "left"',default:'"bottom"',description:"Lado preferido."},{name:"HoverCardContent.sideOffset",type:"number",default:"4",description:"Distância do trigger (px)."},{name:"HoverCardContent.align",type:'"start" | "center" | "end"',default:'"center"',description:"Alinhamento."}],accessibility:["Projetado apenas para usuários com mouse (não focável por teclado)","Conteúdo não é anunciado para leitores de tela","Para conteúdo acessível, use Popover ou Dialog","Ideal para conteúdo suplementar não essencial","Respeita preferências de movimento reduzido do sistema"],notes:["⚠️ HoverCard é apenas para mouse - não é acessível via teclado","💡 Para conteúdo essencial, use Popover ou Dialog","💡 Ideal para previews de perfil, links, etc.","💡 Configure delays para evitar abertura acidental"]})}export{C as HoverCardDoc};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import{j as e,a as s,dW as r,dw as a,B as t,as as n,aK as i,aN as c,S as d}from"./index-DkiftrvI.js";import{C as l}from"./ComponentDocTemplate-CQbBhfvZ.js";import{P as o}from"./package-B3-pVvPM.js";import{F as p}from"./file-braces-DFb5X9so.js";import{G as m}from"./globe-CpMIWAcv.js";import"./ExampleCard-DuLrb3t-.js";function u(){return e.jsxs("div",{className:"space-y-6",children:[e.jsx(i,{children:e.jsxs(c,{className:"text-sm",children:["O i18n usa ",e.jsx("strong",{children:"namespaces"}),": a lib fornece o namespace ",e.jsx("code",{children:"core"})," com traduções base, e cada projeto consumidor injeta suas traduções no namespace ",e.jsx("code",{children:"app"}),". O ",e.jsx("code",{children:"t('key')"})," busca primeiro em ",e.jsx("code",{children:"app"}),", depois em ",e.jsx("code",{children:"core"}),"."]})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(s,{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-primary/10",children:e.jsx(r,{className:"h-5 w-5 text-primary"})}),e.jsx("h4",{className:"font-semibold",children:"Namespace core"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Traduções da lib (save, cancel, etc.) em ",e.jsx("code",{children:"lib/i18n/locales/"})]})]}),e.jsxs(s,{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(o,{className:"h-5 w-5 text-green-500"})}),e.jsx("h4",{className:"font-semibold",children:"Namespace app"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Traduções do projeto consumidor, injetadas via ",e.jsx("code",{children:"appTranslations"})," no CoreProviders"]})]}),e.jsxs(s,{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(d,{className:"h-5 w-5 text-orange-500"})}),e.jsx("h4",{className:"font-semibold",children:"CoreProviders"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Wrapper que configura i18n, injeta traduções do app e encapsula todos os providers"})]}),e.jsxs(s,{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-violet-500/10",children:e.jsx(m,{className:"h-5 w-5 text-violet-500"})}),e.jsx("h4",{className:"font-semibold",children:"LocaleContext"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Context React com locale fixo em pt-BR (futuramente via API externa)"})]})]})]})}function x(){return e.jsxs(s,{className:"p-4 space-y-4",children:[e.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[e.jsx(r,{className:"h-4 w-4"}),"Resolução de Namespaces"]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"p-3 rounded-lg bg-muted/50 font-mono text-xs",children:e.jsx("pre",{children:`t('save')
|
|
2
|
-
1. Busca em namespace 'app' → encontrou? usa
|
|
3
|
-
2. Fallback para namespace 'core' → "Salvar"
|
|
4
|
-
|
|
5
|
-
t('meu_campo_custom')
|
|
6
|
-
1. Busca em namespace 'app' → "Meu Campo"
|
|
7
|
-
2. (não chega ao core)`})}),e.jsxs("div",{className:"text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["• ",e.jsx("code",{children:"defaultNS: 'app'"})," — ",e.jsx("code",{children:"t('key')"})," busca primeiro no projeto"]}),e.jsxs("p",{children:["• ",e.jsx("code",{children:"fallbackNS: 'core'"})," — se não encontrar, busca na lib"]}),e.jsxs("p",{children:["• Projeto pode ",e.jsx("strong",{children:"sobrescrever"})," traduções da lib definindo a mesma chave em ",e.jsx("code",{children:"app"})]})]})]})]})}function j(){return e.jsxs(s,{className:"p-4 space-y-4",children:[e.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[e.jsx(o,{className:"h-4 w-4"}),"Setup do Projeto Consumidor"]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-green-500/5 border border-green-500/20",children:[e.jsx(a,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Passo 1: Criar JSONs de tradução"}),e.jsxs("p",{className:"text-muted-foreground",children:[e.jsx("code",{children:"src/i18n/pt-BR.json"})," com as traduções específicas do projeto"]})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-green-500/5 border border-green-500/20",children:[e.jsx(a,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Passo 2: Passar para CoreProviders"}),e.jsxs("p",{className:"text-muted-foreground",children:["Usar a prop ",e.jsx("code",{children:"appTranslations"})," para injetar no namespace ",e.jsx("code",{children:"app"})]})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-green-500/5 border border-green-500/20",children:[e.jsx(a,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Passo 3: Usar t() normalmente"}),e.jsxs("p",{className:"text-muted-foreground",children:[e.jsx("code",{children:"t('key')"})," busca em ",e.jsx("code",{children:"app"})," primeiro, fallback para ",e.jsx("code",{children:"core"})]})]})]})]})]})}function h(){return e.jsxs(s,{className:"p-4 bg-muted/50",children:[e.jsxs("h4",{className:"font-semibold mb-3 flex items-center gap-2",children:[e.jsx(p,{className:"h-4 w-4"}),"Estrutura de Arquivos"]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"p-3 rounded bg-background font-mono text-xs",children:e.jsx("pre",{children:`lib/i18n/
|
|
8
|
-
├── config.ts # Configuração i18next + addAppTranslations()
|
|
9
|
-
├── constants.ts # Locales, timezones, formatos
|
|
10
|
-
├── index.ts # Exports centralizados
|
|
11
|
-
└── locales/
|
|
12
|
-
├── pt-BR.json # { "save": "Salvar", "cancel": "Cancelar", ... }
|
|
13
|
-
├── en-US.json # { "save": "Save", "cancel": "Cancel", ... }
|
|
14
|
-
└── es-ES.json # { "save": "Guardar", "cancel": "Cancelar", ... }
|
|
15
|
-
|
|
16
|
-
# Projeto consumidor:
|
|
17
|
-
src/i18n/
|
|
18
|
-
├── pt-BR.json # { "my_field": "Meu Campo", ... }
|
|
19
|
-
├── en-US.json # { "my_field": "My Field", ... }
|
|
20
|
-
└── es-ES.json # { "my_field": "Mi Campo", ... }`})}),e.jsxs("div",{className:"text-muted-foreground space-y-1",children:[e.jsxs("p",{children:["• Formato ",e.jsx("strong",{children:"flat"}),": ",e.jsx("code",{children:'{ "chave": "valor" }'})," (compatível com Tolgee)"]}),e.jsx("p",{children:"• Um arquivo por idioma (padrão i18next)"}),e.jsxs("p",{children:["• Carregamento ",e.jsx("strong",{children:"síncrono"})," via import estático"]})]})]})]})}function f(){return e.jsxs(s,{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-violet-500/10",children:e.jsx(n,{className:"h-5 w-5 text-violet-500"})}),e.jsx("h4",{className:"font-semibold",children:"Conversão de Timezone"})]}),e.jsxs("div",{className:"text-sm space-y-2",children:[e.jsx("div",{className:"p-2 rounded bg-muted/50 font-mono text-xs",children:"UTC: 2024-03-15T17:30:00Z"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"🇧🇷 Brasília (UTC-3)"}),e.jsx("span",{className:"font-medium",children:"15/03/2024 14:30"})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"🇺🇸 New York (UTC-4)"}),e.jsx("span",{className:"font-medium",children:"03/15/2024 01:30 PM"})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b",children:[e.jsx("span",{className:"text-muted-foreground",children:"🇬🇧 Londres (UTC+0)"}),e.jsx("span",{className:"font-medium",children:"15/03/2024 17:30"})]}),e.jsxs("div",{className:"flex justify-between py-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"🇯🇵 Tóquio (UTC+9)"}),e.jsx("span",{className:"font-medium",children:"16/03/2024 02:30"})]})]})]})]})}function v(){return e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs(s,{className:"p-4 flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:"🇧🇷"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:["Português (Brasil)",e.jsx(t,{variant:"secondary",children:"Padrão"})]}),e.jsx("code",{className:"text-xs text-muted-foreground",children:"pt-BR"})]})]}),e.jsxs(s,{className:"p-4 flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:"🇺🇸"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"English (US)"}),e.jsx("code",{className:"text-xs text-muted-foreground",children:"en-US"})]})]}),e.jsxs(s,{className:"p-4 flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:"🇪🇸"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Español (España)"}),e.jsx("code",{className:"text-xs text-muted-foreground",children:"es-ES"})]})]})]})}function T(){return e.jsx(l,{title:"Internacionalização (i18n)",description:"Sistema de internacionalização com namespaces core/app. A lib fornece traduções base no namespace 'core' (lib/i18n/locales/). Projetos consumidores injetam suas traduções no namespace 'app' via prop appTranslations do CoreProviders. Resolução: app → core → fallback pt-BR.",component:e.jsx(u,{}),usage:`// ===== PROJETO CONSUMIDOR: SETUP COMPLETO =====
|
|
21
|
-
|
|
22
|
-
// 1. Criar arquivos de tradução do projeto
|
|
23
|
-
// src/i18n/pt-BR.json
|
|
24
|
-
// { "objective": "Objetivo", "key_result": "Resultado-chave" }
|
|
25
|
-
|
|
26
|
-
// 2. Importar e passar para CoreProviders
|
|
27
|
-
import { CoreProviders } from 'forlogic-core';
|
|
28
|
-
import ptBR from './i18n/pt-BR.json';
|
|
29
|
-
// import enUS from './i18n/en-US.json'; // quando tiver
|
|
30
|
-
|
|
31
|
-
function App() {
|
|
32
|
-
return (
|
|
33
|
-
<CoreProviders
|
|
34
|
-
moduleAlias="performance"
|
|
35
|
-
appTranslations={{
|
|
36
|
-
'pt-BR': ptBR,
|
|
37
|
-
// 'en-US': enUS,
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<BrowserRouter>
|
|
41
|
-
<Routes />
|
|
42
|
-
</BrowserRouter>
|
|
43
|
-
</CoreProviders>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// 3. Usar traduções nos componentes
|
|
48
|
-
import { useTranslation } from 'forlogic-core';
|
|
49
|
-
|
|
50
|
-
function MyComponent() {
|
|
51
|
-
const { t } = useTranslation();
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div>
|
|
55
|
-
{/* Busca em 'app' (projeto) → encontra */}
|
|
56
|
-
<h1>{t('objective')}</h1>
|
|
57
|
-
|
|
58
|
-
{/* Busca em 'app' → não encontra → fallback 'core' (lib) */}
|
|
59
|
-
<Button>{t('save')}</Button>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}`,examples:[{title:"Resolução de Namespaces (core/app)",description:"O t() busca primeiro no namespace app (projeto), depois no core (lib). Isso permite que o projeto sobrescreva traduções da lib.",preview:e.jsx(x,{}),code:`// Configuração interna (lib/i18n/config.ts):
|
|
63
|
-
i18n.init({
|
|
64
|
-
resources: {
|
|
65
|
-
'pt-BR': { core: ptBR }, // lib/i18n/locales/pt-BR.json
|
|
66
|
-
'en-US': { core: enUS },
|
|
67
|
-
'es-ES': { core: esES },
|
|
68
|
-
},
|
|
69
|
-
defaultNS: 'app', // t('key') busca primeiro aqui
|
|
70
|
-
fallbackNS: 'core', // se não encontrar, busca aqui
|
|
71
|
-
ns: ['core'],
|
|
72
|
-
fallbackLng: 'pt-BR',
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// O CoreProviders injeta traduções do projeto no namespace 'app':
|
|
76
|
-
export function addAppTranslations(lang: string, translations: Record<string, string>) {
|
|
77
|
-
i18n.addResourceBundle(lang, 'app', translations, true, true);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Resultado:
|
|
81
|
-
// t('save') → app.save || core.save → "Salvar"
|
|
82
|
-
// t('objective') → app.objective → "Objetivo"
|
|
83
|
-
// t('save', 'Fallback') → safety net se nenhum namespace tiver a chave`},{title:"Setup do Projeto Consumidor",description:"Apenas 3 passos: criar JSONs, passar para CoreProviders, e usar t(). Sem tabela Supabase, sem await, sem configuração extra.",preview:e.jsx(j,{}),code:`// ===== PASSO 1: Criar JSONs de tradução =====
|
|
84
|
-
// src/i18n/pt-BR.json
|
|
85
|
-
{
|
|
86
|
-
"objective": "Objetivo",
|
|
87
|
-
"key_result": "Resultado-chave",
|
|
88
|
-
"cycle": "Ciclo",
|
|
89
|
-
"progress": "Progresso"
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// ===== PASSO 2: Passar para CoreProviders =====
|
|
93
|
-
// src/App.tsx
|
|
94
|
-
import { CoreProviders } from 'forlogic-core';
|
|
95
|
-
import ptBR from './i18n/pt-BR.json';
|
|
96
|
-
|
|
97
|
-
function App() {
|
|
98
|
-
return (
|
|
99
|
-
<CoreProviders
|
|
100
|
-
moduleAlias="performance"
|
|
101
|
-
appTranslations={{ 'pt-BR': ptBR }}
|
|
102
|
-
>
|
|
103
|
-
<BrowserRouter>
|
|
104
|
-
<Routes />
|
|
105
|
-
</BrowserRouter>
|
|
106
|
-
</CoreProviders>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ===== PASSO 3: Usar t() normalmente =====
|
|
111
|
-
import { useTranslation } from 'forlogic-core';
|
|
112
|
-
// ❌ NUNCA: import { useTranslation } from 'react-i18next';
|
|
113
|
-
|
|
114
|
-
function MeuComponente() {
|
|
115
|
-
const { t } = useTranslation();
|
|
116
|
-
return <h1>{t('objective')}</h1>; // "Objetivo"
|
|
117
|
-
}`},{title:"Estrutura de Arquivos",description:"JSONs por idioma no formato flat — compatível com Tolgee CLI para futuro gerenciamento externo de traduções",preview:e.jsx(h,{}),code:`// Formato dos JSONs (flat, sem nesting):
|
|
118
|
-
// lib/i18n/locales/pt-BR.json (namespace core — lib)
|
|
119
|
-
{
|
|
120
|
-
"save": "Salvar",
|
|
121
|
-
"cancel": "Cancelar",
|
|
122
|
-
"delete": "Excluir",
|
|
123
|
-
"confirm": "Confirmar",
|
|
124
|
-
"loading": "Carregando..."
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/i18n/pt-BR.json (namespace app — projeto)
|
|
128
|
-
{
|
|
129
|
-
"objective": "Objetivo",
|
|
130
|
-
"key_result": "Resultado-chave",
|
|
131
|
-
"cycle": "Ciclo"
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Suporta interpolação:
|
|
135
|
-
// { "hello_user": "Olá, {{name}}!" }
|
|
136
|
-
// t('hello_user', { name: 'João' }) → "Olá, João!"
|
|
137
|
-
|
|
138
|
-
// Futuro: Tolgee CLI para sincronizar
|
|
139
|
-
// tolgee pull --path src/i18n/`},{title:"Idiomas Suportados",description:"O sistema suporta 3 idiomas com fallback automático para português",preview:e.jsx(v,{}),code:`// Idiomas configurados em lib/i18n/config.ts
|
|
140
|
-
// fallbackLng: 'pt-BR' — sempre cai para português se não encontrar
|
|
141
|
-
|
|
142
|
-
// Prioridade de resolução para t('save'):
|
|
143
|
-
// 1. Idioma atual, namespace 'app' (projeto)
|
|
144
|
-
// 2. Idioma atual, namespace 'core' (lib)
|
|
145
|
-
// 3. fallbackLng 'pt-BR', namespace 'app'
|
|
146
|
-
// 4. fallbackLng 'pt-BR', namespace 'core'
|
|
147
|
-
// 5. Retorna a própria chave: "save"`},{title:"useI18nFormatters Hook",description:"Hook RECOMENDADO para formatação de datas. Converte automaticamente para o timezone do usuário.",preview:e.jsx(f,{}),code:`import { useI18nFormatters } from 'forlogic-core';
|
|
148
|
-
|
|
149
|
-
function ActivityLog() {
|
|
150
|
-
const { formatDatetime, formatDate } = useI18nFormatters();
|
|
151
|
-
|
|
152
|
-
const createdAt = "2024-03-15T17:30:00Z"; // UTC
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<div>
|
|
156
|
-
<p>Criado em: {formatDatetime(createdAt)}</p>
|
|
157
|
-
{/* → "15/03/2024 14:30" (Brasília UTC-3) */}
|
|
158
|
-
|
|
159
|
-
<p>Data: {formatDate(createdAt)}</p>
|
|
160
|
-
{/* → "15 de mar. de 2024" */}
|
|
161
|
-
</div>
|
|
162
|
-
);
|
|
163
|
-
}`},{title:"Constantes Centralizadas",description:"Todas as opções de localização estão centralizadas em lib/i18n/constants.ts",preview:e.jsxs(s,{className:"p-4 space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Constantes exportadas:"}),e.jsxs("div",{className:"text-sm space-y-2",children:[e.jsxs("p",{children:["• ",e.jsx("code",{children:"SUPPORTED_LOCALES"})," - pt-BR, en-US, es-ES"]}),e.jsxs("p",{children:["• ",e.jsx("code",{children:"DATETIME_FORMATS"})," - 6 formatos de data/hora"]}),e.jsxs("p",{children:["• ",e.jsx("code",{children:"TIMEZONES"})," - 12 fusos horários"]}),e.jsxs("p",{children:["• ",e.jsx("code",{children:"DEFAULT_*"})," - Valores padrão (fallback)"]}),e.jsxs("p",{children:["• ",e.jsx("code",{children:"detectBrowserPreferences()"})," - Detecta do navegador"]})]})]}),code:`import {
|
|
164
|
-
SUPPORTED_LOCALES, DATETIME_FORMATS, TIMEZONES,
|
|
165
|
-
DEFAULT_LOCALE, DEFAULT_DATETIME_FORMAT, DEFAULT_TIMEZONE,
|
|
166
|
-
detectBrowserLocale, detectBrowserTimezone,
|
|
167
|
-
} from 'forlogic-core';`}],props:[{name:"appTranslations",type:"Record<string, Record<string, string>>",default:"-",description:"Prop do CoreProviders. Mapa de idioma → traduções do projeto. Injetadas no namespace app."},{name:"addAppTranslations",type:"(lang, translations) => void",default:"-",description:"Helper para injetar traduções no namespace app manualmente (alternativa ao CoreProviders)."},{name:"useTranslation",type:"hook",default:"-",description:"Hook principal. Retorna { t, i18n }. SEMPRE importar de forlogic-core, NUNCA de react-i18next."},{name:"useLocale",type:"hook",default:"-",description:"Hook para acessar locale fixo em pt-BR (futuramente via API externa)."},{name:"useI18nFormatters",type:"hook",default:"-",description:"Hook RECOMENDADO para formatação de datas respeitando timezone do usuário."},{name:"SUPPORTED_LOCALES",type:"const",default:"-",description:"Array com locales suportados: pt-BR, en-US, es-ES."},{name:"DEFAULT_LOCALE",type:"const",default:"pt-BR",description:"Locale padrão de fallback."}],accessibility:["Traduções são carregadas de forma síncrona (sem loading/flash)","Fallback automático: app → core → pt-BR → chave","Projetos consumidores podem sobrescrever traduções da lib","Padrão t('key', 'Fallback') continua como safety net"],notes:["**Namespaces**: defaultNS = `app` (projeto), fallbackNS = `core` (lib). O t() busca automaticamente nos dois.","**Import obrigatório**: Sempre importar `useTranslation` de `forlogic-core`, NUNCA de `react-i18next` (evita conflito de instâncias).",'**Formato**: JSONs flat por idioma (`{ "key": "value" }`), compatível com Tolgee CLI.',"**CoreProviders**: Usar prop `appTranslations` é a forma recomendada de injetar traduções do projeto.","**Sem Supabase**: Traduções são estáticas, carregadas via import — sem dependência de rede ou banco."]})}export{T as I18nDoc};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{r as i,j as o,f7 as a,aR as c}from"./index-DkiftrvI.js";import{C as m}from"./ComponentDocTemplate-CQbBhfvZ.js";import{L as n}from"./lucide-react-Cp3Yw3Zm.js";import"./ExampleCard-DuLrb3t-.js";import"./pin-DVsSl8QA.js";import"./building-DeVappnD.js";import"./hash-cQWdKjya.js";import"./blocks-B6LrJeAM.js";import"./calendar-days-BQ0na5kM.js";import"./check-check-C_-PJCJa.js";import"./circle-plus-CpIcep-O.js";import"./circle-x-jPpBPew0.js";import"./clipboard-list-CXNPdciZ.js";import"./cloud-upload-BEjzumjl.js";import"./life-buoy-ByXiPddz.js";import"./share-2-Dv8Do445.js";import"./crown-CqNsQIsm.js";import"./file-braces-DFb5X9so.js";import"./file-pen-line-CyUGKkEN.js";import"./git-branch-BcXv9mpp.js";import"./globe-CpMIWAcv.js";import"./shield-x-DJTRfVux.js";import"./hourglass-BahQ3eDv.js";import"./package-B3-pVvPM.js";import"./smartphone-BSNR60L7.js";import"./pen-Bi_lmmKT.js";import"./printer-BnJ8B6m-.js";import"./server-CtzFTfKR.js";import"./shield-check-CFXjOV_w.js";import"./text-align-start-qE-MbYYw.js";import"./thumbs-up-D_XIW_uX.js";import"./trash-DTWQwpwA.js";import"./trending-up-jip5-leJ.js";import"./user-check-BlH3EDWK.js";import"./user-plus-BqwXwD-c.js";function O(){const[e,t]=i.useState("Star"),r=n[e]||c;return o.jsx(m,{title:"Icon Picker",description:"Seletor de ícones da biblioteca Lucide React com busca integrada.",component:o.jsxs("div",{className:"w-[300px]",children:[o.jsx(a,{value:e,onChange:t,label:"Escolha um ícone"}),o.jsxs("div",{className:"mt-4 p-4 rounded-md border bg-card flex items-center gap-3",children:[o.jsx(r,{className:"h-6 w-6 text-primary"}),o.jsxs("p",{className:"font-medium",children:["Ícone selecionado: ",e]})]})]}),usage:`import { IconPicker } from "forlogic-core"
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
const [icon, setIcon] = useState('Star')
|
|
5
|
-
|
|
6
|
-
<IconPicker
|
|
7
|
-
value={icon}
|
|
8
|
-
onChange={setIcon}
|
|
9
|
-
label="Escolha um ícone"
|
|
10
|
-
/>`,props:[{name:"value",type:"string",default:"Star",description:"Nome do ícone selecionado (Lucide React)."},{name:"onChange",type:"(iconName: string) => void",default:"-",description:"Callback quando o ícone é alterado."},{name:"label",type:"string",default:"-",description:"Label opcional para o campo."}],accessibility:["Busca por nome do ícone","Grid acessível por teclado","Títulos descritivos em cada ícone","Indicador visual de seleção","Scroll area com navegação adequada"]})}export{O as IconPickerDoc};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import{r as m,j as e,B as y,a as c,b as d,c as i,e as n,K as S,d as o,x as N,aP as k,aQ as T,aR as L,aS as u,aT as P,aU as v,Y as E}from"./index-DkiftrvI.js";import{L as H,S as D}from"./lucide-react-Cp3Yw3Zm.js";import{G as M}from"./life-buoy-ByXiPddz.js";import"./pin-DVsSl8QA.js";import"./building-DeVappnD.js";import"./hash-cQWdKjya.js";import"./blocks-B6LrJeAM.js";import"./calendar-days-BQ0na5kM.js";import"./check-check-C_-PJCJa.js";import"./circle-plus-CpIcep-O.js";import"./circle-x-jPpBPew0.js";import"./clipboard-list-CXNPdciZ.js";import"./cloud-upload-BEjzumjl.js";import"./share-2-Dv8Do445.js";import"./crown-CqNsQIsm.js";import"./file-braces-DFb5X9so.js";import"./file-pen-line-CyUGKkEN.js";import"./git-branch-BcXv9mpp.js";import"./globe-CpMIWAcv.js";import"./shield-x-DJTRfVux.js";import"./hourglass-BahQ3eDv.js";import"./package-B3-pVvPM.js";import"./smartphone-BSNR60L7.js";import"./pen-Bi_lmmKT.js";import"./printer-BnJ8B6m-.js";import"./server-CtzFTfKR.js";import"./shield-check-CFXjOV_w.js";import"./text-align-start-qE-MbYYw.js";import"./thumbs-up-D_XIW_uX.js";import"./trash-DTWQwpwA.js";import"./trending-up-jip5-leJ.js";import"./user-check-BlH3EDWK.js";import"./user-plus-BqwXwD-c.js";const z=["createLucideIcon","default","icons","Icon","LucideIcon","IconNode","LucideProps","createElement"];function ue(){const[x,w]=m.useState(""),[C,g]=m.useState(null),[r,j]=m.useState(1),f=120,h=m.useMemo(()=>Object.entries(H).filter(([s,t])=>!(z.includes(s)||!t||typeof t!="function"&&typeof t!="object"||s.startsWith("Lucide")||typeof t=="object"&&!("$$typeof"in t))).map(([s,t])=>({name:s,Icon:t})),[]),p=m.useMemo(()=>{if(!x.trim())return h;const s=x.toLowerCase();return h.filter(({name:t})=>t.toLowerCase().includes(s))},[h,x]);m.useMemo(()=>{j(1)},[x]);const a=Math.ceil(p.length/f),b=m.useMemo(()=>{const s=(r-1)*f;return p.slice(s,s+f)},[p,r]),I=s=>{const t=`import { ${s} } from 'lucide-react';`;navigator.clipboard.writeText(t),g(s),E.success(`Import de ${s} copiado!`),setTimeout(()=>g(null),2e3)};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-bold mb-4",children:"Ícones"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:"Biblioteca completa de ícones usando Lucide React - uma biblioteca de ícones open-source com mais de 1400 ícones em SVG."}),e.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[e.jsxs(y,{variant:"secondary",children:[h.length," ícones disponíveis"]}),e.jsx(y,{variant:"outline",children:"lucide-react"})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Galeria de Ícones"}),e.jsxs(n,{children:["Clique em um ícone para copiar o import. Mostrando ",b.length," de ",p.length," ícones",p.length!==h.length&&` (${h.length} total)`,"."]}),e.jsx("div",{className:"mt-4 flex items-center gap-4",children:e.jsx(S,{type:"text",placeholder:"Buscar ícones...",value:x,onChange:s=>w(s.target.value),className:"max-w-sm"})})]}),e.jsxs(o,{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-6 sm:grid-cols-8 md:grid-cols-10 lg:grid-cols-12 gap-2",children:b.map(({name:s,Icon:t})=>e.jsxs("button",{onClick:()=>I(s),className:`flex flex-col items-center justify-center p-3 rounded-md border hover:bg-accent hover:border-primary transition-all group ${C===s?"bg-primary/10 border-primary":""}`,title:s,children:[e.jsx(t,{className:"h-5 w-5 group-hover:text-primary transition-colors"}),e.jsx("span",{className:"text-[9px] mt-1.5 text-muted-foreground truncate w-full text-center",children:s.length>8?`${s.slice(0,8)}...`:s})]},s))}),p.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(D,{className:"h-12 w-12 mb-4"}),e.jsxs("p",{children:['Nenhum ícone encontrado para "',x,'"']})]}),a>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 pt-4 border-t",children:[e.jsx(N,{variant:"outline",size:"sm",onClick:()=>j(s=>Math.max(1,s-1)),disabled:r===1,children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,a)},(s,t)=>{let l;return a<=5||r<=3?l=t+1:r>=a-2?l=a-4+t:l=r-2+t,e.jsx(N,{variant:r===l?"default":"outline",size:"sm",onClick:()=>j(l),className:"w-8",children:l},l)})}),e.jsx(N,{variant:"outline",size:"sm",onClick:()=>j(s=>Math.min(a,s+1)),disabled:r===a,children:e.jsx(T,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["Página ",r," de ",a]})]})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Instalação"}),e.jsx(n,{children:"Como instalar e usar a biblioteca de ícones"})]}),e.jsxs(o,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"1. Instalação"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm overflow-x-auto",children:"npm install lucide-react"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"2. Importação Individual (Recomendado)"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm overflow-x-auto",children:`import { Home, Settings, User, Search } from 'lucide-react';
|
|
2
|
-
|
|
3
|
-
function MyComponent() {
|
|
4
|
-
return (
|
|
5
|
-
<div>
|
|
6
|
-
<Home className="h-6 w-6" />
|
|
7
|
-
<Settings className="h-6 w-6 text-muted-foreground" />
|
|
8
|
-
<User className="h-6 w-6 text-primary" />
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
}`})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"3. Ícone Dinâmico"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm overflow-x-auto",children:`import { icons } from 'lucide-react';
|
|
12
|
-
|
|
13
|
-
function DynamicIcon({ name, ...props }: { name: keyof typeof icons }) {
|
|
14
|
-
const LucideIcon = icons[name];
|
|
15
|
-
return <LucideIcon {...props} />;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Uso
|
|
19
|
-
<DynamicIcon name="Home" className="h-5 w-5" />`})]})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Propriedades"}),e.jsx(n,{children:"Props disponíveis para todos os ícones"})]}),e.jsx(o,{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 py-2 pr-4 font-semibold",children:"Prop"}),e.jsx("th",{className:"text-left py-2 pr-4 font-semibold",children:"Tipo"}),e.jsx("th",{className:"text-left py-2 pr-4 font-semibold",children:"Default"}),e.jsx("th",{className:"text-left py-2 font-semibold",children:"Descrição"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"size"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"number"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"24"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"Tamanho do ícone em pixels"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"color"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"string"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"currentColor"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"Cor do ícone"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"strokeWidth"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"number"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"2"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"Espessura do traço"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"absoluteStrokeWidth"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"boolean"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"false"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"Se verdadeiro, a espessura não escala com o tamanho"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"className"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"string"}),e.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:"-"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"Classes CSS (preferido para estilização)"})]})]})]})})})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Tamanhos"}),e.jsx(n,{children:"Exemplos de diferentes tamanhos de ícones"})]}),e.jsxs(o,{children:[e.jsx("div",{className:"flex items-end gap-6 flex-wrap",children:[16,20,24,32,40,48].map(s=>e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(L,{size:s,className:"text-primary"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s,"px"]})]},s))}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm mt-4 overflow-x-auto",children:`<Star size={16} />
|
|
20
|
-
<Star className="h-5 w-5" /> {/* 20px - Tailwind */}
|
|
21
|
-
<Star className="h-6 w-6" /> {/* 24px - Default */}
|
|
22
|
-
<Star size={32} />
|
|
23
|
-
<Star className="h-10 w-10" /> {/* 40px */}
|
|
24
|
-
<Star size={48} />`})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Cores"}),e.jsx(n,{children:"Use classes Tailwind para definir cores semânticas"})]}),e.jsxs(o,{children:[e.jsxs("div",{className:"flex items-center gap-6 flex-wrap",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"default"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8 text-primary"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"primary"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"muted"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8 text-destructive"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"destructive"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8 text-success"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"success"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(u,{className:"h-8 w-8 text-warning"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"warning"})]})]}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm mt-4 overflow-x-auto",children:`<Heart className="h-8 w-8" /> {/* currentColor */}
|
|
25
|
-
<Heart className="h-8 w-8 text-primary" /> {/* cor primária */}
|
|
26
|
-
<Heart className="h-8 w-8 text-muted-foreground" /> {/* cor muted */}
|
|
27
|
-
<Heart className="h-8 w-8 text-destructive" /> {/* cor de erro */}
|
|
28
|
-
<Heart className="h-8 w-8 text-success" /> {/* cor de sucesso */}
|
|
29
|
-
<Heart className="h-8 w-8 text-warning" /> {/* cor de aviso */}`})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Espessura do Traço"}),e.jsx(n,{children:"Personalize a espessura do traço dos ícones"})]}),e.jsxs(o,{children:[e.jsx("div",{className:"flex items-center gap-6 flex-wrap",children:[1,1.5,2,2.5,3].map(s=>e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(P,{size:32,strokeWidth:s,className:"text-primary"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s})]},s))}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-sm mt-4 overflow-x-auto",children:`<Circle strokeWidth={1} /> {/* fino */}
|
|
30
|
-
<Circle strokeWidth={1.5} /> {/* leve */}
|
|
31
|
-
<Circle strokeWidth={2} /> {/* padrão */}
|
|
32
|
-
<Circle strokeWidth={2.5} /> {/* médio */}
|
|
33
|
-
<Circle strokeWidth={3} /> {/* grosso */}`})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Boas Práticas"}),e.jsx(n,{children:"Diretrizes para uso consistente de ícones"})]}),e.jsxs(o,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2 text-green-600 dark:text-green-400",children:"✅ Faça"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Use importações individuais para melhor tree-shaking"}),e.jsxs("li",{children:["Prefira ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"className"})," para estilização via Tailwind"]}),e.jsx("li",{children:"Use tamanhos consistentes em contextos similares (h-4 w-4 para botões, h-5 w-5 para menus)"}),e.jsx("li",{children:"Use cores semânticas do design system (text-primary, text-muted-foreground)"}),e.jsxs("li",{children:["Adicione ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:'aria-hidden="true"'})," para ícones decorativos"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2 text-red-600 dark:text-red-400",children:"❌ Não Faça"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["Não importe todos os ícones com ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"import * as Icons"})]}),e.jsxs("li",{children:["Não use cores hardcoded como ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:'color="#ff0000"'})]}),e.jsx("li",{children:"Não misture tamanhos inconsistentes na mesma interface"}),e.jsx("li",{children:"Não use ícones sem texto ou label para ações importantes"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Padrões de Tamanho Recomendados"}),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 py-2 pr-4 font-semibold",children:"Contexto"}),e.jsx("th",{className:"text-left py-2 pr-4 font-semibold",children:"Classe Tailwind"}),e.jsx("th",{className:"text-left py-2 font-semibold",children:"Tamanho"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4",children:"Botões pequenos"}),e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"h-3.5 w-3.5"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"14px"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4",children:"Botões e inputs"}),e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"h-4 w-4"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"16px"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4",children:"Menus e listas"}),e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"h-5 w-5"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"20px"})]}),e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4",children:"Headers e destaque"}),e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"h-6 w-6"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"24px"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4",children:"Empty states"}),e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:"h-12 w-12"}),e.jsx("td",{className:"py-2 text-muted-foreground",children:"48px"})]})]})]})})]})]})]}),e.jsxs(c,{children:[e.jsxs(d,{children:[e.jsx(i,{children:"Links Úteis"}),e.jsx(n,{children:"Recursos adicionais da biblioteca Lucide"})]}),e.jsx(o,{children:e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary hover:underline",children:[e.jsx(v,{className:"h-4 w-4"}),"Catálogo Oficial"]}),e.jsxs("a",{href:"https://lucide.dev/guide/packages/lucide-react",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary hover:underline",children:[e.jsx(v,{className:"h-4 w-4"}),"Documentação React"]}),e.jsxs("a",{href:"https://github.com/lucide-icons/lucide",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary hover:underline",children:[e.jsx(M,{className:"h-4 w-4"}),"GitHub"]})]})})]})]})}export{ue as IconsFoundationDoc};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e,o as m,K as s,x as N,M as w,aZ as G,J as a,b0 as h,d7 as C,a1 as v,ee as A,ew as S,dZ as L,bs as b,dp as F,e0 as k,dD as E,aX as T,a$ as B}from"./index-DkiftrvI.js";import{C as D}from"./ComponentDocTemplate-CQbBhfvZ.js";import{D as P,A as V,H as q}from"./hash-cQWdKjya.js";import"./ExampleCard-DuLrb3t-.js";const t=d.forwardRef(({className:l,...i},n)=>e.jsx("div",{ref:n,"data-slot":"input-group",className:m("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",l),...i}));t.displayName="InputGroup";const z=G("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),o=d.forwardRef(({className:l,align:i,...n},p)=>e.jsx("div",{ref:p,"data-slot":"input-group-addon",className:m(z({align:i}),l),...n}));o.displayName="InputGroupAddon";const M=G("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),c=d.forwardRef(({className:l,size:i,variant:n="ghost",...p},x)=>e.jsx(N,{ref:x,"data-slot":"input-group-button",variant:n,className:m(M({size:i}),"rounded-none first:rounded-l-md last:rounded-r-md",l),...p}));c.displayName="InputGroupButton";const r=d.forwardRef(({className:l,...i},n)=>e.jsx(s,{ref:n,"data-slot":"input-group-control",className:m("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",l),...i}));r.displayName="InputGroupInput";const j=d.forwardRef(({className:l,...i},n)=>e.jsx(w,{ref:n,"data-slot":"input-group-control",className:m("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",l),...i}));j.displayName="InputGroupTextarea";const R=`import { Input, Label } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
// Input básico
|
|
4
|
-
<Input placeholder="Digite algo..." />
|
|
5
|
-
|
|
6
|
-
// Com Label
|
|
7
|
-
<div className="grid w-full items-center gap-1.5">
|
|
8
|
-
<Label htmlFor="email">Email</Label>
|
|
9
|
-
<Input type="email" id="email" placeholder="email@exemplo.com" />
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
// InputGroup com prefixo e sufixo
|
|
13
|
-
import { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton } from "forlogic-core"
|
|
14
|
-
|
|
15
|
-
<InputGroup>
|
|
16
|
-
<InputGroupAddon align="inline-start">https://</InputGroupAddon>
|
|
17
|
-
<InputGroupInput placeholder="exemplo.com" />
|
|
18
|
-
<InputGroupAddon align="inline-end">.com.br</InputGroupAddon>
|
|
19
|
-
</InputGroup>`;function W(){const[l,i]=d.useState(!1),[n,p]=d.useState(!1),[x,f]=d.useState(""),[g,I]=d.useState(""),y=()=>{p(!0),setTimeout(()=>p(!1),1e3)};return e.jsx(D,{title:"Input",description:"Campo de entrada de texto com suporte a todos os tipos HTML. Inclui Label para rótulos acessíveis e InputGroup para agrupar inputs com addons de prefixo, sufixo, ícones e botões.",component:e.jsx(s,{placeholder:"Digite algo...",className:"max-w-sm"}),usage:R,examples:[{title:"Tipos de Input",description:"Suporta todos os tipos HTML nativos com estilização consistente",preview:e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-lg",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"text-example",children:"Texto"}),e.jsx(s,{type:"text",id:"text-example",placeholder:"Nome completo"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"email-example",children:"Email"}),e.jsx(s,{type:"email",id:"email-example",placeholder:"email@exemplo.com"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"password-example",children:"Senha"}),e.jsx(s,{type:"password",id:"password-example",placeholder:"••••••••"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"number-example",children:"Número"}),e.jsx(s,{type:"number",id:"number-example",placeholder:"0"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"tel-example",children:"Telefone"}),e.jsx(s,{type:"tel",id:"tel-example",placeholder:"(11) 99999-9999"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"url-example",children:"URL"}),e.jsx(s,{type:"url",id:"url-example",placeholder:"https://..."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"date-example",children:"Data"}),e.jsx(s,{type:"date",id:"date-example"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"search-example",children:"Busca"}),e.jsx(s,{type:"search",id:"search-example",placeholder:"Pesquisar..."})]})]}),code:`<Input type="text" placeholder="Nome completo" />
|
|
20
|
-
<Input type="email" placeholder="email@exemplo.com" />
|
|
21
|
-
<Input type="password" placeholder="••••••••" />
|
|
22
|
-
<Input type="number" placeholder="0" />
|
|
23
|
-
<Input type="tel" placeholder="(11) 99999-9999" />
|
|
24
|
-
<Input type="url" placeholder="https://..." />
|
|
25
|
-
<Input type="date" />
|
|
26
|
-
<Input type="search" placeholder="Pesquisar..." />`},{title:"Com Label",description:"Use Label com htmlFor para associar corretamente ao input e melhorar acessibilidade",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-sm",children:[e.jsxs("div",{className:"grid w-full items-center gap-1.5",children:[e.jsx(a,{htmlFor:"name",children:"Nome *"}),e.jsx(s,{type:"text",id:"name",placeholder:"Seu nome completo"})]}),e.jsxs("div",{className:"grid w-full items-center gap-1.5",children:[e.jsx(a,{htmlFor:"email-label",children:"Email *"}),e.jsx(s,{type:"email",id:"email-label",placeholder:"email@exemplo.com"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nunca compartilharemos seu email."})]})]}),code:`<div className="grid w-full items-center gap-1.5">
|
|
27
|
-
<Label htmlFor="name">Nome *</Label>
|
|
28
|
-
<Input type="text" id="name" placeholder="Seu nome completo" />
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div className="grid w-full items-center gap-1.5">
|
|
32
|
-
<Label htmlFor="email">Email *</Label>
|
|
33
|
-
<Input type="email" id="email" placeholder="email@exemplo.com" />
|
|
34
|
-
<p className="text-xs text-muted-foreground">Nunca compartilharemos seu email.</p>
|
|
35
|
-
</div>`},{title:"Estados",description:"Estados visuais para feedback do usuário",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-sm",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Normal"}),e.jsx(s,{placeholder:"Campo editável"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-muted-foreground",children:"Desabilitado"}),e.jsx(s,{placeholder:"Campo desabilitado",disabled:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Somente Leitura"}),e.jsx(s,{value:"Valor fixo",readOnly:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-destructive",children:"Com Erro"}),e.jsx(s,{placeholder:"Campo com erro",className:"border-destructive focus-visible:ring-destructive"}),e.jsx("p",{className:"text-xs text-destructive",children:"Este campo é obrigatório."})]})]}),code:`// Normal
|
|
36
|
-
<Input placeholder="Campo editável" />
|
|
37
|
-
|
|
38
|
-
// Desabilitado
|
|
39
|
-
<Input placeholder="Campo desabilitado" disabled />
|
|
40
|
-
|
|
41
|
-
// Somente Leitura
|
|
42
|
-
<Input value="Valor fixo" readOnly />
|
|
43
|
-
|
|
44
|
-
// Com Erro (adicione classes de erro)
|
|
45
|
-
<Input
|
|
46
|
-
placeholder="Campo com erro"
|
|
47
|
-
className="border-destructive focus-visible:ring-destructive"
|
|
48
|
-
/>
|
|
49
|
-
<p className="text-xs text-destructive">Este campo é obrigatório.</p>`},{title:"Com Ícones (posicionamento manual)",description:"Ícones posicionados com CSS absoluto para inputs simples",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-sm",children:[e.jsxs("div",{className:"relative",children:[e.jsx(h,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(s,{placeholder:"Email",className:"pl-10"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(s,{placeholder:"Buscar...",className:"pl-10 pr-10",value:x,onChange:u=>f(u.target.value)}),x&&e.jsx("button",{className:"absolute right-3 top-3 text-muted-foreground hover:text-foreground",onClick:()=>f(""),children:e.jsx(v,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(A,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(s,{placeholder:"Telefone",className:"pl-10",type:"tel"})]})]}),code:`// Ícone à esquerda
|
|
50
|
-
<div className="relative">
|
|
51
|
-
<Mail className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
|
|
52
|
-
<Input placeholder="Email" className="pl-10" />
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
// Com botão de limpar
|
|
56
|
-
<div className="relative">
|
|
57
|
-
<Search className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
|
|
58
|
-
<Input
|
|
59
|
-
placeholder="Buscar..."
|
|
60
|
-
className="pl-10 pr-10"
|
|
61
|
-
value={searchValue}
|
|
62
|
-
onChange={(e) => setSearchValue(e.target.value)}
|
|
63
|
-
/>
|
|
64
|
-
{searchValue && (
|
|
65
|
-
<button
|
|
66
|
-
className="absolute right-3 top-3"
|
|
67
|
-
onClick={() => setSearchValue('')}
|
|
68
|
-
>
|
|
69
|
-
<X className="h-4 w-4" />
|
|
70
|
-
</button>
|
|
71
|
-
)}
|
|
72
|
-
</div>`},{title:"InputGroup - Prefixo e Sufixo de Texto",description:"Use InputGroupAddon para textos fixos antes ou depois do input",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-md",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Website"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:"https://"}),e.jsx(r,{placeholder:"seusite.com"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Valor"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:"R$"}),e.jsx(r,{type:"number",placeholder:"0,00"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Email"}),e.jsxs(t,{children:[e.jsx(r,{placeholder:"usuario"}),e.jsx(o,{align:"inline-end",children:"@empresa.com.br"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Peso"}),e.jsxs(t,{children:[e.jsx(r,{type:"number",placeholder:"0"}),e.jsx(o,{align:"inline-end",children:"kg"})]})]})]}),code:`// Prefixo
|
|
73
|
-
<InputGroup>
|
|
74
|
-
<InputGroupAddon align="inline-start">https://</InputGroupAddon>
|
|
75
|
-
<InputGroupInput placeholder="seusite.com" />
|
|
76
|
-
</InputGroup>
|
|
77
|
-
|
|
78
|
-
// Prefixo de moeda
|
|
79
|
-
<InputGroup>
|
|
80
|
-
<InputGroupAddon align="inline-start">R$</InputGroupAddon>
|
|
81
|
-
<InputGroupInput type="number" placeholder="0,00" />
|
|
82
|
-
</InputGroup>
|
|
83
|
-
|
|
84
|
-
// Sufixo de domínio
|
|
85
|
-
<InputGroup>
|
|
86
|
-
<InputGroupInput placeholder="usuario" />
|
|
87
|
-
<InputGroupAddon align="inline-end">@empresa.com.br</InputGroupAddon>
|
|
88
|
-
</InputGroup>
|
|
89
|
-
|
|
90
|
-
// Sufixo de unidade
|
|
91
|
-
<InputGroup>
|
|
92
|
-
<InputGroupInput type="number" placeholder="0" />
|
|
93
|
-
<InputGroupAddon align="inline-end">kg</InputGroupAddon>
|
|
94
|
-
</InputGroup>`},{title:"InputGroup - Com Ícones",description:"Combine ícones com inputs de forma elegante e consistente",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-md",children:[e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(S,{className:"h-4 w-4"})}),e.jsx(r,{placeholder:"Nome de usuário"})]}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx(r,{placeholder:"seu@email.com"})]}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(L,{className:"h-4 w-4"})}),e.jsx(r,{placeholder:"https://..."}),e.jsx(o,{align:"inline-end",children:e.jsx(b,{className:"h-4 w-4 text-success"})})]}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(F,{className:"h-4 w-4"})}),e.jsx(r,{type:"date"})]})]}),code:`// Ícone de usuário
|
|
95
|
-
<InputGroup>
|
|
96
|
-
<InputGroupAddon align="inline-start">
|
|
97
|
-
<User className="h-4 w-4" />
|
|
98
|
-
</InputGroupAddon>
|
|
99
|
-
<InputGroupInput placeholder="Nome de usuário" />
|
|
100
|
-
</InputGroup>
|
|
101
|
-
|
|
102
|
-
// Com ícone de validação
|
|
103
|
-
<InputGroup>
|
|
104
|
-
<InputGroupAddon align="inline-start">
|
|
105
|
-
<Link className="h-4 w-4" />
|
|
106
|
-
</InputGroupAddon>
|
|
107
|
-
<InputGroupInput placeholder="https://..." />
|
|
108
|
-
<InputGroupAddon align="inline-end">
|
|
109
|
-
<Check className="h-4 w-4 text-success" />
|
|
110
|
-
</InputGroupAddon>
|
|
111
|
-
</InputGroup>`},{title:"InputGroup - Com Botões",description:"Botões integrados para ações como mostrar/ocultar senha, copiar ou limpar",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-md",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Senha"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(k,{className:"h-4 w-4"})}),e.jsx(r,{type:l?"text":"password",placeholder:"Digite sua senha"}),e.jsx(c,{variant:"ghost",size:"icon-xs",onClick:()=>i(!l),type:"button",children:l?e.jsx(E,{className:"h-4 w-4"}):e.jsx(T,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Link para compartilhar"}),e.jsxs(t,{children:[e.jsx(r,{value:"https://meusite.com/abc123",readOnly:!0}),e.jsxs(c,{variant:"secondary",size:"sm",onClick:y,type:"button",children:[n?e.jsx(b,{className:"h-4 w-4"}):e.jsx(B,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1",children:n?"Copiado!":"Copiar"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Campo com ação"}),e.jsxs(t,{children:[e.jsx(r,{placeholder:"Digite um valor",value:g,onChange:u=>I(u.target.value)}),g&&e.jsx(c,{variant:"ghost",size:"icon-xs",onClick:()=>I(""),type:"button",children:e.jsx(v,{className:"h-4 w-4"})})]})]})]}),code:`const [showPassword, setShowPassword] = useState(false);
|
|
112
|
-
|
|
113
|
-
// Campo de senha com toggle
|
|
114
|
-
<InputGroup>
|
|
115
|
-
<InputGroupAddon align="inline-start">
|
|
116
|
-
<Lock className="h-4 w-4" />
|
|
117
|
-
</InputGroupAddon>
|
|
118
|
-
<InputGroupInput
|
|
119
|
-
type={showPassword ? "text" : "password"}
|
|
120
|
-
placeholder="Digite sua senha"
|
|
121
|
-
/>
|
|
122
|
-
<InputGroupButton
|
|
123
|
-
variant="ghost"
|
|
124
|
-
size="icon-xs"
|
|
125
|
-
onClick={() => setShowPassword(!showPassword)}
|
|
126
|
-
type="button"
|
|
127
|
-
>
|
|
128
|
-
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
|
129
|
-
</InputGroupButton>
|
|
130
|
-
</InputGroup>
|
|
131
|
-
|
|
132
|
-
// Campo com botão de copiar
|
|
133
|
-
<InputGroup>
|
|
134
|
-
<InputGroupInput value="https://meusite.com/abc123" readOnly />
|
|
135
|
-
<InputGroupButton variant="secondary" size="sm" onClick={handleCopy}>
|
|
136
|
-
<Copy className="h-4 w-4" />
|
|
137
|
-
<span className="ml-1">Copiar</span>
|
|
138
|
-
</InputGroupButton>
|
|
139
|
-
</InputGroup>`},{title:"InputGroup - Combinações Avançadas",description:"Combine múltiplos addons, ícones e botões para casos complexos",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-md",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Preço em dólares"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(P,{className:"h-4 w-4"})}),e.jsx(r,{type:"number",placeholder:"0.00",step:"0.01"}),e.jsx(o,{align:"inline-end",children:"USD"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Verificar usuário"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(V,{className:"h-4 w-4"})}),e.jsx(r,{placeholder:"username"}),e.jsx(c,{variant:"default",size:"sm",children:"Verificar"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Código de referência"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(q,{className:"h-4 w-4"})}),e.jsx(o,{align:"inline-start",children:"REF-"}),e.jsx(r,{placeholder:"0000",maxLength:4}),e.jsx(c,{variant:"outline",size:"sm",children:"Gerar"})]})]})]}),code:`// Preço com ícone e unidade
|
|
140
|
-
<InputGroup>
|
|
141
|
-
<InputGroupAddon align="inline-start">
|
|
142
|
-
<DollarSign className="h-4 w-4" />
|
|
143
|
-
</InputGroupAddon>
|
|
144
|
-
<InputGroupInput type="number" placeholder="0.00" step="0.01" />
|
|
145
|
-
<InputGroupAddon align="inline-end">USD</InputGroupAddon>
|
|
146
|
-
</InputGroup>
|
|
147
|
-
|
|
148
|
-
// Username com verificação
|
|
149
|
-
<InputGroup>
|
|
150
|
-
<InputGroupAddon align="inline-start">
|
|
151
|
-
<AtSign className="h-4 w-4" />
|
|
152
|
-
</InputGroupAddon>
|
|
153
|
-
<InputGroupInput placeholder="username" />
|
|
154
|
-
<InputGroupButton variant="default" size="sm">
|
|
155
|
-
Verificar
|
|
156
|
-
</InputGroupButton>
|
|
157
|
-
</InputGroup>
|
|
158
|
-
|
|
159
|
-
// Múltiplos addons
|
|
160
|
-
<InputGroup>
|
|
161
|
-
<InputGroupAddon align="inline-start">
|
|
162
|
-
<Hash className="h-4 w-4" />
|
|
163
|
-
</InputGroupAddon>
|
|
164
|
-
<InputGroupAddon align="inline-start">REF-</InputGroupAddon>
|
|
165
|
-
<InputGroupInput placeholder="0000" maxLength={4} />
|
|
166
|
-
<InputGroupButton variant="outline" size="sm">
|
|
167
|
-
Gerar
|
|
168
|
-
</InputGroupButton>
|
|
169
|
-
</InputGroup>`},{title:"InputGroup - Com Textarea",description:"Use InputGroupTextarea para áreas de texto com header ou footer",preview:e.jsxs("div",{className:"flex flex-col gap-4 max-w-md",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Mensagem com header"}),e.jsxs(t,{className:"flex-col",children:[e.jsx(o,{align:"block-start",className:"bg-muted/50",children:e.jsx("span",{className:"text-xs font-medium",children:"Escreva sua mensagem"})}),e.jsx(j,{placeholder:"Digite sua mensagem aqui...",rows:3})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{children:"Descrição com contador"}),e.jsxs(t,{className:"flex-col",children:[e.jsx(j,{placeholder:"Descreva o problema...",rows:3,maxLength:500}),e.jsx(o,{align:"block-end",className:"justify-end bg-muted/30",children:e.jsx("span",{className:"text-xs",children:"0/500 caracteres"})})]})]})]}),code:`// Textarea com header
|
|
170
|
-
<InputGroup className="flex-col">
|
|
171
|
-
<InputGroupAddon align="block-start" className="bg-muted/50">
|
|
172
|
-
<span className="text-xs font-medium">Escreva sua mensagem</span>
|
|
173
|
-
</InputGroupAddon>
|
|
174
|
-
<InputGroupTextarea placeholder="Digite sua mensagem..." rows={3} />
|
|
175
|
-
</InputGroup>
|
|
176
|
-
|
|
177
|
-
// Textarea com footer contador
|
|
178
|
-
<InputGroup className="flex-col">
|
|
179
|
-
<InputGroupTextarea placeholder="Descreva..." rows={3} maxLength={500} />
|
|
180
|
-
<InputGroupAddon align="block-end" className="justify-end bg-muted/30">
|
|
181
|
-
<span className="text-xs">0/500 caracteres</span>
|
|
182
|
-
</InputGroupAddon>
|
|
183
|
-
</InputGroup>`},{title:"Formulário Completo",description:"Exemplo de formulário combinando Input, Label e InputGroup",preview:e.jsxs("form",{className:"flex flex-col gap-4 max-w-md",onSubmit:u=>u.preventDefault(),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"first-name",children:"Nome *"}),e.jsx(s,{id:"first-name",placeholder:"João",required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"last-name",children:"Sobrenome *"}),e.jsx(s,{id:"last-name",placeholder:"Silva",required:!0})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"form-email",children:"Email *"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx(r,{id:"form-email",type:"email",placeholder:"joao@exemplo.com",required:!0})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"form-phone",children:"Telefone"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:"+55"}),e.jsx(r,{id:"form-phone",type:"tel",placeholder:"(11) 99999-9999"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"form-website",children:"Website"}),e.jsxs(t,{children:[e.jsx(o,{align:"inline-start",children:"https://"}),e.jsx(r,{id:"form-website",placeholder:"seusite.com"})]})]}),e.jsx(N,{type:"submit",className:"w-full",children:"Enviar"})]}),code:`<form className="flex flex-col gap-4 max-w-md">
|
|
184
|
-
<div className="grid grid-cols-2 gap-4">
|
|
185
|
-
<div className="space-y-1.5">
|
|
186
|
-
<Label htmlFor="first-name">Nome *</Label>
|
|
187
|
-
<Input id="first-name" placeholder="João" required />
|
|
188
|
-
</div>
|
|
189
|
-
<div className="space-y-1.5">
|
|
190
|
-
<Label htmlFor="last-name">Sobrenome *</Label>
|
|
191
|
-
<Input id="last-name" placeholder="Silva" required />
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
<div className="space-y-1.5">
|
|
195
|
-
<Label htmlFor="email">Email *</Label>
|
|
196
|
-
<InputGroup>
|
|
197
|
-
<InputGroupAddon align="inline-start">
|
|
198
|
-
<Mail className="h-4 w-4" />
|
|
199
|
-
</InputGroupAddon>
|
|
200
|
-
<InputGroupInput id="email" type="email" placeholder="joao@exemplo.com" required />
|
|
201
|
-
</InputGroup>
|
|
202
|
-
</div>
|
|
203
|
-
<div className="space-y-1.5">
|
|
204
|
-
<Label htmlFor="phone">Telefone</Label>
|
|
205
|
-
<InputGroup>
|
|
206
|
-
<InputGroupAddon align="inline-start">+55</InputGroupAddon>
|
|
207
|
-
<InputGroupInput id="phone" type="tel" placeholder="(11) 99999-9999" />
|
|
208
|
-
</InputGroup>
|
|
209
|
-
</div>
|
|
210
|
-
<Button type="submit" className="w-full">Enviar</Button>
|
|
211
|
-
</form>`}],props:[{name:"type",type:"string",default:'"text"',description:'Tipo do input HTML: "text", "email", "password", "number", "tel", "url", "search", "date", "time", etc.'},{name:"placeholder",type:"string",default:"-",description:"Texto de placeholder exibido quando o campo está vazio."},{name:"value",type:"string | number",default:"-",description:"Valor controlado do input."},{name:"defaultValue",type:"string | number",default:"-",description:"Valor inicial para input não controlado."},{name:"disabled",type:"boolean",default:"false",description:"Se o input está desabilitado (não editável e não envia no form)."},{name:"readOnly",type:"boolean",default:"false",description:"Se o input é somente leitura (não editável mas envia no form)."},{name:"required",type:"boolean",default:"false",description:"Se o campo é obrigatório para submissão do formulário."},{name:"maxLength",type:"number",default:"-",description:"Número máximo de caracteres permitidos."},{name:"minLength",type:"number",default:"-",description:"Número mínimo de caracteres necessários."},{name:"pattern",type:"string",default:"-",description:"Regex para validação do valor (HTML5)."},{name:"autoComplete",type:"string",default:"-",description:'Dica de autocompletar: "off", "email", "name", "tel", etc.'},{name:"autoFocus",type:"boolean",default:"false",description:"Se o input deve receber foco automaticamente ao montar."},{name:"className",type:"string",default:"-",description:"Classes CSS adicionais para customização."},{name:"onChange",type:"(e: ChangeEvent) => void",default:"-",description:"Callback chamado quando o valor muda."},{name:"onBlur",type:"(e: FocusEvent) => void",default:"-",description:"Callback chamado quando o input perde foco."},{name:"onFocus",type:"(e: FocusEvent) => void",default:"-",description:"Callback chamado quando o input recebe foco."}],notes:["**Label**: Componente de rótulo acessível. Use `htmlFor` para associar ao `id` do input.","**InputGroup**: Container que agrupa input com addons. Adiciona borda unificada e foco visual compartilhado.","**InputGroupInput**: Input estilizado para uso dentro do InputGroup (remove bordas próprias).","**InputGroupTextarea**: Textarea estilizado para uso com addons `block-start` ou `block-end`.","**InputGroupAddon**: Elemento decorativo (texto, ícone). Props: `align`: `inline-start` (prefixo), `inline-end` (sufixo), `block-start` (topo), `block-end` (base).","**InputGroupButton**: Botão integrado ao InputGroup. Props: `size`: `xs`, `sm`, `icon-xs`, `icon-sm`. Aceita todas as `variant` do Button.","Para validação de formulários, use react-hook-form com FormField, FormControl e FormMessage.","Para estados de erro, adicione as classes `border-destructive focus-visible:ring-destructive` ao Input."],accessibility:["Sempre associe Label ao Input usando htmlFor/id para melhor navegação com leitores de tela","Use placeholder como dica adicional, nunca como substituto do Label","O estado disabled é comunicado automaticamente para tecnologias assistivas","O estado required é comunicado e valida automaticamente no submit","InputGroup mantém foco visual unificado (ring) quando qualquer elemento interno está focado","Indicadores de foco visíveis atendem WCAG 2.4.7 (Focus Visible)","Inputs são totalmente navegáveis via teclado (Tab, Shift+Tab)","Para campos de senha, forneça toggle de visibilidade com ícone descritivo","Mensagens de erro devem ser associadas ao input via aria-describedby para leitores de tela"]})}export{W as InputDoc};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import{j as e,J as a,K as s,m as i}from"./index-DkiftrvI.js";import{C as l}from"./ComponentDocTemplate-CQbBhfvZ.js";import"./ExampleCard-DuLrb3t-.js";function d(){return e.jsx(l,{title:"Label",description:"Renderiza uma label acessível associada a controles de formulário.",component:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{id:"terms-main"}),e.jsx(a,{htmlFor:"terms-main",children:"Aceitar termos e condições"})]}),usage:`import { Label } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<Label htmlFor="email">Email</Label>
|
|
4
|
-
<Input id="email" type="email" />`,examples:[{title:"Com Input",description:"Label associada a um campo de texto.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-1.5",children:[e.jsx(a,{htmlFor:"email",children:"Email"}),e.jsx(s,{id:"email",type:"email",placeholder:"seu@email.com"})]}),code:`<div className="grid gap-1.5">
|
|
5
|
-
<Label htmlFor="email">Email</Label>
|
|
6
|
-
<Input id="email" type="email" placeholder="seu@email.com" />
|
|
7
|
-
</div>`},{title:"Campo Obrigatório",description:"Indicador visual de campo obrigatório.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-1.5",children:[e.jsxs(a,{htmlFor:"name",children:["Nome completo ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s,{id:"name",required:!0})]}),code:`<Label htmlFor="name">
|
|
8
|
-
Nome completo <span className="text-destructive">*</span>
|
|
9
|
-
</Label>
|
|
10
|
-
<Input id="name" required />`},{title:"Com Texto de Ajuda",description:"Label com descrição auxiliar abaixo.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-1.5",children:[e.jsx(a,{htmlFor:"password",children:"Senha"}),e.jsx(s,{id:"password",type:"password"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Mínimo de 8 caracteres com letras e números."})]}),code:`<div className="grid gap-1.5">
|
|
11
|
-
<Label htmlFor="password">Senha</Label>
|
|
12
|
-
<Input id="password" type="password" />
|
|
13
|
-
<p className="text-xs text-muted-foreground">
|
|
14
|
-
Mínimo de 8 caracteres com letras e números.
|
|
15
|
-
</p>
|
|
16
|
-
</div>`},{title:"Estado de Erro",description:"Label estilizada para indicar erro de validação.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-1.5",children:[e.jsx(a,{htmlFor:"email-error",className:"text-destructive",children:"Email"}),e.jsx(s,{id:"email-error",type:"email",className:"border-destructive",defaultValue:"email-invalido"}),e.jsx("p",{className:"text-xs text-destructive",children:"Por favor, insira um email válido."})]}),code:`<Label htmlFor="email" className="text-destructive">Email</Label>
|
|
17
|
-
<Input id="email" className="border-destructive" />
|
|
18
|
-
<p className="text-xs text-destructive">
|
|
19
|
-
Por favor, insira um email válido.
|
|
20
|
-
</p>`},{title:"Campo Desabilitado",description:"Label com aparência desabilitada.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-1.5",children:[e.jsx(a,{htmlFor:"disabled-field",className:"text-muted-foreground",children:"Campo bloqueado"}),e.jsx(s,{id:"disabled-field",disabled:!0,defaultValue:"Valor fixo"})]}),code:`<Label htmlFor="field" className="text-muted-foreground">
|
|
21
|
-
Campo bloqueado
|
|
22
|
-
</Label>
|
|
23
|
-
<Input id="field" disabled defaultValue="Valor fixo" />`},{title:"Com Checkbox",description:"Label associada a checkbox para área de clique maior.",preview:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(i,{id:"newsletter"}),e.jsx(a,{htmlFor:"newsletter",className:"cursor-pointer",children:"Receber novidades por email"})]}),code:`<div className="flex items-center space-x-2">
|
|
24
|
-
<Checkbox id="newsletter" />
|
|
25
|
-
<Label htmlFor="newsletter" className="cursor-pointer">
|
|
26
|
-
Receber novidades por email
|
|
27
|
-
</Label>
|
|
28
|
-
</div>`},{title:"Formulário Completo",description:"Múltiplos campos com labels estruturadas.",preview:e.jsxs("div",{className:"grid w-full max-w-sm gap-4",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsxs(a,{htmlFor:"full-name",children:["Nome ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s,{id:"full-name"})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsxs(a,{htmlFor:"full-email",children:["Email ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(s,{id:"full-email",type:"email"})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(a,{htmlFor:"full-phone",children:"Telefone"}),e.jsx(s,{id:"full-phone",type:"tel"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Opcional"})]})]}),code:`<div className="grid gap-4">
|
|
29
|
-
<div className="grid gap-1.5">
|
|
30
|
-
<Label htmlFor="name">Nome <span className="text-destructive">*</span></Label>
|
|
31
|
-
<Input id="name" />
|
|
32
|
-
</div>
|
|
33
|
-
<div className="grid gap-1.5">
|
|
34
|
-
<Label htmlFor="email">Email <span className="text-destructive">*</span></Label>
|
|
35
|
-
<Input id="email" type="email" />
|
|
36
|
-
</div>
|
|
37
|
-
<div className="grid gap-1.5">
|
|
38
|
-
<Label htmlFor="phone">Telefone</Label>
|
|
39
|
-
<Input id="phone" type="tel" />
|
|
40
|
-
<p className="text-xs text-muted-foreground">Opcional</p>
|
|
41
|
-
</div>
|
|
42
|
-
</div>`}],props:[{name:"htmlFor",type:"string",default:"-",description:"O id do controle de formulário para associar."},{name:"className",type:"string",default:"-",description:"Classes CSS para estilização."},{name:"children",type:"ReactNode",default:"-",description:"Conteúdo da label."}],accessibility:["Associa adequadamente com controles de formulário via htmlFor","Clicar na label foca automaticamente o input associado","Suporte completo para leitores de tela","Compatível com WCAG - melhora a área de clique","Use com Checkbox/Radio para melhor UX"],notes:["Sempre associe Labels a seus campos via htmlFor/id","Use o componente Label (não <label>) para formulários acessíveis","Indique campos obrigatórios com asterisco ou texto descritivo","Labels aumentam a área de clique para inputs (especialmente útil em mobile)","Adicione cursor-pointer quando associada a checkboxes/radios","Combine com texto de ajuda abaixo do input para instruções adicionais"]})}export{d as LabelDoc};
|