Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+100
-205
@@ -2,11 +2,9 @@
|
||||
|
||||
import React from "react";
|
||||
import { FeatherCircleDashed } from "@subframe/core";
|
||||
import { FeatherSidebarClose } from "@subframe/core";
|
||||
import { FeatherSidebarOpen } from "@subframe/core";
|
||||
import * as SubframeCore from "@subframe/core";
|
||||
import * as SubframeUtils from "../../utils";
|
||||
import { IconButton } from "../IconButton";
|
||||
import { useSidebarHoverSweep } from "../../sidebar-hover-sweep";
|
||||
|
||||
export interface NavItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
icon?: React.ReactNode;
|
||||
@@ -17,52 +15,42 @@ export interface NavItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
}
|
||||
|
||||
const NavItem = React.forwardRef<HTMLDivElement, NavItemProps>(function NavItem(
|
||||
{
|
||||
icon = <FeatherCircleDashed />,
|
||||
children,
|
||||
selected = false,
|
||||
variant = "icon-and-text",
|
||||
className,
|
||||
...otherProps
|
||||
}: NavItemProps,
|
||||
{ icon = <FeatherCircleDashed />, children, selected = false, variant = "icon-and-text", className, ...otherProps }: NavItemProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
// @subframe/sync-disable -- local fix: keep the item left-anchored in both states (no items-center flip on collapse) so the icon rail does not jump horizontally.
|
||||
"group/7aa51c7e flex w-full cursor-pointer flex-col items-start gap-1 pt-2",
|
||||
{ "w-auto items-center": variant === "icon-only" },
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
data-sidebar-hover-item="true"
|
||||
{...otherProps}
|
||||
>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full flex-col items-start gap-2",
|
||||
{ "w-auto flex-none items-center": variant === "icon-only" }
|
||||
)}
|
||||
>
|
||||
{/* @subframe/sync-disable -- local fix: no items-center flip on collapse; the icon column stays put. */}
|
||||
<div className={SubframeUtils.twClassNames("flex w-full flex-col items-start gap-2")}>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 group-hover/7aa51c7e:bg-surface-neutral-tertiary",
|
||||
// @subframe/sync-disable -- local fix: constant left-anchored 32px icon column in BOTH states; only the label column (1fr) collapses with the animating width so the icon never shifts horizontally.
|
||||
"pointer-events-none group-hover/7aa51c7e:bg-surface-neutral-tertiary grid h-8 w-full origin-center scale-100 grid-cols-[32px_minmax(0,1fr)] items-center rounded-md pr-2 transition-[background-color,scale] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)] will-change-[scale] motion-reduce:transition-none group-hover/7aa51c7e:scale-[1.065] data-[sidebar-sweep-hover=true]:scale-[1.065]",
|
||||
{
|
||||
"w-auto flex-none items-start justify-center px-1.5":
|
||||
variant === "icon-only",
|
||||
"bg-surface-neutral-tertiary group-hover/7aa51c7e:bg-surface-neutral-modal group-active/7aa51c7e:bg-surface-neutral-tertiary":
|
||||
selected,
|
||||
"bg-surface-neutral-tertiary group-hover/7aa51c7e:bg-surface-neutral-modal group-active/7aa51c7e:bg-surface-neutral-tertiary": selected,
|
||||
}
|
||||
)}
|
||||
data-slot="inner-sidebar-nav-item-surface"
|
||||
data-sidebar-hover-surface="true"
|
||||
>
|
||||
{icon ? (
|
||||
<SubframeCore.IconWrapper className="inline-flex h-4 w-4 flex-none items-center justify-center leading-none text-body-default-semibold-0 font-body-default-semibold-0 text-icon-neutral-primary group-active/7aa51c7e:text-icon-neutral-on-subtle [&>svg]:h-full [&>svg]:w-full">
|
||||
<SubframeCore.IconWrapper className="text-body-default-semibold-0 font-body-default-semibold-0 text-icon-neutral-primary group-active/7aa51c7e:text-icon-neutral-on-subtle col-start-1 inline-flex h-5 w-5 flex-none items-center justify-center justify-self-center leading-none [&>svg]:h-5 [&>svg]:max-h-5 [&>svg]:w-5 [&>svg]:max-w-5">
|
||||
{icon}
|
||||
</SubframeCore.IconWrapper>
|
||||
) : null}
|
||||
{children ? (
|
||||
<span
|
||||
className={SubframeUtils.twClassNames(
|
||||
"min-w-0 flex-1 truncate text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary group-active/7aa51c7e:text-text-neutral-on-subtle",
|
||||
"text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary group-active/7aa51c7e:text-text-neutral-on-subtle col-start-2 min-w-0 truncate overflow-hidden whitespace-nowrap opacity-100 transition-[opacity] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)]",
|
||||
{
|
||||
hidden: variant === "icon-only",
|
||||
"text-text-neutral-on-subtle": selected,
|
||||
@@ -87,212 +75,119 @@ export interface NavSectionProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const NavSection = React.forwardRef<HTMLDivElement, NavSectionProps>(
|
||||
function NavSection(
|
||||
{
|
||||
children,
|
||||
label,
|
||||
variant = "default",
|
||||
showLabel = false,
|
||||
showDivider = false,
|
||||
className,
|
||||
...otherProps
|
||||
}: NavSectionProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
const NavSection = React.forwardRef<HTMLDivElement, NavSectionProps>(function NavSection(
|
||||
{ children, label, variant = "default", showLabel = false, showDivider = false, className, ...otherProps }: NavSectionProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
<div className={SubframeUtils.twClassNames("group/c119f2b2 flex w-full flex-col items-start gap-2 pt-2", className)} ref={ref} {...otherProps}>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"group/c119f2b2 flex w-full flex-col items-start gap-2 pt-2",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...otherProps}
|
||||
className={SubframeUtils.twClassNames("hidden w-full items-start", {
|
||||
flex: showDivider,
|
||||
})}
|
||||
>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames("hidden w-full items-start", {
|
||||
flex: showDivider,
|
||||
})}
|
||||
>
|
||||
<SidebarInside.NavDivider />
|
||||
</div>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames("hidden w-full items-start", {
|
||||
flex: showLabel,
|
||||
})}
|
||||
>
|
||||
<SidebarInside.NavLabel label={label} />
|
||||
</div>
|
||||
{children ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full grow shrink-0 basis-0 flex-col items-center",
|
||||
{ "pl-5 pr-0 py-0": variant === "subsection" }
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
) : null}
|
||||
<SidebarInside.NavDivider />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
<div
|
||||
className={SubframeUtils.twClassNames("hidden w-full items-start", {
|
||||
flex: showLabel,
|
||||
})}
|
||||
>
|
||||
<SidebarInside.NavLabel label={label} />
|
||||
</div>
|
||||
{children ? (
|
||||
<div className={SubframeUtils.twClassNames("flex w-full shrink-0 grow basis-0 flex-col items-center", { "py-0 pr-0 pl-5": variant === "subsection" })}>
|
||||
{children}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export interface NavLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
label?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const NavLabel = React.forwardRef<HTMLDivElement, NavLabelProps>(
|
||||
function NavLabel({ label, className, ...otherProps }: NavLabelProps, ref) {
|
||||
return (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full flex-col items-start gap-4 px-3 py-1",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...otherProps}
|
||||
>
|
||||
{label ? (
|
||||
<span className="w-full text-body-extra-small-medium-0 font-body-extra-small-medium-0 text-text-neutral-secondary">
|
||||
{label}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
const NavLabel = React.forwardRef<HTMLDivElement, NavLabelProps>(function NavLabel({ label, className, ...otherProps }: NavLabelProps, ref) {
|
||||
return (
|
||||
<div className={SubframeUtils.twClassNames("flex w-full flex-col items-start gap-4 px-3 py-1", className)} ref={ref} {...otherProps}>
|
||||
{label ? <span className="text-body-extra-small-medium-0 font-body-extra-small-medium-0 text-text-neutral-secondary w-full">{label}</span> : null}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export interface NavDividerProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const NavDivider = React.forwardRef<HTMLDivElement, NavDividerProps>(
|
||||
function NavDivider({ className, ...otherProps }: NavDividerProps, ref) {
|
||||
return (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full flex-col items-center justify-center gap-2 px-1 pt-2",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...otherProps}
|
||||
>
|
||||
<div className="flex h-px w-full flex-none flex-col items-center justify-center gap-2 bg-border-default" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
const NavDivider = React.forwardRef<HTMLDivElement, NavDividerProps>(function NavDivider({ className, ...otherProps }: NavDividerProps, ref) {
|
||||
return (
|
||||
<div className={SubframeUtils.twClassNames("flex w-full flex-col items-center justify-center gap-2 px-1 pt-2", className)} ref={ref} {...otherProps}>
|
||||
<div className="bg-border-default flex h-px w-full flex-none flex-col items-center justify-center gap-2" />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export interface SubcomponentProps
|
||||
extends React.HTMLAttributes<HTMLDivElement> {
|
||||
sidebarButton?: "close" | "open";
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const Subcomponent = React.forwardRef<HTMLDivElement, SubcomponentProps>(
|
||||
function Subcomponent(
|
||||
{ sidebarButton = "close", className, ...otherProps }: SubcomponentProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"group/21460331 flex h-8 w-8 flex-col items-center justify-center gap-2",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...otherProps}
|
||||
>
|
||||
<IconButton
|
||||
variant="tertiary"
|
||||
size="small"
|
||||
square={true}
|
||||
icon={
|
||||
sidebarButton === "open" ? (
|
||||
<FeatherSidebarOpen />
|
||||
) : (
|
||||
<FeatherSidebarClose />
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
export interface SidebarInsideRootProps
|
||||
extends React.HTMLAttributes<HTMLElement> {
|
||||
export interface SidebarInsideRootProps extends React.HTMLAttributes<HTMLElement> {
|
||||
variant?: "open" | "closed";
|
||||
footer?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
visible?: boolean;
|
||||
className?: string;
|
||||
// @subframe/sync-disable -- local fix: Inner sidebar collapse is controlled by the app shell.
|
||||
onToggleCollapse?: () => void;
|
||||
}
|
||||
|
||||
const SidebarInsideRoot = React.forwardRef<HTMLElement, SidebarInsideRootProps>(
|
||||
function SidebarInsideRoot(
|
||||
{
|
||||
variant = "open",
|
||||
footer,
|
||||
children,
|
||||
visible = false,
|
||||
className,
|
||||
onToggleCollapse,
|
||||
...otherProps
|
||||
}: SidebarInsideRootProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
<nav
|
||||
className={SubframeUtils.twClassNames(
|
||||
"group/f6538807 hidden h-full w-[208px] min-w-0 flex-col items-start rounded-l-md border-r border-solid border-border-default bg-surface-neutral-secondary relative transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width]",
|
||||
{
|
||||
flex: visible,
|
||||
"w-12 items-center": variant === "closed",
|
||||
},
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
{...otherProps}
|
||||
>
|
||||
<Subcomponent
|
||||
className="absolute -right-[17px] top-[26px] z-40 cursor-pointer"
|
||||
sidebarButton={variant === "closed" ? "open" : "close"}
|
||||
onClick={onToggleCollapse}
|
||||
/>
|
||||
{children ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex w-full grow shrink-0 basis-0 flex-col items-start overflow-y-auto overflow-x-hidden px-2 pt-1 pb-2",
|
||||
{ "items-center": variant === "closed" }
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
) : null}
|
||||
{footer ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"hidden w-full items-center gap-4 border-t border-solid border-border-default px-6 py-6",
|
||||
{ "justify-center": variant === "closed" }
|
||||
)}
|
||||
>
|
||||
{footer}
|
||||
</div>
|
||||
) : null}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
);
|
||||
const SidebarInsideRoot = React.forwardRef<HTMLElement, SidebarInsideRootProps>(function SidebarInsideRoot(
|
||||
{ variant = "open", footer, children, visible = false, className, onPointerMove, onPointerLeave, ...otherProps }: SidebarInsideRootProps,
|
||||
ref
|
||||
) {
|
||||
const { handlePointerMove, handlePointerLeave } = useSidebarHoverSweep({ onPointerMove, onPointerLeave });
|
||||
|
||||
return (
|
||||
<nav
|
||||
className={SubframeUtils.twClassNames(
|
||||
"group/f6538807 border-border-default bg-surface-neutral-secondary relative hidden h-full w-[208px] min-w-0 flex-col items-start overflow-visible rounded-l-md border-r border-solid transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width]",
|
||||
{
|
||||
flex: visible,
|
||||
"w-12": variant === "closed",
|
||||
},
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
onPointerMove={handlePointerMove}
|
||||
onPointerLeave={handlePointerLeave}
|
||||
{...otherProps}
|
||||
>
|
||||
{children ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
// @subframe/sync-disable -- local fix: do not center children when closed (items-center removed) so the icon column stays left-anchored through the width animation.
|
||||
"flex shrink-0 grow basis-0 flex-col items-start overflow-x-hidden overflow-y-auto pt-1 pb-2 transition-[padding,width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",
|
||||
{
|
||||
"w-full px-2": variant === "open",
|
||||
"w-12 px-2": variant === "closed",
|
||||
}
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
) : null}
|
||||
{footer ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames("border-border-default hidden w-full items-center gap-4 border-t border-solid px-6 py-6", {
|
||||
"justify-center": variant === "closed",
|
||||
})}
|
||||
>
|
||||
{footer}
|
||||
</div>
|
||||
) : null}
|
||||
</nav>
|
||||
);
|
||||
});
|
||||
|
||||
export const SidebarInside = Object.assign(SidebarInsideRoot, {
|
||||
NavItem,
|
||||
NavSection,
|
||||
NavLabel,
|
||||
NavDivider,
|
||||
Subcomponent,
|
||||
});
|
||||
Reference in new issue
Block a user