@case-framework/survey-editor-ui 0.4.2 → 0.5.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 (114) hide show
  1. package/README.md +75 -0
  2. package/dist/item-core-registry.cjs.js +1 -1
  3. package/dist/item-core-registry.cjs.js.map +1 -1
  4. package/dist/item-core-registry.es.js.map +1 -1
  5. package/dist/src/components/c-ui/alert-provider.d.ts +1 -1
  6. package/dist/src/components/c-ui/confirm-dialog.d.ts +1 -1
  7. package/dist/src/components/c-ui/confirm-provider.d.ts +1 -1
  8. package/dist/src/components/c-ui/dot-background.d.ts +2 -2
  9. package/dist/src/components/c-ui/filepicker-dropzone.d.ts +1 -1
  10. package/dist/src/components/common/content-editable-plain.d.ts +1 -1
  11. package/dist/src/components/common/drag-drop-provider.d.ts +7 -0
  12. package/dist/src/components/common/sortable-tree.d.ts +8 -1
  13. package/dist/src/components/rich-text/rich-text-block-editor.d.ts +1 -1
  14. package/dist/src/components/rich-text/rich-text-content-view.d.ts +1 -1
  15. package/dist/src/components/rich-text/rich-text-editor-context.d.ts +1 -1
  16. package/dist/src/components/rich-text-editor/plugins/docked-toolbar-plugin.d.ts +1 -1
  17. package/dist/src/components/rich-text-editor/plugins/end-of-content-editing-area-plugin.d.ts +1 -1
  18. package/dist/src/components/rich-text-editor/plugins/floating-toolbar-plugin.d.ts +1 -1
  19. package/dist/src/components/rich-text-editor/plugins/image-dialog-plugin.d.ts +1 -1
  20. package/dist/src/components/rich-text-editor/plugins/info-box-popover-plugin.d.ts +1 -1
  21. package/dist/src/components/rich-text-editor/plugins/link-popover-plugin.d.ts +1 -1
  22. package/dist/src/components/rich-text-editor/plugins/slash-command-menu-plugin.d.ts +1 -1
  23. package/dist/src/components/rich-text-editor/rich-text-editor.d.ts +1 -1
  24. package/dist/src/components/rich-text-editor/style-control-icon.d.ts +1 -1
  25. package/dist/src/components/ui/alert-dialog.d.ts +12 -12
  26. package/dist/src/components/ui/alert.d.ts +4 -4
  27. package/dist/src/components/ui/badge.d.ts +1 -1
  28. package/dist/src/components/ui/breadcrumb.d.ts +7 -7
  29. package/dist/src/components/ui/button.d.ts +1 -1
  30. package/dist/src/components/ui/calendar.d.ts +2 -2
  31. package/dist/src/components/ui/card.d.ts +7 -7
  32. package/dist/src/components/ui/checkbox.d.ts +1 -1
  33. package/dist/src/components/ui/collapsible.d.ts +3 -3
  34. package/dist/src/components/ui/command.d.ts +9 -9
  35. package/dist/src/components/ui/context-menu.d.ts +15 -15
  36. package/dist/src/components/ui/dialog.d.ts +10 -10
  37. package/dist/src/components/ui/dropdown-menu.d.ts +15 -15
  38. package/dist/src/components/ui/field.d.ts +10 -10
  39. package/dist/src/components/ui/input-group.d.ts +6 -6
  40. package/dist/src/components/ui/input.d.ts +1 -1
  41. package/dist/src/components/ui/kbd.d.ts +2 -2
  42. package/dist/src/components/ui/label.d.ts +1 -1
  43. package/dist/src/components/ui/popover.d.ts +7 -7
  44. package/dist/src/components/ui/progress.d.ts +1 -1
  45. package/dist/src/components/ui/radio-group.d.ts +2 -2
  46. package/dist/src/components/ui/resizable.d.ts +3 -3
  47. package/dist/src/components/ui/scroll-area.d.ts +2 -2
  48. package/dist/src/components/ui/select.d.ts +10 -10
  49. package/dist/src/components/ui/separator.d.ts +1 -1
  50. package/dist/src/components/ui/skeleton.d.ts +1 -1
  51. package/dist/src/components/ui/slider.d.ts +1 -1
  52. package/dist/src/components/ui/sonner.d.ts +1 -1
  53. package/dist/src/components/ui/switch.d.ts +1 -1
  54. package/dist/src/components/ui/tabs.d.ts +4 -4
  55. package/dist/src/components/ui/textarea.d.ts +1 -1
  56. package/dist/src/components/ui/toggle-group.d.ts +2 -2
  57. package/dist/src/components/ui/toggle.d.ts +1 -1
  58. package/dist/src/components/ui/tooltip.d.ts +4 -4
  59. package/dist/src/index.d.ts +1 -1
  60. package/dist/src/modules/default-item-registry/items/form/editor/field-item-preview.d.ts +1 -1
  61. package/dist/src/modules/default-item-registry/items/form/editor/field-type-shared.d.ts +7 -7
  62. package/dist/src/modules/default-item-registry/items/form/editor/simple-field-editor.d.ts +1 -1
  63. package/dist/src/modules/default-item-registry/shared/preview/question-header.d.ts +1 -1
  64. package/dist/src/modules/survey-editor/assets/survey-image-asset-manager.d.ts +1 -1
  65. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +2 -6
  66. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-catalog.d.ts +6 -0
  67. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-insert-item-preset.d.ts +18 -0
  68. package/dist/src/modules/survey-editor/editor-card/add-items/item-preset-utils.d.ts +6 -0
  69. package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +1 -1
  70. package/dist/src/modules/survey-editor/editor-card/copy-item-dropdown-menu.d.ts +1 -1
  71. package/dist/src/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +1 -1
  72. package/dist/src/modules/survey-editor/editor-card/group-items.d.ts +1 -1
  73. package/dist/src/modules/survey-editor/editor-card/item-authoring-state-preview.d.ts +2 -2
  74. package/dist/src/modules/survey-editor/editor-card/item-color-menu.d.ts +2 -2
  75. package/dist/src/modules/survey-editor/editor-card/item-expression-overview.d.ts +3 -3
  76. package/dist/src/modules/survey-editor/editor-card/item-key-editor.d.ts +1 -1
  77. package/dist/src/modules/survey-editor/editor-card/item-preview.d.ts +1 -1
  78. package/dist/src/modules/survey-editor/editor-card/item-type-icon-with-tooltip.d.ts +1 -1
  79. package/dist/src/modules/survey-editor/editor-card/recommended-item-types.d.ts +1 -1
  80. package/dist/src/modules/survey-editor/index.d.ts +1 -1
  81. package/dist/src/modules/survey-editor/preview-viewport-toggle.d.ts +1 -1
  82. package/dist/src/modules/survey-editor/primitives/input-with-ai-popover.d.ts +1 -1
  83. package/dist/src/modules/survey-editor/routes/editor/_components/assistant-authoring-lock.d.ts +2 -2
  84. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +2 -2
  85. package/dist/src/modules/survey-editor/routes/editor/_components/editor-mode-switch.d.ts +1 -1
  86. package/dist/src/modules/survey-editor/routes/editor/_components/editor-workspace.d.ts +2 -2
  87. package/dist/src/modules/survey-editor/routes/editor/_components/footer.d.ts +1 -1
  88. package/dist/src/modules/survey-editor/routes/editor/_components/main.d.ts +0 -2
  89. package/dist/src/modules/survey-editor/routes/editor/_components/workspace-panel-toggles.d.ts +23 -0
  90. package/dist/src/modules/survey-editor/routes/editor/asset-manager/index.d.ts +1 -1
  91. package/dist/src/modules/survey-editor/routes/editor/index.d.ts +0 -2
  92. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-drag-drop.d.ts +23 -0
  93. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/language-picker.d.ts +1 -1
  94. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-item-toolbox.d.ts +1 -0
  95. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-left-panel.d.ts +1 -0
  96. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-outline.d.ts +2 -2
  97. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-workspace.d.ts +1 -3
  98. package/dist/src/modules/survey-editor/routes/editor/item-editor/index.d.ts +1 -5
  99. package/dist/src/modules/survey-editor/routes/editor/preview-mode/index.d.ts +1 -3
  100. package/dist/src/modules/survey-editor/routes/editor/preview-mode/page-break-divider.d.ts +1 -1
  101. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-controls.d.ts +1 -1
  102. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-canvas.d.ts +1 -1
  103. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-item.d.ts +1 -1
  104. package/dist/src/modules/survey-editor/routes/editor/translation-mode/index.d.ts +1 -1
  105. package/dist/src/modules/survey-editor/routes/editor/translation-mode/translation-left-panel.d.ts +5 -0
  106. package/dist/src/modules/survey-editor/survey-editor.d.ts +19 -2
  107. package/dist/survey-editor-defaults.css +14 -0
  108. package/dist/survey-editor-ui.cjs.js +60 -60
  109. package/dist/survey-editor-ui.cjs.js.map +1 -1
  110. package/dist/survey-editor-ui.css +2 -2
  111. package/dist/survey-editor-ui.es.js +14582 -14071
  112. package/dist/survey-editor-ui.es.js.map +1 -1
  113. package/package.json +8 -8
  114. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +0 -6
