@brightlocal/ui-components 0.1.2 → 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 +177 -170
- 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/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 -0
- 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/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
|
@@ -7,13 +7,37 @@ import { ChevronDownIcon } from "lucide-react";
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
|
|
9
9
|
interface BaseAccordionProps {
|
|
10
|
+
/**
|
|
11
|
+
* Data hook for automated testing (REQUIRED)
|
|
12
|
+
*/
|
|
10
13
|
dataHook: string;
|
|
14
|
+
/**
|
|
15
|
+
* Tracking element identifier for analytics
|
|
16
|
+
*/
|
|
11
17
|
trackingEl?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Tracking label for analytics context
|
|
20
|
+
*/
|
|
12
21
|
trackingLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the accordion is disabled
|
|
24
|
+
*/
|
|
13
25
|
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Text direction
|
|
28
|
+
*/
|
|
14
29
|
dir?: "ltr" | "rtl";
|
|
30
|
+
/**
|
|
31
|
+
* Orientation of the accordion
|
|
32
|
+
*/
|
|
15
33
|
orientation?: "vertical" | "horizontal";
|
|
34
|
+
/**
|
|
35
|
+
* Additional CSS classes
|
|
36
|
+
*/
|
|
16
37
|
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Accordion items
|
|
40
|
+
*/
|
|
17
41
|
children?: React.ReactNode;
|
|
18
42
|
}
|
|
19
43
|
|
|
@@ -34,23 +58,46 @@ interface MultipleAccordionProps extends BaseAccordionProps {
|
|
|
34
58
|
|
|
35
59
|
export type AccordionProps = SingleAccordionProps | MultipleAccordionProps;
|
|
36
60
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
|
|
62
|
+
(props, ref) => {
|
|
63
|
+
const {
|
|
64
|
+
dataHook,
|
|
65
|
+
trackingEl,
|
|
66
|
+
trackingLabel,
|
|
67
|
+
disabled,
|
|
68
|
+
dir,
|
|
69
|
+
orientation,
|
|
70
|
+
className,
|
|
71
|
+
children,
|
|
72
|
+
} = props;
|
|
73
|
+
|
|
74
|
+
if (props.type === "single") {
|
|
75
|
+
return (
|
|
76
|
+
<AccordionPrimitive.Root
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={className}
|
|
79
|
+
collapsible={props.collapsible}
|
|
80
|
+
data-hook={dataHook}
|
|
81
|
+
data-slot="accordion"
|
|
82
|
+
data-tracking-el={trackingEl}
|
|
83
|
+
data-tracking-label={trackingLabel}
|
|
84
|
+
defaultValue={props.defaultValue}
|
|
85
|
+
dir={dir}
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
orientation={orientation}
|
|
88
|
+
type="single"
|
|
89
|
+
value={props.value}
|
|
90
|
+
onValueChange={props.onValueChange}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</AccordionPrimitive.Root>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
50
97
|
return (
|
|
51
98
|
<AccordionPrimitive.Root
|
|
99
|
+
ref={ref}
|
|
52
100
|
className={className}
|
|
53
|
-
collapsible={props.collapsible}
|
|
54
101
|
data-hook={dataHook}
|
|
55
102
|
data-slot="accordion"
|
|
56
103
|
data-tracking-el={trackingEl}
|
|
@@ -59,7 +106,7 @@ function Accordion(props: AccordionProps) {
|
|
|
59
106
|
dir={dir}
|
|
60
107
|
disabled={disabled}
|
|
61
108
|
orientation={orientation}
|
|
62
|
-
type="
|
|
109
|
+
type="multiple"
|
|
63
110
|
value={props.value}
|
|
64
111
|
onValueChange={props.onValueChange}
|
|
65
112
|
>
|
|
@@ -67,76 +114,115 @@ function Accordion(props: AccordionProps) {
|
|
|
67
114
|
</AccordionPrimitive.Root>
|
|
68
115
|
);
|
|
69
116
|
}
|
|
117
|
+
);
|
|
70
118
|
|
|
71
|
-
|
|
72
|
-
<AccordionPrimitive.Root
|
|
73
|
-
className={className}
|
|
74
|
-
data-hook={dataHook}
|
|
75
|
-
data-slot="accordion"
|
|
76
|
-
data-tracking-el={trackingEl}
|
|
77
|
-
data-tracking-label={trackingLabel}
|
|
78
|
-
defaultValue={props.defaultValue}
|
|
79
|
-
dir={dir}
|
|
80
|
-
disabled={disabled}
|
|
81
|
-
orientation={orientation}
|
|
82
|
-
type="multiple"
|
|
83
|
-
value={props.value}
|
|
84
|
-
onValueChange={props.onValueChange}
|
|
85
|
-
>
|
|
86
|
-
{children}
|
|
87
|
-
</AccordionPrimitive.Root>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
119
|
+
Accordion.displayName = "Accordion";
|
|
90
120
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
121
|
+
export interface AccordionItemProps extends React.ComponentProps<
|
|
122
|
+
typeof AccordionPrimitive.Item
|
|
123
|
+
> {
|
|
124
|
+
/**
|
|
125
|
+
* A unique value for the item (REQUIRED)
|
|
126
|
+
*/
|
|
127
|
+
value: string;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the accordion item is disabled
|
|
130
|
+
*/
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Additional CSS classes
|
|
134
|
+
*/
|
|
135
|
+
className?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Accordion item content (AccordionTrigger and AccordionContent)
|
|
138
|
+
*/
|
|
139
|
+
children?: React.ReactNode;
|
|
102
140
|
}
|
|
103
141
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
142
|
+
const AccordionItem = React.forwardRef<
|
|
143
|
+
React.ComponentRef<typeof AccordionPrimitive.Item>,
|
|
144
|
+
AccordionItemProps
|
|
145
|
+
>(({ className, ...props }, ref) => (
|
|
146
|
+
<AccordionPrimitive.Item
|
|
147
|
+
ref={ref}
|
|
148
|
+
className={cn("border-b last:border-b-0", className)}
|
|
149
|
+
data-slot="accordion-item"
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
));
|
|
153
|
+
|
|
154
|
+
AccordionItem.displayName = "AccordionItem";
|
|
155
|
+
|
|
156
|
+
export interface AccordionTriggerProps extends React.ComponentProps<
|
|
157
|
+
typeof AccordionPrimitive.Trigger
|
|
158
|
+
> {
|
|
159
|
+
/**
|
|
160
|
+
* Additional CSS classes
|
|
161
|
+
*/
|
|
162
|
+
className?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Trigger content (usually text)
|
|
165
|
+
*/
|
|
166
|
+
children?: React.ReactNode;
|
|
167
|
+
/**
|
|
168
|
+
* Whether the trigger is disabled
|
|
169
|
+
*/
|
|
170
|
+
disabled?: boolean;
|
|
124
171
|
}
|
|
125
172
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
className=
|
|
134
|
-
|
|
173
|
+
const AccordionTrigger = React.forwardRef<
|
|
174
|
+
React.ComponentRef<typeof AccordionPrimitive.Trigger>,
|
|
175
|
+
AccordionTriggerProps
|
|
176
|
+
>(({ className, children, ...props }, ref) => (
|
|
177
|
+
<AccordionPrimitive.Header className="flex">
|
|
178
|
+
<AccordionPrimitive.Trigger
|
|
179
|
+
ref={ref}
|
|
180
|
+
className={cn(
|
|
181
|
+
"focus-visible:border-ring focus-visible:shadow-default flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-shadow outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
182
|
+
className
|
|
183
|
+
)}
|
|
184
|
+
data-slot="accordion-trigger"
|
|
135
185
|
{...props}
|
|
136
186
|
>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
187
|
+
{children}
|
|
188
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
189
|
+
</AccordionPrimitive.Trigger>
|
|
190
|
+
</AccordionPrimitive.Header>
|
|
191
|
+
));
|
|
192
|
+
|
|
193
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
194
|
+
|
|
195
|
+
export interface AccordionContentProps extends React.ComponentProps<
|
|
196
|
+
typeof AccordionPrimitive.Content
|
|
197
|
+
> {
|
|
198
|
+
/**
|
|
199
|
+
* Additional CSS classes
|
|
200
|
+
*/
|
|
201
|
+
className?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Content to display when the accordion item is open
|
|
204
|
+
*/
|
|
205
|
+
children?: React.ReactNode;
|
|
206
|
+
/**
|
|
207
|
+
* Force mounting of the content when true
|
|
208
|
+
*/
|
|
209
|
+
forceMount?: true;
|
|
140
210
|
}
|
|
141
211
|
|
|
212
|
+
const AccordionContent = React.forwardRef<
|
|
213
|
+
React.ComponentRef<typeof AccordionPrimitive.Content>,
|
|
214
|
+
AccordionContentProps
|
|
215
|
+
>(({ className, children, ...props }, ref) => (
|
|
216
|
+
<AccordionPrimitive.Content
|
|
217
|
+
ref={ref}
|
|
218
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
219
|
+
data-slot="accordion-content"
|
|
220
|
+
{...props}
|
|
221
|
+
>
|
|
222
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
223
|
+
</AccordionPrimitive.Content>
|
|
224
|
+
));
|
|
225
|
+
|
|
226
|
+
AccordionContent.displayName = "AccordionContent";
|
|
227
|
+
|
|
142
228
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -6,141 +6,186 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { ButtonVariants } from "@brightlocal/ui-components/button";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
interface AlertDialogProps extends React.ComponentProps<
|
|
10
|
+
typeof AlertDialogPrimitive.Root
|
|
11
|
+
> {
|
|
12
|
+
/**
|
|
13
|
+
* Data hook for automated testing (REQUIRED)
|
|
14
|
+
*/
|
|
15
|
+
dataHook: string;
|
|
16
|
+
/**
|
|
17
|
+
* Tracking element identifier for analytics
|
|
18
|
+
*/
|
|
19
|
+
trackingEl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Tracking label for analytics context
|
|
22
|
+
*/
|
|
23
|
+
trackingLabel?: string;
|
|
13
24
|
}
|
|
14
25
|
|
|
15
|
-
function
|
|
26
|
+
function AlertDialog({
|
|
27
|
+
dataHook,
|
|
28
|
+
trackingEl,
|
|
29
|
+
trackingLabel,
|
|
16
30
|
...props
|
|
17
|
-
}:
|
|
31
|
+
}: AlertDialogProps) {
|
|
18
32
|
return (
|
|
19
|
-
<AlertDialogPrimitive.
|
|
33
|
+
<AlertDialogPrimitive.Root
|
|
34
|
+
data-hook={dataHook}
|
|
35
|
+
data-slot="alert-dialog"
|
|
36
|
+
data-tracking-el={trackingEl}
|
|
37
|
+
data-tracking-label={trackingLabel}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
20
40
|
);
|
|
21
41
|
}
|
|
22
42
|
|
|
43
|
+
AlertDialog.displayName = "AlertDialog";
|
|
44
|
+
|
|
45
|
+
const AlertDialogTrigger = React.forwardRef<
|
|
46
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Trigger>,
|
|
47
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Trigger>
|
|
48
|
+
>((props, ref) => (
|
|
49
|
+
<AlertDialogPrimitive.Trigger
|
|
50
|
+
ref={ref}
|
|
51
|
+
data-slot="alert-dialog-trigger"
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
));
|
|
55
|
+
|
|
56
|
+
AlertDialogTrigger.displayName = "AlertDialogTrigger";
|
|
57
|
+
|
|
23
58
|
function AlertDialogPortal({
|
|
24
59
|
...props
|
|
25
60
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
-
return
|
|
27
|
-
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
-
);
|
|
61
|
+
return <AlertDialogPrimitive.Portal {...props} />;
|
|
29
62
|
}
|
|
30
63
|
|
|
31
|
-
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
-
return (
|
|
36
|
-
<AlertDialogPrimitive.Overlay
|
|
37
|
-
className={cn(
|
|
38
|
-
"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",
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
data-slot="alert-dialog-overlay"
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
64
|
+
AlertDialogPortal.displayName = "AlertDialogPortal";
|
|
46
65
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/>
|
|
62
|
-
</AlertDialogPortal>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
66
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
67
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Overlay>,
|
|
68
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Overlay>
|
|
69
|
+
>(({ className, ...props }, ref) => (
|
|
70
|
+
<AlertDialogPrimitive.Overlay
|
|
71
|
+
ref={ref}
|
|
72
|
+
className={cn(
|
|
73
|
+
"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",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
data-slot="alert-dialog-overlay"
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
));
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
className,
|
|
68
|
-
...props
|
|
69
|
-
}: React.ComponentProps<"div">) {
|
|
70
|
-
return (
|
|
71
|
-
<div
|
|
72
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
73
|
-
data-slot="alert-dialog-header"
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
81
|
+
AlertDialogOverlay.displayName = "AlertDialogOverlay";
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
<
|
|
83
|
+
const AlertDialogContent = React.forwardRef<
|
|
84
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Content>,
|
|
85
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Content>
|
|
86
|
+
>(({ className, ...props }, ref) => (
|
|
87
|
+
<AlertDialogPortal>
|
|
88
|
+
<AlertDialogOverlay />
|
|
89
|
+
<AlertDialogPrimitive.Content
|
|
90
|
+
ref={ref}
|
|
85
91
|
className={cn(
|
|
86
|
-
"
|
|
92
|
+
"border-border bg-background 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-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
87
93
|
className
|
|
88
94
|
)}
|
|
89
|
-
data-slot="alert-dialog-
|
|
95
|
+
data-slot="alert-dialog-content"
|
|
90
96
|
{...props}
|
|
91
97
|
/>
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
</AlertDialogPortal>
|
|
99
|
+
));
|
|
94
100
|
|
|
95
|
-
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
-
return (
|
|
100
|
-
<AlertDialogPrimitive.Title
|
|
101
|
-
className={cn("text-lg font-semibold", className)}
|
|
102
|
-
data-slot="alert-dialog-title"
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
101
|
+
AlertDialogContent.displayName = "AlertDialogContent";
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
103
|
+
const AlertDialogHeader = React.forwardRef<
|
|
104
|
+
HTMLDivElement,
|
|
105
|
+
React.ComponentProps<"div">
|
|
106
|
+
>(({ className, ...props }, ref) => (
|
|
107
|
+
<div
|
|
108
|
+
ref={ref}
|
|
109
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
110
|
+
data-slot="alert-dialog-header"
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
));
|
|
120
114
|
|
|
121
|
-
|
|
122
|
-
className,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
-
return (
|
|
126
|
-
<AlertDialogPrimitive.Action
|
|
127
|
-
className={cn(ButtonVariants(), className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
115
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
132
116
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
const AlertDialogFooter = React.forwardRef<
|
|
118
|
+
HTMLDivElement,
|
|
119
|
+
React.ComponentProps<"div">
|
|
120
|
+
>(({ className, ...props }, ref) => (
|
|
121
|
+
<div
|
|
122
|
+
ref={ref}
|
|
123
|
+
className={cn(
|
|
124
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
data-slot="alert-dialog-footer"
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
));
|
|
131
|
+
|
|
132
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
133
|
+
|
|
134
|
+
const AlertDialogTitle = React.forwardRef<
|
|
135
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Title>,
|
|
136
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Title>
|
|
137
|
+
>(({ className, ...props }, ref) => (
|
|
138
|
+
<AlertDialogPrimitive.Title
|
|
139
|
+
ref={ref}
|
|
140
|
+
className={cn("text-lg font-semibold", className)}
|
|
141
|
+
data-slot="alert-dialog-title"
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
));
|
|
145
|
+
|
|
146
|
+
AlertDialogTitle.displayName = "AlertDialogTitle";
|
|
147
|
+
|
|
148
|
+
const AlertDialogDescription = React.forwardRef<
|
|
149
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Description>,
|
|
150
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Description>
|
|
151
|
+
>(({ className, ...props }, ref) => (
|
|
152
|
+
<AlertDialogPrimitive.Description
|
|
153
|
+
ref={ref}
|
|
154
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
155
|
+
data-slot="alert-dialog-description"
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
));
|
|
159
|
+
|
|
160
|
+
AlertDialogDescription.displayName = "AlertDialogDescription";
|
|
161
|
+
|
|
162
|
+
const AlertDialogAction = React.forwardRef<
|
|
163
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Action>,
|
|
164
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Action>
|
|
165
|
+
>(({ className, ...props }, ref) => (
|
|
166
|
+
<AlertDialogPrimitive.Action
|
|
167
|
+
ref={ref}
|
|
168
|
+
className={cn(ButtonVariants(), className)}
|
|
169
|
+
data-slot="alert-dialog-action"
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
));
|
|
173
|
+
|
|
174
|
+
AlertDialogAction.displayName = "AlertDialogAction";
|
|
175
|
+
|
|
176
|
+
const AlertDialogCancel = React.forwardRef<
|
|
177
|
+
React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,
|
|
178
|
+
React.ComponentProps<typeof AlertDialogPrimitive.Cancel>
|
|
179
|
+
>(({ className, ...props }, ref) => (
|
|
180
|
+
<AlertDialogPrimitive.Cancel
|
|
181
|
+
ref={ref}
|
|
182
|
+
className={cn(ButtonVariants({ variant: "outline" }), className)}
|
|
183
|
+
data-slot="alert-dialog-cancel"
|
|
184
|
+
{...props}
|
|
185
|
+
/>
|
|
186
|
+
));
|
|
187
|
+
|
|
188
|
+
AlertDialogCancel.displayName = "AlertDialogCancel";
|
|
144
189
|
|
|
145
190
|
export {
|
|
146
191
|
AlertDialog,
|
package/src/components/alert.tsx
CHANGED
|
@@ -4,14 +4,6 @@ import { CircleCheck, Info, CircleX, TriangleAlert } from "lucide-react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
|
|
7
|
-
enum AlertVariant {
|
|
8
|
-
DEFAULT = "default",
|
|
9
|
-
SUCCESS = "success",
|
|
10
|
-
INFO = "info",
|
|
11
|
-
DESTRUCTIVE = "destructive",
|
|
12
|
-
WARNING = "warning",
|
|
13
|
-
}
|
|
14
|
-
|
|
15
7
|
const alertVariants = cva(
|
|
16
8
|
"relative w-full rounded-lg px-4 py-3 text-sm flex gap-3 items-start [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:translate-y-0.5",
|
|
17
9
|
{
|
|
@@ -79,12 +71,33 @@ const AlertDescription = React.forwardRef<
|
|
|
79
71
|
AlertDescription.displayName = "AlertDescription";
|
|
80
72
|
|
|
81
73
|
interface AlertContentProps {
|
|
74
|
+
/**
|
|
75
|
+
* Optional title for the alert
|
|
76
|
+
*/
|
|
82
77
|
title?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Description text for the alert (REQUIRED)
|
|
80
|
+
*/
|
|
83
81
|
description: React.ReactNode;
|
|
82
|
+
/**
|
|
83
|
+
* Additional CSS classes
|
|
84
|
+
*/
|
|
84
85
|
className?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Optional action element (e.g., button)
|
|
88
|
+
*/
|
|
85
89
|
action?: React.ReactNode;
|
|
86
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Data hook for automated testing (REQUIRED)
|
|
92
|
+
*/
|
|
93
|
+
dataHook: string;
|
|
94
|
+
/**
|
|
95
|
+
* Tracking element identifier for analytics
|
|
96
|
+
*/
|
|
87
97
|
trackingEl?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Tracking label for analytics context
|
|
100
|
+
*/
|
|
88
101
|
trackingLabel?: string;
|
|
89
102
|
}
|
|
90
103
|
|
|
@@ -103,7 +116,7 @@ function AlertSuccess({
|
|
|
103
116
|
data-hook={dataHook}
|
|
104
117
|
data-tracking-el={trackingEl}
|
|
105
118
|
data-tracking-label={trackingLabel}
|
|
106
|
-
variant=
|
|
119
|
+
variant="success"
|
|
107
120
|
>
|
|
108
121
|
<CircleCheck />
|
|
109
122
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
@@ -130,7 +143,7 @@ function AlertInfo({
|
|
|
130
143
|
data-hook={dataHook}
|
|
131
144
|
data-tracking-el={trackingEl}
|
|
132
145
|
data-tracking-label={trackingLabel}
|
|
133
|
-
variant=
|
|
146
|
+
variant="info"
|
|
134
147
|
>
|
|
135
148
|
<Info />
|
|
136
149
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
@@ -157,7 +170,7 @@ function AlertDestructive({
|
|
|
157
170
|
data-hook={dataHook}
|
|
158
171
|
data-tracking-el={trackingEl}
|
|
159
172
|
data-tracking-label={trackingLabel}
|
|
160
|
-
variant=
|
|
173
|
+
variant="destructive"
|
|
161
174
|
>
|
|
162
175
|
<CircleX />
|
|
163
176
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
@@ -184,7 +197,7 @@ function AlertWarning({
|
|
|
184
197
|
data-hook={dataHook}
|
|
185
198
|
data-tracking-el={trackingEl}
|
|
186
199
|
data-tracking-label={trackingLabel}
|
|
187
|
-
variant=
|
|
200
|
+
variant="warning"
|
|
188
201
|
>
|
|
189
202
|
<TriangleAlert />
|
|
190
203
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|