@case-framework/survey-ui 0.2.2 → 0.2.4

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 (126) hide show
  1. package/README.md +37 -59
  2. package/dist/index.d.ts +478 -9
  3. package/dist/survey-editor-defaults.css +9 -0
  4. package/dist/survey-ui.cjs.js +24 -24
  5. package/dist/survey-ui.cjs.js.map +1 -1
  6. package/dist/survey-ui.css +3 -0
  7. package/dist/survey-ui.es.js +1679 -1644
  8. package/dist/survey-ui.es.js.map +1 -1
  9. package/package.json +8 -7
  10. package/dist/components/c-ui/alert-provider.d.ts +0 -18
  11. package/dist/components/c-ui/confirm-dialog.d.ts +0 -19
  12. package/dist/components/c-ui/confirm-provider.d.ts +0 -15
  13. package/dist/components/c-ui/filepicker-dropzone.d.ts +0 -38
  14. package/dist/components/c-ui/loading-button.d.ts +0 -9
  15. package/dist/components/inputs/Filepicker.d.ts +0 -14
  16. package/dist/components/ui/alert-dialog.d.ts +0 -18
  17. package/dist/components/ui/alert.d.ts +0 -9
  18. package/dist/components/ui/badge.d.ts +0 -9
  19. package/dist/components/ui/breadcrumb.d.ts +0 -11
  20. package/dist/components/ui/button.d.ts +0 -10
  21. package/dist/components/ui/card.d.ts +0 -9
  22. package/dist/components/ui/checkbox.d.ts +0 -4
  23. package/dist/components/ui/command.d.ts +0 -20
  24. package/dist/components/ui/context-menu.d.ts +0 -25
  25. package/dist/components/ui/dialog.d.ts +0 -19
  26. package/dist/components/ui/dropdown-menu.d.ts +0 -25
  27. package/dist/components/ui/field.d.ts +0 -24
  28. package/dist/components/ui/input.d.ts +0 -3
  29. package/dist/components/ui/kbd.d.ts +0 -3
  30. package/dist/components/ui/label.d.ts +0 -4
  31. package/dist/components/ui/popover.d.ts +0 -7
  32. package/dist/components/ui/radio-group.d.ts +0 -5
  33. package/dist/components/ui/scroll-area.d.ts +0 -5
  34. package/dist/components/ui/separator.d.ts +0 -4
  35. package/dist/components/ui/skeleton.d.ts +0 -2
  36. package/dist/components/ui/sonner.d.ts +0 -3
  37. package/dist/components/ui/tabs.d.ts +0 -7
  38. package/dist/components/ui/tooltip.d.ts +0 -7
  39. package/dist/dev/_components/nav-input.d.ts +0 -35
  40. package/dist/dev/app.d.ts +0 -2
  41. package/dist/dev/main.d.ts +0 -0
  42. package/dist/lib/utils.d.ts +0 -2
  43. package/dist/modules/default-item-registry/built-in-preview-renderers.d.ts +0 -3
  44. package/dist/modules/default-item-registry/default-item-cores.d.ts +0 -33
  45. package/dist/modules/default-item-registry/default-registry-entries.d.ts +0 -2
  46. package/dist/modules/default-item-registry/editors/editor-card-for-group.d.ts +0 -3
  47. package/dist/modules/default-item-registry/editors/editor-card-for-root.d.ts +0 -3
  48. package/dist/modules/default-item-registry/editors/editor-card-for-scg-mcg.d.ts +0 -3
  49. package/dist/modules/default-item-registry/index.d.ts +0 -19
  50. package/dist/modules/survey-editor/_components/sortable/sortable-item.d.ts +0 -5
  51. package/dist/modules/survey-editor/_components/sortable/sortable-wrapper.d.ts +0 -21
  52. package/dist/modules/survey-editor/ai/types.d.ts +0 -88
  53. package/dist/modules/survey-editor/editor-card/add-items/constants.d.ts +0 -5
  54. package/dist/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +0 -25
  55. package/dist/modules/survey-editor/editor-card/add-items/hooks/use-add-item-target.d.ts +0 -9
  56. package/dist/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +0 -19
  57. package/dist/modules/survey-editor/editor-card/add-items/types.d.ts +0 -21
  58. package/dist/modules/survey-editor/editor-card/add-items/views/ai-item-view.d.ts +0 -10
  59. package/dist/modules/survey-editor/editor-card/add-items/views/back-button.d.ts +0 -5
  60. package/dist/modules/survey-editor/editor-card/add-items/views/blank-item-view.d.ts +0 -13
  61. package/dist/modules/survey-editor/editor-card/add-items/views/entry-view.d.ts +0 -15
  62. package/dist/modules/survey-editor/editor-card/add-items/views/structure-view.d.ts +0 -16
  63. package/dist/modules/survey-editor/editor-card/add-items.d.ts +0 -1
  64. package/dist/modules/survey-editor/editor-card/copy-item-dropdown-menu.d.ts +0 -5
  65. package/dist/modules/survey-editor/editor-card/delete-item-context-menu.d.ts +0 -5
  66. package/dist/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +0 -5
  67. package/dist/modules/survey-editor/editor-card/group-items.d.ts +0 -2
  68. package/dist/modules/survey-editor/editor-card/hooks/use-group-list-keyboard.d.ts +0 -35
  69. package/dist/modules/survey-editor/editor-card/index.d.ts +0 -2
  70. package/dist/modules/survey-editor/editor-card/item-color-menu.d.ts +0 -6
  71. package/dist/modules/survey-editor/editor-card/item-color-selector.d.ts +0 -5
  72. package/dist/modules/survey-editor/editor-card/item-editor-card-skeleton.d.ts +0 -2
  73. package/dist/modules/survey-editor/editor-card/item-editor-card.d.ts +0 -21
  74. package/dist/modules/survey-editor/editor-card/item-editor-context.d.ts +0 -20
  75. package/dist/modules/survey-editor/editor-card/item-key-editor.d.ts +0 -9
  76. package/dist/modules/survey-editor/editor-card/item-label-preview-and-editor.d.ts +0 -9
  77. package/dist/modules/survey-editor/editor-card/item-preview.d.ts +0 -8
  78. package/dist/modules/survey-editor/editor-card/item-type-icon-with-tooltip.d.ts +0 -8
  79. package/dist/modules/survey-editor/editor-instance-provider.d.ts +0 -7
  80. package/dist/modules/survey-editor/hooks/useClipboardValue.d.ts +0 -2
  81. package/dist/modules/survey-editor/hooks/useDeleteItem.d.ts +0 -9
  82. package/dist/modules/survey-editor/hooks/useEditor.d.ts +0 -12
  83. package/dist/modules/survey-editor/hooks/useEditorStateChange.d.ts +0 -17
  84. package/dist/modules/survey-editor/hooks/useKeyboardShortcuts.d.ts +0 -7
  85. package/dist/modules/survey-editor/index.d.ts +0 -7
  86. package/dist/modules/survey-editor/navigation/navigation-provider.d.ts +0 -11
  87. package/dist/modules/survey-editor/navigation/navigation.d.ts +0 -13
  88. package/dist/modules/survey-editor/navigation/types.d.ts +0 -18
  89. package/dist/modules/survey-editor/primitives/input-with-ai-popover.d.ts +0 -35
  90. package/dist/modules/survey-editor/registry/index.d.ts +0 -7
  91. package/dist/modules/survey-editor/registry/registry-mappers.d.ts +0 -19
  92. package/dist/modules/survey-editor/registry/search-adapter.d.ts +0 -19
  93. package/dist/modules/survey-editor/registry/types.d.ts +0 -154
  94. package/dist/modules/survey-editor/routes/editor/_components/footer.d.ts +0 -2
  95. package/dist/modules/survey-editor/routes/editor/_components/history-stack.d.ts +0 -2
  96. package/dist/modules/survey-editor/routes/editor/_components/main.d.ts +0 -2
  97. package/dist/modules/survey-editor/routes/editor/_components/sidebar.d.ts +0 -7
  98. package/dist/modules/survey-editor/routes/editor/index.d.ts +0 -5
  99. package/dist/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/breadcrumbs-nav.d.ts +0 -2
  100. package/dist/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +0 -2
  101. package/dist/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/language-picker.d.ts +0 -2
  102. package/dist/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/search-trigger.d.ts +0 -3
  103. package/dist/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/survey-search.d.ts +0 -7
  104. package/dist/modules/survey-editor/routes/editor/item-editor/index.d.ts +0 -2
  105. package/dist/modules/survey-editor/routes/editor/simulator/index.d.ts +0 -2
  106. package/dist/modules/survey-editor/routes/editor/translation-mode/index.d.ts +0 -2
  107. package/dist/modules/survey-editor/session-file.d.ts +0 -13
  108. package/dist/modules/survey-editor/store/editor-store-context.d.ts +0 -10
  109. package/dist/modules/survey-editor/store/editor-store-provider.d.ts +0 -7
  110. package/dist/modules/survey-editor/store/editor-store.d.ts +0 -96
  111. package/dist/modules/survey-editor/store/use-editor-store.d.ts +0 -4
  112. package/dist/modules/survey-editor/store/useItemNavigation.d.ts +0 -7
  113. package/dist/modules/survey-editor/survey-editor-config.d.ts +0 -17
  114. package/dist/modules/survey-editor/survey-editor.d.ts +0 -20
  115. package/dist/modules/survey-editor/utils/item-type-infos.d.ts +0 -23
  116. package/dist/modules/survey-player/index.d.ts +0 -1
  117. package/dist/modules/survey-player/survey-context.d.ts +0 -23
  118. package/dist/modules/survey-player/survey-item/survey-item-context.d.ts +0 -17
  119. package/dist/modules/survey-player/survey-item/survey-item-types/question-wrapper.d.ts +0 -5
  120. package/dist/modules/survey-player/survey-item/survey-item-types/single-choice-question-renderer.d.ts +0 -7
  121. package/dist/modules/survey-player/survey-item/survey-item.d.ts +0 -7
  122. package/dist/modules/survey-player/survey-player.d.ts +0 -2
  123. package/dist/styles.cjs.js +0 -0
  124. package/dist/styles.css +0 -2
  125. package/dist/styles.d.ts +0 -0
  126. package/dist/styles.es.js +0 -0
