@brightlocal/ui-components 2.7.0 → 2.9.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 +6 -4
- package/dist/alert.cjs +1 -1
- package/dist/alert.js +1 -1
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +74 -26
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +318 -296
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +39 -21
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +379 -425
- package/dist/callout.cjs +1 -1
- package/dist/callout.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +11 -11
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +24 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +327 -302
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +3 -3
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +90 -82
- package/dist/hooks/use-breakpoint.cjs +1 -0
- package/dist/hooks/use-breakpoint.d.ts +15 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-breakpoint.js +30 -0
- package/dist/hooks/use-mobile.d.ts +13 -3
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +220 -215
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +5 -0
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +34 -25
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +15 -0
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/split-layout.js +40 -38
- package/package.json +3 -3
- package/src/blocks/data-table.tsx +139 -76
- package/src/blocks/sidebar.tsx +134 -148
- package/src/components/alert.tsx +1 -1
- package/src/components/callout.tsx +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/combobox.tsx +72 -11
- package/src/components/global-layout.tsx +49 -40
- package/src/components/scroll-area.tsx +15 -1
- package/src/components/split-layout.tsx +19 -2
- package/src/hooks/use-breakpoint.ts +58 -0
- package/src/hooks/use-mobile.ts +20 -40
- package/src/index.ts +1 -0
- package/dist/hooks/use-mobile.cjs +0 -1
- package/dist/hooks/use-mobile.js +0 -26
package/dist/scroll-area.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ interface ScrollAreaProps extends React.ComponentProps<typeof ScrollAreaPrimitiv
|
|
|
16
16
|
* Tracking label for analytics context
|
|
17
17
|
*/
|
|
18
18
|
trackingLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Scrollbar orientation. "vertical" shows only vertical, "both" adds horizontal.
|
|
21
|
+
* @default "vertical"
|
|
22
|
+
*/
|
|
23
|
+
scrollOrientation?: "vertical" | "both";
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* ScrollArea provides a styled scrollable viewport with custom scrollbars.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAGnE;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CACpD,OAAO,mBAAmB,CAAC,IAAI,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAGnE;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CACpD,OAAO,mBAAmB,CAAC,IAAI,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CACzC;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,qGAuCf,CAAC;AAIF;;GAEG;AACH,UAAU,cAAe,SAAQ,KAAK,CAAC,cAAc,CACnD,OAAO,mBAAmB,CAAC,mBAAmB,CAC/C;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CACzC;AAED;;GAEG;AACH,QAAA,MAAM,SAAS,oGAwCd,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAEjC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/scroll-area.js
CHANGED
|
@@ -1,60 +1,69 @@
|
|
|
1
|
-
import { jsxs as f, jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
3
|
import * as l from "@radix-ui/react-scroll-area";
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
6
|
-
({
|
|
4
|
+
import { cn as m } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const h = d.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
className: o,
|
|
8
|
+
children: a,
|
|
9
|
+
dataHook: e,
|
|
10
|
+
trackingEl: t,
|
|
11
|
+
trackingLabel: s,
|
|
12
|
+
scrollOrientation: c = "vertical",
|
|
13
|
+
...i
|
|
14
|
+
}, b) => /* @__PURE__ */ f(
|
|
7
15
|
l.Root,
|
|
8
16
|
{
|
|
9
|
-
ref:
|
|
10
|
-
className:
|
|
17
|
+
ref: b,
|
|
18
|
+
className: m("relative", o),
|
|
11
19
|
"data-hook": e,
|
|
12
20
|
"data-slot": "scroll-area",
|
|
13
21
|
"data-tracking-el": t,
|
|
14
22
|
"data-tracking-label": s,
|
|
15
|
-
...
|
|
23
|
+
...i,
|
|
16
24
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ r(
|
|
18
26
|
l.Viewport,
|
|
19
27
|
{
|
|
20
28
|
className: "focus-visible:shadow-default size-full rounded-[inherit] p-1 transition-[color,box-shadow] outline-none",
|
|
21
29
|
"data-slot": "scroll-area-viewport",
|
|
22
30
|
tabIndex: 0,
|
|
23
|
-
children:
|
|
31
|
+
children: a
|
|
24
32
|
}
|
|
25
33
|
),
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ r(n, {}),
|
|
35
|
+
c === "both" && /* @__PURE__ */ r(n, { orientation: "horizontal" }),
|
|
36
|
+
/* @__PURE__ */ r(l.Corner, {})
|
|
28
37
|
]
|
|
29
38
|
}
|
|
30
39
|
)
|
|
31
40
|
);
|
|
32
|
-
|
|
33
|
-
const
|
|
41
|
+
h.displayName = "ScrollArea";
|
|
42
|
+
const n = d.forwardRef(
|
|
34
43
|
({
|
|
35
44
|
className: o,
|
|
36
|
-
orientation:
|
|
45
|
+
orientation: a = "vertical",
|
|
37
46
|
dataHook: e,
|
|
38
47
|
trackingEl: t,
|
|
39
48
|
trackingLabel: s,
|
|
40
49
|
...c
|
|
41
|
-
},
|
|
50
|
+
}, i) => /* @__PURE__ */ r(
|
|
42
51
|
l.ScrollAreaScrollbar,
|
|
43
52
|
{
|
|
44
|
-
ref:
|
|
45
|
-
className:
|
|
53
|
+
ref: i,
|
|
54
|
+
className: m(
|
|
46
55
|
"flex touch-none p-px transition-colors select-none",
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
a === "vertical" && "h-full w-2.5 border-l border-l-transparent",
|
|
57
|
+
a === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
|
|
49
58
|
o
|
|
50
59
|
),
|
|
51
60
|
"data-hook": e,
|
|
52
61
|
"data-slot": "scroll-area-scrollbar",
|
|
53
62
|
"data-tracking-el": t,
|
|
54
63
|
"data-tracking-label": s,
|
|
55
|
-
orientation:
|
|
64
|
+
orientation: a,
|
|
56
65
|
...c,
|
|
57
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ r(
|
|
58
67
|
l.ScrollAreaThumb,
|
|
59
68
|
{
|
|
60
69
|
className: "bg-border relative flex-1 rounded-full",
|
|
@@ -64,8 +73,8 @@ const m = i.forwardRef(
|
|
|
64
73
|
}
|
|
65
74
|
)
|
|
66
75
|
);
|
|
67
|
-
|
|
76
|
+
n.displayName = "ScrollBar";
|
|
68
77
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
h as ScrollArea,
|
|
79
|
+
n as ScrollBar
|
|
71
80
|
};
|
package/dist/split-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),i=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,l.get?l:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const n=S(h),g=n.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:l,left:o,right:r,children:c,...u},d)=>s.jsxs("div",{ref:d,className:i.cn("group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",t),"data-hook":a,"data-slot":"split-layout","data-tracking-el":e||"split-layout","data-tracking-label":l,...u,children:[c,o&&s.jsx(p,{children:o}),r&&s.jsx(f,{children:r})]}));g.displayName="SplitLayout";const y=n.forwardRef(({className:t,children:a,...e},l)=>s.jsx("div",{ref:l,className:i.cn("px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",t),"data-slot":"split-layout-header",...e,children:a}));y.displayName="SplitLayoutHeader";const p=n.forwardRef(({className:t,sticky:a=!1,children:e,...l},o)=>s.jsx("div",{ref:o,className:i.cn("p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto","group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",a&&"lg:sticky lg:top-0 lg:h-screen lg:self-start",t),"data-slot":"split-layout-left",...l,children:e}));p.displayName="SplitLayoutContentLeft";const f=n.forwardRef(({className:t,flush:a=!1,sticky:e=!1,children:l,...o},r)=>s.jsx("div",{ref:r,className:i.cn("bg-card hidden lg:col-start-2 lg:row-span-full lg:row-start-1",a?"relative overflow-hidden lg:block":"p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",e&&"lg:sticky lg:top-0 lg:h-screen lg:self-start",t),"data-slot":"split-layout-right",...o,children:l}));f.displayName="SplitLayoutContentRight";const m=n.forwardRef(({className:t,dataHook:a,src:e,alt:l,objectFit:o="cover",objectPosition:r="center",style:c,...u},d)=>s.jsx("img",{ref:d,alt:l,className:i.cn("absolute inset-0 h-full w-full",t),"data-hook":a,"data-slot":"split-layout-image",src:e,style:{objectFit:o,objectPosition:r,...c},...u}));m.displayName="SplitLayoutImage";exports.SplitLayout=g;exports.SplitLayoutContentLeft=p;exports.SplitLayoutContentRight=f;exports.SplitLayoutHeader=y;exports.SplitLayoutImage=m;
|
package/dist/split-layout.d.ts
CHANGED
|
@@ -86,6 +86,13 @@ interface SplitLayoutHeaderProps extends React.ComponentProps<"div"> {
|
|
|
86
86
|
declare const SplitLayoutHeader: React.ForwardRefExoticComponent<Omit<SplitLayoutHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
87
87
|
interface SplitLayoutContentLeftProps extends React.ComponentProps<"div"> {
|
|
88
88
|
children: React.ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* Pins the column to the viewport on desktop (≥lg) so it stays visible
|
|
91
|
+
* while the sibling column grows beyond one screen.
|
|
92
|
+
* Applies `sticky top-0 h-screen self-start`.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
sticky?: boolean;
|
|
89
96
|
}
|
|
90
97
|
/**
|
|
91
98
|
* SplitLayoutContentLeft - Left/primary section within a SplitLayout.
|
|
@@ -103,6 +110,14 @@ interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
|
|
|
103
110
|
* @default false
|
|
104
111
|
*/
|
|
105
112
|
flush?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Pins the column to the viewport on desktop (≥lg) so it stays visible
|
|
115
|
+
* while the sibling column grows beyond one screen.
|
|
116
|
+
* Applies `sticky top-0 h-screen self-start`.
|
|
117
|
+
* Can be combined with `flush` for a sticky full-bleed panel.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
sticky?: boolean;
|
|
106
121
|
}
|
|
107
122
|
/**
|
|
108
123
|
* SplitLayoutContentRight - Right/secondary section within a SplitLayout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-layout.d.ts","sourceRoot":"","sources":["../../src/components/split-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC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AChC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC3B,CAAC"}
|
package/dist/split-layout.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const y =
|
|
1
|
+
import { jsxs as g, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cn as n } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
const y = i.forwardRef(
|
|
5
5
|
({
|
|
6
6
|
className: t,
|
|
7
7
|
dataHook: a,
|
|
8
8
|
trackingEl: l,
|
|
9
9
|
trackingLabel: e,
|
|
10
|
-
left:
|
|
11
|
-
right:
|
|
12
|
-
children:
|
|
13
|
-
...
|
|
14
|
-
},
|
|
10
|
+
left: s,
|
|
11
|
+
right: o,
|
|
12
|
+
children: c,
|
|
13
|
+
...d
|
|
14
|
+
}, u) => /* @__PURE__ */ g(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
|
-
ref:
|
|
18
|
-
className:
|
|
17
|
+
ref: u,
|
|
18
|
+
className: n(
|
|
19
19
|
"group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",
|
|
20
20
|
t
|
|
21
21
|
),
|
|
@@ -23,21 +23,21 @@ const y = r.forwardRef(
|
|
|
23
23
|
"data-slot": "split-layout",
|
|
24
24
|
"data-tracking-el": l || "split-layout",
|
|
25
25
|
"data-tracking-label": e,
|
|
26
|
-
...
|
|
26
|
+
...d,
|
|
27
27
|
children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
c,
|
|
29
|
+
s && /* @__PURE__ */ r(p, { children: s }),
|
|
30
|
+
o && /* @__PURE__ */ r(f, { children: o })
|
|
31
31
|
]
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
);
|
|
35
35
|
y.displayName = "SplitLayout";
|
|
36
|
-
const
|
|
36
|
+
const m = i.forwardRef(({ className: t, children: a, ...l }, e) => /* @__PURE__ */ r(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
ref: e,
|
|
40
|
-
className:
|
|
40
|
+
className: n(
|
|
41
41
|
"px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",
|
|
42
42
|
t
|
|
43
43
|
),
|
|
@@ -46,58 +46,60 @@ const g = r.forwardRef(({ className: t, children: a, ...l }, e) => /* @__PURE__
|
|
|
46
46
|
children: a
|
|
47
47
|
}
|
|
48
48
|
));
|
|
49
|
-
|
|
50
|
-
const p =
|
|
49
|
+
m.displayName = "SplitLayoutHeader";
|
|
50
|
+
const p = i.forwardRef(({ className: t, sticky: a = !1, children: l, ...e }, s) => /* @__PURE__ */ r(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
|
-
ref:
|
|
54
|
-
className:
|
|
53
|
+
ref: s,
|
|
54
|
+
className: n(
|
|
55
55
|
"p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto",
|
|
56
56
|
"group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",
|
|
57
|
+
a && "lg:sticky lg:top-0 lg:h-screen lg:self-start",
|
|
57
58
|
t
|
|
58
59
|
),
|
|
59
60
|
"data-slot": "split-layout-left",
|
|
60
|
-
...
|
|
61
|
-
children:
|
|
61
|
+
...e,
|
|
62
|
+
children: l
|
|
62
63
|
}
|
|
63
64
|
));
|
|
64
65
|
p.displayName = "SplitLayoutContentLeft";
|
|
65
|
-
const f =
|
|
66
|
+
const f = i.forwardRef(({ className: t, flush: a = !1, sticky: l = !1, children: e, ...s }, o) => /* @__PURE__ */ r(
|
|
66
67
|
"div",
|
|
67
68
|
{
|
|
68
69
|
ref: o,
|
|
69
|
-
className:
|
|
70
|
+
className: n(
|
|
70
71
|
"bg-card hidden lg:col-start-2 lg:row-span-full lg:row-start-1",
|
|
71
72
|
a ? "relative overflow-hidden lg:block" : "p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",
|
|
73
|
+
l && "lg:sticky lg:top-0 lg:h-screen lg:self-start",
|
|
72
74
|
t
|
|
73
75
|
),
|
|
74
76
|
"data-slot": "split-layout-right",
|
|
75
|
-
...
|
|
76
|
-
children:
|
|
77
|
+
...s,
|
|
78
|
+
children: e
|
|
77
79
|
}
|
|
78
80
|
));
|
|
79
81
|
f.displayName = "SplitLayoutContentRight";
|
|
80
|
-
const h =
|
|
82
|
+
const h = i.forwardRef(
|
|
81
83
|
({
|
|
82
84
|
className: t,
|
|
83
85
|
dataHook: a,
|
|
84
86
|
src: l,
|
|
85
87
|
alt: e,
|
|
86
|
-
objectFit:
|
|
87
|
-
objectPosition:
|
|
88
|
-
style:
|
|
89
|
-
...
|
|
90
|
-
},
|
|
88
|
+
objectFit: s = "cover",
|
|
89
|
+
objectPosition: o = "center",
|
|
90
|
+
style: c,
|
|
91
|
+
...d
|
|
92
|
+
}, u) => /* @__PURE__ */ r(
|
|
91
93
|
"img",
|
|
92
94
|
{
|
|
93
|
-
ref:
|
|
95
|
+
ref: u,
|
|
94
96
|
alt: e,
|
|
95
|
-
className:
|
|
97
|
+
className: n("absolute inset-0 h-full w-full", t),
|
|
96
98
|
"data-hook": a,
|
|
97
99
|
"data-slot": "split-layout-image",
|
|
98
100
|
src: l,
|
|
99
|
-
style: { objectFit:
|
|
100
|
-
...
|
|
101
|
+
style: { objectFit: s, objectPosition: o, ...c },
|
|
102
|
+
...d
|
|
101
103
|
}
|
|
102
104
|
)
|
|
103
105
|
);
|
|
@@ -106,6 +108,6 @@ export {
|
|
|
106
108
|
y as SplitLayout,
|
|
107
109
|
p as SplitLayoutContentLeft,
|
|
108
110
|
f as SplitLayoutContentRight,
|
|
109
|
-
|
|
111
|
+
m as SplitLayoutHeader,
|
|
110
112
|
h as SplitLayoutImage
|
|
111
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"vite-bundle-visualizer": "^1.2.1",
|
|
131
131
|
"vite-plugin-dts": "^4.5.4",
|
|
132
132
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
133
|
-
"@workspace/
|
|
134
|
-
"@workspace/
|
|
133
|
+
"@workspace/eslint-config": "0.0.0",
|
|
134
|
+
"@workspace/typescript-config": "0.0.0"
|
|
135
135
|
},
|
|
136
136
|
"publishConfig": {
|
|
137
137
|
"access": "public",
|
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
* renders only visible rows via `@tanstack/react-virtual`. Use for large
|
|
13
13
|
* datasets (1 000+ rows) where full DOM rendering is too expensive.
|
|
14
14
|
* - Helpers: `DataTableSearch`, `DataTablePagination`,
|
|
15
|
-
* `DataTableColumnHeader`, `
|
|
16
|
-
* `
|
|
15
|
+
* `DataTableColumnHeader`, `DataTableSelectAllCheckbox`,
|
|
16
|
+
* `DataTableSelectRowCheckbox`.
|
|
17
|
+
* - Layout: `DataTableToolbar`, `DataTableToolbarLeft`,
|
|
18
|
+
* `DataTableToolbarRight` — responsive flex container for search +
|
|
19
|
+
* pagination above (or below) the table.
|
|
17
20
|
*
|
|
18
21
|
* Block composition example — see `apps/sandbox/components/audit-table.tsx`.
|
|
19
22
|
*/
|
|
@@ -37,23 +40,11 @@ import {
|
|
|
37
40
|
useReactTable,
|
|
38
41
|
} from "@tanstack/react-table";
|
|
39
42
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
40
|
-
import {
|
|
41
|
-
ArrowDown,
|
|
42
|
-
ArrowUp,
|
|
43
|
-
ArrowUpDown,
|
|
44
|
-
Ellipsis,
|
|
45
|
-
Search,
|
|
46
|
-
X,
|
|
47
|
-
} from "@brightlocal/icons";
|
|
43
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, Search, X } from "@brightlocal/icons";
|
|
48
44
|
|
|
49
45
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
50
46
|
import { Button } from "../components/button";
|
|
51
47
|
import { Checkbox } from "../components/checkbox";
|
|
52
|
-
import {
|
|
53
|
-
DropdownMenu,
|
|
54
|
-
DropdownMenuContent,
|
|
55
|
-
DropdownMenuTrigger,
|
|
56
|
-
} from "../components/dropdown-menu";
|
|
57
48
|
import {
|
|
58
49
|
InputGroup,
|
|
59
50
|
InputGroupAddon,
|
|
@@ -858,65 +849,6 @@ export function DataTableColumnHeader<TData, TValue>({
|
|
|
858
849
|
|
|
859
850
|
DataTableColumnHeader.displayName = "DataTableColumnHeader";
|
|
860
851
|
|
|
861
|
-
/* -------------------------------------------------------------------------------------------------
|
|
862
|
-
* DataTableRowActions (row ellipsis menu)
|
|
863
|
-
* -----------------------------------------------------------------------------------------------*/
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* Props for `DataTableRowActions` — the standard row ellipsis actions menu.
|
|
867
|
-
*/
|
|
868
|
-
export interface DataTableRowActionsProps<TData> {
|
|
869
|
-
/** TanStack row instance (from the `cell` render slot). */
|
|
870
|
-
row: Row<TData>;
|
|
871
|
-
/** Data hook for automated testing. */
|
|
872
|
-
dataHook?: string;
|
|
873
|
-
/** Analytics element identifier. */
|
|
874
|
-
trackingEl?: string;
|
|
875
|
-
/** Analytics label. */
|
|
876
|
-
trackingLabel?: string;
|
|
877
|
-
/** Accessible label for the trigger. @default "Open row actions menu" */
|
|
878
|
-
ariaLabel?: string;
|
|
879
|
-
/** `DropdownMenuItem`s to render inside the menu. */
|
|
880
|
-
children?: React.ReactNode;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Row-level ellipsis dropdown menu. Pass `DropdownMenuItem`s as children.
|
|
885
|
-
*/
|
|
886
|
-
export function DataTableRowActions<TData>({
|
|
887
|
-
row,
|
|
888
|
-
dataHook,
|
|
889
|
-
trackingEl,
|
|
890
|
-
trackingLabel,
|
|
891
|
-
ariaLabel = "Open row actions menu",
|
|
892
|
-
children,
|
|
893
|
-
}: DataTableRowActionsProps<TData>) {
|
|
894
|
-
return (
|
|
895
|
-
<DropdownMenu>
|
|
896
|
-
<DropdownMenuTrigger asChild data-slot="data-table-row-actions">
|
|
897
|
-
<Button
|
|
898
|
-
aria-label={ariaLabel}
|
|
899
|
-
dataHook={dataHook || `row-actions-${row.id}`}
|
|
900
|
-
size="sm"
|
|
901
|
-
trackingEl={trackingEl}
|
|
902
|
-
trackingLabel={trackingLabel}
|
|
903
|
-
variant="ghost"
|
|
904
|
-
>
|
|
905
|
-
<Ellipsis />
|
|
906
|
-
</Button>
|
|
907
|
-
</DropdownMenuTrigger>
|
|
908
|
-
<DropdownMenuContent
|
|
909
|
-
align="end"
|
|
910
|
-
dataHook={dataHook ? `${dataHook}-menu` : `row-actions-${row.id}-menu`}
|
|
911
|
-
>
|
|
912
|
-
{children}
|
|
913
|
-
</DropdownMenuContent>
|
|
914
|
-
</DropdownMenu>
|
|
915
|
-
);
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
DataTableRowActions.displayName = "DataTableRowActions";
|
|
919
|
-
|
|
920
852
|
/* -------------------------------------------------------------------------------------------------
|
|
921
853
|
* DataTableSearch (filter input)
|
|
922
854
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -1378,7 +1310,7 @@ export function DataTablePagination<TData>({
|
|
|
1378
1310
|
return (
|
|
1379
1311
|
<DataTablePaginationContext.Provider value={contextValue}>
|
|
1380
1312
|
<div
|
|
1381
|
-
className={cn("flex items-center gap-4", className)}
|
|
1313
|
+
className={cn("flex w-full items-center gap-4", className)}
|
|
1382
1314
|
{...wrapperDataAttrs}
|
|
1383
1315
|
>
|
|
1384
1316
|
{children}
|
|
@@ -1407,7 +1339,7 @@ export function DataTablePagination<TData>({
|
|
|
1407
1339
|
<DataTablePaginationContext.Provider value={contextValue}>
|
|
1408
1340
|
<div
|
|
1409
1341
|
className={cn(
|
|
1410
|
-
"flex items-center gap-4",
|
|
1342
|
+
"flex w-full items-center gap-4",
|
|
1411
1343
|
rowCountContent != null ? "justify-between" : "justify-end",
|
|
1412
1344
|
className
|
|
1413
1345
|
)}
|
|
@@ -1513,6 +1445,137 @@ export function DataTableSelectRowCheckbox<TData>({
|
|
|
1513
1445
|
|
|
1514
1446
|
DataTableSelectRowCheckbox.displayName = "DataTableSelectRowCheckbox";
|
|
1515
1447
|
|
|
1448
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1449
|
+
* DataTableToolbar (layout container)
|
|
1450
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Props for `DataTableToolbar` — a responsive flex container for laying out
|
|
1454
|
+
* search, filters, pagination, and actions above (or below) a DataTable.
|
|
1455
|
+
*/
|
|
1456
|
+
export interface DataTableToolbarProps {
|
|
1457
|
+
/** Data hook for automated testing (REQUIRED). */
|
|
1458
|
+
dataHook: string;
|
|
1459
|
+
/** Additional class name (merged after defaults via `cn`). */
|
|
1460
|
+
className?: string;
|
|
1461
|
+
/** Toolbar contents — typically `DataTableToolbarLeft` and `DataTableToolbarRight`. */
|
|
1462
|
+
children: React.ReactNode;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Responsive toolbar container for DataTable companion controls.
|
|
1467
|
+
*
|
|
1468
|
+
* Stacks vertically on mobile (< 640 px) and switches to a horizontal
|
|
1469
|
+
* row on `sm:` and up. Layout-only — no dependency on a TanStack Table
|
|
1470
|
+
* instance, so it works for table footers or any search-plus-pagination row.
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* <DataTableToolbar dataHook="locations-toolbar">
|
|
1474
|
+
* <DataTableToolbarLeft>
|
|
1475
|
+
* <DataTableSearch table={table} dataHook="search" />
|
|
1476
|
+
* </DataTableToolbarLeft>
|
|
1477
|
+
* <DataTableToolbarRight>
|
|
1478
|
+
* <DataTablePagination table={table} dataHook="pagination" />
|
|
1479
|
+
* </DataTableToolbarRight>
|
|
1480
|
+
* </DataTableToolbar>
|
|
1481
|
+
*/
|
|
1482
|
+
export function DataTableToolbar({
|
|
1483
|
+
dataHook,
|
|
1484
|
+
className,
|
|
1485
|
+
children,
|
|
1486
|
+
}: DataTableToolbarProps) {
|
|
1487
|
+
return (
|
|
1488
|
+
<div
|
|
1489
|
+
className={cn(
|
|
1490
|
+
"flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
|
|
1491
|
+
className
|
|
1492
|
+
)}
|
|
1493
|
+
data-hook={dataHook}
|
|
1494
|
+
data-slot="data-table-toolbar"
|
|
1495
|
+
>
|
|
1496
|
+
{children}
|
|
1497
|
+
</div>
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
DataTableToolbar.displayName = "DataTableToolbar";
|
|
1502
|
+
|
|
1503
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1504
|
+
* DataTableToolbarLeft (search / filters slot)
|
|
1505
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Props for `DataTableToolbarLeft` — the left slot inside a `DataTableToolbar`.
|
|
1509
|
+
*/
|
|
1510
|
+
export interface DataTableToolbarLeftProps {
|
|
1511
|
+
/** Additional class name (merged after defaults via `cn`). */
|
|
1512
|
+
className?: string;
|
|
1513
|
+
/** Slot contents — typically `DataTableSearch` and filter controls. */
|
|
1514
|
+
children: React.ReactNode;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Left slot of `DataTableToolbar`. Grows to fill remaining space on
|
|
1519
|
+
* desktop; full-width on mobile. `min-w-0` lets long inputs shrink
|
|
1520
|
+
* instead of overflowing on narrow viewports.
|
|
1521
|
+
*/
|
|
1522
|
+
export function DataTableToolbarLeft({
|
|
1523
|
+
className,
|
|
1524
|
+
children,
|
|
1525
|
+
}: DataTableToolbarLeftProps) {
|
|
1526
|
+
return (
|
|
1527
|
+
<div
|
|
1528
|
+
className={cn(
|
|
1529
|
+
"flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
|
|
1530
|
+
className
|
|
1531
|
+
)}
|
|
1532
|
+
data-slot="data-table-toolbar-left"
|
|
1533
|
+
>
|
|
1534
|
+
{children}
|
|
1535
|
+
</div>
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
DataTableToolbarLeft.displayName = "DataTableToolbarLeft";
|
|
1540
|
+
|
|
1541
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1542
|
+
* DataTableToolbarRight (pagination / actions slot)
|
|
1543
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Props for `DataTableToolbarRight` — the right slot inside a `DataTableToolbar`.
|
|
1547
|
+
*/
|
|
1548
|
+
export interface DataTableToolbarRightProps {
|
|
1549
|
+
/** Additional class name (merged after defaults via `cn`). */
|
|
1550
|
+
className?: string;
|
|
1551
|
+
/** Slot contents — typically `DataTablePagination` or action buttons. */
|
|
1552
|
+
children: React.ReactNode;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Right slot of `DataTableToolbar`. Collapses to content width and
|
|
1557
|
+
* right-aligns on desktop; full-width with `justify-end` on mobile so
|
|
1558
|
+
* pagination controls don't jump when stacking.
|
|
1559
|
+
*/
|
|
1560
|
+
export function DataTableToolbarRight({
|
|
1561
|
+
className,
|
|
1562
|
+
children,
|
|
1563
|
+
}: DataTableToolbarRightProps) {
|
|
1564
|
+
return (
|
|
1565
|
+
<div
|
|
1566
|
+
className={cn(
|
|
1567
|
+
"flex w-full items-center justify-end gap-2 sm:w-auto",
|
|
1568
|
+
className
|
|
1569
|
+
)}
|
|
1570
|
+
data-slot="data-table-toolbar-right"
|
|
1571
|
+
>
|
|
1572
|
+
{children}
|
|
1573
|
+
</div>
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
DataTableToolbarRight.displayName = "DataTableToolbarRight";
|
|
1578
|
+
|
|
1516
1579
|
/* -------------------------------------------------------------------------------------------------
|
|
1517
1580
|
* Re-exported TanStack Table helpers
|
|
1518
1581
|
* -----------------------------------------------------------------------------------------------*/
|