@lerianstudio/sindarian-ui 1.4.0-beta.3 → 1.4.0-beta.5

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 (138) hide show
  1. package/dist/components/form/date-picker-field/index.d.ts +12 -2
  2. package/dist/components/form/date-picker-field/index.d.ts.map +1 -1
  3. package/dist/components/form/date-picker-field/index.js +7 -2
  4. package/dist/components/form/date-range-field/index.d.ts +12 -2
  5. package/dist/components/form/date-range-field/index.d.ts.map +1 -1
  6. package/dist/components/form/date-range-field/index.js +3 -2
  7. package/dist/components/form/date-time-picker-field/index.d.ts +12 -2
  8. package/dist/components/form/date-time-picker-field/index.d.ts.map +1 -1
  9. package/dist/components/form/date-time-picker-field/index.js +3 -2
  10. package/dist/components/form/input-field/index.d.ts +12 -2
  11. package/dist/components/form/input-field/index.d.ts.map +1 -1
  12. package/dist/components/form/input-field/index.js +29 -5
  13. package/dist/components/form/select-field/index.d.ts +29 -5
  14. package/dist/components/form/select-field/index.d.ts.map +1 -1
  15. package/dist/components/form/select-field/index.js +33 -10
  16. package/dist/components/page-header/index.d.ts +8 -2
  17. package/dist/components/page-header/index.d.ts.map +1 -1
  18. package/dist/components/page-header/index.js +4 -4
  19. package/dist/components/ui/badge/index.d.ts +8 -0
  20. package/dist/components/ui/badge/index.d.ts.map +1 -1
  21. package/dist/components/ui/badge/index.js +9 -1
  22. package/dist/components/ui/calendar/index.d.ts.map +1 -1
  23. package/dist/components/ui/calendar/index.js +1 -4
  24. package/dist/components/ui/form.d.ts +4 -4
  25. package/dist/components/ui/form.d.ts.map +1 -1
  26. package/dist/components/ui/form.js +12 -6
  27. package/dist/components/ui/multiple-select/index.d.ts +11 -3
  28. package/dist/components/ui/multiple-select/index.d.ts.map +1 -1
  29. package/dist/components/ui/select/index.d.ts +5 -0
  30. package/dist/components/ui/select/index.d.ts.map +1 -1
  31. package/dist/components/ui/select/index.js +24 -1
  32. package/dist/domain/blotter/index.d.ts +2 -2
  33. package/dist/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
  34. package/dist/domain/delinquency-aging/aging-buckets.js +1 -1
  35. package/dist/domain/delinquency-aging/index.d.ts.map +1 -1
  36. package/dist/domain/delinquency-aging/index.js +1 -1
  37. package/dist/domain/figure/index.d.ts +11 -9
  38. package/dist/domain/figure/index.d.ts.map +1 -1
  39. package/dist/domain/figure/index.js +8 -8
  40. package/dist/domain/key-id/index.d.ts +1 -1
  41. package/dist/domain/key-id/index.d.ts.map +1 -1
  42. package/dist/domain/key-id/index.js +1 -1
  43. package/dist/domain/section-label/index.d.ts +10 -7
  44. package/dist/domain/section-label/index.d.ts.map +1 -1
  45. package/dist/domain/status-rail/index.d.ts +1 -1
  46. package/dist/domain/status-rail/index.d.ts.map +1 -1
  47. package/dist/domain/status-rail/index.js +8 -4
  48. package/dist/enterprise/alert-banner/index.d.ts +5 -3
  49. package/dist/enterprise/alert-banner/index.d.ts.map +1 -1
  50. package/dist/enterprise/alert-banner/index.js +2 -2
  51. package/dist/enterprise/data-table/column-size.d.ts +70 -0
  52. package/dist/enterprise/data-table/column-size.d.ts.map +1 -0
  53. package/dist/enterprise/data-table/column-size.js +103 -0
  54. package/dist/enterprise/data-table/index.d.ts.map +1 -1
  55. package/dist/enterprise/data-table/index.js +22 -2
  56. package/dist/enterprise/date-range-picker/index.d.ts +8 -1
  57. package/dist/enterprise/date-range-picker/index.d.ts.map +1 -1
  58. package/dist/enterprise/date-range-picker/index.js +10 -5
  59. package/dist/enterprise/stat-card/index.d.ts +3 -3
  60. package/dist/enterprise/stat-card/index.d.ts.map +1 -1
  61. package/dist/enterprise/stat-card/index.js +1 -1
  62. package/dist/enterprise/status-badge/index.js +1 -1
  63. package/dist/enterprise/virtualized-table/index.d.ts +18 -2
  64. package/dist/enterprise/virtualized-table/index.d.ts.map +1 -1
  65. package/dist/enterprise/virtualized-table/index.js +31 -4
  66. package/dist/esm/components/form/date-picker-field/index.d.ts +12 -2
  67. package/dist/esm/components/form/date-picker-field/index.d.ts.map +1 -1
  68. package/dist/esm/components/form/date-picker-field/index.js +7 -2
  69. package/dist/esm/components/form/date-range-field/index.d.ts +12 -2
  70. package/dist/esm/components/form/date-range-field/index.d.ts.map +1 -1
  71. package/dist/esm/components/form/date-range-field/index.js +3 -2
  72. package/dist/esm/components/form/date-time-picker-field/index.d.ts +12 -2
  73. package/dist/esm/components/form/date-time-picker-field/index.d.ts.map +1 -1
  74. package/dist/esm/components/form/date-time-picker-field/index.js +3 -2
  75. package/dist/esm/components/form/input-field/index.d.ts +12 -2
  76. package/dist/esm/components/form/input-field/index.d.ts.map +1 -1
  77. package/dist/esm/components/form/input-field/index.js +29 -5
  78. package/dist/esm/components/form/select-field/index.d.ts +29 -5
  79. package/dist/esm/components/form/select-field/index.d.ts.map +1 -1
  80. package/dist/esm/components/form/select-field/index.js +33 -10
  81. package/dist/esm/components/page-header/index.d.ts +8 -2
  82. package/dist/esm/components/page-header/index.d.ts.map +1 -1
  83. package/dist/esm/components/page-header/index.js +4 -4
  84. package/dist/esm/components/ui/badge/index.d.ts +8 -0
  85. package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
  86. package/dist/esm/components/ui/badge/index.js +9 -1
  87. package/dist/esm/components/ui/calendar/index.d.ts.map +1 -1
  88. package/dist/esm/components/ui/calendar/index.js +1 -4
  89. package/dist/esm/components/ui/form.d.ts +4 -4
  90. package/dist/esm/components/ui/form.d.ts.map +1 -1
  91. package/dist/esm/components/ui/form.js +12 -6
  92. package/dist/esm/components/ui/multiple-select/index.d.ts +11 -3
  93. package/dist/esm/components/ui/multiple-select/index.d.ts.map +1 -1
  94. package/dist/esm/components/ui/select/index.d.ts +5 -0
  95. package/dist/esm/components/ui/select/index.d.ts.map +1 -1
  96. package/dist/esm/components/ui/select/index.js +24 -1
  97. package/dist/esm/domain/blotter/index.d.ts +2 -2
  98. package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
  99. package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -1
  100. package/dist/esm/domain/delinquency-aging/index.d.ts.map +1 -1
  101. package/dist/esm/domain/delinquency-aging/index.js +1 -1
  102. package/dist/esm/domain/figure/index.d.ts +11 -9
  103. package/dist/esm/domain/figure/index.d.ts.map +1 -1
  104. package/dist/esm/domain/figure/index.js +8 -8
  105. package/dist/esm/domain/key-id/index.d.ts +1 -1
  106. package/dist/esm/domain/key-id/index.d.ts.map +1 -1
  107. package/dist/esm/domain/key-id/index.js +1 -1
  108. package/dist/esm/domain/section-label/index.d.ts +10 -7
  109. package/dist/esm/domain/section-label/index.d.ts.map +1 -1
  110. package/dist/esm/domain/status-rail/index.d.ts +1 -1
  111. package/dist/esm/domain/status-rail/index.d.ts.map +1 -1
  112. package/dist/esm/domain/status-rail/index.js +8 -4
  113. package/dist/esm/enterprise/alert-banner/index.d.ts +5 -3
  114. package/dist/esm/enterprise/alert-banner/index.d.ts.map +1 -1
  115. package/dist/esm/enterprise/alert-banner/index.js +2 -2
  116. package/dist/esm/enterprise/data-table/column-size.d.ts +70 -0
  117. package/dist/esm/enterprise/data-table/column-size.d.ts.map +1 -0
  118. package/dist/esm/enterprise/data-table/column-size.js +97 -0
  119. package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
  120. package/dist/esm/enterprise/data-table/index.js +22 -2
  121. package/dist/esm/enterprise/date-range-picker/index.d.ts +8 -1
  122. package/dist/esm/enterprise/date-range-picker/index.d.ts.map +1 -1
  123. package/dist/esm/enterprise/date-range-picker/index.js +10 -5
  124. package/dist/esm/enterprise/stat-card/index.d.ts +3 -3
  125. package/dist/esm/enterprise/stat-card/index.d.ts.map +1 -1
  126. package/dist/esm/enterprise/stat-card/index.js +1 -1
  127. package/dist/esm/enterprise/status-badge/index.js +1 -1
  128. package/dist/esm/enterprise/virtualized-table/index.d.ts +18 -2
  129. package/dist/esm/enterprise/virtualized-table/index.d.ts.map +1 -1
  130. package/dist/esm/enterprise/virtualized-table/index.js +31 -4
  131. package/dist/esm/lib/typography.d.ts +21 -6
  132. package/dist/esm/lib/typography.d.ts.map +1 -1
  133. package/dist/esm/lib/typography.js +20 -5
  134. package/dist/globals.css +51 -16
  135. package/dist/lib/typography.d.ts +21 -6
  136. package/dist/lib/typography.d.ts.map +1 -1
  137. package/dist/lib/typography.js +20 -5
  138. package/package.json +1 -1
