@vantageos/mosaic-blocks 0.5.36-alpha → 0.5.38-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 +553 -49
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +191 -2
  5. package/dist/index.d.ts +191 -2
  6. package/dist/index.js +546 -51
  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 +6 -6
  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/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.38-alpha";
52
56
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
53
57
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
54
58
  }
@@ -18224,6 +18228,86 @@ function MosaicAdminOnlyGuard(props) {
18224
18228
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
18225
18229
  }
18226
18230
  MosaicAdminOnlyGuard.displayName = "MosaicAdminOnlyGuard";
18231
+ var registreGridTheme = agGridCommunity.themeQuartz.withParams({
18232
+ accentColor: "var(--accent)",
18233
+ backgroundColor: "var(--surface)",
18234
+ foregroundColor: "var(--foreground)",
18235
+ textColor: "var(--foreground)",
18236
+ borderColor: "var(--border)",
18237
+ headerBackgroundColor: "var(--surface-secondary)",
18238
+ headerTextColor: "var(--surface-secondary-foreground)",
18239
+ headerFontWeight: 600,
18240
+ fontFamily: "var(--font-sans)",
18241
+ fontSize: 14,
18242
+ headerFontSize: 13,
18243
+ rowHeight: 40,
18244
+ headerHeight: 44,
18245
+ spacing: 8,
18246
+ wrapperBorderRadius: 8,
18247
+ rowHoverColor: "var(--surface-hover)"
18248
+ // No `selectedRowBackgroundColor`: the grid does not use the native AG Grid row
18249
+ // selection. A host highlights its selected row through `getRowStyle`.
18250
+ });
18251
+ var fitGridWidthStrategy = {
18252
+ type: "fitGridWidth"
18253
+ };
18254
+ function refitColumns(e) {
18255
+ e.api.sizeColumnsToFit();
18256
+ }
18257
+ var modulesRegistered = false;
18258
+ function ensureModules() {
18259
+ if (modulesRegistered) return;
18260
+ agGridCommunity.ModuleRegistry.registerModules([agGridCommunity.AllCommunityModule]);
18261
+ modulesRegistered = true;
18262
+ }
18263
+ var DEFAUTS = {
18264
+ resizable: true,
18265
+ sortable: true,
18266
+ filter: true,
18267
+ floatingFilter: true
18268
+ };
18269
+ function GrilleRegistre({
18270
+ lignes,
18271
+ columnDefs,
18272
+ getRowId,
18273
+ filtreGlobal,
18274
+ theme = registreGridTheme,
18275
+ onGridReady,
18276
+ onCelluleEditee,
18277
+ getRowStyle,
18278
+ tooltipShowDelay,
18279
+ suppressCellFocus,
18280
+ onCellClicked,
18281
+ rowHeight,
18282
+ domLayout,
18283
+ onGridSizeChanged,
18284
+ messageVide
18285
+ }) {
18286
+ ensureModules();
18287
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "isolate h-full min-h-0 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
18288
+ agGridReact.AgGridReact,
18289
+ {
18290
+ theme,
18291
+ autoSizeStrategy: fitGridWidthStrategy,
18292
+ rowData: lignes,
18293
+ columnDefs,
18294
+ defaultColDef: DEFAUTS,
18295
+ quickFilterText: filtreGlobal,
18296
+ getRowId: (p) => getRowId(p.data),
18297
+ onGridReady,
18298
+ onCellValueChanged: onCelluleEditee,
18299
+ onCellClicked,
18300
+ getRowStyle,
18301
+ tooltipShowDelay,
18302
+ suppressCellFocus,
18303
+ rowHeight,
18304
+ domLayout,
18305
+ onGridSizeChanged,
18306
+ overlayComponentParams: messageVide === void 0 ? void 0 : { noRows: { overlayText: messageVide } },
18307
+ animateRows: true
18308
+ }
18309
+ ) });
18310
+ }
18227
18311
 
18228
18312
  // src/components/document-review/panel-tab.ts
18229
18313
  var REVIEW_PANEL_TABS = ["compare", "document", "row"];
@@ -18304,6 +18388,22 @@ function correctionOutcome(result) {
18304
18388
  if (!result.ok) return "failed";
18305
18389
  return result.confirmed ? "ok" : "uncertain";
18306
18390
  }
