@platned/ui 0.8.1 → 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.cjs CHANGED
@@ -3680,7 +3680,7 @@ function FormCard({
3680
3680
  }
3681
3681
  function FormCardHeader({ title, subtitle }) {
3682
3682
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "border-b border-default px-7 py-6", children: [
3683
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-heading-sm font-semibold text-default leading-snug", children: title }),
3683
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]", children: title }),
3684
3684
  subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
3685
3685
  ] });
3686
3686
  }
@@ -4760,7 +4760,7 @@ var Checkbox = (0, import_react29.forwardRef)(function Checkbox2({
4760
4760
  size: size2
4761
4761
  }
4762
4762
  ),
4763
- label && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_clsx38.default)(LABEL_TEXT2[size2], "text-default"), children: label })
4763
+ label && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_clsx38.default)(LABEL_TEXT2[size2], "min-w-0 text-default [overflow-wrap:anywhere]"), children: label })
4764
4764
  ]
4765
4765
  }
4766
4766
  ),
@@ -4769,7 +4769,7 @@ var Checkbox = (0, import_react29.forwardRef)(function Checkbox2({
4769
4769
  {
4770
4770
  id: descriptionId,
4771
4771
  className: (0, import_clsx38.default)(
4772
- "mt-0.5 pl-[26px]",
4772
+ "mt-0.5 pl-[26px] [overflow-wrap:anywhere]",
4773
4773
  LABEL_TEXT2[size2],
4774
4774
  disabled ? "text-disabled" : "text-default-secondary"
4775
4775
  ),
@@ -5426,6 +5426,12 @@ function isInsideToaster(target) {
5426
5426
 
5427
5427
  // src/components/overlays/modal.tsx
5428
5428
  var import_jsx_runtime50 = require("react/jsx-runtime");
5429
+ var OVERLAY_ALIGN = {
5430
+ center: "sm:items-center",
5431
+ // A fixed offset rather than centring, so a change in content height grows the panel
5432
+ // downward instead of moving its top edge. 6dvh + the 88dvh cap leaves a gap below.
5433
+ top: "sm:items-start sm:pt-[6dvh]"
5434
+ };
5429
5435
  var SIZE8 = {
5430
5436
  sm: "sm:max-w-[420px]",
5431
5437
  md: "sm:max-w-[540px]",
@@ -5463,6 +5469,7 @@ var ModalShell = (0, import_react36.forwardRef)(
5463
5469
  size: size2 = "md",
5464
5470
  role = "dialog",
5465
5471
  showClose = true,
5472
+ align = "center",
5466
5473
  className,
5467
5474
  onEscapeKeyDown,
5468
5475
  onInteractOutside,
@@ -5477,10 +5484,12 @@ var ModalShell = (0, import_react36.forwardRef)(
5477
5484
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5478
5485
  import_radix_ui2.Dialog.Overlay,
5479
5486
  {
5487
+ "data-align": align,
5480
5488
  className: cn(
5481
5489
  // The overlay wraps the content (a Radix-supported layout), so it also does the
5482
- // centring: bottom sheet below `sm`, centred card above it.
5483
- "fixed inset-0 z-modal flex items-end justify-center sm:items-center",
5490
+ // positioning: bottom sheet below `sm`, a card centred or top-anchored above it.
5491
+ "fixed inset-0 z-modal flex items-end justify-center",
5492
+ OVERLAY_ALIGN[align],
5484
5493
  OVERLAY_SCRIM
5485
5494
  ),
5486
5495
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
@@ -5516,6 +5525,7 @@ var ModalShell = (0, import_react36.forwardRef)(
5516
5525
  },
5517
5526
  className: cn(
5518
5527
  "relative max-h-[92dvh] w-full overflow-y-auto bg-default shadow-400 focus:outline-none",
5528
+ align === "top" && "sm:max-h-[88dvh]",
5519
5529
  // Not a `ScrollArea`: the panel is the dialog, so the scroll container has to stay
5520
5530
  // the element carrying `role`, `aria-modal` and the trap boundary. It is already
5521
5531
  // keyboard-scrollable because the trap focuses it on open.
@@ -6443,6 +6453,7 @@ function ConfirmDialog({
6443
6453
  subtitle,
6444
6454
  tone = "default",
6445
6455
  size: size2 = "md",
6456
+ align,
6446
6457
  confirmLabel = "Confirm",
6447
6458
  cancelLabel = "Cancel",
6448
6459
  confirmVariant = "primary",
@@ -6470,6 +6481,7 @@ function ConfirmDialog({
6470
6481
  onOpenChange: requestOpenChange,
6471
6482
  role: "alertdialog",
6472
6483
  size: size2,
6484
+ align,
6473
6485
  className,
6474
6486
  initialFocus: cancelRef,
6475
6487
  children: [
@@ -6521,6 +6533,7 @@ function NoteConfirmModalShell({
6521
6533
  subtitle,
6522
6534
  tone = "default",
6523
6535
  size: size2 = "md",
6536
+ align,
6524
6537
  confirmLabel,
6525
6538
  cancelLabel = "Cancel",
6526
6539
  confirmVariant = "primary",
@@ -6555,6 +6568,7 @@ function NoteConfirmModalShell({
6555
6568
  open: true,
6556
6569
  onOpenChange: requestOpenChange,
6557
6570
  size: size2,
6571
+ align,
6558
6572
  className,
6559
6573
  onEscapeKeyDown: guardDiscard,
6560
6574
  onInteractOutside: guardDiscard,
@@ -10118,7 +10132,7 @@ function DetailItem({
10118
10132
  if (layout === "inline") {
10119
10133
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: (0, import_clsx86.default)("flex gap-3 text-body-xs", SPAN[span], className), children: [
10120
10134
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: (0, import_clsx86.default)("shrink-0 text-default-secondary", labelWidth), children: label }),
10121
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
10135
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]", children: [
10122
10136
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "text-default", children: shown }),
10123
10137
  detail && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "text-default-secondary", children: detail })
10124
10138
  ] })
@@ -10126,8 +10140,8 @@ function DetailItem({
10126
10140
  }
10127
10141
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: (0, import_clsx86.default)("flex min-w-0 flex-col gap-0.5", SPAN[span], className), children: [
10128
10142
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "text-body-tiny font-medium text-default-secondary", children: label }),
10129
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "text-body-sm font-medium text-default", children: shown }),
10130
- detail && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "text-body-xs text-default-secondary", children: detail })
10143
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "text-body-sm font-medium text-default [overflow-wrap:anywhere]", children: shown }),
10144
+ detail && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "text-body-xs text-default-secondary [overflow-wrap:anywhere]", children: detail })
10131
10145
  ] });
10132
10146
  }
10133
10147
  var COLUMNS3 = {
@@ -10818,13 +10832,23 @@ function DataTablePagination({
10818
10832
  // src/components/lists/data-table-cells.tsx
10819
10833
  var import_clsx93 = __toESM(require("clsx"), 1);
10820
10834
  var import_jsx_runtime116 = require("react/jsx-runtime");
10835
+ function textFromNode(node) {
10836
+ if (typeof node === "string") return node;
10837
+ if (typeof node === "number") return String(node);
10838
+ if (Array.isArray(node)) {
10839
+ const parts4 = node.map(textFromNode);
10840
+ return parts4.every((part) => part !== void 0) ? parts4.join("") : void 0;
10841
+ }
10842
+ return void 0;
10843
+ }
10821
10844
  function TableCellLeadText({ primary, secondary, size: size2 = "md", className }) {
10822
- return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: (0, import_clsx93.default)("flex flex-col gap-0.5", className), children: [
10845
+ return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: (0, import_clsx93.default)("flex min-w-0 flex-col gap-0.5", className), children: [
10823
10846
  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
10824
10847
  "span",
10825
10848
  {
10849
+ title: primary,
10826
10850
  className: (0, import_clsx93.default)(
10827
- "font-medium leading-snug text-default",
10851
+ "block truncate font-medium leading-snug text-default",
10828
10852
  size2 === "sm" ? "text-body-xs" : "text-body-sm"
10829
10853
  ),
10830
10854
  children: primary
@@ -10833,8 +10857,9 @@ function TableCellLeadText({ primary, secondary, size: size2 = "md", className }
10833
10857
  secondary && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
10834
10858
  "span",
10835
10859
  {
10860
+ title: secondary,
10836
10861
  className: (0, import_clsx93.default)(
10837
- "font-normal leading-tight text-default-secondary",
10862
+ "block truncate font-normal leading-tight text-default-secondary",
10838
10863
  size2 === "sm" ? "text-body-tiny" : "text-body-xs"
10839
10864
  ),
10840
10865
  children: secondary
@@ -10846,16 +10871,17 @@ function TableCellText({
10846
10871
  children,
10847
10872
  muted = true,
10848
10873
  size: size2 = "md",
10849
- truncate = false,
10874
+ truncate = true,
10850
10875
  className
10851
10876
  }) {
10852
10877
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
10853
10878
  "span",
10854
10879
  {
10880
+ title: truncate ? textFromNode(children) : void 0,
10855
10881
  className: (0, import_clsx93.default)(
10856
10882
  "font-normal leading-snug",
10857
10883
  size2 === "sm" ? "text-body-tiny" : "text-body-xs",
10858
- truncate ? "block truncate" : "whitespace-nowrap",
10884
+ truncate ? "block min-w-0 truncate" : "whitespace-nowrap",
10859
10885
  muted ? "text-default-secondary" : "text-default",
10860
10886
  className
10861
10887
  ),
@@ -10867,11 +10893,12 @@ function TableCellBadge({ label, className }) {
10867
10893
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
10868
10894
  "span",
10869
10895
  {
10896
+ title: label,
10870
10897
  className: (0, import_clsx93.default)(
10871
- "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",
10898
+ "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",
10872
10899
  className
10873
10900
  ),
10874
- children: label
10901
+ children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "truncate", children: label })
10875
10902
  }
10876
10903
  );
10877
10904
  }
@@ -10879,9 +10906,10 @@ function TableCellProgress({
10879
10906
  percent,
10880
10907
  tone = "brand",
10881
10908
  size: size2 = "md",
10909
+ label,
10882
10910
  className
10883
10911
  }) {
10884
- const clamped = Math.min(100, Math.max(0, percent));
10912
+ const clamped = Math.round(Math.min(100, Math.max(0, percent)));
10885
10913
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: (0, import_clsx93.default)("flex w-full min-w-0 items-center gap-2", className), children: [
10886
10914
  /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
10887
10915
  ProgressBar,
@@ -10890,11 +10918,11 @@ function TableCellProgress({
10890
10918
  tone,
10891
10919
  size: size2 === "sm" ? "xs" : "sm",
10892
10920
  className: "min-w-12 flex-1",
10893
- "aria-label": `${clamped}%`
10921
+ "aria-label": label ?? `${clamped}%`
10894
10922
  }
10895
10923
  ),
10896
10924
  /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("span", { className: "shrink-0 text-body-tiny leading-none tabular-nums text-default-secondary", children: [
10897
- percent,
10925
+ clamped,
10898
10926
  "%"
10899
10927
  ] })
10900
10928
  ] });
@@ -11392,7 +11420,7 @@ function BodyCell({
11392
11420
  [ROW_LINK_ATTR]: "",
11393
11421
  className: cn("block min-w-0 rounded-sm", FOCUS_RING_INSET),
11394
11422
  children: content
11395
- });
11423
+ }, cell.row.original);
11396
11424
  }
11397
11425
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11398
11426
  "td",
@@ -11488,7 +11516,7 @@ function CardList({
11488
11516
  children: [
11489
11517
  /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex items-start gap-3", children: [
11490
11518
  selectable && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "relative z-raised shrink-0 pt-0.5", children: render(SELECT_COLUMN_ID) }),
11491
- /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "min-w-0 flex-1", children: href ? renderRowLink({ href, [ROW_LINK_ATTR]: "", className: trigger, children: titleContent }) : onRowClick ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11519
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "min-w-0 flex-1", children: href ? renderRowLink({ href, [ROW_LINK_ATTR]: "", className: trigger, children: titleContent }, row.original) : onRowClick ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11492
11520
  "button",
11493
11521
  {
11494
11522
  type: "button",
@@ -11750,7 +11778,7 @@ function Toaster({
11750
11778
  "aria-atomic": "false",
11751
11779
  ...{ [TOASTER_ATTRIBUTE]: "" },
11752
11780
  className: (0, import_clsx97.default)(
11753
- "pointer-events-none fixed z-toast flex w-full max-w-[380px] flex-col gap-2",
11781
+ "pointer-events-none fixed z-toast flex w-[calc(100%-2rem)] max-w-[380px] flex-col gap-2",
11754
11782
  POSITION[position]
11755
11783
  ),
11756
11784
  children: toasts.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ToastItem, { toast: entry, onDismiss: () => dismiss(entry.id) }, entry.id))