@nswds/ui 8.2.1 → 8.3.0
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/README.md +5 -5
- package/dist/components/alert-dialog.d.ts +74 -0
- package/dist/components/alert-dialog.js +190 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/callout.d.ts +15 -1
- package/dist/components/callout.js +3 -1
- package/dist/components/callout.js.map +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.d.ts +54 -0
- package/dist/components/dialog.js +204 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.js +3 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +89 -0
- package/dist/components/dropdown-menu.js +313 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +26 -0
- package/dist/components/empty.js +98 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.js +4 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.d.ts +33 -0
- package/dist/components/skeleton.js +34 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +5 -0
- package/dist/lib/overlay.d.ts +29 -0
- package/dist/lib/overlay.js +7 -0
- package/dist/lib/overlay.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { Button } from '../components/button.js';
|
|
6
|
+
import { IconClose } from '../icons/close.js';
|
|
7
|
+
import { ButtonGroupBoundary } from '../lib/button-group-context.js';
|
|
8
|
+
import { overlayScrim, overlayInk } from '../lib/overlay.js';
|
|
9
|
+
import { cn } from '../lib/utils.js';
|
|
10
|
+
|
|
11
|
+
function Dialog({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, { "data-slot": "dialog", ...props });
|
|
13
|
+
}
|
|
14
|
+
function DialogTrigger({ ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
16
|
+
}
|
|
17
|
+
function DialogClose({ ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
|
|
19
|
+
}
|
|
20
|
+
function DialogPortal({ children, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, { "data-slot": "dialog-portal", ...props, children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children }) });
|
|
22
|
+
}
|
|
23
|
+
const dialogContentVariants = cva(
|
|
24
|
+
// `w-[calc(100%-2rem)]` + `max-w-lg` rather than shadcn's
|
|
25
|
+
// `max-w-[calc(100%-2rem)] sm:max-w-sm`: two different properties, so there
|
|
26
|
+
// is no bare/responsive pair for a consumer's build to reorder (see
|
|
27
|
+
// check:cascade).
|
|
28
|
+
"group/dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-6 overflow-y-auto bg-popover p-6 text-base/relaxed text-popover-foreground ring-1 ring-foreground/10 outline-hidden transition-[opacity,scale] duration-150 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0",
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "rounded-md",
|
|
33
|
+
band: "rounded-md",
|
|
34
|
+
rule: "rounded-t-sm rounded-b-md border-t-4 border-t-(--overlay-ink)"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: { variant: "default" }
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
function DialogOverlay({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
Dialog$1.Backdrop,
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "dialog-overlay",
|
|
45
|
+
className: cn(
|
|
46
|
+
"fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
47
|
+
overlayScrim,
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function DialogContent({
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
variant = "default",
|
|
58
|
+
showCloseButton = true,
|
|
59
|
+
closeLabel = "Close",
|
|
60
|
+
...props
|
|
61
|
+
}) {
|
|
62
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
63
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
64
|
+
/* @__PURE__ */ jsxs(
|
|
65
|
+
Dialog$1.Popup,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "dialog-content",
|
|
68
|
+
"data-variant": variant,
|
|
69
|
+
className: cn(
|
|
70
|
+
dialogContentVariants({ variant }),
|
|
71
|
+
// The ink rule's cap is drawn in (see overlayInk).
|
|
72
|
+
overlayInk,
|
|
73
|
+
// The header rules below match it at any depth, not only as a direct
|
|
74
|
+
// child: an edit dialog usually wraps its content in a <form>.
|
|
75
|
+
// A header with nothing below it draws no divider over empty space.
|
|
76
|
+
"[&_[data-slot=dialog-header]:last-child]:border-b-0",
|
|
77
|
+
// Keep a long title clear of the absolutely-positioned close button:
|
|
78
|
+
// 72px where the header bleeds to the edge (24px gutter + the 48px
|
|
79
|
+
// the button needs), 48px under `rule`, whose header does not bleed.
|
|
80
|
+
"[&:has(>[data-slot=dialog-close])_[data-slot=dialog-header]]:pe-18 data-[variant=rule]:[&:has(>[data-slot=dialog-close])_[data-slot=dialog-header]]:pe-12",
|
|
81
|
+
// With no header at all, the first content after the close button
|
|
82
|
+
// reserves the button's 48px instead, so its text cannot run under it.
|
|
83
|
+
"[&>[data-slot=dialog-close]+:not([data-slot=dialog-header]):not(:has([data-slot=dialog-header]))]:pe-12",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
...props,
|
|
87
|
+
children: [
|
|
88
|
+
showCloseButton && /* @__PURE__ */ jsx(
|
|
89
|
+
Dialog$1.Close,
|
|
90
|
+
{
|
|
91
|
+
"data-slot": "dialog-close",
|
|
92
|
+
render: /* @__PURE__ */ jsx(
|
|
93
|
+
Button,
|
|
94
|
+
{
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
color: "grey",
|
|
97
|
+
size: "icon",
|
|
98
|
+
"aria-label": closeLabel,
|
|
99
|
+
className: cn(
|
|
100
|
+
// z-10, as Sheet's: the button comes first in the DOM, so any
|
|
101
|
+
// positioned content after it would otherwise paint over it.
|
|
102
|
+
"absolute end-4 top-4 z-10",
|
|
103
|
+
// On the band the button takes the band's inverse ink — only
|
|
104
|
+
// when a header is there to paint the band. The extra
|
|
105
|
+
// data-slot keeps this above Button's own dark ink at any
|
|
106
|
+
// emission order.
|
|
107
|
+
"group-data-[variant=band]/dialog-content:group-has-[[data-slot=dialog-header]]/dialog-content:data-[slot=dialog-close]:[--btn-bg:var(--text-inverse)]"
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
children: /* @__PURE__ */ jsx(IconClose, {})
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
children
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
function DialogHeader({ className, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
"data-slot": "dialog-header",
|
|
125
|
+
className: cn(
|
|
126
|
+
// default: bleeds to the popup's edges and is divided off by a hairline.
|
|
127
|
+
"-mx-6 -mt-6 flex flex-col gap-2 border-b border-border px-6 pt-6 pb-5",
|
|
128
|
+
// band: the same bleed, painted as a solid band instead of divided.
|
|
129
|
+
"group-data-[variant=band]/dialog-content:border-b-0 group-data-[variant=band]/dialog-content:bg-primary group-data-[variant=band]/dialog-content:pb-6 group-data-[variant=band]/dialog-content:text-primary-foreground",
|
|
130
|
+
// rule: no bleed — the title carries its own hairline instead.
|
|
131
|
+
"group-data-[variant=rule]/dialog-content:mx-0 group-data-[variant=rule]/dialog-content:mt-0 group-data-[variant=rule]/dialog-content:border-b-0 group-data-[variant=rule]/dialog-content:px-0 group-data-[variant=rule]/dialog-content:pt-0 group-data-[variant=rule]/dialog-content:pb-0",
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function DialogFooter({
|
|
139
|
+
className,
|
|
140
|
+
showCloseButton = false,
|
|
141
|
+
closeLabel = "Close",
|
|
142
|
+
children,
|
|
143
|
+
...props
|
|
144
|
+
}) {
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "dialog-footer",
|
|
149
|
+
className: cn(
|
|
150
|
+
// Stacked with the primary action on top below `sm`, a row aligned to
|
|
151
|
+
// the end from `sm` up. `max-sm:` rather than a bare `flex-col-reverse`
|
|
152
|
+
// keeps the pair cascade-safe (see check:cascade).
|
|
153
|
+
"flex gap-2 max-sm:flex-col-reverse sm:flex-row sm:justify-end",
|
|
154
|
+
// default: bleeds to the popup's edges above a hairline.
|
|
155
|
+
"-mx-6 -mb-6 border-t border-border px-6 py-4",
|
|
156
|
+
// band: the same bleed on a subtle band instead of a hairline.
|
|
157
|
+
"group-data-[variant=band]/dialog-content:border-t-0 group-data-[variant=band]/dialog-content:bg-muted",
|
|
158
|
+
// rule: no bleed, actions aligned to the start.
|
|
159
|
+
"group-data-[variant=rule]/dialog-content:mx-0 group-data-[variant=rule]/dialog-content:mb-0 group-data-[variant=rule]/dialog-content:border-t-0 group-data-[variant=rule]/dialog-content:px-0 group-data-[variant=rule]/dialog-content:py-0 group-data-[variant=rule]/dialog-content:sm:justify-start",
|
|
160
|
+
className
|
|
161
|
+
),
|
|
162
|
+
...props,
|
|
163
|
+
children: [
|
|
164
|
+
children,
|
|
165
|
+
showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, { render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: closeLabel })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
function DialogTitle({ className, ...props }) {
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
Dialog$1.Title,
|
|
173
|
+
{
|
|
174
|
+
"data-slot": "dialog-title",
|
|
175
|
+
className: cn(
|
|
176
|
+
"font-heading text-2xl font-medium text-foreground",
|
|
177
|
+
// Inverse ink only inside the band — a title placed in the body stays
|
|
178
|
+
// on the popover and must keep the default ink.
|
|
179
|
+
"group-data-[variant=band]/dialog-content:in-data-[slot=dialog-header]:text-primary-foreground",
|
|
180
|
+
"group-data-[variant=rule]/dialog-content:border-b group-data-[variant=rule]/dialog-content:border-foreground group-data-[variant=rule]/dialog-content:pb-3",
|
|
181
|
+
className
|
|
182
|
+
),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function DialogDescription({ className, ...props }) {
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
Dialog$1.Description,
|
|
190
|
+
{
|
|
191
|
+
"data-slot": "dialog-description",
|
|
192
|
+
className: cn(
|
|
193
|
+
"text-base/relaxed text-muted-foreground",
|
|
194
|
+
"group-data-[variant=band]/dialog-content:in-data-[slot=dialog-header]:text-primary-foreground",
|
|
195
|
+
className
|
|
196
|
+
),
|
|
197
|
+
...props
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants };
|
|
203
|
+
//# sourceMappingURL=dialog.js.map
|
|
204
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/dialog.tsx"],"names":["DialogPrimitive"],"mappings":";;;;;;;;;AAYA,SAAS,MAAA,CAAO,EAAE,GAAG,KAAA,EAAM,EAA+B;AACxD,EAAA,2BAAQA,QAAA,CAAgB,IAAA,EAAhB,EAAqB,WAAA,EAAU,QAAA,EAAU,GAAG,KAAA,EAAO,CAAA;AAC7D;AAEA,SAAS,aAAA,CAAc,EAAE,GAAG,KAAA,EAAM,EAAkC;AAClE,EAAA,2BAAQA,QAAA,CAAgB,OAAA,EAAhB,EAAwB,WAAA,EAAU,gBAAA,EAAkB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,WAAA,CAAY,EAAE,GAAG,KAAA,EAAM,EAAgC;AAC9D,EAAA,2BAAQA,QAAA,CAAgB,KAAA,EAAhB,EAAsB,WAAA,EAAU,cAAA,EAAgB,GAAG,KAAA,EAAO,CAAA;AACpE;AAEA,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,GAAG,OAAM,EAAiC;AAC1E,EAAA,uBACE,GAAA,CAACA,QAAA,CAAgB,MAAA,EAAhB,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAEpD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC,CAAA;AAEJ;AAyBA,MAAM,qBAAA,GAAwB,GAAA;AAAA;AAAA;AAA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A,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,eAAA,oBACC,GAAA,CAACA,QAAA,CAAgB,KAAA,EAAhB,EAAsB,MAAA,kBAAQ,GAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,SAAA,EAAU,CAAA,EACtD,QAAA,EAAA,UAAA,EACH;AAAA;AAAA;AAAA,GAEJ;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,mDAAA;AAAA;AAAA;AAAA,QAGA,+FAAA;AAAA,QACA,4JAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,iBAAA,CAAkB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAsC;AACrF,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,WAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,oBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,yCAAA;AAAA,QACA,+FAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"dialog.js","sourcesContent":["'use client'\n\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { overlayInk, overlayScrim } from '../lib/overlay.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Dialog({ ...props }: DialogPrimitive.Root.Props) {\n return <DialogPrimitive.Root data-slot='dialog' {...props} />\n}\n\nfunction DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {\n return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />\n}\n\nfunction DialogClose({ ...props }: DialogPrimitive.Close.Props) {\n return <DialogPrimitive.Close data-slot='dialog-close' {...props} />\n}\n\nfunction DialogPortal({ children, ...props }: DialogPrimitive.Portal.Props) {\n return (\n <DialogPrimitive.Portal data-slot='dialog-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </DialogPrimitive.Portal>\n )\n}\n\n/**\n * The three approved looks (design-shotgun, overlays-20260923):\n *\n * - `default` (Hairline): a flat raised surface drawn with a 1px ring; the\n * header and footer bleed to the edges and are divided off by hairlines.\n * - `band`: the header is a solid band in the action colour with an inverse\n * title; the footer sits on a subtle band.\n * - `rule`: a 4px rule in the ink colour caps the top edge, the title sits on\n * a hairline in the text colour, and the actions align to the start.\n *\n * None casts a shadow and none blurs the page behind — depth is drawn, per\n * DESIGN.md's Hairline Rule. Parts read the variant from `data-variant` on\n * the popup through `group-data-*`, so there is no context to thread.\n */\ntype DialogVariant = 'default' | 'band' | 'rule'\n\n/**\n * The popup's own classes and its look. The parts (header, footer, title,\n * description, close button) read the look from `data-variant` through\n * `group-data-*` instead: cva sees only its own props, not an ancestor's.\n * Radius sits in every branch, not the base, so rule's square top never\n * competes with a base `rounded-md` at equal specificity.\n */\nconst dialogContentVariants = cva(\n // `w-[calc(100%-2rem)]` + `max-w-lg` rather than shadcn's\n // `max-w-[calc(100%-2rem)] sm:max-w-sm`: two different properties, so there\n // is no bare/responsive pair for a consumer's build to reorder (see\n // check:cascade).\n 'group/dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-6 overflow-y-auto bg-popover p-6 text-base/relaxed text-popover-foreground ring-1 ring-foreground/10 outline-hidden transition-[opacity,scale] duration-150 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0',\n {\n variants: {\n variant: {\n default: 'rounded-md',\n band: 'rounded-md',\n rule: 'rounded-t-sm rounded-b-md border-t-4 border-t-(--overlay-ink)',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n)\n\nfunction DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props) {\n return (\n <DialogPrimitive.Backdrop\n data-slot='dialog-overlay'\n className={cn(\n 'fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0',\n overlayScrim,\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n variant = 'default',\n showCloseButton = true,\n closeLabel = 'Close',\n ...props\n}: DialogPrimitive.Popup.Props & {\n variant?: DialogVariant\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Popup\n data-slot='dialog-content'\n data-variant={variant}\n className={cn(\n dialogContentVariants({ variant }),\n // The ink rule's cap is drawn in (see overlayInk).\n overlayInk,\n // The header rules below match it at any depth, not only as a direct\n // child: an edit dialog usually wraps its content in a <form>.\n // A header with nothing below it draws no divider over empty space.\n '[&_[data-slot=dialog-header]:last-child]:border-b-0',\n // Keep a long title clear of the absolutely-positioned close button:\n // 72px where the header bleeds to the edge (24px gutter + the 48px\n // the button needs), 48px under `rule`, whose header does not bleed.\n '[&:has(>[data-slot=dialog-close])_[data-slot=dialog-header]]:pe-18 data-[variant=rule]:[&:has(>[data-slot=dialog-close])_[data-slot=dialog-header]]:pe-12',\n // With no header at all, the first content after the close button\n // reserves the button's 48px instead, so its text cannot run under it.\n '[&>[data-slot=dialog-close]+:not([data-slot=dialog-header]):not(:has([data-slot=dialog-header]))]:pe-12',\n className,\n )}\n {...props}\n >\n {/* The close button comes FIRST in the DOM (it is absolutely placed, so\n the visual order is unchanged). Base UI focuses the first tabbable\n element on open; after the content, that is a footer button, and a\n long dialog opens scrolled to the bottom with the reader past\n everything above it. */}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot='dialog-close'\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className={cn(\n // z-10, as Sheet's: the button comes first in the DOM, so any\n // positioned content after it would otherwise paint over it.\n 'absolute end-4 top-4 z-10',\n // On the band the button takes the band's inverse ink — only\n // when a header is there to paint the band. The extra\n // data-slot keeps this above Button's own dark ink at any\n // emission order.\n 'group-data-[variant=band]/dialog-content:group-has-[[data-slot=dialog-header]]/dialog-content:data-[slot=dialog-close]:[--btn-bg:var(--text-inverse)]',\n )}\n />\n }\n >\n <IconClose />\n </DialogPrimitive.Close>\n )}\n {children}\n </DialogPrimitive.Popup>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='dialog-header'\n className={cn(\n // default: bleeds to the popup's edges and is divided off by a hairline.\n '-mx-6 -mt-6 flex flex-col gap-2 border-b border-border px-6 pt-6 pb-5',\n // band: the same bleed, painted as a solid band instead of divided.\n 'group-data-[variant=band]/dialog-content:border-b-0 group-data-[variant=band]/dialog-content:bg-primary group-data-[variant=band]/dialog-content:pb-6 group-data-[variant=band]/dialog-content:text-primary-foreground',\n // rule: no bleed — the title carries its own hairline instead.\n 'group-data-[variant=rule]/dialog-content:mx-0 group-data-[variant=rule]/dialog-content:mt-0 group-data-[variant=rule]/dialog-content:border-b-0 group-data-[variant=rule]/dialog-content:px-0 group-data-[variant=rule]/dialog-content:pt-0 group-data-[variant=rule]/dialog-content:pb-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n closeLabel = 'Close',\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n /** Appends an outline Close button after the footer's own actions. */\n showCloseButton?: boolean\n /** Visible label of that Close button. Override to translate it. */\n closeLabel?: string\n}) {\n return (\n <div\n data-slot='dialog-footer'\n className={cn(\n // Stacked with the primary action on top below `sm`, a row aligned to\n // the end from `sm` up. `max-sm:` rather than a bare `flex-col-reverse`\n // keeps the pair cascade-safe (see check:cascade).\n 'flex gap-2 max-sm:flex-col-reverse sm:flex-row sm:justify-end',\n // default: bleeds to the popup's edges above a hairline.\n '-mx-6 -mb-6 border-t border-border px-6 py-4',\n // band: the same bleed on a subtle band instead of a hairline.\n 'group-data-[variant=band]/dialog-content:border-t-0 group-data-[variant=band]/dialog-content:bg-muted',\n // rule: no bleed, actions aligned to the start.\n 'group-data-[variant=rule]/dialog-content:mx-0 group-data-[variant=rule]/dialog-content:mb-0 group-data-[variant=rule]/dialog-content:border-t-0 group-data-[variant=rule]/dialog-content:px-0 group-data-[variant=rule]/dialog-content:py-0 group-data-[variant=rule]/dialog-content:sm:justify-start',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close render={<Button variant='outline' />}>\n {closeLabel}\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {\n return (\n <DialogPrimitive.Title\n data-slot='dialog-title'\n className={cn(\n 'font-heading text-2xl font-medium text-foreground',\n // Inverse ink only inside the band — a title placed in the body stays\n // on the popover and must keep the default ink.\n 'group-data-[variant=band]/dialog-content:in-data-[slot=dialog-header]:text-primary-foreground',\n 'group-data-[variant=rule]/dialog-content:border-b group-data-[variant=rule]/dialog-content:border-foreground group-data-[variant=rule]/dialog-content:pb-3',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({ className, ...props }: DialogPrimitive.Description.Props) {\n return (\n <DialogPrimitive.Description\n data-slot='dialog-description'\n className={cn(\n 'text-base/relaxed text-muted-foreground',\n 'group-data-[variant=band]/dialog-content:in-data-[slot=dialog-header]:text-primary-foreground',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n dialogContentVariants,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\nexport type { DialogVariant }\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { Drawer as Drawer$1 } from 'vaul';
|
|
4
4
|
import { ButtonGroupBoundary } from '../lib/button-group-context.js';
|
|
5
|
+
import { overlayScrim } from '../lib/overlay.js';
|
|
5
6
|
import { cn } from '../lib/utils.js';
|
|
6
7
|
|
|
7
8
|
function Drawer({ ...props }) {
|
|
@@ -25,7 +26,8 @@ function DrawerOverlay({
|
|
|
25
26
|
{
|
|
26
27
|
"data-slot": "drawer-overlay",
|
|
27
28
|
className: cn(
|
|
28
|
-
"fixed inset-0 z-50
|
|
29
|
+
"fixed inset-0 z-50 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
30
|
+
overlayScrim,
|
|
29
31
|
className
|
|
30
32
|
),
|
|
31
33
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/drawer.tsx"],"names":["DrawerPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/drawer.tsx"],"names":["DrawerPrimitive"],"mappings":";;;;;;AASA,SAAS,MAAA,CAAO,EAAE,GAAG,KAAA,EAAM,EAAsD;AAC/E,EAAA,2BAAQA,QAAA,CAAgB,IAAA,EAAhB,EAAqB,WAAA,EAAU,QAAA,EAAU,GAAG,KAAA,EAAO,CAAA;AAC7D;AAEA,SAAS,aAAA,CAAc,EAAE,GAAG,KAAA,EAAM,EAAyD;AACzF,EAAA,2BAAQA,QAAA,CAAgB,OAAA,EAAhB,EAAwB,WAAA,EAAU,gBAAA,EAAkB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,GAAG,OAAM,EAAwD;AACjG,EAAA,uBACE,GAAA,CAACA,QAA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,GAAG,OAAM,EAAgC;AAC1E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,8KAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AAC1E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iCAAA,EAAmC,SAAS,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAuD;AAChG,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,iBAAA,CAAkB;AAAA,EACzB,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA6D;AAC3D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,WAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,oBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uCAAA,EAAyC,SAAS,CAAA;AAAA,MAC/D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"drawer.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\n\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { overlayScrim } from '../lib/overlay.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return <DrawerPrimitive.Root data-slot='drawer' {...props} />\n}\n\nfunction DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger data-slot='drawer-trigger' {...props} />\n}\n\nfunction DrawerPortal({ children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return (\n <DrawerPrimitive.Portal data-slot='drawer-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </DrawerPrimitive.Portal>\n )\n}\n\nfunction DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n return <DrawerPrimitive.Close data-slot='drawer-close' {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot='drawer-overlay'\n className={cn(\n 'fixed inset-0 z-50 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n overlayScrim,\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DrawerContent({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n return (\n <DrawerPortal data-slot='drawer-portal'>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n data-slot='drawer-content'\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-transparent p-2 text-xs/relaxed text-popover-foreground before:absolute before:inset-2 before:-z-10 before:rounded-md before:border before:border-border before:bg-popover data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:start-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:end-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm',\n className,\n )}\n {...props}\n >\n <div className='mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block' />\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='drawer-header'\n className={cn(\n 'flex flex-col gap-1 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:text-start',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='drawer-footer'\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot='drawer-title'\n className={cn('text-sm font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot='drawer-description'\n className={cn('text-xs/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { Menu } from '@base-ui/react/menu';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The three approved looks (design-shotgun, overlays-20260923), set on
|
|
7
|
+
* `DropdownMenuContent` and read by every part through `group-data-*`:
|
|
8
|
+
*
|
|
9
|
+
* - `default` (Hairline): a flat surface drawn with a 1px ring. The
|
|
10
|
+
* highlighted row takes an ink tint, and keyboard focus adds a 2px inset
|
|
11
|
+
* ring — a tint alone is ~1.1:1 against the menu and is no focus cue.
|
|
12
|
+
* - `band`: the highlighted row is a solid band in the action colour, the
|
|
13
|
+
* group label sits on a subtle band, and rows run edge to edge.
|
|
14
|
+
* - `rule`: a 4px ink rule caps the top edge and a 4px rail on the start edge
|
|
15
|
+
* marks the highlighted row, like SideNav's current-page rail.
|
|
16
|
+
*
|
|
17
|
+
* No shadow — depth is drawn (DESIGN.md, The Hairline Rule).
|
|
18
|
+
*/
|
|
19
|
+
type DropdownMenuVariant = 'default' | 'band' | 'rule';
|
|
20
|
+
/**
|
|
21
|
+
* The popup's own classes and its look; the rows and labels read the look from
|
|
22
|
+
* `data-variant` through `group-data-*`, since cva sees only its own props.
|
|
23
|
+
* Radius and padding sit in every branch, not the base, so no branch competes
|
|
24
|
+
* with a base value at equal specificity. The base is at least as wide as the
|
|
25
|
+
* trigger and never narrower than 12rem — shadcn pins the menu to the
|
|
26
|
+
* trigger's width, which squeezes a menu opened from an icon button to a sliver.
|
|
27
|
+
*/
|
|
28
|
+
declare const dropdownMenuContentVariants: (props?: ({
|
|
29
|
+
variant?: "default" | "band" | "rule" | null | undefined;
|
|
30
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
31
|
+
declare function DropdownMenu({ ...props }: Menu.Root.Props): React.JSX.Element;
|
|
32
|
+
declare function DropdownMenuPortal({ children, ...props }: Menu.Portal.Props): React.JSX.Element;
|
|
33
|
+
declare function DropdownMenuTrigger({ ...props }: Menu.Trigger.Props): React.JSX.Element;
|
|
34
|
+
declare function DropdownMenuContent({ align, alignOffset, side, sideOffset, variant, className, children, ...props }: Menu.Popup.Props & Pick<Menu.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'> & {
|
|
35
|
+
variant?: DropdownMenuVariant;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
declare function DropdownMenuGroup({ ...props }: Menu.Group.Props): React.JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* A heading for a `DropdownMenuGroup`, which it names for assistive tech.
|
|
40
|
+
* Only a label inside a group can do that: outside one — the shadcn/Radix
|
|
41
|
+
* habit of dropping a label straight into the content — it renders as plain
|
|
42
|
+
* visible text, naming nothing. Wrap labelled actions in `DropdownMenuGroup`
|
|
43
|
+
* when the label should name them.
|
|
44
|
+
*/
|
|
45
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: Menu.GroupLabel.Props & {
|
|
46
|
+
inset?: boolean;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: Menu.Item.Props & {
|
|
49
|
+
inset?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* `destructive` inks the item with the danger role tokens, which carry
|
|
52
|
+
* their own dark values — so it needs no `dark:` variant.
|
|
53
|
+
*/
|
|
54
|
+
variant?: 'default' | 'destructive';
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* An item that navigates. Renders a real `<a>`, so the browser's own link
|
|
58
|
+
* behaviour (middle-click, open in new tab, status-bar URL) is kept — use it
|
|
59
|
+
* instead of an `onClick` that sets `location`.
|
|
60
|
+
*
|
|
61
|
+
* `closeOnClick` defaults to `true` here, where Base UI's own default is
|
|
62
|
+
* `false`: with client-side routing (`render={<Link />}`) the page never
|
|
63
|
+
* reloads, so a menu that stayed open would sit over the new route.
|
|
64
|
+
*/
|
|
65
|
+
declare function DropdownMenuLinkItem({ className, inset, closeOnClick, ...props }: Menu.LinkItem.Props & {
|
|
66
|
+
inset?: boolean;
|
|
67
|
+
}): React.JSX.Element;
|
|
68
|
+
declare function DropdownMenuSub({ ...props }: Menu.SubmenuRoot.Props): React.JSX.Element;
|
|
69
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: Menu.SubmenuTrigger.Props & {
|
|
70
|
+
inset?: boolean;
|
|
71
|
+
}): React.JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* A submenu's popup. It portals out of its parent menu, so it cannot read the
|
|
74
|
+
* parent's `data-variant` from the DOM; `variant` defaults to the parent's
|
|
75
|
+
* through context instead.
|
|
76
|
+
*/
|
|
77
|
+
declare function DropdownMenuSubContent({ align, alignOffset, side, sideOffset, variant, className, ...props }: React.ComponentProps<typeof DropdownMenuContent>): React.JSX.Element;
|
|
78
|
+
declare function DropdownMenuCheckboxItem({ className, children, inset, ...props }: Menu.CheckboxItem.Props & {
|
|
79
|
+
inset?: boolean;
|
|
80
|
+
}): React.JSX.Element;
|
|
81
|
+
declare function DropdownMenuRadioGroup({ ...props }: Menu.RadioGroup.Props): React.JSX.Element;
|
|
82
|
+
declare function DropdownMenuRadioItem({ className, children, inset, ...props }: Menu.RadioItem.Props & {
|
|
83
|
+
inset?: boolean;
|
|
84
|
+
}): React.JSX.Element;
|
|
85
|
+
declare function DropdownMenuSeparator({ className, ...props }: Menu.Separator.Props): React.JSX.Element;
|
|
86
|
+
/** A trailing hint such as a keyboard shortcut. Decorative — it binds nothing. */
|
|
87
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
88
|
+
|
|
89
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuLinkItem, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownMenuVariant, dropdownMenuContentVariants };
|