package/README.md CHANGED
@@ -1,73 +1,51 @@
1
- # React + TypeScript + Vite
1
+ # @case-framework/survey-ui
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ React UI components for CASE surveys, including the `SurveyEditor`.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## SurveyEditor styling in a host project
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ Import the package stylesheet once in your app entry point:
9
8
 
10
- ## React Compiler
11
-
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
9
+ ```tsx
10
+ import "@case-framework/survey-ui/css";
11
+ ```
13
12
 
14
- ## Expanding the ESLint configuration
13
+ If you only want the editor's default variable values as a tiny standalone asset, import:
15
14
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
15
+ ```tsx
16
+ import "@case-framework/survey-ui/editor-defaults.css";
17
+ ```
17
18
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
19
+ `@case-framework/survey-ui/css` already includes these defaults, so the standalone file is only needed when the host wants a separate variables-only layer.
25
20
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
21
+ If the host app uses Tailwind CSS v4, add the package as a source in the host global CSS file so Tailwind also scans the editor package:
32
22
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
23
+ ```css
24
+ @import "tailwindcss";
25
+ @source "../node_modules/@case-framework/survey-ui/dist";
44
26
  ```
45
27
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
28
+ Override the editor-specific CSS variables on the `.survey-editor` scope in the host stylesheet:
47
29
 
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
30
+ ```css
31
+ .survey-editor {
32
+ --main-bg-color: oklch(98.5% 0 0);
33
+ --main-bg-dot-color: oklch(85% 0 0);
34
+ --main-bg-dot-grid-size: calc(var(--spacing, 0.25rem) * 5);
52
35
 
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
36
+ --footer-bg-color: oklch(37.3% 0.034 259.733);
37
+ --footer-text-color: oklch(98.5% 0 0);
38
+ --footer-height: calc(var(--spacing, 0.25rem) * 6);
39
+ }
73
40
  ```