@@ -20,6 +20,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
20
20
  * `original` value, so screens compose money / date / status cells directly in
21
21
  * their column `cell` renderers.
22
22
  *
23
+ * Declared column sizing (see `./column-size`) does NOT mean the same thing in
24
+ * the kit's two table paths, because their layouts differ:
25
+ * - DataTable renders real `<th>`/`<td>` under CSS AUTO table layout (the
26
+ * `Table` primitive sets no `table-fixed`). There, `size` is a PREFERRED
27
+ * width the browser may exceed to fit content, `minSize` acts as a floor,
28
+ * and `maxSize` is ignored outright — Chrome and Firefox do not apply
29
+ * `max-width` to table cells. A column declaring none keeps auto width.
30
+ * - VirtualizedTable renders flex rows, where all three PIN: `size`,
31
+ * `minSize` and `maxSize` are honoured exactly as declared.
32
+ * So a column that must not grow past a width belongs in VirtualizedTable, or
33
+ * in a cell renderer that truncates its own content.
34
+ *
23
35
  * Row selection is opt-in and controlled: pass `enableRowSelection` plus
24
36
  * `rowSelection` / `onRowSelectionChange` (TanStack-native types). When
25
37
  * enabled, a checkbox column is prepended — header checkbox selects the
@@ -45,6 +57,7 @@ const skeleton_1 = require("../../components/ui/skeleton");
45
57
  const typography_1 = require("../../lib/typography");
46
58
  const utils_1 = require("../../lib/utils");
47
59
  const empty_state_1 = require("../empty-state");
60
+ const column_size_1 = require("./column-size");
48
61
  const SELECTION_COLUMN_ID = '__select__';
49
62
  const CHECKBOX_CLASS = 'accent-primary block size-4';
50
63
  /** Right-aligned mono treatment for `meta: { numeric: true }` columns. */