@@ -1,6 +1,4 @@
1
1
  interface EditorMainProps {
2
- onBackRequested?: () => void;
3
- onSaveRequested: () => void;
4
2
  onSimulatorRequested?: () => void;
5
3
  }
6
4
  declare const EditorMain: React.FC<EditorMainProps>;
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ interface WorkspacePanelTogglesState {
3
+ leftLabel?: string;
4
+ leftOpen: boolean;
5
+ onLeftToggle: () => void;
6
+ rightLabel?: string;
7
+ rightOpen: boolean;
8
+ onRightToggle: () => void;
9
+ }
10
+ export declare const WorkspacePanelTogglesProvider: ({ value, children, }: {
11
+ value: WorkspacePanelTogglesState;
12
+ children: ReactNode;
13
+ }) => import("react").JSX.Element;
14
+ type PanelToggleSeparator = "before" | "after";
15
+ /** Shared left workspace-panel control for mode headers. */
16
+ export declare const WorkspaceLeftPanelToggle: ({ separator }: {
17
+ separator?: PanelToggleSeparator;
18
+ }) => import("react").JSX.Element;
19
+ /** Shared right workspace-panel control for mode headers. */
20
+ export declare const WorkspaceRightPanelToggle: ({ separator }: {
21
+ separator?: PanelToggleSeparator;
22
+ }) => import("react").JSX.Element;
23
+ export {};
@@ -1,2 +1,2 @@
1
- declare const AssetManager: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const AssetManager: () => import("react").JSX.Element;
2
2
  export default AssetManager;
