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.

refactor(properties): move code from core to properties package, continue component improve (#3350)

Seamus57319c8c208e
diff --git a/js/app/packages/app/component/PropertyFilter/FilterValueEntity.tsx b/js/app/packages/app/component/PropertyFilter/FilterValueEntity.tsx
index 52e0d8b1d3..2c00c82aee 100644
--- a/js/app/packages/app/component/PropertyFilter/FilterValueEntity.tsx
+++ b/js/app/packages/app/component/PropertyFilter/FilterValueEntity.tsx
@@ -1,3 +1,10 @@
+import { usePropertyEntityDisplay } from '@core/component/Properties/hooks/usePropertyEntityDisplay';
+import { useEmail, useUserId } from '@core/context/user';
+import { useAugmentUserWithDmActivity } from '@core/user';
+import { createFreshSearch } from '@core/util/freshSort';
+import type { EmailEntity } from '@entity';
+import { createEmailsInfiniteQuery } from '@macro-entity';
+import XIcon from '@phosphor/x.svg';
import {
type CombinedEntity,
createEntitySearchConfig,
@@ -11,14 +18,7 @@ import {
threadMapper,
useQuickAccessEntities,
userToEntity,
-} from '@core/component/Properties/component/modal/shared/entityUtils';
-import { usePropertyEntityDisplay } from '@core/component/Properties/hooks/usePropertyEntityDisplay';
-import { useEmail, useUserId } from '@core/context/user';
-import { useAugmentUserWithDmActivity } from '@core/user';
-import { createFreshSearch } from '@core/util/freshSort';
-import type { EmailEntity } from '@entity';
-import { createEmailsInfiniteQuery } from '@macro-entity';
-import XIcon from '@phosphor/x.svg';
+} from '@property';
import { useSearchSoupQuery } from '@queries/soup/search';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
import { debounce } from '@solid-primitives/scheduled';
diff --git a/js/app/packages/app/component/next-soup/search-context.tsx b/js/app/packages/app/component/next-soup/search-context.tsx
index a2ab99b551..e4a9467920 100644
--- a/js/app/packages/app/component/next-soup/search-context.tsx
+++ b/js/app/packages/app/component/next-soup/search-context.tsx
@@ -1,5 +1,4 @@
-import { useQuickAccessEntities } from '@core/component/Properties/component/modal';
-import type { EntityTypeItemMap } from '@core/component/Properties/component/modal/shared/entityUtils';
+import { type EntityTypeItemMap, useQuickAccessEntities } from '@property';
import { EntityType } from '@service-properties/generated/schemas/entityType';
import {
type Accessor,
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 aeecd6f378..d42cd4cddc 100644
--- a/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
+++ b/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
@@ -1,8 +1,3 @@
-import {
- type CombinedEntity,
- getEntityName,
- getEntityType,
-} from '@core/component/Properties/component/modal/shared/entityUtils';
import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue';
import { usePropertySelection } from '@core/component/Properties/hooks';
import { usePropertyEntityDisplay } from '@core/component/Properties/hooks/usePropertyEntityDisplay';
@@ -25,6 +20,7 @@ import {
useListKeyBindings,
} from '@core/util/useListKeyBindings';
import { type EntityData, InlineEntity } from '@entity';
+import { type CombinedEntity, getEntityName, getEntityType } from '@property';
import { useEntityPropertiesQuery } from '@queries/properties/entity';
import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
import { mergeRefs } from '@solid-primitives/refs';
diff --git a/js/app/packages/app/component/property-edit-modal/hooks/useEntitiesForProperty.ts b/js/app/packages/app/component/property-edit-modal/hooks/useEntitiesForProperty.ts
index 067e9d87e9..da9a2f8a21 100644
--- a/js/app/packages/app/component/property-edit-modal/hooks/useEntitiesForProperty.ts
+++ b/js/app/packages/app/component/property-edit-modal/hooks/useEntitiesForProperty.ts
@@ -1,3 +1,12 @@
+import type {
+ Property,
+ PropertyDefinitionDomain,
+} from '@core/component/Properties/types';
+import { useEmail, useUserId } from '@core/context/user';
+import { useAugmentUserWithDmActivity } from '@core/user';
+import { createFreshSearch } from '@core/util/freshSort';
+import type { EmailEntity } from '@entity';
+import { createEmailsInfiniteQuery } from '@macro-entity';
import {
type CombinedEntity,
createEntitySearchConfig,
@@ -10,16 +19,7 @@ import {
threadMapper,
useQuickAccessEntities,
userToEntity,
-} from '@core/component/Properties/component/modal/shared/entityUtils';
-import type {
- Property,
- PropertyDefinitionDomain,
-} from '@core/component/Properties/types';
-import { useEmail, useUserId } from '@core/context/user';
-import { useAugmentUserWithDmActivity } from '@core/user';
-import { createFreshSearch } from '@core/util/freshSort';
-import type { EmailEntity } from '@entity';
-import { createEmailsInfiniteQuery } from '@macro-entity';
+} from '@property';
import { useSearchSoupQuery } from '@queries/soup/search';
import { debounce } from '@solid-primitives/scheduled';
import {
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 b40199a5bc..29c7ba7c5d 100644
--- a/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx
@@ -2,6 +2,7 @@ import { useBlockId } from '@core/block';
import { useUserId } from '@core/context/user';
import LoadingSpinner from '@phosphor/spinner.svg';
import XIcon from '@phosphor/x.svg';
+import { Dropdown, type DropdownOption } from '@property';
import { useCreatePropertyDefinitionMutation } from '@queries/properties/definitions';
import { useAddEntityPropertyMutation } from '@queries/properties/entity';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
@@ -14,14 +15,12 @@ import {
Index,
Show,
} from 'solid-js';
-
import { usePropertiesContext } from '../../context/PropertiesContext';
import {
getPropertyDataTypeDropdownOptions,
usePropertyNameFocus,
} from '../../utils';
import { ERROR_MESSAGES } from '../../utils/errorHandling';
-import { Dropdown, type DropdownOption } from './shared/Dropdown';
// Derive DataTypeValue from the dropdown options
type DataTypeValue = ReturnType<
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 b75cc382d2..df16ba184b 100644
--- a/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx
@@ -1,348 +1,61 @@
import { useMaybeBlockId } from '@core/block';
-import { floatWithElement } from '@core/component/LexicalMarkdown/directive/floatWithElement';
-import { ScopedPortal } from '@core/component/ScopedPortal';
-import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
-import {
- useAddPropertyOptionMutation,
- usePropertyOptionsQuery,
-} from '@queries/properties/options';
-import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
-import { mergeRefs } from '@solid-primitives/refs';
-import { cn, Layer } from '@ui';
-import { createSignal, onMount, Show } from 'solid-js';
+import { Property, type PropertyApiValues, useProperty } from '@property';
+import { createEffect, onMount } from 'solid-js';
import { usePropertiesContext } from '../../context/PropertiesContext';
-import { usePropertyEditor } from '../../hooks/usePropertyEditor';
-import type {
- DateProperty,
- PropertyApiValues,
- PropertyEditorProps,
-} from '../../types';
-import { formatOptionValue } from '../../utils';
-import {
- entityReferencesToIdSet,
- updateEntityReferences,
-} from '../../utils/entityConversion';
-import { PropertyDateSelector } from './shared/PropertyDateSelector';
-import { PropertyEntitySelector } from './shared/PropertyEntitySelector';
-import { PropertyOptionSelector } from './shared/PropertyOptionSelector';
-
+import type { PropertyEditorProps } from '../../types';
+
+/**
+ * Bridge from the legacy PropertiesContext modal stack to the new
+ * @property primitives. Mounts <Property.Root> with the saved property,
+ * forwards saves through PropertiesContext's saveHandler, and auto-opens the
+ * popover editor against the click anchor. When the local editor closes
+ * (ESC / click-out / save-on-close), notifies the legacy stack to clear its
+ * modal state.
+ *
+ * Inline-edit-only types (STRING / NUMBER / BOOLEAN / LINK) never route here
+ * — they edit in place. This bridge therefore only renders the popover
+ * editors (DATE / SELECT_* / ENTITY).
+ */
export function EditPropertyValueModal(props: PropertyEditorProps) {
- const propertyOptionsQuery = usePropertyOptionsQuery(
- () => props.property.propertyDefinitionId
- );
-
- const addPropertyOptionMutation = useAddPropertyOptionMutation({});
-
- const propertyOptions = () => {
- if (
- propertyOptionsQuery.isLoading ||
- propertyOptionsQuery.isError ||
- !propertyOptionsQuery.data
- )
- return [];
- return propertyOptionsQuery.data;
- };
-
- const isLoading = () =>
- propertyOptionsQuery.isLoading || addPropertyOptionMutation.isPending;
-
- const { saveHandler, entityType: currentEntityType } = usePropertiesContext();
+ const { saveHandler, entityType } = usePropertiesContext();
const blockId = useMaybeBlockId();
- let modalRef!: HTMLDivElement;
-
- const [attachHotkeys, modalScopeId] = useHotkeyDOMScope(
- 'property-edit-modal',
- false
- );
-
- const [selectedEntityRefs, setSelectedEntityRefs] = createSignal<
- EntityReference[]
- >(
- props.property.valueType === 'ENTITY' && props.property.value != null
- ? props.property.value
- : []
- );
-
- const [selectedDate, setSelectedDate] = createSignal<Date | null>(
- props.property.valueType === 'DATE' && props.property.value != null
- ? new Date(props.property.value)
- : null
- );
+ const onSave = (
+ p: Parameters<typeof saveHandler.saveProperty>[0],
+ v: PropertyApiValues
+ ) => saveHandler.saveProperty(p, v);
- const {
- selectedOptions,
- hasChanges,
- initializeSelectedOptions,
- toggleOption,
- clearOptions,
- addOption,
- } = usePropertyEditor(
- props.property,
- propertyOptions,
- addPropertyOptionMutation.mutateAsync
+ return (
+ <Property.Root
+ property={props.property}
+ canEdit
+ onSave={onSave}
+ onRefresh={props.onSaved}
+ >
+ <LegacyEditorBridge anchor={props.anchorRef} onExit={props.onClose} />
+ <Property.PopoverEditor entitySelfFilter={{ entityType, blockId }} />
+ </Property.Root>
);
+}
- const saveChanges = async () => {
- const selectedArray = Array.from(selectedOptions());
-
- let apiValues: PropertyApiValues;
-
- switch (props.property.valueType) {
- case 'SELECT_STRING':
- apiValues = {
- valueType: 'SELECT_STRING',
- values: selectedArray.length > 0 ? selectedArray : null,
- };
- break;
- case 'SELECT_NUMBER':
- apiValues = {
- valueType: 'SELECT_NUMBER',
- values: selectedArray.length > 0 ? selectedArray : null,
- };
- break;
- case 'ENTITY': {
- const refs = selectedEntityRefs();
- apiValues = {
- valueType: 'ENTITY',
- refs: refs.length > 0 ? refs : null,
- };
- break;
- }
- case 'DATE': {
- const date = selectedDate();
- apiValues = {
- valueType: 'DATE',
- value: date,
- };
- break;
- }
- default:
- console.error(
- 'PropertyEditor.saveChanges:',
- new Error(
- `Invalid property type for modal editor: ${props.property.valueType}`
- )
- );
- props.onClose();
- return;
- }
-
- try {
- await saveHandler.saveProperty(props.property, apiValues);
- props.onSaved();
- } catch (error) {
- console.error('Failed to save property:', error);
- }
-
- props.onClose();
- };
-
- const hasEntityChanges = () => {
- if (props.property.valueType !== 'ENTITY') return false;
-
- const currentRefs = selectedEntityRefs();
- const originalRefs = props.property.value ?? [];
-
- // Compare lengths first
- if (currentRefs.length !== originalRefs.length) return true;
-
- // Compare each reference
- return !currentRefs.every((currentRef) =>
- originalRefs.some(
- (originalRef) =>
- originalRef.entity_id === currentRef.entity_id &&
- originalRef.entity_type === currentRef.entity_type
- )
- );
- };
-
- const hasDateChanges = () => {
- if (props.property.valueType !== 'DATE') return false;
-
- const currentDate = selectedDate();
- const originalDate = props.property.value
- ? new Date(props.property.value)
- : null;
-
- if (!currentDate && !originalDate) return false;
-
- if (!currentDate || !originalDate) return true;
-
- return currentDate.getTime() !== originalDate.getTime();
- };
-
- const handleClose = async () => {
- const hasUnsavedChanges =
- hasChanges() || hasEntityChanges() || hasDateChanges();
- if (hasUnsavedChanges) {
- await saveChanges();
- } else {
- props.onClose();
- }
- };
+function LegacyEditorBridge(props: {
+ anchor?: HTMLElement;
+ onExit: () => void;
+}) {
+ const ctx = useProperty();
+ let hasOpened = false;
onMount(() => {
- initializeSelectedOptions();
- propertyOptionsQuery.refetch();
-
- // Attach hotkeys to modal element
- attachHotkeys(modalRef);
+ ctx.openEditor(props.anchor);
+ });
- // Register escape key handler
- registerHotkey({
- hotkey: 'escape',
- scopeId: modalScopeId,
- description: 'Close property modal',
- keyDownHandler: () => {
- handleClose();
- return true;
- },
- runWithInputFocused: true,
- });
+ createEffect(() => {
+ if (ctx.editorOpen()) {
+ hasOpened = true;
+ } else if (hasOpened) {
+ props.onExit();
+ }
});
- return (
- <ScopedPortal scope="local">
- <div
- class="fixed inset-0 z-modal"
- onClick={(e) => {
- e.stopPropagation();
- handleClose();
- }}
- >
- <Layer depth={2}>
- <div
- ref={mergeRefs((ref) => {
- modalRef = ref;
- floatWithElement(ref, () => ({
- element: () => props.anchorRef,
- }));
- })}
- class={cn(
- 'absolute border border-edge rounded-md z-action-menu max-h-96 overflow-hidden flex flex-col w-full max-w-60 shadow-md shadow-drop-shadow'
- )}
- tabIndex={-1}
- onClick={(e) => e.stopPropagation()}
- >
- <Show when={!isLoading()}>
- <div class="bg-surface 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
- }
- clearOption={
- !props.property.isMultiSelect &&
- !props.property.isRequired
- ? {
- label: `No ${props.property.displayName.toLowerCase()}`,
- onClear: clearOptions,
- }
- : undefined
- }
- 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()}
- >
- 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>
- </Layer>
- </div>
- </ScopedPortal>
- );
+ return null;
}
diff --git a/js/app/packages/core/component/Properties/component/modal/index.ts b/js/app/packages/core/component/Properties/component/modal/index.ts
index 10e1178d71..d1fc93097d 100644
--- a/js/app/packages/core/component/Properties/component/modal/index.ts
+++ b/js/app/packages/core/component/Properties/component/modal/index.ts
@@ -1,5 +1,30 @@
+// The selectors and entity utilities used to live under ./shared. They were
+// physically moved into @property/editors/selectors; this barrel re-exports
+// the public-facing helpers so callers that pulled them from the modal
+// barrel keep working. Long-term, import directly from '@property'.
+export {
+ type CombinedEntity,
+ createEntitySearchConfig,
+ Dropdown,
+ type DropdownOption,
+ type EntityTypeItemMap,
+ entityDataToEntity,
+ entityTypeToBuckets,
+ getEntityName,
+ getEntitySearchText,
+ getEntityTimestampedItem,
+ getEntityType,
+ isChannelEntity,
+ PropertyDateSelector,
+ PropertyEntitySelector,
+ PropertyOptionSelector,
+ quickAccessItemToEntity,
+ sortEntitiesWithSelfFirst,
+ threadMapper,
+ useQuickAccessEntities,
+ userToEntity,
+} from '@property';
export { CreatePropertyModal } from './CreatePropertyModal';
export { EditPropertyValueModal } from './EditPropertyValueModal';
export { Modals } from './Modals';
export { SelectPropertyModal } from './SelectPropertyModal';
-export * from './shared';
diff --git a/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsx
index 85fbafc886..4539f1ee70 100644
--- a/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsx
+++ b/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsx
@@ -1,7 +1,6 @@
import { useMaybeBlockAliasedName } from '@core/block';
import { type Component, createMemo, For, Show } from 'solid-js';
import { getBuiltinPropertyIds } from '../../constants';
-import { usePropertiesContext } from '../../context/PropertiesContext';
import type { Property } from '../../types';
import { PropertyRow } from './PropertyRow';
@@ -13,8 +12,6 @@ interface PropertiesListProps {
}
export const PropertyGrid: Component<PropertiesListProps> = (props) => {
- const { openPropertyEditor } = usePropertiesContext();
-
const blockName = useMaybeBlockAliasedName();
const builtinPropertyIds = blockName ? getBuiltinPropertyIds(blockName) : [];
@@ -54,18 +51,6 @@ export const PropertyGrid: Component<PropertiesListProps> = (props) => {
propertyGroups().userProperties.length > 0
);
- const handleValueClick = (property: Property, anchor?: HTMLElement) => {
- if (
- property.valueType === 'DATE' ||
- property.valueType === 'SELECT_STRING' ||
- property.valueType === 'SELECT_NUMBER' ||
- property.valueType === 'ENTITY'
- ) {
- openPropertyEditor(property, anchor);
- }
- // LINK, STRING, NUMBER, BOOLEAN handle their own inline editing
- };
-
return (
<Show
when={props.properties.length > 0}
@@ -84,26 +69,14 @@ export const PropertyGrid: Component<PropertiesListProps> = (props) => {
{/* Metadata properties */}
<Show when={propertyGroups().metadata.length > 0}>
<For each={propertyGroups().metadata}>
- {(property) => (
- <PropertyRow
- property={property}
- onValueClick={handleValueClick}
- withPin
- />
- )}
+ {(property) => <PropertyRow property={property} withPin />}
</For>
</Show>
{/* Builtin properties (block-specific, non-removable) */}
<Show when={propertyGroups().builtinProperties.length > 0}>
<For each={propertyGroups().builtinProperties}>
- {(property) => (
- <PropertyRow
- property={property}
- onValueClick={handleValueClick}
- withPin
- />
- )}
+ {(property) => <PropertyRow property={property} withPin />}
</For>
</Show>
@@ -118,7 +91,6 @@ export const PropertyGrid: Component<PropertiesListProps> = (props) => {
{(property) => (
<PropertyRow
property={property}
- onValueClick={handleValueClick}
withDelete={props.withDelete}
withPin={props.withPin}
/>
diff --git a/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsx
index 7a7b54ed4e..e4cd0b495b 100644
--- a/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsx
+++ b/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsx
@@ -1,16 +1,26 @@
+import { useMaybeBlockId } from '@core/block';
+import { Property } from '@property';
import type { Component } from 'solid-js';
-import type { Property } from '../../types';
-import { PropertyValue } from '../propertyValue/PropertyValue';
+import { usePropertiesContext } from '../../context/PropertiesContext';
+import type { Property as PropertyT } from '../../types';
import { PropertyLabel } from './PropertyLabel';
interface PropertyRowProps {
- property: Property;
- onValueClick: (property: Property, anchor?: HTMLElement) => void;
+ property: PropertyT;
withDelete?: boolean;
withPin?: boolean;
}
+/**
+ * Panel row: label + value. Value uses Property.Display, which composes
+ * display + inline/popover editing entirely from primitives — the legacy
+ * PropertiesContext modal stack is bypassed here. Saves still route through
+ * the panel's saveHandler (bulk-save mutation).
+ */
export const PropertyRow: Component<PropertyRowProps> = (props) => {
+ const { saveHandler, entityType, onRefresh } = usePropertiesContext();
+ const blockId = useMaybeBlockId();
+
return (
<>
<div class="flex items-start min-w-0">
@@ -21,7 +31,14 @@ export const PropertyRow: Component<PropertyRowProps> = (props) => {
/>
</div>
<div class="ph-no-capture flex items-start min-w-0">
- <PropertyValue property={props.property} onEdit={props.onValueClick} />
+ <Property.Root
+ property={props.property}
+ canEdit
+ onSave={(p, v) => saveHandler.saveProperty(p, v)}
+ onRefresh={onRefresh}
+ >
+ <Property.Display entitySelfFilter={{ entityType, blockId }} />
+ </Property.Root>
</div>
</>
);
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx
deleted file mode 100644
index 1748fe840b..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import CheckIcon from '@phosphor/check.svg';
-import type { Component } from 'solid-js';
-import { Show } from 'solid-js';
-import { useBooleanEditor } from '../../hooks';
-import type { Property } from '../../types';
-import { type PropertyValueProps, stubSaveHandler } from './ValueComponents';
-
-/**
- * Display component for boolean properties with instant toggle
- * Treats null as false (unchecked)
- */
-export const BooleanValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
-
- const { value, isSaving, toggle } = useBooleanEditor(
- props.property as Property & { valueType: 'BOOLEAN' },
- saveHandler(),
- props.onRefresh
- );
-
- const isReadOnly = () => props.property.isMetadata || !props.canEdit;
-
- // Treat null as false - use !! to convert any truthy value to boolean
- const isChecked = () => !!value();
-
- const handleClick = () => {
- if (!isReadOnly() && !isSaving()) {
- toggle();
- }
- };
-
- return (
- <button
- onClick={handleClick}
- disabled={isSaving() || isReadOnly()}
- class="flex items-center justify-end p-1"
- classList={{
- 'cursor-default': isReadOnly() || isSaving(),
- 'hover:bg-hover': !isReadOnly() && !isSaving(),
- }}
- >
- <div
- class="size-4 flex items-center justify-center"
- classList={{
- 'bg-accent border-accent border': isChecked(),
- 'bg-transparent border-edge-muted border': !isChecked(),
- }}
- >
- <Show when={isChecked()}>
- <CheckIcon class="size-3 text-surface" />
- </Show>
- </div>
- </button>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
deleted file mode 100644
index bf956ac52c..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-import { getSelectValues } from '@core/component/Properties/utils';
-import CircleDashedEmpty from '@phosphor/circle-dashed.svg';
-import { cn, HoverCard } from '@ui';
-import type { Component, JSX } from 'solid-js';
-import { Show } from 'solid-js';
-import type { Property } from '../../types';
-import {
- formatBoolean,
- formatDate,
- formatNumber,
-} from '../../utils/formatting';
-import {
- hasValue,
- isBooleanProperty,
- isDateProperty,
- isEntityProperty,
- isNumberProperty,
- isSelectProperty,
- isStringProperty,
-} from '../../utils/typeGuards';
-import { PropertyTooltip } from './PropertyTooltip';
-import { PropertyValueIcon } from './PropertyValueIcon';
-import { UserGroup } from './UserGroup';
-
-type CondensedPropertyValueProps = {
- property: Property;
- canEdit: boolean;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
-};
-
-/**
- * Condensed property value display - shows as an icon-only pill but launches full modals for editing
- * Similar to PropertyPills but integrated with the Properties context for editing
- */
-export const CondensedPropertyValue: Component<CondensedPropertyValueProps> = (
- props
-) => {
- const validValue = () => hasValue(props.property);
-
- const handleClick = (e: MouseEvent) => {
- if (!props.canEdit) return;
- e.preventDefault();
- e.stopPropagation();
- const target = e.currentTarget as HTMLElement;
- props.onEdit?.(props.property, target);
- };
-
- return (
- <HoverCard content={<PropertyTooltip property={props.property} />}>
- <div
- class={cn(
- 'inline-flex items-center text-xs leading-none text-ink-muted shrink-0 p-1.5 h-6.5 transition-colors rounded-sm',
- {
- 'hover:bg-hover': props.canEdit,
- 'opacity-50': !validValue(),
- }
- )}
- onClick={handleClick}
- role={props.canEdit ? 'button' : undefined}
- tabIndex={props.canEdit ? 0 : undefined}
- >
- <CondensedIcon property={props.property} />
- </div>
- </HoverCard>
- );
-};
-
-const CondensedIcon = (props: { property: Property }): JSX.Element => {
- const internal = (): JSX.Element | null => {
- if (!hasValue(props.property)) return null;
-
- // Entity properties - show user group or fallback
- if (isEntityProperty(props.property)) {
- if (props.property.specificEntityType === 'USER') {
- return <UserGroup entities={props.property.value ?? []} maxUsers={2} />;
- }
- // For non-user entities, show count if multiple
- const count = props.property.value?.length ?? 0;
- if (count > 0) {
- return (
- <span class="truncate max-w-25">
- {count === 1 ? '1 item' : `${count} items`}
- </span>
- );
- }
- return null;
- }
-
- // Select properties - show icon for first selected option
- if (isSelectProperty(props.property)) {
- const values = getSelectValues(props.property);
- if (values.length > 0) {
- return PropertyValueIcon({ optionId: values[0] });
- }
- return null;
- }
-
- // Date properties - show formatted date
- if (isDateProperty(props.property)) {
- const value = props.property.value;
- if (value) {
- return <span class="truncate max-w-25">{formatDate(value)}</span>;
- }
- return null;
- }
-
- // String properties - show truncated value
- if (isStringProperty(props.property)) {
- const value = props.property.value;
- if (value) {
- return <span class="truncate max-w-25">{value}</span>;
- }
- return null;
- }
-
- // Number properties - show formatted number
- if (isNumberProperty(props.property)) {
- const value = props.property.value;
- if (value !== null) {
- return <span class="truncate max-w-25">{formatNumber(value)}</span>;
- }
- return null;
- }
-
- // Boolean properties - show True/False
- if (isBooleanProperty(props.property)) {
- const value = props.property.value;
- if (value !== null) {
- return <span class="truncate max-w-25">{formatBoolean(value)}</span>;
- }
- return null;
- }
-
- return null;
- };
-
- return (
- <Show
- when={internal()}
- fallback={<CircleDashedEmpty class="size-3 shrink-0" />}
- >
- {(content) => content()}
- </Show>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx
deleted file mode 100644
index 4ad7b0ac79..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import DeleteIcon from '@phosphor/x.svg';
-import { cn } from '@ui';
-import type { Component } from 'solid-js';
-import { createSignal, Show } from 'solid-js';
-import { formatDate } from '../../utils';
-import {
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
-
-/**
- * Display component for date properties
- * Opens date picker modal on click
- */
-export const DateValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
- const [isHovered, setIsHovered] = createSignal(false);
- const [isSaving, setIsSaving] = createSignal(false);
-
- const handleClick = (e: MouseEvent) => {
- if (props.canEdit && !props.property.isMetadata) {
- props.onEdit?.(props.property, e.currentTarget as HTMLElement);
- }
- };
-
- const handleDelete = async () => {
- if (isReadOnly() || isSaving()) return;
-
- setIsSaving(true);
-
- try {
- await saveHandler().saveProperty(props.property, {
- valueType: 'DATE',
- value: null,
- });
- props.onRefresh?.();
- } catch {
- // Error toast is shown by mutation's onError callback
- } finally {
- setIsSaving(false);
- }
- };
-
- const isReadOnly = () => props.property.isMetadata || !props.canEdit;
-
- const displayValue =
- props.property.value != null
- ? formatDate(props.property.value as Date)
- : '';
-
- return (
- <div
- class={cn('relative inline-flex max-w-full shrink-0 rounded-sm', {
- 'hover:bg-hover': props.canEdit,
- })}
- onMouseEnter={() => setIsHovered(true)}
- onMouseLeave={() => setIsHovered(false)}
- >
- <button
- onClick={handleClick}
- class="inline-flex items-center leading-none shrink-0 p-1.5 h-6.5 transition-colors"
- >
- <Show when={displayValue} fallback={<EmptyValue />}>
- <span class="block truncate max-w-full">{displayValue}</span>
- </Show>
- </button>
- <Show when={!isReadOnly() && isHovered() && displayValue && !isSaving()}>
- <div class="absolute right-0 inset-y-0 flex items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm">
- <button
- onClick={handleDelete}
- disabled={isSaving()}
- class="size-4 p-0.5 flex items-center justify-center text-ink-muted hover:text-failure-ink rounded-sm"
- >
- <DeleteIcon class="size-3" />
- </button>
- </div>
- </Show>
- </div>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
deleted file mode 100644
index 4dd9fa54fc..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
-import type { Component } from 'solid-js';
-import { createSignal, For, Show } from 'solid-js';
-import { getEntityValues } from '../../utils';
-import { EntityIcon } from './EntityIcon';
-import {
- AddPropertyValueButton,
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
-
-/**
- * Display component for entity properties
- * Shows entity badges and opens modal on click
- */
-export const EntityValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
- const [isSaving, setIsSaving] = createSignal(false);
-
- const handleEditClick = (e: MouseEvent) => {
- if (props.canEdit && !props.property.isMetadata) {
- props.onEdit?.(props.property, e.currentTarget as HTMLElement);
- }
- };
-
- const handleEditEntity = (anchor?: HTMLElement) => {
- if (props.canEdit && !props.property.isMetadata) {
- props.onEdit?.(props.property, anchor);
- }
- };
-
- const handleRemoveEntity = async (entityToRemove: EntityReference) => {
- if (isReadOnly() || isSaving()) return;
-
- setIsSaving(true);
-
- try {
- const entities = getEntityValues(props.property);
- const newValues = entities.filter(
- (entity: EntityReference) =>
- entity.entity_id !== entityToRemove.entity_id ||
- entity.entity_type !== entityToRemove.entity_type
- );
-
- await saveHandler().saveProperty(props.property, {
- valueType: 'ENTITY',
- refs: newValues.length > 0 ? newValues : null,
- });
- props.onRefresh?.();
- } catch {
- // Error toast is shown by mutation's onError callback
- } finally {
- setIsSaving(false);
- }
- };
-
- const isReadOnly = () => props.property.isMetadata || !props.canEdit;
- const entities = getEntityValues(props.property);
- return (
- <div class="flex flex-wrap gap-1 justify-start items-start w-full min-w-0">
- <For each={entities}>
- {(entityRef) => (
- <EntityIcon
- property={props.property}
- entityId={entityRef.entity_id}
- entityType={entityRef.entity_type}
- specificMessageId={entityRef.specific_message_id}
- canEdit={!isReadOnly()}
- onRemove={() => handleRemoveEntity(entityRef)}
- onEdit={handleEditEntity}
- isSaving={isSaving()}
- />
- )}
- </For>
- <Show
- when={!isReadOnly()}
- fallback={
- <Show when={entities.length === 0}>
- <div class="text-ink-muted px-2 py-0.5 bg-transparent inline-block shrink-0 rounded-sm">
- <EmptyValue />
- </div>
- </Show>
- }
- >
- <Show when={entities.length === 0 || props.property.isMultiSelect}>
- <AddPropertyValueButton onClick={handleEditClick} />
- </Show>
- </Show>
- </div>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx
deleted file mode 100644
index a9e2a05e98..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
-import type { Component } from 'solid-js';
-import { Dynamic, Show } from 'solid-js/web';
-import { match } from 'ts-pattern';
-import {
- type PropertySaveHandler,
- usePropertiesContext,
-} from '../../context/PropertiesContext';
-import type { Property } from '../../types';
-import { BooleanValue } from './BooleanValue';
-import { CondensedPropertyValue } from './CondensedPropertyValue';
-import { DateValue } from './DateValue';
-import { EntityValue } from './EntityValue';
-import { LinkValue } from './LinkValue';
-import { NumberValue } from './NumberValue';
-import { SelectValue } from './SelectValue';
-import { TextValue } from './TextValue';
-import { stubSaveHandler } from './ValueComponents';
-
-/**
- * Attempts to use PropertiesContext, returning stub values if not within a provider
- */
-function tryUsePropertiesContext(): {
- entityType?: EntityType;
- canEdit: boolean;
- onRefresh: () => void;
- saveHandler: PropertySaveHandler;
- openPropertyEditor: (property: Property, anchor?: HTMLElement) => void;
-} {
- try {
- return usePropertiesContext();
- } catch {
- return {
- entityType: undefined,
- canEdit: false,
- onRefresh: () => {},
- saveHandler: stubSaveHandler,
- openPropertyEditor: () => {},
- };
- }
-}
-
-/**
- * Router component that delegates to type-specific display components
- */
-export const PropertyValue: Component<{
- property: Property;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
- condensed?: boolean;
-}> = (props) => {
- const context = tryUsePropertiesContext();
- const expanded = () => !props.condensed;
-
- const valueComponent = () =>
- match(props.property)
- .with({ valueType: 'STRING' }, () => TextValue)
- .with({ valueType: 'NUMBER' }, () => NumberValue)
- .with({ valueType: 'BOOLEAN' }, () => BooleanValue)
- .with({ valueType: 'DATE' }, () => DateValue)
- .with({ valueType: 'SELECT_STRING' }, () => SelectValue)
- .with({ valueType: 'SELECT_NUMBER' }, () => SelectValue)
- .with({ valueType: 'ENTITY' }, () => EntityValue)
- .with({ valueType: 'LINK' }, () => LinkValue)
- .exhaustive();
-
- return (
- <Show
- when={expanded()}
- fallback={
- <CondensedPropertyValue
- property={props.property}
- canEdit={context.canEdit}
- onEdit={props.onEdit ?? context.openPropertyEditor}
- />
- }
- >
- <Dynamic
- component={valueComponent()}
- property={props.property}
- canEdit={context.canEdit}
- entityType={context.entityType}
- onEdit={props.onEdit}
- onRefresh={context.onRefresh}
- saveHandler={context.saveHandler}
- />
- </Show>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx
deleted file mode 100644
index 72d2bb3fa2..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import DeleteIcon from '@phosphor/x.svg';
-import type { Component } from 'solid-js';
-import { createSignal, For, Show } from 'solid-js';
-import { PROPERTY_STYLES } from '../../styles/styles';
-import { formatPropertyValue, getSelectValues } from '../../utils';
-import { PropertyValueIcon } from './PropertyValueIcon';
-import {
- AddPropertyValueButton,
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
-
-/**
- * Display component for select_string and select_number properties
- * Opens options modal on click
- */
-export const SelectValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
- const [hoveredValue, setHoveredValue] = createSignal<string | null>(null);
- const [isSaving, setIsSaving] = createSignal(false);
-
- const handleClick = (e: MouseEvent) => {
- if (props.canEdit && !props.property.isMetadata) {
- e.stopPropagation();
- props.onEdit?.(props.property, e.currentTarget as HTMLElement);
- }
- };
-
- const handleRemoveValue = async (valueToRemove: string) => {
- if (isReadOnly() || isSaving()) return;
-
- setIsSaving(true);
-
- try {
- const values = displayValues;
- const newValues = values.filter((v) => v !== valueToRemove);
-
- const valueType = props.property.valueType;
- if (valueType !== 'SELECT_STRING' && valueType !== 'SELECT_NUMBER') {
- return;
- }
-
- await saveHandler().saveProperty(props.property, {
- valueType,
- values: newValues.length > 0 ? newValues : null,
- });
- props.onRefresh?.();
- } catch {
- // Error toast is shown by mutation's onError callback
- } finally {
- setIsSaving(false);
- }
- };
-
- const isReadOnly = () => props.property.isMetadata || !props.canEdit;
- const displayValues = getSelectValues(props.property);
-
- return (
- <div class="flex flex-wrap gap-2 justify-start items-start w-full min-w-0">
- <For each={displayValues}>
- {(value) => {
- const formatted = formatPropertyValue(props.property, value);
- const isHovered = () => hoveredValue() === value;
- return (
- <div
- class="relative inline-flex max-w-35 shrink-0 rounded-sm hover:bg-hover"
- onMouseEnter={() => setHoveredValue(value)}
- onMouseLeave={() => setHoveredValue(null)}
- >
- <div
- class={PROPERTY_STYLES.value.multiButton}
- title={formatted}
- onClick={
- !props.property.isMultiSelect ? handleClick : undefined
- }
- style={{
- cursor: 'default',
- }}
- >
- <PropertyValueIcon optionId={value} />
- <span class="block truncate">{formatted}</span>
- </div>
- <Show when={!isReadOnly() && isHovered() && !isSaving()}>
- <div class="absolute right-0 inset-y-0 flex items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm">
- <button
- onClick={() => handleRemoveValue(value)}
- disabled={isSaving()}
- class="size-4 p-0.5 flex items-center justify-center text-ink-muted hover:text-failure-ink rounded-sm"
- >
- <DeleteIcon class="size-3" />
- </button>
- </div>
- </Show>
- </div>
- );
- }}
- </For>
- <Show
- when={!isReadOnly()}
- fallback={
- <Show when={displayValues.length === 0}>
- <div class="text-ink-muted px-2 py-0.5 bg-transparent inline-block shrink-0 rounded-sm">
- <EmptyValue />
- </div>
- </Show>
- }
- >
- <Show when={props.property.isMultiSelect || displayValues.length === 0}>
- <AddPropertyValueButton onClick={handleClick} />
- </Show>
- </Show>
- </div>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx b/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx
deleted file mode 100644
index 6293e91cd1..0000000000
--- a/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
-import type { Component, JSX } from 'solid-js';
-import { twMerge } from 'tailwind-merge';
-import type { PropertySaveHandler } from '../../context/PropertiesContext';
-import type { Property } from '../../types';
-
-/**
- * Stub save handler for read-only contexts.
- */
-export const stubSaveHandler: PropertySaveHandler = {
- saveProperty: async () => {},
- saveDate: async () => {},
-};
-
-/**
- * Shared props type for all property value display components
- */
-export type PropertyValueProps = {
- property: Property;
- canEdit: boolean;
- entityType?: EntityType;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
- onRefresh?: () => void;
- saveHandler?: PropertySaveHandler;
-};
-
-/**
- * Shared UI primitives for property value display components
- * Provides consistent styling and behavior across all value types
- */
-
-/** CSS classes for common property value UI patterns */
-const STYLES = {
- addButton:
- 'text-ink-muted hover:text-ink hover:bg-hover px-2 py-0.5 inline-block shrink-0 rounded-sm',
-} as const;
-
-/**
- * Empty value display - just the "—" symbol
- * Consistent component used everywhere
- */
-export const EmptyValue: Component = () => {
- return <span class="opacity-20">Empty</span>;
-};
-
-/**
- * Button for adding values to multi-value properties (select, link, entity)
- * Shows "+" with hover states
- */
-export const AddPropertyValueButton: Component<{
- onClick: ((e: MouseEvent) => void) | (() => void);
- disabled?: boolean;
-}> = (props) => {
- return (
- <button
- onClick={props.onClick as (e: MouseEvent) => void}
- disabled={props.disabled}
- class={twMerge(STYLES.addButton, 'cursor-default')}
- >
- +
- </button>
- );
-};
-
-/**
- * Container for clickable property values (used by Date, Select, Entity)
- * Provides consistent button styling with optional hover states
- */
-export const PropertyValueButton: Component<{
- onClick?: (e: MouseEvent) => void;
- isReadOnly: boolean;
- disabled?: boolean;
- title?: string;
- class?: string;
- children: JSX.Element;
-}> = (props) => {
- return (
- <button
- onClick={props.onClick}
- disabled={props.disabled}
- title={props.title}
- class={twMerge(
- 'text-left px-2 py-0.5 bg-transparent cursor-default rounded-sm',
- props.class
- )}
- classList={{
- 'text-ink-muted': props.isReadOnly,
- 'text-ink': !props.isReadOnly,
- }}
- >
- {props.children}
- </button>
- );
-};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/index.ts b/js/app/packages/core/component/Properties/component/propertyValue/index.ts
index 7f6fb668fc..6b9ab24029 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/index.ts
+++ b/js/app/packages/core/component/Properties/component/propertyValue/index.ts
@@ -1,13 +1,4 @@
-export { BooleanValue } from './BooleanValue';
-export { CondensedPropertyValue } from './CondensedPropertyValue';
-export { DateValue } from './DateValue';
export { EntityIcon } from './EntityIcon';
-export { EntityValue } from './EntityValue';
-export { LinkValue } from './LinkValue';
-export { NumberValue } from './NumberValue';
export { PropertyTooltip } from './PropertyTooltip';
-export { PropertyValue } from './PropertyValue';
export { PropertyValueIcon } from './PropertyValueIcon';
-export { SelectValue } from './SelectValue';
-export { TextValue } from './TextValue';
-export * from './ValueComponents';
+export { UserGroup } from './UserGroup';
diff --git a/js/app/packages/core/component/Properties/hooks/index.ts b/js/app/packages/core/component/Properties/hooks/index.ts
index b8f18c6f3c..8a2fcc2d27 100644
--- a/js/app/packages/core/component/Properties/hooks/index.ts
+++ b/js/app/packages/core/component/Properties/hooks/index.ts
@@ -1,6 +1,4 @@
-export { useBooleanEditor } from './useBooleanEditor';
export { useEntityProperties } from './useEntityProperties';
-export { useInlineEditor } from './useInlineEditor';
export { usePropertyEditor } from './usePropertyEditor';
export { usePropertyEntityDisplay } from './usePropertyEntityDisplay';
export { usePropertySelection } from './usePropertySelection';
diff --git a/js/app/packages/core/component/Properties/hooks/useBooleanEditor.ts b/js/app/packages/core/component/Properties/hooks/useBooleanEditor.ts
deleted file mode 100644
index 38557cd9ac..0000000000
--- a/js/app/packages/core/component/Properties/hooks/useBooleanEditor.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { type Accessor, createMemo, createSignal } from 'solid-js';
-import type { PropertySaveHandler } from '../context/PropertiesContext';
-import type { Property } from '../types';
-
-/**
- * Hook for editing boolean properties
- *
- * @param property - The property to toggle
- * @param entityType - The type of entity
- * @param onSaved - Callback when save succeeds
- */
-export function useBooleanEditor(
- property: Property & { valueType: 'BOOLEAN' },
- saveHandler: PropertySaveHandler,
- onSaved?: () => void
-): {
- value: Accessor<boolean | null>;
- isSaving: Accessor<boolean>;
- toggle: () => Promise<void>;
-} {
- const [isSaving, setIsSaving] = createSignal(false);
-
- const currentValue = createMemo(() => {
- return property.value as boolean | null;
- });
-
- const toggle = async () => {
- if (isSaving()) return;
-
- setIsSaving(true);
-
- try {
- const actualValue = property.value as boolean | null;
-
- // If currently unset (null), set to true
- // Otherwise toggle between true and false
- const newValue = actualValue === null ? true : !actualValue;
-
- await saveHandler.saveProperty(property, {
- valueType: 'BOOLEAN',
- value: newValue,
- });
- onSaved?.();
- } catch {
- // Error toast is shown by mutation's onError callback
- } finally {
- setIsSaving(false);
- }
- };
-
- return {
- value: currentValue,
- isSaving,
- toggle,
- };
-}
diff --git a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
index 3511e4b112..886f2fed6c 100644
--- a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
+++ b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx
@@ -1,16 +1,17 @@
import { Modals } from '@core/component/Properties/component/modal';
-import { PropertyValue } from '@core/component/Properties/component/propertyValue/PropertyValue';
import {
PropertiesProvider,
type PropertySaveHandler,
+ usePropertiesContext,
} from '@core/component/Properties/context/PropertiesContext';
import type {
Property,
PropertyApiValues,
} from '@core/component/Properties/types';
+import { Property as PropertyComponent } from '@property';
import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
import { EntityType } from '@service-properties/generated/schemas/entityType';
-import { createMemo, For, Show, Suspense } from 'solid-js';
+import { type Accessor, createMemo, For, Show, Suspense } from 'solid-js';
import { match } from 'ts-pattern';
import {
type EntityData,
@@ -46,19 +47,10 @@ export interface EntityKeyPropertiesProps {
}
/**
- * Displays key properties (Status, Priority, Assignees) for an entity.
- *
- * This is an opinionated, high-level component that:
- * - Takes only an entity as input
- * - Automatically extracts properties from the entity
- * - Filters to only show Status, Priority, and Assignees
- * - Renders them in a consistent order
- * - Handles save mutations internally
- *
- * @example
- * ```tsx
- * <EntityKeyProperties entity={taskEntity} />
- * ```
+ * Displays key properties (Status, Priority, Assignees) for an entity as a
+ * row of condensed icon-only pills. Click routes through the legacy modal
+ * stack via `openPropertyEditor` so the existing PropertyEditModal (now
+ * itself a thin bridge over Property.PopoverEditor) handles editing.
*/
export function EntityKeyProperties(props: EntityKeyPropertiesProps) {
const entityType = createMemo(() => getEntityType(props.entity));
@@ -99,15 +91,10 @@ export function EntityKeyProperties(props: EntityKeyPropertiesProps) {
onPropertyDeleted={() => {}}
saveHandler={saveHandler}
>
- <div class="flex items-center gap-1 justify-start overflow-hidden">
- <For each={keyProperties()}>
- {(property) => (
- <div class="relative">
- <PropertyValue property={property} condensed />
- </div>
- )}
- </For>
- </div>
+ <KeyPropertiesRow
+ properties={keyProperties}
+ onRefresh={props.onRefresh}
+ />
<Suspense>
<Modals />
</Suspense>
@@ -115,3 +102,30 @@ export function EntityKeyProperties(props: EntityKeyPropertiesProps) {
</Show>
);
}
+
+function KeyPropertiesRow(props: {
+ properties: Accessor<Property[]>;
+ onRefresh?: () => void;
+}) {
+ const { saveHandler, openPropertyEditor } = usePropertiesContext();
+
+ return (
+ <div class="flex items-center gap-1 justify-start overflow-hidden">
+ <For each={props.properties()}>
+ {(property) => (
+ <div class="relative">
+ <PropertyComponent.Root
+ property={property}
+ canEdit
+ onSave={(p, v) => saveHandler.saveProperty(p, v)}
+ onEdit={openPropertyEditor}
+ onRefresh={props.onRefresh}
+ >
+ <PropertyComponent.DisplayCondensed />
+ </PropertyComponent.Root>
+ </div>
+ )}
+ </For>
+ </div>
+ );
+}
diff --git a/js/app/packages/property/src/composed/PropertyDisplay.tsx b/js/app/packages/property/src/composed/PropertyDisplay.tsx
new file mode 100644
index 0000000000..31dc00cacc
--- /dev/null
+++ b/js/app/packages/property/src/composed/PropertyDisplay.tsx
@@ -0,0 +1,271 @@
+import { EntityIcon } from '@core/component/Properties/component/propertyValue/EntityIcon';
+import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { cn } from '@ui';
+import { For, Match, Show, Switch } from 'solid-js';
+import { useProperty } from '../core/context';
+import { InlineEditor } from '../editors/inline/InlineEditor';
+import { PopoverEditor } from '../editors/popover/PopoverEditor';
+import { PropertyAddButton } from '../extractors/PropertyAddButton';
+import { PropertyEditTrigger } from '../extractors/PropertyEditTrigger';
+import { PropertyEmpty } from '../extractors/PropertyEmpty';
+import { PropertyRemoveButton } from '../extractors/PropertyRemoveButton';
+import { PropertyText } from '../extractors/PropertyText';
+import {
+ formatDate,
+ formatPropertyValue,
+ getEntityValues,
+ getSelectValues,
+ hasValue,
+} from '../utils';
+
+export type PropertyDisplayProps = {
+ /**
+ * Forwarded to PopoverEditor when the property is an ENTITY type — filters
+ * the owning entity out of the picker.
+ */
+ entitySelfFilter?: { entityType: EntityType; blockId?: string };
+};
+
+/**
+ * Opinionated composition of display + editing affordances. Drop-in
+ * replacement for the legacy PropertyValue router.
+ *
+ * Routes by valueType:
+ * - STRING / NUMBER / BOOLEAN / LINK: <Property.InlineEditor>
+ * - DATE / SELECT (single): button with formatted text + RemoveButton on
+ * hover, opens popover
+ * - SELECT (multi): chip list with per-chip RemoveButton + AddButton
+ * - ENTITY: legacy EntityIcon per value (handles entity-name resolution and
+ * navigation) + AddButton when applicable
+ *
+ * Must be inside <Property.Root>.
+ */
+export function PropertyDisplay(props: PropertyDisplayProps) {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const isReadOnly = () => !ctx.canEdit() || !!property().isMetadata;
+ const isInline = () => {
+ const t = property().valueType;
+ return t === 'STRING' || t === 'NUMBER' || t === 'BOOLEAN' || t === 'LINK';
+ };
+
+ return (
+ <Switch>
+ <Match when={isInline()}>
+ <InlineEditor />
+ </Match>
+ <Match when={property().valueType === 'DATE'}>
+ <DateDisplay />
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </Match>
+ <Match
+ when={
+ (property().valueType === 'SELECT_STRING' ||
+ property().valueType === 'SELECT_NUMBER') &&
+ !property().isMultiSelect
+ }
+ >
+ <SingleSelectDisplay />
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </Match>
+ <Match
+ when={
+ property().valueType === 'SELECT_STRING' ||
+ property().valueType === 'SELECT_NUMBER'
+ }
+ >
+ <MultiSelectDisplay isReadOnly={isReadOnly()} />
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </Match>
+ <Match when={property().valueType === 'ENTITY'}>
+ <EntityDisplay isReadOnly={isReadOnly()} />
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </Match>
+ </Switch>
+ );
+}
+
+function DateDisplay() {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const display = () =>
+ property().valueType === 'DATE' && property().value != null
+ ? formatDate(property().value as Date)
+ : '';
+
+ return (
+ <div
+ class={cn(
+ 'group relative inline-flex max-w-full shrink-0 rounded-sm',
+ ctx.canEdit() && !property().isMetadata && 'hover:bg-hover'
+ )}
+ >
+ <PropertyEditTrigger class="inline-flex items-center leading-none shrink-0 p-1.5 h-6.5 transition-colors">
+ <Show when={display()} fallback={<PropertyEmpty label="Empty" />}>
+ <span class="block truncate max-w-full">{display()}</span>
+ </Show>
+ </PropertyEditTrigger>
+ <Show
+ when={hasValue(property()) && ctx.canEdit() && !property().isMetadata}
+ >
+ <div class="absolute right-0 inset-y-0 hidden items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm group-hover:flex">
+ <PropertyRemoveButton />
+ </div>
+ </Show>
+ </div>
+ );
+}
+
+function SingleSelectDisplay() {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const value = () => getSelectValues(property())[0];
+ const label = () =>
+ value() ? formatPropertyValue(property(), value()!) : '';
+
+ return (
+ <div
+ class={cn(
+ 'group relative inline-flex max-w-35 shrink-0 rounded-sm',
+ ctx.canEdit() && !property().isMetadata && 'hover:bg-hover'
+ )}
+ >
+ <PropertyEditTrigger class="text-left px-2 py-0.5 bg-transparent inline-flex items-center gap-1.5 w-full">
+ <Show when={value()}>
+ {(id) => <PropertyValueIcon optionId={id()} />}
+ </Show>
+ <Show when={label()} fallback={<PropertyEmpty label="Empty" />}>
+ <span class="block truncate">{label()}</span>
+ </Show>
+ </PropertyEditTrigger>
+ <Show when={value() && ctx.canEdit() && !property().isMetadata}>
+ <div class="absolute right-0 inset-y-0 hidden items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm group-hover:flex">
+ <PropertyRemoveButton />
+ </div>
+ </Show>
+ </div>
+ );
+}
+
+function MultiSelectDisplay(props: { isReadOnly: boolean }) {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const values = () => getSelectValues(property());
+
+ return (
+ <div class="flex flex-wrap gap-2 justify-start items-start w-full min-w-0">
+ <For each={values()}>
+ {(value) => (
+ <div class="group relative inline-flex max-w-35 shrink-0 rounded-sm hover:bg-hover">
+ <div
+ class="text-left px-2 py-0.5 bg-transparent cursor-default inline-flex items-center gap-1.5"
+ title={formatPropertyValue(property(), value)}
+ >
+ <PropertyValueIcon optionId={value} />
+ <span class="block truncate">
+ {formatPropertyValue(property(), value)}
+ </span>
+ </div>
+ <Show when={!props.isReadOnly}>
+ <div class="absolute right-0 inset-y-0 hidden items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm group-hover:flex">
+ <PropertyRemoveButton valueToRemove={value} />
+ </div>
+ </Show>
+ </div>
+ )}
+ </For>
+ <Show
+ when={!props.isReadOnly}
+ fallback={
+ <Show when={values().length === 0}>
+ <div class="text-ink-muted px-2 py-0.5 bg-transparent inline-block shrink-0 rounded-sm">
+ <PropertyEmpty label="Empty" />
+ </div>
+ </Show>
+ }
+ >
+ <PropertyAddButton />
+ </Show>
+ </div>
+ );
+}
+
+function EntityDisplay(props: { isReadOnly: boolean }) {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const entities = () => getEntityValues(property());
+
+ const handleRemoveEntity = async (entityId: string) => {
+ const remaining = entities().filter((e) => e.entity_id !== entityId);
+ await ctx.onSave?.(property(), {
+ valueType: 'ENTITY',
+ refs: remaining.length > 0 ? remaining : null,
+ });
+ ctx.onRefresh?.();
+ };
+
+ return (
+ <div class="flex flex-wrap gap-1 justify-start items-start w-full min-w-0">
+ <For each={entities()}>
+ {(entityRef) => (
+ <EntityIcon
+ property={property()}
+ entityId={entityRef.entity_id}
+ entityType={entityRef.entity_type}
+ specificMessageId={entityRef.specific_message_id}
+ canEdit={!props.isReadOnly}
+ onRemove={() => handleRemoveEntity(entityRef.entity_id)}
+ onEdit={(anchor) => {
+ if (props.isReadOnly) return;
+ if (ctx.onEdit) ctx.onEdit(property(), anchor);
+ else ctx.openEditor(anchor);
+ }}
+ />
+ )}
+ </For>
+ <Show
+ when={!props.isReadOnly}
+ fallback={
+ <Show when={entities().length === 0}>
+ <div class="text-ink-muted px-2 py-0.5 bg-transparent inline-block shrink-0 rounded-sm">
+ <PropertyEmpty label="Empty" />
+ </div>
+ </Show>
+ }
+ >
+ <Show when={entities().length === 0 || property().isMultiSelect}>
+ <PropertyAddButton />
+ </Show>
+ </Show>
+ </div>
+ );
+}
+
+/**
+ * Condensed (icon-only pill) display — used in inline mention contexts and
+ * compact list views. Falls back to PropertyEmpty when no value.
+ */
+export function PropertyDisplayCondensed(props: PropertyDisplayProps) {
+ const ctx = useProperty();
+ const property = () => ctx.property();
+ const valid = () => hasValue(property());
+
+ return (
+ <>
+ <PropertyEditTrigger
+ class={cn(
+ 'inline-flex items-center text-xs leading-none text-ink-muted shrink-0 p-1.5 h-6.5 transition-colors rounded-sm',
+ ctx.canEdit() && 'hover:bg-hover',
+ !valid() && 'opacity-50'
+ )}
+ >
+ <PropertyText
+ property={property()}
+ fallback={<PropertyEmpty label="" />}
+ />
+ </PropertyEditTrigger>
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </>
+ );
+}
diff --git a/js/app/packages/property/src/core/Root.tsx b/js/app/packages/property/src/core/Root.tsx
index cf5c441c62..4741b75964 100644
--- a/js/app/packages/property/src/core/Root.tsx
+++ b/js/app/packages/property/src/core/Root.tsx
@@ -1,5 +1,5 @@
import { cn } from '@ui';
-import { type JSX, splitProps } from 'solid-js';
+import { createSignal, type JSX, splitProps } from 'solid-js';
import type { Property } from '../types';
import {
type PropertyEditFn,
@@ -28,6 +28,11 @@ export function Root(props: PropertyRootProps) {
'children',
]);
+ const [editorOpen, setEditorOpen] = createSignal(false);
+ const [editorAnchor, setEditorAnchor] = createSignal<HTMLElement | undefined>(
+ undefined
+ );
+
const value: PropertyRootContextValue = {
property: () => local.property,
canEdit: () => local.canEdit ?? false,
@@ -40,6 +45,16 @@ export function Root(props: PropertyRootProps) {
get onRefresh() {
return local.onRefresh;
},
+ editorOpen,
+ editorAnchor,
+ openEditor: (anchor) => {
+ setEditorAnchor(() => anchor);
+ setEditorOpen(true);
+ },
+ closeEditor: () => {
+ setEditorOpen(false);
+ setEditorAnchor(() => undefined);
+ },
};
return (
diff --git a/js/app/packages/property/src/core/context.ts b/js/app/packages/property/src/core/context.ts
index 36dddac858..cf66cf8a27 100644
--- a/js/app/packages/property/src/core/context.ts
+++ b/js/app/packages/property/src/core/context.ts
@@ -1,4 +1,4 @@
-import { createContext, useContext } from 'solid-js';
+import { type Accessor, createContext, useContext } from 'solid-js';
import type { Property, PropertyApiValues } from '../types';
export type PropertySaveFn = (
@@ -14,6 +14,14 @@ export interface PropertyRootContextValue {
onSave?: PropertySaveFn;
onEdit?: PropertyEditFn;
onRefresh?: () => void;
+
+ // Local editor open state. Populated by EditTrigger when the consumer
+ // hasn't supplied an external onEdit; consumed by PopoverEditor. Always
+ // present (signals never undefined) so consumers can read without nulls.
+ editorOpen: Accessor<boolean>;
+ editorAnchor: Accessor<HTMLElement | undefined>;
+ openEditor: (anchor?: HTMLElement) => void;
+ closeEditor: () => void;
}
export const PropertyRootContext = createContext<PropertyRootContextValue>();
diff --git a/js/app/packages/property/src/debug/PropertyDebug.tsx b/js/app/packages/property/src/debug/PropertyDebug.tsx
index 685bd0583f..72d34694ed 100644
--- a/js/app/packages/property/src/debug/PropertyDebug.tsx
+++ b/js/app/packages/property/src/debug/PropertyDebug.tsx
@@ -2,14 +2,14 @@ import { SplitHeaderLeft } from '@app/component/split-layout/components/SplitHea
import { StaticSplitLabel } from '@app/component/split-layout/components/SplitLabel';
import { seedMockDisplayNames } from '@core/user';
import { cn } from '@ui';
-import { type Component, For, type JSX, Show } from 'solid-js';
+import { type Component, createSignal, For, type JSX, Show } from 'solid-js';
import {
PROPERTIES_EMPTY,
PROPERTIES_FILLED,
PROPERTIES_METADATA,
} from '../../mocks/mockProperties';
import { Property } from '../property';
-import type { Property as PropertyT } from '../types';
+import type { PropertyApiValues, Property as PropertyT } from '../types';
// Seed mock display names so user properties render real first names.
seedMockDisplayNames([
@@ -269,6 +269,10 @@ const PropertyDebug: Component = () => {
</For>
</Section>
+ <Section title="Editors — interactive (click any value)">
+ <EditorsDemo />
+ </Section>
+
<Section title="Composed (stubs — coming in PR 3-6)">
<Show when={true} fallback={null}>
<div class="text-xs text-ink-muted">
@@ -282,4 +286,103 @@ const PropertyDebug: Component = () => {
);
};
+/**
+ * Interactive editor demo. Each fixture gets a local signal so the demo
+ * round-trips through save: clicking a value, picking a date, toggling a
+ * checkbox, etc. visibly updates the rendered property. Console logs the
+ * dispatched API values.
+ */
+const EditorsDemo: Component = () => {
+ return (
+ <div
+ class="grid gap-3"
+ style={{ 'grid-template-columns': 'repeat(2, minmax(0, 1fr))' }}
+ >
+ <For each={PROPERTIES_FILLED}>
+ {(initial) => <EditorRow initial={initial} />}
+ </For>
+ </div>
+ );
+};
+
+const EditorRow: Component<{ initial: PropertyT }> = (props) => {
+ const [property, setProperty] = createSignal<PropertyT>(props.initial);
+
+ const applyApiValue = (p: PropertyT, value: PropertyApiValues): PropertyT => {
+ if (p.valueType === 'STRING' && value.valueType === 'STRING') {
+ return { ...p, value: value.value };
+ }
+ if (p.valueType === 'NUMBER' && value.valueType === 'NUMBER') {
+ return { ...p, value: value.value };
+ }
+ if (p.valueType === 'BOOLEAN' && value.valueType === 'BOOLEAN') {
+ return { ...p, value: value.value };
+ }
+ if (p.valueType === 'DATE' && value.valueType === 'DATE') {
+ return { ...p, value: value.value };
+ }
+ if (
+ p.valueType === 'SELECT_STRING' &&
+ value.valueType === 'SELECT_STRING'
+ ) {
+ return { ...p, value: value.values };
+ }
+ if (
+ p.valueType === 'SELECT_NUMBER' &&
+ value.valueType === 'SELECT_NUMBER'
+ ) {
+ return { ...p, value: value.values };
+ }
+ if (p.valueType === 'ENTITY' && value.valueType === 'ENTITY') {
+ return { ...p, value: value.refs };
+ }
+ if (p.valueType === 'LINK' && value.valueType === 'LINK') {
+ return { ...p, value: value.values };
+ }
+ return p;
+ };
+
+ const onSave = async (p: PropertyT, value: PropertyApiValues) => {
+ console.log('[props-debug] save', {
+ property: p.displayName,
+ valueType: p.valueType,
+ value,
+ });
+ setProperty((prev) => applyApiValue(prev, value));
+ };
+
+ const isInline = () => {
+ const t = property().valueType;
+ return t === 'STRING' || t === 'NUMBER' || t === 'BOOLEAN' || t === 'LINK';
+ };
+
+ return (
+ <div class="border border-edge-muted/30 rounded p-2 flex flex-col gap-1 min-w-0">
+ <div class="text-xxs text-ink-extra-muted truncate">
+ {property().displayName} · {property().valueType}
+ </div>
+ <Property.Root property={property()} canEdit onSave={onSave}>
+ <Show
+ when={isInline()}
+ fallback={
+ <>
+ <Property.EditTrigger class={buttonClass}>
+ <Property.Icon property={property()} class="size-3 shrink-0" />
+ <Property.Text
+ property={property()}
+ fallback={<Property.Empty label="None" />}
+ />
+ <Property.Caret />
+ </Property.EditTrigger>
+ <Property.PopoverEditor />
+ </>
+ }
+ >
+ <Property.InlineEditor />
+ </Show>
+ </Property.Root>
+ </div>
+ );
+};
+
export default PropertyDebug;
diff --git a/js/app/packages/property/src/editors/PropertyEditor.tsx b/js/app/packages/property/src/editors/PropertyEditor.tsx
new file mode 100644
index 0000000000..25b01625f6
--- /dev/null
+++ b/js/app/packages/property/src/editors/PropertyEditor.tsx
@@ -0,0 +1,42 @@
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { Match, Switch } from 'solid-js';
+import { useProperty } from '../core/context';
+import { InlineEditor } from './inline/InlineEditor';
+import { PopoverEditor } from './popover/PopoverEditor';
+
+export type PropertyEditorProps = {
+ /**
+ * Forwarded to entity popover editor. Has no effect for non-entity types.
+ */
+ entitySelfFilter?: { entityType: EntityType; blockId?: string };
+};
+
+/**
+ * Auto-dispatch editor — picks inline vs popover by valueType.
+ *
+ * Inline types (STRING, NUMBER, BOOLEAN, LINK) render their own display + edit
+ * surface in place of any sibling display extractors. Popover types (DATE,
+ * SELECT_*, ENTITY) render nothing until opened (via a sibling
+ * <Property.EditTrigger>) — pair them with display extractors.
+ */
+export function PropertyEditor(props: PropertyEditorProps) {
+ const ctx = useProperty();
+ const type = () => ctx.property().valueType;
+
+ const isInline = () =>
+ type() === 'STRING' ||
+ type() === 'NUMBER' ||
+ type() === 'BOOLEAN' ||
+ type() === 'LINK';
+
+ return (
+ <Switch>
+ <Match when={isInline()}>
+ <InlineEditor />
+ </Match>
+ <Match when={!isInline()}>
+ <PopoverEditor entitySelfFilter={props.entitySelfFilter} />
+ </Match>
+ </Switch>
+ );
+}
diff --git a/js/app/packages/property/src/editors/hooks/useBooleanEditor.ts b/js/app/packages/property/src/editors/hooks/useBooleanEditor.ts
new file mode 100644
index 0000000000..8ba782ae68
--- /dev/null
+++ b/js/app/packages/property/src/editors/hooks/useBooleanEditor.ts
@@ -0,0 +1,42 @@
+import { type Accessor, createMemo, createSignal } from 'solid-js';
+import { useProperty } from '../../core/context';
+
+/**
+ * Boolean toggle editor — instant save, no editing mode. Treats null as false
+ * for the initial click (sets to true). Subsequent clicks invert.
+ */
+export function useBooleanEditor(): {
+ value: Accessor<boolean | null>;
+ isSaving: Accessor<boolean>;
+ toggle: () => Promise<void>;
+} {
+ const ctx = useProperty();
+ const [isSaving, setIsSaving] = createSignal(false);
+
+ const value = createMemo(() => {
+ const p = ctx.property();
+ if (p.valueType !== 'BOOLEAN') return null;
+ return p.value as boolean | null;
+ });
+
+ const toggle = async () => {
+ if (isSaving()) return;
+ const property = ctx.property();
+ if (property.valueType !== 'BOOLEAN') return;
+ if (!ctx.canEdit() || property.isMetadata) return;
+
+ setIsSaving(true);
+ try {
+ const current = property.value as boolean | null;
+ const next = current === null ? true : !current;
+ await ctx.onSave?.(property, { valueType: 'BOOLEAN', value: next });
+ ctx.onRefresh?.();
+ } catch {
+ // onSave callers own error UX.
+ } finally {
+ setIsSaving(false);
+ }
+ };
+
+ return { value, isSaving, toggle };
+}
diff --git a/js/app/packages/core/component/Properties/hooks/useInlineEditor.ts b/js/app/packages/property/src/editors/hooks/useInlineEditor.ts
similarity index 65%
rename from js/app/packages/core/component/Properties/hooks/useInlineEditor.ts
rename to js/app/packages/property/src/editors/hooks/useInlineEditor.ts
index 98c168e6e1..3cf2d4481f 100644
--- a/js/app/packages/core/component/Properties/hooks/useInlineEditor.ts
+++ b/js/app/packages/property/src/editors/hooks/useInlineEditor.ts
@@ -1,21 +1,16 @@
import { type Accessor, createSignal, type Setter } from 'solid-js';
-import { NUMBER_DECIMAL_PLACES } from '../constants';
-import type { PropertySaveHandler } from '../context/PropertiesContext';
-import type { Property, PropertyApiValues } from '../types';
-import { formatPropertyValue } from '../utils';
+import { NUMBER_DECIMAL_PLACES } from '../../constants';
+import { useProperty } from '../../core/context';
+import type { PropertyApiValues } from '../../types';
+import { formatPropertyValue } from '../../utils';
/**
- * Hook for inline editing of string and number properties
+ * Inline editing state for STRING / NUMBER properties. Saves via the
+ * <Property.Root> onSave handler; surfaces dirty/saving signals for UI.
*
- * @param property - The property to edit
- * @param entityType - The type of entity
- * @param onSaved - Callback when save succeeds
+ * Read-only properties (canEdit=false or isMetadata) reject startEdit.
*/
-export function useInlineEditor(
- property: Property,
- saveHandler: PropertySaveHandler,
- onSaved?: () => void
-): {
+export function useInlineEditor(): {
isEditing: Accessor<boolean>;
inputValue: Accessor<string>;
setInputValue: Setter<string>;
@@ -24,20 +19,22 @@ export function useInlineEditor(
cancelEdit: () => void;
save: () => Promise<void>;
} {
+ const ctx = useProperty();
const [isEditing, setIsEditing] = createSignal(false);
const [inputValue, setInputValue] = createSignal('');
const [isSaving, setIsSaving] = createSignal(false);
const getCurrentRawValue = () => {
+ const property = ctx.property();
const val = property.value;
if (val == null) return '';
-
- // This hook works with string and number properties
- // For these types, val is a single value, not an array
return formatPropertyValue(property, val as string | number);
};
+ const isReadOnly = () => !ctx.canEdit() || ctx.property().isMetadata;
+
const startEdit = () => {
+ if (isReadOnly()) return;
setInputValue(getCurrentRawValue());
setIsEditing(true);
};
@@ -49,26 +46,20 @@ export function useInlineEditor(
const save = async () => {
if (isSaving()) return;
-
+ const property = ctx.property();
const trimmedValue = inputValue().trim();
const currentRawValue = getCurrentRawValue();
- // No change, just cancel
if (trimmedValue === currentRawValue) {
cancelEdit();
return;
}
setIsSaving(true);
-
try {
let apiValues: PropertyApiValues;
-
if (property.valueType === 'STRING') {
- apiValues = {
- valueType: 'STRING',
- value: trimmedValue || null,
- };
+ apiValues = { valueType: 'STRING', value: trimmedValue || null };
} else if (property.valueType === 'NUMBER') {
const numValue = parseFloat(trimmedValue);
apiValues = {
@@ -80,12 +71,11 @@ export function useInlineEditor(
} else {
throw new Error(`Unsupported property type: ${property.valueType}`);
}
-
- await saveHandler.saveProperty(property, apiValues);
+ await ctx.onSave?.(property, apiValues);
setIsEditing(false);
- onSaved?.();
+ ctx.onRefresh?.();
} catch {
- // Error toast is shown by mutation's onError callback
+ // onSave callers (mutations) own error UX via onError toasts.
} finally {
setIsSaving(false);
}
diff --git a/js/app/packages/property/src/editors/index.ts b/js/app/packages/property/src/editors/index.ts
new file mode 100644
index 0000000000..824b7055c5
--- /dev/null
+++ b/js/app/packages/property/src/editors/index.ts
@@ -0,0 +1,22 @@
+export { useBooleanEditor } from './hooks/useBooleanEditor';
+export { useInlineEditor } from './hooks/useInlineEditor';
+export { InlineBooleanEditor } from './inline/InlineBooleanEditor';
+export { InlineEditor } from './inline/InlineEditor';
+export { InlineLinkEditor } from './inline/InlineLinkEditor';
+export { InlineNumberEditor } from './inline/InlineNumberEditor';
+export { InlineTextEditor } from './inline/InlineTextEditor';
+export {
+ PropertyEditor,
+ type PropertyEditorProps,
+} from './PropertyEditor';
+export { DateEditor } from './popover/DateEditor';
+export { EditorPopover } from './popover/EditorPopover';
+export {
+ EntityEditor,
+ type EntityEditorProps,
+} from './popover/EntityEditor';
+export {
+ PopoverEditor,
+ type PopoverEditorProps,
+} from './popover/PopoverEditor';
+export { SelectEditor } from './popover/SelectEditor';
diff --git a/js/app/packages/property/src/editors/inline/InlineBooleanEditor.tsx b/js/app/packages/property/src/editors/inline/InlineBooleanEditor.tsx
new file mode 100644
index 0000000000..6e8edf7552
--- /dev/null
+++ b/js/app/packages/property/src/editors/inline/InlineBooleanEditor.tsx
@@ -0,0 +1,41 @@
+import CheckIcon from '@phosphor/check.svg';
+import { Show } from 'solid-js';
+import { useProperty } from '../../core/context';
+import { useBooleanEditor } from '../hooks/useBooleanEditor';
+
+/**
+ * Checkbox toggle for BOOLEAN properties. Saves immediately on click — no
+ * editing mode. Treats null as unchecked.
+ */
+export function InlineBooleanEditor() {
+ const ctx = useProperty();
+ const { value, isSaving, toggle } = useBooleanEditor();
+
+ const isReadOnly = () => ctx.property().isMetadata || !ctx.canEdit();
+ const isChecked = () => !!value();
+
+ return (
+ <button
+ type="button"
+ onClick={() => !isReadOnly() && !isSaving() && toggle()}
+ disabled={isSaving() || isReadOnly()}
+ class="flex items-center justify-end p-1"
+ classList={{
+ 'cursor-default': isReadOnly() || isSaving(),
+ 'hover:bg-hover': !isReadOnly() && !isSaving(),
+ }}
+ >
+ <div
+ class="size-4 flex items-center justify-center"
+ classList={{
+ 'bg-accent border-accent border': isChecked(),
+ 'bg-transparent border-edge-muted border': !isChecked(),
+ }}
+ >
+ <Show when={isChecked()}>
+ <CheckIcon class="size-3 text-surface" />
+ </Show>
+ </div>
+ </button>
+ );
+}
diff --git a/js/app/packages/property/src/editors/inline/InlineEditor.tsx b/js/app/packages/property/src/editors/inline/InlineEditor.tsx
new file mode 100644
index 0000000000..7c16cc726f
--- /dev/null
+++ b/js/app/packages/property/src/editors/inline/InlineEditor.tsx
@@ -0,0 +1,33 @@
+import { Match, Switch } from 'solid-js';
+import { useProperty } from '../../core/context';
+import { InlineBooleanEditor } from './InlineBooleanEditor';
+import { InlineLinkEditor } from './InlineLinkEditor';
+import { InlineNumberEditor } from './InlineNumberEditor';
+import { InlineTextEditor } from './InlineTextEditor';
+
+/**
+ * Dispatches to the right inline editor based on property.valueType. Renders
+ * nothing for popover-only types (DATE / SELECT_* / ENTITY) — those need an
+ * <EditTrigger> + <PopoverEditor> pair instead.
+ */
+export function InlineEditor() {
+ const ctx = useProperty();
+ const type = () => ctx.property().valueType;
+
+ return (
+ <Switch>
+ <Match when={type() === 'STRING'}>
+ <InlineTextEditor />
+ </Match>
+ <Match when={type() === 'NUMBER'}>
+ <InlineNumberEditor />
+ </Match>
+ <Match when={type() === 'BOOLEAN'}>
+ <InlineBooleanEditor />
+ </Match>
+ <Match when={type() === 'LINK'}>
+ <InlineLinkEditor />
+ </Match>
+ </Switch>
+ );
+}
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx b/js/app/packages/property/src/editors/inline/InlineLinkEditor.tsx
similarity index 52%
rename from js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx
rename to js/app/packages/property/src/editors/inline/InlineLinkEditor.tsx
index d9a932c6fe..ad10af6bbd 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx
+++ b/js/app/packages/property/src/editors/inline/InlineLinkEditor.tsx
@@ -2,24 +2,26 @@ import { useUnfurl } from '@core/signal/unfurl';
import LinkIcon from '@phosphor/link.svg';
import DeleteIcon from '@phosphor/x.svg';
import { proxyResource } from '@service-unfurl/client';
-import type { Component } from 'solid-js';
-import { createSignal, For, Show } from 'solid-js';
+import { type Component, createSignal, For, Show } from 'solid-js';
import { createStore } from 'solid-js/store';
+import { useProperty } from '../../core/context';
+import { PropertyEmpty } from '../../extractors/PropertyEmpty';
import {
extractDomain,
getLinkValues,
- isValidUrl,
- normalizeUrl,
+ hasValue,
+ isLinkProperty,
} from '../../utils';
-import {
- AddPropertyValueButton,
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
-export const LinkValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
+const ADD_BUTTON_CLASS =
+ 'text-ink-muted hover:text-ink hover:bg-hover px-2 py-0.5 inline-block shrink-0 rounded-sm cursor-default';
+
+// Inline URL collection editor for LINK properties. Supports multi-select
+// (chip list with add button) and single (one slot). Unfurl preview pulls
+// favicon + title; remove on hover.
+export function InlineLinkEditor() {
+ const ctx = useProperty();
+
const [isAdding, setIsAdding] = createSignal(false);
const [inputValue, setInputValue] = createSignal('');
const [error, setError] = createSignal<string | null>(null);
@@ -27,8 +29,10 @@ export const LinkValue: Component<PropertyValueProps> = (props) => {
const [isSaving, setIsSaving] = createSignal(false);
const [badLinks, setBadLinks] = createStore<Record<string, true>>({});
- const isReadOnly = () => props.property.isMetadata || !props.canEdit;
- const linkValues = getLinkValues(props.property);
+ const property = () => ctx.property();
+ const isReadOnly = () => property().isMetadata || !ctx.canEdit();
+ const links = () =>
+ isLinkProperty(property()) ? getLinkValues(property()) : [];
const startAdding = () => {
if (isReadOnly()) return;
@@ -43,63 +47,65 @@ export const LinkValue: Component<PropertyValueProps> = (props) => {
setError(null);
};
+ const normalize = (v: string) => {
+ const t = v.trim();
+ if (!t) return '';
+ return /^https?:\/\//i.test(t) ? t : `https://${t}`;
+ };
+
+ const isValidUrl = (v: string) => {
+ try {
+ new URL(v);
+ return true;
+ } catch {
+ return false;
+ }
+ };
+
const handleAddLink = async () => {
- const value = inputValue().trim();
- if (!value) {
+ const raw = inputValue().trim();
+ if (!raw) {
cancelAdding();
return;
}
-
- const normalized = normalizeUrl(value);
+ const normalized = normalize(raw);
if (!isValidUrl(normalized)) {
setError('Please enter a valid URL');
return;
}
-
- if (linkValues.includes(normalized)) {
+ if (links().includes(normalized)) {
setError('This URL has already been added');
return;
}
setIsSaving(true);
setError(null);
-
try {
- let newValues: string[];
- if (props.property.isMultiSelect) {
- newValues = [...linkValues, normalized];
- } else {
- newValues = [normalized];
- }
-
- await saveHandler().saveProperty(props.property, {
- valueType: 'LINK',
- values: newValues,
- });
+ const next = property().isMultiSelect
+ ? [...links(), normalized]
+ : [normalized];
+ await ctx.onSave?.(property(), { valueType: 'LINK', values: next });
cancelAdding();
- props.onRefresh?.();
+ ctx.onRefresh?.();
} catch {
- // Error toast is shown by mutation's onError callback
+ // mutation onError owns toast
} finally {
setIsSaving(false);
}
};
- const handleRemoveLink = async (url: string) => {
+ const handleRemove = async (url: string) => {
if (isReadOnly() || isSaving()) return;
-
setIsSaving(true);
-
try {
- const newValues = linkValues.filter((link: string) => link !== url);
-
- await saveHandler().saveProperty(props.property, {
+ const next = links().filter((l) => l !== url);
+ await ctx.onSave?.(property(), {
valueType: 'LINK',
- values: newValues.length > 0 ? newValues : null,
+ values: next.length > 0 ? next : null,
});
- props.onRefresh?.();
+ ctx.onRefresh?.();
} catch {
- // Error toast is shown by mutation's onError callback
+ // mutation onError owns toast
} finally {
setIsSaving(false);
}
@@ -117,55 +123,30 @@ export const LinkValue: Component<PropertyValueProps> = (props) => {
}
};
- const AddLinkInput = () => (
- <>
- <input
- ref={(el) => {
- setTimeout(() => el.focus(), 0);
- }}
- type="text"
- value={inputValue()}
- onInput={(e) => setInputValue(e.currentTarget.value)}
- onKeyDown={handleKeyDown}
- onBlur={() => {
- setTimeout(() => {
- if (isAdding()) {
- handleAddLink();
- }
- }, 100);
- }}
- placeholder="Enter URL..."
- disabled={isSaving()}
- class="text-left px-2 py-0.5 bg-transparent focus:outline-none text-ink inline-block shrink-0 rounded-sm"
- />
- <Show when={error()}>
- <div class="text-failure-ink mt-1 w-full">{error()}</div>
- </Show>
- </>
- );
-
return (
<div class="flex flex-wrap gap-1 justify-start items-start w-full min-w-0">
- <For each={linkValues}>
+ <For each={links()}>
{(url) => (
- <LinkDisplay
+ <LinkChip
url={url}
- onRemove={() => handleRemoveLink(url)}
canEdit={!isReadOnly()}
isRemoving={isSaving()}
- hoveredLink={hoveredLink()}
- setHoveredLink={setHoveredLink}
+ hovered={hoveredLink() === url}
+ onMouseEnter={() => setHoveredLink(url)}
+ onMouseLeave={() => setHoveredLink(null)}
+ onRemove={() => handleRemove(url)}
badLinks={badLinks}
- setBadLinks={setBadLinks}
+ markBad={(k) => setBadLinks(k, true)}
/>
)}
</For>
+
<Show
when={!isReadOnly()}
fallback={
- <Show when={linkValues.length === 0}>
+ <Show when={!hasValue(property())}>
<div class="text-ink-muted px-2 py-0.5 bg-transparent inline-block shrink-0 rounded-sm">
- <EmptyValue />
+ <PropertyEmpty label="Empty" />
</div>
</Show>
}
@@ -173,50 +154,61 @@ export const LinkValue: Component<PropertyValueProps> = (props) => {
<Show
when={isAdding()}
fallback={
- <Show
- when={props.property.isMultiSelect || linkValues.length === 0}
- >
- <AddPropertyValueButton onClick={startAdding} />
+ <Show when={property().isMultiSelect || links().length === 0}>
+ <button
+ type="button"
+ class={ADD_BUTTON_CLASS}
+ onClick={startAdding}
+ disabled={isSaving()}
+ >
+ +
+ </button>
</Show>
}
>
- <AddLinkInput />
+ <input
+ ref={(el) => setTimeout(() => el.focus(), 0)}
+ type="text"
+ value={inputValue()}
+ onInput={(e) => setInputValue(e.currentTarget.value)}
+ onKeyDown={handleKeyDown}
+ onBlur={() => {
+ setTimeout(() => {
+ if (isAdding()) handleAddLink();
+ }, 100);
+ }}
+ placeholder="Enter URL..."
+ disabled={isSaving()}
+ class="text-left px-2 py-0.5 bg-transparent focus:outline-none text-ink inline-block shrink-0 rounded-sm"
+ />
+ <Show when={error()}>
+ <div class="text-failure-ink mt-1 w-full">{error()}</div>
+ </Show>
</Show>
</Show>
</div>
);
-};
+}
-type LinkDisplayProps = {
+type LinkChipProps = {
url: string;
- onRemove: () => void;
canEdit: boolean;
isRemoving: boolean;
- hoveredLink: string | null;
- setHoveredLink: (url: string | null) => void;
+ hovered: boolean;
+ onMouseEnter: () => void;
+ onMouseLeave: () => void;
+ onRemove: () => void;
badLinks: Record<string, true>;
- setBadLinks: (key: string, value: true) => void;
+ markBad: (key: string) => void;
};
-const LinkDisplay: Component<LinkDisplayProps> = (props) => {
+const LinkChip: Component<LinkChipProps> = (props) => {
const [imageError, setImageError] = createSignal(false);
- const [unfurlData] = useUnfurl(props.url);
+ const [unfurl] = useUnfurl(props.url);
const domain = extractDomain(props.url);
- const handleLinkClick = (e: MouseEvent) => {
- if ((e.target as HTMLElement).closest('.remove-button')) {
- return;
- }
- e.preventDefault();
- window.open(props.url, '_blank');
- };
-
- const handleRemoveClick = () => {
- props.onRemove();
- };
-
const faviconUrl = () => {
- const data = unfurlData();
+ const data = unfurl();
if (data?.type === 'success' && data.data.favicon_url) {
return proxyResource(data.data.favicon_url);
}
@@ -224,22 +216,25 @@ const LinkDisplay: Component<LinkDisplayProps> = (props) => {
};
const title = () => {
- const data = unfurlData();
- if (data?.type === 'success' && data.data.title) {
- return data.data.title;
- }
+ const data = unfurl();
+ if (data?.type === 'success' && data.data.title) return data.data.title;
return domain;
};
- const isHovered = () => props.hoveredLink === props.url;
+ const handleLinkClick = (e: MouseEvent) => {
+ if ((e.target as HTMLElement).closest('.remove-button')) return;
+ e.preventDefault();
+ window.open(props.url, '_blank');
+ };
return (
<div
class="relative inline-flex max-w-50 shrink-0 rounded-sm hover:bg-hover"
- onMouseEnter={() => props.setHoveredLink(props.url)}
- onMouseLeave={() => props.setHoveredLink(null)}
+ onMouseEnter={props.onMouseEnter}
+ onMouseLeave={props.onMouseLeave}
>
<button
+ type="button"
onClick={handleLinkClick}
class="text-left px-2 py-0.5 bg-transparent text-ink inline-flex items-center gap-2 w-full cursor-default"
title={props.url}
@@ -259,22 +254,21 @@ const LinkDisplay: Component<LinkDisplayProps> = (props) => {
alt="favicon"
onError={() => {
setImageError(true);
- if (faviconUrl()) {
- props.setBadLinks(faviconUrl()!, true);
- }
+ const f = faviconUrl();
+ if (f) props.markBad(f);
}}
/>
</Show>
</div>
-
<span class="truncate flex-1 text-ink">{title()}</span>
</button>
- <Show when={props.canEdit && isHovered() && !props.isRemoving}>
+ <Show when={props.canEdit && props.hovered && !props.isRemoving}>
<div class="absolute right-0 inset-y-0 flex items-center pr-1 pl-2 bg-linear-to-r from-transparent to-hover to-40% rounded-r-sm">
<button
- onClick={handleRemoveClick}
+ type="button"
+ class="remove-button size-4 p-0.5 flex items-center justify-center text-ink-muted hover:text-failure-ink rounded-sm"
+ onClick={props.onRemove}
disabled={props.isRemoving}
- class="size-4 p-0.5 flex items-center justify-center text-ink-muted hover:text-failure-ink rounded-sm"
>
<DeleteIcon class="size-3" />
</button>
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx b/js/app/packages/property/src/editors/inline/InlineNumberEditor.tsx
similarity index 50%
rename from js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx
rename to js/app/packages/property/src/editors/inline/InlineNumberEditor.tsx
index 3f50c52f42..31fec491f5 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx
+++ b/js/app/packages/property/src/editors/inline/InlineNumberEditor.tsx
@@ -1,35 +1,26 @@
-import type { Component } from 'solid-js';
import { Show } from 'solid-js';
-import { useInlineEditor } from '../../hooks';
+import { useProperty } from '../../core/context';
+import { PropertyEmpty } from '../../extractors/PropertyEmpty';
import { formatNumber } from '../../utils';
-import {
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
+import { useInlineEditor } from '../hooks/useInlineEditor';
/**
- * Display component for number properties with inline editing
- * Numbers are formatted to 4 decimal places
+ * Click-to-edit number input. Step 0.0001 matches the existing
+ * NUMBER_DECIMAL_PLACES rounding the save path applies.
*/
-export const NumberValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
- const editor = useInlineEditor(
- props.property,
- saveHandler(),
- props.onRefresh
- );
+export function InlineNumberEditor() {
+ const ctx = useProperty();
+ const editor = useInlineEditor();
+ const property = () => ctx.property();
const supportsInline = () =>
- props.canEdit &&
- !props.property.isMetadata &&
- props.property.valueType === 'NUMBER';
+ ctx.canEdit() &&
+ !property().isMetadata &&
+ property().valueType === 'NUMBER';
- const handleClick = () => {
- if (supportsInline()) {
- editor.startEdit();
- }
- };
+ const hasValue = () => property().value != null;
+ const display = () =>
+ hasValue() ? formatNumber(property().value as number) : '';
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') {
@@ -41,35 +32,27 @@ export const NumberValue: Component<PropertyValueProps> = (props) => {
}
};
- const hasValue = () => props.property.value != null;
- const displayValue = hasValue()
- ? formatNumber(props.property.value as number)
- : '';
-
return (
<Show
when={editor.isEditing()}
fallback={
<button
- onClick={handleClick}
+ type="button"
+ onClick={() => supportsInline() && editor.startEdit()}
class="text-left px-2 py-0.5 bg-transparent block max-w-full wrap-break-word cursor-default rounded-sm"
classList={{
'text-ink': supportsInline(),
'text-ink-muted': !supportsInline(),
}}
>
- <Show when={hasValue()} fallback={<EmptyValue />}>
- <span class="block truncate max-w-full">{displayValue}</span>
+ <Show when={hasValue()} fallback={<PropertyEmpty label="Empty" />}>
+ <span class="block truncate max-w-full">{display()}</span>
</Show>
</button>
}
>
<input
- ref={(el) => {
- setTimeout(() => {
- el.focus();
- }, 0);
- }}
+ ref={(el) => setTimeout(() => el.focus(), 0)}
type="number"
step="0.0001"
value={editor.inputValue()}
@@ -82,4 +65,4 @@ export const NumberValue: Component<PropertyValueProps> = (props) => {
/>
</Show>
);
-};
+}
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx b/js/app/packages/property/src/editors/inline/InlineTextEditor.tsx
similarity index 55%
rename from js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx
rename to js/app/packages/property/src/editors/inline/InlineTextEditor.tsx
index 9b109081bc..5542b91448 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx
+++ b/js/app/packages/property/src/editors/inline/InlineTextEditor.tsx
@@ -1,33 +1,27 @@
-import type { Component } from 'solid-js';
import { Show } from 'solid-js';
-import { useInlineEditor } from '../../hooks';
+import { useProperty } from '../../core/context';
+import { PropertyEmpty } from '../../extractors/PropertyEmpty';
import { formatPropertyValue } from '../../utils';
-import {
- EmptyValue,
- type PropertyValueProps,
- stubSaveHandler,
-} from './ValueComponents';
+import { useInlineEditor } from '../hooks/useInlineEditor';
/**
- * Display component for string properties with inline editing
+ * Click-to-edit textarea for STRING properties. In display mode renders as a
+ * button (matches existing CondensedPropertyValue / panel pill look); editing
+ * mode swaps to a field-sizing textarea that grows with content.
*/
-export const TextValue: Component<PropertyValueProps> = (props) => {
- const saveHandler = () => props.saveHandler ?? stubSaveHandler;
- const editor = useInlineEditor(
- props.property,
- saveHandler(),
- props.onRefresh
- );
+export function InlineTextEditor() {
+ const ctx = useProperty();
+ const editor = useInlineEditor();
+ const property = () => ctx.property();
const supportsInline = () =>
- props.canEdit &&
- !props.property.isMetadata &&
- props.property.valueType === 'STRING';
+ ctx.canEdit() &&
+ !property().isMetadata &&
+ property().valueType === 'STRING';
- const handleClick = () => {
- if (supportsInline()) {
- editor.startEdit();
- }
+ const hasValue = () => {
+ const v = property().value;
+ return typeof v === 'string' && v.length > 0;
};
const handleKeyDown = (e: KeyboardEvent) => {
@@ -40,29 +34,22 @@ export const TextValue: Component<PropertyValueProps> = (props) => {
}
};
- const hasValue = () =>
- props.property.value != null &&
- typeof props.property.value === 'string' &&
- props.property.value.length > 0;
-
return (
<Show
when={editor.isEditing()}
fallback={
<button
- onClick={handleClick}
+ type="button"
+ onClick={() => supportsInline() && editor.startEdit()}
class="text-left px-2 py-0.5 bg-transparent block max-w-full wrap-break-word cursor-default rounded-sm"
classList={{
'text-ink': supportsInline(),
'text-ink-muted': !supportsInline(),
}}
>
- <Show when={hasValue()} fallback={<EmptyValue />}>
+ <Show when={hasValue()} fallback={<PropertyEmpty label="Empty" />}>
<span class="block max-w-full">
- {formatPropertyValue(
- props.property,
- props.property.value as string
- )}
+ {formatPropertyValue(property(), property().value as string)}
</span>
</Show>
</button>
@@ -75,7 +62,7 @@ export const TextValue: Component<PropertyValueProps> = (props) => {
el.setSelectionRange(el.value.length, el.value.length);
}, 0);
}}
- placeholder={`Set ${props.property.displayName}...`}
+ placeholder={`Set ${property().displayName}...`}
value={editor.inputValue()}
onInput={(e) => editor.setInputValue(e.currentTarget.value)}
onBlur={editor.save}
@@ -85,4 +72,4 @@ export const TextValue: Component<PropertyValueProps> = (props) => {
/>
</Show>
);
-};
+}
diff --git a/js/app/packages/property/src/editors/popover/DateEditor.tsx b/js/app/packages/property/src/editors/popover/DateEditor.tsx
new file mode 100644
index 0000000000..f861d86ebc
--- /dev/null
+++ b/js/app/packages/property/src/editors/popover/DateEditor.tsx
@@ -0,0 +1,53 @@
+import { createSignal, Show } from 'solid-js';
+import { useProperty } from '../../core/context';
+import type { DateProperty } from '../../types';
+import { isDateProperty } from '../../utils';
+import { PropertyDateSelector } from '../selectors/PropertyDateSelector';
+import { EditorPopover } from './EditorPopover';
+
+/**
+ * Date picker popover. Local selectedDate state initialised from current
+ * value; save happens on selection (PropertyDateSelector calls onSelectDate
+ * then closes via onClose).
+ */
+export function DateEditor() {
+ const ctx = useProperty();
+
+ return (
+ <Show when={ctx.editorOpen() && isDateProperty(ctx.property())}>
+ <DateEditorBody />
+ </Show>
+ );
+}
+
+function DateEditorBody() {
+ const ctx = useProperty();
+ const property = ctx.property() as DateProperty;
+
+ const [selectedDate, setSelectedDate] = createSignal<Date | null>(
+ property.value != null ? new Date(property.value) : null
+ );
+
+ const commit = async (date: Date | null) => {
+ setSelectedDate(date);
+ try {
+ await ctx.onSave?.(property, { valueType: 'DATE', value: date });
+ ctx.onRefresh?.();
+ } catch {
+ // mutation onError owns toast
+ }
+ };
+
+ return (
+ <EditorPopover>
+ <PropertyDateSelector
+ property={property}
+ selectedDate={selectedDate()}
+ onSelectDate={(date) => {
+ commit(date);
+ }}
+ onClose={() => ctx.closeEditor()}
+ />
+ </EditorPopover>
+ );
+}
diff --git a/js/app/packages/property/src/editors/popover/EditorPopover.tsx b/js/app/packages/property/src/editors/popover/EditorPopover.tsx
new file mode 100644
index 0000000000..6b408c1b39
--- /dev/null
+++ b/js/app/packages/property/src/editors/popover/EditorPopover.tsx
@@ -0,0 +1,92 @@
+import { floatWithElement } from '@core/component/LexicalMarkdown/directive/floatWithElement';
+import { ScopedPortal } from '@core/component/ScopedPortal';
+import { cn, Layer } from '@ui';
+import { type JSX, onCleanup, onMount, Show } from 'solid-js';
+import { useProperty } from '../../core/context';
+
+type EditorPopoverProps = {
+ children: JSX.Element;
+ class?: string;
+ /**
+ * Called on ESC or click outside. Default: <Property.Root>'s closeEditor.
+ * Override to save-on-close.
+ */
+ onClose?: () => void;
+};
+
+/**
+ * Floating shell for popover-style editors (date / select / entity). Mounts
+ * only when the parent <Property.Root>'s editor is open; floats with
+ * `editorAnchor`; routes ESC + click-outside through onClose (defaults to
+ * closeEditor so consumers without a save-on-close opt out get the legacy
+ * behavior for free).
+ */
+export function EditorPopover(props: EditorPopoverProps) {
+ const ctx = useProperty();
+
+ return (
+ <Show when={ctx.editorOpen()}>
+ <PopoverBody onClose={props.onClose} class={props.class}>
+ {props.children}
+ </PopoverBody>
+ </Show>
+ );
+}
+
+function PopoverBody(props: {
+ children: JSX.Element;
+ class?: string;
+ onClose?: () => void;
+}) {
+ const ctx = useProperty();
+
+ const close = () => {
+ if (props.onClose) props.onClose();
+ else ctx.closeEditor();
+ };
+
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.key === 'Escape') {
+ e.preventDefault();
+ e.stopPropagation();
+ close();
+ }
+ };
+
+ onMount(() => {
+ document.addEventListener('keydown', handleKeyDown, { capture: true });
+ });
+ onCleanup(() => {
+ document.removeEventListener('keydown', handleKeyDown, { capture: true });
+ });
+
+ return (
+ <ScopedPortal scope="local">
+ <div
+ class="fixed inset-0 z-modal"
+ onClick={(e) => {
+ e.stopPropagation();
+ close();
+ }}
+ >
+ <Layer depth={2}>
+ <div
+ ref={(ref) =>
+ floatWithElement(ref, () => ({
+ element: () => ctx.editorAnchor() ?? null,
+ }))
+ }
+ class={cn(
+ 'absolute border border-edge rounded-md z-action-menu max-h-96 overflow-hidden flex flex-col w-full max-w-60 shadow-md shadow-drop-shadow bg-surface text-ink',
+ props.class
+ )}
+ tabIndex={-1}
+ onClick={(e) => e.stopPropagation()}
+ >
+ {props.children}
+ </div>
+ </Layer>
+ </div>
+ </ScopedPortal>
+ );
+}
diff --git a/js/app/packages/property/src/editors/popover/EntityEditor.tsx b/js/app/packages/property/src/editors/popover/EntityEditor.tsx
new file mode 100644
index 0000000000..139c4241b1
--- /dev/null
+++ b/js/app/packages/property/src/editors/popover/EntityEditor.tsx
@@ -0,0 +1,96 @@
+import {
+ entityReferencesToIdSet,
+ updateEntityReferences,
+} from '@core/component/Properties/utils/entityConversion';
+import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { createSignal, Show } from 'solid-js';
+import { useProperty } from '../../core/context';
+import type { EntityProperty, PropertyApiValues } from '../../types';
+import { isEntityProperty } from '../../utils';
+import { PropertyEntitySelector } from '../selectors/PropertyEntitySelector';
+import { EditorPopover } from './EditorPopover';
+
+export type EntityEditorProps = {
+ /**
+ * Owning entity context for the property — used by PropertyEntitySelector
+ * to filter the current entity out of the picker. Omit when no self-filter
+ * is needed (e.g. composer with no entity yet).
+ */
+ selfFilter?: { entityType: EntityType; blockId?: string };
+};
+
+/**
+ * Popover dropdown for ENTITY properties. Wraps PropertyEntitySelector;
+ * saves accumulated selection on close.
+ */
+export function EntityEditor(props: EntityEditorProps) {
+ const ctx = useProperty();
+ return (
+ <Show when={ctx.editorOpen() && isEntityProperty(ctx.property())}>
+ <EntityEditorBody selfFilter={props.selfFilter} />
+ </Show>
+ );
+}
+
+function EntityEditorBody(props: EntityEditorProps) {
+ const ctx = useProperty();
+ const property = ctx.property() as EntityProperty;
+
+ const initialRefs: EntityReference[] = property.value ?? [];
+ const [selectedRefs, setSelectedRefs] =
+ createSignal<EntityReference[]>(initialRefs);
+ const [dirty, setDirty] = createSignal(false);
+
+ const refsEqual = (a: EntityReference[], b: EntityReference[]) => {
+ if (a.length !== b.length) return false;
+ return a.every((aRef) =>
+ b.some(
+ (bRef) =>
+ aRef.entity_id === bRef.entity_id &&
+ aRef.entity_type === bRef.entity_type
+ )
+ );
+ };
+
+ const closeAndSave = async () => {
+ if (dirty() && !refsEqual(selectedRefs(), initialRefs)) {
+ const refs = selectedRefs();
+ const apiValues: PropertyApiValues = {
+ valueType: 'ENTITY',
+ refs: refs.length > 0 ? refs : null,
+ };
+ try {
+ await ctx.onSave?.(property, apiValues);
+ ctx.onRefresh?.();
+ } catch {
+ // mutation onError owns toast
+ }
+ }
+ ctx.closeEditor();
+ };
+
+ return (
+ <EditorPopover onClose={closeAndSave}>
+ <PropertyEntitySelector
+ config={{
+ isMultiSelect: property.isMultiSelect,
+ placeholder: `${property.isMultiSelect ? 'Add' : 'Change'} ${property.displayName.toLowerCase()}...`,
+ specificEntityType: property.specificEntityType,
+ selfFilter: props.selfFilter,
+ }}
+ selectedOptions={() => entityReferencesToIdSet(selectedRefs())}
+ setSelectedOptions={(newOptions, entityInfo) => {
+ const updated = updateEntityReferences(
+ selectedRefs(),
+ newOptions,
+ entityInfo
+ );
+ setSelectedRefs(updated);
+ setDirty(true);
+ }}
+ onClose={closeAndSave}
+ />
+ </EditorPopover>
+ );
+}
diff --git a/js/app/packages/property/src/editors/popover/PopoverEditor.tsx b/js/app/packages/property/src/editors/popover/PopoverEditor.tsx
new file mode 100644
index 0000000000..05cdb1598c
--- /dev/null
+++ b/js/app/packages/property/src/editors/popover/PopoverEditor.tsx
@@ -0,0 +1,38 @@
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { Match, Switch } from 'solid-js';
+import { useProperty } from '../../core/context';
+import { DateEditor } from './DateEditor';
+import { EntityEditor } from './EntityEditor';
+import { SelectEditor } from './SelectEditor';
+
+export type PopoverEditorProps = {
+ /**
+ * Forwarded to EntityEditor to filter the owning entity out of the picker.
+ * Has no effect for non-entity properties.
+ */
+ entitySelfFilter?: { entityType: EntityType; blockId?: string };
+};
+
+/**
+ * Dispatches to the right popover editor based on property.valueType. Renders
+ * nothing for inline types (STRING / NUMBER / BOOLEAN / LINK) — those use
+ * <Property.InlineEditor /> in place of a display.
+ */
+export function PopoverEditor(props: PopoverEditorProps) {
+ const ctx = useProperty();
+ const type = () => ctx.property().valueType;
+
+ return (
+ <Switch>
+ <Match when={type() === 'DATE'}>
+ <DateEditor />
+ </Match>
+ <Match when={type() === 'SELECT_STRING' || type() === 'SELECT_NUMBER'}>
+ <SelectEditor />
+ </Match>
+ <Match when={type() === 'ENTITY'}>
+ <EntityEditor selfFilter={props.entitySelfFilter} />
+ </Match>
+ </Switch>
+ );
+}
diff --git a/js/app/packages/property/src/editors/popover/SelectEditor.tsx b/js/app/packages/property/src/editors/popover/SelectEditor.tsx
new file mode 100644
index 0000000000..6a7ec7da6c
--- /dev/null
+++ b/js/app/packages/property/src/editors/popover/SelectEditor.tsx
@@ -0,0 +1,121 @@
+import { usePropertyEditor } from '@core/component/Properties/hooks/usePropertyEditor';
+import {
+ useAddPropertyOptionMutation,
+ usePropertyOptionsQuery,
+} from '@queries/properties/options';
+import { onMount, Show } from 'solid-js';
+import { useProperty } from '../../core/context';
+import type { PropertyApiValues, SelectProperty } from '../../types';
+import { formatOptionValue, isSelectProperty } from '../../utils';
+import { PropertyOptionSelector } from '../selectors/PropertyOptionSelector';
+import { EditorPopover } from './EditorPopover';
+
+/**
+ * Popover dropdown for SELECT_STRING / SELECT_NUMBER. Loads options via
+ * usePropertyOptionsQuery, tracks local selection, saves accumulated state
+ * on close (matches existing modal UX — single-select closes-on-pick,
+ * multi-select stays open until Done/click-out/ESC).
+ */
+export function SelectEditor() {
+ const ctx = useProperty();
+ return (
+ <Show when={ctx.editorOpen() && isSelectProperty(ctx.property())}>
+ <SelectEditorBody />
+ </Show>
+ );
+}
+
+function SelectEditorBody() {
+ const ctx = useProperty();
+ const property = ctx.property() as SelectProperty;
+
+ const optionsQuery = usePropertyOptionsQuery(
+ () => property.propertyDefinitionId
+ );
+ const addOptionMutation = useAddPropertyOptionMutation({});
+
+ const options = () =>
+ optionsQuery.isLoading || optionsQuery.isError || !optionsQuery.data
+ ? []
+ : optionsQuery.data;
+
+ const isLoading = () => optionsQuery.isLoading || addOptionMutation.isPending;
+
+ const editor = usePropertyEditor(
+ property,
+ options,
+ addOptionMutation.mutateAsync
+ );
+
+ onMount(() => {
+ editor.initializeSelectedOptions();
+ optionsQuery.refetch();
+ });
+
+ const closeAndSave = async () => {
+ if (editor.hasChanges()) {
+ const arr = Array.from(editor.selectedOptions());
+ const apiValues: PropertyApiValues =
+ property.valueType === 'SELECT_NUMBER'
+ ? {
+ valueType: 'SELECT_NUMBER',
+ values: arr.length > 0 ? arr : null,
+ }
+ : {
+ valueType: 'SELECT_STRING',
+ values: arr.length > 0 ? arr : null,
+ };
+ try {
+ await ctx.onSave?.(property, apiValues);
+ ctx.onRefresh?.();
+ } catch {
+ // mutation onError owns toast
+ }
+ }
+ ctx.closeEditor();
+ };
+
+ const canAddOption = (query: string) => {
+ if (property.isSystemProperty) return false;
+ if (property.valueType === 'SELECT_STRING') return true;
+ if (property.valueType === 'SELECT_NUMBER') {
+ const n = parseFloat(query);
+ return !Number.isNaN(n) && Number.isFinite(n);
+ }
+ return false;
+ };
+
+ return (
+ <EditorPopover onClose={closeAndSave}>
+ <Show when={!isLoading()}>
+ <PropertyOptionSelector
+ config={{
+ isMultiSelect: property.isMultiSelect,
+ placeholder: `${property.isMultiSelect ? 'Add' : 'Change'} ${property.displayName.toLowerCase()}...`,
+ inputType:
+ property.valueType === 'SELECT_NUMBER' ? 'number' : 'text',
+ canAddOption: property.isSystemProperty ? undefined : canAddOption,
+ }}
+ options={options().map((opt) => ({
+ id: opt.id,
+ label: formatOptionValue(opt),
+ }))}
+ isLoading={false}
+ error={null}
+ selectedOptions={editor.selectedOptions}
+ onToggleOption={editor.toggleOption}
+ onAddOption={property.isSystemProperty ? undefined : editor.addOption}
+ clearOption={
+ !property.isMultiSelect && !property.isRequired
+ ? {
+ label: `No ${property.displayName.toLowerCase()}`,
+ onClear: editor.clearOptions,
+ }
+ : undefined
+ }
+ onClose={closeAndSave}
+ />
+ </Show>
+ </EditorPopover>
+ );
+}
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx b/js/app/packages/property/src/editors/selectors/Dropdown.tsx
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsx
rename to js/app/packages/property/src/editors/selectors/Dropdown.tsx
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/OptionCheckBox.tsx b/js/app/packages/property/src/editors/selectors/OptionCheckBox.tsx
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/OptionCheckBox.tsx
rename to js/app/packages/property/src/editors/selectors/OptionCheckBox.tsx
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyDateSelector.tsx b/js/app/packages/property/src/editors/selectors/PropertyDateSelector.tsx
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/PropertyDateSelector.tsx
rename to js/app/packages/property/src/editors/selectors/PropertyDateSelector.tsx
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx b/js/app/packages/property/src/editors/selectors/PropertyEntitySelector.tsx
similarity index 99%
rename from js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx
rename to js/app/packages/property/src/editors/selectors/PropertyEntitySelector.tsx
index 152b050c0e..b7c7fc6607 100644
--- a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx
+++ b/js/app/packages/property/src/editors/selectors/PropertyEntitySelector.tsx
@@ -1,3 +1,4 @@
+import { useSearchInputFocus } from '@core/component/Properties/utils';
import { UserIcon } from '@core/component/UserIcon';
import { useEmail, useUserId } from '@core/context/user';
import { useAugmentUserWithDmActivity } from '@core/user';
@@ -20,7 +21,6 @@ import {
onMount,
Show,
} from 'solid-js';
-import { useSearchInputFocus } from '../../../utils';
import {
type CombinedEntity,
createEntitySearchConfig,
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsx b/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
similarity index 98%
rename from js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsx
rename to js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
index 307f2ded89..3f62b40928 100644
--- a/js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsx
+++ b/js/app/packages/property/src/editors/selectors/PropertyOptionSelector.tsx
@@ -1,3 +1,6 @@
+import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue';
+import { useSearchInputFocus } from '@core/component/Properties/utils';
+import { ERROR_MESSAGES } from '@core/component/Properties/utils/errorHandling';
import { useKeyPressed } from '@core/util/useKeyPressed';
import CircleDashedEmpty from '@phosphor/circle-dashed.svg';
import SearchIcon from '@phosphor/magnifying-glass.svg';
@@ -18,9 +21,6 @@ import {
Show,
Switch,
} from 'solid-js';
-import { useSearchInputFocus } from '../../../utils';
-import { ERROR_MESSAGES } from '../../../utils/errorHandling';
-import { PropertyValueIcon } from '../../propertyValue';
import { OptionCheckBox } from './OptionCheckBox';
import type { OptionSelectorConfig, SelectableOption } from './types';
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/entityUtils.test.ts b/js/app/packages/property/src/editors/selectors/entityUtils.test.ts
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/entityUtils.test.ts
rename to js/app/packages/property/src/editors/selectors/entityUtils.test.ts
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/entityUtils.ts b/js/app/packages/property/src/editors/selectors/entityUtils.ts
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/entityUtils.ts
rename to js/app/packages/property/src/editors/selectors/entityUtils.ts
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/index.ts b/js/app/packages/property/src/editors/selectors/index.ts
similarity index 70%
rename from js/app/packages/core/component/Properties/component/modal/shared/index.ts
rename to js/app/packages/property/src/editors/selectors/index.ts
index b7347b6c13..5f7f4636a0 100644
--- a/js/app/packages/core/component/Properties/component/modal/shared/index.ts
+++ b/js/app/packages/property/src/editors/selectors/index.ts
@@ -8,12 +8,21 @@ export {
entityTypeToBuckets,
getEntityName,
getEntitySearchText,
+ getEntityTimestampedItem,
getEntityType,
+ isChannelEntity,
quickAccessItemToEntity,
sortEntitiesWithSelfFirst,
threadMapper,
useQuickAccessEntities,
userToEntity,
} from './entityUtils';
+export { PropertyDateSelector } from './PropertyDateSelector';
export { PropertyEntitySelector } from './PropertyEntitySelector';
export { PropertyOptionSelector } from './PropertyOptionSelector';
+export type {
+ EntitySelectorConfig,
+ OptionSelectorConfig,
+ PinnedOption,
+ SelectableOption,
+} from './types';
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/types.ts b/js/app/packages/property/src/editors/selectors/types.ts
similarity index 100%
rename from js/app/packages/core/component/Properties/component/modal/shared/types.ts
rename to js/app/packages/property/src/editors/selectors/types.ts
diff --git a/js/app/packages/property/src/extractors/PropertyAddButton.tsx b/js/app/packages/property/src/extractors/PropertyAddButton.tsx
index 21615d8834..e036d780c2 100644
--- a/js/app/packages/property/src/extractors/PropertyAddButton.tsx
+++ b/js/app/packages/property/src/extractors/PropertyAddButton.tsx
@@ -20,7 +20,13 @@ export function PropertyAddButton(props: Props) {
) => {
e.stopPropagation();
if (isReadOnly()) return;
- ctx.onEdit?.(ctx.property(), e.currentTarget);
+ // External onEdit (legacy modal routing) takes precedence; otherwise
+ // open the local editor so a sibling <Property.PopoverEditor /> can mount.
+ if (ctx.onEdit) {
+ ctx.onEdit(ctx.property(), e.currentTarget);
+ } else {
+ ctx.openEditor(e.currentTarget);
+ }
};
return (
diff --git a/js/app/packages/property/src/extractors/PropertyEditTrigger.tsx b/js/app/packages/property/src/extractors/PropertyEditTrigger.tsx
index cbbc57ae72..862550ff0b 100644
--- a/js/app/packages/property/src/extractors/PropertyEditTrigger.tsx
+++ b/js/app/packages/property/src/extractors/PropertyEditTrigger.tsx
@@ -34,7 +34,14 @@ export function PropertyEditTrigger(props: Props) {
const handleClick: ButtonClickHandler = (e) => {
if (local.stopPropagation !== false) e.stopPropagation();
if (isReadOnly()) return;
- ctx.onEdit?.(ctx.property(), e.currentTarget);
+ // External onEdit (legacy routing through PropertiesContext modal stack)
+ // takes precedence; otherwise open the local editor so a sibling
+ // <Property.PopoverEditor /> can render anchored to this button.
+ if (ctx.onEdit) {
+ ctx.onEdit(ctx.property(), e.currentTarget);
+ } else {
+ ctx.openEditor(e.currentTarget);
+ }
if (typeof local.onClick === 'function') local.onClick(e);
};
diff --git a/js/app/packages/property/src/index.ts b/js/app/packages/property/src/index.ts
index f159357360..9feee09752 100644
--- a/js/app/packages/property/src/index.ts
+++ b/js/app/packages/property/src/index.ts
@@ -8,6 +8,35 @@ export {
useMaybeProperty,
useProperty,
} from './core/context';
+export {
+ type EntityEditorProps,
+ type PopoverEditorProps,
+ type PropertyEditorProps,
+ useBooleanEditor,
+ useInlineEditor,
+} from './editors';
+export {
+ type CombinedEntity,
+ createEntitySearchConfig,
+ Dropdown,
+ type DropdownOption,
+ type EntityTypeItemMap,
+ entityDataToEntity,
+ entityTypeToBuckets,
+ getEntityName,
+ getEntitySearchText,
+ getEntityTimestampedItem,
+ getEntityType,
+ isChannelEntity,
+ PropertyDateSelector,
+ PropertyEntitySelector,
+ PropertyOptionSelector,
+ quickAccessItemToEntity,
+ sortEntitiesWithSelfFirst,
+ threadMapper,
+ useQuickAccessEntities,
+ userToEntity,
+} from './editors/selectors';
export * from './hooks';
export { Property } from './property';
export * from './types';
diff --git a/js/app/packages/property/src/property.ts b/js/app/packages/property/src/property.ts
index 2a4989dd4c..7458c0d5f4 100644
--- a/js/app/packages/property/src/property.ts
+++ b/js/app/packages/property/src/property.ts
@@ -4,9 +4,23 @@
// property values in any layout, replacing the duplicated PropertyValue /
// CondensedPropertyValue / InlinePropertyValue / ListPropertyValue trees.
+import {
+ PropertyDisplay,
+ PropertyDisplayCondensed,
+} from './composed/PropertyDisplay';
import { Layout } from './core/Layout';
import { Root } from './core/Root';
import { Slot } from './core/Slot';
+import {
+ InlineBooleanEditor,
+ InlineEditor,
+ InlineLinkEditor,
+ InlineNumberEditor,
+ InlineTextEditor,
+ PopoverEditor,
+ PropertyEditor,
+} from './editors';
+import { EditorPopover } from './editors/popover/EditorPopover';
import {
PropertyAddButton,
PropertyCaret,
@@ -40,4 +54,23 @@ export const Property = {
EditTrigger: PropertyEditTrigger,
RemoveButton: PropertyRemoveButton,
AddButton: PropertyAddButton,
+
+ // Editors — auto-dispatch by valueType. Use Property.Editor for "do the
+ // right thing", or compose with InlineEditor / PopoverEditor when you need
+ // finer control over where the editor sits in the tree.
+ Editor: PropertyEditor,
+ InlineEditor,
+ PopoverEditor,
+ EditorPopover,
+
+ // Per-type editor leaves (rare — prefer the dispatchers above).
+ InlineText: InlineTextEditor,
+ InlineNumber: InlineNumberEditor,
+ InlineBoolean: InlineBooleanEditor,
+ InlineLink: InlineLinkEditor,
+
+ // Composed: opinionated display + editor compositions. Drop-in replacements
+ // for the legacy PropertyValue / CondensedPropertyValue routers.
+ Display: PropertyDisplay,
+ DisplayCondensed: PropertyDisplayCondensed,
};