@@ -89,6 +102,10 @@ function DataTable({ columns, data, loading = false, skeletonRows = 8, loadingLa
89
102
  const table = (0, react_table_1.useReactTable)({
90
103
  data,
91
104
  columns: tableColumns,
105
+ // Keeps `columnDef.size`/`minSize`/`maxSize` meaning "declared" — see
106
+ // ./column-size. `getSize()` is unaffected; it falls back to the library
107
+ // defaults itself.
108
+ defaultColumn: column_size_1.UNSIZED_DEFAULT_COLUMN,
92
109
  getCoreRowModel: (0, react_table_1.getCoreRowModel)(),
93
110
  getRowId,
94
111
  enableRowSelection,
@@ -220,7 +237,10 @@ function DataTable({ columns, data, loading = false, skeletonRows = 8, loadingLa
220
237
  ? 'No rows'
221
238
  : `${rowCount} rows` }), (0, jsx_runtime_1.jsxs)(table_1.Table, { "aria-busy": loading ? 'true' : undefined, children: [(0, jsx_runtime_1.jsx)(table_1.TableHeader, { children: table.getHeaderGroups().map((headerGroup) => ((0, jsx_runtime_1.jsx)(table_1.TableRow, { className: "hover:bg-transparent", children: headerGroup.headers.map((header) => {
222
239
  const numeric = header.column.columnDef.meta?.numeric;
223
- return ((0, jsx_runtime_1.jsx)(table_1.TableHead, { align: numeric ? 'right' : undefined, className: (0, utils_1.cn)(typography_1.LABEL_VOICE_CLASS, headDensityClass, header.column.id === SELECTION_COLUMN_ID && 'w-10', headClassName), children: header.isPlaceholder
240
+ return ((0, jsx_runtime_1.jsx)(table_1.TableHead, { align: numeric ? 'right' : undefined,
241
+ // Only a column that DECLARED sizing gets an inline width;
242
+ // everything else keeps the auto table layout it has today.
243
+ style: (0, column_size_1.readPreferredColumnSize)(header.column), className: (0, utils_1.cn)(typography_1.LABEL_VOICE_CLASS, headDensityClass, header.column.id === SELECTION_COLUMN_ID && 'w-10', headClassName), children: header.isPlaceholder
224
244
  ? null
225
245
  : (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()) }, header.id));
226
246
  }) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)(table_1.TableBody, { children: loading ? (Array.from({ length: skeletonRows }).map((_, rowIndex) => ((0, jsx_runtime_1.jsx)(table_1.TableRow, { className: "hover:bg-transparent", children: Array.from({ length: colCount }).map((__, cellIndex) => ((0, jsx_runtime_1.jsx)(table_1.TableCell, { className: cellDensityClass, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { className: "h-4 w-full max-w-[160px]" }) }, `skeleton-${rowIndex}-${cellIndex}`))) }, `skeleton-${rowIndex}`)))) : rowCount === 0 ? ((0, jsx_runtime_1.jsx)(table_1.TableRow, { className: "hover:bg-transparent", children: (0, jsx_runtime_1.jsx)(table_1.TableCell, { colSpan: colCount, className: "p-0", children: (0, jsx_runtime_1.jsx)(empty_state_1.EmptyState, { title: empty?.title ?? 'Nothing here yet', description: empty?.description, icon: empty?.icon, action: empty?.action,
@@ -243,7 +263,7 @@ function DataTable({ columns, data, loading = false, skeletonRows = 8, loadingLa
243
263
  ? (event) => handleRowKeyDown(event, row, rowIndex)
244
264
  : undefined, className: keyboardNav ? ROW_FOCUS_CLASS : undefined, "data-state": enableRowSelection && row.getIsSelected()
245
265
  ? 'selected'
246
- : undefined, children: row.getVisibleCells().map((cell) => ((0, jsx_runtime_1.jsx)(table_1.TableCell, { className: (0, utils_1.cn)(cell.column.columnDef.meta?.numeric && NUMERIC_CELL_CLASS, cellDensityClass, cell.column.id === SELECTION_COLUMN_ID && 'w-10'), onClick: cell.column.id === SELECTION_COLUMN_ID
266
+ : undefined, children: row.getVisibleCells().map((cell) => ((0, jsx_runtime_1.jsx)(table_1.TableCell, { style: (0, column_size_1.readPreferredColumnSize)(cell.column), className: (0, utils_1.cn)(cell.column.columnDef.meta?.numeric && NUMERIC_CELL_CLASS, cellDensityClass, cell.column.id === SELECTION_COLUMN_ID && 'w-10'), onClick: cell.column.id === SELECTION_COLUMN_ID
247
267
  ? stopPropagation
248
268
  : undefined, children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id)))) }), footer ? (0, jsx_runtime_1.jsx)(table_1.TableFooter, { children: footer }) : null] })] }));
249
269
  }
@@ -21,6 +21,13 @@ export type DateRangePickerProps = {
21
21
  fromLabel: ReactNode;
22
22
  toLabel: ReactNode;
23
23
  invalid?: boolean;
24
+ /**
25
+ * Marks the range as mandatory. Renders the library's required marker: the
26
+ * literal ' *' appended to both labels, exactly as `FormLabel` does. It is
27
+ * deliberately NOT mirrored as `aria-required` on the triggers: ARIA does not
28
+ * allow that attribute on `role="button"`.
29
+ */
30
+ required?: boolean;
24
31
  /** Wired as aria-describedby on both triggers while `invalid` is set. */
25
32
  errorId?: string;
26
33
  /** Trigger placeholder when unset. */
@@ -32,6 +39,6 @@ export type DateRangePickerProps = {
32
39
  /** date-fns locale for the calendar. Defaults to en-US. */
33
40
  locale?: CalendarLocale;
34
41
  };
35
- export declare function DateRangePicker({ value, onValueChange, fromId, toId, fromLabel, toLabel, invalid, errorId, placeholder, ariaLabel, clearLabel, locale }: DateRangePickerProps): import("react").JSX.Element;
42
+ export declare function DateRangePicker({ value, onValueChange, fromId, toId, fromLabel, toLabel, invalid, required, errorId, placeholder, ariaLabel, clearLabel, locale }: DateRangePickerProps): import("react").JSX.Element;
36
43
  export {};
37
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enterprise/date-range-picker/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAUnD;;;;GAIG;AACH,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE/D,MAAM,MAAM,cAAc,GAAG;IAC3B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,cAAc,CAAA;IACrB,aAAa,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IAC7C,8EAA8E;IAC9E,MAAM,EAA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A;IACZ,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAkCD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAa,EACb,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,EACP,OAAe,EACf,QAAgB,EAChB,OAAO,EACP,WAAwB,EACxB,SAA+B,EAC/B,UAAoB,EACpB,MAAa,EACd,EAAE,oBAAoB,+BA8HtB"}
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  /**
7
7
  * DateRangePicker — a two-segment popover range control.
8
8
  *
9
- * Two labelled mono trigger segments (from / to) each open the SAME two-month
9
+ * Two labelled trigger segments (from / to) each open the SAME two-month
10
10
  * react-day-picker range calendar over the same range selection. The external
11
11
  * contract is plain YYYY-MM-DD strings (empty string = unset) so state shapes
12
12
  * that speak `date_from`/`date_to` stay untouched. The picker guarantees
@@ -30,7 +30,6 @@ const button_1 = require("../../components/ui/button");
30
30
  const calendar_1 = require("../../components/ui/calendar");
31
31
  const label_1 = require("../../components/ui/label");
32
32
  const popover_1 = require("../../components/ui/popover");
33
- const typography_1 = require("../../lib/typography");
34
33
  const utils_1 = require("../../lib/utils");
35
34
  /** Leading YYYY-MM-DD of an ISO date (or date-time) string. */
36
35
  const ISO_DAY = /^(\d{4})-(\d{2})-(\d{2})/;
@@ -63,7 +62,7 @@ function toDayString(value) {
63
62
  const day = String(value.getDate()).padStart(2, '0');
64
63
  return `${year}-${month}-${day}`;
65
64
  }
66
- function DateRangePicker({ value, onValueChange, fromId, toId, fromLabel, toLabel, invalid = false, errorId, placeholder = 'Any date', ariaLabel = 'Select date range', clearLabel = 'Clear', locale = locale_1.enUS }) {
65
+ function DateRangePicker({ value, onValueChange, fromId, toId, fromLabel, toLabel, invalid = false, required = false, errorId, placeholder = 'Any date', ariaLabel = 'Select date range', clearLabel = 'Clear', locale = locale_1.enUS }) {
67
66
  // Which segment's popover is open, if any. One root per segment means one open
68
67
  // state per segment; holding the identity of the open one here keeps them
69
68
  // mutually exclusive, so clicking "to" while "from" is open swaps the anchor
@@ -82,11 +81,17 @@ function DateRangePicker({ value, onValueChange, fromId, toId, fromLabel, toLabe
82
81
  to: toDayString(range?.to)
83
82
  });
84
83
  };
85
- const triggerClass = (0, utils_1.cn)('border-input bg-card hover:bg-secondary focus-visible:ring-ring flex h-9 items-center gap-2 rounded-md border px-3 text-left font-mono text-sm tabular-nums transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none sm:w-40', invalid && 'border-destructive');
84
+ const triggerClass = (0, utils_1.cn)(
85
+ // border-shadcn-400, not border-input: `--input` is a SURFACE token and is
86
+ // white in the light theme, so the trigger had no visible edge next to the
87
+ // Input and Select it sits with. font-sans, not font-mono: the dates are
88
+ // figures in the body face with tabular figures, like every other figure in
89
+ // the console.
90
+ 'border-shadcn-400 bg-card hover:bg-secondary focus-visible:ring-ring flex h-9 items-center gap-2 rounded-md border px-3 text-left font-sans text-sm tabular-nums transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none sm:w-40', invalid && 'border-destructive');
86
91
  // The one calendar, rendered inside whichever segment's popover is open. Both
87
92
  // segments read and write the SAME range selection, so which one you opened
88
93
  // changes only the anchor, never the state.
89
94
  const calendar = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(calendar_1.Calendar, { mode: "range", numberOfMonths: 2, defaultMonth: fromDate ?? toDate ?? new Date(), selected: selected, onSelect: onSelect, locale: locale }), (0, jsx_runtime_1.jsx)("div", { className: "border-border flex items-center justify-end border-t px-3 py-2", children: (0, jsx_runtime_1.jsx)(button_1.Button, { type: "button", variant: "plain", size: "small", disabled: !hasValue, onClick: () => onValueChange({ from: '', to: '' }), children: clearLabel }) })] }));
90
- const renderSegment = (segment, id, label, dateValue) => ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: openSegment === segment, onOpenChange: (next) => setOpenSegment(next ? segment : null), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1.5", children: [(0, jsx_runtime_1.jsx)(label_1.Label, { htmlFor: id, className: typography_1.SECTION_LABEL_CLASS, children: label }), (0, jsx_runtime_1.jsxs)(popover_1.PopoverTrigger, { type: "button", id: id, className: triggerClass, "aria-invalid": invalid || undefined, "aria-describedby": invalid ? errorId : undefined, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CalendarDays, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": true }), dateValue ? ((0, jsx_runtime_1.jsx)("span", { children: dateValue })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground font-sans", children: placeholder }))] })] }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { align: "start", className: "w-auto p-0", "aria-label": ariaLabel, children: calendar })] }, segment));
95
+ const renderSegment = (segment, id, label, dateValue) => ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: openSegment === segment, onOpenChange: (next) => setOpenSegment(next ? segment : null), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1.5", children: [(0, jsx_runtime_1.jsxs)(label_1.Label, { htmlFor: id, children: [label, required ? ' *' : ''] }), (0, jsx_runtime_1.jsxs)(popover_1.PopoverTrigger, { type: "button", id: id, className: triggerClass, "aria-invalid": invalid || undefined, "aria-describedby": invalid ? errorId : undefined, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.CalendarDays, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": true }), dateValue ? ((0, jsx_runtime_1.jsx)("span", { children: dateValue })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground", children: placeholder }))] })] }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { align: "start", className: "w-auto p-0", "aria-label": ariaLabel, children: calendar })] }, segment));
91
96
  return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end", children: [renderSegment('from', fromId, fromLabel, value.from), renderSegment('to', toId, toLabel, value.to)] }));
92
97
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * StatCard — a single headline-figure cell of the console.
3
3
  *
4
- * A `LedgerPanel` holding a recessive `SectionLabel`, the dominant mono
4
+ * A `LedgerPanel` holding a recessive `SectionLabel`, the dominant
5
5
  * `Figure`, an optional delta line, an optional inline trend, and optional
6
6
  * secondary `BlotterRow` key/value rows. Drop StatCards into a `LedgerSheet` so
7
7
  * they read as connected hairline-seamed panels rather than floating cards.
@@ -23,9 +23,9 @@ export type StatCardRow = {
23
23
  value: ReactNode;
24
24
  };
25
25
  export type StatCardProps = {
26
- /** Recessive uppercase heading. */
26
+ /** Recessive heading, rendered through `SectionLabel`'s quiet label voice. */
27
27
  label: string;
28
- /** The dominant headline value — rendered in the hero mono figure. */
28
+ /** The dominant headline value — rendered in the hero figure. */
29
29
  value: ReactNode;
30
30
  /** Optional delta line below the value (e.g. `+0.6 pts`, `-3`). Inherits the tone color. */
31
31
  delta?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enterprise/stat-card/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQtC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,aAA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;IAChB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,uDAAuD;IACvD,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,sDAAsD;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAA;IAC7D,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yCAAyC;IACzC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAwED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAgB,EAChB,KAAK,EACL,QAAkB,EAClB,IAAI,EACJ,SAAS,EACV,EAAE,aAAa,+BAgCf"}
@@ -63,5 +63,5 @@ function TrendSpark({ data, dataKey, color }) {
63
63
  function StatCard({ label, value, delta, tone = 'default', trend, trendKey = 'value', rows, className }) {
64
64
  const hasTrend = trend !== undefined && trend.length > 0;
65
65
  const hasRows = rows !== undefined && rows.length > 0;
66
- return ((0, jsx_runtime_1.jsxs)(ledger_sheet_1.LedgerPanel, { "data-tone": tone, className: className, children: [(0, jsx_runtime_1.jsx)(section_label_1.SectionLabel, { children: label }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsx)(figure_1.Figure, { size: "hero", className: (0, utils_1.cn)('block', TONE_VALUE[tone]), children: value }), delta !== undefined ? ((0, jsx_runtime_1.jsx)("p", { className: (0, utils_1.cn)('font-mono text-xs tabular-nums', TONE_VALUE[tone]), children: delta })) : null] }), hasTrend ? ((0, jsx_runtime_1.jsx)(TrendSpark, { data: trend, dataKey: trendKey, color: TONE_TREND[tone] })) : null, hasRows ? ((0, jsx_runtime_1.jsx)(blotter_1.Blotter, { className: "mt-auto", children: rows.map((row, i) => ((0, jsx_runtime_1.jsx)(blotter_1.BlotterRow, { label: row.label, value: row.value }, i))) })) : null] }));
66
+ return ((0, jsx_runtime_1.jsxs)(ledger_sheet_1.LedgerPanel, { "data-tone": tone, className: className, children: [(0, jsx_runtime_1.jsx)(section_label_1.SectionLabel, { children: label }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsx)(figure_1.Figure, { size: "hero", className: (0, utils_1.cn)('block', TONE_VALUE[tone]), children: value }), delta !== undefined ? ((0, jsx_runtime_1.jsx)("p", { className: (0, utils_1.cn)('text-xs tabular-nums', TONE_VALUE[tone]), children: delta })) : null] }), hasTrend ? ((0, jsx_runtime_1.jsx)(TrendSpark, { data: trend, dataKey: trendKey, color: TONE_TREND[tone] })) : null, hasRows ? ((0, jsx_runtime_1.jsx)(blotter_1.Blotter, { className: "mt-auto", children: rows.map((row, i) => ((0, jsx_runtime_1.jsx)(blotter_1.BlotterRow, { label: row.label, value: row.value }, i))) })) : null] }));
67
67
  }
@@ -116,5 +116,5 @@ function StatusBadge({ status, label, variantMap, withIcon = false, unknownLabel
116
116
  // The glyph follows the resolved variant; an unknown/non-severity variant has
117
117
  // no cue, so the badge gracefully renders label-only even with withIcon set.
118
118
  const cue = withIcon ? SEVERITY_CUE[variant] : undefined;
119
- return ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { variant: variant, className: (0, utils_1.cn)('gap-1', className), children: [cue ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(cue.Icon, { "aria-hidden": true, className: "size-3.5 shrink-0" }), (0, jsx_runtime_1.jsxs)("span", { className: "sr-only", children: [cue.word, ": "] })] })) : null, label ?? humanize(status)] }));
119
+ return ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { variant: variant, className: className, children: [cue ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(cue.Icon, { "aria-hidden": true, className: "size-3.5 shrink-0" }), (0, jsx_runtime_1.jsxs)("span", { className: "sr-only", children: [cue.word, ": "] })] })) : null, label ?? humanize(status)] }));
120
120
  }
