@brightlocal/ui-components 2.21.0 → 2.23.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/README.md +2 -1
- package/component-meta.json +40 -5
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -31
- 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/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +111 -109
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +109 -121
- 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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +311 -308
- 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/loading.cjs +1 -0
- package/dist/loading.d.ts +46 -0
- package/dist/loading.d.ts.map +1 -0
- package/dist/loading.js +142 -0
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +1 -1
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +97 -99
- 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/popover.cjs +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +27 -26
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +29 -35
- 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 +21 -2
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +37 -34
- package/package.json +1 -1
- package/src/blocks/data-table.tsx +58 -4
- package/src/components/alert.tsx +9 -13
- package/src/components/context-menu.tsx +8 -3
- package/src/components/dropdown-menu.tsx +6 -15
- package/src/components/hover-card.tsx +6 -3
- package/src/components/loading.tsx +322 -0
- package/src/components/map.tsx +3 -1
- package/src/components/menubar.tsx +6 -5
- package/src/components/navigation-menu.tsx +80 -101
- package/src/components/popover.tsx +6 -2
- package/src/components/select.tsx +5 -8
- package/src/components/table.tsx +44 -7
- package/src/components/tooltip.tsx +36 -8
- package/src/index.ts +1 -0
- package/src/lib/utils.ts +3 -0
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/popover.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 t=require("react/jsx-runtime"),g=require("react"),f=require("@radix-ui/react-popover"),c=require("@brightlocal/ui-components/lib/utils"),m=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function p(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const i=p(g),n=p(f);function s({...e}){return t.jsx(n.Root,{"data-slot":"popover",...e})}s.displayName="Popover";const d=i.forwardRef(({dataHook:e,...r},o)=>t.jsx(n.Trigger,{ref:o,"data-slot":"popover-trigger",...e!=null&&{"data-hook":e},...r}));d.displayName="PopoverTrigger";const l=i.forwardRef(({className:e,align:r="center",sideOffset:o=4,dataHook:a,...v},P)=>(m.useOverlayPointerLock(),t.jsx(n.Portal,{children:t.jsx(n.Content,{ref:P,align:r,className:c.cn("bg-popover text-popover-foreground z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",c.FLOATING_CONTENT_ANIMATION,e),"data-hook":a,"data-slot":"popover-content",sideOffset:o,...v})})));l.displayName="PopoverContent";const u=i.forwardRef(({dataHook:e,...r},o)=>t.jsx(n.Anchor,{ref:o,"data-hook":e,"data-slot":"popover-anchor",...r}));u.displayName="PopoverAnchor";exports.Popover=s;exports.PopoverAnchor=u;exports.PopoverContent=l;exports.PopoverTrigger=d;
|
package/dist/popover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAQ5D,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CACxD,OAAO,gBAAgB,CAAC,IAAI,CAC7B;IACC,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,sHAAsH;IACtH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAE1C;kBAFQ,OAAO;;;AAKhB,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAC/D,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC,2GAA2G;IAC3G,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,4GAUlB,CAAC;AAGH,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAC/D,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kGAAkG;IAClG,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uIAAuI;IACvI,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,yGA6BnB,CAAC;AAGF,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAC9D,OAAO,gBAAgB,CAAC,MAAM,CAC/B;IACC,2GAA2G;IAC3G,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,aAAa,wGAUjB,CAAC;AAGH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/popover.js
CHANGED
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
3
|
import * as a from "@radix-ui/react-popover";
|
|
4
|
-
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
import { useOverlayPointerLock as
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
4
|
+
import { cn as m, FLOATING_CONTENT_ANIMATION as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { useOverlayPointerLock as v } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
6
|
+
function c({ ...o }) {
|
|
7
|
+
return /* @__PURE__ */ t(a.Root, { "data-slot": "popover", ...o });
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
const
|
|
9
|
+
c.displayName = "Popover";
|
|
10
|
+
const l = p.forwardRef(({ dataHook: o, ...r }, e) => /* @__PURE__ */ t(
|
|
11
11
|
a.Trigger,
|
|
12
12
|
{
|
|
13
13
|
ref: e,
|
|
14
14
|
"data-slot": "popover-trigger",
|
|
15
15
|
...o != null && { "data-hook": o },
|
|
16
|
-
...
|
|
16
|
+
...r
|
|
17
17
|
}
|
|
18
18
|
));
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
({ className: o, align:
|
|
19
|
+
l.displayName = "PopoverTrigger";
|
|
20
|
+
const f = p.forwardRef(
|
|
21
|
+
({ className: o, align: r = "center", sideOffset: e = 4, dataHook: n, ...i }, d) => (v(), /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ t(
|
|
22
22
|
a.Content,
|
|
23
23
|
{
|
|
24
|
-
ref:
|
|
25
|
-
align:
|
|
26
|
-
className:
|
|
27
|
-
"bg-popover text-popover-foreground
|
|
24
|
+
ref: d,
|
|
25
|
+
align: r,
|
|
26
|
+
className: m(
|
|
27
|
+
"bg-popover text-popover-foreground z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
28
|
+
s,
|
|
28
29
|
o
|
|
29
30
|
),
|
|
30
|
-
"data-hook":
|
|
31
|
+
"data-hook": n,
|
|
31
32
|
"data-slot": "popover-content",
|
|
32
33
|
sideOffset: e,
|
|
33
|
-
...
|
|
34
|
+
...i
|
|
34
35
|
}
|
|
35
36
|
) }))
|
|
36
37
|
);
|
|
37
|
-
|
|
38
|
-
const
|
|
38
|
+
f.displayName = "PopoverContent";
|
|
39
|
+
const g = p.forwardRef(({ dataHook: o, ...r }, e) => /* @__PURE__ */ t(
|
|
39
40
|
a.Anchor,
|
|
40
41
|
{
|
|
41
42
|
ref: e,
|
|
42
43
|
"data-hook": o,
|
|
43
44
|
"data-slot": "popover-anchor",
|
|
44
|
-
...
|
|
45
|
+
...r
|
|
45
46
|
}
|
|
46
47
|
));
|
|
47
|
-
|
|
48
|
+
g.displayName = "PopoverAnchor";
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
c as Popover,
|
|
51
|
+
g as PopoverAnchor,
|
|
52
|
+
f as PopoverContent,
|
|
53
|
+
l as PopoverTrigger
|
|
53
54
|
};
|
package/dist/select.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("react"),C=require("@radix-ui/react-select"),d=require("@brightlocal/icons"),
|
|
2
|
-
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,[r]);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("react"),C=require("@radix-ui/react-select"),d=require("@brightlocal/icons"),I=require("class-variance-authority"),a=require("@brightlocal/ui-components/lib/utils"),T=require("./lib/use-dev-warning.cjs"),O=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const _=g(q),o=g(C);function v({children:e,...r}){return t.jsx(o.Root,{"data-slot":"select",...r,children:e})}v.displayName="Select";function x(e){return t.jsx(o.Group,{"data-slot":"select-group",...e})}x.displayName="SelectGroup";function S(e){return t.jsx(o.Value,{"data-slot":"select-value",...e})}S.displayName="SelectValue";const D=I.cva(["relative flex w-full h-9 items-center justify-between gap-2","px-3 py-2","border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color]","bg-neutral-50 border-neutral-300","dark:bg-white/5 dark:border-white/15","text-sm font-normal font-sans text-foreground","[&>span]:block [&>span]:truncate","data-[placeholder]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0"]);function h({className:e,children:r,placeholder:n,dataHook:s,error:c,selectLabel:u,...l}){const i=c||l["aria-invalid"]===!0||l["aria-invalid"]==="true",p=l["aria-required"]===!0||l["aria-required"]==="true",m=l["aria-label"]||u||n||"Select an option",k=i?"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive":"";return t.jsxs(o.Trigger,{...l,"aria-invalid":i?"true":void 0,"aria-label":m,"aria-required":p?"true":void 0,className:a.cn(D(),k,e),"data-hook":s,"data-slot":"select-trigger",children:[r,t.jsx(o.Icon,{asChild:!0,children:t.jsx(d.ChevronDown,{className:"text-muted-foreground"})})]})}h.displayName="SelectTrigger";function y({className:e,children:r,position:n="popper",maxHeight:s,style:c,...u}){O.useOverlayPointerLock();const l=_.useRef(null);T.useDevWarning(()=>l.current?l.current.querySelectorAll('[data-slot="select-item"]').length>=100:!1,`Select contains many items. For large lists (100+), consider using <Combobox> which supports search and filtering.
|
|
2
|
+
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,[r]);const i=a.cn("relative z-50 overflow-hidden","min-w-[8rem]","rounded-md border border-border bg-popover shadow-md","text-popover-foreground","max-h-[var(--radix-select-content-available-height)]","origin-[var(--radix-select-content-transform-origin)]",a.FLOATING_CONTENT_ANIMATION),p=n==="popper"&&a.cn("data-[side=bottom]:translate-y-1","data-[side=left]:-translate-x-1","data-[side=right]:translate-x-1","data-[side=top]:-translate-y-1"),m=s!==void 0?{...c,maxHeight:`min(${s}px, var(--radix-select-content-available-height))`}:c;return t.jsx(o.Portal,{children:t.jsxs(o.Content,{className:a.cn(i,p,e),"data-slot":"select-content",position:n,style:m,...u,children:[t.jsx(b,{}),t.jsx(o.Viewport,{ref:l,className:a.cn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:r}),t.jsx(f,{})]})})}y.displayName="SelectContent";function j({className:e,...r}){return t.jsx(o.Label,{className:a.cn("text-muted-foreground px-2 py-1.5 text-xs font-medium",e),"data-slot":"select-label",...r})}j.displayName="SelectLabel";function w({className:e,children:r,...n}){const s=a.cn("relative flex w-full cursor-default select-none items-center gap-2","rounded py-1.5 pl-2 pr-8","text-sm font-normal leading-5 text-popover-foreground","focus:bg-accent focus:text-accent-foreground","hover:bg-accent/50 hover:text-accent-foreground","outline-none focus:outline-none","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0");return t.jsxs(o.Item,{className:a.cn(s,e),"data-slot":"select-item",...n,children:[t.jsx("span",{className:"absolute right-2 flex size-4 items-center justify-center",children:t.jsx(o.ItemIndicator,{children:t.jsx(d.Check,{})})}),t.jsx(o.ItemText,{children:r})]})}w.displayName="SelectItem";function N({className:e,...r}){return t.jsx(o.Separator,{className:a.cn("bg-border pointer-events-none -mx-1 my-1 h-px",e),"data-slot":"select-separator",...r})}N.displayName="SelectSeparator";function b({className:e,...r}){return t.jsx(o.ScrollUpButton,{className:a.cn("flex cursor-default items-center justify-center py-1",e),"data-slot":"select-scroll-up-button",...r,children:t.jsx(d.ChevronUp,{})})}b.displayName="SelectScrollUpButton";function f({className:e,...r}){return t.jsx(o.ScrollDownButton,{className:a.cn("flex cursor-default items-center justify-center py-1",e),"data-slot":"select-scroll-down-button",...r,children:t.jsx(d.ChevronDown,{})})}f.displayName="SelectScrollDownButton";exports.Select=v;exports.SelectContent=y;exports.SelectGroup=x;exports.SelectItem=w;exports.SelectLabel=j;exports.SelectScrollDownButton=f;exports.SelectScrollUpButton=b;exports.SelectSeparator=N;exports.SelectTrigger=h;exports.SelectValue=S;
|
package/dist/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"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"}
|
package/dist/select.js
CHANGED
|
@@ -3,21 +3,21 @@ import * as h from "react";
|
|
|
3
3
|
import * as o from "@radix-ui/react-select";
|
|
4
4
|
import { Check as x, ChevronDown as f, ChevronUp as S } from "@brightlocal/icons";
|
|
5
5
|
import { cva as y } from "class-variance-authority";
|
|
6
|
-
import { cn as a } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { cn as a, FLOATING_CONTENT_ANIMATION as N } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { useDevWarning as w } from "./lib/use-dev-warning.js";
|
|
8
|
-
import { useOverlayPointerLock as
|
|
9
|
-
function
|
|
8
|
+
import { useOverlayPointerLock as k } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
9
|
+
function I({ children: e, ...r }) {
|
|
10
10
|
return /* @__PURE__ */ t(o.Root, { "data-slot": "select", ...r, children: e });
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
I.displayName = "Select";
|
|
13
13
|
function C(e) {
|
|
14
14
|
return /* @__PURE__ */ t(o.Group, { "data-slot": "select-group", ...e });
|
|
15
15
|
}
|
|
16
16
|
C.displayName = "SelectGroup";
|
|
17
|
-
function
|
|
17
|
+
function T(e) {
|
|
18
18
|
return /* @__PURE__ */ t(o.Value, { "data-slot": "select-value", ...e });
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
T.displayName = "SelectValue";
|
|
21
21
|
const j = y([
|
|
22
22
|
// Base layout
|
|
23
23
|
"relative flex w-full h-9 items-center justify-between gap-2",
|
|
@@ -48,15 +48,15 @@ function B({
|
|
|
48
48
|
placeholder: l,
|
|
49
49
|
dataHook: s,
|
|
50
50
|
error: i,
|
|
51
|
-
selectLabel:
|
|
51
|
+
selectLabel: d,
|
|
52
52
|
...n
|
|
53
53
|
}) {
|
|
54
|
-
const
|
|
54
|
+
const c = i || n["aria-invalid"] === !0 || n["aria-invalid"] === "true", u = n["aria-required"] === !0 || n["aria-required"] === "true", m = n["aria-label"] || d || l || "Select an option", v = c ? "border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive" : "";
|
|
55
55
|
return /* @__PURE__ */ p(
|
|
56
56
|
o.Trigger,
|
|
57
57
|
{
|
|
58
58
|
...n,
|
|
59
|
-
"aria-invalid":
|
|
59
|
+
"aria-invalid": c ? "true" : void 0,
|
|
60
60
|
"aria-label": m,
|
|
61
61
|
"aria-required": u ? "true" : void 0,
|
|
62
62
|
className: a(j(), v, e),
|
|
@@ -70,15 +70,15 @@ function B({
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
B.displayName = "SelectTrigger";
|
|
73
|
-
function
|
|
73
|
+
function L({
|
|
74
74
|
className: e,
|
|
75
75
|
children: r,
|
|
76
76
|
position: l = "popper",
|
|
77
77
|
maxHeight: s,
|
|
78
78
|
style: i,
|
|
79
|
-
...
|
|
79
|
+
...d
|
|
80
80
|
}) {
|
|
81
|
-
|
|
81
|
+
k();
|
|
82
82
|
const n = h.useRef(null);
|
|
83
83
|
w(
|
|
84
84
|
() => n.current ? n.current.querySelectorAll('[data-slot="select-item"]').length >= 100 : !1,
|
|
@@ -86,7 +86,7 @@ function q({
|
|
|
86
86
|
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
87
87
|
[r]
|
|
88
88
|
);
|
|
89
|
-
const
|
|
89
|
+
const c = a(
|
|
90
90
|
// Base appearance
|
|
91
91
|
"relative z-50 overflow-hidden",
|
|
92
92
|
"min-w-[8rem]",
|
|
@@ -96,13 +96,7 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
96
96
|
"max-h-[var(--radix-select-content-available-height)]",
|
|
97
97
|
"origin-[var(--radix-select-content-transform-origin)]",
|
|
98
98
|
// Animations
|
|
99
|
-
|
|
100
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
101
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
102
|
-
"data-[side=bottom]:slide-in-from-top-2",
|
|
103
|
-
"data-[side=left]:slide-in-from-right-2",
|
|
104
|
-
"data-[side=right]:slide-in-from-left-2",
|
|
105
|
-
"data-[side=top]:slide-in-from-bottom-2"
|
|
99
|
+
N
|
|
106
100
|
), u = l === "popper" && a(
|
|
107
101
|
"data-[side=bottom]:translate-y-1",
|
|
108
102
|
"data-[side=left]:-translate-x-1",
|
|
@@ -115,11 +109,11 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
115
109
|
return /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ p(
|
|
116
110
|
o.Content,
|
|
117
111
|
{
|
|
118
|
-
className: a(
|
|
112
|
+
className: a(c, u, e),
|
|
119
113
|
"data-slot": "select-content",
|
|
120
114
|
position: l,
|
|
121
115
|
style: m,
|
|
122
|
-
...
|
|
116
|
+
...d,
|
|
123
117
|
children: [
|
|
124
118
|
/* @__PURE__ */ t(b, {}),
|
|
125
119
|
/* @__PURE__ */ t(
|
|
@@ -138,8 +132,8 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
138
132
|
}
|
|
139
133
|
) });
|
|
140
134
|
}
|
|
141
|
-
|
|
142
|
-
function
|
|
135
|
+
L.displayName = "SelectContent";
|
|
136
|
+
function _({
|
|
143
137
|
className: e,
|
|
144
138
|
...r
|
|
145
139
|
}) {
|
|
@@ -155,8 +149,8 @@ function D({
|
|
|
155
149
|
}
|
|
156
150
|
);
|
|
157
151
|
}
|
|
158
|
-
|
|
159
|
-
function
|
|
152
|
+
_.displayName = "SelectLabel";
|
|
153
|
+
function q({
|
|
160
154
|
className: e,
|
|
161
155
|
children: r,
|
|
162
156
|
...l
|
|
@@ -189,8 +183,8 @@ function L({
|
|
|
189
183
|
}
|
|
190
184
|
);
|
|
191
185
|
}
|
|
192
|
-
|
|
193
|
-
function
|
|
186
|
+
q.displayName = "SelectItem";
|
|
187
|
+
function D({
|
|
194
188
|
className: e,
|
|
195
189
|
...r
|
|
196
190
|
}) {
|
|
@@ -203,7 +197,7 @@ function R({
|
|
|
203
197
|
}
|
|
204
198
|
);
|
|
205
199
|
}
|
|
206
|
-
|
|
200
|
+
D.displayName = "SelectSeparator";
|
|
207
201
|
function b({
|
|
208
202
|
className: e,
|
|
209
203
|
...r
|
|
@@ -241,14 +235,14 @@ function g({
|
|
|
241
235
|
}
|
|
242
236
|
g.displayName = "SelectScrollDownButton";
|
|
243
237
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
238
|
+
I as Select,
|
|
239
|
+
L as SelectContent,
|
|
246
240
|
C as SelectGroup,
|
|
247
|
-
|
|
248
|
-
|
|
241
|
+
q as SelectItem,
|
|
242
|
+
_ as SelectLabel,
|
|
249
243
|
g as SelectScrollDownButton,
|
|
250
244
|
b as SelectScrollUpButton,
|
|
251
|
-
|
|
245
|
+
D as SelectSeparator,
|
|
252
246
|
B as SelectTrigger,
|
|
253
|
-
|
|
247
|
+
T as SelectValue
|
|
254
248
|
};
|
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
|
/**
|