Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -9,20 +9,16 @@ import { FeatherChevronRight } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface ChevronProps
extends React.ComponentProps<typeof SubframeCore.Collapsible.Chevron> {
export interface ChevronProps extends React.ComponentProps<typeof SubframeCore.Collapsible.Chevron> {
className?: string;
}
const Chevron = React.forwardRef<
React.ElementRef<typeof FeatherChevronRight>,
ChevronProps
>(function Chevron({ className, ...otherProps }: ChevronProps, ref) {
const Chevron = React.forwardRef<React.ElementRef<typeof FeatherChevronRight>, ChevronProps>(function Chevron({ className, ...otherProps }: ChevronProps, ref) {
return (
<SubframeCore.Collapsible.Chevron {...otherProps}>
<FeatherChevronRight
className={SubframeUtils.twClassNames(
"text-body-default-regular-150 font-body-default-regular-150 text-icon-neutral-primary group-data-[state=open]/d2e81e20:rotate-90 group-aria-[invalid=true]/d2e81e20:text-icon-feedback-negative group-aria-[disabled=true]/d2e81e20:text-icon-neutral-disabled",
"text-body-default-regular-150 font-body-default-regular-150 text-icon-neutral-primary group-aria-[invalid=true]/d2e81e20:text-icon-feedback-negative group-aria-[disabled=true]/d2e81e20:text-icon-neutral-disabled group-data-[state=open]/d2e81e20:rotate-90",
className
)}
ref={ref}
@@ -31,124 +27,89 @@ const Chevron = React.forwardRef<
);
});
export interface ContentProps
extends React.ComponentProps<typeof SubframeCore.Collapsible.Content> {
export interface ContentProps extends React.ComponentProps<typeof SubframeCore.Collapsible.Content> {
children?: React.ReactNode;
className?: string;
}
const Content = React.forwardRef<HTMLDivElement, ContentProps>(function Content(
{ children, className, ...otherProps }: ContentProps,
ref
) {
const Content = React.forwardRef<HTMLDivElement, ContentProps>(function Content({ children, className, ...otherProps }: ContentProps, ref) {
return children ? (
<SubframeCore.Collapsible.Content asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start gap-2",
className
)}
ref={ref}
>
<div className={SubframeUtils.twClassNames("flex w-full flex-col items-start gap-2", className)} ref={ref}>
{children}
</div>
</SubframeCore.Collapsible.Content>
) : null;
});
export interface TriggerProps
extends React.ComponentProps<typeof SubframeCore.Collapsible.Trigger> {
export interface TriggerProps extends React.ComponentProps<typeof SubframeCore.Collapsible.Trigger> {
children?: React.ReactNode;
className?: string;
}
const Trigger = React.forwardRef<HTMLDivElement, TriggerProps>(function Trigger(
{ children, className, ...otherProps }: TriggerProps,
ref
) {
const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger({ children, className, ...otherProps }: TriggerProps, ref) {
return children ? (
<SubframeCore.Collapsible.Trigger asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"flex w-full cursor-pointer flex-col items-start gap-2",
className
)}
<button
type="button"
className={SubframeUtils.twClassNames("flex w-full cursor-pointer flex-col items-start gap-2 border-0 bg-transparent p-0 text-left", className)}
ref={ref}
>
{children}
</div>
</button>
</SubframeCore.Collapsible.Trigger>
) : null;
});
export interface AccordionRootProps
extends React.ComponentProps<typeof SubframeCore.Collapsible.Root> {
export interface AccordionRootProps extends React.ComponentProps<typeof SubframeCore.Collapsible.Root> {
disabled?: boolean;
error?: boolean;
open?: boolean;
variant?: "card" | "ghost";
trigger?: React.ReactNode;
triggerRole?: React.AriaRole;
children?: React.ReactNode;
className?: string;
}
const AccordionRoot = React.forwardRef<HTMLDivElement, AccordionRootProps>(
function AccordionRoot(
{
disabled = false,
error = false,
open,
variant = "card",
trigger,
children,
className,
defaultOpen = false,
...otherProps
}: AccordionRootProps,
ref
) {
return (
<SubframeCore.Collapsible.Root
open={open}
defaultOpen={defaultOpen}
asChild={true}
disabled={disabled}
{...otherProps}
const AccordionRoot = React.forwardRef<HTMLDivElement, AccordionRootProps>(function AccordionRoot(
{
disabled = false,
error = false,
open,
variant = "card",
trigger,
triggerRole,
children,
className,
defaultOpen = false,
...otherProps
}: AccordionRootProps,
ref
) {
return (
<SubframeCore.Collapsible.Root open={open} defaultOpen={defaultOpen} asChild={true} disabled={disabled} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"group/d2e81e20 border-border-default bg-surface-neutral-secondary hover:bg-surface-neutral-tertiary flex w-full cursor-pointer flex-col items-start rounded-md border border-solid",
{
"border-none bg-transparent hover:bg-transparent": variant === "ghost",
"border-border-negative-solid hover:border-border-negative-solid border-2 border-solid": error,
"border-border-disabled bg-surface-neutral-disabled hover:bg-surface-neutral-disabled hover:border-border-disabled pointer-events-none border border-solid opacity-40":
disabled,
},
className
)}
ref={ref}
>
<div
className={SubframeUtils.twClassNames(
"group/d2e81e20 flex w-full cursor-pointer flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary hover:bg-surface-neutral-tertiary",
{
"border-none bg-transparent hover:bg-transparent":
variant === "ghost",
"border-2 border-solid border-border-negative-solid hover:border-border-negative-solid":
error,
"border border-solid border-border-disabled bg-surface-neutral-disabled opacity-40 pointer-events-none hover:bg-surface-neutral-disabled hover:border-border-disabled":
disabled,
},
className
)}
ref={ref}
>
<Trigger>
{trigger ? (
<div className="flex w-full grow shrink-0 basis-0 flex-col items-start group-data-[state=open]/d2e81e20:flex-none">
{trigger}
</div>
) : null}
</Trigger>
<Content>
{children ? (
<div className="flex w-full grow shrink-0 basis-0 flex-col items-start">
{children}
</div>
) : null}
</Content>
</div>
</SubframeCore.Collapsible.Root>
);
}
);
<Trigger role={triggerRole}>
{trigger ? <div className="flex w-full shrink-0 grow basis-0 flex-col items-start group-data-[state=open]/d2e81e20:flex-none">{trigger}</div> : null}
</Trigger>
<Content>{children ? <div className="flex w-full shrink-0 grow basis-0 flex-col items-start">{children}</div> : null}</Content>
</div>
</SubframeCore.Collapsible.Root>
);
});
export const Accordion = Object.assign(AccordionRoot, {
Chevron,
@@ -0,0 +1,17 @@
import "@testing-library/jest-dom/vitest";
import { render } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Avatar } from "./Avatar";
describe("Avatar", () => {
it("supports a larger circular profile-picture size", () => {
const { getByTestId } = render(
<Avatar size="extra-large" image="data:image/png;base64,AA==" data-testid="avatar" />,
);
const avatar = getByTestId("avatar");
expect(avatar).toHaveClass("h-16", "w-16", "rounded-round");
expect(avatar.querySelector("img")).toHaveClass("h-16", "w-16", "rounded-round");
});
});
@@ -7,86 +7,74 @@
import React from "react";
import * as SubframeUtils from "../../utils";
export interface AvatarRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "color"> {
export interface AvatarRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "color"> {
color?: "neutral" | "blue" | "green" | "red" | "yellow" | "purple";
size?: "extra-small" | "small" | "medium" | "large";
size?: "extra-small" | "small" | "medium" | "large" | "extra-large";
border?: boolean;
children?: React.ReactNode;
image?: string;
className?: string;
}
const AvatarRoot = React.forwardRef<HTMLDivElement, AvatarRootProps>(
function AvatarRoot(
{
color = "neutral",
size = "medium",
border = false,
children,
image,
className,
...otherProps
}: AvatarRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/bec25ae6 flex h-10 w-10 flex-col items-center justify-center gap-2 overflow-hidden rounded-round bg-surface-neutral-tertiary relative",
{
"border border-solid border-border-on-primary": border,
const AvatarRoot = React.forwardRef<HTMLDivElement, AvatarRootProps>(function AvatarRoot(
{ color = "neutral", size = "medium", border = false, children, image, className, ...otherProps }: AvatarRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/bec25ae6 rounded-round bg-surface-neutral-tertiary relative flex h-10 w-10 flex-col items-center justify-center gap-2 overflow-hidden",
{
"border-border-on-primary border border-solid": border,
"h-16 w-16": size === "extra-large",
"h-12 w-12": size === "large",
"h-8 w-8": size === "small",
"h-6 w-6": size === "extra-small",
"bg-surface-ui-subtle-purple-default": color === "purple",
"bg-surface-ui-subtle-yellow-default": color === "yellow",
"bg-surface-ui-subtle-red-default": color === "red",
"bg-surface-ui-subtle-green-default": color === "green",
"bg-surface-ui-subtle-blue-default": color === "blue",
},
className
)}
ref={ref}
{...otherProps}
>
{children ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-medium-150 font-body-default-medium-150 text-text-neutral-secondary absolute line-clamp-1 w-full text-center",
{
"text-body-large font-body-large": size === "large",
"text-heading-3 font-heading-3": size === "extra-large",
"text-body-small-medium-150 font-body-small-medium-150": size === "small",
"text-body-extra-small-medium-150 font-body-extra-small-medium-150": size === "extra-small",
"text-text-ui-purple": color === "purple",
"text-text-ui-yellow": color === "yellow",
"text-text-ui-red": color === "red",
"text-text-ui-green": color === "green",
"text-text-ui-blue": color === "blue",
}
)}
>
{children}
</span>
) : null}
{image ? (
<img
className={SubframeUtils.twClassNames("rounded-round absolute h-10 w-10 flex-none object-cover", {
"h-16 w-16": size === "extra-large",
"h-12 w-12": size === "large",
"h-8 w-8": size === "small",
"h-6 w-6": size === "extra-small",
"bg-surface-ui-subtle-purple-default": color === "purple",
"bg-surface-ui-subtle-yellow-default": color === "yellow",
"bg-surface-ui-subtle-red-default": color === "red",
"bg-surface-ui-subtle-green-default": color === "green",
"bg-surface-ui-subtle-blue-default": color === "blue",
},
className
)}
ref={ref}
{...otherProps}
>
{children ? (
<span
className={SubframeUtils.twClassNames(
"line-clamp-1 w-full text-body-default-medium-150 font-body-default-medium-150 text-text-neutral-secondary text-center absolute",
{
"text-body-large font-body-large": size === "large",
"text-body-small-medium-150 font-body-small-medium-150":
size === "small",
"text-body-extra-small-medium-150 font-body-extra-small-medium-150":
size === "extra-small",
"text-text-ui-purple": color === "purple",
"text-text-ui-yellow": color === "yellow",
"text-text-ui-red": color === "red",
"text-text-ui-green": color === "green",
"text-text-ui-blue": color === "blue",
}
)}
>
{children}
</span>
) : null}
{image ? (
<img
className={SubframeUtils.twClassNames(
"h-10 w-10 flex-none object-cover absolute",
{
"h-12 w-12": size === "large",
"h-8 w-8": size === "small",
"h-6 w-6": size === "extra-small",
}
)}
src={image}
/>
) : null}
</div>
);
}
);
})}
src={image}
alt=""
/>
) : null}
</div>
);
});
export const Avatar = AvatarRoot;
@@ -0,0 +1,317 @@
"use client";
/*
* Documentation:
* Badge — https://app.subframe.com/f023064a5ca0/library?component=Badge_7d75e221-355a-4695-acb7-3902a9f6ffde
*/
import React from "react";
import * as SubframeUtils from "../../utils";
export interface BadgeRootProps extends React.HTMLAttributes<HTMLDivElement> {
tone?:
| "red-subtle"
| "orange-subtle"
| "yellow-subtle"
| "pear-subtle"
| "lime-subtle"
| "green-subtle"
| "teal-subtle"
| "ocean-subtle"
| "sky-subtle"
| "blue-subtle"
| "indigo-subtle"
| "violet-subtle"
| "fuchsia-subtle"
| "pink-subtle"
| "sand-subtle"
| "brown-subtle"
| "red-solid"
| "orange-solid"
| "yellow-solid"
| "pear-solid"
| "lime-solid"
| "green-solid"
| "teal-solid"
| "ocean-solid"
| "sky-solid"
| "blue-solid"
| "indigo-solid"
| "violet-solid"
| "fuchsia-solid"
| "pink-solid"
| "sand-solid"
| "brown-solid"
| "red-outline"
| "orange-outline"
| "yellow-outline"
| "pear-outline"
| "lime-outline"
| "green-outline"
| "teal-outline"
| "ocean-outline"
| "sky-outline"
| "blue-outline"
| "indigo-outline"
| "violet-outline"
| "fuchsia-outline"
| "pink-outline"
| "sand-outline"
| "brown-outline"
| "brand-primary-solid"
| "brand-secondary-solid"
| "neutral-solid"
| "brand-primary-subtle"
| "brand-secondary-subtle"
| "neutral-subtle"
| "white";
children?: React.ReactNode;
size?: "small" | "medium" | "large";
hideDot?: boolean;
className?: string;
}
const BadgeRoot = React.forwardRef<HTMLDivElement, BadgeRootProps>(
function BadgeRoot(
{
tone = "neutral-subtle",
children,
size = "medium",
hideDot = false,
className,
...otherProps
}: BadgeRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/7d75e221 flex h-6 items-center gap-2 rounded-round border border-solid border-border-default bg-surface-feedback-subtle-neutral px-2.5 py-1",
{
"h-8 py-2": size === "large",
"h-5 py-0.5": size === "small",
"bg-surface-neutral-secondary": tone === "white",
"border border-solid border-brand-brand-secondary-surface-subtle-default bg-brand-brand-secondary-surface-subtle-default":
tone === "brand-secondary-subtle",
"border border-solid border-brand-brand-surface-subtle-default bg-brand-brand-surface-subtle-default":
tone === "brand-primary-subtle",
"border border-solid border-surface-feedback-solid-neutral bg-surface-feedback-solid-neutral":
tone === "neutral-solid",
"border border-solid border-brand-brand-secondary-surface-solid-default bg-brand-brand-secondary-surface-solid-default":
tone === "brand-secondary-solid",
"border border-solid border-brand-brand-surface-solid-default bg-brand-brand-surface-solid-default":
tone === "brand-primary-solid",
"border-2 border-solid border-[#c2a682] bg-[#fafafa]":
tone === "brown-outline",
"border-2 border-solid border-[#c8baa9] bg-[#fafafa]":
tone === "sand-outline",
"border-2 border-solid border-[#f9a8d4] bg-[#fafafa]":
tone === "pink-outline",
"border-2 border-solid border-[#f0abfc] bg-[#fafafa]":
tone === "fuchsia-outline",
"border-2 border-solid border-[#cfb2ff] bg-[#fafafa]":
tone === "violet-outline",
"border-2 border-solid border-[#b3b8ff] bg-[#fafafa]":
tone === "indigo-outline",
"border-2 border-solid border-[#85c7ff] bg-[#fafafa]":
tone === "blue-outline",
"border-2 border-solid border-[#79c7ff] bg-[#fafafa]":
tone === "sky-outline",
"border-2 border-solid border-[#81dbf8] bg-[#fafafa]":
tone === "ocean-outline",
"border-2 border-solid border-[#51f7e5] bg-[#fafafa]":
tone === "teal-outline",
"border-2 border-solid border-[#85f0a3] bg-[#fafafa]":
tone === "green-outline",
"border-2 border-solid border-[#bef264] bg-[#fafafa]":
tone === "lime-outline",
"border-2 border-solid border-[#e0eb6b] bg-[#fafafa]":
tone === "pear-outline",
"border-2 border-solid border-[#f6d84e] bg-[#fafafa]":
tone === "yellow-outline",
"border-2 border-solid border-[#ffa570] bg-[#fafafa]":
tone === "orange-outline",
"border-2 border-solid border-[#fba6a6] bg-[#fafafa]":
tone === "red-outline",
"border border-solid border-[#8a5f44] bg-[#8a5f44]":
tone === "brown-solid",
"border border-solid border-[#947562] bg-[#947562]":
tone === "sand-solid",
"border border-solid border-[#db2777] bg-[#db2777]":
tone === "pink-solid",
"border border-solid border-[#c026d3] bg-[#c026d3]":
tone === "fuchsia-solid",
"border border-solid border-[#7c2df0] bg-[#7c2df0]":
tone === "violet-solid",
"border border-solid border-[#4835f2] bg-[#4835f2]":
tone === "indigo-solid",
"border border-solid border-[#0c4bff] bg-[#0c4bff]":
tone === "blue-solid",
"border border-solid border-[#0071ce] bg-[#0071ce]":
tone === "sky-solid",
"border border-solid border-[#0890c1] bg-[#0890c1]":
tone === "ocean-solid",
"border border-solid border-[#05807c] bg-[#05807c]":
tone === "teal-solid",
"border border-solid border-[#15a43e] bg-[#15a43e]":
tone === "green-solid",
"border border-solid border-[#4d7c0f] bg-[#4d7c0f]":
tone === "lime-solid",
"border border-solid border-[#677615] bg-[#677615]":
tone === "pear-solid",
"border border-solid border-[#e0c200] bg-[#e0c200]":
tone === "yellow-solid",
"border border-solid border-[#ea580c] bg-[#ea580c]":
tone === "orange-solid",
"border border-solid border-[#da2828] bg-[#da2828]":
tone === "red-solid",
"border border-solid border-[#d9c8af] bg-[#ebe3d6]":
tone === "brown-subtle",
"border border-solid border-[#ded6ca] bg-[#ede9e3]":
tone === "sand-subtle",
"border border-solid border-[#fbcfe8] bg-[#fce7f3]":
tone === "pink-subtle",
"border border-solid border-[#f5d0fe] bg-[#fae8ff]":
tone === "fuchsia-subtle",
"border border-solid border-[#e4d4ff] bg-[#f0e7ff]":
tone === "violet-subtle",
"border border-solid border-[#d5d9ff] bg-[#e8e9ff]":
tone === "indigo-subtle",
"border border-solid border-[#b3dfff] bg-[#d5efff]":
tone === "blue-subtle",
"border border-solid border-border-information-subtle bg-surface-feedback-subtle-information":
tone === "sky-subtle",
"border border-solid border-[#bceafb] bg-[#e1f4fd]":
tone === "ocean-subtle",
"border border-solid border-[#90ffee] bg-[#c8fff7]":
tone === "teal-subtle",
"border border-solid border-[#baf8cb] bg-[#dcfce4]":
tone === "green-subtle",
"border border-solid border-[#d9f99d] bg-[#ecfccb]":
tone === "lime-subtle",
"border border-solid border-[#eff4a2] bg-[#f8facd]":
tone === "pear-subtle",
"border border-solid border-[#faeb8e] bg-[#fcf6c5]":
tone === "yellow-subtle",
"border border-solid border-[#ffcaa8] bg-[#ffe7d4]":
tone === "orange-subtle",
"border border-solid border-[#fdcbcb] bg-[#fee2e2]":
tone === "red-subtle",
},
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"flex h-1 w-1 flex-none flex-col items-start rounded-round bg-icon-neutral-on-subtle",
{
hidden: hideDot,
"bg-brand-brand-secondary-surface-solid-default":
tone === "brand-secondary-subtle",
"bg-brand-brand-surface-solid-default":
tone === "brand-primary-subtle",
"bg-icon-neutral-on-solid":
tone === "neutral-solid" ||
tone === "brand-secondary-solid" ||
tone === "brand-primary-solid" ||
tone === "brown-solid" ||
tone === "sand-solid" ||
tone === "pink-solid" ||
tone === "fuchsia-solid" ||
tone === "violet-solid" ||
tone === "indigo-solid" ||
tone === "blue-solid" ||
tone === "sky-solid" ||
tone === "ocean-solid" ||
tone === "teal-solid" ||
tone === "green-solid" ||
tone === "lime-solid" ||
tone === "pear-solid" ||
tone === "yellow-solid" ||
tone === "orange-solid" ||
tone === "red-solid",
"bg-[#6f4a39]": tone === "brown-outline",
"bg-[#7c6052]": tone === "sand-outline",
"bg-[#be185d]": tone === "pink-outline",
"bg-[#a21caf]": tone === "fuchsia-outline",
"bg-[#691cd4]": tone === "violet-outline",
"bg-[#3923de]": tone === "indigo-outline",
"bg-[#003beb]": tone === "blue-outline",
"bg-[#0071ce]": tone === "sky-outline" || tone === "sky-subtle",
"bg-[#08739c]": tone === "ocean-outline",
"bg-[#05807c]": tone === "teal-outline" || tone === "teal-subtle",
"bg-[#148134]": tone === "green-outline",
"bg-[#4d7c0f]": tone === "lime-outline" || tone === "lime-subtle",
"bg-[#677615]": tone === "pear-outline" || tone === "pear-subtle",
"bg-[#9b5e0d]": tone === "yellow-outline",
"bg-[#c72307]": tone === "orange-outline",
"bg-[#c52020]": tone === "red-outline",
"bg-[#8a5f44]": tone === "brown-subtle",
"bg-[#947562]": tone === "sand-subtle",
"bg-[#db2777]": tone === "pink-subtle",
"bg-[#c026d3]": tone === "fuchsia-subtle",
"bg-[#7c2df0]": tone === "violet-subtle",
"bg-[#4835f2]": tone === "indigo-subtle",
"bg-[#0c4bff]": tone === "blue-subtle",
"bg-[#0890c1]": tone === "ocean-subtle",
"bg-[#15a43e]": tone === "green-subtle",
"bg-[#e0c200]": tone === "yellow-subtle",
"bg-[#ea580c]": tone === "orange-subtle",
"bg-[#da2828]": tone === "red-subtle",
}
)}
/>
{children ? (
<span
className={SubframeUtils.twClassNames(
"whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-on-subtle",
{
"text-text-neutral-on-solid":
tone === "neutral-solid" ||
tone === "brand-secondary-solid" ||
tone === "brand-primary-solid" ||
tone === "brown-solid" ||
tone === "sand-solid" ||
tone === "pink-solid" ||
tone === "fuchsia-solid" ||
tone === "violet-solid" ||
tone === "indigo-solid" ||
tone === "blue-solid" ||
tone === "sky-solid" ||
tone === "ocean-solid" ||
tone === "teal-solid" ||
tone === "green-solid" ||
tone === "lime-solid" ||
tone === "pear-solid" ||
tone === "yellow-solid" ||
tone === "orange-solid" ||
tone === "red-solid",
"text-[#6f4a39]": tone === "brown-outline",
"text-[#7c6052]": tone === "sand-outline",
"text-[#be185d]": tone === "pink-outline",
"text-[#a21caf]": tone === "fuchsia-outline",
"text-[#691cd4]": tone === "violet-outline",
"text-[#3923de]": tone === "indigo-outline",
"text-[#003beb]": tone === "blue-outline",
"text-[#0071ce]": tone === "sky-outline",
"text-[#08739c]": tone === "ocean-outline",
"text-[#05807c]": tone === "teal-outline",
"text-[#148134]": tone === "green-outline",
"text-[#4d7c0f]": tone === "lime-outline",
"text-[#677615]": tone === "pear-outline",
"text-[#9b5e0d]": tone === "yellow-outline",
"text-[#c72307]": tone === "orange-outline",
"text-[#c52020]": tone === "red-outline",
}
)}
>
{children}
</span>
) : null}
</div>
);
}
);
export const Badge = BadgeRoot;
@@ -0,0 +1,10 @@
"use client";
import { Badge as BadgeComponent } from "./Badge";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const Badge = BadgeComponent;
@@ -32,7 +32,7 @@ const BannerAlertRoot = React.forwardRef<HTMLDivElement, BannerAlertRootProps>(
dismissing = false,
type = "information",
fillContainer = false,
hideAction = false,
hideAction: _hideAction = false,
dismissible = false,
children,
actionLabel,
@@ -7,29 +7,20 @@
import React from "react";
import * as SubframeUtils from "../../utils";
export interface BannerOfflineRootProps
extends React.HTMLAttributes<HTMLDivElement> {
export interface BannerOfflineRootProps extends React.HTMLAttributes<HTMLDivElement> {
variant?: "default";
text?: React.ReactNode;
className?: string;
}
const BannerOfflineRoot = React.forwardRef<
HTMLDivElement,
BannerOfflineRootProps
>(function BannerOfflineRoot(
{
variant = "default",
text,
className,
...otherProps
}: BannerOfflineRootProps,
const BannerOfflineRoot = React.forwardRef<HTMLDivElement, BannerOfflineRootProps>(function BannerOfflineRoot(
{ variant: _variant = "default", text, className, ...otherProps }: BannerOfflineRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center gap-2 border-b border-solid border-border-warning-solid bg-surface-feedback-subtle-warning px-4 py-3",
"border-border-warning-solid bg-surface-feedback-subtle-warning flex w-full items-center gap-2 border-b border-solid px-4 py-3",
className
)}
ref={ref}
@@ -38,9 +29,10 @@ const BannerOfflineRoot = React.forwardRef<
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxjaXJjbGUgY3g9IjIiIGN5PSIyIiByPSIyIiBmaWxsPSIjOUI1RTBEIi8+PC9zdmc+"
alt=""
/>
{text ? (
<span className="grow shrink-0 basis-0 whitespace-pre-wrap text-body-default-regular-0 font-body-default-regular-0 text-text-feedback-warning">
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-feedback-warning shrink-0 grow basis-0 whitespace-pre-wrap">
{text}
</span>
) : null}
@@ -6,7 +6,6 @@
import React from "react";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export type CalendarRootProps = React.ComponentProps<
typeof SubframeCore.Calendar
@@ -17,6 +17,7 @@ export interface CardRootProps extends React.HTMLAttributes<HTMLDivElement> {
| "positive"
| "warning"
| "negative";
contentOverflow?: "default" | "wrap";
className?: string;
}
@@ -26,6 +27,7 @@ const CardRoot = React.forwardRef<HTMLDivElement, CardRootProps>(
children,
size = "medium",
variant = "default",
contentOverflow = "default",
className,
...otherProps
}: CardRootProps,
@@ -36,6 +38,7 @@ const CardRoot = React.forwardRef<HTMLDivElement, CardRootProps>(
className={SubframeUtils.twClassNames(
"group/56067c50 flex w-full flex-col items-start gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-4 py-4 shadow-sm",
{
"min-w-0 [overflow-wrap:anywhere]": contentOverflow === "wrap",
"border border-solid border-border-negative-subtle bg-surface-feedback-subtle-negative":
variant === "negative",
"border border-solid border-border-warning-subtle bg-surface-feedback-subtle-warning":
@@ -14,6 +14,8 @@ export interface CardImageRootProps
outlined?: boolean;
layout?: "horizontal" | "vertical";
hideImage?: boolean;
image?: string;
imageAlt?: string;
title?: React.ReactNode;
body?: React.ReactNode;
className?: string;
@@ -25,6 +27,8 @@ const CardImageRoot = React.forwardRef<HTMLDivElement, CardImageRootProps>(
outlined = false,
layout = "horizontal",
hideImage = false,
image = "/images/placeholder.svg",
imageAlt = "",
title,
body,
className,
@@ -51,7 +55,8 @@ const CardImageRoot = React.forwardRef<HTMLDivElement, CardImageRootProps>(
"h-40 w-40 flex-none object-cover",
{ hidden: hideImage }
)}
src="https://res.cloudinary.com/subframe/image/upload/v1711417507/shared/y2rsnhq3mex4auk54aye.png"
src={image}
alt={imageAlt}
/>
<div className="flex flex-col items-start gap-6">
<div
@@ -0,0 +1,21 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Checkbox } from ".";
describe("Checkbox accessibility wrapper", () => {
it("keeps a hidden string label as the checkbox accessible name", () => {
render(<Checkbox hideLabel label="Accept privacy policy" />);
expect(screen.getByRole("checkbox", { name: "Accept privacy policy" })).toBeInTheDocument();
});
it("preserves an explicit accessible name", () => {
render(<Checkbox hideLabel label="Privacy" aria-label="Accept privacy policy" />);
expect(screen.getByRole("checkbox", { name: "Accept privacy policy" })).toBeInTheDocument();
});
});
@@ -1,5 +1,7 @@
"use client";
import { Checkbox as CheckboxComponent } from "./Checkbox";
import React from "react";
import { Checkbox as CheckboxComponent, type CheckboxRootProps } from "./Checkbox";
/**
* Add wrapper components and business logic here.
@@ -7,4 +9,8 @@ import { Checkbox as CheckboxComponent } from "./Checkbox";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const Checkbox = CheckboxComponent;
export const Checkbox = React.forwardRef<HTMLButtonElement, CheckboxRootProps>(function Checkbox(props, ref) {
const accessibleLabel =
props["aria-label"] ?? (props["aria-labelledby"] ? undefined : props.hideLabel && typeof props.label === "string" ? props.label : undefined);
return <CheckboxComponent {...props} aria-label={accessibleLabel} ref={ref} />;
});
@@ -261,7 +261,9 @@ const ComboboxRoot = React.forwardRef<HTMLDivElement, ComboboxRootProps>(
>
<input
className={SubframeUtils.twClassNames(
"h-6 min-w-[64px] grow shrink-0 basis-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle",
// Reset against @tailwindcss/forms: the trigger already draws
// the field, a second border inside it reads as two controls.
"subframe-text-input-control h-6 min-w-[64px] grow shrink-0 basis-0 border-none bg-transparent px-0 py-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle",
{ hidden: hasValue, "text-text-neutral-disabled": disabled }
)}
placeholder={placeholder}
@@ -0,0 +1,22 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { ContextMenu } from ".";
describe("ContextMenu motion", () => {
it("applies the global open and close animation contract", () => {
const { container } = render(<ContextMenu>Menu content</ContextMenu>);
const menu = container.firstElementChild;
expect(menu).toHaveClass(
"data-[state=open]:animate-in",
"data-[state=closed]:animate-out",
"data-[state=open]:zoom-in-[0.96]",
"data-[state=closed]:zoom-out-[0.98]",
"data-[state=open]:duration-200",
"motion-reduce:animate-none",
);
});
});
@@ -99,7 +99,11 @@ const ContextMenuRoot = React.forwardRef<HTMLDivElement, ContextMenuRootProps>(
return children ? (
<div
className={SubframeUtils.twClassNames(
"flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
// Local adjustment: `relative z-50`, same as DropdownMenu. The panel
// opens in a portal whose wrapper has no z-index, so any positioned
// `z-10` in the page (e.g. the ProjectCard price row) paints over the
// open menu.
"relative z-50 flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
className
)}
ref={ref}
@@ -1,5 +1,9 @@
// @subframe/sync-disable
"use client";
import React from "react";
import { ContextMenu as ContextMenuComponent } from "./ContextMenu";
import { CONTEXT_MENU_MOTION_CLASS } from "../../floating-motion";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
@@ -7,4 +11,14 @@ import { ContextMenu as ContextMenuComponent } from "./ContextMenu";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const ContextMenu = ContextMenuComponent;
const ContextMenuRoot = React.forwardRef<
React.ElementRef<typeof ContextMenuComponent>,
React.ComponentProps<typeof ContextMenuComponent>
>(function ContextMenuRoot({ className, ...otherProps }, ref) {
return <ContextMenuComponent className={SubframeUtils.twClassNames(CONTEXT_MENU_MOTION_CLASS, className)} ref={ref} {...otherProps} />;
});
export const ContextMenu = Object.assign(ContextMenuRoot, {
ContextDivider: ContextMenuComponent.ContextDivider,
ContextItem: ContextMenuComponent.ContextItem,
});
@@ -8,64 +8,62 @@
import React from "react";
import { FeatherCopy } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import copy from "copy-to-clipboard";
import * as SubframeUtils from "../../utils";
import { Tooltip } from "../Tooltip";
export interface CopyToClipboardButtonRootProps
extends Omit<
React.ComponentProps<typeof SubframeCore.CopyToClipboard.Root>,
"clipboardText"
> {
export interface CopyToClipboardButtonRootProps extends Omit<React.ComponentProps<typeof SubframeCore.CopyToClipboard.Root>, "clipboardText" | "onCopy"> {
clipboardText?: React.ReactNode;
tooltipText?: React.ReactNode;
icon?: React.ReactNode;
onCopy?: () => void;
onCopy?: (copied: boolean) => void;
className?: string;
}
const CopyToClipboardButtonRoot = React.forwardRef<
HTMLDivElement,
CopyToClipboardButtonRootProps
>(function CopyToClipboardButtonRoot(
{
clipboardText,
tooltipText,
icon = <FeatherCopy />,
className,
...otherProps
}: CopyToClipboardButtonRootProps,
const CopyToClipboardButtonRoot = React.forwardRef<HTMLDivElement, CopyToClipboardButtonRootProps>(function CopyToClipboardButtonRoot(
{ clipboardText, tooltipText, icon = <FeatherCopy />, onCopy, options, className, ...otherProps }: CopyToClipboardButtonRootProps,
ref
) {
const copyValue = () => {
if (typeof clipboardText !== "string") return;
const copied = copy(clipboardText, options);
onCopy?.(copied);
};
return (
<SubframeCore.Tooltip.Provider>
<SubframeCore.Tooltip.Root>
<SubframeCore.Tooltip.Trigger asChild={true}>
<SubframeCore.CopyToClipboard.Root
clipboardText={clipboardText as string}
<div
{...otherProps}
aria-label={otherProps["aria-label"] ?? (typeof tooltipText === "string" ? tooltipText : undefined)}
className={SubframeUtils.twClassNames(
"group/e8c76626 flex h-6 w-6 cursor-pointer flex-col items-center justify-center gap-2 rounded-md hover:bg-[#f5f5f5]",
className
)}
onClick={(event) => {
otherProps.onClick?.(event);
if (!event.defaultPrevented) copyValue();
}}
onKeyDown={(event) => {
otherProps.onKeyDown?.(event);
if (event.defaultPrevented || (event.key !== "Enter" && event.key !== " ")) return;
event.preventDefault();
copyValue();
}}
ref={ref}
role={otherProps.role ?? "button"}
tabIndex={otherProps.tabIndex ?? 0}
>
<div
className={SubframeUtils.twClassNames(
"group/e8c76626 flex h-6 w-6 cursor-pointer flex-col items-center justify-center gap-2 rounded-md hover:bg-[#f5f5f5]",
className
)}
ref={ref}
>
{icon ? (
<SubframeCore.IconWrapper className="font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373] group-hover/e8c76626:text-[#171717]">
{icon}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.CopyToClipboard.Root>
{icon ? (
<SubframeCore.IconWrapper className="font-['Inter'] text-[14px] leading-[20px] font-[400] text-[#737373] group-hover/e8c76626:text-[#171717]">
{icon}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.Tooltip.Trigger>
<SubframeCore.Tooltip.Portal>
<SubframeCore.Tooltip.Content
side="bottom"
align="center"
sideOffset={8}
asChild={true}
>
<SubframeCore.Tooltip.Content side="bottom" align="center" sideOffset={8} asChild={true}>
<Tooltip>{tooltipText}</Tooltip>
</SubframeCore.Tooltip.Content>
</SubframeCore.Tooltip.Portal>
@@ -1,4 +1,11 @@
"use client";
import React from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { SaveToast } from "~/components/notifications/SaveToast";
import { COPY_TOAST_DURATION_MS } from "~/hooks/use-copy-toast";
import { CopyToClipboardButton as CopyToClipboardButtonComponent } from "./CopyToClipboardButton";
/**
@@ -7,4 +14,54 @@ import { CopyToClipboardButton as CopyToClipboardButtonComponent } from "./CopyT
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const CopyToClipboardButton = CopyToClipboardButtonComponent;
type GeneratedProps = React.ComponentProps<typeof CopyToClipboardButtonComponent>;
export type CopyToClipboardButtonProps = Omit<GeneratedProps, "onCopy"> & {
successKey?: string;
errorKey?: string;
onCopy?: (copied: boolean) => void;
};
export const CopyToClipboardButton = React.forwardRef<HTMLDivElement, CopyToClipboardButtonProps>(function CopyToClipboardButton(
{ successKey, errorKey, onCopy, ...props },
ref
) {
const { t } = useTranslation();
return (
<CopyToClipboardButtonComponent
{...props}
ref={ref}
onCopy={(copied) => {
onCopy?.(copied);
if (copied) {
toast.custom(
() => (
<SaveToast
variant="success"
title={t(successKey ?? "shared.copyToast.successTitle", {
defaultValue: t("shared.copyToast.successTitle"),
})}
/>
),
{ duration: COPY_TOAST_DURATION_MS }
);
return;
}
toast.custom(
() => (
<SaveToast
variant="error"
title={t("shared.copyToast.errorTitle")}
description={t(errorKey ?? "shared.copyToast.errorDescription", {
defaultValue: t("shared.copyToast.errorDescription"),
})}
/>
),
{ duration: COPY_TOAST_DURATION_MS }
);
}}
/>
);
});
@@ -505,7 +505,7 @@ const DatePickerRoot = React.forwardRef<HTMLDivElement, DatePickerRootProps>(
value,
month,
year,
boolean = false,
boolean: _boolean = false,
className,
...otherProps
}: DatePickerRootProps,
@@ -0,0 +1,90 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { cleanup, render } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { Description as RadixDialogDescription, Title as RadixDialogTitle } from "@radix-ui/react-dialog";
import { Drawer } from "../Drawer";
import { FullscreenDialog } from "../FullscreenDialog";
import { ModalBlank } from "../ModalBlank";
import { Select } from "../Select";
import { Dialog } from ".";
afterEach(cleanup);
function expectModalLayer() {
const layer = document.querySelector<HTMLElement>('[data-ui-layer="modal"]');
expect(layer).not.toBeNull();
expect(layer).toHaveClass("z-[60]");
return layer!;
}
describe("Subframe modal layering", () => {
it("places dialogs above the app sidebar", () => {
render(
<Dialog open>
<Dialog.Content>Dialog content</Dialog.Content>
</Dialog>,
);
const layer = expectModalLayer();
expect(layer).toHaveClass("bg-black/35", "backdrop-blur-[4px]", "data-[state=open]:duration-300");
expect(document.querySelector('[data-state="open"][role="dialog"]')).toHaveClass(
"data-[state=open]:zoom-in-[0.98]",
"data-[state=open]:slide-in-from-bottom-1",
"motion-reduce:animate-none",
);
});
it("uses the same modal layer for blank modals, drawers and fullscreen dialogs", () => {
const { unmount: unmountModal } = render(
<ModalBlank open>
<ModalBlank.Content>Modal content</ModalBlank.Content>
</ModalBlank>,
);
expectModalLayer();
unmountModal();
const { unmount: unmountDrawer } = render(
<Drawer open>
<Drawer.Content>Drawer content</Drawer.Content>
</Drawer>,
);
const drawerLayer = expectModalLayer();
expect(drawerLayer).toHaveClass("hg-drawer-backdrop", "backdrop-blur-[4px]");
expect(drawerLayer).not.toHaveClass("data-[state=closed]:fade-out-0");
expect(document.querySelector('[data-state="open"][role="dialog"]')).toHaveClass(
"data-[state=open]:slide-in-from-right",
"data-[state=closed]:slide-out-to-right",
"data-[state=open]:duration-[360ms]",
"motion-reduce:animate-none",
);
unmountDrawer();
render(
<FullscreenDialog open>
<div>
<RadixDialogTitle className="sr-only">Fullscreen title</RadixDialogTitle>
<RadixDialogDescription className="sr-only">Fullscreen description</RadixDialogDescription>
Fullscreen content
</div>
</FullscreenDialog>,
);
expectModalLayer();
});
it("keeps portalled select menus above an open modal", () => {
render(
<Dialog open>
<Dialog.Content>
<Select open value="one" onValueChange={() => undefined}>
<Select.Item value="one">One</Select.Item>
</Select>
</Dialog.Content>
</Dialog>,
);
const floatingLayer = document.querySelector<HTMLElement>('[data-ui-layer="modal-floating"]');
expect(floatingLayer).not.toBeNull();
expect(floatingLayer).toHaveClass("z-[70]");
});
});
@@ -1,5 +1,10 @@
// @subframe/sync-disable
"use client";
import React from "react";
import { Dialog as DialogComponent } from "./Dialog";
import { MODAL_LAYER_CLASS } from "../../layers";
import { MODAL_CONTENT_MOTION_CLASS, MODAL_OVERLAY_MOTION_CLASS } from "../../modal-motion";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
@@ -7,4 +12,27 @@ import { Dialog as DialogComponent } from "./Dialog";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const Dialog = DialogComponent;
const DialogRoot = React.forwardRef<
React.ElementRef<typeof DialogComponent>,
React.ComponentProps<typeof DialogComponent>
>(function DialogRoot({ className, ...otherProps }, ref) {
return (
<DialogComponent
className={SubframeUtils.twClassNames(MODAL_LAYER_CLASS, MODAL_OVERLAY_MOTION_CLASS, className)}
data-ui-layer="modal"
ref={ref}
{...otherProps}
/>
);
});
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogComponent.Content>,
React.ComponentProps<typeof DialogComponent.Content>
>(function DialogContent({ className, ...otherProps }, ref) {
return <DialogComponent.Content className={SubframeUtils.twClassNames(MODAL_CONTENT_MOTION_CLASS, className)} ref={ref} {...otherProps} />;
});
export const Dialog = Object.assign(DialogRoot, {
Content: DialogContent,
});
@@ -1,5 +1,10 @@
// @subframe/sync-disable
"use client";
import React from "react";
import { Drawer as DrawerComponent } from "./Drawer";
import { MODAL_LAYER_CLASS } from "../../layers";
import { DRAWER_CONTENT_FULL_FROM_RIGHT_MOTION_CLASS, DRAWER_CONTENT_MOTION_CLASS, DRAWER_OVERLAY_MOTION_CLASS } from "../../modal-motion";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
@@ -7,4 +12,36 @@ import { Drawer as DrawerComponent } from "./Drawer";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const Drawer = DrawerComponent;
const DrawerRoot = React.forwardRef<
React.ElementRef<typeof DrawerComponent>,
React.ComponentProps<typeof DrawerComponent>
>(function DrawerRoot({ className, ...otherProps }, ref) {
return (
<DrawerComponent
className={SubframeUtils.twClassNames(MODAL_LAYER_CLASS, DRAWER_OVERLAY_MOTION_CLASS, className)}
data-ui-layer="modal"
ref={ref}
{...otherProps}
/>
);
});
const DrawerContent = React.forwardRef<
React.ElementRef<typeof DrawerComponent.Content>,
React.ComponentProps<typeof DrawerComponent.Content> & { motionDirection?: "from-right" | "full-from-right" }
>(function DrawerContent({ className, motionDirection = "from-right", ...otherProps }, ref) {
return (
<DrawerComponent.Content
className={SubframeUtils.twClassNames(
motionDirection === "full-from-right" ? DRAWER_CONTENT_FULL_FROM_RIGHT_MOTION_CLASS : DRAWER_CONTENT_MOTION_CLASS,
className
)}
ref={ref}
{...otherProps}
/>
);
});
export const Drawer = Object.assign(DrawerRoot, {
Content: DrawerContent,
});
@@ -14,33 +14,22 @@ import * as SubframeUtils from "../../utils";
import { Accordion } from "../Accordion";
import { Avatar } from "../Avatar";
export interface DropdownDividerProps
extends React.HTMLAttributes<HTMLDivElement> {
export interface DropdownDividerProps extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const DropdownDivider = React.forwardRef<HTMLDivElement, DropdownDividerProps>(
function DropdownDivider(
{ className, ...otherProps }: DropdownDividerProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-start gap-2 px-1 py-1",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-border-default" />
</div>
);
}
);
const DropdownDivider = React.forwardRef<HTMLDivElement, DropdownDividerProps>(function DropdownDivider(
{ className, ...otherProps }: DropdownDividerProps,
ref
) {
return (
<div className={SubframeUtils.twClassNames("flex w-full items-start gap-2 px-1 py-1", className)} ref={ref} {...otherProps}>
<div className="bg-border-default flex h-px shrink-0 grow basis-0 flex-col items-center gap-2" />
</div>
);
});
export interface DropdownItemProps
extends React.ComponentProps<typeof SubframeCore.DropdownMenu.Item> {
export interface DropdownItemProps extends React.ComponentProps<typeof SubframeCore.DropdownMenu.Item> {
children?: React.ReactNode;
icon?: React.ReactNode;
iconRight?: React.ReactNode;
@@ -50,124 +39,92 @@ export interface DropdownItemProps
className?: string;
}
const DropdownItem = React.forwardRef<HTMLDivElement, DropdownItemProps>(
function DropdownItem(
{
children,
icon = null,
iconRight = null,
image,
selected = false,
showCheckbox = false,
className,
...otherProps
}: DropdownItemProps,
ref
) {
return (
<SubframeCore.DropdownMenu.Item asChild={true} {...otherProps}>
const DropdownItem = React.forwardRef<HTMLDivElement, DropdownItemProps>(function DropdownItem(
{ children, icon = null, iconRight = null, image, selected = false, showCheckbox = false, className, ...otherProps }: DropdownItemProps,
ref
) {
return (
<SubframeCore.DropdownMenu.Item asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"group/adcae8d6 group/dropdown-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active": selected,
},
className
)}
ref={ref}
>
<div
className={SubframeUtils.twClassNames(
"group/adcae8d6 flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2 group/dropdown-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
"border-border-strong bg-surface-neutral-secondary hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
flex: showCheckbox,
"border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default border-2 border-solid": selected,
}
)}
ref={ref}
>
<div
<FeatherCheck
className={SubframeUtils.twClassNames("text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid hidden", {
"inline-flex": selected,
})}
/>
</div>
{image ? <img className="rounded-round h-6 w-6 flex-none object-cover" src={image} alt="" /> : null}
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames("text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary", {
"text-icon-neutral-primary": selected,
})}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{children ? (
<span
className={SubframeUtils.twClassNames(
"hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid border-border-strong bg-surface-neutral-secondary",
{
flex: showCheckbox,
"border-2 border-solid border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default":
selected,
}
"text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-tertiary line-clamp-1 shrink-0 grow basis-0",
{ "text-text-neutral-primary": selected }
)}
>
<FeatherCheck
className={SubframeUtils.twClassNames(
"hidden text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid",
{ "inline-flex": selected }
)}
/>
</div>
{image ? (
<img
className="h-6 w-6 flex-none rounded-round object-cover"
src={image}
/>
) : null}
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{children ? (
<span
className={SubframeUtils.twClassNames(
"line-clamp-1 grow shrink-0 basis-0 text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-tertiary",
{ "text-text-neutral-primary": selected }
)}
>
{children}
</span>
) : null}
{iconRight ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{iconRight}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.DropdownMenu.Item>
);
}
);
{children}
</span>
) : null}
{iconRight ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames("text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary", {
"text-icon-neutral-primary": selected,
})}
>
{iconRight}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.DropdownMenu.Item>
);
});
export interface DropdownUserItemProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
export interface DropdownUserItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
title?: React.ReactNode;
subtitle?: React.ReactNode;
image?: string;
/** Avatar fallback shown when no image is set. */
initials?: React.ReactNode;
selected?: boolean;
showCheckbox?: boolean;
className?: string;
}
const DropdownUserItem = React.forwardRef<
HTMLDivElement,
DropdownUserItemProps
>(function DropdownUserItem(
{
title,
subtitle,
image,
selected = false,
showCheckbox = false,
className,
...otherProps
}: DropdownUserItemProps,
const DropdownUserItem = React.forwardRef<HTMLDivElement, DropdownUserItemProps>(function DropdownUserItem(
{ title, subtitle, image, initials, selected = false, showCheckbox = false, className, ...otherProps }: DropdownUserItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/0d3c57ad flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2 group/user-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
"group/0d3c57ad group/user-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active": selected,
},
className
)}
@@ -176,106 +133,78 @@ const DropdownUserItem = React.forwardRef<
>
<div
className={SubframeUtils.twClassNames(
"hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid border-border-strong bg-surface-neutral-secondary",
"border-border-strong bg-surface-neutral-secondary hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid",
{
flex: showCheckbox,
"border-2 border-solid border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default":
selected,
"border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default border-2 border-solid": selected,
}
)}
>
<FeatherCheck
className={SubframeUtils.twClassNames(
"hidden text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid",
{ "inline-flex": selected }
)}
className={SubframeUtils.twClassNames("text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid hidden", {
"inline-flex": selected,
})}
/>
</div>
<Avatar size="small" image={image}>
OR
{initials}
</Avatar>
<div className="flex grow shrink-0 basis-0 flex-col items-start">
{title ? (
<span className="line-clamp-1 w-full text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{title}
</span>
) : null}
<div className="flex shrink-0 grow basis-0 flex-col items-start">
{title ? <span className="text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary line-clamp-1 w-full">{title}</span> : null}
{subtitle ? (
<span className="line-clamp-1 w-full text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary">
{subtitle}
</span>
<span className="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary line-clamp-1 w-full">{subtitle}</span>
) : null}
</div>
</div>
);
});
export interface DropdownCustomItemProps
extends React.HTMLAttributes<HTMLDivElement> {
export interface DropdownCustomItemProps extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
className?: string;
}
const DropdownCustomItem = React.forwardRef<
HTMLDivElement,
DropdownCustomItemProps
>(function DropdownCustomItem(
const DropdownCustomItem = React.forwardRef<HTMLDivElement, DropdownCustomItemProps>(function DropdownCustomItem(
{ children, className, ...otherProps }: DropdownCustomItemProps,
ref
) {
return children ? (
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start gap-2 rounded-md px-3 py-2",
className
)}
ref={ref}
{...otherProps}
>
<div className={SubframeUtils.twClassNames("flex w-full flex-col items-start gap-2 rounded-md px-3 py-2", className)} ref={ref} {...otherProps}>
{children}
</div>
) : null;
});
export interface DropdownNestedItemProps
extends React.ComponentProps<typeof Accordion> {
export interface DropdownNestedItemProps extends React.ComponentProps<typeof Accordion> {
children?: React.ReactNode;
label?: React.ReactNode;
icon?: React.ReactNode;
className?: string;
}
const DropdownNestedItem = React.forwardRef<
React.ElementRef<typeof Accordion>,
DropdownNestedItemProps
>(function DropdownNestedItem(
{
children,
label,
icon = <FeatherLayers />,
className,
...otherProps
}: DropdownNestedItemProps,
const DropdownNestedItem = React.forwardRef<React.ElementRef<typeof Accordion>, DropdownNestedItemProps>(function DropdownNestedItem(
{ children, label, icon = <FeatherLayers />, className, ...otherProps }: DropdownNestedItemProps,
ref
) {
return (
<Accordion
className={SubframeUtils.twClassNames(
"group/ca3b20a3 cursor-pointer group/nested-item",
className
)}
className={SubframeUtils.twClassNames("group/ca3b20a3 group/nested-item cursor-pointer", className)}
variant="ghost"
role="none"
triggerRole="menuitem"
// @subframe/sync-disable -- local fix: group-hover/ca3b20a3 -> hover on the
// trigger row. The group is the whole accordion, so hovering an item in the
// expanded submenu also lit up the trigger above it — two highlighted rows at
// once. Only the trigger itself should react to its own hover.
trigger={
<div className="flex h-8 w-full flex-none items-center gap-2 rounded-md px-3 group-hover/ca3b20a3:bg-surface-neutral-tertiary">
<div className="hover:bg-surface-neutral-tertiary flex h-8 w-full flex-none items-center gap-2 rounded-md px-3">
{icon ? (
<SubframeCore.IconWrapper className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-primary">
{icon}
</SubframeCore.IconWrapper>
) : null}
{label ? (
<span className="line-clamp-1 grow shrink-0 basis-0 text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{label}
</span>
<span className="text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary line-clamp-1 shrink-0 grow basis-0">{label}</span>
) : null}
<Accordion.Chevron />
</div>
@@ -283,30 +212,27 @@ const DropdownNestedItem = React.forwardRef<
ref={ref}
{...otherProps}
>
{children ? (
<div className="flex w-full flex-col items-start gap-1">{children}</div>
) : null}
{children ? <div className="flex w-full flex-col items-start gap-1">{children}</div> : null}
</Accordion>
);
});
export interface DropdownMenuRootProps
extends React.HTMLAttributes<HTMLDivElement> {
export interface DropdownMenuRootProps extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
className?: string;
}
const DropdownMenuRoot = React.forwardRef<
HTMLDivElement,
DropdownMenuRootProps
>(function DropdownMenuRoot(
const DropdownMenuRoot = React.forwardRef<HTMLDivElement, DropdownMenuRootProps>(function DropdownMenuRoot(
{ children, className, ...otherProps }: DropdownMenuRootProps,
ref
) {
return children ? (
<div
className={SubframeUtils.twClassNames(
"flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
// Local adjustment: `relative z-50`. The panel opens in a portal whose
// wrapper has no z-index, so any positioned `z-10` in the page (e.g. the
// ProjectCard price row) paints over the open menu.
"border-border-default bg-surface-neutral-secondary relative z-50 flex min-w-[192px] flex-col items-start rounded-md border border-solid px-1 py-1 shadow-lg",
className
)}
ref={ref}
@@ -0,0 +1,407 @@
"use client";
// Synced from Subframe ("Dropdown Menu multi select", 2026-07-21) for WF-P8 S01.
//
// Two deliberate local deviations, both reported to David — the export renders
// a multi-select that cannot express selection or survive a click:
// 1. The item checkboxes are hardcoded unselected. Here they follow the
// `selected` prop, so a checked facet option actually reads as checked.
// 2. `DropdownItem` wraps a Radix `DropdownMenu.Item`, which closes the menu
// on select. A multi-select must stay open, so the default `onSelect`
// preventsDefault; a caller that wants the closing behaviour back passes
// its own `onSelect`.
import React from "react";
import { FeatherLayers } from "@subframe/core";
import { FeatherSearch } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
import { Accordion } from "../Accordion";
import { Avatar } from "../Avatar";
import { Checkbox } from "../Checkbox";
export interface DropdownDividerProps
extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const DropdownDivider = React.forwardRef<HTMLDivElement, DropdownDividerProps>(
function DropdownDivider(
{ className, ...otherProps }: DropdownDividerProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-start gap-2 px-1 py-1",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-border-default" />
</div>
);
}
);
export interface DropdownItemProps
extends React.ComponentProps<typeof SubframeCore.DropdownMenu.Item> {
children?: React.ReactNode;
icon?: React.ReactNode;
iconRight?: React.ReactNode;
image?: string;
selected?: boolean;
showCheckbox?: boolean;
className?: string;
}
const DropdownItem = React.forwardRef<HTMLDivElement, DropdownItemProps>(
function DropdownItem(
{
children,
icon = null,
iconRight = null,
image,
selected = false,
showCheckbox = false,
className,
onSelect,
...otherProps
}: DropdownItemProps,
ref
) {
return (
<SubframeCore.DropdownMenu.Item
asChild={true}
// Keep the menu open across selections — see the file header.
onSelect={onSelect ?? ((event) => event.preventDefault())}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"group/744235d7 flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2.5 group/dropdown-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
>
<div
className={SubframeUtils.twClassNames("hidden items-start", {
flex: showCheckbox,
})}
>
<Checkbox
className="h-auto w-auto flex-none self-stretch"
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
</div>
{image ? (
<img
className="h-6 w-6 flex-none rounded-round object-cover"
src={image}
// Decorative: the item's own text already names the option.
alt=""
/>
) : null}
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{children ? (
<span
className={SubframeUtils.twClassNames(
"line-clamp-1 grow shrink-0 basis-0 text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-primary": selected }
)}
>
{children}
</span>
) : null}
{iconRight ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{iconRight}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.DropdownMenu.Item>
);
}
);
export interface DropdownUserItemProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
title?: React.ReactNode;
subtitle?: React.ReactNode;
image?: string;
/** Initials fallback when there is no photo — the export hardcoded "OR". */
initials?: string;
selected?: boolean;
showCheckbox?: boolean;
className?: string;
}
const DropdownUserItem = React.forwardRef<
HTMLDivElement,
DropdownUserItemProps
>(function DropdownUserItem(
{
title,
subtitle,
image,
initials,
selected = false,
showCheckbox = false,
className,
...otherProps
}: DropdownUserItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/ad6eaaaf flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2 group/user-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames("hidden items-start", {
flex: showCheckbox,
})}
>
<Checkbox
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
</div>
<Avatar size="small" image={image}>
{initials ?? ""}
</Avatar>
<div className="flex grow shrink-0 basis-0 flex-col items-start">
{title ? (
<span className="line-clamp-1 w-full text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{title}
</span>
) : null}
{subtitle ? (
<span className="line-clamp-1 w-full text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary">
{subtitle}
</span>
) : null}
</div>
</div>
);
});
export interface DropdownCustomItemProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
selected?: boolean;
showCheckbox?: boolean;
size?: "medium" | "small" | "large";
className?: string;
}
const DropdownCustomItem = React.forwardRef<
HTMLDivElement,
DropdownCustomItemProps
>(function DropdownCustomItem(
{
children,
selected = false,
showCheckbox = false,
size = "medium",
className,
...otherProps
}: DropdownCustomItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/e2891f3f flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2.5 hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"px-2.5 py-3": size === "large",
"px-1 py-1": size === "small",
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
{...otherProps}
>
<Checkbox
className={SubframeUtils.twClassNames("hidden", { flex: showCheckbox })}
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
{children ? (
<div className="flex grow shrink-0 basis-0 flex-col items-start">
{children}
</div>
) : null}
</div>
);
});
export interface DropdownNestedItemProps
extends React.ComponentProps<typeof Accordion> {
children?: React.ReactNode;
label?: React.ReactNode;
icon?: React.ReactNode;
className?: string;
}
const DropdownNestedItem = React.forwardRef<
React.ElementRef<typeof Accordion>,
DropdownNestedItemProps
>(function DropdownNestedItem(
{
children,
label,
icon = <FeatherLayers />,
className,
...otherProps
}: DropdownNestedItemProps,
ref
) {
return (
<Accordion
className={SubframeUtils.twClassNames(
"group/e3a3cd0a cursor-pointer group/nested-item",
className
)}
variant="ghost"
trigger={
<div className="flex h-8 w-full flex-none items-center gap-2 rounded-md px-3 group-hover/e3a3cd0a:bg-surface-neutral-tertiary">
{icon ? (
<SubframeCore.IconWrapper className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-primary">
{icon}
</SubframeCore.IconWrapper>
) : null}
{label ? (
<span className="line-clamp-1 grow shrink-0 basis-0 text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{label}
</span>
) : null}
<Accordion.Chevron />
</div>
}
ref={ref}
{...otherProps}
>
{children ? (
<div className="flex w-full flex-col items-start gap-1">{children}</div>
) : null}
</Accordion>
);
});
export interface DropdownMenuMultiSelectRootProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
showSearch?: boolean;
/** Controlled search term — the export shipped a dead, hardcoded input. */
searchValue?: string;
searchPlaceholder?: string;
onSearchChange?: (value: string) => void;
className?: string;
}
const DropdownMenuMultiSelectRoot = React.forwardRef<
HTMLDivElement,
DropdownMenuMultiSelectRootProps
>(function DropdownMenuMultiSelectRoot(
{
children,
showSearch = false,
searchValue,
searchPlaceholder,
onSearchChange,
className,
...otherProps
}: DropdownMenuMultiSelectRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
// Local adjustment: `relative z-50`. The panel opens in a portal whose
// wrapper has no z-index, so any positioned `z-10` in the page (e.g. the
// ProjectCard price row) paints over the open menu.
"group/8c9fd450 relative z-50 flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"hidden w-full flex-col items-start gap-1 pb-1",
{ flex: showSearch }
)}
>
<div className="flex w-full items-center gap-2 rounded-sm bg-surface-neutral-tertiary px-2 py-1.5">
<FeatherSearch className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary" />
<input
// Reset against @tailwindcss/forms, which would otherwise draw a
// border and a white fill inside the tinted search row.
className="subframe-text-input-control min-w-[0px] grow shrink-0 basis-0 self-stretch border-none bg-transparent px-0 py-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle"
placeholder={searchPlaceholder}
value={searchValue ?? ""}
onChange={(event) => onSearchChange?.(event.target.value)}
type="search"
/>
</div>
<div className="flex h-px w-full flex-none flex-col items-center gap-2 bg-border-default" />
</div>
{children ? (
<div className="flex w-full flex-col items-start gap-0.5">
{children}
</div>
) : null}
</div>
);
});
export const DropdownMenuMultiSelect = Object.assign(
DropdownMenuMultiSelectRoot,
{
DropdownDivider,
DropdownItem,
DropdownUserItem,
DropdownCustomItem,
DropdownNestedItem,
}
);
@@ -0,0 +1,10 @@
"use client";
import { DropdownMenuMultiSelect as DropdownMenuMultiSelectComponent } from "./DropdownMenuMultiSelect";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const DropdownMenuMultiSelect = DropdownMenuMultiSelectComponent;
@@ -0,0 +1,404 @@
"use client";
// Synced from Subframe ("Dropdown Menu select", 2026-07-21) for WF-P8 S02/S05.
//
// The searchable single-select counterpart of DropdownMenuMultiSelect: `Select`
// has no search and the multi-select has the wrong cardinality.
//
// The same two export defects as the multi-select apply here and are fixed the
// same way, both reported to David:
// 1. The search input is dead markup — hardcoded `value=""`, no handler and a
// hardcoded German placeholder. It is a controlled input here, and the
// placeholder is a prop so the caller supplies a translated string.
// 2. The item checkboxes are hardcoded unselected. Here they follow the
// `selected` prop, so a chosen option reads as chosen.
//
// Unlike the multi-select, `DropdownItem` keeps the Radix close-on-select
// behaviour: picking the one value is the end of the interaction.
import React from "react";
import { FeatherLayers } from "@subframe/core";
import { FeatherSearch } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
import { Accordion } from "../Accordion";
import { Avatar } from "../Avatar";
import { Checkbox } from "../Checkbox";
export interface DropdownDividerProps
extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const DropdownDivider = React.forwardRef<HTMLDivElement, DropdownDividerProps>(
function DropdownDivider(
{ className, ...otherProps }: DropdownDividerProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-start gap-2 px-1 py-1",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-border-default" />
</div>
);
}
);
export interface DropdownItemProps
extends React.ComponentProps<typeof SubframeCore.DropdownMenu.Item> {
children?: React.ReactNode;
icon?: React.ReactNode;
iconRight?: React.ReactNode;
image?: string;
selected?: boolean;
showCheckbox?: boolean;
className?: string;
}
const DropdownItem = React.forwardRef<HTMLDivElement, DropdownItemProps>(
function DropdownItem(
{
children,
icon = null,
iconRight = null,
image,
selected = false,
showCheckbox = false,
className,
...otherProps
}: DropdownItemProps,
ref
) {
return (
<SubframeCore.DropdownMenu.Item asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"group/adcae8d6 flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2.5 group/dropdown-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
>
<div
className={SubframeUtils.twClassNames("hidden items-start", {
flex: showCheckbox,
})}
>
<Checkbox
className="h-auto w-auto flex-none self-stretch"
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
</div>
{image ? (
<img
className="h-6 w-6 flex-none rounded-round object-cover"
src={image}
// Decorative: the item's own text already names the option.
alt=""
/>
) : null}
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{children ? (
<span
className={SubframeUtils.twClassNames(
"line-clamp-1 grow shrink-0 basis-0 text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-primary": selected }
)}
>
{children}
</span>
) : null}
{iconRight ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
>
{iconRight}
</SubframeCore.IconWrapper>
) : null}
</div>
</SubframeCore.DropdownMenu.Item>
);
}
);
export interface DropdownUserItemProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
title?: React.ReactNode;
subtitle?: React.ReactNode;
image?: string;
selected?: boolean;
showCheckbox?: boolean;
/** Avatar fallback initials; the export hardcoded "OR". */
initials?: string;
className?: string;
}
const DropdownUserItem = React.forwardRef<
HTMLDivElement,
DropdownUserItemProps
>(function DropdownUserItem(
{
title,
subtitle,
image,
selected = false,
showCheckbox = false,
initials,
className,
...otherProps
}: DropdownUserItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/0d3c57ad flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2 group/user-item hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames("hidden items-start", {
flex: showCheckbox,
})}
>
<Checkbox
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
</div>
<Avatar size="small" image={image}>
{initials}
</Avatar>
<div className="flex grow shrink-0 basis-0 flex-col items-start">
{title ? (
<span className="line-clamp-1 w-full text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{title}
</span>
) : null}
{subtitle ? (
<span className="line-clamp-1 w-full text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary">
{subtitle}
</span>
) : null}
</div>
</div>
);
});
export interface DropdownCustomItemProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
selected?: boolean;
showCheckbox?: boolean;
size?: "medium" | "small" | "large";
className?: string;
}
const DropdownCustomItem = React.forwardRef<
HTMLDivElement,
DropdownCustomItemProps
>(function DropdownCustomItem(
{
children,
selected = false,
showCheckbox = false,
size = "medium",
className,
...otherProps
}: DropdownCustomItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/4abe03f9 flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-2.5 hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
{
"px-2.5 py-3": size === "large",
"px-1 py-1": size === "small",
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
},
className
)}
ref={ref}
{...otherProps}
>
<Checkbox
className={SubframeUtils.twClassNames("hidden", { flex: showCheckbox })}
label="label"
description="Description"
helpText=""
hideLabel={true}
checked={selected}
/>
{children ? (
<div className="flex grow shrink-0 basis-0 flex-col items-start">
{children}
</div>
) : null}
</div>
);
});
export interface DropdownNestedItemProps
extends React.ComponentProps<typeof Accordion> {
children?: React.ReactNode;
label?: React.ReactNode;
icon?: React.ReactNode;
className?: string;
}
const DropdownNestedItem = React.forwardRef<
React.ElementRef<typeof Accordion>,
DropdownNestedItemProps
>(function DropdownNestedItem(
{
children,
label,
icon = <FeatherLayers />,
className,
...otherProps
}: DropdownNestedItemProps,
ref
) {
return (
<Accordion
className={SubframeUtils.twClassNames(
"group/ca3b20a3 cursor-pointer group/nested-item",
className
)}
variant="ghost"
trigger={
<div className="flex h-8 w-full flex-none items-center gap-2 rounded-md px-3 group-hover/ca3b20a3:bg-surface-neutral-tertiary">
{icon ? (
<SubframeCore.IconWrapper className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-primary">
{icon}
</SubframeCore.IconWrapper>
) : null}
{label ? (
<span className="line-clamp-1 grow shrink-0 basis-0 text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{label}
</span>
) : null}
<Accordion.Chevron />
</div>
}
ref={ref}
{...otherProps}
>
{children ? (
<div className="flex w-full flex-col items-start gap-1">{children}</div>
) : null}
</Accordion>
);
});
export interface DropdownMenuSelectRootProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
showSearch?: boolean;
/** Controlled search term — the export shipped a dead, hardcoded input. */
searchValue?: string;
searchPlaceholder?: string;
onSearchChange?: (value: string) => void;
className?: string;
}
const DropdownMenuSelectRoot = React.forwardRef<
HTMLDivElement,
DropdownMenuSelectRootProps
>(function DropdownMenuSelectRoot(
{
children,
showSearch = false,
searchValue,
searchPlaceholder,
onSearchChange,
className,
...otherProps
}: DropdownMenuSelectRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
// Local adjustment: `relative z-50`, same as DropdownMenu. The panel
// opens in a portal whose wrapper has no z-index, so any positioned
// `z-10` in the page (e.g. the ProjectCard price row) paints over the
// open menu.
"group/99951515 relative z-50 flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"hidden w-full flex-col items-start gap-1 pb-1",
{ flex: showSearch }
)}
>
<div className="flex w-full items-center gap-2 rounded-sm bg-surface-neutral-tertiary px-2 py-1.5">
<FeatherSearch className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary" />
<input
// Reset against @tailwindcss/forms, which would otherwise draw a
// border and a white fill inside the tinted search row.
className="subframe-text-input-control min-w-[0px] grow shrink-0 basis-0 self-stretch border-none bg-transparent px-0 py-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle"
placeholder={searchPlaceholder}
value={searchValue ?? ""}
onChange={(event) => onSearchChange?.(event.target.value)}
type="search"
/>
</div>
<div className="flex h-px w-full flex-none flex-col items-center gap-2 bg-border-default" />
</div>
{children ? (
<div className="flex w-full flex-col items-start gap-0.5">
{children}
</div>
) : null}
</div>
);
});
export const DropdownMenuSelect = Object.assign(DropdownMenuSelectRoot, {
DropdownDivider,
DropdownItem,
DropdownUserItem,
DropdownCustomItem,
DropdownNestedItem,
});
@@ -0,0 +1,10 @@
"use client";
import { DropdownMenuSelect as DropdownMenuSelectComponent } from "./DropdownMenuSelect";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const DropdownMenuSelect = DropdownMenuSelectComponent;
@@ -7,103 +7,68 @@
import React from "react";
import * as SubframeUtils from "../../utils";
import { Button } from "../Button";
export interface EmptyStateRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
export interface EmptyStateRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
variant?: "default" | "no-results" | "error";
outlined?: boolean;
fillContainer?: boolean;
title?: React.ReactNode;
body?: React.ReactNode;
// Optional call-to-action rendered below the text. When omitted (the default),
// no button is shown. Replaces the previous hard-coded "Create project" button.
action?: React.ReactNode;
className?: string;
}
const EmptyStateRoot = React.forwardRef<HTMLDivElement, EmptyStateRootProps>(
function EmptyStateRoot(
{
variant = "default",
outlined = false,
fillContainer = false,
title,
body,
className,
...otherProps
}: EmptyStateRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/9fcf03a9 flex max-w-[384px] items-center gap-4 px-4 py-8",
{
"max-w-none": fillContainer,
"rounded-md border border-solid border-border-default bg-surface-neutral-primary":
outlined,
},
className
)}
ref={ref}
{...otherProps}
>
<div className="flex flex-col items-center gap-6">
<div className="flex flex-col items-center gap-7">
<img
className={SubframeUtils.twClassNames(
"h-12 w-12 flex-none object-cover",
{ hidden: variant === "error" || variant === "no-results" }
)}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGFzcz0iZmxleC1ub25lIiBkYXRhLW5vZGUtaWQ9IjM3YmE4ZTQ2Ij48cGF0aCBkPSJNMzcuNSAyMVYzNy42NjY3QzM3LjUgMzguMDIwMyAzNy4zNTk1IDM4LjM1OTQgMzcuMTA5NSAzOC42MDk1QzM2Ljg1OTQgMzguODU5NSAzNi41MjAzIDM5IDM2LjE2NjcgMzlINy41QzcuMTAyMTggMzkgNi43MjA2NCAzOC44NDIgNi40MzkzNCAzOC41NjA3QzYuMTU4MDQgMzguMjc5NCA2IDM3Ljg5NzggNiAzNy41VjE2LjVDNiAxNi4xMDIyIDYuMTU4MDQgMTUuNzIwNiA2LjQzOTM0IDE1LjQzOTNDNi43MjA2NCAxNS4xNTggNy4xMDIxOCAxNSA3LjUgMTVIMTZDMTYuMzI0NiAxNSAxNi42NDA0IDE1LjEwNTMgMTYuOSAxNS4zTDIyLjEgMTkuMkMyMi4zNTk2IDE5LjM5NDcgMjIuNjc1NCAxOS41IDIzIDE5LjVIMzZDMzYuMzk3OCAxOS41IDM2Ljc3OTQgMTkuNjU4IDM3LjA2MDcgMTkuOTM5M0MzNy4zNDIgMjAuMjIwNiAzNy41IDIwLjYwMjIgMzcuNSAyMVoiIHN0cm9rZT0iIzg1ODU4OSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZGF0YS1ub2RlLWlkPSI4MzBkNDBlZi05N2E3LTRjMjYtODQwZi0yNDQzMTEwNjYwMjgiPjwvcGF0aD48cGF0aCBkPSJNMTIgMTVWMTAuNUMxMiAxMC4xMDIyIDEyLjE1OCA5LjcyMDY0IDEyLjQzOTMgOS40MzkzNEMxMi43MjA2IDkuMTU4MDQgMTMuMTAyMiA5IDEzLjUgOUgyMkMyMi4zMjQ2IDkgMjIuNjQwNCA5LjEwNTI3IDIyLjkgOS4zTDI4LjEgMTMuMkMyOC4zNTk2IDEzLjM5NDcgMjguNjc1NCAxMy41IDI5IDEzLjVINDJDNDIuMzk3OCAxMy41IDQyLjc3OTQgMTMuNjU4IDQzLjA2MDcgMTMuOTM5M0M0My4zNDIgMTQuMjIwNiA0My41IDE0LjYwMjIgNDMuNSAxNVYzMS42NjY3QzQzLjUgMzEuODQxOCA0My40NjU1IDMyLjAxNTEgNDMuMzk4NSAzMi4xNzY5QzQzLjMzMTUgMzIuMzM4NyA0My4yMzMzIDMyLjQ4NTcgNDMuMTA5NSAzMi42MDk1QzQyLjk4NTcgMzIuNzMzMyA0Mi44Mzg3IDMyLjgzMTUgNDIuNjc2OSAzMi44OTg1QzQyLjUxNTEgMzIuOTY1NSA0Mi4zNDE4IDMzIDQyLjE2NjcgMzNIMzcuNSIgc3Ryb2tlPSIjODU4NTg5IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkYXRhLW5vZGUtaWQ9IjJiZDUxMmE0LWI3YzQtNDg5MS05N2NmLTliNjkyZTc1MTNkMSI+PC9wYXRoPjwvc3ZnPg=="
/>
<img
className={SubframeUtils.twClassNames(
"hidden h-12 w-12 flex-none object-cover",
{ block: variant === "no-results" }
)}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjEuNzUgMzcuNUMzMC40NDg1IDM3LjUgMzcuNSAzMC40NDg1IDM3LjUgMjEuNzVDMzcuNSAxMy4wNTE1IDMwLjQ0ODUgNiAyMS43NSA2QzEzLjA1MTUgNiA2IDEzLjA1MTUgNiAyMS43NUM2IDMwLjQ0ODUgMTMuMDUxNSAzNy41IDIxLjc1IDM3LjVaIiBzdHJva2U9IiM4NTg1ODkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTMyLjg4NjMgMzIuODg2N0w0MS45OTg5IDQxLjk5OTMiIHN0cm9rZT0iIzg1ODU4OSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4="
/>
<img
className={SubframeUtils.twClassNames(
"hidden h-12 w-12 flex-none object-cover",
{ block: variant === "error" }
)}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjQgMTkuNVYyNyIgc3Ryb2tlPSIjQzUyMDIwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yMS40MDM2IDcuNDk3MTNMNC45MDgwNCAzNS45OTU3QzQuNjQ0MDkgMzYuNDUxNyA0LjUwNDg5IDM2Ljk2OTIgNC41MDQ0NiAzNy40OTYxQzQuNTA0MDIgMzguMDIzIDQuNjQyMzYgMzguNTQwNyA0LjkwNTU1IDM4Ljk5NzFDNS4xNjg3NSAzOS40NTM2IDUuNTQ3NTEgMzkuODMyNyA2LjAwMzc0IDQwLjA5NjJDNi40NTk5NyA0MC4zNTk4IDYuOTc3NTcgNDAuNDk4NiA3LjUwNDQ3IDQwLjQ5ODZINDAuNDk1NkM0MS4wMjI0IDQwLjQ5ODYgNDEuNTQgNDAuMzU5OCA0MS45OTYzIDQwLjA5NjJDNDIuNDUyNSAzOS44MzI3IDQyLjgzMTMgMzkuNDUzNiA0My4wOTQ1IDM4Ljk5NzFDNDMuMzU3NyAzOC41NDA3IDQzLjQ5NiAzOC4wMjMgNDMuNDk1NiAzNy40OTYxQzQzLjQ5NTEgMzYuOTY5MiA0My4zNTU5IDM2LjQ1MTcgNDMuMDkyIDM1Ljk5NTdMMjYuNTk2NCA3LjQ5NzEzQzI2LjMzMjkgNy4wNDE4NSAyNS45NTQzIDYuNjYzODcgMjUuNDk4NiA2LjQwMTFDMjUuMDQyOSA2LjEzODMyIDI0LjUyNjEgNiAyNCA2QzIzLjQ3NCA2IDIyLjk1NzIgNi4xMzgzMiAyMi41MDE0IDYuNDAxMUMyMi4wNDU3IDYuNjYzODcgMjEuNjY3MSA3LjA0MTg1IDIxLjQwMzYgNy40OTcxM1Y3LjQ5NzEzWiIgc3Ryb2tlPSIjQzUyMDIwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yNCAzNS42MjVDMjUuMDM1NSAzNS42MjUgMjUuODc1IDM0Ljc4NTUgMjUuODc1IDMzLjc1QzI1Ljg3NSAzMi43MTQ1IDI1LjAzNTUgMzEuODc1IDI0IDMxLjg3NUMyMi45NjQ1IDMxLjg3NSAyMi4xMjUgMzIuNzE0NSAyMi4xMjUgMzMuNzVDMjIuMTI1IDM0Ljc4NTUgMjIuOTY0NSAzNS42MjUgMjQgMzUuNjI1WiIgZmlsbD0iI0M1MjAyMCIvPjwvc3ZnPg=="
/>
<div className="flex w-full flex-col items-center gap-4 px-4">
{title ? (
<span className="w-full text-body-large-0 font-body-large-0 text-text-neutral-primary text-center">
{title}
</span>
) : null}
{body ? (
<span className="break-words text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary text-center">
{body}
</span>
) : null}
</div>
<Button
className={SubframeUtils.twClassNames("h-9 w-36 flex-none", {
"w-28": variant === "error" || variant === "no-results",
})}
variant={
variant === "error"
? "tertiary"
: variant === "no-results"
? "tertiary"
: undefined
}
>
{variant === "error"
? "Try again"
: variant === "no-results"
? "Clear filters"
: "Create project"}
</Button>
const EmptyStateRoot = React.forwardRef<HTMLDivElement, EmptyStateRootProps>(function EmptyStateRoot(
{ variant = "default", outlined = false, fillContainer = false, title, body, action, className, ...otherProps }: EmptyStateRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
// Local mod (HiveGrid): center the empty state within its container by
// default. The root was max-w-[384px] with the flex default justify-start,
// so the box hugged the left edge of the content area. Now the root spans
// the width and centers; the 384px reading width moves onto the inner
// column so body text still wraps. Re-check this on the next ~/ui sync.
"group/9fcf03a9 flex w-full items-center justify-center gap-4 px-4 py-8",
{
"border-border-default bg-surface-neutral-primary rounded-md border border-solid": outlined,
},
className
)}
ref={ref}
{...otherProps}
>
<div className={SubframeUtils.twClassNames("flex w-full max-w-[384px] flex-col items-center gap-6", { "max-w-none": fillContainer })}>
<div className="flex flex-col items-center gap-7">
<img
className={SubframeUtils.twClassNames("h-12 w-12 flex-none object-cover", { hidden: variant === "error" || variant === "no-results" })}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGFzcz0iZmxleC1ub25lIiBkYXRhLW5vZGUtaWQ9IjM3YmE4ZTQ2Ij48cGF0aCBkPSJNMzcuNSAyMVYzNy42NjY3QzM3LjUgMzguMDIwMyAzNy4zNTk1IDM4LjM1OTQgMzcuMTA5NSAzOC42MDk1QzM2Ljg1OTQgMzguODU5NSAzNi41MjAzIDM5IDM2LjE2NjcgMzlINy41QzcuMTAyMTggMzkgNi43MjA2NCAzOC44NDIgNi40MzkzNCAzOC41NjA3QzYuMTU4MDQgMzguMjc5NCA2IDM3Ljg5NzggNiAzNy41VjE2LjVDNiAxNi4xMDIyIDYuMTU4MDQgMTUuNzIwNiA2LjQzOTM0IDE1LjQzOTNDNi43MjA2NCAxNS4xNTggNy4xMDIxOCAxNSA3LjUgMTVIMTZDMTYuMzI0NiAxNSAxNi42NDA0IDE1LjEwNTMgMTYuOSAxNS4zTDIyLjEgMTkuMkMyMi4zNTk2IDE5LjM5NDcgMjIuNjc1NCAxOS41IDIzIDE5LjVIMzZDMzYuMzk3OCAxOS41IDM2Ljc3OTQgMTkuNjU4IDM3LjA2MDcgMTkuOTM5M0MzNy4zNDIgMjAuMjIwNiAzNy41IDIwLjYwMjIgMzcuNSAyMVoiIHN0cm9rZT0iIzg1ODU4OSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZGF0YS1ub2RlLWlkPSI4MzBkNDBlZi05N2E3LTRjMjYtODQwZi0yNDQzMTEwNjYwMjgiPjwvcGF0aD48cGF0aCBkPSJNMTIgMTVWMTAuNUMxMiAxMC4xMDIyIDEyLjE1OCA5LjcyMDY0IDEyLjQzOTMgOS40MzkzNEMxMi43MjA2IDkuMTU4MDQgMTMuMTAyMiA5IDEzLjUgOUgyMkMyMi4zMjQ2IDkgMjIuNjQwNCA5LjEwNTI3IDIyLjkgOS4zTDI4LjEgMTMuMkMyOC4zNTk2IDEzLjM5NDcgMjguNjc1NCAxMy41IDI5IDEzLjVINDJDNDIuMzk3OCAxMy41IDQyLjc3OTQgMTMuNjU4IDQzLjA2MDcgMTMuOTM5M0M0My4zNDIgMTQuMjIwNiA0My41IDE0LjYwMjIgNDMuNSAxNVYzMS42NjY3QzQzLjUgMzEuODQxOCA0My40NjU1IDMyLjAxNTEgNDMuMzk4NSAzMi4xNzY5QzQzLjMzMTUgMzIuMzM4NyA0My4yMzMzIDMyLjQ4NTcgNDMuMTA5NSAzMi42MDk1QzQyLjk4NTcgMzIuNzMzMyA0Mi44Mzg3IDMyLjgzMTUgNDIuNjc2OSAzMi44OTg1QzQyLjUxNTEgMzIuOTY1NSA0Mi4zNDE4IDMzIDQyLjE2NjcgMzNIMzcuNSIgc3Ryb2tlPSIjODU4NTg5IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkYXRhLW5vZGUtaWQ9IjJiZDUxMmE0LWI3YzQtNDg5MS05N2NmLTliNjkyZTc1MTNkMSI+PC9wYXRoPjwvc3ZnPg=="
alt=""
/>
<img
className={SubframeUtils.twClassNames("hidden h-12 w-12 flex-none object-cover", { block: variant === "no-results" })}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjEuNzUgMzcuNUMzMC40NDg1IDM3LjUgMzcuNSAzMC40NDg1IDM3LjUgMjEuNzVDMzcuNSAxMy4wNTE1IDMwLjQ0ODUgNiAyMS43NSA2QzEzLjA1MTUgNiA2IDEzLjA1MTUgNiAyMS43NUM2IDMwLjQ0ODUgMTMuMDUxNSAzNy41IDIxLjc1IDM3LjVaIiBzdHJva2U9IiM4NTg1ODkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTMyLjg4NjMgMzIuODg2N0w0MS45OTg5IDQxLjk5OTMiIHN0cm9rZT0iIzg1ODU4OSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4="
alt=""
/>
<img
className={SubframeUtils.twClassNames("hidden h-12 w-12 flex-none object-cover", { block: variant === "error" })}
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjQgMTkuNVYyNyIgc3Ryb2tlPSIjQzUyMDIwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yMS40MDM2IDcuNDk3MTNMNC45MDgwNCAzNS45OTU3QzQuNjQ0MDkgMzYuNDUxNyA0LjUwNDg5IDM2Ljk2OTIgNC41MDQ0NiAzNy40OTYxQzQuNTA0MDIgMzguMDIzIDQuNjQyMzYgMzguNTQwNyA0LjkwNTU1IDM4Ljk5NzFDNS4xNjg3NSAzOS40NTM2IDUuNTQ3NTEgMzkuODMyNyA2LjAwMzc0IDQwLjA5NjJDNi40NTk5NyA0MC4zNTk4IDYuOTc3NTcgNDAuNDk4NiA3LjUwNDQ3IDQwLjQ5ODZINDAuNDk1NkM0MS4wMjI0IDQwLjQ5ODYgNDEuNTQgNDAuMzU5OCA0MS45OTYzIDQwLjA5NjJDNDIuNDUyNSAzOS44MzI3IDQyLjgzMTMgMzkuNDUzNiA0My4wOTQ1IDM4Ljk5NzFDNDMuMzU3NyAzOC41NDA3IDQzLjQ5NiAzOC4wMjMgNDMuNDk1NiAzNy40OTYxQzQzLjQ5NTEgMzYuOTY5MiA0My4zNTU5IDM2LjQ1MTcgNDMuMDkyIDM1Ljk5NTdMMjYuNTk2NCA3LjQ5NzEzQzI2LjMzMjkgNy4wNDE4NSAyNS45NTQzIDYuNjYzODcgMjUuNDk4NiA2LjQwMTFDMjUuMDQyOSA2LjEzODMyIDI0LjUyNjEgNiAyNCA2QzIzLjQ3NCA2IDIyLjk1NzIgNi4xMzgzMiAyMi41MDE0IDYuNDAxMUMyMi4wNDU3IDYuNjYzODcgMjEuNjY3MSA3LjA0MTg1IDIxLjQwMzYgNy40OTcxM1Y3LjQ5NzEzWiIgc3Ryb2tlPSIjQzUyMDIwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yNCAzNS42MjVDMjUuMDM1NSAzNS42MjUgMjUuODc1IDM0Ljc4NTUgMjUuODc1IDMzLjc1QzI1Ljg3NSAzMi43MTQ1IDI1LjAzNTUgMzEuODc1IDI0IDMxLjg3NUMyMi45NjQ1IDMxLjg3NSAyMi4xMjUgMzIuNzE0NSAyMi4xMjUgMzMuNzVDMjIuMTI1IDM0Ljc4NTUgMjIuOTY0NSAzNS42MjUgMjQgMzUuNjI1WiIgZmlsbD0iI0M1MjAyMCIvPjwvc3ZnPg=="
alt=""
/>
<div className="flex w-full flex-col items-center gap-4 px-4">
{title ? <span className="text-body-large-0 font-body-large-0 text-text-neutral-primary w-full text-center">{title}</span> : null}
{body ? (
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary text-center break-words">{body}</span>
) : null}
</div>
{action ? <div className="flex flex-none items-center gap-2">{action}</div> : null}
</div>
</div>
);
}
);
</div>
);
});
export const EmptyState = EmptyStateRoot;
@@ -0,0 +1,25 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { EmptyState } from "./index";
describe("EmptyState wrapper", () => {
it("renders the action slot button", () => {
render(<EmptyState title="Nothing here" body="Add something" action={<button type="button">Create</button>} />);
expect(screen.getByRole("button", { name: "Create" })).toBeInTheDocument();
});
// Regression guard: the wrapper once merged `[&_button]:hidden` into the root
// (a workaround for a since-removed hardcoded CTA in the synced component),
// which display:none'd every action button screens pass in.
it("does not hide descendant buttons via a blanket class", () => {
const { container } = render(<EmptyState title="Nothing here" action={<button type="button">Create</button>} />);
expect(container.innerHTML).not.toContain("[&_button]:hidden");
});
it("still forwards a caller-provided className", () => {
const { container } = render(<EmptyState title="Nothing here" className="custom-class" />);
expect(container.firstElementChild).toHaveClass("custom-class");
});
});
@@ -1,20 +1,18 @@
"use client";
import React from "react";
import { EmptyState as EmptyStateComponent, type EmptyStateRootProps } from "./EmptyState";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*
* Wrapper rationale (2026-07-07, R-P5 verification): the synced Subframe
* component always renders a hardcoded, non-wired english CTA ("Create
* project" / "Try again" / "Clear filters") - no onClick, no i18n (violates
* DoD B10/E23). Until the design-system component gets a proper action slot
* (design-nachzug), the wrapper hides that dead internal button; screens render
* their own translated action next to the EmptyState.
* History: this wrapper used to add `[&_button]:hidden` to suppress the synced
* component's hardcoded, non-wired english CTA ("Create project"). The synced
* component has since gained a proper `action` slot and no hardcoded button,
* so the class only hid the real action buttons screens pass in (create/retry
* CTAs). Do not re-add a blanket button-hiding class here.
*/
export const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateRootProps>(function EmptyState({ className, ...props }, ref) {
return <EmptyStateComponent ref={ref} className={SubframeUtils.twClassNames("[&_button]:hidden", className)} {...props} />;
export const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateRootProps>(function EmptyState(props, ref) {
return <EmptyStateComponent ref={ref} {...props} />;
});
@@ -9,8 +9,7 @@ import React from "react";
import * as SubframeUtils from "../../utils";
import { Button } from "../Button";
export interface ErrorStateRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
export interface ErrorStateRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
variant?: "inline" | "full-width";
hideCancel?: boolean;
title?: React.ReactNode;
@@ -20,62 +19,45 @@ export interface ErrorStateRootProps
className?: string;
}
const ErrorStateRoot = React.forwardRef<HTMLDivElement, ErrorStateRootProps>(
function ErrorStateRoot(
{
variant = "inline",
hideCancel = false,
title,
description,
retryLabel,
cancelLabel,
className,
...otherProps
}: ErrorStateRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/07f75db5 flex min-w-[192px] max-w-[576px] flex-col items-start gap-2 rounded-md border-2 border-solid border-border-negative-solid bg-surface-feedback-subtle-negative px-4 py-4 shadow-sm group/error-state",
{ "w-full min-w-0 max-w-none": variant === "full-width" },
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-full flex-col items-start gap-6">
<div className="flex w-full items-center gap-2">
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
/>
{title ? (
<span className="grow shrink-0 basis-0 whitespace-pre-wrap text-body-default-medium-0 font-body-default-medium-0 text-text-feedback-negative">
{title}
</span>
) : null}
</div>
<div className="flex flex-col items-start gap-6 pl-3">
{description ? (
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
{description}
</span>
) : null}
<div className="flex items-center gap-2">
<Button variant="tertiary">{retryLabel}</Button>
<Button
className={SubframeUtils.twClassNames({ hidden: hideCancel })}
variant="ghost"
>
{cancelLabel}
</Button>
</div>
const ErrorStateRoot = React.forwardRef<HTMLDivElement, ErrorStateRootProps>(function ErrorStateRoot(
{ variant = "inline", hideCancel = false, title, description, retryLabel, cancelLabel, className, ...otherProps }: ErrorStateRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/07f75db5 border-border-negative-solid bg-surface-feedback-subtle-negative group/error-state flex max-w-[576px] min-w-[192px] flex-col items-start gap-2 rounded-md border-2 border-solid px-4 py-4 shadow-sm",
{ "w-full max-w-none min-w-0": variant === "full-width" },
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-full flex-col items-start gap-6">
<div className="flex w-full items-center gap-2">
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
alt=""
/>
{title ? (
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-feedback-negative shrink-0 grow basis-0 whitespace-pre-wrap">
{title}
</span>
) : null}
</div>
<div className="flex flex-col items-start gap-6 pl-3">
{description ? <span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">{description}</span> : null}
<div className="flex items-center gap-2">
<Button variant="tertiary">{retryLabel}</Button>
<Button className={SubframeUtils.twClassNames({ hidden: hideCancel })} variant="ghost">
{cancelLabel}
</Button>
</div>
</div>
</div>
);
}
);
</div>
);
});
export const ErrorState = ErrorStateRoot;
@@ -33,7 +33,7 @@ const FileUploadRoot = React.forwardRef<HTMLDivElement, FileUploadRootProps>(
state = "default",
filename,
fileSize,
uploadProgress = 60,
uploadProgress: _uploadProgress = 60,
progressText,
errorMessage,
browseLabel,
@@ -0,0 +1,251 @@
"use client";
// Synced from Subframe ("Filter Bar", 2026-07-28) for WF-P8 S01.
//
// Deliberate local deviations, reported to David — the export ships the two
// interactive controls of the bar as dead markup:
// 1. The free-text input is hardcoded to `value=""` with no handler. Here it
// is controlled via `searchValue`/`onSearchChange`.
// 2. The "Zurücksetzen" pill is a plain div with no callback. Here it takes
// `onReset` and a translatable `resetLabel`, and is a real <button> so it
// is keyboard-reachable.
// Both labels come in as props so no German string is baked into the kit.
import React from "react";
import { FeatherBriefcase } from "@subframe/core";
import { FeatherChevronDown } from "@subframe/core";
import { FeatherRotateCcw } from "@subframe/core";
import { FeatherSearch } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface StatusFilterButtonProps
extends React.HTMLAttributes<HTMLDivElement> {
icon?: React.ReactNode;
label?: React.ReactNode;
showCount?: boolean;
count?: React.ReactNode;
dropdown?: React.ReactNode;
className?: string;
}
const StatusFilterButton = React.forwardRef<
HTMLDivElement,
StatusFilterButtonProps
>(function StatusFilterButton(
{
icon = <FeatherBriefcase />,
label,
showCount = false,
count,
dropdown,
className,
...otherProps
}: StatusFilterButtonProps,
ref
) {
return (
<SubframeCore.DropdownMenu.Root>
<SubframeCore.DropdownMenu.Trigger asChild={true}>
<div
className={SubframeUtils.twClassNames(
"group/4ad576dd flex h-6 cursor-pointer items-center gap-0.5 rounded-md border border-solid border-border-default pl-1 pr-0.5 py-1 hover:bg-surface-neutral-tertiary focus-within:shadow-focus",
{
"border border-solid border-brand-brand-secondary-border-subtle-default bg-surface-feedback-subtle-information-hover pl-px hover:border hover:border-solid hover:border-brand-brand-secondary-border-subtle-hover hover:bg-surface-feedback-subtle-information-hover active:border active:border-solid active:border-brand-brand-secondary-border-subtle-active active:bg-surface-feedback-subtle-information-active focus-within:border focus-within:border-solid focus-within:border-brand-brand-secondary-border-subtle-hover":
showCount,
},
className
)}
ref={ref}
{...otherProps}
>
<div className="flex items-center gap-1">
<div
className={SubframeUtils.twClassNames(
"hidden h-5 grow shrink-0 basis-0 items-center gap-1 rounded-sm bg-surface-neutral-secondary px-1.5 py-0.5",
{ flex: showCount }
)}
>
<div className="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-neutral-primary" />
{count ? (
<span className="text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-primary">
{count}
</span>
) : null}
</div>
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-default-regular-150 font-body-default-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": showCount }
)}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{label ? (
<span
className={SubframeUtils.twClassNames(
"text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-primary": showCount }
)}
>
{label}
</span>
) : null}
</div>
<div className="flex items-center pt-px">
<FeatherChevronDown
className={SubframeUtils.twClassNames(
"text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": showCount }
)}
/>
</div>
</div>
</SubframeCore.DropdownMenu.Trigger>
<SubframeCore.DropdownMenu.Portal>
<SubframeCore.DropdownMenu.Content
side="bottom"
align="start"
sideOffset={4}
asChild={true}
>
{dropdown ? (
<div className="items-start contents">{dropdown}</div>
) : null}
</SubframeCore.DropdownMenu.Content>
</SubframeCore.DropdownMenu.Portal>
</SubframeCore.DropdownMenu.Root>
);
});
export interface FilterBarRootProps
extends React.HTMLAttributes<HTMLDivElement> {
hideSearch?: boolean;
showActiveFilters?: boolean;
children?: React.ReactNode;
activeFilters?: React.ReactNode;
/** Controlled free-text term — the export shipped a dead input. */
searchValue?: string;
searchPlaceholder?: string;
/** data-ui-id of the free-text input, so screens stay addressable in tests. */
searchUiId?: string;
searchSubmitUiId?: string;
searchSubmitLabel?: string;
onSearchChange?: (value: string) => void;
/** Commit the server-backed search; typing alone never navigates. */
onSearchSubmit?: () => void;
/** Reset pill. Rendered only when a handler is supplied. */
onReset?: () => void;
resetLabel?: React.ReactNode;
className?: string;
}
const FilterBarRoot = React.forwardRef<HTMLDivElement, FilterBarRootProps>(
function FilterBarRoot(
{
hideSearch = false,
showActiveFilters = false,
children,
activeFilters,
searchValue,
searchPlaceholder,
searchUiId,
searchSubmitUiId,
searchSubmitLabel,
onSearchChange,
onSearchSubmit,
onReset,
resetLabel,
className,
...otherProps
}: FilterBarRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/f2cf6974 flex w-full flex-col items-start gap-2 rounded-md bg-surface-neutral-secondary px-3 py-2",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-full flex-wrap items-center gap-1">
<div
className={SubframeUtils.twClassNames("flex items-center gap-1.5", {
hidden: hideSearch,
})}
>
{onSearchSubmit ? (
<button
type="button"
className="inline-flex size-6 flex-none items-center justify-center rounded-md text-icon-neutral-tertiary transition-colors hover:bg-surface-neutral-tertiary hover:text-icon-neutral-secondary focus-visible:shadow-focus focus-visible:outline-none"
aria-label={searchSubmitLabel}
data-ui-id={searchSubmitUiId}
onClick={onSearchSubmit}
>
<FeatherSearch className="text-body-small-regular-150 font-body-small-regular-150" />
</button>
) : (
<FeatherSearch className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary" />
)}
<input
// The reset is not cosmetic: @tailwindcss/forms gives every bare
// <input> a border, a white fill and 8px/12px padding, which turns
// this borderless search into a form control that fights the
// bordered facet buttons beside it. Same reset TextInput carries.
className="subframe-text-input-control w-40 flex-none border-none bg-transparent px-0 py-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle"
placeholder={searchPlaceholder}
value={searchValue ?? ""}
onChange={(event) => onSearchChange?.(event.target.value)}
onKeyDown={(event) => {
if (event.key !== "Enter") return;
event.preventDefault();
onSearchSubmit?.();
}}
data-ui-id={searchUiId}
type="text"
/>
</div>
<div
className={SubframeUtils.twClassNames(
"flex h-5 w-px flex-none items-start bg-border-default",
{ hidden: hideSearch }
)}
/>
{children ? (
<div className="items-start contents">{children}</div>
) : null}
</div>
<div
className={SubframeUtils.twClassNames(
"hidden w-full flex-wrap items-center gap-1.5 border-t border-solid border-border-default pt-2",
{ flex: showActiveFilters }
)}
>
{activeFilters ? (
<div className="items-start contents">{activeFilters}</div>
) : null}
{onReset ? (
<button
type="button"
onClick={onReset}
className="flex h-6 items-center gap-1 rounded-md border border-solid border-border-negative-subtle bg-surface-feedback-subtle-negative px-1.5 py-1 cursor-pointer hover:bg-surface-feedback-subtle-negative-hover active:bg-surface-feedback-subtle-negative-active focus-within:shadow-focus"
>
<FeatherRotateCcw className="text-body-small-regular-150 font-body-small-regular-150 text-icon-feedback-negative" />
<span className="whitespace-nowrap text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative">
{resetLabel}
</span>
</button>
) : null}
</div>
</div>
);
}
);
export const FilterBar = Object.assign(FilterBarRoot, {
StatusFilterButton,
});
@@ -0,0 +1,10 @@
"use client";
import { FilterBar as FilterBarComponent } from "./FilterBar";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const FilterBar = FilterBarComponent;
@@ -7,46 +7,26 @@
import React from "react";
import * as SubframeUtils from "../../utils";
export interface FormSaveRetryRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
export interface FormSaveRetryRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
variant?: "default";
title?: React.ReactNode;
children?: React.ReactNode;
className?: string;
}
const FormSaveRetryRoot = React.forwardRef<
HTMLDivElement,
FormSaveRetryRootProps
>(function FormSaveRetryRoot(
{
variant = "default",
title,
children,
className,
...otherProps
}: FormSaveRetryRootProps,
const FormSaveRetryRoot = React.forwardRef<HTMLDivElement, FormSaveRetryRootProps>(function FormSaveRetryRoot(
{ variant: _variant = "default", title, children, className, ...otherProps }: FormSaveRetryRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex max-w-[576px] flex-col items-start gap-2 px-4 py-4",
className
)}
ref={ref}
{...otherProps}
>
<div className={SubframeUtils.twClassNames("flex max-w-[576px] flex-col items-start gap-2 px-4 py-4", className)} ref={ref} {...otherProps}>
<div className="flex w-full items-center gap-2">
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
alt=""
/>
{children ? (
<div className="flex grow shrink-0 basis-0 items-center gap-2">
{children}
</div>
) : null}
{children ? <div className="flex shrink-0 grow basis-0 items-center gap-2">{children}</div> : null}
</div>
</div>
);
@@ -1,5 +1,9 @@
// @subframe/sync-disable
"use client";
import React from "react";
import { FullscreenDialog as FullscreenDialogComponent } from "./FullscreenDialog";
import { MODAL_LAYER_CLASS } from "../../layers";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
@@ -7,4 +11,16 @@ import { FullscreenDialog as FullscreenDialogComponent } from "./FullscreenDialo
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const FullscreenDialog = FullscreenDialogComponent;
export const FullscreenDialog = React.forwardRef<
React.ElementRef<typeof FullscreenDialogComponent>,
React.ComponentProps<typeof FullscreenDialogComponent>
>(function FullscreenDialog({ className, ...otherProps }, ref) {
return (
<FullscreenDialogComponent
className={SubframeUtils.twClassNames(MODAL_LAYER_CLASS, className)}
data-ui-layer="modal"
ref={ref}
{...otherProps}
/>
);
});
@@ -134,7 +134,7 @@ const HeaderNavigationRoot = React.forwardRef<
<DropdownMenu.DropdownUserItem
title="Olivia Rhye"
subtitle="olivia@untitledui.com"
image="https://res.cloudinary.com/subframe/image/upload/v1711417513/shared/kwut7rhuyivweg8tmyzl.jpg"
image=""
/>
<DropdownMenu.DropdownDivider />
<DropdownMenu.DropdownItem
@@ -154,22 +154,22 @@ const HeaderNavigationRoot = React.forwardRef<
<DropdownMenu.DropdownUserItem
title="Olivia Rhye"
subtitle="olivia@untitledui.com"
image="https://res.cloudinary.com/subframe/image/upload/v1711417513/shared/kwut7rhuyivweg8tmyzl.jpg"
image=""
/>
<DropdownMenu.DropdownUserItem
title="Olivia Rhye"
subtitle="olivia@untitledui.com"
image="https://res.cloudinary.com/subframe/image/upload/v1711417514/shared/ubsk7cs5hnnaj798efej.jpg"
image=""
/>
<DropdownMenu.DropdownUserItem
title="Olivia Rhye"
subtitle="olivia@untitledui.com"
image="https://res.cloudinary.com/subframe/image/upload/v1711417512/shared/m0kfajqpwkfief00it4v.jpg"
image=""
/>
<DropdownMenu.DropdownUserItem
title="Olivia Rhye"
subtitle="olivia@untitledui.com"
image="https://res.cloudinary.com/subframe/image/upload/v1711417512/shared/btvntvzhdbhpulae3kzk.jpg"
image=""
/>
</DropdownMenu.DropdownNestedItem>
</DropdownMenu>
@@ -22,7 +22,7 @@ const HelpCircleRoot = React.forwardRef<HTMLDivElement, HelpCircleRootProps>(
{
icon = <FeatherHelpCircle />,
size = "medium",
shape = "default",
shape: _shape = "default",
className,
...otherProps
}: HelpCircleRootProps,
@@ -1,34 +1,52 @@
"use client";
/*
* Documentation:
* Icon — https://app.subframe.com/f023064a5ca0/library?component=Icon_e24ec5dc-9821-430d-8254-1d72a7d46218
* KanbanCard — https://app.subframe.com/f023064a5ca0/library?component=KanbanCard_27235bcb-e61b-4880-9ae6-3f12d290a434
*/
import React from "react";
import { FeatherFlag } from "@subframe/core";
import { FeatherLock } from "@subframe/core";
import * as SubframeUtils from "../../utils";
import { Icon } from "../Icon";
export interface KanbanCardRootProps
extends React.HTMLAttributes<HTMLDivElement> {
name?: React.ReactNode;
price?: React.ReactNode;
topRow?: React.ReactNode;
progress?: React.ReactNode;
bottomStack?: React.ReactNode;
hideProgress?: boolean;
hideFooter?: boolean;
tagsSlot?: React.ReactNode;
hideTags?: boolean;
titleSlot?: React.ReactNode;
valueSlot?: React.ReactNode;
priceLocked?: boolean;
lockedValueSlot?: React.ReactNode;
footerLeftSlot?: React.ReactNode;
footerRightSlot?: React.ReactNode;
flagVariant?:
| "primary"
| "secondary"
| "tertiary"
| "destructive"
| "neutral"
| "success"
| "warning"
| "information";
keepTagRowSpace?: boolean;
className?: string;
}
const KanbanCardRoot = React.forwardRef<HTMLDivElement, KanbanCardRootProps>(
function KanbanCardRoot(
{
name,
price,
topRow,
progress,
bottomStack,
hideProgress = false,
hideFooter = false,
tagsSlot,
hideTags = false,
titleSlot,
valueSlot,
priceLocked = false,
lockedValueSlot,
footerLeftSlot,
footerRightSlot,
flagVariant = "primary",
keepTagRowSpace = false,
className,
...otherProps
}: KanbanCardRootProps,
@@ -37,55 +55,84 @@ const KanbanCardRoot = React.forwardRef<HTMLDivElement, KanbanCardRootProps>(
return (
<div
className={SubframeUtils.twClassNames(
"group/27235bcb flex flex-col items-start gap-3",
"group/27235bcb flex w-full min-w-[0px] flex-col items-start gap-3 max-w-full",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-72 flex-col items-start gap-4 rounded-lg border border-solid border-border-default bg-surface-neutral-secondary px-3 py-3 shadow-sm">
{topRow ? (
<div className="flex w-full items-center justify-between">
{topRow}
<div className="flex w-full min-w-[0px] flex-col items-start gap-4 rounded-lg border border-solid border-border-default bg-surface-neutral-secondary px-3 py-3 shadow-sm relative max-w-full">
<Icon
className="absolute top-3 right-3"
variant={
flagVariant === "information"
? "information"
: flagVariant === "warning"
? "warning"
: flagVariant === "success"
? "success"
: flagVariant === "neutral"
? "neutral"
: flagVariant === "destructive"
? "destructive"
: flagVariant === "tertiary"
? "tertiary"
: flagVariant === "secondary"
? "secondary"
: "primary"
}
icon={<FeatherFlag />}
/>
{tagsSlot ? (
<div
className={SubframeUtils.twClassNames(
"flex w-full min-w-[0px] flex-wrap items-center gap-1.5 pr-7 grow",
{ hidden: hideTags }
)}
>
{tagsSlot}
</div>
) : null}
<div className="flex w-full flex-col items-start justify-center gap-2">
{name ? (
<span className="w-full text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
{name}
</span>
) : null}
</div>
<div className="flex w-full items-center gap-2">
<div className="flex flex-col items-start gap-2">
{price ? (
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
{price}
</span>
) : null}
<div
className={SubframeUtils.twClassNames(
"hidden h-5 w-full min-w-[0px] flex-none flex-wrap items-center gap-1.5 pr-7",
{ flex: keepTagRowSpace }
)}
/>
{titleSlot ? (
<div className="flex w-full min-w-[0px] flex-col items-start justify-center gap-2 pr-7">
{titleSlot}
</div>
{progress ? (
) : null}
<div className="flex w-full min-w-[0px] flex-wrap items-center gap-2">
{valueSlot ? (
<div
className={SubframeUtils.twClassNames(
"flex grow shrink-0 basis-0 items-start gap-2",
{ hidden: hideProgress }
"flex min-w-[0px] flex-col items-start gap-2",
{ hidden: priceLocked }
)}
>
{progress}
{valueSlot}
</div>
) : null}
{priceLocked && lockedValueSlot ? (
<div className="flex min-w-[0px] items-center gap-1.5">
<FeatherLock className="text-body-small-medium-0 font-body-small-medium-0 text-icon-neutral-tertiary" />
<span className="break-words text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">
{lockedValueSlot}
</span>
</div>
) : null}
</div>
<div className="flex h-0.5 w-full flex-none flex-col items-center gap-2 bg-[#e5e5e5]" />
{bottomStack ? (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center justify-between",
{ hidden: hideFooter }
)}
>
{bottomStack}
</div>
) : null}
<div className="flex h-px w-full flex-none flex-col items-center gap-2 bg-border-default" />
<div className="flex w-full min-w-[0px] flex-wrap items-center justify-between gap-x-2 gap-y-2">
{footerLeftSlot ? (
<div className="flex items-center">{footerLeftSlot}</div>
) : null}
{footerRightSlot ? (
<div className="flex items-center">{footerRightSlot}</div>
) : null}
</div>
</div>
</div>
);
@@ -7,6 +7,7 @@
import React from "react";
import { FeatherChevronsLeft } from "@subframe/core";
import { FeatherChevronsRight } from "@subframe/core";
import { FeatherLock } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
@@ -18,6 +19,18 @@ export interface KanbanColumnRootProps
icon?: React.ReactNode;
badge?: React.ReactNode;
cards?: React.ReactNode;
sumMode?: "visible" | "locked" | "hidden";
lockedSumSlot?: React.ReactNode;
twoColumn?: boolean;
wrapAfter?: number;
/**
* Local adjustment: the export draws the collapsed head with `cursor-pointer`
* and a chevron but wires nothing to it, so a collapsed column could never be
* opened again. With this callback the collapsed head IS the expand control.
*/
onToggleCollapse?: () => void;
/** Accessible name of that expand control — the caller owns the copy. */
expandLabel?: string;
className?: string;
}
@@ -32,16 +45,42 @@ const KanbanColumnRoot = React.forwardRef<
icon = <FeatherChevronsLeft />,
badge,
cards,
sumMode = "hidden",
lockedSumSlot,
twoColumn = false,
wrapAfter = 6,
onToggleCollapse,
expandLabel,
className,
...otherProps
}: KanbanColumnRootProps,
ref
) {
// Only the collapsed head is interactive: expanded, the same row holds the
// kebab menu, and a click target around it would swallow its clicks.
const expandProps =
collapsed && onToggleCollapse
? {
role: "button" as const,
tabIndex: 0,
"aria-label": expandLabel,
onClick: onToggleCollapse,
onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
onToggleCollapse();
}
},
}
: {};
return (
<div
className={SubframeUtils.twClassNames(
"group/bbc08458 flex w-80 flex-col items-center gap-2 rounded-md border-2 border-solid border-border-default bg-surface-neutral-tertiary px-1.5 py-1.5 self-start",
{ "h-full w-12 px-0": collapsed },
"group/bbc08458 flex w-80 flex-col items-center gap-2 rounded-md border-2 border-solid border-border-default bg-surface-neutral-tertiary px-1.5 py-1.5 shrink-0 min-w-80 self-start",
{
"w-[680px] min-w-[680px]": twoColumn,
"h-full w-12 px-0 min-w-12": collapsed,
},
className
)}
ref={ref}
@@ -55,9 +94,14 @@ const KanbanColumnRoot = React.forwardRef<
>
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center justify-between px-1 pt-1.5 pb-1",
{ "flex-col rounded-md py-3 cursor-pointer": collapsed }
"flex w-full items-center justify-between px-1 pt-1.5 pb-1 gap-2",
{
"flex-col rounded-md py-3 cursor-pointer": collapsed,
"hover:bg-surface-neutral-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-200":
collapsed && Boolean(onToggleCollapse),
}
)}
{...expandProps}
>
<FeatherChevronsRight
className={SubframeUtils.twClassNames(
@@ -71,12 +115,12 @@ const KanbanColumnRoot = React.forwardRef<
{ flex: collapsed }
)}
>
<div className="flex h-0.5 w-full flex-none flex-col items-center gap-2 bg-[#e5e5e5]" />
<div className="flex h-0.5 w-full flex-none flex-col items-center gap-2 bg-border-default" />
</div>
{name ? (
<span
className={SubframeUtils.twClassNames(
"hidden text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary [writing-mode:vertical-rl] rotate-180",
"hidden break-words text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary [writing-mode:vertical-rl] rotate-180",
{ inline: collapsed }
)}
>
@@ -84,14 +128,15 @@ const KanbanColumnRoot = React.forwardRef<
</span>
) : null}
<div
className={SubframeUtils.twClassNames("flex items-center gap-2.5", {
"flex-col px-1 py-1": collapsed,
})}
className={SubframeUtils.twClassNames(
"flex min-w-[0px] items-center gap-2.5 grow shrink",
{ "flex-col px-1 py-1": collapsed }
)}
>
{name ? (
<span
className={SubframeUtils.twClassNames(
"text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary",
"min-w-[0px] break-words text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary",
{ hidden: collapsed }
)}
>
@@ -101,8 +146,13 @@ const KanbanColumnRoot = React.forwardRef<
{badge ? (
<div
className={SubframeUtils.twClassNames(
"flex items-center gap-2.5",
{ "px-1 py-2": collapsed }
"flex items-center gap-2.5 shrink-0",
{
// Local adjustment: collapsed, the count reads sideways like
// the stage name above it — horizontally it would either
// widen the 48px rail or clip.
"px-1 py-2 [writing-mode:vertical-rl] rotate-180": collapsed,
}
)}
>
{badge}
@@ -110,12 +160,26 @@ const KanbanColumnRoot = React.forwardRef<
) : null}
</div>
<div
className={SubframeUtils.twClassNames("flex items-center gap-4", {
hidden: collapsed,
})}
className={SubframeUtils.twClassNames(
"flex min-w-[0px] items-center gap-2 shrink-0",
{ hidden: collapsed }
)}
>
{sumMode === "locked" && lockedSumSlot ? (
<div className="flex shrink-0 items-center gap-1">
<FeatherLock className="text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-icon-neutral-subtle" />
<span className="whitespace-nowrap text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-subtle">
{lockedSumSlot}
</span>
</div>
) : null}
{price ? (
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">
<span
className={SubframeUtils.twClassNames(
"hidden break-words text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ inline: sumMode === "visible" }
)}
>
{price}
</span>
) : null}
@@ -127,13 +191,29 @@ const KanbanColumnRoot = React.forwardRef<
</div>
</div>
</div>
<div className="flex h-0.5 w-full flex-none flex-col items-center gap-2 bg-[#e5e5e5]" />
<div
className={SubframeUtils.twClassNames(
"flex h-0.5 w-full flex-none flex-col items-center gap-2 bg-border-default",
{ hidden: collapsed }
)}
/>
{cards ? (
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-center gap-3 pb-2",
{ hidden: collapsed }
{
"min-w-[0px] flex-none items-start grid grid-flow-col grid-rows-6 grid-cols-2 justify-items-stretch mobile:grid-flow-row mobile:grid-rows-none mobile:grid-cols-1":
twoColumn,
hidden: collapsed,
}
)}
// Local adjustment: honor wrapAfter instead of the fixed grid-rows-6
// from the Subframe export (inline style wins over the class).
style={
twoColumn
? { gridTemplateRows: `repeat(${wrapAfter}, min-content)` }
: undefined
}
>
{cards}
</div>
@@ -14,65 +14,53 @@ export interface LogoRootProps extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const LogoRoot = React.forwardRef<HTMLDivElement, LogoRootProps>(
function LogoRoot(
{
size = "28",
showIcon = false,
hideText = false,
className,
...otherProps
}: LogoRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/609493cb flex items-center justify-center gap-3 w-fit",
{
"gap-6": size === "128",
"gap-4": size === "64",
"gap-2": size === "32",
"gap-1": size === "16" || size === "8",
},
className
)}
ref={ref}
{...otherProps}
>
<img
className={SubframeUtils.twClassNames(
"hidden h-7 flex-none object-contain",
{
block: showIcon,
"h-32": size === "128",
"h-16": size === "64",
"h-8": size === "32",
"h-6": size === "24",
"h-4": size === "16",
"h-2": size === "8",
}
)}
src="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_302_142' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='96' height='84'%3E%3Cpath d='M0 0H96V83.12H0V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_302_142)'%3E%3Cpath d='M95.9449 41.52L83.9589 20.76L48.0009 41.52H71.9719L59.9869 62.281H36.0139L24.0279 41.52L36.0139 20.76H83.9589L74.3919 4.188L71.9719 0H24.0279L0.0549316 41.52L24.0279 83.042H71.9719L95.9449 41.52Z' fill='%23F1B729'/%3E%3C/g%3E%3C/svg%3E"
/>
<img
className={SubframeUtils.twClassNames(
"h-7 flex-none object-contain",
{
hidden: hideText,
"h-32": size === "128",
"h-16": size === "64",
"h-8": size === "32",
"h-6": size === "24",
"h-4": size === "16",
"h-2": size === "8",
}
)}
src="data:image/svg+xml,%3Csvg width='243' height='44' viewBox='3.4 3.6 243 44' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='123' height='55'%3E%3Cpath d='M122.88 0H0V55H122.88V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_15_21)'%3E%3Cpath d='M3.48022 8.81384H11.1272V22.1967H28.3362V8.81384H35.9831V42.2736H28.3362V28.8803H11.1285V42.2736H3.48022V8.81384Z' fill='%23111111'/%3E%3Cpath d='M42.4373 8.81384H50.0842V42.2736H42.4373V8.81384Z' fill='%23111111'/%3E%3Cpath d='M53.9084 12.6387V8.81519H61.0803L71.1187 34.8656H71.5978L81.6336 8.81519H88.8054V12.6387L76.3755 42.2736H66.3371L53.9084 12.6387Z' fill='%23111111'/%3E%3C/g%3E%3Cmask id='mask1_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='154' y='0' width='93' height='55'%3E%3Cpath d='M246.806 0H154.907V55H246.806V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask1_15_21)'%3E%3Cpath d='M197.555 8.78772H205.202V42.2462H197.555V8.78772Z' fill='%23111111'/%3E%3Cpath d='M211.657 8.78772H236.274C238.663 8.78772 240.575 9.50438 242.01 10.939C243.443 12.3736 244.161 14.286 244.161 16.6749V34.3603C244.161 36.7505 243.444 38.6616 242.01 40.0962C240.575 41.5308 238.663 42.2475 236.274 42.2475H211.657V8.78772ZM233.405 35.5547C235.478 35.5547 236.513 34.5196 236.513 32.4492V18.5873C236.513 16.5143 235.476 15.4791 233.405 15.4791H219.304V35.5547H233.405Z' fill='%23111111'/%3E%3C/g%3E%3Cpath d='M185.126 29.819C186.306 29.5958 187.374 29.1976 188.33 28.6246C189.157 28.1155 189.907 27.3753 190.576 26.4028C191.245 25.429 191.58 24.0988 191.58 22.4109V16.675C191.58 14.2861 190.864 12.3737 189.429 10.9391C187.994 9.50581 186.082 8.78784 183.693 8.78784H159.554V10.5501L168.179 25.5047L159.554 40.4135V42.2463H167.201V28.8948L174.939 28.8791L185.365 42.2463H192.297V38.4228L185.126 29.819ZM183.933 20.4985C183.933 22.5688 182.79 22.1968 180.718 22.1968H167.203V15.478H180.825C182.898 15.478 183.933 16.5144 183.933 18.5861V20.4985Z' fill='%23111111'/%3E%3Cpath d='M118.412 35.5797H100.041V28.8791H114.548L112.566 25.442L114.444 22.1968H100.041V15.5041H118.314L121.075 10.7329V8.81396H92.3943V42.2737H121.075V40.1968L118.412 35.5797Z' fill='%23111111'/%3E%3Cpath d='M165.334 25.3873L159.062 14.5213L140.242 25.3873H152.788L146.516 36.2521H133.968L127.696 25.3873L133.968 14.5213H159.062L154.054 5.84824L152.788 3.65649H127.696L115.15 25.3873L127.696 47.1181H152.788L165.334 25.3873Z' fill='%23F1B729'/%3E%3C/svg%3E"
/>
</div>
);
}
);
const LogoRoot = React.forwardRef<HTMLDivElement, LogoRootProps>(function LogoRoot(
{ size = "28", showIcon = false, hideText = false, className, ...otherProps }: LogoRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/609493cb flex w-fit items-center justify-center gap-3",
{
"gap-6": size === "128",
"gap-4": size === "64",
"gap-2": size === "32",
"gap-1": size === "16" || size === "8",
},
className
)}
ref={ref}
{...otherProps}
>
<img
className={SubframeUtils.twClassNames("hidden h-7 flex-none object-contain", {
block: showIcon,
"h-32": size === "128",
"h-16": size === "64",
"h-8": size === "32",
"h-6": size === "24",
"h-4": size === "16",
"h-2": size === "8",
})}
src="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_302_142' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='96' height='84'%3E%3Cpath d='M0 0H96V83.12H0V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_302_142)'%3E%3Cpath d='M95.9449 41.52L83.9589 20.76L48.0009 41.52H71.9719L59.9869 62.281H36.0139L24.0279 41.52L36.0139 20.76H83.9589L74.3919 4.188L71.9719 0H24.0279L0.0549316 41.52L24.0279 83.042H71.9719L95.9449 41.52Z' fill='%23F1B729'/%3E%3C/g%3E%3C/svg%3E"
alt={hideText ? "HiveGrid" : ""}
/>
<img
className={SubframeUtils.twClassNames("h-7 flex-none object-contain", {
hidden: hideText,
"h-32": size === "128",
"h-16": size === "64",
"h-8": size === "32",
"h-6": size === "24",
"h-4": size === "16",
"h-2": size === "8",
})}
src="data:image/svg+xml,%3Csvg width='243' height='44' viewBox='3.4 3.6 243 44' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='123' height='55'%3E%3Cpath d='M122.88 0H0V55H122.88V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_15_21)'%3E%3Cpath d='M3.48022 8.81384H11.1272V22.1967H28.3362V8.81384H35.9831V42.2736H28.3362V28.8803H11.1285V42.2736H3.48022V8.81384Z' fill='%23111111'/%3E%3Cpath d='M42.4373 8.81384H50.0842V42.2736H42.4373V8.81384Z' fill='%23111111'/%3E%3Cpath d='M53.9084 12.6387V8.81519H61.0803L71.1187 34.8656H71.5978L81.6336 8.81519H88.8054V12.6387L76.3755 42.2736H66.3371L53.9084 12.6387Z' fill='%23111111'/%3E%3C/g%3E%3Cmask id='mask1_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='154' y='0' width='93' height='55'%3E%3Cpath d='M246.806 0H154.907V55H246.806V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask1_15_21)'%3E%3Cpath d='M197.555 8.78772H205.202V42.2462H197.555V8.78772Z' fill='%23111111'/%3E%3Cpath d='M211.657 8.78772H236.274C238.663 8.78772 240.575 9.50438 242.01 10.939C243.443 12.3736 244.161 14.286 244.161 16.6749V34.3603C244.161 36.7505 243.444 38.6616 242.01 40.0962C240.575 41.5308 238.663 42.2475 236.274 42.2475H211.657V8.78772ZM233.405 35.5547C235.478 35.5547 236.513 34.5196 236.513 32.4492V18.5873C236.513 16.5143 235.476 15.4791 233.405 15.4791H219.304V35.5547H233.405Z' fill='%23111111'/%3E%3C/g%3E%3Cpath d='M185.126 29.819C186.306 29.5958 187.374 29.1976 188.33 28.6246C189.157 28.1155 189.907 27.3753 190.576 26.4028C191.245 25.429 191.58 24.0988 191.58 22.4109V16.675C191.58 14.2861 190.864 12.3737 189.429 10.9391C187.994 9.50581 186.082 8.78784 183.693 8.78784H159.554V10.5501L168.179 25.5047L159.554 40.4135V42.2463H167.201V28.8948L174.939 28.8791L185.365 42.2463H192.297V38.4228L185.126 29.819ZM183.933 20.4985C183.933 22.5688 182.79 22.1968 180.718 22.1968H167.203V15.478H180.825C182.898 15.478 183.933 16.5144 183.933 18.5861V20.4985Z' fill='%23111111'/%3E%3Cpath d='M118.412 35.5797H100.041V28.8791H114.548L112.566 25.442L114.444 22.1968H100.041V15.5041H118.314L121.075 10.7329V8.81396H92.3943V42.2737H121.075V40.1968L118.412 35.5797Z' fill='%23111111'/%3E%3Cpath d='M165.334 25.3873L159.062 14.5213L140.242 25.3873H152.788L146.516 36.2521H133.968L127.696 25.3873L133.968 14.5213H159.062L154.054 5.84824L152.788 3.65649H127.696L115.15 25.3873L127.696 47.1181H152.788L165.334 25.3873Z' fill='%23F1B729'/%3E%3C/svg%3E"
alt={showIcon ? "" : "HiveGrid"}
/>
</div>
);
});
export const Logo = LogoRoot;
@@ -1,5 +1,9 @@
// @subframe/sync-disable
"use client";
import React from "react";
import { ModalBlank as ModalBlankComponent } from "./ModalBlank";
import { MODAL_LAYER_CLASS } from "../../layers";
import * as SubframeUtils from "../../utils";
/**
* Add wrapper components and business logic here.
@@ -7,4 +11,20 @@ import { ModalBlank as ModalBlankComponent } from "./ModalBlank";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const ModalBlank = ModalBlankComponent;
const ModalBlankRoot = React.forwardRef<
React.ElementRef<typeof ModalBlankComponent>,
React.ComponentProps<typeof ModalBlankComponent>
>(function ModalBlankRoot({ className, ...otherProps }, ref) {
return (
<ModalBlankComponent
className={SubframeUtils.twClassNames(MODAL_LAYER_CLASS, className)}
data-ui-layer="modal"
ref={ref}
{...otherProps}
/>
);
});
export const ModalBlank = Object.assign(ModalBlankRoot, {
Content: ModalBlankComponent.Content,
});
@@ -22,25 +22,15 @@ export interface ItemProps extends React.HTMLAttributes<HTMLDivElement> {
}
const Item = React.forwardRef<HTMLDivElement, ItemProps>(function Item(
{
icon = null,
iconRight = null,
image,
children,
selected = false,
showCheckbox = false,
className,
...otherProps
}: ItemProps,
{ icon = null, iconRight = null, image, children, selected = false, showCheckbox = false, className, ...otherProps }: ItemProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/21b24fdb flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-2 hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary",
"group/21b24fdb hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-2",
{
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active":
selected,
"bg-surface-ui-subtle-blue-default hover:bg-surface-ui-subtle-blue-hover active:bg-surface-ui-subtle-blue-active": selected,
},
className
)}
@@ -49,53 +39,43 @@ const Item = React.forwardRef<HTMLDivElement, ItemProps>(function Item(
>
<div
className={SubframeUtils.twClassNames(
"hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid border-border-strong bg-surface-neutral-secondary",
"border-border-strong bg-surface-neutral-secondary hidden h-4 w-4 flex-none flex-col items-center justify-center rounded-sm border-2 border-solid",
{
flex: showCheckbox,
"border-2 border-solid border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default":
selected,
"border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default border-2 border-solid": selected,
}
)}
>
<FeatherCheck
className={SubframeUtils.twClassNames(
"hidden text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid",
{ "inline-flex": selected }
)}
className={SubframeUtils.twClassNames("text-body-extra-small-semibold-150 font-body-extra-small-semibold-150 text-icon-neutral-on-solid hidden", {
"inline-flex": selected,
})}
/>
</div>
{image ? (
<img
className="h-6 w-6 flex-none rounded-round object-cover"
src={image}
/>
) : null}
{image ? <img className="rounded-round h-6 w-6 flex-none object-cover" src={image} alt="" /> : null}
{icon ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
className={SubframeUtils.twClassNames("text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary", {
"text-icon-neutral-primary": selected,
})}
>
{icon}
</SubframeCore.IconWrapper>
) : null}
{children ? (
<span
className={SubframeUtils.twClassNames(
"grow shrink-0 basis-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-primary": selected }
)}
className={SubframeUtils.twClassNames("text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-tertiary shrink-0 grow basis-0", {
"text-text-neutral-primary": selected,
})}
>
{children}
</span>
) : null}
{iconRight ? (
<SubframeCore.IconWrapper
className={SubframeUtils.twClassNames(
"text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary",
{ "text-icon-neutral-primary": selected }
)}
className={SubframeUtils.twClassNames("text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary", {
"text-icon-neutral-primary": selected,
})}
>
{iconRight}
</SubframeCore.IconWrapper>
@@ -104,8 +84,7 @@ const Item = React.forwardRef<HTMLDivElement, ItemProps>(function Item(
);
});
export interface MultiSelectRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "placeholder"> {
export interface MultiSelectRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "placeholder"> {
disabled?: boolean;
error?: boolean;
hasValue?: boolean;
@@ -125,160 +104,134 @@ export interface MultiSelectRootProps
className?: string;
}
const MultiSelectRoot = React.forwardRef<HTMLDivElement, MultiSelectRootProps>(
function MultiSelectRoot(
{
disabled = false,
error = false,
hasValue = false,
open = false,
variant = "outline",
borderless = false,
noPadding = false,
size = "medium",
showLabel = false,
label,
helpText,
value,
placeholder,
icon = <FeatherUsers />,
children,
errorText,
className,
...otherProps
}: MultiSelectRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/457d3920 flex h-9 w-full min-w-[192px] max-w-[384px] cursor-pointer flex-col items-start gap-4",
{
"h-auto gap-3": showLabel,
"h-12": size === "large",
"h-8": size === "small",
"h-auto": noPadding,
},
className
)}
ref={ref}
{...otherProps}
>
const MultiSelectRoot = React.forwardRef<HTMLDivElement, MultiSelectRootProps>(function MultiSelectRoot(
{
disabled = false,
error = false,
hasValue = false,
open = false,
variant = "outline",
borderless = false,
noPadding = false,
size = "medium",
showLabel = false,
label,
helpText,
value,
placeholder,
icon = <FeatherUsers />,
children,
errorText,
className,
...otherProps
}: MultiSelectRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/457d3920 flex h-9 w-full max-w-[384px] min-w-[192px] cursor-pointer flex-col items-start gap-4",
{
"h-auto gap-3": showLabel,
"h-12": size === "large",
"h-8": size === "small",
"h-auto": noPadding,
},
className
)}
ref={ref}
{...otherProps}
>
<div className={SubframeUtils.twClassNames("hidden flex-col items-start gap-3", { flex: showLabel })}>
{label ? (
<span
className={SubframeUtils.twClassNames("text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary", {
"text-text-feedback-negative": error,
})}
>
{label}
</span>
) : null}
{helpText ? <span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">{helpText}</span> : null}
</div>
<div className="flex w-full shrink-0 grow basis-0 flex-col items-start gap-1 rounded-sm">
<div
className={SubframeUtils.twClassNames(
"hidden flex-col items-start gap-3",
{ flex: showLabel }
"border-border-strong bg-surface-neutral-primary group-hover/457d3920:border-brand-brand-border-solid-hover group-hover/457d3920:bg-surface-neutral-secondary group-focus-within/457d3920:bg-surface-neutral-secondary group-focus-within/457d3920:shadow-focus flex h-9 w-full flex-none flex-col items-start rounded-sm border border-solid group-hover/457d3920:border group-hover/457d3920:border-solid",
{
"h-12": size === "large",
"h-8": size === "small",
"h-auto": noPadding,
// @subframe/sync-disable -- local fix: `borderless` only dropped the hover and focus
// border, so the field showed a border at rest and lost it on hover — the opposite of
// what the prop says. The resting border goes with the other two.
"[&&]:border-none group-focus-within/457d3920:group-focus-within/457d3920:[&&]:border-none group-focus-within/457d3920:group-focus-within/457d3920:group-focus-within/457d3920:[&&]:border-none group-hover/457d3920:group-hover/457d3920:[&&]:border-none group-hover/457d3920:group-hover/457d3920:group-hover/457d3920:[&&]:border-none":
borderless,
"bg-surface-neutral-secondary": variant === "filled",
"border-border-negative-solid group-hover/457d3920:border-border-negative-solid group-focus-within/457d3920:border-border-negative-solid border border-solid group-focus-within/457d3920:border-2 group-focus-within/457d3920:border-solid group-focus-within/457d3920:shadow-none group-hover/457d3920:border group-hover/457d3920:border-solid":
error,
"border-border-disabled bg-surface-neutral-disabled group-hover/457d3920:border-border-disabled group-hover/457d3920:bg-surface-neutral-disabled group-focus-within/457d3920:bg-surface-neutral-disabled border border-solid group-focus-within/457d3920:shadow-none group-hover/457d3920:border group-hover/457d3920:border-solid":
disabled,
}
)}
>
{label ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary",
{ "text-text-feedback-negative": error }
)}
>
{label}
</span>
) : null}
{helpText ? (
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">
{helpText}
</span>
) : null}
</div>
<div className="flex w-full grow shrink-0 basis-0 flex-col items-start gap-1 rounded-sm">
<div
className={SubframeUtils.twClassNames(
"flex h-9 w-full flex-none flex-col items-start rounded-sm border border-solid border-border-strong bg-surface-neutral-primary group-hover/457d3920:border group-hover/457d3920:border-solid group-hover/457d3920:border-brand-brand-border-solid-hover group-hover/457d3920:bg-surface-neutral-secondary group-focus-within/457d3920:bg-surface-neutral-secondary group-focus-within/457d3920:shadow-focus",
{
"h-12": size === "large",
"h-8": size === "small",
"h-auto": noPadding,
"group-hover/457d3920:group-hover/457d3920:[&&]:border-none group-hover/457d3920:group-hover/457d3920:group-hover/457d3920:[&&]:border-none group-focus-within/457d3920:group-focus-within/457d3920:[&&]:border-none group-focus-within/457d3920:group-focus-within/457d3920:group-focus-within/457d3920:[&&]:border-none":
borderless,
"bg-surface-neutral-secondary": variant === "filled",
"border border-solid border-border-negative-solid group-hover/457d3920:border group-hover/457d3920:border-solid group-hover/457d3920:border-border-negative-solid group-focus-within/457d3920:border-2 group-focus-within/457d3920:border-solid group-focus-within/457d3920:border-border-negative-solid group-focus-within/457d3920:shadow-none":
error,
"border border-solid border-border-disabled bg-surface-neutral-disabled group-hover/457d3920:border group-hover/457d3920:border-solid group-hover/457d3920:border-border-disabled group-hover/457d3920:bg-surface-neutral-disabled group-focus-within/457d3920:bg-surface-neutral-disabled group-focus-within/457d3920:shadow-none":
disabled,
}
)}
>
<div
className={SubframeUtils.twClassNames(
"flex w-full grow shrink-0 basis-0 items-center gap-2 px-3 text-left",
{ "px-0 py-0": noPadding }
)}
>
{icon ? (
<SubframeCore.IconWrapper className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-subtle">
{icon}
</SubframeCore.IconWrapper>
) : null}
{value ? (
<span
className={SubframeUtils.twClassNames(
"hidden grow shrink-0 basis-0 whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary",
{
"text-body-small-regular-0 font-body-small-regular-0":
size === "small",
inline: hasValue,
"text-text-neutral-disabled": disabled,
}
)}
>
{value}
</span>
) : null}
{placeholder ? (
<span
className={SubframeUtils.twClassNames(
"grow shrink-0 basis-0 whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-subtle",
{ hidden: hasValue, "text-text-neutral-disabled": disabled }
)}
>
{placeholder}
</span>
) : null}
<FeatherChevronDown
<div className={SubframeUtils.twClassNames("flex w-full shrink-0 grow basis-0 items-center gap-2 px-3 text-left", { "px-0 py-0": noPadding })}>
{icon ? (
<SubframeCore.IconWrapper className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-subtle">
{icon}
</SubframeCore.IconWrapper>
) : null}
{value ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-medium-0 font-body-default-medium-0 text-icon-neutral-tertiary",
"text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary hidden shrink-0 grow basis-0 whitespace-nowrap",
{
"text-body-small-medium-0 font-body-small-medium-0":
size === "small",
"text-icon-neutral-disabled": disabled,
"text-body-small-regular-0 font-body-small-regular-0": size === "small",
inline: hasValue,
"text-text-neutral-disabled": disabled,
}
)}
/>
</div>
</div>
{errorText ? (
<span
className={SubframeUtils.twClassNames(
"hidden text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative",
{ inline: error }
)}
>
{errorText}
</span>
) : null}
<div
className={SubframeUtils.twClassNames(
"hidden w-full flex-col items-start justify-center gap-1 overflow-hidden rounded-sm border border-solid border-border-default bg-surface-neutral-primary px-1 py-1 shadow-md",
{ flex: open }
)}
>
{children ? (
<div className="flex w-full flex-col items-start gap-0.5">
{children}
</div>
>
{value}
</span>
) : null}
{placeholder ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-subtle shrink-0 grow basis-0 whitespace-nowrap",
{ hidden: hasValue, "text-text-neutral-disabled": disabled }
)}
>
{placeholder}
</span>
) : null}
<FeatherChevronDown
className={SubframeUtils.twClassNames("text-body-default-medium-0 font-body-default-medium-0 text-icon-neutral-tertiary", {
"text-body-small-medium-0 font-body-small-medium-0": size === "small",
"text-icon-neutral-disabled": disabled,
})}
/>
</div>
</div>
{errorText ? (
<span
className={SubframeUtils.twClassNames("text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative hidden", { inline: error })}
>
{errorText}
</span>
) : null}
<div
className={SubframeUtils.twClassNames(
"border-border-default bg-surface-neutral-primary hidden w-full flex-col items-start justify-center gap-1 overflow-hidden rounded-sm border border-solid px-1 py-1 shadow-md",
{ flex: open }
)}
>
{children ? <div className="flex w-full flex-col items-start gap-0.5">{children}</div> : null}
</div>
</div>
);
}
);
</div>
);
});
export const MultiSelect = Object.assign(MultiSelectRoot, {
Item,
@@ -0,0 +1,27 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { NumberInput } from "./NumberInput";
describe("NumberInput accessibility", () => {
it("associates its visible label with the spinbutton", () => {
render(
<NumberInput showLabel label="Seats">
<NumberInput.Input name="seats" />
</NumberInput>
);
expect(screen.getByRole("spinbutton", { name: "Seats" })).toBeVisible();
});
it("preserves an explicit accessible name", () => {
render(
<NumberInput showLabel label="Seats">
<NumberInput.Input name="seats" aria-label="Licensed seats" />
</NumberInput>
);
expect(screen.getByRole("spinbutton", { name: "Licensed seats" })).toBeVisible();
});
});
@@ -2,6 +2,13 @@
// so it can be driven controlled (value) OR uncontrolled (defaultValue). The generated
// `value=""` (before {...otherProps}) forced controlled-empty whenever no `value` was
// passed, breaking defaultValue-only call sites (Phase 0 Subframe migration).
// Second local fix (AK-P19): with `showLabel` the root kept its fixed h-9 while label +
// gap + input need ~72px, so the input box overflowed the card below (TextInput already
// uses the flexible-root/fixed-box pattern). With a label the root is now h-auto and the
// input box a fixed h-9 flex item.
// Third local fix (AK-P19): the generated stepper chevrons were purely decorative. They
// now call stepUp()/stepDown() on the contained input and emit a native `input` event so
// React onChange handlers fire.
"use client";
/*
* Documentation:
@@ -113,6 +120,21 @@ const NumberInputRoot = React.forwardRef<HTMLDivElement, NumberInputRootProps>(
}: NumberInputRootProps,
ref
) {
const boxRef = React.useRef<HTMLDivElement>(null);
const generatedLabelId = React.useId();
const inputLabelId = showLabel && label ? generatedLabelId : undefined;
// Steps the contained native number input and notifies React listeners.
const stepBy = (direction: "up" | "down") => {
if (disabled) return;
const input = boxRef.current?.querySelector("input");
if (!input || input.disabled || input.readOnly) return;
if (direction === "up") input.stepUp();
else input.stepDown();
input.dispatchEvent(new Event("input", { bubbles: true }));
input.focus();
};
return (
<div
className={SubframeUtils.twClassNames(
@@ -120,7 +142,7 @@ const NumberInputRoot = React.forwardRef<HTMLDivElement, NumberInputRootProps>(
{
"h-12": size === "large",
"h-8": size === "small",
"h-auto": noPadding,
"h-auto": noPadding || showLabel,
},
className
)}
@@ -135,6 +157,7 @@ const NumberInputRoot = React.forwardRef<HTMLDivElement, NumberInputRootProps>(
>
{label ? (
<span
id={inputLabelId}
className={SubframeUtils.twClassNames(
"text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary",
{
@@ -158,9 +181,13 @@ const NumberInputRoot = React.forwardRef<HTMLDivElement, NumberInputRootProps>(
) : null}
</div>
<div
ref={boxRef}
className={SubframeUtils.twClassNames(
"flex w-full grow shrink-0 basis-0 rounded-sm border border-solid border-border-strong bg-surface-neutral-primary items-stretch group-hover/06ebc0c5:bg-surface-neutral-secondary group-hover/06ebc0c5:border-brand-brand-border-solid-hover group-focus-within/06ebc0c5:bg-surface-neutral-secondary group-focus-within/06ebc0c5:shadow-focus",
{
"h-9 grow-0 shrink-0 basis-auto": showLabel,
"h-8": showLabel && size === "small",
"h-12": showLabel && size === "large",
"flex-none [&_input]:px-0": noPadding,
"[&]:border-none group-hover/06ebc0c5:border-none group-focus-within/06ebc0c5:shadow-none group-focus-within/06ebc0c5:border-none":
borderless,
@@ -179,13 +206,17 @@ const NumberInputRoot = React.forwardRef<HTMLDivElement, NumberInputRootProps>(
{ "[&_input]:px-2.5": size === "small" }
)}
>
{children}
{React.Children.map(children, (child) => {
if (!inputLabelId || !React.isValidElement<InputProps>(child)) return child;
if (child.props["aria-label"] || child.props["aria-labelledby"]) return child;
return React.cloneElement(child, { "aria-labelledby": inputLabelId });
})}
</div>
) : null}
<div className="flex w-9 flex-none flex-col self-stretch overflow-hidden rounded-r-md border-l border-solid border-border-default items-stretch justify-center">
<Stepper className="rounded-none" />
<Stepper className="rounded-none" disabled={disabled} aria-hidden onClick={() => stepBy("up")} />
<div className="flex h-px w-full flex-none flex-col items-center gap-2 bg-border-default" />
<Stepper className="rounded-none" down={true} />
<Stepper className="rounded-none" disabled={disabled} aria-hidden down={true} onClick={() => stepBy("down")} />
</div>
</div>
</div>
@@ -9,23 +9,19 @@ import React from "react";
import * as SubframeUtils from "../../utils";
import { Button } from "../Button";
export interface PartialPageFailureRootProps
extends React.HTMLAttributes<HTMLDivElement> {
export interface PartialPageFailureRootProps extends React.HTMLAttributes<HTMLDivElement> {
variant?: "inline" | "full-width";
className?: string;
}
const PartialPageFailureRoot = React.forwardRef<
HTMLDivElement,
PartialPageFailureRootProps
>(function PartialPageFailureRoot(
const PartialPageFailureRoot = React.forwardRef<HTMLDivElement, PartialPageFailureRootProps>(function PartialPageFailureRoot(
{ variant = "inline", className, ...otherProps }: PartialPageFailureRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/db7ae858 flex max-w-[576px] flex-col items-start gap-2 rounded-md border-2 border-solid border-border-negative-solid bg-surface-feedback-subtle-negative px-4 py-4 shadow-sm",
"group/db7ae858 border-border-negative-solid bg-surface-feedback-subtle-negative flex max-w-[576px] flex-col items-start gap-2 rounded-md border-2 border-solid px-4 py-4 shadow-sm",
{ "max-w-none": variant === "full-width" },
className
)}
@@ -37,8 +33,9 @@ const PartialPageFailureRoot = React.forwardRef<
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
alt=""
/>
<span className="grow shrink-0 basis-0 whitespace-pre-wrap text-body-default-medium-0 font-body-default-medium-0 text-text-feedback-negative">
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-feedback-negative shrink-0 grow basis-0 whitespace-pre-wrap">
{"Failed to load"}
</span>
</div>
@@ -0,0 +1,28 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Progress } from ".";
describe("Progress accessibility wrapper", () => {
it("uses its string label as an accessible-name fallback", () => {
render(<Progress label="Project progress" value={50} />);
expect(screen.getByRole("progressbar", { name: "Project progress" })).toBeInTheDocument();
});
it("preserves explicit aria-label and aria-labelledby contracts", () => {
const { rerender } = render(<Progress aria-label="Explicit progress" label="Visible label" value={50} />);
expect(screen.getByRole("progressbar", { name: "Explicit progress" })).toBeInTheDocument();
rerender(
<>
<span id="external-progress-label">External progress</span>
<Progress aria-labelledby="external-progress-label" label="Visible label" value={50} />
</>
);
const progress = screen.getByRole("progressbar", { name: "External progress" });
expect(progress).not.toHaveAttribute("aria-label");
});
});
@@ -1,5 +1,7 @@
"use client";
import { Progress as ProgressComponent } from "./Progress";
import React from "react";
import { Progress as ProgressComponent, type ProgressRootProps } from "./Progress";
/**
* Add wrapper components and business logic here.
@@ -7,4 +9,12 @@ import { Progress as ProgressComponent } from "./Progress";
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const Progress = ProgressComponent;
const ProgressRoot = React.forwardRef<HTMLDivElement, ProgressRootProps>(function ProgressRoot(props, ref) {
const accessibleLabel =
props["aria-label"] ?? (props["aria-labelledby"] ? undefined : typeof props.label === "string" ? props.label : undefined);
return <ProgressComponent {...props} aria-label={accessibleLabel} ref={ref} />;
});
export const Progress = Object.assign(ProgressRoot, {
Indicator: ProgressComponent.Indicator,
});
@@ -23,7 +23,7 @@ const ProgressCircleRoot = React.forwardRef<
>(function ProgressCircleRoot(
{
state = "default",
value = 30,
value: _value = 30,
statusText,
className,
...otherProps
@@ -0,0 +1,342 @@
"use client";
/*
* Documentation:
* ProjectCard — https://app.subframe.com/f023064a5ca0/library?component=ProjectCard_f82a72d5-da31-4d61-b47b-6b6ebd18ff67
*/
import React from "react";
import { FeatherCalendarClock } from "@subframe/core";
import { FeatherFlag } from "@subframe/core";
import { FeatherPlayCircle } from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface PriorityIndicatorProps
extends React.HTMLAttributes<HTMLDivElement> {
variant?: "none" | "low" | "medium" | "high" | "critical";
className?: string;
}
const PriorityIndicator = React.forwardRef<
HTMLDivElement,
PriorityIndicatorProps
>(function PriorityIndicator(
{ variant = "none", className, ...otherProps }: PriorityIndicatorProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/ba2d0229 flex h-8 items-center gap-0.5 rounded-md border-2 border-solid border-border-default bg-surface-neutral-secondary px-1.5 py-1.5",
{
"border-2 border-solid border-surface-ui-solid-purple-default":
variant === "critical",
"border-2 border-solid border-border-negative-solid":
variant === "high",
"border-2 border-solid border-border-warning-subtle":
variant === "medium",
"border-2 border-solid border-border-positive-subtle":
variant === "low",
},
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"flex h-4 w-1.5 flex-none items-center rounded-sm bg-border-default",
{
"bg-surface-ui-solid-purple-default": variant === "critical",
"bg-surface-feedback-solid-negative-default": variant === "high",
"bg-surface-ui-subtle-yellow-active": variant === "medium",
"bg-surface-feedback-solid-positive-default": variant === "low",
}
)}
/>
<div
className={SubframeUtils.twClassNames(
"hidden h-4 w-1.5 flex-none items-center rounded-sm bg-surface-ui-subtle-yellow-active",
{ flex: variant === "medium" }
)}
/>
<div
className={SubframeUtils.twClassNames(
"flex h-4 w-1.5 flex-none items-start rounded-sm bg-border-default",
{
"bg-surface-ui-solid-purple-default": variant === "critical",
"bg-surface-ui-solid-red-default": variant === "high",
hidden: variant === "medium",
}
)}
/>
<div
className={SubframeUtils.twClassNames(
"flex h-4 w-1.5 flex-none items-start rounded-sm bg-border-default",
{
"bg-surface-ui-solid-purple-default": variant === "critical",
"bg-surface-ui-solid-red-default": variant === "high",
}
)}
/>
<div
className={SubframeUtils.twClassNames(
"flex h-4 w-1.5 flex-none items-start rounded-sm bg-border-default",
{
"bg-surface-ui-solid-purple-hover": variant === "critical",
"bg-brand-brand-surface-subtle-default": variant === "high",
}
)}
/>
</div>
);
});
export interface PriorityBadgeProps
extends React.HTMLAttributes<HTMLDivElement> {
variant?: "none" | "low" | "medium" | "high" | "critical";
/**
* Local wrapper deviation from the Subframe export: the export hardcodes the
* German words "Kritisch"/"Hoch"/"Mittel"/"Niedrig" inside the badge, which
* would ship untranslated text into an English UI. The label is a prop here
* so the calling screen passes the already-translated string. Reported back
* to David; keep this override if the component is re-synced.
*/
label?: React.ReactNode;
className?: string;
}
const PriorityBadge = React.forwardRef<HTMLDivElement, PriorityBadgeProps>(
function PriorityBadge(
{ variant = "none", label, className, ...otherProps }: PriorityBadgeProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/94453bd3 hidden items-center rounded-sm border-2 border-solid border-surface-ui-solid-purple-default bg-surface-ui-subtle-purple-default px-1.5 py-0.5",
{
flex: variant === "critical",
"flex border-2 border-solid border-border-negative-solid bg-surface-feedback-subtle-negative":
variant === "high",
"flex border-2 border-solid border-border-warning-subtle bg-surface-feedback-subtle-warning":
variant === "medium",
"flex border-2 border-solid border-border-positive-subtle bg-surface-feedback-subtle-positive":
variant === "low",
},
className
)}
ref={ref}
{...otherProps}
>
<span
className={SubframeUtils.twClassNames(
"whitespace-nowrap text-body-small-semibold-0 font-body-small-semibold-0 text-text-neutral-secondary",
{
"text-text-ui-purple": variant === "critical",
"text-text-feedback-negative": variant === "high",
"text-text-feedback-warning": variant === "medium",
"text-text-feedback-positive": variant === "low",
}
)}
>
{label}
</span>
</div>
);
}
);
export interface ProjectCardRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
title?: React.ReactNode;
subtitle?: React.ReactNode;
tags?: React.ReactNode;
price?: React.ReactNode;
/** Translated priority label rendered inside the badge (see PriorityBadge). */
priorityLabel?: React.ReactNode;
avatar?: React.ReactNode;
startDate?: React.ReactNode;
endDate?: React.ReactNode;
appointmentLabel?: React.ReactNode;
variant?: "none" | "low" | "medium" | "high" | "critical";
hideBadge?: boolean;
hideIndicator?: boolean;
hideAvatar?: boolean;
hideDateRange?: boolean;
hideAppointment?: boolean;
className?: string;
}
const ProjectCardRoot = React.forwardRef<HTMLDivElement, ProjectCardRootProps>(
function ProjectCardRoot(
{
title,
subtitle,
tags,
price,
priorityLabel,
avatar,
startDate,
endDate,
appointmentLabel,
variant = "none",
hideBadge = false,
hideIndicator = false,
hideAvatar = false,
hideDateRange = false,
hideAppointment = false,
className,
...otherProps
}: ProjectCardRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/f82a72d5 flex w-80 cursor-pointer flex-col items-start overflow-hidden rounded-lg border border-solid border-border-default bg-surface-neutral-secondary shadow-sm hover:shadow-md",
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start px-3.5 pt-3.5",
{ "group-hover/f82a72d5:pt-2.5": variant === "low" }
)}
>
{title ? (
<span className="line-clamp-2 w-full text-body-default-semibold-0 font-body-default-semibold-0 text-text-neutral-primary">
{title}
</span>
) : null}
{subtitle ? (
<span className="line-clamp-1 w-full text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
{subtitle}
</span>
) : null}
</div>
<div className="flex w-full flex-wrap items-center gap-1 px-3.5 pt-2">
{tags ? (
<div className="flex max-h-[44px] flex-wrap items-start gap-1 overflow-hidden">
{tags}
</div>
) : null}
</div>
<div className="flex w-full items-center px-3.5 pt-2 pb-4 relative z-10">
{price ? (
<span className="text-subtitle-0 font-subtitle-0 text-text-neutral-primary">
{price}
</span>
) : null}
<div className="flex items-center gap-1.5 absolute -bottom-4 right-2">
<div className="flex items-center gap-1">
<PriorityBadge
className={SubframeUtils.twClassNames({ hidden: hideBadge })}
label={priorityLabel}
variant={
variant === "critical"
? "critical"
: variant === "high"
? "high"
: variant === "medium"
? "medium"
: variant === "low"
? "low"
: "none"
}
/>
<PriorityIndicator
className={SubframeUtils.twClassNames({
hidden: hideIndicator,
})}
variant={
variant === "critical"
? "critical"
: variant === "high"
? "high"
: variant === "medium"
? "medium"
: variant === "low"
? "low"
: "none"
}
/>
</div>
{avatar ? (
<div
className={SubframeUtils.twClassNames(
"flex items-center gap-1.5 rounded-[9999px] ring-2 ring-border-default",
{
hidden: hideAvatar,
"ring-surface-ui-solid-purple-default":
variant === "critical",
"ring-border-negative-solid": variant === "high",
"ring-border-warning-subtle": variant === "medium",
"ring-border-positive-subtle": variant === "low",
}
)}
>
{avatar}
</div>
) : null}
</div>
</div>
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start gap-2 overflow-hidden rounded-md border-2 border-solid border-border-default bg-surface-neutral-tertiary px-3 pt-6 pb-2.5 relative z-0",
{
"border-2 border-solid border-surface-ui-subtle-purple-active bg-surface-ui-subtle-purple-default":
variant === "critical",
"border-2 border-solid border-border-negative-subtle bg-surface-feedback-subtle-negative":
variant === "high",
"border-2 border-solid border-border-warning-subtle bg-surface-feedback-subtle-warning":
variant === "medium",
"border-2 border-solid border-border-positive-subtle bg-surface-feedback-subtle-positive":
variant === "low",
}
)}
>
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center gap-1.5",
{ hidden: hideDateRange }
)}
>
<FeatherPlayCircle className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-primary" />
{startDate ? (
<span className="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-primary">
{startDate}
</span>
) : null}
<div className="flex h-px grow shrink-0 basis-0 items-start bg-text-neutral-primary" />
{endDate ? (
<span className="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-primary">
{endDate}
</span>
) : null}
<FeatherFlag className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-primary" />
</div>
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center justify-center gap-1.5 rounded-round border border-solid border-border-default bg-surface-neutral-secondary px-2 py-1",
{ hidden: hideAppointment }
)}
>
<FeatherCalendarClock className="text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-icon-neutral-primary" />
{appointmentLabel ? (
<span className="whitespace-nowrap text-body-extra-small-medium-0 font-body-extra-small-medium-0 text-text-neutral-primary">
{appointmentLabel}
</span>
) : null}
</div>
</div>
</div>
);
}
);
export const ProjectCard = Object.assign(ProjectCardRoot, {
PriorityIndicator,
PriorityBadge,
});
@@ -0,0 +1,10 @@
"use client";
import { ProjectCard as ProjectCardComponent } from "./ProjectCard";
/**
* Add wrapper components and business logic here.
* If you modify this file, disable Subframe sync for it to prevent overwrites.
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
*/
export const ProjectCard = ProjectCardComponent;
@@ -0,0 +1,29 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Select } from ".";
describe("Select accessibility wrapper", () => {
it("uses its string label as the combobox accessible-name fallback", () => {
render(
<Select label="Contact type" showLabel>
<Select.Item value="person">Person</Select.Item>
</Select>
);
expect(screen.getByRole("combobox", { name: "Contact type" })).toBeInTheDocument();
});
it("preserves an explicit trigger accessible name", () => {
render(
<Select label="Contact type" showLabel triggerAriaLabel="Choose contact type">
<Select.Item value="person">Person</Select.Item>
</Select>
);
expect(screen.getByRole("combobox", { name: "Choose contact type" })).toBeInTheDocument();
});
});
@@ -10,6 +10,9 @@ import { FeatherCheck } from "@subframe/core";
import { FeatherChevronDown } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
import { MODAL_FLOATING_LAYER_CLASS } from "../../layers";
const SelectHighContrastTextContext = React.createContext(false);
export interface ContentProps
extends React.ComponentProps<typeof SubframeCore.Select.Content> {
@@ -26,8 +29,10 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(function Content(
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start gap-1 overflow-hidden rounded-sm border border-solid border-[#e5e5e5] bg-[#ffffff] px-1 py-1 shadow-sm",
MODAL_FLOATING_LAYER_CLASS,
className
)}
data-ui-layer="modal-floating"
ref={ref}
>
{children}
@@ -84,12 +89,13 @@ const ItemText = React.forwardRef<HTMLSpanElement, ItemTextProps>(
{ children, variant = "option-1", className, ...otherProps }: ItemTextProps,
ref
) {
const highContrastText = React.useContext(SelectHighContrastTextContext);
return children ? (
<SubframeCore.Select.ItemText {...otherProps}>
<span
className={SubframeUtils.twClassNames(
"group/c3085a74 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-secondary": variant === "selected" },
{ "text-text-neutral-secondary": variant === "selected" || highContrastText },
className
)}
ref={ref}
@@ -131,7 +137,7 @@ const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(
<SubframeCore.Select.Trigger asChild={true} {...otherProps}>
<button
className={SubframeUtils.twClassNames(
"group/7ce1d396 flex h-9 w-full items-center justify-between px-3 py-3 text-left",
"group/7ce1d396 flex h-9 w-full min-w-0 items-center justify-between gap-2 overflow-hidden px-3 py-3 text-left",
{
"px-0 py-0": noPadding,
"h-12": size === "large",
@@ -161,7 +167,7 @@ const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(
/>
<FeatherChevronDown
className={SubframeUtils.twClassNames(
"text-body-default-medium-0 font-body-default-medium-0 text-icon-neutral-tertiary",
"flex-none text-body-default-medium-0 font-body-default-medium-0 text-icon-neutral-tertiary",
{
"text-body-small-medium-0 font-body-small-medium-0":
size === "small",
@@ -190,7 +196,7 @@ const TriggerValue = React.forwardRef<
{
placeholder,
variant = "not-filled",
size = "m",
size: _size = "m",
className,
...otherProps
}: TriggerValueProps,
@@ -199,7 +205,7 @@ const TriggerValue = React.forwardRef<
return (
<SubframeCore.Select.Value
className={SubframeUtils.twClassNames(
"group/21c51472 whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-subtle",
"group/21c51472 min-w-0 truncate whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-subtle",
{
"text-text-neutral-secondary": variant === "filled",
"text-text-neutral-disabled": variant === "disabled",
@@ -228,10 +234,13 @@ export interface SelectRootProps
placeholder?: React.ReactNode;
helpText?: React.ReactNode;
icon?: React.ReactNode;
highContrastText?: boolean;
children?: React.ReactNode;
errorText?: React.ReactNode;
value?: string;
onValueChange?: (value: string) => void;
triggerAriaLabel?: string;
triggerAriaLabelledBy?: string;
className?: string;
}
@@ -242,19 +251,22 @@ const SelectRoot = React.forwardRef<HTMLDivElement, SelectRootProps>(
error = false,
variant = "outline",
borderless = false,
noPadding = false,
noPadding: _noPadding = false,
size = "medium",
showLabel = false,
label,
placeholder,
helpText,
icon = null,
highContrastText = false,
children,
errorText,
className,
value,
defaultValue,
onValueChange,
triggerAriaLabel,
triggerAriaLabelledBy,
open,
defaultOpen,
onOpenChange,
@@ -268,20 +280,21 @@ const SelectRoot = React.forwardRef<HTMLDivElement, SelectRootProps>(
ref
) {
return (
<SubframeCore.Select.Root
disabled={disabled}
value={value}
defaultValue={defaultValue}
onValueChange={onValueChange}
open={open}
defaultOpen={defaultOpen}
onOpenChange={onOpenChange}
dir={dir}
name={name}
autoComplete={autoComplete}
required={required}
form={form}
>
<SelectHighContrastTextContext.Provider value={highContrastText}>
<SubframeCore.Select.Root
disabled={disabled}
value={value}
defaultValue={defaultValue}
onValueChange={onValueChange}
open={open}
defaultOpen={defaultOpen}
onOpenChange={onOpenChange}
dir={dir}
name={name}
autoComplete={autoComplete}
required={required}
form={form}
>
<div
className={SubframeUtils.twClassNames(
"group/bb88f90b flex w-full min-w-[192px] max-w-[320px] cursor-pointer flex-col items-start gap-4",
@@ -332,6 +345,11 @@ const SelectRoot = React.forwardRef<HTMLDivElement, SelectRootProps>(
)}
>
<Trigger
aria-label={
triggerAriaLabel ??
(typeof label === "string" ? label : undefined)
}
aria-labelledby={triggerAriaLabelledBy}
placeholder={placeholder}
icon={icon}
variant={
@@ -368,8 +386,9 @@ const SelectRoot = React.forwardRef<HTMLDivElement, SelectRootProps>(
) : null}
</Content>
</div>
</div>
</SubframeCore.Select.Root>
</div>
</SubframeCore.Select.Root>
</SelectHighContrastTextContext.Provider>
);
}
);
@@ -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,
});
@@ -0,0 +1,87 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { act, fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { SidebarWithSections } from ".";
describe("SidebarWithSections navigation motion", () => {
it("uses caller-provided translated names for logo navigation", () => {
const onLogoClick = vi.fn();
const { rerender } = render(
<SidebarWithSections logoHref="/dashboard" logoLabel="Übersicht" />,
);
expect(screen.getByRole("link", { name: "Übersicht" })).toHaveAttribute("href", "/dashboard");
rerender(
<SidebarWithSections logoLabel="Zur Übersicht" onLogoClick={onLogoClick} />,
);
fireEvent.click(screen.getByRole("button", { name: "Zur Übersicht" }));
expect(onLogoClick).toHaveBeenCalledOnce();
});
it("smoothly transitions the full item scale in both directions", () => {
const { container } = render(<SidebarWithSections.NavItem>Dashboard</SidebarWithSections.NavItem>);
const itemSurface = container.querySelector('[data-slot="app-sidebar-nav-item-surface"]');
expect(itemSurface).toHaveClass(
"pointer-events-none",
"scale-100",
"transition-[background-color,scale]",
"duration-150",
"ease-[cubic-bezier(0.4,0,0.2,1)]",
"motion-reduce:transition-none",
"group-hover/2713e17b:scale-[1.065]",
"data-[sidebar-sweep-hover=true]:scale-[1.065]",
);
});
it("pulses items crossed between fast pointer samples", () => {
vi.useFakeTimers();
try {
const { container } = render(
<SidebarWithSections>
<SidebarWithSections.NavItem>CRM</SidebarWithSections.NavItem>
<SidebarWithSections.NavItem>Leads</SidebarWithSections.NavItem>
<SidebarWithSections.NavItem>Boards</SidebarWithSections.NavItem>
</SidebarWithSections>,
);
const sidebar = container.querySelector("nav");
const items = container.querySelectorAll<HTMLElement>('[data-sidebar-hover-item="true"]');
const surfaces = container.querySelectorAll<HTMLElement>('[data-sidebar-hover-surface="true"]');
expect(sidebar).not.toBeNull();
expect(items).toHaveLength(3);
items.forEach((item, index) => {
const top = index * 40;
vi.spyOn(item, "getBoundingClientRect").mockReturnValue({
top,
bottom: top + 40,
left: 0,
right: 200,
width: 200,
height: 40,
x: 0,
y: top,
toJSON: () => ({}),
});
});
const movePointerTo = (clientY: number) => {
const event = new Event("pointermove", { bubbles: true });
Object.defineProperty(event, "clientY", { value: clientY });
fireEvent(sidebar!, event);
};
movePointerTo(20);
movePointerTo(100);
expect(surfaces[1]).toHaveAttribute("data-sidebar-sweep-hover", "true");
act(() => vi.advanceTimersByTime(150));
expect(surfaces[1]).not.toHaveAttribute("data-sidebar-sweep-hover");
} finally {
vi.useRealTimers();
}
});
});
@@ -12,6 +12,7 @@ import { FeatherSidebarClose } from "@subframe/core";
import { FeatherSidebarOpen } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
import { useSidebarHoverSweep } from "../../sidebar-hover-sweep";
import { IconButton } from "../IconButton";
import { Logo } from "../Logo";
@@ -37,34 +38,37 @@ const NavItem = React.forwardRef<HTMLDivElement, NavItemProps>(function NavItem(
return (
<div
className={SubframeUtils.twClassNames(
// @subframe/sync-disable -- local fix: keep the item left-anchored on collapse (no items-center flip) so the icon does not jump horizontally.
"group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2",
{ "items-center": variant === "icon-only" },
className
)}
ref={ref}
data-sidebar-hover-item="true"
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
// @subframe/sync-disable -- local fix: no items-center flip on collapse (keeps subitem behaviour, drops icon-only centering).
"flex w-full flex-col items-start gap-2",
{
"items-end justify-center": variant === "subitem",
"items-center": variant === "icon-only",
}
)}
>
<div
className={SubframeUtils.twClassNames(
"flex w-full items-center gap-2.5 rounded-md px-3 py-2 group-hover/2713e17b:bg-surface-neutral-tertiary",
// @subframe/sync-disable -- local fix: icon-only keeps the same left-aligned row (w-full px-3) as the expanded state and only hides the label, so the icon stays at a constant horizontal position through the width animation.
// @subframe/sync-disable -- local fix: same hover lift as the inner sidebar (SidebarInside.NavItem) so both rails react identically.
"pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5 rounded-md px-3 py-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/2713e17b:scale-[1.065] data-[sidebar-sweep-hover=true]:scale-[1.065] group-hover/2713e17b:bg-surface-neutral-tertiary",
{
"w-52 flex-none group-active/2713e17b:w-full group-active/2713e17b:max-w-[208px] group-active/2713e17b:flex-none group-active/2713e17b:justify-end":
variant === "subitem",
"w-auto flex-none items-start justify-center px-2.5 py-2.5":
variant === "icon-only",
"bg-surface-neutral-tertiary group-hover/2713e17b:bg-surface-neutral-modal group-active/2713e17b:bg-surface-neutral-tertiary":
selected,
}
)}
data-slot="app-sidebar-nav-item-surface"
data-sidebar-hover-surface="true"
>
{icon ? (
<SubframeCore.IconWrapper className="inline-flex h-5 w-5 flex-none items-center justify-center leading-none text-body-large font-body-large text-icon-neutral-primary group-active/2713e17b:text-icon-neutral-on-subtle [&>svg]:h-full [&>svg]:w-full">
@@ -200,12 +204,20 @@ const NavDivider = React.forwardRef<HTMLDivElement, NavDividerProps>(
export interface SubcomponentProps
extends React.HTMLAttributes<HTMLDivElement> {
sidebarButton?: "close" | "open";
buttonLabel?: string;
onToggle?: () => void;
className?: string;
}
const Subcomponent = React.forwardRef<HTMLDivElement, SubcomponentProps>(
function Subcomponent(
{ sidebarButton = "close", className, ...otherProps }: SubcomponentProps,
{
sidebarButton = "close",
buttonLabel,
onToggle,
className,
...otherProps
}: SubcomponentProps,
ref
) {
return (
@@ -228,6 +240,8 @@ const Subcomponent = React.forwardRef<HTMLDivElement, SubcomponentProps>(
<FeatherSidebarClose />
)
}
aria-label={buttonLabel}
onClick={onToggle}
/>
</div>
);
@@ -242,6 +256,16 @@ export interface SidebarWithSectionsRootProps
className?: string;
// @subframe/sync-disable -- local fix: Collapse-Toggle verdrahtbar machen (App steuert open/closed).
onToggleCollapse?: () => void;
// @subframe/sync-disable -- local fix: native collapse button needs an accessible, translated name.
toggleLabel?: string;
// @subframe/sync-disable -- local fix: make the logo a link (click -> dashboard, same target as the Dashboard nav item).
logoHref?: string;
// @subframe/sync-disable -- logo navigation needs the caller's translated accessible name.
logoLabel?: string;
// @subframe/sync-disable -- branded surfaces can replace the default mark without forking the canonical sidebar.
logoContent?: React.ReactNode;
// @subframe/sync-disable -- callback-owned surfaces keep logo navigation client-side.
onLogoClick?: () => void;
}
const SidebarWithSectionsRoot = React.forwardRef<
@@ -254,26 +278,38 @@ const SidebarWithSectionsRoot = React.forwardRef<
children,
className,
onToggleCollapse,
toggleLabel,
logoHref,
logoLabel,
logoContent,
onLogoClick,
onPointerMove,
onPointerLeave,
...otherProps
}: SidebarWithSectionsRootProps,
ref
) {
const { handlePointerMove, handlePointerLeave } = useSidebarHoverSweep({ onPointerMove, onPointerLeave });
return (
<nav
className={SubframeUtils.twClassNames(
// @subframe/sync-disable -- local fix: animierbare Breite (w-16 statt w-auto) + smoother Collapse-Animation.
"group/f4047c8b flex h-full w-60 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]",
// @subframe/sync-disable -- local fix: explicit w-16 width and a smooth collapse transition.
"group/f4047c8b flex h-full w-60 shrink-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]",
{ "w-16": variant === "closed" },
className
)}
ref={ref}
onPointerMove={handlePointerMove}
onPointerLeave={handlePointerLeave}
{...otherProps}
>
{/* @subframe/sync-disable -- local fix: Collapse-Toggle verdrahtet (onClick -> onToggleCollapse) statt nur dekorativ. */}
<Subcomponent
className="absolute -right-[17px] top-[40px] z-40 cursor-pointer"
sidebarButton={variant === "closed" ? "open" : "close"}
onClick={onToggleCollapse}
buttonLabel={toggleLabel}
onToggle={onToggleCollapse}
/>
<div
className={SubframeUtils.twClassNames(
@@ -282,11 +318,41 @@ const SidebarWithSectionsRoot = React.forwardRef<
)}
>
<div className="flex items-center justify-center gap-2">
<Logo
size="32"
showIcon={variant === "closed" ? true : undefined}
hideText={variant === "closed" ? true : undefined}
/>
{/* @subframe/sync-disable -- local fix: logo links to the dashboard when logoHref is set (mirrors the Dashboard nav item). */}
{onLogoClick ? (
<button
type="button"
aria-label={logoLabel}
className="border-0 bg-transparent p-0"
onClick={onLogoClick}
>
{logoContent ?? (
<Logo
size="32"
showIcon={variant === "closed" ? true : undefined}
hideText={variant === "closed" ? true : undefined}
/>
)}
</button>
) : logoHref ? (
<a href={logoHref} aria-label={logoLabel} className="no-underline">
{logoContent ?? (
<Logo
size="32"
showIcon={variant === "closed" ? true : undefined}
hideText={variant === "closed" ? true : undefined}
/>
)}
</a>
) : (
logoContent ?? (
<Logo
size="32"
showIcon={variant === "closed" ? true : undefined}
hideText={variant === "closed" ? true : undefined}
/>
)
)}
</div>
</div>
{children ? (
@@ -109,6 +109,7 @@ const SliderRoot = React.forwardRef<HTMLDivElement, SliderRootProps>(
valueText,
description,
className,
"aria-label": ariaLabel,
...otherProps
}: SliderRootProps,
ref
@@ -117,6 +118,7 @@ const SliderRoot = React.forwardRef<HTMLDivElement, SliderRootProps>(
<SubframeCore.Slider.Root
asChild={true}
disabled={disabled}
aria-label={ariaLabel}
{...otherProps}
>
<div
@@ -156,10 +158,15 @@ const SliderRoot = React.forwardRef<HTMLDivElement, SliderRootProps>(
)}
>
<Track variant={disabled ? "disabled" : "default"} />
<Thumb variant={disabled ? "disabled" : "default"} />
{/* @subframe/sync-disable -- Radix needs the accessible name on the focusable thumb. */}
<Thumb
variant={disabled ? "disabled" : "default"}
aria-label={ariaLabel}
/>
<Thumb
className={SubframeUtils.twClassNames("hidden", { flex: range })}
variant={disabled ? "disabled" : "default"}
aria-label={ariaLabel ? `${ariaLabel} maximum` : undefined}
/>
</div>
{description ? (
@@ -1,4 +1,10 @@
"use client";
// @subframe/sync-disable -- local fix: render `label`, `value`, `percentage` and
// `comparisonText` whenever they are present instead of when they are truthy. The
// generated `{value ? … : null}` guards drop the number `0` and the empty string,
// so every card whose metric was legitimately zero rendered as a headline with a
// bare trend arrow and no figure at all (admin audit 2026-07-26: /health,
// /system, /sales/tasks/today, /sales/contacts, /sales/calls, /sales/bookings,
// /accounts/billing).
/*
* Documentation:
* Stats Card — https://app.subframe.com/f023064a5ca0/library?component=Stats+Card_63f809c7-22ef-47f8-9fb9-0f33b252be3f
@@ -12,6 +18,16 @@ import { FeatherTrendingUp } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
/**
* A slot is rendered when it carries visible content. The number `0` does — it
* is a legitimate metric — while `undefined`, `null`, `false` and the empty
* string do not. Call sites pass `percentage=""` to opt out of that slot, so an
* empty string must stay unrendered rather than produce an empty element.
*/
function hasContent(node: React.ReactNode): boolean {
return node !== undefined && node !== null && node !== false && node !== "";
}
export interface StatsCardRootProps
extends React.HTMLAttributes<HTMLDivElement> {
trend?: "positive" | "negative" | "neutral";
@@ -20,6 +36,7 @@ export interface StatsCardRootProps
percentage?: React.ReactNode;
comparisonText?: React.ReactNode;
icon?: React.ReactNode;
highContrastText?: boolean;
className?: string;
}
@@ -32,6 +49,7 @@ const StatsCardRoot = React.forwardRef<HTMLDivElement, StatsCardRootProps>(
percentage,
comparisonText,
icon = <FeatherDollarSign />,
highContrastText = false,
className,
...otherProps
}: StatsCardRootProps,
@@ -48,8 +66,13 @@ const StatsCardRoot = React.forwardRef<HTMLDivElement, StatsCardRootProps>(
>
<div className="flex w-full flex-col items-start gap-5">
<div className="flex w-full items-center justify-between">
{label ? (
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
{hasContent(label) ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary",
{ "text-text-neutral-primary": highContrastText }
)}
>
{label}
</span>
) : null}
@@ -59,7 +82,7 @@ const StatsCardRoot = React.forwardRef<HTMLDivElement, StatsCardRootProps>(
</SubframeCore.IconWrapper>
) : null}
</div>
{value ? (
{hasContent(value) ? (
<span className="text-subtitle-0 font-subtitle-0 text-text-neutral-primary">
{value}
</span>
@@ -84,7 +107,7 @@ const StatsCardRoot = React.forwardRef<HTMLDivElement, StatsCardRootProps>(
{ hidden: trend === "neutral" || trend === "negative" }
)}
/>
{percentage ? (
{hasContent(percentage) ? (
<span
className={SubframeUtils.twClassNames(
"text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-positive",
@@ -98,8 +121,13 @@ const StatsCardRoot = React.forwardRef<HTMLDivElement, StatsCardRootProps>(
</span>
) : null}
</div>
{comparisonText ? (
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">
{hasContent(comparisonText) ? (
<span
className={SubframeUtils.twClassNames(
"text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ "text-text-neutral-secondary": highContrastText }
)}
>
{comparisonText}
</span>
) : null}
@@ -0,0 +1,47 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { StatsCard } from ".";
describe("StatsCard slot rendering", () => {
it("renders a zero metric instead of dropping it", () => {
// Regression guard: the generated `{value ? … : null}` guard treated the
// number 0 as absent, so cards such as "Kritisch" or "Überfällig" showed a
// heading and a trend arrow with no figure at all.
render(<StatsCard label="Kritisch" value={0} />);
expect(screen.getByText("Kritisch")).toBeInTheDocument();
expect(screen.getByText("0")).toBeInTheDocument();
});
it("renders zero percentages and zero comparison text", () => {
render(<StatsCard label="Überfällig" value={0} percentage={0} comparisonText={0} />);
expect(screen.getAllByText("0")).toHaveLength(3);
});
it("still omits slots that carry no content", () => {
const { container } = render(<StatsCard label="Unklar" value={undefined} percentage={null} comparisonText={false} />);
expect(screen.getByText("Unklar")).toBeInTheDocument();
expect(container.textContent).toBe("Unklar");
});
it("treats an empty string as an opt-out, not as content", () => {
// Call sites pass `percentage=""` to hide that slot; rendering it would add
// empty elements to every card.
const { container } = render(<StatsCard label="Kritisch" value={0} percentage="" comparisonText="" />);
expect(container.querySelectorAll("span:empty")).toHaveLength(0);
expect(container.textContent).toBe("Kritisch0");
});
it("keeps rendering formatted string values", () => {
render(<StatsCard label="Umsatz" value="19,99 €" />);
expect(screen.getByText("19,99 €")).toBeInTheDocument();
});
});
@@ -0,0 +1,24 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { StepperHorizontal } from "./StepperHorizontal";
describe("StepperHorizontal", () => {
it("announces progress without implying that static steps are clickable", () => {
const { container } = render(
<StepperHorizontal aria-label="Setup progress">
<StepperHorizontal.Step firstStep variant="completed" stepNumber="1" label="Account" />
<StepperHorizontal.Step variant="active" stepNumber="2" label="Payment" />
<StepperHorizontal.Step lastStep stepNumber="3" label="Workspace" />
</StepperHorizontal>
);
expect(screen.getByRole("list", { name: "Setup progress" })).toBeVisible();
expect(screen.getAllByRole("listitem")).toHaveLength(3);
expect(screen.getByRole("listitem", { current: "step" })).toHaveTextContent("Payment");
expect(container.querySelectorAll(".cursor-pointer")).toHaveLength(0);
expect(screen.queryAllByRole("button")).toHaveLength(0);
});
});
@@ -31,9 +31,11 @@ const Step = React.forwardRef<HTMLDivElement, StepProps>(function Step(
return (
<div
className={SubframeUtils.twClassNames(
"group/c1145464 flex w-full cursor-pointer flex-col items-center justify-center gap-1",
"group/c1145464 flex w-full flex-col items-center justify-center gap-1",
className
)}
role="listitem"
aria-current={variant === "active" ? "step" : undefined}
ref={ref}
{...otherProps}
>
@@ -74,7 +76,7 @@ const Step = React.forwardRef<HTMLDivElement, StepProps>(function Step(
{label ? (
<span
className={SubframeUtils.twClassNames(
"font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373] group-hover/c1145464:text-[#171717]",
"font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373]",
{
"font-['Inter'] text-[14px] font-[500] leading-[20px] tracking-normal text-[#171717]":
variant === "active",
@@ -107,6 +109,7 @@ const StepperHorizontalRoot = React.forwardRef<
"flex w-full items-start justify-center",
className
)}
role="list"
ref={ref}
{...otherProps}
>
@@ -11,7 +11,7 @@ import * as SubframeUtils from "../../utils";
export interface CellProps
extends React.TdHTMLAttributes<HTMLTableDataCellElement> {
children?: React.ReactNode;
variant?: "align-left" | "align-center";
variant?: "align-left" | "align-center" | "align-right";
className?: string;
}
@@ -24,8 +24,11 @@ const Cell = React.forwardRef<HTMLTableDataCellElement, CellProps>(
<td className={className} ref={ref} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"group/291d4418 flex h-full min-h-[48px] w-full items-center border-r border-solid border-border-default px-4 py-1",
{ "justify-center": variant === "align-center" }
"group/291d4418 flex h-full min-h-[48px] w-full min-w-[0px] items-center border-r border-solid border-border-default px-4 py-1",
{
"justify-end": variant === "align-right",
"justify-center": variant === "align-center",
}
)}
>
{children}
@@ -5,7 +5,6 @@
*/
import React from "react";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface InputProps
@@ -25,7 +25,7 @@ export interface InputProps
React.InputHTMLAttributes<HTMLInputElement>,
"type" | "placeholder" | "value"
> {
type?: "text" | "password" | "email" | "number" | "tel" | "url" | "search";
type?: "text" | "password" | "email" | "number" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "file";
placeholder?: React.ReactNode;
variant?: "regular" | "small" | "extra-small";
value?: React.ReactNode;
@@ -60,6 +60,14 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(function Input(
? "number"
: type === "email"
? "email"
: type === "datetime-local"
? "datetime-local"
: type === "date"
? "date"
: type === "time"
? "time"
: type === "file"
? "file"
: type === "password"
? "password"
: "text";
@@ -131,7 +139,7 @@ export interface TextInputRootProps
message?: React.ReactNode;
icon?: React.ReactNode;
iconRight?: React.ReactNode;
type?: "text" | "password" | "email" | "number" | "tel" | "url" | "search";
type?: "text" | "password" | "email" | "number" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "file";
children?: React.ReactNode;
className?: string;
}
@@ -14,44 +14,43 @@ export interface TimeoutRootProps extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const TimeoutRoot = React.forwardRef<HTMLDivElement, TimeoutRootProps>(
function TimeoutRoot(
{ variant = "inline", className, ...otherProps }: TimeoutRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/ff21411f flex max-w-[576px] flex-col items-start gap-2 rounded-md border-2 border-solid border-border-negative-solid bg-surface-feedback-subtle-negative px-4 py-4 shadow-sm",
{ "max-w-none": variant === "full-width" },
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-full flex-col items-start gap-6">
<div className="flex w-full items-center gap-2">
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
/>
<span className="grow shrink-0 basis-0 whitespace-pre-wrap text-body-default-regular-0 font-body-default-regular-0 text-text-feedback-negative">
{"Request timed out"}
</span>
</div>
<div className="flex flex-col items-start gap-6 pl-3">
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
The server took too long to respond. Please try again.
</span>
<div className="flex items-center gap-2">
<Button variant="tertiary">Retry</Button>
<Button variant="ghost">Cancel</Button>
</div>
const TimeoutRoot = React.forwardRef<HTMLDivElement, TimeoutRootProps>(function TimeoutRoot(
{ variant = "inline", className, ...otherProps }: TimeoutRootProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"group/ff21411f border-border-negative-solid bg-surface-feedback-subtle-negative flex max-w-[576px] flex-col items-start gap-2 rounded-md border-2 border-solid px-4 py-4 shadow-sm",
{ "max-w-none": variant === "full-width" },
className
)}
ref={ref}
{...otherProps}
>
<div className="flex w-full flex-col items-start gap-6">
<div className="flex w-full items-center gap-2">
<img
className="h-1 w-1 flex-none object-cover"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTEgdy0xIGZsZXgtbm9uZSIgZGF0YS1ub2RlLWlkPSJjNWJhMzRjMCI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9IiNDNTIwMjAiPjwvY2lyY2xlPjwvc3ZnPg=="
alt=""
/>
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-feedback-negative shrink-0 grow basis-0 whitespace-pre-wrap">
{"Request timed out"}
</span>
</div>
<div className="flex flex-col items-start gap-6 pl-3">
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
The server took too long to respond. Please try again.
</span>
<div className="flex items-center gap-2">
<Button variant="tertiary">Retry</Button>
<Button variant="ghost">Cancel</Button>
</div>
</div>
</div>
);
}
);
</div>
);
});
export const Timeout = TimeoutRoot;