@nswds/app 1.119.0 → 1.119.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/globals.css CHANGED
@@ -4979,6 +4979,11 @@
4979
4979
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
4980
4980
  transition-duration: var(--tw-duration, var(--default-transition-duration));
4981
4981
  }
4982
+ .transition-\[background-color\,box-shadow\] {
4983
+ transition-property: background-color,box-shadow;
4984
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
4985
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
4986
+ }
4982
4987
  .transition-\[color\,box-shadow\] {
4983
4988
  transition-property: color,box-shadow;
4984
4989
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -6427,11 +6432,6 @@
6427
6432
  }
6428
6433
  }
6429
6434
  }
6430
- .peer-focus\:pointer-events-auto {
6431
- &:is(:where(.peer):focus ~ *) {
6432
- pointer-events: auto;
6433
- }
6434
- }
6435
6435
  .peer-disabled\:cursor-not-allowed {
6436
6436
  &:is(:where(.peer):disabled ~ *) {
6437
6437
  cursor: not-allowed;
package/dist/index.cjs CHANGED
@@ -14407,9 +14407,20 @@ function CodeDemoContent({ data, showCode = true, controls = defaultControls })
14407
14407
  React5__namespace.default.useEffect(() => {
14408
14408
  const frame2 = iframeRef.current;
14409
14409
  if (!frame2) return;
14410
+ const getTargetOrigin = () => {
14411
+ const src = frame2.getAttribute("src");
14412
+ if (!src || src === "about:blank") {
14413
+ return window.location.origin;
14414
+ }
14415
+ try {
14416
+ return new URL(src, window.location.href).origin;
14417
+ } catch {
14418
+ return window.location.origin;
14419
+ }
14420
+ };
14410
14421
  const send = () => {
14411
14422
  const msg = { type: "nswds-theme", payload: themeValues };
14412
- frame2.contentWindow?.postMessage(msg, "*");
14423
+ frame2.contentWindow?.postMessage(msg, getTargetOrigin());
14413
14424
  };
14414
14425
  send();
14415
14426
  frame2.addEventListener("load", send);
@@ -18334,85 +18345,131 @@ var expandableSearchFocusVariants = classVarianceAuthority.cva("", {
18334
18345
  }
18335
18346
  });
18336
18347
  var ExpandableSearchContext = React5__namespace.createContext(null);
18337
- var ExpandableSearch = React5__namespace.forwardRef(({ className, onAction, defaultValue = "", variant = "default", ...props }, ref) => {
18338
- const [value, setValue] = React5__namespace.useState(defaultValue);
18339
- const formRef = React5__namespace.useRef(null);
18340
- const resolvedVariant = variant ?? "default";
18341
- const handleAction = (e) => {
18342
- e.preventDefault();
18343
- if (onAction) {
18344
- onAction(value);
18345
- }
18346
- };
18347
- return /* @__PURE__ */ jsxRuntime.jsx(
18348
- ExpandableSearchContext.Provider,
18349
- {
18350
- value: { value, setValue, formRef, variant: resolvedVariant },
18351
- children: /* @__PURE__ */ jsxRuntime.jsx(
18352
- "form",
18348
+ var ExpandableSearch = React5__namespace.forwardRef(
18349
+ ({
18350
+ className,
18351
+ onAction,
18352
+ defaultValue = "",
18353
+ onSubmit,
18354
+ onFocusCapture,
18355
+ onBlurCapture,
18356
+ variant = "default",
18357
+ ...props
18358
+ }, ref) => {
18359
+ const [value, setValue] = React5__namespace.useState(defaultValue);
18360
+ const [formHasFocusWithin, setFormHasFocusWithin] = React5__namespace.useState(false);
18361
+ const resolvedVariant = variant ?? "default";
18362
+ const handleSubmit = (e) => {
18363
+ onSubmit?.(e);
18364
+ if (e.defaultPrevented) {
18365
+ return;
18366
+ }
18367
+ e.preventDefault();
18368
+ onAction?.(value);
18369
+ };
18370
+ const handleFocusCapture = (e) => {
18371
+ setFormHasFocusWithin(true);
18372
+ onFocusCapture?.(e);
18373
+ };
18374
+ const handleBlurCapture = (e) => {
18375
+ const nextFocusedElement = e.relatedTarget;
18376
+ if (!e.currentTarget.contains(nextFocusedElement)) {
18377
+ setFormHasFocusWithin(false);
18378
+ }
18379
+ onBlurCapture?.(e);
18380
+ };
18381
+ return /* @__PURE__ */ jsxRuntime.jsx(
18382
+ ExpandableSearchContext.Provider,
18383
+ {
18384
+ value: { value, setValue, formHasFocusWithin, variant: resolvedVariant },
18385
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18386
+ "form",
18387
+ {
18388
+ ref,
18389
+ className: cn("group relative inline-block select-none", className),
18390
+ onBlurCapture: handleBlurCapture,
18391
+ onFocusCapture: handleFocusCapture,
18392
+ onSubmit: handleSubmit,
18393
+ ...props
18394
+ }
18395
+ )
18396
+ }
18397
+ );
18398
+ }
18399
+ );
18400
+ ExpandableSearch.displayName = "ExpandableSearch";
18401
+ var ExpandableSearchField = React5__namespace.forwardRef(
18402
+ ({ className, id: id3, buttonLabel = "Search", buttonProps, ...props }, ref) => {
18403
+ const context = React5__namespace.useContext(ExpandableSearchContext);
18404
+ if (!context) throw new Error("ExpandableSearchField must be used within ExpandableSearch");
18405
+ const generatedId = React5__namespace.useId();
18406
+ const {
18407
+ className: buttonClassName,
18408
+ children: buttonChildren,
18409
+ "aria-label": buttonAriaLabel,
18410
+ ...restButtonProps
18411
+ } = buttonProps ?? {};
18412
+ const isActive = context.value.length > 0 || context.formHasFocusWithin;
18413
+ const variant = context.variant;
18414
+ const inputId = id3 ?? generatedId;
18415
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
18416
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sr-only", htmlFor: inputId, children: "Search" }),
18417
+ /* @__PURE__ */ jsxRuntime.jsx(
18418
+ "input",
18353
18419
  {
18354
18420
  ref,
18355
- className: cn("relative inline-block select-none", className),
18356
- onSubmit: handleAction,
18421
+ id: inputId,
18422
+ value: context.value,
18423
+ onChange: (e) => context.setValue(e.target.value),
18424
+ className: cn(
18425
+ "align-center flex h-12 w-12 cursor-pointer overflow-hidden rounded-sm border-0 text-transparent",
18426
+ "ring-offset-white focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
18427
+ "transition-[width,box-shadow,background-color] duration-300 ease-in-out",
18428
+ "placeholder:text-transparent placeholder:opacity-0",
18429
+ "expandable-search__input",
18430
+ expandableSearchFocusVariants({ variant }),
18431
+ expandableSearchCollapsedVariants({ variant }),
18432
+ // Conditionally apply classes based on active state
18433
+ {
18434
+ "p-0": !isActive,
18435
+ "w-96 cursor-auto pt-0 pr-12 pb-0 pl-4 outline-none select-auto": isActive
18436
+ },
18437
+ isActive && expandableSearchSurfaceVariants({ variant }),
18438
+ isActive && (variant === "default" ? "placeholder:text-grey-700 placeholder:opacity-100" : "placeholder:text-current placeholder:opacity-70"),
18439
+ className
18440
+ ),
18357
18441
  ...props
18358
18442
  }
18443
+ ),
18444
+ /* @__PURE__ */ jsxRuntime.jsx(
18445
+ "button",
18446
+ {
18447
+ "aria-label": buttonAriaLabel ?? buttonLabel,
18448
+ type: "submit",
18449
+ className: cn(
18450
+ "absolute top-0 right-0 z-10 flex h-12 w-12 rounded-sm transition-[background-color,box-shadow] duration-200",
18451
+ "ring-offset-white focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
18452
+ expandableSearchButtonVariants({ variant }),
18453
+ expandableSearchFocusVariants({ variant }),
18454
+ {
18455
+ "pointer-events-none": !isActive,
18456
+ "pointer-events-auto": isActive
18457
+ },
18458
+ buttonClassName
18459
+ ),
18460
+ ...restButtonProps,
18461
+ children: buttonChildren ?? /* @__PURE__ */ jsxRuntime.jsx(
18462
+ Icons.search,
18463
+ {
18464
+ "aria-hidden": "true",
18465
+ className: "m-auto block h-8 w-8 shrink-0 fill-current leading-none"
18466
+ }
18467
+ )
18468
+ }
18359
18469
  )
18360
- }
18361
- );
18362
- });
18363
- ExpandableSearch.displayName = "ExpandableSearch";
18364
- var ExpandableSearchField = React5__namespace.forwardRef(({ className, id: id3, ...props }, ref) => {
18365
- const context = React5__namespace.useContext(ExpandableSearchContext);
18366
- if (!context) throw new Error("ExpandableSearchField must be used within ExpandableSearch");
18367
- const [isFocused, setIsFocused] = React5__namespace.useState(false);
18368
- const generatedId = React5__namespace.useId();
18369
- const isActive = context.value.length > 0 || isFocused;
18370
- const variant = context.variant;
18371
- const inputId = id3 ?? generatedId;
18372
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
18373
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sr-only", htmlFor: inputId, children: "Search" }),
18374
- /* @__PURE__ */ jsxRuntime.jsx(
18375
- "input",
18376
- {
18377
- ref,
18378
- id: inputId,
18379
- value: context.value,
18380
- onChange: (e) => context.setValue(e.target.value),
18381
- onFocus: () => setIsFocused(true),
18382
- onBlur: () => setIsFocused(false),
18383
- className: cn(
18384
- "peer align-center flex h-12 w-12 cursor-pointer overflow-hidden rounded-sm border-0 text-transparent",
18385
- "ring-offset-white focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
18386
- "transition-[width,box-shadow,background-color] duration-300 ease-in-out",
18387
- "placeholder:text-transparent placeholder:opacity-0",
18388
- "expandable-search__input",
18389
- expandableSearchFocusVariants({ variant }),
18390
- expandableSearchCollapsedVariants({ variant }),
18391
- // Conditionally apply classes based on active state
18392
- {
18393
- "p-0": !isActive,
18394
- "w-96 cursor-auto pt-0 pr-12 pb-0 pl-4 outline-none select-auto": isActive
18395
- },
18396
- isActive && expandableSearchSurfaceVariants({ variant }),
18397
- isActive && (variant === "default" ? "placeholder:text-grey-700 placeholder:opacity-100" : "placeholder:text-current placeholder:opacity-70"),
18398
- className
18399
- ),
18400
- ...props
18401
- }
18402
- ),
18403
- /* @__PURE__ */ jsxRuntime.jsx(
18404
- "button",
18405
- {
18406
- type: "button",
18407
- className: cn(
18408
- "pointer-events-none absolute top-0 right-0 z-10 flex h-12 w-12 rounded-sm transition-colors duration-200 peer-focus:pointer-events-auto",
18409
- expandableSearchButtonVariants({ variant })
18410
- ),
18411
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.search, { className: "m-auto block h-8 w-8 shrink-0 fill-current leading-none" })
18412
- }
18413
- )
18414
- ] });
18415
- });
18470
+ ] });
18471
+ }
18472
+ );
18416
18473
  ExpandableSearchField.displayName = "ExpandableSearchField";
18417
18474
  function Fieldset2({
18418
18475
  className,
@@ -18941,7 +18998,7 @@ function FormatToggle({ format, setFormat }) {
18941
18998
 
18942
18999
  // package.json
18943
19000
  var package_default = {
18944
- version: "1.118.0"};
19001
+ version: "1.119.1"};
18945
19002
  var SluggerContext = React5__namespace.default.createContext(null);
18946
19003
  function flattenText(nodes) {
18947
19004
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -31368,7 +31425,14 @@ function SidebarProvider({
31368
31425
  } else {
31369
31426
  _setOpen(openState);
31370
31427
  }
31371
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
31428
+ const cookieParts = [
31429
+ `${SIDEBAR_COOKIE_NAME}=${encodeURIComponent(String(openState))}`,
31430
+ "path=/",
31431
+ `max-age=${SIDEBAR_COOKIE_MAX_AGE}`,
31432
+ "SameSite=Lax",
31433
+ "Secure"
31434
+ ];
31435
+ document.cookie = cookieParts.join("; ");
31372
31436
  },
31373
31437
  [setOpenProp, open]
31374
31438
  );