@brightlocal/ui-components 3.1.0 → 3.2.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 +6 -1
- package/component-meta.json +663 -38
- package/deprecations.json +1 -1
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +21 -20
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +86 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +185 -96
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +231 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +466 -306
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +169 -22
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +695 -561
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +593 -561
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +28 -6
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +5 -5
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +11 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +97 -81
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +8 -3
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/card.tsx +211 -24
- package/src/components/chart.tsx +523 -35
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +1 -1
- package/src/components/data-table.tsx +778 -195
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +33 -11
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/select.tsx +35 -5
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +5 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/utils.ts +1 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { ChevronDown as J } from "@brightlocal/icons";
|
|
4
|
+
import { Button as R } from "@brightlocal/ui-components/button";
|
|
5
|
+
import { Drawer as K, DrawerTrigger as Q, DrawerContent as W, DrawerHeader as X, DrawerTitle as Y, DrawerDescription as Z, DrawerBody as E, DrawerFooter as H, DrawerClose as ee } from "@brightlocal/ui-components/drawer";
|
|
6
|
+
import { useIsBelowBreakpoint as le } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
7
|
+
import { Label as re } from "@brightlocal/ui-components/label";
|
|
8
|
+
import { RadioGroup as ae, RadioGroupItem as ne } from "@brightlocal/ui-components/radio-group";
|
|
9
|
+
import { Select as te, SelectTrigger as ce, SelectValue as oe, SelectContent as ie, SelectItem as se } from "@brightlocal/ui-components/select";
|
|
10
|
+
import { cn as j } from "@brightlocal/ui-components/lib/utils";
|
|
11
|
+
import { multiSelectFilterTriggerVariants as L } from "@brightlocal/ui-components/multi-select-filter";
|
|
12
|
+
function de({
|
|
13
|
+
value: c,
|
|
14
|
+
defaultValue: l,
|
|
15
|
+
onValueChange: o,
|
|
16
|
+
open: s,
|
|
17
|
+
onOpenChange: m
|
|
18
|
+
}) {
|
|
19
|
+
const [g, b] = h.useState(l), u = c !== void 0, C = u ? c : g, [p, $] = h.useState(!1), d = s !== void 0, f = d ? s : p, v = h.useCallback(
|
|
20
|
+
(i) => {
|
|
21
|
+
u || b(i), o?.(i);
|
|
22
|
+
},
|
|
23
|
+
[u, o]
|
|
24
|
+
), w = h.useCallback(
|
|
25
|
+
(i) => {
|
|
26
|
+
d || $(i), m?.(i);
|
|
27
|
+
},
|
|
28
|
+
[d, m]
|
|
29
|
+
);
|
|
30
|
+
return {
|
|
31
|
+
clear: () => v(l),
|
|
32
|
+
onOpenChange: w,
|
|
33
|
+
open: f,
|
|
34
|
+
setValue: v,
|
|
35
|
+
value: C
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function ue({ count: c }) {
|
|
39
|
+
return /* @__PURE__ */ e("span", { className: "text-muted-foreground text-label-sm ml-auto tabular-nums", children: c });
|
|
40
|
+
}
|
|
41
|
+
function N({
|
|
42
|
+
children: c,
|
|
43
|
+
dataHook: l
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ e(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
50
|
+
"data-hook": l,
|
|
51
|
+
children: c
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function U({
|
|
56
|
+
className: c,
|
|
57
|
+
dataHook: l,
|
|
58
|
+
label: o,
|
|
59
|
+
options: s,
|
|
60
|
+
value: m,
|
|
61
|
+
defaultValue: g = "",
|
|
62
|
+
onValueChange: b,
|
|
63
|
+
open: u,
|
|
64
|
+
onOpenChange: C,
|
|
65
|
+
size: p = "default",
|
|
66
|
+
icon: $,
|
|
67
|
+
presentation: d = "menu",
|
|
68
|
+
disabled: f = !1,
|
|
69
|
+
clearLabel: v,
|
|
70
|
+
doneLabel: w,
|
|
71
|
+
drawerDescription: i,
|
|
72
|
+
trackingEl: k,
|
|
73
|
+
trackingLabel: y,
|
|
74
|
+
"aria-label": O,
|
|
75
|
+
ref: F,
|
|
76
|
+
...I
|
|
77
|
+
}) {
|
|
78
|
+
const n = de({
|
|
79
|
+
defaultValue: g,
|
|
80
|
+
onOpenChange: C,
|
|
81
|
+
onValueChange: b,
|
|
82
|
+
open: u,
|
|
83
|
+
value: m
|
|
84
|
+
}), A = le("md"), M = d === "drawer" || d === "auto" && A, P = h.useId(), S = n.value === "" ? void 0 : s.find((r) => r.value === n.value), x = S?.label, D = S !== void 0, _ = D ? x : o, V = $ ?? S?.icon, T = V ? /* @__PURE__ */ e(N, { dataHook: `${l}-icon`, children: V }) : null, B = D ? `${o}: ${x}` : o;
|
|
85
|
+
if (M) {
|
|
86
|
+
const r = /* @__PURE__ */ t(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
ref: F,
|
|
90
|
+
"aria-label": O ?? B,
|
|
91
|
+
className: j(L({ size: p }), c),
|
|
92
|
+
"data-hook": l,
|
|
93
|
+
"data-slot": "single-select-filter",
|
|
94
|
+
"data-tracking-el": k ?? "single-select-filter",
|
|
95
|
+
"data-tracking-label": y,
|
|
96
|
+
disabled: f,
|
|
97
|
+
type: "button",
|
|
98
|
+
...I,
|
|
99
|
+
children: [
|
|
100
|
+
T,
|
|
101
|
+
/* @__PURE__ */ e("span", { "data-hook": `${l}-summary`, children: _ }),
|
|
102
|
+
/* @__PURE__ */ e(J, { "aria-hidden": "true", className: "text-muted-foreground" })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
return /* @__PURE__ */ t(K, { open: n.open, onOpenChange: n.onOpenChange, children: [
|
|
107
|
+
/* @__PURE__ */ e(Q, { asChild: !0, children: r }),
|
|
108
|
+
/* @__PURE__ */ t(W, { dataHook: `${l}-drawer`, children: [
|
|
109
|
+
/* @__PURE__ */ t(X, { children: [
|
|
110
|
+
/* @__PURE__ */ e(Y, { children: o }),
|
|
111
|
+
/* @__PURE__ */ e(Z, { className: "sr-only", children: i ?? "Pick one option." })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ t(E, { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pb-2", children: [
|
|
114
|
+
/* @__PURE__ */ e(
|
|
115
|
+
ae,
|
|
116
|
+
{
|
|
117
|
+
className: "grid grid-cols-2 gap-x-4 gap-y-3",
|
|
118
|
+
dataHook: `${l}-radio-group`,
|
|
119
|
+
value: n.value,
|
|
120
|
+
onValueChange: (a) => {
|
|
121
|
+
n.setValue(a);
|
|
122
|
+
},
|
|
123
|
+
children: s.map((a, q) => {
|
|
124
|
+
const z = a.disabled || a.count === 0, G = `${P}-${q}`;
|
|
125
|
+
return /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
126
|
+
/* @__PURE__ */ e(
|
|
127
|
+
ne,
|
|
128
|
+
{
|
|
129
|
+
"data-hook": `${l}-option-${a.value}`,
|
|
130
|
+
disabled: z,
|
|
131
|
+
id: G,
|
|
132
|
+
value: a.value
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ t(re, { className: "flex-1 gap-2", htmlFor: G, children: [
|
|
136
|
+
a.icon ? /* @__PURE__ */ e(
|
|
137
|
+
N,
|
|
138
|
+
{
|
|
139
|
+
dataHook: `${l}-option-${a.value}-icon`,
|
|
140
|
+
children: a.icon
|
|
141
|
+
}
|
|
142
|
+
) : null,
|
|
143
|
+
a.label
|
|
144
|
+
] }),
|
|
145
|
+
a.count !== void 0 ? /* @__PURE__ */ e(ue, { count: a.count }) : null
|
|
146
|
+
] }, a.value);
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
D && n.value !== g ? /* @__PURE__ */ e(
|
|
151
|
+
R,
|
|
152
|
+
{
|
|
153
|
+
dataHook: `${l}-clear`,
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
onClick: () => n.clear(),
|
|
156
|
+
children: v ?? "Clear filters"
|
|
157
|
+
}
|
|
158
|
+
) : null
|
|
159
|
+
] }),
|
|
160
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(ee, { asChild: !0, children: /* @__PURE__ */ e(R, { dataHook: `${l}-done`, children: w ?? "Done" }) }) })
|
|
161
|
+
] })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
return /* @__PURE__ */ e(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
"data-hook": l,
|
|
168
|
+
"data-slot": "single-select-filter",
|
|
169
|
+
"data-tracking-el": k ?? "single-select-filter",
|
|
170
|
+
"data-tracking-label": y,
|
|
171
|
+
children: /* @__PURE__ */ t(
|
|
172
|
+
te,
|
|
173
|
+
{
|
|
174
|
+
disabled: f,
|
|
175
|
+
open: n.open,
|
|
176
|
+
value: n.value,
|
|
177
|
+
onOpenChange: n.onOpenChange,
|
|
178
|
+
onValueChange: (r) => n.setValue(r),
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ t(
|
|
181
|
+
ce,
|
|
182
|
+
{
|
|
183
|
+
ref: F,
|
|
184
|
+
className: j(
|
|
185
|
+
L({ size: p }),
|
|
186
|
+
// A filter reads the dimension name like a value, never muted.
|
|
187
|
+
"data-[placeholder]:text-foreground w-auto",
|
|
188
|
+
c
|
|
189
|
+
),
|
|
190
|
+
dataHook: `${l}-trigger`,
|
|
191
|
+
selectLabel: O ?? B,
|
|
192
|
+
...I,
|
|
193
|
+
children: [
|
|
194
|
+
T,
|
|
195
|
+
/* @__PURE__ */ e(oe, { placeholder: o, children: x })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ e(ie, { align: "start", children: s.map((r) => {
|
|
200
|
+
const a = r.disabled || r.count === 0;
|
|
201
|
+
return /* @__PURE__ */ e(
|
|
202
|
+
se,
|
|
203
|
+
{
|
|
204
|
+
"data-hook": `${l}-option-${r.value}`,
|
|
205
|
+
disabled: a,
|
|
206
|
+
hint: r.count !== void 0 ? /* @__PURE__ */ e("span", { className: "tabular-nums", children: r.count }) : void 0,
|
|
207
|
+
value: r.value,
|
|
208
|
+
children: /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
|
|
209
|
+
r.icon ? /* @__PURE__ */ e(N, { dataHook: `${l}-option-${r.value}-icon`, children: r.icon }) : null,
|
|
210
|
+
r.label
|
|
211
|
+
] })
|
|
212
|
+
},
|
|
213
|
+
r.value
|
|
214
|
+
);
|
|
215
|
+
}) })
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
const Se = U;
|
|
223
|
+
U.displayName = "SingleSelectFilter";
|
|
224
|
+
export {
|
|
225
|
+
Se as SingleSelectFilter
|
|
226
|
+
};
|
package/dist/sonner.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@brightlocal/icons"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@brightlocal/icons"),f=require("class-variance-authority"),m=require("sonner"),x=require("@brightlocal/ui-components/button"),o=require("@brightlocal/ui-components/lib/utils"),v=require("@brightlocal/ui-components/spinner"),g=4e3,p=f.cva(["flex","items-center","justify-between","w-full","md:w-auto","md:min-w-[364px]","rounded-md","border","border-border","p-4","gap-2","shadow-lg"].join(" "),{variants:{colorSchema:{default:"bg-popover",success:"bg-success-background dark:bg-popover"}},defaultVariants:{colorSchema:"default"}}),N=f.cva("text-heading-compact",{variants:{colorSchema:{default:"text-foreground",success:"text-success-foreground dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),j=f.cva("text-body-sm",{variants:{colorSchema:{default:"text-muted-foreground",success:"text-success-foreground dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),l=f.cva("",{variants:{colorSchema:{default:"text-foreground",success:"text-success-foreground dark:text-green-100"}},defaultVariants:{colorSchema:"default"}});function T(c,t){switch(c){case"info":return e.jsx(d.Info,{className:o.cn(l({colorSchema:t}))});case"success":return e.jsx(d.CheckCircle2,{className:o.cn(l({colorSchema:t}))});case"warning":return e.jsx(d.AlertTriangle,{className:o.cn(l({colorSchema:t}))});case"error":return e.jsx(d.XCircle,{className:o.cn(l({colorSchema:t}))});case"loading":return e.jsx(v.Spinner,{className:o.cn(l({colorSchema:t}))});default:return null}}const S=function(t,r){const{id:a,...s}=t,u={...r,duration:r?.duration??g,...a!=null&&{id:r?.id??a}},h=u.duration===1/0;m.toast.custom(n=>{const i=s.button&&s.button.label?{label:s.button.label,variant:s.button.variant,onClick:()=>{s.button?.onClick&&s.button.onClick(),m.toast.dismiss(n)}}:void 0;return e.jsx(I,{button:i,colorSchema:s.colorSchema,description:s.description,icon:s.icon??void 0,id:n,title:s.title})},{...u,...h&&{dismissible:!1}})};S.dismiss=c=>{m.toast.dismiss(c)};function I(c){const{button:t,description:r,icon:a,title:s,colorSchema:u}=c,n=(i=>i==="success"?"success":"default")(u);return e.jsxs("div",{"aria-atomic":"true","aria-live":"polite",className:o.cn(p({colorSchema:n})),role:"status",children:[e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[a!=null&&(()=>{const i=T(a,n);return i?e.jsx("span",{className:"mt-0.5 shrink-0",children:i}):null})(),e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:o.cn(N({colorSchema:n})),children:s}),r&&e.jsx("p",{className:o.cn(j({colorSchema:n})),children:r})]})]}),t?.label&&e.jsx(x.Button,{"aria-label":t.label,dataHook:"toast-action",size:"sm",variant:t.variant,onClick:t.onClick,children:t.label})]})}function b(){return e.jsx(m.Toaster,{position:"top-right"})}b.displayName="Sonner";exports.Sonner=b;exports.sonner=S;
|
package/dist/sonner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../src/components/sonner.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAI/E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEhD;;;;GAIG;AACH,KAAK,UAAU,GAAG;IAChB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,MAAM,CAAC,EAAE;QACP,wBAAwB;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,mCAAmC;QACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;QACrB,mCAAmC;QACnC,OAAO,CAAC,EAAE,mBAAmB,CAAC;KAC/B,CAAC;IACF,gCAAgC;IAChC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,mCAAmC;IACnC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtD,KAAK,mBAAmB,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;I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G;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,+MAA+M;IAC/M,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AA8GpE,UAAU,QAAQ;IAChB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzD,mCAAmC;IACnC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,QAAA,MAAM,MAAM,EAAE,QA+Cb,CAAC;AA+DF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,iBAAS,MAAM,4CAEd;kBAFQ,MAAM;;;AAKf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/sonner.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { XCircle as S, AlertTriangle as p, CheckCircle2 as b, Info as g } from "@brightlocal/icons";
|
|
3
|
-
import { cva as
|
|
3
|
+
import { cva as d } from "class-variance-authority";
|
|
4
4
|
import { Toaster as v, toast as f } from "sonner";
|
|
5
5
|
import { Button as N } from "@brightlocal/ui-components/button";
|
|
6
6
|
import { cn as r } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { Spinner as x } from "@brightlocal/ui-components/spinner";
|
|
8
|
-
const I = 4e3, T =
|
|
8
|
+
const I = 4e3, T = d(
|
|
9
9
|
[
|
|
10
10
|
"flex",
|
|
11
11
|
"items-center",
|
|
@@ -23,47 +23,47 @@ const I = 4e3, T = u(
|
|
|
23
23
|
{
|
|
24
24
|
variants: {
|
|
25
25
|
colorSchema: {
|
|
26
|
-
default: "bg-
|
|
27
|
-
success: "bg-
|
|
26
|
+
default: "bg-popover",
|
|
27
|
+
success: "bg-success-background dark:bg-popover"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
defaultVariants: {
|
|
31
31
|
colorSchema: "default"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
), k =
|
|
34
|
+
), k = d("text-heading-compact", {
|
|
35
35
|
variants: {
|
|
36
36
|
colorSchema: {
|
|
37
37
|
default: "text-foreground",
|
|
38
|
-
success: "text-
|
|
38
|
+
success: "text-success-foreground dark:text-green-100"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
defaultVariants: {
|
|
42
42
|
colorSchema: "default"
|
|
43
43
|
}
|
|
44
|
-
}), A =
|
|
44
|
+
}), A = d("text-body-sm", {
|
|
45
45
|
variants: {
|
|
46
46
|
colorSchema: {
|
|
47
47
|
default: "text-muted-foreground",
|
|
48
|
-
success: "text-
|
|
48
|
+
success: "text-success-foreground dark:text-green-100"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
defaultVariants: {
|
|
52
52
|
colorSchema: "default"
|
|
53
53
|
}
|
|
54
|
-
}), l =
|
|
54
|
+
}), l = d("", {
|
|
55
55
|
variants: {
|
|
56
56
|
colorSchema: {
|
|
57
57
|
default: "text-foreground",
|
|
58
|
-
success: "text-
|
|
58
|
+
success: "text-success-foreground dark:text-green-100"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
defaultVariants: {
|
|
62
62
|
colorSchema: "default"
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
function C(
|
|
66
|
-
switch (
|
|
65
|
+
function C(s, e) {
|
|
66
|
+
switch (s) {
|
|
67
67
|
case "info":
|
|
68
68
|
return /* @__PURE__ */ o(g, { className: r(l({ colorSchema: e })) });
|
|
69
69
|
case "success":
|
|
@@ -79,11 +79,11 @@ function C(n, e) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
const w = function(e, c) {
|
|
82
|
-
const { id:
|
|
82
|
+
const { id: n, ...t } = e, u = {
|
|
83
83
|
...c,
|
|
84
84
|
duration: c?.duration ?? I,
|
|
85
|
-
...
|
|
86
|
-
}, h =
|
|
85
|
+
...n != null && { id: c?.id ?? n }
|
|
86
|
+
}, h = u.duration === 1 / 0;
|
|
87
87
|
f.custom(
|
|
88
88
|
(a) => {
|
|
89
89
|
const i = t.button && t.button.label ? {
|
|
@@ -106,16 +106,16 @@ const w = function(e, c) {
|
|
|
106
106
|
);
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
|
-
...
|
|
109
|
+
...u,
|
|
110
110
|
...h && { dismissible: !1 }
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
};
|
|
114
|
-
w.dismiss = (
|
|
115
|
-
f.dismiss(
|
|
114
|
+
w.dismiss = (s) => {
|
|
115
|
+
f.dismiss(s);
|
|
116
116
|
};
|
|
117
|
-
function V(
|
|
118
|
-
const { button: e, description: c, icon:
|
|
117
|
+
function V(s) {
|
|
118
|
+
const { button: e, description: c, icon: n, title: t, colorSchema: u } = s, a = ((i) => i === "success" ? "success" : "default")(u);
|
|
119
119
|
return /* @__PURE__ */ m(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
@@ -125,8 +125,8 @@ function V(n) {
|
|
|
125
125
|
role: "status",
|
|
126
126
|
children: [
|
|
127
127
|
/* @__PURE__ */ m("div", { className: "flex flex-1 items-start gap-2", children: [
|
|
128
|
-
|
|
129
|
-
const i = C(
|
|
128
|
+
n != null && (() => {
|
|
129
|
+
const i = C(n, a);
|
|
130
130
|
return i ? /* @__PURE__ */ o("span", { className: "mt-0.5 shrink-0", children: i }) : null;
|
|
131
131
|
})(),
|
|
132
132
|
/* @__PURE__ */ m("div", { className: "w-full", children: [
|
package/dist/split-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),i=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,l.get?l:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const n=S(h),g=n.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:l,left:o,right:r,children:c
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),i=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,l.get?l:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const n=S(h),g=n.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:l,left:o,right:r,children:u,...c},d)=>s.jsxs("div",{ref:d,className:i.cn("group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",t),"data-hook":a,"data-slot":"split-layout","data-tracking-el":e||"split-layout","data-tracking-label":l,...c,children:[u,o&&s.jsx(p,{children:o}),r&&s.jsx(f,{children:r})]}));g.displayName="SplitLayout";const y=n.forwardRef(({className:t,children:a,...e},l)=>s.jsx("div",{ref:l,className:i.cn("px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",t),"data-slot":"split-layout-header",...e,children:a}));y.displayName="SplitLayoutHeader";const p=n.forwardRef(({className:t,sticky:a=!1,children:e,...l},o)=>s.jsx("div",{ref:o,className:i.cn("p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto","group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",a&&"lg:sticky lg:top-0 lg:h-screen lg:self-start",t),"data-slot":"split-layout-left",...l,children:e}));p.displayName="SplitLayoutContentLeft";const f=n.forwardRef(({className:t,flush:a=!1,sticky:e=!1,children:l,...o},r)=>s.jsx("div",{ref:r,className:i.cn("bg-muted hidden lg:col-start-2 lg:row-span-full lg:row-start-1",a?"relative overflow-hidden lg:block":"p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",e&&"lg:sticky lg:top-0 lg:h-screen lg:self-start",t),"data-slot":"split-layout-right",...o,children:l}));f.displayName="SplitLayoutContentRight";const m=n.forwardRef(({className:t,dataHook:a,src:e,alt:l,objectFit:o="cover",objectPosition:r="center",style:u,...c},d)=>s.jsx("img",{ref:d,alt:l,className:i.cn("absolute inset-0 h-full w-full",t),"data-hook":a,"data-slot":"split-layout-image",src:e,style:{objectFit:o,objectPosition:r,...u},...c}));m.displayName="SplitLayoutImage";exports.SplitLayout=g;exports.SplitLayoutContentLeft=p;exports.SplitLayoutContentRight=f;exports.SplitLayoutHeader=y;exports.SplitLayoutImage=m;
|
package/dist/split-layout.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
|
|
|
123
123
|
* SplitLayoutContentRight - Right/secondary section within a SplitLayout.
|
|
124
124
|
*
|
|
125
125
|
* Hidden on mobile/tablet (<1024px), visible on desktop (≥1024px).
|
|
126
|
-
* Uses
|
|
126
|
+
* Uses the muted background colour (bg-muted).
|
|
127
127
|
* Self-positions in the second column, spanning all rows of the grid.
|
|
128
128
|
*
|
|
129
129
|
* Set `flush` to remove padding for full-bleed content (e.g. images).
|
package/dist/split-layout.js
CHANGED
|
@@ -9,12 +9,12 @@ const y = i.forwardRef(
|
|
|
9
9
|
trackingLabel: e,
|
|
10
10
|
left: s,
|
|
11
11
|
right: o,
|
|
12
|
-
children:
|
|
13
|
-
...
|
|
14
|
-
},
|
|
12
|
+
children: d,
|
|
13
|
+
...u
|
|
14
|
+
}, c) => /* @__PURE__ */ g(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
|
-
ref:
|
|
17
|
+
ref: c,
|
|
18
18
|
className: n(
|
|
19
19
|
"group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",
|
|
20
20
|
t
|
|
@@ -23,9 +23,9 @@ const y = i.forwardRef(
|
|
|
23
23
|
"data-slot": "split-layout",
|
|
24
24
|
"data-tracking-el": l || "split-layout",
|
|
25
25
|
"data-tracking-label": e,
|
|
26
|
-
...
|
|
26
|
+
...u,
|
|
27
27
|
children: [
|
|
28
|
-
|
|
28
|
+
d,
|
|
29
29
|
s && /* @__PURE__ */ r(p, { children: s }),
|
|
30
30
|
o && /* @__PURE__ */ r(f, { children: o })
|
|
31
31
|
]
|
|
@@ -68,7 +68,7 @@ const f = i.forwardRef(({ className: t, flush: a = !1, sticky: l = !1, children:
|
|
|
68
68
|
{
|
|
69
69
|
ref: o,
|
|
70
70
|
className: n(
|
|
71
|
-
"bg-
|
|
71
|
+
"bg-muted hidden lg:col-start-2 lg:row-span-full lg:row-start-1",
|
|
72
72
|
a ? "relative overflow-hidden lg:block" : "p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",
|
|
73
73
|
l && "lg:sticky lg:top-0 lg:h-screen lg:self-start",
|
|
74
74
|
t
|
|
@@ -87,19 +87,19 @@ const h = i.forwardRef(
|
|
|
87
87
|
alt: e,
|
|
88
88
|
objectFit: s = "cover",
|
|
89
89
|
objectPosition: o = "center",
|
|
90
|
-
style:
|
|
91
|
-
...
|
|
92
|
-
},
|
|
90
|
+
style: d,
|
|
91
|
+
...u
|
|
92
|
+
}, c) => /* @__PURE__ */ r(
|
|
93
93
|
"img",
|
|
94
94
|
{
|
|
95
|
-
ref:
|
|
95
|
+
ref: c,
|
|
96
96
|
alt: e,
|
|
97
97
|
className: n("absolute inset-0 h-full w-full", t),
|
|
98
98
|
"data-hook": a,
|
|
99
99
|
"data-slot": "split-layout-image",
|
|
100
100
|
src: l,
|
|
101
|
-
style: { objectFit: s, objectPosition: o, ...
|
|
102
|
-
...
|
|
101
|
+
style: { objectFit: s, objectPosition: o, ...d },
|
|
102
|
+
...u
|
|
103
103
|
}
|
|
104
104
|
)
|
|
105
105
|
);
|
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"),k=require("react"),u=require("class-variance-authority"),s=require("@brightlocal/ui-components/lib/utils");function v(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 r=v(k),C=u.cva("align-middle bg-transparent text-body-sm text-foreground 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"}}),H=u.cva("[thead_&]:bg-muted h-12 p-2 align-middle text-muted-foreground text-label font-semibold break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-fast ease-out",{variants:{align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{align:"left"}});function m(e){return{role:"region","aria-label":e??"Scrollable table",tabIndex:0}}const g=r.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:l,layout:d="auto",minWidth:n,scrollRegionLabel:c,scrollOwner:i="self",style:b,...R},j)=>{const f=i==="self";return o.jsx("div",{className:s.cn("relative w-full",f&&"scrollbar overflow-x-auto",f&&n&&"focus-visible:shadow-default rounded-md outline-none"),"data-slot":"table-container",...f&&n?m(c):void 0,children:o.jsx("table",{ref:j,className:s.cn("text-body-sm w-full caption-bottom tabular-nums",d==="fixed"&&"table-fixed",e),"data-hook":t,"data-slot":"table","data-tracking-el":a,"data-tracking-label":l,style:{minWidth:n,...b},...R})})});g.displayName="Table";const p=r.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("thead",{ref:l,className:s.cn("bg-muted",e),"data-hook":t,"data-slot":"table-header",...a}));p.displayName="TableHeader";const x=r.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tbody",{ref:l,className:s.cn(e),"data-hook":t,"data-slot":"table-body",...a}));x.displayName="TableBody";const T=r.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tfoot",{ref:l,className:s.cn("bg-muted/50",e),"data-hook":t,"data-slot":"table-footer",...a}));T.displayName="TableFooter";const y=r.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tr",{ref:l,className:s.cn("data-[state=selected]:bg-muted","duration-fast transition-colors ease-out",e),"data-hook":t,"data-slot":"table-row",...a}));y.displayName="TableRow";const h=r.forwardRef(({className:e,dataHook:t,align:a,width:l,minWidth:d,style:n,scope:c="col",...i},b)=>o.jsx("th",{ref:b,className:s.cn(H({align:a}),e),"data-hook":t,"data-slot":"table-head",scope:c,style:{width:l,minWidth:d,...n},...i}));h.displayName="TableHead";const w=r.forwardRef(({className:e,dataHook:t,size:a,align:l,width:d,minWidth:n,style:c,...i},b)=>o.jsx("td",{ref:b,className:s.cn(C({size:a,align:l}),e),"data-hook":t,"data-slot":"table-cell",style:{width:d,minWidth:n,...c},...i}));w.displayName="TableCell";const N=r.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("caption",{ref:l,className:s.cn("caption-bottom py-4",e),"data-hook":t,"data-slot":"table-caption",...a}));N.displayName="TableCaption";exports.Table=g;exports.TableBody=x;exports.TableCaption=N;exports.TableCell=w;exports.TableFooter=T;exports.TableHead=h;exports.TableHeader=p;exports.TableRow=y;exports.scrollRegionProps=m;
|
package/dist/table.d.ts
CHANGED
|
@@ -7,6 +7,26 @@ declare const tableCellVariants: (props?: ({
|
|
|
7
7
|
declare const tableHeadVariants: (props?: ({
|
|
8
8
|
align?: "center" | "left" | "right" | null | undefined;
|
|
9
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Focusable scroll-region semantics for a table's scroll container:
|
|
12
|
+
* `role="region"` with an accessible name plus `tabIndex={0}`, so keyboard
|
|
13
|
+
* users can focus the container and scroll it (axe:
|
|
14
|
+
* scrollable-region-focusable).
|
|
15
|
+
*
|
|
16
|
+
* Single source of the contract and its "Scrollable table" default.
|
|
17
|
+
* `Table` applies it to its own wrapper (`scrollOwner="self"` + `minWidth`);
|
|
18
|
+
* `DataTable` / `VirtualizedDataTable` apply it to their outer wrapper,
|
|
19
|
+
* which owns scrolling instead. The caller decides *when* the container is
|
|
20
|
+
* a scroll region; this helper only says *what* that means.
|
|
21
|
+
*
|
|
22
|
+
* @internal Exported only so the DataTable module shares one copy — not a
|
|
23
|
+
* public contract; its shape may change without a major release.
|
|
24
|
+
*/
|
|
25
|
+
declare function scrollRegionProps(scrollRegionLabel: string | undefined): {
|
|
26
|
+
readonly role: "region";
|
|
27
|
+
readonly "aria-label": string;
|
|
28
|
+
readonly tabIndex: 0;
|
|
29
|
+
};
|
|
10
30
|
interface TableProps extends React.ComponentProps<"table"> {
|
|
11
31
|
/**
|
|
12
32
|
* Data hook for automated testing (REQUIRED)
|
|
@@ -35,16 +55,37 @@ interface TableProps extends React.ComponentProps<"table"> {
|
|
|
35
55
|
* Minimum width for the table (e.g., "600px", "40rem").
|
|
36
56
|
* Prevents columns from compressing on narrow viewports and enables
|
|
37
57
|
* horizontal scroll via the built-in overflow container.
|
|
38
|
-
*
|
|
39
|
-
* keyboard accessibility
|
|
58
|
+
* With `scrollOwner="self"` (the default) the wrapper then becomes a
|
|
59
|
+
* focusable scroll region for keyboard accessibility; with
|
|
60
|
+
* `scrollOwner="parent"` the scrolling ancestor must carry those
|
|
61
|
+
* semantics itself (`DataTable` does).
|
|
40
62
|
*/
|
|
41
63
|
minWidth?: string;
|
|
42
64
|
/**
|
|
43
65
|
* Accessible label for the scroll container region.
|
|
44
|
-
* Used when `minWidth` is set
|
|
66
|
+
* Used when `minWidth` is set with `scrollOwner="self"` (the default).
|
|
67
|
+
* Ignored with `scrollOwner="parent"` — the scrolling ancestor owns the
|
|
68
|
+
* region and its label there.
|
|
69
|
+
*
|
|
70
|
+
* Give each table on a page a distinct label — several region landmarks
|
|
71
|
+
* sharing the default name violate axe's landmark-unique rule.
|
|
45
72
|
* @default "Scrollable table"
|
|
46
73
|
*/
|
|
47
74
|
scrollRegionLabel?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Which element owns the table's scrolling.
|
|
77
|
+
* - `"self"` (default) — the built-in `table-container` wrapper scrolls
|
|
78
|
+
* horizontally and (with `minWidth`) carries the focusable
|
|
79
|
+
* scroll-region semantics. Standalone Table behavior.
|
|
80
|
+
* - `"parent"` — no internal scroll container is created: the wrapper
|
|
81
|
+
* stays a plain positioned block, so the nearest scrolling ancestor
|
|
82
|
+
* owns both axes. A `sticky` header then sticks to that ancestor, and
|
|
83
|
+
* the ancestor must carry the scroll-region semantics itself when
|
|
84
|
+
* `minWidth` is set. `DataTable` / `VirtualizedDataTable` render Table
|
|
85
|
+
* this way — their outer wrapper is the single scroll container.
|
|
86
|
+
* @default "self"
|
|
87
|
+
*/
|
|
88
|
+
scrollOwner?: "self" | "parent";
|
|
48
89
|
}
|
|
49
90
|
declare const Table: React.ForwardRefExoticComponent<Omit<TableProps, "ref"> & React.RefAttributes<HTMLTableElement>>;
|
|
50
91
|
interface TableHeaderProps extends React.ComponentProps<"thead"> {
|
|
@@ -157,6 +198,6 @@ interface TableCaptionProps extends React.ComponentProps<"caption"> {
|
|
|
157
198
|
* ```
|
|
158
199
|
*/
|
|
159
200
|
declare const TableCaption: React.ForwardRefExoticComponent<Omit<TableCaptionProps, "ref"> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
160
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
201
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, scrollRegionProps, };
|
|
161
202
|
export type { TableProps, TableHeaderProps, TableBodyProps, TableFooterProps, TableRowProps, TableHeadProps, TableCellProps, TableCaptionProps, };
|
|
162
203
|
//# sourceMappingURL=table.d.ts.map
|
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;;8EAgBtB,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,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B
|
|
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;;8EAgBtB,CAAC;AAMF;;;;;;;;;;;;;;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