@@ -1,6 +1,16 @@
1
1
  import { type ColumnDef } from '@tanstack/react-table';
2
2
  export type VirtualizedTableProps<TData> = {
3
- /** Same shape as DataTable: standard TanStack `ColumnDef<T>`. */
3
+ /**
4
+ * Same shape as DataTable: standard TanStack `ColumnDef<T>`. A column that
5
+ * declares none keeps its equal share of the row.
6
+ *
7
+ * Declared sizing does NOT mean the same thing in the kit's two table paths.
8
+ * Here, flex rows PIN all three: `size`, `minSize` and `maxSize` are honoured
9
+ * exactly as declared. DataTable renders real `<th>`/`<td>` under CSS auto
10
+ * table layout, where `size` is only a PREFERRED width, `minSize` a floor,
11
+ * and `maxSize` is ignored outright. A column that must not grow past a width
12
+ * belongs here.
13
+ */
4
14
  columns: ColumnDef<TData, unknown>[];
5
15
  /** The full dataset, already in memory. Only the visible window renders. */
6
16
  data: TData[];
@@ -21,6 +31,12 @@ export type VirtualizedTableProps<TData> = {
21
31
  scrollAreaLabel?: string;
22
32
  /** Applied to the outer wrapper (the scroll container's parent). */
23
33
  className?: string;
34
+ /**
35
+ * Extra classes merged onto every header cell, after the kit label voice —
36
+ * the same seam DataTable exposes, so a screen that switches between the two
37
+ * render paths quiets both column heads with one prop instead of one.
38
+ */
39
+ headClassName?: string;
24
40
  };
25
- export declare function VirtualizedTable<TData>({ columns, data, rowHeight, maxHeight, scrollAreaLabel, className }: VirtualizedTableProps<TData>): import("react").JSX.Element;
41
+ export declare function VirtualizedTable<TData>({ columns, data, rowHeight, maxHeight, scrollAreaLabel, className, headClassName }: VirtualizedTableProps<TData>): import("react").JSX.Element;
26
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enterprise/virtualized-table/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAA;AAK9B,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC,iEAAiE;IACjE,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAA;IACpC,4EAA4E;IAC5E,IAAI,EAAE,KAAK,EAAE,CAAA;IACb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,EACtC,OAAO,EACP,IAAI,EACJ,SAAc,EACd,SAAe,EACf,eAAyC,EACzC,SAAS,EACV,EAAE,qBAAqB,CAAC,KAAK,CAAC,+BAiM9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enterprise/virtualized-table/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAA;AAW9B,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC;;;;;;;;;;OAUG;IACH,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAA;IACpC,4EAA4E;IAC5E,IAAI,EAAE,KAAK,EAAE,CAAA;IACb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,EACtC,OAAO,EACP,IAAI,EACJ,SAAc,EACd,SAAe,EACf,eAAyC,EACzC,SAAS,EACT,aAAa,EACd,EAAE,qBAAqB,CAAC,KAAK,CAAC,+BAkO9B"}
@@ -34,10 +34,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
34
34
  const react_1 = require("react");
35
35
  const react_table_1 = require("@tanstack/react-table");
36
36
  const react_virtual_1 = require("@tanstack/react-virtual");
37
+ const typography_1 = require("../../lib/typography");
37
38
  const utils_1 = require("../../lib/utils");
39
+ const column_size_1 = require("../data-table/column-size");
38
40
  /** Rows rendered just outside the viewport to keep fast scrolls smooth. */
39
41
  const OVERSCAN = 8;
40
- function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scrollAreaLabel = 'Scrollable table rows', className }) {
42
+ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scrollAreaLabel = 'Scrollable table rows', className, headClassName }) {
41
43
  const scrollRef = (0, react_1.useRef)(null);
42
44
  const [isScrollable, setIsScrollable] = (0, react_1.useState)(false);
43
45
  // A number is px; a string is used verbatim (e.g. '60vh').
@@ -45,6 +47,10 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
45
47
  const table = (0, react_table_1.useReactTable)({
46
48
  data,
47
49
  columns,
50
+ // Keeps `columnDef.size`/`minSize`/`maxSize` meaning "declared" — see
51
+ // ../data-table/column-size. `getSize()` is unaffected; it falls back to
52
+ // the library defaults itself.
53
+ defaultColumn: column_size_1.UNSIZED_DEFAULT_COLUMN,
48
54
  getCoreRowModel: (0, react_table_1.getCoreRowModel)()
49
55
  });
50
56
  const rows = table.getRowModel().rows;
@@ -97,11 +103,23 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
97
103
  // its position among its siblings.
98
104
  const firstLeaf = header.column.getLeafColumns()[0];
99
105
  const start = leafPosition.get(firstLeaf?.id ?? header.column.id);
100
- return ((0, jsx_runtime_1.jsx)("div", { role: "columnheader", "aria-colindex": (start ?? 0) + 1, "aria-colspan": header.colSpan > 1 ? header.colSpan : undefined, style: { flex: `${header.colSpan} 1 0%` },
106
+ // A group header spans leaf columns whose body cells carry
107
+ // their own widths, so its size comes from those leaves, not
108
+ // from the group def (which declares nothing). A leaf header
109
+ // reads its own column, as before.
110
+ const size = header.subHeaders.length > 0
111
+ ? (0, column_size_1.readDeclaredGroupSize)(header.column.getLeafColumns())
112
+ : (0, column_size_1.readDeclaredColumnSize)(header.column);
113
+ return ((0, jsx_runtime_1.jsx)("div", { role: "columnheader", "aria-colindex": (start ?? 0) + 1, "aria-colspan": header.colSpan > 1 ? header.colSpan : undefined,
114
+ // A declared width must not be flexed away; without one the
115
+ // cell keeps its colSpan share of the row, as before.
116
+ style: size?.width === undefined
117
+ ? { flex: `${header.colSpan} 1 0%`, ...size }
118
+ : { flex: '0 0 auto', ...size },
101
119
  // Header height is independent of rowHeight: pinning it to a
102
120
  // small rowHeight (32) clipped the uppercase label against its
103
121
  // own padding. Padding sizes it; min-h keeps a stable rule.
104
- className: "text-muted-foreground min-h-10 px-4 py-2.5 text-left text-xs font-medium tracking-wide uppercase", children: header.isPlaceholder
122
+ className: (0, utils_1.cn)('min-h-10 px-4 py-2.5 text-left', typography_1.LABEL_VOICE_CLASS, headClassName), children: header.isPlaceholder
105
123
  ? null
106
124
  : (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()) }, header.id));
107
125
  }) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)("div", { ref: scrollRef, role: "rowgroup", "data-testid": "virtualized-table-viewport", "aria-label": isScrollable ? scrollAreaLabel : undefined, tabIndex: isScrollable ? 0 : undefined, className: "focus-visible:ring-ring relative overflow-auto focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", style: { maxHeight: viewportMaxHeight }, children: (0, jsx_runtime_1.jsx)("div", { role: "presentation", className: "relative w-full", style: { height: totalSize }, children: virtualRows.map((virtualItem) => {
@@ -109,6 +127,15 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
109
127
  return ((0, jsx_runtime_1.jsx)("div", { role: "row", "aria-rowindex": virtualItem.index + headerRowCount + 1, "data-index": virtualItem.index, className: "border-border absolute left-0 flex w-full items-center border-b text-sm", style: {
110
128
  height: virtualItem.size,
111
129
  transform: `translateY(${virtualItem.start}px)`
112
- }, children: row.getVisibleCells().map((cell, i) => ((0, jsx_runtime_1.jsx)("div", { role: "cell", "aria-colindex": i + 1, className: "flex-1 truncate px-4", children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
130
+ }, children: row.getVisibleCells().map((cell, i) => {
131
+ const size = (0, column_size_1.readDeclaredColumnSize)(cell.column);
132
+ return ((0, jsx_runtime_1.jsx)("div", { role: "cell", "aria-colindex": i + 1,
133
+ // An inline `flex` beats the class, so a sized column
134
+ // stops flexing while every other column renders
135
+ // exactly as it did before.
136
+ style: size?.width === undefined
137
+ ? size
138
+ : { flex: '0 0 auto', ...size }, className: "flex-1 truncate px-4", children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
139
+ }) }, row.id));
113
140
  }) }) })] }) }));
114
141
  }