@@ -1,6 +1,4 @@
1
1
  interface EditorProps {
2
- onBackRequested?: () => void;
3
- onSaveRequested?: () => void;
4
2
  onSimulatorRequested?: () => void;
5
3
  }
6
4
  declare const Editor: React.FC<EditorProps>;
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { ItemInsertionTarget } from '../../../../../../../modules/survey-editor/editor-card/add-items/hooks/use-insert-item-preset';
3
+ export declare const SURVEY_ITEM_DRAG_TYPE = "survey-editor-item";
4
+ export interface ItemPresetDragData {
5
+ kind: "item-preset";
6
+ presetId: string;
7
+ }
8
+ export declare const isItemPresetDragData: (data: unknown) => data is ItemPresetDragData;
9
+ export declare const useItemPresetDragActive: () => boolean;
10
+ export declare function SurveyItemDragDropProvider({ children }: {
11
+ children: ReactNode;
12
+ }): import("react").JSX.Element;
13
+ interface ItemInsertionDropTargetProps {
14
+ target: ItemInsertionTarget;
15
+ surface: "outline" | "preview";
16
+ navigation?: "outline" | "preview" | "none";
17
+ className?: string;
18
+ activeClassName?: string;
19
+ idSuffix?: string;
20
+ children: ReactNode;
21
+ }
22
+ export declare function ItemInsertionDropTarget({ target, surface, navigation, className, activeClassName, idSuffix, children, }: ItemInsertionDropTargetProps): import("react").JSX.Element;
23
+ export {};
@@ -1,2 +1,2 @@
1
- declare const LanguagePicker: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const LanguagePicker: () => import("react").JSX.Element;
2
2
  export default LanguagePicker;
