@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.cjs CHANGED
@@ -1153,7 +1153,9 @@ var inputControlClasses = (size2, invalid, disabled) => (0, import_clsx10.defaul
1153
1153
  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",
1154
1154
  // read-only is not disabled: the value still matters and is still selectable, but it
1155
1155
  // must not look editable. Nothing in the library styled this before 0.4.0.
1156
- "read-only:bg-default-secondary read-only:cursor-default"
1156
+ // `enabled:` because a disabled input also matches `:read-only`. Through 0.9.1 that let this
1157
+ // lighter fill override `bg-disabled`, so a disabled field looked read-only (0.9.2).
1158
+ "enabled:read-only:bg-default-secondary enabled:read-only:cursor-default"
1157
1159
  );
1158
1160
  var Input = (0, import_react7.forwardRef)(function Input2({
1159
1161
  label,
@@ -1328,7 +1330,8 @@ var TextareaControl = (0, import_react8.forwardRef)(
1328
1330
  "focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default",
1329
1331
  textareaBase[size2],
1330
1332
  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",
1331
- "read-only:cursor-default read-only:resize-none read-only:bg-default-secondary",
1333
+ // `enabled:`: a disabled textarea also matches `:read-only` (see Input).
1334
+ "enabled:read-only:cursor-default enabled:read-only:resize-none enabled:read-only:bg-default-secondary",
1332
1335
  className
1333
1336
  ),
1334
1337
  ...props
@@ -3919,7 +3922,7 @@ function FormCard({
3919
3922
  );
3920
3923
  }
3921
3924
  function FormCardHeader({ title, subtitle }) {
3922
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "border-b border-default px-7 py-6", children: [
3925
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "border-b border-default px-4 py-5 sm:px-7 sm:py-6", children: [
3923
3926
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-heading-sm font-semibold text-default leading-snug [overflow-wrap:anywhere]", children: title }),
3924
3927
  subtitle && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
3925
3928
  ] });
@@ -4104,13 +4107,14 @@ function RoleBadge({ role, size: size2 = "sm", tone, color }) {
4104
4107
  "span",
4105
4108
  {
4106
4109
  "data-tone": tone,
4110
+ title: role,
4107
4111
  className: (0, import_clsx28.default)(
4108
- "inline-flex items-center rounded-full font-medium whitespace-nowrap",
4112
+ "inline-flex max-w-full items-center rounded-full font-medium whitespace-nowrap align-middle",
4109
4113
  size2 === "sm" ? "px-2 py-0.5 text-body-tiny" : "px-3 py-1 text-body-xs",
4110
4114
  !rawColor && TONE_STYLES[resolved]
4111
4115
  ),
4112
4116
  style: rawColor ? { backgroundColor: `${rawColor}1F`, color: rawColor } : void 0,
4113
- children: role
4117
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 truncate", children: role })
4114
4118
  }
4115
4119
  );
4116
4120
  }
@@ -8163,12 +8167,33 @@ var SIZE7 = {
8163
8167
  };
8164
8168
  function PageToolbar({
8165
8169
  children,
8170
+ actions,
8166
8171
  onBack,
8167
8172
  backLabel = "Go back",
8168
8173
  wrap,
8169
8174
  size: size2 = "md",
8170
8175
  className
8171
8176
  }) {
8177
+ if (actions !== void 0) {
8178
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
8179
+ "div",
8180
+ {
8181
+ "data-slot": "page-toolbar",
8182
+ className: (0, import_clsx53.default)(
8183
+ "flex shrink-0 flex-wrap items-center gap-x-4 gap-y-3 border-b border-default bg-default",
8184
+ SIZE7[size2],
8185
+ className
8186
+ ),
8187
+ children: [
8188
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex min-w-[min(100%,12rem)] flex-1 basis-48 items-center gap-4", children: [
8189
+ onBack && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(IconButton, { variant: "neutral", size: "md", "aria-label": backLabel, onClick: onBack, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react23.ArrowLeftIcon, { "aria-hidden": true }) }),
8190
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "min-w-0 flex-1", children })
8191
+ ] }),
8192
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { "data-slot": "page-toolbar-actions", className: "ml-auto flex max-w-full flex-wrap items-center justify-end gap-2", children: actions })
8193
+ ]
8194
+ }
8195
+ );
8196
+ }
8172
8197
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
8173
8198
  "div",
8174
8199
  {
@@ -10525,9 +10550,9 @@ function EmailText({ email, className }) {
10525
10550
  const at = email.lastIndexOf("@");
10526
10551
  const local = at > 0 ? email.slice(0, at) : email;
10527
10552
  const domain = at > 0 ? email.slice(at) : "";
10528
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("span", { title: email, className: (0, import_clsx88.default)("flex min-w-0 max-w-full", className), children: [
10529
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "min-w-0 truncate", children: local }),
10530
- domain && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "min-w-0 truncate [flex-shrink:0.001]", children: domain })
10553
+ return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("span", { title: email, "data-slot": "email-text", className: (0, import_clsx88.default)("flex min-w-0 max-w-full", className), children: [
10554
+ /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap", children: local }),
10555
+ domain && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [flex-shrink:0.001]", children: domain })
10531
10556
  ] });
10532
10557
  }
10533
10558
 
@@ -11147,17 +11172,30 @@ function TableCellLeadText({ primary, secondary, size: size2 = "md", className }
11147
11172
  children: primary
11148
11173
  }
11149
11174
  ),
11150
- secondary && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11175
+ secondary && (typeof secondary === "string" || typeof secondary === "number" ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11151
11176
  "span",
11152
11177
  {
11153
- title: secondary,
11178
+ title: String(secondary),
11154
11179
  className: (0, import_clsx94.default)(
11155
11180
  "block truncate font-normal leading-tight text-default-secondary",
11156
11181
  size2 === "sm" ? "text-body-tiny" : "text-body-xs"
11157
11182
  ),
11158
11183
  children: secondary
11159
11184
  }
11160
- )
11185
+ ) : (
11186
+ // An element brings its own overflow handling, so it gets no `truncate` here,
11187
+ // which a card layout's touch un-truncation would otherwise turn into wrapping.
11188
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11189
+ "span",
11190
+ {
11191
+ className: (0, import_clsx94.default)(
11192
+ "block min-w-0 font-normal leading-tight text-default-secondary",
11193
+ size2 === "sm" ? "text-body-tiny" : "text-body-xs"
11194
+ ),
11195
+ children: secondary
11196
+ }
11197
+ )
11198
+ ))
11161
11199
  ] });
11162
11200
  }
11163
11201
  function TableCellText({