@case-framework/survey-editor-ui 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/src/components/c-ui/dot-background.d.ts +2 -2
  2. package/dist/src/components/rich-text/index.d.ts +1 -1
  3. package/dist/src/components/rich-text/rich-text-survey-content.d.ts +5 -1
  4. package/dist/src/components/rich-text-editor/plugins/docked-toolbar-plugin.d.ts +19 -0
  5. package/dist/src/components/rich-text-editor/rich-text-command-application.d.ts +4 -0
  6. package/dist/src/components/rich-text-editor/rich-text-editor.d.ts +8 -1
  7. package/dist/src/modules/default-item-registry/items/choice/editor/{option-edit-dialog.d.ts → option-editor-card.d.ts} +8 -8
  8. package/dist/src/modules/default-item-registry/items/choice/editor/option-editor-fields.d.ts +5 -1
  9. package/dist/src/modules/default-item-registry/items/choice/editor/response-options-list.d.ts +4 -3
  10. package/dist/src/modules/default-item-registry/items/form/editor/simple-field-editor.d.ts +6 -0
  11. package/dist/src/modules/default-item-registry/items/form/model.d.ts +2 -0
  12. package/dist/src/modules/default-item-registry/shared/question-editor/deferred-localized-rich-text-field.d.ts +3 -0
  13. package/dist/src/modules/survey-editor/assistant/apply.d.ts +5 -0
  14. package/dist/src/modules/survey-editor/assistant/index.d.ts +1 -1
  15. package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +2 -2
  16. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +2 -2
  17. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +2 -2
  18. package/dist/src/modules/survey-editor/editor-card/add-items/initial-item-tree.d.ts +13 -0
  19. package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +1 -0
  20. package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +1 -8
  21. package/dist/src/modules/survey-editor/editor-card/item-editor-card.d.ts +2 -6
  22. package/dist/src/modules/survey-editor/editor-card/item-editor-context.d.ts +6 -4
  23. package/dist/src/modules/survey-editor/editor-card/item-key-editor.d.ts +1 -0
  24. package/dist/src/modules/survey-editor/editor-card/item-label-preview-and-editor.d.ts +1 -0
  25. package/dist/src/modules/survey-editor/editor-card/item-type-icon-with-tooltip.d.ts +2 -1
  26. package/dist/src/modules/survey-editor/navigation/location.d.ts +8 -0
  27. package/dist/src/modules/survey-editor/registry/types.d.ts +26 -8
  28. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot-context.d.ts +8 -0
  29. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +6 -2
  30. package/dist/src/modules/survey-editor/survey-editor.d.ts +3 -0
  31. package/dist/survey-editor-ui.cjs.js +62 -62
  32. package/dist/survey-editor-ui.cjs.js.map +1 -1
  33. package/dist/survey-editor-ui.css +1 -1
  34. package/dist/survey-editor-ui.es.js +14461 -13127
  35. package/dist/survey-editor-ui.es.js.map +1 -1
  36. package/package.json +12 -12
