@platned/ui 1.1.0 → 1.1.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.
package/dist/blocks.d.cts CHANGED
@@ -87,7 +87,10 @@ interface SidebarNavItem {
87
87
  disabled?: boolean;
88
88
  /** Overrides route matching. */
89
89
  isActive?: boolean;
90
- /** Child rows, one level deep, in a foldable sub-menu. */
90
+ /**
91
+ * Child rows, one level deep, in a foldable sub-menu. With a `to` or `href` of its own (from 1.1.1), the row opens
92
+ * that page (a section's overview, say) and a chevron button beside it folds the children.
93
+ */
91
94
  children?: SidebarNavItem[];
92
95
  /** Whether the children start open. Default: open when one of them is the current route. */
93
96
  defaultOpen?: boolean;
@@ -297,13 +300,18 @@ interface DataTableFilterOptions {
297
300
  variant?: 'menu' | 'buttons' | 'tabs';
298
301
  /** Label of the "everything" choice of `buttons` and `tabs`. Default "All". */
299
302
  allLabel?: string;
303
+ /**
304
+ * Show the filter but don't let it be used, e.g. while the server can't filter by this column yet. A string says
305
+ * why, on hover. New in 1.1.1.
306
+ */
307
+ disabled?: boolean | string;
300
308
  }
301
309
  type DataTableField<TData> = ValueField<TData> & {
302
310
  /** Column id. Default: the key. */
303
311
  id?: string;
304
312
  /** Sort by this column. Default `true`, except for `badge` columns (lists). */
305
313
  sortable?: boolean;
306
- /** Can be hidden from the Columns menu. Default `true`. */
314
+ /** Can be hidden from its header menu and the View menu. Default `true`. */
307
315
  hideable?: boolean;
308
316
  /** A faceted filter for this column in the toolbar. */
309
317
  filter?: boolean | DataTableFilterOptions;
@@ -341,6 +349,8 @@ interface DataTableFilterMeta {
341
349
  options?: string[];
342
350
  variant: 'menu' | 'buttons' | 'tabs';
343
351
  allLabel: string;
352
+ /** Shown but not usable; a string says why. */
353
+ disabled?: boolean | string;
344
354
  /** The label and badge colour for one value, as the column shows it. */
345
355
  describe: (value: string) => {
346
356
  label: string;
@@ -475,6 +485,12 @@ interface DataTableManual {
475
485
  pagination?: boolean;
476
486
  /** Total rows on the server. Needed with `pagination`, so the pager knows the page count. */
477
487
  rowCount?: number;
488
+ /**
489
+ * With `filtering`: each filter's counts from the server, by column id, then value, e.g.
490
+ * `{ status: { active: 120, inactive: 4 } }`. The rows on hand are one page, so the table can't
491
+ * count them itself; a filter the server sends no counts for shows none. New in 1.1.1.
492
+ */
493
+ facets?: Record<string, Record<string, number>>;
478
494
  }
479
495
  interface DataTableSearchOptions {
480
496
  /** Filter one column instead of every column. */
@@ -482,6 +498,11 @@ interface DataTableSearchOptions {
482
498
  placeholder?: string;
483
499
  /** Accessible name. Default "Search". */
484
500
  label?: string;
501
+ /**
502
+ * Show the box but don't let it be used, e.g. while the server can't search yet. A string says why, on hover.
503
+ * New in 1.1.1.
504
+ */
505
+ disabled?: boolean | string;
485
506
  }
486
507
  interface DataTableRowLinkProps {
487
508
  href: string;
@@ -609,8 +630,13 @@ interface DataTableProps<TData, TValue = unknown> {
609
630
  * header row pinned. Works with horizontal scrolling and sticky columns, and caps the card list
610
631
  * in the responsive layout. The pattern of MUI's `TableContainer` + `stickyHeader` and Ant
611
632
  * Design's `scroll.y`. New in 0.7.1.
633
+ *
634
+ * `'fill'` takes the height of the parent instead (a flex column, or a box with a set height): the
635
+ * toolbar and pager stay put and the rows scroll in what is left, as on a list page whose heading
636
+ * stays fixed. Where the parent has no set height (a page that scrolls as a whole, on a phone) the
637
+ * table simply grows. New in 1.1.1.
612
638
  */
613
- maxHeight?: number | string;
639
+ maxHeight?: number | string | 'fill';
614
640
  manual?: DataTableManual;
615
641
  /** Controlled state. Any key you pass is controlled; the rest stay internal. */
616
642
  state?: Partial<DataTableState>;
package/dist/blocks.d.ts CHANGED
@@ -87,7 +87,10 @@ interface SidebarNavItem {
87
87
  disabled?: boolean;
88
88
  /** Overrides route matching. */
89
89
  isActive?: boolean;
90
- /** Child rows, one level deep, in a foldable sub-menu. */
90
+ /**
91
+ * Child rows, one level deep, in a foldable sub-menu. With a `to` or `href` of its own (from 1.1.1), the row opens
92
+ * that page (a section's overview, say) and a chevron button beside it folds the children.
93
+ */
91
94
  children?: SidebarNavItem[];
92
95
  /** Whether the children start open. Default: open when one of them is the current route. */
93
96
  defaultOpen?: boolean;
@@ -297,13 +300,18 @@ interface DataTableFilterOptions {
297
300
  variant?: 'menu' | 'buttons' | 'tabs';
298
301
  /** Label of the "everything" choice of `buttons` and `tabs`. Default "All". */
299
302
  allLabel?: string;
303
+ /**
304
+ * Show the filter but don't let it be used, e.g. while the server can't filter by this column yet. A string says
305
+ * why, on hover. New in 1.1.1.
306
+ */
307
+ disabled?: boolean | string;
300
308
  }
301
309
  type DataTableField<TData> = ValueField<TData> & {
302
310
  /** Column id. Default: the key. */
303
311
  id?: string;
304
312
  /** Sort by this column. Default `true`, except for `badge` columns (lists). */
305
313
  sortable?: boolean;
306
- /** Can be hidden from the Columns menu. Default `true`. */
314
+ /** Can be hidden from its header menu and the View menu. Default `true`. */
307
315
  hideable?: boolean;
308
316
  /** A faceted filter for this column in the toolbar. */
309
317
  filter?: boolean | DataTableFilterOptions;
@@ -341,6 +349,8 @@ interface DataTableFilterMeta {
341
349
  options?: string[];
342
350
  variant: 'menu' | 'buttons' | 'tabs';
343
351
  allLabel: string;
352
+ /** Shown but not usable; a string says why. */
353
+ disabled?: boolean | string;
344
354
  /** The label and badge colour for one value, as the column shows it. */
345
355
  describe: (value: string) => {
346
356
  label: string;
@@ -475,6 +485,12 @@ interface DataTableManual {
475
485
  pagination?: boolean;
476
486
  /** Total rows on the server. Needed with `pagination`, so the pager knows the page count. */
477
487
  rowCount?: number;
488
+ /**
489
+ * With `filtering`: each filter's counts from the server, by column id, then value, e.g.
490
+ * `{ status: { active: 120, inactive: 4 } }`. The rows on hand are one page, so the table can't
491
+ * count them itself; a filter the server sends no counts for shows none. New in 1.1.1.
492
+ */
493
+ facets?: Record<string, Record<string, number>>;
478
494
  }
479
495
  interface DataTableSearchOptions {
480
496
  /** Filter one column instead of every column. */
@@ -482,6 +498,11 @@ interface DataTableSearchOptions {
482
498
  placeholder?: string;
483
499
  /** Accessible name. Default "Search". */
484
500
  label?: string;
501
+ /**
502
+ * Show the box but don't let it be used, e.g. while the server can't search yet. A string says why, on hover.
503
+ * New in 1.1.1.
504
+ */
505
+ disabled?: boolean | string;
485
506
  }
486
507
  interface DataTableRowLinkProps {
487
508
  href: string;
@@ -609,8 +630,13 @@ interface DataTableProps<TData, TValue = unknown> {
609
630
  * header row pinned. Works with horizontal scrolling and sticky columns, and caps the card list
610
631
  * in the responsive layout. The pattern of MUI's `TableContainer` + `stickyHeader` and Ant
611
632
  * Design's `scroll.y`. New in 0.7.1.
633
+ *
634
+ * `'fill'` takes the height of the parent instead (a flex column, or a box with a set height): the
635
+ * toolbar and pager stay put and the rows scroll in what is left, as on a list page whose heading
636
+ * stays fixed. Where the parent has no set height (a page that scrolls as a whole, on a phone) the
637
+ * table simply grows. New in 1.1.1.
612
638
  */
613
- maxHeight?: number | string;
639
+ maxHeight?: number | string | 'fill';
614
640
  manual?: DataTableManual;
615
641
  /** Controlled state. Any key you pass is controlled; the rest stay internal. */
616
642
  state?: Partial<DataTableState>;
package/dist/blocks.js CHANGED
@@ -7478,10 +7478,14 @@ function DetailRow({
7478
7478
  const { span, copy, hint, permission: _permission, ...valueField } = field;
7479
7479
  const label = field.label ?? humanize5(String(field.key));
7480
7480
  const raw = getValueAt6(record, String(field.key));
7481
- const value = /* @__PURE__ */ jsxs20("span", { className: "inline-flex min-w-0 items-center gap-1", children: [
7482
- /* @__PURE__ */ jsx23(Value4, { row: record, field: valueField, className: "break-words" }),
7483
- copy && !isEmptyValue2(raw) && /* @__PURE__ */ jsx23(CopyValue, { value: String(raw), label })
7484
- ] });
7481
+ const value = (
7482
+ // max-w-full and min-w-0: in the rows layout the value is end-aligned, so nothing else stops a long one
7483
+ // (an email, a URL) from running over its label; this way it wraps, or truncates where its type does.
7484
+ /* @__PURE__ */ jsxs20("span", { className: "inline-flex max-w-full min-w-0 items-center gap-1", children: [
7485
+ /* @__PURE__ */ jsx23(Value4, { row: record, field: valueField, className: "min-w-0 break-words" }),
7486
+ copy && !isEmptyValue2(raw) && /* @__PURE__ */ jsx23(CopyValue, { value: String(raw), label })
7487
+ ] })
7488
+ );
7485
7489
  if (layout === "rows") {
7486
7490
  return /* @__PURE__ */ jsxs20("div", { "data-slot": "detail-row", className: "flex items-start justify-between gap-4 py-2.5 first:pt-0 last:pb-0", children: [
7487
7491
  /* @__PURE__ */ jsx23("dt", { className: "shrink-0 text-muted-foreground", children: label }),