@brightlocal/ui-components 1.1.0 → 1.2.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/AI_USAGE.md +390 -0
- package/README.md +67 -10
- package/component-meta.json +1488 -0
- package/dist/blocks/input-list.cjs +2 -0
- package/dist/blocks/input-list.d.ts +93 -0
- package/dist/blocks/input-list.d.ts.map +1 -0
- package/dist/blocks/input-list.js +215 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +17 -14
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +9 -8
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +8 -10
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +12 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +87 -79
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +60 -50
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +66 -57
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +2 -2
- package/dist/header.cjs +1 -1
- package/dist/header.d.ts +4 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/header.js +33 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -268
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +2 -2
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +17 -17
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +20 -20
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +33 -25
- package/dist/input.cjs +1 -1
- package/dist/input.js +15 -15
- package/dist/label.d.ts.map +1 -1
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +24 -25
- package/dist/list.cjs +1 -0
- package/dist/list.d.ts +104 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/list.js +145 -0
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +6 -5
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +20 -20
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +10 -4
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +48 -41
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +66 -15
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/split-layout.js +100 -96
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +2 -2
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +40 -38
- package/package.json +10 -1
- package/src/blocks/input-list.tsx +366 -0
- package/src/blocks/sidebar.tsx +7 -7
- package/src/components/breadcrumb.tsx +4 -1
- package/src/components/button.tsx +1 -0
- package/src/components/calendar.tsx +1 -1
- package/src/components/checkbox.tsx +2 -4
- package/src/components/combobox.tsx +21 -2
- package/src/components/command.tsx +25 -9
- package/src/components/date-picker.tsx +15 -5
- package/src/components/dropdown-menu.tsx +3 -3
- package/src/components/field.tsx +5 -3
- package/src/components/header.tsx +28 -2
- package/src/components/input-chip.tsx +2 -2
- package/src/components/input-group.tsx +4 -4
- package/src/components/input-otp.tsx +7 -3
- package/src/components/input-password.tsx +8 -2
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +1 -4
- package/src/components/link.tsx +3 -4
- package/src/components/list.tsx +290 -0
- package/src/components/navigation-menu.tsx +1 -0
- package/src/components/radio-group.tsx +2 -2
- package/src/components/select.tsx +3 -3
- package/src/components/sheet.tsx +2 -2
- package/src/components/sonner.tsx +30 -12
- package/src/components/split-layout.tsx +200 -79
- package/src/components/switch.tsx +6 -4
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +4 -2
- package/src/index.ts +2 -0
- package/tailwind.css +1 -0
|
@@ -61,6 +61,8 @@ export type SonnerColorSchema = "default" | "success";
|
|
|
61
61
|
type SonnerCustomOptions = {
|
|
62
62
|
className?: string;
|
|
63
63
|
id?: string | number;
|
|
64
|
+
/** Duration in ms before the toast auto-dismisses. Set to `Infinity` to keep the toast visible until the user closes it or you call `sonner.dismiss(id)`. @default 4000 */
|
|
65
|
+
duration?: number;
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
/**
|
|
@@ -68,6 +70,9 @@ type SonnerCustomOptions = {
|
|
|
68
70
|
*/
|
|
69
71
|
type ToastInput = Omit<ToastProps, "id"> & { id?: string | number };
|
|
70
72
|
|
|
73
|
+
/** Default toast duration in ms (matches Sonner library default) */
|
|
74
|
+
const DEFAULT_DURATION = 4000;
|
|
75
|
+
|
|
71
76
|
// CVA variant definitions extracted for reusability and testing
|
|
72
77
|
const CONTAINER_VARIANTS = cva(
|
|
73
78
|
[
|
|
@@ -101,7 +106,7 @@ const TITLE_VARIANTS = cva("text-sm leading-normal font-medium", {
|
|
|
101
106
|
variants: {
|
|
102
107
|
colorSchema: {
|
|
103
108
|
default: "text-foreground",
|
|
104
|
-
success: "text-green-900",
|
|
109
|
+
success: "text-green-900 dark:text-green-100",
|
|
105
110
|
},
|
|
106
111
|
},
|
|
107
112
|
defaultVariants: {
|
|
@@ -113,7 +118,7 @@ const DESCRIPTION_VARIANTS = cva("text-sm leading-normal", {
|
|
|
113
118
|
variants: {
|
|
114
119
|
colorSchema: {
|
|
115
120
|
default: "text-muted-foreground",
|
|
116
|
-
success: "text-green-900",
|
|
121
|
+
success: "text-green-900 dark:text-green-100",
|
|
117
122
|
},
|
|
118
123
|
},
|
|
119
124
|
defaultVariants: {
|
|
@@ -125,7 +130,7 @@ const ICON_VARIANTS = cva("", {
|
|
|
125
130
|
variants: {
|
|
126
131
|
colorSchema: {
|
|
127
132
|
default: "text-foreground",
|
|
128
|
-
success: "text-green-900",
|
|
133
|
+
success: "text-green-900 dark:text-green-100",
|
|
129
134
|
},
|
|
130
135
|
},
|
|
131
136
|
defaultVariants: {
|
|
@@ -166,12 +171,22 @@ function renderToastIcon(type: ToastIconType, schema: "default" | "success") {
|
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
173
|
|
|
169
|
-
|
|
174
|
+
interface SonnerFn {
|
|
175
|
+
(toast: ToastInput, options?: SonnerCustomOptions): void;
|
|
176
|
+
/** Dismiss a toast by its `id`. */
|
|
177
|
+
dismiss: (id: string | number) => void;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const sonner: SonnerFn = function sonner(
|
|
181
|
+
toast: ToastInput,
|
|
182
|
+
options?: SonnerCustomOptions
|
|
183
|
+
): void {
|
|
170
184
|
const { id: providedId, ...rest } = toast;
|
|
171
|
-
const mergedOptions: SonnerCustomOptions
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
const mergedOptions: SonnerCustomOptions = {
|
|
186
|
+
...options,
|
|
187
|
+
duration: options?.duration ?? DEFAULT_DURATION,
|
|
188
|
+
...(providedId != null && { id: options?.id ?? providedId }),
|
|
189
|
+
};
|
|
175
190
|
|
|
176
191
|
sonnerToast.custom((id) => {
|
|
177
192
|
// Wrap button onClick to include dismiss logic
|
|
@@ -200,7 +215,11 @@ function sonner(toast: ToastInput, options?: SonnerCustomOptions): void {
|
|
|
200
215
|
/>
|
|
201
216
|
);
|
|
202
217
|
}, mergedOptions);
|
|
203
|
-
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
sonner.dismiss = (id: string | number) => {
|
|
221
|
+
sonnerToast.dismiss(id);
|
|
222
|
+
};
|
|
204
223
|
|
|
205
224
|
/**
|
|
206
225
|
* Internal Toast component that renders the custom toast UI.
|
|
@@ -340,7 +359,6 @@ Sonner.displayName = "Sonner";
|
|
|
340
359
|
* ```tsx
|
|
341
360
|
* // 1. Mount the Sonner component in your app root
|
|
342
361
|
* import { Sonner } from '@brightlocal/ui-components/sonner';
|
|
343
|
-
* import { toast } from 'sonner';
|
|
344
362
|
*
|
|
345
363
|
* <Sonner />
|
|
346
364
|
*
|
|
@@ -377,14 +395,14 @@ Sonner.displayName = "Sonner";
|
|
|
377
395
|
* // After operation completes, dismiss the loading toast and show success
|
|
378
396
|
* try {
|
|
379
397
|
* await uploadFile();
|
|
380
|
-
*
|
|
398
|
+
* sonner.dismiss(loadingToastId);
|
|
381
399
|
* sonner({
|
|
382
400
|
* title: "Upload complete!",
|
|
383
401
|
* icon: "success",
|
|
384
402
|
* colorSchema: "success"
|
|
385
403
|
* });
|
|
386
404
|
* } catch (error) {
|
|
387
|
-
*
|
|
405
|
+
* sonner.dismiss(loadingToastId);
|
|
388
406
|
* sonner({
|
|
389
407
|
* title: "Upload failed",
|
|
390
408
|
* description: error.message,
|
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { cva } from "class-variance-authority";
|
|
3
2
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Background section - extends full-width with background color
|
|
16
|
-
const splitLayoutSectionVariants = cva(
|
|
17
|
-
["flex", "flex-1", "items-center", "overflow-auto", "p-6"],
|
|
18
|
-
{
|
|
19
|
-
variants: {
|
|
20
|
-
side: {
|
|
21
|
-
left: [
|
|
22
|
-
"bg-background", // base/background token
|
|
23
|
-
"justify-center", // Center on mobile
|
|
24
|
-
"lg:justify-end", // Align to right on large screens
|
|
25
|
-
"lg:pr-[46px]", // 46px spacing from right edge on LG
|
|
26
|
-
"xl:pr-[110px]", // 110px spacing from right edge on XL and bigger
|
|
27
|
-
],
|
|
28
|
-
right: [
|
|
29
|
-
"bg-card", // base/card token (handles both light and dark modes)
|
|
30
|
-
"hidden", // Hidden on mobile (MD and SM breakpoints)
|
|
31
|
-
"lg:flex", // Visible on large screens (LG and XL breakpoints)
|
|
32
|
-
"justify-center", // Center on mobile
|
|
33
|
-
"lg:justify-start", // Align to left on large screens
|
|
34
|
-
"lg:pl-[46px]", // 46px spacing from left edge on LG
|
|
35
|
-
"xl:pl-[110px]", // 110px spacing from left edge on XL and bigger
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
side: "left",
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
);
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Internal context — lets SplitLayoutContentLeft know if a header is present
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
const SplitLayoutContext = React.createContext(false);
|
|
9
|
+
|
|
10
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11
|
+
* SplitLayout Root
|
|
12
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
44
13
|
|
|
45
14
|
interface SplitLayoutProps extends React.ComponentProps<"div"> {
|
|
46
15
|
/** Data hook for automated testing (REQUIRED) */
|
|
@@ -49,25 +18,57 @@ interface SplitLayoutProps extends React.ComponentProps<"div"> {
|
|
|
49
18
|
trackingEl?: string;
|
|
50
19
|
/** Tracking label for analytics context */
|
|
51
20
|
trackingLabel?: string;
|
|
52
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Content for the left/primary section.
|
|
23
|
+
* @deprecated Use `<SplitLayoutContentLeft>` composition instead.
|
|
24
|
+
*/
|
|
53
25
|
left?: React.ReactNode;
|
|
54
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Content for the right/secondary section.
|
|
28
|
+
* @deprecated Use `<SplitLayoutContentRight>` composition instead.
|
|
29
|
+
*/
|
|
55
30
|
right?: React.ReactNode;
|
|
56
31
|
}
|
|
57
32
|
|
|
58
33
|
/**
|
|
59
|
-
* SplitLayout component for creating responsive two-column layouts
|
|
34
|
+
* SplitLayout component for creating responsive two-column layouts.
|
|
60
35
|
*
|
|
61
36
|
* Displays content in two sections side-by-side on large screens (≥1024px),
|
|
62
37
|
* and shows only the left section on smaller screens (hiding the right/marketing section).
|
|
63
38
|
* This pattern is commonly used for authentication pages where the form is prioritized on mobile.
|
|
64
39
|
*
|
|
40
|
+
* Uses a composition pattern with SplitLayoutHeader, SplitLayoutContentLeft,
|
|
41
|
+
* and SplitLayoutContentRight sub-components.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Basic usage
|
|
45
|
+
* <SplitLayout dataHook="login-layout">
|
|
46
|
+
* <SplitLayoutContentLeft>
|
|
47
|
+
* <LoginForm />
|
|
48
|
+
* </SplitLayoutContentLeft>
|
|
49
|
+
* <SplitLayoutContentRight>
|
|
50
|
+
* <MarketingContent />
|
|
51
|
+
* </SplitLayoutContentRight>
|
|
52
|
+
* </SplitLayout>
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // With Header
|
|
56
|
+
* <SplitLayout dataHook="login-layout">
|
|
57
|
+
* <SplitLayoutHeader>
|
|
58
|
+
* <Header dataHook="my-header"><Logo dataHook="my-logo" /></Header>
|
|
59
|
+
* </SplitLayoutHeader>
|
|
60
|
+
* <SplitLayoutContentLeft>
|
|
61
|
+
* <LoginForm />
|
|
62
|
+
* </SplitLayoutContentLeft>
|
|
63
|
+
* <SplitLayoutContentRight>
|
|
64
|
+
* <MarketingContent />
|
|
65
|
+
* </SplitLayoutContentRight>
|
|
66
|
+
* </SplitLayout>
|
|
67
|
+
*
|
|
65
68
|
* Layout specifications:
|
|
66
69
|
* - Mobile/Tablet: Stacked layout, only left section visible, content centered
|
|
67
|
-
* -
|
|
68
|
-
* -
|
|
69
|
-
* - Left section: Content aligned to right edge with responsive padding
|
|
70
|
-
* - Right section: Content aligned to left edge with responsive padding
|
|
70
|
+
* - Desktop (≥1024px): Side-by-side, content centered within each section
|
|
71
|
+
* - Section padding uses responsive section tokens (16px mobile, 24px desktop)
|
|
71
72
|
* - Background colors extend full-width of viewport
|
|
72
73
|
* - Content within each section can be independently sized (e.g., using Card components)
|
|
73
74
|
*/
|
|
@@ -85,33 +86,66 @@ const SplitLayout = React.forwardRef<HTMLDivElement, SplitLayoutProps>(
|
|
|
85
86
|
},
|
|
86
87
|
ref
|
|
87
88
|
) => {
|
|
89
|
+
const headerChildren: React.ReactNode[] = [];
|
|
90
|
+
const leftChildren: React.ReactNode[] = [];
|
|
91
|
+
const rightChildren: React.ReactNode[] = [];
|
|
92
|
+
|
|
93
|
+
const collectChild = (child: React.ReactNode): void => {
|
|
94
|
+
if (!React.isValidElement(child)) return;
|
|
95
|
+
if (child.type === React.Fragment) {
|
|
96
|
+
React.Children.forEach(
|
|
97
|
+
(child.props as { children: React.ReactNode }).children,
|
|
98
|
+
collectChild
|
|
99
|
+
);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (child.type === SplitLayoutHeader) {
|
|
103
|
+
headerChildren.push(child);
|
|
104
|
+
} else if (child.type === SplitLayoutContentRight) {
|
|
105
|
+
rightChildren.push(child);
|
|
106
|
+
} else {
|
|
107
|
+
leftChildren.push(child);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
React.Children.forEach(children, collectChild);
|
|
111
|
+
|
|
112
|
+
// Support legacy left/right props as fallback
|
|
113
|
+
const hasLegacyProps = left != null || right != null;
|
|
114
|
+
const hasCompositionChildren =
|
|
115
|
+
leftChildren.length > 0 || rightChildren.length > 0;
|
|
116
|
+
const useLegacy = hasLegacyProps && !hasCompositionChildren;
|
|
117
|
+
|
|
118
|
+
const hasHeader = headerChildren.length > 0;
|
|
119
|
+
|
|
88
120
|
return (
|
|
89
121
|
<div
|
|
90
122
|
ref={ref}
|
|
91
|
-
className={cn(
|
|
123
|
+
className={cn(
|
|
124
|
+
"flex min-h-screen w-full flex-col lg:flex-row",
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
92
127
|
data-hook={dataHook}
|
|
93
128
|
data-slot="split-layout"
|
|
94
129
|
data-tracking-el={trackingEl || "split-layout"}
|
|
95
130
|
data-tracking-label={trackingLabel}
|
|
96
131
|
{...props}
|
|
97
132
|
>
|
|
98
|
-
{left
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</
|
|
113
|
-
|
|
114
|
-
{children}
|
|
133
|
+
{/* Left column: header + left content stacked vertically */}
|
|
134
|
+
<div
|
|
135
|
+
className="bg-background flex flex-1 flex-col"
|
|
136
|
+
data-slot="split-layout-body"
|
|
137
|
+
>
|
|
138
|
+
<SplitLayoutContext.Provider value={hasHeader}>
|
|
139
|
+
{headerChildren}
|
|
140
|
+
{useLegacy
|
|
141
|
+
? left && <SplitLayoutContentLeft>{left}</SplitLayoutContentLeft>
|
|
142
|
+
: leftChildren}
|
|
143
|
+
</SplitLayoutContext.Provider>
|
|
144
|
+
</div>
|
|
145
|
+
{/* Right column: extends full height with bg-card */}
|
|
146
|
+
{useLegacy
|
|
147
|
+
? right && <SplitLayoutContentRight>{right}</SplitLayoutContentRight>
|
|
148
|
+
: rightChildren}
|
|
115
149
|
</div>
|
|
116
150
|
);
|
|
117
151
|
}
|
|
@@ -119,28 +153,72 @@ const SplitLayout = React.forwardRef<HTMLDivElement, SplitLayoutProps>(
|
|
|
119
153
|
|
|
120
154
|
SplitLayout.displayName = "SplitLayout";
|
|
121
155
|
|
|
122
|
-
|
|
156
|
+
/* -------------------------------------------------------------------------------------------------
|
|
157
|
+
* SplitLayoutHeader
|
|
158
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
159
|
+
|
|
160
|
+
interface SplitLayoutHeaderProps extends React.ComponentProps<"div"> {
|
|
123
161
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @default "left"
|
|
162
|
+
* Header content (e.g., Header component with Logo)
|
|
126
163
|
*/
|
|
127
|
-
|
|
164
|
+
children: React.ReactNode;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* SplitLayoutHeader component for rendering header content at the top of SplitLayout.
|
|
169
|
+
* Content is centered on mobile/tablet, left-aligned from lg breakpoint onwards.
|
|
170
|
+
* Uses section padding tokens for responsive horizontal and vertical padding (16px mobile, 24px desktop).
|
|
171
|
+
*/
|
|
172
|
+
const SplitLayoutHeader = React.forwardRef<
|
|
173
|
+
HTMLDivElement,
|
|
174
|
+
SplitLayoutHeaderProps
|
|
175
|
+
>(({ className, children, ...props }, ref) => {
|
|
176
|
+
return (
|
|
177
|
+
<div
|
|
178
|
+
ref={ref}
|
|
179
|
+
className={cn(
|
|
180
|
+
"px-section pt-section flex w-full items-center justify-center lg:justify-start",
|
|
181
|
+
className
|
|
182
|
+
)}
|
|
183
|
+
data-slot="split-layout-header"
|
|
184
|
+
{...props}
|
|
185
|
+
>
|
|
186
|
+
{children}
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
SplitLayoutHeader.displayName = "SplitLayoutHeader";
|
|
192
|
+
|
|
193
|
+
/* -------------------------------------------------------------------------------------------------
|
|
194
|
+
* SplitLayoutContentLeft
|
|
195
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
196
|
+
|
|
197
|
+
interface SplitLayoutContentLeftProps extends React.ComponentProps<"div"> {
|
|
198
|
+
children: React.ReactNode;
|
|
128
199
|
}
|
|
129
200
|
|
|
130
201
|
/**
|
|
131
|
-
*
|
|
202
|
+
* SplitLayoutContentLeft - Left/primary section within a SplitLayout.
|
|
132
203
|
*
|
|
133
|
-
*
|
|
204
|
+
* Always visible. When a SplitLayoutHeader is present, top padding is
|
|
205
|
+
* automatically reduced to avoid excessive spacing below the header.
|
|
134
206
|
*/
|
|
135
|
-
const
|
|
207
|
+
const SplitLayoutContentLeft = React.forwardRef<
|
|
136
208
|
HTMLDivElement,
|
|
137
|
-
|
|
138
|
-
>(({ className,
|
|
209
|
+
SplitLayoutContentLeftProps
|
|
210
|
+
>(({ className, children, ...props }, ref) => {
|
|
211
|
+
const hasHeader = React.useContext(SplitLayoutContext);
|
|
212
|
+
|
|
139
213
|
return (
|
|
140
214
|
<div
|
|
141
215
|
ref={ref}
|
|
142
|
-
className={cn(
|
|
143
|
-
|
|
216
|
+
className={cn(
|
|
217
|
+
"p-section flex flex-1 items-center justify-center overflow-auto",
|
|
218
|
+
hasHeader && "pt-2",
|
|
219
|
+
className
|
|
220
|
+
)}
|
|
221
|
+
data-slot="split-layout-left"
|
|
144
222
|
{...props}
|
|
145
223
|
>
|
|
146
224
|
{children}
|
|
@@ -148,11 +226,54 @@ const SplitLayoutSection = React.forwardRef<
|
|
|
148
226
|
);
|
|
149
227
|
});
|
|
150
228
|
|
|
151
|
-
|
|
229
|
+
SplitLayoutContentLeft.displayName = "SplitLayoutContentLeft";
|
|
230
|
+
|
|
231
|
+
/* -------------------------------------------------------------------------------------------------
|
|
232
|
+
* SplitLayoutContentRight
|
|
233
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
234
|
+
|
|
235
|
+
interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
|
|
236
|
+
children: React.ReactNode;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* SplitLayoutContentRight - Right/secondary section within a SplitLayout.
|
|
241
|
+
*
|
|
242
|
+
* Hidden on mobile/tablet (<1024px), visible on desktop (≥1024px).
|
|
243
|
+
* Uses bg-card background color.
|
|
244
|
+
*/
|
|
245
|
+
const SplitLayoutContentRight = React.forwardRef<
|
|
246
|
+
HTMLDivElement,
|
|
247
|
+
SplitLayoutContentRightProps
|
|
248
|
+
>(({ className, children, ...props }, ref) => {
|
|
249
|
+
return (
|
|
250
|
+
<div
|
|
251
|
+
ref={ref}
|
|
252
|
+
className={cn(
|
|
253
|
+
"bg-card p-section hidden flex-1 items-center justify-center overflow-auto lg:flex",
|
|
254
|
+
className
|
|
255
|
+
)}
|
|
256
|
+
data-slot="split-layout-right"
|
|
257
|
+
{...props}
|
|
258
|
+
>
|
|
259
|
+
{children}
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
SplitLayoutContentRight.displayName = "SplitLayoutContentRight";
|
|
265
|
+
|
|
266
|
+
/* -------------------------------------------------------------------------------------------------
|
|
267
|
+
* Exports
|
|
268
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
152
269
|
|
|
153
270
|
export {
|
|
154
271
|
SplitLayout,
|
|
155
|
-
|
|
272
|
+
SplitLayoutHeader,
|
|
273
|
+
SplitLayoutContentLeft,
|
|
274
|
+
SplitLayoutContentRight,
|
|
156
275
|
type SplitLayoutProps,
|
|
157
|
-
type
|
|
276
|
+
type SplitLayoutHeaderProps,
|
|
277
|
+
type SplitLayoutContentLeftProps,
|
|
278
|
+
type SplitLayoutContentRightProps,
|
|
158
279
|
};
|
|
@@ -5,8 +5,10 @@ import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
-
interface SwitchProps
|
|
9
|
-
|
|
8
|
+
interface SwitchProps extends Omit<
|
|
9
|
+
React.ComponentProps<typeof SwitchPrimitive.Root>,
|
|
10
|
+
"asChild"
|
|
11
|
+
> {
|
|
10
12
|
/** Data hook for automated testing (REQUIRED) */
|
|
11
13
|
dataHook: string;
|
|
12
14
|
/** Tracking element identifier for analytics */
|
|
@@ -23,8 +25,8 @@ const Switch = React.forwardRef<
|
|
|
23
25
|
<SwitchPrimitive.Root
|
|
24
26
|
ref={ref}
|
|
25
27
|
className={cn(
|
|
26
|
-
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring dark:
|
|
27
|
-
"inline-flex h-5 w-9 shrink-0 items-center rounded-full border-1 border-transparent shadow-xs transition-[background-color,border-color,box-shadow] outline-none
|
|
28
|
+
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring dark:data-[state=unchecked]:bg-input/80 dark:focus-visible:border-neutral-500",
|
|
29
|
+
"focus-visible:shadow-default inline-flex h-5 w-9 shrink-0 items-center rounded-full border-1 border-transparent shadow-xs transition-[background-color,border-color,box-shadow] outline-none",
|
|
28
30
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
29
31
|
"pl-[1px]",
|
|
30
32
|
className
|
|
@@ -67,7 +67,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
67
67
|
className={cn(
|
|
68
68
|
textareaVariants(),
|
|
69
69
|
hasError &&
|
|
70
|
-
"border-destructive
|
|
70
|
+
"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
data-hook={dataHook}
|
|
@@ -127,6 +127,7 @@ const TooltipContent = React.forwardRef<
|
|
|
127
127
|
ref={ref}
|
|
128
128
|
className={cn(
|
|
129
129
|
"bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
|
|
130
|
+
"data-[side=bottom]:[&_[data-slot=tooltip-arrow]]:translate-y-px data-[side=left]:[&_[data-slot=tooltip-arrow]]:-translate-x-px data-[side=right]:[&_[data-slot=tooltip-arrow]]:translate-x-px data-[side=top]:[&_[data-slot=tooltip-arrow]]:-translate-y-px",
|
|
130
131
|
className
|
|
131
132
|
)}
|
|
132
133
|
data-hook={dataHook}
|
|
@@ -140,8 +141,9 @@ const TooltipContent = React.forwardRef<
|
|
|
140
141
|
{!hideArrow && (
|
|
141
142
|
<TooltipPrimitive.Arrow
|
|
142
143
|
className="fill-secondary"
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
data-slot="tooltip-arrow"
|
|
145
|
+
height={7}
|
|
146
|
+
width={14}
|
|
145
147
|
/>
|
|
146
148
|
)}
|
|
147
149
|
</TooltipPrimitive.Content>
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./components/input-group";
|
|
|
33
33
|
export * from "./components/input-otp";
|
|
34
34
|
export * from "./components/label";
|
|
35
35
|
export * from "./components/link";
|
|
36
|
+
export * from "./components/list";
|
|
36
37
|
export * from "./components/logo";
|
|
37
38
|
export * from "./components/menubar";
|
|
38
39
|
export * from "./components/navigation-menu";
|
|
@@ -62,6 +63,7 @@ export * from "./components/typography";
|
|
|
62
63
|
|
|
63
64
|
// Blocks
|
|
64
65
|
export * from "./blocks/data-table";
|
|
66
|
+
export * from "./blocks/input-list";
|
|
65
67
|
export * from "./blocks/sidebar";
|
|
66
68
|
|
|
67
69
|
// Hooks
|
package/tailwind.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source "./dist/**/*.js";
|