@vantageos/mosaic-blocks 0.5.36-alpha → 0.5.37-alpha

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 (57) hide show
  1. package/README.md +3 -1
  2. package/dist/index.cjs +491 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +186 -2
  5. package/dist/index.d.ts +186 -2
  6. package/dist/index.js +483 -2
  7. package/dist/index.js.map +1 -1
  8. package/package.json +9 -1
  9. package/r/mosaic-adaptive-grid.json +1 -1
  10. package/r/mosaic-adaptive-modal.json +1 -1
  11. package/r/mosaic-adaptive-navigation.json +1 -1
  12. package/r/mosaic-add-memory-form.json +3 -3
  13. package/r/mosaic-admin-only-guard.json +1 -1
  14. package/r/mosaic-agent-chat.json +4 -4
  15. package/r/mosaic-agent-composer.json +1 -1
  16. package/r/mosaic-agent-editor.json +3 -3
  17. package/r/mosaic-agent-list.json +4 -4
  18. package/r/mosaic-app-sidebar.json +1 -1
  19. package/r/mosaic-artifact-checklist.json +1 -1
  20. package/r/mosaic-artifact-data-table.json +1 -1
  21. package/r/mosaic-artifact-library.json +1 -1
  22. package/r/mosaic-artifact-save-as-memory-form.json +2 -2
  23. package/r/mosaic-chat-message.json +1 -1
  24. package/r/mosaic-dashboard-content.json +1 -1
  25. package/r/mosaic-dashboard-header.json +1 -1
  26. package/r/mosaic-dashboard-layout.json +3 -3
  27. package/r/mosaic-document-table.json +5 -5
  28. package/r/mosaic-edit-memory-dialog.json +3 -3
  29. package/r/mosaic-edit-session-dialog.json +3 -3
  30. package/r/mosaic-editable-cell.json +1 -1
  31. package/r/mosaic-filter-bar.json +1 -1
  32. package/r/mosaic-filter-sidebar.json +1 -1
  33. package/r/mosaic-grille-registre.json +53 -0
  34. package/r/mosaic-main-nav.json +1 -1
  35. package/r/mosaic-marketplace-card.json +2 -2
  36. package/r/mosaic-marketplace-list.json +3 -3
  37. package/r/mosaic-match-input.json +1 -1
  38. package/r/mosaic-memory-dashboard.json +1 -1
  39. package/r/mosaic-memory-search.json +1 -1
  40. package/r/mosaic-mention-input.json +1 -1
  41. package/r/mosaic-message-list.json +2 -2
  42. package/r/mosaic-message-search.json +1 -1
  43. package/r/mosaic-module-library.json +1 -1
  44. package/r/mosaic-org-context-display.json +1 -1
  45. package/r/mosaic-org-panel.json +2 -2
  46. package/r/mosaic-preferences-panel.json +1 -1
  47. package/r/mosaic-profile-panel.json +1 -1
  48. package/r/mosaic-quick-actions-menu.json +1 -1
  49. package/r/mosaic-quick-agent-selector.json +2 -2
  50. package/r/mosaic-save-chat-as-memory-form.json +3 -3
  51. package/r/mosaic-save-template-modal.json +5 -5
  52. package/r/mosaic-selector-modal.json +1 -1
  53. package/r/mosaic-session-card.json +2 -2
  54. package/r/mosaic-template-gallery.json +3 -3
  55. package/r/mosaic-template-management-panel.json +3 -3
  56. package/r/use-effective-workspace-id.json +1 -1
  57. package/registry.json +42 -0
package/README.md CHANGED
@@ -169,7 +169,7 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
169
169
 
170
170
  ## 6. Component Catalogue Summary
171
171
 