41
+
42
+ Available editor-scoped variables:
43
+
44
+ - `--main-bg-color`
45
+ - `--main-bg-dot-color`
46
+ - `--main-bg-dot-grid-size`
47
+ - `--footer-bg-color`
48
+ - `--footer-text-color`
49
+ - `--footer-height`
50
+
51
+ The editor also uses the shared UI theme tokens from the package stylesheet, so you can override variables such as `--background`, `--foreground`, `--card`, `--primary`, `--muted`, `--accent`, `--border`, `--input`, and `--ring` if you want the rest of the editor chrome to match your host theme.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,478 @@
1
- export { SurveyPlayer } from './modules/survey-player';
2
- export { SurveyEditor } from './modules/survey-editor';
3
- export { buildSurveyFileName, createBlankEditorState, createEditorStateFromRawSurvey, entriesToComposedEditorRegistry, entriesToParticipantRegistry, entriesToItemTypeRegistry, parseEditorStateFromJsonText, serializeSurveyStateForFile, validateRegistryEntries, } from './modules/survey-editor';
4
- export { FilepickerDropzone } from './components/c-ui/filepicker-dropzone';
5
- export { cloneRegistryEntries, createComposedEditorRegistry, createRegistryEntries, createSurveyPlayerRegistry, getDefaultComposedEditorRegistry, getDefaultRegistryEntries, getDefaultSurveyPlayerRegistry, } from './modules/default-item-registry';
6
- export type { CreateComposedEditorRegistryOptions, CreateRegistryEntriesOptions, CreateSurveyPlayerRegistryOptions, RegistryConflictStrategy, } from './modules/default-item-registry';
7
- export type { SurveyEditorProps, SurveyEditorStateChange, EditorItemDefinition, EditorItemDefinitionRegistry, ComposedEditorItemRegistry, EntriesToComposedEditorRegistryOptions, EntriesToParticipantRegistryOptions, ItemEditorComponentProps, ItemIconComponent, ItemPreviewComponentProps, ItemPreviewMode, ItemRegistryEntry, ItemRendererComponentProps, ItemSearchAdapter, RegistryValidationIssue, RegistryValidationMode, RegistryValidationOptions, RegistryValidationResult, AISuggestedText, BuildSurveyAIContextOptions, GenerateItemFromIntentRequest, GenerateItemFromIntentResult, GeneratedItemIntentSuggestion, SuggestItemKeyRequest, SuggestItemKeyResult, SuggestItemKeySuggestion, SuggestItemLabelRequest, SuggestItemLabelResult, SuggestItemLabelSuggestion, SurveyEditorAIProvider, SurveyAIContextScope, SurveyAIInvocationMode, SurveyAIRequestOptions, TranslateContentEntry, TranslateContentRequest, TranslateContentResult, ParsedSurveySession, ParsedSurveySessionFormat, } from './modules/survey-editor';
8
- export type { FilepickerDropzoneLabels, FilepickerDropzoneProps, } from './components/c-ui/filepicker-dropzone';
9
- export type { BuildSurveyAIContextPackOptions, SurveyAIContextIndexes, SurveyAIContextPack, SurveyAIContextPurpose, SurveyAIItemContextNode, SurveyAIKeyIndexEntry, SurveyAIFocus, SurveyAIOutlineNode, SurveyAITranslationSnippet, } from '@case-framework/survey-core/editor';
1
+ import { Accept } from 'react-dropzone';
2
+ import { BuildSurveyAIContextPackOptions } from '@case-framework/survey-core/editor';
3
+ import { ClassProp } from 'class-variance-authority/types';
4
+ import { default as default_2 } from 'react';
5
+ import { FileRejection } from 'react-dropzone';
6
+ import { FileWithPath } from 'react-dropzone';
7
+ import { ItemCoreConstructor } from '@case-framework/survey-core';
8
+ import { ItemTypeRegistry } from '@case-framework/survey-core';
9
+ import { JSX } from 'react/jsx-runtime';
10
+ import { RawSurveyItem } from '@case-framework/survey-core';
11
+ import { RenderedSurveyItem } from '@case-framework/survey-core';
12
+ import { SerializedSurveyEditor } from '@case-framework/survey-core/editor';
13
+ import { Survey } from '@case-framework/survey-core';
14
+ import { SurveyAIContextIndexes } from '@case-framework/survey-core/editor';
15
+ import { SurveyAIContextPack } from '@case-framework/survey-core/editor';
16
+ import { SurveyAIContextPurpose } from '@case-framework/survey-core/editor';
17
+ import { SurveyAIContextScope } from '@case-framework/survey-core/editor';
18
+ import { SurveyAIFocus } from '@case-framework/survey-core/editor';
19
+ import { SurveyAIItemContextNode } from '@case-framework/survey-core/editor';
20
+ import { SurveyAIKeyIndexEntry } from '@case-framework/survey-core/editor';
21
+ import { SurveyAIOutlineNode } from '@case-framework/survey-core/editor';
22
+ import { SurveyAITranslationSnippet } from '@case-framework/survey-core/editor';
23
+ import { SurveyItemCore } from '@case-framework/survey-core';
24
+ import { SurveyItemTranslations } from '@case-framework/survey-core';
25
+ import { Target } from '@case-framework/survey-core/editor';
26
+ import { VariantProps } from 'class-variance-authority';
27
+
28
+ export declare interface AISuggestedText {
29
+ text: string;
30
+ }
31
+
32
+ export declare interface BuildSurveyAIContextOptions {
33
+ purpose?: SurveyAIContextPurpose;
34
+ scope?: SurveyAIContextScope;
35
+ focusItemId?: string;
36
+ includeRawSurvey?: boolean;
37
+ outlineLimit?: number;
38
+ includeIndexes?: boolean;
39
+ includeFocusItemTree?: boolean;
40
+ focusItemTreeLimit?: number;
41
+ translationSnippetsPerItemLimit?: number;
42
+ translationSnippetTextLimit?: number;
43
+ }
44
+
45
+ export { BuildSurveyAIContextPackOptions }
46
+
47
+ export declare function buildSurveyFileName(state: SerializedSurveyEditor, fallback?: string): string;
48
+
49
+ export declare function cloneRegistryEntries(entries: readonly ItemRegistryEntry[]): ItemRegistryEntry[];
50
+
51
+ export declare interface ComposedEditorItemRegistry {
52
+ coreRegistry: ItemTypeRegistry;
53
+ definitions: EditorItemDefinitionRegistry;
54
+ }
55
+
56
+ export declare function createBlankEditorState(pluginRegistry?: ItemTypeRegistry, surveyKey?: string): SerializedSurveyEditor;
57
+
58
+ export declare function createComposedEditorRegistry(options?: CreateComposedEditorRegistryOptions): ComposedEditorItemRegistry;
59
+
60
+ export declare type CreateComposedEditorRegistryOptions = CreateRegistryEntriesOptions & EntriesToComposedEditorRegistryOptions;
61
+
62
+ export declare function createEditorStateFromRawSurvey(rawSurvey: Parameters<typeof Survey.fromJson>[0], pluginRegistry?: ItemTypeRegistry): SerializedSurveyEditor;
63
+
64
+ declare interface CreateItemContext {
65
+ editor: {
66
+ addItem: (target: Target, item: SurveyItemCore, content?: SurveyItemTranslations) => void;
67
+ };
68
+ targetParentId: string;
69
+ constructor: ItemCoreConstructor;
70
+ }
71
+
72
+ export declare function createRegistryEntries(options?: CreateRegistryEntriesOptions): ItemRegistryEntry[];
73
+
74
+ export declare interface CreateRegistryEntriesOptions {
75
+ /** Include default built-in entries first. Defaults to true. */
76
+ includeDefaultEntries?: boolean;
77
+ /** Custom entries to add/override. */
78
+ entries?: ItemRegistryEntry[];
79
+ /** How to handle duplicate itemType values. Defaults to override. */
80
+ conflictStrategy?: RegistryConflictStrategy;
81
+ }
82
+
83
+ export declare function createSurveyPlayerRegistry(options?: CreateSurveyPlayerRegistryOptions): SurveyPlayerItemRegistry;
84
+
85
+ export declare type CreateSurveyPlayerRegistryOptions = CreateRegistryEntriesOptions & EntriesToParticipantRegistryOptions;
86
+
87
+ export declare interface EditorItemDefinition {
88
+ itemType: string;
89
+ infos: ItemInfos;
90
+ editorComponent?: default_2.ComponentType<ItemEditorComponentProps>;
91
+ renderComponent?: default_2.ComponentType<ItemRendererComponentProps>;
92
+ previewComponent?: default_2.ComponentType<ItemPreviewComponentProps>;
93
+ capabilities?: ItemEditorCapabilities;
94
+ isRootOnly?: boolean;
95
+ getInitialItem?: () => ItemInitialData;
96
+ createItem?: (ctx: CreateItemContext) => string;
97
+ searchAdapters?: ItemSearchAdapter[];
98
+ includeDefaultSearchAdapter?: boolean;
99
+ }
100
+
101
+ export declare type EditorItemDefinitionRegistry = Record<string, EditorItemDefinition>;
102
+
103
+ declare interface EditorItemSearchResult {
104
+ matchType: SearchMatchType;
105
+ matchText: string;
106
+ }
107
+
108
+ declare interface EditorStateChangePayload {
109
+ sessionId: string | null;
110
+ state: SerializedSurveyEditor;
111
+ revision: number;
112
+ hasUncommittedChanges: boolean;
113
+ at: number;
114
+ }
115
+
116
+ /**
117
+ * Derive ComposedEditorItemRegistry from unified entries for the editor.
118
+ * Ensures Group and PageBreak have definitions; uses coreRegistry from entries.
119
+ */
120
+ export declare function entriesToComposedEditorRegistry(entries: ItemRegistryEntry[], options?: EntriesToComposedEditorRegistryOptions): ComposedEditorItemRegistry;
121
+
122
+ export declare interface EntriesToComposedEditorRegistryOptions {
123
+ /** Require built-in editor definitions for group/pageBreak. Defaults to true. */
124
+ requireBuiltInTypes?: boolean;
125
+ }
126
+
127
+ /**
128
+ * Derive ItemTypeRegistry from unified entries for Survey / SurveyEditor.
129
+ * Uses built-in registry for group/pageBreak; plugin entries supply constructors for custom types.
130
+ */
131
+ export declare function entriesToItemTypeRegistry(entries: ItemRegistryEntry[]): ItemTypeRegistry;
132
+
133
+ /**
134
+ * Derive participant registry from unified entries.
135
+ * Lightweight: core + renderer only. Use this for survey player / participant app.
136
+ */
137
+ export declare function entriesToParticipantRegistry(entries: ItemRegistryEntry[], options?: EntriesToParticipantRegistryOptions): SurveyPlayerItemRegistry;
138
+
139
+ export declare interface EntriesToParticipantRegistryOptions {
140
+ /** Throw when an entry in the provided list does not define a renderComponent. */
141
+ requireRenderer?: boolean;
142
+ }
143
+
144
+ declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): JSX.Element;
145
+
146
+ declare const fieldVariants: (props?: ({
147
+ orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
148
+ } & ClassProp) | undefined) => string;
149
+
150
+ export declare function FilepickerDropzone({ id, name, label, description, error, accept, multiple, disabled, required, maxFiles, maxSize, minSize, icon, className, labelClassName, contentClassName, descriptionClassName, errorClassName, dropzoneClassName, labels, onChange, onDropRejected, ...props }: FilepickerDropzoneProps): JSX.Element;
151
+
152
+ export declare interface FilepickerDropzoneLabels {
153
+ upload: string;
154
+ drag: string;
155
+ active: string;
156
+ reject: string;
157
+ rejectInvalidType: string;
158
+ rejectTooLarge: string;
159
+ rejectTooSmall: string;
160
+ rejectTooMany: string;
161
+ selectedCount: string;
162
+ }
163
+
164
+ export declare interface FilepickerDropzoneProps extends Omit<React.ComponentProps<typeof Field>, "children" | "onChange"> {
165
+ id: string;
166
+ name?: string;
167
+ label?: React.ReactNode;
168
+ description?: React.ReactNode;
169
+ error?: React.ReactNode;
170
+ accept?: Accept;
171
+ multiple?: boolean;
172
+ disabled?: boolean;
173
+ required?: boolean;
174
+ maxFiles?: number;
175
+ maxSize?: number;
176
+ minSize?: number;
177
+ icon?: React.ReactNode;
178
+ labelClassName?: string;
179
+ contentClassName?: string;
180
+ descriptionClassName?: string;
181
+ errorClassName?: string;
182
+ dropzoneClassName?: string;
183
+ labels?: Partial<FilepickerDropzoneLabels>;
184
+ onChange?: (files: readonly FileWithPath[]) => void;
185
+ onDropRejected?: (fileRejections: FileRejection[]) => void;
186
+ }
187
+
188
+ export declare interface GeneratedItemIntentSuggestion {
189
+ tempId: string;
190
+ parentTempId?: string;
191
+ itemType: string;
192
+ key: string;
193
+ itemLabel?: string;
194
+ confidence?: number;
195
+ }
196
+
197
+ export declare interface GenerateItemFromIntentRequest {
198
+ intent: string;
199
+ targetParentId: string;
200
+ allowedItemTypes: string[];
201
+ maxItems?: number;
202
+ locale?: string;
203
+ context: SurveyAIContextPack;
204
+ }
205
+
206
+ export declare interface GenerateItemFromIntentResult {
207
+ items: GeneratedItemIntentSuggestion[];
208
+ }
209
+
210
+ export declare function getDefaultComposedEditorRegistry(): ComposedEditorItemRegistry;
211
+
212
+ export declare function getDefaultRegistryEntries(): ItemRegistryEntry[];
213
+
214
+ export declare function getDefaultSurveyPlayerRegistry(): SurveyPlayerItemRegistry;
215
+
216
+ declare type ItemCategory = string;
217
+
218
+ declare interface ItemEditorCapabilities {
219
+ usesValidationPanel?: boolean;
220
+ usesTranslationPanel?: boolean;
221
+ usesConditionsPanel?: boolean;
222
+ }
223
+
224
+ export declare interface ItemEditorComponentProps<TItem extends SurveyItemCore = SurveyItemCore> {
225
+ item: TItem;
226
+ }
227
+
228
+ declare interface ItemEditorLocation {
229
+ view: 'item-editor';
230
+ itemId?: string;
231
+ }
232
+
233
+ export declare type ItemIconComponent = default_2.ComponentType<{
234
+ className?: string;
235
+ }>;
236
+
237
+ declare interface ItemInfos {
238
+ icon: ItemIconComponent;
239
+ labelByLocale: ItemLocaleMap;
240
+ descriptionByLocale: ItemLocaleMap;
241
+ defaultItemClassName?: string;
242
+ categories: ItemCategory[];
243
+ }
244
+
245
+ declare interface ItemInitialData {
246
+ rawItem: RawSurveyItem;
247
+ translations?: SurveyItemTranslations;
248
+ children?: ItemInitialData[];
249
+ }
250
+
251
+ declare type ItemLocaleMap = Record<string, string>;
252
+
253
+ export declare interface ItemPreviewComponentProps<TItem extends SurveyItemCore = SurveyItemCore> {
254
+ item: TItem;
255
+ itemConfig: TItem["config"];
256
+ itemContent?: SurveyItemTranslations;
257
+ locale: string;
258
+ mode?: ItemPreviewMode;
259
+ }
260
+
261
+ export declare type ItemPreviewMode = "interactive" | "static";
262
+
263
+ /**
264
+ * Unified registry entry type, reusable across contexts:
265
+ *
266
+ * - Participant app: needs only `constructor` + `renderComponent`
267
+ * - Editor: needs constructor, infos, `previewComponent`, editorComponent, searchAdapters, etc.
268
+ *
269
+ * Use the mapper helpers to derive ItemTypeRegistry, participant registry, or editor registry.
270
+ */
271
+ export declare interface ItemRegistryEntry {
272
+ itemType: string;
273
+ /** Item core constructor. Omit for built-in types (group, pageBreak) — they use survey-core's built-in registry. Omit for virtual "root" — it maps to Group with isRoot. */
274
+ constructor?: ItemCoreConstructor;
275
+ /** Participant renderer. Required for participant app. */
276
+ renderComponent?: default_2.ComponentType<ItemRendererComponentProps>;
277
+ /** Editor-only: item preview renderer */
278
+ previewComponent?: default_2.ComponentType<ItemPreviewComponentProps>;
279
+ /** Editor-only: display metadata */
280
+ infos?: ItemInfos;
281
+ /** Editor-only: card/editor UI */
282
+ editorComponent?: default_2.ComponentType<ItemEditorComponentProps>;
283
+ /** Editor-only: search integration */
284
+ searchAdapters?: ItemSearchAdapter[];
285
+ /** Editor-only: include built-in key/label/itemType search adapter in addition to custom adapters. Defaults to true. */
286
+ includeDefaultSearchAdapter?: boolean;
287
+ /** Editor-only */
288
+ capabilities?: ItemEditorCapabilities;
289
+ /** Editor-only: default raw item when creating new */
290
+ getInitialItem?: () => ItemInitialData;
291
+ /** Editor-only: custom creation flow (advanced) */
292
+ createItem?: (ctx: CreateItemContext) => string;
293
+ /** Editor-only: hide from add-item options in non-root context */
294
+ isRootOnly?: boolean;
295
+ }
296
+
297
+ export declare interface ItemRendererComponentProps {
298
+ renderedItem: RenderedSurveyItem;
299
+ }
300
+
301
+ export declare type ItemSearchAdapter = (ctx: ItemSearchAdapterContext) => EditorItemSearchResult[] | undefined;
302
+
303
+ declare interface ItemSearchAdapterContext {
304
+ itemId: string;
305
+ survey: Survey;
306
+ searchTerm: string;
307
+ }
308
+
309
+ export declare interface ParsedSurveySession {
310
+ format: ParsedSurveySessionFormat;
311
+ state: SerializedSurveyEditor;
312
+ sessionId: string;
313
+ }
314
+
315
+ export declare type ParsedSurveySessionFormat = 'raw-survey' | 'serialized-editor';
316
+
317
+ export declare function parseEditorStateFromJsonText(jsonText: string, pluginRegistry?: ItemTypeRegistry): ParsedSurveySession;
318
+
319
+ export declare type RegistryConflictStrategy = "error" | "override";
320
+
321
+ export declare interface RegistryValidationIssue {
322
+ code: string;
323
+ message: string;
324
+ itemType?: string;
325
+ }
326
+
327
+ export declare type RegistryValidationMode = "editor" | "player";
328
+
329
+ export declare interface RegistryValidationOptions {
330
+ mode: RegistryValidationMode;
331
+ requireBuiltInTypes?: boolean;
332
+ requireRenderer?: boolean;
333
+ }
334
+
335
+ export declare interface RegistryValidationResult {
336
+ errors: RegistryValidationIssue[];
337
+ warnings: RegistryValidationIssue[];
338
+ }
339
+
340
+ declare const SearchMatchType: {
341
+ readonly Content: "content";
342
+ readonly Label: "label";
343
+ readonly Key: "key";
344
+ readonly ItemType: "itemType";
345
+ };
346
+
347
+ declare type SearchMatchType = (typeof SearchMatchType)[keyof typeof SearchMatchType];
348
+
349
+ export declare function serializeSurveyStateForFile(state: SerializedSurveyEditor): string;
350
+
351
+ declare interface SimulatorLocation {
352
+ view: 'simulator';
353
+ }
354
+
355
+ export declare interface SuggestItemKeyRequest {
356
+ draftKey: string;
357
+ currentKey: string;
358
+ siblingKeys: string[];
359
+ childContentHints?: string[];
360
+ maxSuggestions?: number;
361
+ context: SurveyAIContextPack;
362
+ }
363
+
364
+ export declare interface SuggestItemKeyResult {
365
+ suggestions: SuggestItemKeySuggestion[];
366
+ }
367
+
368
+ export declare interface SuggestItemKeySuggestion extends AISuggestedText {
369
+ rationale?: string;
370
+ }
371
+
372
+ export declare interface SuggestItemLabelRequest {
373
+ draftLabel: string;
374
+ itemType: string;
375
+ locale?: string;
376
+ maxSuggestions?: number;
377
+ context: SurveyAIContextPack;
378
+ }
379
+
380
+ export declare interface SuggestItemLabelResult {
381
+ suggestions: SuggestItemLabelSuggestion[];
382
+ }
383
+
384
+ export declare interface SuggestItemLabelSuggestion extends AISuggestedText {
385
+ tone?: string;
386
+ }
387
+
388
+ export { SurveyAIContextIndexes }
389
+
390
+ export { SurveyAIContextPack }
391
+
392
+ export { SurveyAIContextPurpose }
393
+
394
+ export { SurveyAIContextScope }
395
+
396
+ export { SurveyAIFocus }
397
+
398
+ export declare type SurveyAIInvocationMode = "user" | "background";
399
+
400
+ export { SurveyAIItemContextNode }
401
+
402
+ export { SurveyAIKeyIndexEntry }
403
+
404
+ export { SurveyAIOutlineNode }
405
+
406
+ export declare interface SurveyAIRequestOptions {
407
+ signal?: AbortSignal;
408
+ mode?: SurveyAIInvocationMode;
409
+ }
410
+
411
+ export { SurveyAITranslationSnippet }
412
+
413
+ export declare const SurveyEditor: React.FC<SurveyEditorProps>;
414
+
415
+ export declare interface SurveyEditorAIProvider {
416
+ suggestItemKey?: (request: SuggestItemKeyRequest, options?: SurveyAIRequestOptions) => Promise<SuggestItemKeyResult>;
417
+ suggestItemLabel?: (request: SuggestItemLabelRequest, options?: SurveyAIRequestOptions) => Promise<SuggestItemLabelResult>;
418
+ generateItemFromIntent?: (request: GenerateItemFromIntentRequest, options?: SurveyAIRequestOptions) => Promise<GenerateItemFromIntentResult>;
419
+ translateContent?: (request: TranslateContentRequest, options?: SurveyAIRequestOptions) => Promise<TranslateContentResult>;
420
+ }
421
+
422
+ declare type SurveyEditorLocation = ItemEditorLocation | TranslationModeLocation | SimulatorLocation;
423
+
424
+ declare interface SurveyEditorNavigationAdapter {
425
+ getLocation: () => SurveyEditorLocation;
426
+ navigateTo: (location: SurveyEditorLocation, options?: {
427
+ replace?: boolean;
428
+ }) => void;
429
+ subscribe(listener: (location: SurveyEditorLocation) => void): () => void;
430
+ }
431
+
432
+ export declare interface SurveyEditorProps {
433
+ initialEditorState?: SerializedSurveyEditor;
434
+ initialSessionId?: string;
435
+ fallbackLocale?: string;
436
+ itemRegistryEntries?: ItemRegistryEntry[];
437
+ onEditorStateChange?: (change: SurveyEditorStateChange) => void;
438
+ persistDebounceMs?: number;
439
+ helpLink?: string;
440
+ navigationAdapter?: SurveyEditorNavigationAdapter | null;
441
+ aiProvider?: SurveyEditorAIProvider | null;
442
+ onSaveRequested?: () => void;
443
+ }
444
+
445
+ export declare type SurveyEditorStateChange = EditorStateChangePayload;
446
+
447
+ export declare const SurveyPlayer: default_2.FC;
448
+
449
+ /** Participant registry: core + renderer per item type. Lightweight for survey player. */
450
+ declare interface SurveyPlayerItemRegistry {
451
+ coreRegistry: ItemTypeRegistry;
452
+ getRenderer: (itemType: string) => default_2.ComponentType<ItemRendererComponentProps> | undefined;
453
+ }
454
+
455
+ export declare interface TranslateContentEntry {
456
+ id: string;
457
+ text: string;
458
+ kind: string;
459
+ }
460
+
461
+ export declare interface TranslateContentRequest {
462
+ sourceLocale: string;
463
+ targetLocales: string[];
464
+ entries: TranslateContentEntry[];
465
+ context: SurveyAIContextPack;
466
+ }
467
+
468
+ export declare interface TranslateContentResult {
469
+ translations: Record<string, Record<string, string>>;
470
+ }
471
+
472
+ declare interface TranslationModeLocation {
473
+ view: 'translation-mode';
474
+ }
475
+
476
+ export declare function validateRegistryEntries(entries: ItemRegistryEntry[], options: RegistryValidationOptions): RegistryValidationResult;
477
+
478
+ export { }
@@ -0,0 +1,9 @@
1
+ .survey-editor {
2
+ --main-bg-color: oklch(98.5% 0 0);
3
+ --main-bg-dot-color: oklch(85% 0 0);
4
+ --main-bg-dot-grid-size: calc(var(--spacing, 0.25rem) * 5);
5
+
6
+ --footer-bg-color: oklch(37.3% 0.034 259.733);
7
+ --footer-text-color: oklch(98.5% 0 0);
8
+ --footer-height: calc(var(--spacing, 0.25rem) * 6);
9
+ }