18391
+ var SelectedRowIdContext = React30.createContext(null);
18392
+ function OpenRowButton({ value, node }) {
18393
+ const selectedRowId = React30.useContext(SelectedRowIdContext);
18394
+ const isSelected = node.id !== void 0 && node.id === selectedRowId;
18395
+ return /* @__PURE__ */ jsxRuntime.jsx(
18396
+ "button",
18397
+ {
18398
+ type: "button",
18399
+ "data-slot": "document-table-open",
18400
+ "aria-current": isSelected ? "true" : void 0,
18401
+ "data-selected": isSelected ? "true" : void 0,
18402
+ className: "text-left underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18403
+ children: value
18404
+ }
18405
+ );
18406
+ }
18307
18407
  function MosaicDocumentTable({
18308
18408
  columns,
18309
18409
  rows,
@@ -18322,57 +18422,53 @@ function MosaicDocumentTable({
18322
18422
  if (!isControlled) setInternalSelectedRowId(rowId);
18323
18423
  onSelectedRowChange?.(rowId);
18324
18424
  }
18325
- const shown = visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns));
18326
- const tableColumns = shown.map((column, columnIndex) => ({
18327
- key: column.id,
18328
- header: column.label,
18329
- render: (row) => {
18330
- const value = column.accessor(row);
18331
- const text = value === null ? "" : String(value);
18332
- if (columnIndex !== 0) return text;
18333
- const isSelected = getRowId(row) === selectedRowId;
18334
- return /* @__PURE__ */ jsxRuntime.jsx(
18335
- "button",
18336
- {
18337
- type: "button",
18338
- "data-slot": "document-table-open",
18339
- "aria-current": isSelected ? "true" : void 0,
18340
- "data-selected": isSelected ? "true" : void 0,
18341
- className: "text-left underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18342
- children: text
18343
- }
18344
- );
18345
- }
18346
- }));
18347
- function handleClick(event) {
18348
- const tr = event.target.closest("tr[data-slot='data-table-row']");
18349
- if (!(tr instanceof HTMLTableRowElement)) return;
18350
- const row = rows[tr.sectionRowIndex];
18351
- if (row !== void 0) select(getRowId(row));
18425
+ const columnDefs = React30.useMemo(
18426
+ () => visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns)).map(
18427
+ (column, columnIndex) => ({
18428
+ colId: column.id,
18429
+ headerName: column.label,
18430
+ // The column model's value, as text: null reads as an empty cell.
18431
+ valueGetter: (params) => {
18432
+ if (params.data === void 0) return "";
18433
+ const value = column.accessor(params.data);
18434
+ return value === null ? "" : String(value);
18435
+ },
18436
+ // No type inference: a boolean stays text, never a grid checkbox.
18437
+ cellDataType: false,
18438
+ sortable: false,
18439
+ filter: false,
18440
+ floatingFilter: false,
18441
+ ...columnIndex === 0 ? { cellRenderer: OpenRowButton } : {}
18442
+ })
18443
+ ),
18444
+ [columns, columnVisibility]
18445
+ );
18446
+ function handleCellClicked(event) {
18447
+ if (event.data !== void 0) select(getRowId(event.data));
18352
18448
  }
18353
18449
  const orderedRowIds = rows.map(getRowId);
18354
18450
  const selectedRow = selectedRowId === null ? void 0 : rows.find((row) => getRowId(row) === selectedRowId);
18355
- return (
18356
- // biome-ignore lint/a11y/useKeyWithClickEvents: keyboard path is the first column's real <button>; this only resolves mouse clicks on other cells to their row
18357
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "document-table", className, onClick: handleClick, children: [
18358
- /* @__PURE__ */ jsxRuntime.jsx(
18359
- MosaicDataTable,
18360
- {
18361
- columns: tableColumns,
18362
- rows,
18363
- getRowKey: (row) => getRowId(row),
18364
- sortable: false,
18365
- emptyMessage
18366
- }
18367
- ),
18368
- selectedRow !== void 0 && renderPanel ? renderPanel(selectedRow, {
18369
- rowId: getRowId(selectedRow),
18370
- orderedRowIds,
18371
- selectRow: (rowId) => select(rowId),
18372
- closeRow: () => select(null)
18373
- }) : null
18374
- ] })
18375
- );
18451
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "document-table", className, children: [
18452
+ /* @__PURE__ */ jsxRuntime.jsx(SelectedRowIdContext.Provider, { value: selectedRowId, children: /* @__PURE__ */ jsxRuntime.jsx(
18453
+ GrilleRegistre,
18454
+ {
18455
+ lignes: rows,
18456
+ columnDefs,
18457
+ getRowId,
18458
+ onCellClicked: handleCellClicked,
18459
+ suppressCellFocus: true,
18460
+ domLayout: "autoHeight",
18461
+ onGridSizeChanged: refitColumns,
18462
+ messageVide: emptyMessage
18463
+ }
18464
+ ) }),
18465
+ selectedRow !== void 0 && renderPanel ? renderPanel(selectedRow, {
18466
+ rowId: getRowId(selectedRow),
18467
+ orderedRowIds,
18468
+ selectRow: (rowId) => select(rowId),
18469
+ closeRow: () => select(null)
18470
+ }) : null
18471
+ ] });
18376
18472
  }