@@ -1,6 +1,13 @@
1
+ import { Calendar } from '../../../components/ui/calendar/index.js';
1
2
  import * as React from 'react';
2
- import { ReactNode } from 'react';
3
+ import { ComponentProps, ReactNode } from 'react';
3
4
  import { Control, FieldValues } from 'react-hook-form';
5
+ /**
6
+ * The calendar's locale type, taken straight off the Calendar props so the
7
+ * public signature stays the react-day-picker/date-fns `Locale` without this
8
+ * package taking a direct date-fns dependency.
9
+ */
10
+ type CalendarLocale = ComponentProps<typeof Calendar>['locale'];
4
11
  export type DatePickerFieldProps<T extends FieldValues = FieldValues> = {
5
12
  name: string;
6
13
  label?: ReactNode;
@@ -16,6 +23,9 @@ export type DatePickerFieldProps<T extends FieldValues = FieldValues> = {
16
23
  align?: 'start' | 'center' | 'end';
17
24
  'data-testid'?: string;
18
25
  valueAsString?: boolean;
26
+ /** date-fns locale for the calendar. Defaults to en-US. */
27
+ locale?: CalendarLocale;
19
28
  };
20
- export declare const DatePickerField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat, align, valueAsString, ...others }: DatePickerFieldProps<T>) => React.JSX.Element;
29
+ export declare const DatePickerField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat, align, valueAsString, locale, ...others }: DatePickerFieldProps<T>) => React.JSX.Element;
30
+ export {};
21
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/date-picker-field/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAQ,MAAM,iBAAiB,CAAA;AAE5D,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACtE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe,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AE,4JAgBlE,oBAAoB,CAAC,CAAC,CAAC,sBAiGzB,CAAA"}
@@ -8,7 +8,8 @@ import { cn } from '../../../lib/utils.js';
8
8
  import dayjs from 'dayjs';
