@nextlyhq/ui 0.0.2-alpha.74 → 0.0.2-alpha.76

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
@@ -103,7 +103,7 @@ const buttonVariants = (0, class_variance_authority.cva)(`inline-flex items-cent
103
103
  variant: {
104
104
  default: "bg-primary text-primary-foreground border border-transparent hover:opacity-90",
105
105
  primary: "bg-primary text-primary-foreground border border-transparent hover:opacity-90",
106
- destructive: "bg-destructive-solid text-destructive-foreground border border-transparent hover:bg-destructive-600",
106
+ destructive: "bg-destructive-solid text-destructive-foreground border border-transparent hover:bg-destructive-hover",
107
107
  outline: "border border-border text-foreground hover-unified bg-background",
108
108
  secondary: "bg-background border border-border text-foreground hover:bg-primary/5",
109
109
  ghost: "text-foreground border border-transparent hover-unified",
@@ -287,6 +287,15 @@ const FormLabelWithTooltip = react.forwardRef(({ className, labelClassName, tool
287
287
  });
288
288
  });
289
289
  FormLabelWithTooltip.displayName = "FormLabelWithTooltip";
290
+ // src/components/badge.tsx
291
+ /** The arms `badgeVariants` is built from. Its type is read from them: {@link VariantsFn}. */
292
+ /** The status variants, and the solid each one's dot is drawn in. */
293
+ const STATUS_DOT = {
294
+ success: "bg-success-solid",
295
+ warning: "bg-warning-solid",
296
+ destructive: "bg-danger-solid",
297
+ info: "bg-info-solid"
298
+ };
290
299
  /**
291
300
  * Badge Component - Design System Specification
292
301
  *
@@ -305,34 +314,40 @@ FormLabelWithTooltip.displayName = "FormLabelWithTooltip";
305
314
  * - Padding: 2px 10px (vertical × horizontal)
306
315
  * - Border radius: Full (pill shape)
307
316
  * - Font: 12px (text-xs), medium weight (500)
308
- * - Colors: Light backgrounds with dark text for visibility in both light/dark modes
309
- *
310
- * Variants (6 total per design spec):
311
- * - default: Light gray background
312
- * - primary: Light blue background
313
- * - success: Light green background
314
- * - warning: Light amber background
315
- * - destructive: Light red background
316
- * - outline: Transparent background with border border-border
317
+ * - Status variants (success, warning, destructive, info): a neutral chip with
318
+ * a 6px dot in the status's solid colour before the label
319
+ *
320
+ * Variants:
321
+ * - default: muted background
322
+ * - primary: primary tint
323
+ * - success, warning, destructive, info: quiet chip with a status dot
324
+ * - outline: transparent background with a border
317
325
  * @experimental
318
326
  */
319
- const badgeVariants = (0, class_variance_authority.cva)("inline-flex items-center rounded-sm px-2.5 py-0.5 h-[22px] text-xs font-medium transition-colors", {
327
+ const badgeVariants = (0, class_variance_authority.cva)("inline-flex items-center gap-1.5 rounded-sm px-2.5 py-0.5 h-[22px] text-xs font-medium transition-colors", {
320
328
  variants: { variant: {
321
329
  default: "bg-muted text-foreground",
322
330
  primary: "bg-primary/10 text-primary dark:bg-primary/20",
323
- success: "bg-success-100 text-success-700 dark:bg-success-900 dark:text-success-100",
324
- warning: "bg-warning-100 text-warning-700 dark:bg-warning-900 dark:text-warning-100",
325
- destructive: "bg-destructive-100 text-destructive-700 dark:bg-destructive-900 dark:text-destructive-100",
331
+ success: "border border-border bg-card text-foreground",
332
+ warning: "border border-border bg-card text-foreground",
333
+ destructive: "border border-border bg-card text-foreground",
334
+ info: "border border-border bg-card text-foreground",
326
335
  outline: "border border-border bg-transparent text-foreground dark:text-muted-foreground dark:border-border"
327
336
  } },
328
337
  defaultVariants: { variant: "default" }
329
338
  });
330
339
  /** @public */
331
- function Badge({ className, variant = "default", ...props }) {
332
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
340
+ function Badge({ className, variant = "default", children, ...props }) {
341
+ const dot = variant && variant in STATUS_DOT ? STATUS_DOT[variant] : null;
342
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
333
343
  "data-slot": `badge.${variant}`,
334
344
  className: cn(badgeVariants({ variant }), className),
335
- ...props
345
+ ...props,
346
+ children: [dot ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
347
+ "aria-hidden": "true",
348
+ "data-slot": "badge-dot",
349
+ className: cn("size-1.5 shrink-0 rounded-full", dot)
350
+ }) : null, children]
336
351
  });
337
352
  }
338
353
  /**
@@ -537,21 +552,39 @@ const Grid = (0, react.forwardRef)(({ cols = 2, gap = 4, responsive = false, cla
537
552
  });
538
553
  });
539
554
  Grid.displayName = "Grid";
555
+ /** Each tone's dot, in the status's solid colour (the same as `Badge`'s). */
556
+ const STAT_TONE_DOT = {
557
+ success: "bg-success-solid",
558
+ warning: "bg-warning-solid",
559
+ destructive: "bg-danger-solid",
560
+ info: "bg-info-solid"
561
+ };
540
562
  /** Labelled metric block for dashboard-style plugin widgets.
541
563
  * @experimental
542
564
  */
543
- const Stat = (0, react.forwardRef)(({ label, value, className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
544
- ref,
545
- className: cn("flex flex-col gap-1", className),
546
- ...props,
547
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
548
- className: "text-sm text-muted-foreground",
549
- children: label
550
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
551
- className: "text-2xl font-semibold text-foreground",
565
+ const Stat = (0, react.forwardRef)(({ label, value, tone, size = "default", className, ...props }, ref) => {
566
+ const compact = size === "compact";
567
+ const figure = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
568
+ className: cn("font-semibold text-foreground", compact ? "text-xl" : "text-2xl"),
552
569
  children: value
553
- })]
554
- }));
570
+ });
571
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
572
+ ref,
573
+ className: cn("flex flex-col", compact ? "gap-3" : "gap-1", className),
574
+ ...props,
575
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
576
+ className: cn("text-sm text-muted-foreground", compact && "font-semibold"),
577
+ children: label
578
+ }), tone === void 0 ? figure : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
579
+ className: "flex items-center gap-2.5",
580
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
581
+ "aria-hidden": "true",
582
+ "data-stat-tone": tone,
583
+ className: cn("size-2.5 shrink-0 rounded-full", STAT_TONE_DOT[tone])
584
+ }), figure]
585
+ })]
586
+ });
587
+ });
555
588
  Stat.displayName = "Stat";
556
589
  /**
557
590
  * Alert Component - Design System Specification
@@ -563,11 +596,12 @@ Stat.displayName = "Stat";
563
596
  * - Padding: 16px (p-4)
564
597
  * - Border radius: `rounded-md`, one step tighter than Card's `rounded-lg`
565
598
  * for inline/flow content vs. larger container components
566
- * - Border: 1px solid matching variant color
599
+ * - Border: 1px; the card border for info and success, the status border for
600
+ * warning and destructive
567
601
  * - Shadow: sm (subtle elevation)
568
602
  * - Font: 14px (text-sm)
569
603
  * - Layout: Flex with gap-3 for icon/content spacing
570
- * - Colors: Light backgrounds with dark text for WCAG 2.2 AA compliance
604
+ * - Colors: the page's foreground text; the icon in the status's text colour
571
605
  *
572
606
  * Variants (4 total):
573
607
  * - info (default): Blue - informational messages, neutral announcements
@@ -624,10 +658,10 @@ Stat.displayName = "Stat";
624
658
  */
625
659
  const alertVariants = (0, class_variance_authority.cva)("relative flex items-start gap-3 rounded-md border border-border p-4 text-sm transition-colors duration-150", {
626
660
  variants: { variant: {
627
- info: "bg-primary/5 text-primary",
628
- success: "border-success-200 bg-success-50 text-success-900 border-l-4 border-l-success dark:border-success-900 dark:border-l-success dark:bg-success-950 dark:text-success-100",
629
- warning: "border-warning-200 bg-warning-50 text-warning-900 border-l-4 border-l-warning dark:border-warning-900 dark:border-l-warning dark:bg-warning-950 dark:text-warning-100",
630
- destructive: "border-destructive-200 bg-destructive-50 text-destructive-900 border-l-4 border-l-destructive dark:border-destructive-900 dark:border-l-destructive dark:bg-destructive-950 dark:text-destructive-100"
661
+ info: "border-border bg-card text-foreground [&>svg]:text-info-text",
662
+ success: "border-border bg-card text-foreground [&>svg]:text-success-text",
663
+ warning: "border-warning-border bg-warning-surface text-foreground [&>svg]:text-warning-text",
664
+ destructive: "border-danger-border bg-danger-surface text-foreground [&>svg]:text-danger-text"
631
665
  } },
632
666
  defaultVariants: { variant: "info" }
633
667
  });
@@ -780,12 +814,13 @@ function Separator({ className, orientation = "horizontal", decorative = true, .
780
814
  * @see {@link https://adrianroselli.com/2020/11/more-accessible-skeletons.html More Accessible Skeletons}
781
815
  * @experimental
782
816
  */
783
- const Skeleton = react.forwardRef(({ className, ...props }, ref) => {
817
+ const Skeleton = react.forwardRef(({ className, still = false, ...props }, ref) => {
784
818
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
785
819
  ref,
786
820
  "data-slot": "skeleton",
821
+ "data-still": still ? "" : void 0,
787
822
  "aria-hidden": "true",
788
- className: cn("bg-primary/5 animate-pulse rounded-md motion-reduce:animate-none", className),
823
+ className: cn(still ? "bg-secondary rounded-md" : "bg-primary/5 animate-pulse rounded-md motion-reduce:animate-none", className),
789
824
  ...props
790
825
  });
791
826
  });
@@ -800,7 +835,7 @@ Skeleton.displayName = "Skeleton";
800
835
  const progressVariants = (0, class_variance_authority.cva)("h-full rounded-none transition-all", {
801
836
  variants: { variant: {
802
837
  default: "bg-primary-500",
803
- success: "bg-success-500",
838
+ success: "bg-success-solid",
804
839
  error: "bg-destructive"
805
840
  } },
806
841
  defaultVariants: { variant: "default" }
@@ -2274,6 +2309,65 @@ const sheetVariants = (0, class_variance_authority.cva)("fixed z-50 gap-4 bg-bac
2274
2309
  } },
2275
2310
  defaultVariants: { side: "right" }
2276
2311
  });
2312
+ /** How far down, as a share of the sheet's height, a drag must go to close it. */
2313
+ const DISMISS_SHARE = .25;
2314
+ /** A release faster than this, in px per ms, closes it from a shorter drag. */
2315
+ const FLICK_SPEED = .6;
2316
+ /** The shortest drag a flick closes from, so a tap never closes the sheet. */
2317
+ const FLICK_MIN_DISTANCE = 24;
2318
+ /** Whether a drag released at `distance` after `elapsed` ms closes the sheet. */
2319
+ function dragCloses(distance, elapsed, height) {
2320
+ if (distance >= height * DISMISS_SHARE) return true;
2321
+ return distance >= FLICK_MIN_DISTANCE && distance / Math.max(elapsed, 1) >= FLICK_SPEED;
2322
+ }
2323
+ /**
2324
+ * The grab strip: the sheet follows the pointer down (never up), and on
2325
+ * release either closes or springs back. It moves the sheet with an inline
2326
+ * transform, so the closing slide continues from where the finger let go.
2327
+ */
2328
+ function SheetDragHandle({ onDismiss }) {
2329
+ const drag = react.useRef(null);
2330
+ const onPointerDown = (event) => {
2331
+ const sheet = event.currentTarget.closest("[data-slot='sheet-content']");
2332
+ if (!sheet) return;
2333
+ event.currentTarget.setPointerCapture?.(event.pointerId);
2334
+ drag.current = {
2335
+ y: event.clientY,
2336
+ time: performance.now(),
2337
+ height: sheet.getBoundingClientRect().height,
2338
+ sheet
2339
+ };
2340
+ sheet.style.transition = "none";
2341
+ };
2342
+ const onPointerMove = (event) => {
2343
+ const start = drag.current;
2344
+ if (!start) return;
2345
+ const distance = Math.max(0, event.clientY - start.y);
2346
+ start.sheet.style.transform = `translateY(${distance}px)`;
2347
+ };
2348
+ const release = (event, cancelled) => {
2349
+ const start = drag.current;
2350
+ if (!start) return;
2351
+ drag.current = null;
2352
+ start.sheet.style.transition = "";
2353
+ const distance = Math.max(0, event.clientY - start.y);
2354
+ if (!cancelled && dragCloses(distance, performance.now() - start.time, start.height)) {
2355
+ onDismiss();
2356
+ return;
2357
+ }
2358
+ start.sheet.style.transform = "";
2359
+ };
2360
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2361
+ "aria-hidden": "true",
2362
+ "data-slot": "sheet-drag-handle",
2363
+ className: "flex h-6 w-full shrink-0 cursor-grab touch-none items-center justify-center active:cursor-grabbing",
2364
+ onPointerDown,
2365
+ onPointerMove,
2366
+ onPointerUp: (event) => release(event, false),
2367
+ onPointerCancel: (event) => release(event, true),
2368
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-1 w-10 rounded-full bg-border" })
2369
+ });
2370
+ }
2277
2371
  /**
2278
2372
  * SheetContent
2279
2373
  *
@@ -2288,17 +2382,24 @@ const sheetVariants = (0, class_variance_authority.cva)("fixed z-50 gap-4 bg-bac
2288
2382
  * @param side - Which edge to slide in from: "left", "right", "top", "bottom"
2289
2383
  * @public
2290
2384
  */
2291
- const SheetContent = react.forwardRef(({ side = "right", className, children, ...props }, ref) => {
2385
+ const SheetContent = react.forwardRef(({ side = "right", className, children, dragHandle = false, ...props }, ref) => {
2292
2386
  const portalContainer = usePortalContainer();
2293
2387
  const modal = react.useContext(SheetModalContext);
2388
+ const close = react.useRef(null);
2389
+ const draggable = dragHandle && side === "bottom";
2294
2390
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SheetPortal, {
2295
2391
  container: portalContainer,
2296
- children: [modal ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetOverlay, {}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Content, {
2392
+ children: [modal ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetOverlay, {}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Content, {
2297
2393
  ref,
2298
2394
  "data-slot": "sheet-content",
2299
2395
  className: cn(sheetVariants({ side }), className),
2300
2396
  ...props,
2301
- children
2397
+ children: [draggable ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetDragHandle, { onDismiss: () => close.current?.click() }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Close, {
2398
+ ref: close,
2399
+ hidden: true,
2400
+ tabIndex: -1,
2401
+ "aria-hidden": "true"
2402
+ })] }) : null, children]
2302
2403
  })]
2303
2404
  });
2304
2405
  });
@@ -2749,7 +2850,13 @@ function Toaster({ theme = "system", ...props }) {
2749
2850
  "--success-bg": "var(--nx-toast-success-bg)",
2750
2851
  "--success-text": "var(--nx-toast-success-text)",
2751
2852
  "--warning-bg": "var(--nx-toast-warning-bg)",
2752
- "--warning-text": "var(--nx-toast-warning-text)"
2853
+ "--warning-text": "var(--nx-toast-warning-text)",
2854
+ "--error-bg": "var(--nx-danger-surface)",
2855
+ "--error-border": "var(--nx-danger-border)",
2856
+ "--error-text": "var(--nx-danger-text)",
2857
+ "--info-bg": "var(--nx-info-surface)",
2858
+ "--info-border": "var(--nx-info-border)",
2859
+ "--info-text": "var(--nx-info-text)"
2753
2860
  },
2754
2861
  ...props
2755
2862
  });
@@ -4404,7 +4511,7 @@ function MissingIconWarning({ shown, id }) {
4404
4511
  if (!shown) return null;
4405
4512
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4406
4513
  id,
4407
- className: "mt-1.5 flex items-start gap-2 rounded-md border border-warning-200 bg-warning-50 px-2.5 py-1.5 text-xs text-warning-900 dark:border-warning-900 dark:bg-warning-950 dark:text-warning-100",
4514
+ className: "mt-1.5 flex items-start gap-2 rounded-md border border-warning-border bg-warning-surface px-2.5 py-1.5 text-xs text-warning-text",
4408
4515
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.TriangleAlert, {
4409
4516
  className: "mt-px size-3.5 shrink-0",
4410
4517
  "aria-hidden": "true"
@@ -6493,6 +6600,34 @@ function useActiveShortcuts() {
6493
6600
  const manager = useShortcutManager();
6494
6601
  return react.useSyncExternalStore(manager.subscribe, manager.activeBindings, manager.activeBindings);
6495
6602
  }
6603
+ // src/components/field-row.tsx
6604
+ /**
6605
+ * The two-column settings row: label and help on the left, the control on the
6606
+ * right, stacking into one column on a narrow screen.
6607
+ *
6608
+ * Geometry only. It owns the grid and nothing about naming, so the rows that
6609
+ * differ in how they label their control — `FieldShell`'s row layout, and the
6610
+ * admin's form-bound and grouped settings rows — all draw this one grid rather
6611
+ * than three copies of it that could drift apart.
6612
+ *
6613
+ * It applies no vertical padding: `FormSection` sets the rhythm between its
6614
+ * rows, and a row that padded itself as well would double it.
6615
+ * @experimental
6616
+ */
6617
+ function FieldRow({ aside, children, className, ...props }) {
6618
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6619
+ "data-slot": "field-row",
6620
+ className: cn("grid grid-cols-1 md:grid-cols-[2fr_3fr] gap-4 md:gap-8 items-start", className),
6621
+ ...props,
6622
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6623
+ className: "flex flex-col",
6624
+ children: aside
6625
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6626
+ className: "w-full",
6627
+ children
6628
+ })]
6629
+ });
6630
+ }
6496
6631
  // src/components/field-shell.tsx
6497
6632
  /**
6498
6633
  * The width cap applies to a wrapper around the control, not to the field row.
@@ -6558,7 +6693,7 @@ function computeControlWiring(ownProps, requestedId, renderedMessageIds, hasErro
6558
6693
  };
6559
6694
  }
6560
6695
  /** @experimental */
6561
- function FieldShell({ label, description, error, width = "half", htmlFor, className, children }) {
6696
+ function FieldShell({ label, description, error, width, layout = "stacked", htmlFor, className, children }) {
6562
6697
  const generatedControlId = (0, react.useId)();
6563
6698
  const messageBaseId = (0, react.useId)();
6564
6699
  const descriptionId = `${messageBaseId}-description`;
@@ -6587,27 +6722,69 @@ function FieldShell({ label, description, error, width = "half", htmlFor, classN
6587
6722
  };
6588
6723
  control = isFragmentChild ? children : (0, react.cloneElement)(children, controlOverrides);
6589
6724
  }
6725
+ const parts = {
6726
+ label,
6727
+ description,
6728
+ error,
6729
+ controlId: wiring.id,
6730
+ descriptionId,
6731
+ errorId,
6732
+ width: width ?? (layout === "row" ? "fill" : "half"),
6733
+ className,
6734
+ control
6735
+ };
6736
+ return layout === "row" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowField, { ...parts }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StackedField, { ...parts });
6737
+ }
6738
+ /**
6739
+ * The settings row: the label and its help on the left, the control and any
6740
+ * error under it on the right. The grid itself is `FieldRow`'s, so this row and
6741
+ * the admin's own settings rows cannot disagree about it.
6742
+ */
6743
+ function RowField(parts) {
6744
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FieldRow, {
6745
+ className: parts.className,
6746
+ aside: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [parts.label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
6747
+ htmlFor: parts.controlId,
6748
+ className: "cursor-pointer text-sm font-semibold text-foreground",
6749
+ children: parts.label
6750
+ }) : null, parts.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6751
+ id: parts.descriptionId,
6752
+ className: "mt-0.5 text-xs leading-relaxed text-muted-foreground",
6753
+ children: parts.description
6754
+ }) : null] }),
6755
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6756
+ className: controlWidth({ width: parts.width }),
6757
+ children: parts.control
6758
+ }), parts.error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6759
+ id: parts.errorId,
6760
+ className: "mt-1.5 text-sm font-medium text-destructive",
6761
+ children: parts.error
6762
+ }) : null]
6763
+ });
6764
+ }
6765
+ /** The stacked field: the label, then the control, its help and any error. */
6766
+ function StackedField(parts) {
6590
6767
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6591
- className: cn("flex flex-col gap-1.5", className),
6768
+ className: cn("flex flex-col gap-1.5", parts.className),
6592
6769
  children: [
6593
- label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
6594
- htmlFor: wiring.id,
6770
+ parts.label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
6771
+ htmlFor: parts.controlId,
6595
6772
  className: "text-sm font-medium text-foreground",
6596
- children: label
6773
+ children: parts.label
6597
6774
  }) : null,
6598
6775
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6599
- className: controlWidth({ width }),
6600
- children: control
6776
+ className: controlWidth({ width: parts.width }),
6777
+ children: parts.control
6601
6778
  }),
6602
- description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6603
- id: descriptionId,
6779
+ parts.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6780
+ id: parts.descriptionId,
6604
6781
  className: "text-sm text-muted-foreground",
6605
- children: description
6782
+ children: parts.description
6606
6783
  }) : null,
6607
- error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6608
- id: errorId,
6784
+ parts.error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6785
+ id: parts.errorId,
6609
6786
  className: "text-sm font-medium text-destructive",
6610
- children: error
6787
+ children: parts.error
6611
6788
  }) : null
6612
6789
  ]
6613
6790
  });
@@ -6657,13 +6834,13 @@ function FormSection({ label, description, className, children }) {
6657
6834
  * first as soon as either changed.
6658
6835
  * @experimental
6659
6836
  */
6660
- function FormActions({ dirty, className, children }) {
6837
+ function FormActions({ dirty, message = "You have unsaved changes", className, children }) {
6661
6838
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6662
6839
  className: cn("sticky bottom-0 mt-8 flex items-center justify-end gap-3", "border-t border-border bg-background/95 py-4 backdrop-blur", className),
6663
6840
  children: [dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6664
6841
  role: "status",
6665
6842
  className: "mr-auto text-sm text-muted-foreground",
6666
- children: "You have unsaved changes"
6843
+ children: message
6667
6844
  }) : null, children]
6668
6845
  });
6669
6846
  }
@@ -6770,7 +6947,7 @@ const SHELL_MEASURE = {
6770
6947
  * "how far is content from the panel's edge".
6771
6948
  * @experimental
6772
6949
  */
6773
- const PageShell = (0, react.forwardRef)(({ width = "form", className, children, style, ...props }, ref) => {
6950
+ const PageShell = (0, react.forwardRef)(({ width = "form", align = "start", className, children, style, ...props }, ref) => {
6774
6951
  const shellRef = (0, react.useRef)(null);
6775
6952
  const attachRef = (0, react.useCallback)((node) => {
6776
6953
  shellRef.current = node;
@@ -6803,6 +6980,7 @@ const PageShell = (0, react.forwardRef)(({ width = "form", className, children,
6803
6980
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6804
6981
  ref: attachRef,
6805
6982
  "data-slot": "page-shell",
6983
+ "data-align": align,
6806
6984
  style: shellStyle,
6807
6985
  className: cn("nx-page-shell py-8", className),
6808
6986
  ...props,
@@ -6866,32 +7044,175 @@ Bleed.displayName = "Bleed";
6866
7044
  * prop.
6867
7045
  * @experimental
6868
7046
  */
6869
- const PageHeader = (0, react.forwardRef)(({ title, description, breadcrumbs, actions, className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
7047
+ const PageHeader = (0, react.forwardRef)(({ title, description, breadcrumbs, actions, tabs, media, meta, titleId, className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
6870
7048
  ref,
6871
7049
  "data-slot": "page-header",
6872
7050
  className: cn("mb-8", className),
6873
7051
  ...props,
6874
- children: [breadcrumbs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6875
- className: "mb-6",
6876
- children: breadcrumbs
6877
- }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6878
- className: "flex flex-col justify-between gap-4 sm:flex-row sm:items-center",
6879
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6880
- className: "space-y-1",
6881
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
6882
- className: "text-xl font-semibold tracking-tight",
6883
- children: title
6884
- }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6885
- className: "mt-1 text-sm font-normal text-muted-foreground",
6886
- children: description
7052
+ children: [
7053
+ breadcrumbs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7054
+ className: "mb-6 empty:hidden",
7055
+ children: breadcrumbs
7056
+ }) : null,
7057
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7058
+ className: "flex flex-col justify-between gap-4 sm:flex-row sm:items-center",
7059
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7060
+ className: "flex min-w-0 items-start gap-4",
7061
+ children: [media ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7062
+ className: "shrink-0",
7063
+ children: media
7064
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7065
+ className: "min-w-0 space-y-1",
7066
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7067
+ className: "flex flex-wrap items-center gap-3",
7068
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
7069
+ id: titleId,
7070
+ className: "text-xl font-semibold tracking-tight",
7071
+ children: title
7072
+ }), meta]
7073
+ }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7074
+ "data-slot": "page-header-description",
7075
+ className: "mt-1 text-sm font-normal text-muted-foreground",
7076
+ children: description
7077
+ }) : null]
7078
+ })]
7079
+ }), actions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7080
+ className: "flex items-center gap-3",
7081
+ children: actions
6887
7082
  }) : null]
6888
- }), actions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6889
- className: "flex items-center gap-3",
6890
- children: actions
6891
- }) : null]
6892
- })]
7083
+ }),
7084
+ tabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7085
+ className: "mt-6",
7086
+ children: tabs
7087
+ }) : null
7088
+ ]
6893
7089
  }));
6894
7090
  PageHeader.displayName = "PageHeader";
7091
+ /**
7092
+ * The tab row of a page whose sections each have their own address. A labelled
7093
+ * `nav` of links rather than an ARIA tablist: every tab changes the URL, and a
7094
+ * link inside `role="tab"` breaks the tabs pattern's keyboard and announcement
7095
+ * contract. The current section is marked with `aria-current="page"` by
7096
+ * `PageTab`.
7097
+ * @experimental
7098
+ */
7099
+ const PageTabs = (0, react.forwardRef)(({ label, className, children, ...props }, ref) => {
7100
+ const row = (0, react.useRef)(null);
7101
+ const shown = (0, react.useRef)(null);
7102
+ const setRow = (0, react.useCallback)((node) => {
7103
+ row.current = node;
7104
+ if (typeof ref === "function") return ref(node);
7105
+ if (ref) ref.current = node;
7106
+ }, [ref]);
7107
+ (0, react.useEffect)(() => {
7108
+ const nav = row.current;
7109
+ const current = nav?.querySelector("[aria-current=\"page\"]") ?? null;
7110
+ if (nav === null || current === null || current === shown.current) return;
7111
+ shown.current = current;
7112
+ const bounds = nav.getBoundingClientRect();
7113
+ const tab = current.getBoundingClientRect();
7114
+ if (tab.left < bounds.left) nav.scrollLeft -= bounds.left - tab.left;
7115
+ else if (tab.right > bounds.right) nav.scrollLeft += tab.right - bounds.right;
7116
+ });
7117
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
7118
+ ref: setRow,
7119
+ "aria-label": label,
7120
+ "data-slot": "page-tabs",
7121
+ className: cn("flex gap-1 overflow-x-auto border-b border-border", className),
7122
+ ...props,
7123
+ children
7124
+ });
7125
+ });
7126
+ PageTabs.displayName = "PageTabs";
7127
+ /**
7128
+ * One section of a `PageTabs` row: a link, underlined when current.
7129
+ * @experimental
7130
+ */
7131
+ const PageTab = (0, react.forwardRef)(({ current = false, asChild = false, className, children, ...props }, ref) => {
7132
+ const Comp = asChild ? _radix_ui_react_slot.Slot : "a";
7133
+ const marker = current ? "page" : void 0;
7134
+ const content = asChild && (0, react.isValidElement)(children) ? (0, react.cloneElement)(children, { "aria-current": marker }) : children;
7135
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
7136
+ ...props,
7137
+ ref,
7138
+ "data-slot": "page-tab",
7139
+ "aria-current": marker,
7140
+ className: cn("-mb-px inline-flex h-9 shrink-0 items-center border-b-2 px-3 text-sm font-medium whitespace-nowrap transition-colors", current ? "border-foreground text-foreground" : "border-transparent text-muted-foreground hover:text-foreground", className),
7141
+ children: content
7142
+ });
7143
+ });
7144
+ PageTab.displayName = "PageTab";
7145
+ // src/components/page-frame.tsx
7146
+ /**
7147
+ * The shell each type draws with. A table rather than a branch per type, so
7148
+ * the four widths are read in one place and a fifth type is one row.
7149
+ */
7150
+ const SHELL_FOR = { form: {
7151
+ width: "form",
7152
+ align: "start"
7153
+ } };
7154
+ const PageFrameClaimContext = (0, react.createContext)(null);
7155
+ /**
7156
+ * Hears whether the content inside it draws a `PageFrame`, for a host that
7157
+ * gives unframed content a frame of its own and must not frame content twice.
7158
+ * Read from the frames themselves rather than from what the content is called,
7159
+ * so a page that draws a frame through any component is heard the same way.
7160
+ *
7161
+ * The frame claims in a layout effect, so a host that changes its own markup
7162
+ * in answer does so before the first paint.
7163
+ * @experimental
7164
+ */
7165
+ function PageFrameListener({ onFrame, children }) {
7166
+ const onFrameRef = (0, react.useRef)(onFrame);
7167
+ (0, react.useLayoutEffect)(() => {
7168
+ onFrameRef.current = onFrame;
7169
+ });
7170
+ const claims = (0, react.useRef)([]);
7171
+ const claim = (0, react.useCallback)((type) => {
7172
+ const entry = { type };
7173
+ claims.current = [...claims.current, entry];
7174
+ onFrameRef.current(type);
7175
+ return () => {
7176
+ claims.current = claims.current.filter((other) => other !== entry);
7177
+ onFrameRef.current(claims.current[claims.current.length - 1]?.type ?? null);
7178
+ };
7179
+ }, []);
7180
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageFrameClaimContext.Provider, {
7181
+ value: claim,
7182
+ children
7183
+ });
7184
+ }
7185
+ /**
7186
+ * A page's frame: the width and gutter its type gives it. A page says what it
7187
+ * is, and the frame decides how wide that is, so two pages of one type can
7188
+ * never drift apart.
7189
+ * @experimental
7190
+ */
7191
+ const PageFrame = (0, react.forwardRef)(({ type, className, children: content, ...props }, ref) => {
7192
+ const claim = (0, react.useContext)(PageFrameClaimContext);
7193
+ (0, react.useLayoutEffect)(() => claim?.(type), [claim, type]);
7194
+ const children = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageFrameClaimContext.Provider, {
7195
+ value: null,
7196
+ children: content
7197
+ });
7198
+ if (type !== "form") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7199
+ ref,
7200
+ "data-slot": "page-frame",
7201
+ "data-page-type": type,
7202
+ className: cn("min-w-0", type === "list" && "nx-page-pad", className),
7203
+ ...props,
7204
+ children
7205
+ });
7206
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageShell, {
7207
+ ref,
7208
+ "data-page-type": type,
7209
+ ...SHELL_FOR[type],
7210
+ className,
7211
+ ...props,
7212
+ children
7213
+ });
7214
+ });
7215
+ PageFrame.displayName = "PageFrame";
6895
7216
  exports.Accordion = Accordion;
6896
7217
  exports.AccordionContent = AccordionContent;
6897
7218
  exports.AccordionItem = AccordionItem;
@@ -6976,6 +7297,7 @@ exports.DropdownMenuSub = DropdownMenuSub;
6976
7297
  exports.DropdownMenuSubContent = DropdownMenuSubContent;
6977
7298
  exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
6978
7299
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
7300
+ exports.FieldRow = FieldRow;
6979
7301
  exports.FieldShell = FieldShell;
6980
7302
  exports.FormActions = FormActions;
6981
7303
  exports.FormLabelWithTooltip = FormLabelWithTooltip;
@@ -6986,8 +7308,12 @@ exports.IconGlyph = IconGlyph;
6986
7308
  exports.IconPicker = IconPicker;
6987
7309
  exports.Input = Input;
6988
7310
  exports.Label = Label;
7311
+ exports.PageFrame = PageFrame;
7312
+ exports.PageFrameListener = PageFrameListener;
6989
7313
  exports.PageHeader = PageHeader;
6990
7314
  exports.PageShell = PageShell;
7315
+ exports.PageTab = PageTab;
7316
+ exports.PageTabs = PageTabs;
6991
7317
  exports.Popover = Popover;
6992
7318
  exports.PopoverAnchor = PopoverAnchor;
6993
7319
  exports.PopoverContent = PopoverContent;