@brightlocal/ui-components 0.1.2 → 0.1.4
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.cjs +1 -1
- package/dist/alert.d.ts +22 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +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 +38 -307
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +411 -508
- 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 +16 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +31 -29
- 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 -15
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +44 -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 +28 -18
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +191 -160
- 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 +120 -122
- 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 +221 -82
- 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 +26 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +55 -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 +367 -386
- 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-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +25 -26
- 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/link.cjs +1 -1
- package/dist/link.js +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +9 -4
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +20 -21
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +43 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +100 -78
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +6 -54
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +73 -84
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +8 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +78 -86
- 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.cjs +1 -1
- package/dist/radio-group.d.ts +33 -10
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +56 -66
- 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 +58 -6
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +38 -37
- 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 +52 -5
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +45 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +85 -19
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -115
- 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 +21 -22
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +46 -48
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +2 -12
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +37 -41
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +16 -12
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +56 -58
- package/dist/tabs.d.ts +27 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.d.ts +57 -7
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +60 -67
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.d.ts +12 -26
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.js +16 -20
- package/package.json +9 -3
- package/src/blocks/data-table.tsx +43 -33
- package/src/blocks/sidebar.tsx +158 -541
- package/src/components/accordion.tsx +164 -78
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +27 -14
- 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 +159 -83
- package/src/components/button.tsx +42 -63
- package/src/components/calendar.tsx +22 -6
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +68 -49
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +43 -79
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +243 -153
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +279 -82
- package/src/components/date-picker.tsx +282 -31
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +163 -87
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +38 -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-otp.tsx +1 -1
- package/src/components/input-password.tsx +4 -5
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/link.tsx +1 -1
- package/src/components/logo.tsx +12 -7
- package/src/components/menubar.tsx +61 -5
- package/src/components/navigation-menu.tsx +37 -99
- package/src/components/pagination.tsx +13 -19
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +44 -25
- package/src/components/rating.tsx +4 -0
- package/src/components/resizable.tsx +88 -38
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +22 -2
- package/src/components/separator.tsx +101 -24
- package/src/components/sheet.tsx +186 -90
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +34 -34
- package/src/components/split-layout.tsx +4 -1
- package/src/components/switch.figma.tsx +7 -11
- package/src/components/switch.tsx +9 -19
- package/src/components/table.tsx +23 -18
- package/src/components/tabs.tsx +27 -3
- package/src/components/toggle-group.tsx +115 -86
- package/src/components/toggle.figma.tsx +13 -19
- package/src/components/toggle.tsx +20 -34
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
5
|
-
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "
|
|
5
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@brightlocal/icons";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
|
|
8
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -114,6 +114,8 @@ function Select({
|
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
Select.displayName = "Select";
|
|
118
|
+
|
|
117
119
|
/**
|
|
118
120
|
* SelectGroup - Groups related select options together
|
|
119
121
|
*/
|
|
@@ -123,6 +125,8 @@ function SelectGroup(
|
|
|
123
125
|
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
SelectGroup.displayName = "SelectGroup";
|
|
129
|
+
|
|
126
130
|
/**
|
|
127
131
|
* SelectValue - Displays the selected value in the trigger
|
|
128
132
|
*/
|
|
@@ -132,6 +136,8 @@ function SelectValue(
|
|
|
132
136
|
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
133
137
|
}
|
|
134
138
|
|
|
139
|
+
SelectValue.displayName = "SelectValue";
|
|
140
|
+
|
|
135
141
|
// ============================================================================
|
|
136
142
|
// Styles
|
|
137
143
|
// ============================================================================
|
|
@@ -142,7 +148,7 @@ const selectTriggerVariants = cva([
|
|
|
142
148
|
"px-3 py-2",
|
|
143
149
|
|
|
144
150
|
// Base appearance
|
|
145
|
-
"border border-border rounded-
|
|
151
|
+
"border border-border rounded-sm outline-none transition-all",
|
|
146
152
|
"bg-neutral-50 border-neutral-300",
|
|
147
153
|
"dark:bg-white/5 dark:border-white/15",
|
|
148
154
|
|
|
@@ -229,6 +235,8 @@ function SelectTrigger({
|
|
|
229
235
|
);
|
|
230
236
|
}
|
|
231
237
|
|
|
238
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
239
|
+
|
|
232
240
|
/**
|
|
233
241
|
* SelectContent - The dropdown container for select options
|
|
234
242
|
*/
|
|
@@ -292,6 +300,8 @@ function SelectContent({
|
|
|
292
300
|
);
|
|
293
301
|
}
|
|
294
302
|
|
|
303
|
+
SelectContent.displayName = "SelectContent";
|
|
304
|
+
|
|
295
305
|
/**
|
|
296
306
|
* SelectLabel - Label for a group of select options
|
|
297
307
|
*/
|
|
@@ -311,6 +321,8 @@ function SelectLabel({
|
|
|
311
321
|
);
|
|
312
322
|
}
|
|
313
323
|
|
|
324
|
+
SelectLabel.displayName = "SelectLabel";
|
|
325
|
+
|
|
314
326
|
/**
|
|
315
327
|
* SelectItem - Individual selectable option in the dropdown
|
|
316
328
|
*
|
|
@@ -368,6 +380,8 @@ function SelectItem({
|
|
|
368
380
|
);
|
|
369
381
|
}
|
|
370
382
|
|
|
383
|
+
SelectItem.displayName = "SelectItem";
|
|
384
|
+
|
|
371
385
|
/**
|
|
372
386
|
* SelectSeparator - Visual separator between select items or groups
|
|
373
387
|
*/
|
|
@@ -384,6 +398,8 @@ function SelectSeparator({
|
|
|
384
398
|
);
|
|
385
399
|
}
|
|
386
400
|
|
|
401
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
402
|
+
|
|
387
403
|
/**
|
|
388
404
|
* SelectScrollUpButton - Button to scroll up in the dropdown (when content overflows)
|
|
389
405
|
*/
|
|
@@ -405,6 +421,8 @@ function SelectScrollUpButton({
|
|
|
405
421
|
);
|
|
406
422
|
}
|
|
407
423
|
|
|
424
|
+
SelectScrollUpButton.displayName = "SelectScrollUpButton";
|
|
425
|
+
|
|
408
426
|
/**
|
|
409
427
|
* SelectScrollDownButton - Button to scroll down in the dropdown (when content overflows)
|
|
410
428
|
*/
|
|
@@ -426,6 +444,8 @@ function SelectScrollDownButton({
|
|
|
426
444
|
);
|
|
427
445
|
}
|
|
428
446
|
|
|
447
|
+
SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
448
|
+
|
|
429
449
|
export {
|
|
430
450
|
Select,
|
|
431
451
|
SelectContent,
|
|
@@ -5,41 +5,114 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Orientation variants for Separator
|
|
10
|
+
*/
|
|
11
|
+
export type SeparatorOrientation = "horizontal" | "vertical";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Props for the Separator component.
|
|
15
|
+
*/
|
|
16
|
+
interface SeparatorProps extends React.ComponentProps<
|
|
17
|
+
typeof SeparatorPrimitive.Root
|
|
18
|
+
> {
|
|
19
|
+
/**
|
|
20
|
+
* Data hook for automated testing
|
|
21
|
+
*/
|
|
22
|
+
dataHook?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Tracking element identifier for analytics
|
|
25
|
+
*/
|
|
26
|
+
trackingEl?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Tracking label for analytics context
|
|
29
|
+
*/
|
|
30
|
+
trackingLabel?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Separator visually divides content using a horizontal or vertical line.
|
|
35
|
+
* Built on Radix UI Separator primitive.
|
|
36
|
+
*/
|
|
37
|
+
const Separator = React.forwardRef<
|
|
38
|
+
React.ComponentRef<typeof SeparatorPrimitive.Root>,
|
|
39
|
+
SeparatorProps
|
|
40
|
+
>(
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
className,
|
|
44
|
+
orientation = "horizontal",
|
|
45
|
+
decorative = true,
|
|
46
|
+
dataHook,
|
|
47
|
+
trackingEl,
|
|
48
|
+
trackingLabel,
|
|
49
|
+
...props
|
|
50
|
+
},
|
|
51
|
+
ref
|
|
52
|
+
) => {
|
|
53
|
+
return (
|
|
54
|
+
<SeparatorPrimitive.Root
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(
|
|
57
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
data-hook={dataHook}
|
|
61
|
+
data-slot="separator"
|
|
62
|
+
data-tracking-el={trackingEl}
|
|
63
|
+
data-tracking-label={trackingLabel}
|
|
64
|
+
decorative={decorative}
|
|
65
|
+
orientation={orientation}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
Separator.displayName = "Separator";
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Props for the SeparatorWithText component.
|
|
76
|
+
*/
|
|
33
77
|
interface SeparatorWithTextProps {
|
|
78
|
+
/**
|
|
79
|
+
* Additional CSS classes
|
|
80
|
+
*/
|
|
34
81
|
className?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Text content to display between separators
|
|
84
|
+
*/
|
|
35
85
|
children: React.ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Data hook for automated testing
|
|
88
|
+
*/
|
|
89
|
+
dataHook?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Tracking element identifier for analytics
|
|
92
|
+
*/
|
|
93
|
+
trackingEl?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Tracking label for analytics context
|
|
96
|
+
*/
|
|
97
|
+
trackingLabel?: string;
|
|
36
98
|
}
|
|
37
99
|
|
|
38
|
-
|
|
100
|
+
/**
|
|
101
|
+
* SeparatorWithText displays a horizontal separator with centered text.
|
|
102
|
+
* Commonly used for "OR" dividers in forms.
|
|
103
|
+
*/
|
|
104
|
+
const SeparatorWithText = React.forwardRef<
|
|
105
|
+
HTMLDivElement,
|
|
106
|
+
SeparatorWithTextProps
|
|
107
|
+
>(({ className, children, dataHook, trackingEl, trackingLabel }, ref) => {
|
|
39
108
|
return (
|
|
40
109
|
<div
|
|
110
|
+
ref={ref}
|
|
41
111
|
className={cn("flex items-center gap-2", className)}
|
|
112
|
+
data-hook={dataHook}
|
|
42
113
|
data-slot="separator-with-text"
|
|
114
|
+
data-tracking-el={trackingEl}
|
|
115
|
+
data-tracking-label={trackingLabel}
|
|
43
116
|
>
|
|
44
117
|
<Separator className="flex-1" />
|
|
45
118
|
<span className="text-sidebar-foreground shrink-0 text-sm leading-none font-medium whitespace-nowrap">
|
|
@@ -48,6 +121,10 @@ function SeparatorWithText({ className, children }: SeparatorWithTextProps) {
|
|
|
48
121
|
<Separator className="flex-1" />
|
|
49
122
|
</div>
|
|
50
123
|
);
|
|
51
|
-
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
SeparatorWithText.displayName = "SeparatorWithText";
|
|
52
127
|
|
|
53
128
|
export { Separator, SeparatorWithText };
|
|
129
|
+
|
|
130
|
+
export type { SeparatorProps, SeparatorWithTextProps };
|
package/src/components/sheet.tsx
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3
5
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
-
import { XIcon } from "
|
|
6
|
+
import { XIcon } from "@brightlocal/icons";
|
|
5
7
|
|
|
6
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Available sheet side variants
|
|
12
|
+
* - top: Sheet slides in from the top
|
|
13
|
+
* - right: Sheet slides in from the right (default)
|
|
14
|
+
* - bottom: Sheet slides in from the bottom
|
|
15
|
+
* - left: Sheet slides in from the left
|
|
10
16
|
*/
|
|
11
|
-
export
|
|
12
|
-
/** Sheet slides in from the top */
|
|
13
|
-
TOP = "top",
|
|
14
|
-
/** Sheet slides in from the right (default) */
|
|
15
|
-
RIGHT = "right",
|
|
16
|
-
/** Sheet slides in from the bottom */
|
|
17
|
-
BOTTOM = "bottom",
|
|
18
|
-
/** Sheet slides in from the left */
|
|
19
|
-
LEFT = "left",
|
|
20
|
-
}
|
|
17
|
+
export type SheetSide = "top" | "right" | "bottom" | "left";
|
|
21
18
|
|
|
22
19
|
const sheetContentVariants = cva(
|
|
23
20
|
[
|
|
@@ -83,66 +80,142 @@ const sheetContentVariants = cva(
|
|
|
83
80
|
}
|
|
84
81
|
);
|
|
85
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Sheet root component that provides context for the sheet dialog.
|
|
85
|
+
* Wraps the Radix UI Dialog primitive with modal behavior enabled by default.
|
|
86
|
+
*/
|
|
86
87
|
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
87
88
|
return <SheetPrimitive.Root data-slot="sheet" modal={true} {...props} />;
|
|
88
89
|
}
|
|
90
|
+
Sheet.displayName = "Sheet";
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Props for SheetTrigger component
|
|
94
|
+
*/
|
|
95
|
+
interface SheetTriggerProps extends React.ComponentProps<
|
|
96
|
+
typeof SheetPrimitive.Trigger
|
|
97
|
+
> {
|
|
98
|
+
/**
|
|
99
|
+
* Data hook for automated testing
|
|
100
|
+
*/
|
|
101
|
+
dataHook?: string;
|
|
94
102
|
}
|
|
95
103
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Sheet trigger button that opens the sheet when clicked.
|
|
106
|
+
* Use with asChild prop to merge with your own button component.
|
|
107
|
+
*/
|
|
108
|
+
const SheetTrigger = React.forwardRef<
|
|
109
|
+
React.ComponentRef<typeof SheetPrimitive.Trigger>,
|
|
110
|
+
SheetTriggerProps
|
|
111
|
+
>(({ dataHook, ...props }, ref) => (
|
|
112
|
+
<SheetPrimitive.Trigger
|
|
113
|
+
ref={ref}
|
|
114
|
+
data-hook={dataHook}
|
|
115
|
+
data-slot="sheet-trigger"
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
));
|
|
119
|
+
SheetTrigger.displayName = "SheetTrigger";
|
|
101
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Sheet close button that closes the sheet when clicked.
|
|
123
|
+
* Use with asChild prop to merge with your own button component.
|
|
124
|
+
*/
|
|
125
|
+
const SheetClose = React.forwardRef<
|
|
126
|
+
React.ComponentRef<typeof SheetPrimitive.Close>,
|
|
127
|
+
React.ComponentProps<typeof SheetPrimitive.Close>
|
|
128
|
+
>(({ ...props }, ref) => (
|
|
129
|
+
<SheetPrimitive.Close ref={ref} data-slot="sheet-close" {...props} />
|
|
130
|
+
));
|
|
131
|
+
SheetClose.displayName = "SheetClose";
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Sheet portal that renders content in a React portal.
|
|
135
|
+
* Used internally by SheetContent.
|
|
136
|
+
*/
|
|
102
137
|
function SheetPortal({
|
|
103
138
|
...props
|
|
104
139
|
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
105
140
|
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
106
141
|
}
|
|
142
|
+
SheetPortal.displayName = "SheetPortal";
|
|
107
143
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Sheet overlay that appears behind the sheet content.
|
|
146
|
+
* Provides a semi-transparent backdrop with fade animation.
|
|
147
|
+
*/
|
|
148
|
+
const SheetOverlay = React.forwardRef<
|
|
149
|
+
React.ComponentRef<typeof SheetPrimitive.Overlay>,
|
|
150
|
+
React.ComponentProps<typeof SheetPrimitive.Overlay>
|
|
151
|
+
>(({ className, ...props }, ref) => (
|
|
152
|
+
<SheetPrimitive.Overlay
|
|
153
|
+
ref={ref}
|
|
154
|
+
className={cn(
|
|
155
|
+
"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",
|
|
156
|
+
className
|
|
157
|
+
)}
|
|
158
|
+
data-slot="sheet-overlay"
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
));
|
|
162
|
+
SheetOverlay.displayName = "SheetOverlay";
|
|
123
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Props for the SheetContent component
|
|
166
|
+
*/
|
|
124
167
|
interface SheetContentProps
|
|
125
168
|
extends
|
|
126
169
|
React.ComponentProps<typeof SheetPrimitive.Content>,
|
|
127
170
|
VariantProps<typeof sheetContentVariants> {
|
|
128
171
|
/**
|
|
129
172
|
* Side from which the sheet slides in
|
|
173
|
+
* @default "right"
|
|
130
174
|
*/
|
|
131
175
|
side?: SheetSide;
|
|
176
|
+
/**
|
|
177
|
+
* Data hook for automated testing
|
|
178
|
+
*/
|
|
179
|
+
dataHook?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Tracking element identifier for analytics
|
|
182
|
+
*/
|
|
183
|
+
trackingEl?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Tracking label for analytics context
|
|
186
|
+
*/
|
|
187
|
+
trackingLabel?: string;
|
|
132
188
|
}
|
|
133
189
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Sheet content container that slides in from the specified side.
|
|
192
|
+
* Includes an overlay backdrop and close button.
|
|
193
|
+
*/
|
|
194
|
+
const SheetContent = React.forwardRef<
|
|
195
|
+
React.ComponentRef<typeof SheetPrimitive.Content>,
|
|
196
|
+
SheetContentProps
|
|
197
|
+
>(
|
|
198
|
+
(
|
|
199
|
+
{
|
|
200
|
+
className,
|
|
201
|
+
children,
|
|
202
|
+
side,
|
|
203
|
+
dataHook,
|
|
204
|
+
trackingEl,
|
|
205
|
+
trackingLabel,
|
|
206
|
+
...props
|
|
207
|
+
},
|
|
208
|
+
ref
|
|
209
|
+
) => (
|
|
141
210
|
<SheetPortal>
|
|
142
211
|
<SheetOverlay />
|
|
143
212
|
<SheetPrimitive.Content
|
|
213
|
+
ref={ref}
|
|
144
214
|
className={cn(sheetContentVariants({ side }), className)}
|
|
215
|
+
data-hook={dataHook}
|
|
145
216
|
data-slot="sheet-content"
|
|
217
|
+
data-tracking-el={trackingEl}
|
|
218
|
+
data-tracking-label={trackingLabel}
|
|
146
219
|
{...props}
|
|
147
220
|
>
|
|
148
221
|
{children}
|
|
@@ -152,57 +225,80 @@ function SheetContent({
|
|
|
152
225
|
</SheetPrimitive.Close>
|
|
153
226
|
</SheetPrimitive.Content>
|
|
154
227
|
</SheetPortal>
|
|
155
|
-
)
|
|
156
|
-
|
|
228
|
+
)
|
|
229
|
+
);
|
|
230
|
+
SheetContent.displayName = "SheetContent";
|
|
157
231
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Sheet header section for title and description.
|
|
234
|
+
* Centers text on mobile, left-aligns on larger screens.
|
|
235
|
+
*/
|
|
236
|
+
const SheetHeader = React.forwardRef<
|
|
237
|
+
HTMLDivElement,
|
|
238
|
+
React.ComponentProps<"div">
|
|
239
|
+
>(({ className, ...props }, ref) => (
|
|
240
|
+
<div
|
|
241
|
+
ref={ref}
|
|
242
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
243
|
+
data-slot="sheet-header"
|
|
244
|
+
{...props}
|
|
245
|
+
/>
|
|
246
|
+
));
|
|
247
|
+
SheetHeader.displayName = "SheetHeader";
|
|
167
248
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Sheet footer section for actions and buttons.
|
|
251
|
+
* Stacks buttons on mobile, aligns to end on larger screens.
|
|
252
|
+
*/
|
|
253
|
+
const SheetFooter = React.forwardRef<
|
|
254
|
+
HTMLDivElement,
|
|
255
|
+
React.ComponentProps<"div">
|
|
256
|
+
>(({ className, ...props }, ref) => (
|
|
257
|
+
<div
|
|
258
|
+
ref={ref}
|
|
259
|
+
className={cn(
|
|
260
|
+
"mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",
|
|
261
|
+
className
|
|
262
|
+
)}
|
|
263
|
+
data-slot="sheet-footer"
|
|
264
|
+
{...props}
|
|
265
|
+
/>
|
|
266
|
+
));
|
|
267
|
+
SheetFooter.displayName = "SheetFooter";
|
|
180
268
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Sheet title component for the main heading.
|
|
271
|
+
* Should be used within SheetHeader.
|
|
272
|
+
*/
|
|
273
|
+
const SheetTitle = React.forwardRef<
|
|
274
|
+
React.ComponentRef<typeof SheetPrimitive.Title>,
|
|
275
|
+
React.ComponentProps<typeof SheetPrimitive.Title>
|
|
276
|
+
>(({ className, ...props }, ref) => (
|
|
277
|
+
<SheetPrimitive.Title
|
|
278
|
+
ref={ref}
|
|
279
|
+
className={cn("text-foreground text-lg font-semibold", className)}
|
|
280
|
+
data-slot="sheet-title"
|
|
281
|
+
{...props}
|
|
282
|
+
/>
|
|
283
|
+
));
|
|
284
|
+
SheetTitle.displayName = "SheetTitle";
|
|
193
285
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Sheet description component for additional context.
|
|
288
|
+
* Should be used within SheetHeader below SheetTitle.
|
|
289
|
+
*/
|
|
290
|
+
const SheetDescription = React.forwardRef<
|
|
291
|
+
React.ComponentRef<typeof SheetPrimitive.Description>,
|
|
292
|
+
React.ComponentProps<typeof SheetPrimitive.Description>
|
|
293
|
+
>(({ className, ...props }, ref) => (
|
|
294
|
+
<SheetPrimitive.Description
|
|
295
|
+
ref={ref}
|
|
296
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
297
|
+
data-slot="sheet-description"
|
|
298
|
+
{...props}
|
|
299
|
+
/>
|
|
300
|
+
));
|
|
301
|
+
SheetDescription.displayName = "SheetDescription";
|
|
206
302
|
|
|
207
303
|
export {
|
|
208
304
|
Sheet,
|
|
@@ -217,4 +313,4 @@ export {
|
|
|
217
313
|
SheetTrigger,
|
|
218
314
|
};
|
|
219
315
|
|
|
220
|
-
export type { SheetContentProps };
|
|
316
|
+
export type { SheetContentProps, SheetTriggerProps };
|
|
@@ -1,17 +1,47 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Skeleton component
|
|
7
|
+
*/
|
|
8
|
+
interface SkeletonProps extends React.ComponentProps<"div"> {
|
|
9
|
+
/**
|
|
10
|
+
* Data hook for automated testing (optional for Skeleton as it's purely presentational)
|
|
11
|
+
*/
|
|
12
|
+
dataHook?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Tracking element identifier for analytics
|
|
15
|
+
*/
|
|
16
|
+
trackingEl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Tracking label for analytics context
|
|
19
|
+
*/
|
|
20
|
+
trackingLabel?: string;
|
|
13
21
|
}
|
|
14
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Skeleton component for loading placeholder states.
|
|
25
|
+
* Displays a pulsing animation to indicate content is loading.
|
|
26
|
+
* Use to represent text, images, avatars, or any other content while data is being fetched.
|
|
27
|
+
*/
|
|
28
|
+
const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
29
|
+
({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn("bg-accent animate-pulse rounded-md", className)}
|
|
34
|
+
data-hook={dataHook}
|
|
35
|
+
data-slot="skeleton"
|
|
36
|
+
data-tracking-el={trackingEl}
|
|
37
|
+
data-tracking-label={trackingLabel}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
Skeleton.displayName = "Skeleton";
|
|
44
|
+
|
|
15
45
|
export { Skeleton };
|
|
16
46
|
|
|
17
47
|
export type { SkeletonProps };
|