@cloudgrid-io/ui 0.27.2 → 0.28.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/dist/blocks/avatar.d.ts +10 -4
- package/dist/blocks/avatar.d.ts.map +1 -1
- package/dist/blocks/avatar.js +8 -2
- package/dist/blocks/avatar.js.map +1 -1
- package/dist/fonts.css +38 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cloudgrid-cn.d.ts +1 -1
- package/dist/lib/cloudgrid-cn.d.ts.map +1 -1
- package/dist/lib/cloudgrid-cn.js +7 -0
- package/dist/lib/cloudgrid-cn.js.map +1 -1
- package/dist/theme.css +95 -0
- package/dist/tokens/base.json +389 -3
- package/dist/tokens/surface-ink.json +10 -0
- package/dist/tokens/surface-panel.json +10 -0
- package/dist/tokens.css +520 -10
- package/dist/tokens.json +43 -2
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +28 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/dialog.d.ts +17 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +18 -2
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/drawer.d.ts +208 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/drawer.js +265 -0
- package/dist/ui/drawer.js.map +1 -0
- package/package.json +2 -1
package/dist/tokens.json
CHANGED
|
@@ -42,8 +42,30 @@
|
|
|
42
42
|
"--cg-neutral-200": "#e3e3e3",
|
|
43
43
|
"--cg-neutral-400": "#acacac",
|
|
44
44
|
"--cg-neutral-500": "#858585",
|
|
45
|
+
"--cg-neutral-600": "#6a6a6a",
|
|
45
46
|
"--cg-neutral-700": "#595959",
|
|
46
47
|
"--cg-neutral-900": "#222222",
|
|
48
|
+
"--cg-slate-300": "#d2d7de",
|
|
49
|
+
"--cg-slate-500": "#828c98",
|
|
50
|
+
"--cg-slate-600": "#5f6874",
|
|
51
|
+
"--cg-stone-800": "#343330",
|
|
52
|
+
"--cg-violet-100": "#ebe8fd",
|
|
53
|
+
"--cg-violet-150": "#e3e0fd",
|
|
54
|
+
"--cg-violet-200": "#d9d4fb",
|
|
55
|
+
"--cg-violet-300": "#c8c2fa",
|
|
56
|
+
"--cg-violet-400": "#bcb4f9",
|
|
57
|
+
"--cg-violet-500": "#a69bf7",
|
|
58
|
+
"--cg-violet-600": "#9488f5",
|
|
59
|
+
"--cg-violet-700": "#8476f4",
|
|
60
|
+
"--cg-violet-900": "var(--cg-primary)",
|
|
61
|
+
"--cg-cyan-200": "#dffbfc",
|
|
62
|
+
"--cg-cyan-300": "#cff8fa",
|
|
63
|
+
"--cg-cyan-400": "#b1fcff",
|
|
64
|
+
"--cg-cyan-900": "var(--cg-tertiary)",
|
|
65
|
+
"--cg-lime-200": "#eef7dc",
|
|
66
|
+
"--cg-lime-600": "#d0ea9e",
|
|
67
|
+
"--cg-lime-700": "#c8e68e",
|
|
68
|
+
"--cg-lime-900": "var(--cg-secondary)",
|
|
47
69
|
"--cg-surface-page": "var(--cg-neutral-25)",
|
|
48
70
|
"--cg-surface-page-alt": "var(--cg-lavender-50)",
|
|
49
71
|
"--cg-surface-card": "var(--cg-neutral-0)",
|
|
@@ -55,6 +77,7 @@
|
|
|
55
77
|
"--cg-text-primary": "var(--cg-neutral-900)",
|
|
56
78
|
"--cg-text-secondary": "var(--cg-neutral-700)",
|
|
57
79
|
"--cg-text-muted": "var(--cg-neutral-500)",
|
|
80
|
+
"--cg-text-muted-strong": "var(--cg-neutral-600)",
|
|
58
81
|
"--cg-text-placeholder": "var(--cg-neutral-400)",
|
|
59
82
|
"--cg-text-accent": "var(--cg-primary)",
|
|
60
83
|
"--cg-text-inverse": "var(--cg-neutral-0)",
|
|
@@ -68,23 +91,33 @@
|
|
|
68
91
|
"--cg-focus-ring": "rgba(90, 71, 240, 0.28)",
|
|
69
92
|
"--cg-link": "var(--cg-accent)",
|
|
70
93
|
"--cg-link-hover": "var(--cg-accent-press)",
|
|
71
|
-
"--cg-font-display": "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
72
|
-
"--cg-font-body": "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
94
|
+
"--cg-font-display": "'Tanker', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
95
|
+
"--cg-font-body": "'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
96
|
+
"--cg-font-ui": "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
73
97
|
"--cg-font-mono": "'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
74
98
|
"--cg-weight-regular": "400",
|
|
75
99
|
"--cg-weight-medium": "500",
|
|
76
100
|
"--cg-weight-bold": "600",
|
|
77
101
|
"--cg-weight-display": "700",
|
|
102
|
+
"--cg-display-3xl": "120px",
|
|
103
|
+
"--cg-display-2xl": "92px",
|
|
78
104
|
"--cg-display-xl": "56px",
|
|
79
105
|
"--cg-display-lg": "44px",
|
|
80
106
|
"--cg-display-md": "38px",
|
|
81
107
|
"--cg-display-sm": "30px",
|
|
82
108
|
"--cg-display-line": "1.06",
|
|
83
109
|
"--cg-display-tracking": "0.012em",
|
|
110
|
+
"--cg-display-line-tight": "1",
|
|
111
|
+
"--cg-title-lg": "40px",
|
|
112
|
+
"--cg-title-md": "26px",
|
|
113
|
+
"--cg-title-sm": "20px",
|
|
114
|
+
"--cg-title-line": "var(--cg-display-line-tight)",
|
|
115
|
+
"--cg-title-tracking": "0em",
|
|
84
116
|
"--cg-heading-lg": "22px",
|
|
85
117
|
"--cg-heading-md": "20px",
|
|
86
118
|
"--cg-heading-sm": "17px",
|
|
87
119
|
"--cg-heading-line": "1.2",
|
|
120
|
+
"--cg-body-xl": "20px",
|
|
88
121
|
"--cg-body-lg": "19px",
|
|
89
122
|
"--cg-body-md": "16px",
|
|
90
123
|
"--cg-body-sm": "15px",
|
|
@@ -95,6 +128,10 @@
|
|
|
95
128
|
"--cg-mono-line": "1.7",
|
|
96
129
|
"--cg-label-size": "15px",
|
|
97
130
|
"--cg-label-weight": "var(--cg-weight-medium)",
|
|
131
|
+
"--cg-eyebrow-size": "14px",
|
|
132
|
+
"--cg-eyebrow-line": "1.2",
|
|
133
|
+
"--cg-eyebrow-tracking": "0.1em",
|
|
134
|
+
"--cg-eyebrow-weight": "var(--cg-weight-bold)",
|
|
98
135
|
"--cg-space-1": "4px",
|
|
99
136
|
"--cg-space-2": "8px",
|
|
100
137
|
"--cg-space-3": "12px",
|
|
@@ -124,7 +161,9 @@
|
|
|
124
161
|
"--cg-radius-md": "12px",
|
|
125
162
|
"--cg-radius-lg": "14px",
|
|
126
163
|
"--cg-radius-xl": "16px",
|
|
164
|
+
"--cg-radius-container": "20px",
|
|
127
165
|
"--cg-radius-2xl": "24px",
|
|
166
|
+
"--cg-radius-3xl": "32px",
|
|
128
167
|
"--cg-radius-pill": "999px",
|
|
129
168
|
"--cg-border-width": "1px",
|
|
130
169
|
"--cg-border-width-strong": "1.5px",
|
|
@@ -158,6 +197,7 @@
|
|
|
158
197
|
"--cg-text-primary": "#ffffff",
|
|
159
198
|
"--cg-text-secondary": "rgba(255, 255, 255, 0.82)",
|
|
160
199
|
"--cg-text-muted": "rgba(255, 255, 255, 0.66)",
|
|
200
|
+
"--cg-text-muted-strong": "rgba(255, 255, 255, 0.86)",
|
|
161
201
|
"--cg-text-accent": "#ffffff",
|
|
162
202
|
"--cg-border-control": "rgba(255, 255, 255, 0.62)",
|
|
163
203
|
"--cg-border-hairline": "rgba(255, 255, 255, 0.24)",
|
|
@@ -193,6 +233,7 @@
|
|
|
193
233
|
"--cg-text-primary": "#ffffff",
|
|
194
234
|
"--cg-text-secondary": "rgba(255, 255, 255, 0.78)",
|
|
195
235
|
"--cg-text-muted": "rgba(255, 255, 255, 0.56)",
|
|
236
|
+
"--cg-text-muted-strong": "rgba(255, 255, 255, 0.68)",
|
|
196
237
|
"--cg-text-accent": "var(--cg-secondary)",
|
|
197
238
|
"--cg-surface-card": "rgba(255, 255, 255, 0.04)",
|
|
198
239
|
"--cg-surface-page-alt": "rgba(255, 255, 255, 0.06)",
|
package/dist/ui/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "ghost" | "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
4
|
+
variant?: "link" | "ghost" | "default" | "secondary" | "destructive" | "outline" | "cta" | null | undefined;
|
|
5
5
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
package/dist/ui/button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;8EA+DnB,CAAA;AAED,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,+BAQ7D;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/ui/button.js
CHANGED
|
@@ -6,6 +6,34 @@ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justi
|
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
9
|
+
/* The frames' primary call to action (#236): the brand teal with the ink
|
|
10
|
+
on top. Open app, Save, Share, Add secret, Copy command, Verify domain.
|
|
11
|
+
`default` stays the brand purple; this is the one the app page reaches
|
|
12
|
+
for, and it is the reason the Console no longer paints its own black.
|
|
13
|
+
|
|
14
|
+
Named `cta` and not `accent` because "accent" is already spent twice
|
|
15
|
+
here on two different colours: --cg-accent is the brand BLUE (#197,
|
|
16
|
+
utility `azure`), and --cg-text-on-accent is the ink this very button
|
|
17
|
+
puts on the teal. A third meaning would make the call site unreadable.
|
|
18
|
+
The other variants are roles too, not colours.
|
|
19
|
+
|
|
20
|
+
It does NOT flip on the dark surfaces, and that is the whole design
|
|
21
|
+
rather than an omission. --cg-tertiary, --cg-tertiary-press and
|
|
22
|
+
--cg-text-on-accent are declared at :root and redeclared on neither
|
|
23
|
+
[data-cg-surface='panel'] nor [data-cg-surface='ink'], so the label
|
|
24
|
+
pair measures 10.92:1 in all three scopes by construction. A filled
|
|
25
|
+
control carries its own ground (#225). Compare `default`, which needed
|
|
26
|
+
a per-scope --primary in shadcn.css only because --cg-primary IS the
|
|
27
|
+
panel surface (#41); the teal has no such collision, and measures
|
|
28
|
+
4.01:1 against the panel and 10.92:1 against ink, both better than the
|
|
29
|
+
1.46:1 it gets on the white the frames draw.
|
|
30
|
+
|
|
31
|
+
Hover is the opaque press token, not `/80` the way `default` washes.
|
|
32
|
+
An alpha wash composites lighter on white and darker on ink, so the
|
|
33
|
+
same class would mean two opposite things; --cg-tertiary-press is one
|
|
34
|
+
value everywhere and moves with the hue on a retune. Its pair is
|
|
35
|
+
9.25:1. Both numbers are pinned in contrast-guardrail.test.mjs. */
|
|
36
|
+
cta: "bg-cyan text-on-accent hover:bg-cyan-press aria-expanded:bg-cyan-press",
|
|
9
37
|
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
10
38
|
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
11
39
|
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
package/dist/ui/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC,MAAM,cAAc,GAAG,GAAG,CACxB,8lBAA8lB,EAC9lB;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,OAAO,EACL,iLAAiL;YACnL,SAAS,EACP,gLAAgL;YAClL,KAAK,EACH,kHAAkH;YACpH,WAAW,EACT,6NAA6N;YAC/N,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ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sFAAsF;YACxF,EAAE,EAAE,oNAAoN;YACxN,EAAE,EAAE,wNAAwN;YAC5N,EAAE,EAAE,sFAAsF;YAC1F,IAAI,EAAE,QAAQ;YACd,SAAS,EACP,yHAAyH;YAC3H,SAAS,EACP,oFAAoF;YACtF,SAAS,EAAE,QAAQ;SACpB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAA;AAED,SAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,EAChB,GAAG,KAAK,EACoD;IAC5D,OAAO,CACL,KAAC,eAAe,iBACJ,QAAQ,EAClB,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KACvD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/ui/dialog.d.ts
CHANGED
|
@@ -4,7 +4,23 @@ declare function Dialog({ ...props }: DialogPrimitive.Root.Props): React.JSX.Ele
|
|
|
4
4
|
declare function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props): React.JSX.Element;
|
|
5
5
|
declare function DialogPortal({ ...props }: DialogPrimitive.Portal.Props): React.JSX.Element;
|
|
6
6
|
declare function DialogClose({ ...props }: DialogPrimitive.Close.Props): React.JSX.Element;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The scrim.
|
|
9
|
+
*
|
|
10
|
+
* `forceRender`, which is NOT Base UI's default (#214). Base UI suppresses a
|
|
11
|
+
* nested dialog's backdrop on purpose, so that a stack of dialogs presented with
|
|
12
|
+
* its scale-and-offset treatment shows the parent cleanly behind the child. This
|
|
13
|
+
* library does not present a stack that way: its dialogs are flat, and a confirm
|
|
14
|
+
* opened from inside a `Drawer` therefore sat on a drawer that stayed at full
|
|
15
|
+
* brightness, so the two layers read as one broken surface rather than as a
|
|
16
|
+
* dialog on top of a sheet.
|
|
17
|
+
*
|
|
18
|
+
* With it, the child's own scrim covers everything under it, the drawer included,
|
|
19
|
+
* and the top layer is the only bright thing on screen. Asserted in
|
|
20
|
+
* `registry/e2e/drawer.spec.ts`, which measures that the drawer really is beneath
|
|
21
|
+
* the confirm's backdrop rather than merely beside it.
|
|
22
|
+
*/
|
|
23
|
+
declare function DialogOverlay({ className, forceRender, ...props }: DialogPrimitive.Backdrop.Props): React.JSX.Element;
|
|
8
24
|
declare function DialogContent({ className, children, showCloseButton, ...props }: DialogPrimitive.Popup.Props & {
|
|
9
25
|
showCloseButton?: boolean;
|
|
10
26
|
}): React.JSX.Element;
|
package/dist/ui/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAMjE,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,qBAEvD;AAED,iBAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,qBAEjE;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,qBAE/D;AAED,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,qBAE7D;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"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,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,WAAW,CAAC,KAAK,qBAWnC;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
package/dist/ui/dialog.js
CHANGED
|
@@ -17,8 +17,24 @@ function DialogPortal({ ...props }) {
|
|
|
17
17
|
function DialogClose({ ...props }) {
|
|
18
18
|
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The scrim.
|
|
22
|
+
*
|
|
23
|
+
* `forceRender`, which is NOT Base UI's default (#214). Base UI suppresses a
|
|
24
|
+
* nested dialog's backdrop on purpose, so that a stack of dialogs presented with
|
|
25
|
+
* its scale-and-offset treatment shows the parent cleanly behind the child. This
|
|
26
|
+
* library does not present a stack that way: its dialogs are flat, and a confirm
|
|
27
|
+
* opened from inside a `Drawer` therefore sat on a drawer that stayed at full
|
|
28
|
+
* brightness, so the two layers read as one broken surface rather than as a
|
|
29
|
+
* dialog on top of a sheet.
|
|
30
|
+
*
|
|
31
|
+
* With it, the child's own scrim covers everything under it, the drawer included,
|
|
32
|
+
* and the top layer is the only bright thing on screen. Asserted in
|
|
33
|
+
* `registry/e2e/drawer.spec.ts`, which measures that the drawer really is beneath
|
|
34
|
+
* the confirm's backdrop rather than merely beside it.
|
|
35
|
+
*/
|
|
36
|
+
function DialogOverlay({ className, forceRender = true, ...props }) {
|
|
37
|
+
return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", forceRender: forceRender, className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
|
|
22
38
|
}
|
|
23
39
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
24
40
|
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-body-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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", className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-2 right-2", size: "icon-sm" }), children: [_jsx(CloseIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
package/dist/ui/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,SAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAA8B;IACtD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAiC;IAChE,OAAO,KAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,KAAK,KAAK,GAAI,CAAA;AAC1E,CAAC;AAED,SAAS,YAAY,C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@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
/**
|
|
5
|
+
* The sheet that slides in from an edge (#214).
|
|
6
|
+
*
|
|
7
|
+
* `Dialog` is centred. Nothing in this library came in from the side, so the
|
|
8
|
+
* console hand-composes the same panel eight times: five shipped surfaces on its
|
|
9
|
+
* local `Overlay` primitive (`UserDetailsDrawer`, `FeedbackDetailDrawer`,
|
|
10
|
+
* `VaultGrantsDrawer`, `ConnectorAuditDrawer`, `PerEntityCapDrawer`) and three
|
|
11
|
+
* more drawn in the app page facelift (the Secrets update panel, the Database
|
|
12
|
+
* record details panel, the Domains setup wizard). Each copy guesses its own
|
|
13
|
+
* width, lays out its own title row and picks its own close-button size.
|
|
14
|
+
*
|
|
15
|
+
* `Overlay.taxonomy.md` in the console has carried the line "a future Drawer
|
|
16
|
+
* slides from the right" since that primitive was written. This is it.
|
|
17
|
+
*
|
|
18
|
+
* ## Why this is a positioned Dialog and not Base UI's own Drawer
|
|
19
|
+
*
|
|
20
|
+
* Base UI 1.7.0 ships `Drawer`, and its usage guidelines answer the question
|
|
21
|
+
* directly: "Drawer extends Dialog: it adds gesture support, snap points, and
|
|
22
|
+
* indent effects. If you don't need these, use Dialog instead. A panel that
|
|
23
|
+
* slides in from the edge of the screen and doesn't need gesture support is a
|
|
24
|
+
* positioned Dialog."
|
|
25
|
+
*
|
|
26
|
+
* None of the eight consumers swipes. They are desktop side panels opened from a
|
|
27
|
+
* table row or a button, and the one phone surface (`PlugSheet`) dismisses with
|
|
28
|
+
* its close glyph and the scrim. `Drawer` would also bring `Drawer.Viewport` and
|
|
29
|
+
* a swipe layer this repo has no way to test in Playwright, in exchange for
|
|
30
|
+
* behaviour nobody asked for. If a consumer ever needs swipe-to-dismiss, that is
|
|
31
|
+
* Base UI's `Drawer` and its own issue, not a prop here.
|
|
32
|
+
*
|
|
33
|
+
* ## The size rungs, and where they come from
|
|
34
|
+
*
|
|
35
|
+
* `size` is a named rung rather than a Tailwind class handed in by the caller,
|
|
36
|
+
* which is the whole point of #214: five files currently decide independently how
|
|
37
|
+
* wide a drawer is.
|
|
38
|
+
*
|
|
39
|
+
* md 448px max-w-md
|
|
40
|
+
* lg 512px max-w-lg
|
|
41
|
+
*
|
|
42
|
+
* Both were measured off the founder's frames rather than chosen. The three app
|
|
43
|
+
* page frames export at 1024px against a 1600px design, so the scale is 1.5625:
|
|
44
|
+
*
|
|
45
|
+
* Secrets, "Update secret" 287px exported 448px -> md
|
|
46
|
+
* Database, "Record details" 287px exported 448px -> md
|
|
47
|
+
* Domains, "Set up chimp.me" 325px exported 508px -> lg
|
|
48
|
+
*
|
|
49
|
+
* They land on the two rungs the console already writes by hand: `max-w-md` on
|
|
50
|
+
* three of the five shipped drawers, `max-w-lg` on the newest. #694's own frame
|
|
51
|
+
* is 525 of 1600, which is `lg` to the nearest rung.
|
|
52
|
+
*
|
|
53
|
+
* There is deliberately no third rung. Two values cover every frame and every
|
|
54
|
+
* shipped copy, and a wider one with nothing behind it would be a worker
|
|
55
|
+
* inventing a brand decision.
|
|
56
|
+
*
|
|
57
|
+
* `size` is the INLINE width and applies to `left` and `right` only. A bottom
|
|
58
|
+
* sheet is full width, which is what `PlugSheet` already does.
|
|
59
|
+
*
|
|
60
|
+
* ## Full width at the narrow end, without opting in
|
|
61
|
+
*
|
|
62
|
+
* The popup is `w-full` under a `max-w-*` rung, so below 448px it simply fills
|
|
63
|
+
* the screen. No breakpoint prop, no phone variant, nothing for a caller to
|
|
64
|
+
* remember. #214 asks for exactly this.
|
|
65
|
+
*
|
|
66
|
+
* ## Ground: opaque on every surface
|
|
67
|
+
*
|
|
68
|
+
* The trap `Popover` fell into and #230 records. `bg-popover` resolves to
|
|
69
|
+
* `--cg-surface-card`, which is `transparent` inside `[data-cg-surface='panel']`
|
|
70
|
+
* and a 4% white wash inside `[data-cg-surface='ink']`, because a CARD on a dark
|
|
71
|
+
* brand surface is meant to let it through. An overlay is the one thing that
|
|
72
|
+
* cannot: it is drawn over arbitrary content, and a see-through drawer renders
|
|
73
|
+
* its words and the page's in the same pixels.
|
|
74
|
+
*
|
|
75
|
+
* So the ground is opaque in all three scopes, out of values this system already
|
|
76
|
+
* has: the card ground on the page, `--cg-surface-panel` on the panel,
|
|
77
|
+
* `--cg-surface-code` on ink. No new token and no new colour. Guarded by an alpha
|
|
78
|
+
* assertion on all three grounds in `registry/e2e/drawer.spec.ts`, the same check
|
|
79
|
+
* `popover.test.mjs` and that spec added for #228.
|
|
80
|
+
*
|
|
81
|
+
* ## `container`, and the surface a portal leaves behind
|
|
82
|
+
*
|
|
83
|
+
* Base UI portals to `<body>`, which is outside every `data-cg-surface` scope, and
|
|
84
|
+
* every `--cg-*` value here is inherited. A drawer opened from inside an ink
|
|
85
|
+
* header would render with the page's tokens and look entirely correct.
|
|
86
|
+
* `container` forwards to `Dialog.Portal`'s own prop, exactly as `PopoverContent`
|
|
87
|
+
* does, so a consumer can keep the portal inside the surface it belongs to.
|
|
88
|
+
*
|
|
89
|
+
* It changes the token scope, not the geometry: the popup is `fixed`, so it is
|
|
90
|
+
* anchored to the viewport edge wherever the portal lives. That is what all five
|
|
91
|
+
* console drawers do today. The frames draw the drawer inside the page box
|
|
92
|
+
* because on that page the box fills the window.
|
|
93
|
+
*
|
|
94
|
+
* It was worth checking that a mid-page portal does not cost a MODAL its focus
|
|
95
|
+
* trap, since Base UI's focus guards are siblings of the portal node rather than
|
|
96
|
+
* of `<body>` and a popover is not modal, so #228 never had to care. It does not:
|
|
97
|
+
* eighteen Tab and Shift+Tab presses inside a contained drawer never reach a
|
|
98
|
+
* control outside it, asserted in `registry/e2e/drawer.spec.ts`. An earlier
|
|
99
|
+
* throwaway probe appeared to show a leak and was wrong: it tabbed within a few
|
|
100
|
+
* milliseconds of the popup appearing, before Base UI had armed the trap, which
|
|
101
|
+
* is a race in the probe rather than a property of the component.
|
|
102
|
+
*
|
|
103
|
+
* ## Stacking, which is the bug that forced this issue
|
|
104
|
+
*
|
|
105
|
+
* console#694: the drawer's Remove opens the existing confirm modal, both listen
|
|
106
|
+
* for Escape on the document, and one keystroke dismissed the confirm AND the
|
|
107
|
+
* drawer behind it. The console guards it by making the drawer's `onClose` inert
|
|
108
|
+
* while the confirm is open, which every caller has to remember.
|
|
109
|
+
*
|
|
110
|
+
* Base UI makes the topmost dialog the only one that hears Escape, as long as the
|
|
111
|
+
* nested `Drawer`/`Dialog` root is rendered INSIDE the parent's popup. Nothing
|
|
112
|
+
* here implements that, so the spec proves it rather than the docblock claiming
|
|
113
|
+
* it.
|
|
114
|
+
*
|
|
115
|
+
* What this library DOES have to implement is the layering. Base UI suppresses a
|
|
116
|
+
* nested dialog's backdrop by default, so the first version of this left the
|
|
117
|
+
* drawer at full brightness under an open confirm: two bright surfaces, reading as
|
|
118
|
+
* one broken one rather than as a dialog on top of a sheet. Both overlays here and
|
|
119
|
+
* in `dialog.tsx` therefore pass `forceRender`, so whatever is on top brings its
|
|
120
|
+
* own scrim and everything under it dims, the drawer included.
|
|
121
|
+
*
|
|
122
|
+
* Stacking order needs no z-index of its own. A nested dialog always OPENS after
|
|
123
|
+
* its parent, so its portal is appended later and paints above at the same `z-50`.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* The positioning container, and the edge the sheet is pinned to.
|
|
127
|
+
*
|
|
128
|
+
* `fixed inset-0` with one flex alignment per side, which is precisely the shape
|
|
129
|
+
* the console writes as `scrimClassName="flex justify-end"` five times over. It
|
|
130
|
+
* is Base UI's `Dialog.Viewport`, so it carries the open and nested data
|
|
131
|
+
* attributes and Base UI treats a press on it as an outside press.
|
|
132
|
+
*/
|
|
133
|
+
declare const drawerViewportVariants: (props?: ({
|
|
134
|
+
side?: "bottom" | "left" | "right" | null | undefined;
|
|
135
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
136
|
+
/**
|
|
137
|
+
* The sheet itself.
|
|
138
|
+
*
|
|
139
|
+
* `flex flex-col` with `overflow-hidden` is what lets `DrawerBody` scroll while
|
|
140
|
+
* the header and footer hold their place: the body is the only child that grows,
|
|
141
|
+
* and the popup never scrolls as a whole.
|
|
142
|
+
*/
|
|
143
|
+
declare const drawerPopupVariants: (props?: ({
|
|
144
|
+
side?: "bottom" | "left" | "right" | null | undefined;
|
|
145
|
+
size?: "lg" | "md" | null | undefined;
|
|
146
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
147
|
+
declare function Drawer({ ...props }: DialogPrimitive.Root.Props): React.JSX.Element;
|
|
148
|
+
declare function DrawerTrigger({ ...props }: DialogPrimitive.Trigger.Props): React.JSX.Element;
|
|
149
|
+
declare function DrawerPortal({ ...props }: DialogPrimitive.Portal.Props): React.JSX.Element;
|
|
150
|
+
declare function DrawerClose({ ...props }: DialogPrimitive.Close.Props): React.JSX.Element;
|
|
151
|
+
/**
|
|
152
|
+
* The scrim.
|
|
153
|
+
*
|
|
154
|
+
* `bg-scrim` is `--cg-scrim`, the token the console's `Overlay` already reads
|
|
155
|
+
* inline and the one this system declares for exactly this job. It is deliberately
|
|
156
|
+
* declared at `:root` only and does not flip: a scrim composites over whatever is
|
|
157
|
+
* behind it, so it has no surface of its own.
|
|
158
|
+
*
|
|
159
|
+
* `forceRender` because Base UI does not render a nested dialog's backdrop by
|
|
160
|
+
* default. See the stacking note in the component docblock.
|
|
161
|
+
*/
|
|
162
|
+
declare function DrawerOverlay({ className, forceRender, ...props }: DialogPrimitive.Backdrop.Props): React.JSX.Element;
|
|
163
|
+
declare function DrawerContent({ side, size, container, className, children, ...props }: DialogPrimitive.Popup.Props & VariantProps<typeof drawerPopupVariants> & Pick<DialogPrimitive.Portal.Props, "container">): React.JSX.Element;
|
|
164
|
+
/**
|
|
165
|
+
* The title row, with the close affordance built in.
|
|
166
|
+
*
|
|
167
|
+
* The part of #214 that is not geometry. All eight copies lay this row out
|
|
168
|
+
* themselves and the newest had to pick its own close-button size, so the header
|
|
169
|
+
* owns the arrangement: the title on the left, the close glyph top right at the
|
|
170
|
+
* library's own icon rung, an optional description under it, and `children` for
|
|
171
|
+
* the identity row the frames draw in that slot (the secret's key, the record's
|
|
172
|
+
* collection and status chip, the wizard's step strip).
|
|
173
|
+
*
|
|
174
|
+
* `aria-labelledby` needs no wiring: `DrawerTitle` is Base UI's `Dialog.Title`,
|
|
175
|
+
* which registers its own id on the popup. Passing `title` rather than leaving it
|
|
176
|
+
* to the caller is what guarantees every drawer has one.
|
|
177
|
+
*/
|
|
178
|
+
declare function DrawerHeader({ title, description, closeLabel, showCloseButton, className, children, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
179
|
+
title: React.ReactNode;
|
|
180
|
+
description?: React.ReactNode;
|
|
181
|
+
/** The close button's accessible name. "Close user details" beats "Close". */
|
|
182
|
+
closeLabel?: string;
|
|
183
|
+
showCloseButton?: boolean;
|
|
184
|
+
}): React.JSX.Element;
|
|
185
|
+
/**
|
|
186
|
+
* The scrolling half.
|
|
187
|
+
*
|
|
188
|
+
* `min-h-0` is load-bearing and invisible: a flex child's default `min-height` is
|
|
189
|
+
* `auto`, so without it the body refuses to shrink below its content and the
|
|
190
|
+
* whole sheet grows past the viewport instead of scrolling inside itself. The
|
|
191
|
+
* footer then leaves the screen, which is the one thing a pinned footer must not
|
|
192
|
+
* do.
|
|
193
|
+
*/
|
|
194
|
+
declare function DrawerBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
195
|
+
/**
|
|
196
|
+
* The pinned half.
|
|
197
|
+
*
|
|
198
|
+
* `shrink-0` keeps it out of the scroll. It carries a hairline where the header
|
|
199
|
+
* does not: the frames draw neither, but the header sits above content that
|
|
200
|
+
* starts at the top of the sheet while the footer sits above content that has
|
|
201
|
+
* been scrolled under it, and a pinned bar with nothing between it and moving
|
|
202
|
+
* text reads as part of the text.
|
|
203
|
+
*/
|
|
204
|
+
declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
205
|
+
declare function DrawerTitle({ className, ...props }: DialogPrimitive.Title.Props): React.JSX.Element;
|
|
206
|
+
declare function DrawerDescription({ className, ...props }: DialogPrimitive.Description.Props): React.JSX.Element;
|
|
207
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, drawerPopupVariants, drawerViewportVariants, };
|
|
208
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/ui/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwHG;AAEH;;;;;;;GAOG;AACH,QAAA,MAAM,sBAAsB;;8EAW1B,CAAA;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,mBAAmB;;;8EAmCxB,CAAA;AAED,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,qBAEvD;AAED,iBAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,qBAEjE;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,qBAE/D;AAED,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,qBAE7D;A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