@raulaguila/maat-ui 0.10.0 → 0.11.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/dist/sheet.d.ts +2 -1
- package/dist/sheet.js +2 -2
- package/dist/sidebar-controls.d.ts +11 -0
- package/dist/sidebar-controls.js +14 -2
- package/package.json +1 -1
- package/styles.css +49 -0
package/dist/sheet.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
|
3
3
|
declare function Sheet({ ...props }: SheetPrimitive.Root.Props): React.JSX.Element;
|
|
4
4
|
declare function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props): React.JSX.Element;
|
|
5
5
|
declare function SheetClose({ ...props }: SheetPrimitive.Close.Props): React.JSX.Element;
|
|
6
|
-
declare function SheetContent({ className, children, side, showCloseButton, ...props }: SheetPrimitive.Popup.Props & {
|
|
6
|
+
declare function SheetContent({ className, children, side, showCloseButton, keepMounted, ...props }: SheetPrimitive.Popup.Props & {
|
|
7
7
|
side?: "top" | "right" | "bottom" | "left";
|
|
8
|
+
keepMounted?: boolean;
|
|
8
9
|
showCloseButton?: boolean;
|
|
9
10
|
}): React.JSX.Element;
|
|
10
11
|
declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
package/dist/sheet.js
CHANGED
|
@@ -20,9 +20,9 @@ function SheetPortal({ ...props }) {
|
|
|
20
20
|
function SheetOverlay({ className, ...props }) {
|
|
21
21
|
return (_jsx(SheetPrimitive.Backdrop, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs", className), ...props }));
|
|
22
22
|
}
|
|
23
|
-
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
23
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, keepMounted = false, ...props }) {
|
|
24
24
|
const { close } = useFamilyLabels();
|
|
25
|
-
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Popup, { "data-slot": "sheet-content", "data-side": side, className: cn("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { "data-slot": "sheet-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-3 right-3", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: close })] }))] })] }));
|
|
25
|
+
return (_jsxs(SheetPortal, { keepMounted: keepMounted, children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Popup, { "data-slot": "sheet-content", "data-side": side, className: cn("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { "data-slot": "sheet-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-3 right-3", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: close })] }))] })] }));
|
|
26
26
|
}
|
|
27
27
|
function SheetHeader({ className, ...props }) {
|
|
28
28
|
return (_jsx("div", { "data-slot": "sheet-header", className: cn("flex shrink-0 flex-col gap-0.5 p-4", className), ...props }));
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
/** Keep the same keyed rows mounted when entering or leaving a resource. */
|
|
3
|
+
export declare function sidebarAway(direction?: "up" | "down"): {
|
|
4
|
+
"data-away": "up" | "down" | undefined;
|
|
5
|
+
inert: boolean | undefined;
|
|
6
|
+
"aria-hidden": boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare function SidebarResourceRow({ index, selectedIndex, children }: {
|
|
9
|
+
index: number;
|
|
10
|
+
selectedIndex: number;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
2
13
|
export declare function SidebarGroup({ label, compact, open, onToggle, children }: {
|
|
3
14
|
label: string;
|
|
4
15
|
compact: boolean;
|
package/dist/sidebar-controls.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "./cn.js";
|
|
4
|
-
import { useId } from "react";
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
5
|
import { ChevronDown, Settings } from "lucide-react";
|
|
6
6
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
8
|
+
/** Keep the same keyed rows mounted when entering or leaving a resource. */
|
|
9
|
+
export function sidebarAway(direction) {
|
|
10
|
+
return { "data-away": direction, inert: direction ? true : undefined, "aria-hidden": direction ? true : undefined };
|
|
11
|
+
}
|
|
12
|
+
export function SidebarResourceRow({ index, selectedIndex, children }) {
|
|
13
|
+
const selected = index === selectedIndex;
|
|
14
|
+
const away = selectedIndex < 0 || selected ? undefined : index < selectedIndex ? "up" : "down";
|
|
15
|
+
return _jsx("li", { className: "rail-workspace-group", "data-selected": selected ? "" : undefined, ...sidebarAway(away), children: children });
|
|
16
|
+
}
|
|
8
17
|
export function SidebarGroup({ label, compact, open, onToggle, children }) {
|
|
9
18
|
const id = useId();
|
|
10
19
|
const button = _jsxs("button", { type: "button", className: compact ? "rail-item rail-admin-toggle" : "rail-admin-toggle", "aria-label": label, "aria-expanded": open, "aria-controls": id, onClick: onToggle, children: [_jsx(Settings, { className: "rail-admin-icon size-4", "aria-hidden": true }), !compact && _jsxs(_Fragment, { children: [_jsx("span", { className: "rail-nav-label", children: label }), _jsx(ChevronDown, { className: "rail-admin-chevron size-3.5", "aria-hidden": true })] })] });
|
|
11
20
|
return _jsxs("div", { role: "group", "aria-label": label, className: "rail-nav-section", children: [compact ? _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: button }), _jsx(TooltipContent, { side: "right", children: label })] }) : button, _jsx("div", { id: id, hidden: !open, className: "rail-admin-links", children: children })] });
|
|
12
21
|
}
|
|
13
22
|
export function SidebarDrawer({ id, title, description, open, onOpenChange, finalFocus, desktop = false, children }) {
|
|
14
|
-
|
|
23
|
+
const [visited, setVisited] = useState(false);
|
|
24
|
+
if (open && !visited)
|
|
25
|
+
setVisited(true);
|
|
26
|
+
return _jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { keepMounted: visited, id: id, "data-mobile-drawer": true, finalFocus: finalFocus, side: "left", className: cn("flex flex-col gap-0 p-0 data-[side=left]:w-[min(18rem,calc(100vw-2rem))] data-[side=left]:sm:max-w-72", !desktop && "lg:hidden"), children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: title }), _jsx(SheetDescription, { children: description })] }), children] }) });
|
|
15
27
|
}
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -381,6 +381,53 @@ html[data-density="compact"] {
|
|
|
381
381
|
flex-shrink: 0
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
+
/* Resource navigation: the route selects the row; the rail owns its surfaces and motion. */
|
|
385
|
+
[data-ui-workspace-rail] {
|
|
386
|
+
--rail-avatar-bg: color-mix(in oklab, var(--primary) 15%, var(--sidebar));
|
|
387
|
+
--rail-item-hover-bg: color-mix(in oklab, var(--primary) 12%, var(--sidebar));
|
|
388
|
+
}
|
|
389
|
+
[data-ui-workspace-rail] .rail-item:hover,
|
|
390
|
+
[data-ui-workspace-rail] .rail-switch[aria-expanded=true] { background:var(--accent); color:var(--foreground); }
|
|
391
|
+
[data-ui-workspace-rail] :is(.rail-workspace-navigation,.rail-nav,.rail-global) .rail-item:hover { background:transparent; color:var(--primary); }
|
|
392
|
+
:is(.rail-workspace-navigation,.rail-nav,.rail-global) .rail-item:hover > svg { background:var(--rail-item-hover-bg); }
|
|
393
|
+
[data-ui-workspace-rail] :is(.rail-workspace-navigation,.rail-nav,.rail-global) .rail-item:is([aria-current=page],[aria-current=location]) {
|
|
394
|
+
background:transparent; color:var(--primary-strong,var(--primary)); font-weight:600;
|
|
395
|
+
}
|
|
396
|
+
:is(.rail-workspace-navigation,.rail-nav,.rail-global) .rail-item:is([aria-current=page],[aria-current=location]) > svg {
|
|
397
|
+
background:var(--primary); color:var(--primary-foreground);
|
|
398
|
+
}
|
|
399
|
+
/* Resource avatars can supply their own inline fill outside the sidebar. */
|
|
400
|
+
.rail-workspace > .rail-avatar { background:transparent !important; }
|
|
401
|
+
:is([data-ui-workspace-rail][data-collapsed], html.sidebar-collapsed [data-ui-workspace-rail]:not([data-mobile])) .rail-workspace > .rail-avatar {
|
|
402
|
+
width:32px; height:32px; background:var(--rail-avatar-bg) !important;
|
|
403
|
+
}
|
|
404
|
+
@media (min-width:768px) and (max-width:1023px) {
|
|
405
|
+
[data-ui-workspace-rail]:not([data-mobile]) .rail-workspace > .rail-avatar { width:32px; height:32px; background:var(--rail-avatar-bg) !important; }
|
|
406
|
+
}
|
|
407
|
+
.rail-workspace-group { min-width:0; }
|
|
408
|
+
.rail-workspace-group:not([data-selected]), .rail-create, .rail-group-heading {
|
|
409
|
+
max-height:64px; transition:max-height 240ms ease, opacity 200ms ease, transform 240ms ease, margin 240ms ease;
|
|
410
|
+
}
|
|
411
|
+
:is(.rail-workspace-group,.rail-create,.rail-group-heading)[data-away] {
|
|
412
|
+
max-height:0; min-height:0; padding-block:0; opacity:0; overflow:hidden; pointer-events:none; margin-bottom:-4px;
|
|
413
|
+
}
|
|
414
|
+
.rail-group-heading[data-away] { margin-bottom:0; }
|
|
415
|
+
@supports (interpolate-size:allow-keywords) {
|
|
416
|
+
.rail-body { interpolate-size:allow-keywords; }
|
|
417
|
+
.rail-workspace-group:not([data-selected]), .rail-create, .rail-group-heading {
|
|
418
|
+
max-height:none; block-size:auto; transition:block-size 240ms ease, opacity 200ms ease, transform 240ms ease, margin 240ms ease;
|
|
419
|
+
}
|
|
420
|
+
:is(.rail-workspace-group,.rail-create,.rail-group-heading)[data-away] { block-size:0; }
|
|
421
|
+
}
|
|
422
|
+
@media (prefers-reduced-motion:no-preference) {
|
|
423
|
+
:is(.rail-workspace-group,.rail-group-heading)[data-away=up] { transform:translateY(-32px); }
|
|
424
|
+
:is(.rail-workspace-group,.rail-create)[data-away=down] { transform:translateY(32px); }
|
|
425
|
+
}
|
|
426
|
+
@media (prefers-reduced-motion:reduce) {
|
|
427
|
+
.rail-workspace-group:not([data-selected]), .rail-create, .rail-group-heading { transition:none; }
|
|
428
|
+
}
|
|
429
|
+
[data-mobile-drawer][hidden] { display:none !important; }
|
|
430
|
+
|
|
384
431
|
.profile-content [role="tablist"] [role="tab"][aria-selected] { min-height: 38px; }
|
|
385
432
|
@media (max-width: 767px), (pointer: coarse) {
|
|
386
433
|
.profile-content [role="tablist"] [role="tab"][aria-selected] { min-height: 44px; }
|
|
@@ -508,6 +555,8 @@ html[data-density="compact"] {
|
|
|
508
555
|
&:has(textarea:disabled) > label { opacity: .65 }
|
|
509
556
|
}
|
|
510
557
|
[data-ui-floating-control="select"] {
|
|
558
|
+
/* The segmented border provides the keyboard focus indicator. */
|
|
559
|
+
& [data-ui-floating-input] select:focus-visible { outline: none }
|
|
511
560
|
& [data-ui-floating-input] :is(select, button[aria-haspopup]) {
|
|
512
561
|
width: 100%;
|
|
513
562
|
min-width: 0;
|