Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(properties): align pin and remove actions (#9102)

dev-rbd7b0b25227bb
diff --git a/.agents/rules/web/design-system.md b/.agents/rules/web/design-system.md
index 1917985f7d..3fdd7214f1 100644
--- a/.agents/rules/web/design-system.md
+++ b/.agents/rules/web/design-system.md
@@ -54,6 +54,7 @@ construction. Browse them at `/app/component/ui` (Foundations → Controls).
- Use `variant="primary"` for the main create, save, submit, invite, approve, or continue action. Primary is solid neutral: black with white text in light themes, white with black text in dark themes. Keep existing primary consumers on `primary`, including selected-state controls. Use explicit `variant="accent"` only for separately intended theme-color emphasis. Home/AI chat, channel, and email Send actions use the shared primary `SendButton`. Keep the shared New launcher (`ViewCreateButton`) on `variant="secondary" finish="raised"`, and retain secondary, outline, ghost, and danger variants for their own roles.
- Quiet Back, Close, Cancel, and unframed inline utility actions use explicit `variant="ghost"`; omitting the variant opts into solid neutral primary emphasis, not accent. Keep intentional framed groups and selected-state actions in their own variants. Size every rendered glyph explicitly, including children passed through action wrappers; Button does not size descendant SVGs.
- Selected reaction chips are a deliberate local exception: `ReactionChip` uses `appearance="bare"` with accent-tint, accent-text, and overlay classes to preserve its soft selected treatment without a new Button variant. Keep unselected reactions on `secondary`.
+- Property side-panel pin and add-value actions use standard ghost Buttons at 24px with 16px glyphs and extra-muted resting ink; remove actions use `variant="danger-ghost"` for a transparent resting face, failure-colored ink, and shared danger hover/pressed tokens. Retain shared hover tokens, not `appearance="bare"` or custom surface-hover fills. Keep pin and add-value actions visible; reveal remove and secondary row actions on hover or keyboard focus and keep them available on touch. Place add then pin with no gap between them; secondary actions follow this pair. Without add, keep pinning at the right edge after removal. Pinned glyphs use accent ink; suppress only the resting pressed fill, retaining the ghost hover token and toggle semantics. Keep editor focus restoration on value triggers, not row actions.
- Current application Button usages trial `secondary` instead of `outline`, including shared wrappers and groups. Keep the outline API and canonical Button gallery examples; do not change outline variants on badges, inputs, or other components.
- Settings actions that previously used inverse-filled `cta` styling use explicit `variant="primary"`, including creation, runtime setup, billing, invitation, and signature-save actions. Keep existing accent, ghost, and destructive actions in their own roles; do not recolor Button descendants from `SettingsPage`.
- Primary, accent, secondary, danger, and success Buttons and ButtonGroup frames automatically use the raised desktop finish and shared glass on touch. Use `finish="flat"` to opt out or `finish="raised"` to frame a ghost/link action. Outline variants, bare controls, and grouped segments always stay flat.
diff --git a/apps/web/src/components/ui/components/Button.docs.tsx b/apps/web/src/components/ui/components/Button.docs.tsx
index fbb17ae3e8..6ef7a0ba00 100644
--- a/apps/web/src/components/ui/components/Button.docs.tsx
+++ b/apps/web/src/components/ui/components/Button.docs.tsx
@@ -17,6 +17,7 @@ const VARIANTS: ButtonVariant[] = [
'outline',
'ghost',
'danger',
+ 'danger-ghost',
'success',
'link',
];
@@ -28,7 +29,7 @@ function VariantsDemo() {
<For each={VARIANTS}>
{(variant) => (
<div class="flex flex-wrap items-center gap-4">
- <span class="w-20 font-mono text-xs text-ink-muted">{variant}</span>
+ <span class="w-24 font-mono text-xs text-ink-muted">{variant}</span>
<Button variant={variant}>Button</Button>
<Button variant={variant}>
<PlusIcon class="size-4" aria-hidden="true" />
diff --git a/apps/web/src/components/ui/components/Button.tsx b/apps/web/src/components/ui/components/Button.tsx
index 7358d2069f..951dc14bfa 100644
--- a/apps/web/src/components/ui/components/Button.tsx
+++ b/apps/web/src/components/ui/components/Button.tsx
@@ -34,6 +34,8 @@ const buttonFrames = {
ghost:
'bg-button-tertiary-bg text-ink-muted border-transparent bg-none shadow-none',
danger: 'bg-button-danger-bg text-failure border-transparent shadow-button',
+ 'danger-ghost':
+ 'bg-button-tertiary-bg text-failure border-transparent bg-none shadow-none',
success: 'bg-button-success-bg text-success border-transparent shadow-button',
link: 'border-transparent bg-transparent text-link shadow-none',
};
@@ -81,6 +83,11 @@ const buttonStyles = createVariants(
'not-data-disabled:hover:bg-button-danger-hover not-data-disabled:active:bg-button-danger-pressed aria-pressed:bg-button-danger-pressed aria-pressed:not-data-disabled:hover:bg-button-danger-pressed popup-open:bg-button-danger-pressed popup-open:not-data-disabled:hover:bg-button-danger-pressed',
buttonPressedStyles
),
+ 'danger-ghost': cn(
+ buttonFrames['danger-ghost'],
+ 'not-data-disabled:hover:bg-button-danger-hover not-data-disabled:active:bg-button-danger-pressed aria-pressed:bg-button-danger-pressed aria-pressed:not-data-disabled:hover:bg-button-danger-pressed popup-open:bg-button-danger-pressed popup-open:not-data-disabled:hover:bg-button-danger-pressed',
+ buttonPressedStyles
+ ),
success: cn(
buttonFrames.success,
'not-data-disabled:hover:bg-button-success-hover not-data-disabled:active:bg-button-success-pressed aria-pressed:bg-button-success-pressed aria-pressed:not-data-disabled:hover:bg-button-success-pressed popup-open:bg-button-success-pressed popup-open:not-data-disabled:hover:bg-button-success-pressed',
@@ -120,7 +127,10 @@ export type ButtonClassOptions = {
function buttonFinishClasses(variant: ButtonVariant, finish?: ButtonFinish) {
if (finish === 'flat' || variant === 'outline') return 'shadow-none';
- if (finish !== 'raised' && (variant === 'ghost' || variant === 'link')) {
+ if (
+ finish !== 'raised' &&
+ (variant === 'ghost' || variant === 'danger-ghost' || variant === 'link')
+ ) {
return undefined;
}
diff --git a/apps/web/src/features/property/core/Root.tsx b/apps/web/src/features/property/core/Root.tsx
index 64fa1c9a4e..1e18a4e61f 100644
--- a/apps/web/src/features/property/core/Root.tsx
+++ b/apps/web/src/features/property/core/Root.tsx
@@ -53,7 +53,10 @@ export function Root(props: PropertyRootProps) {
// Fallback: find the trigger by property ID (handles remount case)
const root = document.querySelector(`[data-property-id="${propertyId}"]`);
- const trigger = root?.querySelector('button');
+ // Row actions can precede the value editor; restore focus to its trigger.
+ const trigger = root?.querySelector<HTMLButtonElement>(
+ 'button:not([data-property-row-action])'
+ );
if (trigger) {
trigger.focus();
}
diff --git a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
index 224c69549c..162e74acf0 100644
--- a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
+++ b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
@@ -528,6 +528,19 @@ function SidePanelPropertyRow(props: {
const isInputType = () =>
t() === 'STRING' || t() === 'NUMBER' || t() === 'LINK' || t() === 'BOOLEAN';
const isMultilineRow = () => t() === 'STRING' && hasValue(props.property);
+ const hasInlineAddAction = () =>
+ isMultiValueRow() &&
+ !(t() === 'ENTITY' && props.property.specificEntityType === 'USER');
+ const renderActions = () => (
+ <PropertyRowActions
+ canRemoveFromEntity={props.canRemoveFromEntity}
+ pinFirst={hasInlineAddAction()}
+ canPinPendingProperty={props.canPinPendingProperty}
+ property={props.property}
+ onRemovePendingProperty={props.onRemovePendingProperty}
+ onPropertyPinned={props.onPropertyPinned}
+ />
+ );
return (
<div class="contents group/property-row">
@@ -566,7 +579,10 @@ function SidePanelPropertyRow(props: {
<InputValue />
</Match>
<Match when={isMultiValueRow()}>
- <MultiValue property={props.property} />
+ <MultiValue
+ property={props.property}
+ renderActions={renderActions}
+ />
</Match>
</Switch>
<PropertyNS.PopoverEditor
@@ -576,13 +592,7 @@ function SidePanelPropertyRow(props: {
}}
/>
</PropertyNS.Root>
- <PropertyRowActions
- canRemoveFromEntity={props.canRemoveFromEntity}
- canPinPendingProperty={props.canPinPendingProperty}
- property={props.property}
- onRemovePendingProperty={props.onRemovePendingProperty}
- onPropertyPinned={props.onPropertyPinned}
- />
+ <Show when={!hasInlineAddAction()}>{renderActions()}</Show>
</div>
</div>
</div>
@@ -598,6 +608,7 @@ function PropertyRowActions(props: {
canPinPendingProperty?: boolean;
onRemovePendingProperty: (property: Property) => void;
onPropertyPinned?: (propertyId: string) => void;
+ pinFirst?: boolean;
property: Property;
}) {
const ctx = usePropertiesContext();
@@ -620,6 +631,8 @@ function PropertyRowActions(props: {
ctx.pinnedPropertyIds?.().includes(props.property.propertyId) ?? false;
const pinLabel = () => (isPinned() ? 'Unpin from title' : 'Pin below title');
const hasActions = () => canRemove() || canPin();
+ const actionVisibility =
+ 'pointer-events-none opacity-0 group-hover/property-row:pointer-events-auto group-hover/property-row:opacity-100 group-focus-within/property-row:pointer-events-auto group-focus-within/property-row:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100 touch:pointer-events-auto touch:opacity-100';
const stopRowInteraction = (event: MouseEvent) => {
event.preventDefault();
@@ -664,47 +677,48 @@ function PropertyRowActions(props: {
}
};
+ const renderRemoveAction = () => (
+ <Show when={canRemove()}>
+ <Button
+ variant="danger-ghost"
+ size="icon-xs"
+ data-property-row-action
+ tooltip="Remove from entity"
+ aria-label="Remove from entity"
+ disabled={isSaving()}
+ class={cn('transition', actionVisibility)}
+ onClick={removeFromEntity}
+ >
+ <TrashIcon class="size-4" />
+ </Button>
+ </Show>
+ );
+
return (
<Show when={hasActions()}>
<div
- class={cn(
- 'flex shrink-0 items-center gap-0.5',
- 'transition-opacity',
- canPin() && isPinned()
- ? 'pointer-events-auto opacity-100'
- : 'pointer-events-none opacity-0',
- 'group-hover/property-row:pointer-events-auto group-hover/property-row:opacity-100 group-focus-within/property-row:pointer-events-auto group-focus-within/property-row:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100',
- 'touch:pointer-events-auto touch:opacity-100'
- )}
+ class="flex shrink-0 items-center gap-0.5"
onMouseDown={stopRowInteraction}
>
+ <Show when={!props.pinFirst}>{renderRemoveAction()}</Show>
<Show when={canPin()}>
<Button
variant="ghost"
- size="icon-sm"
+ size="icon-xs"
+ data-property-row-action
title={pinLabel()}
aria-label={pinLabel()}
aria-pressed={isPinned()}
disabled={isSaving()}
+ class="text-ink-extra-muted aria-pressed:bg-button-tertiary-bg aria-pressed:not-data-disabled:hover:bg-button-tertiary-hover"
onClick={togglePin}
>
<Show when={isPinned()} fallback={<PushPinIcon class="size-4" />}>
- <PushPinSlashIcon class="size-4" />
+ <PushPinSlashIcon class="size-4 text-accent" />
</Show>
</Button>
</Show>
- <Show when={canRemove()}>
- <button
- type="button"
- title="Remove from entity"
- aria-label="Remove from entity"
- disabled={isSaving()}
- class="flex size-5 items-center justify-center rounded-full text-ink-muted outline-none ring-0 shadow-none hover:bg-hover hover:text-failure-ink focus:outline-none focus-visible:outline-none focus-visible:ring-0 disabled:pointer-events-none disabled:opacity-50"
- onClick={removeFromEntity}
- >
- <TrashIcon class="size-3" />
- </button>
- </Show>
+ <Show when={props.pinFirst}>{renderRemoveAction()}</Show>
</div>
</Show>
);
@@ -785,8 +799,12 @@ function UserStackPill(props: { property: Property }) {
);
}
-function MultiValue(props: { property: Property }) {
+function MultiValue(props: {
+ property: Property;
+ renderActions: () => JSX.Element;
+}) {
const ctx = usePropertiesContext();
+ const propertyCtx = useProperty();
const isReadOnly = () => !ctx.canEdit || props.property.isMetadata;
const isEntity = () => props.property.valueType === 'ENTITY';
const isUserEntity = () =>
@@ -800,7 +818,12 @@ function MultiValue(props: { property: Property }) {
<PropertyNS.Tooltip property={props.property}>
<Show
when={!isEntity()}
- fallback={<NonUserEntityValue property={props.property} />}
+ fallback={
+ <NonUserEntityValue
+ property={props.property}
+ renderActions={props.renderActions}
+ />
+ }
>
<div class="flex flex-wrap items-center gap-1.5">
<PropertyNS.Chips
@@ -817,14 +840,24 @@ function MultiValue(props: { property: Property }) {
</Layer>
)}
/>
- <Show when={!isReadOnly()}>
- <PropertyNS.Pill
- class="size-6 p-0"
- aria-label={`Add ${props.property.displayName}`}
- >
- <Plus class="size-3" />
- </PropertyNS.Pill>
- </Show>
+ <div class="flex shrink-0 items-center">
+ <Show when={!isReadOnly()}>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-xs"
+ class="text-ink-extra-muted"
+ aria-label={`Add ${props.property.displayName}`}
+ onClick={(event) => {
+ event.stopPropagation();
+ propertyCtx.openEditor(event.currentTarget);
+ }}
+ >
+ <Plus class="size-4" />
+ </Button>
+ </Show>
+ {props.renderActions()}
+ </div>
</div>
</Show>
</PropertyNS.Tooltip>
@@ -832,7 +865,10 @@ function MultiValue(props: { property: Property }) {
);
}
-function NonUserEntityValue(props: { property: Property }) {
+function NonUserEntityValue(props: {
+ property: Property;
+ renderActions: () => JSX.Element;
+}) {
const ctx = usePropertiesContext();
const propertyCtx = useProperty();
const entities = () => getEntityValues(props.property);
@@ -867,31 +903,35 @@ function NonUserEntityValue(props: { property: Property }) {
/>
)}
</For>
- <Show
- when={!isReadOnly()}
- fallback={
- <Show when={entities().length === 0}>
- <Badge variant="ghost" size="sm">
- <SidePanel.EmptyPill />
- </Badge>
+ <div class="flex shrink-0 items-center">
+ <Show
+ when={!isReadOnly()}
+ fallback={
+ <Show when={entities().length === 0}>
+ <Badge variant="ghost" size="sm">
+ <SidePanel.EmptyPill />
+ </Badge>
+ </Show>
+ }
+ >
+ <Show when={entities().length === 0 || props.property.isMultiSelect}>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-xs"
+ class="text-ink-extra-muted"
+ aria-label={`Add ${props.property.displayName}`}
+ onClick={(event) => {
+ event.stopPropagation();
+ propertyCtx.openEditor(event.currentTarget);
+ }}
+ >
+ <Plus class="size-4" />
+ </Button>
</Show>
- }
- >
- <Show when={entities().length === 0 || props.property.isMultiSelect}>
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label={`Add ${props.property.displayName}`}
- onClick={(event) => {
- event.stopPropagation();
- propertyCtx.openEditor(event.currentTarget);
- }}
- >
- <Plus class="size-3" />
- </Button>
</Show>
- </Show>
+ {props.renderActions()}
+ </div>
</div>
);
}
@@ -959,24 +999,25 @@ function EntityCollectionPropertyBody(props: {
>
{props.property.displayName}
</span>
- <div class="ml-auto flex shrink-0 items-center gap-1">
+ <div class="ml-auto flex shrink-0 items-center">
<Show when={!isReadOnly()}>
<Button
type="button"
variant="ghost"
- size="icon-sm"
- class="size-5"
+ size="icon-xs"
+ class="text-ink-extra-muted"
aria-label={`Add ${props.property.displayName}`}
onClick={(event) => {
event.stopPropagation();
propertyCtx.openEditor(event.currentTarget);
}}
>
- <Plus class="size-3" />
+ <Plus class="size-4" />
</Button>
</Show>
<PropertyRowActions
canRemoveFromEntity={props.canRemoveFromEntity}
+ pinFirst
property={props.property}
onRemovePendingProperty={props.onRemovePendingProperty}
onPropertyPinned={props.onPropertyPinned}