feat(ui): add flat surfaces and compact profile/site controls
This commit is contained in:
@@ -17,6 +17,8 @@ export interface ApplyThemeOptions {
|
||||
theme?: NodedcTheme;
|
||||
/** Operator UI qualified against Mission Core; opt-in across portals. */
|
||||
appearance?: "default" | "mission";
|
||||
/** Flat surfaces remove decorative edges; keyboard focus uses a contrasting fill. */
|
||||
edges?: "default" | "flat";
|
||||
accent?: RgbTuple;
|
||||
material?: NodedcMaterial;
|
||||
}
|
||||
@@ -31,10 +33,11 @@ function clampOpacity(value: number): number {
|
||||
|
||||
export function applyNodedcTheme(
|
||||
target: HTMLElement,
|
||||
{ theme = "dark", accent, material, appearance = "default" }: ApplyThemeOptions = {},
|
||||
{ theme = "dark", accent, material, appearance = "default", edges = "default" }: ApplyThemeOptions = {},
|
||||
): void {
|
||||
target.dataset.nodedcTheme = theme;
|
||||
target.dataset.nodedcAppearance = appearance;
|
||||
target.dataset.nodedcEdges = edges;
|
||||
target.dataset.nodedcUi = "true";
|
||||
|
||||
if (accent) {
|
||||
|
||||
@@ -4676,3 +4676,31 @@ textarea.nodedc-field__control {
|
||||
|
||||
.nodedc-level-button[data-custom-fill].nodedc-button{position:relative;overflow:hidden;background-image:none}
|
||||
.nodedc-level-button__fill{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;background:var(--nodedc-level-custom);color:var(--nodedc-level-ink);clip-path:inset(0 calc(100% - var(--nodedc-level-percent)) 0 0)}
|
||||
|
||||
/* Opt-in flat material. Applies at the document root, including portal layers.
|
||||
Focus remains visible through a high-contrast fill instead of a contour. */
|
||||
[data-nodedc-edges="flat"] {
|
||||
--nodedc-glass-outline: transparent;
|
||||
--nodedc-glass-control-shadow: none;
|
||||
--nodedc-panel-action-border: transparent;
|
||||
--nodedc-panel-action-border-hover: transparent;
|
||||
--nodedc-panel-action-shadow: none;
|
||||
}
|
||||
[data-nodedc-edges="flat"] .nodedc-material-rim::after,
|
||||
[data-nodedc-edges="flat"] .nodedc-glass-material::before { display: none; }
|
||||
[data-nodedc-edges="flat"] :is(.nodedc-admin-panel__nav-item, .nodedc-application-panel__action, .nodedc-admin-panel__close, .nodedc-media-source-button, .nodedc-media-preview, .nodedc-color-field__swatch) {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
[data-nodedc-edges="flat"] :is(button, input, textarea, [tabindex]):focus-visible {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
background-color: var(--nodedc-text-primary);
|
||||
color: var(--nodedc-canvas);
|
||||
}
|
||||
[data-nodedc-edges="flat"] .nodedc-admin-panel__nav-item:focus-visible .nodedc-admin-panel__nav-icon {
|
||||
background: var(--nodedc-canvas);
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
|
||||
.nodedc-select[data-shape="pill"] :is(.nodedc-select__value,.nodedc-select__toggle) { border-radius: var(--nodedc-radius-circle); }
|
||||
|
||||
@@ -29,6 +29,8 @@ export interface SelectProps<T extends string> {
|
||||
menuWidth?: number | "anchor";
|
||||
disabled?: boolean;
|
||||
variant?: SelectVariant;
|
||||
/** Split site/workspace selectors can align with adjacent circular actions. */
|
||||
shape?: "default" | "pill";
|
||||
className?: string;
|
||||
triggerClassName?: string;
|
||||
menuClassName?: string;
|
||||
@@ -47,6 +49,7 @@ export function Select<T extends string>({
|
||||
menuWidth = "anchor",
|
||||
disabled = false,
|
||||
variant = "integrated",
|
||||
shape = "default",
|
||||
className,
|
||||
triggerClassName,
|
||||
menuClassName,
|
||||
@@ -88,7 +91,7 @@ export function Select<T extends string>({
|
||||
};
|
||||
if (resolvedVariant === "split") {
|
||||
return (
|
||||
<div className={cn("nodedc-select", triggerClassName)} data-disabled={disabled ? "true" : undefined}>
|
||||
<div className={cn("nodedc-select", triggerClassName)} data-shape={shape === "pill" ? "pill" : undefined} data-disabled={disabled ? "true" : undefined}>
|
||||
<div ref={setAnchorRef} className="nodedc-select__control">
|
||||
<div className="nodedc-select__value">
|
||||
{selected?.icon ? <span className="nodedc-select__value-icon">{selected.icon}</span> : null}
|
||||
|
||||
@@ -19,6 +19,8 @@ export interface UserProfileMenuProps {
|
||||
avatarUrl?: string;
|
||||
coverImageUrl?: string;
|
||||
triggerLabel?: ReactNode;
|
||||
/** Optional status glyph between the label and avatar. */
|
||||
triggerIcon?: IconName;
|
||||
actions: readonly UserProfileMenuAction[];
|
||||
}
|
||||
|
||||
@@ -28,6 +30,7 @@ export function UserProfileMenu({
|
||||
avatarUrl,
|
||||
coverImageUrl,
|
||||
triggerLabel,
|
||||
triggerIcon,
|
||||
actions,
|
||||
}: UserProfileMenuProps) {
|
||||
const label = displayName || "NODE.DC";
|
||||
@@ -49,6 +52,7 @@ export function UserProfileMenu({
|
||||
onClick={toggle}
|
||||
>
|
||||
{triggerLabel === null ? null : <span className="nodedc-user-profile-menu__trigger-label">{triggerLabel ?? label}</span>}
|
||||
{triggerIcon ? <Icon name={triggerIcon} size={18} /> : null}
|
||||
<HeaderAvatar label={label} imageUrl={avatarUrl} />
|
||||
</button>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user