@@ -45,8 +45,8 @@ declare const dotBackgroundSpacingVariants: {
45
45
  type DotBackgroundVariant = keyof typeof dotBackgroundColorVariants;
46
46
  type DotBackgroundSpacingVariant = keyof typeof dotBackgroundSpacingVariants;
47
47
  declare const dotBackgroundVariants: (props?: ({
48
- variant?: "default" | "secondary" | "accent" | "muted" | "card" | "custom" | null | undefined;
49
- spacing?: "default" | "dense" | "loose" | "custom" | "relaxed" | null | undefined;
48
+ variant?: "default" | "secondary" | "accent" | "custom" | "muted" | "card" | null | undefined;
49
+ spacing?: "default" | "custom" | "dense" | "loose" | "relaxed" | null | undefined;
50
50
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
51
51
  type DotBackgroundStyle = React.CSSProperties & {
52
52
  "--dot-background-color"?: string;
@@ -1,6 +1,6 @@
1
1
  export { RichTextBlockEditor, type RichTextBlockEditorChange, type RichTextBlockEditorProps, } from './rich-text-block-editor';
2
2
  export { RichTextContentView, type RichTextContentViewProps } from './rich-text-content-view';
3
- export { createRichTextEditorValueFromContent, createRichTextEditorValueFromText, getRichTextContentFromEditorState, writeContentToEditor, } from './rich-text-survey-content';
3
+ export { createRichTextEditorValueFromContent, createRichTextEditorValueFromText, getRichTextContentFromEditorState, type RichTextSerializationOptions, writeContentToEditor, } from './rich-text-survey-content';
4
4
  export type { RichTextImageAssetOption } from './types';
5
5
  export { DEFAULT_BLOCK_CONTENT_POLICY, DEFAULT_COMPACT_CONTENT_POLICY, isBlockContentPolicyVariant, mergeRichTextContentPolicy, sanitizeContentForPolicy, } from './content-policy';
6
6
  export type { RichTextContentPolicy, RichTextEditorVariant, RichTextStyleAttribute, RichTextSupportedBlockType, } from './content-policy';
@@ -2,6 +2,10 @@ import { Content, RichTextContent } from '@case-framework/survey-core';
2
2
  import { EditorState, SerializedEditorState } from 'lexical';
3
3
  import { RichTextContentPolicy } from './content-policy';
4
4
  export declare function writeContentToEditor(content?: Content, policy?: RichTextContentPolicy): void;
5
- export declare function getRichTextContentFromEditorState(editorState: EditorState, policy?: RichTextContentPolicy): RichTextContent;
5
+ export interface RichTextSerializationOptions {
6
+ /** Excludes the editor-only final paragraph used as a convenient caret target. */
7
+ excludeTrailingEmptyParagraph?: boolean;
8
+ }
9
+ export declare function getRichTextContentFromEditorState(editorState: EditorState, policy?: RichTextContentPolicy, options?: RichTextSerializationOptions): RichTextContent;
6
10
  export declare function createRichTextEditorValueFromContent(content?: Content, policy?: RichTextContentPolicy): SerializedEditorState;
7
11
  export declare function createRichTextEditorValueFromText(text?: string, policy?: RichTextContentPolicy): SerializedEditorState;
@@ -0,0 +1,19 @@
1
+ import { RefObject } from 'react';
2
+ import { RichTextStyleControl, RichTextTemplateVariable } from '../rich-text-editor-utils';
3
+ /** A stable, in-flow toolbar for longer block editors. */
4
+ export declare function DockedToolbarPlugin({ editable, visibility, position, linksEnabled, blockAlignmentEnabled, surfaceRef, toolbarClassName, styleControls, templateVariables, bulletListsEnabled, headingsEnabled, infoBoxesEnabled, imagesEnabled, separatorsEnabled, }: {
5
+ editable: boolean;
6
+ visibility: "active" | "always";
7
+ position: "flow" | "above";
8
+ linksEnabled: boolean;
9
+ blockAlignmentEnabled: boolean;
10
+ surfaceRef: RefObject<HTMLDivElement | null>;
11
+ toolbarClassName?: string;
12
+ styleControls: RichTextStyleControl[];
13
+ templateVariables: RichTextTemplateVariable[];
14
+ bulletListsEnabled: boolean;
15
+ headingsEnabled: boolean;
16
+ infoBoxesEnabled: boolean;
17
+ imagesEnabled: boolean;
18
+ separatorsEnabled: boolean;
19
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ import { SlashCommandItem } from './rich-text-editor-utils';
3
+ /** Applies a policy-filtered slash/toolbar command at the current Lexical selection. */
4
+ export declare function $applyRichTextCommand(editor: LexicalEditor, item: SlashCommandItem): void;
@@ -15,6 +15,7 @@ export interface RichTextEditorProps {
15
15
  value?: SerializedEditorState | null;
16
16
  placeholder?: string;
17
17
  autoFocus?: boolean;
18
+ autoFocusSelection?: "rootStart" | "rootEnd";
18
19
  editable?: boolean;
19
20
  wrapperClassName?: string;
20
21
  surfaceClassName?: string;
@@ -23,6 +24,12 @@ export interface RichTextEditorProps {
23
24
  endOfContentEditingArea?: boolean;
24
25
  placeholderClassName?: string;
25
26
  toolbarClassName?: string;
27
+ /** Floating is retained for compact editors; docked puts controls above block content. */
28
+ toolbarMode?: "floating" | "docked" | "none";
29
+ /** Applies to docked toolbars. */
30
+ dockedToolbarVisibility?: "active" | "always";
31
+ /** Whether a docked toolbar participates in flow or sits immediately above its editor surface. */
32
+ dockedToolbarPosition?: "flow" | "above";
26
33
  commandMenuClassName?: string;
27
34
  styleControls?: RichTextStyleControl[];
28
35
  templateVariables?: RichTextTemplateVariable[];
@@ -42,4 +49,4 @@ export interface RichTextEditorProps {
42
49
  onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
43
50
  onKeyDownCapture?: KeyboardEventHandler<HTMLDivElement>;
44
51
  }
45
- export declare function RichTextEditor({ id, value, placeholder, autoFocus, editable, wrapperClassName, surfaceClassName, contentClassName, endOfContentEditingArea, placeholderClassName, toolbarClassName, commandMenuClassName, styleControls, templateVariables, editorVariant, contentPolicy, resolveImageAssetUrl, imageAssets, registerImageAsset, imageAssetDeletion, linksEnabled, "aria-label": ariaLabel, onChange, onFocus, onBlur, onKeyDown, onKeyDownCapture, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
52
+ export declare function RichTextEditor({ id, value, placeholder, autoFocus, autoFocusSelection, editable, wrapperClassName, surfaceClassName, contentClassName, endOfContentEditingArea, placeholderClassName, toolbarClassName, toolbarMode, dockedToolbarVisibility, dockedToolbarPosition, commandMenuClassName, styleControls, templateVariables, editorVariant, contentPolicy, resolveImageAssetUrl, imageAssets, registerImageAsset, imageAssetDeletion, linksEnabled, "aria-label": ariaLabel, onChange, onFocus, onBlur, onKeyDown, onKeyDownCapture, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,21 @@
1
1
  import { Content, SurveyItemTranslations } from '@case-framework/survey-core';
2
2
  import { FormItemConfig } from '../../form/model';
3
3
  import { ChoiceOptionConfig } from '../model';
4
- type ChoiceOptionEditorFocusField = "label" | "key" | "advanced";
5
- interface ChoiceOptionEditDialogProps {
6
- open: boolean;
7
- option: ChoiceOptionConfig | null;
4
+ interface ChoiceOptionEditorCardProps {
5
+ option: ChoiceOptionConfig;
8
6
  existingOptions: ChoiceOptionConfig[];
9
7
  initialLabelContent?: Content;
10
- initialFocusField?: ChoiceOptionEditorFocusField;
11
- initialAdvancedOpen?: boolean;
12
8
  itemId: string;
13
9
  embeddedFormConfig: FormItemConfig;
14
10
  embeddedFormEditingConfig: FormItemConfig;
15
11
  selectedLocale: string;
16
12
  translationNamespace: string;
17
- onSave: (option: ChoiceOptionConfig, labelContent?: Content) => void;
13
+ onCommit: (option: ChoiceOptionConfig, labelContent?: Content) => void;
14
+ onClose: () => void;
18
15
  onPersistEmbeddedForm: (applyChanges: (nextConfig: FormItemConfig, nextTranslations: SurveyItemTranslations) => void | boolean) => boolean;
19
16
  }
20
- export declare const ChoiceOptionEditDialog: React.FC<ChoiceOptionEditDialogProps>;
17
+ export interface ChoiceOptionEditorCardHandle {
18
+ commit: () => boolean;
19
+ }
20
+ export declare const ChoiceOptionEditorCard: import('react').ForwardRefExoticComponent<ChoiceOptionEditorCardProps & import('react').RefAttributes<ChoiceOptionEditorCardHandle>>;
21
21
  export {};
@@ -1,14 +1,18 @@
1
1
  import { RichTextEditorChange } from '../../../../../../components/rich-text-editor';
2
2
  import { SerializedEditorState } from 'lexical';
3
- import { ReactNode } from 'react';
3
+ import { ReactNode, RefObject } from 'react';
4
4
  interface ChoiceOptionEditorFieldsProps {
5
5
  draftKey: string;
6
6
  draftLabelEditorValue: SerializedEditorState;
7
7
  keyValidationMessage: string | null;
8
8
  labelEditorInstanceKey: number;
9
9
  labelAutoFocus?: boolean;
10
+ labelAutoFocusSelection?: "rootStart" | "rootEnd";
11
+ labelWrapperClassName?: string;
10
12
  keyAutoFocus?: boolean;
11
13
  keyRowTrailing?: ReactNode;
14
+ keyInputRef?: RefObject<HTMLInputElement | null>;
15
+ hideKeyField?: boolean;
12
16
  onDraftKeyChange: (value: string) => void;
13
17
  onDraftLabelChange: (change: RichTextEditorChange) => void;
14
18
  onSubmitShortcut?: () => void;
@@ -9,9 +9,10 @@ export interface ChoiceOptionListItem {
9
9
  interface ChoiceResponseOptionsListProps {
10
10
  itemId: string;
11
11
  items: ChoiceOptionListItem[];
12
- onItemEditLabel: (optionId: string) => void;
13
- onItemEditKey: (optionId: string) => void;
14
- onItemEditEmbeddedForm: (optionId: string) => void;
12
+ editingOptionId?: string;
13
+ editorCard?: React.ReactNode;
14
+ directDeleteEnabled: boolean;
15
+ onItemEdit: (optionId: string) => void;
15
16
  onItemDuplicate: (optionId: string) => void;
16
17
  onItemDelete: (optionId: string) => void;
17
18
  onItemsReorder: (nextItems: ChoiceOptionConfig[]) => void;
@@ -0,0 +1,6 @@
1
+ import { FormFieldConfig } from '../model';
2
+ export declare function SimpleFormFieldEditor({ field, onSave, onCustomize, }: {
3
+ field: FormFieldConfig;
4
+ onSave: (nextField: FormFieldConfig) => void;
5
+ onCustomize: () => void;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -125,6 +125,8 @@ export interface FormFieldGroupConfig {
125
125
  }
126
126
  export interface FormItemConfig {
127
127
  id: string;
128
+ /** Editor-facing complexity level; it does not change participant behavior. */
129
+ authoringMode: "simple" | "custom";
128
130
  fieldGroups: FormFieldGroupConfig[];
129
131
  }
130
132
  export declare function createFormItemConfig(itemId: string): FormItemConfig;
@@ -17,6 +17,9 @@ export interface DeferredLocalizedRichTextFieldProps {
17
17
  placeholderClassName?: string;
18
18
  styleControls?: RichTextStyleControl[];
19
19
  templateVariables?: RichTextTemplateVariable[];
20
+ toolbarMode?: "floating" | "docked" | "none";
21
+ dockedToolbarVisibility?: "active" | "always";
22
+ dockedToolbarPosition?: "flow" | "above";
20
23
  resolveImageAssetUrl?: (assetId: string) => string | undefined;
21
24
  imageAssets?: RichTextImageAssetOption[];
22
25
  }
@@ -19,6 +19,11 @@ interface ApplySurveyAssistantChangesInput {
19
19
  editor: SurveyEditorCore;
20
20
  itemRegistry: ComposedEditorItemRegistry;
21
21
  }
22
+ export declare const resolveSelectedLocaleAfterAssistantApply: ({ availableLocales, configuredFallbackLocale, selectedLocale, }: {
23
+ availableLocales: string[];
24
+ configuredFallbackLocale: string;
25
+ selectedLocale: string;
26
+ }) => string;
22
27
  export declare const applySurveyAssistantChangesToEditor: ({ changes, currentPrecondition, editor, itemRegistry, }: ApplySurveyAssistantChangesInput) => SurveyAssistantEditorBatchApplyResult;
23
28
  export declare const applySurveyAssistantChangeToEditor: ({ change, currentPrecondition, editor, itemRegistry, }: ApplySurveyAssistantChangeInput) => SurveyAssistantEditorApplyResult;
24
29
  export {};
@@ -1,2 +1,2 @@
1
- export { applySurveyAssistantChangeToEditor, applySurveyAssistantChangesToEditor, type SurveyAssistantEditorApplyResult, type SurveyAssistantEditorBatchApplyResult, } from './apply';
1
+ export { applySurveyAssistantChangeToEditor, applySurveyAssistantChangesToEditor, resolveSelectedLocaleAfterAssistantApply, type SurveyAssistantEditorApplyResult, type SurveyAssistantEditorBatchApplyResult, } from './apply';
2
2
  export { buildSurveyAssistantItemRegistryManifest, buildSurveyAssistantSnapshot, type SurveyAssistantSnapshotOptions, type SurveyEditorAssistantController, } from './snapshot';
@@ -1,5 +1,5 @@
1
- export declare const LAST_USED_ITEM_TYPE_KEY = "case.survey-editor.last-used-item-type";
2
- export declare const RECENT_ITEM_TYPES_KEY = "case.survey-editor.recent-item-types";
1
+ export declare const LAST_USED_ADD_ITEM_PRESET_KEY = "case.survey-editor.last-used-add-item-preset";
2
+ export declare const RECENT_ADD_ITEM_PRESETS_KEY = "case.survey-editor.recent-add-item-presets";
3
3
  export declare const MAX_RECENT_ITEM_TYPES = 5;
4
4
  export declare const DEFAULT_TOP_ITEM_TYPES: readonly ["infoItem", "formItem"];
5
5
  export declare const STRUCTURE_ITEM_TYPES: Set<string>;
@@ -15,9 +15,9 @@ interface UseAddItemActionsParams {
15
15
  targetIndex?: number;
16
16
  rootItemId?: string;
17
17
  clipboardValue: string | null;
18
- recordRecentItemType: (itemType: string) => void;
18
+ recordRecentPreset: (presetId: string) => void;
19
19
  }
20
- export declare function useAddItemActions({ editorItemRegistry, addItem, pasteItem, commitByUser, setPreferredPreviewItemId, closeDialog, targetGroupId, targetIndex, rootItemId, clipboardValue, recordRecentItemType, }: UseAddItemActionsParams): {
20
+ export declare function useAddItemActions({ editorItemRegistry, addItem, pasteItem, commitByUser, setPreferredPreviewItemId, closeDialog, targetGroupId, targetIndex, rootItemId, clipboardValue, recordRecentPreset, }: UseAddItemActionsParams): {
21
21
  handleSelectOption: (option: ItemTypeOption) => void;
22
22
  pasteFromClipboard: () => void;
23
23
  };
@@ -2,8 +2,8 @@ import { FocusEvent as ReactFocusEvent, KeyboardEvent as ReactKeyboardEvent, Ref
2
2
  interface UseOptionGroupNavigationParams<TOption> {
3
3
  options: TOption[];
4
4
  onSelect: (option: TOption) => void;
5
+ groupSizes?: number[];
5
6
  rowSize?: number;
6
- enableTabNavigation?: boolean;
7
7
  }
8
8
  export interface OptionGroupNavigation {
9
9
  groupRef: RefObject<HTMLDivElement | null>;
@@ -16,5 +16,5 @@ export interface OptionGroupNavigation {
16
16
  handleGroupBlur: (event: ReactFocusEvent<HTMLDivElement>) => void;
17
17
  handleGroupKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
18
18
  }
19
- export declare function useOptionGroupNavigation<TOption>({ options, onSelect, rowSize, enableTabNavigation, }: UseOptionGroupNavigationParams<TOption>): OptionGroupNavigation;
19
+ export declare function useOptionGroupNavigation<TOption>({ options, onSelect, groupSizes, rowSize, }: UseOptionGroupNavigationParams<TOption>): OptionGroupNavigation;
20
20
  export {};
@@ -0,0 +1,13 @@
1
+ import { SurveyItemCore, SurveyItemTranslations } from '@case-framework/survey-core';
2
+ import { Target } from '@case-framework/survey-core/editor';
3
+ import { ComposedEditorItemRegistry, ItemInitialData } from '../../../../../modules/survey-editor/registry';
4
+ interface ItemIdLookup {
5
+ has(itemId: string): boolean;
6
+ }
7
+ interface AddInitialItemTreeOptions {
8
+ itemKey?: string;
9
+ targetIndex?: number;
10
+ existingItemIds?: ItemIdLookup;
11
+ }
12
+ export declare const addInitialItemTree: (initialItem: ItemInitialData, parentId: string, editorItemRegistry: Pick<ComposedEditorItemRegistry, "coreRegistry">, addItem: (target: Target | null, item: SurveyItemCore, content?: SurveyItemTranslations) => void, options?: AddInitialItemTreeOptions) => SurveyItemCore;
13
+ export {};
@@ -2,6 +2,7 @@ import { LucideIcon } from 'lucide-react';
2
2
  import { ItemTypeInfos } from '../../../../../modules/survey-editor/utils/item-type-infos';
3
3
  export type AddDialogView = "entry" | "blank-item" | "structure" | "catalogue";
4
4
  export interface ItemTypeOption extends ItemTypeInfos {
5
+ presetId: string;
5
6
  itemType: string;
6
7
  categories: string[];
7
8
  }
@@ -6,9 +6,6 @@ export interface ItemTypeGridSection {
6
6
  options: ItemTypeOption[];
7
7
  }
8
8
  interface ItemTypeGridViewProps {
9
- search: string;
10
- searchInputRef: RefObject<HTMLInputElement | null>;
11
- searchPlaceholder: string;
12
9
  recentLabel: string;
13
10
  recentOptions: ItemTypeOption[];
14
11
  sections: ItemTypeGridSection[];
@@ -16,15 +13,11 @@ interface ItemTypeGridViewProps {
16
13
  activeIndex: number;
17
14
  isFocused: boolean;
18
15
  setActiveIndex: (index: number) => void;
19
- onSearchChange: (search: string) => void;
20
- onMoveFocusToGrid: () => void;
21
16
  onGroupFocus: () => void;
22
17
  onGroupBlur: (event: ReactFocusEvent<HTMLDivElement>) => void;
23
18
  onGroupKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
24
19
  onSelectOption: (option: ItemTypeOption) => void;
25
- emptyMessage: string;
26
20
  gridLabel: string;
27
- fullScreen: boolean;
28
21
  }
29
- export declare function ItemTypeGridView({ search, searchInputRef, searchPlaceholder, recentLabel, recentOptions, sections, optionGroupRef, activeIndex, isFocused, setActiveIndex, onSearchChange, onMoveFocusToGrid, onGroupFocus, onGroupBlur, onGroupKeyDown, onSelectOption, emptyMessage, gridLabel, fullScreen, }: ItemTypeGridViewProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function ItemTypeGridView({ recentLabel, recentOptions, sections, optionGroupRef, activeIndex, isFocused, setActiveIndex, onGroupFocus, onGroupBlur, onGroupKeyDown, onSelectOption, gridLabel, }: ItemTypeGridViewProps): import("react/jsx-runtime").JSX.Element;
30
23
  export {};
@@ -11,13 +11,9 @@ interface NavItem {
11
11
  hasIndicator?: boolean;
12
12
  indicatorCount?: number;
13
13
  }
14
- interface SidePanelCard {
15
- id: string;
14
+ interface ConditionsPopoverConfig {
16
15
  title: string;
17
16
  description?: string;
18
- icon: LucideIcon;
19
- content?: ReactNode;
20
- headerAction?: ReactNode;
21
17
  }
22
18
  interface ItemEditorCardProps {
23
19
  surveyItem: SurveyItemCore;
@@ -27,7 +23,7 @@ interface ItemEditorCardProps {
27
23
  };
28
24
  navItems?: NavItem[];
29
25
  layoutVariant?: "tabs" | "stacked";
30
- sidePanelCards?: SidePanelCard[];
26
+ conditionsPopover?: ConditionsPopoverConfig;
31
27
  children: ReactNode;
32
28
  }
33
29
  declare const ItemEditorCard: React.FC<ItemEditorCardProps>;
@@ -1,13 +1,15 @@
1
1
  import { ReactNode } from 'react';
2
+ export type AddItemDialogMode = "assistant" | "browse";
2
3
  interface ItemEditorContextType {
3
4
  addItemDialogOpen: boolean;
4
5
  setAddItemDialogOpen: (open: boolean) => void;
5
- openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingItemType?: string) => void;
6
+ openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingPresetId?: string, preferredMode?: AddItemDialogMode) => void;
6
7
  closeAddItemDialog: () => void;
7
8
  targetParentId: string | undefined;
8
9
  targetIndex: number | undefined;
9
- pendingItemType: string | undefined;
10
- clearPendingItemType: () => void;
10
+ pendingPresetId: string | undefined;
11
+ preferredAddItemDialogMode: AddItemDialogMode | undefined;
12
+ clearPendingPresetId: () => void;
11
13
  preferredPreviewItemId: string | null;
12
14
  setPreferredPreviewItemId: (itemId: string | null) => void;
13
15
  }
@@ -17,7 +19,7 @@ interface ItemEditorProviderProps {
17
19
  export declare const ItemEditorProvider: React.FC<ItemEditorProviderProps>;
18
20
  export declare const useItemEditor: () => ItemEditorContextType;
19
21
  export declare const useAddItemDialog: () => {
20
- openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingItemType?: string) => void;
22
+ openAddItemDialog: (targetParentId?: string, targetIndex?: number, pendingPresetId?: string, preferredMode?: AddItemDialogMode) => void;
21
23
  closeAddItemDialog: () => void;
22
24
  };
23
25
  export {};
@@ -4,6 +4,7 @@ interface ItemKeyEditorProps {
4
4
  currentItemKey?: SurveyItemKey;
5
5
  siblingKeys: string[];
6
6
  onChangeItemKey: (newKey: string) => void;
7
+ suppressInitialTooltipFocus?: boolean;
7
8
  }
8
9
  declare const ItemKeyEditor: (props: ItemKeyEditorProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export default ItemKeyEditor;
@@ -5,6 +5,7 @@ interface ItemLabelPreviewAndEditorProps {
5
5
  maxSuggestions?: number;
6
6
  className?: string;
7
7
  onChangeItemLabel: (newLabel: string) => void;
8
+ suppressInitialTooltipFocus?: boolean;
8
9
  }
9
10
  declare const ItemLabelPreviewAndEditor: React.FC<ItemLabelPreviewAndEditorProps>;
10
11
  export default ItemLabelPreviewAndEditor;
@@ -3,6 +3,7 @@ interface ItemTypeIconWithTooltipProps {
3
3
  typeInfos: ItemTypeInfos;
4
4
  color?: string;
5
5
  iconClassName?: string;
6
+ preventAutoFocus?: boolean;
6
7
  }
7
- declare const ItemTypeIconWithTooltip: ({ typeInfos, color, iconClassName, }: ItemTypeIconWithTooltipProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const ItemTypeIconWithTooltip: ({ typeInfos, color, iconClassName, preventAutoFocus, }: ItemTypeIconWithTooltipProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export default ItemTypeIconWithTooltip;
@@ -3,4 +3,12 @@ export type ItemFocusedSurveyEditorLocation = Exclude<SurveyEditorLocation, {
3
3
  view: "asset-manager";
4
4
  }>;
5
5
  export declare const surveyEditorLocationSupportsItemFocus: (location: SurveyEditorLocation) => location is ItemFocusedSurveyEditorLocation;
6
+ /**
7
+ * Returns the item that is actively being authored or inspected.
8
+ *
9
+ * Preview navigation keeps its canvas focus (`itemId`) separate from the item
10
+ * whose inline editor is open (`editingItemId`). The latter is the actionable
11
+ * target and therefore must win when publishing editor context to consumers
12
+ * such as the survey assistant.
13
+ */
6
14
  export declare const getSurveyEditorFocusedItemId: (location: SurveyEditorLocation) => string | undefined;
@@ -50,14 +50,6 @@ export interface ItemInfos {
50
50
  icon: ItemIconComponent;
51
51
  labelByLocale: ItemLocaleMap;
52
52
  descriptionByLocale: ItemLocaleMap;
53
- /**
54
- * Optional recommendation shown when an author opens an empty survey preview.
55
- * Entries are ordered by rank, allowing host registries to curate a simple first-step menu.
56
- */
57
- gettingStarted?: {
58
- rank: number;
59
- descriptionByLocale?: ItemLocaleMap;
60
- };
61
53
  defaultItemClassName?: string;
62
54
  categories: ItemCategory[];
63
55
  }
@@ -91,16 +83,40 @@ export interface EditorItemDefinition {
91
83
  createItem?: (ctx: CreateItemContext) => string;
92
84
  searchAdapters?: ItemSearchAdapter[];
93
85
  includeDefaultSearchAdapter?: boolean;
86
+ addItemPresets?: AddItemPreset[];
94
87
  }
95
88
  /** Context available when the editor creates an item from a registry entry. */
96
89
  export interface ItemInitialDataContext {
97
90
  /** The language currently selected in the editor. */
98
91
  locale: string;
99
92
  }
93
+ /** A named, author-facing way to create an item. */
94
+ export interface AddItemPreset {
95
+ /** Globally stable catalog identity, for example `choice.single`. */
96
+ id: string;
97
+ labelByLocale: ItemLocaleMap;
98
+ descriptionByLocale: ItemLocaleMap;
99
+ icon?: ItemIconComponent;
100
+ defaultItemClassName?: string;
101
+ categories?: ItemCategory[];
102
+ defaultItemKeyPrefix?: string;
103
+ /** Omit to make this preset available only in the full Add item catalog. */
104
+ recommendation?: {
105
+ rank: number;
106
+ descriptionByLocale?: ItemLocaleMap;
107
+ };
108
+ getInitialItem: (context?: ItemInitialDataContext) => ItemInitialData;
109
+ }
110
+ /** A preset after it has been associated with its registry item's persisted type. */
111
+ export interface ResolvedAddItemPreset extends AddItemPreset {
112
+ itemType: string;
113
+ }
100
114
  export type EditorItemDefinitionRegistry = Record<string, EditorItemDefinition>;
101
115
  export interface ComposedEditorItemRegistry {
102
116
  coreRegistry: ItemTypeRegistry;
103
117
  definitions: EditorItemDefinitionRegistry;
118
+ /** All author-creatable catalog entries, resolved from registry item presets. */
119
+ addItemPresets?: ResolvedAddItemPreset[];
104
120
  /** Validated assistant capabilities, composed once with the registry. */
105
121
  assistantCapabilities: SurveyAssistantCapabilitySet;
106
122
  playerLocalizations: LocalizationCatalog;
@@ -150,6 +166,8 @@ export interface ItemRegistryEntry {
150
166
  getInitialItem?: (context?: ItemInitialDataContext) => ItemInitialData;
151
167
  /** Editor-only: custom creation flow (advanced) */
152
168
  createItem?: (ctx: CreateItemContext) => string;
169
+ /** Editor-only: author-facing creation presets. Without one, this item cannot be added. */
170
+ addItemPresets?: AddItemPreset[];
153
171
  /** Editor-only: hide from add-item options in non-root context */
154
172
  isRootOnly?: boolean;
155
173
  }
@@ -1,6 +1,14 @@
1
+ import { SurveyAssistantThreadLauncher } from '@case-framework/survey-assistant/react';
1
2
  export interface EditorAssistantSlotContextValue {
2
3
  available: boolean;
4
+ threadLauncher?: SurveyAssistantThreadLauncher;
5
+ openPanel: () => void;
6
+ setOpenPanel: (openPanel: (() => void) | null) => void;
3
7
  setTarget: (target: HTMLDivElement | null) => void;
4
8
  }
5
9
  export declare const EditorAssistantSlotContext: import('react').Context<EditorAssistantSlotContextValue>;
6
10
  export declare const useEditorAssistantPanelAvailable: () => boolean;
11
+ export declare const useEditorAssistantThreadLauncher: () => {
12
+ openPanel: () => void;
13
+ threadLauncher: SurveyAssistantThreadLauncher;
14
+ } | null;
@@ -1,8 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
+ import { SurveyAssistantThreadLauncher } from '@case-framework/survey-assistant/react';
2
3
  interface EditorAssistantPanelProviderProps {
3
4
  children: ReactNode;
4
5
  panel?: ReactNode;
6
+ threadLauncher?: SurveyAssistantThreadLauncher;
5
7
  }
6
- export declare const EditorAssistantPanelProvider: ({ children, panel, }: EditorAssistantPanelProviderProps) => import("react/jsx-runtime").JSX.Element;
7
- export declare const EditorAssistantPanelSlot: () => import("react/jsx-runtime").JSX.Element;
8
+ export declare const EditorAssistantPanelProvider: ({ children, panel, threadLauncher, }: EditorAssistantPanelProviderProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const EditorAssistantPanelSlot: ({ openPanel }: {
10
+ openPanel?: () => void;
11
+ }) => import("react/jsx-runtime").JSX.Element;
8
12
  export {};
@@ -3,6 +3,7 @@ import { SerializedSurveyEditor } from '@case-framework/survey-core/editor';
3
3
  import { EditorStateChangePayload } from './hooks/useEditorStateChange';
4
4
  import { SurveyEditorNavigationAdapter } from './navigation/types';
5
5
  import { SurveyEditorAssistantController } from './assistant';
6
+ import { SurveyAssistantThreadLauncher } from '@case-framework/survey-assistant/react';
6
7
  import { ItemCategory, ItemLocaleMap, ItemRegistryEntry } from './registry';
7
8
  import { SurveyEditorAIProvider } from './ai/types';
8
9
  import { LocalizationCatalog } from '@case-framework/ui-localization';
@@ -26,6 +27,8 @@ export interface SurveyEditorProps {
26
27
  assistantControllerRef?: React.Ref<SurveyEditorAssistantController | null>;
27
28
  /** Optional host-rendered assistant UI shown in the editor workspace. */
28
29
  assistantPanel?: ReactNode;
30
+ /** Allows editor surfaces to create a new assistant thread and submit its first prompt. */
31
+ assistantThreadLauncher?: SurveyAssistantThreadLauncher;
29
32
  persistDebounceMs?: number;
30
33
  helpLink?: string;
31
34
  navigationAdapter?: SurveyEditorNavigationAdapter | null;