@case-framework/survey-editor-ui 0.1.1
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.
- package/README.md +90 -0
- package/dist/item-core-registry.cjs.js +2 -0
- package/dist/item-core-registry.cjs.js.map +1 -0
- package/dist/item-core-registry.es.js +11 -0
- package/dist/item-core-registry.es.js.map +1 -0
- package/dist/src/components/c-ui/alert-provider.d.ts +18 -0
- package/dist/src/components/c-ui/confirm-dialog.d.ts +19 -0
- package/dist/src/components/c-ui/confirm-provider.d.ts +15 -0
- package/dist/src/components/c-ui/dot-background.d.ts +72 -0
- package/dist/src/components/c-ui/filepicker-dropzone.d.ts +38 -0
- package/dist/src/components/c-ui/loading-button.d.ts +9 -0
- package/dist/src/components/common/content-editable-plain.d.ts +17 -0
- package/dist/src/components/common/sortable-tree.d.ts +59 -0
- package/dist/src/components/hooks/use-button-shortcut.d.ts +18 -0
- package/dist/src/components/hooks/use-document-keydown.d.ts +7 -0
- package/dist/src/components/rich-text/content-policy.d.ts +19 -0
- package/dist/src/components/rich-text/index.d.ts +6 -0
- package/dist/src/components/rich-text/nodes/rich-text-image-node.d.ts +40 -0
- package/dist/src/components/rich-text/nodes/rich-text-info-box-node.d.ts +45 -0
- package/dist/src/components/rich-text/nodes/survey-rich-text-heading-node.d.ts +27 -0
- package/dist/src/components/rich-text/rich-text-block-editor.d.ts +8 -0
- package/dist/src/components/rich-text/rich-text-content-view.d.ts +15 -0
- package/dist/src/components/rich-text/rich-text-editor-context.d.ts +23 -0
- package/dist/src/components/rich-text/rich-text-link-utils.d.ts +1 -0
- package/dist/src/components/rich-text/rich-text-survey-content.d.ts +7 -0
- package/dist/src/components/rich-text/types.d.ts +6 -0
- package/dist/src/components/rich-text-editor/index.d.ts +3 -0
- package/dist/src/components/rich-text-editor/plugins/command-handler-plugin.d.ts +5 -0
- package/dist/src/components/rich-text-editor/plugins/editable-mode-plugin.d.ts +3 -0
- package/dist/src/components/rich-text-editor/plugins/floating-toolbar-plugin.d.ts +11 -0
- package/dist/src/components/rich-text-editor/plugins/image-dialog-plugin.d.ts +4 -0
- package/dist/src/components/rich-text-editor/plugins/info-box-popover-plugin.d.ts +6 -0
- package/dist/src/components/rich-text-editor/plugins/link-popover-plugin.d.ts +6 -0
- package/dist/src/components/rich-text-editor/plugins/rich-text-image-asset-deletion-plugin.d.ts +1 -0
- package/dist/src/components/rich-text-editor/plugins/slash-command-menu-plugin.d.ts +15 -0
- package/dist/src/components/rich-text-editor/plugins/sync-editor-value-plugin.d.ts +4 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-utils.d.ts +205 -0
- package/dist/src/components/rich-text-editor/rich-text-editor.d.ts +43 -0
- package/dist/src/components/rich-text-editor/rich-text-image-editor-commands.d.ts +12 -0
- package/dist/src/components/rich-text-editor/rich-text-info-box-commands.d.ts +20 -0
- package/dist/src/components/rich-text-editor/style-control-icon.d.ts +5 -0
- package/dist/src/components/ui/alert-dialog.d.ts +18 -0
- package/dist/src/components/ui/alert.d.ts +10 -0
- package/dist/src/components/ui/badge.d.ts +9 -0
- package/dist/src/components/ui/breadcrumb.d.ts +11 -0
- package/dist/src/components/ui/button.d.ts +10 -0
- package/dist/src/components/ui/calendar.d.ts +10 -0
- package/dist/src/components/ui/card.d.ts +11 -0
- package/dist/src/components/ui/checkbox.d.ts +4 -0
- package/dist/src/components/ui/collapsible.d.ts +5 -0
- package/dist/src/components/ui/command.d.ts +18 -0
- package/dist/src/components/ui/context-menu.d.ts +31 -0
- package/dist/src/components/ui/dialog.d.ts +20 -0
- package/dist/src/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/src/components/ui/field.d.ts +24 -0
- package/dist/src/components/ui/input-group.d.ts +16 -0
- package/dist/src/components/ui/input.d.ts +3 -0
- package/dist/src/components/ui/kbd.d.ts +3 -0
- package/dist/src/components/ui/label.d.ts +4 -0
- package/dist/src/components/ui/popover.d.ts +10 -0
- package/dist/src/components/ui/progress.d.ts +4 -0
- package/dist/src/components/ui/radio-group.d.ts +5 -0
- package/dist/src/components/ui/resizable.d.ts +7 -0
- package/dist/src/components/ui/scroll-area.d.ts +5 -0
- package/dist/src/components/ui/select.d.ts +15 -0
- package/dist/src/components/ui/separator.d.ts +4 -0
- package/dist/src/components/ui/skeleton.d.ts +2 -0
- package/dist/src/components/ui/slider.d.ts +4 -0
- package/dist/src/components/ui/sonner.d.ts +3 -0
- package/dist/src/components/ui/switch.d.ts +6 -0
- package/dist/src/components/ui/tabs.d.ts +11 -0
- package/dist/src/components/ui/textarea.d.ts +3 -0
- package/dist/src/components/ui/toggle-group.d.ts +10 -0
- package/dist/src/components/ui/toggle.d.ts +9 -0
- package/dist/src/components/ui/tooltip.d.ts +7 -0
- package/dist/src/dev/_components/nav-input.d.ts +35 -0
- package/dist/src/dev/app.d.ts +2 -0
- package/dist/src/dev/localizations/de.d.ts +2 -0
- package/dist/src/dev/main.d.ts +0 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/item-core-registry.d.ts +4 -0
- package/dist/src/lib/rich-text-link-url.d.ts +2 -0
- package/dist/src/lib/survey-assets.d.ts +2 -0
- package/dist/src/lib/utils.d.ts +2 -0
- package/dist/src/modules/default-item-registry/default-registry-entries.d.ts +2 -0
- package/dist/src/modules/default-item-registry/index.d.ts +19 -0
- package/dist/src/modules/default-item-registry/item-authoring-state.d.ts +15 -0
- package/dist/src/modules/default-item-registry/items/choice/display-order.d.ts +1 -0
- package/dist/src/modules/default-item-registry/items/choice/editor/card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/choice/editor/option-create.d.ts +11 -0
- package/dist/src/modules/default-item-registry/items/choice/editor/option-edit-dialog.d.ts +21 -0
- package/dist/src/modules/default-item-registry/items/choice/editor/option-editor-fields.d.ts +17 -0
- package/dist/src/modules/default-item-registry/items/choice/editor/response-options-list.d.ts +20 -0
- package/dist/src/modules/default-item-registry/items/choice/expression-registry.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/choice/model.d.ts +28 -0
- package/dist/src/modules/default-item-registry/items/choice/preview/item.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/choice/search-adapter.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/form/editor/card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/form/editor/config-editor.d.ts +12 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-edit-dialog.d.ts +10 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-group-header-dialog.d.ts +12 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-group-layout-dialog.d.ts +9 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-item-preview.d.ts +15 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-key-dialog.d.ts +10 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-sort-dialog.d.ts +11 -0
- package/dist/src/modules/default-item-registry/items/form/editor/field-type-shared.d.ts +12 -0
- package/dist/src/modules/default-item-registry/items/form/editor/response-field-groups-list.d.ts +16 -0
- package/dist/src/modules/default-item-registry/items/form/model.d.ts +161 -0
- package/dist/src/modules/default-item-registry/items/form/preview/item.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/form/search-adapter.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/info/editor-card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/info/preview/item.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/info/search-adapter.d.ts +2 -0
- package/dist/src/modules/default-item-registry/items/structure/group/editor-card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/structure/page-break/editor-card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/structure/preview-renderers.d.ts +3 -0
- package/dist/src/modules/default-item-registry/items/structure/root/editor-card.d.ts +3 -0
- package/dist/src/modules/default-item-registry/shared/preview/question-header.d.ts +6 -0
- package/dist/src/modules/default-item-registry/shared/preview/utils.d.ts +3 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/deferred-localized-rich-text-field.d.ts +26 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/header-editor.d.ts +6 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/layout.d.ts +8 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/rich-text-editors.d.ts +23 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/rich-text-policies.d.ts +8 -0
- package/dist/src/modules/default-item-registry/shared/question-editor/toolbar.d.ts +10 -0
- package/dist/src/modules/survey-editor/ai/create-provider.d.ts +22 -0
- package/dist/src/modules/survey-editor/ai/types.d.ts +11 -0
- package/dist/src/modules/survey-editor/ai/use-survey-assistant-integration.d.ts +18 -0
- package/dist/src/modules/survey-editor/assets/index.d.ts +4 -0
- package/dist/src/modules/survey-editor/assets/survey-image-asset-manager.d.ts +4 -0
- package/dist/src/modules/survey-editor/assets/use-survey-assets.d.ts +4 -0
- package/dist/src/modules/survey-editor/assets/utils.d.ts +5 -0
- package/dist/src/modules/survey-editor/assistant/apply.d.ts +24 -0
- package/dist/src/modules/survey-editor/assistant/index.d.ts +2 -0
- package/dist/src/modules/survey-editor/assistant/snapshot.d.ts +39 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +24 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-target.d.ts +9 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +20 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +21 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/views/back-button.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/views/blank-item-view.d.ts +13 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/views/entry-view.d.ts +15 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +30 -0
- package/dist/src/modules/survey-editor/editor-card/add-items/views/structure-view.d.ts +16 -0
- package/dist/src/modules/survey-editor/editor-card/add-items.d.ts +1 -0
- package/dist/src/modules/survey-editor/editor-card/copy-item-dropdown-menu.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/delete-item-context-menu.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +7 -0
- package/dist/src/modules/survey-editor/editor-card/editor-card-tab-trigger.d.ts +15 -0
- package/dist/src/modules/survey-editor/editor-card/expression-pseudo-code.d.ts +9 -0
- package/dist/src/modules/survey-editor/editor-card/group-items.d.ts +2 -0
- package/dist/src/modules/survey-editor/editor-card/hooks/use-armed-shortcut-sequence.d.ts +11 -0
- package/dist/src/modules/survey-editor/editor-card/hooks/use-group-list-keyboard.d.ts +30 -0
- package/dist/src/modules/survey-editor/editor-card/index.d.ts +2 -0
- package/dist/src/modules/survey-editor/editor-card/item-authoring-state-preview.d.ts +16 -0
- package/dist/src/modules/survey-editor/editor-card/item-color-menu.d.ts +6 -0
- package/dist/src/modules/survey-editor/editor-card/item-color-selector.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/item-editor-card-skeleton.d.ts +2 -0
- package/dist/src/modules/survey-editor/editor-card/item-editor-card.d.ts +34 -0
- package/dist/src/modules/survey-editor/editor-card/item-editor-context.d.ts +23 -0
- package/dist/src/modules/survey-editor/editor-card/item-expression-overview.d.ts +33 -0
- package/dist/src/modules/survey-editor/editor-card/item-key-editor.d.ts +9 -0
- package/dist/src/modules/survey-editor/editor-card/item-label-preview-and-editor.d.ts +10 -0
- package/dist/src/modules/survey-editor/editor-card/item-preview.d.ts +8 -0
- package/dist/src/modules/survey-editor/editor-card/item-sibling-navigation.d.ts +5 -0
- package/dist/src/modules/survey-editor/editor-card/item-type-icon-with-tooltip.d.ts +8 -0
- package/dist/src/modules/survey-editor/editor-card/survey-player-item-preview.d.ts +6 -0
- package/dist/src/modules/survey-editor/editor-instance-provider.d.ts +9 -0
- package/dist/src/modules/survey-editor/hooks/useClipboardValue.d.ts +2 -0
- package/dist/src/modules/survey-editor/hooks/useDeleteItem.d.ts +11 -0
- package/dist/src/modules/survey-editor/hooks/useEditor.d.ts +12 -0
- package/dist/src/modules/survey-editor/hooks/useEditorStateChange.d.ts +18 -0
- package/dist/src/modules/survey-editor/hooks/useKeyboardShortcuts.d.ts +7 -0
- package/dist/src/modules/survey-editor/index.d.ts +20 -0
- package/dist/src/modules/survey-editor/localization/date-fns.d.ts +5 -0
- package/dist/src/modules/survey-editor/localization/default-all.d.ts +2 -0
- package/dist/src/modules/survey-editor/localization/default-en.d.ts +3 -0
- package/dist/src/modules/survey-editor/localization/default-nl.d.ts +2 -0
- package/dist/src/modules/survey-editor/localization/index.d.ts +5 -0
- package/dist/src/modules/survey-editor/localization/runtime.d.ts +4 -0
- package/dist/src/modules/survey-editor/navigation/location.d.ts +6 -0
- package/dist/src/modules/survey-editor/navigation/navigation-provider.d.ts +12 -0
- package/dist/src/modules/survey-editor/navigation/navigation.d.ts +22 -0
- package/dist/src/modules/survey-editor/navigation/types.d.ts +23 -0
- package/dist/src/modules/survey-editor/primitives/input-with-ai-popover.d.ts +35 -0
- package/dist/src/modules/survey-editor/registry/authoring-state.d.ts +17 -0
- package/dist/src/modules/survey-editor/registry/index.d.ts +8 -0
- package/dist/src/modules/survey-editor/registry/registry-mappers.d.ts +25 -0
- package/dist/src/modules/survey-editor/registry/search-adapter.d.ts +19 -0
- package/dist/src/modules/survey-editor/registry/types.d.ts +218 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/assistant-authoring-lock.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot-context.d.ts +6 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +8 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/editor-mode-switch.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/editor-workspace.d.ts +30 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/footer.d.ts +2 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/history-stack.d.ts +2 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/main.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/_components/workspace-presets.d.ts +75 -0
- package/dist/src/modules/survey-editor/routes/editor/asset-manager/index.d.ts +2 -0
- package/dist/src/modules/survey-editor/routes/editor/index.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/breadcrumbs-nav.d.ts +2 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +6 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/language-picker.d.ts +2 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/search-trigger.d.ts +3 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/survey-search.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-outline.d.ts +3 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-workspace.d.ts +12 -0
- package/dist/src/modules/survey-editor/routes/editor/item-editor/index.d.ts +6 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/index.d.ts +7 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/page-break-divider.d.ts +6 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-controls.d.ts +15 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-tree.d.ts +26 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-canvas.d.ts +16 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-item.d.ts +13 -0
- package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts +14 -0
- package/dist/src/modules/survey-editor/routes/editor/translation-mode/index.d.ts +2 -0
- package/dist/src/modules/survey-editor/session-file.d.ts +13 -0
- package/dist/src/modules/survey-editor/store/editor-store-context.d.ts +10 -0
- package/dist/src/modules/survey-editor/store/editor-store-provider.d.ts +7 -0
- package/dist/src/modules/survey-editor/store/editor-store.d.ts +109 -0
- package/dist/src/modules/survey-editor/store/use-editor-store.d.ts +4 -0
- package/dist/src/modules/survey-editor/store/useItemNavigation.d.ts +7 -0
- package/dist/src/modules/survey-editor/survey-editor-config.d.ts +38 -0
- package/dist/src/modules/survey-editor/survey-editor.d.ts +40 -0
- package/dist/src/modules/survey-editor/utils/item-type-infos.d.ts +23 -0
- package/dist/src/modules/survey-editor/workspace.d.ts +17 -0
- package/dist/survey-editor-animations.css +87 -0
- package/dist/survey-editor-animations.css.d.ts +2 -0
- package/dist/survey-editor-defaults.css +15 -0
- package/dist/survey-editor-defaults.css.d.ts +2 -0
- package/dist/survey-editor-ui.cjs.js +161 -0
- package/dist/survey-editor-ui.cjs.js.map +1 -0
- package/dist/survey-editor-ui.css +3 -0
- package/dist/survey-editor-ui.css.d.ts +2 -0
- package/dist/survey-editor-ui.es.js +50260 -0
- package/dist/survey-editor-ui.es.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @case-framework/survey-editor-ui
|
|
2
|
+
|
|
3
|
+
Authoring UI for CASE surveys, including the `SurveyEditor`. Participant-facing
|
|
4
|
+
rendering is provided by the package dependency `@case-framework/survey-ui`.
|
|
5
|
+
|
|
6
|
+
For repository development and custom item registration, see
|
|
7
|
+
[Custom survey items](https://github.com/case-framework/case-survey-toolkit/blob/main/packages/survey-editor-ui/docs/custom-items.md).
|
|
8
|
+
|
|
9
|
+
## SurveyEditor styling in a host project
|
|
10
|
+
|
|
11
|
+
### Tailwind CSS v4 / shadcn host
|
|
12
|
+
|
|
13
|
+
Do not import the complete `@case-framework/survey-ui/css` or
|
|
14
|
+
`@case-framework/survey-editor-ui/css` assets in a standard shadcn application.
|
|
15
|
+
Those generated stylesheets contain their own Tailwind base layer and global
|
|
16
|
+
theme variables, which can collide with the host's Preflight, `:root`, `.dark`,
|
|
17
|
+
and semantic tokens.
|
|
18
|
+
|
|
19
|
+
Register both packages in the host's existing global stylesheet instead:
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
@import "tailwindcss";
|
|
23
|
+
@import "tw-animate-css";
|
|
24
|
+
@import "shadcn/tailwind.css";
|
|
25
|
+
|
|
26
|
+
@source "../node_modules/@case-framework/survey-ui/dist";
|
|
27
|
+
@source "../node_modules/@case-framework/survey-editor-ui/dist";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The paths are relative to the stylesheet containing `@source`; adjust them for
|
|
31
|
+
the host's directory layout. Both sources are necessary because the editor
|
|
32
|
+
contains participant previews implemented by `@case-framework/survey-ui`.
|
|
33
|
+
|
|
34
|
+
Import only the editor-specific, namespaced additions once in the application
|
|
35
|
+
entry point:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import "@case-framework/survey-editor-ui/editor-defaults.css";
|
|
39
|
+
import "@case-framework/survey-editor-ui/editor-animations.css";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
These assets use `survey-editor-*` selectors and `.survey-editor`-scoped
|
|
43
|
+
variables. They do not define the host's global shadcn theme.
|
|
44
|
+
|
|
45
|
+
Override the editor-specific CSS variables on the `.survey-editor` scope in the host stylesheet:
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
.survey-editor {
|
|
49
|
+
--surface-bg-color: oklch(1 0 0);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Available editor-scoped variables:
|
|
54
|
+
|
|
55
|
+
- `--surface-bg-color`
|
|
56
|
+
|
|
57
|
+
The editor uses the host's shared shadcn theme tokens, including `--background`,
|
|
58
|
+
`--foreground`, `--card`, `--primary`, `--muted`, `--accent`, `--border`,
|
|
59
|
+
`--input`, and `--ring`. Set those in the host theme as usual to make the editor
|
|
60
|
+
chrome match the application.
|
|
61
|
+
|
|
62
|
+
### Standalone/non-Tailwind host
|
|
63
|
+
|
|
64
|
+
The complete precompiled assets remain available:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import "@case-framework/survey-ui/css";
|
|
68
|
+
import "@case-framework/survey-editor-ui/css";
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
They are application-level stylesheets, not isolated component styles. Import
|
|
72
|
+
each only once. They currently include global theme and base rules, so review
|
|
73
|
+
their cascade before combining them with another CSS framework or design
|
|
74
|
+
system.
|
|
75
|
+
|
|
76
|
+
## Sources
|
|
77
|
+
|
|
78
|
+
- [Tailwind: detecting classes in source files](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources)
|
|
79
|
+
documents `@source` for external component libraries and explains why
|
|
80
|
+
dependencies are not scanned automatically.
|
|
81
|
+
- [Tailwind: Preflight](https://tailwindcss.com/docs/preflight) documents the
|
|
82
|
+
global base styles included by `@import "tailwindcss"`.
|
|
83
|
+
- [shadcn: theming](https://ui.shadcn.com/docs/theming) recommends application-owned
|
|
84
|
+
semantic CSS variables.
|
|
85
|
+
- [shadcn: Tailwind v4](https://ui.shadcn.com/docs/tailwind-v4) documents the
|
|
86
|
+
`@theme inline`, `:root`, and `.dark` arrangement used by shadcn hosts.
|
|
87
|
+
- [shadcn: monorepo](https://ui.shadcn.com/docs/monorepo) demonstrates that the
|
|
88
|
+
shared UI stylesheet and theme configuration belong to the consuming
|
|
89
|
+
workspace rather than being independently repeated by every component
|
|
90
|
+
package.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./survey-editor-ui.cjs.js`);let e=require(`@case-framework/survey-ui`);var t={choiceItem:e.ChoiceItemCore,formItem:e.FormItemCore,infoItem:e.InfoItemCore};exports.ChoiceItemCore=e.ChoiceItemCore,exports.FormItemCore=e.FormItemCore,exports.InfoItemCore=e.InfoItemCore,exports.defaultItemCoreRegistry=t;
|
|
2
|
+
//# sourceMappingURL=item-core-registry.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-core-registry.cjs.js","names":[],"sources":["../src/item-core-registry.ts"],"sourcesContent":["import type { ItemTypeRegistry } from \"@case-framework/survey-core\";\nimport { ChoiceItemCore, FormItemCore, InfoItemCore } from \"@case-framework/survey-ui\";\n\nexport const defaultItemCoreRegistry: ItemTypeRegistry = {\n choiceItem: ChoiceItemCore,\n formItem: FormItemCore,\n infoItem: InfoItemCore,\n};\n\nexport { ChoiceItemCore, FormItemCore, InfoItemCore };\n"],"mappings":"mJAGA,IAAa,EAA4C,CACvD,WAAY,EAAA,eACZ,SAAU,EAAA,aACV,SAAU,EAAA,aACX"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChoiceItemCore as e, FormItemCore as t, InfoItemCore as n } from "@case-framework/survey-ui";
|
|
2
|
+
//#region src/item-core-registry.ts
|
|
3
|
+
var r = {
|
|
4
|
+
choiceItem: e,
|
|
5
|
+
formItem: t,
|
|
6
|
+
infoItem: n
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as ChoiceItemCore, t as FormItemCore, n as InfoItemCore, r as defaultItemCoreRegistry };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=item-core-registry.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-core-registry.es.js","names":[],"sources":["../src/item-core-registry.ts"],"sourcesContent":["import type { ItemTypeRegistry } from \"@case-framework/survey-core\";\nimport { ChoiceItemCore, FormItemCore, InfoItemCore } from \"@case-framework/survey-ui\";\n\nexport const defaultItemCoreRegistry: ItemTypeRegistry = {\n choiceItem: ChoiceItemCore,\n formItem: FormItemCore,\n infoItem: InfoItemCore,\n};\n\nexport { ChoiceItemCore, FormItemCore, InfoItemCore };\n"],"mappings":";;AAGA,IAAa,IAA4C;CACvD,YAAY;CACZ,UAAU;CACV,UAAU;CACX"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { AlertDialogCancel } from '../../../components/ui/alert-dialog';
|
|
3
|
+
export interface AlertOptions {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
dismissButtonClassName?: string;
|
|
8
|
+
dismissButtonVariant?: ComponentProps<typeof AlertDialogCancel>["variant"];
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface AlertApi {
|
|
12
|
+
(options: AlertOptions): Promise<void>;
|
|
13
|
+
dismiss: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const AlertDialogProvider: ({ children }: {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const useAlert: () => AlertApi;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RequireConfirmationInput {
|
|
2
|
+
confirmTerm: string;
|
|
3
|
+
/** Custom label with {{confirmTerm}} placeholder for the required term (bold). Default: "Type {{confirmTerm}} to confirm" */
|
|
4
|
+
label?: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ConfirmDialogProps {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
confirmButtonText: string;
|
|
11
|
+
cancelButtonText: string;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
variant: "default" | "destructive";
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
requireConfirmationInput?: RequireConfirmationInput;
|
|
17
|
+
}
|
|
18
|
+
declare const ConfirmDialog: (props: ConfirmDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default ConfirmDialog;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RequireConfirmationInput } from './confirm-dialog';
|
|
3
|
+
export type { RequireConfirmationInput };
|
|
4
|
+
interface ConfirmOptions {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
confirmButtonText?: string;
|
|
8
|
+
cancelButtonText?: string;
|
|
9
|
+
variant?: "default" | "destructive";
|
|
10
|
+
requireConfirmationInput?: RequireConfirmationInput;
|
|
11
|
+
}
|
|
12
|
+
export declare const ConfirmDialogProvider: ({ children }: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const useConfirm: () => (options: ConfirmOptions) => Promise<boolean>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const dotBackgroundColorVariants: {
|
|
3
|
+
readonly default: {
|
|
4
|
+
readonly backgroundColor: "var(--background)";
|
|
5
|
+
readonly dotColor: "var(--border)";
|
|
6
|
+
};
|
|
7
|
+
readonly muted: {
|
|
8
|
+
readonly backgroundColor: "var(--muted)";
|
|
9
|
+
readonly dotColor: "color-mix(in oklab, var(--muted-foreground) 24%, transparent)";
|
|
10
|
+
};
|
|
11
|
+
readonly card: {
|
|
12
|
+
readonly backgroundColor: "var(--card)";
|
|
13
|
+
readonly dotColor: "color-mix(in oklab, var(--border) 90%, transparent)";
|
|
14
|
+
};
|
|
15
|
+
readonly accent: {
|
|
16
|
+
readonly backgroundColor: "var(--accent)";
|
|
17
|
+
readonly dotColor: "color-mix(in oklab, var(--accent-foreground) 18%, transparent)";
|
|
18
|
+
};
|
|
19
|
+
readonly secondary: {
|
|
20
|
+
readonly backgroundColor: "var(--secondary)";
|
|
21
|
+
readonly dotColor: "color-mix(in oklab, var(--secondary-foreground) 16%, transparent)";
|
|
22
|
+
};
|
|
23
|
+
readonly custom: {
|
|
24
|
+
readonly backgroundColor: "var(--background)";
|
|
25
|
+
readonly dotColor: "var(--border)";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
declare const dotBackgroundSpacingVariants: {
|
|
29
|
+
readonly dense: {
|
|
30
|
+
readonly spacing: "0.875rem";
|
|
31
|
+
};
|
|
32
|
+
readonly default: {
|
|
33
|
+
readonly spacing: "1.25rem";
|
|
34
|
+
};
|
|
35
|
+
readonly relaxed: {
|
|
36
|
+
readonly spacing: "1.75rem";
|
|
37
|
+
};
|
|
38
|
+
readonly loose: {
|
|
39
|
+
readonly spacing: "2.25rem";
|
|
40
|
+
};
|
|
41
|
+
readonly custom: {
|
|
42
|
+
readonly spacing: "1.25rem";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
type DotBackgroundVariant = keyof typeof dotBackgroundColorVariants;
|
|
46
|
+
type DotBackgroundSpacingVariant = keyof typeof dotBackgroundSpacingVariants;
|
|
47
|
+
declare const dotBackgroundVariants: (props?: ({
|
|
48
|
+
variant?: "default" | "secondary" | "accent" | "muted" | "card" | "custom" | null | undefined;
|
|
49
|
+
spacing?: "default" | "dense" | "loose" | "custom" | "relaxed" | null | undefined;
|
|
50
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
51
|
+
type DotBackgroundStyle = React.CSSProperties & {
|
|
52
|
+
"--dot-background-color"?: string;
|
|
53
|
+
"--dot-background-dot-color"?: string;
|
|
54
|
+
"--dot-background-spacing"?: string;
|
|
55
|
+
"--dot-background-dot-size"?: string;
|
|
56
|
+
};
|
|
57
|
+
type DotBackgroundVars = {
|
|
58
|
+
backgroundColor?: string;
|
|
59
|
+
dotColor?: string;
|
|
60
|
+
spacing?: number | string;
|
|
61
|
+
dotSize?: number | string;
|
|
62
|
+
};
|
|
63
|
+
type DotBackgroundProps = Omit<React.ComponentProps<"div">, "style"> & {
|
|
64
|
+
asChild?: boolean;
|
|
65
|
+
variant?: DotBackgroundVariant;
|
|
66
|
+
spacing?: DotBackgroundSpacingVariant;
|
|
67
|
+
vars?: DotBackgroundVars;
|
|
68
|
+
style?: DotBackgroundStyle;
|
|
69
|
+
};
|
|
70
|
+
declare function DotBackground({ asChild, variant, spacing, vars, className, style, ...props }: DotBackgroundProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
export { DotBackground, dotBackgroundColorVariants, dotBackgroundSpacingVariants, dotBackgroundVariants, };
|
|
72
|
+
export type { DotBackgroundProps, DotBackgroundSpacingVariant, DotBackgroundStyle, DotBackgroundVariant, DotBackgroundVars, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Accept, FileRejection, FileWithPath } from 'react-dropzone';
|
|
2
|
+
import { Field } from '../../../components/ui/field';
|
|
3
|
+
export interface FilepickerDropzoneLabels {
|
|
4
|
+
upload: string;
|
|
5
|
+
drag: string;
|
|
6
|
+
active: string;
|
|
7
|
+
reject: string;
|
|
8
|
+
rejectInvalidType: string;
|
|
9
|
+
rejectTooLarge: string;
|
|
10
|
+
rejectTooSmall: string;
|
|
11
|
+
rejectTooMany: string;
|
|
12
|
+
selectedCount: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FilepickerDropzoneProps extends Omit<React.ComponentProps<typeof Field>, "children" | "onChange"> {
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
error?: React.ReactNode;
|
|
20
|
+
accept?: Accept;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
maxFiles?: number;
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
minSize?: number;
|
|
27
|
+
icon?: React.ReactNode;
|
|
28
|
+
labelClassName?: string;
|
|
29
|
+
contentClassName?: string;
|
|
30
|
+
descriptionClassName?: string;
|
|
31
|
+
errorClassName?: string;
|
|
32
|
+
dropzoneClassName?: string;
|
|
33
|
+
labels?: Partial<FilepickerDropzoneLabels>;
|
|
34
|
+
onChange?: (files: readonly FileWithPath[]) => void;
|
|
35
|
+
onDropRejected?: (fileRejections: FileRejection[]) => void;
|
|
36
|
+
}
|
|
37
|
+
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): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export { FilepickerDropzone };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { buttonVariants } from '../../../components/ui/button';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
type LoadingButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const LoadingButton: React.ForwardRefExoticComponent<Omit<LoadingButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export { LoadingButton };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
export interface ContentEditablePlainProps {
|
|
3
|
+
id: string;
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
onChange: (next: string) => void;
|
|
9
|
+
onFocus?: () => void;
|
|
10
|
+
onBlur?: () => void;
|
|
11
|
+
onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Plain-text contenteditable: line breaks allowed, paste stripped to text only.
|
|
15
|
+
* Syncs `value` from props only while unfocused to avoid clobbering the caret.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ContentEditablePlain({ id, value, placeholder, className, "aria-label": ariaLabel, onChange, onFocus, onBlur, onKeyDown, }: ContentEditablePlainProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SortableTreePosition {
|
|
3
|
+
parentId: string;
|
|
4
|
+
index: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SortableTreeMoveEvent<T> {
|
|
7
|
+
id: string;
|
|
8
|
+
item: T;
|
|
9
|
+
from: SortableTreePosition;
|
|
10
|
+
to: SortableTreePosition;
|
|
11
|
+
}
|
|
12
|
+
export interface SortableTreeDropEvent<T> extends SortableTreeMoveEvent<T> {
|
|
13
|
+
parent: T | null;
|
|
14
|
+
}
|
|
15
|
+
export type SortableTreeDropPosition = "before" | "inside" | "after";
|
|
16
|
+
export interface SortableTreeRenderItemProps<T> {
|
|
17
|
+
item: T;
|
|
18
|
+
id: string;
|
|
19
|
+
parentId: string;
|
|
20
|
+
index: number;
|
|
21
|
+
depth: number;
|
|
22
|
+
indent: number;
|
|
23
|
+
isBranch: boolean;
|
|
24
|
+
isExpanded: boolean;
|
|
25
|
+
isDragging: boolean;
|
|
26
|
+
isDropTarget: boolean;
|
|
27
|
+
isDropParent: boolean;
|
|
28
|
+
dropPosition: SortableTreeDropPosition | null;
|
|
29
|
+
dropDepth: number | null;
|
|
30
|
+
isOverlay: boolean;
|
|
31
|
+
dragHandleRef: (element: Element | null) => void;
|
|
32
|
+
toggleExpanded: () => void;
|
|
33
|
+
}
|
|
34
|
+
export interface SortableTreeEmptyGroupProps<T> {
|
|
35
|
+
parent: T | null;
|
|
36
|
+
parentId: string;
|
|
37
|
+
depth: number;
|
|
38
|
+
indent: number;
|
|
39
|
+
}
|
|
40
|
+
export interface SortableTreeProps<T> {
|
|
41
|
+
items: readonly T[];
|
|
42
|
+
rootId: string;
|
|
43
|
+
getId: (item: T) => string;
|
|
44
|
+
getChildren: (item: T) => readonly T[];
|
|
45
|
+
renderItem: (props: SortableTreeRenderItemProps<T>) => ReactNode;
|
|
46
|
+
onMove: (event: SortableTreeMoveEvent<T>) => void;
|
|
47
|
+
isBranch?: (item: T) => boolean;
|
|
48
|
+
canDrag?: (item: T) => boolean;
|
|
49
|
+
canDrop?: (event: SortableTreeDropEvent<T>) => boolean;
|
|
50
|
+
expandedIds?: ReadonlySet<string>;
|
|
51
|
+
defaultExpandedIds?: Iterable<string>;
|
|
52
|
+
onExpandedChange?: (id: string, expanded: boolean) => void;
|
|
53
|
+
renderEmptyGroup?: (props: SortableTreeEmptyGroupProps<T>) => ReactNode;
|
|
54
|
+
ariaLabel?: string;
|
|
55
|
+
indent?: number;
|
|
56
|
+
className?: string;
|
|
57
|
+
levelClassName?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function SortableTree<T>({ items, rootId, getId, getChildren, renderItem, onMove, isBranch, canDrag, canDrop, expandedIds, defaultExpandedIds, onExpandedChange, renderEmptyGroup, ariaLabel, indent, className, levelClassName, }: SortableTreeProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ButtonShortcutDefinition {
|
|
2
|
+
key: string;
|
|
3
|
+
modKey?: boolean;
|
|
4
|
+
metaKey?: boolean;
|
|
5
|
+
ctrlKey?: boolean;
|
|
6
|
+
shiftKey?: boolean;
|
|
7
|
+
altKey?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface UseButtonShortcutOptions {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
activeDurationMs?: number;
|
|
12
|
+
preventDefault?: boolean;
|
|
13
|
+
ignoreEditableTargets?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const useButtonShortcut: (ref: React.RefObject<HTMLButtonElement | null>, shortcut: ButtonShortcutDefinition, { enabled, activeDurationMs, preventDefault, ignoreEditableTargets, }?: UseButtonShortcutOptions) => {
|
|
16
|
+
isShortcutActive: boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const isEditableKeyboardTarget: (target: EventTarget | null) => boolean;
|
|
2
|
+
interface UseDocumentKeydownOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
ignoreEditableTargets?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const useDocumentKeydown: (onKeyDown: (event: KeyboardEvent) => void, { enabled, ignoreEditableTargets }?: UseDocumentKeydownOptions) => void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Content, RichTextStyle } from '@case-framework/survey-core';
|
|
2
|
+
export type RichTextEditorVariant = "compact" | "block";
|
|
3
|
+
export type RichTextSupportedBlockType = "paragraph" | "bulletList" | "image" | "separator" | "heading" | "infoBox";
|
|
4
|
+
export type RichTextStyleAttribute = keyof RichTextStyle;
|
|
5
|
+
export interface RichTextContentPolicy {
|
|
6
|
+
variant?: RichTextEditorVariant;
|
|
7
|
+
allowedBlockTypes?: Partial<Record<RichTextSupportedBlockType, boolean>>;
|
|
8
|
+
allowedStyleAttributes?: Partial<Record<RichTextStyleAttribute, boolean>>;
|
|
9
|
+
allowLinks?: boolean;
|
|
10
|
+
allowTemplateVariables?: boolean;
|
|
11
|
+
allowLineBreaks?: boolean;
|
|
12
|
+
/** When true, paragraph/heading/list-paragraph alignment may be edited and persisted. */
|
|
13
|
+
allowBlockAlignment?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_COMPACT_CONTENT_POLICY: RichTextContentPolicy;
|
|
16
|
+
export declare const DEFAULT_BLOCK_CONTENT_POLICY: RichTextContentPolicy;
|
|
17
|
+
export declare function mergeRichTextContentPolicy(base: RichTextContentPolicy, override?: RichTextContentPolicy): RichTextContentPolicy;
|
|
18
|
+
export declare function sanitizeContentForPolicy(content: Content | undefined, policy?: RichTextContentPolicy): Content | undefined;
|
|
19
|
+
export declare function isBlockContentPolicyVariant(policy?: RichTextContentPolicy): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { RichTextBlockEditor, type RichTextBlockEditorChange, type RichTextBlockEditorProps, } from './rich-text-block-editor';
|
|
2
|
+
export { RichTextContentView, type RichTextContentViewProps } from './rich-text-content-view';
|
|
3
|
+
export { createRichTextEditorValueFromContent, createRichTextEditorValueFromText, getRichTextContentFromEditorState, writeContentToEditor, } from './rich-text-survey-content';
|
|
4
|
+
export type { RichTextImageAssetOption } from './types';
|
|
5
|
+
export { DEFAULT_BLOCK_CONTENT_POLICY, DEFAULT_COMPACT_CONTENT_POLICY, isBlockContentPolicyVariant, mergeRichTextContentPolicy, sanitizeContentForPolicy, } from './content-policy';
|
|
6
|
+
export type { RichTextContentPolicy, RichTextEditorVariant, RichTextStyleAttribute, RichTextSupportedBlockType, } from './content-policy';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RichTextImageSize, SurveyContentImageSource } from '@case-framework/survey-core';
|
|
2
|
+
import { DecoratorBlockNode, SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
|
|
3
|
+
import { ElementFormatType, LexicalNode, LexicalUpdateJSON, NodeKey, Spread } from 'lexical';
|
|
4
|
+
import { JSX } from 'react';
|
|
5
|
+
export type SerializedRichTextImageNode = Spread<{
|
|
6
|
+
source: SurveyContentImageSource;
|
|
7
|
+
alt?: string;
|
|
8
|
+
caption?: string;
|
|
9
|
+
size?: RichTextImageSize;
|
|
10
|
+
}, SerializedDecoratorBlockNode>;
|
|
11
|
+
export declare class RichTextImageNode extends DecoratorBlockNode {
|
|
12
|
+
__source: SurveyContentImageSource;
|
|
13
|
+
__alt?: string;
|
|
14
|
+
__caption: string;
|
|
15
|
+
__size?: RichTextImageSize;
|
|
16
|
+
static getType(): string;
|
|
17
|
+
static clone(node: RichTextImageNode): RichTextImageNode;
|
|
18
|
+
static importJSON(serializedNode: SerializedRichTextImageNode): RichTextImageNode;
|
|
19
|
+
constructor(source: SurveyContentImageSource, alt?: string, size?: RichTextImageSize, caption?: string, format?: SerializedDecoratorBlockNode["format"], key?: NodeKey);
|
|
20
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedRichTextImageNode>): this;
|
|
21
|
+
exportJSON(): SerializedRichTextImageNode;
|
|
22
|
+
getSource(): SurveyContentImageSource;
|
|
23
|
+
getAlt(): string | undefined;
|
|
24
|
+
getCaption(): string;
|
|
25
|
+
getSize(): RichTextImageSize | undefined;
|
|
26
|
+
setSource(source: SurveyContentImageSource): this;
|
|
27
|
+
setAlt(alt: string | undefined): this;
|
|
28
|
+
setCaption(caption: string): this;
|
|
29
|
+
setSize(size: RichTextImageSize | undefined): this;
|
|
30
|
+
decorate(): JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
export declare function $createRichTextImageNode({ source, alt, size, caption, format, key, }: {
|
|
33
|
+
source: SurveyContentImageSource;
|
|
34
|
+
alt?: string;
|
|
35
|
+
size?: RichTextImageSize;
|
|
36
|
+
caption?: string;
|
|
37
|
+
format?: ElementFormatType;
|
|
38
|
+
key?: NodeKey;
|
|
39
|
+
}): RichTextImageNode;
|
|
40
|
+
export declare function $isRichTextImageNode(node: LexicalNode | null | undefined): node is RichTextImageNode;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { RichTextInfoBoxBlock } from '@case-framework/survey-core';
|
|
2
|
+
import { DecoratorBlockNode, SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
|
|
3
|
+
import { LexicalNode, LexicalUpdateJSON, NodeKey, Spread } from 'lexical';
|
|
4
|
+
import { JSX } from 'react';
|
|
5
|
+
export type RichTextInfoBoxTone = NonNullable<RichTextInfoBoxBlock["tone"]>;
|
|
6
|
+
export type SerializedRichTextInfoBoxNode = Spread<{
|
|
7
|
+
tone: RichTextInfoBoxTone;
|
|
8
|
+
title: string;
|
|
9
|
+
content: string;
|
|
10
|
+
collapsible: boolean;
|
|
11
|
+
defaultOpen: boolean;
|
|
12
|
+
}, SerializedDecoratorBlockNode>;
|
|
13
|
+
export declare class RichTextInfoBoxNode extends DecoratorBlockNode {
|
|
14
|
+
__tone: RichTextInfoBoxTone;
|
|
15
|
+
__title: string;
|
|
16
|
+
__content: string;
|
|
17
|
+
__collapsible: boolean;
|
|
18
|
+
__defaultOpen: boolean;
|
|
19
|
+
static getType(): string;
|
|
20
|
+
static clone(node: RichTextInfoBoxNode): RichTextInfoBoxNode;
|
|
21
|
+
static importJSON(serializedNode: SerializedRichTextInfoBoxNode): RichTextInfoBoxNode;
|
|
22
|
+
constructor(tone: RichTextInfoBoxTone, title: string, content: string, collapsible: boolean, defaultOpen: boolean, key?: NodeKey);
|
|
23
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedRichTextInfoBoxNode>): this;
|
|
24
|
+
exportJSON(): SerializedRichTextInfoBoxNode;
|
|
25
|
+
getTone(): RichTextInfoBoxTone;
|
|
26
|
+
setTone(tone: RichTextInfoBoxTone): void;
|
|
27
|
+
getTitle(): string;
|
|
28
|
+
setTitle(title: string): void;
|
|
29
|
+
getContent(): string;
|
|
30
|
+
setContent(content: string): void;
|
|
31
|
+
getCollapsible(): boolean;
|
|
32
|
+
setCollapsible(collapsible: boolean): void;
|
|
33
|
+
getDefaultOpen(): boolean;
|
|
34
|
+
setDefaultOpen(defaultOpen: boolean): void;
|
|
35
|
+
decorate(): JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
export declare function $createRichTextInfoBoxNode({ tone, title, content, collapsible, defaultOpen, key, }: {
|
|
38
|
+
tone?: RichTextInfoBoxTone;
|
|
39
|
+
title?: string;
|
|
40
|
+
content?: string;
|
|
41
|
+
collapsible?: boolean;
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
key?: NodeKey;
|
|
44
|
+
}): RichTextInfoBoxNode;
|
|
45
|
+
export declare function $isRichTextInfoBoxNode(node: LexicalNode | null | undefined): node is RichTextInfoBoxNode;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RichTextHeadingBlock } from '@case-framework/survey-core';
|
|
2
|
+
import { ParagraphNode, DOMConversionMap, EditorConfig, LexicalEditor, LexicalNode, RangeSelection, SerializedParagraphNode, Spread } from 'lexical';
|
|
3
|
+
export type SerializedSurveyRichTextHeadingNode = Spread<{
|
|
4
|
+
level: RichTextHeadingBlock["level"];
|
|
5
|
+
}, SerializedParagraphNode>;
|
|
6
|
+
/** Block editor node for survey rich-text headings; serializes to core `heading` blocks. */
|
|
7
|
+
export declare class SurveyRichTextHeadingNode extends ParagraphNode {
|
|
8
|
+
/** @internal */
|
|
9
|
+
__level: RichTextHeadingBlock["level"];
|
|
10
|
+
static getType(): string;
|
|
11
|
+
static clone(node: SurveyRichTextHeadingNode): SurveyRichTextHeadingNode;
|
|
12
|
+
constructor(level?: RichTextHeadingBlock["level"], key?: string);
|
|
13
|
+
getHeadingLevel(): RichTextHeadingBlock["level"];
|
|
14
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
15
|
+
updateDOM(prevNode: SurveyRichTextHeadingNode): boolean;
|
|
16
|
+
static importDOM(): DOMConversionMap | null;
|
|
17
|
+
exportDOM(editor: LexicalEditor): {
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
static importJSON(serializedNode: SerializedSurveyRichTextHeadingNode): SurveyRichTextHeadingNode;
|
|
21
|
+
exportJSON(): SerializedSurveyRichTextHeadingNode;
|
|
22
|
+
/** Backspace at block start: replace heading with a paragraph (same children and block styles). */
|
|
23
|
+
collapseAtStart(): boolean;
|
|
24
|
+
insertNewAfter(rangeSelection: RangeSelection, restoreSelection?: boolean): ParagraphNode;
|
|
25
|
+
}
|
|
26
|
+
export declare function $createSurveyRichTextHeadingNode(level?: RichTextHeadingBlock["level"]): SurveyRichTextHeadingNode;
|
|
27
|
+
export declare function $isSurveyRichTextHeadingNode(node: LexicalNode | null | undefined): node is SurveyRichTextHeadingNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RichTextEditorChange, RichTextEditorProps } from '../rich-text-editor/rich-text-editor';
|
|
2
|
+
import { RichTextImageAssetOption } from './types';
|
|
3
|
+
export type RichTextBlockEditorChange = RichTextEditorChange;
|
|
4
|
+
export interface RichTextBlockEditorProps extends RichTextEditorProps {
|
|
5
|
+
resolveImageAssetUrl?: (assetId: string) => string | undefined;
|
|
6
|
+
imageAssets?: RichTextImageAssetOption[];
|
|
7
|
+
}
|
|
8
|
+
export declare function RichTextBlockEditor({ wrapperClassName, surfaceClassName, contentClassName, placeholderClassName, ...props }: RichTextBlockEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Content, RichTextHeadingBlock } from '@case-framework/survey-core';
|
|
2
|
+
export interface RichTextContentViewProps {
|
|
3
|
+
content?: Content;
|
|
4
|
+
className?: string;
|
|
5
|
+
paragraphClassName?: string;
|
|
6
|
+
resolveImageAssetUrl?: (assetId: string) => string | undefined;
|
|
7
|
+
singleLine?: boolean;
|
|
8
|
+
/** Rendered at each line break when `singleLine` is true. */
|
|
9
|
+
singleLineNewlineIndicator?: string;
|
|
10
|
+
/** Minimum semantic heading level to render. Use this to avoid nested rich text creating page-level h1s. */
|
|
11
|
+
minHeadingLevel?: RichTextHeadingBlock["level"];
|
|
12
|
+
/** Semantic level offset applied before clamping. For example, 1 renders stored h1/h2 as h2/h3. */
|
|
13
|
+
headingLevelOffset?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function RichTextContentView({ content, className, paragraphClassName, resolveImageAssetUrl, singleLine, singleLineNewlineIndicator, minHeadingLevel, headingLevelOffset, }: RichTextContentViewProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RichTextContentPolicy } from './content-policy';
|
|
2
|
+
import { RichTextImageAssetOption } from './types';
|
|
3
|
+
export interface RichTextImageAssetDeletionHandlers {
|
|
4
|
+
/** Total references to this asset across the survey (from committed content), per `Survey.getAssetUsages`. */
|
|
5
|
+
getUsageCount(assetId: string): number;
|
|
6
|
+
removeAsset(assetId: string): void;
|
|
7
|
+
}
|
|
8
|
+
interface RichTextEditorContextValue {
|
|
9
|
+
editorVariant: "compact" | "block";
|
|
10
|
+
contentPolicy?: RichTextContentPolicy;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
resolveImageAssetUrl?: (assetId: string) => string | undefined;
|
|
13
|
+
imageAssets?: RichTextImageAssetOption[];
|
|
14
|
+
registerImageAsset?: (file: File) => Promise<string>;
|
|
15
|
+
/** When set, removing a local image with a single survey-wide reference can prompt to delete the embedded asset. */
|
|
16
|
+
imageAssetDeletion?: RichTextImageAssetDeletionHandlers;
|
|
17
|
+
}
|
|
18
|
+
export declare function RichTextEditorContextProvider({ value, children, }: {
|
|
19
|
+
value: RichTextEditorContextValue;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function useRichTextEditorContext(): RichTextEditorContextValue;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_RICH_TEXT_LINK_URL, sanitizeRichTextLinkUrl } from '../../../lib/rich-text-link-url';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Content, RichTextContent } from '@case-framework/survey-core';
|
|
2
|
+
import { EditorState, SerializedEditorState } from 'lexical';
|
|
3
|
+
import { RichTextContentPolicy } from './content-policy';
|
|
4
|
+
export declare function writeContentToEditor(content?: Content, policy?: RichTextContentPolicy): void;
|
|
5
|
+
export declare function getRichTextContentFromEditorState(editorState: EditorState, policy?: RichTextContentPolicy): RichTextContent;
|
|
6
|
+
export declare function createRichTextEditorValueFromContent(content?: Content, policy?: RichTextContentPolicy): SerializedEditorState;
|
|
7
|
+
export declare function createRichTextEditorValueFromText(text?: string, policy?: RichTextContentPolicy): SerializedEditorState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { RichTextEditor, type RichTextEditorChange, type RichTextEditorProps, } from './rich-text-editor';
|
|
2
|
+
export { APPLY_RICH_TEXT_STYLE_COMMAND, CONVERT_RICH_TEXT_LINK_TO_TEXT_COMMAND, INSERT_RICH_TEXT_LINK_COMMAND, INSERT_RICH_TEXT_TEMPLATE_VARIABLE_COMMAND, RichTextLinkNode, OPEN_RICH_TEXT_LINK_EDITOR_COMMAND, TemplateVariableNode, UPDATE_RICH_TEXT_LINK_COMMAND, createRichTextEditorValueFromPlainText, } from './rich-text-editor-utils';
|
|
3
|
+
export type { RichTextLinkPayload, RichTextStyleControl, RichTextTemplateVariable, SerializedRichTextLinkNode, SerializedTemplateVariableNode, } from './rich-text-editor-utils';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface CommandHandlerPluginProps {
|
|
2
|
+
/** When true, registers Lexical's horizontal rule insert command (block editor only). */
|
|
3
|
+
horizontalRuleCommandEnabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function CommandHandlerPlugin({ horizontalRuleCommandEnabled, }: CommandHandlerPluginProps): null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { RichTextStyleControl, RichTextTemplateVariable } from '../rich-text-editor-utils';
|
|
3
|
+
export declare function FloatingToolbarPlugin({ editable, linksEnabled, blockAlignmentEnabled, surfaceRef, toolbarClassName, styleControls, templateVariables, }: {
|
|
4
|
+
editable: boolean;
|
|
5
|
+
linksEnabled: boolean;
|
|
6
|
+
blockAlignmentEnabled: boolean;
|
|
7
|
+
surfaceRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
toolbarClassName?: string;
|
|
9
|
+
styleControls: RichTextStyleControl[];
|
|
10
|
+
templateVariables: RichTextTemplateVariable[];
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|