@brightlocal/ui-components 0.1.1 → 0.1.3
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.cjs +1 -1
- package/dist/accordion.d.ts +74 -4
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +100 -105
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +30 -10
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +129 -132
- package/dist/alert.d.ts +22 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.d.ts +11 -1
- package/dist/aspect-ratio.d.ts.map +1 -1
- package/dist/aspect-ratio.js +16 -20
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.d.ts +43 -3
- package/dist/avatar.d.ts.map +1 -1
- package/dist/avatar.js +18 -16
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +24 -9
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +34 -32
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +209 -202
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +154 -154
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +63 -8
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +97 -93
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +17 -45
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +49 -50
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +12 -0
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +10 -8
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +58 -18
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +60 -51
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +99 -9
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +142 -128
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +18 -2
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +46 -33
- package/dist/chart.cjs +4 -4
- package/dist/chart.d.ts +70 -7
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +71 -66
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +9 -5
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +61 -82
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts +65 -8
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +41 -55
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +29 -11
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +193 -159
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +115 -9
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +176 -152
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +188 -20
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +119 -121
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +75 -9
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +220 -81
- package/dist/description.cjs +1 -0
- package/dist/description.d.ts +37 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +25 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +73 -9
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +103 -112
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +92 -0
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +67 -52
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +95 -11
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +146 -106
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +23 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +54 -53
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +27 -17
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +86 -79
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +36 -6
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +44 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +383 -387
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +21 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +51 -41
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +24 -25
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts +38 -24
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +68 -136
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts +20 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +31 -18
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +3 -0
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +12 -10
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +40 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +97 -76
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +59 -4
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +42 -34
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +9 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +71 -59
- package/dist/radio-group.d.ts +40 -0
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/rating.d.ts +4 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +65 -4
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +53 -36
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +46 -5
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +42 -38
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +30 -0
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +64 -54
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +49 -2
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +48 -36
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +80 -9
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -113
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +24 -2
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +15 -9
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +18 -4
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +72 -66
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +4 -2
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +29 -28
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.d.ts +3 -1
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +38 -36
- package/package.json +8 -2
- package/src/blocks/data-table.tsx +42 -32
- package/src/blocks/sidebar.tsx +4 -12
- package/src/components/accordion.tsx +163 -77
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +26 -13
- package/src/components/aspect-ratio.tsx +25 -16
- package/src/components/avatar.tsx +56 -8
- package/src/components/badge.tsx +65 -42
- package/src/components/breadcrumb.tsx +158 -82
- package/src/components/button.tsx +41 -62
- package/src/components/calendar.tsx +16 -2
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +67 -35
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +42 -78
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +242 -144
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +278 -81
- package/src/components/date-picker.tsx +281 -30
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +162 -86
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +36 -11
- package/src/components/global-layout.tsx +116 -77
- package/src/components/hover-card.tsx +54 -14
- package/src/components/input-group.tsx +56 -18
- package/src/components/input-password.tsx +3 -4
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/logo.tsx +3 -0
- package/src/components/menubar.tsx +58 -4
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +40 -0
- package/src/components/rating.tsx +4 -1
- package/src/components/resizable.tsx +119 -31
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +21 -1
- package/src/components/separator.tsx +97 -20
- package/src/components/sheet.tsx +180 -79
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +10 -7
- package/src/components/split-layout.tsx +4 -1
- package/src/components/table.tsx +1 -1
- package/src/components/toggle-group.tsx +4 -0
- package/src/index.ts +1 -1
- package/dist/input-base.cjs +0 -1
- package/dist/input-base.d.ts +0 -28
- package/dist/input-base.d.ts.map +0 -1
- package/dist/input-base.js +0 -56
- package/src/components/input-base.tsx +0 -86
|
@@ -6,66 +6,121 @@ import { XIcon } from "lucide-react";
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Dialog - Root component for modal dialogs
|
|
11
|
+
* @description Wraps content in a modal dialog that overlays the main content
|
|
12
|
+
*/
|
|
13
|
+
const Dialog = DialogPrimitive.Root;
|
|
14
|
+
Dialog.displayName = "Dialog";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Props for DialogTrigger component
|
|
18
|
+
*/
|
|
19
|
+
interface DialogTriggerProps extends React.ComponentProps<
|
|
20
|
+
typeof DialogPrimitive.Trigger
|
|
21
|
+
> {
|
|
22
|
+
/**
|
|
23
|
+
* Data hook for automated testing
|
|
24
|
+
*/
|
|
25
|
+
dataHook?: string;
|
|
19
26
|
}
|
|
20
27
|
|
|
28
|
+
/**
|
|
29
|
+
* DialogTrigger - Button or element that opens the dialog
|
|
30
|
+
* @description Wraps an interactive element that toggles the dialog open state
|
|
31
|
+
*/
|
|
32
|
+
const DialogTrigger = React.forwardRef<
|
|
33
|
+
React.ComponentRef<typeof DialogPrimitive.Trigger>,
|
|
34
|
+
DialogTriggerProps
|
|
35
|
+
>(({ dataHook, ...props }, ref) => (
|
|
36
|
+
<DialogPrimitive.Trigger
|
|
37
|
+
ref={ref}
|
|
38
|
+
data-hook={dataHook}
|
|
39
|
+
data-slot="dialog-trigger"
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
));
|
|
43
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* DialogPortal - Portal for rendering dialog outside of DOM hierarchy
|
|
47
|
+
* @description Renders dialog content in a React portal
|
|
48
|
+
*/
|
|
21
49
|
function DialogPortal({
|
|
22
50
|
...props
|
|
23
51
|
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
24
|
-
return <DialogPrimitive.Portal
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function DialogClose({
|
|
28
|
-
...props
|
|
29
|
-
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
30
|
-
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function DialogOverlay({
|
|
34
|
-
className,
|
|
35
|
-
...props
|
|
36
|
-
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
37
|
-
return (
|
|
38
|
-
<DialogPrimitive.Overlay
|
|
39
|
-
className={cn(
|
|
40
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
41
|
-
className
|
|
42
|
-
)}
|
|
43
|
-
data-slot="dialog-overlay"
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
52
|
+
return <DialogPrimitive.Portal {...props} />;
|
|
47
53
|
}
|
|
48
|
-
|
|
54
|
+
DialogPortal.displayName = "DialogPortal";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* DialogClose - Button or element that closes the dialog
|
|
58
|
+
* @description Wraps an element that closes the dialog when clicked
|
|
59
|
+
*/
|
|
60
|
+
const DialogClose = React.forwardRef<
|
|
61
|
+
React.ComponentRef<typeof DialogPrimitive.Close>,
|
|
62
|
+
React.ComponentProps<typeof DialogPrimitive.Close>
|
|
63
|
+
>(({ ...props }, ref) => (
|
|
64
|
+
<DialogPrimitive.Close ref={ref} data-slot="dialog-close" {...props} />
|
|
65
|
+
));
|
|
66
|
+
DialogClose.displayName = "DialogClose";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* DialogOverlay - Semi-transparent backdrop behind the dialog
|
|
70
|
+
* @description Renders a backdrop that dims the page content
|
|
71
|
+
*/
|
|
72
|
+
const DialogOverlay = React.forwardRef<
|
|
73
|
+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
74
|
+
React.ComponentProps<typeof DialogPrimitive.Overlay>
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<DialogPrimitive.Overlay
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cn(
|
|
79
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
80
|
+
className
|
|
81
|
+
)}
|
|
82
|
+
data-slot="dialog-overlay"
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
));
|
|
86
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Props for DialogContent component
|
|
90
|
+
*/
|
|
49
91
|
interface DialogContentProps extends React.ComponentProps<
|
|
50
92
|
typeof DialogPrimitive.Content
|
|
51
93
|
> {
|
|
94
|
+
/**
|
|
95
|
+
* Data hook for automated testing (required)
|
|
96
|
+
*/
|
|
52
97
|
dataHook?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Tracking element identifier for analytics
|
|
100
|
+
*/
|
|
53
101
|
trackingEl?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Tracking label for analytics context
|
|
104
|
+
*/
|
|
54
105
|
trackingLabel?: string;
|
|
55
106
|
}
|
|
56
107
|
|
|
108
|
+
/**
|
|
109
|
+
* DialogContent - The main dialog content container
|
|
110
|
+
* @description Contains the dialog's content including header, body, and footer
|
|
111
|
+
*/
|
|
57
112
|
const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
58
113
|
(
|
|
59
114
|
{ className, children, dataHook, trackingEl, trackingLabel, ...props },
|
|
60
115
|
ref
|
|
61
116
|
) => {
|
|
62
117
|
return (
|
|
63
|
-
<DialogPortal
|
|
118
|
+
<DialogPortal>
|
|
64
119
|
<DialogOverlay />
|
|
65
120
|
<DialogPrimitive.Content
|
|
66
121
|
ref={ref}
|
|
67
122
|
className={cn(
|
|
68
|
-
"bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border
|
|
123
|
+
"bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",
|
|
69
124
|
className
|
|
70
125
|
)}
|
|
71
126
|
data-hook={dataHook}
|
|
@@ -84,57 +139,78 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
84
139
|
);
|
|
85
140
|
}
|
|
86
141
|
);
|
|
87
|
-
|
|
88
142
|
DialogContent.displayName = "DialogContent";
|
|
89
143
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
className
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
144
|
+
/**
|
|
145
|
+
* DialogHeader - Container for dialog title and description
|
|
146
|
+
* @description Groups the title and description at the top of the dialog
|
|
147
|
+
*/
|
|
148
|
+
const DialogHeader = React.forwardRef<
|
|
149
|
+
HTMLDivElement,
|
|
150
|
+
React.ComponentProps<"div">
|
|
151
|
+
>(({ className, ...props }, ref) => (
|
|
152
|
+
<div
|
|
153
|
+
ref={ref}
|
|
154
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
155
|
+
data-slot="dialog-header"
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
));
|
|
159
|
+
DialogHeader.displayName = "DialogHeader";
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* DialogFooter - Container for dialog action buttons
|
|
163
|
+
* @description Groups action buttons at the bottom of the dialog
|
|
164
|
+
*/
|
|
165
|
+
const DialogFooter = React.forwardRef<
|
|
166
|
+
HTMLDivElement,
|
|
167
|
+
React.ComponentProps<"div">
|
|
168
|
+
>(({ className, ...props }, ref) => (
|
|
169
|
+
<div
|
|
170
|
+
ref={ref}
|
|
171
|
+
className={cn(
|
|
172
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
175
|
+
data-slot="dialog-footer"
|
|
176
|
+
{...props}
|
|
177
|
+
/>
|
|
178
|
+
));
|
|
179
|
+
DialogFooter.displayName = "DialogFooter";
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* DialogTitle - The title of the dialog
|
|
183
|
+
* @description Renders an accessible title for the dialog
|
|
184
|
+
*/
|
|
185
|
+
const DialogTitle = React.forwardRef<
|
|
186
|
+
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
187
|
+
React.ComponentProps<typeof DialogPrimitive.Title>
|
|
188
|
+
>(({ className, ...props }, ref) => (
|
|
189
|
+
<DialogPrimitive.Title
|
|
190
|
+
ref={ref}
|
|
191
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
192
|
+
data-slot="dialog-title"
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
));
|
|
196
|
+
DialogTitle.displayName = "DialogTitle";
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* DialogDescription - The description of the dialog
|
|
200
|
+
* @description Renders an accessible description for the dialog
|
|
201
|
+
*/
|
|
202
|
+
const DialogDescription = React.forwardRef<
|
|
203
|
+
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
204
|
+
React.ComponentProps<typeof DialogPrimitive.Description>
|
|
205
|
+
>(({ className, ...props }, ref) => (
|
|
206
|
+
<DialogPrimitive.Description
|
|
207
|
+
ref={ref}
|
|
208
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
209
|
+
data-slot="dialog-description"
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
));
|
|
213
|
+
DialogDescription.displayName = "DialogDescription";
|
|
138
214
|
|
|
139
215
|
export {
|
|
140
216
|
Dialog,
|
|
@@ -149,4 +225,4 @@ export {
|
|
|
149
225
|
DialogTrigger,
|
|
150
226
|
};
|
|
151
227
|
|
|
152
|
-
export type { DialogContentProps };
|
|
228
|
+
export type { DialogContentProps, DialogTriggerProps };
|
|
@@ -5,30 +5,57 @@ import { Drawer as DrawerPrimitive } from "vaul";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Props for Drawer component
|
|
10
|
+
*/
|
|
8
11
|
type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Drawer - Root component for slide-out panels
|
|
15
|
+
* @description A responsive drawer component that slides in from the edge of the screen
|
|
16
|
+
*/
|
|
10
17
|
function Drawer({ ...props }: DrawerProps) {
|
|
11
18
|
return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
|
|
12
19
|
}
|
|
20
|
+
Drawer.displayName = "Drawer";
|
|
13
21
|
|
|
22
|
+
/**
|
|
23
|
+
* DrawerTrigger - Button or element that opens the drawer
|
|
24
|
+
* @description Wraps an interactive element that toggles the drawer open state
|
|
25
|
+
*/
|
|
14
26
|
function DrawerTrigger({
|
|
15
27
|
...props
|
|
16
28
|
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
17
29
|
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
|
|
18
30
|
}
|
|
31
|
+
DrawerTrigger.displayName = "DrawerTrigger";
|
|
19
32
|
|
|
33
|
+
/**
|
|
34
|
+
* DrawerPortal - Portal for rendering drawer outside of DOM hierarchy
|
|
35
|
+
* @description Renders drawer content in a React portal
|
|
36
|
+
*/
|
|
20
37
|
function DrawerPortal({
|
|
21
38
|
...props
|
|
22
39
|
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
23
|
-
return <DrawerPrimitive.Portal
|
|
40
|
+
return <DrawerPrimitive.Portal {...props} />;
|
|
24
41
|
}
|
|
42
|
+
DrawerPortal.displayName = "DrawerPortal";
|
|
25
43
|
|
|
44
|
+
/**
|
|
45
|
+
* DrawerClose - Button or element that closes the drawer
|
|
46
|
+
* @description Wraps an element that closes the drawer when clicked
|
|
47
|
+
*/
|
|
26
48
|
function DrawerClose({
|
|
27
49
|
...props
|
|
28
50
|
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
29
51
|
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
|
|
30
52
|
}
|
|
53
|
+
DrawerClose.displayName = "DrawerClose";
|
|
31
54
|
|
|
55
|
+
/**
|
|
56
|
+
* DrawerOverlay - Semi-transparent backdrop behind the drawer
|
|
57
|
+
* @description Renders a backdrop that dims the page content
|
|
58
|
+
*/
|
|
32
59
|
function DrawerOverlay({
|
|
33
60
|
className,
|
|
34
61
|
...props
|
|
@@ -44,15 +71,32 @@ function DrawerOverlay({
|
|
|
44
71
|
/>
|
|
45
72
|
);
|
|
46
73
|
}
|
|
74
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
47
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Props for DrawerContent component
|
|
78
|
+
*/
|
|
48
79
|
type DrawerContentProps = React.ComponentProps<
|
|
49
80
|
typeof DrawerPrimitive.Content
|
|
50
81
|
> & {
|
|
82
|
+
/**
|
|
83
|
+
* Data hook for automated testing (required)
|
|
84
|
+
*/
|
|
51
85
|
dataHook?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Tracking element identifier for analytics
|
|
88
|
+
*/
|
|
52
89
|
trackingEl?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Tracking label for analytics context
|
|
92
|
+
*/
|
|
53
93
|
trackingLabel?: string;
|
|
54
94
|
};
|
|
55
95
|
|
|
96
|
+
/**
|
|
97
|
+
* DrawerContent - The main drawer content container
|
|
98
|
+
* @description Contains the drawer's content including header, body, and footer
|
|
99
|
+
*/
|
|
56
100
|
function DrawerContent({
|
|
57
101
|
className,
|
|
58
102
|
children,
|
|
@@ -85,7 +129,12 @@ function DrawerContent({
|
|
|
85
129
|
</DrawerPortal>
|
|
86
130
|
);
|
|
87
131
|
}
|
|
132
|
+
DrawerContent.displayName = "DrawerContent";
|
|
88
133
|
|
|
134
|
+
/**
|
|
135
|
+
* DrawerHeader - Container for drawer title and description
|
|
136
|
+
* @description Groups the title and description at the top of the drawer
|
|
137
|
+
*/
|
|
89
138
|
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
90
139
|
return (
|
|
91
140
|
<div
|
|
@@ -98,17 +147,31 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
98
147
|
/>
|
|
99
148
|
);
|
|
100
149
|
}
|
|
150
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
101
151
|
|
|
152
|
+
/**
|
|
153
|
+
* DrawerBody - Main content area of the drawer
|
|
154
|
+
* @description Container for the primary drawer content
|
|
155
|
+
*/
|
|
102
156
|
function DrawerBody({ className, ...props }: React.ComponentProps<"div">) {
|
|
103
157
|
return (
|
|
104
158
|
<div
|
|
105
|
-
className={cn(
|
|
159
|
+
className={cn(
|
|
160
|
+
"mx-auto w-full max-w-sm px-4",
|
|
161
|
+
"mt-4 group-has-[[data-slot=drawer-header]]/drawer-content:mt-0",
|
|
162
|
+
className
|
|
163
|
+
)}
|
|
106
164
|
data-slot="drawer-body"
|
|
107
165
|
{...props}
|
|
108
166
|
/>
|
|
109
167
|
);
|
|
110
168
|
}
|
|
169
|
+
DrawerBody.displayName = "DrawerBody";
|
|
111
170
|
|
|
171
|
+
/**
|
|
172
|
+
* DrawerFooter - Container for drawer action buttons
|
|
173
|
+
* @description Groups action buttons at the bottom of the drawer
|
|
174
|
+
*/
|
|
112
175
|
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
113
176
|
return (
|
|
114
177
|
<div
|
|
@@ -121,7 +184,12 @@ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
121
184
|
/>
|
|
122
185
|
);
|
|
123
186
|
}
|
|
187
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
124
188
|
|
|
189
|
+
/**
|
|
190
|
+
* DrawerTitle - The title of the drawer
|
|
191
|
+
* @description Renders an accessible title for the drawer
|
|
192
|
+
*/
|
|
125
193
|
function DrawerTitle({
|
|
126
194
|
className,
|
|
127
195
|
...props
|
|
@@ -137,7 +205,12 @@ function DrawerTitle({
|
|
|
137
205
|
/>
|
|
138
206
|
);
|
|
139
207
|
}
|
|
208
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
140
209
|
|
|
210
|
+
/**
|
|
211
|
+
* DrawerDescription - The description of the drawer
|
|
212
|
+
* @description Renders an accessible description for the drawer
|
|
213
|
+
*/
|
|
141
214
|
function DrawerDescription({
|
|
142
215
|
className,
|
|
143
216
|
...props
|
|
@@ -150,6 +223,7 @@ function DrawerDescription({
|
|
|
150
223
|
/>
|
|
151
224
|
);
|
|
152
225
|
}
|
|
226
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
153
227
|
|
|
154
228
|
export {
|
|
155
229
|
Drawer,
|