@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
package/dist/select.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { Check as N, ChevronDown as
|
|
1
|
+
import { jsx as e, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import * as a from "@radix-ui/react-select";
|
|
4
|
+
import { Check as N, ChevronDown as x, ChevronUp as w } from "@brightlocal/icons";
|
|
5
5
|
import { cva as k } from "class-variance-authority";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as n, FLOATING_CONTENT_ANIMATION as C } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { useDevWarning as I } from "./lib/use-dev-warning.js";
|
|
8
8
|
import { useOverlayPointerLock as R } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
9
9
|
function T({
|
|
10
10
|
children: t,
|
|
11
11
|
onClose: r,
|
|
12
|
-
onOpenChange:
|
|
13
|
-
open:
|
|
12
|
+
onOpenChange: o,
|
|
13
|
+
open: l,
|
|
14
14
|
defaultOpen: i,
|
|
15
15
|
...p
|
|
16
16
|
}) {
|
|
17
|
-
const [
|
|
17
|
+
const [c, s] = m.useState(
|
|
18
18
|
i ?? !1
|
|
19
|
-
),
|
|
20
|
-
(
|
|
21
|
-
|
|
19
|
+
), d = l !== void 0, u = d ? l : c, h = m.useCallback(
|
|
20
|
+
(g) => {
|
|
21
|
+
d || s(g), o?.(g);
|
|
22
22
|
},
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
[d, o]
|
|
24
|
+
), f = m.useRef(r);
|
|
25
|
+
m.useEffect(() => {
|
|
26
|
+
f.current = r;
|
|
27
27
|
}, [r]);
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
|
|
28
|
+
const b = m.useRef(u);
|
|
29
|
+
return m.useEffect(() => {
|
|
30
|
+
b.current && !u && f.current?.(), b.current = u;
|
|
31
|
+
}, [u]), m.useEffect(() => () => {
|
|
32
|
+
b.current && f.current?.();
|
|
33
33
|
}, []), /* @__PURE__ */ e(
|
|
34
|
-
|
|
34
|
+
a.Root,
|
|
35
35
|
{
|
|
36
36
|
"data-slot": "select",
|
|
37
37
|
defaultOpen: i,
|
|
38
|
-
open:
|
|
39
|
-
onOpenChange:
|
|
38
|
+
open: l,
|
|
39
|
+
onOpenChange: h,
|
|
40
40
|
...p,
|
|
41
41
|
children: t
|
|
42
42
|
}
|
|
@@ -44,11 +44,11 @@ function T({
|
|
|
44
44
|
}
|
|
45
45
|
T.displayName = "Select";
|
|
46
46
|
function O(t) {
|
|
47
|
-
return /* @__PURE__ */ e(
|
|
47
|
+
return /* @__PURE__ */ e(a.Group, { "data-slot": "select-group", ...t });
|
|
48
48
|
}
|
|
49
49
|
O.displayName = "SelectGroup";
|
|
50
50
|
function j(t) {
|
|
51
|
-
return /* @__PURE__ */ e(
|
|
51
|
+
return /* @__PURE__ */ e(a.Value, { "data-slot": "select-value", ...t });
|
|
52
52
|
}
|
|
53
53
|
j.displayName = "SelectValue";
|
|
54
54
|
const B = k([
|
|
@@ -59,9 +59,9 @@ const B = k([
|
|
|
59
59
|
"border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
60
60
|
"bg-neutral-50 border-neutral-300",
|
|
61
61
|
"dark:bg-white/5 dark:border-white/15",
|
|
62
|
-
// Typography — text-
|
|
63
|
-
//
|
|
64
|
-
"text-
|
|
62
|
+
// Typography — text-field (DS-992): label-sized like every field value, with
|
|
63
|
+
// the built-in 16px touch bump that keeps iOS Safari from zooming on focus.
|
|
64
|
+
"text-field text-foreground",
|
|
65
65
|
// Text truncation for long content (shadcn default behavior)
|
|
66
66
|
"[&>span]:block [&>span]:truncate",
|
|
67
67
|
// Placeholder state
|
|
@@ -79,26 +79,42 @@ const B = k([
|
|
|
79
79
|
function L({
|
|
80
80
|
className: t,
|
|
81
81
|
children: r,
|
|
82
|
-
placeholder:
|
|
83
|
-
dataHook:
|
|
82
|
+
placeholder: o,
|
|
83
|
+
dataHook: l,
|
|
84
84
|
error: i,
|
|
85
85
|
selectLabel: p,
|
|
86
|
-
|
|
86
|
+
reserveValues: c,
|
|
87
|
+
...s
|
|
87
88
|
}) {
|
|
88
|
-
const
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
const d = i || s["aria-invalid"] === !0 || s["aria-invalid"] === "true", u = s["aria-required"] === !0 || s["aria-required"] === "true", h = s["aria-label"] || p || o || "Select an option", f = 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" : "";
|
|
90
|
+
return /* @__PURE__ */ v(
|
|
91
|
+
a.Trigger,
|
|
91
92
|
{
|
|
92
|
-
...
|
|
93
|
-
"aria-invalid":
|
|
94
|
-
"aria-label":
|
|
93
|
+
...s,
|
|
94
|
+
"aria-invalid": d ? "true" : void 0,
|
|
95
|
+
"aria-label": h,
|
|
95
96
|
"aria-required": u ? "true" : void 0,
|
|
96
|
-
className:
|
|
97
|
-
"data-hook":
|
|
97
|
+
className: n(B(), f, t),
|
|
98
|
+
"data-hook": l,
|
|
98
99
|
"data-slot": "select-trigger",
|
|
99
100
|
children: [
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
c?.length ? (
|
|
102
|
+
// The base [&>span]:block would beat .grid on specificity, flowing the
|
|
103
|
+
// sizer spans inline and summing their widths — hence !grid.
|
|
104
|
+
/* @__PURE__ */ v("span", { className: "!grid min-w-0 text-left", "data-slot": "select-reserve", children: [
|
|
105
|
+
c.map((b, g) => /* @__PURE__ */ e(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: "invisible col-start-1 row-start-1 truncate",
|
|
110
|
+
children: b
|
|
111
|
+
},
|
|
112
|
+
g
|
|
113
|
+
)),
|
|
114
|
+
/* @__PURE__ */ e("span", { className: "col-start-1 row-start-1 truncate", children: r })
|
|
115
|
+
] })
|
|
116
|
+
) : r,
|
|
117
|
+
/* @__PURE__ */ e(a.Icon, { asChild: !0, children: /* @__PURE__ */ e(x, { className: "text-muted-foreground" }) })
|
|
102
118
|
]
|
|
103
119
|
}
|
|
104
120
|
);
|
|
@@ -107,20 +123,20 @@ L.displayName = "SelectTrigger";
|
|
|
107
123
|
function _({
|
|
108
124
|
className: t,
|
|
109
125
|
children: r,
|
|
110
|
-
position:
|
|
111
|
-
maxHeight:
|
|
126
|
+
position: o = "popper",
|
|
127
|
+
maxHeight: l,
|
|
112
128
|
style: i,
|
|
113
129
|
...p
|
|
114
130
|
}) {
|
|
115
131
|
R();
|
|
116
|
-
const
|
|
132
|
+
const c = m.useRef(null);
|
|
117
133
|
I(
|
|
118
|
-
() =>
|
|
134
|
+
() => c.current ? c.current.querySelectorAll('[data-slot="select-item"]').length >= 100 : !1,
|
|
119
135
|
`Select contains many items. For large lists (100+), consider using <Combobox> which supports search and filtering.
|
|
120
136
|
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
121
137
|
[r]
|
|
122
138
|
);
|
|
123
|
-
const
|
|
139
|
+
const s = n(
|
|
124
140
|
// Base appearance
|
|
125
141
|
"relative z-50 overflow-hidden",
|
|
126
142
|
"min-w-[8rem]",
|
|
@@ -131,32 +147,32 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
131
147
|
"origin-[var(--radix-select-content-transform-origin)]",
|
|
132
148
|
// Animations
|
|
133
149
|
C
|
|
134
|
-
),
|
|
150
|
+
), d = o === "popper" && n(
|
|
135
151
|
"data-[side=bottom]:translate-y-1",
|
|
136
152
|
"data-[side=left]:-translate-x-1",
|
|
137
153
|
"data-[side=right]:translate-x-1",
|
|
138
154
|
"data-[side=top]:-translate-y-1"
|
|
139
|
-
),
|
|
155
|
+
), u = l !== void 0 ? {
|
|
140
156
|
...i,
|
|
141
|
-
maxHeight: `min(${
|
|
157
|
+
maxHeight: `min(${l}px, var(--radix-select-content-available-height))`
|
|
142
158
|
} : i;
|
|
143
|
-
return /* @__PURE__ */ e(
|
|
144
|
-
|
|
159
|
+
return /* @__PURE__ */ e(a.Portal, { children: /* @__PURE__ */ v(
|
|
160
|
+
a.Content,
|
|
145
161
|
{
|
|
146
|
-
className:
|
|
162
|
+
className: n(s, d, t),
|
|
147
163
|
"data-slot": "select-content",
|
|
148
|
-
position:
|
|
149
|
-
style:
|
|
164
|
+
position: o,
|
|
165
|
+
style: u,
|
|
150
166
|
...p,
|
|
151
167
|
children: [
|
|
152
|
-
/* @__PURE__ */ e(
|
|
168
|
+
/* @__PURE__ */ e(S, {}),
|
|
153
169
|
/* @__PURE__ */ e(
|
|
154
|
-
|
|
170
|
+
a.Viewport,
|
|
155
171
|
{
|
|
156
|
-
ref:
|
|
157
|
-
className:
|
|
172
|
+
ref: c,
|
|
173
|
+
className: n(
|
|
158
174
|
"p-1",
|
|
159
|
-
|
|
175
|
+
o === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
160
176
|
),
|
|
161
177
|
children: r
|
|
162
178
|
}
|
|
@@ -172,9 +188,9 @@ function q({
|
|
|
172
188
|
...r
|
|
173
189
|
}) {
|
|
174
190
|
return /* @__PURE__ */ e(
|
|
175
|
-
|
|
191
|
+
a.Label,
|
|
176
192
|
{
|
|
177
|
-
className:
|
|
193
|
+
className: n(
|
|
178
194
|
"text-muted-foreground text-label-sm px-2 py-1.5",
|
|
179
195
|
t
|
|
180
196
|
),
|
|
@@ -184,8 +200,8 @@ function q({
|
|
|
184
200
|
);
|
|
185
201
|
}
|
|
186
202
|
q.displayName = "SelectLabel";
|
|
187
|
-
function D({ className: t, children: r, hint:
|
|
188
|
-
const i =
|
|
203
|
+
function D({ className: t, children: r, hint: o, ...l }) {
|
|
204
|
+
const i = n(
|
|
189
205
|
// Base layout
|
|
190
206
|
"relative flex w-full cursor-default select-none items-center gap-2",
|
|
191
207
|
"rounded py-1.5 pl-2 pr-8",
|
|
@@ -200,21 +216,21 @@ function D({ className: t, children: r, hint: n, ...s }) {
|
|
|
200
216
|
// Icon styles
|
|
201
217
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
202
218
|
);
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
|
|
219
|
+
return /* @__PURE__ */ v(
|
|
220
|
+
a.Item,
|
|
205
221
|
{
|
|
206
|
-
className:
|
|
222
|
+
className: n(i, t),
|
|
207
223
|
"data-slot": "select-item",
|
|
208
|
-
...
|
|
224
|
+
...l,
|
|
209
225
|
children: [
|
|
210
|
-
/* @__PURE__ */ e("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ e(
|
|
211
|
-
/* @__PURE__ */ e(
|
|
212
|
-
|
|
226
|
+
/* @__PURE__ */ e("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ e(a.ItemIndicator, { children: /* @__PURE__ */ e(N, {}) }) }),
|
|
227
|
+
/* @__PURE__ */ e(a.ItemText, { children: r }),
|
|
228
|
+
o != null && /* @__PURE__ */ e(
|
|
213
229
|
"span",
|
|
214
230
|
{
|
|
215
231
|
className: "text-label-sm text-muted-foreground ml-auto",
|
|
216
232
|
"data-slot": "select-item-hint",
|
|
217
|
-
children:
|
|
233
|
+
children: o
|
|
218
234
|
}
|
|
219
235
|
)
|
|
220
236
|
]
|
|
@@ -227,23 +243,23 @@ function E({
|
|
|
227
243
|
...r
|
|
228
244
|
}) {
|
|
229
245
|
return /* @__PURE__ */ e(
|
|
230
|
-
|
|
246
|
+
a.Separator,
|
|
231
247
|
{
|
|
232
|
-
className:
|
|
248
|
+
className: n("bg-border pointer-events-none -mx-1 my-1 h-px", t),
|
|
233
249
|
"data-slot": "select-separator",
|
|
234
250
|
...r
|
|
235
251
|
}
|
|
236
252
|
);
|
|
237
253
|
}
|
|
238
254
|
E.displayName = "SelectSeparator";
|
|
239
|
-
function
|
|
255
|
+
function S({
|
|
240
256
|
className: t,
|
|
241
257
|
...r
|
|
242
258
|
}) {
|
|
243
259
|
return /* @__PURE__ */ e(
|
|
244
|
-
|
|
260
|
+
a.ScrollUpButton,
|
|
245
261
|
{
|
|
246
|
-
className:
|
|
262
|
+
className: n(
|
|
247
263
|
"flex cursor-default items-center justify-center py-1",
|
|
248
264
|
t
|
|
249
265
|
),
|
|
@@ -253,21 +269,21 @@ function x({
|
|
|
253
269
|
}
|
|
254
270
|
);
|
|
255
271
|
}
|
|
256
|
-
|
|
272
|
+
S.displayName = "SelectScrollUpButton";
|
|
257
273
|
function y({
|
|
258
274
|
className: t,
|
|
259
275
|
...r
|
|
260
276
|
}) {
|
|
261
277
|
return /* @__PURE__ */ e(
|
|
262
|
-
|
|
278
|
+
a.ScrollDownButton,
|
|
263
279
|
{
|
|
264
|
-
className:
|
|
280
|
+
className: n(
|
|
265
281
|
"flex cursor-default items-center justify-center py-1",
|
|
266
282
|
t
|
|
267
283
|
),
|
|
268
284
|
"data-slot": "select-scroll-down-button",
|
|
269
285
|
...r,
|
|
270
|
-
children: /* @__PURE__ */ e(
|
|
286
|
+
children: /* @__PURE__ */ e(x, {})
|
|
271
287
|
}
|
|
272
288
|
);
|
|
273
289
|
}
|
|
@@ -279,7 +295,7 @@ export {
|
|
|
279
295
|
D as SelectItem,
|
|
280
296
|
q as SelectLabel,
|
|
281
297
|
y as SelectScrollDownButton,
|
|
282
|
-
|
|
298
|
+
S as SelectScrollUpButton,
|
|
283
299
|
E as SelectSeparator,
|
|
284
300
|
L as SelectTrigger,
|
|
285
301
|
j as SelectValue
|
package/dist/sheet.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 a=require("react/jsx-runtime"),I=require("react"),X=require("@radix-ui/react-dialog"),G=require("class-variance-authority"),w=require("@brightlocal/icons"),c=require("@brightlocal/ui-components/lib/utils"),k=require("@brightlocal/ui-components/button"),J=require("@brightlocal/ui-components/scroll-area"),Q=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function P(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const n=P(I),d=P(X),W=G.cva(["bg-background","data-[state=open]:animate-in","data-[state=closed]:animate-out","fixed","z-50","flex","flex-col","gap-4","p-6","shadow-lg","ease-out","data-[state=closed]:ease-in","data-[state=open]:duration-slow","data-[state=closed]:duration-250"],{variants:{side:{top:["data-[state=closed]:slide-out-to-top","data-[state=open]:slide-in-from-top","inset-x-0","top-0","h-auto","border-b"],right:["data-[state=closed]:slide-out-to-right","data-[state=open]:slide-in-from-right","inset-y-0","right-0","h-full","border-l"],bottom:["data-[state=closed]:slide-out-to-bottom","data-[state=open]:slide-in-from-bottom","inset-x-0","bottom-0","h-auto","border-t"],left:["data-[state=closed]:slide-out-to-left","data-[state=open]:slide-in-from-left","inset-y-0","left-0","h-full","border-r"]},size:{default:[],sm:[]}},compoundVariants:[{side:["left","right"],size:"default",className:["w-3/4","sm:max-w-sm"]},{side:["left","right"],size:"sm",className:["w-fit","min-w-(--ds-container-2xs)","max-w-(--ds-container-xs)"]}],defaultVariants:{side:"right",size:"default"}});function O({...e}){return a.jsx(d.Root,{"data-slot":"sheet",modal:!0,...e})}O.displayName="Sheet";const q=n.forwardRef(({dataHook:e,...t},s)=>a.jsx(d.Trigger,{ref:s,"data-slot":"sheet-trigger",...e!=null&&{"data-hook":e},...t}));q.displayName="SheetTrigger";const B=n.forwardRef(({...e},t)=>a.jsx(d.Close,{ref:t,"data-slot":"sheet-close",...e}));B.displayName="SheetClose";function R({...e}){return a.jsx(d.Portal,{"data-slot":"sheet-portal",...e})}R.displayName="SheetPortal";const C=n.forwardRef(({className:e,...t},s)=>a.jsx(d.Overlay,{ref:s,className:c.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),"data-slot":"sheet-overlay",...t}));C.displayName="SheetOverlay";const z=n.forwardRef(({className:e,children:t,side:s,size:r,dataHook:l,trackingEl:u,trackingLabel:S,closeLabel:h,...b},j)=>(Q.useOverlayPointerLock(),a.jsxs(R,{children:[a.jsx(C,{}),a.jsxs(d.Content,{ref:j,className:c.cn(W({side:s,size:r}),e),"data-hook":l,"data-slot":"sheet-content","data-tracking-el":u,"data-tracking-label":S,...b,children:[t,a.jsx(d.Close,{asChild:!0,children:a.jsxs(k.Button,{iconOnly:!0,className:"absolute top-6 right-4",dataHook:"sheet-close",variant:"ghost",children:[a.jsx(w.X,{}),a.jsx("span",{className:"sr-only",children:h??"Close"})]})})]})]})));z.displayName="SheetContent";const A=n.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:c.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"sheet-header",...t}));A.displayName="SheetHeader";const _=n.forwardRef(({className:e,onPrevious:t,onNext:s,current:r,total:l,hasPrevious:u,hasNext:S,renderPosition:h,ariaLabel:b,prevAriaLabel:j,nextAriaLabel:F,dataHook:N,trackingEl:K,trackingLabel:E,...M},U)=>{const m=u??(r==null||r>1),p=S??(r==null||l==null||r<l),g=n.useRef(null),x=n.useRef(null),f=n.useRef(null);n.useEffect(()=>{const o=f.current;if(f.current=null,!o)return;const i=document.activeElement;i!==o&&i!==document.body||(!m&&o===g.current&&p?x.current?.focus():!p&&o===x.current&&m&&g.current?.focus())});const D=o=>{const i=o.relatedTarget;i&&i!==g.current&&i!==x.current&&(f.current=null)},y=(o,i)=>{if(o==="previous"){if(!m)return;f.current=i,t()}else{if(!p)return;f.current=i,s()}},T=o=>{o.key==="ArrowUp"||o.key==="ArrowLeft"?(o.preventDefault(),y("previous",o.currentTarget)):(o.key==="ArrowDown"||o.key==="ArrowRight")&&(o.preventDefault(),y("next",o.currentTarget))};let v=null;return h!==null&&r!=null&&l!=null&&(v=h?h({current:r,total:l}):`${r} of ${l}`),a.jsxs("div",{ref:U,"aria-label":b??"Item navigation",className:c.cn("mb-2 flex items-center gap-1",e),"data-hook":N,"data-slot":"sheet-pagination","data-tracking-el":K,"data-tracking-label":E,role:"group",...M,children:[a.jsx(k.Button,{ref:g,ariaLabel:j??"Previous item",dataHook:`${N}-previous`,disabled:!m,variant:"ghost",onBlur:D,onClick:o=>y("previous",o.currentTarget),onKeyDown:T,children:a.jsx(w.ChevronUp,{})}),a.jsx(k.Button,{ref:x,ariaLabel:F??"Next item",dataHook:`${N}-next`,disabled:!p,variant:"ghost",onBlur:D,onClick:o=>y("next",o.currentTarget),onKeyDown:T,children:a.jsx(w.ChevronDown,{})}),v!=null&&a.jsx("span",{"aria-live":"polite",className:"text-body-sm text-muted-foreground","data-slot":"sheet-pagination-position",children:v})]})});_.displayName="SheetPagination";const L=n.forwardRef(({className:e,children:t,dataHook:s,...r},l)=>a.jsx(J.ScrollArea,{ref:l,className:c.cn("-mx-6 min-h-0 flex-1",e),"data-slot":"sheet-body",dataHook:s??"sheet-body",...r,children:a.jsx("div",{className:"px-5","data-slot":"sheet-body-content",children:t})}));L.displayName="SheetBody";const H=n.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:c.cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",e),"data-slot":"sheet-footer",...t}));H.displayName="SheetFooter";const V=n.forwardRef(({className:e,icon:t,children:s,dataHook:r,...l},u)=>a.jsxs(d.Title,{ref:u,className:c.cn("text-foreground text-heading-section",t&&"flex items-center gap-2",e),"data-hook":r,"data-slot":"sheet-title",...l,children:[t&&a.jsx("span",{className:"shrink-0 [&_svg]:size-5","data-slot":"sheet-title-icon",children:t}),s]}));V.displayName="SheetTitle";const $=n.forwardRef(({className:e,dataHook:t,...s},r)=>a.jsx(d.Description,{ref:r,className:c.cn("text-body-sm text-muted-foreground",e),"data-hook":t,"data-slot":"sheet-description",...s}));$.displayName="SheetDescription";exports.Sheet=O;exports.SheetBody=L;exports.SheetClose=B;exports.SheetContent=z;exports.SheetDescription=$;exports.SheetFooter=H;exports.SheetHeader=A;exports.SheetOverlay=C;exports.SheetPagination=_;exports.SheetPortal=R;exports.SheetTitle=V;exports.SheetTrigger=q;
|
package/dist/sheet.d.ts
CHANGED
|
@@ -105,6 +105,82 @@ declare const SheetContent: React.ForwardRefExoticComponent<Omit<SheetContentPro
|
|
|
105
105
|
* Centers text on mobile, left-aligns on larger screens.
|
|
106
106
|
*/
|
|
107
107
|
declare const SheetHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
/**
|
|
109
|
+
* Numbers a `SheetPagination` position indicator is built from.
|
|
110
|
+
*/
|
|
111
|
+
interface SheetPaginationPositionInfo {
|
|
112
|
+
/** 1-based position of the item shown in the sheet. */
|
|
113
|
+
current: number;
|
|
114
|
+
/** Total number of items in the list being stepped through. */
|
|
115
|
+
total: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Props for the SheetPagination component
|
|
119
|
+
*/
|
|
120
|
+
interface SheetPaginationProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
121
|
+
/** Called when the user steps to the previous item. */
|
|
122
|
+
onPrevious: () => void;
|
|
123
|
+
/** Called when the user steps to the next item. */
|
|
124
|
+
onNext: () => void;
|
|
125
|
+
/**
|
|
126
|
+
* 1-based position of the item shown in the sheet. Together with `total`,
|
|
127
|
+
* drives the position indicator and the default boundary state.
|
|
128
|
+
*/
|
|
129
|
+
current?: number;
|
|
130
|
+
/** Total number of items in the list being stepped through. */
|
|
131
|
+
total?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Whether a previous item exists. Disables the previous button when false.
|
|
134
|
+
* @default current > 1 (true when `current` is not set)
|
|
135
|
+
*/
|
|
136
|
+
hasPrevious?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Whether a next item exists. Disables the next button when false.
|
|
139
|
+
* @default current < total (true when either is not set)
|
|
140
|
+
*/
|
|
141
|
+
hasNext?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Render the position indicator. Receives the current position and total;
|
|
144
|
+
* you own the wording. Return `null` to hide it.
|
|
145
|
+
* @default Renders "{current} of {total}", or nothing when either is unset.
|
|
146
|
+
*/
|
|
147
|
+
renderPosition?: ((info: SheetPaginationPositionInfo) => React.ReactNode) | null;
|
|
148
|
+
/**
|
|
149
|
+
* Accessible label for the item navigation group.
|
|
150
|
+
* @default "Item navigation"
|
|
151
|
+
*/
|
|
152
|
+
ariaLabel?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Accessible label for the previous button.
|
|
155
|
+
* @default "Previous item"
|
|
156
|
+
*/
|
|
157
|
+
prevAriaLabel?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Accessible label for the next button.
|
|
160
|
+
* @default "Next item"
|
|
161
|
+
*/
|
|
162
|
+
nextAriaLabel?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Data hook for automated testing. The buttons get `{dataHook}-previous`
|
|
165
|
+
* and `{dataHook}-next`.
|
|
166
|
+
*/
|
|
167
|
+
dataHook: string;
|
|
168
|
+
/**
|
|
169
|
+
* Tracking element identifier for analytics
|
|
170
|
+
*/
|
|
171
|
+
trackingEl?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Tracking label for analytics context
|
|
174
|
+
*/
|
|
175
|
+
trackingLabel?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Previous/next controls for stepping through a list of items without
|
|
179
|
+
* closing the sheet — e.g. a detail sheet drilled into from a table row.
|
|
180
|
+
* Place it as the first child of SheetContent, above SheetHeader; it shares
|
|
181
|
+
* the close button's row. The arrow keys step while focus is on the controls.
|
|
182
|
+
*/
|
|
183
|
+
declare const SheetPagination: React.ForwardRefExoticComponent<Omit<SheetPaginationProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
108
184
|
/**
|
|
109
185
|
* Props for the SheetBody component
|
|
110
186
|
*/
|
|
@@ -163,6 +239,6 @@ interface SheetDescriptionProps extends React.ComponentProps<typeof SheetPrimiti
|
|
|
163
239
|
* Should be used within SheetHeader below SheetTitle.
|
|
164
240
|
*/
|
|
165
241
|
declare const SheetDescription: React.ForwardRefExoticComponent<Omit<SheetDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
166
|
-
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, };
|
|
167
|
-
export type { SheetBodyProps, SheetContentProps, SheetDescriptionProps, SheetTitleProps, SheetTriggerProps, };
|
|
242
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPagination, SheetPortal, SheetTitle, SheetTrigger, };
|
|
243
|
+
export type { SheetBodyProps, SheetContentProps, SheetDescriptionProps, SheetPaginationPositionInfo, SheetPaginationProps, SheetTitleProps, SheetTriggerProps, };
|
|
168
244
|
//# sourceMappingURL=sheet.d.ts.map
|
package/dist/sheet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/components/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/components/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAGpE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;AAEzC,QAAA,MAAM,oBAAoB;;;8EAwFzB,CAAC;AAEF;;;GAGG;AACH,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,2CAE5E;kBAFQ,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