172
- 192 exported `Mosaic*` components across 9 sections (314 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
172
+ 192 exported `Mosaic*` components across 9 sections (323 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
173
173
 
174
174
  > There is **no "Debate" section**. No `Mosaic*` debate component (room/timer/participant) is exported by this package — despite the "absorbed from anydebate" origin story below, the debate UI was never ported. If you need debate-room UI, it does not exist here yet.
175
175
 
@@ -187,6 +187,8 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
187
187
 
188
188
  All exports: `import { ComponentName } from "@vantageos/mosaic-blocks"`
189
189
 
190
+ **Registry-screen blocks** (`src/components/registre/`): `GrilleRegistre` (AG Grid Community grid, every column sortable/filterable/resizable, stable row id), `RegistreEcran` (fullscreen section + toolbar: global search, column chooser, fullscreen toggle), `PanneauRegistreShell` (resizable HeroUI drawer with ArrowUp/ArrowDown row navigation) and `RegistreLigneDetail` (declaration-driven per-field detail and edit), plus `ChoixColonnes`, the `ColonneRegistre` declaration type and `registreGridTheme`. Columns, row shape, labels and formatters are props. They need the peer dependencies `@heroui/react` (with its styles), `ag-grid-community`, `ag-grid-react` and `lucide-react`.
191
+
190
192
  ---
191
193
 
192
194
  ## 7. Auth Integration
package/dist/index.cjs CHANGED
@@ -26,6 +26,10 @@ var menu = require('@base-ui/react/menu');
26
26
  var dialog = require('@base-ui/react/dialog');
27
27
  var alertDialog = require('@base-ui/react/alert-dialog');
28
28
  var popover = require('@base-ui/react/popover');
29
+ var agGridCommunity = require('ag-grid-community');
30
+ var agGridReact = require('ag-grid-react');
31
+ var react = require('@heroui/react');
32
+ var lucideReact = require('lucide-react');
29
33
 
30
34
  function _interopNamespace(e) {
31
35
  if (e && e.__esModule) return e;
@@ -48,7 +52,7 @@ function _interopNamespace(e) {
48
52
  var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
49
53
 
50
54
  // src/version.ts
51
- var version = "0.5.36-alpha";
55
+ var version = "0.5.37-alpha";
52
56
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
53
57
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
54
58
  }
@@ -18505,6 +18509,483 @@ function MosaicDocumentCriteriaPanel({
18505
18509
  );
18506
18510
  }
18507
18511
  MosaicDocumentCriteriaPanel.displayName = "MosaicDocumentCriteriaPanel";
18512
+ var registreGridTheme = agGridCommunity.themeQuartz.withParams({
18513
+ accentColor: "var(--accent)",
18514
+ backgroundColor: "var(--surface)",
18515
+ foregroundColor: "var(--foreground)",
18516
+ textColor: "var(--foreground)",
18517
+ borderColor: "var(--border)",
18518
+ headerBackgroundColor: "var(--surface-secondary)",
18519
+ headerTextColor: "var(--surface-secondary-foreground)",
18520
+ headerFontWeight: 600,
18521
+ fontFamily: "var(--font-sans)",
18522
+ fontSize: 14,
18523
+ headerFontSize: 13,
18524
+ rowHeight: 40,
18525
+ headerHeight: 44,
18526
+ spacing: 8,
18527
+ wrapperBorderRadius: 8,
18528
+ rowHoverColor: "var(--surface-hover)"
18529
+ // No `selectedRowBackgroundColor`: the grid does not use the native AG Grid row
18530
+ // selection. A host highlights its selected row through `getRowStyle`.
18531
+ });
18532
+ var fitGridWidthStrategy = {
18533
+ type: "fitGridWidth"
18534
+ };
18535
+ function refitColumns(e) {
18536
+ e.api.sizeColumnsToFit();
18537
+ }
18538
+ var modulesRegistered = false;
18539
+ function ensureModules() {
18540
+ if (modulesRegistered) return;
18541
+ agGridCommunity.ModuleRegistry.registerModules([agGridCommunity.AllCommunityModule]);
18542
+ modulesRegistered = true;
18543
+ }
18544
+ var DEFAUTS = {
18545
+ resizable: true,
18546
+ sortable: true,
18547
+ filter: true,
18548
+ floatingFilter: true
18549
+ };
18550
+ function GrilleRegistre({
18551
+ lignes,
18552
+ columnDefs,
18553
+ getRowId,
18554
+ filtreGlobal,
18555
+ theme = registreGridTheme,
18556
+ onGridReady,
18557
+ onCelluleEditee,
18558
+ getRowStyle,
18559
+ tooltipShowDelay,
18560
+ suppressCellFocus,
18561
+ onCellClicked,
18562
+ rowHeight,
18563
+ domLayout,
18564
+ onGridSizeChanged
18565
+ }) {
18566
+ ensureModules();
18567
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "isolate h-full min-h-0 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
18568
+ agGridReact.AgGridReact,
18569
+ {
18570
+ theme,
18571
+ autoSizeStrategy: fitGridWidthStrategy,
18572
+ rowData: lignes,
18573
+ columnDefs,
18574
+ defaultColDef: DEFAUTS,
18575
+ quickFilterText: filtreGlobal,
18576
+ getRowId: (p) => getRowId(p.data),
18577
+ onGridReady,
18578
+ onCellValueChanged: onCelluleEditee,
18579
+ onCellClicked,
18580
+ getRowStyle,
18581
+ tooltipShowDelay,
18582
+ suppressCellFocus,
18583
+ rowHeight,
18584
+ domLayout,
18585
+ onGridSizeChanged,
18586
+ animateRows: true
18587
+ }
18588
+ ) });
18589
+ }
18590
+ var DEFAULT_WIDTH_RATIO = 0.45;
18591
+ var MIN_WIDTH_PX = 360;
18592
+ var MAX_WIDTH_RATIO = 0.9;
18593
+ var CSS_RULES = {
18594
+ // allow-hardcoded-word: a CSS rule (the scoped width variable), not user-facing text
18595
+ width: (px) => `.panneau-registre-shell { --panneau-registre-width: ${px}px; }`
18596
+ };
18597
+ function PanneauRegistreShell({
18598
+ open,
18599
+ onOpenChange,
18600
+ labels,
18601
+ ariaLabel,
18602
+ contexte,
18603
+ headerActions,
18604
+ forceWidthRatio = null,
18605
+ onPrev,
18606
+ onNext,
18607
+ prevDisabled,
18608
+ nextDisabled,
18609
+ children
18610
+ }) {
18611
+ const [widthPx, setWidthPx] = React30.useState(null);
18612
+ const dragStart = React30.useRef(null);
18613
+ React30.useEffect(() => {
18614
+ if (widthPx !== null || typeof window === "undefined") return;
18615
+ setWidthPx(Math.round(window.innerWidth * DEFAULT_WIDTH_RATIO));
18616
+ }, [widthPx]);
18617
+ const onPointerMove = React30.useCallback((e) => {
18618
+ const drag = dragStart.current;
18619
+ if (!drag) return;
18620
+ const dx = drag.x - e.clientX;
18621
+ const maxWidth = window.innerWidth * MAX_WIDTH_RATIO;
18622
+ setWidthPx(Math.min(maxWidth, Math.max(MIN_WIDTH_PX, drag.width + dx)));
18623
+ }, []);
18624
+ const onPointerUp = React30.useCallback(() => {
18625
+ dragStart.current = null;
18626
+ window.removeEventListener("pointermove", onPointerMove);
18627
+ window.removeEventListener("pointerup", onPointerUp);
18628
+ }, [onPointerMove]);
18629
+ const onHandlePointerDown = React30.useCallback(
18630
+ (e) => {
18631
+ dragStart.current = {
18632
+ x: e.clientX,
18633
+ width: widthPx ?? Math.round(window.innerWidth * DEFAULT_WIDTH_RATIO)
18634
+ };
18635
+ window.addEventListener("pointermove", onPointerMove);
18636
+ window.addEventListener("pointerup", onPointerUp);
18637
+ },
18638
+ [widthPx, onPointerMove, onPointerUp]
18639
+ );
18640
+ React30.useEffect(() => () => onPointerUp(), [onPointerUp]);
18641
+ React30.useEffect(() => {
18642
+ if (!open) return;
18643
+ function onKeyDown(e) {
18644
+ if (isEditableTarget(e.target)) return;
18645
+ if (e.key === "ArrowUp" && !prevDisabled) {
18646
+ e.preventDefault();
18647
+ onPrev();
18648
+ } else if (e.key === "ArrowDown" && !nextDisabled) {
18649
+ e.preventDefault();
18650
+ onNext();
18651
+ }
18652
+ }
18653
+ window.addEventListener("keydown", onKeyDown, true);
18654
+ return () => window.removeEventListener("keydown", onKeyDown, true);
18655
+ }, [open, prevDisabled, nextDisabled, onPrev, onNext]);
18656
+ const resolvedWidth = forceWidthRatio !== null && typeof window !== "undefined" ? Math.round(window.innerWidth * forceWidthRatio) : widthPx ?? MIN_WIDTH_PX;
18657
+ const widthRule = CSS_RULES.width(resolvedWidth);
18658
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer, { isOpen: open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.Backdrop, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Content, { placement: "right", children: [
18659
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: widthRule }),
18660
+ /* @__PURE__ */ jsxRuntime.jsxs(
18661
+ react.Drawer.Dialog,
18662
+ {
18663
+ "aria-label": ariaLabel,
18664
+ className: "panneau-registre-shell relative flex h-full w-full! flex-col overflow-hidden sm:w-[var(--panneau-registre-width)]! sm:min-w-[360px]! sm:max-w-[90vw]!",
18665
+ children: [
18666
+ /* @__PURE__ */ jsxRuntime.jsx(
18667
+ "button",
18668
+ {
18669
+ type: "button",
18670
+ "aria-label": labels.resizeHandle,
18671
+ className: "absolute inset-y-0 left-0 hidden w-1.5 cursor-col-resize touch-none bg-transparent hover:bg-border sm:block",
18672
+ onPointerDown: onHandlePointerDown
18673
+ }
18674
+ ),
18675
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Header, { className: "flex shrink-0 flex-row items-center justify-between gap-3", children: [
18676
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 truncate text-sm text-muted-foreground", children: contexte }),
18677
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 flex-row items-center gap-2", children: [
18678
+ headerActions,
18679
+ /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { "aria-label": labels.close })
18680
+ ] })
18681
+ ] }),
18682
+ children,
18683
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Footer, { className: "flex shrink-0 flex-row items-center justify-end gap-2", children: [
18684
+ /* @__PURE__ */ jsxRuntime.jsx(
18685
+ react.Button,
18686
+ {
18687
+ variant: "outline",
18688
+ size: "sm",
18689
+ isIconOnly: true,
18690
+ "aria-label": labels.previousRow,
18691
+ isDisabled: prevDisabled,
18692
+ onPress: onPrev,
18693
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4", "aria-hidden": "true" })
18694
+ }
18695
+ ),
18696
+ /* @__PURE__ */ jsxRuntime.jsx(
18697
+ react.Button,
18698
+ {
18699
+ variant: "outline",
18700
+ size: "sm",
18701
+ isIconOnly: true,
18702
+ "aria-label": labels.nextRow,
18703
+ isDisabled: nextDisabled,
18704
+ onPress: onNext,
18705
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4", "aria-hidden": "true" })
18706
+ }
18707
+ )
18708
+ ] })
18709
+ ]
18710
+ }
18711
+ )
18712
+ ] }) }) });
18713
+ }
18714
+
18715
+ // src/components/registre/colonnes.ts
18716
+ function estVisible(etat, champ) {
18717
+ return etat[champ] !== false;
18718
+ }
18719
+ var OPTION_CLASS = "flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-default";
18720
+ function ChoixColonnes({
18721
+ colonnes,
18722
+ visibilite,
18723
+ onBasculer,
18724
+ labels,
18725
+ formatLibelle = (libelle) => libelle,
18726
+ ouvertParDefaut = false
18727
+ }) {
18728
+ const [ouvert, setOuvert] = React30.useState(ouvertParDefaut);
18729
+ const nbMasquees = colonnes.filter((c) => !estVisible(visibilite, c.champ)).length;
18730
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Popover, { isOpen: ouvert, onOpenChange: setOuvert, children: [
18731
+ /* @__PURE__ */ jsxRuntime.jsx(react.Button, { variant: "outline", size: "sm", children: labels.columnsButton(nbMasquees) }),
18732
+ /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Content, { placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Dialog, { children: /* @__PURE__ */ jsxRuntime.jsx(
18733
+ "fieldset",
18734
+ {
18735
+ "aria-label": labels.columnsGroupAriaLabel,
18736
+ className: "z-50 max-h-[60vh] w-72 overflow-y-auto border-0 p-1",
18737
+ children: colonnes.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
18738
+ react.Checkbox,
18739
+ {
18740
+ isSelected: estVisible(visibilite, c.champ),
18741
+ onChange: () => onBasculer(c.champ),
18742
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.Checkbox.Content, { className: OPTION_CLASS, children: [
18743
+ /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox.Indicator, {}) }),
18744
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-4 tabular-nums text-muted-foreground", children: c.lettre }),
18745
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatLibelle(c.libelle) })
18746
+ ] })
18747
+ },
18748
+ c.champ
18749
+ ))
18750
+ }
18751
+ ) }) })
18752
+ ] });
18753
+ }
18754
+ var CSS_SELECTORS = {
18755
+ // allow-hardcoded-word: a CSS attribute selector (HeroUI data-slot names), not user-facing text
18756
+ openOverlay: "[data-slot=select-popover], [data-slot=popover-dialog]"
18757
+ };
18758
+ function RegistreEcran({
18759
+ ariaLabel,
18760
+ labels,
18761
+ colonnes,
18762
+ visibilite,
18763
+ onBasculerColonne,
18764
+ formatLibelleColonne,
18765
+ filtreGlobal,
18766
+ onFiltreGlobalChange,
18767
+ avantRecherche,
18768
+ actionsToolbar,
18769
+ children
18770
+ }) {
18771
+ const [fullScreen, setFullScreen] = React30.useState(false);
18772
+ React30.useEffect(() => {
18773
+ if (!fullScreen) return;
18774
+ const onKeyDown = (e) => {
18775
+ if (document.querySelector(CSS_SELECTORS.openOverlay)) return;
18776
+ if (e.key === "Escape") setFullScreen(false);
18777
+ };
18778
+ const previousOverflow = document.body.style.overflow;
18779
+ document.body.style.overflow = "hidden";
18780
+ window.addEventListener("keydown", onKeyDown);
18781
+ return () => {
18782
+ window.removeEventListener("keydown", onKeyDown);
18783
+ document.body.style.overflow = previousOverflow;
18784
+ };
18785
+ }, [fullScreen]);
18786
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18787
+ "section",
18788
+ {
18789
+ "aria-label": ariaLabel,
18790
+ "data-fullscreen": fullScreen ? "true" : void 0,
18791
+ className: fullScreen ? "fixed inset-0 z-40 flex flex-col gap-4 bg-background p-4" : (
18792
+ // Phones let the page scroll so content above cannot squeeze the grid to nothing.
18793
+ "flex min-h-[70vh] flex-1 flex-col gap-4 sm:min-h-0"
18794
+ ),
18795
+ children: [
18796
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsxs(react.Toolbar, { className: "flex flex-wrap items-center gap-2", children: [
18797
+ avantRecherche,
18798
+ /* @__PURE__ */ jsxRuntime.jsx(
18799
+ react.SearchField,
18800
+ {
18801
+ value: filtreGlobal,
18802
+ onChange: onFiltreGlobalChange,
18803
+ "aria-label": labels.searchAriaLabel,
18804
+ className: "w-full sm:w-auto",
18805
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.SearchField.Group, { className: "h-10 min-w-64", children: [
18806
+ /* @__PURE__ */ jsxRuntime.jsx(react.SearchField.SearchIcon, {}),
18807
+ /* @__PURE__ */ jsxRuntime.jsx(
18808
+ react.SearchField.Input,
18809
+ {
18810
+ placeholder: labels.searchPlaceholder,
18811
+ className: "text-base sm:text-sm"
18812
+ }
18813
+ ),
18814
+ /* @__PURE__ */ jsxRuntime.jsx(react.SearchField.ClearButton, {})
18815
+ ] })
18816
+ }
18817
+ ),
18818
+ /* @__PURE__ */ jsxRuntime.jsx(
18819
+ ChoixColonnes,
18820
+ {
18821
+ colonnes,
18822
+ visibilite,
18823
+ onBasculer: onBasculerColonne,
18824
+ labels,
18825
+ formatLibelle: formatLibelleColonne
18826
+ }
18827
+ ),
18828
+ actionsToolbar,
18829
+ /* @__PURE__ */ jsxRuntime.jsxs(
18830
+ react.Button,
18831
+ {
18832
+ variant: "outline",
18833
+ size: "sm",
18834
+ "aria-pressed": fullScreen,
18835
+ onPress: () => setFullScreen((f) => !f),
18836
+ children: [
18837
+ fullScreen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minimize2, { "aria-hidden": true, className: "size-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, { "aria-hidden": true, className: "size-4" }),
18838
+ fullScreen ? labels.exitFullscreen : labels.enterFullscreen
18839
+ ]
18840
+ }
18841
+ )
18842
+ ] }) }),
18843
+ children
18844
+ ]
18845
+ }
18846
+ );
18847
+ }
18848
+ function editValue(value, decimalSeparator) {
18849
+ if (value == null) return "";
18850
+ return typeof value === "number" ? String(value).replace(".", decimalSeparator) : value;
18851
+ }
18852
+ function FieldEditor({
18853
+ col,
18854
+ initial,
18855
+ labels,
18856
+ onSave,
18857
+ onCancel
18858
+ }) {
18859
+ const [draft, setDraft] = React30.useState(initial);
18860
+ const [saving, setSaving] = React30.useState(false);
18861
+ const inputId = `registre-field-${col.champ}`;
18862
+ const label = labels.fieldInput(col);
18863
+ async function submit(e) {
18864
+ e.preventDefault();
18865
+ setSaving(true);
18866
+ await onSave(draft);
18867
+ setSaving(false);
18868
+ }
18869
+ function onKeyDown(e) {
18870
+ if (e.key === "Escape") {
18871
+ e.stopPropagation();
18872
+ onCancel();
18873
+ }
18874
+ }
18875
+ const inputClass = "h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-base sm:text-sm";
18876
+ return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, onKeyDown, className: "flex flex-wrap items-center gap-2", children: [
18877
+ col.valeurs ? /* @__PURE__ */ jsxRuntime.jsxs(
18878
+ "select",
18879
+ {
18880
+ id: inputId,
18881
+ "aria-label": label,
18882
+ value: draft,
18883
+ onChange: (e) => setDraft(e.target.value),
18884
+ className: inputClass,
18885
+ children: [
18886
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "\u2014" }),
18887
+ col.valeurs.map((v) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: v, children: v }, v))
18888
+ ]
18889
+ }
18890
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
18891
+ "input",
18892
+ {
18893
+ id: inputId,
18894
+ "aria-label": label,
18895
+ value: draft,
18896
+ onChange: (e) => setDraft(e.target.value),
18897
+ autoFocus: true,
18898
+ className: inputClass
18899
+ }
18900
+ ),
18901
+ /* @__PURE__ */ jsxRuntime.jsx(
18902
+ "button",
18903
+ {
18904
+ type: "submit",
18905
+ disabled: saving,
18906
+ className: "h-8 rounded-md bg-primary px-3 text-sm text-primary-foreground disabled:opacity-50",
18907
+ children: labels.save
18908
+ }
18909
+ ),
18910
+ /* @__PURE__ */ jsxRuntime.jsx(
18911
+ "button",
18912
+ {
18913
+ type: "button",
18914
+ onClick: onCancel,
18915
+ className: "h-8 rounded-md border border-border px-3 text-sm",
18916
+ children: labels.cancel
18917
+ }
18918
+ )
18919
+ ] });
18920
+ }
18921
+ var PENCIL_CLASS = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-default hover:text-foreground";
18922
+ function RegistreLigneDetail({
18923
+ colonnes,
18924
+ ligne,
18925
+ corrections,
18926
+ labels,
18927
+ formatMontant,
18928
+ formatNombre,
18929
+ decimalSeparator,
18930
+ onSaveField
18931
+ }) {
18932
+ const [editing, setEditing] = React30.useState(null);
18933
+ function displayValue(col, value) {
18934
+ if (value == null || value === "") return "";
18935
+ if (col.type === "montant") return formatMontant(Number(value));
18936
+ if (col.type === "nombre" || col.type === "entier") return formatNombre(Number(value));
18937
+ return String(value);
18938
+ }
18939
+ return /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "divide-y divide-border rounded-md border border-border", children: colonnes.map((col) => {
18940
+ const value = ligne[col.champ] ?? null;
18941
+ const correction = corrections?.[col.champ];
18942
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18943
+ "div",
18944
+ {
18945
+ "data-field": col.champ,
18946
+ className: `grid gap-1 px-3 py-2 sm:grid-cols-[11rem_1fr] sm:gap-3 ${correction ? "bg-amber-50 dark:bg-amber-950/30" : ""}`,
18947
+ children: [
18948
+ /* @__PURE__ */ jsxRuntime.jsxs("dt", { className: "text-muted-foreground", children: [
18949
+ col.libelle,
18950
+ " ",
18951
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs", children: [
18952
+ "\xB7 ",
18953
+ col.lettre
18954
+ ] })
18955
+ ] }),
18956
+ /* @__PURE__ */ jsxRuntime.jsxs("dd", { className: "flex min-w-0 flex-col gap-1", children: [
18957
+ editing === col.champ ? /* @__PURE__ */ jsxRuntime.jsx(
18958
+ FieldEditor,
18959
+ {
18960
+ col,
18961
+ initial: editValue(value, decimalSeparator),
18962
+ labels,
18963
+ onCancel: () => setEditing(null),
18964
+ onSave: async (saisie) => {
18965
+ if (await onSaveField(col.champ, saisie)) setEditing(null);
18966
+ }
18967
+ }
18968
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
18969
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words tabular-nums", children: displayValue(col, value) }),
18970
+ col.editable ? /* @__PURE__ */ jsxRuntime.jsx(
18971
+ "button",
18972
+ {
18973
+ type: "button",
18974
+ "aria-label": labels.edit(col.libelle),
18975
+ onClick: () => setEditing(col.champ),
18976
+ className: PENCIL_CLASS,
18977
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "size-3.5", "aria-hidden": "true" })
18978
+ }
18979
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: labels.computed })
18980
+ ] }),
18981
+ correction && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-amber-800 dark:text-amber-300", children: labels.correction(correction) })
18982
+ ] })
18983
+ ]
18984
+ },
18985
+ col.champ
18986
+ );
18987
+ }) });
18988
+ }
18508
18989
 
