@platned/ui 0.9.1 → 0.9.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
@@ -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
  ] });
@@ -7087,11 +7090,20 @@ function FullscreenSurface({
7087
7090
  className
7088
7091
  }) {
7089
7092
  const [node, setNode] = (0, import_react50.useState)(null);
7093
+ const [returnFocusTo] = (0, import_react50.useState)(
7094
+ () => typeof document === "undefined" ? null : document.activeElement
7095
+ );
7090
7096
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_radix_ui9.Dialog.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_radix_ui9.Dialog.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
7091
7097
  import_radix_ui9.Dialog.Content,
7092
7098
  {
7093
7099
  ref: setNode,
7094
7100
  "aria-describedby": void 0,
7101
+ onCloseAutoFocus: (event) => {
7102
+ if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {
7103
+ event.preventDefault();
7104
+ returnFocusTo.focus();
7105
+ }
7106
+ },
7095
7107
  onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
7096
7108
  className: cn(
7097
7109
  "fixed inset-0 overflow-auto bg-default-secondary p-4 focus:outline-none lg:p-6",