@@ -0,0 +1 @@
1
+ export declare function SurveyItemToolbox(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function SurveyLeftPanel(): import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
- export declare const NavigableSurveyOutline: () => import("react/jsx-runtime").JSX.Element;
2
- declare const EditableSurveyOutline: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const NavigableSurveyOutline: () => import("react").JSX.Element;
2
+ declare const EditableSurveyOutline: () => import("react").JSX.Element;
3
3
  export default EditableSurveyOutline;
@@ -5,8 +5,6 @@ interface SurveyWorkspaceProps {
5
5
  main: ReactNode;
6
6
  overlay?: ReactNode;
7
7
  mainLabel: string;
8
- onBackRequested?: () => void;
9
- onSaveRequested: () => void;
10
8
  }
11
- export declare const SurveyWorkspace: ({ mode, main, overlay, mainLabel, onBackRequested, onSaveRequested, }: SurveyWorkspaceProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const SurveyWorkspace: ({ mode, main, overlay, mainLabel }: SurveyWorkspaceProps) => import("react").JSX.Element;
12
10
  export {};
@@ -1,6 +1,2 @@
1
- interface ItemEditorProps {
2
- onBackRequested?: () => void;
3
- onSaveRequested: () => void;
4
- }
5
- declare const ItemEditor: React.FC<ItemEditorProps>;
1
+ declare const ItemEditor: React.FC;
6
2
  export default ItemEditor;
@@ -1,7 +1,5 @@
1
1
  interface PreviewModeProps {
2
- onBackRequested?: () => void;
3
- onSaveRequested: () => void;
4
2
  onSimulatorRequested?: () => void;
5
3
  }
6
- declare const PreviewMode: ({ onBackRequested, onSaveRequested, onSimulatorRequested, }: PreviewModeProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const PreviewMode: ({ onSimulatorRequested }: PreviewModeProps) => import("react").JSX.Element;
7
5
  export default PreviewMode;
@@ -2,5 +2,5 @@ interface PageBreakDividerProps {
2
2
  itemId: string;
3
3
  highlighted: boolean;
4
4
  }
5
- export declare const PageBreakDivider: ({ itemId, highlighted }: PageBreakDividerProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const PageBreakDivider: ({ itemId, highlighted }: PageBreakDividerProps) => import("react").JSX.Element;
6
6
  export {};
@@ -11,5 +11,5 @@ interface PreviewControlsProps {
11
11
  onFullscreenChange: (fullscreen: boolean) => void;
12
12
  expanded?: boolean;
13
13
  }
14
- export declare const PreviewControls: ({ preferences, onPreferencesChange, canLocate, onLocate, canReset, onReset, onSimulatorRequested, fullscreen, onFullscreenChange, expanded, }: PreviewControlsProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const PreviewControls: ({ preferences, onPreferencesChange, canLocate, onLocate, canReset, onReset, onSimulatorRequested, fullscreen, onFullscreenChange, expanded, }: PreviewControlsProps) => import("react").JSX.Element;
15
15
  export {};
@@ -13,5 +13,5 @@ interface SurveyPreviewCanvasProps {
13
13
  onResponseChanged: () => void;
14
14
  className?: string;
15
15
  }
16
- export declare const SurveyPreviewCanvas: ({ survey, surveyEngine, preferences, focusedItemId, editingItemId, locateRequestKey, initialLocateReady, currentPageIndex, onCurrentPageIndexChange, onResponseChanged, className, }: SurveyPreviewCanvasProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const SurveyPreviewCanvas: ({ survey, surveyEngine, preferences, focusedItemId, editingItemId, locateRequestKey, initialLocateReady, currentPageIndex, onCurrentPageIndexChange, onResponseChanged, className, }: SurveyPreviewCanvasProps) => import("react").JSX.Element;
17
17
  export {};
@@ -9,5 +9,5 @@ interface SurveyPreviewItemProps {
9
9
  onFocus: () => void;
10
10
  afterDeleteItemId: string | null;
11
11
  }
12
- export declare const SurveyPreviewItem: ({ item, renderedItem, preferences, focused, highlighted, onFocus, afterDeleteItemId, }: SurveyPreviewItemProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const SurveyPreviewItem: ({ item, renderedItem, preferences, focused, highlighted, onFocus, afterDeleteItemId, }: SurveyPreviewItemProps) => import("react").JSX.Element;
13
13
  export {};
@@ -1,2 +1,2 @@
1
- declare const TranslationMode: () => import("react/jsx-runtime").JSX.Element;
1
+ declare const TranslationMode: () => import("react").JSX.Element;
2
2
  export default TranslationMode;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Translation mode deliberately exposes language navigation only. Structural
3
+ * survey operations belong to the authoring workspace, not this panel.
4
+ */
5
+ export declare const TranslationLeftPanel: () => import("react").JSX.Element;
@@ -10,6 +10,21 @@ import { LocalizationCatalog } from '@case-framework/ui-localization';
10
10
  import { SurveyEditorDateLocales } from './localization/date-fns';
11
11
  import { SurveyEditorWorkspace } from './workspace';
12
12
  export type SurveyEditorStateChange = EditorStateChangePayload;
13
+ /** Current editor status intended for application-owned controls. */
14
+ export interface SurveyEditorHostState {
15
+ sessionId: string | null;
16
+ revision: number;
17
+ dirty: boolean;
18
+ canUndo: boolean;
19
+ canRedo: boolean;
20
+ readOnly: boolean;
21
+ }
22
+ /** Commands a host application may invoke from controls outside the editor. */
23
+ export interface SurveyEditorController {
24
+ getSerializedState: () => SerializedSurveyEditor | null;
25
+ undo: () => boolean;
26
+ redo: () => boolean;
27
+ }
13
28
  export interface SurveyEditorProps {
14
29
  initialEditorState?: SerializedSurveyEditor;
15
30
  initialSessionId?: string;
@@ -21,6 +36,10 @@ export interface SurveyEditorProps {
21
36
  /** Override or extend default add-item category headings (merged with built-in defaults). */
22
37
  categoryLabels?: Partial<Record<ItemCategory, ItemLocaleMap>>;
23
38
  onEditorStateChange?: (change: SurveyEditorStateChange) => void;
39
+ /** Receives immediate status updates for application-owned editor controls. */
40
+ onHostStateChange?: (state: SurveyEditorHostState) => void;
41
+ /** Optional imperative bridge for application-owned editor controls. */
42
+ controllerRef?: React.Ref<SurveyEditorController | null>;
24
43
  /** Prevent user-authored survey mutations while preserving preview and navigation. */
25
44
  readOnly?: boolean;
26
45
  /** Optional imperative bridge for a survey assistant host. */
@@ -35,9 +54,7 @@ export interface SurveyEditorProps {
35
54
  /** Configure the initial main panel and workspace panels. */
36
55
  workspace?: SurveyEditorWorkspace;
37
56
  aiProvider?: SurveyEditorAIProvider | null;
38
- onBackRequested?: () => void;
39
57
  onSimulatorRequested?: () => void;
40
- onSaveRequested?: () => void;
41
58
  }
42
59
  declare const SurveyEditor: React.FC<SurveyEditorProps>;
43
60
  export { SurveyEditor };
@@ -1,6 +1,10 @@
1
1
  .survey-editor {
2
2
  /* Editor card / preview canvas — neutral near-white */
3
3
  --surface-bg-color: oklch(99.1% 0 0);
4
+ --survey-editor-workspace-radius: 0.75rem;
5
+ --survey-editor-workspace-border-top-width: 1px;
6
+ --survey-editor-footer-padding-inline: 0px;
7
+ --survey-editor-footer-padding-bottom: 0px;
4
8
 
5
9
  /*
6
10
  * Rich text emphasis (Lexical + preview). Chosen for strong contrast on
@@ -13,3 +17,13 @@
13
17
  --rich-text-editor-primary-color: oklch(0.36 0.12 264);
14
18
  --rich-text-editor-accent-color: oklch(0.44 0.15 48);
15
19
  }
20
+
21
+ .survey-editor-workspace-surface {
22
+ border-radius: var(--survey-editor-workspace-radius);
23
+ border-top-width: var(--survey-editor-workspace-border-top-width);
24
+ }
25
+
26
+ .survey-editor-footer {
27
+ padding-inline: var(--survey-editor-footer-padding-inline);
28
+ padding-bottom: var(--survey-editor-footer-padding-bottom);
29
+ }