@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
package/README.md
CHANGED
|
@@ -168,20 +168,20 @@ import {
|
|
|
168
168
|
|
|
169
169
|
## Components
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
67 components, plus 12 copy-and-adapt blocks on the registry channel. The complete catalogue —
|
|
172
172
|
with every export and a description per item — is in the
|
|
173
173
|
[component reference](https://github.com/digitalnsw/nswds-ui/blob/main/docs/reference-components.md).
|
|
174
174
|
|
|
175
175
|
**NSW-original** (no upstream equivalent — the reference is their only documentation):
|
|
176
|
-
Callout, Container, DescriptionList, ExpandableSearch, Footer, Header, LabeledSeparator, Link,
|
|
176
|
+
Callout (also exported as `Alert`), Container, DescriptionList, ExpandableSearch, Footer, Header, LabeledSeparator, Link,
|
|
177
177
|
LinkCard, Logo, MainNav, Masthead, OnThisPage, PushMenu, Section, SideNav, SiteSearch, SkipLink,
|
|
178
178
|
StepIndicator, TabNav, ThemeSwitcher.
|
|
179
179
|
|
|
180
180
|
**Shadcn shapes on Base UI primitives, NSW-styled:**
|
|
181
|
-
Accordion, AspectRatio, Avatar, Badge, Breadcrumb, Button, ButtonGroup, Card, Carousel, Checkbox,
|
|
182
|
-
Collapsible, Combobox, DirectionProvider, Drawer, Field, HoverCard, Input, InputGroup, InputOTP,
|
|
181
|
+
Accordion, AlertDialog, AspectRatio, Avatar, Badge, Breadcrumb, Button, ButtonGroup, Card, Carousel, Checkbox,
|
|
182
|
+
Collapsible, Combobox, Dialog, DirectionProvider, Drawer, DropdownMenu, Empty, Field, HoverCard, Input, InputGroup, InputOTP,
|
|
183
183
|
Kbd, Label, NativeSelect, Pagination, Popover, Progress, RadioGroup, ResizablePanelGroup, ScrollArea, Select,
|
|
184
|
-
Separator, Sheet, Slider, Spinner, Switch, Table, Tabs, Textarea, Toaster, Toggle, ToggleGroup,
|
|
184
|
+
Separator, Sheet, Skeleton, Slider, Spinner, Switch, Table, Tabs, Textarea, Toaster, Toggle, ToggleGroup,
|
|
185
185
|
Tooltip.
|
|
186
186
|
|
|
187
187
|
Plus the icon set under `@nswds/ui/icons` and the brand marks under `@nswds/ui/icons/brands`.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
import '@base-ui/react/button';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import './link.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A modal that interrupts the user to confirm or cancel a consequential
|
|
11
|
+
* action. Unlike `Dialog` it has no close button and does not dismiss on an
|
|
12
|
+
* outside click, and Base UI gives the popup `role="alertdialog"`. Escape
|
|
13
|
+
* still closes it, so treat Escape as Cancel: never make closing the dialog
|
|
14
|
+
* perform the action.
|
|
15
|
+
*/
|
|
16
|
+
declare function AlertDialog({ ...props }: AlertDialog$1.Root.Props): React.JSX.Element;
|
|
17
|
+
declare function AlertDialogTrigger({ ...props }: AlertDialog$1.Trigger.Props): React.JSX.Element;
|
|
18
|
+
declare function AlertDialogPortal({ children, ...props }: AlertDialog$1.Portal.Props): React.JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* The same three looks as `DialogVariant` (design-shotgun, overlays-20260923):
|
|
21
|
+
* `default` (Hairline), `band` and `rule`. Under `band` and `rule` the colour
|
|
22
|
+
* follows the decision: a destructive confirm takes the danger ramp (a red
|
|
23
|
+
* band, a red rule), any other takes the action colour — so a "Sign out?"
|
|
24
|
+
* never borrows the alarm of a "Delete?". A confirm counts as destructive when
|
|
25
|
+
* its `AlertDialogAction` is `color='danger'`, which is detected; if the danger
|
|
26
|
+
* button is anything else (a plain `Button`, a `ButtonLink`), say so with
|
|
27
|
+
* `tone='danger'` on `AlertDialogContent`.
|
|
28
|
+
* No shadow, no backdrop blur — depth is drawn (DESIGN.md, The Hairline Rule).
|
|
29
|
+
*/
|
|
30
|
+
type AlertDialogVariant = 'default' | 'band' | 'rule';
|
|
31
|
+
/**
|
|
32
|
+
* The popup's own classes, its size and its look. The parts read the look
|
|
33
|
+
* from `data-variant` (and the size from `data-size`) through `group-data-*`:
|
|
34
|
+
* cva sees only its own props, not an ancestor's. Radius sits in every branch,
|
|
35
|
+
* not the base, so rule's square top never ties with a base `rounded-md`.
|
|
36
|
+
*/
|
|
37
|
+
declare const alertDialogContentVariants: (props?: ({
|
|
38
|
+
size?: "default" | "sm" | null | undefined;
|
|
39
|
+
variant?: "default" | "band" | "rule" | null | undefined;
|
|
40
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
41
|
+
declare function AlertDialogOverlay({ className, ...props }: AlertDialog$1.Backdrop.Props): React.JSX.Element;
|
|
42
|
+
declare function AlertDialogContent({ className, size, variant, tone, ...props }: AlertDialog$1.Popup.Props & {
|
|
43
|
+
/** `sm` narrows the popup and splits the footer into two equal buttons. */
|
|
44
|
+
size?: 'default' | 'sm';
|
|
45
|
+
variant?: AlertDialogVariant;
|
|
46
|
+
/**
|
|
47
|
+
* Marks the confirm destructive for the `band` and `rule` looks. Only needed
|
|
48
|
+
* when the danger button is not an `AlertDialogAction color='danger'`,
|
|
49
|
+
* which is detected on its own.
|
|
50
|
+
*/
|
|
51
|
+
tone?: 'default' | 'danger';
|
|
52
|
+
}): React.JSX.Element;
|
|
53
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
54
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
55
|
+
/** An icon tile above the title — for a warning glyph on a destructive confirm, say. */
|
|
56
|
+
declare function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
57
|
+
declare function AlertDialogTitle({ className, ...props }: AlertDialog$1.Title.Props): React.JSX.Element;
|
|
58
|
+
declare function AlertDialogDescription({ className, ...props }: AlertDialog$1.Description.Props): React.JSX.Element;
|
|
59
|
+
/**
|
|
60
|
+
* The confirming action. A plain `Button` — it does NOT close the dialog on
|
|
61
|
+
* its own, so the handler can run (and fail) first; close the dialog by
|
|
62
|
+
* controlling `open` once it succeeds.
|
|
63
|
+
*
|
|
64
|
+
* It stamps its `color` as `data-color`, which is how the `band` and `rule`
|
|
65
|
+
* variants know a confirm is destructive.
|
|
66
|
+
*/
|
|
67
|
+
declare function AlertDialogAction(props: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* Closes the dialog without acting. Takes Button's `variant`, `size` and
|
|
70
|
+
* `color` so it can match `AlertDialogAction`; `variant` defaults to outline.
|
|
71
|
+
*/
|
|
72
|
+
declare function AlertDialogCancel({ variant, size, color, ...props }: Omit<AlertDialog$1.Close.Props, 'color'> & Pick<React.ComponentProps<typeof Button>, 'variant' | 'size' | 'color'>): React.JSX.Element;
|
|
73
|
+
|
|
74
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertDialogVariant, alertDialogContentVariants };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { Button } from '../components/button.js';
|
|
6
|
+
import { ButtonGroupBoundary } from '../lib/button-group-context.js';
|
|
7
|
+
import { overlayScrim, overlayDanger, overlayInk } from '../lib/overlay.js';
|
|
8
|
+
import { cn } from '../lib/utils.js';
|
|
9
|
+
|
|
10
|
+
function AlertDialog({ ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Root, { "data-slot": "alert-dialog", ...props });
|
|
12
|
+
}
|
|
13
|
+
function AlertDialogTrigger({ ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
|
|
15
|
+
}
|
|
16
|
+
function AlertDialogPortal({ children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Portal, { "data-slot": "alert-dialog-portal", ...props, children: /* @__PURE__ */ jsx(ButtonGroupBoundary, { children }) });
|
|
18
|
+
}
|
|
19
|
+
const alertDialogContentVariants = cva(
|
|
20
|
+
"group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] -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",
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
default: "max-w-lg",
|
|
25
|
+
sm: "max-w-sm"
|
|
26
|
+
},
|
|
27
|
+
variant: {
|
|
28
|
+
default: "rounded-md",
|
|
29
|
+
band: "rounded-md",
|
|
30
|
+
rule: "rounded-t-sm rounded-b-md border-t-4 border-t-(--alert-dialog-ink)"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: { size: "default", variant: "default" }
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
AlertDialog$1.Backdrop,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "alert-dialog-overlay",
|
|
41
|
+
className: cn(
|
|
42
|
+
"fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
43
|
+
overlayScrim,
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function AlertDialogContent({
|
|
51
|
+
className,
|
|
52
|
+
size = "default",
|
|
53
|
+
variant = "default",
|
|
54
|
+
tone,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
AlertDialog$1.Popup,
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "alert-dialog-content",
|
|
63
|
+
"data-size": size,
|
|
64
|
+
"data-variant": variant,
|
|
65
|
+
"data-tone": tone,
|
|
66
|
+
className: cn(
|
|
67
|
+
alertDialogContentVariants({ variant, size }),
|
|
68
|
+
// The decision's colour, read by the band and the rule: the action
|
|
69
|
+
// colour, or danger when the confirming action is a danger button.
|
|
70
|
+
// Danger bands use the shared danger pairing (see overlayDanger) —
|
|
71
|
+
// the same red as the danger action beside it.
|
|
72
|
+
overlayDanger,
|
|
73
|
+
"[--alert-dialog-band-text:var(--text-inverse)] [--alert-dialog-band:var(--action-default)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-band-text:var(--overlay-danger-text)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-band:var(--overlay-danger)] data-[tone=danger]:[--alert-dialog-band-text:var(--overlay-danger-text)] data-[tone=danger]:[--alert-dialog-band:var(--overlay-danger)]",
|
|
74
|
+
overlayInk,
|
|
75
|
+
"[--alert-dialog-ink:var(--overlay-ink)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-ink:var(--danger-solid)] data-[tone=danger]:[--alert-dialog-ink:var(--danger-solid)]",
|
|
76
|
+
className
|
|
77
|
+
),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
"data-slot": "alert-dialog-header",
|
|
88
|
+
className: cn(
|
|
89
|
+
// default: bleeds to the popup's edges and is divided off by a hairline.
|
|
90
|
+
"-mx-6 -mt-6 flex flex-col items-start gap-2 border-b border-border px-6 pt-6 pb-5",
|
|
91
|
+
// band: the same bleed, painted in the decision's colour.
|
|
92
|
+
"group-data-[variant=band]/alert-dialog-content:border-b-0 group-data-[variant=band]/alert-dialog-content:bg-(--alert-dialog-band) group-data-[variant=band]/alert-dialog-content:pb-6 group-data-[variant=band]/alert-dialog-content:text-(--alert-dialog-band-text)",
|
|
93
|
+
// rule: no bleed; a media glyph sits beside the title, not above it.
|
|
94
|
+
"group-data-[variant=rule]/alert-dialog-content:mx-0 group-data-[variant=rule]/alert-dialog-content:mt-0 group-data-[variant=rule]/alert-dialog-content:grid-cols-[auto_1fr] group-data-[variant=rule]/alert-dialog-content:gap-x-3 group-data-[variant=rule]/alert-dialog-content:border-b-0 group-data-[variant=rule]/alert-dialog-content:px-0 group-data-[variant=rule]/alert-dialog-content:pt-0 group-data-[variant=rule]/alert-dialog-content:pb-0 group-data-[variant=rule]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
"data-slot": "alert-dialog-footer",
|
|
106
|
+
className: cn(
|
|
107
|
+
// `max-sm:` rather than a bare `flex-col-reverse` keeps the pair
|
|
108
|
+
// cascade-safe (see check:cascade). The `sm` size is always a
|
|
109
|
+
// two-column grid, at every width.
|
|
110
|
+
"flex gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 max-sm:flex-col-reverse sm:flex-row sm:justify-end",
|
|
111
|
+
"-mx-6 -mb-6 border-t border-border px-6 py-4",
|
|
112
|
+
"group-data-[variant=band]/alert-dialog-content:border-t-0 group-data-[variant=band]/alert-dialog-content:bg-muted",
|
|
113
|
+
"group-data-[variant=rule]/alert-dialog-content:mx-0 group-data-[variant=rule]/alert-dialog-content:mb-0 group-data-[variant=rule]/alert-dialog-content:border-t-0 group-data-[variant=rule]/alert-dialog-content:px-0 group-data-[variant=rule]/alert-dialog-content:py-0 group-data-[variant=rule]/alert-dialog-content:sm:justify-start",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
"data-slot": "alert-dialog-media",
|
|
125
|
+
className: cn(
|
|
126
|
+
"mb-2 inline-flex size-12 items-center justify-center rounded-md bg-foreground/10 text-foreground [&_svg:not([class*='size-'])]:size-6",
|
|
127
|
+
// band: the bare glyph in the band's inverse ink.
|
|
128
|
+
"group-data-[variant=band]/alert-dialog-content:mb-0 group-data-[variant=band]/alert-dialog-content:size-auto group-data-[variant=band]/alert-dialog-content:bg-transparent group-data-[variant=band]/alert-dialog-content:text-(--alert-dialog-band-text)",
|
|
129
|
+
// rule: the bare glyph, in the decision's ink, beside the title.
|
|
130
|
+
"group-data-[variant=rule]/alert-dialog-content:mt-1 group-data-[variant=rule]/alert-dialog-content:mb-0 group-data-[variant=rule]/alert-dialog-content:size-auto group-data-[variant=rule]/alert-dialog-content:bg-transparent group-data-[variant=rule]/alert-dialog-content:text-(--alert-dialog-ink)",
|
|
131
|
+
className
|
|
132
|
+
),
|
|
133
|
+
...props
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
AlertDialog$1.Title,
|
|
140
|
+
{
|
|
141
|
+
"data-slot": "alert-dialog-title",
|
|
142
|
+
className: cn(
|
|
143
|
+
"font-heading text-2xl font-medium text-foreground",
|
|
144
|
+
"group-data-[variant=band]/alert-dialog-content:in-data-[slot=alert-dialog-header]:text-(--alert-dialog-band-text)",
|
|
145
|
+
// rule: the title's hairline is the text colour, or danger on a
|
|
146
|
+
// destructive confirm — the cap above carries the ink.
|
|
147
|
+
"group-data-[variant=rule]/alert-dialog-content:col-start-2 group-data-[variant=rule]/alert-dialog-content:self-stretch group-data-[variant=rule]/alert-dialog-content:border-b group-data-[variant=rule]/alert-dialog-content:border-foreground group-data-[variant=rule]/alert-dialog-content:pb-3 group-data-[variant=rule]/alert-dialog-content:group-has-[[data-slot=alert-dialog-action][data-color=danger]]/alert-dialog-content:border-destructive group-data-[variant=rule]/alert-dialog-content:group-data-[tone=danger]/alert-dialog-content:border-destructive",
|
|
148
|
+
className
|
|
149
|
+
),
|
|
150
|
+
...props
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
156
|
+
AlertDialog$1.Description,
|
|
157
|
+
{
|
|
158
|
+
"data-slot": "alert-dialog-description",
|
|
159
|
+
className: cn(
|
|
160
|
+
"text-base/relaxed text-muted-foreground",
|
|
161
|
+
"group-data-[variant=band]/alert-dialog-content:in-data-[slot=alert-dialog-header]:text-(--alert-dialog-band-text)",
|
|
162
|
+
"group-data-[variant=rule]/alert-dialog-content:col-start-2",
|
|
163
|
+
className
|
|
164
|
+
),
|
|
165
|
+
...props
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
function AlertDialogAction(props) {
|
|
170
|
+
return /* @__PURE__ */ jsx(Button, { "data-slot": "alert-dialog-action", "data-color": props.color, ...props });
|
|
171
|
+
}
|
|
172
|
+
function AlertDialogCancel({
|
|
173
|
+
variant = "outline",
|
|
174
|
+
size,
|
|
175
|
+
color,
|
|
176
|
+
...props
|
|
177
|
+
}) {
|
|
178
|
+
return /* @__PURE__ */ jsx(
|
|
179
|
+
AlertDialog$1.Close,
|
|
180
|
+
{
|
|
181
|
+
"data-slot": "alert-dialog-cancel",
|
|
182
|
+
render: /* @__PURE__ */ jsx(Button, { variant, size, color }),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, alertDialogContentVariants };
|
|
189
|
+
//# sourceMappingURL=alert-dialog.js.map
|
|
190
|
+
//# sourceMappingURL=alert-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/alert-dialog.tsx"],"names":["AlertDialogPrimitive"],"mappings":";;;;;;;;AAkBA,SAAS,WAAA,CAAY,EAAE,GAAG,KAAA,EAAM,EAAoC;AAClE,EAAA,2BAAQA,aAAA,CAAqB,IAAA,EAArB,EAA0B,WAAA,EAAU,cAAA,EAAgB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,kBAAA,CAAmB,EAAE,GAAG,KAAA,EAAM,EAAuC;AAC5E,EAAA,2BAAQA,aAAA,CAAqB,OAAA,EAArB,EAA6B,WAAA,EAAU,sBAAA,EAAwB,GAAG,KAAA,EAAO,CAAA;AACnF;AAEA,SAAS,iBAAA,CAAkB,EAAE,QAAA,EAAU,GAAG,OAAM,EAAsC;AACpF,EAAA,uBACE,GAAA,CAACA,aAAA,CAAqB,MAAA,EAArB,EAA4B,WAAA,EAAU,qBAAA,EAAuB,GAAG,KAAA,EAE/D,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC,CAAA;AAEJ;AAqBA,MAAM,0BAAA,GAA6B,GAAA;AAAA,EACjC,+ZAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,UAAA;AAAA,QACT,EAAA,EAAI;AAAA,OACN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AAEA,SAAS,sBAAA,CAAuB,EAAE,SAAA,EAAW,GAAG,OAAM,EAA2C;AAC/F,EAAA,uBACE,GAAA;AAAA,IAACA,aAAA,CAAqB,WAAA;AAAA,IAArB;AAAA,MACC,WAAA,EAAU,0BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,yCAAA;AAAA,QACA,mHAAA;AAAA,QACA,4DAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAUA,SAAS,kBAAkB,KAAA,EAA4C;AACrE,EAAA,uBAAO,GAAA,CAAC,UAAO,WAAA,EAAU,qBAAA,EAAsB,cAAY,KAAA,CAAM,KAAA,EAAQ,GAAG,KAAA,EAAO,CAAA;AACrF;AAMA,SAAS,iBAAA,CAAkB;AAAA,EACzB,OAAA,GAAU,SAAA;AAAA,EACV,IAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EAC2E;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,aAAA,CAAqB,KAAA;AAAA,IAArB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,MAAA,kBAAQ,GAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAkB,MAAY,KAAA,EAAc,CAAA;AAAA,MAC3D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"alert-dialog.js","sourcesContent":["'use client'\n\nimport { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { overlayDanger, overlayInk, overlayScrim } from '../lib/overlay.js'\nimport { cn } from '../lib/utils.js'\n\n/**\n * A modal that interrupts the user to confirm or cancel a consequential\n * action. Unlike `Dialog` it has no close button and does not dismiss on an\n * outside click, and Base UI gives the popup `role=\"alertdialog\"`. Escape\n * still closes it, so treat Escape as Cancel: never make closing the dialog\n * perform the action.\n */\nfunction AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) {\n return <AlertDialogPrimitive.Root data-slot='alert-dialog' {...props} />\n}\n\nfunction AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) {\n return <AlertDialogPrimitive.Trigger data-slot='alert-dialog-trigger' {...props} />\n}\n\nfunction AlertDialogPortal({ children, ...props }: AlertDialogPrimitive.Portal.Props) {\n return (\n <AlertDialogPrimitive.Portal data-slot='alert-dialog-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </AlertDialogPrimitive.Portal>\n )\n}\n\n/**\n * The same three looks as `DialogVariant` (design-shotgun, overlays-20260923):\n * `default` (Hairline), `band` and `rule`. Under `band` and `rule` the colour\n * follows the decision: a destructive confirm takes the danger ramp (a red\n * band, a red rule), any other takes the action colour — so a \"Sign out?\"\n * never borrows the alarm of a \"Delete?\". A confirm counts as destructive when\n * its `AlertDialogAction` is `color='danger'`, which is detected; if the danger\n * button is anything else (a plain `Button`, a `ButtonLink`), say so with\n * `tone='danger'` on `AlertDialogContent`.\n * No shadow, no backdrop blur — depth is drawn (DESIGN.md, The Hairline Rule).\n */\ntype AlertDialogVariant = 'default' | 'band' | 'rule'\n\n/**\n * The popup's own classes, its size and its look. The parts read the look\n * from `data-variant` (and the size from `data-size`) through `group-data-*`:\n * cva sees only its own props, not an ancestor's. Radius sits in every branch,\n * not the base, so rule's square top never ties with a base `rounded-md`.\n */\nconst alertDialogContentVariants = cva(\n 'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] -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 size: {\n default: 'max-w-lg',\n sm: 'max-w-sm',\n },\n variant: {\n default: 'rounded-md',\n band: 'rounded-md',\n rule: 'rounded-t-sm rounded-b-md border-t-4 border-t-(--alert-dialog-ink)',\n },\n },\n defaultVariants: { size: 'default', variant: 'default' },\n },\n)\n\nfunction AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot='alert-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 AlertDialogContent({\n className,\n size = 'default',\n variant = 'default',\n tone,\n ...props\n}: AlertDialogPrimitive.Popup.Props & {\n /** `sm` narrows the popup and splits the footer into two equal buttons. */\n size?: 'default' | 'sm'\n variant?: AlertDialogVariant\n /**\n * Marks the confirm destructive for the `band` and `rule` looks. Only needed\n * when the danger button is not an `AlertDialogAction color='danger'`,\n * which is detected on its own.\n */\n tone?: 'default' | 'danger'\n}) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Popup\n data-slot='alert-dialog-content'\n data-size={size}\n data-variant={variant}\n data-tone={tone}\n className={cn(\n alertDialogContentVariants({ variant, size }),\n // The decision's colour, read by the band and the rule: the action\n // colour, or danger when the confirming action is a danger button.\n // Danger bands use the shared danger pairing (see overlayDanger) —\n // the same red as the danger action beside it.\n overlayDanger,\n '[--alert-dialog-band-text:var(--text-inverse)] [--alert-dialog-band:var(--action-default)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-band-text:var(--overlay-danger-text)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-band:var(--overlay-danger)] data-[tone=danger]:[--alert-dialog-band-text:var(--overlay-danger-text)] data-[tone=danger]:[--alert-dialog-band:var(--overlay-danger)]',\n overlayInk,\n '[--alert-dialog-ink:var(--overlay-ink)] has-[[data-slot=alert-dialog-action][data-color=danger]]:[--alert-dialog-ink:var(--danger-solid)] data-[tone=danger]:[--alert-dialog-ink:var(--danger-solid)]',\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n )\n}\n\nfunction AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='alert-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 items-start gap-2 border-b border-border px-6 pt-6 pb-5',\n // band: the same bleed, painted in the decision's colour.\n 'group-data-[variant=band]/alert-dialog-content:border-b-0 group-data-[variant=band]/alert-dialog-content:bg-(--alert-dialog-band) group-data-[variant=band]/alert-dialog-content:pb-6 group-data-[variant=band]/alert-dialog-content:text-(--alert-dialog-band-text)',\n // rule: no bleed; a media glyph sits beside the title, not above it.\n 'group-data-[variant=rule]/alert-dialog-content:mx-0 group-data-[variant=rule]/alert-dialog-content:mt-0 group-data-[variant=rule]/alert-dialog-content:grid-cols-[auto_1fr] group-data-[variant=rule]/alert-dialog-content:gap-x-3 group-data-[variant=rule]/alert-dialog-content:border-b-0 group-data-[variant=rule]/alert-dialog-content:px-0 group-data-[variant=rule]/alert-dialog-content:pt-0 group-data-[variant=rule]/alert-dialog-content:pb-0 group-data-[variant=rule]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='alert-dialog-footer'\n className={cn(\n // `max-sm:` rather than a bare `flex-col-reverse` keeps the pair\n // cascade-safe (see check:cascade). The `sm` size is always a\n // two-column grid, at every width.\n 'flex gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 max-sm:flex-col-reverse sm:flex-row sm:justify-end',\n '-mx-6 -mb-6 border-t border-border px-6 py-4',\n 'group-data-[variant=band]/alert-dialog-content:border-t-0 group-data-[variant=band]/alert-dialog-content:bg-muted',\n 'group-data-[variant=rule]/alert-dialog-content:mx-0 group-data-[variant=rule]/alert-dialog-content:mb-0 group-data-[variant=rule]/alert-dialog-content:border-t-0 group-data-[variant=rule]/alert-dialog-content:px-0 group-data-[variant=rule]/alert-dialog-content:py-0 group-data-[variant=rule]/alert-dialog-content:sm:justify-start',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** An icon tile above the title — for a warning glyph on a destructive confirm, say. */\nfunction AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='alert-dialog-media'\n className={cn(\n \"mb-2 inline-flex size-12 items-center justify-center rounded-md bg-foreground/10 text-foreground [&_svg:not([class*='size-'])]:size-6\",\n // band: the bare glyph in the band's inverse ink.\n 'group-data-[variant=band]/alert-dialog-content:mb-0 group-data-[variant=band]/alert-dialog-content:size-auto group-data-[variant=band]/alert-dialog-content:bg-transparent group-data-[variant=band]/alert-dialog-content:text-(--alert-dialog-band-text)',\n // rule: the bare glyph, in the decision's ink, beside the title.\n 'group-data-[variant=rule]/alert-dialog-content:mt-1 group-data-[variant=rule]/alert-dialog-content:mb-0 group-data-[variant=rule]/alert-dialog-content:size-auto group-data-[variant=rule]/alert-dialog-content:bg-transparent group-data-[variant=rule]/alert-dialog-content:text-(--alert-dialog-ink)',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props) {\n return (\n <AlertDialogPrimitive.Title\n data-slot='alert-dialog-title'\n className={cn(\n 'font-heading text-2xl font-medium text-foreground',\n 'group-data-[variant=band]/alert-dialog-content:in-data-[slot=alert-dialog-header]:text-(--alert-dialog-band-text)',\n // rule: the title's hairline is the text colour, or danger on a\n // destructive confirm — the cap above carries the ink.\n 'group-data-[variant=rule]/alert-dialog-content:col-start-2 group-data-[variant=rule]/alert-dialog-content:self-stretch group-data-[variant=rule]/alert-dialog-content:border-b group-data-[variant=rule]/alert-dialog-content:border-foreground group-data-[variant=rule]/alert-dialog-content:pb-3 group-data-[variant=rule]/alert-dialog-content:group-has-[[data-slot=alert-dialog-action][data-color=danger]]/alert-dialog-content:border-destructive group-data-[variant=rule]/alert-dialog-content:group-data-[tone=danger]/alert-dialog-content:border-destructive',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props) {\n return (\n <AlertDialogPrimitive.Description\n data-slot='alert-dialog-description'\n className={cn(\n 'text-base/relaxed text-muted-foreground',\n 'group-data-[variant=band]/alert-dialog-content:in-data-[slot=alert-dialog-header]:text-(--alert-dialog-band-text)',\n 'group-data-[variant=rule]/alert-dialog-content:col-start-2',\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * The confirming action. A plain `Button` — it does NOT close the dialog on\n * its own, so the handler can run (and fail) first; close the dialog by\n * controlling `open` once it succeeds.\n *\n * It stamps its `color` as `data-color`, which is how the `band` and `rule`\n * variants know a confirm is destructive.\n */\nfunction AlertDialogAction(props: React.ComponentProps<typeof Button>) {\n return <Button data-slot='alert-dialog-action' data-color={props.color} {...props} />\n}\n\n/**\n * Closes the dialog without acting. Takes Button's `variant`, `size` and\n * `color` so it can match `AlertDialogAction`; `variant` defaults to outline.\n */\nfunction AlertDialogCancel({\n variant = 'outline',\n size,\n color,\n ...props\n}: Omit<AlertDialogPrimitive.Close.Props, 'color'> &\n Pick<React.ComponentProps<typeof Button>, 'variant' | 'size' | 'color'>) {\n return (\n <AlertDialogPrimitive.Close\n data-slot='alert-dialog-cancel'\n render={<Button variant={variant} size={size} color={color} />}\n {...props}\n />\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n alertDialogContentVariants,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\nexport type { AlertDialogVariant }\n"]}
|
|
@@ -56,5 +56,19 @@ type CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> & Varia
|
|
|
56
56
|
* relying on the icon, which is decorative here by design.
|
|
57
57
|
*/
|
|
58
58
|
declare function Callout({ className, status, title, icon, children, ref, ...props }: CalloutProps): React.JSX.Element;
|
|
59
|
+
/**
|
|
60
|
+
* `Callout` under shadcn's name, so code and habits carried over from shadcn's
|
|
61
|
+
* `<Alert>` find it. It is the same component with the same props, which
|
|
62
|
+
* differ from shadcn's in three ways: the tone is `status` (`info`, `success`,
|
|
63
|
+
* `warning`, `danger`) rather than `variant`; the title is the `title` prop and
|
|
64
|
+
* the body is `children`, so there is no `AlertTitle` / `AlertDescription`;
|
|
65
|
+
* and it carries no `role="alert"`, for the reason given on `Callout`.
|
|
66
|
+
*/
|
|
67
|
+
declare const Alert: typeof Callout;
|
|
68
|
+
declare const alertVariants: (props?: ({
|
|
69
|
+
status?: "success" | "warning" | "danger" | "info" | null | undefined;
|
|
70
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
71
|
+
type AlertProps = CalloutProps;
|
|
72
|
+
type AlertStatus = CalloutStatus;
|
|
59
73
|
|
|
60
|
-
export { Callout, type CalloutProps, type CalloutStatus, calloutVariants };
|
|
74
|
+
export { Alert, type AlertProps, type AlertStatus, Callout, type CalloutProps, type CalloutStatus, alertVariants, calloutVariants };
|
|
@@ -59,7 +59,9 @@ function Callout({ className, status, title, icon, children, ref, ...props }) {
|
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
+
const Alert = Callout;
|
|
63
|
+
const alertVariants = calloutVariants;
|
|
62
64
|
|
|
63
|
-
export { Callout, calloutVariants };
|
|
65
|
+
export { Alert, Callout, alertVariants, calloutVariants };
|
|
64
66
|
//# sourceMappingURL=callout.js.map
|
|
65
67
|
//# sourceMappingURL=callout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/callout.tsx"],"names":[],"mappings":";;;;;;;;AAuBA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BAAA,EAAkB,WAAU,gBAAA,EACxC,QAAA,EAAA;AAAA,UAAA,KAAA,uBACE,GAAA,EAAA,EAAE,WAAA,EAAU,iBAAgB,SAAA,EAAU,eAAA,EACpC,iBACH,CAAA,GACE,IAAA;AAAA,UACH;AAAA,SAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"callout.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\nimport { IconCheckCircle } from '../icons/check-circle.js'\nimport { IconError } from '../icons/error.js'\nimport { IconInfo } from '../icons/info.js'\nimport { IconWarning } from '../icons/warning.js'\n\n/** The four message statuses, matching `Toaster`'s vocabulary. */\ntype CalloutStatus = 'info' | 'success' | 'warning' | 'danger'\n\n/**\n * Status → glyph, deliberately identical to the mapping `sonner.tsx` gives its\n * toasts. A success confirmation should carry the same mark whether it arrives\n * as a toast or sits on the page, and a reader who has learnt one has learnt\n * the other.\n *\n * `danger` maps to `IconError` — the status name follows `Button`'s vocabulary\n * (`danger`, not `error`), while the icon name follows Material Symbols'.\n */\nconst CALLOUT_ICONS: Record<CalloutStatus, React.ElementType> = {\n info: IconInfo,\n success: IconCheckCircle,\n warning: IconWarning,\n danger: IconError,\n}\n\n/**\n * Every colour funnels through a single `--callout-ink` per status, declared on\n * the root so the icon and the border both resolve from one declaration — the\n * same ink-token pattern as `footer.tsx`, `link.tsx` and `step-indicator.tsx`.\n *\n * Values are the RAW `@nswds/tokens` semantic ROLE tokens (`--info-surface`,\n * `--info-text`, …), not the `--color-*` Tailwind bridge aliases. Two reasons,\n * both load-bearing:\n *\n * 1. Tailwind v4 tree-shakes unreferenced `@theme` keys, and an\n * arbitrary-property reference is not a usage signal — the same trap\n * documented on `button.tsx`'s semantic colours and `step-indicator.tsx`'s\n * status inks. The raw tokens are plain `:root` declarations that always\n * resolve.\n * 2. The role tokens already carry their own dark values, scoped\n * `[data-theme=dark], .dark` by `@nswds/tokens`' `semantic/oklch.dark.css`\n * (imported by theme.css). So every status flips with the theme on its own\n * and this component needs no `dark:` variant at all — nothing here can\n * drift out of step with the token library.\n */\nconst calloutVariants = cva(\n [\n 'flex gap-4 rounded-md border p-6',\n 'border-(--callout-border) bg-(--callout-surface) text-(--callout-text)',\n ],\n {\n variants: {\n status: {\n info: '[--callout-border:var(--info-border)] [--callout-ink:var(--info-solid)] [--callout-surface:var(--info-surface)] [--callout-text:var(--info-text)]',\n success:\n '[--callout-border:var(--success-border)] [--callout-ink:var(--success-solid)] [--callout-surface:var(--success-surface)] [--callout-text:var(--success-text)]',\n warning:\n '[--callout-border:var(--warning-border)] [--callout-ink:var(--warning-solid)] [--callout-surface:var(--warning-surface)] [--callout-text:var(--warning-text)]',\n danger:\n '[--callout-border:var(--danger-border)] [--callout-ink:var(--danger-solid)] [--callout-surface:var(--danger-surface)] [--callout-text:var(--danger-text)]',\n },\n },\n defaultVariants: {\n status: 'info',\n },\n },\n)\n\ntype CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> &\n VariantProps<typeof calloutVariants> & {\n /** Optional bold lead line above the body copy. */\n title?: React.ReactNode\n /**\n * Replaces the status glyph. Pass `null` to drop it entirely — the status\n * is still carried by the border and surface, and by `title` where one is\n * supplied.\n */\n icon?: React.ElementType | null\n ref?: React.Ref<HTMLDivElement>\n }\n\n/**\n * A bordered notice that marks a passage of page content as informational,\n * confirming, cautionary or dangerous.\n *\n * **This is for STATIC content, and carries no live-region semantics.** No\n * `role=\"alert\"`, no `aria-live`: those announce on mount, so a callout that is\n * simply part of the page would interrupt a screen-reader user every time they\n * arrived. Use `Toaster` for a message that appears in response to something\n * the user just did, or `FieldError` for inline validation — both already\n * handle announcement. If you render a `Callout` dynamically and it genuinely\n * needs announcing, own that at the call site with your own live region.\n *\n * **Status is never carried by colour alone** (WCAG 2.2, 1.4.1). The glyph\n * distinguishes the four statuses visually; where the distinction also matters\n * to a screen-reader user, say so in the `title` or the body copy rather than\n * relying on the icon, which is decorative here by design.\n */\nfunction Callout({ className, status, title, icon, children, ref, ...props }: CalloutProps) {\n const resolvedStatus = status ?? 'info'\n // `icon` is optional-with-a-default AND nullable-to-disable, so an explicit\n // `null` has to survive: `icon ?? CALLOUT_ICONS[…]` would resurrect the\n // default for exactly the consumer trying to turn it off.\n const Icon = icon === undefined ? CALLOUT_ICONS[resolvedStatus] : icon\n\n return (\n <div\n ref={ref}\n data-slot='callout'\n data-status={resolvedStatus}\n className={cn(calloutVariants({ status, className }))}\n {...props}\n >\n {Icon ? (\n <Icon\n aria-hidden='true'\n data-slot='callout-icon'\n // The icon modules paint `fill=\"currentColor\"`, so setting the text\n // colour here is what tints the glyph — and it keeps working for a\n // consumer-supplied `icon` drawn with strokes rather than fills.\n className='mt-0.5 size-6 shrink-0 text-(--callout-ink)'\n />\n ) : null}\n <div data-slot='callout-content' className='min-w-0 flex-1'>\n {title ? (\n <p data-slot='callout-title' className='font-semibold'>\n {title}\n </p>\n ) : null}\n {children}\n </div>\n </div>\n )\n}\n\nexport { Callout, calloutVariants }\nexport type { CalloutProps, CalloutStatus }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/callout.tsx"],"names":[],"mappings":";;;;;;;;AAuBA,MAAM,aAAA,GAA0D;AAAA,EAC9D,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,eAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAsBA,MAAM,eAAA,GAAkB,GAAA;AAAA,EACtB;AAAA,IACE,kCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,mJAAA;AAAA,QACN,OAAA,EACE,+JAAA;AAAA,QACF,OAAA,EACE,+JAAA;AAAA,QACF,MAAA,EACE;AAAA;AACJ,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA;AACV;AAEJ;AAgCA,SAAS,OAAA,CAAQ,EAAE,SAAA,EAAW,MAAA,EAAQ,KAAA,EAAO,MAAM,QAAA,EAAU,GAAA,EAAK,GAAG,KAAA,EAAM,EAAiB;AAC1F,EAAA,MAAM,iBAAiB,MAAA,IAAU,MAAA;AAIjC,EAAA,MAAM,IAAA,GAAO,IAAA,KAAS,MAAA,GAAY,aAAA,CAAc,cAAc,CAAA,GAAI,IAAA;AAElE,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,SAAA;AAAA,MACV,aAAA,EAAa,cAAA;AAAA,MACb,WAAW,EAAA,CAAG,eAAA,CAAgB,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAC,CAAA;AAAA,MACnD,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,mBACC,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAY,MAAA;AAAA,YACZ,WAAA,EAAU,cAAA;AAAA,YAIV,SAAA,EAAU;AAAA;AAAA,SACZ,GACE,IAAA;AAAA,wBACJ,IAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,iBAAA,EAAkB,WAAU,gBAAA,EACxC,QAAA,EAAA;AAAA,UAAA,KAAA,uBACE,GAAA,EAAA,EAAE,WAAA,EAAU,iBAAgB,SAAA,EAAU,eAAA,EACpC,iBACH,CAAA,GACE,IAAA;AAAA,UACH;AAAA,SAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ;AAUA,MAAM,KAAA,GAAQ;AACd,MAAM,aAAA,GAAgB","file":"callout.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\nimport { IconCheckCircle } from '../icons/check-circle.js'\nimport { IconError } from '../icons/error.js'\nimport { IconInfo } from '../icons/info.js'\nimport { IconWarning } from '../icons/warning.js'\n\n/** The four message statuses, matching `Toaster`'s vocabulary. */\ntype CalloutStatus = 'info' | 'success' | 'warning' | 'danger'\n\n/**\n * Status → glyph, deliberately identical to the mapping `sonner.tsx` gives its\n * toasts. A success confirmation should carry the same mark whether it arrives\n * as a toast or sits on the page, and a reader who has learnt one has learnt\n * the other.\n *\n * `danger` maps to `IconError` — the status name follows `Button`'s vocabulary\n * (`danger`, not `error`), while the icon name follows Material Symbols'.\n */\nconst CALLOUT_ICONS: Record<CalloutStatus, React.ElementType> = {\n info: IconInfo,\n success: IconCheckCircle,\n warning: IconWarning,\n danger: IconError,\n}\n\n/**\n * Every colour funnels through a single `--callout-ink` per status, declared on\n * the root so the icon and the border both resolve from one declaration — the\n * same ink-token pattern as `footer.tsx`, `link.tsx` and `step-indicator.tsx`.\n *\n * Values are the RAW `@nswds/tokens` semantic ROLE tokens (`--info-surface`,\n * `--info-text`, …), not the `--color-*` Tailwind bridge aliases. Two reasons,\n * both load-bearing:\n *\n * 1. Tailwind v4 tree-shakes unreferenced `@theme` keys, and an\n * arbitrary-property reference is not a usage signal — the same trap\n * documented on `button.tsx`'s semantic colours and `step-indicator.tsx`'s\n * status inks. The raw tokens are plain `:root` declarations that always\n * resolve.\n * 2. The role tokens already carry their own dark values, scoped\n * `[data-theme=dark], .dark` by `@nswds/tokens`' `semantic/oklch.dark.css`\n * (imported by theme.css). So every status flips with the theme on its own\n * and this component needs no `dark:` variant at all — nothing here can\n * drift out of step with the token library.\n */\nconst calloutVariants = cva(\n [\n 'flex gap-4 rounded-md border p-6',\n 'border-(--callout-border) bg-(--callout-surface) text-(--callout-text)',\n ],\n {\n variants: {\n status: {\n info: '[--callout-border:var(--info-border)] [--callout-ink:var(--info-solid)] [--callout-surface:var(--info-surface)] [--callout-text:var(--info-text)]',\n success:\n '[--callout-border:var(--success-border)] [--callout-ink:var(--success-solid)] [--callout-surface:var(--success-surface)] [--callout-text:var(--success-text)]',\n warning:\n '[--callout-border:var(--warning-border)] [--callout-ink:var(--warning-solid)] [--callout-surface:var(--warning-surface)] [--callout-text:var(--warning-text)]',\n danger:\n '[--callout-border:var(--danger-border)] [--callout-ink:var(--danger-solid)] [--callout-surface:var(--danger-surface)] [--callout-text:var(--danger-text)]',\n },\n },\n defaultVariants: {\n status: 'info',\n },\n },\n)\n\ntype CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> &\n VariantProps<typeof calloutVariants> & {\n /** Optional bold lead line above the body copy. */\n title?: React.ReactNode\n /**\n * Replaces the status glyph. Pass `null` to drop it entirely — the status\n * is still carried by the border and surface, and by `title` where one is\n * supplied.\n */\n icon?: React.ElementType | null\n ref?: React.Ref<HTMLDivElement>\n }\n\n/**\n * A bordered notice that marks a passage of page content as informational,\n * confirming, cautionary or dangerous.\n *\n * **This is for STATIC content, and carries no live-region semantics.** No\n * `role=\"alert\"`, no `aria-live`: those announce on mount, so a callout that is\n * simply part of the page would interrupt a screen-reader user every time they\n * arrived. Use `Toaster` for a message that appears in response to something\n * the user just did, or `FieldError` for inline validation — both already\n * handle announcement. If you render a `Callout` dynamically and it genuinely\n * needs announcing, own that at the call site with your own live region.\n *\n * **Status is never carried by colour alone** (WCAG 2.2, 1.4.1). The glyph\n * distinguishes the four statuses visually; where the distinction also matters\n * to a screen-reader user, say so in the `title` or the body copy rather than\n * relying on the icon, which is decorative here by design.\n */\nfunction Callout({ className, status, title, icon, children, ref, ...props }: CalloutProps) {\n const resolvedStatus = status ?? 'info'\n // `icon` is optional-with-a-default AND nullable-to-disable, so an explicit\n // `null` has to survive: `icon ?? CALLOUT_ICONS[…]` would resurrect the\n // default for exactly the consumer trying to turn it off.\n const Icon = icon === undefined ? CALLOUT_ICONS[resolvedStatus] : icon\n\n return (\n <div\n ref={ref}\n data-slot='callout'\n data-status={resolvedStatus}\n className={cn(calloutVariants({ status, className }))}\n {...props}\n >\n {Icon ? (\n <Icon\n aria-hidden='true'\n data-slot='callout-icon'\n // The icon modules paint `fill=\"currentColor\"`, so setting the text\n // colour here is what tints the glyph — and it keeps working for a\n // consumer-supplied `icon` drawn with strokes rather than fills.\n className='mt-0.5 size-6 shrink-0 text-(--callout-ink)'\n />\n ) : null}\n <div data-slot='callout-content' className='min-w-0 flex-1'>\n {title ? (\n <p data-slot='callout-title' className='font-semibold'>\n {title}\n </p>\n ) : null}\n {children}\n </div>\n </div>\n )\n}\n\n/**\n * `Callout` under shadcn's name, so code and habits carried over from shadcn's\n * `<Alert>` find it. It is the same component with the same props, which\n * differ from shadcn's in three ways: the tone is `status` (`info`, `success`,\n * `warning`, `danger`) rather than `variant`; the title is the `title` prop and\n * the body is `children`, so there is no `AlertTitle` / `AlertDescription`;\n * and it carries no `role=\"alert\"`, for the reason given on `Callout`.\n */\nconst Alert = Callout\nconst alertVariants = calloutVariants\ntype AlertProps = CalloutProps\ntype AlertStatus = CalloutStatus\n\nexport { Alert, alertVariants, Callout, calloutVariants }\nexport type { AlertProps, AlertStatus, CalloutProps, CalloutStatus }\n"]}
|
|
@@ -93,7 +93,7 @@ function ComboboxContent({
|
|
|
93
93
|
"data-slot": "combobox-content",
|
|
94
94
|
"data-chips": !!anchor,
|
|
95
95
|
className: cn(
|
|
96
|
-
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground
|
|
96
|
+
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:bg-input/20 *:data-[slot=input-group]:shadow-none dark:bg-popover data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
97
97
|
className
|
|
98
98
|
),
|
|
99
99
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/combobox.tsx"],"names":["ComboboxPrimitive"],"mappings":";;;;;;;;;;;AAaA,MAAM,WAAWA,UAAA,CAAkB;AAEnC,SAAS,aAAA,CAAc,EAAE,GAAG,KAAA,EAAM,EAAkC;AAClE,EAAA,2BAAQA,UAAA,CAAkB,KAAA,EAAlB,EAAwB,WAAA,EAAU,gBAAA,EAAkB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,gBAAgB,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,OAAM,EAAoC;AAC3F,EAAA,uBACE,IAAA;AAAA,IAACA,UAAA,CAAkB,OAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,YAAA,EAAW,kBAAA;AAAA,MACX,SAAA,EAAW,EAAA,CAAG,wCAAA,EAA0C,SAAS,CAAA;AAAA,MAChE,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAAC,cAAA,EAAA,EAAe,SAAA,EAAU,oDAAA,EAAqD;AAAA;AAAA;AAAA,GACjF;AAEJ;AAEA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA,CAAkB,KAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,gBAAA;AAAA,MACV,YAAA,EAAW,OAAA;AAAA,MACX,wBAAQ,GAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAQ,OAAA,EAAQ,MAAK,SAAA,EAAU,CAAA;AAAA,MACzD,SAAA,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mB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAClF,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA,CAAkB,KAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,8BAAA,EAAgC,SAAS,CAAA;AAAA,MACtD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,iBAAA,GAAoB;AAC3B,EAAA,OAAO,KAAA,CAAM,OAA8B,IAAI,CAAA;AACjD","file":"combobox.js","sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconClose } from '../icons/close.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group.js'\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot='combobox-value' {...props} />\n}\n\nfunction ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot='combobox-trigger'\n aria-label='Show suggestions'\n className={cn(\"[&_svg:not([class*='size-'])]:size-3.5\", className)}\n {...props}\n >\n {children}\n <IconExpandMore className='pointer-events-none size-3.5 text-muted-foreground' />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n return (\n <ComboboxPrimitive.Clear\n data-slot='combobox-clear'\n aria-label='Clear'\n render={<InputGroupButton variant='ghost' size='icon-xs' />}\n className={cn(className)}\n {...props}\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean\n showClear?: boolean\n}) {\n return (\n <InputGroup className={cn('w-auto', className)}>\n <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align='inline-end'>\n {showTrigger && (\n <InputGroupButton\n size='icon-xs'\n variant='ghost'\n render={<ComboboxTrigger />}\n data-slot='input-group-button'\n className='group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent'\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'\n >) {\n return (\n <ComboboxPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className='isolate z-50'\n >\n <ComboboxPrimitive.Popup\n data-slot='combobox-content'\n data-chips={!!anchor}\n className={cn(\n 'group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:bg-input/20 *:data-[slot=input-group]:shadow-none dark:bg-popover data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ButtonGroupBoundary>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot='combobox-list'\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot='combobox-item'\n className={cn(\n \"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-sm px-2 py-1 text-xs/relaxed outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return <ComboboxPrimitive.Group data-slot='combobox-group' className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot='combobox-label'\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot='combobox-collection' {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot='combobox-empty'\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-xs/relaxed text-muted-foreground group-data-empty/combobox-content:flex',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot='combobox-separator'\n className={cn('-mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot='combobox-chips'\n className={cn(\n 'flex min-h-7 flex-wrap items-center gap-1 rounded-sm border border-input bg-input/20 bg-clip-padding px-2 py-0.5 text-xs/relaxed transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30 has-aria-invalid:border-destructive has-aria-invalid:ring-2 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n removeLabel = 'Remove',\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n /**\n * Screen-reader name for the chip's remove button. Override to translate it\n * — the button is icon-only, so this string is the only name AT ever hears.\n * Include the chip's own text where a bare \"Remove\" would be ambiguous in a\n * list of chips.\n */\n removeLabel?: string\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot='combobox-chip'\n className={cn(\n 'flex h-[calc(--spacing(4.75))] w-fit items-center justify-center gap-1 rounded-[calc(var(--radius-sm)-2px)] bg-muted-foreground/10 px-1.5 text-xs/relaxed font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0',\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant='ghost' size='icon' />}\n aria-label={removeLabel}\n className='-ms-1 opacity-50 hover:opacity-100'\n data-slot='combobox-chip-remove'\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot='combobox-chip-input'\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/combobox.tsx"],"names":["ComboboxPrimitive"],"mappings":";;;;;;;;;;;AAaA,MAAM,WAAWA,UAAA,CAAkB;AAEnC,SAAS,aAAA,CAAc,EAAE,GAAG,KAAA,EAAM,EAAkC;AAClE,EAAA,2BAAQA,UAAA,CAAkB,KAAA,EAAlB,EAAwB,WAAA,EAAU,gBAAA,EAAkB,GAAG,KAAA,EAAO,CAAA;AACxE;AAEA,SAAS,gBAAgB,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,OAAM,EAAoC;AAC3F,EAAA,uBACE,IAAA;AAAA,IAACA,UAAA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;AAAA,IAACA,UAAA,CAAkB,IAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,4UAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,UAAA,oBACC,GAAA;AAAA,UAACA,UAAA,CAAkB,UAAA;AAAA,UAAlB;AAAA,YACC,wBAAQ,GAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,OAAA,EAAQ,MAAK,MAAA,EAAO,CAAA;AAAA,YAC5C,YAAA,EAAY,WAAA;AAAA,YACZ,SAAA,EAAU,oCAAA;AAAA,YACV,WAAA,EAAU,sBAAA;AAAA,YAEV,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAU,qBAAA,EAAsB;AAAA;AAAA;AAC7C;AAAA;AAAA,GAEJ;AAEJ;AAEA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAClF,EAAA,uBACE,GAAA;AAAA,IAACA,UAAA,CAAkB,KAAA;AAAA,IAAlB;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,8BAAA,EAAgC,SAAS,CAAA;AAAA,MACtD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,iBAAA,GAAoB;AAC3B,EAAA,OAAO,KAAA,CAAM,OAA8B,IAAI,CAAA;AACjD","file":"combobox.js","sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconClose } from '../icons/close.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group.js'\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot='combobox-value' {...props} />\n}\n\nfunction ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot='combobox-trigger'\n aria-label='Show suggestions'\n className={cn(\"[&_svg:not([class*='size-'])]:size-3.5\", className)}\n {...props}\n >\n {children}\n <IconExpandMore className='pointer-events-none size-3.5 text-muted-foreground' />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n return (\n <ComboboxPrimitive.Clear\n data-slot='combobox-clear'\n aria-label='Clear'\n render={<InputGroupButton variant='ghost' size='icon-xs' />}\n className={cn(className)}\n {...props}\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxPrimitive.Input.Props & {\n showTrigger?: boolean\n showClear?: boolean\n}) {\n return (\n <InputGroup className={cn('w-auto', className)}>\n <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align='inline-end'>\n {showTrigger && (\n <InputGroupButton\n size='icon-xs'\n variant='ghost'\n render={<ComboboxTrigger />}\n data-slot='input-group-button'\n className='group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent'\n disabled={disabled}\n />\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'\n >) {\n return (\n <ComboboxPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className='isolate z-50'\n >\n <ComboboxPrimitive.Popup\n data-slot='combobox-content'\n data-chips={!!anchor}\n className={cn(\n 'group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-md bg-popover text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:bg-input/20 *:data-[slot=input-group]:shadow-none dark:bg-popover data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ButtonGroupBoundary>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot='combobox-list'\n className={cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot='combobox-item'\n className={cn(\n \"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-sm px-2 py-1 text-xs/relaxed outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return <ComboboxPrimitive.Group data-slot='combobox-group' className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot='combobox-label'\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection data-slot='combobox-collection' {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n data-slot='combobox-empty'\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-xs/relaxed text-muted-foreground group-data-empty/combobox-content:flex',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot='combobox-separator'\n className={cn('-mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot='combobox-chips'\n className={cn(\n 'flex min-h-7 flex-wrap items-center gap-1 rounded-sm border border-input bg-input/20 bg-clip-padding px-2 py-0.5 text-xs/relaxed transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30 has-aria-invalid:border-destructive has-aria-invalid:ring-2 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n removeLabel = 'Remove',\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n /**\n * Screen-reader name for the chip's remove button. Override to translate it\n * — the button is icon-only, so this string is the only name AT ever hears.\n * Include the chip's own text where a bare \"Remove\" would be ambiguous in a\n * list of chips.\n */\n removeLabel?: string\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot='combobox-chip'\n className={cn(\n 'flex h-[calc(--spacing(4.75))] w-fit items-center justify-center gap-1 rounded-[calc(var(--radius-sm)-2px)] bg-muted-foreground/10 px-1.5 text-xs/relaxed font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pe-0',\n className,\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant='ghost' size='icon' />}\n aria-label={removeLabel}\n className='-ms-1 opacity-50 hover:opacity-100'\n data-slot='combobox-chip-remove'\n >\n <IconClose className='pointer-events-none' />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot='combobox-chip-input'\n className={cn('min-w-16 flex-1 outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
declare function Dialog({ ...props }: Dialog$1.Root.Props): React.JSX.Element;
|
|
6
|
+
declare function DialogTrigger({ ...props }: Dialog$1.Trigger.Props): React.JSX.Element;
|
|
7
|
+
declare function DialogClose({ ...props }: Dialog$1.Close.Props): React.JSX.Element;
|
|
8
|
+
declare function DialogPortal({ children, ...props }: Dialog$1.Portal.Props): React.JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* The three approved looks (design-shotgun, overlays-20260923):
|
|
11
|
+
*
|
|
12
|
+
* - `default` (Hairline): a flat raised surface drawn with a 1px ring; the
|
|
13
|
+
* header and footer bleed to the edges and are divided off by hairlines.
|
|
14
|
+
* - `band`: the header is a solid band in the action colour with an inverse
|
|
15
|
+
* title; the footer sits on a subtle band.
|
|
16
|
+
* - `rule`: a 4px rule in the ink colour caps the top edge, the title sits on
|
|
17
|
+
* a hairline in the text colour, and the actions align to the start.
|
|
18
|
+
*
|
|
19
|
+
* None casts a shadow and none blurs the page behind — depth is drawn, per
|
|
20
|
+
* DESIGN.md's Hairline Rule. Parts read the variant from `data-variant` on
|
|
21
|
+
* the popup through `group-data-*`, so there is no context to thread.
|
|
22
|
+
*/
|
|
23
|
+
type DialogVariant = 'default' | 'band' | 'rule';
|
|
24
|
+
/**
|
|
25
|
+
* The popup's own classes and its look. The parts (header, footer, title,
|
|
26
|
+
* description, close button) read the look from `data-variant` through
|
|
27
|
+
* `group-data-*` instead: cva sees only its own props, not an ancestor's.
|
|
28
|
+
* Radius sits in every branch, not the base, so rule's square top never
|
|
29
|
+
* competes with a base `rounded-md` at equal specificity.
|
|
30
|
+
*/
|
|
31
|
+
declare const dialogContentVariants: (props?: ({
|
|
32
|
+
variant?: "default" | "band" | "rule" | null | undefined;
|
|
33
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
34
|
+
declare function DialogOverlay({ className, ...props }: Dialog$1.Backdrop.Props): React.JSX.Element;
|
|
35
|
+
declare function DialogContent({ className, children, variant, showCloseButton, closeLabel, ...props }: Dialog$1.Popup.Props & {
|
|
36
|
+
variant?: DialogVariant;
|
|
37
|
+
showCloseButton?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Screen-reader name for the close button. Override to translate it — the
|
|
40
|
+
* button is icon-only, so this string is the only name AT ever hears.
|
|
41
|
+
*/
|
|
42
|
+
closeLabel?: string;
|
|
43
|
+
}): React.JSX.Element;
|
|
44
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
45
|
+
declare function DialogFooter({ className, showCloseButton, closeLabel, children, ...props }: React.ComponentProps<'div'> & {
|
|
46
|
+
/** Appends an outline Close button after the footer's own actions. */
|
|
47
|
+
showCloseButton?: boolean;
|
|
48
|
+
/** Visible label of that Close button. Override to translate it. */
|
|
49
|
+
closeLabel?: string;
|
|
50
|
+
}): React.JSX.Element;
|
|
51
|
+
declare function DialogTitle({ className, ...props }: Dialog$1.Title.Props): React.JSX.Element;
|
|
52
|
+
declare function DialogDescription({ className, ...props }: Dialog$1.Description.Props): React.JSX.Element;
|
|
53
|
+
|
|
54
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type DialogVariant, dialogContentVariants };
|