@brightlocal/ui-components 2.4.0 → 2.6.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/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.js +23 -23
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +77 -3
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +403 -283
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +65 -21
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +128 -66
- package/dist/hooks/use-mobile.cjs +1 -1
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +17 -12
- package/dist/index.cjs +1 -1
- package/dist/index.js +356 -347
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +6 -6
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +37 -34
- package/package.json +1 -1
- package/src/blocks/data-table.tsx +2 -2
- package/src/blocks/sidebar.tsx +259 -21
- package/src/components/global-layout.tsx +190 -42
- package/src/components/table.tsx +75 -27
- package/src/hooks/use-mobile.ts +7 -1
package/dist/table.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 o=require("react/jsx-runtime"),y=require("react"),b=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils");function w(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const s=w(y),N=b.cva("align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",{variants:{size:{default:"h-12 p-2",md:"h-16 p-2",lg:"h-24 p-2"},align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{size:"default",align:"left"}}),j=b.cva("h-10 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",{variants:{align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{align:"left"}}),f=s.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:l,...n},d)=>o.jsx("div",{className:"relative w-full overflow-x-auto","data-slot":"table-container",children:o.jsx("table",{ref:d,className:r.cn("w-full caption-bottom text-sm",e),"data-hook":t,"data-slot":"table","data-tracking-el":a,"data-tracking-label":l,...n})}));f.displayName="Table";const u=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("thead",{ref:l,className:r.cn(e),"data-hook":t,"data-slot":"table-header",...a}));u.displayName="TableHeader";const m=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tbody",{ref:l,className:r.cn(e),"data-hook":t,"data-slot":"table-body",...a}));m.displayName="TableBody";const g=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tfoot",{ref:l,className:r.cn("bg-muted/50",e),"data-hook":t,"data-slot":"table-footer",...a}));g.displayName="TableFooter";const p=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tr",{ref:l,className:r.cn("data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",e),"data-hook":t,"data-slot":"table-row",...a}));p.displayName="TableRow";const x=s.forwardRef(({className:e,dataHook:t,align:a,minWidth:l,style:n,scope:d="col",...i},c)=>o.jsx("th",{ref:c,className:r.cn(j({align:a}),e),"data-hook":t,"data-slot":"table-head",scope:d,style:{minWidth:l,...n},...i}));x.displayName="TableHead";const T=s.forwardRef(({className:e,dataHook:t,size:a,align:l,minWidth:n,style:d,...i},c)=>o.jsx("td",{ref:c,className:r.cn(N({size:a,align:l}),e),"data-hook":t,"data-slot":"table-cell",style:{minWidth:n,...d},...i}));T.displayName="TableCell";const h=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("caption",{ref:l,className:r.cn("text-muted-foreground mt-4 text-center text-sm",e),"data-hook":t,"data-slot":"table-caption",...a}));h.displayName="TableCaption";exports.Table=f;exports.TableBody=m;exports.TableCaption=h;exports.TableCell=T;exports.TableFooter=g;exports.TableHead=x;exports.TableHeader=u;exports.TableRow=p;
|
package/dist/table.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const tableCellVariants: (props?: ({
|
|
4
4
|
size?: "default" | "lg" | "md" | null | undefined;
|
|
5
|
-
align?: "left" | "right" | null | undefined;
|
|
5
|
+
align?: "center" | "left" | "right" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
declare const tableHeadVariants: (props?: ({
|
|
8
|
-
align?: "left" | "right" | null | undefined;
|
|
8
|
+
align?: "center" | "left" | "right" | null | undefined;
|
|
9
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
10
|
interface TableProps extends React.ComponentProps<"table"> {
|
|
11
11
|
/**
|
|
@@ -60,10 +60,10 @@ interface TableHeadProps extends Omit<React.ComponentProps<"th">, "align">, Vari
|
|
|
60
60
|
*/
|
|
61
61
|
minWidth?: string;
|
|
62
62
|
/**
|
|
63
|
-
* Text alignment for the header cell
|
|
63
|
+
* Text alignment for the header cell.
|
|
64
64
|
* @default "left"
|
|
65
65
|
*/
|
|
66
|
-
align?: "left" | "right";
|
|
66
|
+
align?: "left" | "right" | "center";
|
|
67
67
|
}
|
|
68
68
|
declare const TableHead: React.ForwardRefExoticComponent<Omit<TableHeadProps, "ref"> & React.RefAttributes<HTMLTableCellElement>>;
|
|
69
69
|
interface TableCellProps extends Omit<React.ComponentProps<"td">, "align">, VariantProps<typeof tableCellVariants> {
|
|
@@ -81,10 +81,10 @@ interface TableCellProps extends Omit<React.ComponentProps<"td">, "align">, Vari
|
|
|
81
81
|
*/
|
|
82
82
|
size?: "default" | "md" | "lg";
|
|
83
83
|
/**
|
|
84
|
-
* Text alignment for the cell
|
|
84
|
+
* Text alignment for the cell.
|
|
85
85
|
* @default "left"
|
|
86
86
|
*/
|
|
87
|
-
align?: "left" | "right";
|
|
87
|
+
align?: "left" | "right" | "center";
|
|
88
88
|
}
|
|
89
89
|
declare const TableCell: React.ForwardRefExoticComponent<Omit<TableCellProps, "ref"> & React.RefAttributes<HTMLTableCellElement>>;
|
|
90
90
|
interface TableCaptionProps extends React.ComponentProps<"caption"> {
|
package/dist/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,QAAA,MAAM,iBAAiB;;;8EAoBtB,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EActB,CAAC;AAMF,UAAU,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,KAAK,kGAmBV,CAAC;AAQF,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IAC9D;;OAEG;IACH,QA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GAAG,QAAQ,CAAC;CACrC;AAED,QAAA,MAAM,SAAS,0GAWd,CAAC;AAQF,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC;IACjE;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,YAAY,gHAWhB,CAAC;AAQH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC;AAEF,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,CAAC"}
|
package/dist/table.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
|
-
import { cva as
|
|
3
|
+
import { cva as f } from "class-variance-authority";
|
|
4
4
|
import { cn as r } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const
|
|
5
|
+
const b = f(
|
|
6
6
|
"align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
@@ -13,7 +13,8 @@ const f = b(
|
|
|
13
13
|
},
|
|
14
14
|
align: {
|
|
15
15
|
left: "text-left",
|
|
16
|
-
right: "text-right"
|
|
16
|
+
right: "text-right",
|
|
17
|
+
center: "text-center"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
defaultVariants: {
|
|
@@ -21,21 +22,22 @@ const f = b(
|
|
|
21
22
|
align: "left"
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
), c =
|
|
25
|
-
"h-10 p-2
|
|
25
|
+
), c = f(
|
|
26
|
+
"h-10 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",
|
|
26
27
|
{
|
|
27
28
|
variants: {
|
|
28
29
|
align: {
|
|
29
30
|
left: "text-left",
|
|
30
|
-
right: "text-right"
|
|
31
|
+
right: "text-right",
|
|
32
|
+
center: "text-center"
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
defaultVariants: {
|
|
34
36
|
align: "left"
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
),
|
|
38
|
-
({ className: a, dataHook: t, trackingEl: e, trackingLabel: o, ...s },
|
|
39
|
+
), u = d.forwardRef(
|
|
40
|
+
({ className: a, dataHook: t, trackingEl: e, trackingLabel: o, ...s }, n) => /* @__PURE__ */ l(
|
|
39
41
|
"div",
|
|
40
42
|
{
|
|
41
43
|
className: "relative w-full overflow-x-auto",
|
|
@@ -43,7 +45,7 @@ const f = b(
|
|
|
43
45
|
children: /* @__PURE__ */ l(
|
|
44
46
|
"table",
|
|
45
47
|
{
|
|
46
|
-
ref:
|
|
48
|
+
ref: n,
|
|
47
49
|
className: r("w-full caption-bottom text-sm", a),
|
|
48
50
|
"data-hook": t,
|
|
49
51
|
"data-slot": "table",
|
|
@@ -55,26 +57,26 @@ const f = b(
|
|
|
55
57
|
}
|
|
56
58
|
)
|
|
57
59
|
);
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
+
u.displayName = "Table";
|
|
61
|
+
const h = d.forwardRef(
|
|
60
62
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
61
63
|
"thead",
|
|
62
64
|
{
|
|
63
65
|
ref: o,
|
|
64
|
-
className: r(
|
|
66
|
+
className: r(a),
|
|
65
67
|
"data-hook": t,
|
|
66
68
|
"data-slot": "table-header",
|
|
67
69
|
...e
|
|
68
70
|
}
|
|
69
71
|
)
|
|
70
72
|
);
|
|
71
|
-
|
|
73
|
+
h.displayName = "TableHeader";
|
|
72
74
|
const g = d.forwardRef(
|
|
73
75
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
74
76
|
"tbody",
|
|
75
77
|
{
|
|
76
78
|
ref: o,
|
|
77
|
-
className: r(
|
|
79
|
+
className: r(a),
|
|
78
80
|
"data-hook": t,
|
|
79
81
|
"data-slot": "table-body",
|
|
80
82
|
...e
|
|
@@ -87,7 +89,7 @@ const p = d.forwardRef(
|
|
|
87
89
|
"tfoot",
|
|
88
90
|
{
|
|
89
91
|
ref: o,
|
|
90
|
-
className: r("bg-muted/50
|
|
92
|
+
className: r("bg-muted/50", a),
|
|
91
93
|
"data-hook": t,
|
|
92
94
|
"data-slot": "table-footer",
|
|
93
95
|
...e
|
|
@@ -101,7 +103,7 @@ const w = d.forwardRef(
|
|
|
101
103
|
{
|
|
102
104
|
ref: o,
|
|
103
105
|
className: r(
|
|
104
|
-
"data-[state=selected]:bg-muted
|
|
106
|
+
"data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",
|
|
105
107
|
a
|
|
106
108
|
),
|
|
107
109
|
"data-hook": t,
|
|
@@ -111,52 +113,53 @@ const w = d.forwardRef(
|
|
|
111
113
|
)
|
|
112
114
|
);
|
|
113
115
|
w.displayName = "TableRow";
|
|
114
|
-
const
|
|
115
|
-
({ className: a, dataHook: t, align: e, minWidth: o, style: s, ...i },
|
|
116
|
+
const x = d.forwardRef(
|
|
117
|
+
({ className: a, dataHook: t, align: e, minWidth: o, style: s, scope: n = "col", ...i }, m) => /* @__PURE__ */ l(
|
|
116
118
|
"th",
|
|
117
119
|
{
|
|
118
|
-
ref:
|
|
120
|
+
ref: m,
|
|
119
121
|
className: r(c({ align: e }), a),
|
|
120
122
|
"data-hook": t,
|
|
121
123
|
"data-slot": "table-head",
|
|
124
|
+
scope: n,
|
|
122
125
|
style: { minWidth: o, ...s },
|
|
123
126
|
...i
|
|
124
127
|
}
|
|
125
128
|
)
|
|
126
129
|
);
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
({ className: a, dataHook: t, size: e, align: o, minWidth: s, style:
|
|
130
|
+
x.displayName = "TableHead";
|
|
131
|
+
const N = d.forwardRef(
|
|
132
|
+
({ className: a, dataHook: t, size: e, align: o, minWidth: s, style: n, ...i }, m) => /* @__PURE__ */ l(
|
|
130
133
|
"td",
|
|
131
134
|
{
|
|
132
135
|
ref: m,
|
|
133
|
-
className: r(
|
|
136
|
+
className: r(b({ size: e, align: o }), a),
|
|
134
137
|
"data-hook": t,
|
|
135
138
|
"data-slot": "table-cell",
|
|
136
|
-
style: { minWidth: s, ...
|
|
137
|
-
...
|
|
139
|
+
style: { minWidth: s, ...n },
|
|
140
|
+
...i
|
|
138
141
|
}
|
|
139
142
|
)
|
|
140
143
|
);
|
|
141
|
-
|
|
142
|
-
const
|
|
144
|
+
N.displayName = "TableCell";
|
|
145
|
+
const T = d.forwardRef(({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
143
146
|
"caption",
|
|
144
147
|
{
|
|
145
148
|
ref: o,
|
|
146
|
-
className: r("text-muted-foreground mt-4 text-sm", a),
|
|
149
|
+
className: r("text-muted-foreground mt-4 text-center text-sm", a),
|
|
147
150
|
"data-hook": t,
|
|
148
151
|
"data-slot": "table-caption",
|
|
149
152
|
...e
|
|
150
153
|
}
|
|
151
154
|
));
|
|
152
|
-
|
|
155
|
+
T.displayName = "TableCaption";
|
|
153
156
|
export {
|
|
154
|
-
|
|
157
|
+
u as Table,
|
|
155
158
|
g as TableBody,
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
T as TableCaption,
|
|
160
|
+
N as TableCell,
|
|
158
161
|
p as TableFooter,
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
x as TableHead,
|
|
163
|
+
h as TableHeader,
|
|
161
164
|
w as TableRow
|
|
162
165
|
};
|
package/package.json
CHANGED
|
@@ -447,7 +447,7 @@ export function DataTable<TData>({
|
|
|
447
447
|
return (
|
|
448
448
|
<div
|
|
449
449
|
aria-busy={isLoading || undefined}
|
|
450
|
-
className={cn(className)}
|
|
450
|
+
className={cn("border-border rounded-md border", className)}
|
|
451
451
|
data-hook={dataHook}
|
|
452
452
|
data-slot="data-table-view"
|
|
453
453
|
data-tracking-el={trackingEl}
|
|
@@ -675,7 +675,7 @@ export function VirtualizedDataTable<TData>({
|
|
|
675
675
|
<div
|
|
676
676
|
ref={scrollContainerRef}
|
|
677
677
|
aria-busy={isLoading || undefined}
|
|
678
|
-
className={cn("overflow-auto", className)}
|
|
678
|
+
className={cn("border-border overflow-auto rounded-md border", className)}
|
|
679
679
|
data-hook={dataHook}
|
|
680
680
|
data-slot="data-table-view"
|
|
681
681
|
data-tracking-el={trackingEl}
|