@nextlyhq/ui 0.0.2-alpha.74 → 0.0.2-alpha.75
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 +269 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -17
- package/dist/index.d.ts +151 -17
- package/dist/index.mjs +267 -53
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.scoped.css +1 -1
- package/dist/tailwind-preset.cjs +20 -0
- package/dist/tailwind-preset.cjs.map +1 -1
- package/dist/tailwind-preset.d.cts +20 -0
- package/dist/tailwind-preset.d.ts +20 -0
- package/dist/tailwind-preset.mjs +20 -0
- package/dist/tailwind-preset.mjs.map +1 -1
- package/dist/theme.css +123 -3
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { Fragment, cloneElement, createContext, forwardRef, useCallback, useContext, useEffect, useId, useRef } from "react";
|
|
5
|
+
import { Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useRef } from "react";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { twMerge } from "tailwind-merge";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -68,7 +68,7 @@ const buttonVariants = cva(`inline-flex items-center justify-center whitespace-n
|
|
|
68
68
|
variant: {
|
|
69
69
|
default: "bg-primary text-primary-foreground border border-transparent hover:opacity-90",
|
|
70
70
|
primary: "bg-primary text-primary-foreground border border-transparent hover:opacity-90",
|
|
71
|
-
destructive: "bg-destructive-solid text-destructive-foreground border border-transparent hover:bg-destructive-
|
|
71
|
+
destructive: "bg-destructive-solid text-destructive-foreground border border-transparent hover:bg-destructive-hover",
|
|
72
72
|
outline: "border border-border text-foreground hover-unified bg-background",
|
|
73
73
|
secondary: "bg-background border border-border text-foreground hover:bg-primary/5",
|
|
74
74
|
ghost: "text-foreground border border-transparent hover-unified",
|
|
@@ -252,6 +252,15 @@ const FormLabelWithTooltip = React.forwardRef(({ className, labelClassName, tool
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
FormLabelWithTooltip.displayName = "FormLabelWithTooltip";
|
|
255
|
+
// src/components/badge.tsx
|
|
256
|
+
/** The arms `badgeVariants` is built from. Its type is read from them: {@link VariantsFn}. */
|
|
257
|
+
/** The status variants, and the solid each one's dot is drawn in. */
|
|
258
|
+
const STATUS_DOT = {
|
|
259
|
+
success: "bg-success-solid",
|
|
260
|
+
warning: "bg-warning-solid",
|
|
261
|
+
destructive: "bg-danger-solid",
|
|
262
|
+
info: "bg-info-solid"
|
|
263
|
+
};
|
|
255
264
|
/**
|
|
256
265
|
* Badge Component - Design System Specification
|
|
257
266
|
*
|
|
@@ -270,34 +279,40 @@ FormLabelWithTooltip.displayName = "FormLabelWithTooltip";
|
|
|
270
279
|
* - Padding: 2px 10px (vertical × horizontal)
|
|
271
280
|
* - Border radius: Full (pill shape)
|
|
272
281
|
* - Font: 12px (text-xs), medium weight (500)
|
|
273
|
-
* -
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* -
|
|
278
|
-
* -
|
|
279
|
-
* - warning:
|
|
280
|
-
* -
|
|
281
|
-
* - outline: Transparent background with border border-border
|
|
282
|
+
* - Status variants (success, warning, destructive, info): a neutral chip with
|
|
283
|
+
* a 6px dot in the status's solid colour before the label
|
|
284
|
+
*
|
|
285
|
+
* Variants:
|
|
286
|
+
* - default: muted background
|
|
287
|
+
* - primary: primary tint
|
|
288
|
+
* - success, warning, destructive, info: quiet chip with a status dot
|
|
289
|
+
* - outline: transparent background with a border
|
|
282
290
|
* @experimental
|
|
283
291
|
*/
|
|
284
|
-
const badgeVariants = cva("inline-flex items-center rounded-sm px-2.5 py-0.5 h-[22px] text-xs font-medium transition-colors", {
|
|
292
|
+
const badgeVariants = cva("inline-flex items-center gap-1.5 rounded-sm px-2.5 py-0.5 h-[22px] text-xs font-medium transition-colors", {
|
|
285
293
|
variants: { variant: {
|
|
286
294
|
default: "bg-muted text-foreground",
|
|
287
295
|
primary: "bg-primary/10 text-primary dark:bg-primary/20",
|
|
288
|
-
success: "
|
|
289
|
-
warning: "
|
|
290
|
-
destructive: "
|
|
296
|
+
success: "border border-border bg-card text-foreground",
|
|
297
|
+
warning: "border border-border bg-card text-foreground",
|
|
298
|
+
destructive: "border border-border bg-card text-foreground",
|
|
299
|
+
info: "border border-border bg-card text-foreground",
|
|
291
300
|
outline: "border border-border bg-transparent text-foreground dark:text-muted-foreground dark:border-border"
|
|
292
301
|
} },
|
|
293
302
|
defaultVariants: { variant: "default" }
|
|
294
303
|
});
|
|
295
304
|
/** @public */
|
|
296
|
-
function Badge({ className, variant = "default", ...props }) {
|
|
297
|
-
|
|
305
|
+
function Badge({ className, variant = "default", children, ...props }) {
|
|
306
|
+
const dot = variant && variant in STATUS_DOT ? STATUS_DOT[variant] : null;
|
|
307
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
298
308
|
"data-slot": `badge.${variant}`,
|
|
299
309
|
className: cn(badgeVariants({ variant }), className),
|
|
300
|
-
...props
|
|
310
|
+
...props,
|
|
311
|
+
children: [dot ? /* @__PURE__ */ jsx("span", {
|
|
312
|
+
"aria-hidden": "true",
|
|
313
|
+
"data-slot": "badge-dot",
|
|
314
|
+
className: cn("size-1.5 shrink-0 rounded-full", dot)
|
|
315
|
+
}) : null, children]
|
|
301
316
|
});
|
|
302
317
|
}
|
|
303
318
|
/**
|
|
@@ -528,11 +543,12 @@ Stat.displayName = "Stat";
|
|
|
528
543
|
* - Padding: 16px (p-4)
|
|
529
544
|
* - Border radius: `rounded-md`, one step tighter than Card's `rounded-lg`
|
|
530
545
|
* for inline/flow content vs. larger container components
|
|
531
|
-
* - Border: 1px
|
|
546
|
+
* - Border: 1px; the card border for info and success, the status border for
|
|
547
|
+
* warning and destructive
|
|
532
548
|
* - Shadow: sm (subtle elevation)
|
|
533
549
|
* - Font: 14px (text-sm)
|
|
534
550
|
* - Layout: Flex with gap-3 for icon/content spacing
|
|
535
|
-
* - Colors:
|
|
551
|
+
* - Colors: the page's foreground text; the icon in the status's text colour
|
|
536
552
|
*
|
|
537
553
|
* Variants (4 total):
|
|
538
554
|
* - info (default): Blue - informational messages, neutral announcements
|
|
@@ -589,10 +605,10 @@ Stat.displayName = "Stat";
|
|
|
589
605
|
*/
|
|
590
606
|
const alertVariants = cva("relative flex items-start gap-3 rounded-md border border-border p-4 text-sm transition-colors duration-150", {
|
|
591
607
|
variants: { variant: {
|
|
592
|
-
info: "bg-
|
|
593
|
-
success: "border-
|
|
594
|
-
warning: "border-warning-
|
|
595
|
-
destructive: "border-
|
|
608
|
+
info: "border-border bg-card text-foreground [&>svg]:text-info-text",
|
|
609
|
+
success: "border-border bg-card text-foreground [&>svg]:text-success-text",
|
|
610
|
+
warning: "border-warning-border bg-warning-surface text-foreground [&>svg]:text-warning-text",
|
|
611
|
+
destructive: "border-danger-border bg-danger-surface text-foreground [&>svg]:text-danger-text"
|
|
596
612
|
} },
|
|
597
613
|
defaultVariants: { variant: "info" }
|
|
598
614
|
});
|
|
@@ -745,12 +761,13 @@ function Separator({ className, orientation = "horizontal", decorative = true, .
|
|
|
745
761
|
* @see {@link https://adrianroselli.com/2020/11/more-accessible-skeletons.html More Accessible Skeletons}
|
|
746
762
|
* @experimental
|
|
747
763
|
*/
|
|
748
|
-
const Skeleton = React.forwardRef(({ className, ...props }, ref) => {
|
|
764
|
+
const Skeleton = React.forwardRef(({ className, still = false, ...props }, ref) => {
|
|
749
765
|
return /* @__PURE__ */ jsx("div", {
|
|
750
766
|
ref,
|
|
751
767
|
"data-slot": "skeleton",
|
|
768
|
+
"data-still": still ? "" : void 0,
|
|
752
769
|
"aria-hidden": "true",
|
|
753
|
-
className: cn("bg-primary/5 animate-pulse rounded-md motion-reduce:animate-none", className),
|
|
770
|
+
className: cn(still ? "bg-secondary rounded-md" : "bg-primary/5 animate-pulse rounded-md motion-reduce:animate-none", className),
|
|
754
771
|
...props
|
|
755
772
|
});
|
|
756
773
|
});
|
|
@@ -765,7 +782,7 @@ Skeleton.displayName = "Skeleton";
|
|
|
765
782
|
const progressVariants = cva("h-full rounded-none transition-all", {
|
|
766
783
|
variants: { variant: {
|
|
767
784
|
default: "bg-primary-500",
|
|
768
|
-
success: "bg-success-
|
|
785
|
+
success: "bg-success-solid",
|
|
769
786
|
error: "bg-destructive"
|
|
770
787
|
} },
|
|
771
788
|
defaultVariants: { variant: "default" }
|
|
@@ -2239,6 +2256,65 @@ const sheetVariants = cva("fixed z-50 gap-4 bg-background p-6 shadow-lg will-cha
|
|
|
2239
2256
|
} },
|
|
2240
2257
|
defaultVariants: { side: "right" }
|
|
2241
2258
|
});
|
|
2259
|
+
/** How far down, as a share of the sheet's height, a drag must go to close it. */
|
|
2260
|
+
const DISMISS_SHARE = .25;
|
|
2261
|
+
/** A release faster than this, in px per ms, closes it from a shorter drag. */
|
|
2262
|
+
const FLICK_SPEED = .6;
|
|
2263
|
+
/** The shortest drag a flick closes from, so a tap never closes the sheet. */
|
|
2264
|
+
const FLICK_MIN_DISTANCE = 24;
|
|
2265
|
+
/** Whether a drag released at `distance` after `elapsed` ms closes the sheet. */
|
|
2266
|
+
function dragCloses(distance, elapsed, height) {
|
|
2267
|
+
if (distance >= height * DISMISS_SHARE) return true;
|
|
2268
|
+
return distance >= FLICK_MIN_DISTANCE && distance / Math.max(elapsed, 1) >= FLICK_SPEED;
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* The grab strip: the sheet follows the pointer down (never up), and on
|
|
2272
|
+
* release either closes or springs back. It moves the sheet with an inline
|
|
2273
|
+
* transform, so the closing slide continues from where the finger let go.
|
|
2274
|
+
*/
|
|
2275
|
+
function SheetDragHandle({ onDismiss }) {
|
|
2276
|
+
const drag = React.useRef(null);
|
|
2277
|
+
const onPointerDown = (event) => {
|
|
2278
|
+
const sheet = event.currentTarget.closest("[data-slot='sheet-content']");
|
|
2279
|
+
if (!sheet) return;
|
|
2280
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
2281
|
+
drag.current = {
|
|
2282
|
+
y: event.clientY,
|
|
2283
|
+
time: performance.now(),
|
|
2284
|
+
height: sheet.getBoundingClientRect().height,
|
|
2285
|
+
sheet
|
|
2286
|
+
};
|
|
2287
|
+
sheet.style.transition = "none";
|
|
2288
|
+
};
|
|
2289
|
+
const onPointerMove = (event) => {
|
|
2290
|
+
const start = drag.current;
|
|
2291
|
+
if (!start) return;
|
|
2292
|
+
const distance = Math.max(0, event.clientY - start.y);
|
|
2293
|
+
start.sheet.style.transform = `translateY(${distance}px)`;
|
|
2294
|
+
};
|
|
2295
|
+
const release = (event, cancelled) => {
|
|
2296
|
+
const start = drag.current;
|
|
2297
|
+
if (!start) return;
|
|
2298
|
+
drag.current = null;
|
|
2299
|
+
start.sheet.style.transition = "";
|
|
2300
|
+
const distance = Math.max(0, event.clientY - start.y);
|
|
2301
|
+
if (!cancelled && dragCloses(distance, performance.now() - start.time, start.height)) {
|
|
2302
|
+
onDismiss();
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
start.sheet.style.transform = "";
|
|
2306
|
+
};
|
|
2307
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2308
|
+
"aria-hidden": "true",
|
|
2309
|
+
"data-slot": "sheet-drag-handle",
|
|
2310
|
+
className: "flex h-6 w-full shrink-0 cursor-grab touch-none items-center justify-center active:cursor-grabbing",
|
|
2311
|
+
onPointerDown,
|
|
2312
|
+
onPointerMove,
|
|
2313
|
+
onPointerUp: (event) => release(event, false),
|
|
2314
|
+
onPointerCancel: (event) => release(event, true),
|
|
2315
|
+
children: /* @__PURE__ */ jsx("span", { className: "h-1 w-10 rounded-full bg-border" })
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2242
2318
|
/**
|
|
2243
2319
|
* SheetContent
|
|
2244
2320
|
*
|
|
@@ -2253,17 +2329,24 @@ const sheetVariants = cva("fixed z-50 gap-4 bg-background p-6 shadow-lg will-cha
|
|
|
2253
2329
|
* @param side - Which edge to slide in from: "left", "right", "top", "bottom"
|
|
2254
2330
|
* @public
|
|
2255
2331
|
*/
|
|
2256
|
-
const SheetContent = React.forwardRef(({ side = "right", className, children, ...props }, ref) => {
|
|
2332
|
+
const SheetContent = React.forwardRef(({ side = "right", className, children, dragHandle = false, ...props }, ref) => {
|
|
2257
2333
|
const portalContainer = usePortalContainer();
|
|
2258
2334
|
const modal = React.useContext(SheetModalContext);
|
|
2335
|
+
const close = React.useRef(null);
|
|
2336
|
+
const draggable = dragHandle && side === "bottom";
|
|
2259
2337
|
return /* @__PURE__ */ jsxs(SheetPortal, {
|
|
2260
2338
|
container: portalContainer,
|
|
2261
|
-
children: [modal ? /* @__PURE__ */ jsx(SheetOverlay, {}) : null, /* @__PURE__ */
|
|
2339
|
+
children: [modal ? /* @__PURE__ */ jsx(SheetOverlay, {}) : null, /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
2262
2340
|
ref,
|
|
2263
2341
|
"data-slot": "sheet-content",
|
|
2264
2342
|
className: cn(sheetVariants({ side }), className),
|
|
2265
2343
|
...props,
|
|
2266
|
-
children
|
|
2344
|
+
children: [draggable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SheetDragHandle, { onDismiss: () => close.current?.click() }), /* @__PURE__ */ jsx(DialogPrimitive.Close, {
|
|
2345
|
+
ref: close,
|
|
2346
|
+
hidden: true,
|
|
2347
|
+
tabIndex: -1,
|
|
2348
|
+
"aria-hidden": "true"
|
|
2349
|
+
})] }) : null, children]
|
|
2267
2350
|
})]
|
|
2268
2351
|
});
|
|
2269
2352
|
});
|
|
@@ -2714,7 +2797,13 @@ function Toaster({ theme = "system", ...props }) {
|
|
|
2714
2797
|
"--success-bg": "var(--nx-toast-success-bg)",
|
|
2715
2798
|
"--success-text": "var(--nx-toast-success-text)",
|
|
2716
2799
|
"--warning-bg": "var(--nx-toast-warning-bg)",
|
|
2717
|
-
"--warning-text": "var(--nx-toast-warning-text)"
|
|
2800
|
+
"--warning-text": "var(--nx-toast-warning-text)",
|
|
2801
|
+
"--error-bg": "var(--nx-danger-surface)",
|
|
2802
|
+
"--error-border": "var(--nx-danger-border)",
|
|
2803
|
+
"--error-text": "var(--nx-danger-text)",
|
|
2804
|
+
"--info-bg": "var(--nx-info-surface)",
|
|
2805
|
+
"--info-border": "var(--nx-info-border)",
|
|
2806
|
+
"--info-text": "var(--nx-info-text)"
|
|
2718
2807
|
},
|
|
2719
2808
|
...props
|
|
2720
2809
|
});
|
|
@@ -4369,7 +4458,7 @@ function MissingIconWarning({ shown, id }) {
|
|
|
4369
4458
|
if (!shown) return null;
|
|
4370
4459
|
return /* @__PURE__ */ jsxs("p", {
|
|
4371
4460
|
id,
|
|
4372
|
-
className: "mt-1.5 flex items-start gap-2 rounded-md border border-warning-
|
|
4461
|
+
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",
|
|
4373
4462
|
children: [/* @__PURE__ */ jsx(TriangleAlert, {
|
|
4374
4463
|
className: "mt-px size-3.5 shrink-0",
|
|
4375
4464
|
"aria-hidden": "true"
|
|
@@ -6735,7 +6824,7 @@ const SHELL_MEASURE = {
|
|
|
6735
6824
|
* "how far is content from the panel's edge".
|
|
6736
6825
|
* @experimental
|
|
6737
6826
|
*/
|
|
6738
|
-
const PageShell = forwardRef(({ width = "form", className, children, style, ...props }, ref) => {
|
|
6827
|
+
const PageShell = forwardRef(({ width = "form", align = "start", className, children, style, ...props }, ref) => {
|
|
6739
6828
|
const shellRef = useRef(null);
|
|
6740
6829
|
const attachRef = useCallback((node) => {
|
|
6741
6830
|
shellRef.current = node;
|
|
@@ -6768,6 +6857,7 @@ const PageShell = forwardRef(({ width = "form", className, children, style, ...p
|
|
|
6768
6857
|
children: /* @__PURE__ */ jsx("div", {
|
|
6769
6858
|
ref: attachRef,
|
|
6770
6859
|
"data-slot": "page-shell",
|
|
6860
|
+
"data-align": align,
|
|
6771
6861
|
style: shellStyle,
|
|
6772
6862
|
className: cn("nx-page-shell py-8", className),
|
|
6773
6863
|
...props,
|
|
@@ -6831,32 +6921,156 @@ Bleed.displayName = "Bleed";
|
|
|
6831
6921
|
* prop.
|
|
6832
6922
|
* @experimental
|
|
6833
6923
|
*/
|
|
6834
|
-
const PageHeader = forwardRef(({ title, description, breadcrumbs, actions, className, ...props }, ref) => /* @__PURE__ */ jsxs("header", {
|
|
6924
|
+
const PageHeader = forwardRef(({ title, description, breadcrumbs, actions, tabs, media, meta, titleId, className, ...props }, ref) => /* @__PURE__ */ jsxs("header", {
|
|
6835
6925
|
ref,
|
|
6836
6926
|
"data-slot": "page-header",
|
|
6837
6927
|
className: cn("mb-8", className),
|
|
6838
6928
|
...props,
|
|
6839
|
-
children: [
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
className: "
|
|
6846
|
-
children: [/* @__PURE__ */
|
|
6847
|
-
className: "
|
|
6848
|
-
children:
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6929
|
+
children: [
|
|
6930
|
+
breadcrumbs ? /* @__PURE__ */ jsx("div", {
|
|
6931
|
+
className: "mb-6 empty:hidden",
|
|
6932
|
+
children: breadcrumbs
|
|
6933
|
+
}) : null,
|
|
6934
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6935
|
+
className: "flex flex-col justify-between gap-4 sm:flex-row sm:items-center",
|
|
6936
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6937
|
+
className: "flex min-w-0 items-start gap-4",
|
|
6938
|
+
children: [media ? /* @__PURE__ */ jsx("div", {
|
|
6939
|
+
className: "shrink-0",
|
|
6940
|
+
children: media
|
|
6941
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
6942
|
+
className: "min-w-0 space-y-1",
|
|
6943
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6944
|
+
className: "flex flex-wrap items-center gap-3",
|
|
6945
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
6946
|
+
id: titleId,
|
|
6947
|
+
className: "text-xl font-semibold tracking-tight",
|
|
6948
|
+
children: title
|
|
6949
|
+
}), meta]
|
|
6950
|
+
}), description ? /* @__PURE__ */ jsx("div", {
|
|
6951
|
+
"data-slot": "page-header-description",
|
|
6952
|
+
className: "mt-1 text-sm font-normal text-muted-foreground",
|
|
6953
|
+
children: description
|
|
6954
|
+
}) : null]
|
|
6955
|
+
})]
|
|
6956
|
+
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
6957
|
+
className: "flex items-center gap-3",
|
|
6958
|
+
children: actions
|
|
6852
6959
|
}) : null]
|
|
6853
|
-
}),
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6960
|
+
}),
|
|
6961
|
+
tabs ? /* @__PURE__ */ jsx("div", {
|
|
6962
|
+
className: "mt-6",
|
|
6963
|
+
children: tabs
|
|
6964
|
+
}) : null
|
|
6965
|
+
]
|
|
6858
6966
|
}));
|
|
6859
6967
|
PageHeader.displayName = "PageHeader";
|
|
6860
|
-
|
|
6968
|
+
/**
|
|
6969
|
+
* The tab row of a page whose sections each have their own address. A labelled
|
|
6970
|
+
* `nav` of links rather than an ARIA tablist: every tab changes the URL, and a
|
|
6971
|
+
* link inside `role="tab"` breaks the tabs pattern's keyboard and announcement
|
|
6972
|
+
* contract. The current section is marked with `aria-current="page"` by
|
|
6973
|
+
* `PageTab`.
|
|
6974
|
+
* @experimental
|
|
6975
|
+
*/
|
|
6976
|
+
const PageTabs = forwardRef(({ label, className, children, ...props }, ref) => /* @__PURE__ */ jsx("nav", {
|
|
6977
|
+
ref,
|
|
6978
|
+
"aria-label": label,
|
|
6979
|
+
"data-slot": "page-tabs",
|
|
6980
|
+
className: cn("flex gap-1 overflow-x-auto border-b border-border", className),
|
|
6981
|
+
...props,
|
|
6982
|
+
children
|
|
6983
|
+
}));
|
|
6984
|
+
PageTabs.displayName = "PageTabs";
|
|
6985
|
+
/**
|
|
6986
|
+
* One section of a `PageTabs` row: a link, underlined when current.
|
|
6987
|
+
* @experimental
|
|
6988
|
+
*/
|
|
6989
|
+
const PageTab = forwardRef(({ current = false, asChild = false, className, children, ...props }, ref) => {
|
|
6990
|
+
const Comp = asChild ? Slot : "a";
|
|
6991
|
+
const marker = current ? "page" : void 0;
|
|
6992
|
+
const content = asChild && isValidElement(children) ? cloneElement(children, { "aria-current": marker }) : children;
|
|
6993
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
6994
|
+
...props,
|
|
6995
|
+
ref,
|
|
6996
|
+
"data-slot": "page-tab",
|
|
6997
|
+
"aria-current": marker,
|
|
6998
|
+
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),
|
|
6999
|
+
children: content
|
|
7000
|
+
});
|
|
7001
|
+
});
|
|
7002
|
+
PageTab.displayName = "PageTab";
|
|
7003
|
+
// src/components/page-frame.tsx
|
|
7004
|
+
/**
|
|
7005
|
+
* The shell each type draws with. A table rather than a branch per type, so
|
|
7006
|
+
* the four widths are read in one place and a fifth type is one row.
|
|
7007
|
+
*/
|
|
7008
|
+
const SHELL_FOR = { form: {
|
|
7009
|
+
width: "form",
|
|
7010
|
+
align: "start"
|
|
7011
|
+
} };
|
|
7012
|
+
const PageFrameClaimContext = createContext(null);
|
|
7013
|
+
/**
|
|
7014
|
+
* Hears whether the content inside it draws a `PageFrame`, for a host that
|
|
7015
|
+
* gives unframed content a frame of its own and must not frame content twice.
|
|
7016
|
+
* Read from the frames themselves rather than from what the content is called,
|
|
7017
|
+
* so a page that draws a frame through any component is heard the same way.
|
|
7018
|
+
*
|
|
7019
|
+
* The frame claims in a layout effect, so a host that changes its own markup
|
|
7020
|
+
* in answer does so before the first paint.
|
|
7021
|
+
* @experimental
|
|
7022
|
+
*/
|
|
7023
|
+
function PageFrameListener({ onFrame, children }) {
|
|
7024
|
+
const onFrameRef = useRef(onFrame);
|
|
7025
|
+
useLayoutEffect(() => {
|
|
7026
|
+
onFrameRef.current = onFrame;
|
|
7027
|
+
});
|
|
7028
|
+
const claims = useRef([]);
|
|
7029
|
+
const claim = useCallback((type) => {
|
|
7030
|
+
const entry = { type };
|
|
7031
|
+
claims.current = [...claims.current, entry];
|
|
7032
|
+
onFrameRef.current(type);
|
|
7033
|
+
return () => {
|
|
7034
|
+
claims.current = claims.current.filter((other) => other !== entry);
|
|
7035
|
+
onFrameRef.current(claims.current[claims.current.length - 1]?.type ?? null);
|
|
7036
|
+
};
|
|
7037
|
+
}, []);
|
|
7038
|
+
return /* @__PURE__ */ jsx(PageFrameClaimContext.Provider, {
|
|
7039
|
+
value: claim,
|
|
7040
|
+
children
|
|
7041
|
+
});
|
|
7042
|
+
}
|
|
7043
|
+
/**
|
|
7044
|
+
* A page's frame: the width and gutter its type gives it. A page says what it
|
|
7045
|
+
* is, and the frame decides how wide that is, so two pages of one type can
|
|
7046
|
+
* never drift apart.
|
|
7047
|
+
* @experimental
|
|
7048
|
+
*/
|
|
7049
|
+
const PageFrame = forwardRef(({ type, className, children: content, ...props }, ref) => {
|
|
7050
|
+
const claim = useContext(PageFrameClaimContext);
|
|
7051
|
+
useLayoutEffect(() => claim?.(type), [claim, type]);
|
|
7052
|
+
const children = /* @__PURE__ */ jsx(PageFrameClaimContext.Provider, {
|
|
7053
|
+
value: null,
|
|
7054
|
+
children: content
|
|
7055
|
+
});
|
|
7056
|
+
if (type !== "form") return /* @__PURE__ */ jsx("div", {
|
|
7057
|
+
ref,
|
|
7058
|
+
"data-slot": "page-frame",
|
|
7059
|
+
"data-page-type": type,
|
|
7060
|
+
className: cn("min-w-0", type === "list" && "nx-page-pad", className),
|
|
7061
|
+
...props,
|
|
7062
|
+
children
|
|
7063
|
+
});
|
|
7064
|
+
return /* @__PURE__ */ jsx(PageShell, {
|
|
7065
|
+
ref,
|
|
7066
|
+
"data-page-type": type,
|
|
7067
|
+
...SHELL_FOR[type],
|
|
7068
|
+
className,
|
|
7069
|
+
...props,
|
|
7070
|
+
children
|
|
7071
|
+
});
|
|
7072
|
+
});
|
|
7073
|
+
PageFrame.displayName = "PageFrame";
|
|
7074
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Bleed, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorPicker, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FieldShell, FormActions, FormLabelWithTooltip, FormSection, Grid, IconField, IconGlyph, IconPicker, Input, Label, PageFrame, PageFrameListener, PageHeader, PageShell, PageTab, PageTabs, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalProvider, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, SHELL_MEASURE, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShortcutProvider, ShortcutScope, Skeleton, Slider, Spinner, Stack, Stat, Switch, TREE_INDENT_PX, Table, TableBody, TableCaption, TableCell, TableEmpty, TableError, TableFooter, TableHead, TableHeader, TableLoading, TableRow, TableSearch, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TreeView, alertVariants, avatarVariants, badgeVariants, buttonVariants, cardVariants, chordMatches, commandDefaultFilter, createShortcutManager, detectApplePlatform, dialogContentVariants, inputVariants, parseKeys, progressVariants, selectTriggerVariants, sheetVariants, spinnerVariants, toast, useActiveShortcuts, useCommandHighlight, useIsomorphicLayoutEffect, usePortalContainer, useShortcutManager, useShortcuts };
|
|
6861
7075
|
|
|
6862
7076
|
//# sourceMappingURL=index.mjs.map
|