@nationaldesignstudio/react 0.6.0 → 0.7.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/accordion/index.d.ts +95 -0
- package/dist/accordion/index.js +143 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/background/index.d.ts +149 -0
- package/dist/background/index.js +200 -0
- package/dist/background/index.js.map +1 -0
- package/dist/banner/index.d.ts +101 -0
- package/dist/banner/index.js +81 -0
- package/dist/banner/index.js.map +1 -0
- package/dist/blurred-video-backdrop/index.d.ts +233 -0
- package/dist/blurred-video-backdrop/index.js +266 -0
- package/dist/blurred-video-backdrop/index.js.map +1 -0
- package/dist/button/index.d.ts +180 -0
- package/dist/button/index.js +169 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button-B2g5fH9b.d.ts +152 -0
- package/dist/card/index.d.ts +406 -0
- package/dist/card/index.js +219 -0
- package/dist/card/index.js.map +1 -0
- package/dist/card-grid/index.d.ts +90 -0
- package/dist/card-grid/index.js +74 -0
- package/dist/card-grid/index.js.map +1 -0
- package/dist/component-registry.md +136 -2
- package/dist/dev-toolbar/index.d.ts +8 -0
- package/dist/dev-toolbar/index.js +206 -0
- package/dist/dev-toolbar/index.js.map +1 -0
- package/dist/dialog/index.d.ts +268 -0
- package/dist/dialog/index.js +288 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/faq-section/index.d.ts +47 -0
- package/dist/faq-section/index.js +152 -0
- package/dist/faq-section/index.js.map +1 -0
- package/dist/grid-overlay/index.d.ts +10 -0
- package/dist/grid-overlay/index.js +38 -0
- package/dist/grid-overlay/index.js.map +1 -0
- package/dist/hero/index.d.ts +462 -0
- package/dist/hero/index.js +494 -0
- package/dist/hero/index.js.map +1 -0
- package/dist/hooks/index.d.ts +150 -0
- package/dist/hooks/index.js +339 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +46 -5339
- package/dist/index.js +157 -4080
- package/dist/index.js.map +1 -1
- package/dist/input/index.d.ts +404 -0
- package/dist/input/index.js +393 -0
- package/dist/input/index.js.map +1 -0
- package/dist/navbar/index.d.ts +68 -0
- package/dist/navbar/index.js +227 -0
- package/dist/navbar/index.js.map +1 -0
- package/dist/ndstudio-footer/index.d.ts +32 -0
- package/dist/ndstudio-footer/index.js +35 -0
- package/dist/ndstudio-footer/index.js.map +1 -0
- package/dist/pager-control/index.d.ts +173 -0
- package/dist/pager-control/index.js +267 -0
- package/dist/pager-control/index.js.map +1 -0
- package/dist/popover/index.d.ts +200 -0
- package/dist/popover/index.js +290 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/prose/index.d.ts +39 -0
- package/dist/prose/index.js +56 -0
- package/dist/prose/index.js.map +1 -0
- package/dist/quote-block/index.d.ts +156 -0
- package/dist/quote-block/index.js +321 -0
- package/dist/quote-block/index.js.map +1 -0
- package/dist/river/index.d.ts +100 -0
- package/dist/river/index.js +107 -0
- package/dist/river/index.js.map +1 -0
- package/dist/select/index.d.ts +188 -0
- package/dist/select/index.js +295 -0
- package/dist/select/index.js.map +1 -0
- package/dist/theme/index.d.ts +149 -0
- package/dist/theme/index.js +211 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme-CzBPUlh_.d.ts +332 -0
- package/dist/tooltip/index.d.ts +166 -0
- package/dist/tooltip/index.js +200 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/tout/index.d.ts +157 -0
- package/dist/tout/index.js +315 -0
- package/dist/tout/index.js.map +1 -0
- package/dist/two-column-section/index.d.ts +122 -0
- package/dist/two-column-section/index.js +121 -0
- package/dist/two-column-section/index.js.map +1 -0
- package/dist/us-gov-banner/index.d.ts +141 -0
- package/dist/us-gov-banner/index.js +74 -0
- package/dist/us-gov-banner/index.js.map +1 -0
- package/dist/use-captions-AkKlJhov.d.ts +71 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/video-dialog/index.d.ts +106 -0
- package/dist/video-dialog/index.js +1305 -0
- package/dist/video-dialog/index.js.map +1 -0
- package/dist/video-player/index.d.ts +115 -0
- package/dist/video-player/index.js +879 -0
- package/dist/video-player/index.js.map +1 -0
- package/dist/video-player-qxf-BURH.d.ts +236 -0
- package/dist/video-with-backdrop/index.d.ts +267 -0
- package/dist/video-with-backdrop/index.js +1284 -0
- package/dist/video-with-backdrop/index.js.map +1 -0
- package/package.json +13 -2
- package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +5 -27
- package/src/theme/hooks.ts +2 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/theme-provider.tsx +2 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { VariantProps } from 'tailwind-variants';
|
|
4
|
+
import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
|
|
5
|
+
import { Dialog as Dialog$1 } from '@base-ui-components/react/dialog';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Dialog backdrop variants
|
|
10
|
+
*
|
|
11
|
+
* Semi-transparent overlay behind the dialog content.
|
|
12
|
+
*/
|
|
13
|
+
declare const dialogBackdropVariants: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], tailwind_variants_dist_config_js.TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
14
|
+
/**
|
|
15
|
+
* Dialog popup variants
|
|
16
|
+
*
|
|
17
|
+
* Uses semantic overlay tokens for themeable styling:
|
|
18
|
+
* - color.overlay.background - Light background
|
|
19
|
+
* - color.overlay.border - Subtle border
|
|
20
|
+
* - color.overlay.text - Primary text
|
|
21
|
+
* - surface.overlay.radius - Rounded corners
|
|
22
|
+
*/
|
|
23
|
+
declare const dialogPopupVariants: tailwind_variants.TVReturnType<{
|
|
24
|
+
size: {
|
|
25
|
+
sm: string;
|
|
26
|
+
md: string;
|
|
27
|
+
lg: string;
|
|
28
|
+
xl: string;
|
|
29
|
+
full: string;
|
|
30
|
+
};
|
|
31
|
+
variant: {
|
|
32
|
+
default: string[];
|
|
33
|
+
minimal: string[];
|
|
34
|
+
};
|
|
35
|
+
}, undefined, string[], tailwind_variants_dist_config_js.TVConfig<{
|
|
36
|
+
size: {
|
|
37
|
+
sm: string;
|
|
38
|
+
md: string;
|
|
39
|
+
lg: string;
|
|
40
|
+
xl: string;
|
|
41
|
+
full: string;
|
|
42
|
+
};
|
|
43
|
+
variant: {
|
|
44
|
+
default: string[];
|
|
45
|
+
minimal: string[];
|
|
46
|
+
};
|
|
47
|
+
}, {
|
|
48
|
+
size: {
|
|
49
|
+
sm: string;
|
|
50
|
+
md: string;
|
|
51
|
+
lg: string;
|
|
52
|
+
xl: string;
|
|
53
|
+
full: string;
|
|
54
|
+
};
|
|
55
|
+
variant: {
|
|
56
|
+
default: string[];
|
|
57
|
+
minimal: string[];
|
|
58
|
+
};
|
|
59
|
+
}>, {
|
|
60
|
+
size: {
|
|
61
|
+
sm: string;
|
|
62
|
+
md: string;
|
|
63
|
+
lg: string;
|
|
64
|
+
xl: string;
|
|
65
|
+
full: string;
|
|
66
|
+
};
|
|
67
|
+
variant: {
|
|
68
|
+
default: string[];
|
|
69
|
+
minimal: string[];
|
|
70
|
+
};
|
|
71
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
72
|
+
size: {
|
|
73
|
+
sm: string;
|
|
74
|
+
md: string;
|
|
75
|
+
lg: string;
|
|
76
|
+
xl: string;
|
|
77
|
+
full: string;
|
|
78
|
+
};
|
|
79
|
+
variant: {
|
|
80
|
+
default: string[];
|
|
81
|
+
minimal: string[];
|
|
82
|
+
};
|
|
83
|
+
}, undefined, string[], tailwind_variants_dist_config_js.TVConfig<{
|
|
84
|
+
size: {
|
|
85
|
+
sm: string;
|
|
86
|
+
md: string;
|
|
87
|
+
lg: string;
|
|
88
|
+
xl: string;
|
|
89
|
+
full: string;
|
|
90
|
+
};
|
|
91
|
+
variant: {
|
|
92
|
+
default: string[];
|
|
93
|
+
minimal: string[];
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
size: {
|
|
97
|
+
sm: string;
|
|
98
|
+
md: string;
|
|
99
|
+
lg: string;
|
|
100
|
+
xl: string;
|
|
101
|
+
full: string;
|
|
102
|
+
};
|
|
103
|
+
variant: {
|
|
104
|
+
default: string[];
|
|
105
|
+
minimal: string[];
|
|
106
|
+
};
|
|
107
|
+
}>, unknown, unknown, undefined>>;
|
|
108
|
+
interface DialogRootProps extends Dialog$1.Root.Props {
|
|
109
|
+
children: React.ReactNode;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Dialog Root
|
|
113
|
+
*
|
|
114
|
+
* Groups all dialog parts and manages open/close state.
|
|
115
|
+
* Provides focus trap, scroll lock, and escape key handling automatically.
|
|
116
|
+
*/
|
|
117
|
+
declare const DialogRoot: ({ children, ...props }: DialogRootProps) => react_jsx_runtime.JSX.Element;
|
|
118
|
+
interface DialogTriggerProps extends React.ComponentProps<typeof Dialog$1.Trigger> {
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Dialog Trigger
|
|
123
|
+
*
|
|
124
|
+
* The element that triggers the dialog to open on click.
|
|
125
|
+
* When children is a single React element, uses `render` prop to avoid wrapper element.
|
|
126
|
+
*/
|
|
127
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<DialogTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
128
|
+
interface DialogPortalProps extends Dialog$1.Portal.Props {
|
|
129
|
+
children: React.ReactNode;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Dialog Portal
|
|
133
|
+
*
|
|
134
|
+
* Renders the dialog in a portal outside the DOM hierarchy.
|
|
135
|
+
* This ensures proper stacking context and avoids z-index issues.
|
|
136
|
+
*/
|
|
137
|
+
declare const DialogPortal: ({ children, ...props }: DialogPortalProps) => react_jsx_runtime.JSX.Element;
|
|
138
|
+
interface DialogBackdropProps extends Omit<React.ComponentProps<typeof Dialog$1.Backdrop>, "className"> {
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Dialog Backdrop
|
|
143
|
+
*
|
|
144
|
+
* Semi-transparent overlay that covers the page behind the dialog.
|
|
145
|
+
* Clicking the backdrop closes the dialog by default.
|
|
146
|
+
*/
|
|
147
|
+
declare const DialogBackdrop: React.ForwardRefExoticComponent<Omit<DialogBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
148
|
+
interface DialogPopupProps extends Omit<React.ComponentProps<typeof Dialog$1.Popup>, "className">, VariantProps<typeof dialogPopupVariants> {
|
|
149
|
+
className?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Dialog Popup
|
|
153
|
+
*
|
|
154
|
+
* The dialog content container. Centered on screen with configurable size.
|
|
155
|
+
* Use `variant="minimal"` for borderless dialogs (video modals, etc.)
|
|
156
|
+
*/
|
|
157
|
+
declare const DialogPopup: React.ForwardRefExoticComponent<Omit<DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
158
|
+
interface DialogTitleProps extends Omit<React.ComponentProps<typeof Dialog$1.Title>, "className"> {
|
|
159
|
+
className?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Dialog Title
|
|
163
|
+
*
|
|
164
|
+
* Accessible title for the dialog. Should be used for screen reader support.
|
|
165
|
+
*/
|
|
166
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
167
|
+
interface DialogDescriptionProps extends Omit<React.ComponentProps<typeof Dialog$1.Description>, "className"> {
|
|
168
|
+
className?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Dialog Description
|
|
172
|
+
*
|
|
173
|
+
* Accessible description for the dialog content.
|
|
174
|
+
*/
|
|
175
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
176
|
+
interface DialogCloseProps extends Omit<React.ComponentProps<typeof Dialog$1.Close>, "className"> {
|
|
177
|
+
className?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Dialog Close
|
|
181
|
+
*
|
|
182
|
+
* Close button for the dialog. Can be placed anywhere within the dialog.
|
|
183
|
+
*/
|
|
184
|
+
declare const DialogClose: React.ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
185
|
+
interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Dialog Body
|
|
190
|
+
*
|
|
191
|
+
* Container for the main dialog content. Handles overflow scrolling.
|
|
192
|
+
*/
|
|
193
|
+
declare const DialogBody: React.ForwardRefExoticComponent<DialogBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
194
|
+
interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
195
|
+
className?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Dialog Footer
|
|
199
|
+
*
|
|
200
|
+
* Container for dialog actions (buttons, etc.). Typically placed at the bottom.
|
|
201
|
+
*/
|
|
202
|
+
declare const DialogFooter: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
203
|
+
interface DialogProps {
|
|
204
|
+
/** The content to show in the dialog */
|
|
205
|
+
children: React.ReactNode;
|
|
206
|
+
/** The element that triggers the dialog (optional for controlled mode) */
|
|
207
|
+
trigger?: React.ReactNode;
|
|
208
|
+
/** Title for the dialog */
|
|
209
|
+
title?: React.ReactNode;
|
|
210
|
+
/** Description for the dialog */
|
|
211
|
+
description?: React.ReactNode;
|
|
212
|
+
/** Size of the dialog */
|
|
213
|
+
size?: "sm" | "md" | "lg" | "xl" | "full";
|
|
214
|
+
/** Visual variant: "default" for card style, "minimal" for borderless (video modals) */
|
|
215
|
+
variant?: "default" | "minimal";
|
|
216
|
+
/** Whether to show a close button */
|
|
217
|
+
showClose?: boolean;
|
|
218
|
+
/** Controlled open state */
|
|
219
|
+
open?: boolean;
|
|
220
|
+
/** Default open state */
|
|
221
|
+
defaultOpen?: boolean;
|
|
222
|
+
/** Callback when open state changes */
|
|
223
|
+
onOpenChange?: (open: boolean) => void;
|
|
224
|
+
/** Additional className for the popup */
|
|
225
|
+
className?: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Dialog
|
|
229
|
+
*
|
|
230
|
+
* A simple, pre-composed dialog component for common use cases.
|
|
231
|
+
* For more complex needs, use the compound components directly.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```tsx
|
|
235
|
+
* // With trigger
|
|
236
|
+
* <Dialog
|
|
237
|
+
* trigger={<Button>Open Dialog</Button>}
|
|
238
|
+
* title="Dialog Title"
|
|
239
|
+
* description="This is the dialog description."
|
|
240
|
+
* >
|
|
241
|
+
* <p>Dialog content goes here.</p>
|
|
242
|
+
* </Dialog>
|
|
243
|
+
*
|
|
244
|
+
* // Controlled mode
|
|
245
|
+
* <Dialog
|
|
246
|
+
* open={isOpen}
|
|
247
|
+
* onOpenChange={setIsOpen}
|
|
248
|
+
* title="Controlled Dialog"
|
|
249
|
+
* >
|
|
250
|
+
* <p>Content here</p>
|
|
251
|
+
* </Dialog>
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare const Dialog: ({ children, trigger, title, description, size, variant, showClose, open, defaultOpen, onOpenChange, className, }: DialogProps) => react_jsx_runtime.JSX.Element;
|
|
255
|
+
declare const DialogParts: (({ children, ...props }: DialogRootProps) => react_jsx_runtime.JSX.Element) & {
|
|
256
|
+
Root: ({ children, ...props }: DialogRootProps) => react_jsx_runtime.JSX.Element;
|
|
257
|
+
Trigger: React.ForwardRefExoticComponent<Omit<DialogTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
258
|
+
Portal: ({ children, ...props }: DialogPortalProps) => react_jsx_runtime.JSX.Element;
|
|
259
|
+
Backdrop: React.ForwardRefExoticComponent<Omit<DialogBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
260
|
+
Popup: React.ForwardRefExoticComponent<Omit<DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
261
|
+
Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
262
|
+
Description: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
263
|
+
Close: React.ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
264
|
+
Body: React.ForwardRefExoticComponent<DialogBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
265
|
+
Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export { Dialog, DialogBackdrop, type DialogBackdropProps, DialogBody, type DialogBodyProps, DialogClose, type DialogCloseProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogParts, DialogPopup, type DialogPopupProps, DialogPortal, type DialogPortalProps, type DialogProps, DialogRoot, type DialogRootProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, dialogBackdropVariants, dialogPopupVariants };
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Dialog as Dialog$1 } from '@base-ui-components/react/dialog';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { tv, cnBase } from 'tailwind-variants';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/components/molecules/dialog/dialog.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return cnBase(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var dialogBackdropVariants = tv({
|
|
13
|
+
base: [
|
|
14
|
+
// Fixed positioning to cover viewport
|
|
15
|
+
"fixed inset-0",
|
|
16
|
+
// Semi-transparent black background using alpha token
|
|
17
|
+
"bg-alpha-black-50",
|
|
18
|
+
// Smooth opacity transition
|
|
19
|
+
"transition-opacity duration-200",
|
|
20
|
+
// Animation states
|
|
21
|
+
"data-[starting-style]:opacity-0",
|
|
22
|
+
"data-[ending-style]:opacity-0",
|
|
23
|
+
// Ensure backdrop covers full viewport on iOS
|
|
24
|
+
"min-h-dvh"
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
var dialogPopupVariants = tv({
|
|
28
|
+
base: [
|
|
29
|
+
// Fixed positioning, centered
|
|
30
|
+
"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
31
|
+
// Layout
|
|
32
|
+
"flex flex-col",
|
|
33
|
+
// Max dimensions with viewport margin (24px on each side = 48px total)
|
|
34
|
+
"max-h-[calc(100vh-48px)] max-w-[calc(100vw-48px)]",
|
|
35
|
+
// Ensure above backdrop
|
|
36
|
+
"z-50",
|
|
37
|
+
// Animation
|
|
38
|
+
"transition-all duration-200",
|
|
39
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
40
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
41
|
+
// Focus outline
|
|
42
|
+
"outline-none"
|
|
43
|
+
],
|
|
44
|
+
variants: {
|
|
45
|
+
size: {
|
|
46
|
+
sm: "w-full sm:max-w-[400px]",
|
|
47
|
+
md: "w-full sm:max-w-[560px]",
|
|
48
|
+
lg: "w-full sm:max-w-[720px]",
|
|
49
|
+
xl: "w-full sm:max-w-[960px]",
|
|
50
|
+
full: "w-[calc(100vw-48px)] h-[calc(100vh-48px)]"
|
|
51
|
+
},
|
|
52
|
+
variant: {
|
|
53
|
+
default: [
|
|
54
|
+
// Background - uses overlay background token
|
|
55
|
+
"bg-overlay-background",
|
|
56
|
+
// Border - uses overlay border token
|
|
57
|
+
"border border-overlay-border",
|
|
58
|
+
// Text - uses overlay text token
|
|
59
|
+
"text-overlay-text",
|
|
60
|
+
// Border radius - uses surface overlay token
|
|
61
|
+
"rounded-surface-overlay",
|
|
62
|
+
// Shadow for elevation
|
|
63
|
+
"shadow-xl"
|
|
64
|
+
],
|
|
65
|
+
minimal: [
|
|
66
|
+
// Transparent background, no border/shadow
|
|
67
|
+
"bg-black",
|
|
68
|
+
"border-0",
|
|
69
|
+
"text-white",
|
|
70
|
+
"rounded-8",
|
|
71
|
+
"shadow-none",
|
|
72
|
+
"overflow-hidden"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
compoundVariants: [
|
|
77
|
+
// Default variant padding by size
|
|
78
|
+
{ variant: "default", size: "sm", class: "p-24" },
|
|
79
|
+
{ variant: "default", size: "md", class: "p-32" },
|
|
80
|
+
{ variant: "default", size: "lg", class: "p-32" },
|
|
81
|
+
{ variant: "default", size: "xl", class: "p-40" },
|
|
82
|
+
{ variant: "default", size: "full", class: "p-40" },
|
|
83
|
+
// Minimal variant has no padding
|
|
84
|
+
{ variant: "minimal", size: "sm", class: "p-0" },
|
|
85
|
+
{ variant: "minimal", size: "md", class: "p-0" },
|
|
86
|
+
{ variant: "minimal", size: "lg", class: "p-0" },
|
|
87
|
+
{ variant: "minimal", size: "xl", class: "p-0" },
|
|
88
|
+
{ variant: "minimal", size: "full", class: "p-0" }
|
|
89
|
+
],
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
size: "md",
|
|
92
|
+
variant: "default"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
var DialogRoot = ({ children, ...props }) => {
|
|
96
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, { ...props, children });
|
|
97
|
+
};
|
|
98
|
+
var DialogTrigger = React.forwardRef(
|
|
99
|
+
({ className, children, ...props }, ref) => {
|
|
100
|
+
const isSingleElement = React.isValidElement(children);
|
|
101
|
+
if (isSingleElement) {
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
Dialog$1.Trigger,
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
className,
|
|
107
|
+
render: children,
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ref, className, ...props, children });
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
116
|
+
var DialogPortal = ({ children, ...props }) => {
|
|
117
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, { ...props, children });
|
|
118
|
+
};
|
|
119
|
+
var DialogBackdrop = React.forwardRef(
|
|
120
|
+
({ className, ...props }, ref) => {
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
Dialog$1.Backdrop,
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
className: cn(dialogBackdropVariants(), className),
|
|
126
|
+
...props
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
DialogBackdrop.displayName = "DialogBackdrop";
|
|
132
|
+
var DialogPopup = React.forwardRef(
|
|
133
|
+
({ className, size, variant, ...props }, ref) => {
|
|
134
|
+
return /* @__PURE__ */ jsx(
|
|
135
|
+
Dialog$1.Popup,
|
|
136
|
+
{
|
|
137
|
+
ref,
|
|
138
|
+
className: cn(dialogPopupVariants({ size, variant }), className),
|
|
139
|
+
...props
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
DialogPopup.displayName = "DialogPopup";
|
|
145
|
+
var DialogTitle = React.forwardRef(
|
|
146
|
+
({ className, ...props }, ref) => {
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
Dialog$1.Title,
|
|
149
|
+
{
|
|
150
|
+
ref,
|
|
151
|
+
className: cn("typography-h4-md font-semibold mb-8", className),
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
DialogTitle.displayName = "DialogTitle";
|
|
158
|
+
var DialogDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
Dialog$1.Description,
|
|
161
|
+
{
|
|
162
|
+
ref,
|
|
163
|
+
className: cn("typography-body-md-md text-overlay-text-muted", className),
|
|
164
|
+
...props
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
DialogDescription.displayName = "DialogDescription";
|
|
169
|
+
var DialogClose = React.forwardRef(
|
|
170
|
+
({ className, ...props }, ref) => {
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
Dialog$1.Close,
|
|
173
|
+
{
|
|
174
|
+
ref,
|
|
175
|
+
className: cn(
|
|
176
|
+
"absolute right-16 top-16 rounded-surface-ui-small p-8",
|
|
177
|
+
"text-overlay-text-muted hover:text-overlay-text",
|
|
178
|
+
"hover:bg-bg-section",
|
|
179
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
180
|
+
"transition-colors duration-150",
|
|
181
|
+
className
|
|
182
|
+
),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
DialogClose.displayName = "DialogClose";
|
|
189
|
+
var DialogBody = React.forwardRef(
|
|
190
|
+
({ className, ...props }, ref) => {
|
|
191
|
+
return /* @__PURE__ */ jsx(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
ref,
|
|
195
|
+
className: cn("flex-1 overflow-y-auto", className),
|
|
196
|
+
...props
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
DialogBody.displayName = "DialogBody";
|
|
202
|
+
var DialogFooter = React.forwardRef(
|
|
203
|
+
({ className, ...props }, ref) => {
|
|
204
|
+
return /* @__PURE__ */ jsx(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
ref,
|
|
208
|
+
className: cn(
|
|
209
|
+
"flex items-center justify-end gap-12 pt-24 mt-auto",
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
...props
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
DialogFooter.displayName = "DialogFooter";
|
|
218
|
+
var Dialog = ({
|
|
219
|
+
children,
|
|
220
|
+
trigger,
|
|
221
|
+
title,
|
|
222
|
+
description,
|
|
223
|
+
size = "md",
|
|
224
|
+
variant = "default",
|
|
225
|
+
showClose = true,
|
|
226
|
+
open,
|
|
227
|
+
defaultOpen,
|
|
228
|
+
onOpenChange,
|
|
229
|
+
className
|
|
230
|
+
}) => {
|
|
231
|
+
return /* @__PURE__ */ jsxs(
|
|
232
|
+
DialogRoot,
|
|
233
|
+
{
|
|
234
|
+
open,
|
|
235
|
+
defaultOpen,
|
|
236
|
+
onOpenChange,
|
|
237
|
+
children: [
|
|
238
|
+
trigger && /* @__PURE__ */ jsx(DialogTrigger, { children: trigger }),
|
|
239
|
+
/* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
240
|
+
/* @__PURE__ */ jsx(DialogBackdrop, {}),
|
|
241
|
+
/* @__PURE__ */ jsxs(DialogPopup, { size, variant, className, children: [
|
|
242
|
+
showClose && /* @__PURE__ */ jsxs(DialogClose, { children: [
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
"svg",
|
|
245
|
+
{
|
|
246
|
+
width: "16",
|
|
247
|
+
height: "16",
|
|
248
|
+
viewBox: "0 0 16 16",
|
|
249
|
+
fill: "none",
|
|
250
|
+
"aria-hidden": "true",
|
|
251
|
+
children: /* @__PURE__ */ jsx(
|
|
252
|
+
"path",
|
|
253
|
+
{
|
|
254
|
+
d: "M2 2L14 14M2 14L14 2",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
strokeWidth: "2",
|
|
257
|
+
strokeLinecap: "round"
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
263
|
+
] }),
|
|
264
|
+
title && /* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
265
|
+
description && /* @__PURE__ */ jsx(DialogDescription, { children: description }),
|
|
266
|
+
/* @__PURE__ */ jsx(DialogBody, { children })
|
|
267
|
+
] })
|
|
268
|
+
] })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
var DialogParts = Object.assign(DialogRoot, {
|
|
274
|
+
Root: DialogRoot,
|
|
275
|
+
Trigger: DialogTrigger,
|
|
276
|
+
Portal: DialogPortal,
|
|
277
|
+
Backdrop: DialogBackdrop,
|
|
278
|
+
Popup: DialogPopup,
|
|
279
|
+
Title: DialogTitle,
|
|
280
|
+
Description: DialogDescription,
|
|
281
|
+
Close: DialogClose,
|
|
282
|
+
Body: DialogBody,
|
|
283
|
+
Footer: DialogFooter
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
export { Dialog, DialogBackdrop, DialogBody, DialogClose, DialogDescription, DialogFooter, DialogParts, DialogPopup, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, dialogBackdropVariants, dialogPopupVariants };
|
|
287
|
+
//# sourceMappingURL=index.js.map
|
|
288
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/mol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from \"tailwind-variants\";\n\nexport { twMerge };\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui-components/react/dialog\";\nimport * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Dialog backdrop variants\n *\n * Semi-transparent overlay behind the dialog content.\n */\nconst dialogBackdropVariants = tv({\n\tbase: [\n\t\t// Fixed positioning to cover viewport\n\t\t\"fixed inset-0\",\n\t\t// Semi-transparent black background using alpha token\n\t\t\"bg-alpha-black-50\",\n\t\t// Smooth opacity transition\n\t\t\"transition-opacity duration-200\",\n\t\t// Animation states\n\t\t\"data-[starting-style]:opacity-0\",\n\t\t\"data-[ending-style]:opacity-0\",\n\t\t// Ensure backdrop covers full viewport on iOS\n\t\t\"min-h-dvh\",\n\t],\n});\n\n/**\n * Dialog popup variants\n *\n * Uses semantic overlay tokens for themeable styling:\n * - color.overlay.background - Light background\n * - color.overlay.border - Subtle border\n * - color.overlay.text - Primary text\n * - surface.overlay.radius - Rounded corners\n */\nconst dialogPopupVariants = tv({\n\tbase: [\n\t\t// Fixed positioning, centered\n\t\t\"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2\",\n\t\t// Layout\n\t\t\"flex flex-col\",\n\t\t// Max dimensions with viewport margin (24px on each side = 48px total)\n\t\t\"max-h-[calc(100vh-48px)] max-w-[calc(100vw-48px)]\",\n\t\t// Ensure above backdrop\n\t\t\"z-50\",\n\t\t// Animation\n\t\t\"transition-all duration-200\",\n\t\t\"data-[starting-style]:scale-95 data-[starting-style]:opacity-0\",\n\t\t\"data-[ending-style]:scale-95 data-[ending-style]:opacity-0\",\n\t\t// Focus outline\n\t\t\"outline-none\",\n\t],\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"w-full sm:max-w-[400px]\",\n\t\t\tmd: \"w-full sm:max-w-[560px]\",\n\t\t\tlg: \"w-full sm:max-w-[720px]\",\n\t\t\txl: \"w-full sm:max-w-[960px]\",\n\t\t\tfull: \"w-[calc(100vw-48px)] h-[calc(100vh-48px)]\",\n\t\t},\n\t\tvariant: {\n\t\t\tdefault: [\n\t\t\t\t// Background - uses overlay background token\n\t\t\t\t\"bg-overlay-background\",\n\t\t\t\t// Border - uses overlay border token\n\t\t\t\t\"border border-overlay-border\",\n\t\t\t\t// Text - uses overlay text token\n\t\t\t\t\"text-overlay-text\",\n\t\t\t\t// Border radius - uses surface overlay token\n\t\t\t\t\"rounded-surface-overlay\",\n\t\t\t\t// Shadow for elevation\n\t\t\t\t\"shadow-xl\",\n\t\t\t],\n\t\t\tminimal: [\n\t\t\t\t// Transparent background, no border/shadow\n\t\t\t\t\"bg-black\",\n\t\t\t\t\"border-0\",\n\t\t\t\t\"text-white\",\n\t\t\t\t\"rounded-8\",\n\t\t\t\t\"shadow-none\",\n\t\t\t\t\"overflow-hidden\",\n\t\t\t],\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t// Default variant padding by size\n\t\t{ variant: \"default\", size: \"sm\", class: \"p-24\" },\n\t\t{ variant: \"default\", size: \"md\", class: \"p-32\" },\n\t\t{ variant: \"default\", size: \"lg\", class: \"p-32\" },\n\t\t{ variant: \"default\", size: \"xl\", class: \"p-40\" },\n\t\t{ variant: \"default\", size: \"full\", class: \"p-40\" },\n\t\t// Minimal variant has no padding\n\t\t{ variant: \"minimal\", size: \"sm\", class: \"p-0\" },\n\t\t{ variant: \"minimal\", size: \"md\", class: \"p-0\" },\n\t\t{ variant: \"minimal\", size: \"lg\", class: \"p-0\" },\n\t\t{ variant: \"minimal\", size: \"xl\", class: \"p-0\" },\n\t\t{ variant: \"minimal\", size: \"full\", class: \"p-0\" },\n\t],\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t\tvariant: \"default\",\n\t},\n});\n\n// ============================================================================\n// Dialog Root\n// ============================================================================\n\nexport interface DialogRootProps extends BaseDialog.Root.Props {\n\tchildren: React.ReactNode;\n}\n\n/**\n * Dialog Root\n *\n * Groups all dialog parts and manages open/close state.\n * Provides focus trap, scroll lock, and escape key handling automatically.\n */\nconst DialogRoot = ({ children, ...props }: DialogRootProps) => {\n\treturn <BaseDialog.Root {...props}>{children}</BaseDialog.Root>;\n};\n\n// ============================================================================\n// Dialog Trigger\n// ============================================================================\n\nexport interface DialogTriggerProps\n\textends React.ComponentProps<typeof BaseDialog.Trigger> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Trigger\n *\n * The element that triggers the dialog to open on click.\n * When children is a single React element, uses `render` prop to avoid wrapper element.\n */\nconst DialogTrigger = React.forwardRef<HTMLButtonElement, DialogTriggerProps>(\n\t({ className, children, ...props }, ref) => {\n\t\t// If children is a single React element, use render prop to avoid wrapper\n\t\tconst isSingleElement = React.isValidElement(children);\n\n\t\tif (isSingleElement) {\n\t\t\treturn (\n\t\t\t\t<BaseDialog.Trigger\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\trender={children as React.ReactElement<Record<string, unknown>>}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseDialog.Trigger ref={ref} className={className} {...props}>\n\t\t\t\t{children}\n\t\t\t</BaseDialog.Trigger>\n\t\t);\n\t},\n);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n// ============================================================================\n// Dialog Portal\n// ============================================================================\n\nexport interface DialogPortalProps extends BaseDialog.Portal.Props {\n\tchildren: React.ReactNode;\n}\n\n/**\n * Dialog Portal\n *\n * Renders the dialog in a portal outside the DOM hierarchy.\n * This ensures proper stacking context and avoids z-index issues.\n */\nconst DialogPortal = ({ children, ...props }: DialogPortalProps) => {\n\treturn <BaseDialog.Portal {...props}>{children}</BaseDialog.Portal>;\n};\n\n// ============================================================================\n// Dialog Backdrop\n// ============================================================================\n\nexport interface DialogBackdropProps\n\textends Omit<React.ComponentProps<typeof BaseDialog.Backdrop>, \"className\"> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Backdrop\n *\n * Semi-transparent overlay that covers the page behind the dialog.\n * Clicking the backdrop closes the dialog by default.\n */\nconst DialogBackdrop = React.forwardRef<HTMLDivElement, DialogBackdropProps>(\n\t({ className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<BaseDialog.Backdrop\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(dialogBackdropVariants(), className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogBackdrop.displayName = \"DialogBackdrop\";\n\n// ============================================================================\n// Dialog Popup\n// ============================================================================\n\nexport interface DialogPopupProps\n\textends Omit<React.ComponentProps<typeof BaseDialog.Popup>, \"className\">,\n\t\tVariantProps<typeof dialogPopupVariants> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Popup\n *\n * The dialog content container. Centered on screen with configurable size.\n * Use `variant=\"minimal\"` for borderless dialogs (video modals, etc.)\n */\nconst DialogPopup = React.forwardRef<HTMLDivElement, DialogPopupProps>(\n\t({ className, size, variant, ...props }, ref) => {\n\t\treturn (\n\t\t\t<BaseDialog.Popup\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(dialogPopupVariants({ size, variant }), className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogPopup.displayName = \"DialogPopup\";\n\n// ============================================================================\n// Dialog Title\n// ============================================================================\n\nexport interface DialogTitleProps\n\textends Omit<React.ComponentProps<typeof BaseDialog.Title>, \"className\"> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Title\n *\n * Accessible title for the dialog. Should be used for screen reader support.\n */\nconst DialogTitle = React.forwardRef<HTMLHeadingElement, DialogTitleProps>(\n\t({ className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<BaseDialog.Title\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\"typography-h4-md font-semibold mb-8\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogTitle.displayName = \"DialogTitle\";\n\n// ============================================================================\n// Dialog Description\n// ============================================================================\n\nexport interface DialogDescriptionProps\n\textends Omit<\n\t\tReact.ComponentProps<typeof BaseDialog.Description>,\n\t\t\"className\"\n\t> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Description\n *\n * Accessible description for the dialog content.\n */\nconst DialogDescription = React.forwardRef<\n\tHTMLParagraphElement,\n\tDialogDescriptionProps\n>(({ className, ...props }, ref) => {\n\treturn (\n\t\t<BaseDialog.Description\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"typography-body-md-md text-overlay-text-muted\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nDialogDescription.displayName = \"DialogDescription\";\n\n// ============================================================================\n// Dialog Close\n// ============================================================================\n\nexport interface DialogCloseProps\n\textends Omit<React.ComponentProps<typeof BaseDialog.Close>, \"className\"> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Close\n *\n * Close button for the dialog. Can be placed anywhere within the dialog.\n */\nconst DialogClose = React.forwardRef<HTMLButtonElement, DialogCloseProps>(\n\t({ className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<BaseDialog.Close\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"absolute right-16 top-16 rounded-surface-ui-small p-8\",\n\t\t\t\t\t\"text-overlay-text-muted hover:text-overlay-text\",\n\t\t\t\t\t\"hover:bg-bg-section\",\n\t\t\t\t\t\"focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\",\n\t\t\t\t\t\"transition-colors duration-150\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogClose.displayName = \"DialogClose\";\n\n// ============================================================================\n// Dialog Body\n// ============================================================================\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Body\n *\n * Container for the main dialog content. Handles overflow scrolling.\n */\nconst DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n\t({ className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\"flex-1 overflow-y-auto\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogBody.displayName = \"DialogBody\";\n\n// ============================================================================\n// Dialog Footer\n// ============================================================================\n\nexport interface DialogFooterProps\n\textends React.HTMLAttributes<HTMLDivElement> {\n\tclassName?: string;\n}\n\n/**\n * Dialog Footer\n *\n * Container for dialog actions (buttons, etc.). Typically placed at the bottom.\n */\nconst DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n\t({ className, ...props }, ref) => {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex items-center justify-end gap-12 pt-24 mt-auto\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nDialogFooter.displayName = \"DialogFooter\";\n\n// ============================================================================\n// Simple Dialog Component\n// ============================================================================\n\nexport interface DialogProps {\n\t/** The content to show in the dialog */\n\tchildren: React.ReactNode;\n\t/** The element that triggers the dialog (optional for controlled mode) */\n\ttrigger?: React.ReactNode;\n\t/** Title for the dialog */\n\ttitle?: React.ReactNode;\n\t/** Description for the dialog */\n\tdescription?: React.ReactNode;\n\t/** Size of the dialog */\n\tsize?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\t/** Visual variant: \"default\" for card style, \"minimal\" for borderless (video modals) */\n\tvariant?: \"default\" | \"minimal\";\n\t/** Whether to show a close button */\n\tshowClose?: boolean;\n\t/** Controlled open state */\n\topen?: boolean;\n\t/** Default open state */\n\tdefaultOpen?: boolean;\n\t/** Callback when open state changes */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Additional className for the popup */\n\tclassName?: string;\n}\n\n/**\n * Dialog\n *\n * A simple, pre-composed dialog component for common use cases.\n * For more complex needs, use the compound components directly.\n *\n * @example\n * ```tsx\n * // With trigger\n * <Dialog\n * trigger={<Button>Open Dialog</Button>}\n * title=\"Dialog Title\"\n * description=\"This is the dialog description.\"\n * >\n * <p>Dialog content goes here.</p>\n * </Dialog>\n *\n * // Controlled mode\n * <Dialog\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * title=\"Controlled Dialog\"\n * >\n * <p>Content here</p>\n * </Dialog>\n * ```\n */\nconst Dialog = ({\n\tchildren,\n\ttrigger,\n\ttitle,\n\tdescription,\n\tsize = \"md\",\n\tvariant = \"default\",\n\tshowClose = true,\n\topen,\n\tdefaultOpen,\n\tonOpenChange,\n\tclassName,\n}: DialogProps) => {\n\treturn (\n\t\t<DialogRoot\n\t\t\topen={open}\n\t\t\tdefaultOpen={defaultOpen}\n\t\t\tonOpenChange={onOpenChange}\n\t\t>\n\t\t\t{trigger && <DialogTrigger>{trigger}</DialogTrigger>}\n\t\t\t<DialogPortal>\n\t\t\t\t<DialogBackdrop />\n\t\t\t\t<DialogPopup size={size} variant={variant} className={className}>\n\t\t\t\t\t{showClose && (\n\t\t\t\t\t\t<DialogClose>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M2 2L14 14M2 14L14 2\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t\t</DialogClose>\n\t\t\t\t\t)}\n\t\t\t\t\t{title && <DialogTitle>{title}</DialogTitle>}\n\t\t\t\t\t{description && <DialogDescription>{description}</DialogDescription>}\n\t\t\t\t\t<DialogBody>{children}</DialogBody>\n\t\t\t\t</DialogPopup>\n\t\t\t</DialogPortal>\n\t\t</DialogRoot>\n\t);\n};\n\n// ============================================================================\n// Compound Component Export\n// ============================================================================\n\nexport const DialogParts = Object.assign(DialogRoot, {\n\tRoot: DialogRoot,\n\tTrigger: DialogTrigger,\n\tPortal: DialogPortal,\n\tBackdrop: DialogBackdrop,\n\tPopup: DialogPopup,\n\tTitle: DialogTitle,\n\tDescription: DialogDescription,\n\tClose: DialogClose,\n\tBody: DialogBody,\n\tFooter: DialogFooter,\n});\n\nexport {\n\tDialog,\n\tDialogRoot,\n\tDialogTrigger,\n\tDialogPortal,\n\tDialogBackdrop,\n\tDialogPopup,\n\tDialogTitle,\n\tDialogDescription,\n\tDialogClose,\n\tDialogBody,\n\tDialogFooter,\n\tdialogBackdropVariants,\n\tdialogPopupVariants,\n};\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import { twoColumnSectionVariants } from '../two-column-section/index.js';
|
|
4
|
+
import 'tailwind-variants/dist/config.js';
|
|
5
|
+
|
|
6
|
+
interface FaqSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, "title">, VariantProps<typeof twoColumnSectionVariants> {
|
|
7
|
+
/**
|
|
8
|
+
* The title text displayed in the left column
|
|
9
|
+
* @default "Frequently Asked Questions"
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The FAQ content - typically an Accordion with AccordionItems
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* FaqSection component for displaying FAQ content in a two-column layout.
|
|
19
|
+
*
|
|
20
|
+
* Wraps TwoColumnSection with FAQ-specific defaults and typography.
|
|
21
|
+
*
|
|
22
|
+
* Layout:
|
|
23
|
+
* - Mobile/Tablet: Stacked (title above content)
|
|
24
|
+
* - Desktop (lg+): Title left (~40%), FAQ content right (~60%)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <FaqSection>
|
|
29
|
+
* <Accordion defaultExpanded="faq-1">
|
|
30
|
+
* <AccordionItem id="faq-1" title="What is the US Tech Force?">
|
|
31
|
+
* Tech Force will be an elite group of technology specialists...
|
|
32
|
+
* </AccordionItem>
|
|
33
|
+
* <AccordionItem id="faq-2" title="What skills are required?">
|
|
34
|
+
* We're looking for expertise in software engineering...
|
|
35
|
+
* </AccordionItem>
|
|
36
|
+
* </Accordion>
|
|
37
|
+
* </FaqSection>
|
|
38
|
+
*
|
|
39
|
+
* // With custom title
|
|
40
|
+
* <FaqSection title="Common Questions" colorScheme="light">
|
|
41
|
+
* ...
|
|
42
|
+
* </FaqSection>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const FaqSection: React.ForwardRefExoticComponent<FaqSectionProps & React.RefAttributes<HTMLElement>>;
|
|
46
|
+
|
|
47
|
+
export { FaqSection, type FaqSectionProps };
|