@vvedantb/ui 0.50.1 → 0.50.2
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/dist/shell/src/SidebarChrome.js +27 -21
- package/package.json +1 -1
- package/shell/src/SidebarChrome.tsx +58 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { createContext, useContext, useEffect, useId } from "react";
|
|
3
|
-
import { AnimatePresence,
|
|
3
|
+
import { AnimatePresence, domMax, LazyMotion, m } from "motion/react";
|
|
4
4
|
import { IconMenu2 } from "@tabler/icons-react";
|
|
5
5
|
import { Button } from "../../src/ui/button.js";
|
|
6
6
|
import { motionEase, motionTiming } from "../../src/motion/presets.js";
|
|
@@ -410,7 +410,7 @@ function Backdrop(t0) {
|
|
|
410
410
|
const sidebar = useSidebar("Backdrop");
|
|
411
411
|
let t2;
|
|
412
412
|
if ($[5] !== className || $[6] !== label || $[7] !== onClick || $[8] !== props || $[9] !== sidebar) {
|
|
413
|
-
t2 = sidebar.mobileOpen && !sidebar.isDesktop ? /*#__PURE__*/_jsx(
|
|
413
|
+
t2 = sidebar.mobileOpen && !sidebar.isDesktop ? /*#__PURE__*/_jsx(m.button, {
|
|
414
414
|
type: "button",
|
|
415
415
|
"aria-label": label,
|
|
416
416
|
...props,
|
|
@@ -444,9 +444,12 @@ function Backdrop(t0) {
|
|
|
444
444
|
}
|
|
445
445
|
let t3;
|
|
446
446
|
if ($[11] !== t2) {
|
|
447
|
-
t3 = /*#__PURE__*/_jsx(
|
|
448
|
-
|
|
449
|
-
children:
|
|
447
|
+
t3 = /*#__PURE__*/_jsx(LazyMotion, {
|
|
448
|
+
features: domMax,
|
|
449
|
+
children: /*#__PURE__*/_jsx(AnimatePresence, {
|
|
450
|
+
initial: false,
|
|
451
|
+
children: t2
|
|
452
|
+
})
|
|
450
453
|
});
|
|
451
454
|
$[11] = t2;
|
|
452
455
|
$[12] = t3;
|
|
@@ -584,22 +587,25 @@ function Aside(t0) {
|
|
|
584
587
|
}
|
|
585
588
|
let t16;
|
|
586
589
|
if ($[23] !== children || $[24] !== handleDrawerDragEnd || $[25] !== props || $[26] !== t11 || $[27] !== t13 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t9) {
|
|
587
|
-
t16 = /*#__PURE__*/_jsx(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
590
|
+
t16 = /*#__PURE__*/_jsx(LazyMotion, {
|
|
591
|
+
features: domMax,
|
|
592
|
+
children: /*#__PURE__*/_jsx(m.aside, {
|
|
593
|
+
id: t2,
|
|
594
|
+
"data-sidebar-layout": t3,
|
|
595
|
+
...props,
|
|
596
|
+
inert: t4,
|
|
597
|
+
onKeyDown: t5,
|
|
598
|
+
className: t9,
|
|
599
|
+
initial: false,
|
|
600
|
+
animate: t11,
|
|
601
|
+
transition: t12,
|
|
602
|
+
drag: t13,
|
|
603
|
+
dragDirectionLock: true,
|
|
604
|
+
dragConstraints: t14,
|
|
605
|
+
dragElastic: t15,
|
|
606
|
+
onDragEnd: handleDrawerDragEnd,
|
|
607
|
+
children: children
|
|
608
|
+
})
|
|
603
609
|
});
|
|
604
610
|
$[23] = children;
|
|
605
611
|
$[24] = handleDrawerDragEnd;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type KeyboardEvent,
|
|
8
8
|
type ReactNode,
|
|
9
9
|
} from "react";
|
|
10
|
-
import { AnimatePresence,
|
|
10
|
+
import { AnimatePresence, domMax, LazyMotion, m, type HTMLMotionProps, type PanInfo } from "motion/react";
|
|
11
11
|
import { IconMenu2 } from "@tabler/icons-react";
|
|
12
12
|
import { Button, type ButtonProps } from "../../src/ui/button";
|
|
13
13
|
import { motionEase, motionTiming } from "../../src/motion/presets";
|
|
@@ -192,24 +192,28 @@ export type SidebarBackdropProps = Omit<HTMLMotionProps<"button">, "children"> &
|
|
|
192
192
|
function Backdrop({ label = "Close navigation", className, onClick, ...props }: SidebarBackdropProps) {
|
|
193
193
|
const sidebar = useSidebar("Backdrop");
|
|
194
194
|
return (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
195
|
+
// `m.*` in its own `LazyMotion`, as every shell part: an app's strict
|
|
196
|
+
// `LazyMotion` throws on a full `motion.*` component.
|
|
197
|
+
<LazyMotion features={domMax}>
|
|
198
|
+
<AnimatePresence initial={false}>
|
|
199
|
+
{sidebar.mobileOpen && !sidebar.isDesktop ? (
|
|
200
|
+
<m.button
|
|
201
|
+
type="button"
|
|
202
|
+
aria-label={label}
|
|
203
|
+
{...props}
|
|
204
|
+
className={cn("fixed inset-0 z-40 bg-backdrop/80 md:hidden", className)}
|
|
205
|
+
onClick={(event) => {
|
|
206
|
+
onClick?.(event);
|
|
207
|
+
sidebar.onMobileOpenChange(false);
|
|
208
|
+
}}
|
|
209
|
+
initial={{ opacity: 0 }}
|
|
210
|
+
animate={{ opacity: 1 }}
|
|
211
|
+
exit={{ opacity: 0 }}
|
|
212
|
+
transition={{ duration: motionTiming.sidebar, ease: motionEase }}
|
|
213
|
+
/>
|
|
214
|
+
) : null}
|
|
215
|
+
</AnimatePresence>
|
|
216
|
+
</LazyMotion>
|
|
213
217
|
);
|
|
214
218
|
}
|
|
215
219
|
|
|
@@ -233,38 +237,41 @@ function Aside({ id, className, onKeyDown, children, ...props }: SidebarAsidePro
|
|
|
233
237
|
};
|
|
234
238
|
|
|
235
239
|
return (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
240
|
+
// `domMax`: the drawer drags to close.
|
|
241
|
+
<LazyMotion features={domMax}>
|
|
242
|
+
<m.aside
|
|
243
|
+
id={id ?? sidebar.drawerId}
|
|
244
|
+
data-sidebar-layout={isDesktop ? "desktop" : "drawer"}
|
|
245
|
+
{...props}
|
|
246
|
+
inert={!isDesktop && !mobileOpen}
|
|
247
|
+
onKeyDown={(event) => {
|
|
248
|
+
onKeyDown?.(event);
|
|
249
|
+
closeOnEscape(sidebar, event);
|
|
250
|
+
}}
|
|
251
|
+
className={cn(
|
|
252
|
+
"fixed inset-y-0 left-0 z-50 flex bg-background pb-[env(safe-area-inset-bottom,0px)] pt-[env(safe-area-inset-top,0px)] md:py-0",
|
|
253
|
+
panelHidden
|
|
254
|
+
? "w-[var(--app-shell-rail-width)]"
|
|
255
|
+
: "w-[min(var(--app-shell-sidebar-width),calc(100vw-1.5rem))]",
|
|
256
|
+
collapsed || panelHidden
|
|
257
|
+
? "md:w-[var(--app-shell-rail-width)]"
|
|
258
|
+
: "md:w-[var(--app-shell-sidebar-width)]",
|
|
259
|
+
!resize?.isResizing &&
|
|
260
|
+
"md:transition-[width] md:[transition-duration:280ms] md:[transition-timing-function:cubic-bezier(0.22,1,0.36,1)]",
|
|
261
|
+
className,
|
|
262
|
+
)}
|
|
263
|
+
initial={false}
|
|
264
|
+
animate={{ x: isDesktop || mobileOpen ? 0 : "-100%" }}
|
|
265
|
+
transition={{ duration: motionTiming.sidebar, ease: motionEase }}
|
|
266
|
+
drag={!isDesktop && mobileOpen ? "x" : false}
|
|
267
|
+
dragDirectionLock
|
|
268
|
+
dragConstraints={{ left: 0, right: 0 }}
|
|
269
|
+
dragElastic={{ left: 0.45, right: 0.08 }}
|
|
270
|
+
onDragEnd={handleDrawerDragEnd}
|
|
271
|
+
>
|
|
272
|
+
{children}
|
|
273
|
+
</m.aside>
|
|
274
|
+
</LazyMotion>
|
|
268
275
|
);
|
|
269
276
|
}
|
|
270
277
|
|