@platned/ui 0.8.2 → 0.8.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.
package/dist/index.d.cts CHANGED
@@ -4716,24 +4716,40 @@ interface TableCellLeadTextProps {
4716
4716
  size?: TableCellSize;
4717
4717
  className?: string;
4718
4718
  }
4719
- /** Primary text plus an optional muted subtitle — for lead entity/name cells. */
4719
+ /**
4720
+ * Primary text plus an optional muted subtitle — for lead entity/name cells.
4721
+ *
4722
+ * Both lines ellipsise, with the full text as a `title`, so a long name can't stretch the row.
4723
+ * `min-w-0` on the root is load-bearing: callers put this next to an Avatar in a flex row, and a
4724
+ * flex item doesn't shrink below its content width without it, so `truncate` would never fire.
4725
+ */
4720
4726
  declare function TableCellLeadText({ primary, secondary, size, className }: TableCellLeadTextProps): react.JSX.Element;
4721
4727
  interface TableCellTextProps {
4722
4728
  children: ReactNode;
4723
4729
  /** Muted (secondary) by default; pass false for the primary colour. */
4724
4730
  muted?: boolean;
4725
4731
  size?: TableCellSize;
4726
- /** Ellipsise instead of wrapping, so every row keeps the same height. */
4732
+ /**
4733
+ * Ellipsise with the full text as a `title` (default). `false` keeps the text on one line at
4734
+ * its full width instead, for a column that is sized to fit its content.
4735
+ *
4736
+ * Defaulted on in 0.8.3. Until then the default was a bare `whitespace-nowrap`, which in a
4737
+ * column narrower than the text clipped it mid-glyph with no ellipsis and no way to read the
4738
+ * rest.
4739
+ */
4727
4740
  truncate?: boolean;
4728
4741
  className?: string;
4729
4742
  }
4730
- /** Plain text cell. */
4743
+ /** Plain one-line text cell. */
4731
4744
  declare function TableCellText({ children, muted, size, truncate, className, }: TableCellTextProps): react.JSX.Element;
4732
4745
  interface TableCellBadgeProps {
4733
4746
  label: string;
4734
4747
  className?: string;
4735
4748
  }
4736
- /** Small outlined chip — entity type labels, categories. */
4749
+ /**
4750
+ * Small outlined chip — entity type labels, categories. A label longer than the column
4751
+ * ellipsises inside the chip, with the full text as a `title`, rather than overflowing it.
4752
+ */
4737
4753
  declare function TableCellBadge({ label, className }: TableCellBadgeProps): react.JSX.Element;
