@godxjp/ui 13.17.1 → 13.17.3

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.
@@ -25,10 +25,16 @@ interface DataTableProps<T> {
25
25
  hoverable?: boolean;
26
26
  /** Pin the header to the top while the body scrolls. Default true. */
27
27
  stickyHeader?: boolean;
28
+ /**
29
+ * Per-row className for state-based row tinting (e.g. flag an invalid or
30
+ * empty record). Returned classes are appended last, so they win over the
31
+ * built-in hover/selected fills. Return `undefined` to leave a row unstyled.
32
+ */
33
+ rowClassName?: (row: T) => string | undefined;
28
34
  className?: string;
29
35
  children?: React.ReactNode;
30
36
  }
31
- export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, loading, empty, striped, hoverable, stickyHeader, className, children, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
37
+ export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, loading, empty, striped, hoverable, stickyHeader, rowClassName, className, children, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
32
38
  export declare namespace DataTable {
33
39
  var Toolbar: ({ children, className, }: {
34
40
  children?: React.ReactNode;
@@ -53,6 +53,7 @@ function DataTable({
53
53
  striped = false,
54
54
  hoverable = false,
55
55
  stickyHeader = true,
56
+ rowClassName,
56
57
  className,
57
58
  children
58
59
  }) {
@@ -101,7 +102,8 @@ function DataTable({
101
102
  emptyColSpan,
102
103
  striped,
103
104
  hoverable,
104
- stickyHeader
105
+ stickyHeader,
106
+ rowClassName
105
107
  };
106
108
  const hasContent = React.Children.toArray(children).some(
107
109
  (c) => React.isValidElement(c) && c.type.displayName === "DataTable.Content"
@@ -195,7 +197,8 @@ DataTable.Content = function DataTableContent() {
195
197
  emptyColSpan,
196
198
  striped,
197
199
  hoverable,
198
- stickyHeader
200
+ stickyHeader,
201
+ rowClassName
199
202
  } = useDataTableContext();
200
203
  const { t } = useTranslation();
201
204
  const rowPadding = tableRowHeightClass;
@@ -329,7 +332,8 @@ DataTable.Content = function DataTableContent() {
329
332
  (onRowClick || hoverable) && "hover:bg-muted/50",
330
333
  // …but the affordance (cursor + focus ring) only when clickable.
331
334
  onRowClick && "focus-visible:ring-ring cursor-pointer focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset",
332
- isSelected && "bg-muted/30"
335
+ isSelected && "bg-muted/30",
336
+ rowClassName?.(row)
333
337
  ),
334
338
  children: [
335
339
  selectable && /* @__PURE__ */ jsx(TableCell, { className: cellPadding, children: /* @__PURE__ */ jsx(
@@ -20,14 +20,30 @@
20
20
  .ui-form-field {
21
21
  display: grid;
22
22
  gap: var(--field-label-gap);
23
+ /* Fill the container's inline (horizontal) axis in ANY parent — a Form's
24
+ * flex column (.ui-form), a ResponsiveGrid cell, or a bare flex column /
25
+ * block — instead of collapsing to the content's max-content width. This
26
+ * mirrors Ant Design's Form.Item, which sets the item/control to width:100%
27
+ * in vertical layout rather than relying on the parent to stretch it. Without
28
+ * this, a flex-column parent maps `align-self:start` onto the inline axis and
29
+ * the field shrinks to its widest content (a helper-less input collapses to
30
+ * its default ~20ch). Inline layout opts out below (Ant: compact, content-width). */
31
+ inline-size: 100%;
23
32
  /* Never stretch to a taller grid-row sibling (e.g. a field carrying a
24
33
  * helper/error). Stretching would let .ui-form-field-control's
25
34
  * align-content:center vertically centre the control, so a field WITHOUT a
26
35
  * helper sits lower than one WITH a helper in the same ResponsiveGrid row.
27
- * Hugging content keeps every control top-aligned across the row. */
36
+ * Hugging content keeps every control top-aligned across the row. This is the
37
+ * BLOCK (vertical) axis only — width is pinned by inline-size:100% above. */
28
38
  align-self: start;
29
39
  }
30
40
 
41
+ /* Inline layout is intentionally compact (Ant: layout="inline"): the field
42
+ * hugs its content so a row of inline fields can sit side by side. */
43
+ .ui-form-field[data-layout="inline"] {
44
+ inline-size: auto;
45
+ }
46
+
31
47
  .ui-form-field-label {
32
48
  display: flex;
33
49
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godxjp/ui",
3
- "version": "13.17.1",
3
+ "version": "13.17.3",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@10.29.1",
6
6
  "sideEffects": false,