@brightlocal/ui-components 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-meta.json +4 -5
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +110 -83
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +428 -389
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +4 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +70 -70
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +6 -24
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +91 -92
- package/dist/index.cjs +1 -1
- package/dist/index.js +169 -173
- package/dist/table.cjs +1 -1
- package/dist/table.js +28 -28
- package/package.json +3 -3
- package/src/blocks/data-table.tsx +462 -293
- package/src/blocks/sidebar.tsx +6 -2
- package/src/components/global-layout.tsx +27 -58
- package/src/components/table.tsx +1 -1
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -719,10 +719,14 @@ SidebarSeparator.displayName = "SidebarSeparator";
|
|
|
719
719
|
interface SidebarContentProps extends Omit<React.ComponentProps<"div">, "dir"> {
|
|
720
720
|
/** Data hook for automated testing */
|
|
721
721
|
dataHook?: string;
|
|
722
|
+
/** Accessible label for the sidebar navigation landmark. Override for i18n.
|
|
723
|
+
* @default "Sidebar"
|
|
724
|
+
*/
|
|
725
|
+
ariaLabel?: string;
|
|
722
726
|
}
|
|
723
727
|
|
|
724
728
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
725
|
-
({ className, dataHook, children, ...props }, ref) => {
|
|
729
|
+
({ className, dataHook, ariaLabel = "Sidebar", children, ...props }, ref) => {
|
|
726
730
|
return (
|
|
727
731
|
<ScrollArea
|
|
728
732
|
ref={ref}
|
|
@@ -734,7 +738,7 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
734
738
|
{...props}
|
|
735
739
|
>
|
|
736
740
|
<nav
|
|
737
|
-
aria-label=
|
|
741
|
+
aria-label={ariaLabel}
|
|
738
742
|
className="flex flex-col gap-2"
|
|
739
743
|
data-slot="sidebar-content"
|
|
740
744
|
>
|
|
@@ -3,20 +3,6 @@ import * as React from "react";
|
|
|
3
3
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
4
4
|
import { Header } from "./header";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Container width variants for GlobalLayout, matching Figma GlobalContainer `width` property.
|
|
8
|
-
* - "xl": 1280px max-width
|
|
9
|
-
* - "lg": 1024px max-width
|
|
10
|
-
* - "sm": 640px max-width
|
|
11
|
-
*/
|
|
12
|
-
type ContainerVariant = "xl" | "lg" | "sm";
|
|
13
|
-
|
|
14
|
-
const containerMaxWidth: Record<ContainerVariant, string> = {
|
|
15
|
-
xl: "var(--ds-breakpoint-xl)",
|
|
16
|
-
lg: "var(--ds-breakpoint-lg)",
|
|
17
|
-
sm: "var(--ds-breakpoint-sm)",
|
|
18
|
-
};
|
|
19
|
-
|
|
20
6
|
interface GlobalLayoutProps extends React.ComponentProps<"div"> {
|
|
21
7
|
/**
|
|
22
8
|
* Data hook for automated testing (required)
|
|
@@ -31,12 +17,8 @@ interface GlobalLayoutProps extends React.ComponentProps<"div"> {
|
|
|
31
17
|
*/
|
|
32
18
|
trackingLabel?: string;
|
|
33
19
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @default
|
|
36
|
-
*/
|
|
37
|
-
variant?: ContainerVariant;
|
|
38
|
-
/**
|
|
39
|
-
* Custom maximum width for the global container. Overrides `variant` when set.
|
|
20
|
+
* Maximum width of the global container. Use `breakpoint` tokens from `@brightlocal/tokens/breakpoints`.
|
|
21
|
+
* @default breakpoint.xl
|
|
40
22
|
*/
|
|
41
23
|
maxWidth?: string | number;
|
|
42
24
|
}
|
|
@@ -45,8 +27,7 @@ const GlobalLayout = React.forwardRef<HTMLDivElement, GlobalLayoutProps>(
|
|
|
45
27
|
(
|
|
46
28
|
{
|
|
47
29
|
className,
|
|
48
|
-
|
|
49
|
-
maxWidth,
|
|
30
|
+
maxWidth = "var(--ds-breakpoint-xl)",
|
|
50
31
|
dataHook,
|
|
51
32
|
trackingEl,
|
|
52
33
|
trackingLabel,
|
|
@@ -56,17 +37,13 @@ const GlobalLayout = React.forwardRef<HTMLDivElement, GlobalLayoutProps>(
|
|
|
56
37
|
ref
|
|
57
38
|
) => {
|
|
58
39
|
const resolvedMaxWidth =
|
|
59
|
-
maxWidth
|
|
60
|
-
? typeof maxWidth === "number"
|
|
61
|
-
? `${maxWidth}px`
|
|
62
|
-
: maxWidth
|
|
63
|
-
: containerMaxWidth[variant];
|
|
40
|
+
typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
64
41
|
|
|
65
42
|
return (
|
|
66
43
|
<div
|
|
67
44
|
ref={ref}
|
|
68
45
|
className={cn(
|
|
69
|
-
"py-section-sm pl-section-sm flex h-dvh w-full flex-col
|
|
46
|
+
"py-section-sm pl-section-sm flex min-h-dvh w-full flex-col",
|
|
70
47
|
className
|
|
71
48
|
)}
|
|
72
49
|
data-hook={dataHook}
|
|
@@ -76,7 +53,7 @@ const GlobalLayout = React.forwardRef<HTMLDivElement, GlobalLayoutProps>(
|
|
|
76
53
|
{...props}
|
|
77
54
|
>
|
|
78
55
|
<div
|
|
79
|
-
className="mx-auto flex
|
|
56
|
+
className="mx-auto flex w-full flex-1"
|
|
80
57
|
data-slot="global-container"
|
|
81
58
|
style={{ maxWidth: resolvedMaxWidth }}
|
|
82
59
|
>
|
|
@@ -113,13 +90,15 @@ const GlobalLayoutSidebar = React.forwardRef<
|
|
|
113
90
|
<aside
|
|
114
91
|
ref={ref}
|
|
115
92
|
className={cn(
|
|
116
|
-
"
|
|
93
|
+
"sticky hidden shrink-0 self-start outline-none lg:block",
|
|
117
94
|
className
|
|
118
95
|
)}
|
|
119
96
|
data-hook={dataHook}
|
|
120
97
|
data-slot="sidebar-container"
|
|
121
|
-
style={{
|
|
122
|
-
|
|
98
|
+
style={{
|
|
99
|
+
width: widthStyle,
|
|
100
|
+
top: "var(--ds-section-padding-y-sm)",
|
|
101
|
+
}}
|
|
123
102
|
{...props}
|
|
124
103
|
>
|
|
125
104
|
{children}
|
|
@@ -129,30 +108,16 @@ const GlobalLayoutSidebar = React.forwardRef<
|
|
|
129
108
|
|
|
130
109
|
GlobalLayoutSidebar.displayName = "GlobalLayoutSidebar";
|
|
131
110
|
|
|
132
|
-
/**
|
|
133
|
-
* Content width variants for GlobalLayoutContent, matching Figma Content `width` property.
|
|
134
|
-
* - "lg": 1024px max-width
|
|
135
|
-
* - "md": 768px max-width
|
|
136
|
-
* - "sm": 640px max-width
|
|
137
|
-
*/
|
|
138
|
-
type ContentVariant = "lg" | "md" | "sm";
|
|
139
|
-
|
|
140
|
-
const contentMaxWidth: Record<ContentVariant, string> = {
|
|
141
|
-
lg: "var(--ds-breakpoint-lg)",
|
|
142
|
-
md: "var(--ds-breakpoint-md)",
|
|
143
|
-
sm: "var(--ds-breakpoint-sm)",
|
|
144
|
-
};
|
|
145
|
-
|
|
146
111
|
interface GlobalLayoutContentProps extends React.ComponentProps<"div"> {
|
|
147
112
|
/**
|
|
148
113
|
* Data hook for automated testing
|
|
149
114
|
*/
|
|
150
115
|
dataHook?: string;
|
|
151
116
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @default
|
|
117
|
+
* Maximum width of the content area. Use `breakpoint` tokens from `@brightlocal/tokens/breakpoints`.
|
|
118
|
+
* @default breakpoint.lg
|
|
154
119
|
*/
|
|
155
|
-
|
|
120
|
+
maxWidth?: string | number;
|
|
156
121
|
/**
|
|
157
122
|
* Custom padding for the content wrapper
|
|
158
123
|
*/
|
|
@@ -164,26 +129,32 @@ const GlobalLayoutContent = React.forwardRef<
|
|
|
164
129
|
GlobalLayoutContentProps
|
|
165
130
|
>(
|
|
166
131
|
(
|
|
167
|
-
{
|
|
132
|
+
{
|
|
133
|
+
className,
|
|
134
|
+
maxWidth = "var(--ds-breakpoint-lg)",
|
|
135
|
+
padding,
|
|
136
|
+
dataHook,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
},
|
|
168
140
|
ref
|
|
169
141
|
) => {
|
|
142
|
+
const resolvedMaxWidth =
|
|
143
|
+
typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
144
|
+
|
|
170
145
|
return (
|
|
171
146
|
<div
|
|
172
147
|
ref={ref}
|
|
173
|
-
className={cn(
|
|
174
|
-
"focus-visible:shadow-default flex h-full min-h-0 min-w-0 flex-1 overflow-y-auto outline-none",
|
|
175
|
-
className
|
|
176
|
-
)}
|
|
148
|
+
className={cn("flex min-w-0 flex-1", className)}
|
|
177
149
|
data-hook={dataHook}
|
|
178
150
|
data-slot="content-wrapper"
|
|
179
|
-
tabIndex={0}
|
|
180
151
|
{...props}
|
|
181
152
|
>
|
|
182
153
|
<div
|
|
183
154
|
className="pr-section-sm mx-auto w-full"
|
|
184
155
|
data-slot="content-container"
|
|
185
156
|
style={{
|
|
186
|
-
maxWidth:
|
|
157
|
+
maxWidth: resolvedMaxWidth,
|
|
187
158
|
padding,
|
|
188
159
|
}}
|
|
189
160
|
>
|
|
@@ -329,8 +300,6 @@ export {
|
|
|
329
300
|
};
|
|
330
301
|
|
|
331
302
|
export type {
|
|
332
|
-
ContainerVariant,
|
|
333
|
-
ContentVariant,
|
|
334
303
|
GlobalLayoutProps,
|
|
335
304
|
GlobalLayoutSidebarProps,
|
|
336
305
|
GlobalLayoutContentProps,
|
package/src/components/table.tsx
CHANGED
|
@@ -294,7 +294,7 @@ const TableCaption = React.forwardRef<
|
|
|
294
294
|
>(({ className, dataHook, ...props }, ref) => (
|
|
295
295
|
<caption
|
|
296
296
|
ref={ref}
|
|
297
|
-
className={cn("
|
|
297
|
+
className={cn("caption-bottom py-4", className)}
|
|
298
298
|
data-hook={dataHook}
|
|
299
299
|
data-slot="table-caption"
|
|
300
300
|
{...props}
|