@platned/ui 0.9.0 → 0.9.2

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
@@ -3090,7 +3090,16 @@ declare function PageHeading({ title, subtitle, size, as, actions, truncateTitle
3090
3090
 
3091
3091
  type PageToolbarSize = 'sm' | 'md';
3092
3092
  interface PageToolbarProps {
3093
+ /** The heading block (usually a `PageHeading`). Without `actions`, the actions as well (legacy). */
3093
3094
  children: ReactNode;
3095
+ /**
3096
+ * The action cluster, e.g. buttons. New in 0.9.1. Passing it makes the bar responsive: on a
3097
+ * wide screen the actions sit on the heading's row, at the right; when they don't fit, they
3098
+ * wrap below the heading and among themselves. The heading never narrows below 12rem (or the
3099
+ * full width, if less). Without it, children keep the old single-row layout, which squeezed
3100
+ * the heading to a sliver and ran the actions off-screen on a phone.
3101
+ */
3102
+ actions?: ReactNode;
3094
3103
  /**
3095
3104
  * Renders an icon-only back control at the far left, ahead of the heading: the Page Header's
3096
3105
  * `backButton` in Figma (node 3473:16837). New in 0.7.0, from SCIC. Omit for no back control.
@@ -3098,7 +3107,10 @@ interface PageToolbarProps {
3098
3107
  onBack?: () => void;
3099
3108
  /** Accessible name for the back control. Default "Go back". */
3100
3109
  backLabel?: string;
3101
- /** Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons). */
3110
+ /**
3111
+ * Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons).
3112
+ * @deprecated Pass the actions through `actions`, which always wraps where needed.
3113
+ */
3102
3114
  wrap?: boolean;
3103
3115
  /**
3104
3116
  * The bar's **own** height and padding. `sm` suits a secondary bar under the main toolbar.
@@ -3119,7 +3131,7 @@ interface PageToolbarProps {
3119
3131
  * variant is adopted here, which is a deliberate improvement below `md` where the
3120
3132
  * fixed 28px padding was cramped.
3121
3133
  */
3122
- declare function PageToolbar({ children, onBack, backLabel, wrap, size, className, }: PageToolbarProps): react.JSX.Element;
3134
+ declare function PageToolbar({ children, actions, onBack, backLabel, wrap, size, className, }: PageToolbarProps): react.JSX.Element;
3123
3135
 
3124
3136
  type FilterBarSize = 'sm' | 'md';
3125
3137
  interface FilterBarProps {
@@ -4621,6 +4633,11 @@ declare function CopyButton({ value, label, copiedLabel, className }: CopyButton
4621
4633
  * `alexandra.konstan…@example.com`. The full address stays in the DOM (screen readers and copy
4622
4634
  * get all of it) and in `title`. Pair it with `copyValue`, so touch users, who cannot hover, can
4623
4635
  * still get the address.
4636
+ *
4637
+ * An email never wraps. It ellipsises through explicit overflow classes rather than the
4638
+ * `truncate` utility, because containers that un-truncate for touch target `.truncate`.
4639
+ * `DataTable`'s card layout does that, and through 0.9.0 it broke an address mid-word
4640
+ * ("alex.reviewer@example.tes / t").
4624
4641
  */
4625
4642
  declare function EmailText({ email, className }: {
4626
4643
  email: string;
@@ -4852,7 +4869,12 @@ declare function DataTablePagination<TData>({ table, pageSizeOptions, summary, }
4852
4869
  type TableCellSize = 'sm' | 'md';
4853
4870
  interface TableCellLeadTextProps {
4854
4871
  primary: string;
4855
- secondary?: string;
4872
+ /**
4873
+ * The muted second line. A string ellipsises with a `title`. From 0.9.1 it can also be an
4874
+ * element, such as `<EmailText email={…} />`, which manages its own overflow: an email
4875
+ * should truncate before the `@`, never wrap mid-word.
4876
+ */
4877
+ secondary?: ReactNode;
4856
4878
  size?: TableCellSize;
4857
4879
  className?: string;
4858
4880
  }
package/dist/index.d.ts CHANGED
@@ -3090,7 +3090,16 @@ declare function PageHeading({ title, subtitle, size, as, actions, truncateTitle
3090
3090
 
3091
3091
  type PageToolbarSize = 'sm' | 'md';
3092
3092
  interface PageToolbarProps {
3093
+ /** The heading block (usually a `PageHeading`). Without `actions`, the actions as well (legacy). */
3093
3094
  children: ReactNode;
3095
+ /**
3096
+ * The action cluster, e.g. buttons. New in 0.9.1. Passing it makes the bar responsive: on a
3097
+ * wide screen the actions sit on the heading's row, at the right; when they don't fit, they
3098
+ * wrap below the heading and among themselves. The heading never narrows below 12rem (or the
3099
+ * full width, if less). Without it, children keep the old single-row layout, which squeezed
3100
+ * the heading to a sliver and ran the actions off-screen on a phone.
3101
+ */
3102
+ actions?: ReactNode;
3094
3103
  /**
3095
3104
  * Renders an icon-only back control at the far left, ahead of the heading: the Page Header's
3096
3105
  * `backButton` in Figma (node 3473:16837). New in 0.7.0, from SCIC. Omit for no back control.
@@ -3098,7 +3107,10 @@ interface PageToolbarProps {
3098
3107
  onBack?: () => void;
3099
3108
  /** Accessible name for the back control. Default "Go back". */
3100
3109
  backLabel?: string;
3101
- /** Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons). */
3110
+ /**
3111
+ * Allow the row to wrap when the action cluster is wide (entity-detail has seven buttons).
3112
+ * @deprecated Pass the actions through `actions`, which always wraps where needed.
3113
+ */
3102
3114
  wrap?: boolean;
3103
3115
  /**
3104
3116
  * The bar's **own** height and padding. `sm` suits a secondary bar under the main toolbar.
@@ -3119,7 +3131,7 @@ interface PageToolbarProps {
3119
3131
  * variant is adopted here, which is a deliberate improvement below `md` where the
3120
3132
  * fixed 28px padding was cramped.
3121
3133
  */
3122
- declare function PageToolbar({ children, onBack, backLabel, wrap, size, className, }: PageToolbarProps): react.JSX.Element;
3134
+ declare function PageToolbar({ children, actions, onBack, backLabel, wrap, size, className, }: PageToolbarProps): react.JSX.Element;
3123
3135
 
3124
3136
  type FilterBarSize = 'sm' | 'md';
3125
3137
  interface FilterBarProps {
@@ -4621,6 +4633,11 @@ declare function CopyButton({ value, label, copiedLabel, className }: CopyButton
4621
4633
  * `alexandra.konstan…@example.com`. The full address stays in the DOM (screen readers and copy
4622
4634
  * get all of it) and in `title`. Pair it with `copyValue`, so touch users, who cannot hover, can
4623
4635
  * still get the address.
4636
+ *
4637
+ * An email never wraps. It ellipsises through explicit overflow classes rather than the
4638
+ * `truncate` utility, because containers that un-truncate for touch target `.truncate`.
4639
+ * `DataTable`'s card layout does that, and through 0.9.0 it broke an address mid-word
4640
+ * ("alex.reviewer@example.tes / t").
4624
4641
  */
4625
4642
  declare function EmailText({ email, className }: {
4626
4643
  email: string;
@@ -4852,7 +4869,12 @@ declare function DataTablePagination<TData>({ table, pageSizeOptions, summary, }
4852
4869
  type TableCellSize = 'sm' | 'md';
4853
4870
  interface TableCellLeadTextProps {
4854
4871
  primary: string;
4855
- secondary?: string;
4872
+ /**
4873
+ * The muted second line. A string ellipsises with a `title`. From 0.9.1 it can also be an
4874
+ * element, such as `<EmailText email={…} />`, which manages its own overflow: an email
4875
+ * should truncate before the `@`, never wrap mid-word.
4876
+ */
4877
+ secondary?: ReactNode;
4856
4878
  size?: TableCellSize;
4857
4879
  className?: string;
4858
4880
  }
package/dist/index.js CHANGED
@@ -804,7 +804,9 @@ var inputControlClasses = (size2, invalid, disabled) => clsx10(
804
804
  disabled ? "cursor-not-allowed bg-disabled border-disabled text-disabled placeholder:text-disabled" : invalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand",
805
805
  // read-only is not disabled: the value still matters and is still selectable, but it
806
806
  // must not look editable. Nothing in the library styled this before 0.4.0.
807
- "read-only:bg-default-secondary read-only:cursor-default"
807
+ // `enabled:` because a disabled input also matches `:read-only`. Through 0.9.1 that let this
808
+ // lighter fill override `bg-disabled`, so a disabled field looked read-only (0.9.2).
809
+ "enabled:read-only:bg-default-secondary enabled:read-only:cursor-default"
808
810
  );
809
811
  var Input = forwardRef6(function Input2({
810
812
  label,
@@ -979,7 +981,8 @@ var TextareaControl = forwardRef7(
979
981
  "focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default",
980
982
  textareaBase[size2],
981
983
  isDisabled ? "cursor-not-allowed resize-none border-disabled bg-disabled text-disabled placeholder:text-disabled" : isInvalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand",
982
- "read-only:cursor-default read-only:resize-none read-only:bg-default-secondary",
984
+ // `enabled:`: a disabled textarea also matches `:read-only` (see Input).
985
+ "enabled:read-only:cursor-default enabled:read-only:resize-none enabled:read-only:bg-default-secondary",
983
986
  className
984
987
  ),
985
988
  ...props
@@ -3618,7 +3621,7 @@ function FormCard({
3618
3621
  );
3619
3622
  }
3620
3623
  function FormCardHeader({ title, subtitle }) {
3621
- return /* @__PURE__ */ jsxs18("div", { className: "border-b border-default px-7 py-6", children: [
3624
+ return /* @__PURE__ */ jsxs18("div", { className: "border-b border-default px-4 py-5 sm:px-7 sm:py-6", children: [
3622
3625
  /* @__PURE__ */ jsx25("h2", { className: "text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]", children: title }),
3623
3626
  subtitle && /* @__PURE__ */ jsx25("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
3624
3627
  ] });
@@ -3803,13 +3806,14 @@ function RoleBadge({ role, size: size2 = "sm", tone, color }) {
3803
3806
  "span",
3804
3807
  {
3805
3808
  "data-tone": tone,
3809
+ title: role,
3806
3810
  className: clsx28(
3807
- "inline-flex items-center rounded-full font-medium whitespace-nowrap",
3811
+ "inline-flex max-w-full items-center rounded-full font-medium whitespace-nowrap align-middle",
3808
3812
  size2 === "sm" ? "px-2 py-0.5 text-body-tiny" : "px-3 py-1 text-body-xs",
3809
3813
  !rawColor && TONE_STYLES[resolved]
3810
3814
  ),
3811
3815
  style: rawColor ? { backgroundColor: `${rawColor}1F`, color: rawColor } : void 0,
3812
- children: role
3816
+ children: /* @__PURE__ */ jsx27("span", { className: "min-w-0 truncate", children: role })
3813
3817
  }
3814
3818
  );
3815
3819
  }
@@ -7926,12 +7930,33 @@ var SIZE7 = {
7926
7930
  };
7927
7931
  function PageToolbar({
7928
7932
  children,
7933
+ actions,
7929
7934
  onBack,
7930
7935
  backLabel = "Go back",
7931
7936
  wrap,
7932
7937
  size: size2 = "md",
7933
7938
  className
7934
7939
  }) {
7940
+ if (actions !== void 0) {
7941
+ return /* @__PURE__ */ jsxs48(
7942
+ "div",
7943
+ {
7944
+ "data-slot": "page-toolbar",
7945
+ className: clsx53(
7946
+ "flex shrink-0 flex-wrap items-center gap-x-4 gap-y-3 border-b border-default bg-default",
7947
+ SIZE7[size2],
7948
+ className
7949
+ ),
7950
+ children: [
7951
+ /* @__PURE__ */ jsxs48("div", { className: "flex min-w-[min(100%,12rem)] flex-1 basis-48 items-center gap-4", children: [
7952
+ onBack && /* @__PURE__ */ jsx73(IconButton, { variant: "neutral", size: "md", "aria-label": backLabel, onClick: onBack, children: /* @__PURE__ */ jsx73(ArrowLeftIcon2, { "aria-hidden": true }) }),
7953
+ /* @__PURE__ */ jsx73("div", { className: "min-w-0 flex-1", children })
7954
+ ] }),
7955
+ /* @__PURE__ */ jsx73("div", { "data-slot": "page-toolbar-actions", className: "ml-auto flex max-w-full flex-wrap items-center justify-end gap-2", children: actions })
7956
+ ]
7957
+ }
7958
+ );
7959
+ }
7935
7960
  return /* @__PURE__ */ jsxs48(
7936
7961
  "div",
7937
7962
  {
@@ -10296,9 +10321,9 @@ function EmailText({ email, className }) {
10296
10321
  const at = email.lastIndexOf("@");
10297
10322
  const local = at > 0 ? email.slice(0, at) : email;
10298
10323
  const domain = at > 0 ? email.slice(at) : "";
10299
- return /* @__PURE__ */ jsxs75("span", { title: email, className: clsx88("flex min-w-0 max-w-full", className), children: [
10300
- /* @__PURE__ */ jsx109("span", { className: "min-w-0 truncate", children: local }),
10301
- domain && /* @__PURE__ */ jsx109("span", { className: "min-w-0 truncate [flex-shrink:0.001]", children: domain })
10324
+ return /* @__PURE__ */ jsxs75("span", { title: email, "data-slot": "email-text", className: clsx88("flex min-w-0 max-w-full", className), children: [
10325
+ /* @__PURE__ */ jsx109("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap", children: local }),
10326
+ domain && /* @__PURE__ */ jsx109("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [flex-shrink:0.001]", children: domain })
10302
10327
  ] });
10303
10328
  }
10304
10329
 
@@ -10932,17 +10957,30 @@ function TableCellLeadText({ primary, secondary, size: size2 = "md", className }
10932
10957
  children: primary
10933
10958
  }
10934
10959
  ),
10935
- secondary && /* @__PURE__ */ jsx116(
10960
+ secondary && (typeof secondary === "string" || typeof secondary === "number" ? /* @__PURE__ */ jsx116(
10936
10961
  "span",
10937
10962
  {
10938
- title: secondary,
10963
+ title: String(secondary),
10939
10964
  className: clsx94(
10940
10965
  "block truncate font-normal leading-tight text-default-secondary",
10941
10966
  size2 === "sm" ? "text-body-tiny" : "text-body-xs"
10942
10967
  ),
10943
10968
  children: secondary
10944
10969
  }
10945
- )
10970
+ ) : (
10971
+ // An element brings its own overflow handling, so it gets no `truncate` here,
10972
+ // which a card layout's touch un-truncation would otherwise turn into wrapping.
10973
+ /* @__PURE__ */ jsx116(
10974
+ "span",
10975
+ {
10976
+ className: clsx94(
10977
+ "block min-w-0 font-normal leading-tight text-default-secondary",
10978
+ size2 === "sm" ? "text-body-tiny" : "text-body-xs"
10979
+ ),
10980
+ children: secondary
10981
+ }
10982
+ )
10983
+ ))
10946
10984
  ] });
10947
10985
  }
10948
10986
  function TableCellText({