18377
18473
  MosaicDocumentTable.displayName = "MosaicDocumentTable";
18378
18474
  function MosaicDocumentCriteriaPanel({
@@ -18505,6 +18601,405 @@ function MosaicDocumentCriteriaPanel({
18505
18601
  );
18506
18602
  }
18507
18603
  MosaicDocumentCriteriaPanel.displayName = "MosaicDocumentCriteriaPanel";
18604
+ var DEFAULT_WIDTH_RATIO = 0.45;
18605
+ var MIN_WIDTH_PX = 360;
18606
+ var MAX_WIDTH_RATIO = 0.9;
18607
+ var CSS_RULES = {
18608
+ // allow-hardcoded-word: a CSS rule (the scoped width variable), not user-facing text
18609
+ width: (px) => `.panneau-registre-shell { --panneau-registre-width: ${px}px; }`
18610
+ };
18611
+ function PanneauRegistreShell({
18612
+ open,
18613
+ onOpenChange,
18614
+ labels,
18615
+ ariaLabel,
18616
+ contexte,
18617
+ headerActions,
18618
+ forceWidthRatio = null,
18619
+ onPrev,
18620
+ onNext,
18621
+ prevDisabled,
18622
+ nextDisabled,
18623
+ children
18624
+ }) {
18625
+ const [widthPx, setWidthPx] = React30.useState(null);
18626
+ const dragStart = React30.useRef(null);
18627
+ React30.useEffect(() => {
18628
+ if (widthPx !== null || typeof window === "undefined") return;
18629
+ setWidthPx(Math.round(window.innerWidth * DEFAULT_WIDTH_RATIO));
18630
+ }, [widthPx]);
18631
+ const onPointerMove = React30.useCallback((e) => {
18632
+ const drag = dragStart.current;
18633
+ if (!drag) return;
18634
+ const dx = drag.x - e.clientX;
18635
+ const maxWidth = window.innerWidth * MAX_WIDTH_RATIO;
18636
+ setWidthPx(Math.min(maxWidth, Math.max(MIN_WIDTH_PX, drag.width + dx)));
18637
+ }, []);
18638
+ const onPointerUp = React30.useCallback(() => {
18639
+ dragStart.current = null;
18640
+ window.removeEventListener("pointermove", onPointerMove);
18641
+ window.removeEventListener("pointerup", onPointerUp);
18642
+ }, [onPointerMove]);
18643
+ const onHandlePointerDown = React30.useCallback(
18644
+ (e) => {
18645
+ dragStart.current = {
18646
+ x: e.clientX,
18647
+ width: widthPx ?? Math.round(window.innerWidth * DEFAULT_WIDTH_RATIO)
18648
+ };
18649
+ window.addEventListener("pointermove", onPointerMove);
18650
+ window.addEventListener("pointerup", onPointerUp);
18651
+ },
18652
+ [widthPx, onPointerMove, onPointerUp]
18653
+ );
18654
+ React30.useEffect(() => () => onPointerUp(), [onPointerUp]);
18655
+ React30.useEffect(() => {
18656
+ if (!open) return;
18657
+ function onKeyDown(e) {
18658
+ if (isEditableTarget(e.target)) return;
18659
+ if (e.key === "ArrowUp" && !prevDisabled) {
18660
+ e.preventDefault();
18661
+ onPrev();
18662
+ } else if (e.key === "ArrowDown" && !nextDisabled) {
18663
+ e.preventDefault();
18664
+ onNext();
18665
+ }
18666
+ }
18667
+ window.addEventListener("keydown", onKeyDown, true);
18668
+ return () => window.removeEventListener("keydown", onKeyDown, true);
18669
+ }, [open, prevDisabled, nextDisabled, onPrev, onNext]);
18670
+ const resolvedWidth = forceWidthRatio !== null && typeof window !== "undefined" ? Math.round(window.innerWidth * forceWidthRatio) : widthPx ?? MIN_WIDTH_PX;
18671
+ const widthRule = CSS_RULES.width(resolvedWidth);
18672
+ 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: [
18673
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: widthRule }),
18674
+ /* @__PURE__ */ jsxRuntime.jsxs(
18675
+ react.Drawer.Dialog,
18676
+ {
18677
+ "aria-label": ariaLabel,
18678
+ 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]!",
18679
+ children: [
18680
+ /* @__PURE__ */ jsxRuntime.jsx(
18681
+ "button",
18682
+ {
18683
+ type: "button",
18684
+ "aria-label": labels.resizeHandle,
18685
+ className: "absolute inset-y-0 left-0 hidden w-1.5 cursor-col-resize touch-none bg-transparent hover:bg-border sm:block",
18686
+ onPointerDown: onHandlePointerDown
18687
+ }
18688
+ ),
18689
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Header, { className: "flex shrink-0 flex-row items-center justify-between gap-3", children: [
18690
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 truncate text-sm text-muted-foreground", children: contexte }),
18691
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 flex-row items-center gap-2", children: [
18692
+ headerActions,
18693
+ /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.CloseTrigger, { "aria-label": labels.close })
18694
+ ] })
18695
+ ] }),
18696
+ children,
18697
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Drawer.Footer, { className: "flex shrink-0 flex-row items-center justify-end gap-2", children: [
18698
+ /* @__PURE__ */ jsxRuntime.jsx(
18699
+ react.Button,
18700
+ {
18701
+ variant: "outline",
18702
+ size: "sm",
18703
+ isIconOnly: true,
18704
+ "aria-label": labels.previousRow,
18705
+ isDisabled: prevDisabled,
18706
+ onPress: onPrev,
18707
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4", "aria-hidden": "true" })
18708
+ }
18709
+ ),
18710
+ /* @__PURE__ */ jsxRuntime.jsx(
18711
+ react.Button,
18712
+ {
18713
+ variant: "outline",
18714
+ size: "sm",
18715
+ isIconOnly: true,
18716
+ "aria-label": labels.nextRow,
18717
+ isDisabled: nextDisabled,
18718
+ onPress: onNext,
18719
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4", "aria-hidden": "true" })
18720
+ }
18721
+ )
18722
+ ] })
18723
+ ]
18724
+ }
18725
+ )
18726
+ ] }) }) });
18727
+ }
18728
+
18729
+ // src/components/registre/colonnes.ts
18730
+ function estVisible(etat, champ) {
18731
+ return etat[champ] !== false;
18732
+ }
18733
+ var OPTION_CLASS = "flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-default";
18734
+ function ChoixColonnes({
18735
+ colonnes,
18736
+ visibilite,
18737
+ onBasculer,
18738
+ labels,
18739
+ formatLibelle = (libelle) => libelle,
18740
+ ouvertParDefaut = false
18741
+ }) {
18742
+ const [ouvert, setOuvert] = React30.useState(ouvertParDefaut);
18743
+ const nbMasquees = colonnes.filter((c) => !estVisible(visibilite, c.champ)).length;
18744
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Popover, { isOpen: ouvert, onOpenChange: setOuvert, children: [
18745
+ /* @__PURE__ */ jsxRuntime.jsx(react.Button, { variant: "outline", size: "sm", children: labels.columnsButton(nbMasquees) }),
18746
+ /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Content, { placement: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Dialog, { children: /* @__PURE__ */ jsxRuntime.jsx(
18747
+ "fieldset",
18748
+ {
18749
+ "aria-label": labels.columnsGroupAriaLabel,
18750
+ className: "z-50 max-h-[60vh] w-72 overflow-y-auto border-0 p-1",
18751
+ children: colonnes.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
18752
+ react.Checkbox,
18753
+ {
18754
+ isSelected: estVisible(visibilite, c.champ),
18755
+ onChange: () => onBasculer(c.champ),
18756
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.Checkbox.Content, { className: OPTION_CLASS, children: [
18757
+ /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox.Indicator, {}) }),
18758
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-4 tabular-nums text-muted-foreground", children: c.lettre }),
18759
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatLibelle(c.libelle) })
18760
+ ] })
18761
+ },
18762
+ c.champ
18763
+ ))
18764
+ }
18765
+ ) }) })
18766
+ ] });
18767
+ }
18768
+ var CSS_SELECTORS = {
18769
+ // allow-hardcoded-word: a CSS attribute selector (HeroUI data-slot names), not user-facing text
18770
+ openOverlay: "[data-slot=select-popover], [data-slot=popover-dialog]"
18771
+ };
18772
+ function RegistreEcran({
18773
+ ariaLabel,
18774
+ labels,
18775
+ colonnes,
18776
+ visibilite,
18777
+ onBasculerColonne,
18778
+ formatLibelleColonne,
18779
+ filtreGlobal,
18780
+ onFiltreGlobalChange,
18781
+ avantRecherche,
18782
+ actionsToolbar,
18783
+ children
18784
+ }) {
18785
+ const [fullScreen, setFullScreen] = React30.useState(false);
18786
+ React30.useEffect(() => {
18787
+ if (!fullScreen) return;
18788
+ const onKeyDown = (e) => {
18789
+ if (document.querySelector(CSS_SELECTORS.openOverlay)) return;
18790
+ if (e.key === "Escape") setFullScreen(false);
18791
+ };
18792
+ const previousOverflow = document.body.style.overflow;
18793
+ document.body.style.overflow = "hidden";
18794
+ window.addEventListener("keydown", onKeyDown);
18795
+ return () => {
18796
+ window.removeEventListener("keydown", onKeyDown);
18797
+ document.body.style.overflow = previousOverflow;
18798
+ };
18799
+ }, [fullScreen]);
18800
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18801
+ "section",
18802
+ {
18803
+ "aria-label": ariaLabel,
18804
+ "data-fullscreen": fullScreen ? "true" : void 0,
18805
+ className: fullScreen ? "fixed inset-0 z-40 flex flex-col gap-4 bg-background p-4" : (
18806
+ // Phones let the page scroll so content above cannot squeeze the grid to nothing.
18807
+ "flex min-h-[70vh] flex-1 flex-col gap-4 sm:min-h-0"
18808
+ ),
18809
+ children: [
18810
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsxs(react.Toolbar, { className: "flex flex-wrap items-center gap-2", children: [
18811
+ avantRecherche,
18812
+ /* @__PURE__ */ jsxRuntime.jsx(
18813
+ react.SearchField,
18814
+ {
18815
+ value: filtreGlobal,
18816
+ onChange: onFiltreGlobalChange,
18817
+ "aria-label": labels.searchAriaLabel,
18818
+ className: "w-full sm:w-auto",
18819
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.SearchField.Group, { className: "h-10 min-w-64", children: [
18820
+ /* @__PURE__ */ jsxRuntime.jsx(react.SearchField.SearchIcon, {}),
18821
+ /* @__PURE__ */ jsxRuntime.jsx(
18822
+ react.SearchField.Input,
18823
+ {
18824
+ placeholder: labels.searchPlaceholder,
18825
+ className: "text-base sm:text-sm"
18826
+ }
18827
+ ),
18828
+ /* @__PURE__ */ jsxRuntime.jsx(react.SearchField.ClearButton, {})
18829
+ ] })
18830
+ }
18831
+ ),
18832
+ /* @__PURE__ */ jsxRuntime.jsx(
18833
+ ChoixColonnes,
18834
+ {
18835
+ colonnes,
18836
+ visibilite,
18837
+ onBasculer: onBasculerColonne,
18838
+ labels,
18839
+ formatLibelle: formatLibelleColonne
18840
+ }
18841
+ ),
18842
+ actionsToolbar,
18843
+ /* @__PURE__ */ jsxRuntime.jsxs(
18844
+ react.Button,
18845
+ {
18846
+ variant: "outline",
18847
+ size: "sm",
18848
+ "aria-pressed": fullScreen,
18849
+ onPress: () => setFullScreen((f) => !f),
18850
+ children: [
18851
+ fullScreen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minimize2, { "aria-hidden": true, className: "size-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, { "aria-hidden": true, className: "size-4" }),
18852
+ fullScreen ? labels.exitFullscreen : labels.enterFullscreen
18853
+ ]
18854
+ }
18855
+ )
18856
+ ] }) }),
18857
+ children
18858
+ ]
18859
+ }
18860
+ );
18861
+ }
18862
+ function editValue(value, decimalSeparator) {
18863
+ if (value == null) return "";
18864
+ return typeof value === "number" ? String(value).replace(".", decimalSeparator) : value;
18865
+ }
18866
+ function FieldEditor({
18867
+ col,
18868
+ initial,
18869
+ labels,
18870
+ onSave,
18871
+ onCancel
18872
+ }) {
18873
+ const [draft, setDraft] = React30.useState(initial);
18874
+ const [saving, setSaving] = React30.useState(false);
18875
+ const inputId = `registre-field-${col.champ}`;
18876
+ const label = labels.fieldInput(col);
18877
+ async function submit(e) {
18878
+ e.preventDefault();
18879
+ setSaving(true);
18880
+ await onSave(draft);
18881
+ setSaving(false);
18882
+ }
18883
+ function onKeyDown(e) {
18884
+ if (e.key === "Escape") {
18885
+ e.stopPropagation();
18886
+ onCancel();
18887
+ }
18888
+ }
18889
+ const inputClass = "h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-base sm:text-sm";
18890
+ return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, onKeyDown, className: "flex flex-wrap items-center gap-2", children: [
18891
+ col.valeurs ? /* @__PURE__ */ jsxRuntime.jsxs(
18892
+ "select",
18893
+ {
18894
+ id: inputId,
18895
+ "aria-label": label,
18896
+ value: draft,
18897
+ onChange: (e) => setDraft(e.target.value),
18898
+ className: inputClass,
18899
+ children: [
18900
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "\u2014" }),
18901
+ col.valeurs.map((v) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: v, children: v }, v))
18902
+ ]
18903
+ }
18904
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
18905
+ "input",
18906
+ {
18907
+ id: inputId,
18908
+ "aria-label": label,
18909
+ value: draft,
18910
+ onChange: (e) => setDraft(e.target.value),
18911
+ autoFocus: true,
18912
+ className: inputClass
18913
+ }
18914
+ ),
18915
+ /* @__PURE__ */ jsxRuntime.jsx(
18916
+ "button",
18917
+ {
18918
+ type: "submit",
18919
+ disabled: saving,
18920
+ className: "h-8 rounded-md bg-primary px-3 text-sm text-primary-foreground disabled:opacity-50",
18921
+ children: labels.save
18922
+ }
18923
+ ),
18924
+ /* @__PURE__ */ jsxRuntime.jsx(
18925
+ "button",
18926
+ {
18927
+ type: "button",
18928
+ onClick: onCancel,
18929
+ className: "h-8 rounded-md border border-border px-3 text-sm",
18930
+ children: labels.cancel
18931
+ }
18932
+ )
18933
+ ] });
18934
+ }
18935
+ var PENCIL_CLASS = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-default hover:text-foreground";
18936
+ function RegistreLigneDetail({
18937
+ colonnes,
18938
+ ligne,
18939
+ corrections,
18940
+ labels,
18941
+ formatMontant,
18942
+ formatNombre,
18943
+ decimalSeparator,
18944
+ onSaveField
18945
+ }) {
18946
+ const [editing, setEditing] = React30.useState(null);
18947
+ function displayValue(col, value) {
18948
+ if (value == null || value === "") return "";
18949
+ if (col.type === "montant") return formatMontant(Number(value));
18950
+ if (col.type === "nombre" || col.type === "entier") return formatNombre(Number(value));
18951
+ return String(value);
18952
+ }
18953
+ return /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "divide-y divide-border rounded-md border border-border", children: colonnes.map((col) => {
18954
+ const value = ligne[col.champ] ?? null;
18955
+ const correction = corrections?.[col.champ];
18956
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18957
+ "div",
18958
+ {
18959
+ "data-field": col.champ,
18960
+ 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" : ""}`,
18961
+ children: [
18962
+ /* @__PURE__ */ jsxRuntime.jsxs("dt", { className: "text-muted-foreground", children: [
18963
+ col.libelle,
18964
+ " ",
18965
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs", children: [
18966
+ "\xB7 ",
18967
+ col.lettre
18968
+ ] })
18969
+ ] }),
18970
+ /* @__PURE__ */ jsxRuntime.jsxs("dd", { className: "flex min-w-0 flex-col gap-1", children: [
18971
+ editing === col.champ ? /* @__PURE__ */ jsxRuntime.jsx(
18972
+ FieldEditor,
18973
+ {
18974
+ col,
18975
+ initial: editValue(value, decimalSeparator),
18976
+ labels,
18977
+ onCancel: () => setEditing(null),
18978
+ onSave: async (saisie) => {
18979
+ if (await onSaveField(col.champ, saisie)) setEditing(null);
18980
+ }
18981
+ }
18982
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
18983
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words tabular-nums", children: displayValue(col, value) }),
18984
+ col.editable ? /* @__PURE__ */ jsxRuntime.jsx(
18985
+ "button",
18986
+ {
18987
+ type: "button",
18988
+ "aria-label": labels.edit(col.libelle),
18989
+ onClick: () => setEditing(col.champ),
18990
+ className: PENCIL_CLASS,
18991
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "size-3.5", "aria-hidden": "true" })
18992
+ }
18993
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: labels.computed })
18994
+ ] }),
18995
+ correction && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-amber-800 dark:text-amber-300", children: labels.correction(correction) })
18996
+ ] })
18997
+ ]
18998
+ },
18999
+ col.champ
19000
+ );
19001
+ }) });
19002
+ }
18508
19003
 
