@brightlocal/ui-components 2.21.0 → 2.22.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 +22 -5
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +35 -3
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +178 -152
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +45 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -68
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +7 -5
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +5 -7
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +82 -90
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +22 -2
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -43
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +36 -36
- package/package.json +1 -1
- package/src/blocks/data-table.tsx +56 -2
- package/src/components/hover-card.tsx +6 -3
- package/src/components/navigation-menu.tsx +80 -101
- package/src/components/table.tsx +44 -7
- package/src/components/tooltip.tsx +8 -5
- package/src/lib/utils.ts +3 -0
|
@@ -37,13 +37,11 @@ type NavigationMenuTriggerProps = React.ComponentPropsWithoutRef<typeof Navigati
|
|
|
37
37
|
* closes it immediately (see radix-ui/primitives#1630).
|
|
38
38
|
*
|
|
39
39
|
* We port Base UI's "patient click" behaviour: an instinctive mouse click made
|
|
40
|
-
* within {@link PATIENT_CLICK_THRESHOLD_MS} of the
|
|
41
|
-
* (calling `preventDefault()` makes Radix's internal
|
|
42
|
-
* skip its toggle).
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* menu shut, and touch taps and keyboard activation are left untouched so they
|
|
46
|
-
* can toggle it too.
|
|
40
|
+
* within {@link PATIENT_CLICK_THRESHOLD_MS} of the pointer entering an open
|
|
41
|
+
* trigger keeps the menu open (calling `preventDefault()` makes Radix's internal
|
|
42
|
+
* `composeEventHandlers` skip its toggle). A deliberate click after that window
|
|
43
|
+
* still toggles the menu shut, and touch taps and keyboard activation are left
|
|
44
|
+
* untouched so they can toggle it too.
|
|
47
45
|
*/
|
|
48
46
|
declare const NavigationMenuTrigger: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
49
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../src/components/navigation-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,uBAAuB,MAAM,iCAAiC,CAAC;AAK3E;;;GAGG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,wBAAwB,CAClE,OAAO,uBAAuB,CAAC,IAAI,CACpC;IACC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,yFAoBlB,CAAC;AAIH;;;GAGG;AACH,QAAA,MAAM,kBAAkB,+KAatB,CAAC;AAIH;;GAEG;AACH,QAAA,MAAM,kBAAkB,yKAStB,CAAC;AAIH;;GAEG;AACH,KAAK,0BAA0B,GAAG,KAAK,CAAC,wBAAwB,CAC9D,OAAO,uBAAuB,CAAC,OAAO,CACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../src/components/navigation-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,C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package/dist/navigation-menu.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
3
|
import * as s from "@radix-ui/react-navigation-menu";
|
|
4
|
-
import { ChevronDown as
|
|
4
|
+
import { ChevronDown as b } from "@brightlocal/icons";
|
|
5
5
|
import { cn as r } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
-
const h = i.forwardRef(({ className: t, children: e, dataHook:
|
|
6
|
+
const h = i.forwardRef(({ className: t, children: e, dataHook: a, delayDuration: d = 50, ...c }, l) => (
|
|
7
7
|
// Radix defaults delayDuration to 200ms, which reads as a laggy hover-open.
|
|
8
8
|
// Match Base UI's snappier 50ms default (still overridable via props).
|
|
9
|
-
/* @__PURE__ */
|
|
9
|
+
/* @__PURE__ */ f(
|
|
10
10
|
s.Root,
|
|
11
11
|
{
|
|
12
|
-
ref:
|
|
12
|
+
ref: l,
|
|
13
13
|
className: r(
|
|
14
14
|
"relative z-10 flex max-w-max flex-1 items-center justify-center",
|
|
15
15
|
t
|
|
16
16
|
),
|
|
17
|
-
"data-hook":
|
|
17
|
+
"data-hook": a,
|
|
18
18
|
"data-slot": "navigation-menu",
|
|
19
|
-
delayDuration:
|
|
20
|
-
...
|
|
19
|
+
delayDuration: d,
|
|
20
|
+
...c,
|
|
21
21
|
children: [
|
|
22
22
|
e,
|
|
23
|
-
/* @__PURE__ */ n(
|
|
23
|
+
/* @__PURE__ */ n(g, {})
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
27
|
));
|
|
28
28
|
h.displayName = "NavigationMenu";
|
|
29
|
-
const
|
|
29
|
+
const w = i.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(
|
|
30
30
|
s.List,
|
|
31
31
|
{
|
|
32
|
-
ref:
|
|
32
|
+
ref: a,
|
|
33
33
|
className: r(
|
|
34
34
|
"group flex flex-1 list-none items-center justify-center gap-1",
|
|
35
35
|
t
|
|
@@ -38,8 +38,8 @@ const x = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
|
38
38
|
...e
|
|
39
39
|
}
|
|
40
40
|
));
|
|
41
|
-
|
|
42
|
-
const
|
|
41
|
+
w.displayName = "NavigationMenuList";
|
|
42
|
+
const x = i.forwardRef((t, e) => /* @__PURE__ */ n(
|
|
43
43
|
s.Item,
|
|
44
44
|
{
|
|
45
45
|
ref: e,
|
|
@@ -47,69 +47,61 @@ const y = i.forwardRef((t, e) => /* @__PURE__ */ n(
|
|
|
47
47
|
...t
|
|
48
48
|
}
|
|
49
49
|
));
|
|
50
|
-
|
|
51
|
-
const M =
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
x.displayName = "NavigationMenuItem";
|
|
51
|
+
const M = 400, y = i.forwardRef(
|
|
52
|
+
({ className: t, children: e, onClick: a, onPointerDown: d, onPointerEnter: c, ...l }, p) => {
|
|
53
|
+
const u = i.useRef(""), m = i.useRef(0);
|
|
54
|
+
return /* @__PURE__ */ f(
|
|
55
|
+
s.Trigger,
|
|
56
|
+
{
|
|
57
|
+
ref: p,
|
|
58
|
+
className: r(
|
|
59
|
+
[
|
|
60
|
+
"group inline-flex h-9 w-max items-center justify-center gap-1",
|
|
61
|
+
"rounded-md px-4 py-2",
|
|
62
|
+
"text-sm font-medium",
|
|
63
|
+
"text-foreground",
|
|
64
|
+
"transition-colors",
|
|
65
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
66
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
67
|
+
"focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
|
|
68
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
69
|
+
"data-[state=open]:bg-accent/50"
|
|
70
|
+
],
|
|
71
|
+
t
|
|
72
|
+
),
|
|
73
|
+
"data-slot": "navigation-menu-trigger",
|
|
74
|
+
onClick: (o) => {
|
|
75
|
+
const v = o.currentTarget.getAttribute("data-state") === "open", N = o.timeStamp - m.current < M;
|
|
76
|
+
u.current === "mouse" && o.detail > 0 && v && N && o.preventDefault(), a?.(o);
|
|
77
|
+
},
|
|
78
|
+
onPointerDown: (o) => {
|
|
79
|
+
u.current = o.pointerType, d?.(o);
|
|
80
|
+
},
|
|
81
|
+
onPointerEnter: (o) => {
|
|
82
|
+
m.current = o.timeStamp, c?.(o);
|
|
83
|
+
},
|
|
84
|
+
...l,
|
|
85
|
+
children: [
|
|
86
|
+
e,
|
|
87
|
+
/* @__PURE__ */ n(
|
|
88
|
+
b,
|
|
89
|
+
{
|
|
90
|
+
"aria-hidden": "true",
|
|
91
|
+
className: "relative top-[1px] ml-1 transition duration-300 group-data-[state=open]:rotate-180",
|
|
92
|
+
size: 12
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
62
96
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
ref: b,
|
|
70
|
-
className: r(
|
|
71
|
-
[
|
|
72
|
-
"group inline-flex h-9 w-max items-center justify-center gap-1",
|
|
73
|
-
"rounded-md px-4 py-2",
|
|
74
|
-
"text-sm font-medium",
|
|
75
|
-
"text-foreground",
|
|
76
|
-
"transition-colors",
|
|
77
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
78
|
-
"focus:bg-accent focus:text-accent-foreground",
|
|
79
|
-
"focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
|
|
80
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
81
|
-
"data-[state=open]:bg-accent/50"
|
|
82
|
-
],
|
|
83
|
-
t
|
|
84
|
-
),
|
|
85
|
-
"data-slot": "navigation-menu-trigger",
|
|
86
|
-
onClick: (a) => {
|
|
87
|
-
const c = a.currentTarget.getAttribute("data-state") === "open", N = a.timeStamp - f.current < M;
|
|
88
|
-
m.current === "mouse" && a.detail > 0 && c && N && a.preventDefault(), o?.(a);
|
|
89
|
-
},
|
|
90
|
-
onPointerDown: (a) => {
|
|
91
|
-
m.current = a.pointerType, u?.(a);
|
|
92
|
-
},
|
|
93
|
-
...l,
|
|
94
|
-
children: [
|
|
95
|
-
e,
|
|
96
|
-
/* @__PURE__ */ n(
|
|
97
|
-
w,
|
|
98
|
-
{
|
|
99
|
-
"aria-hidden": "true",
|
|
100
|
-
className: "relative top-[1px] ml-1 transition duration-300 group-data-[state=open]:rotate-180",
|
|
101
|
-
size: 12
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
R.displayName = "NavigationMenuTrigger";
|
|
109
|
-
const _ = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
y.displayName = "NavigationMenuTrigger";
|
|
101
|
+
const R = i.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(
|
|
110
102
|
s.Content,
|
|
111
103
|
{
|
|
112
|
-
ref:
|
|
104
|
+
ref: a,
|
|
113
105
|
className: r(
|
|
114
106
|
[
|
|
115
107
|
"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out top-0 left-0 w-full",
|
|
@@ -129,11 +121,11 @@ const _ = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
|
129
121
|
...e
|
|
130
122
|
}
|
|
131
123
|
));
|
|
132
|
-
|
|
133
|
-
const
|
|
124
|
+
R.displayName = "NavigationMenuContent";
|
|
125
|
+
const _ = i.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(
|
|
134
126
|
s.Link,
|
|
135
127
|
{
|
|
136
|
-
ref:
|
|
128
|
+
ref: a,
|
|
137
129
|
className: r(
|
|
138
130
|
[
|
|
139
131
|
"block rounded-md p-3 leading-none no-underline select-none",
|
|
@@ -148,11 +140,11 @@ const I = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
|
148
140
|
...e
|
|
149
141
|
}
|
|
150
142
|
));
|
|
151
|
-
|
|
152
|
-
const
|
|
143
|
+
_.displayName = "NavigationMenuLink";
|
|
144
|
+
const g = i.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n("div", { className: r("absolute top-full left-0 z-50 flex justify-center"), children: /* @__PURE__ */ n(
|
|
153
145
|
s.Viewport,
|
|
154
146
|
{
|
|
155
|
-
ref:
|
|
147
|
+
ref: a,
|
|
156
148
|
className: r(
|
|
157
149
|
[
|
|
158
150
|
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)]",
|
|
@@ -173,11 +165,11 @@ const p = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n("div", {
|
|
|
173
165
|
...e
|
|
174
166
|
}
|
|
175
167
|
) }));
|
|
176
|
-
|
|
177
|
-
const
|
|
168
|
+
g.displayName = "NavigationMenuViewport";
|
|
169
|
+
const I = i.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(
|
|
178
170
|
s.Indicator,
|
|
179
171
|
{
|
|
180
|
-
ref:
|
|
172
|
+
ref: a,
|
|
181
173
|
className: r(
|
|
182
174
|
[
|
|
183
175
|
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
|
|
@@ -191,14 +183,14 @@ const k = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
|
191
183
|
children: /* @__PURE__ */ n("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
|
|
192
184
|
}
|
|
193
185
|
));
|
|
194
|
-
|
|
186
|
+
I.displayName = "NavigationMenuIndicator";
|
|
195
187
|
export {
|
|
196
188
|
h as NavigationMenu,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
R as NavigationMenuContent,
|
|
190
|
+
I as NavigationMenuIndicator,
|
|
191
|
+
x as NavigationMenuItem,
|
|
192
|
+
_ as NavigationMenuLink,
|
|
193
|
+
w as NavigationMenuList,
|
|
194
|
+
y as NavigationMenuTrigger,
|
|
195
|
+
g as NavigationMenuViewport
|
|
204
196
|
};
|
package/dist/table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),N=require("react"),f=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils");function j(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=j(N),k=f.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"}}),R=f.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"}}),u=s.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:l,layout:d="auto",minWidth:n,scrollRegionLabel:i,style:c,...b},w)=>o.jsx("div",{className:r.cn("relative w-full overflow-x-auto",n&&"focus-visible:shadow-default rounded-md outline-none"),"data-slot":"table-container",...n?{role:"region","aria-label":i??"Scrollable table",tabIndex:0}:void 0,children:o.jsx("table",{ref:w,className:r.cn("w-full caption-bottom text-sm",d==="fixed"&&"table-fixed",e),"data-hook":t,"data-slot":"table","data-tracking-el":a,"data-tracking-label":l,style:{minWidth:n,...c},...b})}));u.displayName="Table";const m=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}));m.displayName="TableHeader";const g=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}));g.displayName="TableBody";const p=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}));p.displayName="TableFooter";const x=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}));x.displayName="TableRow";const T=s.forwardRef(({className:e,dataHook:t,align:a,width:l,minWidth:d,style:n,scope:i="col",...c},b)=>o.jsx("th",{ref:b,className:r.cn(R({align:a}),e),"data-hook":t,"data-slot":"table-head",scope:i,style:{width:l,minWidth:d,...n},...c}));T.displayName="TableHead";const h=s.forwardRef(({className:e,dataHook:t,size:a,align:l,width:d,minWidth:n,style:i,...c},b)=>o.jsx("td",{ref:b,className:r.cn(k({size:a,align:l}),e),"data-hook":t,"data-slot":"table-cell",style:{width:d,minWidth:n,...i},...c}));h.displayName="TableCell";const y=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("caption",{ref:l,className:r.cn("caption-bottom py-4",e),"data-hook":t,"data-slot":"table-caption",...a}));y.displayName="TableCaption";exports.Table=u;exports.TableBody=g;exports.TableCaption=y;exports.TableCell=h;exports.TableFooter=p;exports.TableHead=T;exports.TableHeader=m;exports.TableRow=x;
|
package/dist/table.d.ts
CHANGED
|
@@ -20,6 +20,17 @@ interface TableProps extends React.ComponentProps<"table"> {
|
|
|
20
20
|
* Tracking label for analytics context
|
|
21
21
|
*/
|
|
22
22
|
trackingLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Table layout algorithm.
|
|
25
|
+
* - `"auto"` (default) — browser sizes columns based on content.
|
|
26
|
+
* - `"fixed"` — columns respect explicit `width` values on `TableHead`/`TableCell`
|
|
27
|
+
* and split remaining space equally. Use when you set `width` on headers.
|
|
28
|
+
*
|
|
29
|
+
* **Migration note:** `"fixed"` will become the default in the next major release.
|
|
30
|
+
* Consumers should start setting explicit `width` on `TableHead` columns now.
|
|
31
|
+
* @default "auto"
|
|
32
|
+
*/
|
|
33
|
+
layout?: "auto" | "fixed";
|
|
23
34
|
/**
|
|
24
35
|
* Minimum width for the table (e.g., "600px", "40rem").
|
|
25
36
|
* Prevents columns from compressing on narrow viewports and enables
|
|
@@ -70,7 +81,11 @@ interface TableHeadProps extends Omit<React.ComponentProps<"th">, "align">, Vari
|
|
|
70
81
|
*/
|
|
71
82
|
dataHook?: string;
|
|
72
83
|
/**
|
|
73
|
-
*
|
|
84
|
+
* Explicit width for the column (e.g., "200px", "50%", "10rem").
|
|
85
|
+
*/
|
|
86
|
+
width?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Minimum width for the column (e.g., "100px", "8rem").
|
|
74
89
|
*/
|
|
75
90
|
minWidth?: string;
|
|
76
91
|
/**
|
|
@@ -86,7 +101,12 @@ interface TableCellProps extends Omit<React.ComponentProps<"td">, "align">, Vari
|
|
|
86
101
|
*/
|
|
87
102
|
dataHook?: string;
|
|
88
103
|
/**
|
|
89
|
-
*
|
|
104
|
+
* Width for the cell (e.g., "200px", "50%", "10rem").
|
|
105
|
+
* Set `layout="fixed"` on the parent `Table` for this value to be respected as an exact constraint.
|
|
106
|
+
*/
|
|
107
|
+
width?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Minimum width for the cell (e.g., "100px", "8rem").
|
|
90
110
|
*/
|
|
91
111
|
minWidth?: string;
|
|
92
112
|
/**
|
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;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;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,QAAA,MAAM,KAAK,
|
|
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;IACvB;;;;;;;;;OASG;IACH,MA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CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EACzC,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACrC;AAED,QAAA,MAAM,SAAS,0GAcd,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
|
@@ -2,7 +2,7 @@ import { jsx as l } from "react/jsx-runtime";
|
|
|
2
2
|
import * as r from "react";
|
|
3
3
|
import { cva as c } from "class-variance-authority";
|
|
4
4
|
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const
|
|
5
|
+
const u = c(
|
|
6
6
|
"align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
@@ -22,7 +22,7 @@ const m = c(
|
|
|
22
22
|
align: "left"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
),
|
|
25
|
+
), p = c(
|
|
26
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",
|
|
27
27
|
{
|
|
28
28
|
variants: {
|
|
@@ -36,17 +36,18 @@ const m = c(
|
|
|
36
36
|
align: "left"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
),
|
|
39
|
+
), g = r.forwardRef(
|
|
40
40
|
({
|
|
41
41
|
className: a,
|
|
42
42
|
dataHook: t,
|
|
43
43
|
trackingEl: e,
|
|
44
44
|
trackingLabel: o,
|
|
45
|
+
layout: n = "auto",
|
|
45
46
|
minWidth: s,
|
|
46
|
-
scrollRegionLabel:
|
|
47
|
-
style:
|
|
48
|
-
...
|
|
49
|
-
},
|
|
47
|
+
scrollRegionLabel: i,
|
|
48
|
+
style: b,
|
|
49
|
+
...f
|
|
50
|
+
}, m) => /* @__PURE__ */ l(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
52
53
|
className: d(
|
|
@@ -56,27 +57,31 @@ const m = c(
|
|
|
56
57
|
"data-slot": "table-container",
|
|
57
58
|
...s ? {
|
|
58
59
|
role: "region",
|
|
59
|
-
"aria-label":
|
|
60
|
+
"aria-label": i ?? "Scrollable table",
|
|
60
61
|
tabIndex: 0
|
|
61
62
|
} : void 0,
|
|
62
63
|
children: /* @__PURE__ */ l(
|
|
63
64
|
"table",
|
|
64
65
|
{
|
|
65
|
-
ref:
|
|
66
|
-
className: d(
|
|
66
|
+
ref: m,
|
|
67
|
+
className: d(
|
|
68
|
+
"w-full caption-bottom text-sm",
|
|
69
|
+
n === "fixed" && "table-fixed",
|
|
70
|
+
a
|
|
71
|
+
),
|
|
67
72
|
"data-hook": t,
|
|
68
73
|
"data-slot": "table",
|
|
69
74
|
"data-tracking-el": e,
|
|
70
75
|
"data-tracking-label": o,
|
|
71
|
-
style: { minWidth: s, ...
|
|
72
|
-
...
|
|
76
|
+
style: { minWidth: s, ...b },
|
|
77
|
+
...f
|
|
73
78
|
}
|
|
74
79
|
)
|
|
75
80
|
}
|
|
76
81
|
)
|
|
77
82
|
);
|
|
78
|
-
|
|
79
|
-
const
|
|
83
|
+
g.displayName = "Table";
|
|
84
|
+
const h = r.forwardRef(
|
|
80
85
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
81
86
|
"thead",
|
|
82
87
|
{
|
|
@@ -88,8 +93,8 @@ const g = r.forwardRef(
|
|
|
88
93
|
}
|
|
89
94
|
)
|
|
90
95
|
);
|
|
91
|
-
|
|
92
|
-
const
|
|
96
|
+
h.displayName = "TableHeader";
|
|
97
|
+
const w = r.forwardRef(
|
|
93
98
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
94
99
|
"tbody",
|
|
95
100
|
{
|
|
@@ -101,8 +106,8 @@ const h = r.forwardRef(
|
|
|
101
106
|
}
|
|
102
107
|
)
|
|
103
108
|
);
|
|
104
|
-
|
|
105
|
-
const
|
|
109
|
+
w.displayName = "TableBody";
|
|
110
|
+
const x = r.forwardRef(
|
|
106
111
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
107
112
|
"tfoot",
|
|
108
113
|
{
|
|
@@ -114,7 +119,7 @@ const w = r.forwardRef(
|
|
|
114
119
|
}
|
|
115
120
|
)
|
|
116
121
|
);
|
|
117
|
-
|
|
122
|
+
x.displayName = "TableFooter";
|
|
118
123
|
const N = r.forwardRef(
|
|
119
124
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
120
125
|
"tr",
|
|
@@ -131,36 +136,45 @@ const N = r.forwardRef(
|
|
|
131
136
|
)
|
|
132
137
|
);
|
|
133
138
|
N.displayName = "TableRow";
|
|
134
|
-
const
|
|
135
|
-
({
|
|
139
|
+
const y = r.forwardRef(
|
|
140
|
+
({
|
|
141
|
+
className: a,
|
|
142
|
+
dataHook: t,
|
|
143
|
+
align: e,
|
|
144
|
+
width: o,
|
|
145
|
+
minWidth: n,
|
|
146
|
+
style: s,
|
|
147
|
+
scope: i = "col",
|
|
148
|
+
...b
|
|
149
|
+
}, f) => /* @__PURE__ */ l(
|
|
136
150
|
"th",
|
|
137
151
|
{
|
|
138
|
-
ref:
|
|
139
|
-
className: d(
|
|
152
|
+
ref: f,
|
|
153
|
+
className: d(p({ align: e }), a),
|
|
140
154
|
"data-hook": t,
|
|
141
155
|
"data-slot": "table-head",
|
|
142
|
-
scope:
|
|
143
|
-
style: {
|
|
144
|
-
...
|
|
156
|
+
scope: i,
|
|
157
|
+
style: { width: o, minWidth: n, ...s },
|
|
158
|
+
...b
|
|
145
159
|
}
|
|
146
160
|
)
|
|
147
161
|
);
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
({ className: a, dataHook: t, size: e, align: o, minWidth: s, style:
|
|
162
|
+
y.displayName = "TableHead";
|
|
163
|
+
const T = r.forwardRef(
|
|
164
|
+
({ className: a, dataHook: t, size: e, align: o, width: n, minWidth: s, style: i, ...b }, f) => /* @__PURE__ */ l(
|
|
151
165
|
"td",
|
|
152
166
|
{
|
|
153
|
-
ref:
|
|
154
|
-
className: d(
|
|
167
|
+
ref: f,
|
|
168
|
+
className: d(u({ size: e, align: o }), a),
|
|
155
169
|
"data-hook": t,
|
|
156
170
|
"data-slot": "table-cell",
|
|
157
|
-
style: { minWidth: s, ...
|
|
158
|
-
...
|
|
171
|
+
style: { width: n, minWidth: s, ...i },
|
|
172
|
+
...b
|
|
159
173
|
}
|
|
160
174
|
)
|
|
161
175
|
);
|
|
162
|
-
|
|
163
|
-
const
|
|
176
|
+
T.displayName = "TableCell";
|
|
177
|
+
const k = r.forwardRef(({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
164
178
|
"caption",
|
|
165
179
|
{
|
|
166
180
|
ref: o,
|
|
@@ -170,14 +184,14 @@ const T = r.forwardRef(({ className: a, dataHook: t, ...e }, o) => /* @__PURE__
|
|
|
170
184
|
...e
|
|
171
185
|
}
|
|
172
186
|
));
|
|
173
|
-
|
|
187
|
+
k.displayName = "TableCaption";
|
|
174
188
|
export {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
g as Table,
|
|
190
|
+
w as TableBody,
|
|
191
|
+
k as TableCaption,
|
|
192
|
+
T as TableCell,
|
|
193
|
+
x as TableFooter,
|
|
194
|
+
y as TableHead,
|
|
195
|
+
h as TableHeader,
|
|
182
196
|
N as TableRow
|
|
183
197
|
};
|
package/dist/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),x=require("@radix-ui/react-tooltip"),a=require("@brightlocal/ui-components/lib/utils");function l(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const s=l(m),i=l(x);function j({delayDuration:t=0,skipDelayDuration:e=0,...o}){return r.jsx(i.Provider,{delayDuration:t,skipDelayDuration:e,...o})}function y({...t}){return r.jsx(i.Root,{...t})}const c=s.forwardRef(({...t},e)=>r.jsx(i.Trigger,{ref:e,"data-slot":"tooltip-trigger",...t}));c.displayName="TooltipTrigger";const d=s.forwardRef(({className:t,sideOffset:e=0,dataHook:o,trackingEl:n,trackingLabel:p,hideArrow:u=!1,children:g,...T},f)=>r.jsx(i.Portal,{children:r.jsxs(i.Content,{ref:f,className:a.cn("bg-secondary text-secondary-foreground z-50 w-max max-w-sm rounded-md px-3 py-1.5 text-xs leading-4 font-normal",a.FLOATING_CONTENT_ANIMATION,"**:data-[slot=tooltip-arrow]:-translate-y-px",t),"data-hook":o,"data-slot":"tooltip-content","data-tracking-el":n,"data-tracking-label":p,sideOffset:e,...T,children:[g,!u&&r.jsx(i.Arrow,{className:"fill-secondary","data-slot":"tooltip-arrow",height:7,width:14})]})}));d.displayName="TooltipContent";exports.Tooltip=y;exports.TooltipContent=d;exports.TooltipProvider=j;exports.TooltipTrigger=c;
|
package/dist/tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAO5D,UAAU,oBAAqB,SAAQ,KAAK,CAAC,cAAc,CACzD,OAAO,gBAAgB,CAAC,QAAQ,CACjC;IACC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,iBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAQtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAEpD;AAED,QAAA,MAAM,cAAc,sKAWlB,CAAC;AAIH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CACxD,OAAO,gBAAgB,CAAC,OAAO,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;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,yGA+CnB,CAAC;AAIF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AACpE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC"}
|