4738
4754
  interface TableCellProgressProps {
4739
4755
  percent: number;
@@ -4743,6 +4759,11 @@ interface TableCellProgressProps {
4743
4759
  */
4744
4760
  tone?: ProgressBarTone;
4745
4761
  size?: TableCellSize;
4762
+ /**
4763
+ * What the bar measures, e.g. "Risk score" — the bar's accessible name, with the value
4764
+ * announced by the progressbar role. Without it the bar is named by its percentage alone.
4765
+ */
4766
+ label?: string;
4746
4767
  className?: string;
4747
4768
  }
4748
4769
  /**
@@ -4751,7 +4772,7 @@ interface TableCellProgressProps {
4751
4772
  * through 0.7.0 it was a fixed 48 / 64px, which left most of a wide column, or of a card field in
4752
4773
  * the responsive layout, empty. `size` now sets the bar's thickness (4 / 6px).
4753
4774
  */
4754
- declare function TableCellProgress({ percent, tone, size, className, }: TableCellProgressProps): react.JSX.Element;
4775
+ declare function TableCellProgress({ percent, tone, size, label, className, }: TableCellProgressProps): react.JSX.Element;
4755
4776
 
4756
4777
  type DataTableColumnAlign = 'start' | 'center' | 'end';
4757
4778
  /**
@@ -4868,8 +4889,14 @@ interface DataTableProps<TData, TValue = unknown> {
4868
4889
  * it. Takes precedence over `onRowClick`.
4869
4890
  */
4870
4891
  getRowHref?: (row: TData) => string;
4871
- /** Renders the row link, e.g. through your router's `Link`. Default: a plain `<a>`. */
4872
- renderRowLink?: (props: DataTableRowLinkProps) => ReactElement;
4892
+ /**
4893
+ * Renders the row link, e.g. through your router's `Link`. Default: a plain `<a>`.
4894
+ *
4895
+ * The row comes as a second argument rather than inside `props`, so spreading `props` onto a
4896
+ * link never puts the row object on a DOM element. Use it for anything the link needs per row,
4897
+ * e.g. router state: `({ href, ...props }, row) => <Link to={href} state={{ from: row.id }} {...props} />`.
4898
+ */
4899
+ renderRowLink?: (props: DataTableRowLinkProps, row: TData) => ReactElement;
4873
4900
  /** A state tint per row, e.g. `(u) => (u.active ? undefined : 'muted')`. */
4874
4901
  getRowTone?: (row: TData) => TableRowTone | undefined;
4875
4902
  /** De-emphasise some rows, e.g. expired ones. */
package/dist/index.d.ts CHANGED
@@ -4716,24 +4716,40 @@ interface TableCellLeadTextProps {
4716
4716
  size?: TableCellSize;
4717
4717
  className?: string;
4718
4718
  }
4719
- /** Primary text plus an optional muted subtitle — for lead entity/name cells. */
4719
+ /**
4720
+ * Primary text plus an optional muted subtitle — for lead entity/name cells.
4721
+ *
4722
+ * Both lines ellipsise, with the full text as a `title`, so a long name can't stretch the row.
4723
+ * `min-w-0` on the root is load-bearing: callers put this next to an Avatar in a flex row, and a
4724
+ * flex item doesn't shrink below its content width without it, so `truncate` would never fire.
4725
+ */
4720
4726
  declare function TableCellLeadText({ primary, secondary, size, className }: TableCellLeadTextProps): react.JSX.Element;
4721
4727
  interface TableCellTextProps {
4722
4728
  children: ReactNode;
4723
4729
  /** Muted (secondary) by default; pass false for the primary colour. */
4724
4730
  muted?: boolean;
4725
4731
  size?: TableCellSize;
4726
- /** Ellipsise instead of wrapping, so every row keeps the same height. */
4732
+ /**
4733
+ * Ellipsise with the full text as a `title` (default). `false` keeps the text on one line at
4734
+ * its full width instead, for a column that is sized to fit its content.
4735
+ *
4736
+ * Defaulted on in 0.8.3. Until then the default was a bare `whitespace-nowrap`, which in a
4737
+ * column narrower than the text clipped it mid-glyph with no ellipsis and no way to read the
4738
+ * rest.
4739
+ */
4727
4740
  truncate?: boolean;
4728
4741
  className?: string;
4729
4742
  }
4730
- /** Plain text cell. */
4743
+ /** Plain one-line text cell. */
4731
4744
  declare function TableCellText({ children, muted, size, truncate, className, }: TableCellTextProps): react.JSX.Element;
4732
4745
  interface TableCellBadgeProps {
4733
4746
  label: string;
4734
4747
  className?: string;
4735
4748
  }
4736
- /** Small outlined chip — entity type labels, categories. */
4749
+ /**
4750
+ * Small outlined chip — entity type labels, categories. A label longer than the column
4751
+ * ellipsises inside the chip, with the full text as a `title`, rather than overflowing it.
4752
+ */
4737
4753
  declare function TableCellBadge({ label, className }: TableCellBadgeProps): react.JSX.Element;
4738
4754
  interface TableCellProgressProps {
4739
4755
  percent: number;
@@ -4743,6 +4759,11 @@ interface TableCellProgressProps {
4743
4759
  */
4744
4760
  tone?: ProgressBarTone;
4745
4761
  size?: TableCellSize;
4762
+ /**
4763
+ * What the bar measures, e.g. "Risk score" — the bar's accessible name, with the value
4764
+ * announced by the progressbar role. Without it the bar is named by its percentage alone.
4765
+ */
4766
+ label?: string;
4746
4767
  className?: string;
4747
4768
  }
4748
4769
  /**
@@ -4751,7 +4772,7 @@ interface TableCellProgressProps {
4751
4772
  * through 0.7.0 it was a fixed 48 / 64px, which left most of a wide column, or of a card field in
4752
4773
  * the responsive layout, empty. `size` now sets the bar's thickness (4 / 6px).
4753
4774
  */
4754
- declare function TableCellProgress({ percent, tone, size, className, }: TableCellProgressProps): react.JSX.Element;
4775
+ declare function TableCellProgress({ percent, tone, size, label, className, }: TableCellProgressProps): react.JSX.Element;
4755
4776
 
4756
4777
  type DataTableColumnAlign = 'start' | 'center' | 'end';
4757
4778
  /**
@@ -4868,8 +4889,14 @@ interface DataTableProps<TData, TValue = unknown> {
4868
4889
  * it. Takes precedence over `onRowClick`.
4869
4890
  */
4870
4891
  getRowHref?: (row: TData) => string;
4871
- /** Renders the row link, e.g. through your router's `Link`. Default: a plain `<a>`. */
4872
- renderRowLink?: (props: DataTableRowLinkProps) => ReactElement;
4892
+ /**
4893
+ * Renders the row link, e.g. through your router's `Link`. Default: a plain `<a>`.
4894
+ *
4895
+ * The row comes as a second argument rather than inside `props`, so spreading `props` onto a
4896
+ * link never puts the row object on a DOM element. Use it for anything the link needs per row,
4897
+ * e.g. router state: `({ href, ...props }, row) => <Link to={href} state={{ from: row.id }} {...props} />`.
4898
+ */
4899
+ renderRowLink?: (props: DataTableRowLinkProps, row: TData) => ReactElement;
4873
4900
  /** A state tint per row, e.g. `(u) => (u.active ? undefined : 'muted')`. */
4874
4901
  getRowTone?: (row: TData) => TableRowTone | undefined;
4875
4902
  /** De-emphasise some rows, e.g. expired ones. */
package/dist/index.js CHANGED
@@ -3380,7 +3380,7 @@ function FormCard({
3380
3380
  }
3381
3381
  function FormCardHeader({ title, subtitle }) {
3382
3382
  return /* @__PURE__ */ jsxs17("div", { className: "border-b border-default px-7 py-6", children: [
3383
- /* @__PURE__ */ jsx24("h2", { className: "text-heading-sm font-semibold text-default leading-snug", children: title }),
3383
+ /* @__PURE__ */ jsx24("h2", { className: "text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]", children: title }),
3384
3384
  subtitle && /* @__PURE__ */ jsx24("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
3385
3385
  ] });
3386
3386
  }
@@ -4467,7 +4467,7 @@ var Checkbox = forwardRef14(function Checkbox2({
4467
4467
  size: size2
4468
4468
  }
4469
4469
  ),
4470
- label && /* @__PURE__ */ jsx41("span", { className: clsx38(LABEL_TEXT2[size2], "text-default"), children: label })
4470
+ label && /* @__PURE__ */ jsx41("span", { className: clsx38(LABEL_TEXT2[size2], "min-w-0 text-default [overflow-wrap:anywhere]"), children: label })
4471
4471
  ]
4472
4472
  }
4473
4473
  ),
@@ -4476,7 +4476,7 @@ var Checkbox = forwardRef14(function Checkbox2({
4476
4476
  {
4477
4477
  id: descriptionId,
4478
4478
  className: clsx38(
4479
- "mt-0.5 pl-[26px]",
4479
+ "mt-0.5 pl-[26px] [overflow-wrap:anywhere]",
4480
4480
  LABEL_TEXT2[size2],
4481
4481
  disabled ? "text-disabled" : "text-default-secondary"
4482
4482
  ),
@@ -9904,7 +9904,7 @@ function DetailItem({
9904
9904
  if (layout === "inline") {
9905
9905
  return /* @__PURE__ */ jsxs72("div", { className: clsx86("flex gap-3 text-body-xs", SPAN[span], className), children: [
9906
9906
  /* @__PURE__ */ jsx107("span", { className: clsx86("shrink-0 text-default-secondary", labelWidth), children: label }),
9907
- /* @__PURE__ */ jsxs72("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
9907
+ /* @__PURE__ */ jsxs72("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]", children: [
9908
9908
  /* @__PURE__ */ jsx107("span", { className: "text-default", children: shown }),
9909
9909
  detail && /* @__PURE__ */ jsx107("span", { className: "text-default-secondary", children: detail })
9910
9910
  ] })
@@ -9912,8 +9912,8 @@ function DetailItem({
9912
9912
  }
9913
9913
  return /* @__PURE__ */ jsxs72("div", { className: clsx86("flex min-w-0 flex-col gap-0.5", SPAN[span], className), children: [
9914
9914
  /* @__PURE__ */ jsx107("p", { className: "text-body-tiny font-medium text-default-secondary", children: label }),
9915
- /* @__PURE__ */ jsx107("p", { className: "text-body-sm font-medium text-default", children: shown }),
9916
- detail && /* @__PURE__ */ jsx107("p", { className: "text-body-xs text-default-secondary", children: detail })
9915
+ /* @__PURE__ */ jsx107("p", { className: "text-body-sm font-medium text-default [overflow-wrap:anywhere]", children: shown }),
9916
+ detail && /* @__PURE__ */ jsx107("p", { className: "text-body-xs text-default-secondary [overflow-wrap:anywhere]", children: detail })
9917
9917
  ] });
9918
9918
  }
9919
9919
  var COLUMNS3 = {
@@ -10618,13 +10618,23 @@ function DataTablePagination({
10618
10618
  // src/components/lists/data-table-cells.tsx
10619
10619
  import clsx93 from "clsx";
10620
10620
  import { jsx as jsx115, jsxs as jsxs79 } from "react/jsx-runtime";
10621
+ function textFromNode(node) {
10622
+ if (typeof node === "string") return node;
10623
+ if (typeof node === "number") return String(node);
10624
+ if (Array.isArray(node)) {
10625
+ const parts4 = node.map(textFromNode);
10626
+ return parts4.every((part) => part !== void 0) ? parts4.join("") : void 0;
10627
+ }
10628
+ return void 0;
10629
+ }
10621
10630
  function TableCellLeadText({ primary, secondary, size: size2 = "md", className }) {
10622
- return /* @__PURE__ */ jsxs79("div", { className: clsx93("flex flex-col gap-0.5", className), children: [
10631
+ return /* @__PURE__ */ jsxs79("div", { className: clsx93("flex min-w-0 flex-col gap-0.5", className), children: [
10623
10632
  /* @__PURE__ */ jsx115(
10624
10633
  "span",
10625
10634
  {
10635
+ title: primary,
10626
10636
  className: clsx93(
10627
- "font-medium leading-snug text-default",
10637
+ "block truncate font-medium leading-snug text-default",
10628
10638
  size2 === "sm" ? "text-body-xs" : "text-body-sm"
10629
10639
  ),
10630
10640
  children: primary
@@ -10633,8 +10643,9 @@ function TableCellLeadText({ primary, secondary, size: size2 = "md", className }
10633
10643
  secondary && /* @__PURE__ */ jsx115(
10634
10644
  "span",
10635
10645
  {
10646
+ title: secondary,
10636
10647
  className: clsx93(
10637
- "font-normal leading-tight text-default-secondary",
10648
+ "block truncate font-normal leading-tight text-default-secondary",
10638
10649
  size2 === "sm" ? "text-body-tiny" : "text-body-xs"
10639
10650
  ),
10640
10651
  children: secondary
@@ -10646,16 +10657,17 @@ function TableCellText({
10646
10657
  children,
10647
10658
  muted = true,
10648
10659
  size: size2 = "md",
10649
- truncate = false,
10660
+ truncate = true,
10650
10661
  className
10651
10662
  }) {
10652
10663
  return /* @__PURE__ */ jsx115(
10653
10664
  "span",
10654
10665
  {
10666
+ title: truncate ? textFromNode(children) : void 0,
10655
10667
  className: clsx93(
10656
10668
  "font-normal leading-snug",
10657
10669
  size2 === "sm" ? "text-body-tiny" : "text-body-xs",
10658
- truncate ? "block truncate" : "whitespace-nowrap",
10670
+ truncate ? "block min-w-0 truncate" : "whitespace-nowrap",
10659
10671
  muted ? "text-default-secondary" : "text-default",
10660
10672
  className
10661
10673
  ),
@@ -10667,11 +10679,12 @@ function TableCellBadge({ label, className }) {
10667
10679
  return /* @__PURE__ */ jsx115(
10668
10680
  "span",
10669
10681
  {
10682
+ title: label,
10670
10683
  className: clsx93(
10671
- "inline-flex items-center rounded-md border border-default bg-default-secondary px-2 py-0.5 text-body-tiny font-medium text-default-secondary whitespace-nowrap",
10684
+ "inline-flex max-w-full items-center rounded-md border border-default bg-default-secondary px-2 py-0.5 text-body-tiny font-medium text-default-secondary",
10672
10685
  className
10673
10686
  ),
10674
- children: label
10687
+ children: /* @__PURE__ */ jsx115("span", { className: "truncate", children: label })
10675
10688
  }
10676
10689
  );
10677
10690
  }
@@ -10679,9 +10692,10 @@ function TableCellProgress({
10679
10692
  percent,
10680
10693
  tone = "brand",
10681
10694
  size: size2 = "md",
10695
+ label,
10682
10696
  className
10683
10697
  }) {
10684
- const clamped = Math.min(100, Math.max(0, percent));
10698
+ const clamped = Math.round(Math.min(100, Math.max(0, percent)));
10685
10699
  return /* @__PURE__ */ jsxs79("div", { className: clsx93("flex w-full min-w-0 items-center gap-2", className), children: [
10686
10700
  /* @__PURE__ */ jsx115(
10687
10701
  ProgressBar,
@@ -10690,11 +10704,11 @@ function TableCellProgress({
10690
10704
  tone,
10691
10705
  size: size2 === "sm" ? "xs" : "sm",
10692
10706
  className: "min-w-12 flex-1",
10693
- "aria-label": `${clamped}%`
10707
+ "aria-label": label ?? `${clamped}%`
10694
10708
  }
10695
10709
  ),
10696
10710
  /* @__PURE__ */ jsxs79("span", { className: "shrink-0 text-body-tiny leading-none tabular-nums text-default-secondary", children: [
10697
- percent,
10711
+ clamped,
10698
10712
  "%"
10699
10713
  ] })
10700
10714
  ] });
@@ -11192,7 +11206,7 @@ function BodyCell({
11192
11206
  [ROW_LINK_ATTR]: "",
11193
11207
  className: cn("block min-w-0 rounded-sm", FOCUS_RING_INSET),
11194
11208
  children: content
11195
- });
11209
+ }, cell.row.original);
11196
11210
  }
11197
11211
  return /* @__PURE__ */ jsx116(
11198
11212
  "td",
@@ -11288,7 +11302,7 @@ function CardList({
11288
11302
  children: [
11289
11303
  /* @__PURE__ */ jsxs80("div", { className: "flex items-start gap-3", children: [
11290
11304
  selectable && /* @__PURE__ */ jsx116("div", { className: "relative z-raised shrink-0 pt-0.5", children: render(SELECT_COLUMN_ID) }),
11291
- /* @__PURE__ */ jsx116("div", { className: "min-w-0 flex-1", children: href ? renderRowLink({ href, [ROW_LINK_ATTR]: "", className: trigger, children: titleContent }) : onRowClick ? /* @__PURE__ */ jsx116(
11305
+ /* @__PURE__ */ jsx116("div", { className: "min-w-0 flex-1", children: href ? renderRowLink({ href, [ROW_LINK_ATTR]: "", className: trigger, children: titleContent }, row.original) : onRowClick ? /* @__PURE__ */ jsx116(
11292
11306
  "button",
11293
11307
  {
11294
11308
  type: "button",
@@ -11558,7 +11572,7 @@ function Toaster({
11558
11572
  "aria-atomic": "false",
11559
11573
  ...{ [TOASTER_ATTRIBUTE]: "" },
11560
11574
  className: clsx97(
11561
- "pointer-events-none fixed z-toast flex w-full max-w-[380px] flex-col gap-2",
11575
+ "pointer-events-none fixed z-toast flex w-[calc(100%-2rem)] max-w-[380px] flex-col gap-2",
11562
11576
  POSITION[position]
11563
11577
  ),
11564
11578
  children: toasts.map((entry) => /* @__PURE__ */ jsx120(ToastItem, { toast: entry, onDismiss: () => dismiss(entry.id) }, entry.id))