@modoock/components 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/accordion.d.ts.map +1 -1
  2. package/dist/accordion.js +1 -1
  3. package/dist/agenda.js +5 -5
  4. package/dist/button.js +1 -1
  5. package/dist/chart.d.ts +37 -0
  6. package/dist/chart.d.ts.map +1 -0
  7. package/dist/chart.js +92 -0
  8. package/dist/checkbox.d.ts +24 -0
  9. package/dist/checkbox.d.ts.map +1 -0
  10. package/dist/checkbox.js +25 -0
  11. package/dist/date-picker.d.ts.map +1 -1
  12. package/dist/date-picker.js +199 -54
  13. package/dist/drawer.d.ts +26 -0
  14. package/dist/drawer.d.ts.map +1 -0
  15. package/dist/drawer.js +125 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +9 -0
  19. package/dist/input.js +2 -2
  20. package/dist/metric-bar.js +1 -1
  21. package/dist/modal.d.ts.map +1 -1
  22. package/dist/modal.js +25 -6
  23. package/dist/pagination.d.ts +16 -0
  24. package/dist/pagination.d.ts.map +1 -0
  25. package/dist/pagination.js +39 -0
  26. package/dist/radio.d.ts +34 -0
  27. package/dist/radio.d.ts.map +1 -0
  28. package/dist/radio.js +37 -0
  29. package/dist/select.d.ts.map +1 -1
  30. package/dist/select.js +9 -5
  31. package/dist/skeleton.d.ts +12 -0
  32. package/dist/skeleton.d.ts.map +1 -0
  33. package/dist/skeleton.js +13 -0
  34. package/dist/stepper.js +1 -1
  35. package/dist/switch.d.ts +21 -0
  36. package/dist/switch.d.ts.map +1 -0
  37. package/dist/switch.js +27 -0
  38. package/dist/tab.js +1 -1
  39. package/dist/table.d.ts.map +1 -1
  40. package/dist/table.js +7 -6
  41. package/dist/toast.d.ts +31 -0
  42. package/dist/toast.d.ts.map +1 -0
  43. package/dist/toast.js +165 -0
  44. package/dist/tooltip.d.ts +18 -0
  45. package/dist/tooltip.d.ts.map +1 -0
  46. package/dist/tooltip.js +78 -0
  47. package/package.json +7 -3
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,KAAK,EACL,aAAoB,EACpB,SAAc,GACf,EAAE,cAAc,+BAgEhB"}
1
+ {"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,KAAK,EACL,aAAoB,EACpB,SAAc,GACf,EAAE,cAAc,+BAsEhB"}
package/dist/accordion.js CHANGED
@@ -25,6 +25,6 @@ export default function Accordion({ items, allowMultiple = true, className = "",
25
25
  const isOpen = openIds.has(item.id);
26
26
  const panelId = `accordion-panel-${item.id}`;
27
27
  const headerId = `accordion-header-${item.id}`;
28
- return (_jsxs("section", { className: "overflow-hidden rounded-large border border-border bg-surface", children: [_jsx("h3", { className: "m-0", children: _jsxs(ClickableButton, { type: "button", variant: "bare", id: headerId, "aria-expanded": isOpen, "aria-controls": panelId, onClick: () => toggle(item.id), className: "flex !h-auto w-full items-center justify-between gap-inline rounded-none px-component py-component text-left text-component-title text-foreground hover:bg-surface-muted focus-visible:ring-primary", children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: item.title }), _jsx(Icon, { name: "ChevronDown", "aria-hidden": "true", className: `shrink-0 transition-transform ${isOpen ? "rotate-180" : ""}` })] }) }), isOpen ? (_jsx("div", { id: panelId, role: "region", "aria-labelledby": headerId, className: "border-t border-border px-component py-component", children: item.content })) : null] }, item.id));
28
+ return (_jsxs("section", { className: "overflow-hidden rounded-large border border-border bg-surface", children: [_jsx("h3", { className: "m-0", children: _jsxs(ClickableButton, { type: "button", variant: "bare", id: headerId, "aria-expanded": isOpen, "aria-controls": panelId, onClick: () => toggle(item.id), className: "flex !h-auto w-full items-center justify-between gap-inline rounded-none px-component py-component text-left text-component-title text-foreground transition-colors duration-200 ease-out hover:bg-surface-muted focus-visible:ring-primary motion-reduce:transition-none", children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: item.title }), _jsx(Icon, { name: "ChevronDown", "aria-hidden": "true", className: `shrink-0 transition-transform duration-200 ease-out motion-reduce:transition-none ${isOpen ? "rotate-180" : ""}` })] }) }), _jsx("div", { id: panelId, role: "region", "aria-labelledby": headerId, "aria-hidden": !isOpen, inert: !isOpen ? true : undefined, className: `grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`, children: _jsx("div", { className: "min-h-0 overflow-hidden", children: _jsx("div", { className: "border-t border-border px-component py-component", children: item.content }) }) })] }, item.id));
29
29
  }) }));