18509
19004
  Object.defineProperty(exports, "Accordion", {
18510
19005
  enumerable: true,
@@ -18514,6 +19009,8 @@ Object.defineProperty(exports, "Tooltip", {
18514
19009
  enumerable: true,
18515
19010
  get: function () { return tooltip.Tooltip; }
18516
19011
  });
19012
+ exports.ChoixColonnes = ChoixColonnes;
19013
+ exports.GrilleRegistre = GrilleRegistre;
18517
19014
  exports.INITIAL_REVIEW_PANEL_TAB = INITIAL_REVIEW_PANEL_TAB;
18518
19015
  exports.MosaicAccordion = MosaicAccordion;
18519
19016
  exports.MosaicAccordionItem = MosaicAccordionItem;
@@ -18707,8 +19204,11 @@ exports.MosaicTooltipRoot = MosaicTooltipRoot;
18707
19204
  exports.MosaicTooltipTrigger = MosaicTooltipTrigger;
18708
19205
  exports.MosaicUrlScraper = MosaicUrlScraper;
18709
19206
  exports.MosaicUserButton = MosaicUserButton;
19207
+ exports.PanneauRegistreShell = PanneauRegistreShell;
18710
19208
  exports.Placeholder = Placeholder;
18711
19209
  exports.REVIEW_PANEL_TABS = REVIEW_PANEL_TABS;
19210
+ exports.RegistreEcran = RegistreEcran;
19211
+ exports.RegistreLigneDetail = RegistreLigneDetail;
18712
19212
  exports.addMemoryFormButtonVariants = addMemoryFormButtonVariants;
18713
19213
  exports.addMemoryFormErrorVariants = addMemoryFormErrorVariants;
18714
19214
  exports.addMemoryFormFieldVariants = addMemoryFormFieldVariants;
@@ -18749,6 +19249,8 @@ exports.editSessionDialogErrorVariants = editSessionDialogErrorVariants;
18749
19249
  exports.editSessionDialogFieldVariants = editSessionDialogFieldVariants;
18750
19250
  exports.editSessionDialogFooterVariants = editSessionDialogFooterVariants;
18751
19251
  exports.editableCellVariants = editableCellVariants;
19252
+ exports.estVisible = estVisible;
19253
+ exports.fitGridWidthStrategy = fitGridWidthStrategy;
18752
19254
  exports.initialColumnVisibility = initialColumnVisibility;
18753
19255
  exports.isEditableTarget = isEditableTarget;
18754
19256
  exports.marketplaceCardVariants = marketplaceCardVariants;
@@ -18769,6 +19271,8 @@ exports.pdfViewerFrameVariants = pdfViewerFrameVariants;
18769
19271
  exports.pdfViewerStatusVariants = pdfViewerStatusVariants;
18770
19272
  exports.pdfViewerToolbarButtonVariants = pdfViewerToolbarButtonVariants;
18771
19273
  exports.popoverPopupVariants = popoverPopupVariants;
19274
+ exports.refitColumns = refitColumns;
19275
+ exports.registreGridTheme = registreGridTheme;
18772
19276
  exports.replyInputActionButtonVariants = replyInputActionButtonVariants;
18773
19277
  exports.replyInputContextVariants = replyInputContextVariants;
18774
19278
  exports.replyInputRootVariants = replyInputRootVariants;