@brightlocal/ui-components 2.12.0 → 2.14.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 +316 -19
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +203 -4
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +667 -393
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +5 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +48 -31
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +8 -0
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +227 -226
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +450 -441
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +25 -4
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +71 -53
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +7 -7
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +13 -13
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +10 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +36 -30
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +14 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -39
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +25 -9
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +128 -113
- package/package.json +2 -2
- package/src/blocks/sidebar.tsx +596 -9
- package/src/components/card.tsx +23 -0
- package/src/components/combobox.tsx +10 -0
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/list.tsx +45 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/rating.tsx +1 -1
- package/src/components/select.tsx +24 -2
- package/src/components/table.tsx +39 -2
- package/src/components/tabs.tsx +195 -146
package/dist/select.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import * as h from "react";
|
|
3
3
|
import * as o from "@radix-ui/react-select";
|
|
4
|
-
import { Check as
|
|
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
6
|
import { cn as a } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { useDevWarning as w } from "./lib/use-dev-warning.js";
|
|
@@ -47,23 +47,23 @@ function j({
|
|
|
47
47
|
placeholder: l,
|
|
48
48
|
dataHook: s,
|
|
49
49
|
error: i,
|
|
50
|
-
selectLabel:
|
|
50
|
+
selectLabel: c,
|
|
51
51
|
...n
|
|
52
52
|
}) {
|
|
53
|
-
const
|
|
54
|
-
return /* @__PURE__ */
|
|
53
|
+
const d = i || n["aria-invalid"] === !0 || n["aria-invalid"] === "true", u = n["aria-required"] === !0 || n["aria-required"] === "true", m = n["aria-label"] || c || l || "Select an option", v = d ? "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" : "";
|
|
54
|
+
return /* @__PURE__ */ p(
|
|
55
55
|
o.Trigger,
|
|
56
56
|
{
|
|
57
57
|
...n,
|
|
58
|
-
"aria-invalid":
|
|
59
|
-
"aria-label":
|
|
60
|
-
"aria-required":
|
|
58
|
+
"aria-invalid": d ? "true" : void 0,
|
|
59
|
+
"aria-label": m,
|
|
60
|
+
"aria-required": u ? "true" : void 0,
|
|
61
61
|
className: a(I(), v, e),
|
|
62
62
|
"data-hook": s,
|
|
63
63
|
"data-slot": "select-trigger",
|
|
64
64
|
children: [
|
|
65
65
|
r,
|
|
66
|
-
/* @__PURE__ */ t(o.Icon, { asChild: !0, children: /* @__PURE__ */ t(
|
|
66
|
+
/* @__PURE__ */ t(o.Icon, { asChild: !0, children: /* @__PURE__ */ t(f, { className: "text-muted-foreground" }) })
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
);
|
|
@@ -73,11 +73,13 @@ function B({
|
|
|
73
73
|
className: e,
|
|
74
74
|
children: r,
|
|
75
75
|
position: l = "popper",
|
|
76
|
-
|
|
76
|
+
maxHeight: s,
|
|
77
|
+
style: i,
|
|
78
|
+
...c
|
|
77
79
|
}) {
|
|
78
|
-
const
|
|
80
|
+
const n = h.useRef(null);
|
|
79
81
|
w(
|
|
80
|
-
() =>
|
|
82
|
+
() => n.current ? n.current.querySelectorAll('[data-slot="select-item"]').length >= 100 : !1,
|
|
81
83
|
`Select contains many items. For large lists (100+), consider using <Combobox> which supports search and filtering.
|
|
82
84
|
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
83
85
|
[r]
|
|
@@ -99,25 +101,29 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
99
101
|
"data-[side=left]:slide-in-from-right-2",
|
|
100
102
|
"data-[side=right]:slide-in-from-left-2",
|
|
101
103
|
"data-[side=top]:slide-in-from-bottom-2"
|
|
102
|
-
),
|
|
104
|
+
), u = l === "popper" && a(
|
|
103
105
|
"data-[side=bottom]:translate-y-1",
|
|
104
106
|
"data-[side=left]:-translate-x-1",
|
|
105
107
|
"data-[side=right]:translate-x-1",
|
|
106
108
|
"data-[side=top]:-translate-y-1"
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
+
), m = s !== void 0 ? {
|
|
110
|
+
...i,
|
|
111
|
+
maxHeight: `min(${s}px, var(--radix-select-content-available-height))`
|
|
112
|
+
} : i;
|
|
113
|
+
return /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ p(
|
|
109
114
|
o.Content,
|
|
110
115
|
{
|
|
111
|
-
className: a(d,
|
|
116
|
+
className: a(d, u, e),
|
|
112
117
|
"data-slot": "select-content",
|
|
113
118
|
position: l,
|
|
114
|
-
|
|
119
|
+
style: m,
|
|
120
|
+
...c,
|
|
115
121
|
children: [
|
|
116
|
-
/* @__PURE__ */ t(
|
|
122
|
+
/* @__PURE__ */ t(b, {}),
|
|
117
123
|
/* @__PURE__ */ t(
|
|
118
124
|
o.Viewport,
|
|
119
125
|
{
|
|
120
|
-
ref:
|
|
126
|
+
ref: n,
|
|
121
127
|
className: a(
|
|
122
128
|
"p-1",
|
|
123
129
|
l === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
@@ -125,7 +131,7 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
125
131
|
children: r
|
|
126
132
|
}
|
|
127
133
|
),
|
|
128
|
-
/* @__PURE__ */ t(
|
|
134
|
+
/* @__PURE__ */ t(g, {})
|
|
129
135
|
]
|
|
130
136
|
}
|
|
131
137
|
) });
|
|
@@ -168,14 +174,14 @@ function D({
|
|
|
168
174
|
// Icon styles
|
|
169
175
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
170
176
|
);
|
|
171
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ p(
|
|
172
178
|
o.Item,
|
|
173
179
|
{
|
|
174
180
|
className: a(s, e),
|
|
175
181
|
"data-slot": "select-item",
|
|
176
182
|
...l,
|
|
177
183
|
children: [
|
|
178
|
-
/* @__PURE__ */ t("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ t(o.ItemIndicator, { children: /* @__PURE__ */ t(
|
|
184
|
+
/* @__PURE__ */ t("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ t(o.ItemIndicator, { children: /* @__PURE__ */ t(x, {}) }) }),
|
|
179
185
|
/* @__PURE__ */ t(o.ItemText, { children: r })
|
|
180
186
|
]
|
|
181
187
|
}
|
|
@@ -196,7 +202,7 @@ function R({
|
|
|
196
202
|
);
|
|
197
203
|
}
|
|
198
204
|
R.displayName = "SelectSeparator";
|
|
199
|
-
function
|
|
205
|
+
function b({
|
|
200
206
|
className: e,
|
|
201
207
|
...r
|
|
202
208
|
}) {
|
|
@@ -209,12 +215,12 @@ function p({
|
|
|
209
215
|
),
|
|
210
216
|
"data-slot": "select-scroll-up-button",
|
|
211
217
|
...r,
|
|
212
|
-
children: /* @__PURE__ */ t(
|
|
218
|
+
children: /* @__PURE__ */ t(S, {})
|
|
213
219
|
}
|
|
214
220
|
);
|
|
215
221
|
}
|
|
216
|
-
|
|
217
|
-
function
|
|
222
|
+
b.displayName = "SelectScrollUpButton";
|
|
223
|
+
function g({
|
|
218
224
|
className: e,
|
|
219
225
|
...r
|
|
220
226
|
}) {
|
|
@@ -227,19 +233,19 @@ function f({
|
|
|
227
233
|
),
|
|
228
234
|
"data-slot": "select-scroll-down-button",
|
|
229
235
|
...r,
|
|
230
|
-
children: /* @__PURE__ */ t(
|
|
236
|
+
children: /* @__PURE__ */ t(f, {})
|
|
231
237
|
}
|
|
232
238
|
);
|
|
233
239
|
}
|
|
234
|
-
|
|
240
|
+
g.displayName = "SelectScrollDownButton";
|
|
235
241
|
export {
|
|
236
242
|
N as Select,
|
|
237
243
|
B as SelectContent,
|
|
238
244
|
k as SelectGroup,
|
|
239
245
|
D as SelectItem,
|
|
240
246
|
q as SelectLabel,
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
g as SelectScrollDownButton,
|
|
248
|
+
b as SelectScrollUpButton,
|
|
243
249
|
R as SelectSeparator,
|
|
244
250
|
j as SelectTrigger,
|
|
245
251
|
C as SelectValue
|
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"),w=require("react"),b=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils");function N(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,l.get?l:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const s=N(w),j=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"}}),k=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:a,dataHook:t,trackingEl:e,trackingLabel:l,minWidth:n,scrollRegionLabel:d,style:i,...c},y)=>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":d??"Scrollable table",tabIndex:0}:void 0,children:o.jsx("table",{ref:y,className:r.cn("w-full caption-bottom text-sm",a),"data-hook":t,"data-slot":"table","data-tracking-el":e,"data-tracking-label":l,style:{minWidth:n,...i},...c})}));f.displayName="Table";const u=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("thead",{ref:l,className:r.cn(a),"data-hook":t,"data-slot":"table-header",...e}));u.displayName="TableHeader";const m=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tbody",{ref:l,className:r.cn(a),"data-hook":t,"data-slot":"table-body",...e}));m.displayName="TableBody";const g=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tfoot",{ref:l,className:r.cn("bg-muted/50",a),"data-hook":t,"data-slot":"table-footer",...e}));g.displayName="TableFooter";const p=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tr",{ref:l,className:r.cn("data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",a),"data-hook":t,"data-slot":"table-row",...e}));p.displayName="TableRow";const T=s.forwardRef(({className:a,dataHook:t,align:e,minWidth:l,style:n,scope:d="col",...i},c)=>o.jsx("th",{ref:c,className:r.cn(k({align:e}),a),"data-hook":t,"data-slot":"table-head",scope:d,style:{minWidth:l,...n},...i}));T.displayName="TableHead";const h=s.forwardRef(({className:a,dataHook:t,size:e,align:l,minWidth:n,style:d,...i},c)=>o.jsx("td",{ref:c,className:r.cn(j({size:e,align:l}),a),"data-hook":t,"data-slot":"table-cell",style:{minWidth:n,...d},...i}));h.displayName="TableCell";const x=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("caption",{ref:l,className:r.cn("caption-bottom py-4",a),"data-hook":t,"data-slot":"table-caption",...e}));x.displayName="TableCaption";exports.Table=f;exports.TableBody=m;exports.TableCaption=x;exports.TableCell=h;exports.TableFooter=g;exports.TableHead=T;exports.TableHeader=u;exports.TableRow=p;
|
package/dist/table.d.ts
CHANGED
|
@@ -20,6 +20,20 @@ interface TableProps extends React.ComponentProps<"table"> {
|
|
|
20
20
|
* Tracking label for analytics context
|
|
21
21
|
*/
|
|
22
22
|
trackingLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Minimum width for the table (e.g., "600px", "40rem").
|
|
25
|
+
* Prevents columns from compressing on narrow viewports and enables
|
|
26
|
+
* horizontal scroll via the built-in overflow container.
|
|
27
|
+
* When set, the scroll container becomes a focusable region for
|
|
28
|
+
* keyboard accessibility.
|
|
29
|
+
*/
|
|
30
|
+
minWidth?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Accessible label for the scroll container region.
|
|
33
|
+
* Used when `minWidth` is set to provide context for keyboard users.
|
|
34
|
+
* @default "Scrollable table"
|
|
35
|
+
*/
|
|
36
|
+
scrollRegionLabel?: string;
|
|
23
37
|
}
|
|
24
38
|
declare const Table: React.ForwardRefExoticComponent<Omit<TableProps, "ref"> & React.RefAttributes<HTMLTableElement>>;
|
|
25
39
|
interface TableHeaderProps extends React.ComponentProps<"thead"> {
|
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;
|
|
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,kGA0CV,CAAC;AAQF,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IAC9D;;OAEG;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,OAAO,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
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cva as c } from "class-variance-authority";
|
|
4
|
+
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const m = 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 c = m(
|
|
|
22
22
|
align: "left"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
),
|
|
25
|
+
), u = 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,73 +36,91 @@ const c = m(
|
|
|
36
36
|
align: "left"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
), p =
|
|
40
|
-
({
|
|
39
|
+
), p = r.forwardRef(
|
|
40
|
+
({
|
|
41
|
+
className: a,
|
|
42
|
+
dataHook: t,
|
|
43
|
+
trackingEl: e,
|
|
44
|
+
trackingLabel: o,
|
|
45
|
+
minWidth: s,
|
|
46
|
+
scrollRegionLabel: n,
|
|
47
|
+
style: i,
|
|
48
|
+
...b
|
|
49
|
+
}, f) => /* @__PURE__ */ l(
|
|
41
50
|
"div",
|
|
42
51
|
{
|
|
43
|
-
className:
|
|
52
|
+
className: d(
|
|
53
|
+
"relative w-full overflow-x-auto",
|
|
54
|
+
s && "focus-visible:shadow-default rounded-md outline-none"
|
|
55
|
+
),
|
|
44
56
|
"data-slot": "table-container",
|
|
57
|
+
...s ? {
|
|
58
|
+
role: "region",
|
|
59
|
+
"aria-label": n ?? "Scrollable table",
|
|
60
|
+
tabIndex: 0
|
|
61
|
+
} : void 0,
|
|
45
62
|
children: /* @__PURE__ */ l(
|
|
46
63
|
"table",
|
|
47
64
|
{
|
|
48
|
-
ref:
|
|
49
|
-
className:
|
|
65
|
+
ref: f,
|
|
66
|
+
className: d("w-full caption-bottom text-sm", a),
|
|
50
67
|
"data-hook": t,
|
|
51
68
|
"data-slot": "table",
|
|
52
69
|
"data-tracking-el": e,
|
|
53
70
|
"data-tracking-label": o,
|
|
54
|
-
...
|
|
71
|
+
style: { minWidth: s, ...i },
|
|
72
|
+
...b
|
|
55
73
|
}
|
|
56
74
|
)
|
|
57
75
|
}
|
|
58
76
|
)
|
|
59
77
|
);
|
|
60
78
|
p.displayName = "Table";
|
|
61
|
-
const
|
|
79
|
+
const g = r.forwardRef(
|
|
62
80
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
63
81
|
"thead",
|
|
64
82
|
{
|
|
65
83
|
ref: o,
|
|
66
|
-
className:
|
|
84
|
+
className: d(a),
|
|
67
85
|
"data-hook": t,
|
|
68
86
|
"data-slot": "table-header",
|
|
69
87
|
...e
|
|
70
88
|
}
|
|
71
89
|
)
|
|
72
90
|
);
|
|
73
|
-
|
|
74
|
-
const
|
|
91
|
+
g.displayName = "TableHeader";
|
|
92
|
+
const h = r.forwardRef(
|
|
75
93
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
76
94
|
"tbody",
|
|
77
95
|
{
|
|
78
96
|
ref: o,
|
|
79
|
-
className:
|
|
97
|
+
className: d(a),
|
|
80
98
|
"data-hook": t,
|
|
81
99
|
"data-slot": "table-body",
|
|
82
100
|
...e
|
|
83
101
|
}
|
|
84
102
|
)
|
|
85
103
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
104
|
+
h.displayName = "TableBody";
|
|
105
|
+
const w = r.forwardRef(
|
|
88
106
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
89
107
|
"tfoot",
|
|
90
108
|
{
|
|
91
109
|
ref: o,
|
|
92
|
-
className:
|
|
110
|
+
className: d("bg-muted/50", a),
|
|
93
111
|
"data-hook": t,
|
|
94
112
|
"data-slot": "table-footer",
|
|
95
113
|
...e
|
|
96
114
|
}
|
|
97
115
|
)
|
|
98
116
|
);
|
|
99
|
-
|
|
100
|
-
const
|
|
117
|
+
w.displayName = "TableFooter";
|
|
118
|
+
const N = r.forwardRef(
|
|
101
119
|
({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
102
120
|
"tr",
|
|
103
121
|
{
|
|
104
122
|
ref: o,
|
|
105
|
-
className:
|
|
123
|
+
className: d(
|
|
106
124
|
"data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",
|
|
107
125
|
a
|
|
108
126
|
),
|
|
@@ -112,13 +130,13 @@ const w = d.forwardRef(
|
|
|
112
130
|
}
|
|
113
131
|
)
|
|
114
132
|
);
|
|
115
|
-
|
|
116
|
-
const
|
|
133
|
+
N.displayName = "TableRow";
|
|
134
|
+
const x = r.forwardRef(
|
|
117
135
|
({ className: a, dataHook: t, align: e, minWidth: o, style: s, scope: n = "col", ...i }, b) => /* @__PURE__ */ l(
|
|
118
136
|
"th",
|
|
119
137
|
{
|
|
120
138
|
ref: b,
|
|
121
|
-
className:
|
|
139
|
+
className: d(u({ align: e }), a),
|
|
122
140
|
"data-hook": t,
|
|
123
141
|
"data-slot": "table-head",
|
|
124
142
|
scope: n,
|
|
@@ -127,13 +145,13 @@ const N = d.forwardRef(
|
|
|
127
145
|
}
|
|
128
146
|
)
|
|
129
147
|
);
|
|
130
|
-
|
|
131
|
-
const
|
|
148
|
+
x.displayName = "TableHead";
|
|
149
|
+
const y = r.forwardRef(
|
|
132
150
|
({ className: a, dataHook: t, size: e, align: o, minWidth: s, style: n, ...i }, b) => /* @__PURE__ */ l(
|
|
133
151
|
"td",
|
|
134
152
|
{
|
|
135
153
|
ref: b,
|
|
136
|
-
className:
|
|
154
|
+
className: d(m({ size: e, align: o }), a),
|
|
137
155
|
"data-hook": t,
|
|
138
156
|
"data-slot": "table-cell",
|
|
139
157
|
style: { minWidth: s, ...n },
|
|
@@ -141,25 +159,25 @@ const T = d.forwardRef(
|
|
|
141
159
|
}
|
|
142
160
|
)
|
|
143
161
|
);
|
|
144
|
-
|
|
145
|
-
const
|
|
162
|
+
y.displayName = "TableCell";
|
|
163
|
+
const T = r.forwardRef(({ className: a, dataHook: t, ...e }, o) => /* @__PURE__ */ l(
|
|
146
164
|
"caption",
|
|
147
165
|
{
|
|
148
166
|
ref: o,
|
|
149
|
-
className:
|
|
167
|
+
className: d("caption-bottom py-4", a),
|
|
150
168
|
"data-hook": t,
|
|
151
169
|
"data-slot": "table-caption",
|
|
152
170
|
...e
|
|
153
171
|
}
|
|
154
172
|
));
|
|
155
|
-
|
|
173
|
+
T.displayName = "TableCaption";
|
|
156
174
|
export {
|
|
157
175
|
p as Table,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
176
|
+
h as TableBody,
|
|
177
|
+
T as TableCaption,
|
|
178
|
+
y as TableCell,
|
|
179
|
+
w as TableFooter,
|
|
180
|
+
x as TableHead,
|
|
181
|
+
g as TableHeader,
|
|
182
|
+
N as TableRow
|
|
165
183
|
};
|
package/dist/tabs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),q=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),q=require("react"),I=require("@radix-ui/react-tabs"),g=require("@brightlocal/ui-components/lib/utils");function h(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const i=h(q),T=h(I),w=i.createContext({lazyMount:!1,unmountOnExit:!1,activeValue:void 0,visitedTabs:new Set});function L({className:t,dataHook:s,trackingEl:a,trackingLabel:n,lazyMount:e=!1,unmountOnExit:r=!1,value:u,defaultValue:b,onValueChange:o,...m},v){const c=e||r,[S,R]=i.useState(b),d=u??S,[x,O]=i.useState(()=>new Set(d!=null?[d]:[])),P=i.useCallback(f=>{R(f),e&&O(p=>{if(p.has(f))return p;const k=new Set(p);return k.add(f),k}),o?.(f)},[e,o]),_=i.useMemo(()=>({lazyMount:e,unmountOnExit:r,activeValue:d,visitedTabs:x}),[e,r,d,x]);return l.jsx(w.Provider,{value:_,children:l.jsx(T.Root,{ref:v,className:g.cn("flex flex-col gap-2",t),"data-hook":s,"data-slot":"tabs","data-tracking-el":a,"data-tracking-label":n,defaultValue:c?void 0:b,value:c?d:u,onValueChange:c?P:o,...m})})}const j=i.forwardRef(L);j.displayName="Tabs";const y=i.forwardRef(({className:t,dataHook:s,trackingEl:a,trackingLabel:n,...e},r)=>l.jsx(T.List,{ref:r,className:g.cn("inline-flex h-9 w-fit items-center justify-center","bg-muted rounded-lg","p-1",t),"data-hook":s,"data-slot":"tabs-list","data-tracking-el":a,"data-tracking-label":n,...e}));y.displayName="TabsList";function V({className:t,dataHook:s,trackingEl:a,trackingLabel:n,...e},r){return l.jsx(T.Trigger,{ref:r,className:g.cn("inline-flex items-center justify-center gap-2 px-2 py-1","text-sm font-medium whitespace-nowrap","rounded-md","border border-transparent","text-foreground","transition-[color,box-shadow] duration-150 ease-in-out","data-[state=active]:bg-background data-[state=active]:shadow-sm","focus-visible:border-ring focus-visible:outline-none","data-[state=inactive]:focus-visible:shadow-default","data-[state=active]:focus-visible:shadow-default","dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5","disabled:pointer-events-none disabled:opacity-50",t),"data-hook":s,"data-slot":"tabs-trigger","data-tracking-el":a,"data-tracking-label":n,...e})}const C=i.forwardRef(V);C.displayName="TabsTrigger";function D({className:t,dataHook:s,trackingEl:a,trackingLabel:n,value:e,...r},u){const{lazyMount:b,unmountOnExit:o,activeValue:m,visitedTabs:v}=i.useContext(w),c=e===m;return b&&!v.has(e)||o&&!c?null:l.jsx(T.Content,{ref:u,className:g.cn("flex-1 outline-none",t),"data-hook":s,"data-slot":"tabs-content","data-tracking-el":a,"data-tracking-label":n,value:e,...r})}const N=i.forwardRef(D);N.displayName="TabsContent";exports.Tabs=j;exports.TabsContent=N;exports.TabsList=y;exports.TabsTrigger=C;
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
3
|
/**
|
|
4
|
-
* Props for the Tabs component
|
|
4
|
+
* Props for the Tabs component.
|
|
5
|
+
* Generic over the tab value type for type-safe `value` and `onValueChange`.
|
|
6
|
+
* @typeParam T - The type of tab values, defaults to `string`
|
|
5
7
|
*/
|
|
6
|
-
interface TabsProps extends React.ComponentProps<typeof TabsPrimitive.Root> {
|
|
8
|
+
interface TabsProps<T extends string = string> extends Omit<React.ComponentProps<typeof TabsPrimitive.Root>, "value" | "defaultValue" | "onValueChange"> {
|
|
7
9
|
/** Data hook for automated testing (required) */
|
|
8
10
|
dataHook: string;
|
|
9
11
|
/** Tracking element identifier for analytics */
|
|
@@ -14,8 +16,14 @@ interface TabsProps extends React.ComponentProps<typeof TabsPrimitive.Root> {
|
|
|
14
16
|
lazyMount?: boolean;
|
|
15
17
|
/** Unmount tab panel content when the tab becomes inactive */
|
|
16
18
|
unmountOnExit?: boolean;
|
|
19
|
+
/** The controlled value of the active tab */
|
|
20
|
+
value?: T;
|
|
21
|
+
/** The default value of the active tab (uncontrolled) */
|
|
22
|
+
defaultValue?: T;
|
|
23
|
+
/** Callback when the active tab changes */
|
|
24
|
+
onValueChange?: (value: T) => void;
|
|
17
25
|
}
|
|
18
|
-
declare const Tabs:
|
|
26
|
+
declare const Tabs: <T extends string = string>(props: TabsProps<T> & React.RefAttributes<React.ComponentRef<typeof TabsPrimitive.Root>>) => React.ReactElement | null;
|
|
19
27
|
/**
|
|
20
28
|
* Props for the TabsList component
|
|
21
29
|
*/
|
|
@@ -29,29 +37,37 @@ interface TabsListProps extends React.ComponentProps<typeof TabsPrimitive.List>
|
|
|
29
37
|
}
|
|
30
38
|
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
39
|
/**
|
|
32
|
-
* Props for the TabsTrigger component
|
|
40
|
+
* Props for the TabsTrigger component.
|
|
41
|
+
* Generic over the tab value type for type-safe `value` prop.
|
|
42
|
+
* @typeParam T - The type of tab values, defaults to `string`
|
|
33
43
|
*/
|
|
34
|
-
interface TabsTriggerProps extends React.ComponentProps<typeof TabsPrimitive.Trigger> {
|
|
44
|
+
interface TabsTriggerProps<T extends string = string> extends Omit<React.ComponentProps<typeof TabsPrimitive.Trigger>, "value"> {
|
|
35
45
|
/** Data hook for automated testing */
|
|
36
46
|
dataHook?: string;
|
|
37
47
|
/** Tracking element identifier for analytics */
|
|
38
48
|
trackingEl?: string;
|
|
39
49
|
/** Tracking label for analytics context */
|
|
40
50
|
trackingLabel?: string;
|
|
51
|
+
/** The value that identifies this tab */
|
|
52
|
+
value: T;
|
|
41
53
|
}
|
|
42
|
-
declare const TabsTrigger:
|
|
54
|
+
declare const TabsTrigger: <T extends string = string>(props: TabsTriggerProps<T> & React.RefAttributes<React.ComponentRef<typeof TabsPrimitive.Trigger>>) => React.ReactElement | null;
|
|
43
55
|
/**
|
|
44
|
-
* Props for the TabsContent component
|
|
56
|
+
* Props for the TabsContent component.
|
|
57
|
+
* Generic over the tab value type for type-safe `value` prop.
|
|
58
|
+
* @typeParam T - The type of tab values, defaults to `string`
|
|
45
59
|
*/
|
|
46
|
-
interface TabsContentProps extends React.ComponentProps<typeof TabsPrimitive.Content> {
|
|
60
|
+
interface TabsContentProps<T extends string = string> extends Omit<React.ComponentProps<typeof TabsPrimitive.Content>, "value"> {
|
|
47
61
|
/** Data hook for automated testing */
|
|
48
62
|
dataHook?: string;
|
|
49
63
|
/** Tracking element identifier for analytics */
|
|
50
64
|
trackingEl?: string;
|
|
51
65
|
/** Tracking label for analytics context */
|
|
52
66
|
trackingLabel?: string;
|
|
67
|
+
/** The value that identifies which tab this content belongs to */
|
|
68
|
+
value: T;
|
|
53
69
|
}
|
|
54
|
-
declare const TabsContent:
|
|
70
|
+
declare const TabsContent: <T extends string = string>(props: TabsContentProps<T> & React.RefAttributes<React.ComponentRef<typeof TabsPrimitive.Content>>) => React.ReactElement | null;
|
|
55
71
|
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
56
72
|
export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps };
|
|
57
73
|
//# sourceMappingURL=tabs.d.ts.map
|
package/dist/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAk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