30
30
  }
package/dist/agenda.js CHANGED
@@ -260,7 +260,7 @@ function EventChip({ event, onSelect, statusStyles, }) {
260
260
  e.preventDefault();
261
261
  e.stopPropagation();
262
262
  onSelect(event);
263
- }, className: `flex w-full items-stretch overflow-hidden rounded-small text-left transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${style.event}`, title: `${formatEventTime(event.startAt)} — ${event.title}`, children: [_jsx("span", { className: `w-0.5 shrink-0 ${style.accent}`, "aria-hidden": "true" }), _jsxs("span", { className: "min-w-0 flex-1 truncate px-1.5 py-0.5 text-[10px] leading-tight", children: [_jsx("span", { className: "font-semibold tabular-nums", children: formatEventTime(event.startAt) }), " ", _jsx("span", { className: "opacity-90", children: event.title })] })] }));
263
+ }, className: `flex w-full items-stretch overflow-hidden rounded-small text-left transition-opacity duration-200 ease-out motion-reduce:transition-none hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${style.event}`, title: `${formatEventTime(event.startAt)} — ${event.title}`, children: [_jsx("span", { className: `w-0.5 shrink-0 ${style.accent}`, "aria-hidden": "true" }), _jsxs("span", { className: "min-w-0 flex-1 truncate px-1.5 py-0.5 text-[10px] leading-tight", children: [_jsx("span", { className: "font-semibold tabular-nums", children: formatEventTime(event.startAt) }), " ", _jsx("span", { className: "opacity-90", children: event.title })] })] }));
264
264
  }
265
265
  function DayEventsModal({ open, title, events, onClose, onSelectEvent, statusOptions, statusStyles, }) {
266
266
  if (!open)
@@ -271,7 +271,7 @@ function DayEventsModal({ open, title, events, onClose, onSelectEvent, statusOpt
271
271
  return (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => {
272
272
  onClose();
273
273
  onSelectEvent(event);
274
- }, className: "flex w-full items-start gap-inline rounded-large border border-border bg-surface px-component py-control text-left transition-colors hover:border-primary hover:bg-primary-light/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", children: [_jsx("span", { className: `mt-1 size-2.5 shrink-0 rounded-full ${style.dot}`, "aria-hidden": "true" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-inline", children: [_jsxs("span", { className: "inline-flex items-center gap-micro text-body-medium text-foreground", children: [_jsx(Icon, { name: "Clock", size: "small", variant: "muted", "aria-hidden": "true" }), formatEventTime(event.startAt), event.endAt
274
+ }, className: "flex w-full items-start gap-inline rounded-large border border-border bg-surface px-component py-control text-left transition-colors duration-200 ease-out motion-reduce:transition-none hover:border-primary hover:bg-primary-light/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", children: [_jsx("span", { className: `mt-1 size-2.5 shrink-0 rounded-full ${style.dot}`, "aria-hidden": "true" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-inline", children: [_jsxs("span", { className: "inline-flex items-center gap-micro text-body-medium text-foreground", children: [_jsx(Icon, { name: "Clock", size: "small", variant: "muted", "aria-hidden": "true" }), formatEventTime(event.startAt), event.endAt
275
275
  ? ` – ${formatEventTime(event.endAt)}`
276
276
  : ""] }), label ? (_jsx(Badge, { variant: style.badge ?? "default", children: label })) : null] }), _jsx("span", { className: "mt-micro block text-body text-foreground", children: event.title }), (event.subtitle || event.kind) && (_jsx("span", { className: "mt-micro block text-small text-muted-foreground", children: [event.kind, event.subtitle].filter(Boolean).join(" · ") }))] }), _jsx(Icon, { name: "ChevronRight", size: "small", variant: "muted", "aria-hidden": "true", className: "mt-1 shrink-0" })] }) }, event.id));
