@vantageos/mosaic 0.3.0-alpha.1 → 0.3.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +12 -0
  3. package/dist/{Alert.schema-BQsZGG6P.d.cts → Alert.schema-LPJE5gFP.d.cts} +31 -1
  4. package/dist/{Alert.schema-BQsZGG6P.d.ts → Alert.schema-LPJE5gFP.d.ts} +31 -1
  5. package/dist/MarkdownRenderer.schema-Rx7kIeVA.d.cts +22 -0
  6. package/dist/MarkdownRenderer.schema-Rx7kIeVA.d.ts +22 -0
  7. package/dist/ProgressBar.schema-CdVYx0Wq.d.cts +22 -0
  8. package/dist/ProgressBar.schema-CdVYx0Wq.d.ts +22 -0
  9. package/dist/StatusBadge.schema-1tOjB4Ir.d.cts +22 -0
  10. package/dist/StatusBadge.schema-1tOjB4Ir.d.ts +22 -0
  11. package/dist/artifacts.cjs +126 -2
  12. package/dist/artifacts.cjs.map +1 -1
  13. package/dist/artifacts.d.cts +3 -21
  14. package/dist/artifacts.d.ts +3 -21
  15. package/dist/artifacts.js +126 -2
  16. package/dist/artifacts.js.map +1 -1
  17. package/dist/confirmation.cjs +126 -2
  18. package/dist/confirmation.cjs.map +1 -1
  19. package/dist/confirmation.d.cts +3 -32
  20. package/dist/confirmation.d.ts +3 -32
  21. package/dist/confirmation.js +126 -2
  22. package/dist/confirmation.js.map +1 -1
  23. package/dist/display.cjs +129 -2
  24. package/dist/display.cjs.map +1 -1
  25. package/dist/display.d.cts +132 -2
  26. package/dist/display.d.ts +132 -2
  27. package/dist/display.js +129 -2
  28. package/dist/display.js.map +1 -1
  29. package/dist/forms.cjs +20 -17
  30. package/dist/forms.cjs.map +1 -1
  31. package/dist/forms.js +20 -17
  32. package/dist/forms.js.map +1 -1
  33. package/dist/index.cjs +129 -2
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +9 -7
  36. package/dist/index.d.ts +9 -7
  37. package/dist/index.js +129 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/media.cjs +126 -2
  40. package/dist/media.cjs.map +1 -1
  41. package/dist/media.d.cts +3 -21
  42. package/dist/media.d.ts +3 -21
  43. package/dist/media.js +126 -2
  44. package/dist/media.js.map +1 -1
  45. package/dist/preact/artifacts.d.ts +39 -1
  46. package/dist/preact/artifacts.js +234 -0
  47. package/dist/preact/artifacts.js.map +1 -1
  48. package/dist/preact/confirmation.d.ts +31 -1
  49. package/dist/preact/confirmation.js +245 -5
  50. package/dist/preact/confirmation.js.map +1 -1
  51. package/dist/preact/display.d.ts +127 -1
  52. package/dist/preact/display.js +419 -11
  53. package/dist/preact/display.js.map +1 -1
  54. package/dist/preact/forms.js +22 -19
  55. package/dist/preact/forms.js.map +1 -1
  56. package/dist/preact/input.js +2 -2
  57. package/dist/preact/progress.d.ts +35 -1
  58. package/dist/preact/progress.js +263 -0
  59. package/dist/preact/progress.js.map +1 -1
  60. package/dist/progress.cjs +126 -2
  61. package/dist/progress.cjs.map +1 -1
  62. package/dist/progress.d.cts +3 -21
  63. package/dist/progress.d.ts +3 -21
  64. package/dist/progress.js +126 -2
  65. package/dist/progress.js.map +1 -1
  66. package/dist/react/artifacts.cjs +241 -0
  67. package/dist/react/artifacts.cjs.map +1 -1
  68. package/dist/react/artifacts.d.cts +20 -1
  69. package/dist/react/artifacts.d.ts +20 -1
  70. package/dist/react/artifacts.js +234 -0
  71. package/dist/react/artifacts.js.map +1 -1
  72. package/dist/react/confirmation.cjs +248 -2
  73. package/dist/react/confirmation.cjs.map +1 -1
  74. package/dist/react/confirmation.d.cts +3 -3
  75. package/dist/react/confirmation.d.ts +3 -3
  76. package/dist/react/confirmation.js +244 -4
  77. package/dist/react/confirmation.js.map +1 -1
  78. package/dist/react/display.cjs +418 -2
  79. package/dist/react/display.cjs.map +1 -1
  80. package/dist/react/display.d.cts +20 -3
  81. package/dist/react/display.d.ts +20 -3
  82. package/dist/react/display.js +413 -4
  83. package/dist/react/display.js.map +1 -1
  84. package/dist/react/forms.cjs +20 -17
  85. package/dist/react/forms.cjs.map +1 -1
  86. package/dist/react/forms.js +20 -17
  87. package/dist/react/forms.js.map +1 -1
  88. package/dist/react/progress.cjs +266 -0
  89. package/dist/react/progress.cjs.map +1 -1
  90. package/dist/react/progress.d.cts +17 -1
  91. package/dist/react/progress.d.ts +17 -1
  92. package/dist/react/progress.js +263 -0
  93. package/dist/react/progress.js.map +1 -1
  94. package/package.json +231 -228
  95. package/registry.yaml +34 -21
  96. package/dist/Skeleton.schema-BO0ca2UX.d.cts +0 -135
  97. package/dist/Skeleton.schema-BO0ca2UX.d.ts +0 -135
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useVirtualizer } from '@tanstack/react-virtual';
4
- import { useRef, useCallback } from 'react';
4
+ import { useRef, useCallback, useState, useEffect } from 'react';
5
5
 
