forlogic-core 1.16.3 → 1.16.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/README.md +113 -109
- package/dist/README.md +113 -109
- package/dist/components/modules/AccessDeniedDialog.d.ts +41 -0
- package/dist/components/modules/ModuleAccessGuard.d.ts +3 -1
- package/dist/components/modules/ModuleOfferContent.d.ts +20 -0
- package/dist/components/modules/ModulesContent.d.ts +15 -0
- package/dist/components/modules/ModulesFooterCards.d.ts +6 -0
- package/dist/components/modules/index.d.ts +8 -0
- package/dist/components/modules/types.d.ts +2 -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/docs/DESIGN_SYSTEM.md +17 -32
- package/package.json +4 -2
- package/dist/assets/AccordionDoc-BnfxyOi9.js +0 -31
- package/dist/assets/ActionButtonDoc-b4F_J8gn.js +0 -47
- package/dist/assets/AlertDoc-PkiHguSJ.js +0 -37
- package/dist/assets/AppHeaderDoc-CsFMZGV0.js +0 -67
- package/dist/assets/AppSidebarDoc-Bg71N-zq.js +0 -196
- package/dist/assets/AuthDoc-DDm57y_J.js +0 -192
- package/dist/assets/AvatarDoc-C6wiZIZR.js +0 -11
- package/dist/assets/BadgeDoc-Bsg7cfm0.js +0 -36
- package/dist/assets/BaseFormDoc-DeIlV273.js +0 -169
- package/dist/assets/BodyContentDoc-Q3DGvyN9.js +0 -83
- package/dist/assets/BreadcrumbDoc-ChsVFjMF.js +0 -75
- package/dist/assets/ButtonDoc-C7Q31Bh3.js +0 -41
- package/dist/assets/ButtonGroupDoc-Bn5vhjBq.js +0 -7
- package/dist/assets/CalendarDoc-iVjNyxyr.js +0 -81
- package/dist/assets/CardDoc-D511dll7.js +0 -49
- package/dist/assets/ChartDoc-CQyYOEHL.js +0 -111
- package/dist/assets/CheckboxDoc-Cjsy4XAq.js +0 -55
- package/dist/assets/ColorPickerDoc-hnYJUWpF.js +0 -10
- package/dist/assets/ColorsFoundationDoc-B8Z4tAyZ.js +0 -13
- package/dist/assets/ComboTreeDoc-ChEbW4a3.js +0 -21
- package/dist/assets/ComboboxDoc-CHWeGE_F.js +0 -134
- package/dist/assets/ComponentDocTemplate-BtOCnlM2.js +0 -1
- package/dist/assets/ContextMenuDoc-C3mFO_Yx.js +0 -182
- package/dist/assets/ContextsDoc-ChEbQxom.js +0 -184
- package/dist/assets/CreateCrudPageDoc-C9tXisCF.js +0 -106
- package/dist/assets/CrudActionBarDoc-Cp1L4gpO.js +0 -112
- package/dist/assets/CrudGridDoc-D-kSFBAQ.js +0 -85
- package/dist/assets/CrudOverviewDoc-CeLBwg-B.js +0 -14
- package/dist/assets/CrudPrimitivesDoc-B2u1vZog.js +0 -164
- package/dist/assets/CrudTableDoc-CvV-II_X.js +0 -95
- package/dist/assets/DataListDoc-BLRii0jB.js +0 -13
- package/dist/assets/DesignSystemHome-TE0Ubaup.js +0 -1
- package/dist/assets/DialogDoc--LC5Jvat.js +0 -981
- package/dist/assets/DropdownMenuDoc-oPlEriRY.js +0 -175
- package/dist/assets/EmptyStateDoc-rNqfWKok.js +0 -35
- package/dist/assets/EnvironmentsDoc-CT7l5s2u.js +0 -96
- package/dist/assets/ErrorBoundaryDoc-rPHOUygA.js +0 -111
- package/dist/assets/ExampleCard-DfuMYM6E.js +0 -1
- package/dist/assets/FormDoc-B0L_QaCT.js +0 -81
- package/dist/assets/FoundationOverview-Dbb8rBsU.js +0 -1
- package/dist/assets/GridDoc-ifcGA2Yw.js +0 -28
- package/dist/assets/HooksDoc-CUOT_3Du.js +0 -665
- package/dist/assets/HoverCardDoc-CdTU2QkI.js +0 -31
- package/dist/assets/I18nDoc-CMEvFqsz.js +0 -232
- package/dist/assets/IconPickerDoc-DF9hEwnJ.js +0 -10
- package/dist/assets/IconsFoundationDoc-D4Y0wKbm.js +0 -33
- package/dist/assets/InputDoc-d_IL4dsq.js +0 -211
- package/dist/assets/LabelDoc-Dr64ISiJ.js +0 -42
- package/dist/assets/LeadershipDoc-BnrTuaeV.js +0 -416
- package/dist/assets/MediaDoc-CLuVprAr.js +0 -459
- package/dist/assets/MenubarDoc-CW7L4QJ4.js +0 -165
- package/dist/assets/ModulesDialogDoc-CUb_g4X-.js +0 -71
- package/dist/assets/NavigationMenuDoc-Csc0U6bV.js +0 -116
- package/dist/assets/OnboardingDialogDoc-3RtjNH1O.js +0 -55
- package/dist/assets/PaginationDoc-BGurD4xQ.js +0 -27
- package/dist/assets/PaginationDoc-DqFyou6O.js +0 -98
- package/dist/assets/PlacesDoc-Dyx8gsqb.js +0 -226
- package/dist/assets/PopoverDoc-DHF-ItUX.js +0 -64
- package/dist/assets/ProgressDoc-DXKV-fkI.js +0 -29
- package/dist/assets/QualiexUserFieldDoc-BbP7w-Pu.js +0 -149
- package/dist/assets/RadioGroupDoc-D845uweM.js +0 -57
- package/dist/assets/RadiusDoc-vN4tTsay.js +0 -7
- package/dist/assets/RequiredFieldsCounterDoc-TzR9r-U9.js +0 -58
- package/dist/assets/ResizableDoc-Bkfz_25O.js +0 -104
- package/dist/assets/RichTextEditorDoc-BUQrg7M8.js +0 -24
- package/dist/assets/ScrollAreaDoc-B6ODYHMX.js +0 -28
- package/dist/assets/SecurityDoc-Chbt6w1s.js +0 -204
- package/dist/assets/SelectDoc-BhcpBIAO.js +0 -80
- package/dist/assets/SeparatorDoc-C3fhatb0.js +0 -4
- package/dist/assets/ServicesDoc-_uao-HA_.js +0 -308
- package/dist/assets/ShadowsDoc-DpkO_TZQ.js +0 -9
- package/dist/assets/SignDoc-BJtnoT6I.js +0 -66
- package/dist/assets/SkeletonDoc-BZS07PJh.js +0 -54
- package/dist/assets/SliderDoc-D2ApV3XT.js +0 -41
- package/dist/assets/SpacingDoc-PNrU24B2.js +0 -12
- package/dist/assets/SplitButtonDoc-D5tUF2Ja.js +0 -53
- package/dist/assets/StepSelectorDoc-Cj0ALYar.js +0 -41
- package/dist/assets/SwitchDoc-DtsT8oh_.js +0 -56
- package/dist/assets/TableDoc-BC-jQnXu.js +0 -128
- package/dist/assets/TableOfContents-DBMJMbI4.js +0 -1
- package/dist/assets/TabsDoc-DtXJ0xY5.js +0 -42
- package/dist/assets/TextareaDoc-nuW5tqBQ.js +0 -46
- package/dist/assets/ToastDoc-D1aX5zda.js +0 -157
- package/dist/assets/ToggleDoc-ILass4CS.js +0 -51
- package/dist/assets/TooltipDoc-lPbdWe_9.js +0 -58
- package/dist/assets/TruncatedCellDoc-DOAzbF2F.js +0 -12
- package/dist/assets/TypographyFoundationDoc-3ZD-rQZw.js +0 -7
- package/dist/assets/UtilitiesDoc-D7lkYhuz.js +0 -145
- package/dist/assets/blocks-Jy49RoqJ.js +0 -1
- package/dist/assets/calendar-days-Cvf2zLJl.js +0 -1
- package/dist/assets/circle-plus-MnG9kjyq.js +0 -1
- package/dist/assets/circle-x-B9ouupla.js +0 -1
- package/dist/assets/crown-BweN5jpI.js +0 -1
- package/dist/assets/date-picker-ttyYeYvC.js +0 -1
- package/dist/assets/disabled-menu-item-WlpPOqxg.js +0 -1
- package/dist/assets/drawer-DvU6_eK5.js +0 -3
- package/dist/assets/file-pen-line-C0VV-QjF.js +0 -1
- package/dist/assets/git-branch-DCjGGwvF.js +0 -1
- package/dist/assets/globe-BdFDFP_k.js +0 -1
- package/dist/assets/grip-vertical-CgXp0oI-.js +0 -1
- package/dist/assets/hash-BAYi_wfk.js +0 -1
- package/dist/assets/index-BtX5DZqb.js +0 -310
- package/dist/assets/index-C1So5Sai.css +0 -1
- package/dist/assets/life-buoy-BydIgTyJ.js +0 -1
- package/dist/assets/lucide-react-ZIMhRYmb.js +0 -1
- package/dist/assets/monitor-B6txWJPg.js +0 -1
- package/dist/assets/package-DNe3FsCh.js +0 -1
- package/dist/assets/pen-CzTmQ16z.js +0 -1
- package/dist/assets/pin-CJJgLEBz.js +0 -1
- package/dist/assets/radio-group-Btv_BY60.js +0 -1
- package/dist/assets/server-XQDXtrjm.js +0 -1
- package/dist/assets/share-2-Dz_89MJb.js +0 -1
- package/dist/assets/step-selector-D0_Y1dow.js +0 -1
- package/dist/assets/text-align-start-WsHo7CNJ.js +0 -1
- package/dist/assets/trash-CeK-mWnM.js +0 -1
- package/dist/assets/useMockCrud-RV9z9n5x.js +0 -1
- package/dist/assets/user-check-CrbWcnPN.js +0 -1
- package/dist/assets/user-plus-Dce9DbqQ.js +0 -1
- package/dist/index.html +0 -35
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as e,C as a,a as r,b as i,c as o,d}from"./index-BtX5DZqb.js";function c(){const l=[{name:"sm",value:"shadow-sm",description:"Elevação sutil para cards e containers"},{name:"default",value:"shadow",description:"Elevação padrão para elementos interativos"},{name:"md",value:"shadow-md",description:"Elevação média para dropdowns e popovers"},{name:"lg",value:"shadow-lg",description:"Elevação alta para modais e diálogos"},{name:"xl",value:"shadow-xl",description:"Elevação máxima para overlays"},{name:"primary",value:"shadow-primary",description:"Sombra colorida para elementos primários"}];return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-4xl font-bold tracking-tight",children:"Sistema de Sombras e Elevação"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Sombras criam profundidade e hierarquia, ajudando usuários a entender as relações espaciais entre elementos e seus estados interativos."})]}),e.jsxs(a,{children:[e.jsxs(r,{children:[e.jsx(i,{children:"Escala de Sombras"}),e.jsx(o,{children:"5 níveis de elevação mais sombras semânticas"})]}),e.jsx(d,{className:"space-y-8",children:l.map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium capitalize",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),e.jsx("code",{className:"text-xs text-muted-foreground",children:s.value})]}),e.jsx("div",{className:`p-6 bg-card rounded-lg ${s.value}`,children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Card with ",s.name," shadow"]})})]},s.name))})]}),e.jsxs(a,{children:[e.jsxs(r,{children:[e.jsx(i,{children:"Estados Interativos"}),e.jsx(o,{children:"Mudanças de sombra no hover e foco"})]}),e.jsxs(d,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Efeito Hover"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Eleva no hover para indicar interatividade"}),e.jsx("div",{className:"p-6 bg-card border rounded-lg shadow-sm hover:shadow-lg transition-shadow cursor-pointer",children:e.jsx("p",{className:"text-sm",children:"Passe o mouse sobre este card para ver a sombra aumentar"})}),e.jsx("code",{className:"text-xs text-muted-foreground block",children:"shadow-sm hover:shadow-lg transition-shadow"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Anel de Foco"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Indicador de foco claro para acessibilidade"}),e.jsx("button",{className:"px-4 py-2 bg-primary text-primary-foreground rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Clique para focar"}),e.jsx("code",{className:"text-xs text-muted-foreground block",children:"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"})]})]})]}),e.jsxs(a,{children:[e.jsx(r,{children:e.jsx(i,{children:"Uso por Tipo de Componente"})}),e.jsx(d,{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Cards & Containers"}),e.jsxs("ul",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["• Padrão: ",e.jsx("code",{children:"shadow-sm"})]}),e.jsxs("li",{children:["• Hover: ",e.jsx("code",{children:"hover:shadow-md"})]}),e.jsxs("li",{children:["• Ativo: ",e.jsx("code",{children:"shadow"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Dropdowns & Popovers"}),e.jsxs("ul",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["• Padrão: ",e.jsx("code",{children:"shadow-md"})]}),e.jsxs("li",{children:["• Menus grandes: ",e.jsx("code",{children:"shadow-lg"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Modais & Diálogos"}),e.jsxs("ul",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["• Padrão: ",e.jsx("code",{children:"shadow-lg"})]}),e.jsxs("li",{children:["• Crítico: ",e.jsx("code",{children:"shadow-xl"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Botões & Ações"}),e.jsxs("ul",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsxs("li",{children:["• Primário: ",e.jsx("code",{children:"shadow-primary"})]}),e.jsxs("li",{children:["• Elevado: ",e.jsx("code",{children:"shadow-sm"})]}),e.jsxs("li",{children:["• Hover: ",e.jsx("code",{children:"hover:shadow-md"})]})]})]})]})})]}),e.jsxs(a,{children:[e.jsx(r,{children:e.jsx(i,{children:"Diretrizes de Sombra"})}),e.jsxs(d,{className:"prose prose-slate dark:prose-invert max-w-none",children:[e.jsx("h3",{children:"Princípios"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Hierarquia"}),": Maior elevação = maior importância na hierarquia visual"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Consistência"}),": Use sombras de forma consistente para tipos de componentes similares"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Sutileza"}),": Sombras devem realçar, não dominar o design"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Performance"}),": Evite desfoque excessivo de sombra para melhor performance de renderização"]})]}),e.jsx("h3",{children:"Acessibilidade"}),e.jsxs("ul",{children:[e.jsx("li",{children:"Não dependa apenas de sombras para indicar estados interativos"}),e.jsx("li",{children:"Sempre inclua anéis focus-visible para navegação por teclado"}),e.jsx("li",{children:"Garanta contraste suficiente entre elementos sombreados e fundo"}),e.jsx("li",{children:"Considere preferências de movimento reduzido ao animar sombras"})]}),e.jsx("h3",{children:"Melhores Práticas"}),e.jsxs("ul",{children:[e.jsxs("li",{children:["Use ",e.jsx("code",{children:"transition-shadow"})," para efeitos de hover suaves"]}),e.jsxs("li",{children:["Combine com ",e.jsx("code",{children:"hover:translate-y-1"})," para efeito de elevação sutil"]}),e.jsx("li",{children:"Use sombras coloridas com moderação (apenas ações primárias)"}),e.jsx("li",{children:"Teste sombras em modos claro e escuro"})]}),e.jsx("h4",{className:"font-semibold mb-3 mt-6",children:"Exemplos de Código"}),e.jsxs("div",{className:"space-y-4 not-prose",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2 text-green-600 dark:text-green-400",children:"✅ Correto"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:e.jsx("code",{children:`<Card className="shadow-sm hover:shadow-lg transition-shadow">
|
|
2
|
-
Card interativo
|
|
3
|
-
</Card>
|
|
4
|
-
|
|
5
|
-
<Button className="focus-visible:ring-2 focus-visible:ring-ring">
|
|
6
|
-
Botão acessível
|
|
7
|
-
</Button>`})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2 text-red-600 dark:text-red-400",children:"❌ Incorreto"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:e.jsx("code",{children:`<div className="shadow-2xl">
|
|
8
|
-
Elevação demais
|
|
9
|
-
</div>`})})]})]})]})]})]})}export{c as ShadowsDoc};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import{eg as oe,r as n,ew as ae,ex as xe,j as e,w as F,aA as he,aB as fe,aC as je,cI as Ne,u as E,C as N,d as v,b7 as ve,f as ne,x as de,bT as be,c6 as z,aD as ie,aM as ye,B as I,a as P,b as T,bB as M}from"./index-BtX5DZqb.js";import{C as Se}from"./ComponentDocTemplate-BtOCnlM2.js";import{F as R}from"./file-pen-line-C0VV-QjF.js";import{G as _e}from"./globe-BdFDFP_k.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";function we(){const{alias:s}=oe(),[o,r]=n.useState(null),[l,t]=n.useState(!0);n.useEffect(()=>{if(!s){t(!1);return}let u=!1;return(async()=>{t(!0);try{const a=ae(),{data:h,error:f}=await a.schema("common").from("sign_configs").select("*").eq("alias",s).is("deleted_at",null).maybeSingle();u||(f&&console.error("[useSignConfig] Error fetching config:",f),r(h))}catch(a){console.error("[useSignConfig] Unexpected error:",a),u||r(null)}finally{u||t(!1)}})(),()=>{u=!0}},[s]);const i=n.useCallback(async(u,x)=>{if(!s)throw new Error("Alias not available");const a=ae(),{data:h,error:f}=await a.schema("common").from("sign_configs").upsert({alias:s,api_key:u,environment:x,updated_at:new Date().toISOString()},{onConflict:"alias"}).select().maybeSingle();if(f)throw f;return r(h),h},[s]);return{config:o,isLoading:l,saveConfig:i}}const Ce="https://ccjfvpnndclajkleyqkc.supabase.co",Ee="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNjamZ2cG5uZGNsYWprbGV5cWtjIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTA5NTQ1OTksImV4cCI6MjA2NjUzMDU5OX0.j7ASp7OYaR5oXfnVmK77VGNH-5hDa9JpzbAYJBUpfa8";async function re(s,o,r){const l=xe.getSupabaseToken(),t={"Content-Type":"application/json",apikey:Ee};l&&(t.Authorization=`Bearer ${l}`);const i=await fetch(`${Ce}/functions/v1/${s}`,{method:"POST",headers:t,body:JSON.stringify({action:o,data:r})});if(!i.ok){const u=await i.json().catch(()=>({}));throw new Error(u.error||`Erro na requisição: ${i.status}`)}return i}const te={async createEnvelopeWithSigner(s){const o=s.provider==="d4sign"?"d4sign":"clicksign",r=s.provider==="d4sign"?"create_and_send":"create_envelope_with_signer";return(await re(o,r,{content_base64:s.contentBase64,filename:s.filename,signer_email:s.signerEmail,signer_name:s.signerName})).json()},async getSignedDocument(s){const o=s.provider==="d4sign"?"d4sign":"clicksign";return(await re(o,"get_signed_document",{envelope_id:s.envelopeId,document_id:s.documentId})).json()}},De="https://cdn-public-library.clicksign.com/embedded/embedded.min-2.1.0.js";let L=null;function Ae(){return window.Clicksign?Promise.resolve():L||(L=new Promise((s,o)=>{const r=document.createElement("script");r.src=De,r.onload=()=>s(),r.onerror=()=>o(new Error("Falha ao carregar script do Clicksign")),document.head.appendChild(r)}),L)}const W="clicksign-container";function ke({signerId:s,environment:o="sandbox",onSign:r,onError:l,onClose:t}){const i=n.useRef(null),[u,x]=n.useState(!0),[a,h]=n.useState(null);return n.useEffect(()=>{let f=!1;return i.current&&(i.current.unmount(),i.current=null),h(null),x(!0),Ae().then(()=>{if(f)return;const m=new window.Clicksign(s);m.endpoint=o==="production"?"https://app.clicksign.com":"https://sandbox.clicksign.com",m.origin=window.origin,m.mount(W),m.on("loaded",function(){x(!1)}),m.on("signed",function(){r?.()}),m.on("resized",function(w){const b=w,y=document.getElementById(W);y&&b?.data?.height&&(y.style.height=b.data.height+"px")}),m.on("error",function(w){console.error("[SignWidget] Widget error",w),x(!1),l?.(w instanceof Error?w:new Error("Erro no widget de assinatura"))}),m.on("closed",function(){t?.()}),i.current=m}).catch(m=>{f||(console.error("[SignWidget] Failed to load Clicksign script",m),h("Falha ao carregar o script de assinatura."),x(!1),l?.(m))}),()=>{f=!0,i.current&&(i.current.unmount(),i.current=null)}},[s,o]),e.jsxs("div",{className:"relative h-full",children:[u&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(F,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Carregando documento..."})]})}),a&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-destructive",children:a})}),e.jsx("div",{id:W,style:{height:"600px"}})]})}const Ie="d4sign-container";function Pe({documentKey:s,signerEmail:o,signerName:r,keySigner:l,environment:t,onSign:i,onError:u}){const x=n.useRef(null),[a,h]=n.useState("loading"),[f,m]=n.useState(null),w=t==="production"?"https://secure.d4sign.com.br/embed/viewblob":"https://sandbox.d4sign.com.br/embed/viewblob",b=(()=>{const C=new URLSearchParams({email:o,display_name:r||"",disable_preview:"0"});return l&&C.set("key_signer",l),`${w}/${s}?${C.toString()}`})(),y=n.useCallback(C=>{if(C.data==="signed"){h("ready"),i?.();return}if(C.data==="wrong-data"){console.error("[D4SignWidget] Wrong data reported by signer"),h("error"),m("O signatário reportou dados incorretos."),u?.(new Error("O signatário reportou dados incorretos"));return}},[i,u]);n.useEffect(()=>(window.addEventListener("message",y,!1),()=>{window.removeEventListener("message",y,!1)}),[y]);const D=n.useCallback(()=>{a==="loading"&&h("ready")},[a]);return a==="error"?e.jsxs(he,{variant:"danger",className:"my-4",children:[e.jsx(fe,{children:"Erro ao carregar documento"}),e.jsx(je,{children:f||"Ocorreu um erro inesperado ao carregar o documento para assinatura. Tente novamente."})]}):e.jsxs("div",{className:"relative h-full",children:[a==="loading"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(F,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Carregando documento..."})]})}),e.jsx("iframe",{ref:x,id:Ie,src:b,width:"100%",style:{height:"600px",border:0},allow:"geolocation",onLoad:D})]})}function Te({file:s,onDocumentSigned:o,onError:r,showEventLog:l=!1}){const{user:t,alias:i}=oe(),{config:u,isLoading:x}=we(),{t:a}=Ne(),[h,f]=n.useState(null),[m,w]=n.useState(!1),[b,y]=n.useState(null),[D,C]=n.useState("sandbox"),[A,J]=n.useState("clicksign"),[S,K]=n.useState(null),[O,G]=n.useState(null),[Y,U]=n.useState(!1),[ce,X]=n.useState(0),[V,H]=n.useState(!1),[Z,le]=n.useState([]),Q=n.useRef(null),ee=n.useRef(null),d=n.useCallback(g=>{l&&le(c=>[...c,`[${new Date().toLocaleTimeString()}] ${g}`])},[l]),$=n.useCallback(async g=>{if(f(g),y(null),K(null),G(null),d(`Arquivo selecionado: ${g.name}`),!(!i||!t)){w(!0);try{const c=u?.provider??"clicksign";J(c),d(`Provedor resolvido: ${c}`);const p=new FileReader,j=await new Promise((k,ge)=>{p.onload=()=>{const pe=p.result;k(pe)},p.onerror=ge,p.readAsDataURL(g)});d(`Criando envelope para assinatura via ${c}...`);const _=await te.createEnvelopeWithSigner({alias:i,contentBase64:j,filename:g.name,signerEmail:t.email||"",signerName:t.name||"",provider:c});d(`Envelope criado: ${_.envelope_id}`),K({envelope_id:_.envelope_id,document_id:_.document_id,signer_email:_.signer_email,key_signer:_.signer_id}),C(_.environment),J(_.provider||c),c==="d4sign"?(d("Documento enviado para D4Sign. Abrindo widget de assinatura..."),await new Promise(k=>setTimeout(k,2e3)),y(_.document_id),E.success(a("sign_doc_sent","Documento enviado! Assine abaixo."))):_.signer_id?(d(`Signer ID obtido: ${_.signer_id}. Aguardando processamento (3s)...`),await new Promise(k=>setTimeout(k,3e3)),y(_.signer_id),E.success(a("sign_doc_sent","Documento enviado! Assine abaixo."))):(d("AVISO: Nenhum signer ID disponível."),E.error(a("sign_access_error","Não foi possível obter o acesso para assinatura. Tente novamente.")),r?.(new Error("Signer ID não disponível")))}catch(c){const p=c instanceof Error?c:new Error(a("sign_process_error","Erro ao processar documento")),j=p.message||"";j.includes("MONTHLY_LIMIT_REACHED")?(d("Limite mensal de assinaturas atingido"),E.error(a("sign_monthly_limit","Limite mensal de assinaturas atingido. Entre em contato com o administrador para ampliar seu plano."))):(d(`Erro: ${j}`),E.error(j)),r?.(p)}finally{w(!1)}}},[i,t,d,r,u]);n.useEffect(()=>{s&&i&&t&&!x&&s!==ee.current&&(ee.current=s,$(s))},[s,i,t,x,$]);const me=g=>{const c=g.target.files?.[0];c&&c.type==="application/pdf"?$(c):E.error(a("sign_select_pdf","Selecione um arquivo PDF"))},B=n.useCallback(async()=>{if(!S||!i)return;U(!0),X(0),H(!1),d("Buscando documento assinado...");const g=6,c=1e4;for(let p=1;p<=g;p++){X(p),d(`Tentativa ${p}/${g}...`);try{const j=await te.getSignedDocument({alias:i,envelopeId:S.envelope_id,documentId:S.document_id,provider:A});if(j.download_url){d("Documento assinado disponível para download"),G(j.download_url),U(!1);return}}catch(j){d(`Erro na tentativa ${p}: ${j instanceof Error?j.message:"Erro desconhecido"}`)}p<g&&(d("Aguardando 10 segundos para próxima tentativa..."),await new Promise(j=>setTimeout(j,c)))}d("Não foi possível obter o documento assinado após 6 tentativas."),U(!1),H(!0)},[S,i,d,A]),se=n.useCallback(async()=>{d("Documento assinado com sucesso!"),E.success(a("sign_signed_success","Documento assinado com sucesso!")),y(null),S&&i&&(o?.({success:!0,provider:A,envelope_id:S.envelope_id,document_id:S.document_id,signer_id:b||"",environment:D}),await B())},[d,o,S,b,i,D,A,B]);if(!i)return e.jsx(N,{className:"border-amber-200 bg-amber-50",children:e.jsx(v,{className:"flex items-start gap-3 py-6",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-amber-800",children:a("sign_auth_required","Autenticação necessária")}),e.jsx("p",{className:"text-sm text-amber-700 mt-1",children:a("sign_login_required","Faça login para utilizar a assinatura digital.")})]})})});const ue=A==="d4sign"?"D4Sign":"Clicksign",q=()=>l&&Z.length>0?e.jsx("div",{className:"bg-muted p-3 rounded-md text-xs font-mono space-y-1 max-h-40 overflow-auto",children:Z.map((g,c)=>e.jsx("div",{children:g},c))}):null;return S&&!b&&(O||Y||V)?e.jsxs("div",{className:"space-y-4",children:[e.jsx(N,{className:"border-green-200 bg-green-50",children:e.jsxs(v,{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx(ve,{className:"h-12 w-12 text-green-600"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-semibold text-green-800",children:a("sign_signed_success","Documento assinado com sucesso!")}),e.jsx("p",{className:"text-sm text-green-700 mt-1",children:h?.name})]}),Y?e.jsxs("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 animate-spin"}),a("sign_preparing_doc","Preparando documento assinado...")," (",a("sign_attempt","tentativa")," ",ce,"/6)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("sign_waiting_provider",`Aguardando processamento pelo ${ue}...`)})]}):O?e.jsx(ne,{asChild:!0,variant:"default",className:"gap-2",children:e.jsxs("a",{href:O,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(de,{className:"h-4 w-4"}),a("sign_download_signed","Baixar documento assinado")]})}):V?e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sign_fetch_failed","Não foi possível obter o documento assinado após 1 minuto.")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("sign_email_fallback","O documento será enviado para o seu e-mail assim que estiver disponível.")})]}),e.jsxs(ne,{variant:"secondary",className:"gap-2",onClick:B,children:[e.jsx(be,{className:"h-4 w-4"}),a("sign_try_again","Tentar novamente")]})]}):null]})}),e.jsx(q,{})]}):b?e.jsxs("div",{className:"space-y-4",children:[A==="d4sign"?e.jsx(Pe,{documentKey:b,signerEmail:S?.signer_email||t?.email||"",signerName:t?.name,keySigner:S?.key_signer,environment:D,onSign:se,onError:r}):e.jsx(ke,{signerId:b,environment:D,onSign:se,onError:r}),e.jsx(q,{})]}):s&&(m||x)?e.jsx(N,{children:e.jsxs(v,{className:"flex items-center justify-center gap-3 py-10",children:[e.jsx(F,{className:"h-6 w-6 animate-spin text-primary"}),e.jsx("p",{className:"font-medium",children:a("sign_sending_doc","Enviando documento para assinatura...")})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{ref:Q,type:"file",accept:"application/pdf",className:"hidden",onChange:me}),m?e.jsx(N,{children:e.jsxs(v,{className:"flex items-center justify-center gap-3 py-10",children:[e.jsx(F,{className:"h-6 w-6 animate-spin text-primary"}),e.jsx("p",{className:"font-medium",children:a("sign_sending_doc","Enviando documento para assinatura...")})]})}):e.jsx(N,{className:"border-dashed border-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>Q.current?.click(),children:e.jsxs(v,{className:"flex flex-col items-center justify-center py-10 gap-3",children:[e.jsx(z,{className:"h-8 w-8 text-muted-foreground"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:a("sign_select_pdf","Selecione um arquivo PDF")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sign_click_to_select","Clique para escolher o documento para assinatura")})]})]})}),e.jsx(q,{})]})}function Fe(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(N,{className:"border-primary bg-primary/5",children:e.jsxs(v,{className:"flex items-center gap-3 p-4",children:[e.jsx(R,{className:"h-5 w-5 text-primary shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"Clicksign"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"API v3 + Widget Embedded 2.1.0"})]}),e.jsx(I,{variant:"default",children:"Ativo"})]})}),e.jsx(N,{className:"border-primary bg-primary/5",children:e.jsxs(v,{className:"flex items-center gap-3 p-4",children:[e.jsx(R,{className:"h-5 w-5 text-primary shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-sm",children:"D4Sign"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"API v1 + iframe Embedded"})]}),e.jsx(I,{variant:"default",children:"Ativo"})]})})]}),e.jsxs(N,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(T,{className:"text-sm flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4 text-primary"}),"Componente Único — 3 Fases"]})}),e.jsxs(v,{className:"text-xs text-muted-foreground space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{variant:"outline",className:"text-xs",children:"1"}),e.jsx(z,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Upload:"})," Seleciona o PDF (ou recebe via prop ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"file"}),")"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{variant:"outline",className:"text-xs",children:"2"}),e.jsx(R,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Assinatura:"})," Widget do provedor configurado (Clicksign embedded ou D4Sign iframe)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{variant:"outline",className:"text-xs",children:"3"}),e.jsx(de,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Assinado:"})," Polling automático (6 tentativas, 10s cada) + botão de retry manual"]})]})]})]}),e.jsxs(N,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(T,{className:"text-sm flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4 text-primary"}),"Comparação dos Provedores"]})}),e.jsx(v,{className:"text-xs text-muted-foreground",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"py-1.5 pr-4 font-medium text-foreground",children:"Característica"}),e.jsx("th",{className:"py-1.5 pr-4 font-medium text-foreground",children:"Clicksign"}),e.jsx("th",{className:"py-1.5 font-medium text-foreground",children:"D4Sign"})]})}),e.jsxs("tbody",{className:"space-y-1",children:[e.jsxs("tr",{className:"border-b border-dashed",children:[e.jsx("td",{className:"py-1.5 pr-4",children:"API"}),e.jsx("td",{className:"py-1.5 pr-4",children:"v3 (JSON:API)"}),e.jsx("td",{className:"py-1.5",children:"v1 (REST)"})]}),e.jsxs("tr",{className:"border-b border-dashed",children:[e.jsx("td",{className:"py-1.5 pr-4",children:"Auth"}),e.jsxs("td",{className:"py-1.5 pr-4",children:["Header ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"Authorization: apiKey"})]}),e.jsxs("td",{className:"py-1.5",children:["Query params ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"tokenAPI + cryptKey"})]})]}),e.jsxs("tr",{className:"border-b border-dashed",children:[e.jsx("td",{className:"py-1.5 pr-4",children:"Widget"}),e.jsx("td",{className:"py-1.5 pr-4",children:"JavaScript embedded (CDN)"}),e.jsx("td",{className:"py-1.5",children:"iframe embedded"})]}),e.jsxs("tr",{className:"border-b border-dashed",children:[e.jsx("td",{className:"py-1.5 pr-4",children:"Callback"}),e.jsx("td",{className:"py-1.5 pr-4",children:e.jsx("code",{className:"bg-muted px-1 rounded",children:"widget.on('signed')"})}),e.jsx("td",{className:"py-1.5",children:e.jsx("code",{className:"bg-muted px-1 rounded",children:"window.postMessage('signed')"})})]}),e.jsxs("tr",{className:"border-b border-dashed",children:[e.jsx("td",{className:"py-1.5 pr-4",children:"Config extra"}),e.jsx("td",{className:"py-1.5 pr-4",children:"—"}),e.jsxs("td",{className:"py-1.5",children:[e.jsx("code",{className:"bg-muted px-1 rounded",children:"crypt_key"}),", ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"uuid_safe"})]})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 pr-4",children:"Sandbox"}),e.jsx("td",{className:"py-1.5 pr-4",children:"Secret automático"}),e.jsx("td",{className:"py-1.5",children:"Config por unidade (não há sandbox automático)"})]})]})]})})})]}),e.jsxs(N,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(T,{className:"text-sm flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-primary"}),"Clicksign — Widget Embedded + Edge Function"]})}),e.jsxs(v,{className:"text-xs text-muted-foreground space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Edge Function (5 passos):"}),e.jsxs("ol",{className:"list-decimal list-inside ml-2 space-y-1",children:[e.jsxs("li",{children:["Cria envelope (",e.jsx("code",{className:"bg-muted px-1 rounded",children:"POST /envelopes"}),")"]}),e.jsxs("li",{children:["Upload do documento (",e.jsx("code",{className:"bg-muted px-1 rounded",children:"POST /envelopes/:id/documents"}),")"]}),e.jsx("li",{children:"Adiciona signatário — apenas nome e e-mail"}),e.jsxs("li",{children:["Cria 2 requirements: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"agree/sign"})," + ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"provide_evidence/email"})]}),e.jsxs("li",{children:["Ativa envelope via ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"PATCH"})," com ",e.jsx("code",{className:"bg-muted px-1 rounded",children:'status: "running"'})]})]}),e.jsx("p",{className:"font-medium text-foreground mt-3",children:"Frontend:"}),e.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[e.jsxs("li",{children:["Aguarda ",e.jsx("strong",{children:"3 segundos"})," para processamento"]}),e.jsxs("li",{children:["Inicializa widget: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"new window.Clicksign(signerId)"})]}),e.jsxs("li",{children:["Script carregado ",e.jsx("strong",{children:"automaticamente"})," pela lib (lazy load sob demanda)"]})]})]})]}),e.jsxs(N,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(T,{className:"text-sm flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-primary"}),"D4Sign — iframe Embedded + Edge Function"]})}),e.jsxs(v,{className:"text-xs text-muted-foreground space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Edge Function (3 passos):"}),e.jsxs("ol",{className:"list-decimal list-inside ml-2 space-y-1",children:[e.jsxs("li",{children:["Upload binary (",e.jsx("code",{className:"bg-muted px-1 rounded",children:"POST /documents/:safe/uploadbinary"}),")"]}),e.jsxs("li",{children:["Registra signatário (",e.jsx("code",{className:"bg-muted px-1 rounded",children:"POST /documents/:uuid/createlist"}),") com ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"skipemail=1"})]}),e.jsxs("li",{children:["Envia para assinatura (",e.jsx("code",{className:"bg-muted px-1 rounded",children:"POST /documents/:uuid/sendtosigner"}),") com ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"skip_email=1"})]})]}),e.jsx("p",{className:"font-medium text-foreground mt-3",children:"Frontend:"}),e.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[e.jsxs("li",{children:["iframe: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"secure.d4sign.com.br/embed/viewblob/{uuid}?email=..."})]}),e.jsxs("li",{children:["Listener: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"window.addEventListener('message')"})]}),e.jsxs("li",{children:["Eventos: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:'"signed"'})," (sucesso) ou ",e.jsx("code",{className:"bg-muted px-1 rounded",children:'"wrong-data"'})," (erro)"]})]})]})]}),e.jsxs(N,{children:[e.jsx(P,{className:"pb-2",children:e.jsxs(T,{className:"text-sm flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-primary"}),"Resolução de Ambiente e Provedor"]})}),e.jsxs(v,{className:"text-xs text-muted-foreground space-y-2",children:[e.jsxs("p",{children:["O frontend envia apenas o ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"alias"})," da unidade."]}),e.jsx("p",{children:"A Edge Function resolve automaticamente qual provedor e chave usar:"}),e.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Tabela:"})," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"sign_configs"})," (coluna ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"provider"}),")"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Clicksign:"})," produção via tabela ou sandbox via secret ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"CLICKSIGN_SANDBOX_API_KEY"})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"D4Sign:"})," configuração obrigatória na tabela (não há sandbox automático)"]})]})]})]})]})}function Re(){const[s,o]=n.useState(null),[r,l]=n.useState(null);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-amber-50 border border-amber-200",children:[e.jsx(ie,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-sm text-amber-800",children:[e.jsx("p",{className:"font-medium",children:"Ambiente de Teste"}),e.jsxs("p",{className:"mt-1",children:[e.jsx("strong",{children:"Clicksign:"})," Unidades sem configuração de produção usam sandbox automaticamente.",e.jsx("br",{}),e.jsx("strong",{children:"D4Sign:"})," Requer configuração na unidade (não há sandbox automático).",e.jsx("br",{}),"Para configurar, acesse ",e.jsx("strong",{children:"/a/cs"})," (aba Assinatura digital no Admin)."]})]})]}),e.jsx(Te,{showEventLog:!0,onDocumentSigned:t=>{o(t),l(null)},onError:t=>{l(t.message),o(null)}}),s&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-emerald-50 border border-emerald-200",children:[e.jsx(ye,{className:"h-4 w-4 text-emerald-600 mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-sm text-emerald-800",children:[e.jsx("p",{className:"font-medium",children:"Documento assinado com sucesso!"}),e.jsx("pre",{className:"mt-2 text-xs font-mono bg-emerald-100 p-2 rounded",children:JSON.stringify(s,null,2)})]})]}),r&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-destructive/10 border border-destructive/20",children:[e.jsx(ie,{className:"h-4 w-4 text-destructive mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-sm text-destructive",children:[e.jsx("p",{className:"font-medium",children:"Erro"}),e.jsx("p",{className:"mt-1",children:r})]})]})]})}function Me(){return e.jsx(Se,{title:"Assinatura Digital (Sign)",description:"Componente único multi-provider de assinatura digital com fluxo em 3 fases: Upload → Assinatura → Download. Suporta Clicksign (widget JavaScript embedded v2.1.0, API v3) e D4Sign (iframe embedded, API v1). O provedor é resolvido automaticamente pela configuração da unidade na tabela sign_configs.",component:e.jsx(Fe,{}),installation:`// Nenhuma configuração manual necessária!
|
|
2
|
-
// O script do Clicksign é carregado automaticamente pela lib (lazy load)
|
|
3
|
-
// D4Sign usa iframe — também não precisa de script externo
|
|
4
|
-
|
|
5
|
-
// Importação do componente principal
|
|
6
|
-
import { DocumentSigner } from 'forlogic-core';
|
|
7
|
-
|
|
8
|
-
// Importação de tipos
|
|
9
|
-
import type {
|
|
10
|
-
SignEnvelopeResult,
|
|
11
|
-
SignedDocumentResult,
|
|
12
|
-
DocumentSignerProps,
|
|
13
|
-
SignProvider, // 'clicksign' | 'd4sign'
|
|
14
|
-
} from 'forlogic-core';`,usage:`// Uso básico — provedor resolvido automaticamente pela config da unidade
|
|
15
|
-
<DocumentSigner
|
|
16
|
-
showEventLog
|
|
17
|
-
onDocumentSigned={(data) => {
|
|
18
|
-
// data.provider → 'clicksign' ou 'd4sign'
|
|
19
|
-
// data.envelope_id, data.document_id, data.signer_id, data.environment
|
|
20
|
-
console.log('Assinado:', data);
|
|
21
|
-
}}
|
|
22
|
-
onError={(error) => {
|
|
23
|
-
console.error('Erro:', error.message);
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
|
|
27
|
-
// Passando PDF programaticamente (sem upload manual)
|
|
28
|
-
<DocumentSigner
|
|
29
|
-
file={meuArquivoPdf}
|
|
30
|
-
onDocumentSigned={(data) => console.log('Assinado:', data)}
|
|
31
|
-
/>`,examples:[{title:"Fluxo Completo (Multi-Provider)",description:"Selecione um PDF → assine no widget do provedor configurado → baixe o documento assinado.",preview:e.jsx(Re,{}),code:`import { DocumentSigner } from 'forlogic-core';
|
|
32
|
-
|
|
33
|
-
function AssinaturaPage() {
|
|
34
|
-
return (
|
|
35
|
-
<DocumentSigner
|
|
36
|
-
showEventLog
|
|
37
|
-
onDocumentSigned={(data) => {
|
|
38
|
-
// data.provider será 'clicksign' ou 'd4sign'
|
|
39
|
-
console.log('Documento assinado:', data);
|
|
40
|
-
}}
|
|
41
|
-
onError={(error) => {
|
|
42
|
-
console.error('Erro:', error.message);
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}`},{title:"Com PDF via prop",description:"Informe o arquivo PDF diretamente, sem upload manual pelo usuário.",preview:e.jsx(N,{children:e.jsx(v,{className:"pt-4",children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium",children:"Prop file"})]}),e.jsxs("ul",{className:"list-disc list-inside text-muted-foreground space-y-1 text-xs",children:[e.jsxs("li",{children:["Aceita um ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"File"})," diretamente"]}),e.jsx("li",{children:"Inicia o processamento automaticamente"}),e.jsx("li",{children:"Pula a fase de upload manual"}),e.jsx("li",{children:"Ideal para integração com formulários existentes"}),e.jsx("li",{children:"Funciona com ambos os provedores"})]})]})})}),code:`import { DocumentSigner } from 'forlogic-core';
|
|
47
|
-
|
|
48
|
-
function MinhaPage() {
|
|
49
|
-
const [file, setFile] = useState<File | null>(null);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<>
|
|
53
|
-
<input
|
|
54
|
-
type="file"
|
|
55
|
-
accept=".pdf"
|
|
56
|
-
onChange={(e) => setFile(e.target.files?.[0] || null)}
|
|
57
|
-
/>
|
|
58
|
-
{file && (
|
|
59
|
-
<DocumentSigner
|
|
60
|
-
file={file}
|
|
61
|
-
onDocumentSigned={(data) => console.log('Assinado:', data)}
|
|
62
|
-
/>
|
|
63
|
-
)}
|
|
64
|
-
</>
|
|
65
|
-
);
|
|
66
|
-
}`}],props:[{name:"file",type:"File",description:"PDF passado programaticamente (pula upload manual)"},{name:"onDocumentSigned",type:"(data: SignEnvelopeResult) => void",description:"Callback quando o documento é assinado. Retorna provider, envelope_id, document_id, signer_id, environment."},{name:"onError",type:"(error: Error) => void",description:"Callback em caso de erro"},{name:"showEventLog",type:"boolean",default:"false",description:"Exibe log de eventos no componente"}],notes:["Multi-provider: suporta Clicksign e D4Sign. O provedor é resolvido automaticamente pela configuração da unidade na tabela sign_configs.",'Clicksign: Widget embedded v2.1.0 com script carregado automaticamente pela lib (lazy load sob demanda). Usa API v3 com header "Authorization: apiKey" (sem Bearer). Não é necessário adicionar nenhum script no index.html.',"D4Sign: iframe embedded apontando para secure.d4sign.com.br/embed/viewblob/{uuid}. Usa API v1 com tokenAPI + cryptKey como query params.","D4Sign NÃO possui sandbox automático via secrets. É necessário configurar a unidade diretamente na tabela sign_configs (via /a/cs).","Clicksign possui fallback automático para sandbox via secret CLICKSIGN_SANDBOX_API_KEY.","Tabela unificada sign_configs com coluna provider (clicksign | d4sign). Campos extras do D4Sign: crypt_key, uuid_safe.","Após assinatura: polling automático busca documento assinado a cada 10s, até 6 tentativas (~1 min).",'Se polling falhar, botão "Tentar novamente" permite busca manual ilimitada.',"Configuração de produção: Admin → /a/cs (aba Assinatura digital)."]})}export{Me as SignDoc};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import{j as e,aE as s,l as c,r as m,aF as i,aG as h,aH as f,aI as C,aJ as k,aK as N,f as r,C as p,a as x,b as u,d as g}from"./index-BtX5DZqb.js";import{C as y}from"./ComponentDocTemplate-BtOCnlM2.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";function S({isLoading:o,children:t,className:a,type:d="spinner",size:n="md"}){return o?d==="overlay"?e.jsxs("div",{className:c("relative",a),children:[t,e.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:e.jsx(s,{size:n})})]}):d==="skeleton"?e.jsx("div",{className:c("animate-pulse",a),children:e.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):e.jsx("div",{className:c("flex items-center justify-center py-8",a),children:e.jsx(s,{size:n})}):e.jsx(e.Fragment,{children:t})}function z(){const[o,t]=m.useState(!1),[a,d]=m.useState(!1),[n,v]=m.useState(!1),l=j=>{j(!0),setTimeout(()=>j(!1),2e3)};return e.jsx(y,{title:"Loading",description:"Componentes para estados de carregamento: Skeleton (placeholders), Spinner (indicador de loading), e LoadingState (gerenciamento declarativo).",component:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(i,{className:"h-12 w-12 rounded-full"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"h-4 w-[250px]"}),e.jsx(i,{className:"h-4 w-[200px]"})]})]}),usage:`import { Skeleton, Spinner, LoadingState } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
// Skeleton básico
|
|
4
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
5
|
-
|
|
6
|
-
// Spinner
|
|
7
|
-
<Spinner size="md" />
|
|
8
|
-
|
|
9
|
-
// LoadingState declarativo
|
|
10
|
-
<LoadingState isLoading={isLoading} type="spinner">
|
|
11
|
-
<div>Conteúdo carregado</div>
|
|
12
|
-
</LoadingState>`,examples:[{title:"Skeleton de Card",preview:e.jsxs("div",{className:"flex flex-col space-y-3 max-w-md",children:[e.jsx(i,{className:"h-[125px] w-full rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"h-4 w-full"}),e.jsx(i,{className:"h-4 w-4/5"})]})]}),code:`<div className="flex flex-col space-y-3">
|
|
13
|
-
<Skeleton className="h-[125px] w-full rounded-xl" />
|
|
14
|
-
<div className="space-y-2">
|
|
15
|
-
<Skeleton className="h-4 w-full" />
|
|
16
|
-
<Skeleton className="h-4 w-4/5" />
|
|
17
|
-
</div>
|
|
18
|
-
</div>`},{title:"Table Skeleton",preview:e.jsx(h,{rows:3,columns:4}),code:"<TableSkeleton rows={3} columns={4} />"},{title:"Card Skeleton",preview:e.jsx(f,{count:2}),code:"<CardSkeleton count={2} />"},{title:"Form Skeleton",preview:e.jsx(C,{fields:3}),code:"<FormSkeleton fields={3} />"},{title:"Header Skeleton",preview:e.jsx(k,{}),code:"<HeaderSkeleton />"},{title:"Sidebar Skeleton",preview:e.jsx("div",{className:"h-48 rounded-lg overflow-hidden border",children:e.jsx(N,{})}),code:"<SidebarSkeleton />"},{title:"Spinner - Tamanhos",preview:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(s,{size:"sm"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"sm"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(s,{size:"md"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"md"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(s,{size:"lg"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"lg"})]})]}),code:`import { Spinner } from "forlogic-core"
|
|
19
|
-
|
|
20
|
-
<Spinner size="sm" />
|
|
21
|
-
<Spinner size="md" />
|
|
22
|
-
<Spinner size="lg" />`},{title:"Spinner - Em Botão",preview:e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(r,{disabled:!0,children:[e.jsx(s,{size:"sm",className:"mr-2"}),"Salvando..."]}),e.jsxs(r,{variant:"secondary",disabled:!0,children:[e.jsx(s,{size:"sm",className:"mr-2"}),"Carregando..."]})]}),code:`<Button disabled>
|
|
23
|
-
<Spinner size="sm" className="mr-2" />
|
|
24
|
-
Salvando...
|
|
25
|
-
</Button>`},{title:"LoadingState - Tipo Spinner",preview:e.jsxs("div",{className:"space-y-4",children:[e.jsx(r,{onClick:()=>l(t),disabled:o,children:o?"Carregando...":"Simular Loading"}),e.jsx(S,{isLoading:o,type:"spinner",children:e.jsxs(p,{children:[e.jsx(x,{children:e.jsx(u,{children:"Conteúdo Carregado"})}),e.jsx(g,{children:"Este conteúdo aparece quando o loading termina."})]})})]}),code:`const [isLoading, setIsLoading] = useState(false);
|
|
26
|
-
|
|
27
|
-
<LoadingState isLoading={isLoading} type="spinner">
|
|
28
|
-
<Card>
|
|
29
|
-
<CardHeader>
|
|
30
|
-
<CardTitle>Conteúdo Carregado</CardTitle>
|
|
31
|
-
</CardHeader>
|
|
32
|
-
<CardContent>
|
|
33
|
-
Este conteúdo aparece quando o loading termina.
|
|
34
|
-
</CardContent>
|
|
35
|
-
</Card>
|
|
36
|
-
</LoadingState>`},{title:"LoadingState - Tipo Overlay",preview:e.jsxs("div",{className:"space-y-4",children:[e.jsx(r,{onClick:()=>l(d),disabled:a,children:a?"Salvando...":"Simular Overlay"}),e.jsx(S,{isLoading:a,type:"overlay",children:e.jsxs(p,{children:[e.jsx(x,{children:e.jsx(u,{children:"Formulário"})}),e.jsxs(g,{className:"space-y-2",children:[e.jsx("p",{children:"O conteúdo fica visível mas com overlay."}),e.jsx("p",{children:"Útil para salvar sem perder contexto visual."})]})]})})]}),code:`<LoadingState isLoading={isSaving} type="overlay">
|
|
37
|
-
<Card>
|
|
38
|
-
<CardHeader>
|
|
39
|
-
<CardTitle>Formulário</CardTitle>
|
|
40
|
-
</CardHeader>
|
|
41
|
-
<CardContent>
|
|
42
|
-
O conteúdo fica visível mas com overlay.
|
|
43
|
-
</CardContent>
|
|
44
|
-
</Card>
|
|
45
|
-
</LoadingState>`},{title:"LoadingState - Tipo Skeleton",preview:e.jsxs("div",{className:"space-y-4",children:[e.jsx(r,{onClick:()=>l(v),disabled:n,children:n?"Carregando...":"Simular Skeleton"}),e.jsx(S,{isLoading:n,type:"skeleton",className:"h-24 w-full",children:e.jsxs(p,{children:[e.jsx(x,{children:e.jsx(u,{children:"Dados Carregados"})}),e.jsx(g,{children:"Este card substitui o skeleton quando carrega."})]})})]}),code:`<LoadingState isLoading={isLoading} type="skeleton" className="h-24 w-full">
|
|
46
|
-
<Card>
|
|
47
|
-
<CardHeader>
|
|
48
|
-
<CardTitle>Dados Carregados</CardTitle>
|
|
49
|
-
</CardHeader>
|
|
50
|
-
<CardContent>
|
|
51
|
-
Este card substitui o skeleton quando carrega.
|
|
52
|
-
</CardContent>
|
|
53
|
-
</Card>
|
|
54
|
-
</LoadingState>`}],props:[{name:"className",type:"string",default:"-",description:"Classes CSS para customizar dimensões e formato."},{name:"rows",type:"number",default:"5",description:"Número de linhas (TableSkeleton)."},{name:"columns",type:"number",default:"4",description:"Número de colunas (TableSkeleton)."},{name:"count",type:"number",default:"3",description:"Número de cards (CardSkeleton)."},{name:"fields",type:"number",default:"4",description:"Número de campos (FormSkeleton)."},{name:"size",type:'"sm" | "md" | "lg"',default:'"md"',description:"Tamanho do Spinner."},{name:"isLoading",type:"boolean",default:"-",description:"Estado de loading (LoadingState)."},{name:"type",type:'"spinner" | "skeleton" | "overlay"',default:'"spinner"',description:"Tipo de loading state."}],notes:["**Skeleton**: Placeholder animado que imita o formato do conteúdo. Use para carregamentos iniciais.","**Spinner**: Indicador circular de loading. Use em botões ou áreas pequenas.","**LoadingState**: Componente declarativo que gerencia exibição de loading vs conteúdo.",'**type="spinner"**: Esconde children e mostra apenas o spinner centralizado.','**type="overlay"**: Mantém children visíveis com um spinner sobreposto. Ideal para salvar.','**type="skeleton"**: Mostra um placeholder animado no lugar dos children.'],accessibility:["Usa animação para indicar estado de carregamento","Dimensionamento corresponde ao conteúdo esperado","Não interfere com leitores de tela","Animação respeita preferências de movimento reduzido","LoadingState com overlay mantém contexto visual para usuários",'Spinner tem role="status" implícito para leitores de tela']})}export{z as SkeletonDoc};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{r as d,Y as ue,j as t,a4 as D,$ as B,a2 as E,X as me,a3 as fe,d2 as X,cR as pe,a6 as xe,cQ as he,l as ve,L as R}from"./index-BtX5DZqb.js";import{C as ge}from"./ComponentDocTemplate-BtOCnlM2.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";var W=["PageUp","PageDown"],G=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],q={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},_="Slider",[z,Se,be]=me(_),[Q]=xe(_,[be]),[we,K]=Q(_),J=d.forwardRef((e,s)=>{const{name:n,min:a=0,max:o=100,step:c=1,orientation:r="horizontal",disabled:l=!1,minStepsBetweenThumbs:m=0,defaultValue:S=[a],value:h,onValueChange:i=()=>{},onValueCommit:u=()=>{},inverted:g=!1,form:j,...v}=e,p=d.useRef(new Set),f=d.useRef(0),b=r==="horizontal"?ye:je,[x=[],M]=ue({prop:h,defaultProp:S,onChange:w=>{[...p.current][f.current]?.focus(),i(w)}}),T=d.useRef(x);function L(w){const N=Ve(x,w);A(w,N)}function ce(w){A(w,f.current)}function de(){const w=T.current[f.current];x[f.current]!==w&&u(x)}function A(w,N,{commit:k}={commit:!1}){const U=Me(c),O=Ae(Math.round((w-a)/c)*c+a,U),I=X(O,[a,o]);M((V=[])=>{const P=Pe(V,I,N);if(_e(P,m*c)){f.current=P.indexOf(I);const Y=String(P)!==String(V);return Y&&k&&u(P),Y?P:V}else return V})}return t.jsx(we,{scope:e.__scopeSlider,name:n,disabled:l,min:a,max:o,valueIndexToChangeRef:f,thumbs:p.current,values:x,orientation:r,form:j,children:t.jsx(z.Provider,{scope:e.__scopeSlider,children:t.jsx(z.Slot,{scope:e.__scopeSlider,children:t.jsx(b,{"aria-disabled":l,"data-disabled":l?"":void 0,...v,ref:s,onPointerDown:D(v.onPointerDown,()=>{l||(T.current=x)}),min:a,max:o,inverted:g,onSlideStart:l?void 0:L,onSlideMove:l?void 0:ce,onSlideEnd:l?void 0:de,onHomeKeyDown:()=>!l&&A(a,0,{commit:!0}),onEndKeyDown:()=>!l&&A(o,x.length-1,{commit:!0}),onStepKeyDown:({event:w,direction:N})=>{if(!l){const O=W.includes(w.key)||w.shiftKey&&G.includes(w.key)?10:1,I=f.current,V=x[I],P=c*O*N;A(V+P,I,{commit:!0})}}})})})})});J.displayName=_;var[Z,ee]=Q(_,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ye=d.forwardRef((e,s)=>{const{min:n,max:a,dir:o,inverted:c,onSlideStart:r,onSlideMove:l,onSlideEnd:m,onStepKeyDown:S,...h}=e,[i,u]=d.useState(null),g=E(s,b=>u(b)),j=d.useRef(void 0),v=fe(o),p=v==="ltr",f=p&&!c||!p&&c;function C(b){const x=j.current||i.getBoundingClientRect(),M=[0,x.width],L=F(M,f?[n,a]:[a,n]);return j.current=x,L(b-x.left)}return t.jsx(Z,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:t.jsx(te,{dir:v,"data-orientation":"horizontal",...h,ref:g,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const x=C(b.clientX);r?.(x)},onSlideMove:b=>{const x=C(b.clientX);l?.(x)},onSlideEnd:()=>{j.current=void 0,m?.()},onStepKeyDown:b=>{const M=q[f?"from-left":"from-right"].includes(b.key);S?.({event:b,direction:M?-1:1})}})})}),je=d.forwardRef((e,s)=>{const{min:n,max:a,inverted:o,onSlideStart:c,onSlideMove:r,onSlideEnd:l,onStepKeyDown:m,...S}=e,h=d.useRef(null),i=E(s,h),u=d.useRef(void 0),g=!o;function j(v){const p=u.current||h.current.getBoundingClientRect(),f=[0,p.height],b=F(f,g?[a,n]:[n,a]);return u.current=p,b(v-p.top)}return t.jsx(Z,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:t.jsx(te,{"data-orientation":"vertical",...S,ref:i,style:{...S.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:v=>{const p=j(v.clientY);c?.(p)},onSlideMove:v=>{const p=j(v.clientY);r?.(p)},onSlideEnd:()=>{u.current=void 0,l?.()},onStepKeyDown:v=>{const f=q[g?"from-bottom":"from-top"].includes(v.key);m?.({event:v,direction:f?-1:1})}})})}),te=d.forwardRef((e,s)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:l,onStepKeyDown:m,...S}=e,h=K(_,n);return t.jsx(B.span,{...S,ref:s,onKeyDown:D(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(l(i),i.preventDefault()):W.concat(G).includes(i.key)&&(m(i),i.preventDefault())}),onPointerDown:D(e.onPointerDown,i=>{const u=i.target;u.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(u)?u.focus():a(i)}),onPointerMove:D(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&o(i)}),onPointerUp:D(e.onPointerUp,i=>{const u=i.target;u.hasPointerCapture(i.pointerId)&&(u.releasePointerCapture(i.pointerId),c(i))})})}),se="SliderTrack",ne=d.forwardRef((e,s)=>{const{__scopeSlider:n,...a}=e,o=K(se,n);return t.jsx(B.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...a,ref:s})});ne.displayName=se;var H="SliderRange",ae=d.forwardRef((e,s)=>{const{__scopeSlider:n,...a}=e,o=K(H,n),c=ee(H,n),r=d.useRef(null),l=E(s,r),m=o.values.length,S=o.values.map(u=>ie(u,o.min,o.max)),h=m>1?Math.min(...S):0,i=100-Math.max(...S);return t.jsx(B.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...a,ref:l,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ae.displayName=H;var $="SliderThumb",oe=d.forwardRef((e,s)=>{const n=Se(e.__scopeSlider),[a,o]=d.useState(null),c=E(s,l=>o(l)),r=d.useMemo(()=>a?n().findIndex(l=>l.ref.current===a):-1,[n,a]);return t.jsx(Re,{...e,ref:c,index:r})}),Re=d.forwardRef((e,s)=>{const{__scopeSlider:n,index:a,name:o,...c}=e,r=K($,n),l=ee($,n),[m,S]=d.useState(null),h=E(s,C=>S(C)),i=m?r.form||!!m.closest("form"):!0,u=pe(m),g=r.values[a],j=g===void 0?0:ie(g,r.min,r.max),v=Ce(a,r.values.length),p=u?.[l.size],f=p?De(p,j,l.direction):0;return d.useEffect(()=>{if(m)return r.thumbs.add(m),()=>{r.thumbs.delete(m)}},[m,r.thumbs]),t.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${j}% + ${f}px)`},children:[t.jsx(z.ItemSlot,{scope:e.__scopeSlider,children:t.jsx(B.span,{role:"slider","aria-label":e["aria-label"]||v,"aria-valuemin":r.min,"aria-valuenow":g,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:g===void 0?{display:"none"}:e.style,onFocus:D(e.onFocus,()=>{r.valueIndexToChangeRef.current=a})})}),i&&t.jsx(re,{name:o??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:g},a)]})});oe.displayName=$;var Ne="RadioBubbleInput",re=d.forwardRef(({__scopeSlider:e,value:s,...n},a)=>{const o=d.useRef(null),c=E(o,a),r=he(s);return d.useEffect(()=>{const l=o.current;if(!l)return;const m=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(m,"value").set;if(r!==s&&h){const i=new Event("input",{bubbles:!0});h.call(l,s),l.dispatchEvent(i)}},[r,s]),t.jsx(B.input,{style:{display:"none"},...n,ref:c,defaultValue:s})});re.displayName=Ne;function Pe(e=[],s,n){const a=[...e];return a[n]=s,a.sort((o,c)=>o-c)}function ie(e,s,n){const c=100/(n-s)*(e-s);return X(c,[0,100])}function Ce(e,s){return s>2?`Value ${e+1} of ${s}`:s===2?["Minimum","Maximum"][e]:void 0}function Ve(e,s){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-s)),a=Math.min(...n);return n.indexOf(a)}function De(e,s,n){const a=e/2,c=F([0,50],[0,a]);return(a-c(s)*n)*n}function Ee(e){return e.slice(0,-1).map((s,n)=>e[n+1]-s)}function _e(e,s){if(s>0){const n=Ee(e);return Math.min(...n)>=s}return!0}function F(e,s){return n=>{if(e[0]===e[1]||s[0]===s[1])return s[0];const a=(s[1]-s[0])/(e[1]-e[0]);return s[0]+a*(n-e[0])}}function Me(e){return(String(e).split(".")[1]||"").length}function Ae(e,s){const n=Math.pow(10,s);return Math.round(e*n)/n}var le=J,Ie=ne,Be=ae,Ke=oe;const y=d.forwardRef(({className:e,value:s,defaultValue:n,...a},o)=>{const c=s||n||[0];return t.jsxs(le,{ref:o,value:s,defaultValue:n,className:ve("relative flex w-full touch-none select-none items-center",e),...a,children:[t.jsx(Ie,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:t.jsx(Be,{className:"absolute h-full bg-primary"})}),c.map((r,l)=>t.jsx(Ke,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},l))]})});y.displayName=le.displayName;function ze(){return t.jsx(ge,{title:"Slider",description:"Um input onde o usuário seleciona um valor dentro de um intervalo determinado.",component:t.jsx(y,{defaultValue:[50],max:100,step:1,className:"w-[60%]"}),usage:`import { Slider } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<Slider defaultValue={[50]} max={100} step={1} />`,examples:[{title:"Padrão",preview:t.jsx(y,{defaultValue:[50],max:100,step:1,className:"w-[60%]"}),code:"<Slider defaultValue={[50]} max={100} step={1} />"},{title:"Com Valor Exibido",preview:(()=>{const[e,s]=d.useState([50]);return t.jsxs("div",{className:"space-y-4 w-[60%]",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Volume"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[e[0],"%"]})]}),t.jsx(y,{value:e,onValueChange:s,max:100,step:1})]})})(),code:`const [value, setValue] = useState([50]);
|
|
4
|
-
|
|
5
|
-
<div className="space-y-4">
|
|
6
|
-
<div className="flex justify-between">
|
|
7
|
-
<Label>Volume</Label>
|
|
8
|
-
<span>{value[0]}%</span>
|
|
9
|
-
</div>
|
|
10
|
-
<Slider value={value} onValueChange={setValue} max={100} step={1} />
|
|
11
|
-
</div>`},{title:"Intervalo (Range)",preview:(()=>{const[e,s]=d.useState([25,75]);return t.jsxs("div",{className:"space-y-4 w-[60%]",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Faixa de Preço"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:["R$ ",e[0]," - R$ ",e[1]]})]}),t.jsx(y,{value:e,onValueChange:s,max:100,step:1})]})})(),code:`const [range, setRange] = useState([25, 75]);
|
|
12
|
-
|
|
13
|
-
<Slider value={range} onValueChange={setRange} max={100} step={1} />`},{title:"Estados",preview:t.jsxs("div",{className:"space-y-6 w-[60%]",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(R,{children:"Normal"}),t.jsx(y,{defaultValue:[50],max:100,step:1})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(R,{className:"text-muted-foreground",children:"Desabilitado"}),t.jsx(y,{defaultValue:[50],max:100,step:1,disabled:!0})]})]}),code:`<Slider defaultValue={[50]} max={100} step={1} />
|
|
14
|
-
<Slider defaultValue={[50]} max={100} step={1} disabled />`},{title:"Casos de Uso - Configurações",preview:(()=>{const[e,s]=d.useState([70]),[n,a]=d.useState([50]),[o,c]=d.useState([60]);return t.jsxs("div",{className:"space-y-6 w-[70%]",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Brilho"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[e[0],"%"]})]}),t.jsx(y,{value:e,onValueChange:s,max:100,step:1})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Contraste"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[n[0],"%"]})]}),t.jsx(y,{value:n,onValueChange:a,max:100,step:1})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Saturação"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[o[0],"%"]})]}),t.jsx(y,{value:o,onValueChange:c,max:100,step:1})]})]})})(),code:`const [brightness, setBrightness] = useState([70]);
|
|
15
|
-
|
|
16
|
-
<div className="space-y-2">
|
|
17
|
-
<div className="flex justify-between">
|
|
18
|
-
<Label>Brilho</Label>
|
|
19
|
-
<span>{brightness[0]}%</span>
|
|
20
|
-
</div>
|
|
21
|
-
<Slider
|
|
22
|
-
value={brightness}
|
|
23
|
-
onValueChange={setBrightness}
|
|
24
|
-
max={100}
|
|
25
|
-
step={1}
|
|
26
|
-
/>
|
|
27
|
-
</div>`},{title:"Casos de Uso - Filtro de Busca",preview:(()=>{const[e,s]=d.useState([200,800]),[n,a]=d.useState([4]);return t.jsxs("div",{className:"space-y-6 w-[70%]",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Faixa de Preço"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:["R$ ",e[0]," - R$ ",e[1]]})]}),t.jsx(y,{value:e,onValueChange:s,min:0,max:1e3,step:10})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(R,{children:"Avaliação Mínima"}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:["⭐ ",n[0]," estrelas"]})]}),t.jsx(y,{value:n,onValueChange:a,min:1,max:5,step:1})]})]})})(),code:`const [priceRange, setPriceRange] = useState([200, 800]);
|
|
28
|
-
|
|
29
|
-
<div className="space-y-2">
|
|
30
|
-
<div className="flex justify-between">
|
|
31
|
-
<Label>Faixa de Preço</Label>
|
|
32
|
-
<span>R$ {priceRange[0]} - R$ {priceRange[1]}</span>
|
|
33
|
-
</div>
|
|
34
|
-
<Slider
|
|
35
|
-
value={priceRange}
|
|
36
|
-
onValueChange={setPriceRange}
|
|
37
|
-
min={0}
|
|
38
|
-
max={1000}
|
|
39
|
-
step={10}
|
|
40
|
-
/>
|
|
41
|
-
</div>`}],props:[{name:"defaultValue",type:"number[]",default:"-",description:"O(s) valor(es) padrão."},{name:"value",type:"number[]",default:"-",description:"O(s) valor(es) controlado(s)."},{name:"min",type:"number",default:"0",description:"O valor mínimo."},{name:"max",type:"number",default:"100",description:"O valor máximo."},{name:"step",type:"number",default:"1",description:"O incremento do passo."},{name:"disabled",type:"boolean",default:"false",description:"Se o slider está desabilitado."}],accessibility:["Suporte completo de teclado (teclas de seta para ajustar)","Segue o padrão WAI-ARIA de slider","Labels e valores ARIA adequados","Indicadores de foco visíveis"]})}export{ze as SliderDoc};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as e,C as n,a as d,b as l,c,d as r,l as o}from"./index-BtX5DZqb.js";function x(){const i=[{name:"0",value:"0px",class:"p-0"},{name:"0.5",value:"2px",class:"p-0.5"},{name:"1",value:"4px",class:"p-1"},{name:"1.5",value:"6px",class:"p-1.5"},{name:"2",value:"8px",class:"p-2"},{name:"2.5",value:"10px",class:"p-2.5"},{name:"3",value:"12px",class:"p-3"},{name:"3.5",value:"14px",class:"p-3.5"},{name:"4",value:"16px",class:"p-4"},{name:"5",value:"20px",class:"p-5"},{name:"6",value:"24px",class:"p-6"},{name:"7",value:"28px",class:"p-7"},{name:"8",value:"32px",class:"p-8"},{name:"9",value:"36px",class:"p-9"},{name:"10",value:"40px",class:"p-10"},{name:"11",value:"44px",class:"p-11"},{name:"12",value:"48px",class:"p-12"},{name:"14",value:"56px",class:"p-14"},{name:"16",value:"64px",class:"p-16"},{name:"20",value:"80px",class:"p-20"},{name:"24",value:"96px",class:"p-24"}];return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-4xl font-bold tracking-tight",children:"Sistema de Espaçamento"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Escala de espaçamento consistente baseada em uma unidade base de 4px (0.25rem), garantindo ritmo visual e alinhamento em todos os componentes."})]}),e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsx(l,{children:"Escala de Espaçamento"}),e.jsx(c,{children:"Escala base-4 de 0px a 96px"})]}),e.jsx(r,{children:e.jsx("div",{className:"space-y-4",children:i.map(s=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-16 text-sm font-mono text-muted-foreground",children:s.name}),e.jsx("div",{className:"w-20 text-sm font-mono text-muted-foreground",children:s.value}),e.jsx("div",{className:"flex-1 bg-muted rounded-lg overflow-hidden",children:e.jsx("div",{className:"bg-primary h-8",style:{width:s.value}})}),e.jsx("code",{className:"text-xs text-muted-foreground w-16",children:s.class.replace("p-","")})]},s.name))})})]}),e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsx(l,{children:"Espaçamento Semântico"}),e.jsx(c,{children:"Padrões comuns de espaçamento com nomes semânticos"})]}),e.jsxs(r,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Espaçamento de Componentes"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:"Compacto (gap-2)",description:"Espaçamento apertado para itens relacionados",className:"gap-2"}),e.jsx(a,{label:"Padrão (gap-4)",description:"Espaçamento padrão entre elementos",className:"gap-4"}),e.jsx(a,{label:"Confortável (gap-6)",description:"Espaçamento generoso para respiro",className:"gap-6"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Espaçamento de Seções"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:"Pequeno (space-y-4)",description:"Seções pequenas ou conteúdo aninhado",className:"gap-4"}),e.jsx(a,{label:"Médio (space-y-8)",description:"Espaçamento padrão de seção",className:"gap-8"}),e.jsx(a,{label:"Grande (space-y-12)",description:"Seções principais ou divisões de página",className:"gap-12"})]})]})]})]}),e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsx(l,{children:"Exemplos de Padding"}),e.jsx(c,{children:"Padrões comuns de padding para componentes"})]}),e.jsx(r,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Button (px-4 py-2)"}),e.jsx("div",{className:"inline-flex px-4 py-2 bg-primary text-primary-foreground rounded-md",children:"Button Text"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Card (p-6)"}),e.jsx("div",{className:"p-6 bg-card border rounded-lg",children:"Card content with standard padding"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Input (px-3 py-2)"}),e.jsx("div",{className:"px-3 py-2 bg-background border rounded-md",children:"Input field padding"})]})]})})]}),e.jsxs(n,{children:[e.jsx(d,{children:e.jsx(l,{children:"Diretrizes de Espaçamento"})}),e.jsxs(r,{className:"prose prose-slate dark:prose-invert max-w-none",children:[e.jsx("h3",{children:"Princípios"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Consistência"}),": Use tokens de espaçamento de forma consistente em toda a aplicação"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Ritmo"}),": Mantenha ritmo visual usando múltiplos de 4px"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Respiro"}),": Garanta espaçamento suficiente para leitura e interação confortáveis"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Agrupamento"}),": Use espaçamento para criar relações visuais entre elementos"]})]}),e.jsx("h3",{children:"Padrões Comuns"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Itens relacionados"}),": gap-2 ou gap-3 (8-12px)"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Componentes"}),": gap-4 ou gap-6 (16-24px)"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Seções"}),": space-y-8 ou space-y-12 (32-48px)"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Margens de página"}),": p-6 ou p-8 (24-32px)"]})]}),e.jsx("h3",{children:"Melhores Práticas"}),e.jsxs("ul",{children:[e.jsx("li",{children:"Use utilitários gap para layouts flex/grid ao invés de margins"}),e.jsx("li",{children:"Prefira space-y/space-x para espaçamento consistente entre filhos"}),e.jsxs("li",{children:["Use espaçamento responsivo (ex: ",e.jsx("code",{children:"p-4 md:p-6 lg:p-8"}),") para melhor experiência mobile"]}),e.jsx("li",{children:"Evite valores arbitrários - mantenha-se na escala de espaçamento"})]}),e.jsx("h4",{className:"font-semibold mb-3 mt-6",children:"Exemplos de Código"}),e.jsxs("div",{className:"space-y-4 not-prose",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2 text-green-600 dark:text-green-400",children:"✅ Correto"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:e.jsx("code",{children:`<div className="space-y-6">
|
|
2
|
-
<Card className="p-6">
|
|
3
|
-
<div className="flex gap-4">
|
|
4
|
-
<Button>Ação</Button>
|
|
5
|
-
<Button variant="outline">Cancelar</Button>
|
|
6
|
-
</div>
|
|
7
|
-
</Card>
|
|
8
|
-
</div>`})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2 text-red-600 dark:text-red-400",children:"❌ Incorreto"}),e.jsx("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:e.jsx("code",{children:`<div style={{ marginBottom: '25px' }}>
|
|
9
|
-
<Card style={{ padding: '22px' }}>
|
|
10
|
-
...
|
|
11
|
-
</Card>
|
|
12
|
-
</div>`})})]})]})]})]})]})}function a({label:i,description:s,className:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s})]})}),e.jsxs("div",{className:o("flex bg-muted p-4 rounded-lg",t),children:[e.jsx("div",{className:"h-12 w-20 bg-primary rounded"}),e.jsx("div",{className:"h-12 w-20 bg-primary rounded"}),e.jsx("div",{className:"h-12 w-20 bg-primary rounded"})]})]})}export{x as SpacingDoc};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import{r as k,j as o,F as e,G as S,J as n,K as l,x as c,M as h,T as f,P as r,u as d}from"./index-BtX5DZqb.js";import{C as g}from"./ComponentDocTemplate-BtOCnlM2.js";import{S as p,C as A}from"./share-2-Dz_89MJb.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";const y=`import { SplitButton } from 'forlogic-core';
|
|
2
|
-
import { Plus } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
<SplitButton
|
|
5
|
-
label="Adicionar Coluna"
|
|
6
|
-
onClick={() => handleAddColumn()}
|
|
7
|
-
icon={Plus}
|
|
8
|
-
actions={[
|
|
9
|
-
{ id: 'add-column', label: 'Adicionar Coluna', onClick: handleAddColumn },
|
|
10
|
-
{ id: 'add-group', label: 'Adicionar Grupo', onClick: handleAddGroup },
|
|
11
|
-
]}
|
|
12
|
-
/>`,E=`// Variante default (primary)
|
|
13
|
-
<SplitButton label="Primary" onClick={onClick} actions={actions} />
|
|
14
|
-
|
|
15
|
-
// Variante secondary
|
|
16
|
-
<SplitButton label="Secondary" variant="secondary" onClick={onClick} actions={actions} />
|
|
17
|
-
|
|
18
|
-
// Variante outline
|
|
19
|
-
<SplitButton label="Outline" variant="outline" onClick={onClick} actions={actions} />
|
|
20
|
-
|
|
21
|
-
// Variante ghost
|
|
22
|
-
<SplitButton label="Ghost" variant="ghost" onClick={onClick} actions={actions} />`,j=`// Tamanho pequeno
|
|
23
|
-
<SplitButton label="Small" size="sm" onClick={onClick} actions={actions} />
|
|
24
|
-
|
|
25
|
-
// Tamanho padrão
|
|
26
|
-
<SplitButton label="Default" size="default" onClick={onClick} actions={actions} />
|
|
27
|
-
|
|
28
|
-
// Tamanho grande
|
|
29
|
-
<SplitButton label="Large" size="lg" onClick={onClick} actions={actions} />`,B=`// Estado de loading
|
|
30
|
-
<SplitButton label="Salvando..." loading onClick={onClick} actions={actions} />
|
|
31
|
-
|
|
32
|
-
// Estado desabilitado
|
|
33
|
-
<SplitButton label="Desabilitado" disabled onClick={onClick} actions={actions} />`,D=`// Quando não há ações secundárias, comporta-se como botão simples
|
|
34
|
-
<SplitButton
|
|
35
|
-
label="Salvar"
|
|
36
|
-
onClick={() => handleSave()}
|
|
37
|
-
icon={Save}
|
|
38
|
-
/>`,w=`<SplitButton
|
|
39
|
-
label="Ações"
|
|
40
|
-
onClick={() => handleDefault()}
|
|
41
|
-
actions={[
|
|
42
|
-
{ id: 'copy', label: 'Copiar', icon: Copy, onClick: handleCopy },
|
|
43
|
-
{ id: 'delete', label: 'Excluir', icon: Trash2, onClick: handleDelete, variant: 'destructive' },
|
|
44
|
-
]}
|
|
45
|
-
/>`;function N(){const[t,s]=k.useState(!1),a=x=>{d.success(`Ação executada: ${x}`)},u=()=>{s(!0),setTimeout(()=>{s(!1),d.success("Salvo com sucesso!")},2e3)},m=[{id:"add-column",label:"Adicionar Coluna",icon:A,onClick:()=>a("Adicionar Coluna")},{id:"add-group",label:"Adicionar Grupo",icon:r,onClick:()=>a("Adicionar Grupo")}],i=[{id:"save-draft",label:"Salvar como Rascunho",icon:S,onClick:()=>a("Salvar Rascunho")},{id:"save-template",label:"Salvar como Modelo",icon:n,onClick:()=>a("Salvar Modelo")}],C=[{id:"export-pdf",label:"Exportar PDF",onClick:()=>a("Exportar PDF")},{id:"export-excel",label:"Exportar Excel",onClick:()=>a("Exportar Excel")},{id:"export-csv",label:"Exportar CSV",onClick:()=>a("Exportar CSV")}],b=[{id:"email",label:"Enviar por E-mail",icon:h,onClick:()=>a("E-mail")},{id:"link",label:"Copiar Link",icon:n,onClick:()=>a("Link")},{id:"share",label:"Compartilhar",icon:p,onClick:()=>a("Compartilhar")}],v=[{id:"copy",label:"Duplicar",icon:n,onClick:()=>a("Duplicar")},{id:"delete",label:"Excluir",icon:f,onClick:()=>a("Excluir"),variant:"destructive"}];return o.jsx(g,{title:"Split Button",description:"Combina uma ação principal com ações secundárias em um menu dropdown. Ideal para destacar a ação prioritária enquanto mantém alternativas acessíveis.",component:o.jsx("div",{className:"flex items-center gap-4",children:o.jsx(e,{label:"Adicionar Coluna",onClick:()=>a("Adicionar Coluna"),icon:r,actions:m})}),usage:y,notes:["Ação principal destacada com clique direto","Menu dropdown para ações secundárias","Estados hover e active independentes para cada área","Suporte a ícones, loading e disabled","Fallback para botão simples quando sem ações secundárias","4 variantes visuais e 3 tamanhos"],examples:[{title:"Variantes",description:"O Split Button suporta as mesmas variantes do Button padrão.",preview:o.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[o.jsx(e,{label:"Primary",onClick:()=>a("Primary"),actions:i}),o.jsx(e,{label:"Secondary",variant:"secondary",onClick:()=>a("Secondary"),actions:i}),o.jsx(e,{label:"Outline",variant:"outline",onClick:()=>a("Outline"),actions:i}),o.jsx(e,{label:"Ghost",variant:"ghost",onClick:()=>a("Ghost"),actions:i})]}),code:E},{title:"Tamanhos",description:"Três tamanhos disponíveis: sm, default e lg.",preview:o.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[o.jsx(e,{label:"Small",size:"sm",onClick:()=>a("Small"),actions:i}),o.jsx(e,{label:"Default",size:"default",onClick:()=>a("Default"),actions:i}),o.jsx(e,{label:"Large",size:"lg",onClick:()=>a("Large"),actions:i})]}),code:j},{title:"Com Ícones",description:"Adicione ícones ao botão principal e às ações do menu.",preview:o.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[o.jsx(e,{label:"Salvar",onClick:()=>a("Salvar"),icon:l,actions:i}),o.jsx(e,{label:"Exportar",onClick:()=>a("Exportar"),icon:c,variant:"secondary",actions:C}),o.jsx(e,{label:"Compartilhar",onClick:()=>a("Compartilhar"),icon:p,variant:"outline",actions:b})]}),code:`<SplitButton
|
|
46
|
-
label="Salvar"
|
|
47
|
-
onClick={handleSave}
|
|
48
|
-
icon={Save}
|
|
49
|
-
actions={[
|
|
50
|
-
{ id: 'draft', label: 'Salvar como Rascunho', icon: FileText, onClick: handleDraft },
|
|
51
|
-
{ id: 'template', label: 'Salvar como Modelo', icon: Copy, onClick: handleTemplate },
|
|
52
|
-
]}
|
|
53
|
-
/>`},{title:"Estados: Loading e Disabled",description:"O Split Button suporta estados de loading e disabled que afetam ambas as áreas.",preview:o.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[o.jsx(e,{label:t?"Salvando...":"Salvar",loading:t,onClick:u,icon:l,actions:i}),o.jsx(e,{label:"Desabilitado",disabled:!0,onClick:()=>{},actions:i})]}),code:B},{title:"Ação Única (Fallback)",description:"Quando não há ações secundárias, o componente se comporta como um botão simples.",preview:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(e,{label:"Salvar",onClick:()=>a("Salvar"),icon:l}),o.jsx(e,{label:"Exportar",onClick:()=>a("Exportar"),icon:c,variant:"secondary"})]}),code:D},{title:"Ação Destrutiva",description:"Ações podem ter variante destructive para indicar operações perigosas.",preview:o.jsx("div",{className:"flex items-center gap-4",children:o.jsx(e,{label:"Ações",onClick:()=>a("Ação padrão"),variant:"outline",actions:v})}),code:w}],props:[{name:"label",type:"string",description:"Texto exibido no botão principal (obrigatório)"},{name:"onClick",type:"() => void",description:"Callback executado ao clicar no botão principal (obrigatório)"},{name:"icon",type:"LucideIcon",description:"Ícone opcional exibido antes do label"},{name:"actions",type:"SplitButtonAction[]",default:"[]",description:"Lista de ações secundárias exibidas no dropdown"},{name:"variant",type:"'default' | 'secondary' | 'outline' | 'ghost'",default:"'default'",description:"Variante visual do botão"},{name:"size",type:"'sm' | 'default' | 'lg'",default:"'default'",description:"Tamanho do botão"},{name:"disabled",type:"boolean",default:"false",description:"Desabilita todo o componente"},{name:"loading",type:"boolean",default:"false",description:"Exibe estado de loading"},{name:"menuAlign",type:"'start' | 'end'",default:"'end'",description:"Alinhamento do menu dropdown"},{name:"className",type:"string",description:"Classes CSS adicionais"}],accessibility:["O botão principal é focável e ativável por teclado","O trigger do dropdown tem aria-label descritivo","O menu pode ser navegado com setas do teclado","Esc fecha o menu e retorna o foco","Estados disabled são anunciados por leitores de tela"]})}export{N as SplitButtonDoc};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{j as e,r as n,C as p,f as r}from"./index-BtX5DZqb.js";import{C as m}from"./ComponentDocTemplate-BtOCnlM2.js";import{S as s}from"./step-selector-D0_Y1dow.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";function x(){const[a,t]=n.useState(1);return e.jsxs("div",{className:"flex flex-col items-center gap-4 p-4",children:[e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"outline",size:"sm",onClick:()=>t(Math.max(1,a-1)),disabled:a===1,children:"Voltar"}),e.jsx(r,{size:"sm",onClick:()=>t(Math.min(4,a+1)),disabled:a===4,children:"Avançar"})]})]})}function u(){const[a,t]=n.useState(1),o=["Tipo","Dados","Configuração","Confirmar"];return e.jsxs("div",{className:"flex flex-col items-center gap-4 p-4",children:[e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,stepLabels:o}),e.jsxs(p,{className:"p-4 text-center min-w-[200px]",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Etapa atual:"}),e.jsx("p",{className:"font-medium",children:o[a-1]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"outline",size:"sm",onClick:()=>t(Math.max(1,a-1)),disabled:a===1,children:"Voltar"}),e.jsx(r,{size:"sm",onClick:()=>t(Math.min(4,a+1)),disabled:a===4,children:"Avançar"})]})]})}function S(){const[a,t]=n.useState(1),[o,c]=n.useState(1),l=["Informações","Endereço","Pagamento","Revisão"],d=()=>{const i=Math.min(4,a+1);t(i),c(Math.max(o,i))};return e.jsxs("div",{className:"flex flex-col items-center gap-4 p-4",children:[e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,stepLabels:l,canGoToStep:i=>i<=o}),e.jsxs(p,{className:"p-4 text-center min-w-[200px]",children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Máximo acessível: Etapa ",o]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Etapas futuras ficam desabilitadas até você avançar"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"outline",size:"sm",onClick:()=>t(Math.max(1,a-1)),disabled:a===1,children:"Voltar"}),e.jsx(r,{size:"sm",onClick:d,disabled:a===4,children:"Validar e Avançar"})]})]})}function g(){const[a,t]=n.useState(2);return e.jsx("div",{className:"flex flex-col items-center gap-6 p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:"w-24:"}),e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,progressWidth:"w-24"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:"w-32:"}),e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,progressWidth:"w-32"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:"w-48:"}),e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,progressWidth:"w-48"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground w-16",children:"w-64:"}),e.jsx(s,{currentStep:a,totalSteps:4,onStepChange:t,progressWidth:"w-64"})]})]})})}const h=`import { StepSelector } from 'forlogic-core';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
|
|
4
|
-
function MyWizard() {
|
|
5
|
-
const [step, setStep] = useState(1);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<StepSelector
|
|
9
|
-
currentStep={step}
|
|
10
|
-
totalSteps={4}
|
|
11
|
-
onStepChange={setStep}
|
|
12
|
-
stepLabels={['Tipo', 'Dados', 'Config', 'Confirmar']}
|
|
13
|
-
canGoToStep={(target) => target <= maxValidStep}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}`,f=`<StepSelector
|
|
17
|
-
currentStep={step}
|
|
18
|
-
totalSteps={4}
|
|
19
|
-
onStepChange={setStep}
|
|
20
|
-
stepLabels={['Tipo', 'Dados', 'Configuração', 'Confirmar']}
|
|
21
|
-
/>`,v=`const [step, setStep] = useState(1);
|
|
22
|
-
const [maxValidStep, setMaxValidStep] = useState(1);
|
|
23
|
-
|
|
24
|
-
// Ao avançar, aumenta o máximo acessível
|
|
25
|
-
const handleNext = () => {
|
|
26
|
-
const nextStep = step + 1;
|
|
27
|
-
setStep(nextStep);
|
|
28
|
-
setMaxValidStep(Math.max(maxValidStep, nextStep));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
<StepSelector
|
|
32
|
-
currentStep={step}
|
|
33
|
-
totalSteps={4}
|
|
34
|
-
onStepChange={setStep}
|
|
35
|
-
stepLabels={['Informações', 'Endereço', 'Pagamento', 'Revisão']}
|
|
36
|
-
canGoToStep={(target) => target <= maxValidStep}
|
|
37
|
-
/>`,j=`// Larguras disponíveis via Tailwind classes
|
|
38
|
-
<StepSelector progressWidth="w-24" {...props} /> // Compacto
|
|
39
|
-
<StepSelector progressWidth="w-32" {...props} /> // Padrão
|
|
40
|
-
<StepSelector progressWidth="w-48" {...props} /> // Médio
|
|
41
|
-
<StepSelector progressWidth="w-64" {...props} /> // Largo`;function E(){return e.jsx(m,{title:"Step Selector",description:"Componente de navegação para Wizards multi-etapas. Combina um DropdownMenu para seleção de etapas com uma barra de Progress para indicação visual do progresso.",component:e.jsx(x,{}),usage:h,examples:[{title:"Com Labels Customizados",description:"Use stepLabels para definir nomes descritivos para cada etapa. Os labels aparecem no dropdown de navegação.",preview:e.jsx(u,{}),code:f},{title:"Com Validação de Navegação",description:"Use canGoToStep para controlar quais etapas estão acessíveis. Navegação para etapas anteriores é sempre permitida.",preview:e.jsx(S,{}),code:v},{title:"Larguras Customizadas",description:"Ajuste a largura da barra de progresso com progressWidth para diferentes contextos de layout.",preview:e.jsx(g,{}),code:j}],props:[{name:"currentStep",type:"number",description:"Etapa atual (1-indexed). A primeira etapa é 1."},{name:"totalSteps",type:"number",description:"Total de etapas do Wizard."},{name:"onStepChange",type:"(step: number) => void",description:"Callback chamado quando uma etapa é selecionada."},{name:"stepLabels",type:"string[]",description:'Labels customizados para cada etapa. Se não fornecido, usa "Etapa N".'},{name:"canGoToStep",type:"(targetStep: number) => boolean",description:"Função que valida se pode navegar para uma etapa específica. Retornar para etapas anteriores é sempre permitido."},{name:"className",type:"string",description:"Classes CSS adicionais para o container."},{name:"progressWidth",type:"string",default:'"w-32"',description:"Largura da barra de progresso. Aceita classes Tailwind (w-24, w-32, w-48, etc.)."}],accessibility:["Suporte completo a navegação por teclado (Tab, Enter, Escape)","O dropdown usa Radix UI com gerenciamento de foco automático","Indicador visual (ícone check) marca a etapa atual","Estados disabled comunicam visualmente etapas inacessíveis",'A barra de progresso usa role="progressbar" com valores aria'],notes:["Ideal para uso no DialogFooter de Wizards multi-etapas","Navegação para etapas anteriores é sempre permitida, independente de canGoToStep","Combina DropdownMenu + Progress para experiência intuitiva","Use em conjunto com Dialog ou OnboardingDialog para fluxos completos","Os steps são 1-indexed: a primeira etapa é 1, não 0"]})}export{E as default};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import{j as e,S as a,L as i}from"./index-BtX5DZqb.js";import{C as s}from"./ComponentDocTemplate-BtOCnlM2.js";import"./ExampleCard-DfuMYM6E.js";import"./TableOfContents-DBMJMbI4.js";function c(){return e.jsx(s,{title:"Switch",description:"Um controle que permite ao usuário alternar entre marcado e desmarcado.",component:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"airplane-mode"}),e.jsx("label",{htmlFor:"airplane-mode",className:"text-sm font-medium",children:"Modo Avião"})]}),usage:`import { Switch, Label } from "forlogic-core"
|
|
2
|
-
|
|
3
|
-
<div className="flex items-center space-x-2">
|
|
4
|
-
<Switch id="airplane-mode" />
|
|
5
|
-
<Label htmlFor="airplane-mode">Modo Avião</Label>
|
|
6
|
-
</div>`,examples:[{title:"Estados",preview:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"off"}),e.jsx(i,{htmlFor:"off",children:"Desligado"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"on",defaultChecked:!0}),e.jsx(i,{htmlFor:"on",children:"Ligado"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"disabled",disabled:!0}),e.jsx(i,{htmlFor:"disabled",className:"text-muted-foreground",children:"Desabilitado Desligado"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"disabled-on",disabled:!0,defaultChecked:!0}),e.jsx(i,{htmlFor:"disabled-on",className:"text-muted-foreground",children:"Desabilitado Ligado"})]})]}),code:`// Desligado
|
|
7
|
-
<Switch id="off" />
|
|
8
|
-
|
|
9
|
-
// Ligado
|
|
10
|
-
<Switch id="on" defaultChecked />
|
|
11
|
-
|
|
12
|
-
// Desabilitado
|
|
13
|
-
<Switch id="disabled" disabled />
|
|
14
|
-
|
|
15
|
-
// Desabilitado e Ligado
|
|
16
|
-
<Switch id="disabled-on" disabled defaultChecked />`},{title:"Com Label",preview:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a,{id:"airplane-mode2"}),e.jsx(i,{htmlFor:"airplane-mode2",children:"Modo Avião"})]}),code:`import { Switch, Label } from "forlogic-core"
|
|
17
|
-
|
|
18
|
-
<div className="flex items-center space-x-2">
|
|
19
|
-
<Switch id="airplane-mode" />
|
|
20
|
-
<Label htmlFor="airplane-mode">Modo Avião</Label>
|
|
21
|
-
</div>`},{title:"Casos de Uso - Configurações",preview:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(i,{htmlFor:"notifications",children:"Notificações por Email"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receber emails sobre atividades da sua conta"})]}),e.jsx(a,{id:"notifications",defaultChecked:!0})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(i,{htmlFor:"marketing",children:"Emails de Marketing"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receber emails sobre novos produtos e recursos"})]}),e.jsx(a,{id:"marketing"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(i,{htmlFor:"security",className:"text-muted-foreground",children:"Alertas de Segurança"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Não pode ser desabilitado por motivos de segurança"})]}),e.jsx(a,{id:"security",defaultChecked:!0,disabled:!0})]})]}),code:`<div className="flex flex-col gap-4">
|
|
22
|
-
<div className="flex items-center justify-between gap-4">
|
|
23
|
-
<div className="space-y-0.5">
|
|
24
|
-
<Label htmlFor="notifications">Notificações por Email</Label>
|
|
25
|
-
<p className="text-sm text-muted-foreground">
|
|
26
|
-
Receber emails sobre atividades
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
29
|
-
<Switch id="notifications" defaultChecked />
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div className="flex items-center justify-between gap-4">
|
|
33
|
-
<div className="space-y-0.5">
|
|
34
|
-
<Label htmlFor="security" className="text-muted-foreground">
|
|
35
|
-
Alertas de Segurança
|
|
36
|
-
</Label>
|
|
37
|
-
<p className="text-sm text-muted-foreground">
|
|
38
|
-
Não pode ser desabilitado
|
|
39
|
-
</p>
|
|
40
|
-
</div>
|
|
41
|
-
<Switch id="security" defaultChecked disabled />
|
|
42
|
-
</div>
|
|
43
|
-
</div>`},{title:"Casos de Uso - Privacidade",preview:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(i,{htmlFor:"public-profile",children:"Perfil Público"}),e.jsx(a,{id:"public-profile",defaultChecked:!0})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(i,{htmlFor:"show-email",children:"Mostrar Endereço de Email"}),e.jsx(a,{id:"show-email"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(i,{htmlFor:"allow-messages",children:"Permitir Mensagens"}),e.jsx(a,{id:"allow-messages",defaultChecked:!0})]})]}),code:`<div className="flex flex-col gap-4">
|
|
44
|
-
<div className="flex items-center justify-between gap-4">
|
|
45
|
-
<Label htmlFor="public-profile">Perfil Público</Label>
|
|
46
|
-
<Switch id="public-profile" defaultChecked />
|
|
47
|
-
</div>
|
|
48
|
-
<div className="flex items-center justify-between gap-4">
|
|
49
|
-
<Label htmlFor="show-email">Mostrar Email</Label>
|
|
50
|
-
<Switch id="show-email" />
|
|
51
|
-
</div>
|
|
52
|
-
<div className="flex items-center justify-between gap-4">
|
|
53
|
-
<Label htmlFor="allow-messages">Permitir Mensagens</Label>
|
|
54
|
-
<Switch id="allow-messages" defaultChecked />
|
|
55
|
-
</div>
|
|
56
|
-
</div>`}],props:[{name:"id",type:"string",default:"-",description:"Identificador único para associar com Label."},{name:"checked",type:"boolean",default:"-",description:"Estado controlado do switch."},{name:"defaultChecked",type:"boolean",default:"false",description:"Estado inicial não controlado."},{name:"disabled",type:"boolean",default:"false",description:"Desabilita a interação."},{name:"required",type:"boolean",default:"false",description:"Indica campo obrigatório em formulário."},{name:"name",type:"string",default:"-",description:"Nome do campo para submissão de formulário."},{name:"value",type:"string",default:'"on"',description:"Valor enviado quando marcado."},{name:"onCheckedChange",type:"(checked: boolean) => void",default:"-",description:"Callback quando o estado muda."}],accessibility:['Role "switch" aplicado automaticamente (WAI-ARIA)',"Suporte completo de teclado (Espaço para alternar)","Estados aria-checked comunicados para leitores de tela","Associação com Label via htmlFor/id","Indicadores visuais de foco visíveis","Estado desabilitado comunicado via aria-disabled"]})}export{c as SwitchDoc};
|