277
277
  }) }) }));
@@ -371,13 +371,13 @@ function MonthView({ events, anchorDate, onSelectEvent, onCreateSlot, maxEventsP
371
371
  e.preventDefault();
372
372
  openDay(cellDate, dayEvents);
373
373
  }
374
- }, className: `group relative flex min-h-[6.5rem] flex-col gap-micro border-b border-r border-border p-inline transition-colors last:border-r-0 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary ${inMonth
374
+ }, className: `group relative flex min-h-[6.5rem] flex-col gap-micro border-b border-r border-border p-inline transition-colors duration-200 ease-out motion-reduce:transition-none last:border-r-0 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary ${inMonth
375
375
  ? "bg-surface hover:bg-surface-muted/60"
376
376
  : "bg-surface-muted/40 text-muted-foreground"} ${cellIndex % 7 === 6 ? "border-r-0" : ""}`, children: [_jsxs("div", { className: "flex items-center justify-between gap-micro", children: [_jsx("span", { className: `inline-flex size-7 items-center justify-center rounded-full text-small ${today
377
377
  ? "bg-primary font-semibold text-primary-foreground"
378
378
  : inMonth
379
379
  ? "font-medium text-foreground"
380
- : "text-muted-foreground"}`, children: cellDate.getDate() }), canCreate ? (_jsx("span", { className: "pointer-events-none inline-flex size-6 items-center justify-center rounded-small text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100", children: _jsx(Icon, { name: "Plus", size: "small", "aria-hidden": "true" }) })) : dayEvents.length > 0 ? (_jsx("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: dayEvents.length })) : null] }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-micro", children: [mounted &&
380
+ : "text-muted-foreground"}`, children: cellDate.getDate() }), canCreate ? (_jsx("span", { className: "pointer-events-none inline-flex size-6 items-center justify-center rounded-small text-muted-foreground opacity-0 transition-opacity duration-200 ease-out motion-reduce:transition-none group-hover:opacity-100 group-focus-visible:opacity-100", children: _jsx(Icon, { name: "Plus", size: "small", "aria-hidden": "true" }) })) : dayEvents.length > 0 ? (_jsx("span", { className: "text-[10px] tabular-nums text-muted-foreground", children: dayEvents.length })) : null] }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-micro", children: [mounted &&
381
381
  visible.map((event) => (_jsx(EventChip, { event: event, onSelect: onSelectEvent, statusStyles: statusStyles }, event.id))), mounted && extra > 0 ? (_jsxs("button", { type: "button", onClick: (e) => {
382
382
  e.stopPropagation();
383
383
  openDay(cellDate, dayEvents);
@@ -444,7 +444,7 @@ function WeekView({ events, anchorDate, onSelectEvent, onCreateSlot, weekStartHo
444
444
  return (_jsxs("button", { type: "button", onClick: (e) => {
445
445
  e.stopPropagation();
446
446
  onSelectEvent(event);
447
- }, className: `absolute right-1 left-1 z-[1] flex overflow-hidden rounded-small text-left shadow-sm transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${style.event}`, style: {
447
+ }, className: `absolute right-1 left-1 z-[1] flex overflow-hidden rounded-small text-left shadow-sm transition-opacity duration-200 ease-out motion-reduce:transition-none hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${style.event}`, style: {
448
448
  top: `${topPct}%`,
449
449
  height: `${heightPct}%`,
450
450
  minHeight: "1.35rem",
package/dist/button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Icon from "./icon";
3
- const BASE_CLASS = "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-medium text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60 [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current";
3
+ const BASE_CLASS = "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-medium text-sm font-medium outline-none transition-[color,background-color,border-color,opacity,filter] duration-200 ease-out focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60 motion-reduce:transition-none [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current";
4
4
  const SIZE_CLASS = {
5
5
  sm: "h-9 px-3",
6
6
  md: "h-10 px-4",
@@ -0,0 +1,37 @@
1
+ export type ChartType = "line" | "area" | "bar" | "stacked-bar" | "donut" | "sparkline";
2
+ export type ChartDataPoint = Record<string, string | number>;
3
+ export interface ChartSeries {
4
+ /** Key in each data point. */
5
+ key: string;
6
+ /** Legend / tooltip label (French in product copy). */
7
+ label: string;
8
+ /** CSS color (token var or hex). Defaults to the Modoock palette. */
9
+ color?: string;
10
+ }
11
+ export interface ChartProps {
12
+ type: ChartType;
13
+ data: ChartDataPoint[];
14
+ /**
15
+ * Category axis key (line/area/bar) or slice name key (donut).
16
+ * Ignored for sparkline.
17
+ */
18
+ categoryKey: string;
19
+ series: ChartSeries[];
20
+ /** Chart height in pixels. Defaults by type. */
21
+ height?: number;
22
+ showGrid?: boolean;
23
+ showLegend?: boolean;
24
+ showTooltip?: boolean;
25
+ className?: string;
26
+ /** Accessible name for the chart region. */
27
+ "aria-label"?: string;
28
+ emptyTitle?: string;
29
+ emptyDescription?: string;
30
+ }
31
+ export declare const CHART_COLORS: readonly ["var(--color-primary)", "var(--color-info)", "var(--color-success)", "var(--color-accent)", "var(--color-border-strong)", "var(--color-muted-foreground)"];
32
+ /**
33
+ * Graphiques métier (argent, santé, tableaux de bord) via Recharts.
34
+ * Types : line, area, bar, stacked-bar, donut, sparkline.
35
+ */
36
+ export default function Chart({ type, data, categoryKey, series, height, showGrid, showLegend, showTooltip, className, "aria-label": ariaLabel, emptyTitle, emptyDescription, }: ChartProps): import("react").JSX.Element;
37
+ //# sourceMappingURL=chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../components/ui/chart.tsx"],"names":[],"mappings":"AA0BA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,KAAK,GACL,aAAa,GACb,OAAO,GACP,WAAW,CAAC;AAEhB,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD,eAAO,MAAM,YAAY,sKAOf,CAAC;AAyHX;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,MAAM,EACN,MAAM,EACN,QAAe,EACf,UAAiB,EACjB,WAAkB,EAClB,SAAc,EACd,YAAY,EAAE,SAAS,EACvB,UAA4B,EAC5B,gBAAkF,GACnF,EAAE,UAAU,+BA4MZ"}
package/dist/chart.js ADDED
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Legend, Line, LineChart, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts";
4
+ import Icon from "./icon";
5
+ /* ------------------------------------------------------------------ */
6
+ /* Palette — avoid orange/warning as decorative series colors */
7
+ /* ------------------------------------------------------------------ */
8
+ export const CHART_COLORS = [
9
+ "var(--color-primary)",
10
+ "var(--color-info)",
11
+ "var(--color-success)",
12
+ "var(--color-accent)",
13
+ "var(--color-border-strong)",
14
+ "var(--color-muted-foreground)",
15
+ ];
16
+ function seriesColor(series, index) {
17
+ return series.color ?? CHART_COLORS[index % CHART_COLORS.length];
18
+ }
19
+ /* ------------------------------------------------------------------ */
20
+ /* Shared chrome */
21
+ /* ------------------------------------------------------------------ */
22
+ const AXIS_TICK = {
23
+ fill: "var(--color-muted-foreground)",
24
+ fontSize: 12,
25
+ };
26
+ const GRID_STROKE = "var(--color-border)";
27
+ const TOOLTIP_CURSOR = { fill: "var(--color-surface-muted)" };
28
+ function defaultHeight(type) {
29
+ if (type === "sparkline")
30
+ return 40;
31
+ if (type === "donut")
32
+ return 240;
33
+ return 280;
34
+ }
35
+ function ChartEmpty({ title, description, height, }) {
36
+ return (_jsxs("div", { className: "flex w-full flex-col items-center justify-center gap-inline rounded-medium border border-dashed border-border bg-surface-muted px-component text-center", style: { height }, role: "status", children: [_jsx(Icon, { name: "ChartColumnIncreasing", variant: "muted", "aria-hidden": "true" }), _jsx("p", { className: "text-body-medium text-foreground", children: title }), _jsx("p", { className: "max-w-xs text-small text-muted-foreground", children: description })] }));
37
+ }
38
+ function ChartTooltipContent({ active, payload, label, series, }) {
39
+ if (!active || !payload?.length)
40
+ return null;
41
+ const labelByKey = new Map(series.map((item) => [item.key, item.label]));
42
+ return (_jsxs("div", { className: "rounded-medium border border-border bg-surface px-component py-control shadow-lg", children: [label != null && label !== "" && (_jsx("p", { className: "mb-micro text-label text-muted-foreground", children: label })), _jsx("ul", { className: "flex flex-col gap-micro", children: payload.map((entry, index) => {
43
+ const key = String(entry.dataKey ?? "");
44
+ const rowLabel = entry.name && !labelByKey.has(String(entry.name))
45
+ ? entry.name
46
+ : (labelByKey.get(key) ?? entry.name ?? key);
47
+ return (_jsxs("li", { className: "flex items-center justify-between gap-component text-small text-foreground", children: [_jsx("span", { children: rowLabel }), _jsx("span", { className: "font-medium tabular-nums", children: entry.value })] }, `${key}-${index}`));
48
+ }) })] }));
49
+ }
50
+ function ChartFrame({ height, className, ariaLabel, children, }) {
51
+ return (_jsx("div", { className: `w-full min-w-0 ${className}`, style: { height }, role: "img", "aria-label": ariaLabel, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: children }) }));
52
+ }
53
+ /* ------------------------------------------------------------------ */
54
+ /* Chart */
55
+ /* ------------------------------------------------------------------ */
56
+ /**
57
+ * Graphiques métier (argent, santé, tableaux de bord) via Recharts.
58
+ * Types : line, area, bar, stacked-bar, donut, sparkline.
59
+ */
60
+ export default function Chart({ type, data, categoryKey, series, height, showGrid = true, showLegend = true, showTooltip = true, className = "", "aria-label": ariaLabel, emptyTitle = "Aucune donnée", emptyDescription = "Les valeurs apparaîtront ici dès qu’elles seront disponibles.", }) {
61
+ const resolvedHeight = height ?? defaultHeight(type);
62
+ if (!data.length || !series.length) {
63
+ return (_jsx(ChartEmpty, { title: emptyTitle, description: emptyDescription, height: resolvedHeight }));
64
+ }
65
+ const tooltip = showTooltip ? (_jsx(Tooltip, { content: _jsx(ChartTooltipContent, { series: series }), cursor: type === "bar" || type === "stacked-bar" ? TOOLTIP_CURSOR : undefined })) : null;
66
+ const legend = showLegend ? (_jsx(Legend, { wrapperStyle: { fontSize: 12, color: "var(--color-muted-foreground)" }, formatter: (value) => {
67
+ const match = series.find((item) => item.key === value);
68
+ return match?.label ?? value;
69
+ } })) : null;
70
+ const grid = showGrid ? (_jsx(CartesianGrid, { stroke: GRID_STROKE, strokeDasharray: "3 3", vertical: false })) : null;
71
+ if (type === "sparkline") {
72
+ const primary = series[0];
73
+ const color = seriesColor(primary, 0);
74
+ return (_jsx(ChartFrame, { height: resolvedHeight, className: className, ariaLabel: ariaLabel ?? primary.label, children: _jsx(LineChart, { data: data, margin: { top: 4, right: 0, left: 0, bottom: 0 }, children: _jsx(Line, { type: "monotone", dataKey: primary.key, stroke: color, strokeWidth: 2, dot: false, isAnimationActive: true, animationDuration: 200 }) }) }));
75
+ }
76
+ if (type === "donut") {
77
+ const valueKey = series[0].key;
78
+ return (_jsx(ChartFrame, { height: resolvedHeight, className: className, ariaLabel: ariaLabel ?? "Répartition", children: _jsxs(PieChart, { children: [_jsx(Pie, { data: data, dataKey: valueKey, nameKey: categoryKey, innerRadius: "58%", outerRadius: "80%", paddingAngle: 2, stroke: "var(--color-surface)", strokeWidth: 2, isAnimationActive: true, animationDuration: 200, children: data.map((_, index) => (_jsx(Cell, { fill: seriesColor(series[0], index) }, `slice-${index}`))) }), tooltip, legend] }) }));
79
+ }
80
+ if (type === "line") {
81
+ return (_jsx(ChartFrame, { height: resolvedHeight, className: className, ariaLabel: ariaLabel, children: _jsxs(LineChart, { data: data, margin: { top: 8, right: 8, left: 0, bottom: 0 }, children: [grid, _jsx(XAxis, { dataKey: categoryKey, tick: AXIS_TICK, axisLine: false, tickLine: false }), _jsx(YAxis, { tick: AXIS_TICK, axisLine: false, tickLine: false, width: 40 }), tooltip, legend, series.map((item, index) => (_jsx(Line, { type: "monotone", dataKey: item.key, name: item.key, stroke: seriesColor(item, index), strokeWidth: 2, dot: false, activeDot: { r: 4 }, isAnimationActive: true, animationDuration: 200 }, item.key)))] }) }));
82
+ }
83
+ if (type === "area") {
84
+ return (_jsx(ChartFrame, { height: resolvedHeight, className: className, ariaLabel: ariaLabel, children: _jsxs(AreaChart, { data: data, margin: { top: 8, right: 8, left: 0, bottom: 0 }, children: [grid, _jsx(XAxis, { dataKey: categoryKey, tick: AXIS_TICK, axisLine: false, tickLine: false }), _jsx(YAxis, { tick: AXIS_TICK, axisLine: false, tickLine: false, width: 40 }), tooltip, legend, series.map((item, index) => {
85
+ const color = seriesColor(item, index);
86
+ return (_jsx(Area, { type: "monotone", dataKey: item.key, name: item.key, stroke: color, fill: color, fillOpacity: 0.15, strokeWidth: 2, isAnimationActive: true, animationDuration: 200 }, item.key));
87
+ })] }) }));
88
+ }
89
+ // bar | stacked-bar
90
+ const stacked = type === "stacked-bar";
91
+ return (_jsx(ChartFrame, { height: resolvedHeight, className: className, ariaLabel: ariaLabel, children: _jsxs(BarChart, { data: data, margin: { top: 8, right: 8, left: 0, bottom: 0 }, children: [grid, _jsx(XAxis, { dataKey: categoryKey, tick: AXIS_TICK, axisLine: false, tickLine: false }), _jsx(YAxis, { tick: AXIS_TICK, axisLine: false, tickLine: false, width: 40 }), tooltip, legend, series.map((item, index) => (_jsx(Bar, { dataKey: item.key, name: item.key, fill: seriesColor(item, index), radius: stacked ? [0, 0, 0, 0] : [4, 4, 0, 0], stackId: stacked ? "stack" : undefined, isAnimationActive: true, animationDuration: 200 }, item.key)))] }) }));
92
+ }
@@ -0,0 +1,24 @@
1
+ export type CheckboxSize = "sm" | "md";
2
+ export interface CheckboxProps {
3
+ /** Controlled checked state. */
4
+ checked: boolean;
5
+ onCheckedChange: (checked: boolean) => void;
6
+ /** Visible label — required for accessibility. */
7
+ label: string;
8
+ /** Optional helper text under the label. */
9
+ description?: string;
10
+ /** Mixed state (e.g. “select all” when some children are checked). */
11
+ indeterminate?: boolean;
12
+ disabled?: boolean;
13
+ id?: string;
14
+ name?: string;
15
+ value?: string;
16
+ size?: CheckboxSize;
17
+ className?: string;
18
+ }
19
+ /**
20
+ * Case à cocher — option binaire ou mixte.
21
+ * Identité Modoock : fond primary à l’activation, icône blanche.
22
+ */
23
+ export default function Checkbox({ checked, onCheckedChange, label, description, indeterminate, disabled, id, name, value, size, className, }: CheckboxProps): import("react").JSX.Element;
24
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../components/ui/checkbox.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,OAAO,EACP,eAAe,EACf,KAAK,EACL,WAAW,EACX,aAAqB,EACrB,QAAgB,EAChB,EAAE,EACF,IAAI,EACJ,KAAK,EACL,IAAW,EACX,SAAc,GACf,EAAE,aAAa,+BA0Ef"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef } from "react";
4
+ import Icon from "./icon";
5
+ const BOX_SIZE = {
6
+ sm: "size-4",
7
+ md: "size-5",
8
+ };
9
+ /**
10
+ * Case à cocher — option binaire ou mixte.
11
+ * Identité Modoock : fond primary à l’activation, icône blanche.
12
+ */
13
+ export default function Checkbox({ checked, onCheckedChange, label, description, indeterminate = false, disabled = false, id, name, value, size = "md", className = "", }) {
14
+ const generatedId = useId();
15
+ const inputId = id ?? generatedId;
16
+ const descriptionId = description ? `${inputId}-description` : undefined;
17
+ const inputRef = useRef(null);
18
+ const isOn = checked || indeterminate;
19
+ useEffect(() => {
20
+ if (inputRef.current) {
21
+ inputRef.current.indeterminate = indeterminate;
22
+ }
23
+ }, [indeterminate]);
24
+ return (_jsxs("div", { className: `inline-flex items-start gap-control ${disabled ? "opacity-60" : ""} ${className}`, children: [_jsxs("span", { className: "relative mt-micro inline-flex shrink-0", children: [_jsx("input", { ref: inputRef, type: "checkbox", id: inputId, name: name, value: value, checked: checked, disabled: disabled, "aria-checked": indeterminate ? "mixed" : checked, "aria-describedby": descriptionId, onChange: (event) => onCheckedChange(event.target.checked), className: `appearance-none rounded-small border outline-none transition-[background-color,border-color] duration-200 ease-out focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed motion-reduce:transition-none ${BOX_SIZE[size]} ${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${isOn ? "border-primary bg-primary" : "border-border bg-surface"}` }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 grid place-items-center", children: indeterminate ? (_jsx(Icon, { name: "Minus", variant: "white", size: "small", className: "size-2.5" })) : checked ? (_jsx(Icon, { name: "Check", variant: "white", size: "small", className: "size-2.5" })) : null })] }), _jsxs("div", { className: "min-w-0 pt-micro", children: [_jsx("label", { htmlFor: inputId, className: `text-body-medium leading-snug text-foreground ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`, children: label }), description ? (_jsx("p", { id: descriptionId, className: "mt-0 text-small leading-snug text-muted-foreground", children: description })) : null] })] }));
25
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../components/ui/date-picker.tsx"],"names":[],"mappings":"AAkBA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,IAAI,GAAG,IAAI,CAAC;CACjB,CAAC;AAEF,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAoB,SAAQ,gBAAgB;IACpD,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC3C;AAsbD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAsC,EACtC,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,eAAe,+BAkEjB;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAmD,EACnD,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,mBAAmB,+BAwGrB;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAyC,EACzC,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,oBAAoB,+BA4GtB"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../components/ui/date-picker.tsx"],"names":[],"mappings":"AAkBA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,IAAI,GAAG,IAAI,CAAC;CACjB,CAAC;AAEF,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAoB,SAAQ,gBAAgB;IACpD,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC3C;AA6qBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAsC,EACtC,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,eAAe,+BAuEjB;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAmD,EACnD,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,mBAAmB,+BAyHrB;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAyC,EACzC,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAgB,EAChB,SAAc,GACf,EAAE,oBAAoB,+BA+HtB"}