9
9
  import { CalendarIcon } from 'lucide-react';
10
10
  import * as React from 'react';
11
- export const DatePickerField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY', align = 'start', valueAsString, ...others }) => {
11
+ import { enUS } from 'react-day-picker/locale';
12
+ export const DatePickerField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY', align = 'start', valueAsString, locale = enUS, ...others }) => {
12
13
  const [open, setOpen] = React.useState(false);
13
14
  return (_jsx(FormField, { name: name, control: control, render: ({ field }) => {
14
15
  const convertFieldValueToDate = (fieldValue) => {
@@ -33,6 +34,10 @@ export const DatePickerField = ({ name, label, tooltip, labelExtra, description,
33
34
  const handleSelect = (date) => {
34
35
  field.onChange(convertDateToOutputFormat(date));
35
36
  };
36
- return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-shadcn-400 text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: dayjs(value).format(dateFormat) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "single", defaultMonth: value, selected: value, onSelect: handleSelect, disabled: disabled || readOnly }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
37
+ return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-shadcn-400 text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: dayjs(value).format(dateFormat) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "single",
38
+ // `required` mirrors the field's own required: a required
39
+ // field is not emptied by a re-click; an optional one keeps
40
+ // react-day-picker's clear gesture.
41
+ required: required, defaultMonth: value, selected: value, onSelect: handleSelect, disabled: disabled || readOnly, locale: locale }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
37
42
  } }));
38
43
  };
