/* Context Menu mapping. Same anchored floating menu family as Dropdown Menu, opened by pointer context (right click / context key / long press). Surface values come from the Floating Semantic (--hm-sem-floating-*); item and text values are current HM values. Radix state attributes (data-highlighted, data-disabled, data-state) drive the states. Tokens are this component's own and never reference --hm-dropdown-menu-*. */ :root, [data-hm-theme] { --hm-context-menu-background: var(--hm-sem-floating-background); --hm-context-menu-text: var(--hm-sem-fg-primary); --hm-context-menu-border-width: var(--hm-sem-floating-border-width); --hm-context-menu-border-color: var(--hm-sem-floating-border-color); --hm-context-menu-radius: var(--hm-sem-floating-radius); --hm-context-menu-shadow: var(--hm-sem-floating-shadow); --hm-context-menu-padding: 4px; --hm-context-menu-item-height: 36px; --hm-context-menu-item-padding-x: 12px; --hm-context-menu-item-gap: 8px; --hm-context-menu-item-radius: 2px; --hm-context-menu-font-size: 14px; --hm-context-menu-line-height: 20px; --hm-context-menu-font-weight: 400; /* Highlighted (hover and keyboard) uses the same face as the Select option: the shadcn accent. */ --hm-context-menu-highlight-background: var(--hm-sem-surface-highlight); --hm-context-menu-highlight-text: var(--accent-foreground); --hm-context-menu-destructive-text: var(--hm-sem-action-destructive); --hm-context-menu-destructive-highlight-background: var(--hm-color-action-destructive-hover); --hm-context-menu-label-color: var(--hm-sem-fg-secondary); --hm-context-menu-label-font-size: 12px; --hm-context-menu-label-line-height: 18px; --hm-context-menu-label-font-weight: 500; --hm-context-menu-shortcut-color: var(--hm-sem-fg-secondary); --hm-context-menu-shortcut-font-size: 12px; --hm-context-menu-separator-color: var(--hm-sem-stroke-input-default); /* Check / radio indicator column at the start of the item. */ --hm-context-menu-indicator-size: 16px; --hm-context-menu-radio-dot-size: 8px; } [data-slot="context-menu-content"], [data-slot="context-menu-sub-content"] { box-sizing: border-box; padding: var(--hm-context-menu-padding); border: var(--hm-context-menu-border-width) solid var(--hm-context-menu-border-color); border-radius: var(--hm-context-menu-radius); background: var(--hm-context-menu-background); color: var(--hm-context-menu-text); box-shadow: var(--hm-context-menu-shadow); font-size: var(--hm-context-menu-font-size); line-height: var(--hm-context-menu-line-height); font-weight: var(--hm-context-menu-font-weight); } [data-slot="context-menu-item"], [data-slot="context-menu-checkbox-item"], [data-slot="context-menu-radio-item"], [data-slot="context-menu-sub-trigger"] { box-sizing: border-box; min-height: var(--hm-context-menu-item-height); gap: var(--hm-context-menu-item-gap); padding: 0 var(--hm-context-menu-item-padding-x); border-radius: var(--hm-context-menu-item-radius); } /* Checkbox / radio items reserve the indicator column; `inset` aligns plain items to the same text start. */ [data-slot="context-menu-checkbox-item"], [data-slot="context-menu-radio-item"], [data-slot="context-menu-item"][data-inset], [data-slot="context-menu-sub-trigger"][data-inset] { padding-left: calc(var(--hm-context-menu-item-padding-x) + var(--hm-context-menu-indicator-size) + var(--hm-context-menu-item-gap)); } [data-slot="context-menu-item-indicator"] { left: var(--hm-context-menu-item-padding-x); width: var(--hm-context-menu-indicator-size); height: var(--hm-context-menu-indicator-size); } [data-slot="context-menu-radio-dot"] { width: var(--hm-context-menu-radio-dot-size); height: var(--hm-context-menu-radio-dot-size); } /* Highlighted: Radix sets data-highlighted for pointer hover and keyboard focus alike. An open sub menu keeps its trigger highlighted. */ [data-slot="context-menu-item"][data-highlighted], [data-slot="context-menu-checkbox-item"][data-highlighted], [data-slot="context-menu-radio-item"][data-highlighted], [data-slot="context-menu-sub-trigger"][data-highlighted], [data-slot="context-menu-sub-trigger"][data-state="open"] { background: var(--hm-context-menu-highlight-background); color: var(--hm-context-menu-highlight-text); } [data-slot="context-menu-item"][data-variant="destructive"] { color: var(--hm-context-menu-destructive-text); } [data-slot="context-menu-item"][data-variant="destructive"][data-highlighted] { background: var(--hm-context-menu-destructive-highlight-background); color: var(--hm-context-menu-destructive-text); } [data-slot="context-menu-label"] { padding: 6px var(--hm-context-menu-item-padding-x); color: var(--hm-context-menu-label-color); font-size: var(--hm-context-menu-label-font-size); line-height: var(--hm-context-menu-label-line-height); font-weight: var(--hm-context-menu-label-font-weight); } [data-slot="context-menu-label"][data-inset] { padding-left: calc(var(--hm-context-menu-item-padding-x) + var(--hm-context-menu-indicator-size) + var(--hm-context-menu-item-gap)); } [data-slot="context-menu-separator"] { margin: var(--hm-context-menu-padding) calc(-1 * var(--hm-context-menu-padding)); background: var(--hm-context-menu-separator-color); } [data-slot="context-menu-shortcut"] { color: var(--hm-context-menu-shortcut-color); font-size: var(--hm-context-menu-shortcut-font-size); letter-spacing: 0.05em; } [data-slot="context-menu-item"][data-highlighted] [data-slot="context-menu-shortcut"], [data-slot="context-menu-checkbox-item"][data-highlighted] [data-slot="context-menu-shortcut"], [data-slot="context-menu-radio-item"][data-highlighted] [data-slot="context-menu-shortcut"] { color: inherit; }