6
6
  // src/components/display/EmptyState.logic.ts
7
7
  var ACTION_VARIANT_CLASSES = {
@@ -23,6 +23,7 @@ function validateEmptyStateProps(raw) {
23
23
 
24
24
  // src/i18n/strings.ts
25
25
  var EN = {
26
+ // ─── Non-forms components ──────────────────────────────────────────────────
26
27
  "ProgressBar.aria.label": "Progress",
27
28
  "ProgressBar.error.invalidProps": "ProgressBar: invalid props",
28
29
  "ConfirmDialog.button.confirm": "Confirm",
@@ -50,9 +51,71 @@ var EN = {
50
51
  "VirtualList.empty.message": "No items to display",
51
52
  "VirtualList.error.invalidProps": "VirtualList: invalid props",
52
53
  "Skeleton.aria.label": "Loading",
53
- "Skeleton.error.invalidProps": "Skeleton: invalid props"
54
+ "Skeleton.error.invalidProps": "Skeleton: invalid props",
55
+ // ─── Forms — useMosaicForm ─────────────────────────────────────────────────
56
+ "useMosaicForm.error.invalidProps": "useMosaicForm: invalid options",
57
+ // ─── Forms — FormProvider ──────────────────────────────────────────────────
58
+ "FormProvider.error.invalidProps": "FormProvider: invalid props",
59
+ // ─── Forms — FormField ────────────────────────────────────────────────────
60
+ "FormField.error.invalidProps": "FormField: invalid props",
61
+ // ─── Forms — ErrorDisplay ─────────────────────────────────────────────────
62
+ "ErrorDisplay.error.required": "This field is required",
63
+ "ErrorDisplay.error.min": "Value is below the minimum",
64
+ "ErrorDisplay.error.max": "Value exceeds the maximum",
65
+ "ErrorDisplay.error.minLength": "Input is too short",
66
+ "ErrorDisplay.error.maxLength": "Input is too long",
67
+ "ErrorDisplay.error.pattern": "Invalid format",
68
+ "ErrorDisplay.error.email": "Enter a valid email address",
69
+ "ErrorDisplay.error.url": "Enter a valid URL",
70
+ "ErrorDisplay.error.generic": "Invalid value",
71
+ // ─── Forms — SubmitButton ─────────────────────────────────────────────────
72
+ "SubmitButton.aria.submit": "Submit form",
73
+ "SubmitButton.state.loading": "Submitting\u2026",
74
+ "SubmitButton.error.invalidProps": "SubmitButton: invalid props",
75
+ // ─── Forms — Input ────────────────────────────────────────────────────────
76
+ "Input.aria.label": "Input field",
77
+ "Input.error.required": "This field is required",
78
+ "Input.error.invalid": "Invalid value",
79
+ "Input.error.tooLong": "Input is too long",
80
+ "Input.error.tooShort": "Input is too short",
81
+ "Input.error.invalidProps": "Input: invalid props",
82
+ // ─── Forms — Textarea ─────────────────────────────────────────────────────
83
+ "Textarea.aria.label": "Text area",
84
+ "Textarea.error.required": "This field is required",
85
+ "Textarea.error.tooLong": "Text is too long",
86
+ "Textarea.counter.remaining": "characters remaining",
87
+ "Textarea.error.invalidProps": "Textarea: invalid props",
88
+ // ─── Forms — FieldArray ───────────────────────────────────────────────────
89
+ "FieldArray.aria.list": "List of items",
90
+ "FieldArray.aria.addItem": "Add item",
91
+ "FieldArray.aria.removeItem": "Remove item",
92
+ "FieldArray.error.invalidProps": "FieldArray: invalid props",
93
+ // ─── Forms — Checkbox ─────────────────────────────────────────────────────
94
+ "Checkbox.aria.label": "Checkbox",
95
+ "Checkbox.error.required": "This field must be checked",
96
+ "Checkbox.error.invalidProps": "Checkbox: invalid props",
97
+ // ─── Forms — MultiSelect ──────────────────────────────────────────────────
98
+ "MultiSelect.aria.label": "Multi-select field",
99
+ "MultiSelect.aria.removeChip": "Remove",
100
+ "MultiSelect.error.required": "Select at least one option",
101
+ "MultiSelect.error.maxItems": "Maximum number of selections reached",
102
+ "MultiSelect.placeholder": "Select options\u2026",
103
+ "MultiSelect.search.placeholder": "Search\u2026",
104
+ "MultiSelect.empty": "No options available",
105
+ "MultiSelect.error.invalidProps": "MultiSelect: invalid props",
106
+ // ─── Forms — RadioGroup ───────────────────────────────────────────────────
107
+ "RadioGroup.aria.label": "Radio group",
108
+ "RadioGroup.error.required": "Select one option",
109
+ "RadioGroup.error.invalidProps": "RadioGroup: invalid props",
110
+ // ─── Forms — Select ───────────────────────────────────────────────────────
111
+ "Select.placeholder": "Select an option\u2026",
112
+ "Select.search.placeholder": "Search\u2026",
113
+ "Select.empty": "No options available",
114
+ "Select.error.required": "Select an option",
115
+ "Select.error.invalidProps": "Select: invalid props"
54
116
  };
55
117
  var FR = {
118
+ // ─── Non-forms components ──────────────────────────────────────────────────
56
119
  "ProgressBar.aria.label": "Progression",
57
120
  "ProgressBar.error.invalidProps": "ProgressBar : propri\xE9t\xE9s invalides",
58
121
  "ConfirmDialog.button.confirm": "Confirmer",
@@ -80,7 +143,68 @@ var FR = {
80
143
  "VirtualList.empty.message": "Aucun \xE9l\xE9ment \xE0 afficher",
81
144
  "VirtualList.error.invalidProps": "VirtualList : propri\xE9t\xE9s invalides",
82
145
  "Skeleton.aria.label": "Chargement",
83
- "Skeleton.error.invalidProps": "Skeleton : propri\xE9t\xE9s invalides"
146
+ "Skeleton.error.invalidProps": "Skeleton : propri\xE9t\xE9s invalides",
147
+ // ─── Forms — useMosaicForm ─────────────────────────────────────────────────
148
+ "useMosaicForm.error.invalidProps": "useMosaicForm : options invalides",
149
+ // ─── Forms — FormProvider ──────────────────────────────────────────────────
150
+ "FormProvider.error.invalidProps": "FormProvider : propri\xE9t\xE9s invalides",
151
+ // ─── Forms — FormField ────────────────────────────────────────────────────
152
+ "FormField.error.invalidProps": "FormField : propri\xE9t\xE9s invalides",
153
+ // ─── Forms — ErrorDisplay ─────────────────────────────────────────────────
154
+ "ErrorDisplay.error.required": "Ce champ est obligatoire",
155
+ "ErrorDisplay.error.min": "La valeur est inf\xE9rieure au minimum",
156
+ "ErrorDisplay.error.max": "La valeur d\xE9passe le maximum",
157
+ "ErrorDisplay.error.minLength": "La saisie est trop courte",
158
+ "ErrorDisplay.error.maxLength": "La saisie est trop longue",
159
+ "ErrorDisplay.error.pattern": "Format invalide",
160
+ "ErrorDisplay.error.email": "Saisissez une adresse e-mail valide",
161
+ "ErrorDisplay.error.url": "Saisissez une URL valide",
162
+ "ErrorDisplay.error.generic": "Valeur invalide",
163
+ // ─── Forms — SubmitButton ─────────────────────────────────────────────────
164
+ "SubmitButton.aria.submit": "Soumettre le formulaire",
165
+ "SubmitButton.state.loading": "Envoi en cours\u2026",
166
+ "SubmitButton.error.invalidProps": "SubmitButton : propri\xE9t\xE9s invalides",
167
+ // ─── Forms — Input ────────────────────────────────────────────────────────
168
+ "Input.aria.label": "Champ de saisie",
169
+ "Input.error.required": "Ce champ est obligatoire",
170
+ "Input.error.invalid": "Valeur invalide",
171
+ "Input.error.tooLong": "La saisie est trop longue",
172
+ "Input.error.tooShort": "La saisie est trop courte",
173
+ "Input.error.invalidProps": "Input : propri\xE9t\xE9s invalides",
174
+ // ─── Forms — Textarea ─────────────────────────────────────────────────────
175
+ "Textarea.aria.label": "Zone de texte",
176
+ "Textarea.error.required": "Ce champ est obligatoire",
177
+ "Textarea.error.tooLong": "Le texte est trop long",
178
+ "Textarea.counter.remaining": "caract\xE8res restants",
179
+ "Textarea.error.invalidProps": "Textarea : propri\xE9t\xE9s invalides",
180
+ // ─── Forms — FieldArray ───────────────────────────────────────────────────
181
+ "FieldArray.aria.list": "Liste d'\xE9l\xE9ments",
182
+ "FieldArray.aria.addItem": "Ajouter un \xE9l\xE9ment",
183
+ "FieldArray.aria.removeItem": "Supprimer l'\xE9l\xE9ment",
184
+ "FieldArray.error.invalidProps": "FieldArray : propri\xE9t\xE9s invalides",
185
+ // ─── Forms — Checkbox ─────────────────────────────────────────────────────
186
+ "Checkbox.aria.label": "Case \xE0 cocher",
187
+ "Checkbox.error.required": "Ce champ doit \xEAtre coch\xE9",
188
+ "Checkbox.error.invalidProps": "Checkbox : propri\xE9t\xE9s invalides",
189
+ // ─── Forms — MultiSelect ──────────────────────────────────────────────────
190
+ "MultiSelect.aria.label": "Champ de s\xE9lection multiple",
191
+ "MultiSelect.aria.removeChip": "Retirer",
192
+ "MultiSelect.error.required": "S\xE9lectionnez au moins une option",
193
+ "MultiSelect.error.maxItems": "Nombre maximum de s\xE9lections atteint",
194
+ "MultiSelect.placeholder": "S\xE9lectionner des options\u2026",
195
+ "MultiSelect.search.placeholder": "Rechercher\u2026",
196
+ "MultiSelect.empty": "Aucune option disponible",
197
+ "MultiSelect.error.invalidProps": "MultiSelect : propri\xE9t\xE9s invalides",
198
+ // ─── Forms — RadioGroup ───────────────────────────────────────────────────
199
+ "RadioGroup.aria.label": "Groupe de boutons radio",
200
+ "RadioGroup.error.required": "S\xE9lectionnez une option",
201
+ "RadioGroup.error.invalidProps": "RadioGroup : propri\xE9t\xE9s invalides",
202
+ // ─── Forms — Select ───────────────────────────────────────────────────────
203
+ "Select.placeholder": "S\xE9lectionner une option\u2026",
204
+ "Select.search.placeholder": "Rechercher\u2026",
205
+ "Select.empty": "Aucune option disponible",
206
+ "Select.error.required": "S\xE9lectionnez une option",
207
+ "Select.error.invalidProps": "Select : propri\xE9t\xE9s invalides"
84
208
  };
85
209
  var TABLE = {
86
210
  en: EN,
@@ -359,7 +483,292 @@ function VirtualListInner({
359
483
  }
360
484
  );
361
485
  }
486
+ var StatusBadgePropsSchema = z.object({
487
+ status: z.string(),
488
+ variant: z.enum(["success", "warning", "danger", "info", "neutral"]).default("neutral"),
489
+ label: z.string().optional(),
490
+ locale: z.enum(["en", "fr"])
491
+ });
492
+ function validateProps(raw) {
493
+ return StatusBadgePropsSchema.parse(raw);
494
+ }
495
+ var variantClasses = {
496
+ success: "bg-green-100 text-green-800 ring-1 ring-green-300",
497
+ warning: "bg-amber-100 text-amber-800 ring-1 ring-amber-300",
498
+ danger: "bg-red-100 text-red-800 ring-1 ring-red-300",
499
+ info: "bg-blue-100 text-blue-800 ring-1 ring-blue-300",
500
+ neutral: "bg-slate-100 text-slate-800 ring-1 ring-slate-300"
501
+ };
502
+ function StatusBadgeInner({ status, variant, label, locale }) {
503
+ const ariaLabel = label ?? status;
504
+ return /* @__PURE__ */ jsx(
505
+ "output",
506
+ {
507
+ "aria-label": ariaLabel,
508
+ lang: locale,
509
+ className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${variantClasses[variant]}`,
510
+ children: label ?? status
511
+ }
512
+ );
513
+ }
514
+ function StatusBadge(raw) {
515
+ try {
516
+ const props = validateProps(raw);
517
+ return /* @__PURE__ */ jsx(StatusBadgeInner, { ...props });
518
+ } catch {
519
+ const locale = raw.locale === "fr" ? "fr" : "en";
520
+ return /* @__PURE__ */ jsx("span", { role: "alert", children: t("StatusBadge.error.invalidProps", locale) });
521
+ }
522
+ }
523
+ var ColumnDefSchema = z.object({
524
+ key: z.string().min(1),
525
+ header: z.string().min(1)
526
+ // render is a runtime function — excluded from Zod, typed separately
527
+ });
528
+ var TableViewPropsSchema = z.object({
529
+ columns: z.array(ColumnDefSchema).min(1, "TableView requires at least one column"),
530
+ virtualizeThreshold: z.number().int().positive().default(100),
531
+ ariaLabel: z.string().min(1),
532
+ locale: z.enum(["en", "fr"]).default("en")
533
+ });
534
+ function validateTableViewProps(raw) {
535
+ return TableViewPropsSchema.parse(raw);
536
+ }
537
+ var OVERSCAN = 5;
538
+ function TableView(props) {
539
+ let validatedThreshold = 100;
540
+ try {
541
+ const validated = validateTableViewProps({
542
+ columns: props.columns.map(({ key, header }) => ({ key, header })),
543
+ virtualizeThreshold: props.virtualizeThreshold,
544
+ ariaLabel: props.ariaLabel,
545
+ locale: props.locale
546
+ });
547
+ validatedThreshold = validated.virtualizeThreshold;
548
+ } catch {
549
+ const locale = props.locale === "fr" ? "fr" : "en";
550
+ return /* @__PURE__ */ jsx("div", { role: "alert", children: t("TableView.error.invalidProps", locale) });
551
+ }
552
+ const isVirtual = props.rows.length > validatedThreshold;
553
+ const resolvedLocale = props.locale === "fr" ? "fr" : "en";
554
+ if (isVirtual) {
555
+ return /* @__PURE__ */ jsx(
556
+ VirtualTable,
557
+ {
558
+ rows: props.rows,
559
+ columns: props.columns,
560
+ ariaLabel: props.ariaLabel,
561
+ locale: resolvedLocale,
562
+ onRowClick: props.onRowClick
563
+ }
564
+ );
565
+ }
566
+ return /* @__PURE__ */ jsx(
567
+ StaticTable,
568
+ {
569
+ rows: props.rows,
570
+ columns: props.columns,
571
+ ariaLabel: props.ariaLabel,
572
+ locale: resolvedLocale,
573
+ onRowClick: props.onRowClick
574
+ }
575
+ );
576
+ }
577
+ function StreamingTableView(props) {
578
+ let validatedThreshold = 100;
579
+ try {
580
+ const validated = validateTableViewProps({
581
+ columns: props.columns.map(({ key, header }) => ({ key, header })),
582
+ virtualizeThreshold: props.virtualizeThreshold,
583
+ ariaLabel: props.ariaLabel,
584
+ locale: props.locale
585
+ });
586
+ validatedThreshold = validated.virtualizeThreshold;
587
+ } catch {
588
+ const locale = props.locale === "fr" ? "fr" : "en";
589
+ return /* @__PURE__ */ jsx("div", { role: "alert", children: t("TableView.error.invalidProps", locale) });
590
+ }
591
+ return /* @__PURE__ */ jsx(
592
+ StreamingTableViewInner,
593
+ {
594
+ ...props,
595
+ virtualizeThreshold: validatedThreshold,
596
+ onRowClick: props.onRowClick
597
+ }
598
+ );
599
+ }
600
+ function StreamingTableViewInner({
601
+ columns,
602
+ rows$,
603
+ virtualizeThreshold = 100,
604
+ ariaLabel,
605
+ locale,
606
+ onRowClick
607
+ }) {
608
+ const resolvedLocale = locale === "fr" ? "fr" : "en";
609
+ const [rows, setRows] = useState([]);
610
+ useEffect(() => {
611
+ setRows([]);
612
+ const sub = rows$.subscribe((chunk) => {
613
+ setRows((prev) => [...prev, ...chunk]);
614
+ });
615
+ return () => {
616
+ sub.unsubscribe();
617
+ };
618
+ }, [rows$]);
619
+ const isVirtual = rows.length > virtualizeThreshold;
620
+ if (isVirtual) {
621
+ return /* @__PURE__ */ jsx(
622
+ VirtualTable,
623
+ {
624
+ rows,
625
+ columns,
626
+ ariaLabel,
627
+ locale: resolvedLocale,
628
+ onRowClick
629
+ }
630
+ );
631
+ }
632
+ return /* @__PURE__ */ jsx(
633
+ StaticTable,
634
+ {
635
+ rows,
636
+ columns,
637
+ ariaLabel,
638
+ locale: resolvedLocale,
639
+ onRowClick
640
+ }
641
+ );
642
+ }
643
+ function renderCell(col, row) {
644
+ if (col.render) {
645
+ return col.render(row);
646
+ }
647
+ return String(row[col.key] ?? "");
648
+ }
649
+ function StaticTable({
650
+ rows,
651
+ columns,
652
+ ariaLabel,
653
+ locale,
654
+ onRowClick
655
+ }) {
656
+ const emptyMsg = t("TableView.empty.message", locale);
657
+ return /* @__PURE__ */ jsxs(
658
+ "table",
659
+ {
660
+ "aria-label": ariaLabel,
661
+ "aria-rowcount": rows.length,
662
+ style: { width: "100%", borderCollapse: "collapse" },
663
+ children: [
664
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx("th", { scope: "col", children: col.header }, col.key)) }) }),
665
+ /* @__PURE__ */ jsx("tbody", { children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, "aria-label": emptyMsg, children: emptyMsg }) }) : rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
666
+ "tr",
667
+ {
668
+ "aria-rowindex": rowIndex + 2,
669
+ ...onRowClick ? {
670
+ role: "button",
671
+ tabIndex: 0,
672
+ style: { cursor: "pointer" },
673
+ onClick: () => onRowClick(row, rowIndex),
674
+ onKeyDown: (e) => {
675
+ if (e.key === "Enter" || e.key === " ") {
676
+ e.preventDefault();
677
+ onRowClick(row, rowIndex);
678
+ }
679
+ }
680
+ } : {},
681
+ children: columns.map((col) => /* @__PURE__ */ jsx("td", { children: renderCell(col, row) }, col.key))
682
+ },
683
+ row.id != null ? String(row.id) : `row-${rowIndex}`
684
+ )) })
685
+ ]
686
+ }
687
+ );
688
+ }
689
+ function VirtualTable({
690
+ rows,
691
+ columns,
692
+ ariaLabel,
693
+ // locale reserved for future virtual-mode empty/pagination strings
694
+ locale: _locale,
695
+ onRowClick
696
+ }) {
697
+ const scrollRef = useRef(null);
698
+ const rowVirtualizer = useVirtualizer({
699
+ count: rows.length,
700
+ /* v8 ignore next 1 */
701
+ getScrollElement: () => scrollRef.current,
702
+ estimateSize: useCallback(() => 40, []),
703
+ overscan: OVERSCAN
704
+ });
705
+ const virtualItems = rowVirtualizer.getVirtualItems();
706
+ const totalSize = rowVirtualizer.getTotalSize();
707
+ return /* @__PURE__ */ jsx(
708
+ "div",
709
+ {
710
+ "data-virtual": "true",
711
+ ref: scrollRef,
712
+ tabIndex: 0,
713
+ role: "region",
714
+ "aria-label": ariaLabel,
715
+ style: { height: 400, overflow: "auto", position: "relative" },
716
+ children: /* @__PURE__ */ jsxs(
717
+ "table",
718
+ {
719
+ "aria-label": ariaLabel,
720
+ "aria-rowcount": rows.length,
721
+ style: { width: "100%", borderCollapse: "collapse" },
722
+ children: [
723
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx("th", { scope: "col", children: col.header }, col.key)) }) }),
724
+ /* @__PURE__ */ jsx(
725
+ "tbody",
726
+ {
727
+ style: {
728
+ height: `${totalSize}px`,
729
+ position: "relative",
730
+ display: "block"
731
+ },
732
+ children: virtualItems.map((virtualRow) => {
733
+ const row = rows[virtualRow.index] ?? {};
734
+ return /* @__PURE__ */ jsx(
735
+ "tr",
736
+ {
737
+ "aria-rowindex": virtualRow.index + 2,
738
+ style: {
739
+ position: "absolute",
740
+ top: 0,
741
+ left: 0,
742
+ width: "100%",
743
+ transform: `translateY(${virtualRow.start}px)`,
744
+ display: "flex",
745
+ ...onRowClick ? { cursor: "pointer" } : {}
746
+ },
747
+ ...onRowClick ? {
748
+ role: "button",
749
+ tabIndex: 0,
750
+ onClick: () => onRowClick(row, virtualRow.index),
751
+ onKeyDown: (e) => {
752
+ if (e.key === "Enter" || e.key === " ") {
753
+ e.preventDefault();
754
+ onRowClick(row, virtualRow.index);
755
+ }
756
+ }
757
+ } : {},
758
+ children: columns.map((col) => /* @__PURE__ */ jsx("td", { style: { flex: 1 }, children: renderCell(col, row) }, col.key))
759
+ },
760
+ row.id != null ? String(row.id) : `vrow-${virtualRow.index}`
761
+ );
762
+ })
763
+ }
764
+ )
765
+ ]
766
+ }
767
+ )
768
+ }
769
+ );
770
+ }
362
771
 
363
- export { EmptyState, EmptyStatePropsSchema, Skeleton, SkeletonPropsSchema, VirtualList, VirtualListPropsSchema, resolveSkeletonDimensions, validateEmptyStateProps, validateSkeletonProps, validateVirtualListProps };
772
+ export { EmptyState, EmptyStatePropsSchema, Skeleton, SkeletonPropsSchema, StatusBadge, StatusBadgePropsSchema, StreamingTableView, TableView, TableViewPropsSchema, VirtualList, VirtualListPropsSchema, resolveSkeletonDimensions, validateEmptyStateProps, validateSkeletonProps, validateProps as validateStatusBadgeProps, validateTableViewProps, validateVirtualListProps };
364
773
  //# sourceMappingURL=display.js.map
365
774
  //# sourceMappingURL=display.js.map