@@ -1,6 +1,13 @@
1
+ import { Calendar } from '../../../components/ui/calendar/index.js';
1
2
  import * as React from 'react';
2
- import { ReactNode } from 'react';
3
+ import { type ComponentProps, ReactNode } from 'react';
3
4
  import { Control, FieldValues } from 'react-hook-form';
5
+ /**
6
+ * The calendar's locale type, taken straight off the Calendar props so the
7
+ * public signature stays the react-day-picker/date-fns `Locale` without this
8
+ * package taking a direct date-fns dependency.
9
+ */
10
+ type CalendarLocale = ComponentProps<typeof Calendar>['locale'];
4
11
  export type DateRangeFieldProps<T extends FieldValues = FieldValues> = {
5
12
  name: string;
6
13
  label?: ReactNode;
@@ -15,7 +22,10 @@ export type DateRangeFieldProps<T extends FieldValues = FieldValues> = {
15
22
  numberOfMonths?: number;
16
23
  dateFormat?: string;
17
24
  align?: 'start' | 'center' | 'end';
25
+ /** date-fns locale for the calendar. Defaults to en-US. */
26
+ locale?: CalendarLocale;
18
27
  'data-testid'?: string;
19
28
  };
20
- export declare const DateRangeField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths, dateFormat, align, ...others }: DateRangeFieldProps<T>) => React.JSX.Element;
29
+ export declare const DateRangeField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths, dateFormat, align, locale, ...others }: DateRangeFieldProps<T>) => React.JSX.Element;
30
+ export {};
21
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/date-range-field/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAQ,MAAM,iBAAiB,CAAA;AAE5D,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MA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IAC3D,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,6JAgBjE,mBAAmB,CAAC,CAAC,CAAC,sBA2ExB,CAAA"}
@@ -8,10 +8,11 @@ import { cn } from '../../../lib/utils.js';
8
8
  import dayjs from 'dayjs';
9
9
  import { CalendarIcon } from 'lucide-react';
10
10
  import * as React from 'react';
11
- export const DateRangeField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths = 2, dateFormat = 'MMM DD, YYYY', align = 'start', ...others }) => {
11
+ import { enUS } from 'react-day-picker/locale';
12
+ export const DateRangeField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths = 2, dateFormat = 'MMM DD, YYYY', align = 'start', locale = enUS, ...others }) => {
12
13
  const [open, setOpen] = React.useState(false);
13
14
  return (_jsx(FormField, { name: name, control: control, render: ({ field }) => {
14
15
  const value = field.value;
15
- return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-shadcn-400 text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value?.from ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: value.to ? (_jsxs(_Fragment, { children: [dayjs(value.from).format(dateFormat), " -", ' ', dayjs(value.to).format(dateFormat)] })) : (dayjs(value.from).format(dateFormat)) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "range", defaultMonth: value?.from, selected: value, onSelect: field.onChange, numberOfMonths: numberOfMonths, disabled: disabled || readOnly }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
16
+ return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-shadcn-400 text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value?.from ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: value.to ? (_jsxs(_Fragment, { children: [dayjs(value.from).format(dateFormat), " -", ' ', dayjs(value.to).format(dateFormat)] })) : (dayjs(value.from).format(dateFormat)) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "range", defaultMonth: value?.from, selected: value, onSelect: field.onChange, numberOfMonths: numberOfMonths, disabled: disabled || readOnly, locale: locale }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
16
17
  } }));
17
18
  };
@@ -1,6 +1,13 @@
1
+ import { Calendar } from '../../../components/ui/calendar/index.js';
1
2
  import * as React from 'react';
2
- import { type ReactNode } from 'react';
3
+ import { type ComponentProps, type ReactNode } from 'react';
3
4
  import { Control, FieldValues } from 'react-hook-form';
5
+ /**
6
+ * The calendar's locale type, taken straight off the Calendar props so the
7
+ * public signature stays the react-day-picker/date-fns `Locale` without this
8
+ * package taking a direct date-fns dependency.
9
+ */
10
+ type CalendarLocale = ComponentProps<typeof Calendar>['locale'];
4
11
  export type DateTimePickerFieldProps<T extends FieldValues = FieldValues> = {
5
12
  name: string;
6
13
  label?: ReactNode;
@@ -14,10 +21,13 @@ export type DateTimePickerFieldProps<T extends FieldValues = FieldValues> = {
14
21
  required?: boolean;
15
22
  dateFormat?: string;
16
23
  align?: 'start' | 'center' | 'end';
24
+ /** date-fns locale for the calendar. Defaults to en-US. */
25
+ locale?: CalendarLocale;
17
26
  'data-testid'?: string;
18
27
  minDate?: Date;
19
28
  maxDate?: Date;
20
29
  defaultTime?: string;
21
30
  };
22
- export declare const DateTimePickerField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat, align, minDate, maxDate, defaultTime, ...others }: DateTimePickerFieldProps<T>) => React.JSX.Element;
31
+ export declare const DateTimePickerField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat, align, locale, minDate, maxDate, defaultTime, ...others }: DateTimePickerFieldProps<T>) => React.JSX.Element;
32
+ export {};
23
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/date-time-picker-field/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAQ,MAAM,iBAAiB,CAAA;AAE5D,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IAC1E,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,W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AAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,4KAkBtE,wBAAwB,CAAC,CAAC,CAAC,sBAiK7B,CAAA"}
@@ -9,7 +9,8 @@ import { cn } from '../../../lib/utils.js';
9
9
  import dayjs from 'dayjs';
