gymatra-ui 0.0.0-stage → 0.1.1
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 +62 -2
- package/dist/gymatra-mark-cropped.png +0 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +6027 -0
- package/dist/styles.css +1 -0
- package/dist/types/components/avatar.d.ts +47 -0
- package/dist/types/components/badge.d.ts +20 -0
- package/dist/types/components/breadcrumb.d.ts +50 -0
- package/dist/types/components/button.d.ts +26 -0
- package/dist/types/components/cn.d.ts +1 -0
- package/dist/types/components/combobox.d.ts +76 -0
- package/dist/types/components/dialog.d.ts +86 -0
- package/dist/types/components/drawer-panel.d.ts +11 -0
- package/dist/types/components/drawer.d.ts +42 -0
- package/dist/types/components/filter-bar.d.ts +74 -0
- package/dist/types/components/filter-select.d.ts +38 -0
- package/dist/types/components/forms/boolean-fields.d.ts +52 -0
- package/dist/types/components/forms/content-fields.d.ts +18 -0
- package/dist/types/components/forms/date-fields.d.ts +32 -0
- package/dist/types/components/forms/field-container.d.ts +19 -0
- package/dist/types/components/forms/file-fields.d.ts +28 -0
- package/dist/types/components/forms/floating-field.d.ts +56 -0
- package/dist/types/components/forms/index.d.ts +85 -0
- package/dist/types/components/forms/numeric-fields.d.ts +23 -0
- package/dist/types/components/forms/other-fields.d.ts +55 -0
- package/dist/types/components/forms/selection-fields.d.ts +58 -0
- package/dist/types/components/forms/text-fields.d.ts +49 -0
- package/dist/types/components/menu.d.ts +86 -0
- package/dist/types/components/menubar.d.ts +47 -0
- package/dist/types/components/pagination.d.ts +21 -0
- package/dist/types/components/popover.d.ts +61 -0
- package/dist/types/components/progress.d.ts +55 -0
- package/dist/types/components/separator.d.ts +22 -0
- package/dist/types/components/stepper.d.ts +89 -0
- package/dist/types/components/switch.d.ts +25 -0
- package/dist/types/components/table.d.ts +146 -0
- package/dist/types/components/tabs.d.ts +55 -0
- package/dist/types/components/toggle-group.d.ts +1 -0
- package/dist/types/components/toggle.d.ts +50 -0
- package/dist/types/components/tooltip.d.ts +33 -0
- package/dist/types/index.d.ts +26 -0
- package/package.json +66 -4
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Gymatra UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bibliothèque de composants d'interface React moderne et accessible pour applications de gestion sportive et plateformes SaaS, conçue avec Tailwind CSS et les primitives Base UI.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Dans votre projet React, installez le package et ses dépendances homologues :
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install gymatra-ui @base-ui/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration & Utilisation
|
|
14
|
+
|
|
15
|
+
### 1. Importer les styles CSS
|
|
16
|
+
|
|
17
|
+
Dans le point d'entrée de votre application (ex: `main.tsx`, `App.tsx`, ou `layout.tsx` dans Next.js) :
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import "gymatra-ui/styles.css";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Exemple d'utilisation
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import React, { useState } from "react";
|
|
27
|
+
import {
|
|
28
|
+
GymatraButton,
|
|
29
|
+
GymatraBadge,
|
|
30
|
+
GymatraSwitch,
|
|
31
|
+
GymatraCombobox,
|
|
32
|
+
} from "gymatra-ui";
|
|
33
|
+
|
|
34
|
+
export function DashboardHeader() {
|
|
35
|
+
const [autoRenew, setAutoRenew] = useState(true);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="flex items-center gap-4 p-4 bg-white border border-border rounded-lg">
|
|
39
|
+
<GymatraBadge variant="success">Actif</GymatraBadge>
|
|
40
|
+
|
|
41
|
+
<GymatraSwitch
|
|
42
|
+
checked={autoRenew}
|
|
43
|
+
onChange={setAutoRenew}
|
|
44
|
+
label="Renouvellement automatique"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<GymatraButton variant="primary">
|
|
48
|
+
Enregistrer
|
|
49
|
+
</GymatraButton>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Composants disponibles
|
|
56
|
+
|
|
57
|
+
- **Boutons & Actions :** `GymatraButton`, `GymatraToggle`, `GymatraToggleGroup`
|
|
58
|
+
- **Navigation & Menus :** `GymatraBreadcrumb`, `GymatraTabs`, `GymatraMenu`, `GymatraMenubar`, `GymatraPagination`, `GymatraStepper`
|
|
59
|
+
- **Surfaces & Affichage :** `GymatraAvatar`, `GymatraBadge`, `GymatraSeparator`, `GymatraProgress`, `GymatraTooltip`
|
|
60
|
+
- **Sélection & Recherche :** `GymatraCombobox`, `GymatraFilterSelect`, `GymatraFilterBar`
|
|
61
|
+
- **Formulaires & Bascules :** `GymatraSwitch`, `GymatraFieldContainer`, suite complète d'entrées de formulaires
|
|
62
|
+
- **Overlays :** `GymatraDialog`, `GymatraDrawer`, `GymatraDrawerPanel`, `GymatraPopover`
|
|
63
|
+
- **Données :** `GymatraDataTable`
|
|
Binary file
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),ue=require("@base-ui/react/avatar"),E=require("@base-ui/react/combobox"),O=require("@base-ui/react/dialog"),q=require("@base-ui/react/field"),yt=require("@base-ui/react/form"),gt=require("@base-ui/react/input"),Z=require("@base-ui/react/select"),Ue=require("@base-ui/react/checkbox"),je=require("@base-ui/react/switch"),R=require("@base-ui/react/menu"),jt=require("@base-ui/react/menubar"),Q=require("@base-ui/react/popover"),ee=require("@base-ui/react/progress"),vt=require("@base-ui/react/separator"),te=require("@base-ui/react/tabs"),wt=require("@base-ui/react/toggle"),Nt=require("@base-ui/react/toggle-group"),ie=require("@base-ui/react/tooltip"),br=require("react-phone-number-input/input"),se=require("react-phone-number-input"),ut=require("react-phone-number-input/flags"),xt=require("react-phone-number-input/locale/fr.json");function l(...t){return t.filter(Boolean).join(" ")}const Me={xs:{root:"size-6 text-[10px]",status:"size-1.5 ring-1"},sm:{root:"size-8 text-xs",status:"size-2 ring-1.5"},md:{root:"size-10 text-sm",status:"size-2.5 ring-2"},lg:{root:"size-12 text-base",status:"size-3 ring-2"},xl:{root:"size-16 text-xl",status:"size-3.5 ring-2"},"2xl":{root:"size-20 text-2xl",status:"size-4 ring-2"}},mt={circle:"rounded-full",square:"rounded-lg"},pt={primary:"bg-primary-soft text-primary",secondary:"bg-surface-muted text-text",success:"bg-emerald-50 text-emerald-700",warning:"bg-amber-50 text-amber-700",danger:"bg-rose-50 text-rose-700",info:"bg-sky-50 text-sky-700",neutral:"bg-gray-100 text-gray-700"},hr={online:"bg-emerald-500",busy:"bg-rose-500",away:"bg-amber-500",offline:"bg-gray-400"};function yr(t){if(!t)return"";const r=t.trim().split(/\s+/).filter(Boolean);return r.length===0?"":r.length===1?r[0].slice(0,2).toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function gr({className:t}){return e.jsxs("svg",{className:l("size-1/2 opacity-65",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function we({src:t,alt:r="Avatar",name:s,fallback:a,size:n="md",shape:i="circle",variant:o="primary",status:c,statusPosition:x="bottom-right",bordered:d=!1,delayMs:u=0,className:b,children:f,...y}){const p=Me[n]??Me.md,g=mt[i]??mt.circle,h=pt[o]??pt.primary,v=s?yr(s):void 0,k=a??v??e.jsx(gr,{});return e.jsxs("span",{className:l("relative inline-flex shrink-0 select-none",b),...y,children:[e.jsx(ue.Avatar.Root,{className:l("flex items-center justify-center overflow-hidden font-semibold transition-all",p.root,g,h,d&&"border border-border"),children:f||e.jsxs(e.Fragment,{children:[t&&e.jsx(ue.Avatar.Image,{src:t,alt:r||s||"Avatar",className:"size-full object-cover"}),e.jsx(ue.Avatar.Fallback,{delay:u,className:"flex size-full items-center justify-center uppercase tracking-wider",children:k})]})}),c&&e.jsx("span",{className:l("absolute rounded-full ring-white",p.status,hr[c],x==="bottom-right"&&(i==="circle"?"bottom-0 end-0 translate-x-[1px] translate-y-[1px]":"bottom-[-2px] end-[-2px]"),x==="top-right"&&(i==="circle"?"top-0 end-0 translate-x-[1px] -translate-y-[1px]":"top-[-2px] end-[-2px]")),"aria-hidden":"true"})]})}function kt({children:t,max:r,size:s="md",spacing:a="tight",className:n,...i}){const o=m.Children.toArray(t).filter(m.isValidElement),c=o.length,x=a==="tight"?s==="xs"?"-space-x-1.5":s==="sm"?"-space-x-2":s==="md"?"-space-x-2.5":s==="lg"?"-space-x-3":"-space-x-4":a==="normal"?"-space-x-1.5":"space-x-1",d=r&&c>r?o.slice(0,r):o,u=r&&c>r?c-r:0,b=Me[s]??Me.md;return e.jsxs("div",{className:l("inline-flex items-center",x,n),role:"group","aria-label":`Groupe de ${c} avatars`,...i,children:[d.map((f,y)=>m.cloneElement(f,{key:y,size:f.props.size??s,className:l("ring-2 ring-white hover:z-10 focus:z-10 transition-transform",f.props.className)})),u>0&&e.jsxs("span",{className:l("flex items-center justify-center rounded-full bg-surface-muted border border-border text-text font-semibold ring-2 ring-white select-none shrink-0",b.root),title:`${u} autre(s) utilisateur(s)`,children:["+",u]})]})}we.Root=ue.Avatar.Root;we.Image=ue.Avatar.Image;we.Fallback=ue.Avatar.Fallback;we.Group=kt;const jr={default:"bg-surface-muted text-text-muted",primary:"bg-primary-soft text-primary",secondary:"bg-surface text-text",outline:"bg-transparent text-text border border-border",success:"bg-emerald-50 text-emerald-700",warning:"bg-amber-50 text-amber-700",danger:"bg-rose-50 text-rose-700",info:"bg-sky-50 text-sky-700"},vr={sm:"h-5 px-2 text-xs gap-1",md:"h-6 px-2.5 text-xs gap-1.5",lg:"h-7 px-3 text-xs font-semibold gap-1.5"},Ve=m.forwardRef(({variant:t="default",size:r="md",pill:s=!0,dot:a=!1,check:n=!1,circle:i=!1,startIcon:o,endIcon:c,className:x,children:d,...u},b)=>e.jsxs("span",{ref:b,className:l("inline-flex items-center justify-center font-medium border-0 select-none transition-colors",s?"rounded-full":"rounded-md",jr[t],vr[r],x),...u,children:[i||a?e.jsx("span",{className:l("rounded-full border-2 border-current shrink-0",r==="sm"?"size-2":"size-2.5"),"aria-hidden":"true"}):n?e.jsx("svg",{className:l("shrink-0",r==="sm"?"size-3":r==="lg"?"size-3.5":"size-3"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):null,o&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:o}),d&&e.jsx("span",{className:"truncate",children:d}),c&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:c})]}));Ve.displayName="GymatraBadge";function Gt({items:t,separator:r="/",className:s,...a}){return e.jsx("nav",{"aria-label":"Breadcrumb",className:l("inline-block",s),...a,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",children:t.map((n,i)=>{const o=i===t.length-1;return e.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[!o&&n.href?e.jsxs("a",{href:n.href,onClick:n.onClick,className:"inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",children:[n.icon,e.jsx("span",{children:n.label})]}):e.jsxs("span",{className:l("inline-flex items-center gap-1.5 px-0.5 text-sm",o?"font-medium text-text":"text-text-muted"),"aria-current":o?"page":void 0,children:[n.icon,e.jsx("span",{children:n.label})]}),!o&&e.jsx("span",{className:"text-xs text-text-subtle select-none px-0.5","aria-hidden":"true",children:r})]},i)})})})}Gt.displayName="GymatraBreadcrumb";function Ct({className:t,...r}){return e.jsx("ol",{className:l("flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",t),...r})}Ct.displayName="GymatraBreadcrumbList";function St({className:t,...r}){return e.jsx("li",{className:l("inline-flex items-center gap-1.5",t),...r})}St.displayName="GymatraBreadcrumbItem";function Pt({className:t,...r}){return e.jsx("a",{className:l("inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",t),...r})}Pt.displayName="GymatraBreadcrumbLink";function zt({className:t,...r}){return e.jsx("span",{"aria-current":"page",className:l("inline-flex items-center gap-1.5 px-0.5 text-sm font-medium text-text",t),...r})}zt.displayName="GymatraBreadcrumbPage";function It({children:t="/",className:r,...s}){return e.jsx("span",{"aria-hidden":"true",className:l("text-xs text-text-subtle select-none px-0.5",r),...s,children:t})}It.displayName="GymatraBreadcrumbSeparator";function Mt({className:t,...r}){return e.jsx("span",{"aria-hidden":"true",className:l("flex size-6 items-center justify-center text-text-muted select-none text-xs font-bold",t),...r,children:"…"})}Mt.displayName="GymatraBreadcrumbEllipsis";const ft={primary:"bg-primary text-white hover:bg-primary-hover active:bg-primary-active focus-visible:outline-primary shadow-none border-0",secondary:"bg-surface-muted text-text hover:bg-border/60 active:bg-border focus-visible:outline-primary shadow-none border-0",outline:"bg-transparent text-text border border-border hover:bg-surface-muted hover:text-text active:bg-border/40 focus-visible:outline-primary shadow-none",soft:"bg-primary-soft text-primary hover:bg-primary-soft/70 active:bg-primary/15 focus-visible:outline-primary shadow-none border-0",ghost:"bg-transparent text-text-muted hover:text-text hover:bg-surface-muted active:bg-border/40 focus-visible:outline-primary shadow-none border-0",danger:"bg-danger text-white hover:bg-danger/90 active:bg-danger/80 focus-visible:outline-danger shadow-none border-0",success:"bg-emerald-600 text-white hover:bg-emerald-700 active:bg-emerald-800 focus-visible:outline-emerald-600 shadow-none border-0",warning:"bg-amber-600 text-white hover:bg-amber-700 active:bg-amber-800 focus-visible:outline-amber-600 shadow-none border-0",info:"bg-sky-600 text-white hover:bg-sky-700 active:bg-sky-800 focus-visible:outline-sky-600 shadow-none border-0","outline-primary":"bg-transparent text-primary border border-primary/40 hover:bg-primary-soft hover:border-primary active:bg-primary/15 focus-visible:outline-primary shadow-none","outline-danger":"bg-transparent text-danger border border-danger/40 hover:bg-rose-50 hover:border-danger active:bg-danger/15 focus-visible:outline-danger shadow-none","outline-warning":"bg-transparent text-amber-700 border border-amber-400 hover:bg-amber-50 hover:border-amber-600 active:bg-amber-100 focus-visible:outline-amber-600 shadow-none","outline-success":"bg-transparent text-emerald-700 border border-emerald-400 hover:bg-emerald-50 hover:border-emerald-600 active:bg-emerald-100 focus-visible:outline-emerald-600 shadow-none","outline-info":"bg-transparent text-sky-700 border border-sky-400 hover:bg-sky-50 hover:border-sky-600 active:bg-sky-100 focus-visible:outline-sky-600 shadow-none"},wr={xs:"h-7 px-2.5 text-xs gap-1.5",sm:"h-8 px-3 text-xs gap-1.5",md:"h-10 px-4 text-sm gap-2",lg:"h-11 px-5 text-sm gap-2.5",xl:"h-12 px-6 text-base gap-3",icon:"size-9 p-0 justify-center text-sm gap-0"},Nr={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},kr={xs:"size-3.5",sm:"size-4",md:"size-4",lg:"size-4.5",xl:"size-5",icon:"size-4.5"};function Gr(t,r){if(r&&r!=="default"){if(t==="outline")return`outline-${r}`;if(t==="primary")return r}return t}const Te=m.forwardRef(({variant:t="primary",color:r,size:s="md",weight:a="semibold",pill:n=!1,fullWidth:i=!1,startIcon:o,endIcon:c,loading:x=!1,loadingText:d,disabled:u,children:b,className:f,type:y="button",...p},g)=>{const h=u||x,v=kr[s],k=Gr(t,r);return e.jsx("button",{ref:g,type:y,disabled:h,"aria-busy":x?!0:void 0,className:l("inline-flex cursor-pointer items-center justify-center transition-all duration-150 select-none",n?"rounded-full":s==="xs"?"rounded":s==="xl"?"rounded-lg":"rounded-md",i?"w-full":"",Nr[a],"focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",ft[k]||ft.primary,wr[s],f),...p,children:x?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:l("animate-spin shrink-0",v),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),d?e.jsx("span",{children:d}):b?e.jsx("span",{children:b}):null]}):e.jsxs(e.Fragment,{children:[o&&e.jsx("span",{className:l("inline-flex shrink-0 items-center justify-center",v),"aria-hidden":"true",children:o}),b&&e.jsx("span",{children:b}),c&&e.jsx("span",{className:l("inline-flex shrink-0 items-center justify-center",v),"aria-hidden":"true",children:c})]})})});Te.displayName="GymatraButton";const Cr=E.Combobox.Root,Sr=E.Combobox.Trigger,Pr=E.Combobox.Portal,zr=E.Combobox.Positioner,Ir=E.Combobox.List,Mr=E.Combobox.Group,Tr=E.Combobox.Separator,Rr=E.Combobox.Clear,Lr=E.Combobox.Chips,Br=E.Combobox.Chip,Dr=E.Combobox.ChipRemove,Tt=m.forwardRef(({className:t,startIcon:r,error:s,disabled:a,...n},i)=>e.jsxs("div",{className:l("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",a?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[r&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:r}),e.jsx(E.Combobox.Input,{ref:i,disabled:a,className:l("h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0",t),...n}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}));Tt.displayName="GymatraComboboxInput";const He=m.forwardRef(({className:t,children:r,...s},a)=>e.jsx(E.Combobox.Popup,{ref:a,className:l("z-50 min-w-[var(--anchor-width)] max-h-64 overflow-y-auto rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));He.displayName="GymatraComboboxPopup";function Fr({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}const Re=m.forwardRef(({className:t,children:r,icon:s,description:a,...n},i)=>e.jsxs(E.Combobox.Item,{ref:i,className:l("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[highlighted]:bg-surface-muted data-[highlighted]:text-text","data-[selected]:font-medium data-[selected]:text-primary",t),...n,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:r}),a&&e.jsx("div",{className:"text-[11px] text-text-muted truncate",children:a})]})]}),e.jsx(E.Combobox.ItemIndicator,{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(Fr,{})})]}));Re.displayName="GymatraComboboxItem";const Ke=m.forwardRef(({className:t,children:r,...s},a)=>e.jsx(E.Combobox.Empty,{ref:a,className:l("px-3 py-2 text-xs text-text-muted text-center",t),...s,children:r??"Aucun résultat trouvé"}));Ke.displayName="GymatraComboboxEmpty";const Qe=m.forwardRef(({className:t,...r},s)=>e.jsx(E.Combobox.GroupLabel,{ref:s,className:l("px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wider text-text-subtle select-none",t),...r}));Qe.displayName="GymatraComboboxGroupLabel";function Ar(t){return t.map(r=>typeof r=="string"?{value:r,label:r}:r)}function Er({label:t,helperText:r,error:s,options:a,value:n,defaultValue:i,onValueChange:o,onChange:c,placeholder:x="Rechercher ou sélectionner...",emptyText:d="Aucun résultat trouvé",disabled:u=!1,required:b=!1,className:f,startIcon:y}){const p=Ar(a),g=p.some(j=>!!j.group),h={};g&&p.forEach(j=>{const N=j.group||"Autres";h[N]||(h[N]=[]),h[N].push(j)});const v=j=>{o==null||o(j),c==null||c(j)},k=n!==void 0?{value:n,onValueChange:v,items:p}:i!==void 0?{defaultValue:i,onValueChange:v,items:p}:{onValueChange:v,items:p};return e.jsxs("div",{className:l("w-full space-y-1.5",f),children:[t&&e.jsxs("label",{className:"block text-xs font-semibold text-text",children:[t,b&&e.jsx("span",{className:"text-danger ml-0.5",children:"*"})]}),e.jsxs(E.Combobox.Root,{...k,disabled:u,children:[e.jsxs("div",{className:l("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",u?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[y&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:y}),e.jsx(E.Combobox.Input,{placeholder:x,disabled:u,className:"h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0"}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx(E.Combobox.Portal,{children:e.jsx(E.Combobox.Positioner,{sideOffset:4,className:"z-50 outline-none",children:e.jsxs(He,{children:[e.jsx(Ke,{children:d}),e.jsx(E.Combobox.List,{children:g?Object.entries(h).map(([j,N])=>e.jsxs(E.Combobox.Group,{children:[e.jsx(Qe,{children:j}),N.map(z=>e.jsx(Re,{value:z.value,disabled:z.disabled,icon:z.icon,description:z.description,children:z.label},z.value))]},j)):p.map(j=>e.jsx(Re,{value:j.value,disabled:j.disabled,icon:j.icon,description:j.description,children:j.label},j.value))})]})})})]}),s?e.jsx("p",{className:"text-[11px] text-danger",children:s}):r?e.jsx("p",{className:"text-[11px] text-text-muted",children:r}):null]})}const Rt={sm:"max-w-[420px]",md:"max-w-lg",lg:"max-w-xl",xl:"max-w-2xl"};function Wr({variant:t}){switch(t){case"danger":case"delete":return e.jsx("svg",{className:"size-12 text-danger stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})});case"warning":return e.jsx("svg",{className:"size-12 text-amber-600 stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})});case"success":return e.jsx("svg",{className:"size-12 text-emerald-600 stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})});case"info":return e.jsx("svg",{className:"size-12 text-sky-600 stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})});case"primary":return e.jsx("svg",{className:"size-12 text-primary stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})});default:return null}}function Lt({open:t,defaultOpen:r,onOpenChange:s,trigger:a,variant:n="default",size:i="sm",title:o,description:c,icon:x,align:d="center",children:u,confirmLabel:b,onConfirm:f,confirmVariant:y,cancelLabel:p="Annuler",onCancel:g,loading:h=!1,confirmDisabled:v=!1,showCloseButton:k=!1,footer:j,className:N}){const z=n==="danger"||n==="delete",G=b??(f?z?"Supprimer":"Confirmer":void 0),C=x===!1?null:x!==void 0?x:e.jsx(Wr,{variant:n}),w=()=>y||(z?"danger":n==="warning"?"warning":n==="success"?"success":n==="info"?"info":"primary"),S=e.jsxs(O.Dialog.Portal,{children:[e.jsx(O.Dialog.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-xs transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsxs(O.Dialog.Popup,{className:l("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",Rt[i],d==="center"?"items-center text-center":"items-start text-left",N),children:[k&&e.jsx(O.Dialog.Close,{className:"size-8 inline-flex items-center justify-center absolute right-3.5 top-3.5 rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors focus-visible:outline-primary","aria-label":"Fermer",onClick:g,children:e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),C&&e.jsx("div",{className:"flex items-center justify-center mb-3 text-center",children:C}),o&&e.jsx(O.Dialog.Title,{className:l("text-lg font-semibold text-text leading-snug",d==="center"?"text-center":"text-left"),children:o}),c&&e.jsx(O.Dialog.Description,{className:l("text-sm text-text-muted mt-2 leading-relaxed",d==="center"?"text-center":"text-left"),children:c}),u&&e.jsx("div",{className:"mt-4 w-full text-left",children:u}),j!==void 0?j:(G||p)&&e.jsxs("div",{className:l("w-full mt-6",p&&G?"grid grid-cols-2 gap-3":"flex justify-end gap-3"),children:[p&&e.jsx(O.Dialog.Close,{render:e.jsx(Te,{variant:"outline",size:"md",className:"w-full text-sm font-medium",onClick:g,disabled:h,children:p})}),G&&e.jsx(Te,{variant:w(),size:"md",className:"w-full text-sm font-medium",onClick:f,loading:h,disabled:v||h,children:G})]})]})]});return e.jsxs(O.Dialog.Root,{open:t,defaultOpen:r,onOpenChange:s,children:[a&&e.jsx(O.Dialog.Trigger,{render:a}),S]})}const xe=Object.assign(Lt,{Root:O.Dialog.Root,Trigger:O.Dialog.Trigger,Portal:O.Dialog.Portal,Backdrop:m.forwardRef(function({className:r,...s},a){return e.jsx(O.Dialog.Backdrop,{ref:a,className:l("fixed inset-0 z-50 bg-black/40 backdrop-blur-xs transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",r),...s})}),Popup:m.forwardRef(function({className:r,size:s="sm",...a},n){return e.jsx(O.Dialog.Popup,{ref:n,className:l("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",Rt[s],r),...a})}),Title:m.forwardRef(function({className:r,...s},a){return e.jsx(O.Dialog.Title,{ref:a,className:l("text-lg font-semibold text-text leading-snug",r),...s})}),Description:m.forwardRef(function({className:r,...s},a){return e.jsx(O.Dialog.Description,{ref:a,className:l("text-sm text-text-muted mt-2 leading-relaxed",r),...s})}),Close:O.Dialog.Close}),Or=O.Dialog.Root,_r=O.Dialog.Trigger,$r=O.Dialog.Portal,qr=xe.Backdrop,Ur=xe.Popup,Vr=xe.Popup,Hr=xe.Title,Kr=xe.Description,Qr=O.Dialog.Close,ze={s:400,m:560,l:700,xl:860,full:1100};function Ie(t){return typeof t=="number"?t:t&&t in ze?ze[t]:ze.m}const Ze=m.createContext(void 0),Bt=()=>{const t=m.useContext(Ze);if(!t)throw new Error("useGymatraDrawer must be used within a GymatraDrawerProvider");return t},Zr=Bt,Jr=Ze;function Dt({children:t}){const[r,s]=m.useState(!1),[a,n]=m.useState(!1),[i,o]=m.useState(!1),[c,x]=m.useState("m"),[d,u]=m.useState(null),[b,f]=m.useState(null),y=m.useRef(null),p=m.useRef(null),[g,h]=m.useState(!1),[v,k]=m.useState(!1),[j,N]=m.useState(!1),[z,M]=m.useState("l"),[G,C]=m.useState(null),[w,S]=m.useState(null),W=m.useRef(null),L=m.useRef(null),[V,re]=m.useState(!1),[I,H]=m.useState(!1),[ae,B]=m.useState(!1),[_,J]=m.useState("s"),[K,Y]=m.useState(null),[Ge,ne]=m.useState(null),fe=m.useRef(null),oe=m.useRef(null);m.useEffect(()=>{if(a&&r){const D=requestAnimationFrame(()=>{o(!0)});return()=>cancelAnimationFrame(D)}else o(!1)},[a,r]),m.useEffect(()=>{if(v&&g){const D=requestAnimationFrame(()=>{N(!0)});return()=>cancelAnimationFrame(D)}else N(!1)},[v,g]),m.useEffect(()=>{if(I&&V){const D=requestAnimationFrame(()=>{B(!0)});return()=>cancelAnimationFrame(D)}else B(!1)},[I,V]),m.useEffect(()=>{const D=()=>{he()};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]);const be=(D,U="s",$={})=>{oe.current&&clearTimeout(oe.current),Y(()=>D),J(U),ne($),H(!0),re(!0)},X=()=>{re(!1),B(!1),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{H(!1),Y(null),ne(null)},300)},Ce=(D,U="l",$={})=>{L.current&&clearTimeout(L.current),C(()=>D),M(U),S($),k(!0),h(!0)},le=()=>{X(),h(!1),N(!1),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{k(!1),C(null),S(null)},300)},_e=(D,U="m",$={})=>{p.current&&clearTimeout(p.current),u(()=>D),x(U),f($),n(!0),s(!0)},ce=()=>{X(),le(),s(!1),o(!1),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{n(!1),u(null),f(null)},300)},he=()=>{ce()};m.useEffect(()=>{const D=U=>{U.key==="Escape"&&(V?X():g?le():r&&ce())};if(r||g||V)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[r,g,V]);const Se=a||v||I,$e=i||j||ae,Pe=(r?1:0)+(g?1:0)+(V?1:0),P=Ie(c),T=Ie(z),A=Ie(_);return e.jsxs(Ze.Provider,{value:{openDrawer:_e,closeDrawer:ce,isOpen:r,size:c,contentProps:b,Component:d,openSecondDrawer:Ce,closeSecondDrawer:le,isSecondOpen:g,secondSize:z,secondContentProps:w,SecondComponent:G,openThirdDrawer:be,closeThirdDrawer:X,isThirdOpen:V,thirdSize:_,thirdContentProps:Ge,ThirdComponent:K,closeAll:he,openCount:Pe},children:[t,Se&&e.jsx("div",{"aria-hidden":"true",onClick:()=>{V?X():g?le():r&&ce()},className:l("fixed inset-0 z-[9990] bg-black/40 backdrop-blur-[2px] cursor-pointer","transition-opacity duration-300 ease-out",$e?"opacity-100":"opacity-0 pointer-events-none")}),Se&&e.jsxs("div",{className:l("fixed end-0 top-0 bottom-0 z-[10000] flex items-stretch justify-end pointer-events-none","overflow-x-auto overflow-y-hidden max-[900px]:!inset-0"),children:[I&&e.jsx("div",{ref:fe,className:l("flex flex-col bg-white border-s border-border min-h-0 shrink-0 overflow-y-auto overflow-x-hidden shadow-none","transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]",ae?"translate-x-0 opacity-100 pointer-events-auto":"translate-x-full opacity-0 pointer-events-none","max-[900px]:!w-full max-[900px]:!border-0 max-[900px]:fixed max-[900px]:inset-0 max-[900px]:z-30"),style:{width:`${A}px`,maxWidth:"100vw"},children:K&&e.jsx(K,{...Ge||{}})}),v&&e.jsx("div",{ref:W,className:l("flex flex-col bg-white border-s border-border min-h-0 shrink-0 overflow-y-auto overflow-x-hidden shadow-none","transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]",j?"translate-x-0 opacity-100 pointer-events-auto":"translate-x-full opacity-0 pointer-events-none","max-[900px]:!w-full max-[900px]:!border-0 max-[900px]:fixed max-[900px]:inset-0 max-[900px]:z-20"),style:{width:`${T}px`,maxWidth:"100vw"},children:G&&e.jsx(G,{...w||{}})}),a&&e.jsx("div",{ref:y,className:l("flex flex-col bg-white border-s border-border min-h-0 shrink-0 overflow-y-auto overflow-x-hidden shadow-none","transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]",i?"translate-x-0 opacity-100 pointer-events-auto":"translate-x-full opacity-0 pointer-events-none","max-[900px]:!w-full max-[900px]:!border-0 max-[900px]:fixed max-[900px]:inset-0 max-[900px]:z-10"),style:{width:`${P}px`,maxWidth:"100vw"},children:d&&e.jsx(d,{...b||{}})})]})]})}const Yr=Dt;function Xr({title:t,description:r,icon:s,showCloseButton:a=!0,onClose:n,footer:i,className:o,children:c,...x}){return e.jsxs("div",{className:l("flex h-full flex-col bg-white text-text min-h-0",o),...x,children:[(t||a)&&e.jsxs("div",{className:"sticky top-0 z-20 shrink-0 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 pt-4 pb-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 pe-3",children:[s&&e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:s}),e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("h3",{className:"text-base font-semibold text-text truncate",children:t}),r&&e.jsx("p",{className:"text-xs text-text-muted truncate mt-0.5",children:r})]})]}),a&&e.jsx("button",{type:"button",onClick:n,"aria-label":"Close drawer",className:"size-8 inline-flex shrink-0 items-center justify-center rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors",children:e.jsxs("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:"mx-5 sm:mx-6 border-b border-border"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-sm text-text space-y-4",children:c}),i&&e.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2.5 border-t border-border px-5 py-3.5 bg-surface/30",children:i})]})}function es({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Je({label:t,options:r,multiple:s=!1,value:a,defaultValue:n,onChange:i,placeholder:o,bordered:c=!0,showCount:x=!0,size:d="sm",width:u,className:b,disabled:f=!1}){const[y,p]=m.useState(()=>typeof n<"u"?n:s?[]:r.length>0?r[0].value:""),[g,h]=m.useState(!1),v=m.useRef(null),k=a??y,j=s?Array.isArray(k)?k:k?[k]:[]:typeof k=="string"&&k!==""?[k]:[];let N;if(s)if(j.length===0)N=o??`All ${t}`;else if(j.length===1){const w=r.find(S=>S.value===j[0]);N=w?w.label:j[0]}else j.length===r.length?N=`All (${j.length})`:N=`${j.length} selected`;else{const w=j[0],S=r.find(W=>W.value===w);N=S?S.label:o??`All ${t}`}const z=s?j.length>0:!!(j[0]&&j[0]!=="all"&&j[0]!=="");m.useEffect(()=>{function w(S){v.current&&!v.current.contains(S.target)&&h(!1)}if(g)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[g]),m.useEffect(()=>{function w(S){S.key==="Escape"&&h(!1)}if(g)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[g]);function M(w){if(s){const W=j.includes(w)?j.filter(L=>L!==w):[...j,w];typeof a>"u"&&p(W),i==null||i(W)}else typeof a>"u"&&p(w),i==null||i(w),h(!1)}function G(){const w=r.filter(S=>!S.disabled).map(S=>S.value);typeof a>"u"&&p(w),i==null||i(w)}function C(){const w=[];typeof a>"u"&&p(w),i==null||i(w)}return e.jsxs("div",{ref:v,className:l("relative inline-block text-left",b),children:[e.jsxs("button",{type:"button",disabled:f,onClick:()=>h(w=>!w),"aria-haspopup":"listbox","aria-expanded":g,"aria-label":`${t}: ${N}`,className:l("inline-flex items-center justify-between gap-2 rounded-md text-text cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","disabled:pointer-events-none disabled:opacity-50",d==="sm"?"h-8.5 px-3 text-sm":"h-10 px-3.5 text-sm",u||(d==="sm"?"w-[165px]":"w-[185px]"),c?"border border-border bg-white hover:border-border-strong hover:bg-surface/50":"border-0 bg-transparent hover:bg-surface/50",g&&"bg-primary-soft/50 text-primary",z&&!g&&"bg-primary-soft/50 text-primary"),children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"truncate",children:N})]}),e.jsx("span",{className:l("text-text-subtle transition-transform duration-150 flex items-center shrink-0",g&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(es,{})})]}),g&&e.jsxs("div",{role:"listbox","aria-multiselectable":s,"aria-label":t,className:"absolute left-0 z-50 mt-1 min-w-[190px] w-max max-w-[280px] rounded-lg border border-border bg-white p-1.5 shadow-none focus:outline-none",children:[s&&r.length>2&&e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2 py-1.5 mb-1 text-xs text-text-muted",children:[e.jsxs("span",{children:[j.length," of ",r.length," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:G,className:"text-primary hover:underline font-medium cursor-pointer",children:"All"}),e.jsx("span",{className:"text-border","aria-hidden":"true",children:"|"}),e.jsx("button",{type:"button",onClick:C,className:"text-text-muted hover:text-text hover:underline cursor-pointer",children:"Clear"})]})]}),e.jsx("div",{className:"max-h-60 overflow-y-auto space-y-0.5",children:r.map(w=>{const S=j.includes(w.value);return e.jsxs("button",{type:"button",role:"option","aria-selected":S,disabled:w.disabled,onClick:()=>M(w.value),className:l("flex w-full items-center justify-between gap-2.5 rounded-md px-2 py-1.5 text-xs text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text","focus-visible:bg-surface focus-visible:text-primary","disabled:pointer-events-none disabled:opacity-40",S?"bg-primary-soft/40 text-primary font-medium":"text-text font-normal"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{"aria-hidden":"true",className:l("size-5 shrink-0 rounded-md flex items-center justify-center border transition-colors",S?"border-primary bg-primary text-white":"border-slate-300 bg-white hover:border-slate-400"),children:S&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsx("span",{className:"truncate",children:w.label})]}),x&&typeof w.count<"u"&&e.jsx("span",{className:l("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium leading-none",S?"bg-primary text-white":"bg-surface text-text-muted"),children:w.count})]},w.value)})})]})]})}Je.displayName="GymatraFilterSelect";function ts({className:t="size-4"}){return e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]})}function Ft({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function rs({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function ss({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}function At({value:t,onChange:r,onClear:s,placeholder:a="Search...",borderless:n=!0,className:i,...o}){const c=!!(t&&String(t).length>0);return e.jsxs("div",{className:l("relative flex items-center shrink-0",n?"w-[180px] min-w-[140px] max-w-[220px]":"w-60",i),children:[e.jsx("span",{className:"pointer-events-none absolute left-0.5 flex items-center text-text-subtle","aria-hidden":"true",children:e.jsx(ts,{className:"size-4"})}),e.jsx("input",{type:"search",value:t,onChange:r,placeholder:a,className:l("w-full h-9 bg-transparent text-[13px] text-text placeholder:text-[13px] placeholder:text-text-subtle",n?"border-0 ring-0 outline-none shadow-none pl-6 pr-5 focus:border-0 focus:ring-0 focus:outline-none focus:shadow-none active:border-0 active:ring-0 active:outline-none":"rounded-md border border-border pl-8 pr-6 focus:border-primary focus:outline-2 focus:outline-primary/30"),...o}),c&&s&&e.jsx("button",{type:"button",onClick:s,"aria-label":"Clear search",className:"absolute right-0.5 flex size-5 items-center justify-center text-text-subtle hover:text-text cursor-pointer transition-colors",children:e.jsx(Ft,{className:"size-3.5"})})]})}function as({label:t,options:r,value:s,defaultValue:a,onChange:n,className:i,...o}){return e.jsxs("div",{className:l("relative inline-flex items-center",i),children:[e.jsx("select",{value:s,defaultValue:a,onChange:n,"aria-label":t,className:"h-8.5 rounded-md border border-border bg-surface pl-2.5 pr-7 text-xs text-text outline-none hover:border-border-strong focus-visible:border-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary cursor-pointer appearance-none transition-colors",...o,children:r.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}),e.jsx("span",{className:"pointer-events-none absolute right-2 text-text-subtle flex items-center","aria-hidden":"true",children:e.jsx(rs,{})})]})}function Et({label:t,valueLabel:r,onRemove:s,className:a}){return e.jsxs("span",{className:l("inline-flex h-6 items-center gap-1.5 rounded border border-border bg-surface px-2 text-xs text-text",a),children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"font-medium text-text",children:r}),e.jsx("button",{type:"button",onClick:s,"aria-label":`Remove filter ${t}: ${r}`,className:"inline-flex size-3.5 items-center justify-center rounded-full text-text-muted hover:text-text cursor-pointer transition-colors",children:e.jsx(Ft,{})})]})}function Wt({searchValue:t,onSearchChange:r,searchPlaceholder:s="Search...",searchBorderless:a=!0,totalCount:n,countLabel:i="Results",actions:o,filters:c=[],activeFilters:x=[],onResetFilters:d,isFiltersOpen:u,defaultFiltersOpen:b=!1,onToggleFilters:f,filterButtonLabel:y="Filters",bottomContent:p,className:g,children:h,...v}){const[k,j]=m.useState(b),N=u??k;function z(){const C=!N;typeof u>"u"&&j(C),f==null||f(C)}const M=typeof t<"u"||typeof r<"u";c.length>0||x.length>0;const G=x.length;return e.jsxs("div",{className:l("flex flex-col w-full",g),...v,children:[e.jsxs("div",{className:"flex flex-wrap items-center min-h-12 py-1.5 ps-3.5 pe-1.5 gap-3 rounded-lg border border-border bg-surface",children:[M&&e.jsx(At,{value:t,onChange:C=>r==null?void 0:r(C.target.value),onClear:()=>r==null?void 0:r(""),placeholder:s,borderless:a}),M&&typeof n<"u"&&e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),typeof n<"u"&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-sm text-text-muted",children:[e.jsx("span",{className:"font-semibold text-text",children:n}),e.jsx("span",{children:i})]}),h,e.jsxs("div",{className:"ms-auto flex flex-wrap items-center gap-2.5",children:[c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.map(C=>e.jsx(Je,{label:C.label,options:C.options,multiple:C.multiple,value:C.value,defaultValue:C.defaultValue,onChange:C.onChange},C.id)),d&&(x.length>0||!!t)&&e.jsx("button",{type:"button",onClick:d,className:"rounded px-1.5 py-0.5 text-xs font-medium text-primary hover:underline cursor-pointer transition-opacity",children:"Reset"})]})]}),o,p&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("button",{type:"button",onClick:z,"aria-expanded":N,"aria-label":`${N?"Hide":"Show"} filters`,title:y,"data-active":N||G>0,className:"relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-text hover:bg-surface-muted hover:text-primary cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary data-[active=true]:bg-primary-soft data-[active=true]:text-primary",children:[e.jsx(ss,{}),G>0&&e.jsx("span",{className:"absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold leading-none text-white",children:G})]})]})]})]}),x.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 px-1","aria-label":"Applied filters",children:x.map(C=>e.jsx(Et,{label:C.label,valueLabel:C.valueLabel,onRemove:C.onRemove},C.id))}),N&&p&&e.jsx("div",{className:"mt-2.5 flex flex-col gap-3 rounded-lg border border-border bg-surface p-3.5 transition-all",children:p})]})}Wt.displayName="GymatraFilterBar";function F({label:t,error:r,helperText:s,required:a,disabled:n,focused:i,startAdornment:o,endAdornment:c,className:x,wrapperClassName:d,children:u,...b}){const f=!!r;return e.jsxs("div",{className:l("relative w-full pt-2.5 pb-1",n&&"opacity-60 pointer-events-none",d),...b,children:[e.jsxs("div",{className:l("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",f?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":i?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",x),children:[t&&e.jsxs("label",{className:l("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",f?"text-danger":i?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,a&&e.jsx("span",{className:"ms-0.5 text-danger","aria-hidden":"true",children:"*"})]}),o&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:o}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:u}),c&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:c})]}),(r||s)&&e.jsxs("p",{className:l("mt-2 text-xs flex items-center gap-1 ps-1",f?"text-danger font-medium":"text-text-muted"),children:[f&&e.jsxs("svg",{className:"size-3.5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("span",{children:r||s})]})]})}const me=m.forwardRef(({label:t,error:r,helperText:s,startIcon:a,endIcon:n,prefixText:i,suffixText:o,type:c="text",placeholder:x,disabled:d,required:u,className:b,wrapperClassName:f,...y},p)=>{const g=!!(a||i),h=!!(o||n);return e.jsx(F,{label:t,error:r,helperText:s,required:u,disabled:d,wrapperClassName:f,startAdornment:g?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[a,i&&e.jsx("span",{className:"font-medium text-text select-none",children:i})]}):void 0,endAdornment:h?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[o&&e.jsx("span",{className:"font-medium text-text select-none",children:o}),n]}):void 0,children:e.jsx("input",{ref:p,type:c,disabled:d,placeholder:x||(typeof t=="string"?t:void 0),className:l("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",g?"ps-2.5":"ps-3.5",h?"pe-2.5":"pe-3.5","disabled:cursor-not-allowed",b),...y})})});me.displayName="GymatraTextInput";const Ot=m.forwardRef(({label:t="Email",startIcon:r,...s},a)=>{const n=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]});return e.jsx(me,{ref:a,type:"email",label:t,startIcon:r??n,autoComplete:"email",...s})});Ot.displayName="GymatraEmailInput";const _t=m.forwardRef(({label:t="Mot de passe",startIcon:r,...s},a)=>{const[n,i]=m.useState(!1),o=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});return e.jsx(me,{ref:a,type:n?"text":"password",label:t,startIcon:r??o,autoComplete:"current-password",endIcon:e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>i(!n),className:"text-text-muted hover:text-text cursor-pointer transition-colors p-1","aria-label":n?"Masquer":"Afficher",children:n?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"23",x2:"23",y2:"1"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),...s})});_t.displayName="GymatraPasswordInput";const $t=m.forwardRef(({label:t="Rechercher",startIcon:r,value:s,onChange:a,onClear:n,...i},o)=>{const[c,x]=m.useState(""),d=s!==void 0,u=d?String(s):c,b=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),f=()=>{d||x(""),n==null||n()};return e.jsx(me,{ref:o,type:"search",label:t,value:s,onChange:y=>{d||x(y.target.value),a==null||a(y)},startIcon:r??b,endIcon:u?e.jsx("button",{type:"button",onClick:f,className:"text-text-muted hover:text-text cursor-pointer p-0.5 rounded-full hover:bg-surface-muted transition-colors","aria-label":"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):void 0,...i})});$t.displayName="GymatraSearchInput";const bt=["MA","DZ","TN","FR","ES","BE","CA","US","GB","SA","AE","QA","TR"],ht={MA:"Maroc",DZ:"Algérie",TN:"Tunisie",FR:"France",ES:"Espagne",BE:"Belgique",CA:"Canada",US:"États-Unis",GB:"Royaume-Uni",SA:"Arabie Saoudite",AE:"Émirats Arabes Unis",QA:"Qatar",TR:"Turquie",IT:"Italie",DE:"Allemagne",CH:"Suisse",NL:"Pays-Bas",PT:"Portugal",EG:"Égypte",SN:"Sénégal",CI:"Côte d'Ivoire"},qt=({name:t,label:r="Téléphone",error:s,helperText:a,value:n,defaultValue:i,onChange:o,onBlur:c,defaultCountry:x="MA",disabled:d,required:u,autoValidate:b=!1,invalidErrorMessage:f,placeholder:y,className:p,wrapperClassName:g})=>{const[h,v]=m.useState(x),[k,j]=m.useState(i),[N,z]=m.useState(!1),[M,G]=m.useState(""),C=m.useRef(null),w=m.useRef(null),S=n!==void 0?n:k,W=B=>{n===void 0&&j(B),o==null||o(B)},L=ut[h],V=h?se.getCountryCallingCode(h):"212",re=!!(b&&S&&S.trim().length>3&&!se.isValidPhoneNumber(S)),I=s||(re?f||"Numéro de téléphone invalide pour ce pays":void 0),H=m.useMemo(()=>{const _=se.getCountries().filter(J=>!bt.includes(J));return[...bt,..._]},[]),ae=m.useMemo(()=>{if(!M.trim())return H;const B=M.toLowerCase().trim();return H.filter(_=>{const J=(xt[_]||ht[_]||_).toLowerCase(),K=se.getCountryCallingCode(_);return J.includes(B)||K.includes(B)||_.toLowerCase().includes(B)})},[H,M]);return m.useEffect(()=>{const B=_=>{C.current&&!C.current.contains(_.target)&&z(!1)};return N&&(document.addEventListener("mousedown",B),setTimeout(()=>{var _;return(_=w.current)==null?void 0:_.focus()},50)),()=>document.removeEventListener("mousedown",B)},[N]),e.jsxs("div",{ref:C,className:"relative w-full",children:[e.jsx(F,{label:r,error:I,helperText:a,required:u,disabled:d,focused:N,wrapperClassName:g,className:p,startAdornment:e.jsxs("div",{className:"relative flex items-center pe-1 self-stretch",children:[e.jsxs("button",{type:"button",disabled:d,onClick:()=>{d||(z(!N),G(""))},className:"flex items-center gap-1.5 py-1 px-1 -ms-1 rounded hover:bg-surface-muted transition-colors cursor-pointer select-none text-sm text-text outline-none focus-visible:ring-1 focus-visible:ring-primary","aria-expanded":N,"aria-label":"Sélectionner le pays",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-[2px] overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:L?e.jsx(L,{title:h}):e.jsx("span",{className:"text-xs",children:"🌐"})}),e.jsx("svg",{className:l("size-3 text-text-subtle shrink-0 transition-transform duration-200",N&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsxs("span",{className:"font-medium text-text text-sm ms-0.5",children:["+",V]})]}),e.jsx("span",{className:"h-4 w-px bg-border ms-1.5 me-1 shrink-0","aria-hidden":"true"})]}),children:e.jsx(br,{name:t,country:h,value:S,onChange:W,onBlur:c,disabled:d,placeholder:y||(h==="MA"?"06 55 12 34 56":"Numéro de téléphone"),className:l("w-full h-11 ps-1 pe-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed",p)})}),N&&e.jsxs("div",{className:"absolute top-[calc(100%+6px)] start-0 z-50 w-72 rounded-lg border border-border bg-white p-2 shadow-lg max-h-72 flex flex-col",children:[e.jsxs("div",{className:"relative mb-2 shrink-0",children:[e.jsx("div",{className:"absolute inset-y-0 start-2.5 flex items-center pointer-events-none text-text-subtle",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{ref:w,type:"text",value:M,onChange:B=>G(B.target.value),placeholder:"Rechercher pays ou indicatif...",className:"w-full h-8 ps-8 pe-2.5 bg-surface-muted rounded text-xs text-text placeholder:text-text-subtle outline-none border border-border focus:border-primary focus:bg-white transition-colors"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-0.5 pe-1",children:ae.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-center text-text-muted",children:"Aucun pays trouvé"}):ae.map(B=>{const _=ut[B],J=se.getCountryCallingCode(B),K=xt[B]||ht[B]||B,Y=B===h;return e.jsxs("button",{type:"button",onClick:()=>{v(B),z(!1),G("")},className:l("w-full flex items-center justify-between px-2.5 py-1.5 rounded text-xs transition-colors cursor-pointer text-start",Y?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-[2px] overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:_?e.jsx(_,{title:K}):e.jsx("span",{className:"text-[10px]",children:"🌐"})}),e.jsx("span",{className:"truncate",children:K})]}),e.jsxs("span",{className:l("text-xs shrink-0 ms-2 font-medium",Y?"text-primary":"text-text-muted"),children:["+",J]})]},B)})})]})]})};qt.displayName="GymatraPhoneInput";const Ut=m.forwardRef(({label:t="Site web",prefixText:r="https://",...s},a)=>{const n=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});return e.jsx(me,{ref:a,type:"url",label:t,startIcon:n,prefixText:r,placeholder:"example.com",...s})});Ut.displayName="GymatraUrlInput";const Ne=m.forwardRef(({label:t="Nombre",error:r,helperText:s,step:a=1,min:n,max:i,showSteppers:o=!0,prefixText:c,suffixText:x,disabled:d,required:u,className:b,value:f,defaultValue:y,onChange:p,...g},h)=>{const v=m.useRef(null),k=j=>{const N=v.current;!N||d||(j==="up"?N.stepUp():N.stepDown(),N.dispatchEvent(new Event("change",{bubbles:!0})))};return e.jsx(F,{label:t,error:r,helperText:s,required:u,disabled:d,startAdornment:c?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:c}):void 0,endAdornment:o?e.jsxs("div",{className:"flex flex-col border-s border-border -me-1 self-stretch my-0.5 justify-center",children:[e.jsx("button",{type:"button",tabIndex:-1,disabled:d,onClick:()=>k("up"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer flex-1 flex items-center justify-center","aria-label":"Augmenter",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})})}),e.jsx("button",{type:"button",tabIndex:-1,disabled:d,onClick:()=>k("down"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer border-t border-border flex-1 flex items-center justify-center","aria-label":"Diminuer",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}):x?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:x}):void 0,children:e.jsx("input",{ref:j=>{v.current=j,typeof h=="function"?h(j):h&&(h.current=j)},type:"number",step:a,min:n,max:i,disabled:d,value:f,defaultValue:y,onChange:p,className:l("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",c?"ps-2.5":"ps-3.5",o||x?"pe-2.5":"pe-3.5",b),...g})})});Ne.displayName="GymatraNumberInput";const ns=Ne,Vt=m.forwardRef(({label:t="Montant",currency:r="DH",currencyPosition:s="end",step:a=.01,min:n=0,placeholder:i="0.00",...o},c)=>{const x=s==="start";return e.jsx(Ne,{ref:c,label:t,step:a,min:n,placeholder:i,showSteppers:!1,prefixText:x?r:void 0,suffixText:x?void 0:r,...o})});Vt.displayName="GymatraCurrencyInput";const Ht=m.forwardRef(({label:t="Pourcentage",min:r=0,max:s=100,step:a=1,placeholder:n="0",...i},o)=>e.jsx(Ne,{ref:o,label:t,min:r,max:s,step:a,placeholder:n,showSteppers:!1,suffixText:"%",...i}));Ht.displayName="GymatraPercentageInput";const Kt=m.forwardRef(({label:t="Date",error:r,helperText:s,required:a,disabled:n,className:i,...o},c)=>e.jsx(F,{label:t,error:r,helperText:s,required:a,disabled:n,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:c,type:"date",disabled:n,className:l("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",i),...o})}));Kt.displayName="GymatraDateInput";const Qt=m.forwardRef(({label:t="Heure",error:r,helperText:s,required:a,disabled:n,className:i,...o},c)=>e.jsx(F,{label:t,error:r,helperText:s,required:a,disabled:n,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),children:e.jsx("input",{ref:c,type:"time",disabled:n,className:l("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",i),...o})}));Qt.displayName="GymatraTimeInput";const Zt=m.forwardRef(({label:t="Date & Heure",error:r,helperText:s,required:a,disabled:n,className:i,...o},c)=>e.jsx(F,{label:t,error:r,helperText:s,required:a,disabled:n,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:c,type:"datetime-local",disabled:n,className:l("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",i),...o})}));Zt.displayName="GymatraDateTimeInput";function os({label:t="Période (Début - Fin)",startDate:r,endDate:s,onStartDateChange:a,onEndDateChange:n,error:i,helperText:o,disabled:c,required:x,className:d}){return e.jsx(F,{label:t,error:i,helperText:o,required:x,disabled:c,className:d,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsxs("div",{className:"flex items-center w-full px-2",children:[e.jsx("input",{type:"date",value:r,disabled:c,onChange:u=>a==null?void 0:a(u.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"}),e.jsx("span",{className:"px-2 text-text-muted select-none",children:"→"}),e.jsx("input",{type:"date",value:s,disabled:c,onChange:u=>n==null?void 0:n(u.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"})]})})}function is({name:t,label:r="Sélection",options:s,value:a,defaultValue:n,onChange:i,onBlur:o,placeholder:c="Sélectionner une option...",searchable:x=!1,searchPlaceholder:d="Rechercher...",clearable:u=!1,error:b,helperText:f,required:y,disabled:p,className:g,wrapperClassName:h}){const[v,k]=m.useState(n),[j,N]=m.useState(!1),[z,M]=m.useState(""),G=m.useRef(null),C=m.useRef(null),w=a!==void 0,S=w?a:v,W=s.find(I=>I.value===S);m.useEffect(()=>{const I=H=>{G.current&&!G.current.contains(H.target)&&N(!1)};if(j)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[j]),m.useEffect(()=>{j&&x&&C.current&&C.current.focus(),j||M("")},[j,x]);const L=z.trim()?s.filter(I=>I.label.toLowerCase().includes(z.toLowerCase())||I.description&&I.description.toLowerCase().includes(z.toLowerCase())):s,V=I=>{I.disabled||(w||k(I.value),i==null||i(I.value),N(!1))},re=I=>{I.stopPropagation(),w||k(void 0),i==null||i(void 0)};return e.jsxs("div",{ref:G,className:l("relative w-full",h),children:[t&&e.jsx("input",{type:"hidden",name:t,value:S!==void 0?String(S):""}),e.jsx(F,{label:r,error:b,helperText:f,required:y,disabled:p,focused:j,endAdornment:e.jsxs("div",{className:"flex items-center gap-1",children:[u&&S!==void 0&&!p&&e.jsx("button",{type:"button",tabIndex:-1,onClick:re,className:"size-5 flex items-center justify-center rounded text-text-subtle hover:text-text hover:bg-surface-muted transition-colors cursor-pointer",title:"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("svg",{className:l("size-4 text-text-subtle transition-transform duration-200 pointer-events-none",j&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:e.jsx("button",{type:"button",disabled:p,onClick:()=>N(I=>!I),onBlur:o,className:l("w-full h-11 px-3.5 flex items-center justify-start text-start bg-transparent text-sm outline-none cursor-pointer border-0 ring-0",p&&"cursor-not-allowed text-text-subtle",g),children:W?e.jsxs("span",{className:"flex items-center gap-2 truncate text-text font-normal",children:[W.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:W.icon}),e.jsx("span",{className:"truncate",children:W.label})]}):e.jsx("span",{className:"text-text-subtle/80 truncate",children:c})})}),j&&e.jsxs("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-lg border border-border bg-white p-1.5 shadow-lg max-h-72 overflow-y-auto animate-in fade-in-50 zoom-in-95",children:[x&&e.jsx("div",{className:"p-1 pb-1.5 border-b border-border mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-muted rounded-md text-xs",children:[e.jsxs("svg",{className:"size-3.5 text-text-subtle shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:C,type:"text",value:z,onChange:I=>M(I.target.value),placeholder:d,className:"w-full bg-transparent text-text outline-none placeholder:text-text-subtle text-xs"}),z&&e.jsx("button",{type:"button",onClick:()=>M(""),className:"size-3.5 text-text-subtle hover:text-text cursor-pointer",children:"×"})]})}),e.jsx("div",{className:"space-y-0.5",children:L.length===0?e.jsx("div",{className:"py-4 text-center text-xs text-text-muted",children:"Aucun résultat trouvé"}):L.map(I=>{const H=I.value===S;return e.jsxs("button",{type:"button",disabled:I.disabled,onClick:()=>V(I),className:l("w-full flex items-center justify-between gap-2 px-3 py-2 rounded-md text-xs sm:text-sm text-start transition-colors cursor-pointer",H?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted",I.disabled&&"opacity-40 cursor-not-allowed hover:bg-transparent"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[I.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:I.icon}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:I.label}),I.description&&e.jsx("div",{className:"text-xs text-text-muted truncate mt-0.5",children:I.description})]})]}),H&&e.jsx("svg",{className:"size-4 text-primary shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},String(I.value))})})]})]})}const Jt=m.forwardRef(({label:t="Sélection",options:r,error:s,helperText:a,placeholder:n="Choisir...",disabled:i,required:o,className:c,children:x,...d},u)=>e.jsx(F,{label:t,error:s,helperText:a,required:o,disabled:i,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:u,disabled:i,className:l("w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",c),...d,children:[n&&e.jsx("option",{value:"",children:n}),r.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value)),x]})}));Jt.displayName="GymatraSelectField";function ls({label:t="Sélection multiple",options:r,value:s=[],onChange:a,error:n,helperText:i,placeholder:o="Sélectionner...",disabled:c,required:x}){const[d,u]=m.useState(!1),b=m.useRef(null);m.useEffect(()=>{const p=g=>{b.current&&!b.current.contains(g.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const f=p=>{s.includes(p)?a==null||a(s.filter(g=>g!==p)):a==null||a([...s,p])},y=r.filter(p=>s.includes(p.value));return e.jsxs("div",{ref:b,className:"relative w-full",children:[e.jsx(F,{label:t,error:n,helperText:i,required:x,disabled:c,focused:d,endAdornment:e.jsx("svg",{className:l("size-4 text-text-subtle transition-transform",d&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsx("button",{type:"button",disabled:c,onClick:()=>u(!d),className:"w-full min-h-11 py-2 px-3.5 flex flex-wrap items-center gap-1.5 text-left text-sm text-text outline-none cursor-pointer",children:y.length===0?e.jsx("span",{className:"text-text-subtle",children:o}):y.map(p=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs font-medium text-text border border-border",children:[p.label,e.jsx("span",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),f(p.value)},className:"text-text-muted hover:text-text cursor-pointer",children:"×"})]},p.value))})}),d&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1.5 shadow-sm max-h-56 overflow-y-auto",children:r.map(p=>{const g=s.includes(p.value);return e.jsxs("div",{onClick:()=>f(p.value),className:l("flex items-center justify-between px-2.5 py-1.5 rounded text-sm cursor-pointer transition-colors",g?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsx("span",{children:p.label}),g&&e.jsx("span",{children:"✓"})]},p.value)})})]})}function cs({label:t="Autocomplétion",suggestions:r,value:s="",onChange:a,placeholder:n="Commencez à taper...",error:i,helperText:o}){const[c,x]=m.useState(!1),[d,u]=m.useState(s),b=m.useRef(null),f=s!==void 0?s:d,y=r.filter(p=>p.toLowerCase().includes(f.toLowerCase())&&p.toLowerCase()!==f.toLowerCase());return m.useEffect(()=>{const p=g=>{b.current&&!b.current.contains(g.target)&&x(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),e.jsxs("div",{ref:b,className:"relative w-full",children:[e.jsx(F,{label:t,error:i,helperText:o,focused:c&&y.length>0,children:e.jsx("input",{type:"text",value:f,placeholder:n,onFocus:()=>x(!0),onChange:p=>{const g=p.target.value;u(g),a==null||a(g),x(!0)},className:"w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0"})}),c&&y.length>0&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1 shadow-sm max-h-48 overflow-y-auto",children:y.map((p,g)=>e.jsx("div",{onClick:()=>{u(p),a==null||a(p),x(!1)},className:"px-3 py-2 rounded text-sm text-text hover:bg-surface-muted cursor-pointer transition-colors",children:p},g))})]})}function ds({label:t,boxLabel:r,description:s,error:a,helperText:n,checked:i,defaultChecked:o,onChange:c,disabled:x,className:d,...u}){return e.jsx(F,{label:t,error:a,helperText:n,disabled:x,className:d,children:e.jsxs("label",{className:"flex items-start gap-2.5 w-full p-3 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:i,defaultChecked:o,onChange:c,disabled:x,className:"mt-0.5 size-4 accent-primary rounded border-border",...u}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-sm font-medium text-text block leading-tight",children:r}),s&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 block",children:s})]})]})})}function us({label:t="Options",name:r,options:s,value:a,defaultValue:n,onChange:i,direction:o="horizontal",error:c,helperText:x,disabled:d}){return e.jsx(F,{label:t,error:c,helperText:x,disabled:d,children:e.jsx("div",{className:l("p-3 w-full flex flex-wrap gap-4",o==="vertical"&&"flex-col gap-2.5"),children:s.map(u=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:r,value:u.value,checked:a!==void 0?a===u.value:void 0,defaultChecked:n===u.value,onChange:()=>i==null?void 0:i(u.value),disabled:d,className:"size-4 accent-primary"}),e.jsx("span",{className:"text-sm font-medium text-text",children:u.label})]},u.value))})})}function xs({label:t,switchLabel:r,description:s,checked:a,defaultChecked:n,onChange:i,error:o,helperText:c,disabled:x}){return e.jsx(F,{label:t,error:o,helperText:c,disabled:x,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3",children:[e.jsxs("div",{className:"min-w-0 pe-3",children:[e.jsx("span",{className:"text-sm font-medium text-text block leading-tight",children:r}),s&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 block",children:s})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":a,disabled:x,onClick:()=>i==null?void 0:i(!a),className:l("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",a?"bg-primary":"bg-border-strong"),children:e.jsx("span",{className:l("pointer-events-none inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out",a?"translate-x-5":"translate-x-0")})})]})})}function ms({label:t,options:r,value:s,onChange:a,error:n,helperText:i}){return e.jsx(F,{label:t,error:n,helperText:i,children:e.jsx("div",{className:"flex items-center p-1.5 w-full gap-1",children:r.map(o=>e.jsx("button",{type:"button",onClick:()=>a(o.value),className:l("flex-1 h-8 rounded text-sm font-medium transition-colors cursor-pointer",s===o.value?"bg-primary text-white shadow-none":"bg-surface-muted text-text-muted hover:bg-border/60 hover:text-text"),children:o.label},o.value))})})}const Yt=m.forwardRef(({label:t="Description",error:r,helperText:s,required:a,disabled:n,className:i,placeholder:o,rows:c=3,...x},d)=>e.jsx(F,{label:t,error:r,helperText:s,required:a,disabled:n,children:e.jsx("textarea",{ref:d,rows:c,disabled:n,placeholder:o||(typeof t=="string"?t:void 0),className:l("w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",i),...x})}));Yt.displayName="GymatraTextareaField";function ps({label:t="Contenu enrichi",value:r,defaultValue:s="",onChange:a,placeholder:n="Rédigez votre texte...",error:i,helperText:o,disabled:c}){const[x,d]=m.useState(s),u=r!==void 0?r:x,b=f=>{const y=`${u} [${f}]`;r===void 0&&d(y),a==null||a(y)};return e.jsx(F,{label:t,error:i,helperText:o,disabled:c,children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2 bg-surface-muted/50",children:[e.jsx("button",{type:"button",onClick:()=>b("b"),className:"size-7 rounded text-xs font-bold text-text hover:bg-white hover:shadow-xs transition-colors",title:"Gras",children:"B"}),e.jsx("button",{type:"button",onClick:()=>b("i"),className:"size-7 rounded text-xs italic font-serif text-text hover:bg-white hover:shadow-xs transition-colors",title:"Italique",children:"I"}),e.jsx("button",{type:"button",onClick:()=>b("u"),className:"size-7 rounded text-xs underline text-text hover:bg-white hover:shadow-xs transition-colors",title:"Souligné",children:"U"}),e.jsx("span",{className:"h-4 w-px bg-border mx-1"}),e.jsx("button",{type:"button",onClick:()=>b("ul"),className:"size-7 rounded text-xs text-text hover:bg-white hover:shadow-xs transition-colors flex items-center justify-center",title:"Liste à puces",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]})}),e.jsx("button",{type:"button",onClick:()=>b("link"),className:"size-7 rounded text-xs text-text hover:bg-white hover:shadow-xs transition-colors flex items-center justify-center",title:"Lien",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]}),e.jsx("textarea",{rows:4,value:u,disabled:c,placeholder:n,onChange:f=>{r===void 0&&d(f.target.value),a==null||a(f.target.value)},className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none"})]})})}function fs({label:t="Fichiers joints",accept:r,multiple:s=!1,onFilesSelected:a,error:n,helperText:i,disabled:o}){const[c,x]=m.useState([]),d=m.useId(),u=b=>{if(!b||b.length===0)return;const f=Array.from(b);x(f.map(y=>y.name)),a==null||a(f)};return e.jsx(F,{label:t,error:n,helperText:i,disabled:o,children:e.jsxs("div",{className:"flex flex-col w-full p-3.5",children:[e.jsx("input",{id:d,type:"file",accept:r,multiple:s,disabled:o,onChange:b=>u(b.target.files),className:"hidden"}),e.jsxs("label",{htmlFor:d,className:"flex flex-col items-center justify-center border-2 border-dashed border-border rounded-md p-4 bg-surface-muted/30 hover:bg-surface-muted cursor-pointer transition-colors text-center",children:[e.jsxs("svg",{className:"size-6 text-text-subtle mb-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsx("span",{className:"text-sm font-medium text-primary",children:"Cliquez pour parcourir"}),e.jsx("span",{className:"text-xs text-text-muted mt-0.5",children:"ou glissez-déposez vos fichiers ici"})]}),c.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:c.map((b,f)=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs text-text border border-border",children:["📄 ",b]},f))})]})})}function bs({label:t="Téléverser une image",onImageSelected:r,error:s,helperText:a,disabled:n}){const[i,o]=m.useState(null),c=m.useId(),x=d=>{const u=d==null?void 0:d[0];u&&(o(URL.createObjectURL(u)),r==null||r(u))};return e.jsx(F,{label:t,error:s,helperText:a,disabled:n,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3.5 gap-3",children:[e.jsx("input",{id:c,type:"file",accept:"image/*",disabled:n,onChange:d=>x(d.target.files),className:"hidden"}),i?e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("img",{src:i,alt:"Aperçu",className:"size-14 rounded-md object-cover border border-border shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("label",{htmlFor:c,className:"text-xs font-semibold text-primary hover:underline cursor-pointer block",children:"Changer l'image"}),e.jsx("button",{type:"button",onClick:()=>o(null),className:"mt-1 text-xs text-danger hover:underline cursor-pointer",children:"Supprimer"})]})]}):e.jsxs("label",{htmlFor:c,className:"flex items-center gap-3 w-full cursor-pointer",children:[e.jsx("div",{className:"size-12 rounded-md bg-surface-muted border border-border flex items-center justify-center text-text-subtle shrink-0",children:e.jsxs("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text block",children:"Sélectionner une photo"}),e.jsx("span",{className:"text-xs text-text-muted",children:"PNG, JPG, WebP jusqu'à 5MB"})]})]})]})})}function hs({label:t="Photo de profil",initialSrc:r,onAvatarChange:s,error:a,helperText:n,disabled:i}){const[o,c]=m.useState(r??null),x=m.useId(),d=u=>{const b=u==null?void 0:u[0];b&&(c(URL.createObjectURL(b)),s==null||s(b))};return e.jsx(F,{label:t,error:a,helperText:n,disabled:i,children:e.jsxs("div",{className:"flex items-center gap-3.5 w-full p-3.5",children:[e.jsx("input",{id:x,type:"file",accept:"image/*",disabled:i,onChange:u=>d(u.target.files),className:"hidden"}),e.jsx("div",{className:"size-12 rounded-full border border-border bg-surface-muted overflow-hidden flex items-center justify-center shrink-0",children:o?e.jsx("img",{src:o,alt:"Avatar",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:x,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une photo"}),e.jsx("span",{className:"text-xs text-text-muted block mt-0.5",children:"Format carré recommandé"})]})]})})}const ys=["#224086","#10B981","#EF4444","#F59E0B","#8B5CF6","#06B6D4","#1E293B"];function Xt({name:t,label:r="Couleur",value:s,defaultValue:a="#224086",onChange:n,onBlur:i,presets:o=ys,showPresets:c=!0,error:x,helperText:d,disabled:u,required:b,className:f,wrapperClassName:y}){const[p,g]=m.useState(a),h=s!==void 0?s:p,v=j=>{s===void 0&&g(j),n==null||n(j)},k=h.startsWith("#")?h.slice(1):h;return e.jsx(F,{label:r,error:x,helperText:d,required:b,disabled:u,wrapperClassName:y,className:f,startAdornment:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative size-6 rounded border border-border overflow-hidden cursor-pointer shrink-0 shadow-none hover:border-text-subtle transition-colors",children:[e.jsx("div",{className:"w-full h-full",style:{backgroundColor:h||"#224086"}}),e.jsx("input",{type:"color",value:h.startsWith("#")&&h.length===7?h:"#224086",disabled:u,onChange:j=>v(j.target.value.toUpperCase()),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed","aria-label":"Choisir la couleur"})]}),e.jsx("span",{className:"text-text-muted font-mono text-sm select-none",children:"#"})]}),endAdornment:c&&o.length>0?e.jsx("div",{className:"flex items-center gap-1.5 pe-1",children:o.slice(0,7).map(j=>{const N=h.toLowerCase()===j.toLowerCase();return e.jsx("button",{type:"button",disabled:u,onClick:()=>v(j),className:l("size-4 rounded-full border transition-all cursor-pointer hover:scale-115 shrink-0",N?"ring-2 ring-primary ring-offset-1 border-white scale-110":"border-border/60 hover:border-text-subtle"),style:{backgroundColor:j},title:j,"aria-label":`Couleur ${j}`},j)})}):void 0,children:e.jsx("input",{name:t,type:"text",value:k.toUpperCase(),disabled:u,maxLength:6,onChange:j=>{const N=j.target.value.replace(/[^0-9A-Fa-f]/g,"");N.length<=6&&v(`#${N}`)},onBlur:i,placeholder:"224086",className:l("w-full h-11 ps-1 pe-2 bg-transparent text-sm font-mono text-text placeholder:text-text-subtle/80 uppercase outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed")})})}const gs=Xt;function js({label:t="Intensité",min:r=0,max:s=100,step:a=1,value:n,defaultValue:i=50,unit:o="%",onChange:c,error:x,helperText:d,disabled:u}){const[b,f]=m.useState(i),y=n!==void 0?n:b;return e.jsx(F,{label:t,error:x,helperText:d,disabled:u,children:e.jsxs("div",{className:"flex items-center gap-3 w-full p-3",children:[e.jsx("input",{type:"range",min:r,max:s,step:a,value:y,disabled:u,onChange:p=>{const g=Number(p.target.value);n===void 0&&f(g),c==null||c(g)},className:"flex-1 accent-primary cursor-pointer"}),e.jsxs("span",{className:"min-w-10 text-right text-sm font-semibold text-text font-mono",children:[y,o]})]})})}function vs({label:t="Fourchette",min:r=0,max:s=1e3,minValue:a=100,maxValue:n=600,unit:i="€",onRangeChange:o,error:c,helperText:x}){const[d,u]=m.useState(a),[b,f]=m.useState(n);return e.jsx(F,{label:t,error:c,helperText:x,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Min:"}),e.jsx("input",{type:"number",min:r,max:b,value:d,onChange:y=>{const p=Number(y.target.value);u(p),o==null||o(p,b)},className:"w-full h-8 px-2 rounded border border-border text-xs font-semibold text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:i})]}),e.jsx("span",{className:"text-text-muted",children:"—"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max:"}),e.jsx("input",{type:"number",min:d,max:s,value:b,onChange:y=>{const p=Number(y.target.value);f(p),o==null||o(d,p)},className:"w-full h-8 px-2 rounded border border-border text-xs font-semibold text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:i})]})]})})}function ws({label:t="Code de validation (OTP)",length:r=6,value:s="",onChange:a,error:n,helperText:i,disabled:o}){const[c,x]=m.useState(s),d=s!==void 0?s:c,u=(f,y)=>{y.length>1&&(y=y.slice(-1));const p=d.padEnd(r," ").split("");p[f]=y||" ";const g=p.join("").trimEnd();if(s===void 0&&x(g),a==null||a(g),y&&f<r-1){const h=document.getElementById(`gym-otp-${f+1}`);h==null||h.focus()}},b=(f,y)=>{if(y.key==="Backspace"&&!d[f]&&f>0){const p=document.getElementById(`gym-otp-${f-1}`);p==null||p.focus()}};return e.jsx(F,{label:t,error:n,helperText:i,disabled:o,children:e.jsx("div",{className:"flex items-center justify-between w-full p-3 gap-2",children:Array.from({length:r}).map((f,y)=>e.jsx("input",{id:`gym-otp-${y}`,type:"text",inputMode:"numeric",maxLength:1,disabled:o,value:d[y]&&d[y]!==" "?d[y]:"",onChange:p=>u(y,p.target.value),onKeyDown:p=>b(y,p),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},y))})})}function ke({label:t,error:r,helperText:s,required:a,disabled:n,startAdornment:i,endAdornment:o,focused:c,hasValue:x,className:d,children:u,...b}){const f=!!r;return e.jsxs("div",{className:l("relative w-full pt-2.5 pb-1",n&&"opacity-60 pointer-events-none",d),...b,children:[e.jsxs("div",{className:l("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",f?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":c?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[e.jsxs("label",{className:l("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",f?"text-danger":c?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,a&&e.jsx("span",{className:"ms-0.5 text-danger",children:"*"})]}),i&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:i}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:u}),o&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:o})]}),(r||s)&&e.jsx("p",{className:l("mt-1 text-xs leading-none ps-1",f?"text-danger":"text-text-muted"),children:r||s})]})}const er=m.forwardRef(({label:t,error:r,helperText:s,startIcon:a,endIcon:n,prefixText:i,suffixText:o,type:c="text",value:x,defaultValue:d,onChange:u,disabled:b,required:f,className:y,placeholder:p,...g},h)=>{const[v,k]=m.useState(!1),[j,N]=m.useState(d??""),z=x!==void 0,M=c==="password",G=M?v?"text":"password":c;return e.jsx(ke,{label:t,error:r,helperText:s,required:f,disabled:b,className:y,startAdornment:a||i?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[a,i&&e.jsx("span",{className:"font-medium text-text",children:i})]}):void 0,endAdornment:M?e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>k(!v),className:"text-text-muted hover:text-text cursor-pointer transition-colors","aria-label":v?"Hide password":"Show password",children:v?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}):o||n?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[o&&e.jsx("span",{className:"font-medium text-text",children:o}),n]}):void 0,children:e.jsx("input",{ref:h,type:G,value:x,defaultValue:d,onChange:C=>{z||N(C.target.value),u==null||u(C)},disabled:b,placeholder:p||(typeof t=="string"?t:void 0),className:l("w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed"),...g})})});er.displayName="GymatraTextField";const tr=m.forwardRef(({label:t,error:r,helperText:s,required:a,disabled:n,className:i,placeholder:o,rows:c=3,...x},d)=>e.jsx(ke,{label:t,error:r,helperText:s,required:a,disabled:n,className:i,children:e.jsx("textarea",{ref:d,rows:c,disabled:n,placeholder:o||(typeof t=="string"?t:void 0),className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",...x})}));tr.displayName="GymatraFloatingTextarea";const rr=m.forwardRef(({label:t,error:r,helperText:s,required:a,disabled:n,options:i,className:o,children:c,...x},d)=>e.jsx(ke,{label:t,error:r,helperText:s,required:a,disabled:n,className:o,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:d,disabled:n,className:"w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",...x,children:[i.map(u=>e.jsx("option",{value:u.value,children:u.label},u.value)),c]})}));rr.displayName="GymatraFloatingSelect";function Ns({length:t=6,value:r="",onChange:s,label:a="Code OTP / PIN",error:n,disabled:i}){const[o,c]=m.useState(r),x=r!==void 0?r:o,d=(b,f)=>{f.length>1&&(f=f.slice(-1));const y=x.padEnd(t," ").split("");y[b]=f||" ";const p=y.join("").trimEnd();if(r===void 0&&c(p),s==null||s(p),f&&b<t-1){const g=document.getElementById(`otp-digit-${b+1}`);g==null||g.focus()}},u=(b,f)=>{if(f.key==="Backspace"&&!x[b]&&b>0){const y=document.getElementById(`otp-digit-${b-1}`);y==null||y.focus()}};return e.jsx("div",{className:"relative",children:e.jsx(ke,{label:a,error:n,disabled:i,children:e.jsx("div",{className:"flex items-center justify-between w-full p-2.5 gap-2",children:Array.from({length:t}).map((b,f)=>e.jsx("input",{id:`otp-digit-${f}`,type:"text",inputMode:"numeric",maxLength:1,disabled:i,value:x[f]&&x[f]!==" "?x[f]:"",onChange:y=>d(f,y.target.value),onKeyDown:y=>u(f,y),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},f))})})})}function ks({label:t="Photo de profil",src:r,onChange:s,disabled:a}){const[n,i]=m.useState(r),o=m.useId(),c=x=>{var u;const d=(u=x.target.files)==null?void 0:u[0];if(d){const b=URL.createObjectURL(d);i(b),s==null||s(d)}};return e.jsxs("div",{className:"relative rounded-md border border-border p-3.5 bg-white",children:[e.jsx("label",{className:"absolute -top-2.5 start-2.5 px-1 bg-white text-xs font-medium text-text-muted",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"relative size-12 shrink-0 rounded-full border border-border overflow-hidden bg-surface-muted flex items-center justify-center text-text-muted",children:n?e.jsx("img",{src:n,alt:"Avatar preview",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("input",{id:o,type:"file",accept:"image/*",disabled:a,onChange:c,className:"hidden"}),e.jsx("label",{htmlFor:o,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une image"}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"PNG, JPG jusqu'à 2MB"})]})]})]})}function Gs({className:t,...r}){return e.jsx(yt.Form,{...r,className:typeof t=="function"?s=>l("gym-form",t(s)):l("gym-form",t)})}function Cs({name:t,label:r,description:s,error:a,required:n,disabled:i,validate:o,validationMode:c,className:x,children:d}){return e.jsxs(q.Field.Root,{name:t,invalid:!!a,disabled:i,validate:o,validationMode:c,className:l("gym-field",x),children:[e.jsxs(q.Field.Label,{className:"gym-field__label",children:[r,n&&e.jsx("span",{className:"gym-required","aria-hidden":"true",children:"*"})]}),d,s&&e.jsx(q.Field.Description,{className:"gym-field__description",children:s}),a?e.jsx(q.Field.Error,{match:!0,className:"gym-field__error",children:a}):e.jsx(q.Field.Error,{match:"valueMissing",className:"gym-field__error",children:"This field is required."}),!a&&e.jsx(q.Field.Error,{match:"typeMismatch",className:"gym-field__error",children:"Enter a valid value."})]})}const sr=m.forwardRef(({className:t,...r},s)=>e.jsx(q.Field.Control,{ref:s,render:e.jsx(gt.Input,{}),...r,className:l("gym-control",t)}));sr.displayName="GymatraInput";function Ss({rows:t=4,className:r,...s}){return e.jsx(q.Field.Control,{...s,render:e.jsx("textarea",{rows:t}),className:l("gym-control gym-control--textarea",r)})}function Ps({name:t,label:r,description:s,error:a,options:n,value:i,defaultValue:o,onValueChange:c,placeholder:x="Choose an option",required:d,disabled:u,className:b}){const f=m.useId(),y=s?`${f}-description`:void 0,p=`${f}-error`;return e.jsxs(q.Field.Root,{name:t,invalid:!!a,disabled:u,className:l("gym-field",b),children:[e.jsxs(q.Field.Label,{htmlFor:f,className:"gym-field__label",children:[r,d&&e.jsx("span",{className:"gym-required","aria-hidden":"true",children:"*"})]}),e.jsxs(Z.Select.Root,{name:t,id:f,items:n,value:i,defaultValue:o,onValueChange:c,required:d,disabled:u,children:[e.jsxs(Z.Select.Trigger,{"aria-describedby":[y,p].filter(Boolean).join(" "),"aria-invalid":a?!0:void 0,className:"gym-control gym-select__trigger",children:[e.jsx(Z.Select.Value,{placeholder:x}),e.jsx(Z.Select.Icon,{"aria-hidden":"true",className:"gym-select__icon",children:"⌄"})]}),e.jsx(Z.Select.Portal,{children:e.jsx(Z.Select.Positioner,{sideOffset:4,className:"gym-select__positioner",children:e.jsx(Z.Select.Popup,{className:"gym-select__popup",children:e.jsx(Z.Select.List,{children:n.map(g=>e.jsxs(Z.Select.Item,{value:g.value,className:"gym-select__item",children:[e.jsx(Z.Select.ItemText,{children:g.label}),e.jsx(Z.Select.ItemIndicator,{className:"gym-select__check",children:"✓"})]},g.value))})})})})]}),s&&e.jsx(q.Field.Description,{id:y,className:"gym-field__description",children:s}),e.jsx(q.Field.Error,{id:p,match:a?!0:"valueMissing",className:"gym-field__error",children:a??"Choose an option."})]})}function zs({name:t,label:r,description:s,checked:a,defaultChecked:n,onCheckedChange:i,disabled:o,required:c,className:x}){const d=m.useId();return e.jsxs(q.Field.Root,{name:t,disabled:o,className:l("gym-choice",x),children:[e.jsxs(q.Field.Label,{htmlFor:d,className:"gym-choice__label",children:[e.jsx(Ue.Checkbox.Root,{id:d,name:t,checked:a,defaultChecked:n,onCheckedChange:i,disabled:o,required:c,className:"gym-checkbox",children:e.jsx(Ue.Checkbox.Indicator,{className:"gym-checkbox__check",children:"✓"})}),e.jsxs("span",{children:[r,c&&e.jsx("span",{className:"gym-required","aria-hidden":"true",children:"*"})]})]}),s&&e.jsx(q.Field.Description,{className:"gym-field__description gym-choice__description",children:s})]})}const Is=R.Menu.Root,Ms=R.Menu.Trigger,Ts=R.Menu.Portal,Rs=R.Menu.Positioner,Ls=R.Menu.Group,Bs=R.Menu.RadioGroup,Ds=R.Menu.SubmenuRoot,pe=m.forwardRef(({className:t,children:r,...s},a)=>e.jsx(R.Menu.Popup,{ref:a,className:l("z-50 min-w-48 rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));pe.displayName="GymatraMenuPopup";const Be=m.forwardRef(({variant:t="default",startIcon:r,endIcon:s,shortcut:a,className:n,children:i,...o},c)=>e.jsxs(R.Menu.Item,{ref:c,className:l("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t==="danger"?"text-danger data-[highlighted]:bg-rose-50 data-[highlighted]:text-danger font-medium":t==="primary"?"text-primary data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary font-medium":"text-text data-[highlighted]:bg-surface-muted data-[highlighted]:text-text",n),...o,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:r}),e.jsx("span",{className:"flex-1 truncate",children:i}),a&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-[11px] text-text-subtle tracking-widest",children:a}),s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center ml-auto",children:s})]}));Be.displayName="GymatraMenuItem";const De=m.forwardRef(({className:t,...r},s)=>e.jsx(R.Menu.Separator,{ref:s,className:l("my-1 h-px bg-border -mx-1",t),...r}));De.displayName="GymatraMenuSeparator";const Fe=m.forwardRef(({className:t,...r},s)=>e.jsx(R.Menu.GroupLabel,{ref:s,className:l("px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wider text-text-subtle select-none",t),...r}));Fe.displayName="GymatraMenuGroupLabel";function Fs({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function As({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const Ae=m.forwardRef(({className:t,children:r,shortcut:s,...a},n)=>e.jsxs(R.Menu.CheckboxItem,{ref:n,className:l("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...a,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(R.Menu.CheckboxItemIndicator,{children:e.jsx(Fs,{})})}),e.jsx("span",{className:"flex-1 truncate",children:r}),s&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-[11px] text-text-subtle tracking-widest",children:s})]}));Ae.displayName="GymatraMenuCheckboxItem";const Ee=m.forwardRef(({className:t,children:r,...s},a)=>e.jsxs(R.Menu.RadioItem,{ref:a,className:l("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...s,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(R.Menu.RadioItemIndicator,{children:e.jsx("span",{className:"size-2 rounded-full bg-primary"})})}),e.jsx("span",{className:"flex-1 truncate",children:r})]}));Ee.displayName="GymatraMenuRadioItem";const We=m.forwardRef(({startIcon:t,className:r,children:s,...a},n)=>e.jsxs(R.Menu.SubmenuTrigger,{ref:n,className:l("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",r),...a,children:[e.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:t}),e.jsx("span",{className:"truncate",children:s})]}),e.jsx(As,{className:"size-3.5 text-text-muted shrink-0"})]}));We.displayName="GymatraMenuSubmenuTrigger";function Oe(t){return t.map((r,s)=>{const a=r.key??`menu-item-${s}`;return r.type==="separator"?e.jsx(De,{},a):r.type==="label"?e.jsx(Fe,{children:r.label},a):r.type==="checkbox"?e.jsx(Ae,{checked:r.checked,onCheckedChange:r.onCheckedChange,shortcut:r.shortcut,disabled:r.disabled,children:r.label},a):r.type==="radio"?e.jsx(Ee,{value:r.value??String(a),disabled:r.disabled,children:r.label},a):r.items&&r.items.length>0?e.jsxs(R.Menu.SubmenuRoot,{children:[e.jsx(We,{startIcon:r.startIcon??r.icon,disabled:r.disabled,children:r.label}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{sideOffset:4,align:"start",className:"z-50 outline-none",children:e.jsx(pe,{children:Oe(r.items)})})})]},a):e.jsx(Be,{variant:r.variant,startIcon:r.startIcon??r.icon,endIcon:r.endIcon,shortcut:r.shortcut,disabled:r.disabled,onClick:r.onClick,children:r.label},a)})}function Es({trigger:t,items:r,open:s,defaultOpen:a,onOpenChange:n,side:i="bottom",align:o="start",sideOffset:c=6,width:x="min-w-[200px]",popupClassName:d,children:u}){const b=s!==void 0?{open:s,onOpenChange:n}:a!==void 0?{defaultOpen:a,onOpenChange:n}:{onOpenChange:n};return e.jsxs(R.Menu.Root,{...b,children:[e.jsx(R.Menu.Trigger,{render:m.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{side:i,align:o,sideOffset:c,className:"z-50 outline-none",children:e.jsx(pe,{className:l(x,d),children:r&&r.length>0?Oe(r):u})})})]})}const Ws=jt.Menubar,Os=R.Menu.Root,_s=R.Menu.Portal,$s=R.Menu.Positioner,qs=R.Menu.Group,Us=R.Menu.RadioGroup,Vs=R.Menu.SubmenuRoot,Hs=pe,Ks=Be,Qs=De,Zs=Fe,Js=Ae,Ys=Ee,Xs=We,Ye=m.forwardRef(({className:t,startIcon:r,children:s,...a},n)=>e.jsxs(R.Menu.Trigger,{ref:n,className:l("flex cursor-pointer select-none items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-text outline-none transition-colors","hover:bg-surface-muted hover:text-text","data-[popup-open]:bg-primary-soft data-[popup-open]:text-primary","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",t),...a,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:r}),e.jsx("span",{children:s})]}));Ye.displayName="GymatraMenubarTrigger";const ar=m.forwardRef(({menus:t,bordered:r=!0,className:s,children:a,...n},i)=>e.jsx(jt.Menubar,{ref:i,className:l("flex items-center gap-0.5 text-sm text-text select-none",r?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",s),...n,children:t&&t.length>0?t.map((o,c)=>{const x=o.key??`menubar-menu-${c}`;return e.jsxs(R.Menu.Root,{disabled:o.disabled,children:[e.jsx(Ye,{startIcon:o.startIcon,disabled:o.disabled,children:o.trigger}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{side:o.side??"bottom",align:o.align??"start",sideOffset:o.sideOffset??6,className:"z-50 outline-none",children:e.jsx(pe,{className:l(o.width??"min-w-52",o.popupClassName),children:Oe(o.items)})})})]},x)}):a}));ar.displayName="GymatraMenubar";function ea({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ta({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function ra({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function sa({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Xe({page:t,total:r,pageSize:s,onPageChange:a,pageSizeOptions:n,onPageSizeChange:i,showSummary:o=!0,className:c,...x}){const d=Math.max(1,Math.ceil(r/s)),u=Math.min(Math.max(1,t),d),b=r===0?0:(u-1)*s+1,f=Math.min(u*s,r),[y,p]=m.useState(!1),g=m.useRef(null);m.useEffect(()=>{function k(j){g.current&&!g.current.contains(j.target)&&p(!1)}if(y)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[y]);function h(){return d<=7?Array.from({length:d},(k,j)=>j+1):u<=4?[1,2,3,4,5,"ellipsis",d]:u>=d-3?[1,"ellipsis",d-4,d-3,d-2,d-1,d]:[1,"ellipsis",u-1,u,u+1,"ellipsis",d]}const v=h();return e.jsxs("div",{className:l("flex flex-wrap items-center justify-between gap-3 pt-3 px-1 text-xs text-text-muted",c),...x,children:[e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-xs",children:[o&&e.jsxs("span",{children:["Display ",b," to ",f," of ",r]}),n&&n.length>0&&i&&e.jsxs("div",{ref:g,className:"relative inline-block text-left",children:[e.jsxs("button",{type:"button",onClick:()=>p(k=>!k),"aria-haspopup":"listbox","aria-expanded":y,"aria-label":`Rows per page: ${s}`,className:l("inline-flex h-7 items-center justify-between gap-2 rounded-md border border-border bg-white px-2.5 text-xs text-text cursor-pointer transition-colors outline-none","hover:border-border-strong hover:bg-surface/50","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",y&&"border-primary bg-primary-soft/30 text-primary"),children:[e.jsx("span",{children:s}),e.jsx("span",{className:l("text-text-subtle transition-transform duration-150 flex items-center",y&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(ra,{})})]}),y&&e.jsx("div",{role:"listbox","aria-label":"Rows per page",className:"absolute left-0 bottom-full z-50 mb-1 min-w-[75px] rounded-lg border border-border bg-white p-1 shadow-sm focus:outline-none",children:n.map(k=>{const j=k===s;return e.jsxs("button",{type:"button",role:"option","aria-selected":j,onClick:()=>{i(k),p(!1)},className:l("flex w-full items-center justify-between rounded px-2 py-1 text-xs text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text",j?"bg-primary-soft/40 text-primary font-semibold":"text-text font-normal"),children:[e.jsx("span",{children:k}),j&&e.jsx("span",{className:"text-primary","aria-hidden":"true",children:e.jsx(sa,{})})]},k)})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 ms-auto",children:[e.jsx("button",{type:"button",disabled:u<=1,onClick:()=>a(u-1),"aria-label":"Previous page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(ea,{})}),v.map((k,j)=>{if(k==="ellipsis")return e.jsx("span",{className:"flex size-7 items-center justify-center text-text-subtle select-none",children:"…"},`ellipsis-${j}`);const N=k===u;return e.jsx("button",{type:"button",onClick:()=>a(k),"aria-current":N?"page":void 0,className:l("flex size-7 items-center justify-center rounded-full text-xs font-semibold cursor-pointer transition-colors",N?"bg-primary text-white":"text-text hover:bg-surface"),children:k},k)}),e.jsx("button",{type:"button",disabled:u>=d,onClick:()=>a(u+1),"aria-label":"Next page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(ta,{})})]})]})}Xe.displayName="GymatraPagination";const aa=Q.Popover.Root,na=Q.Popover.Trigger,oa=Q.Popover.Portal,ia=Q.Popover.Positioner,et=m.forwardRef(({className:t,children:r,...s},a)=>e.jsx(Q.Popover.Popup,{ref:a,className:l("relative z-50 rounded-lg border border-border bg-white p-4 text-text outline-none shadow-none",t),...s,children:r}));et.displayName="GymatraPopoverPopup";const tt=m.forwardRef(({className:t,...r},s)=>e.jsx(Q.Popover.Title,{ref:s,className:l("text-sm font-semibold text-text tracking-tight",t),...r}));tt.displayName="GymatraPopoverTitle";const rt=m.forwardRef(({className:t,...r},s)=>e.jsx(Q.Popover.Description,{ref:s,className:l("mt-1 text-xs leading-relaxed text-text-muted",t),...r}));rt.displayName="GymatraPopoverDescription";function la({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}const st=m.forwardRef(({className:t,children:r,...s},a)=>e.jsx(Q.Popover.Close,{ref:a,className:l("absolute top-3 right-3 rounded-md p-1 text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",t),"aria-label":"Fermer",...s,children:r??e.jsx(la,{})}));st.displayName="GymatraPopoverClose";const nr=m.forwardRef(({className:t,...r},s)=>e.jsx(Q.Popover.Arrow,{ref:s,className:l("fill-white stroke-border stroke-1",t),...r}));nr.displayName="GymatraPopoverArrow";function ca({trigger:t,title:r,description:s,content:a,children:n,footer:i,side:o="bottom",align:c="center",sideOffset:x=8,width:d="w-80",showCloseButton:u=!0,open:b,defaultOpen:f,onOpenChange:y,modal:p=!1,popupClassName:g}){const h=b!==void 0?{open:b,onOpenChange:y,modal:p}:f!==void 0?{defaultOpen:f,onOpenChange:y,modal:p}:{onOpenChange:y,modal:p};return e.jsxs(Q.Popover.Root,{...h,children:[e.jsx(Q.Popover.Trigger,{render:m.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(Q.Popover.Portal,{children:e.jsx(Q.Popover.Positioner,{side:o,align:c,sideOffset:x,className:"z-50 outline-none",children:e.jsxs(et,{className:l(d,g),children:[u&&e.jsx(st,{}),(r||s)&&e.jsxs("div",{className:l("space-y-1",u?"pr-6":void 0),children:[r&&e.jsx(tt,{children:r}),s&&e.jsx(rt,{children:s})]}),(a||n)&&e.jsx("div",{className:l(r||s?"mt-3":void 0),children:a??n}),i&&e.jsx("div",{className:"mt-4 pt-3 border-t border-border flex items-center justify-end gap-2",children:i})]})})})]})}const da=ee.Progress.Root,ua=ee.Progress.Track,xa=ee.Progress.Indicator,ma=ee.Progress.Label,pa=ee.Progress.Value,fa={primary:"bg-primary",success:"bg-emerald-600",warning:"bg-amber-500",danger:"bg-rose-600",info:"bg-sky-600"},ba={xs:"h-1",sm:"h-1.5",md:"h-2",lg:"h-3"},ha={pill:"rounded-full",rounded:"rounded-md",square:"rounded-none"};function ya({value:t,min:r=0,max:s=100,label:a,description:n,showValue:i=!0,formatValue:o,variant:c="primary",size:x="md",shape:d="pill",className:u,trackClassName:b,indicatorClassName:f}){const y=t===null,p=ha[d],g=t!==null?Math.round((t-r)/(s-r)*100):0;return e.jsxs(ee.Progress.Root,{value:t,min:r,max:s,className:l("w-full space-y-1.5",u),children:[(a||i)&&e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[e.jsxs("div",{className:"space-y-0.5 min-w-0",children:[a&&e.jsx(ee.Progress.Label,{className:"text-text font-semibold truncate",children:a}),n&&e.jsx("p",{className:"text-[11px] text-text-muted",children:n})]}),i&&!y&&e.jsx("span",{className:"text-text-muted font-mono font-medium shrink-0 ml-auto",children:o?o(t):`${g}%`})]}),e.jsx(ee.Progress.Track,{className:l("relative w-full overflow-hidden bg-surface-muted",ba[x],p,b),children:e.jsx(ee.Progress.Indicator,{className:l("h-full transition-all duration-300 ease-out",fa[c],p,y&&"w-1/3 animate-[indeterminate_1.5s_infinite_ease-in-out]",f)})})]})}const ga={primary:"text-primary",success:"text-emerald-600",warning:"text-amber-500",danger:"text-rose-600",info:"text-sky-600"};function ja({value:t,size:r=80,strokeWidth:s=8,variant:a="primary",children:n,className:i,showValue:o=!0}){const c=Math.min(100,Math.max(0,t)),x=(r-s)/2,d=2*Math.PI*x,u=d-c/100*d;return e.jsxs("div",{className:l("relative inline-flex items-center justify-center shrink-0",i),style:{width:r,height:r},role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsxs("svg",{className:"-rotate-90 origin-center",width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[e.jsx("circle",{className:"text-surface-muted",strokeWidth:s,stroke:"currentColor",fill:"transparent",r:x,cx:r/2,cy:r/2}),e.jsx("circle",{className:l(ga[a],"transition-all duration-500 ease-out"),strokeWidth:s,strokeDasharray:d,strokeDashoffset:u,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:x,cx:r/2,cy:r/2})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center p-1",children:n??(o&&e.jsxs("span",{className:"text-xs font-semibold font-mono text-text",children:[Math.round(c),"%"]}))})]})}const va=vt.Separator,or=m.forwardRef(({orientation:t="horizontal",variant:r="default",decorative:s=!0,label:a,children:n,labelPosition:i="center",className:o,...c},x)=>{const d=t==="horizontal",u=a??n,b=()=>{switch(r){case"subtle":return d?"h-px w-full bg-border/50":"w-px h-full min-h-[1rem] bg-border/50 self-stretch";case"primary":return d?"h-px w-full bg-primary/40":"w-px h-full min-h-[1rem] bg-primary/40 self-stretch";case"dashed":return d?"h-0 w-full border-t border-dashed border-border":"w-0 h-full min-h-[1rem] border-s border-dashed border-border self-stretch";case"dotted":return d?"h-0 w-full border-t border-dotted border-border":"w-0 h-full min-h-[1rem] border-s border-dotted border-border self-stretch";case"default":default:return d?"h-px w-full bg-border":"w-px h-full min-h-[1rem] bg-border self-stretch"}};if(d&&u){const f=b();return e.jsxs("div",{ref:x,role:s?"none":"separator","aria-orientation":"horizontal",className:l("flex w-full items-center select-none text-xs font-medium text-text-muted",o),...c,children:[e.jsx("div",{className:l(i==="start"?"w-6 shrink-0":"flex-1",f)}),e.jsx("span",{className:"px-3 shrink-0 flex items-center gap-1.5",children:u}),e.jsx("div",{className:l(i==="end"?"w-6 shrink-0":"flex-1",f)})]})}return e.jsx(vt.Separator,{ref:x,orientation:t,role:s?"none":"separator",className:l("shrink-0",b(),o),...c})});or.displayName="GymatraSeparator";const de=m.createContext(null);function ir(){const t=m.useContext(de);if(!t)throw new Error("useGymatraStepper must be used within a GymatraStepper");return t}function lr({className:t}){return e.jsx("svg",{className:l("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function wa({className:t}){return e.jsxs("svg",{className:l("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function Na({steps:t,currentStep:r,activeStep:s,orientation:a="horizontal",variant:n="numbered",layout:i="inline",size:o="md",clickable:c=!1,allowStepAdvance:x=!1,onStepClick:d,className:u,children:b,...f}){const y=r??s??0,p=t?t.length:m.Children.count(b),g={currentStep:y,orientation:a,variant:n,size:o,layout:i,clickable:c,allowStepAdvance:x,onStepClick:d,totalSteps:p};return a==="vertical"?e.jsx(de.Provider,{value:g,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:l("w-full flex flex-col",u),...f,children:t?t.map((h,v)=>{const k=v===t.length-1,j=h.status??(v<y?"complete":v===y?"current":"upcoming");return e.jsx(cr,{stepIndex:v,status:j,title:h.title,description:h.description,icon:h.icon,completedIcon:h.completedIcon,errorIcon:h.errorIcon,optional:h.optional,disabled:h.disabled,badge:h.badge,isLast:k},h.id??v)}):b})}):t&&n==="pills"&&a==="horizontal"?e.jsx(de.Provider,{value:g,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:l("w-full text-text",u),...f,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-2 sm:gap-2.5 w-full",children:t.map((h,v)=>{const k=v===t.length-1,j=h.status??(v<y?"complete":v===y?"current":"upcoming"),N=j==="complete",z=j==="current",M=j==="error",G=c&&!h.disabled&&(x||N||z),C=()=>{G&&d&&d(v,h)};return e.jsxs("li",{className:"inline-flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:!G||h.disabled,onClick:C,"aria-current":z?"step":void 0,className:l("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs transition-all outline-none",z?"bg-primary text-white font-semibold ring-2 ring-primary/25":N?"bg-primary-soft text-primary font-medium hover:bg-primary-soft/80":M?"bg-rose-50 text-danger border border-danger/30 font-medium":"bg-surface-muted text-text-muted font-normal hover:text-text",G&&"cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",!G&&"cursor-default",h.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("span",{className:l("flex size-4 items-center justify-center rounded-full text-[10px] font-bold shrink-0",z?"bg-white/20 text-white":N?"bg-primary text-white":M?"bg-danger text-white":"bg-border text-text-muted"),children:N?e.jsx(lr,{className:"size-2.5"}):v+1}),e.jsx("span",{className:"truncate",children:h.title})]}),!k&&e.jsx("span",{className:"text-text-subtle text-xs select-none","aria-hidden":"true",children:"/"})]},h.id??v)})})})}):t&&a==="horizontal"&&i==="centered"?e.jsx(de.Provider,{value:g,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:l("w-full text-text",u),...f,children:e.jsx("ol",{className:"flex items-start justify-between w-full",children:t.map((h,v)=>{const k=v===0,j=v===t.length-1,N=h.status??(v<y?"complete":v===y?"current":"upcoming"),z=N==="complete",M=N==="current",G=c&&!h.disabled&&(x||z||M),C=()=>{G&&d&&d(v,h)},w=S=>{G&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),C())};return e.jsxs("li",{className:"relative flex-1 flex flex-col items-center text-center group",children:[!k&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-0 right-1/2 h-0.5 bg-border -z-0",children:e.jsx("div",{className:l("h-full transition-all duration-300",v<=y?"bg-primary":"bg-transparent")})}),!j&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-1/2 right-0 h-0.5 bg-border -z-0",children:e.jsx("div",{className:l("h-full transition-all duration-300",v<y?"bg-primary":"bg-transparent")})}),e.jsxs("div",{role:G?"button":void 0,tabIndex:G?0:void 0,onClick:G?C:void 0,onKeyDown:G?w:void 0,"aria-current":M?"step":void 0,className:l("relative z-10 flex flex-col items-center outline-none group rounded-lg p-1 transition-colors",G&&"cursor-pointer hover:bg-surface-muted/40 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",h.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("div",{className:"bg-white rounded-full p-0.5 ring-4 ring-white",children:e.jsx(ve,{stepIndex:v,status:N,icon:h.icon,completedIcon:h.completedIcon,errorIcon:h.errorIcon,variant:n,size:o})}),e.jsxs("div",{className:"mt-2 flex flex-col items-center max-w-[140px]",children:[e.jsx("span",{className:l("text-xs leading-tight transition-colors",M?"text-primary font-bold":z?"text-text font-medium":N==="error"?"text-danger font-medium":"text-text-muted"),children:h.title}),h.description&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 hidden sm:block truncate w-full",children:h.description}),h.badge&&e.jsx("span",{className:"mt-1",children:h.badge})]})]})]},h.id??v)})})})}):t&&a==="horizontal"?e.jsx(de.Provider,{value:g,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:l("w-full text-text",u),...f,children:e.jsx("ol",{className:"flex items-center w-full",children:t.map((h,v)=>{const k=v===t.length-1,j=h.status??(v<y?"complete":v===y?"current":"upcoming"),N=j==="complete",z=j==="current",M=j==="error",G=c&&!h.disabled&&(x||N||z),C=()=>{G&&d&&d(v,h)},w=S=>{G&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),C())};return e.jsxs("li",{className:l("flex items-center min-w-0",k?"flex-none":"flex-1"),children:[e.jsxs("div",{role:G?"button":void 0,tabIndex:G?0:void 0,onClick:G?C:void 0,onKeyDown:G?w:void 0,"aria-current":z?"step":void 0,className:l("flex items-center gap-2.5 sm:gap-3 shrink-0 rounded-lg outline-none transition-colors p-1 -m-1",G&&"cursor-pointer hover:bg-surface-muted/50 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",h.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx(ve,{stepIndex:v,status:j,icon:h.icon,completedIcon:h.completedIcon,errorIcon:h.errorIcon,variant:n,size:o}),e.jsxs("div",{className:"flex flex-col text-start min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:l("leading-tight truncate transition-colors",o==="sm"?"text-xs":o==="lg"?"text-base":"text-sm",z?"text-primary font-bold":N?"text-text font-medium":M?"text-danger font-medium":"text-text-muted font-normal"),children:h.title}),h.optional&&e.jsx("span",{className:"text-xs text-text-subtle font-normal",children:"(Facultatif)"}),h.badge&&e.jsx("span",{children:h.badge})]}),h.description&&e.jsx("span",{className:"text-text-muted leading-tight mt-0.5 truncate hidden md:inline-block text-xs",children:h.description})]})]}),!k&&e.jsx("div",{"aria-hidden":"true",className:"flex-1 mx-2 sm:mx-4 h-0.5 min-w-3 sm:min-w-6 bg-border relative overflow-hidden rounded-full shrink",children:e.jsx("div",{className:l("h-full w-full transition-all duration-300",v<y?"bg-primary":"bg-transparent")})})]},h.id??v)})})})}):e.jsx(de.Provider,{value:g,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:l("w-full text-text",a==="horizontal"?"flex flex-row items-start justify-between":"flex flex-col space-y-0",u),...f,children:b})})}function cr({stepIndex:t=0,status:r,title:s,description:a,icon:n,completedIcon:i,errorIcon:o,optional:c,disabled:x,badge:d,isLast:u=!1,className:b,children:f,...y}){const{currentStep:p,orientation:g,variant:h,size:v,clickable:k,allowStepAdvance:j,onStepClick:N}=ir(),z=r??(t<p?"complete":t===p?"current":"upcoming"),M=z==="complete",G=z==="current",C=z==="error",w=k&&!x&&(j||M||G),S=()=>{w&&N&&N(t)},W=L=>{w&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),S())};return g==="vertical"?e.jsxs("div",{className:l("relative flex items-stretch gap-3.5 group",x&&"opacity-50 pointer-events-none",b),...y,children:[e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?S:void 0,onKeyDown:w?W:void 0,"aria-current":G?"step":void 0,className:l("rounded-full outline-none transition-transform",w&&"cursor-pointer hover:scale-105 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:e.jsx(ve,{stepIndex:t,status:z,icon:n,completedIcon:i,errorIcon:o,variant:h,size:v})}),!u&&e.jsx("div",{className:l("w-0.5 flex-1 my-1.5 transition-colors duration-200 min-h-7",M?"bg-primary":"bg-border"),"aria-hidden":"true"})]}),e.jsxs("div",{className:l("flex-1 min-w-0 pb-6",u&&"pb-1"),children:[e.jsxs("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?S:void 0,onKeyDown:w?W:void 0,className:l("flex flex-col outline-none rounded-md",w&&"cursor-pointer"),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:l("leading-tight transition-colors",v==="sm"?"text-xs":v==="lg"?"text-base":"text-sm",G?"text-primary font-bold":M?"text-text font-medium":C?"text-danger font-medium":"text-text-muted font-normal"),children:s}),c&&e.jsx("span",{className:"text-xs text-text-subtle font-normal",children:"(Facultatif)"}),d&&e.jsx("span",{children:d})]}),a&&e.jsx("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:a})]}),f&&e.jsx("div",{className:"mt-2.5",children:f})]})]}):e.jsx("div",{className:l("group relative flex flex-col items-center flex-1 text-center sm:flex-row sm:items-start sm:text-start",x&&"opacity-50 pointer-events-none",b),...y,children:e.jsxs("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?S:void 0,onKeyDown:w?W:void 0,"aria-current":G?"step":void 0,className:l("flex items-start gap-3 rounded-lg transition-colors outline-none flex-col sm:flex-row items-center sm:items-start",w&&"cursor-pointer p-1.5 -m-1.5 rounded-md hover:bg-surface-muted/70 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:[e.jsx(ve,{stepIndex:t,status:z,icon:n,completedIcon:i,errorIcon:o,variant:h,size:v}),(s||a||f)&&e.jsxs("div",{className:"min-w-0 flex flex-col items-center sm:items-start",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s&&e.jsx("span",{className:l("leading-tight truncate transition-colors",v==="sm"?"text-xs":v==="lg"?"text-base":"text-sm",G?"text-primary font-bold":M?"text-text font-medium":C?"text-danger font-medium":"text-text-muted font-normal"),children:s}),c&&e.jsx("span",{className:"text-xs text-text-subtle font-normal",children:"(Facultatif)"}),d&&e.jsx("span",{children:d})]}),a&&e.jsx("p",{className:"text-text-muted leading-relaxed mt-0.5 text-xs",children:a}),f]})]})})}function ve({stepIndex:t,status:r,icon:s,completedIcon:a,errorIcon:n,variant:i="numbered",size:o="md"}){const c=r==="complete",x=r==="current",d=r==="error";if(i==="dots"){const b=o==="sm"?"size-2.5":o==="lg"?"size-4":"size-3";return e.jsx("span",{"aria-hidden":"true",className:l("rounded-full shrink-0 transition-all duration-200 mt-1.5",b,c?"bg-primary":x?"bg-primary ring-4 ring-primary/25 scale-125":d?"bg-danger ring-2 ring-danger/20":"bg-border")})}const u=o==="sm"?"size-6 text-xs":o==="lg"?"size-10 text-sm":"size-8 text-xs font-semibold";return e.jsx("span",{className:l("relative flex shrink-0 items-center justify-center rounded-full transition-all duration-200 select-none",u,c?"bg-primary text-white border border-primary shadow-none":x?"bg-primary text-white border border-primary ring-4 ring-primary/20 font-bold":d?"bg-rose-50 text-danger border-2 border-danger font-bold":"bg-surface-muted text-text-subtle border border-border"),"aria-hidden":"true",children:c?a??e.jsx(lr,{}):d?n??e.jsx(wa,{}):i==="icons"&&s?s:e.jsx("span",{children:t+1})})}function ka({status:t="upcoming",className:r}){const s=t==="complete";return e.jsx("div",{"aria-hidden":"true",className:l("flex-1 hidden sm:flex items-center self-start mt-4 px-2",r),children:e.jsx("div",{className:l("h-0.5 w-full transition-colors duration-200",s?"bg-primary":"bg-border")})})}function Ga({active:t=!0,className:r,children:s,...a}){return t?e.jsx("div",{className:l("text-xs text-text",r),...a,children:s}):null}const Ca=je.Switch.Root,Sa=je.Switch.Thumb;function Pa(t="md"){switch(t){case"sm":return{track:"h-5 w-9 p-0.5",thumb:"size-4 data-[checked]:translate-x-4"};case"lg":return{track:"h-7 w-13 p-0.5",thumb:"size-6 data-[checked]:translate-x-6"};case"md":default:return{track:"h-6 w-11 p-0.5",thumb:"size-5 data-[checked]:translate-x-5"}}}function za(t="primary"){switch(t){case"success":return"data-[checked]:bg-emerald-600 data-[checked]:border-emerald-600 focus-visible:outline-emerald-600";case"danger":return"data-[checked]:bg-danger data-[checked]:border-danger focus-visible:outline-danger";case"warning":return"data-[checked]:bg-amber-500 data-[checked]:border-amber-500 focus-visible:outline-amber-500";case"primary":default:return"data-[checked]:bg-primary data-[checked]:border-primary focus-visible:outline-primary"}}const dr=m.forwardRef(({size:t="md",variant:r="primary",label:s,description:a,labelPosition:n="right",onCheckedChange:i,onChange:o,disabled:c=!1,className:x,wrapperClassName:d,...u},b)=>{const f=Pa(t),y=za(r),p=(h,v)=>{i==null||i(h,v),o==null||o(h)},g=e.jsx(je.Switch.Root,{ref:b,disabled:c,onCheckedChange:p,className:l("relative inline-flex shrink-0 cursor-pointer rounded-full border border-border bg-surface-muted transition-colors duration-200 outline-none select-none shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",f.track,y,x),...u,children:e.jsx(je.Switch.Thumb,{className:l("pointer-events-none block rounded-full bg-white transition-transform duration-200 shadow-none translate-x-0",f.thumb)})});return!s&&!a?g:n==="left"?e.jsxs("label",{className:l("flex cursor-pointer select-none items-center justify-between gap-4 w-full",c&&"cursor-not-allowed opacity-50",d),children:[e.jsxs("div",{className:"flex flex-col min-w-0",children:[s&&e.jsx("span",{className:"text-sm font-medium text-text leading-tight",children:s}),a&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 leading-normal",children:a})]}),g]}):e.jsxs("label",{className:l("inline-flex cursor-pointer select-none items-center gap-3",c&&"cursor-not-allowed opacity-50",d),children:[g,e.jsxs("div",{className:"flex flex-col min-w-0",children:[s&&e.jsx("span",{className:"text-sm font-medium text-text leading-tight",children:s}),a&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 leading-normal",children:a})]})]})});dr.displayName="GymatraSwitch";function Ia({direction:t}){return e.jsxs("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[e.jsx("path",{d:"M5 12V4M5 4L2.5 6.5M5 4L7.5 6.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="asc"?"text-primary opacity-100":"opacity-35"}),e.jsx("path",{d:"M11 4V12M11 12L8.5 9.5M11 12L13.5 9.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="desc"?"text-primary opacity-100":"opacity-35"})]})}function Ma({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function ur({variant:t="cards",className:r,...s}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsx("table",{className:l("w-full text-left text-sm",t==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden",r),...s})})}ur.displayName="GymatraTable";function at({className:t,...r}){return e.jsx("thead",{className:l("text-xs font-semibold uppercase tracking-wider text-text-subtle",t),...r})}at.displayName="GymatraTableHeader";function nt({className:t,...r}){return e.jsx("tbody",{className:l("space-y-2",t),...r})}nt.displayName="GymatraTableBody";function ot({className:t,selected:r,variant:s="cards",...a}){return e.jsx("tr",{"data-selected":r,className:l("group transition-all bg-white hover:bg-surface/60","data-[selected=true]:bg-primary-soft/30",s==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e [&>td]:shadow-none":"border-b border-border last:border-b-0",t),...a})}ot.displayName="GymatraTableRow";function ye({className:t,align:r="left",density:s="normal",...a}){const n=s==="compact"?"py-1.5 px-3 text-[11px]":s==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:l("font-semibold uppercase tracking-wider text-text-subtle align-middle whitespace-nowrap",n,r==="center"&&"text-center",r==="right"&&"text-right",t),...a})}ye.displayName="GymatraTableHead";function ge({className:t,align:r="left",density:s="normal",...a}){const n=s==="compact"?"py-2 px-3 text-xs":s==="relaxed"?"py-4 px-4 text-sm":"py-3 px-3.5 text-sm";return e.jsx("td",{className:l("align-middle text-text bg-inherit",n,r==="center"&&"text-center",r==="right"&&"text-right",t),...a})}ge.displayName="GymatraTableCell";function it({children:t,direction:r,onSort:s,align:a="left",density:n="normal",className:i,...o}){const c=!!r,x=n==="compact"?"py-1.5 px-3 text-[11px]":n==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:l("font-semibold uppercase tracking-wider align-middle whitespace-nowrap",x,a==="center"&&"text-center",a==="right"&&"text-right",i),...o,children:e.jsxs("button",{type:"button",onClick:s,className:l("inline-flex items-center gap-1.5 cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",c?"text-primary font-bold":"text-text-subtle hover:text-text"),children:[e.jsx("span",{children:t}),e.jsx(Ia,{direction:r})]})})}it.displayName="GymatraTableSortHead";function Le({checked:t=!1,onChange:r,indeterminate:s=!1,"aria-label":a}){return e.jsxs("button",{type:"button",role:"checkbox","aria-checked":s?"mixed":t,"aria-label":a,onClick:()=>r==null?void 0:r(!t),className:l("size-5 shrink-0 rounded-md flex items-center justify-center border cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",t||s?"border-primary bg-primary text-white":"border-slate-300 bg-white hover:border-slate-400"),children:[t&&!s&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),s&&e.jsx("span",{className:"h-0.5 w-3 bg-white rounded-full"})]})}Le.displayName="GymatraTableCheckbox";function lt({columnsCount:t,hasCheckbox:r=!1,hasExpand:s=!1,density:a="normal",variant:n="cards"}){const i=a==="compact"?"py-2 px-3":a==="relaxed"?"py-4 px-4":"py-3 px-3.5";return e.jsxs("tr",{className:l("bg-white transition-opacity",n==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e":"border-b border-border last:border-b-0"),children:[s&&e.jsx("td",{className:l("w-8 text-center align-middle",i),children:e.jsx("div",{className:"size-4 mx-auto rounded bg-slate-200/80 animate-pulse"})}),r&&e.jsx("td",{className:l("w-8 align-middle",i),children:e.jsx("div",{className:"size-5 rounded-md bg-slate-200/80 animate-pulse"})}),Array.from({length:t}).map((o,c)=>e.jsx("td",{className:l("align-middle",i),children:c===0?e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"size-8 shrink-0 rounded-full bg-slate-200/80 animate-pulse"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-28 rounded bg-slate-200/80 animate-pulse"}),e.jsx("div",{className:"h-2.5 w-20 rounded bg-slate-200/60 animate-pulse"})]})]}):e.jsx("div",{className:l("h-3.5 rounded bg-slate-200/80 animate-pulse",c===1?"w-24":c===t-1?"w-16":"w-20")})},c))]})}lt.displayName="GymatraTableSkeletonRow";function ct({rowCount:t=5,columnsCount:r,hasCheckbox:s=!1,hasExpand:a=!1,density:n="normal",variant:i="cards"}){return e.jsx(e.Fragment,{children:Array.from({length:t}).map((o,c)=>e.jsx(lt,{columnsCount:r,hasCheckbox:s,hasExpand:a,density:n,variant:i},c))})}ct.displayName="GymatraTableSkeleton";function xr({columns:t,data:r,rowKey:s=(G,C)=>G.id??C,sort:a,defaultSort:n,onSortChange:i,selectable:o=!1,selectedIds:c,onSelectionChange:x,selectionActions:d,pagination:u,emptyTitle:b="No data found",emptyDescription:f="There are no records matching your criteria.",loading:y=!1,skeletonRowCount:p=5,density:g="normal",variant:h="cards",onRowClick:v,expandedRowRender:k,expandedRowKeys:j,onExpandedRowsChange:N,className:z,...M}){const[G,C]=m.useState(n),w=a??G,[S,W]=m.useState([]),L=c??S,[V,re]=m.useState([]),I=j??V,[H,ae]=m.useState((u==null?void 0:u.page)??1),[B,_]=m.useState((u==null?void 0:u.pageSize)??10),J=(u==null?void 0:u.page)??H,K=(u==null?void 0:u.pageSize)??B,Y=!!k;function Ge(P){let T;(w==null?void 0:w.key)!==P?T={key:P,direction:"asc"}:w.direction==="asc"?T={key:P,direction:"desc"}:T=void 0,typeof a>"u"&&C(T),i==null||i(T)}const ne=m.useMemo(()=>w?[...r].sort((P,T)=>{const A=P[w.key],D=T[w.key];if(A===D)return 0;if(A==null)return 1;if(D==null)return-1;const U=String(A).localeCompare(String(D),void 0,{numeric:!0});return w.direction==="asc"?U:-U}):r,[r,w]),fe=typeof(u==null?void 0:u.total)<"u",oe=fe?u.total:ne.length,be=m.useMemo(()=>{if(!u||fe)return ne;const P=(J-1)*K;return ne.slice(P,P+K)},[ne,u,fe,J,K]),X=be.map((P,T)=>s(P,T)),Ce=X.length>0&&X.every(P=>L.includes(P)),le=X.some(P=>L.includes(P))&&!Ce;function _e(P){let T;if(P){const A=new Set([...L,...X]);T=Array.from(A)}else T=L.filter(A=>!X.includes(A));typeof c>"u"&&W(T),x==null||x(T)}function ce(P,T){let A;T?A=[...L,P]:A=L.filter(D=>D!==P),typeof c>"u"&&W(A),x==null||x(A)}function he(){typeof c>"u"&&W([]),x==null||x([])}function Se(P){let T;I.includes(P)?T=I.filter(A=>A!==P):T=[...I,P],typeof j>"u"&&re(T),N==null||N(T)}const $e=L.length>0,Pe=t.length+(o?1:0)+(Y?1:0);return e.jsxs("div",{className:l("flex flex-col w-full relative",z),...M,children:[e.jsx("div",{className:l("fixed bottom-6 left-1/2 -translate-x-1/2 z-50 transition-all duration-200 ease-out","w-[calc(100%-2rem)] max-w-lg sm:w-auto",$e&&d?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-4 opacity-0 pointer-events-none"),children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between sm:justify-start gap-3 rounded-3xl border border-border bg-white px-4 py-2 text-xs shadow-sm",children:[e.jsx("span",{className:"font-medium text-text",children:L.length===1?"1 item selected":`${L.length} items selected`}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("div",{className:"flex items-center gap-1.5 ms-auto sm:ms-0",children:typeof d=="function"?d(L,he):d}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("button",{type:"button",onClick:he,"aria-label":"Cancel selection",title:"Cancel selection",className:"flex size-6 items-center justify-center rounded-full text-text-muted hover:bg-surface hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("svg",{"aria-hidden":"true",className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:l("w-full text-left text-sm",h==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden"),children:[e.jsx(at,{children:e.jsxs("tr",{children:[Y&&e.jsx(ye,{density:g,className:"w-8 px-2"}),o&&e.jsx(ye,{density:g,className:"w-8 px-3",children:e.jsx(Le,{checked:Ce,indeterminate:le,onChange:_e,"aria-label":"Select all rows on current page"})}),t.map(P=>P.sortable?e.jsx(it,{direction:(w==null?void 0:w.key)===P.key?w.direction:void 0,onSort:()=>Ge(P.key),align:P.align,density:g,className:P.width,children:P.header},P.key):e.jsx(ye,{align:P.align,density:g,className:P.width,children:P.header},P.key))]})}),e.jsx(nt,{children:y?e.jsx(ct,{rowCount:p,columnsCount:t.length,hasCheckbox:o,hasExpand:Y,density:g,variant:h}):be.length>0?be.map((P,T)=>{const A=s(P,T),D=L.includes(A),U=I.includes(A);return e.jsxs(m.Fragment,{children:[e.jsxs(ot,{selected:D,variant:h,onClick:$=>{const qe=$.target;qe.closest("button")||qe.closest("input")||qe.closest("a")||v==null||v(P,T)},className:l(v&&"cursor-pointer hover:border-primary/40"),children:[Y&&e.jsx(ge,{density:g,className:"w-8 px-2 text-center",children:e.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),Se(A)},"aria-expanded":U,"aria-label":U?"Collapse row":"Expand row",className:"size-6 inline-flex items-center justify-center rounded text-text-muted hover:text-text hover:bg-surface-muted transition-transform cursor-pointer outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("span",{className:l("inline-block transition-transform duration-150",U&&"rotate-180"),children:e.jsx(Ma,{})})})}),o&&e.jsx(ge,{density:g,className:"w-8 px-3",children:e.jsx(Le,{checked:D,onChange:$=>ce(A,$),"aria-label":`Select row ${A}`})}),t.map($=>e.jsx(ge,{align:$.align,density:g,children:$.render?$.render(P,T):P[$.key]},$.key))]}),Y&&U&&e.jsx("tr",{className:l(h==="cards"?"bg-surface-muted/30":"bg-surface-muted/40 border-b border-border"),children:e.jsx("td",{colSpan:Pe,className:l("px-5 py-4 text-sm text-text",h==="cards"&&"rounded-lg border border-border border-dashed my-1"),children:k==null?void 0:k(P,T)})})]},A)}):e.jsx("tr",{children:e.jsxs("td",{colSpan:Pe,className:"rounded-lg border border-border bg-white px-4 py-12 text-center text-text-muted",children:[e.jsx("p",{className:"font-semibold text-text",children:b}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f})]})})})]})}),u&&!y&&e.jsx(Xe,{page:J,pageSize:K,total:oe,onPageChange:P=>{var T;typeof u.page>"u"&&ae(P),(T=u.onPageChange)==null||T.call(u,P)},pageSizeOptions:u.pageSizeOptions,onPageSizeChange:P=>{var T;typeof u.pageSize>"u"&&_(P),(T=u.onPageSizeChange)==null||T.call(u,P)},showSummary:u.showSummary})]})}xr.displayName="GymatraDataTable";const Ta=te.Tabs.Root,Ra=te.Tabs.List,La=te.Tabs.Tab,Ba=te.Tabs.Panel,Da=te.Tabs.Indicator,Fa={sm:"h-8 px-2.5 text-xs gap-1.5",md:"h-9 px-3.5 text-sm gap-2",lg:"h-11 px-4 text-base gap-2.5"};function Aa(t,r,s,a="horizontal"){const n="inline-flex items-center justify-center font-medium transition-colors select-none outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 cursor-pointer",i=Fa[r],o=s?"flex-1":"";switch(t){case"line":return a==="vertical"?l(n,i,o,"justify-start border-r-2 -mr-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary data-[active]:font-semibold aria-selected:font-semibold"):l(n,i,o,"border-b-2 -mb-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary data-[active]:font-semibold aria-selected:font-semibold");case"pills":return l(n,i,o,"rounded-md border border-transparent text-text-muted hover:text-text hover:bg-surface-muted/60","data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:font-semibold aria-selected:font-semibold data-[active]:border-border aria-selected:border-border");case"enclosed":return l(n,i,o,"rounded-t-md border-t border-x -mb-px border-transparent text-text-muted hover:text-text hover:bg-surface-muted/40","data-[active]:border-border aria-selected:border-border data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:font-semibold aria-selected:font-semibold data-[active]:border-b-transparent aria-selected:border-b-transparent");case"soft":default:return l(n,i,o,"rounded-md text-text-muted hover:bg-surface-muted hover:text-text","data-[active]:bg-primary-soft aria-selected:bg-primary-soft data-[active]:text-primary aria-selected:text-primary data-[active]:font-semibold aria-selected:font-semibold")}}function Ea(t,r="horizontal",s){if(r==="vertical")return t==="line"?"flex flex-col border-r border-border gap-1":t==="pills"?"flex flex-col rounded-lg border border-border bg-surface-muted/60 p-1 gap-1":"flex flex-col gap-1";const a=s?"w-full":"";switch(t){case"line":return l("flex items-center border-b border-border gap-2 sm:gap-6",a);case"pills":return l("inline-flex items-center rounded-lg border border-border bg-surface-muted/60 p-1 gap-1",a);case"enclosed":return l("flex items-center border-b border-border gap-1",a);case"soft":default:return l("flex items-center gap-1.5",a)}}function Wa({value:t,defaultValue:r,onValueChange:s,variant:a="line",size:n="md",orientation:i="horizontal",fullWidth:o=!1,items:c,children:x,className:d,listClassName:u,panelClassName:b}){const f=r??(c&&c.length>0?c[0].value:void 0),y=t!==void 0?{value:t}:f!==void 0?{defaultValue:f}:{};return e.jsx(te.Tabs.Root,{...y,onValueChange:p=>{typeof p=="string"&&(s==null||s(p))},orientation:i,className:l(i==="vertical"?"flex gap-6 items-start":"flex flex-col",d),children:c&&c.length>0?e.jsxs(e.Fragment,{children:[e.jsx(te.Tabs.List,{className:l(Ea(a,i,o),u),children:c.map(p=>{const g=p.startIcon??p.icon;return e.jsxs(te.Tabs.Tab,{value:p.value,disabled:p.disabled,className:l(Aa(a,n,o,i)),children:[g&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:g}),e.jsx("span",{children:p.label}),p.badge!==void 0&&e.jsx(Ve,{variant:p.badgeVariant??"default",size:"sm",pill:!0,className:"ml-1 text-[11px] px-1.5 py-0 h-4 min-w-4",children:p.badge}),p.endIcon&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:p.endIcon})]},p.value)})}),c.map(p=>p.content?e.jsx(te.Tabs.Panel,{value:p.value,className:l("pt-4 focus-visible:outline-none",b),children:p.content},p.value):null)]}):x})}const Oa=wt.Toggle,_a=Nt.ToggleGroup;function mr(t="default"){switch(t){case"outline":return l("border border-border bg-white text-text","hover:bg-surface-muted hover:border-text-subtle","data-[pressed]:border-primary data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium");case"solid":return l("bg-surface-muted text-text","hover:bg-surface-muted/80","data-[pressed]:bg-primary data-[pressed]:text-white data-[pressed]:font-medium");case"ghost":return l("bg-transparent text-text-muted","hover:bg-surface-muted hover:text-text","data-[pressed]:bg-surface-muted data-[pressed]:text-primary data-[pressed]:font-medium");case"default":default:return l("bg-surface-muted text-text","hover:bg-surface-muted/80 hover:text-text","data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium")}}function pr(t="md"){switch(t){case"sm":return"h-8 px-2.5 text-xs gap-1.5 rounded-md";case"lg":return"h-11 px-4 text-base gap-2.5 rounded-md";case"md":default:return"h-9.5 px-3 text-sm gap-2 rounded-md"}}const dt=m.forwardRef(({variant:t="default",size:r="md",startIcon:s,endIcon:a,className:n,children:i,...o},c)=>e.jsxs(wt.Toggle,{ref:c,className:l("inline-flex items-center justify-center select-none outline-none transition-colors shadow-none font-medium","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",pr(r),mr(t),n),...o,children:[s&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:s}),i&&e.jsx("span",{children:i}),a&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:a})]}));dt.displayName="GymatraToggle";const $a=m.forwardRef(({options:t,value:r,defaultValue:s,onValueChange:a,size:n="md",variant:i="default",bordered:o=!0,multiple:c=!1,orientation:x="horizontal",className:d,children:u,...b},f)=>{const y=r!==void 0?Array.isArray(r)?r:[r]:void 0,p=s!==void 0?Array.isArray(s)?s:[s]:void 0,g=v=>{a&&a(c?v:v[0]??"")},h=x==="vertical";return e.jsx(Nt.ToggleGroup,{ref:f,value:y,defaultValue:p,onValueChange:g,multiple:c,orientation:x,className:l("inline-flex select-none",h?"flex-col items-stretch gap-1":"flex-row items-center gap-1",o?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",d),...b,children:t&&t.length>0?t.map(v=>e.jsx(dt,{value:v.value,size:n,variant:i,disabled:v.disabled,"aria-label":v.ariaLabel||(typeof v.label=="string"?v.label:void 0),startIcon:v.startIcon??v.icon,endIcon:v.endIcon,children:v.label},v.value)):u})});function fr({content:t,children:r,side:s="top",align:a="center",sideOffset:n=8,delay:i=150,showArrow:o=!0,open:c,defaultOpen:x,onOpenChange:d,className:u,variant:b="dark"}){const f=b==="dark";return e.jsx(ie.Tooltip.Provider,{delay:i,children:e.jsxs(ie.Tooltip.Root,{open:c,defaultOpen:x,onOpenChange:d,children:[e.jsx(ie.Tooltip.Trigger,{render:r}),e.jsx(ie.Tooltip.Portal,{children:e.jsx(ie.Tooltip.Positioner,{side:s,align:a,sideOffset:n,className:"z-50 outline-none",children:e.jsxs(ie.Tooltip.Popup,{className:l("z-50 rounded-md px-2.5 py-1.5 text-xs font-medium leading-none outline-none select-none","transition-opacity duration-150 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",f?"bg-text text-white shadow-sm":"bg-white text-text border border-border shadow-sm",u),children:[o&&e.jsx(ie.Tooltip.Arrow,{className:l("size-2 rotate-45",f?"bg-text":"bg-white border-t border-l border-border","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1")}),t]})})})]})})}fr.displayName="GymatraTooltip";Object.defineProperty(exports,"BaseUIField",{enumerable:!0,get:()=>q.Field});Object.defineProperty(exports,"BaseUIForm",{enumerable:!0,get:()=>yt.Form});Object.defineProperty(exports,"BaseUIInput",{enumerable:!0,get:()=>gt.Input});Object.defineProperty(exports,"BaseUISelect",{enumerable:!0,get:()=>Z.Select});Object.defineProperty(exports,"BaseUICheckbox",{enumerable:!0,get:()=>Ue.Checkbox});Object.defineProperty(exports,"BaseUISwitch",{enumerable:!0,get:()=>je.Switch});Object.defineProperty(exports,"formatPhoneNumber",{enumerable:!0,get:()=>se.formatPhoneNumber});Object.defineProperty(exports,"formatPhoneNumberIntl",{enumerable:!0,get:()=>se.formatPhoneNumberIntl});Object.defineProperty(exports,"isValidPhoneNumber",{enumerable:!0,get:()=>se.isValidPhoneNumber});exports.DRAWER_SIZES=ze;exports.GymatraAutocomplete=cs;exports.GymatraAvatar=we;exports.GymatraAvatarGroup=kt;exports.GymatraAvatarUpload=ks;exports.GymatraAvatarUploadField=hs;exports.GymatraBadge=Ve;exports.GymatraBreadcrumb=Gt;exports.GymatraBreadcrumbEllipsis=Mt;exports.GymatraBreadcrumbItem=St;exports.GymatraBreadcrumbLink=Pt;exports.GymatraBreadcrumbList=Ct;exports.GymatraBreadcrumbPage=zt;exports.GymatraBreadcrumbSeparator=It;exports.GymatraButton=Te;exports.GymatraCheckbox=zs;exports.GymatraCheckboxField=ds;exports.GymatraCircularProgress=ja;exports.GymatraColorPicker=gs;exports.GymatraColorPickerField=Xt;exports.GymatraCombobox=Er;exports.GymatraComboboxChip=Br;exports.GymatraComboboxChipRemove=Dr;exports.GymatraComboboxChips=Lr;exports.GymatraComboboxClear=Rr;exports.GymatraComboboxEmpty=Ke;exports.GymatraComboboxGroup=Mr;exports.GymatraComboboxGroupLabel=Qe;exports.GymatraComboboxInput=Tt;exports.GymatraComboboxItem=Re;exports.GymatraComboboxList=Ir;exports.GymatraComboboxPopup=He;exports.GymatraComboboxPortal=Pr;exports.GymatraComboboxPositioner=zr;exports.GymatraComboboxRoot=Cr;exports.GymatraComboboxSeparator=Tr;exports.GymatraComboboxTrigger=Sr;exports.GymatraCurrencyInput=Vt;exports.GymatraCustomSelect=is;exports.GymatraDataTable=xr;exports.GymatraDateInput=Kt;exports.GymatraDateRangeInput=os;exports.GymatraDateTimeInput=Zt;exports.GymatraDialog=xe;exports.GymatraDialogBackdrop=qr;exports.GymatraDialogClose=Qr;exports.GymatraDialogComponent=Lt;exports.GymatraDialogContent=Vr;exports.GymatraDialogDescription=Kr;exports.GymatraDialogPopup=Ur;exports.GymatraDialogPortal=$r;exports.GymatraDialogRoot=Or;exports.GymatraDialogTitle=Hr;exports.GymatraDialogTrigger=_r;exports.GymatraDrawerPanel=Xr;exports.GymatraDrawerProvider=Dt;exports.GymatraEmailInput=Ot;exports.GymatraField=Cs;exports.GymatraFieldContainer=F;exports.GymatraFileUploadField=fs;exports.GymatraFilterBar=Wt;exports.GymatraFilterBarChip=Et;exports.GymatraFilterBarSearch=At;exports.GymatraFilterBarSelect=as;exports.GymatraFilterSelect=Je;exports.GymatraFloatingField=ke;exports.GymatraFloatingSelect=rr;exports.GymatraFloatingTextarea=tr;exports.GymatraForm=Gs;exports.GymatraImageUploadField=bs;exports.GymatraInput=sr;exports.GymatraMenu=Es;exports.GymatraMenuCheckboxItem=Ae;exports.GymatraMenuGroup=Ls;exports.GymatraMenuGroupLabel=Fe;exports.GymatraMenuItem=Be;exports.GymatraMenuPopup=pe;exports.GymatraMenuPortal=Ts;exports.GymatraMenuPositioner=Rs;exports.GymatraMenuRadioGroup=Bs;exports.GymatraMenuRadioItem=Ee;exports.GymatraMenuRoot=Is;exports.GymatraMenuSeparator=De;exports.GymatraMenuSubmenuRoot=Ds;exports.GymatraMenuSubmenuTrigger=We;exports.GymatraMenuTrigger=Ms;exports.GymatraMenubar=ar;exports.GymatraMenubarCheckboxItem=Js;exports.GymatraMenubarGroup=qs;exports.GymatraMenubarGroupLabel=Zs;exports.GymatraMenubarItem=Ks;exports.GymatraMenubarMenu=Os;exports.GymatraMenubarPopup=Hs;exports.GymatraMenubarPortal=_s;exports.GymatraMenubarPositioner=$s;exports.GymatraMenubarRadioGroup=Us;exports.GymatraMenubarRadioItem=Ys;exports.GymatraMenubarRoot=Ws;exports.GymatraMenubarSeparator=Qs;exports.GymatraMenubarSubmenuRoot=Vs;exports.GymatraMenubarSubmenuTrigger=Xs;exports.GymatraMenubarTrigger=Ye;exports.GymatraMultiSelect=ls;exports.GymatraNumberInput=Ne;exports.GymatraNumericField=ns;exports.GymatraOtpField=ws;exports.GymatraOtpInput=Ns;exports.GymatraPagination=Xe;exports.GymatraPasswordInput=_t;exports.GymatraPercentageInput=Ht;exports.GymatraPhoneInput=qt;exports.GymatraPopover=ca;exports.GymatraPopoverArrow=nr;exports.GymatraPopoverClose=st;exports.GymatraPopoverDescription=rt;exports.GymatraPopoverPopup=et;exports.GymatraPopoverPortal=oa;exports.GymatraPopoverPositioner=ia;exports.GymatraPopoverRoot=aa;exports.GymatraPopoverTitle=tt;exports.GymatraPopoverTrigger=na;exports.GymatraProgress=ya;exports.GymatraProgressIndicator=xa;exports.GymatraProgressLabel=ma;exports.GymatraProgressRoot=da;exports.GymatraProgressTrack=ua;exports.GymatraProgressValue=pa;exports.GymatraRadioGroupField=us;exports.GymatraRangeField=vs;exports.GymatraRichTextEditor=ps;exports.GymatraSearchInput=$t;exports.GymatraSelect=Ps;exports.GymatraSelectField=Jt;exports.GymatraSeparator=or;exports.GymatraSeparatorRoot=va;exports.GymatraSliderField=js;exports.GymatraStep=cr;exports.GymatraStepConnector=ka;exports.GymatraStepContent=Ga;exports.GymatraStepIndicator=ve;exports.GymatraStepper=Na;exports.GymatraSwitch=dr;exports.GymatraSwitchField=xs;exports.GymatraSwitchRoot=Ca;exports.GymatraSwitchThumb=Sa;exports.GymatraTab=La;exports.GymatraTable=ur;exports.GymatraTableBody=nt;exports.GymatraTableCell=ge;exports.GymatraTableCheckbox=Le;exports.GymatraTableHead=ye;exports.GymatraTableHeader=at;exports.GymatraTableRow=ot;exports.GymatraTableSkeleton=ct;exports.GymatraTableSkeletonRow=lt;exports.GymatraTableSortHead=it;exports.GymatraTabs=Wa;exports.GymatraTabsIndicator=Da;exports.GymatraTabsList=Ra;exports.GymatraTabsPanel=Ba;exports.GymatraTabsRoot=Ta;exports.GymatraTextField=er;exports.GymatraTextInput=me;exports.GymatraTextarea=Ss;exports.GymatraTextareaField=Yt;exports.GymatraTimeInput=Qt;exports.GymatraToggle=dt;exports.GymatraToggleField=ms;exports.GymatraToggleGroup=$a;exports.GymatraToggleGroupRoot=_a;exports.GymatraToggleRoot=Oa;exports.GymatraTooltip=fr;exports.GymatraUrlInput=Ut;exports.SidebarContext=Jr;exports.SidebarProvider=Yr;exports.cn=l;exports.getDrawerWidth=Ie;exports.getToggleSizeClasses=pr;exports.getToggleVariantClasses=mr;exports.renderMenuItems=Oe;exports.useGymatraDrawer=Bt;exports.useGymatraStepper=ir;exports.useSidebar=Zr;
|