@brightlocal/ui-components 2.18.0 → 2.20.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 +1 -1
- package/component-meta.json +11 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +34 -33
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +20 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +423 -390
- package/dist/browser-entry.d.ts +2 -0
- package/dist/browser-entry.d.ts.map +1 -1
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +47 -46
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +35 -34
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +48 -47
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +44 -42
- package/dist/hooks/use-overlay-pointer-lock.cjs +1 -0
- package/dist/hooks/use-overlay-pointer-lock.d.ts +20 -0
- package/dist/hooks/use-overlay-pointer-lock.d.ts.map +1 -0
- package/dist/hooks/use-overlay-pointer-lock.js +39 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -86
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +44 -37
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +21 -20
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +25 -23
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +14 -0
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +90 -44
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +29 -28
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts +15 -13
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +84 -85
- package/package.json +3 -3
- package/src/blocks/sidebar.tsx +81 -14
- package/src/browser-entry.ts +10 -0
- package/src/components/alert-dialog.tsx +20 -14
- package/src/components/context-menu.tsx +19 -13
- package/src/components/dialog.tsx +4 -0
- package/src/components/dropdown-menu.tsx +4 -0
- package/src/components/global-layout.tsx +3 -1
- package/src/components/logo.tsx +19 -25
- package/src/components/popover.tsx +22 -16
- package/src/components/select.tsx +4 -0
- package/src/components/separator.tsx +91 -23
- package/src/components/sheet.tsx +4 -0
- package/src/components/stepper.tsx +93 -80
- package/src/hooks/use-overlay-pointer-lock.ts +128 -0
- package/src/index.ts +1 -0
package/dist/stepper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as S, Fragment as z } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
3
|
import { Slot as D } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva as P } from "class-variance-authority";
|
|
@@ -22,61 +22,60 @@ function N() {
|
|
|
22
22
|
);
|
|
23
23
|
return t;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(x)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const V = o.forwardRef(
|
|
25
|
+
function M({
|
|
26
|
+
className: t,
|
|
27
|
+
dataHook: a,
|
|
28
|
+
steps: e,
|
|
29
|
+
value: p,
|
|
30
|
+
defaultValue: i,
|
|
31
|
+
onValueChange: c,
|
|
32
|
+
orientation: n = "horizontal",
|
|
33
|
+
labelPlacement: g = "below",
|
|
34
|
+
ariaLabel: f,
|
|
35
|
+
trackingEl: l,
|
|
36
|
+
trackingLabel: u,
|
|
37
|
+
...s
|
|
38
|
+
}, m) {
|
|
39
|
+
const h = n === "vertical" ? "vertical" : g === "inline" ? "horizontal-inline" : "horizontal-below", y = p !== void 0, [b, v] = o.useState(
|
|
40
|
+
i ?? e[0]?.id ?? ""
|
|
41
|
+
), w = y ? p : b, I = e.findIndex((x) => x.id === w), k = o.useCallback(
|
|
42
|
+
(x) => {
|
|
43
|
+
y || v(x), c?.(x);
|
|
44
|
+
},
|
|
45
|
+
[y, c]
|
|
46
|
+
), E = o.useMemo(
|
|
47
|
+
() => ({
|
|
48
|
+
activeId: w,
|
|
49
|
+
activeIndex: I,
|
|
50
|
+
setActiveStep: k,
|
|
51
|
+
steps: e,
|
|
52
|
+
orientation: n
|
|
53
|
+
}),
|
|
54
|
+
[w, I, k, e, n]
|
|
55
|
+
);
|
|
56
|
+
return /* @__PURE__ */ r(C.Provider, { value: E, children: /* @__PURE__ */ r(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
ref: m,
|
|
60
|
+
"aria-label": f ?? "Progress",
|
|
61
|
+
className: d(
|
|
62
|
+
"group/stepper flex data-[orientation=vertical]:flex-col",
|
|
63
|
+
t
|
|
64
|
+
),
|
|
65
|
+
"data-hook": a,
|
|
66
|
+
"data-layout": h,
|
|
67
|
+
"data-orientation": n,
|
|
68
|
+
"data-slot": "stepper",
|
|
69
|
+
"data-tracking-el": l,
|
|
70
|
+
"data-tracking-label": u,
|
|
71
|
+
role: "group",
|
|
72
|
+
...s
|
|
73
|
+
}
|
|
74
|
+
) });
|
|
75
|
+
}
|
|
76
|
+
const V = o.forwardRef(M);
|
|
77
|
+
V.displayName = "Stepper";
|
|
78
|
+
const F = o.forwardRef(
|
|
80
79
|
({ className: t, dataHook: a, ...e }, p) => /* @__PURE__ */ r(
|
|
81
80
|
"ol",
|
|
82
81
|
{
|
|
@@ -95,8 +94,8 @@ const V = o.forwardRef(
|
|
|
95
94
|
}
|
|
96
95
|
)
|
|
97
96
|
);
|
|
98
|
-
|
|
99
|
-
const
|
|
97
|
+
F.displayName = "StepperNav";
|
|
98
|
+
const X = o.forwardRef(
|
|
100
99
|
({
|
|
101
100
|
className: t,
|
|
102
101
|
stepId: a,
|
|
@@ -152,8 +151,8 @@ const F = o.forwardRef(
|
|
|
152
151
|
) });
|
|
153
152
|
}
|
|
154
153
|
);
|
|
155
|
-
|
|
156
|
-
const
|
|
154
|
+
X.displayName = "StepperItem";
|
|
155
|
+
const $ = o.forwardRef(
|
|
157
156
|
({ asChild: t = !1, className: a, dataHook: e, ...p }, i) => {
|
|
158
157
|
const { setActiveStep: c } = R(), { stepId: n, state: g, isDisabled: f } = N();
|
|
159
158
|
return /* @__PURE__ */ r(
|
|
@@ -189,8 +188,8 @@ const X = o.forwardRef(
|
|
|
189
188
|
);
|
|
190
189
|
}
|
|
191
190
|
);
|
|
192
|
-
|
|
193
|
-
const
|
|
191
|
+
$.displayName = "StepperTrigger";
|
|
192
|
+
const q = P(
|
|
194
193
|
[
|
|
195
194
|
"relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
|
196
195
|
"transition-colors duration-200 ease-out",
|
|
@@ -218,7 +217,7 @@ const $ = P(
|
|
|
218
217
|
state: "inactive"
|
|
219
218
|
}
|
|
220
219
|
}
|
|
221
|
-
),
|
|
220
|
+
), B = o.forwardRef(
|
|
222
221
|
({
|
|
223
222
|
asChild: t = !1,
|
|
224
223
|
className: a,
|
|
@@ -229,7 +228,7 @@ const $ = P(
|
|
|
229
228
|
dataHook: n,
|
|
230
229
|
...g
|
|
231
230
|
}, f) => {
|
|
232
|
-
const { state: l, index: u, isLoading: s } = N(), m = /* @__PURE__ */ z
|
|
231
|
+
const { state: l, index: u, isLoading: s } = N(), m = /* @__PURE__ */ S(z, { children: [
|
|
233
232
|
l === "completed" && /* @__PURE__ */ r("span", { className: "sr-only", children: p }),
|
|
234
233
|
l === "error" && /* @__PURE__ */ r("span", { className: "sr-only", children: i }),
|
|
235
234
|
s && /* @__PURE__ */ r("span", { className: "sr-only", children: c })
|
|
@@ -238,15 +237,15 @@ const $ = P(
|
|
|
238
237
|
"span",
|
|
239
238
|
{
|
|
240
239
|
ref: f,
|
|
241
|
-
className: d(
|
|
240
|
+
className: d(q({ state: l }), a),
|
|
242
241
|
"data-hook": n,
|
|
243
242
|
"data-slot": "stepper-indicator",
|
|
244
243
|
"data-state": l,
|
|
245
244
|
...g,
|
|
246
|
-
children: t ? /* @__PURE__ */ z
|
|
245
|
+
children: t ? /* @__PURE__ */ S(z, { children: [
|
|
247
246
|
e,
|
|
248
247
|
m
|
|
249
|
-
] }) : /* @__PURE__ */ z
|
|
248
|
+
] }) : /* @__PURE__ */ S(z, { children: [
|
|
250
249
|
/* @__PURE__ */ r(
|
|
251
250
|
"span",
|
|
252
251
|
{
|
|
@@ -266,8 +265,8 @@ const $ = P(
|
|
|
266
265
|
);
|
|
267
266
|
}
|
|
268
267
|
);
|
|
269
|
-
|
|
270
|
-
const
|
|
268
|
+
B.displayName = "StepperIndicator";
|
|
269
|
+
const G = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
|
|
271
270
|
const { isLast: i } = N();
|
|
272
271
|
return i ? null : /* @__PURE__ */ r(
|
|
273
272
|
"div",
|
|
@@ -296,8 +295,8 @@ const B = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
|
|
|
296
295
|
}
|
|
297
296
|
);
|
|
298
297
|
});
|
|
299
|
-
|
|
300
|
-
const
|
|
298
|
+
G.displayName = "StepperSeparator";
|
|
299
|
+
const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
301
300
|
"span",
|
|
302
301
|
{
|
|
303
302
|
ref: e,
|
|
@@ -312,8 +311,8 @@ const G = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
|
312
311
|
...a
|
|
313
312
|
}
|
|
314
313
|
));
|
|
315
|
-
|
|
316
|
-
const
|
|
314
|
+
H.displayName = "StepperContent";
|
|
315
|
+
const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
317
316
|
"span",
|
|
318
317
|
{
|
|
319
318
|
ref: e,
|
|
@@ -327,8 +326,8 @@ const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
|
327
326
|
...a
|
|
328
327
|
}
|
|
329
328
|
));
|
|
330
|
-
|
|
331
|
-
const
|
|
329
|
+
J.displayName = "StepperTitle";
|
|
330
|
+
const K = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
332
331
|
"span",
|
|
333
332
|
{
|
|
334
333
|
ref: e,
|
|
@@ -337,15 +336,15 @@ const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
|
|
|
337
336
|
...a
|
|
338
337
|
}
|
|
339
338
|
));
|
|
340
|
-
|
|
339
|
+
K.displayName = "StepperDescription";
|
|
341
340
|
export {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
341
|
+
V as Stepper,
|
|
342
|
+
H as StepperContent,
|
|
343
|
+
K as StepperDescription,
|
|
344
|
+
B as StepperIndicator,
|
|
345
|
+
X as StepperItem,
|
|
346
|
+
F as StepperNav,
|
|
347
|
+
G as StepperSeparator,
|
|
348
|
+
J as StepperTitle,
|
|
349
|
+
$ as StepperTrigger
|
|
351
350
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
"vite-bundle-visualizer": "^1.2.1",
|
|
141
141
|
"vite-plugin-dts": "^4.5.4",
|
|
142
142
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
143
|
-
"@workspace/
|
|
144
|
-
"@workspace/
|
|
143
|
+
"@workspace/typescript-config": "0.0.0",
|
|
144
|
+
"@workspace/eslint-config": "0.0.0"
|
|
145
145
|
},
|
|
146
146
|
"publishConfig": {
|
|
147
147
|
"access": "public",
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
5
6
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
7
|
import {
|
|
@@ -189,6 +190,8 @@ type SidebarContext = {
|
|
|
189
190
|
setOpenMobile: (open: boolean) => void;
|
|
190
191
|
isMobile: boolean;
|
|
191
192
|
toggleSidebar: () => void;
|
|
193
|
+
footerPortalEl: HTMLDivElement | null;
|
|
194
|
+
setFooterPortalEl: (el: HTMLDivElement | null) => void;
|
|
192
195
|
};
|
|
193
196
|
|
|
194
197
|
const SidebarContext = React.createContext<SidebarContext | null>(null);
|
|
@@ -253,6 +256,8 @@ const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(
|
|
|
253
256
|
) => {
|
|
254
257
|
const isMobile = useIsBelowBreakpoint("lg");
|
|
255
258
|
const [openMobile, setOpenMobile] = React.useState(false);
|
|
259
|
+
const [footerPortalEl, setFooterPortalEl] =
|
|
260
|
+
React.useState<HTMLDivElement | null>(null);
|
|
256
261
|
|
|
257
262
|
// Internal state for uncontrolled usage
|
|
258
263
|
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
@@ -307,8 +312,19 @@ const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(
|
|
|
307
312
|
openMobile,
|
|
308
313
|
setOpenMobile,
|
|
309
314
|
toggleSidebar,
|
|
315
|
+
footerPortalEl,
|
|
316
|
+
setFooterPortalEl,
|
|
310
317
|
}),
|
|
311
|
-
[
|
|
318
|
+
[
|
|
319
|
+
state,
|
|
320
|
+
open,
|
|
321
|
+
setOpen,
|
|
322
|
+
isMobile,
|
|
323
|
+
openMobile,
|
|
324
|
+
setOpenMobile,
|
|
325
|
+
toggleSidebar,
|
|
326
|
+
footerPortalEl,
|
|
327
|
+
]
|
|
312
328
|
);
|
|
313
329
|
|
|
314
330
|
return (
|
|
@@ -669,7 +685,7 @@ const SidebarHeader = React.forwardRef<HTMLElement, SidebarHeaderProps>(
|
|
|
669
685
|
<header
|
|
670
686
|
ref={ref}
|
|
671
687
|
className={cn(
|
|
672
|
-
"pr-section-xs flex flex-col gap-2 pt-2 pb-9 pl-8",
|
|
688
|
+
"pr-section-xs flex shrink-0 flex-col gap-2 pt-2 pb-9 pl-8",
|
|
673
689
|
className
|
|
674
690
|
)}
|
|
675
691
|
data-hook={dataHook}
|
|
@@ -687,28 +703,63 @@ SidebarHeader.displayName = "SidebarHeader";
|
|
|
687
703
|
interface SidebarFooterProps extends React.ComponentProps<"footer"> {
|
|
688
704
|
/** Data hook for automated testing */
|
|
689
705
|
dataHook?: string;
|
|
706
|
+
/**
|
|
707
|
+
* Whether to render a separator at the top of the footer.
|
|
708
|
+
* @default true
|
|
709
|
+
*/
|
|
710
|
+
separator?: boolean;
|
|
690
711
|
}
|
|
691
712
|
|
|
692
713
|
const SidebarFooter = React.forwardRef<HTMLElement, SidebarFooterProps>(
|
|
693
|
-
({ className, dataHook, ...props }, ref) => {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
714
|
+
({ className, dataHook, separator = true, ...props }, ref) => {
|
|
715
|
+
const { footerPortalEl } = useSidebar();
|
|
716
|
+
|
|
717
|
+
const footer = (
|
|
718
|
+
<>
|
|
719
|
+
{separator && (
|
|
720
|
+
<Separator
|
|
721
|
+
className="group-data-[collapsible=icon]:mx-0"
|
|
722
|
+
data-slot="sidebar-footer-separator"
|
|
723
|
+
spacing="md"
|
|
724
|
+
/>
|
|
725
|
+
)}
|
|
726
|
+
<footer
|
|
727
|
+
ref={ref}
|
|
728
|
+
className={cn("flex shrink-0 flex-col gap-1 p-1", className)}
|
|
729
|
+
data-hook={dataHook}
|
|
730
|
+
data-slot="sidebar-footer"
|
|
731
|
+
{...props}
|
|
732
|
+
/>
|
|
733
|
+
</>
|
|
702
734
|
);
|
|
735
|
+
|
|
736
|
+
if (footerPortalEl) {
|
|
737
|
+
return createPortal(footer, footerPortalEl);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return footer;
|
|
703
741
|
}
|
|
704
742
|
);
|
|
705
743
|
SidebarFooter.displayName = "SidebarFooter";
|
|
706
744
|
|
|
707
745
|
/**
|
|
708
746
|
* Props for the SidebarSeparator component
|
|
747
|
+
* @deprecated Use `Separator` from `@brightlocal/ui-components/separator` with `spacing="md"` instead. SidebarSeparator will be removed in the next major version.
|
|
709
748
|
*/
|
|
710
749
|
type SidebarSeparatorProps = React.ComponentProps<typeof Separator>;
|
|
711
750
|
|
|
751
|
+
/**
|
|
752
|
+
* @deprecated Use `Separator` from `@brightlocal/ui-components/separator` with `spacing="md"` instead.
|
|
753
|
+
*
|
|
754
|
+
* ```tsx
|
|
755
|
+
* // Before
|
|
756
|
+
* <SidebarSeparator />
|
|
757
|
+
*
|
|
758
|
+
* // After
|
|
759
|
+
* import { Separator } from "@brightlocal/ui-components/separator";
|
|
760
|
+
* <Separator spacing="md" dataHook="sidebar-separator" />
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
712
763
|
const SidebarSeparator = React.forwardRef<
|
|
713
764
|
React.ComponentRef<typeof Separator>,
|
|
714
765
|
SidebarSeparatorProps
|
|
@@ -741,13 +792,16 @@ interface SidebarContentProps extends Omit<React.ComponentProps<"div">, "dir"> {
|
|
|
741
792
|
|
|
742
793
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
743
794
|
({ className, dataHook, ariaLabel = "Sidebar", children, ...props }, ref) => {
|
|
744
|
-
const { isMobile } = useSidebar();
|
|
795
|
+
const { isMobile, setFooterPortalEl } = useSidebar();
|
|
796
|
+
const viewportRef = React.useRef<HTMLElement | null>(null);
|
|
797
|
+
const [hasOverflow, setHasOverflow] = React.useState(false);
|
|
745
798
|
|
|
746
799
|
const scrollAreaRef = React.useCallback(
|
|
747
800
|
(node: HTMLDivElement | null) => {
|
|
748
801
|
const viewport = node?.querySelector<HTMLElement>(
|
|
749
802
|
'[data-slot="scroll-area-viewport"]'
|
|
750
803
|
);
|
|
804
|
+
viewportRef.current = viewport ?? null;
|
|
751
805
|
if (viewport) viewport.tabIndex = -1;
|
|
752
806
|
if (typeof ref === "function") ref(node);
|
|
753
807
|
else if (ref) ref.current = node;
|
|
@@ -755,11 +809,23 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
755
809
|
[ref]
|
|
756
810
|
);
|
|
757
811
|
|
|
812
|
+
React.useEffect(() => {
|
|
813
|
+
const vp = viewportRef.current;
|
|
814
|
+
if (!vp) return;
|
|
815
|
+
|
|
816
|
+
const check = () => setHasOverflow(vp.scrollHeight > vp.clientHeight);
|
|
817
|
+
const ro = new ResizeObserver(check);
|
|
818
|
+
ro.observe(vp);
|
|
819
|
+
if (vp.firstElementChild) ro.observe(vp.firstElementChild);
|
|
820
|
+
|
|
821
|
+
return () => ro.disconnect();
|
|
822
|
+
}, []);
|
|
823
|
+
|
|
758
824
|
return (
|
|
759
825
|
<ScrollArea
|
|
760
826
|
ref={scrollAreaRef}
|
|
761
827
|
className={cn(
|
|
762
|
-
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&_[data-slot=scroll-area-viewport]>div]:
|
|
828
|
+
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden **:data-[slot=scroll-area-scrollbar]:w-1.5 **:data-[slot=scroll-area-scrollbar]:border-l-0 **:data-[slot=scroll-area-scrollbar]:p-0 [&_[data-slot=scroll-area-viewport]>div]:flex! [&_[data-slot=scroll-area-viewport]>div]:min-h-full [&_[data-slot=scroll-area-viewport]>div]:flex-col",
|
|
763
829
|
className
|
|
764
830
|
)}
|
|
765
831
|
dataHook={dataHook ?? "sidebar-content-scroll"}
|
|
@@ -768,11 +834,12 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
768
834
|
>
|
|
769
835
|
<nav
|
|
770
836
|
aria-label={ariaLabel}
|
|
771
|
-
className="flex flex-col gap-2"
|
|
837
|
+
className={cn("flex flex-col gap-2", hasOverflow && "pr-2")}
|
|
772
838
|
data-slot="sidebar-content"
|
|
773
839
|
>
|
|
774
840
|
{children}
|
|
775
841
|
</nav>
|
|
842
|
+
<div ref={setFooterPortalEl} className="mt-auto" />
|
|
776
843
|
</ScrollArea>
|
|
777
844
|
);
|
|
778
845
|
}
|
package/src/browser-entry.ts
CHANGED
|
@@ -21,6 +21,16 @@ export const useReducer = React.useReducer;
|
|
|
21
21
|
export const useLayoutEffect = React.useLayoutEffect;
|
|
22
22
|
export const Fragment = React.Fragment;
|
|
23
23
|
|
|
24
|
+
// --- Build metadata ---
|
|
25
|
+
// Injected by vite.config.browser.ts at build time. Lets consumers read
|
|
26
|
+
// window.BrightLocalDS.version to verify which release a bundle was built from.
|
|
27
|
+
declare const __DS_VERSION__: string;
|
|
28
|
+
declare const __DS_BUILD_TIME__: string;
|
|
29
|
+
export const version =
|
|
30
|
+
typeof __DS_VERSION__ === "string" ? __DS_VERSION__ : "0.0.0-dev";
|
|
31
|
+
export const buildTime =
|
|
32
|
+
typeof __DS_BUILD_TIME__ === "string" ? __DS_BUILD_TIME__ : "";
|
|
33
|
+
|
|
24
34
|
// --- Mount API for IIFE consumers ---
|
|
25
35
|
|
|
26
36
|
const roots = new WeakMap<HTMLElement, Root>();
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
7
8
|
import { ButtonVariants } from "@brightlocal/ui-components/button";
|
|
8
9
|
|
|
9
10
|
interface AlertDialogProps extends React.ComponentProps<
|
|
@@ -83,20 +84,25 @@ AlertDialogOverlay.displayName = "AlertDialogOverlay";
|
|
|
83
84
|
const AlertDialogContent = React.forwardRef<
|
|
84
85
|
React.ComponentRef<typeof AlertDialogPrimitive.Content>,
|
|
85
86
|
React.ComponentProps<typeof AlertDialogPrimitive.Content>
|
|
86
|
-
>(({ className, ...props }, ref) =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
>(({ className, ...props }, ref) => {
|
|
88
|
+
// Safety net for the Radix dismissable-layer body-lock leak (DS-634).
|
|
89
|
+
useOverlayPointerLock();
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<AlertDialogPortal>
|
|
93
|
+
<AlertDialogOverlay />
|
|
94
|
+
<AlertDialogPrimitive.Content
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
"border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
data-slot="alert-dialog-content"
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
</AlertDialogPortal>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
100
106
|
|
|
101
107
|
AlertDialogContent.displayName = "AlertDialogContent";
|
|
102
108
|
|
|
@@ -4,6 +4,7 @@ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
|
4
4
|
import { Check, ChevronRight, Circle } from "@brightlocal/icons";
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Props for the ContextMenu component
|
|
@@ -220,19 +221,24 @@ export type ContextMenuContentProps = React.ComponentPropsWithoutRef<
|
|
|
220
221
|
const ContextMenuContent = React.forwardRef<
|
|
221
222
|
React.ComponentRef<typeof ContextMenuPrimitive.Content>,
|
|
222
223
|
ContextMenuContentProps
|
|
223
|
-
>(({ className, ...props }, ref) =>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
224
|
+
>(({ className, ...props }, ref) => {
|
|
225
|
+
// Safety net for the Radix dismissable-layer body-lock leak (DS-634).
|
|
226
|
+
useOverlayPointerLock();
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<ContextMenuPrimitive.Portal>
|
|
230
|
+
<ContextMenuPrimitive.Content
|
|
231
|
+
ref={ref}
|
|
232
|
+
className={cn(
|
|
233
|
+
"border-border bg-popover text-popover-foreground animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md",
|
|
234
|
+
className
|
|
235
|
+
)}
|
|
236
|
+
data-slot="context-menu-content"
|
|
237
|
+
{...props}
|
|
238
|
+
/>
|
|
239
|
+
</ContextMenuPrimitive.Portal>
|
|
240
|
+
);
|
|
241
|
+
});
|
|
236
242
|
ContextMenuContent.displayName = "ContextMenuContent";
|
|
237
243
|
|
|
238
244
|
/**
|
|
@@ -5,6 +5,7 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
|
5
5
|
import { X } from "@brightlocal/icons";
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
+
import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Dialog - Root component for modal dialogs
|
|
@@ -127,6 +128,9 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
127
128
|
},
|
|
128
129
|
ref
|
|
129
130
|
) => {
|
|
131
|
+
// Safety net for the Radix dismissable-layer body-lock leak (DS-634).
|
|
132
|
+
useOverlayPointerLock();
|
|
133
|
+
|
|
130
134
|
return (
|
|
131
135
|
<DialogPortal>
|
|
132
136
|
<DialogOverlay />
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "@brightlocal/icons";
|
|
11
11
|
|
|
12
12
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
13
|
+
import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Root component for dropdown menu (context provider, does not render to DOM)
|
|
@@ -108,6 +109,9 @@ const DropdownMenuContent = React.forwardRef<
|
|
|
108
109
|
},
|
|
109
110
|
ref
|
|
110
111
|
) => {
|
|
112
|
+
// Safety net for the Radix dismissable-layer body-lock leak (DS-634).
|
|
113
|
+
useOverlayPointerLock();
|
|
114
|
+
|
|
111
115
|
return (
|
|
112
116
|
<DropdownMenuPrimitive.Portal>
|
|
113
117
|
<DropdownMenuPrimitive.Content
|
|
@@ -101,11 +101,13 @@ const GlobalLayoutSidebar = React.forwardRef<
|
|
|
101
101
|
)}
|
|
102
102
|
data-hook={dataHook}
|
|
103
103
|
data-slot="sidebar-container"
|
|
104
|
+
{...props}
|
|
104
105
|
style={{
|
|
105
106
|
width: widthStyle,
|
|
106
107
|
top: "var(--ds-section-padding-y-sm)",
|
|
108
|
+
height: "calc(100dvh - 2 * var(--ds-section-padding-y-sm))",
|
|
109
|
+
...props.style,
|
|
107
110
|
}}
|
|
108
|
-
{...props}
|
|
109
111
|
>
|
|
110
112
|
{children}
|
|
111
113
|
</aside>
|