18509
18990
  Object.defineProperty(exports, "Accordion", {
18510
18991
  enumerable: true,
@@ -18514,6 +18995,8 @@ Object.defineProperty(exports, "Tooltip", {
18514
18995
  enumerable: true,
18515
18996
  get: function () { return tooltip.Tooltip; }
18516
18997
  });
18998
+ exports.ChoixColonnes = ChoixColonnes;
18999
+ exports.GrilleRegistre = GrilleRegistre;
18517
19000
  exports.INITIAL_REVIEW_PANEL_TAB = INITIAL_REVIEW_PANEL_TAB;
18518
19001
  exports.MosaicAccordion = MosaicAccordion;
18519
19002
  exports.MosaicAccordionItem = MosaicAccordionItem;
@@ -18707,8 +19190,11 @@ exports.MosaicTooltipRoot = MosaicTooltipRoot;
18707
19190
  exports.MosaicTooltipTrigger = MosaicTooltipTrigger;
18708
19191
  exports.MosaicUrlScraper = MosaicUrlScraper;
18709
19192
  exports.MosaicUserButton = MosaicUserButton;
19193
+ exports.PanneauRegistreShell = PanneauRegistreShell;
18710
19194
  exports.Placeholder = Placeholder;
18711
19195
  exports.REVIEW_PANEL_TABS = REVIEW_PANEL_TABS;
19196
+ exports.RegistreEcran = RegistreEcran;
19197
+ exports.RegistreLigneDetail = RegistreLigneDetail;
18712
19198
  exports.addMemoryFormButtonVariants = addMemoryFormButtonVariants;
18713
19199
  exports.addMemoryFormErrorVariants = addMemoryFormErrorVariants;
18714
19200
  exports.addMemoryFormFieldVariants = addMemoryFormFieldVariants;
@@ -18749,6 +19235,8 @@ exports.editSessionDialogErrorVariants = editSessionDialogErrorVariants;
18749
19235
  exports.editSessionDialogFieldVariants = editSessionDialogFieldVariants;
18750
19236
  exports.editSessionDialogFooterVariants = editSessionDialogFooterVariants;
18751
19237
  exports.editableCellVariants = editableCellVariants;
19238
+ exports.estVisible = estVisible;
19239
+ exports.fitGridWidthStrategy = fitGridWidthStrategy;
18752
19240
  exports.initialColumnVisibility = initialColumnVisibility;
18753
19241
  exports.isEditableTarget = isEditableTarget;
18754
19242
  exports.marketplaceCardVariants = marketplaceCardVariants;
@@ -18769,6 +19257,8 @@ exports.pdfViewerFrameVariants = pdfViewerFrameVariants;
18769
19257
  exports.pdfViewerStatusVariants = pdfViewerStatusVariants;
18770
19258
  exports.pdfViewerToolbarButtonVariants = pdfViewerToolbarButtonVariants;
18771
19259
  exports.popoverPopupVariants = popoverPopupVariants;
19260
+ exports.refitColumns = refitColumns;
19261
+ exports.registreGridTheme = registreGridTheme;
18772
19262
  exports.replyInputActionButtonVariants = replyInputActionButtonVariants;
18773
19263
  exports.replyInputContextVariants = replyInputContextVariants;
18774
19264
  exports.replyInputRootVariants = replyInputRootVariants;