10
10
  import { CalendarIcon, XIcon } from 'lucide-react';
11
11
  import * as React from 'react';
12
- export const DateTimePickerField = ({ name, label, tooltip, labelExtra, description, placeholder = 'Select date and time...', disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY HH:mm', align = 'start', minDate, maxDate, defaultTime = '00:00', ...others }) => {
12
+ import { enUS } from 'react-day-picker/locale';
13
+ export const DateTimePickerField = ({ name, label, tooltip, labelExtra, description, placeholder = 'Select date and time...', disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY HH:mm', align = 'start', locale = enUS, minDate, maxDate, defaultTime = '00:00', ...others }) => {
13
14
  const [open, setOpen] = React.useState(false);
14
15
  const parseDefaultTime = (time) => {
15
16
  const [h, m] = time.split(':').map(Number);
@@ -58,7 +59,7 @@ export const DateTimePickerField = ({ name, label, tooltip, labelExtra, descript
58
59
  e.preventDefault();
59
60
  handleClear(e);
60
61
  }
61
- }, children: _jsx(XIcon, { className: "size-4" }) }))] }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsxs("div", { className: "flex flex-col sm:flex-row sm:items-stretch", children: [_jsx(Calendar, { mode: "single", defaultMonth: validCurrent ? validCurrent.toDate() : undefined, selected: validCurrent ? validCurrent.toDate() : undefined, onSelect: handleDateSelect, disabled: (date) => {
62
+ }, children: _jsx(XIcon, { className: "size-4" }) }))] }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsxs("div", { className: "flex flex-col sm:flex-row sm:items-stretch", children: [_jsx(Calendar, { mode: "single", defaultMonth: validCurrent ? validCurrent.toDate() : undefined, selected: validCurrent ? validCurrent.toDate() : undefined, onSelect: handleDateSelect, locale: locale, disabled: (date) => {
62
63
  if (disabled || readOnly)
63
64
  return true;
64
65
  if (minDate &&
@@ -11,16 +11,26 @@ export type InputFieldProps<T extends FieldValues = FieldValues> = {
11
11
  description?: ReactNode;
12
12
  startAdornment?: ReactNode;
13
13
  endAdornment?: ReactNode;
14
- control: Control<T>;
14
+ /** react-hook-form control. Omit it to drive the field from plain state
15
+ * with `value`/`defaultValue` + `onChange`. */
16
+ control?: Control<T>;
17
+ /** Controlled value for the no-`control` path. */
18
+ value?: string;
15
19
  disabled?: boolean;
16
20
  readOnly?: boolean;
17
21
  minHeight?: number;
18
22
  maxHeight?: number;
19
23
  textArea?: boolean;
20
24
  required?: boolean;
25
+ /**
26
+ * Seed value. With `control` and no form-level default for this name,
27
+ * react-hook-form treats the seed as a VALUE rather than a default, so
28
+ * `formState.isDirty` reads true after `reset()` and after retyping the
29
+ * seed. Prefer `useForm({ defaultValues })` when dirty tracking matters.
30
+ */
21
31
  defaultValue?: string;
22
32
  'data-testid'?: string;
23
33
  onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
24
34
  };
25
- export declare const InputField: <T extends FieldValues = FieldValues>({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }: InputFieldProps<T>) => import("react").JSX.Element;
35
+ export declare const InputField: <T extends FieldValues = FieldValues>({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, value, onChange, ...others }: InputFieldProps<T>) => import("react").JSX.Element;
26
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input-field/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAQ,MAAM,iBAAiB,CAAA;AAE5D,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACjE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,sBAAsB,CAAA;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,M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;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,CACT,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACzD,IAAI,CAAA;CACV,CAAA;AAeD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,uMAmB7D,eAAe,CAAC,CAAC,CAAC,gCA2EpB,CAAA"}
@@ -2,9 +2,33 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AutosizeTextarea } from '../../../components/ui/autosize-textarea/index.js';
3
3
  import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormTooltip } from '../../../components/ui/form.js';
4
4
  import { Input } from '../../../components/ui/input/index.js';
5
- export const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }) => {
6
- return (_jsx(FormField, { ...others, name: others.name, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsx(FormControl, { children: textArea ? (_jsx(AutosizeTextarea, { className: className, placeholder: placeholder, readOnly: readOnly, minHeight: minHeight, maxHeight: maxHeight, defaultValue: defaultValue, "data-testid": others['data-testid'], ...field, onChange: (e) => {
7
- field.onChange(e);
8
- onChange?.(e);
9
- } })) : (_jsx(Input, { className: className, type: type, placeholder: placeholder, readOnly: readOnly, startAdornment: startAdornment, endAdornment: endAdornment, "data-testid": others['data-testid'], ...field })) }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] })) }));
5
+ export const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, value, onChange, ...others }) => {
6
+ const renderItem = (binding) => (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsx(FormControl, { children: textArea ? (_jsx(AutosizeTextarea, { className: className, placeholder: placeholder, readOnly: readOnly, minHeight: minHeight, maxHeight: maxHeight, "data-testid": others['data-testid'], ...binding })) : (_jsx(Input, { className: className, type: type, placeholder: placeholder, readOnly: readOnly, startAdornment: startAdornment, endAdornment: endAdornment, "data-testid": others['data-testid'], ...binding })) }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
7
+ if (!others.control) {
8
+ return renderItem({
9
+ name: others.name,
10
+ disabled: others.disabled,
11
+ // Controlled when the caller holds the value, uncontrolled when it only
12
+ // seeds one — supplying both is what React warns about.
13
+ ...(value !== undefined ? { value } : { defaultValue }),
14
+ onChange: (e) => onChange?.(e)
15
+ });
16
+ }
17
+ return (_jsx(FormField, { ...others, name: others.name,
18
+ // The seed goes through react-hook-form, never straight to the DOM: a
19
+ // value painted on the box only makes the field LOOK filled while the
20
+ // form still submits nothing for that name. Controller seeds its own
21
+ // state from this, so `field.value` carries the seed on both branches.
22
+ defaultValue: defaultValue, render: ({ field }) => renderItem({
23
+ ...field,
24
+ // Controlled from mount. react-hook-form hands `undefined` for any
25
+ // name the form declares no default for; React then mounts the box
26
+ // uncontrolled and flips it on the first keystroke, losing that
27
+ // character.
28
+ value: field.value ?? '',
29
+ onChange: (e) => {
30
+ field.onChange(e);
31
+ onChange?.(e);
32
+ }
33
+ }) }));
10
34
  };