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.

style(layer): layer styles for most property modals (#3012)

Seamusd95c82eb9b22
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 74b96c92be..d587330d5f 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -624,7 +624,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</Show>
<div class={cn('px-2 w-full', !callCtx?.isInCall() && 'mt-auto')}>
- <hr class="border-edge-muted mb-[8px]" />
+ <hr class="border-edge-muted mb-2" />
</div>
<div class="w-full px-2 flex flex-col">
@@ -800,7 +800,7 @@ const SidebarLink = (props: SidebarLinkProps) => {
<div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
<Hotkey shortcut={GO_TO_LEADER_KEY} />
</div>
- <div class="text-[0.625rem] text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
+ <div class="text-xxs text-ink-extra-muted rounded-sm ml-auto border border-ink/5 px-1.5 py-0.5 -my-1">
<Hotkey shortcut={props.hotkey} />
</div>
</Show>
diff --git a/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx b/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
index b5cc7531d0..e8db503070 100644
--- a/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
+++ b/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
@@ -153,7 +153,7 @@ export function PropertyEditorModal() {
<Dialog.Portal>
<DialogWrapper contentRef={mergeRefs(attach, setDialogRef)}>
<div class="flex flex-col max-h-108 overflow-hidden bracket-never text-sm">
- <div class="flex items-center gap-2 bg-panel px-2 h-[40px] border-b border-edge-muted shrink-0">
+ <div class="flex items-center gap-2 bg-panel px-2 h-10 border-b border-edge-muted shrink-0">
<span class="pl-2 pointer-events-none">❯</span>
<SearchInput
placeHolder={placeholder() || defaultPlaceholder}
@@ -300,7 +300,7 @@ function PropertyList(props: {
>
<div
ref={containerRef}
- class="max-h-[200px] overflow-y-auto overflow-x-hidden scrollbar-hidden p-1"
+ class="max-h-50 overflow-y-auto overflow-x-hidden scrollbar-hidden p-1"
>
<For each={filteredProperties()}>
{(property, index) => (
@@ -484,7 +484,7 @@ function SelectPropertyEditor(props: {
const selector = createSelector(props.selectedIndex);
return (
- <div class="p-1 max-h-[200px] overflow-y-auto overflow-x-hidden scrollbar-hidden">
+ <div class="p-1 max-h-50 overflow-y-auto overflow-x-hidden scrollbar-hidden">
<Show
when={filteredOptions().length > 0}
fallback={
@@ -577,7 +577,7 @@ function EntityPropertyEditor(props: {
const selector = createSelector(props.selectedIndex);
return (
- <div class="p-1 max-h-[200px] overflow-y-auto overflow-x-hidden scrollbar-hidden">
+ <div class="p-1 max-h-50 overflow-y-auto overflow-x-hidden scrollbar-hidden">
<Show
when={entities().length > 0}
fallback={
@@ -767,7 +767,7 @@ function DirectEditPropertyEditor(props: {
};
return (
- <div class="max-h-[200px] overflow-y-auto overflow-x-hidden scrollbar-hidden p-1">
+ <div class="max-h-50 overflow-y-auto overflow-x-hidden scrollbar-hidden p-1">
<ListItem
id="property-value-option-0"
isSelected={true}
@@ -841,7 +841,7 @@ function DatePropertyEditor(props: {
return (
<>
- <div class="p-1 max-h-[200px] overflow-y-auto overflow-x-hidden scrollbar-hidden">
+ <div class="p-1 max-h-50 overflow-y-auto overflow-x-hidden scrollbar-hidden">
<Show
when={dateOptions().length > 0}
fallback={
diff --git a/js/app/packages/block-md/component/History.tsx b/js/app/packages/block-md/component/History.tsx
index d6dd728a1d..a030888a18 100644
--- a/js/app/packages/block-md/component/History.tsx
+++ b/js/app/packages/block-md/component/History.tsx
@@ -562,7 +562,7 @@ function VersionListItem(props: {
}) {
return (
<button
- class="w-full p-2 sm:p-3 text-left flex items-center gap-2 sm:gap-3 min-h-[60px] sm:min-h-auto"
+ class="w-full p-2 sm:p-3 text-left flex items-center gap-2 sm:gap-3 min-h-15 sm:min-h-auto"
classList={{
'bg-hover': props.isSelected && !!props.handleSelect,
'hover:bg-hover hover-transition-bg': !!props.handleSelect,
diff --git a/js/app/packages/core/component/DialogWrapper.tsx b/js/app/packages/core/component/DialogWrapper.tsx
index 59f403e580..103ee0dfc8 100644
--- a/js/app/packages/core/component/DialogWrapper.tsx
+++ b/js/app/packages/core/component/DialogWrapper.tsx
@@ -36,7 +36,7 @@ export function DialogWrapper(props: DialogWrapperProps) {
style={{ width: width }}
onCloseAutoFocus={props.onCloseAutoFocus}
>
- <Panel depth={3} active>
+ <Panel depth={2} active>
<div
class={cn('*:max-h-[75vh]', props.class)}
ref={props.contentRef}
diff --git a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
index ae2c6b54dd..f43875def6 100644
--- a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
@@ -25,6 +25,7 @@ import {
} from '../../utils';
import { ERROR_MESSAGES } from '../../utils/errorHandling';
import { Dropdown, type DropdownOption } from './shared/Dropdown';
+import { Panel } from '@ui';
// Derive DataTypeValue from the dropdown options
type DataTypeValue = ReturnType<
@@ -416,7 +417,7 @@ export const CreatePropertyModal: Component<CreatePropertyModalProps> = (
>
<Dialog.Portal>
<DialogWrapper>
- <div class="flex flex-col overflow-hidden bracket-never text-sm">
+ <Panel depth={2} class="flex flex-col text-sm">
<div class="flex items-center justify-between gap-2 bg-panel px-2 h-10 border-b border-edge-muted shrink-0">
<Dialog.Title class="pl-2 text-sm font-medium">
Create New Property
@@ -609,7 +610,7 @@ export const CreatePropertyModal: Component<CreatePropertyModalProps> = (
</Show>
</Button>
</div>
- </div>
+ </Panel>
</DialogWrapper>
</Dialog.Portal>
</Dialog>
diff --git a/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx
index 759575daf6..4eb5873045 100644
--- a/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx
@@ -9,8 +9,6 @@ import { usePropertiesContext } from '../../context/PropertiesContext';
import { usePropertyEditor } from '../../hooks/usePropertyEditor';
import { formatOptionValue } from '../../utils';
import type { PropertyApiValues, PropertyEditorProps } from '../../types';
-
-false && floatWithElement;
import {
entityReferencesToIdSet,
updateEntityReferences,
@@ -23,10 +21,7 @@ import {
usePropertyOptionsQuery,
} from '@queries/properties/options';
import type { DateProperty } from '../../types';
-
-// Common CSS classes
-const MODAL_BASE =
- 'absolute z-action-menu bg-menu border border-edge-muted max-h-96 overflow-hidden flex flex-col w-full max-w-sm';
+import { cn, Layer } from '@ui';
export function EditPropertyValueModal(props: PropertyEditorProps) {
const propertyOptionsQuery = usePropertyOptionsQuery(
@@ -212,120 +207,128 @@ export function EditPropertyValueModal(props: PropertyEditorProps) {
handleClose();
}}
>
- <div
- ref={mergeRefs((ref) => {
- modalRef = ref;
- })}
- class={MODAL_BASE}
- tabIndex={-1}
- use:floatWithElement={{ element: () => props.anchorRef }}
- // All properties that reach this modal (select, entity, and date types) should auto-save
- onClick={(e) => e.stopPropagation()}
- >
- <Show when={!isLoading()}>
- <div class="bg-dialog text-ink">
- <div>
- <Show
- when={
- props.property.valueType === 'SELECT_STRING' ||
- props.property.valueType === 'SELECT_NUMBER'
- }
- fallback={
- <Show
- when={props.property.valueType === 'ENTITY'}
- fallback={
- <Show when={props.property.valueType === 'DATE'}>
- <PropertyDateSelector
- property={props.property as DateProperty}
- selectedDate={selectedDate()}
- onSelectDate={(date) => setSelectedDate(date)}
- onClose={handleClose}
- />
- </Show>
+ <Layer depth={2}>
+ <div
+ ref={mergeRefs((ref) => {
+ modalRef = ref;
+ floatWithElement(ref, () => ({
+ element: () => props.anchorRef,
+ }));
+ })}
+ class={cn(
+ 'absolute border border-edge rounded sm z-action-menu max-h-96 overflow-hidden flex flex-col w-full max-w-sm'
+ )}
+ tabIndex={-1}
+ onClick={(e) => e.stopPropagation()}
+ >
+ <Show when={!isLoading()}>
+ <div class="bg-dialog text-ink">
+ <div>
+ <Show
+ when={
+ props.property.valueType === 'SELECT_STRING' ||
+ props.property.valueType === 'SELECT_NUMBER'
+ }
+ fallback={
+ <Show
+ when={props.property.valueType === 'ENTITY'}
+ fallback={
+ <Show when={props.property.valueType === 'DATE'}>
+ <PropertyDateSelector
+ property={props.property as DateProperty}
+ selectedDate={selectedDate()}
+ onSelectDate={(date) => setSelectedDate(date)}
+ onClose={handleClose}
+ />
+ </Show>
+ }
+ >
+ <PropertyEntitySelector
+ config={{
+ isMultiSelect: props.property.isMultiSelect,
+ placeholder: `${props.property.isMultiSelect ? 'Add' : 'Change'} ${props.property.displayName.toLowerCase()}...`,
+ specificEntityType:
+ props.property.specificEntityType,
+ selfFilter: {
+ entityType: currentEntityType,
+ blockId,
+ },
+ }}
+ selectedOptions={() => {
+ const refs = selectedEntityRefs();
+ return entityReferencesToIdSet(refs);
+ }}
+ setSelectedOptions={(newOptions, entityInfo) => {
+ const currentRefs = selectedEntityRefs();
+ const updatedRefs = updateEntityReferences(
+ currentRefs,
+ newOptions,
+ entityInfo
+ );
+ setSelectedEntityRefs(updatedRefs);
+ }}
+ onClose={handleClose}
+ />
+ </Show>
+ }
+ >
+ <PropertyOptionSelector
+ config={{
+ isMultiSelect: props.property.isMultiSelect,
+ placeholder: `${props.property.isMultiSelect ? 'Add' : 'Change'} ${props.property.displayName.toLowerCase()}...`,
+ inputType:
+ props.property.valueType === 'SELECT_NUMBER'
+ ? 'number'
+ : 'text',
+ canAddOption: props.property.isSystemProperty
+ ? undefined
+ : (query) => {
+ if (props.property.valueType === 'SELECT_STRING')
+ return true;
+ if (
+ props.property.valueType === 'SELECT_NUMBER'
+ ) {
+ const n = parseFloat(query);
+ return !isNaN(n) && Number.isFinite(n);
+ }
+ return false;
+ },
+ }}
+ options={propertyOptions().map((opt) => ({
+ id: opt.id,
+ label: formatOptionValue(opt),
+ }))}
+ isLoading={false}
+ error={null}
+ selectedOptions={selectedOptions}
+ onToggleOption={toggleOption}
+ onAddOption={
+ props.property.isSystemProperty ? undefined : addOption
}
+ onClose={handleClose}
+ />
+ </Show>
+ </div>
+ <Show when={props.property.isMultiSelect}>
+ <div class="border-t border-edge-muted px-2 py-1.5 flex justify-end gap-1">
+ <button
+ class="text-xs text-ink-muted hover:text-ink px-2 py-1"
+ onClick={() => props.onClose()}
>
- <PropertyEntitySelector
- config={{
- isMultiSelect: props.property.isMultiSelect,
- placeholder: `${props.property.isMultiSelect ? 'Add' : 'Change'} ${props.property.displayName.toLowerCase()}...`,
- specificEntityType: props.property.specificEntityType,
- selfFilter: {
- entityType: currentEntityType,
- blockId,
- },
- }}
- selectedOptions={() => {
- const refs = selectedEntityRefs();
- return entityReferencesToIdSet(refs);
- }}
- setSelectedOptions={(newOptions, entityInfo) => {
- const currentRefs = selectedEntityRefs();
- const updatedRefs = updateEntityReferences(
- currentRefs,
- newOptions,
- entityInfo
- );
- setSelectedEntityRefs(updatedRefs);
- }}
- onClose={handleClose}
- />
- </Show>
- }
- >
- <PropertyOptionSelector
- config={{
- isMultiSelect: props.property.isMultiSelect,
- placeholder: `${props.property.isMultiSelect ? 'Add' : 'Change'} ${props.property.displayName.toLowerCase()}...`,
- inputType:
- props.property.valueType === 'SELECT_NUMBER'
- ? 'number'
- : 'text',
- canAddOption: props.property.isSystemProperty
- ? undefined
- : (query) => {
- if (props.property.valueType === 'SELECT_STRING')
- return true;
- if (props.property.valueType === 'SELECT_NUMBER') {
- const n = parseFloat(query);
- return !isNaN(n) && Number.isFinite(n);
- }
- return false;
- },
- }}
- options={propertyOptions().map((opt) => ({
- id: opt.id,
- label: formatOptionValue(opt),
- }))}
- isLoading={false}
- error={null}
- selectedOptions={selectedOptions}
- onToggleOption={toggleOption}
- onAddOption={
- props.property.isSystemProperty ? undefined : addOption
- }
- onClose={handleClose}
- />
+ Cancel
+ </button>
+ <button
+ class="text-xs text-ink-muted hover:text-ink px-2 py-1"
+ onClick={handleClose}
+ >
+ Done
+ </button>
+ </div>
</Show>
</div>
- <Show when={props.property.isMultiSelect}>
- <div class="border-t border-edge-muted px-2 py-1.5 flex justify-end gap-1">
- <button
- class="text-xs text-ink-muted hover:text-ink px-2 py-1"
- onClick={() => props.onClose()}
- >
- Cancel
- </button>
- <button
- class="text-xs text-ink-muted hover:text-ink px-2 py-1"
- onClick={handleClose}
- >
- Done
- </button>
- </div>
- </Show>
- </div>
- </Show>
- </div>
+ </Show>
+ </div>
+ </Layer>
</div>
</ScopedPortal>
);
diff --git a/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
index 959ac1c5b6..f409fd6b01 100644
--- a/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
@@ -27,6 +27,7 @@ import {
toPropertyDefinitionDomain,
useSearchInputFocus,
} from '../../utils';
+import { Panel } from '@ui';
export function SelectPropertyModal(props: PropertySelectorProps) {
const blockId = useBlockId();
@@ -160,9 +161,11 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
>
<Dialog.Portal>
<DialogWrapper contentRef={setDialogRef}>
- <div class="flex flex-col overflow-hidden bracket-never text-sm">
- <div class="flex items-center gap-2 bg-panel px-2 h-[40px] border-b border-edge-muted shrink-0">
- <span class="pl-2 pointer-events-none">❯</span>
+ <Panel depth={2} class="flex flex-col text-sm">
+ <div class="flex items-center gap-2 bg-panel px-2 h-10 border-b border-edge-muted shrink-0">
+ <span class="pl-2 pointer-events-none text-ink-extra-muted">
+ ❯
+ </span>
<input
ref={searchInputRef}
type="text"
@@ -195,7 +198,7 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
type="button"
id={`select-property-option-${index()}`}
class={cn(
- 'flex flex-row w-full items-center gap-2 py-1.5 px-2 scroll-my-1',
+ 'flex flex-row w-full items-center gap-2 py-1.5 px-2 scroll-my-1 bracket-never',
isFocused(index()) && 'bg-hover'
)}
onClick={() => addProperty(property.id)}
@@ -236,7 +239,7 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
</div>
</Show>
</div>
- </div>
+ </Panel>
</DialogWrapper>
</Dialog.Portal>
</Dialog>
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx b/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx
index 2fc0568cad..44e70b6f32 100644
--- a/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx
@@ -11,6 +11,7 @@ import {
onCleanup,
Show,
} from 'solid-js';
+import { Layer } from '@ui';
export type DropdownOption<T> = {
value: T;
@@ -125,42 +126,44 @@ export const Dropdown = <T extends string | number>(
</button>
<Show when={isOpen()}>
<ScopedPortal scope="local">
- <div
- ref={menuRef}
- class="z-toast-region border border-edge-muted bg-menu shadow-lg max-h-64 overflow-y-auto p-1"
- style={getMenuStyle()}
- >
- <For each={props.options}>
- {(option) => {
- const isSelected = () => option.value === props.value;
- const isDisabled = () => option.disabled ?? false;
+ <Layer depth={2}>
+ <div
+ ref={menuRef}
+ class="z-toast-region border border-edge bg-menu shadow-lg max-h-64 overflow-y-auto p-1"
+ style={getMenuStyle()}
+ >
+ <For each={props.options}>
+ {(option) => {
+ const isSelected = () => option.value === props.value;
+ const isDisabled = () => option.disabled ?? false;
- return (
- <button
- type="button"
- onClick={() => {
- if (!isDisabled()) {
- props.onChange(option.value);
- setIsOpen(false);
- }
- }}
- disabled={isDisabled()}
- class={cn(
- 'w-full p-1.5 text-sm text-left flex items-center justify-between',
- isDisabled()
- ? 'opacity-50 cursor-not-allowed'
- : isSelected()
- ? 'bg-active text-ink'
- : 'hover:bg-hover/50 text-ink'
- )}
- >
- {props.renderOption?.(option, isSelected()) ??
- defaultRenderOption(option, isSelected())}
- </button>
- );
- }}
- </For>
- </div>
+ return (
+ <button
+ type="button"
+ onClick={() => {
+ if (!isDisabled()) {
+ props.onChange(option.value);
+ setIsOpen(false);
+ }
+ }}
+ disabled={isDisabled()}
+ class={cn(
+ 'w-full p-1.5 text-sm text-left flex items-center justify-between',
+ isDisabled()
+ ? 'opacity-50 cursor-not-allowed'
+ : isSelected()
+ ? 'bg-active text-ink'
+ : 'hover:bg-hover/50 text-ink'
+ )}
+ >
+ {props.renderOption?.(option, isSelected()) ??
+ defaultRenderOption(option, isSelected())}
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ </Layer>
</ScopedPortal>
</Show>
</div>
diff --git a/js/app/packages/core/component/Tooltip.tsx b/js/app/packages/core/component/Tooltip.tsx
index d5c5ca1e47..b0de30ac9f 100644
--- a/js/app/packages/core/component/Tooltip.tsx
+++ b/js/app/packages/core/component/Tooltip.tsx
@@ -159,7 +159,7 @@ export function LabelAndHotKey(props: LabelAndHotKeyProps) {
<For each={props.hotkeySequence}>
{(step, ndx) => (
<>
- <div class="text-xxs rounded-sm border border-edge-muted px-1.5 py-0.25">
+ <div class="text-xxs rounded-sm border border-edge-muted px-1.5 py-px">
<Hotkey
token={step.token}
shortcut={step.shortcut}
@@ -175,7 +175,7 @@ export function LabelAndHotKey(props: LabelAndHotKeyProps) {
</div>
</Show>
<Show when={hasSingleHotkey()}>
- <div class="text-xxs rounded-sm ml-auto border border-edge-muted px-1.5 py-0.25">
+ <div class="text-xxs rounded-sm ml-auto border border-edge-muted px-1.5 py-px">
{props.hotkeyToken
? Hotkey({ token: props.hotkeyToken, class: 'flex gap-1' })
: Hotkey({ shortcut: props.shortcut, class: 'flex gap-1' })}
diff --git a/js/app/packages/ui/components/Panel.tsx b/js/app/packages/ui/components/Panel.tsx
index 5ba1098da8..4fe9a66a8c 100644
--- a/js/app/packages/ui/components/Panel.tsx
+++ b/js/app/packages/ui/components/Panel.tsx
@@ -1,29 +1,33 @@
import { cn } from '../utils/classname';
-import type { JSX } from 'solid-js';
+import { splitProps, type JSX } from 'solid-js';
import { Layer } from './Layer';
-export type PanelProps = {
+export type PanelProps = JSX.HTMLAttributes<HTMLDivElement> & {
highlightColor?: string;
- children?: JSX.Element;
active?: boolean;
- class?: string;
depth?: 0 | 1 | 2 | 3 | 4 | 5;
+ hidden?: boolean;
};
export function Panel(props: PanelProps) {
+ const [local, rest] = splitProps(props, ['highlightColor', 'active', 'depth', 'class', 'children', 'hidden']);
return (
- <Layer depth={props.depth ?? 0}>
+ <Layer depth={local.depth ?? 0}>
<div
- style={{'background-image': `linear-gradient(${props.active ? `${props.highlightColor || 'var(--color-accent)'}, var(--color-edge) 80%` : 'var(--color-edge)'})`}}
- class="p-px h-full w-full box-border rounded-md overflow-clip min-h-0"
+ style={{
+ 'background-image': `linear-gradient(${props.active ? `${props.highlightColor || 'var(--color-acent)'}, var(--color-edge) 80%` : 'var(--color-edge)'})`,
+ 'display': local.hidden ? 'none' : 'block'
+ }}
+ class={cn("p-px h-full w-full box-border rounded-md overflow-clip min-h-0")}
>
<div
class={cn(
'h-full w-full box-border bg-panel rounded-[5px] overflow-clip',
- props.class
+ local.class
)}
+ {...rest}
>
- {props.children}
+ {local.children}
</div>
</div>
</Layer>