@signalsafe/content-editor-react 0.0.0-stage → 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 +105 -2
- package/dist/BootstrapBlockRenderer.d.ts +10 -0
- package/dist/BootstrapBlockRenderer.js +256 -0
- package/dist/BootstrapInlineCanvasEditor.d.ts +11 -0
- package/dist/BootstrapInlineCanvasEditor.js +38 -0
- package/dist/BootstrapInlineText.d.ts +9 -0
- package/dist/BootstrapInlineText.js +121 -0
- package/dist/BootstrapNavigationBlocks.d.ts +13 -0
- package/dist/BootstrapNavigationBlocks.js +33 -0
- package/dist/BootstrapProgressGroup.d.ts +11 -0
- package/dist/BootstrapProgressGroup.js +13 -0
- package/dist/BootstrapProperties.d.ts +15 -0
- package/dist/BootstrapProperties.js +217 -0
- package/dist/CanvasTheme.d.ts +25 -0
- package/dist/CanvasTheme.js +34 -0
- package/dist/CollectionRowActions.d.ts +19 -0
- package/dist/CollectionRowActions.js +9 -0
- package/dist/ColorModeSelect.d.ts +9 -0
- package/dist/ColorModeSelect.js +28 -0
- package/dist/ColumnContent.d.ts +6 -0
- package/dist/ColumnContent.js +6 -0
- package/dist/ComponentPicker.d.ts +10 -0
- package/dist/ComponentPicker.js +22 -0
- package/dist/ComponentPickerIcon.d.ts +3 -0
- package/dist/ComponentPickerIcon.js +52 -0
- package/dist/ContentEditor.d.ts +16 -0
- package/dist/ContentEditor.js +73 -0
- package/dist/ContentImage.d.ts +16 -0
- package/dist/ContentImage.js +45 -0
- package/dist/ContentInteractionProvider.d.ts +21 -0
- package/dist/ContentInteractionProvider.js +102 -0
- package/dist/ContentKeyboardHelp.d.ts +4 -0
- package/dist/ContentKeyboardHelp.js +8 -0
- package/dist/ContentOutline.d.ts +20 -0
- package/dist/ContentOutline.js +71 -0
- package/dist/ContentRuntime.d.ts +28 -0
- package/dist/ContentRuntime.js +13 -0
- package/dist/EditorActionIcon.d.ts +18 -0
- package/dist/EditorActionIcon.js +32 -0
- package/dist/EditorCanvasScroll.d.ts +6 -0
- package/dist/EditorCanvasScroll.js +82 -0
- package/dist/EditorCanvasSettings.d.ts +5 -0
- package/dist/EditorCanvasSettings.js +21 -0
- package/dist/EditorCanvasToolbar.d.ts +16 -0
- package/dist/EditorCanvasToolbar.js +22 -0
- package/dist/EditorCollectionAdd.d.ts +6 -0
- package/dist/EditorCollectionAdd.js +6 -0
- package/dist/EditorCollectionRow.d.ts +18 -0
- package/dist/EditorCollectionRow.js +6 -0
- package/dist/EditorCommandBar.d.ts +7 -0
- package/dist/EditorCommandBar.js +9 -0
- package/dist/EditorContainerFields.d.ts +17 -0
- package/dist/EditorContainerFields.js +27 -0
- package/dist/EditorHistoryControls.d.ts +8 -0
- package/dist/EditorHistoryControls.js +6 -0
- package/dist/EditorIssuesPanel.d.ts +5 -0
- package/dist/EditorIssuesPanel.js +6 -0
- package/dist/EditorLayoutMenu.d.ts +23 -0
- package/dist/EditorLayoutMenu.js +13 -0
- package/dist/EditorMenuChoice.d.ts +8 -0
- package/dist/EditorMenuChoice.js +6 -0
- package/dist/EditorPanel.d.ts +10 -0
- package/dist/EditorPanel.js +12 -0
- package/dist/EditorPreviewToggle.d.ts +6 -0
- package/dist/EditorPreviewToggle.js +6 -0
- package/dist/EditorSidebarLayout.d.ts +8 -0
- package/dist/EditorSidebarLayout.js +29 -0
- package/dist/EditorStatusBar.d.ts +5 -0
- package/dist/EditorStatusBar.js +8 -0
- package/dist/EditorStatusBarContext.d.ts +2 -0
- package/dist/EditorStatusBarContext.js +3 -0
- package/dist/EditorSubmenu.d.ts +18 -0
- package/dist/EditorSubmenu.js +74 -0
- package/dist/EditorTabs.d.ts +9 -0
- package/dist/EditorTabs.js +28 -0
- package/dist/EditorTemplateMenu.d.ts +12 -0
- package/dist/EditorTemplateMenu.js +7 -0
- package/dist/EditorViewportSelect.d.ts +30 -0
- package/dist/EditorViewportSelect.js +17 -0
- package/dist/EditorWorkflowActions.d.ts +12 -0
- package/dist/EditorWorkflowActions.js +6 -0
- package/dist/EmptyContent.d.ts +6 -0
- package/dist/EmptyContent.js +18 -0
- package/dist/InlineCanvasEditor.d.ts +7 -0
- package/dist/InlineCanvasEditor.js +12 -0
- package/dist/InteractiveBootstrapBlocks.d.ts +17 -0
- package/dist/InteractiveBootstrapBlocks.js +434 -0
- package/dist/JsonEditor.css +163 -0
- package/dist/JsonTextEditor.d.ts +11 -0
- package/dist/JsonTextEditor.js +70 -0
- package/dist/JsonViewer.d.ts +15 -0
- package/dist/JsonViewer.js +109 -0
- package/dist/LayoutPresets.d.ts +8 -0
- package/dist/LayoutPresets.js +66 -0
- package/dist/LayoutPropertyFields.d.ts +8 -0
- package/dist/LayoutPropertyFields.js +43 -0
- package/dist/MarkdownEditor.d.ts +13 -0
- package/dist/MarkdownEditor.js +82 -0
- package/dist/PracticeInputBlock.d.ts +12 -0
- package/dist/PracticeInputBlock.js +21 -0
- package/dist/ReadableButton.d.ts +5 -0
- package/dist/ReadableButton.js +20 -0
- package/dist/ReadableDropdownSurface.d.ts +6 -0
- package/dist/ReadableDropdownSurface.js +16 -0
- package/dist/ReadableDropdownToggle.d.ts +2 -0
- package/dist/ReadableDropdownToggle.js +14 -0
- package/dist/ReadableFormSelect.d.ts +3 -0
- package/dist/ReadableFormSelect.js +10 -0
- package/dist/ReorderHandle.d.ts +15 -0
- package/dist/ReorderHandle.js +31 -0
- package/dist/ReorderTarget.d.ts +10 -0
- package/dist/ReorderTarget.js +7 -0
- package/dist/SpacingEditor.d.ts +9 -0
- package/dist/SpacingEditor.js +53 -0
- package/dist/authoringActions.d.ts +18 -0
- package/dist/authoringActions.js +172 -0
- package/dist/authoringText.d.ts +4 -0
- package/dist/authoringText.js +45 -0
- package/dist/authoringUuid.d.ts +2 -0
- package/dist/authoringUuid.js +11 -0
- package/dist/bootstrapFamilies.d.ts +10 -0
- package/dist/bootstrapFamilies.js +151 -0
- package/dist/bootstrapGridImport.d.ts +8 -0
- package/dist/bootstrapGridImport.js +122 -0
- package/dist/bootstrapGridMigration.d.ts +3 -0
- package/dist/bootstrapGridMigration.js +27 -0
- package/dist/bootstrapRegistry.d.ts +69 -0
- package/dist/bootstrapRegistry.js +966 -0
- package/dist/canvasPreferences.d.ts +27 -0
- package/dist/canvasPreferences.js +28 -0
- package/dist/collectionNavigation.d.ts +20 -0
- package/dist/collectionNavigation.js +38 -0
- package/dist/componentPickerFamilies.d.ts +5 -0
- package/dist/componentPickerFamilies.js +40 -0
- package/dist/componentPolicy.d.ts +31 -0
- package/dist/componentPolicy.js +25 -0
- package/dist/componentValidation.d.ts +23707 -0
- package/dist/componentValidation.js +7 -0
- package/dist/content-editor.css +584 -0
- package/dist/content-layout.css +597 -0
- package/dist/contentContainment.d.ts +4 -0
- package/dist/contentContainment.js +117 -0
- package/dist/contentCssPath.d.ts +5 -0
- package/dist/contentCssPath.js +63 -0
- package/dist/contentEditingCommands.d.ts +35 -0
- package/dist/contentEditingCommands.js +69 -0
- package/dist/contentInsertion.d.ts +3 -0
- package/dist/contentInsertion.js +16 -0
- package/dist/contentModel.d.ts +3 -0
- package/dist/contentModel.js +1 -0
- package/dist/contentTreeValidation.d.ts +8 -0
- package/dist/contentTreeValidation.js +211 -0
- package/dist/contracts/semantics.gen.d.ts +2 -0
- package/dist/contracts/semantics.gen.js +3 -0
- package/dist/contracts/types.gen.d.ts +3741 -0
- package/dist/contracts/types.gen.js +1 -0
- package/dist/contracts/zod.gen.d.ts +62365 -0
- package/dist/contracts/zod.gen.js +3036 -0
- package/dist/controlBackgroundIconContrast.d.ts +3 -0
- package/dist/controlBackgroundIconContrast.js +60 -0
- package/dist/dropdownContrast.d.ts +5 -0
- package/dist/dropdownContrast.js +34 -0
- package/dist/editor-ui-colors.css +40 -0
- package/dist/editorThemes.d.ts +10 -0
- package/dist/editorThemes.js +12 -0
- package/dist/inlineMarkup.d.ts +6 -0
- package/dist/inlineMarkup.js +171 -0
- package/dist/layout.d.ts +17 -0
- package/dist/layout.js +37 -0
- package/dist/nestedComponentLabel.d.ts +2 -0
- package/dist/nestedComponentLabel.js +17 -0
- package/dist/responsiveLayout.d.ts +51 -0
- package/dist/responsiveLayout.js +97 -0
- package/dist/slideAppearance.d.ts +25 -0
- package/dist/slideAppearance.js +283 -0
- package/dist/source-manifest.json +105 -0
- package/dist/spacingShorthand.d.ts +12 -0
- package/dist/spacingShorthand.js +47 -0
- package/dist/themes/canvas-themes.css +131 -0
- package/dist/useCanvasSelectionScroll.d.ts +3 -0
- package/dist/useCanvasSelectionScroll.js +51 -0
- package/dist/useContentHistory.d.ts +40 -0
- package/dist/useContentHistory.js +42 -0
- package/dist/useContentReorderTarget.d.ts +6 -0
- package/dist/useContentReorderTarget.js +44 -0
- package/dist/useContentSelection.d.ts +10 -0
- package/dist/useContentSelection.js +23 -0
- package/dist/useDropdownContrast.d.ts +16 -0
- package/dist/useDropdownContrast.js +145 -0
- package/dist/useEditorControlContrast.d.ts +3 -0
- package/dist/useEditorControlContrast.js +188 -0
- package/dist/useSiteThemeStyles.d.ts +3 -0
- package/dist/useSiteThemeStyles.js +30 -0
- package/dist/useValidationFocus.d.ts +5 -0
- package/dist/useValidationFocus.js +17 -0
- package/package.json +74 -5
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
import { IMAGE_DEFAULT_PROPS } from "./ContentImage.js";
|
|
2
|
+
import { responsiveStackProperties } from "./responsiveLayout.js";
|
|
3
|
+
import { appearanceProperties } from "./slideAppearance.js";
|
|
4
|
+
import { canContainContentBlock } from "./contentContainment.js";
|
|
5
|
+
const LAYOUT_TYPES = ["Container", "Row", "Column", "Group", "Stack", "Ratio", "Divider"];
|
|
6
|
+
const CONTENT_TYPES = [
|
|
7
|
+
"Text", "Image", "Figure", "Figcaption", "Blockquote", "Cite",
|
|
8
|
+
"ContentList", "ContentListItem", "DescriptionList", "DescriptionTerm", "DescriptionDetails",
|
|
9
|
+
"Table", "TableCaption", "TableHead", "TableBody", "TableFoot", "TableRow", "TableHeader", "TableCell",
|
|
10
|
+
"Video", "Audio", "Embed",
|
|
11
|
+
];
|
|
12
|
+
const FORM_TYPES = [
|
|
13
|
+
"FormLabel", "FormControl", "FormSelect", "FormRange", "InputGroup", "InputGroupText",
|
|
14
|
+
"PracticeInput", "PracticeSelect", "PracticeCheck", "PracticeRange",
|
|
15
|
+
];
|
|
16
|
+
const COMPONENT_TYPES = [
|
|
17
|
+
"Accordion", "AccordionItem", "Alert", "Badge", "Breadcrumb", "BreadcrumbItem",
|
|
18
|
+
"Button", "ButtonGroup", "CloseButton",
|
|
19
|
+
"Card", "CardHeader", "CardBody", "CardFooter", "CardTitle", "CardSubtitle", "CardText",
|
|
20
|
+
"CardLink", "CardImage", "CardImageOverlay", "CardGroup",
|
|
21
|
+
"Carousel", "CarouselItem",
|
|
22
|
+
"Dropdown", "DropdownHeader", "DropdownItem", "DropdownDivider",
|
|
23
|
+
"Indicator", "ListGroup", "ListGroupItem", "Modal",
|
|
24
|
+
"Navbar", "NavbarBrand", "NavbarToggle", "NavbarCollapse", "Nav", "NavLink",
|
|
25
|
+
"Offcanvas", "Pagination", "PaginationItem", "Popover", "Progress", "ProgressGroup", "Reveal",
|
|
26
|
+
"Tabs", "Tab", "TabContainer", "TabContent", "TabPane", "Toast", "Tooltip", "Spinner", "Placeholder", "PlaceholderButton",
|
|
27
|
+
];
|
|
28
|
+
export const BOOTSTRAP_BLOCK_TYPES = [
|
|
29
|
+
...LAYOUT_TYPES, ...CONTENT_TYPES, ...FORM_TYPES, ...COMPONENT_TYPES,
|
|
30
|
+
];
|
|
31
|
+
const TYPES = new Set(BOOTSTRAP_BLOCK_TYPES);
|
|
32
|
+
export function isBootstrapBlock(block) {
|
|
33
|
+
return TYPES.has(block.type);
|
|
34
|
+
}
|
|
35
|
+
export function isBootstrapBlockType(type) {
|
|
36
|
+
return TYPES.has(type);
|
|
37
|
+
}
|
|
38
|
+
export const bootstrapBlockGroups = [
|
|
39
|
+
{ label: "Layout", types: LAYOUT_TYPES },
|
|
40
|
+
{ label: "Content", types: CONTENT_TYPES },
|
|
41
|
+
{ label: "Forms", types: FORM_TYPES },
|
|
42
|
+
{ label: "Components", types: COMPONENT_TYPES },
|
|
43
|
+
];
|
|
44
|
+
const LABELS = {
|
|
45
|
+
FormLabel: "Form label", FormControl: "Form control", FormSelect: "Form select", FormRange: "Form range",
|
|
46
|
+
TabContainer: "Tab container", TabContent: "Tab content", TabPane: "Tab pane",
|
|
47
|
+
Navbar: "Navbar",
|
|
48
|
+
NavbarBrand: "Navbar brand",
|
|
49
|
+
NavbarToggle: "Navbar toggle",
|
|
50
|
+
NavbarCollapse: "Navbar collapse",
|
|
51
|
+
Nav: "Navigation",
|
|
52
|
+
NavLink: "Navigation link",
|
|
53
|
+
Pagination: "Pagination",
|
|
54
|
+
PaginationItem: "Pagination item",
|
|
55
|
+
InputGroup: "Input group",
|
|
56
|
+
InputGroupText: "Input addon",
|
|
57
|
+
ProgressGroup: "Multiple progress bars",
|
|
58
|
+
DropdownDivider: "Dropdown divider",
|
|
59
|
+
DropdownHeader: "Dropdown header",
|
|
60
|
+
Group: "Group",
|
|
61
|
+
Ratio: "Ratio",
|
|
62
|
+
Accordion: "Accordion",
|
|
63
|
+
AccordionItem: "Accordion item",
|
|
64
|
+
Tabs: "Tabs",
|
|
65
|
+
Tab: "Tab",
|
|
66
|
+
Button: "Button",
|
|
67
|
+
ButtonGroup: "Button group",
|
|
68
|
+
Reveal: "Reveal",
|
|
69
|
+
Tooltip: "Tooltip",
|
|
70
|
+
Popover: "Popover",
|
|
71
|
+
Carousel: "Carousel",
|
|
72
|
+
CarouselItem: "Carousel item",
|
|
73
|
+
Progress: "Progress",
|
|
74
|
+
Modal: "Modal",
|
|
75
|
+
Offcanvas: "Offcanvas",
|
|
76
|
+
Dropdown: "Dropdown",
|
|
77
|
+
DropdownItem: "Dropdown item",
|
|
78
|
+
Toast: "Toast",
|
|
79
|
+
PracticeInput: "Practice input",
|
|
80
|
+
PracticeSelect: "Practice select",
|
|
81
|
+
PracticeCheck: "Practice check",
|
|
82
|
+
PracticeRange: "Practice range",
|
|
83
|
+
Breadcrumb: "Breadcrumb",
|
|
84
|
+
BreadcrumbItem: "Breadcrumb item",
|
|
85
|
+
Video: "Video",
|
|
86
|
+
Audio: "Audio",
|
|
87
|
+
Embed: "Embed",
|
|
88
|
+
Stack: "Stack",
|
|
89
|
+
Divider: "Divider",
|
|
90
|
+
Alert: "Alert",
|
|
91
|
+
ContentList: "List",
|
|
92
|
+
ContentListItem: "List item",
|
|
93
|
+
DescriptionList: "Description list",
|
|
94
|
+
DescriptionTerm: "Term",
|
|
95
|
+
DescriptionDetails: "Definition",
|
|
96
|
+
Container: "Container",
|
|
97
|
+
Text: "Text",
|
|
98
|
+
Figure: "Figure",
|
|
99
|
+
Blockquote: "Blockquote",
|
|
100
|
+
Figcaption: "Figure caption",
|
|
101
|
+
Cite: "Citation",
|
|
102
|
+
Table: "Table",
|
|
103
|
+
TableHead: "Table head",
|
|
104
|
+
TableBody: "Table body",
|
|
105
|
+
TableFoot: "Table foot",
|
|
106
|
+
TableRow: "Table row",
|
|
107
|
+
TableHeader: "Table header cell",
|
|
108
|
+
TableCell: "Table cell",
|
|
109
|
+
TableCaption: "Table caption",
|
|
110
|
+
Indicator: "Indicator",
|
|
111
|
+
Badge: "Badge",
|
|
112
|
+
ListGroup: "List group",
|
|
113
|
+
ListGroupItem: "List item",
|
|
114
|
+
Image: "Image", CloseButton: "Close button", Placeholder: "Placeholder", PlaceholderButton: "Placeholder button",
|
|
115
|
+
Spinner: "Spinner",
|
|
116
|
+
Row: "Row",
|
|
117
|
+
Column: "Column",
|
|
118
|
+
Card: "Card",
|
|
119
|
+
CardHeader: "Card header",
|
|
120
|
+
CardBody: "Card body",
|
|
121
|
+
CardFooter: "Card footer",
|
|
122
|
+
CardTitle: "Card title",
|
|
123
|
+
CardSubtitle: "Card subtitle",
|
|
124
|
+
CardText: "Card text",
|
|
125
|
+
CardLink: "Card link",
|
|
126
|
+
CardImage: "Card image",
|
|
127
|
+
CardImageOverlay: "Card image overlay",
|
|
128
|
+
CardGroup: "Card group",
|
|
129
|
+
};
|
|
130
|
+
export const CONTENT_BLOCK_TYPES = [
|
|
131
|
+
"Heading",
|
|
132
|
+
"Paragraph",
|
|
133
|
+
...BOOTSTRAP_BLOCK_TYPES,
|
|
134
|
+
];
|
|
135
|
+
const options = (values) => values.map((value) => ({ label: value, value }));
|
|
136
|
+
const variants = [
|
|
137
|
+
"primary",
|
|
138
|
+
"secondary",
|
|
139
|
+
"success",
|
|
140
|
+
"info",
|
|
141
|
+
"warning",
|
|
142
|
+
"danger",
|
|
143
|
+
"light",
|
|
144
|
+
"dark",
|
|
145
|
+
];
|
|
146
|
+
function property(name, label, kind) {
|
|
147
|
+
return { name, label, kind };
|
|
148
|
+
}
|
|
149
|
+
function selectProperty(name, label, values) {
|
|
150
|
+
return { name, label, kind: "select", options: options(values) };
|
|
151
|
+
}
|
|
152
|
+
const fields = {
|
|
153
|
+
alignment: selectProperty("alignment", "Alignment", ["start", "center", "end"]),
|
|
154
|
+
spacing: selectProperty("spacing", "Spacing", ["compact", "normal", "relaxed"]),
|
|
155
|
+
richText: property("text", "Text", "richText"),
|
|
156
|
+
groupElement: selectProperty("element", "Element", ["div", "section", "article", "aside", "form", "fieldset", "nav", "ul", "li"]),
|
|
157
|
+
aspectRatio: selectProperty("aspectRatio", "Aspect ratio", ["1x1", "4x3", "16x9", "21x9"]),
|
|
158
|
+
alwaysOpen: property("alwaysOpen", "Always open", "boolean"),
|
|
159
|
+
flush: property("flush", "Flush", "boolean"),
|
|
160
|
+
defaultActiveKey: property("defaultActiveKey", "Default active key", "text"),
|
|
161
|
+
eventKey: property("eventKey", "Event key", "text"),
|
|
162
|
+
title: property("title", "Title", "text"),
|
|
163
|
+
tabsVariant: selectProperty("variant", "Variant", ["tabs", "pills", "underline"]),
|
|
164
|
+
fill: property("fill", "Fill", "boolean"),
|
|
165
|
+
justify: property("justify", "Justify", "boolean"),
|
|
166
|
+
disabled: property("disabled", "Disabled", "boolean"),
|
|
167
|
+
text: property("text", "Text", "text"),
|
|
168
|
+
buttonVariant: selectProperty("variant", "Variant", [
|
|
169
|
+
"primary",
|
|
170
|
+
"secondary",
|
|
171
|
+
"success",
|
|
172
|
+
"danger",
|
|
173
|
+
"warning",
|
|
174
|
+
"info",
|
|
175
|
+
"light",
|
|
176
|
+
"dark",
|
|
177
|
+
]),
|
|
178
|
+
size: selectProperty("size", "Size", ["sm", "lg"]),
|
|
179
|
+
outline: property("outline", "Outline", "boolean"),
|
|
180
|
+
action: selectProperty("action", "Action", [
|
|
181
|
+
"none",
|
|
182
|
+
"link",
|
|
183
|
+
"toggle",
|
|
184
|
+
"show",
|
|
185
|
+
"hide",
|
|
186
|
+
"select-tab",
|
|
187
|
+
"next-slide",
|
|
188
|
+
"previous-slide",
|
|
189
|
+
]),
|
|
190
|
+
targetId: property("targetId", "Target id", "text"),
|
|
191
|
+
targetKey: property("targetKey", "Target key", "text"),
|
|
192
|
+
href: property("href", "Href", "text"),
|
|
193
|
+
newWindow: property("newWindow", "New window", "boolean"),
|
|
194
|
+
vertical: property("vertical", "Vertical", "boolean"),
|
|
195
|
+
defaultOpen: property("defaultOpen", "Default open", "boolean"),
|
|
196
|
+
overlayPlacement: selectProperty("placement", "Placement", ["top", "bottom", "start", "end"]),
|
|
197
|
+
controls: property("controls", "Controls", "boolean"),
|
|
198
|
+
indicators: property("indicators", "Indicators", "boolean"),
|
|
199
|
+
fade: property("fade", "Fade", "boolean"),
|
|
200
|
+
interval: property("interval", "Interval", "number"),
|
|
201
|
+
caption: property("caption", "Caption", "text"),
|
|
202
|
+
value: property("value", "Value", "number"),
|
|
203
|
+
min: property("min", "Min", "number"),
|
|
204
|
+
max: property("max", "Max", "number"),
|
|
205
|
+
label: property("label", "Label", "text"),
|
|
206
|
+
variantText: property("variant", "Variant", "text"),
|
|
207
|
+
striped: property("striped", "Striped", "boolean"),
|
|
208
|
+
animated: property("animated", "Animated", "boolean"),
|
|
209
|
+
modalSize: selectProperty("size", "Size", ["sm", "lg", "xl", "fullscreen"]),
|
|
210
|
+
centered: property("centered", "Centered", "boolean"),
|
|
211
|
+
scrollable: property("scrollable", "Scrollable", "boolean"),
|
|
212
|
+
closeButton: property("closeButton", "Close button", "boolean"),
|
|
213
|
+
offcanvasPlacement: selectProperty("placement", "Placement", ["start", "end", "top", "bottom"]),
|
|
214
|
+
backdrop: property("backdrop", "Backdrop", "boolean"),
|
|
215
|
+
autohide: property("autohide", "Autohide", "boolean"),
|
|
216
|
+
delay: property("delay", "Delay", "number"),
|
|
217
|
+
inputType: selectProperty("type", "Type", ["text", "email", "number", "textarea", "password", "file", "search"]),
|
|
218
|
+
placeholder: property("placeholder", "Placeholder", "text"),
|
|
219
|
+
defaultText: property("defaultValue", "Default value", "text"),
|
|
220
|
+
required: property("required", "Required", "boolean"),
|
|
221
|
+
checkType: selectProperty("type", "Type", ["checkbox", "switch", "radio"]),
|
|
222
|
+
defaultChecked: property("defaultChecked", "Default checked", "boolean"),
|
|
223
|
+
name: property("name", "Name", "text"),
|
|
224
|
+
step: property("step", "Step", "number"),
|
|
225
|
+
defaultNumber: property("defaultValue", "Default value", "number"),
|
|
226
|
+
active: property("active", "Active", "boolean"),
|
|
227
|
+
captionsSrc: property("captionsSrc", "Captions VTT URL", "text"),
|
|
228
|
+
captionsLanguage: property("captionsLanguage", "Captions language", "text"),
|
|
229
|
+
captionsLabel: property("captionsLabel", "Captions label", "text"),
|
|
230
|
+
src: property("src", "Src", "text"),
|
|
231
|
+
poster: property("poster", "Poster", "text"),
|
|
232
|
+
autoPlay: property("autoPlay", "Auto play", "boolean"),
|
|
233
|
+
muted: property("muted", "Muted", "boolean"),
|
|
234
|
+
loop: property("loop", "Loop", "boolean"),
|
|
235
|
+
allowFullScreen: property("allowFullScreen", "Allow full screen", "boolean"),
|
|
236
|
+
direction: selectProperty("direction", "Direction", ["horizontal", "vertical"]),
|
|
237
|
+
distribution: selectProperty("justify", "Horizontal distribution", [
|
|
238
|
+
"start",
|
|
239
|
+
"center",
|
|
240
|
+
"end",
|
|
241
|
+
"between",
|
|
242
|
+
"around",
|
|
243
|
+
"evenly",
|
|
244
|
+
]),
|
|
245
|
+
align: selectProperty("align", "Item alignment", ["start", "center", "end", "stretch"]),
|
|
246
|
+
wrap: property("wrap", "Wrap items", "boolean"),
|
|
247
|
+
dismissible: property("dismissible", "Dismissible", "boolean"),
|
|
248
|
+
variant: selectProperty("variant", "Variant", variants),
|
|
249
|
+
fluid: property("fluid", "Full width", "boolean"),
|
|
250
|
+
textElement: selectProperty("element", "Text element", [
|
|
251
|
+
"p",
|
|
252
|
+
"h1",
|
|
253
|
+
"h2",
|
|
254
|
+
"h3",
|
|
255
|
+
"h4",
|
|
256
|
+
"h5",
|
|
257
|
+
"h6",
|
|
258
|
+
"div",
|
|
259
|
+
"span",
|
|
260
|
+
"lead",
|
|
261
|
+
"legend",
|
|
262
|
+
"label",
|
|
263
|
+
"small",
|
|
264
|
+
]),
|
|
265
|
+
tableVariant: selectProperty("variant", "Table variant", variants),
|
|
266
|
+
responsiveBreakpoint: selectProperty("responsiveBreakpoint", "Responsive below", [
|
|
267
|
+
"sm",
|
|
268
|
+
"md",
|
|
269
|
+
"lg",
|
|
270
|
+
"xl",
|
|
271
|
+
"xxl",
|
|
272
|
+
]),
|
|
273
|
+
scope: selectProperty("scope", "Header scope", ["col", "row", "colgroup", "rowgroup"]),
|
|
274
|
+
pill: property("pill", "Pill shape", "boolean"),
|
|
275
|
+
inlineElement: selectProperty("element", "Element", ["span", "div"]),
|
|
276
|
+
horizontal: property("horizontal", "Horizontal", "boolean"),
|
|
277
|
+
horizontalBreakpoint: selectProperty("horizontalBreakpoint", "Horizontal from breakpoint", [
|
|
278
|
+
"sm",
|
|
279
|
+
"md",
|
|
280
|
+
"lg",
|
|
281
|
+
"xl",
|
|
282
|
+
"xxl",
|
|
283
|
+
]),
|
|
284
|
+
numbered: property("numbered", "Numbered list", "boolean"),
|
|
285
|
+
flushEdges: property("flush", "Flush edges", "boolean"),
|
|
286
|
+
itemVariant: selectProperty("variant", "Item variant", variants),
|
|
287
|
+
headingElement: selectProperty("element", "Heading element", [
|
|
288
|
+
"h1",
|
|
289
|
+
"h2",
|
|
290
|
+
"h3",
|
|
291
|
+
"h4",
|
|
292
|
+
"h5",
|
|
293
|
+
"h6",
|
|
294
|
+
]),
|
|
295
|
+
linkText: property("text", "Link text", "text"),
|
|
296
|
+
linkUrl: property("href", "Link URL", "text"),
|
|
297
|
+
objectFit: selectProperty("objectFit", "Image fit", [
|
|
298
|
+
"contain",
|
|
299
|
+
"cover",
|
|
300
|
+
"fill",
|
|
301
|
+
"scale-down",
|
|
302
|
+
"none",
|
|
303
|
+
]),
|
|
304
|
+
thumbnail: property("thumbnail", "Thumbnail border", "boolean"),
|
|
305
|
+
imageUrl: property("src", "Image URL", "text"),
|
|
306
|
+
alt: property("alt", "Alternative text", "text"),
|
|
307
|
+
position: selectProperty("position", "Position", ["top", "bottom"]),
|
|
308
|
+
};
|
|
309
|
+
const common = [fields.alignment, fields.spacing,
|
|
310
|
+
property("cssClasses", "Bootstrap classes", "text"), selectProperty("colorMode", "Color mode", ["light", "dark"])];
|
|
311
|
+
const inline = [fields.richText];
|
|
312
|
+
const BLOCK_PROPERTIES = {
|
|
313
|
+
TabContainer: () => [fields.defaultActiveKey],
|
|
314
|
+
TabPane: () => [fields.eventKey],
|
|
315
|
+
FormLabel: () => [...inline, property("htmlFor", "Control ID", "text")],
|
|
316
|
+
FormControl: () => properties("PracticeInput"),
|
|
317
|
+
FormSelect: () => properties("PracticeSelect"),
|
|
318
|
+
FormRange: () => properties("PracticeRange"),
|
|
319
|
+
Navbar: () => [selectProperty("expand", "Expand from", ["sm", "md", "lg", "xl", "xxl"])],
|
|
320
|
+
NavbarBrand: () => [fields.text, fields.href],
|
|
321
|
+
Nav: () => [fields.defaultActiveKey, fields.tabsVariant, property("navbar", "Navbar links", "boolean"), fields.vertical],
|
|
322
|
+
NavLink: () => [fields.eventKey, fields.text, fields.href, fields.active, fields.disabled],
|
|
323
|
+
Pagination: () => [fields.size],
|
|
324
|
+
PaginationItem: () => [fields.text, fields.active, fields.disabled],
|
|
325
|
+
InputGroup: () => [fields.size],
|
|
326
|
+
InputGroupText: () => inline,
|
|
327
|
+
DropdownHeader: () => inline,
|
|
328
|
+
"Group": () => [fields.groupElement],
|
|
329
|
+
"Ratio": () => [fields.aspectRatio],
|
|
330
|
+
"Accordion": () => [fields.alwaysOpen, fields.flush, fields.defaultActiveKey],
|
|
331
|
+
"AccordionItem": () => [fields.eventKey, fields.title],
|
|
332
|
+
"Tabs": () => [fields.defaultActiveKey, fields.tabsVariant, fields.fill, fields.justify],
|
|
333
|
+
"Tab": () => [fields.eventKey, fields.title, fields.disabled],
|
|
334
|
+
"Button": () => [
|
|
335
|
+
fields.text,
|
|
336
|
+
fields.buttonVariant,
|
|
337
|
+
fields.active,
|
|
338
|
+
fields.size,
|
|
339
|
+
fields.outline,
|
|
340
|
+
fields.disabled,
|
|
341
|
+
fields.action,
|
|
342
|
+
fields.targetId,
|
|
343
|
+
fields.targetKey,
|
|
344
|
+
fields.href,
|
|
345
|
+
fields.newWindow,
|
|
346
|
+
],
|
|
347
|
+
"DropdownItem": () => [fields.eventKey,
|
|
348
|
+
fields.text,
|
|
349
|
+
fields.buttonVariant,
|
|
350
|
+
fields.active,
|
|
351
|
+
fields.size,
|
|
352
|
+
fields.outline,
|
|
353
|
+
fields.disabled,
|
|
354
|
+
fields.action,
|
|
355
|
+
fields.targetId,
|
|
356
|
+
fields.targetKey,
|
|
357
|
+
fields.href,
|
|
358
|
+
fields.newWindow,
|
|
359
|
+
],
|
|
360
|
+
"ButtonGroup": () => [fields.vertical, fields.size],
|
|
361
|
+
"Reveal": () => [fields.defaultOpen],
|
|
362
|
+
"Tooltip": () => [property("triggerText", "Trigger text", "text"), fields.text, fields.overlayPlacement],
|
|
363
|
+
"Popover": () => [property("triggerText", "Trigger text", "text"), fields.title, fields.text, fields.overlayPlacement],
|
|
364
|
+
"Carousel": () => [
|
|
365
|
+
fields.controls,
|
|
366
|
+
fields.indicators,
|
|
367
|
+
fields.fade,
|
|
368
|
+
fields.interval,
|
|
369
|
+
fields.defaultActiveKey,
|
|
370
|
+
],
|
|
371
|
+
"CarouselItem": () => [fields.eventKey, fields.title, fields.caption],
|
|
372
|
+
"Progress": () => [
|
|
373
|
+
fields.value,
|
|
374
|
+
fields.min,
|
|
375
|
+
fields.max,
|
|
376
|
+
fields.label,
|
|
377
|
+
fields.variantText,
|
|
378
|
+
fields.striped,
|
|
379
|
+
fields.animated,
|
|
380
|
+
],
|
|
381
|
+
"Modal": () => [property("inline", "Inline example", "boolean"),
|
|
382
|
+
fields.title,
|
|
383
|
+
fields.defaultOpen,
|
|
384
|
+
fields.modalSize,
|
|
385
|
+
fields.centered,
|
|
386
|
+
fields.scrollable,
|
|
387
|
+
fields.closeButton,
|
|
388
|
+
],
|
|
389
|
+
"Offcanvas": () => [
|
|
390
|
+
fields.title,
|
|
391
|
+
fields.defaultOpen,
|
|
392
|
+
fields.offcanvasPlacement,
|
|
393
|
+
fields.backdrop,
|
|
394
|
+
fields.closeButton,
|
|
395
|
+
],
|
|
396
|
+
"Dropdown": () => [fields.text, fields.variantText, fields.size, property("nav", "Navigation dropdown", "boolean"), property("split", "Split toggle", "boolean")],
|
|
397
|
+
"Toast": () => [property("subtitle", "Subtitle", "text"), fields.title, fields.defaultOpen, fields.autohide, fields.delay],
|
|
398
|
+
"PracticeInput": () => [
|
|
399
|
+
fields.size,
|
|
400
|
+
...["readOnly", "plaintext", "floating", "controlOnly"].map(name => property(name, name, "boolean")),
|
|
401
|
+
property("helpText", "Help text", "text"), property("feedback", "Feedback", "text"),
|
|
402
|
+
selectProperty("validation", "Validation", ["valid", "invalid"]),
|
|
403
|
+
fields.label,
|
|
404
|
+
fields.inputType,
|
|
405
|
+
fields.placeholder,
|
|
406
|
+
fields.defaultText,
|
|
407
|
+
fields.required,
|
|
408
|
+
fields.disabled,
|
|
409
|
+
],
|
|
410
|
+
"PracticeSelect": () => [fields.size, property("multiple", "Multiple selection", "boolean"), fields.label, fields.defaultText, fields.required, fields.disabled],
|
|
411
|
+
"PracticeCheck": () => [
|
|
412
|
+
fields.label,
|
|
413
|
+
fields.checkType,
|
|
414
|
+
fields.defaultChecked,
|
|
415
|
+
fields.disabled,
|
|
416
|
+
fields.name,
|
|
417
|
+
],
|
|
418
|
+
"PracticeRange": () => [
|
|
419
|
+
fields.label,
|
|
420
|
+
fields.min,
|
|
421
|
+
fields.max,
|
|
422
|
+
fields.step,
|
|
423
|
+
fields.defaultNumber,
|
|
424
|
+
fields.disabled,
|
|
425
|
+
],
|
|
426
|
+
"Breadcrumb": () => [],
|
|
427
|
+
"BreadcrumbItem": () => [fields.text, fields.href, fields.active],
|
|
428
|
+
"Video": () => [
|
|
429
|
+
fields.captionsSrc,
|
|
430
|
+
fields.captionsLanguage,
|
|
431
|
+
fields.captionsLabel,
|
|
432
|
+
fields.src,
|
|
433
|
+
fields.poster,
|
|
434
|
+
fields.controls,
|
|
435
|
+
fields.autoPlay,
|
|
436
|
+
fields.muted,
|
|
437
|
+
fields.loop,
|
|
438
|
+
],
|
|
439
|
+
"Audio": () => [
|
|
440
|
+
fields.captionsSrc,
|
|
441
|
+
fields.captionsLanguage,
|
|
442
|
+
fields.captionsLabel,
|
|
443
|
+
fields.src,
|
|
444
|
+
fields.controls,
|
|
445
|
+
fields.autoPlay,
|
|
446
|
+
fields.muted,
|
|
447
|
+
fields.loop,
|
|
448
|
+
],
|
|
449
|
+
"Embed": () => [fields.src, fields.title, fields.allowFullScreen],
|
|
450
|
+
"Stack": () => [
|
|
451
|
+
...responsiveStackProperties,
|
|
452
|
+
fields.direction,
|
|
453
|
+
{
|
|
454
|
+
name: "gap",
|
|
455
|
+
label: "Gap",
|
|
456
|
+
kind: "number",
|
|
457
|
+
min: 0,
|
|
458
|
+
max: 5,
|
|
459
|
+
step: 1,
|
|
460
|
+
},
|
|
461
|
+
fields.distribution,
|
|
462
|
+
fields.align,
|
|
463
|
+
fields.wrap,
|
|
464
|
+
],
|
|
465
|
+
"Divider": () => [fields.direction],
|
|
466
|
+
"Alert": () => [fields.dismissible, fields.variant],
|
|
467
|
+
"ContentList": () => ["ordered", "unstyled", "inline"].map((name) => ({
|
|
468
|
+
name,
|
|
469
|
+
label: name[0]?.toUpperCase() + name.slice(1),
|
|
470
|
+
kind: "boolean",
|
|
471
|
+
})),
|
|
472
|
+
"Container": () => [
|
|
473
|
+
fields.fluid,
|
|
474
|
+
{
|
|
475
|
+
name: "padding",
|
|
476
|
+
label: "Padding",
|
|
477
|
+
kind: "number",
|
|
478
|
+
min: 0,
|
|
479
|
+
max: 5,
|
|
480
|
+
step: 1,
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
"Text": () => [...inline, fields.textElement],
|
|
484
|
+
"Table": () => [
|
|
485
|
+
...[
|
|
486
|
+
"striped",
|
|
487
|
+
"bordered",
|
|
488
|
+
"hover",
|
|
489
|
+
"responsive",
|
|
490
|
+
"compact",
|
|
491
|
+
"borderless",
|
|
492
|
+
"stripedColumns",
|
|
493
|
+
"captionTop",
|
|
494
|
+
].map((name) => ({
|
|
495
|
+
name,
|
|
496
|
+
label: name[0]?.toUpperCase() + name.slice(1),
|
|
497
|
+
kind: "boolean",
|
|
498
|
+
})),
|
|
499
|
+
fields.tableVariant,
|
|
500
|
+
fields.responsiveBreakpoint,
|
|
501
|
+
],
|
|
502
|
+
"TableHeader": () => [fields.scope, ...properties("TableCell")],
|
|
503
|
+
"TableCell": () => [
|
|
504
|
+
{
|
|
505
|
+
name: "colSpan",
|
|
506
|
+
label: "Column span",
|
|
507
|
+
kind: "number",
|
|
508
|
+
min: 1,
|
|
509
|
+
max: 12,
|
|
510
|
+
step: 1,
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: "rowSpan",
|
|
514
|
+
label: "Row span",
|
|
515
|
+
kind: "number",
|
|
516
|
+
min: 1,
|
|
517
|
+
max: 100,
|
|
518
|
+
step: 1,
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
"Badge": () => [fields.text, fields.variant, fields.pill, fields.inlineElement],
|
|
522
|
+
"Indicator": () => [fields.text, fields.variant, fields.pill, fields.inlineElement],
|
|
523
|
+
"ListGroup": () => [
|
|
524
|
+
fields.horizontal,
|
|
525
|
+
fields.horizontalBreakpoint,
|
|
526
|
+
fields.numbered,
|
|
527
|
+
fields.flushEdges,
|
|
528
|
+
],
|
|
529
|
+
"ListGroupItem": () => [fields.itemVariant, fields.active, fields.disabled],
|
|
530
|
+
"CardTitle": () => [...inline, fields.headingElement],
|
|
531
|
+
"CardSubtitle": () => [...inline, fields.headingElement],
|
|
532
|
+
"CardText": () => inline,
|
|
533
|
+
"CardLink": () => [fields.linkText, fields.linkUrl],
|
|
534
|
+
"CardImage": () => [
|
|
535
|
+
fields.objectFit,
|
|
536
|
+
fields.aspectRatio,
|
|
537
|
+
fields.thumbnail,
|
|
538
|
+
fields.imageUrl,
|
|
539
|
+
fields.alt,
|
|
540
|
+
fields.position,
|
|
541
|
+
]
|
|
542
|
+
};
|
|
543
|
+
function numericProperty(name, label, min, max) { return { name, label, kind: "number", min, max, step: 1 }; }
|
|
544
|
+
function properties(type) {
|
|
545
|
+
if (type === "Image")
|
|
546
|
+
return [property("src", "Image URL", "text"), property("alt", "Alt text", "text"), property("caption", "Caption", "text"), selectProperty("size", "Image size", ["small", "medium", "large", "full"]), selectProperty("alignment", "Image alignment", ["start", "center", "end"]), fields.objectFit, fields.aspectRatio, property("thumbnail", "Thumbnail border", "boolean"), property("roundedCircle", "Circular image", "boolean")];
|
|
547
|
+
if (type === "CloseButton")
|
|
548
|
+
return [fields.disabled, property("label", "Close label", "text")];
|
|
549
|
+
if (type === "Placeholder" || type === "PlaceholderButton")
|
|
550
|
+
return [numericProperty("xs", "Width (xs)", 1, 12), ...["sm", "md", "lg", "xl", "xxl"].map(point => numericProperty(point, `Width (${point})`, 1, 12)), selectProperty("animation", "Animation", ["glow", "wave"]), selectProperty("size", "Size", type === "Placeholder" ? ["xs", "sm", "lg"] : ["sm", "lg"]), fields.variant];
|
|
551
|
+
if (type === "Spinner")
|
|
552
|
+
return [selectProperty("animation", "Animation", ["border", "grow"]), fields.variant, selectProperty("size", "Size", ["sm"]), property("label", "Loading text", "text")];
|
|
553
|
+
return BLOCK_PROPERTIES[type]?.() ?? [];
|
|
554
|
+
}
|
|
555
|
+
export function bootstrapBlockDefinition(type) {
|
|
556
|
+
return {
|
|
557
|
+
type,
|
|
558
|
+
label: LABELS[type],
|
|
559
|
+
allowedChildren: CONTENT_BLOCK_TYPES.filter((child) => canContainContentBlock(type, child)),
|
|
560
|
+
properties: [...properties(type), ...(type === "Row" || type === "Column" || type === "Image" ? [] : common), ...appearanceProperties],
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
export function bootstrapPropertyValue(block, name) {
|
|
564
|
+
const value = Object.entries(block.props).find(([key]) => key === name)?.[1];
|
|
565
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean"
|
|
566
|
+
? value
|
|
567
|
+
: null;
|
|
568
|
+
}
|
|
569
|
+
const BLOCK_FACTORIES = {
|
|
570
|
+
Image: props => ({ type: "Image", props: { ...IMAGE_DEFAULT_PROPS, ...props } }),
|
|
571
|
+
CloseButton: props => ({ type: "CloseButton", props: { ...props, disabled: false, label: "Close" } }),
|
|
572
|
+
Placeholder: props => ({ type: "Placeholder", props: { ...props, xs: 6, animation: "glow", variant: "secondary" } }),
|
|
573
|
+
PlaceholderButton: props => ({ type: "PlaceholderButton", props: { ...props, xs: 6, animation: "glow", variant: "primary" } }),
|
|
574
|
+
Row: props => ({ type: "Row", props: { ...props, gap: 3, alignment: "stretch" } }),
|
|
575
|
+
Column: props => {
|
|
576
|
+
if (!props.parentId)
|
|
577
|
+
throw new Error("Columns require an owning Row.");
|
|
578
|
+
return { type: "Column", props: { ...props, parentId: props.parentId, width: 6, mobileWidth: 12 } };
|
|
579
|
+
},
|
|
580
|
+
Spinner: props => ({ type: "Spinner", props: { ...props, animation: "border", variant: "primary", label: "Loading..." } }),
|
|
581
|
+
FormLabel: props => ({ type: "FormLabel", props: { ...props, text: "Label", format: "plain" } }),
|
|
582
|
+
FormControl: props => ({ type: "FormControl", props: { ...props, type: "text", label: "", placeholder: "", defaultValue: "", required: false, disabled: false, controlOnly: true } }),
|
|
583
|
+
FormSelect: props => ({ type: "FormSelect", props: { ...props, label: "", options: [], defaultValue: "", required: false, disabled: false } }),
|
|
584
|
+
FormRange: props => ({ type: "FormRange", props: { ...props, label: "", min: 0, max: 100, step: 1, defaultValue: 50, disabled: false } }),
|
|
585
|
+
TabContainer: props => ({ type: "TabContainer", props: { ...props, defaultActiveKey: "home" } }),
|
|
586
|
+
TabContent: props => ({ type: "TabContent", props }),
|
|
587
|
+
TabPane: props => ({ type: "TabPane", props: { ...props, eventKey: props.id } }),
|
|
588
|
+
Navbar: (props) => ({ type: "Navbar", props: { ...props, expand: 'lg' } }),
|
|
589
|
+
NavbarBrand: (props) => ({ type: "NavbarBrand", props: { ...props, text: 'Navbar', href: '#', active: false, disabled: false } }),
|
|
590
|
+
NavbarToggle: (props) => ({ type: "NavbarToggle", props: { ...props, } }),
|
|
591
|
+
NavbarCollapse: (props) => ({ type: "NavbarCollapse", props: { ...props, } }),
|
|
592
|
+
Nav: (props) => ({ type: "Nav", props: { ...props, navbar: false, vertical: false } }),
|
|
593
|
+
NavLink: (props) => ({ type: "NavLink", props: { ...props, text: 'Link', href: '#', active: false, disabled: false } }),
|
|
594
|
+
Pagination: (props) => ({ type: "Pagination", props: { ...props, } }),
|
|
595
|
+
PaginationItem: (props) => ({ type: "PaginationItem", props: { ...props, text: '1', active: false, disabled: false } }),
|
|
596
|
+
InputGroup: (props) => ({ type: "InputGroup", props: { ...props, } }),
|
|
597
|
+
InputGroupText: (props) => ({ type: "InputGroupText", props: { ...props, text: '@', format: 'plain' } }),
|
|
598
|
+
ProgressGroup: (props) => ({ type: "ProgressGroup", props: { ...props, } }),
|
|
599
|
+
DropdownDivider: (props) => ({ type: "DropdownDivider", props: { ...props, } }),
|
|
600
|
+
DropdownHeader: (props) => ({ type: "DropdownHeader", props: { ...props, text: 'Dropdown header', format: 'plain' } }),
|
|
601
|
+
"Group": (props, _id) => ({ type: "Group", props: { ...props, element: "div" } }),
|
|
602
|
+
"Ratio": (props, _id) => ({ type: "Ratio", props: { ...props, aspectRatio: "16x9" } }),
|
|
603
|
+
"Accordion": (props, _id) => ({
|
|
604
|
+
type: "Accordion",
|
|
605
|
+
props: {
|
|
606
|
+
...props,
|
|
607
|
+
alwaysOpen: false,
|
|
608
|
+
flush: false,
|
|
609
|
+
defaultActiveKey: "",
|
|
610
|
+
},
|
|
611
|
+
}),
|
|
612
|
+
"AccordionItem": (props, _id) => ({
|
|
613
|
+
type: "AccordionItem",
|
|
614
|
+
props: { ...props, eventKey: _id, title: "Section" },
|
|
615
|
+
}),
|
|
616
|
+
"Tabs": (props, _id) => ({
|
|
617
|
+
type: "Tabs",
|
|
618
|
+
props: {
|
|
619
|
+
...props,
|
|
620
|
+
defaultActiveKey: "",
|
|
621
|
+
variant: "tabs",
|
|
622
|
+
fill: false,
|
|
623
|
+
justify: false,
|
|
624
|
+
},
|
|
625
|
+
}),
|
|
626
|
+
"Tab": (props, _id) => ({
|
|
627
|
+
type: "Tab",
|
|
628
|
+
props: {
|
|
629
|
+
...props,
|
|
630
|
+
eventKey: _id,
|
|
631
|
+
title: "Tab",
|
|
632
|
+
disabled: false,
|
|
633
|
+
},
|
|
634
|
+
}),
|
|
635
|
+
"Button": (props, _id) => ({
|
|
636
|
+
type: "Button",
|
|
637
|
+
props: {
|
|
638
|
+
...props,
|
|
639
|
+
text: "Button",
|
|
640
|
+
variant: "primary",
|
|
641
|
+
outline: false,
|
|
642
|
+
disabled: false,
|
|
643
|
+
action: "none",
|
|
644
|
+
newWindow: false,
|
|
645
|
+
},
|
|
646
|
+
}),
|
|
647
|
+
"ButtonGroup": (props, _id) => ({
|
|
648
|
+
type: "ButtonGroup",
|
|
649
|
+
props: { ...props, vertical: false, ariaLabel: "Button group" },
|
|
650
|
+
}),
|
|
651
|
+
"Reveal": (props, _id) => ({ type: "Reveal", props: { ...props, defaultOpen: false } }),
|
|
652
|
+
"Tooltip": (props, _id) => ({
|
|
653
|
+
type: "Tooltip",
|
|
654
|
+
props: { ...props, text: "More information", placement: "top" },
|
|
655
|
+
}),
|
|
656
|
+
"Popover": (props, _id) => ({
|
|
657
|
+
type: "Popover",
|
|
658
|
+
props: {
|
|
659
|
+
...props,
|
|
660
|
+
title: "More information",
|
|
661
|
+
text: "Details",
|
|
662
|
+
placement: "end",
|
|
663
|
+
},
|
|
664
|
+
}),
|
|
665
|
+
"Carousel": (props, _id) => ({
|
|
666
|
+
type: "Carousel",
|
|
667
|
+
props: {
|
|
668
|
+
...props,
|
|
669
|
+
controls: true,
|
|
670
|
+
indicators: true,
|
|
671
|
+
fade: false,
|
|
672
|
+
interval: 0,
|
|
673
|
+
defaultActiveKey: "",
|
|
674
|
+
},
|
|
675
|
+
}),
|
|
676
|
+
"CarouselItem": (props, _id) => ({
|
|
677
|
+
type: "CarouselItem",
|
|
678
|
+
props: { ...props, eventKey: _id, title: "", caption: "" },
|
|
679
|
+
}),
|
|
680
|
+
"Progress": (props, _id) => ({
|
|
681
|
+
type: "Progress",
|
|
682
|
+
props: {
|
|
683
|
+
...props,
|
|
684
|
+
value: 0,
|
|
685
|
+
min: 0,
|
|
686
|
+
max: 100,
|
|
687
|
+
label: "",
|
|
688
|
+
variant: "primary",
|
|
689
|
+
striped: false,
|
|
690
|
+
animated: false,
|
|
691
|
+
},
|
|
692
|
+
}),
|
|
693
|
+
"Modal": (props, _id) => ({
|
|
694
|
+
type: "Modal",
|
|
695
|
+
props: {
|
|
696
|
+
...props,
|
|
697
|
+
title: "Dialog",
|
|
698
|
+
defaultOpen: false,
|
|
699
|
+
size: "lg",
|
|
700
|
+
centered: true,
|
|
701
|
+
scrollable: true,
|
|
702
|
+
closeButton: true,
|
|
703
|
+
},
|
|
704
|
+
}),
|
|
705
|
+
"Offcanvas": (props, _id) => ({
|
|
706
|
+
type: "Offcanvas",
|
|
707
|
+
props: {
|
|
708
|
+
...props,
|
|
709
|
+
title: "Details",
|
|
710
|
+
defaultOpen: false,
|
|
711
|
+
placement: "end",
|
|
712
|
+
backdrop: true,
|
|
713
|
+
closeButton: true,
|
|
714
|
+
},
|
|
715
|
+
}),
|
|
716
|
+
"Dropdown": (props, _id) => ({
|
|
717
|
+
type: "Dropdown",
|
|
718
|
+
props: { ...props, text: "Options", variant: "secondary" },
|
|
719
|
+
}),
|
|
720
|
+
"DropdownItem": (props, _id) => ({
|
|
721
|
+
type: "DropdownItem",
|
|
722
|
+
props: {
|
|
723
|
+
...props,
|
|
724
|
+
text: "Option",
|
|
725
|
+
variant: "primary",
|
|
726
|
+
outline: false,
|
|
727
|
+
disabled: false,
|
|
728
|
+
action: "none",
|
|
729
|
+
newWindow: false,
|
|
730
|
+
},
|
|
731
|
+
}),
|
|
732
|
+
"Toast": (props, _id) => ({
|
|
733
|
+
type: "Toast",
|
|
734
|
+
props: {
|
|
735
|
+
...props,
|
|
736
|
+
title: "Notification",
|
|
737
|
+
defaultOpen: true,
|
|
738
|
+
autohide: false,
|
|
739
|
+
delay: 5000,
|
|
740
|
+
},
|
|
741
|
+
}),
|
|
742
|
+
"PracticeInput": (props, _id) => ({
|
|
743
|
+
type: "PracticeInput",
|
|
744
|
+
props: {
|
|
745
|
+
...props,
|
|
746
|
+
label: "Your response",
|
|
747
|
+
type: "text",
|
|
748
|
+
placeholder: "",
|
|
749
|
+
defaultValue: "",
|
|
750
|
+
required: false,
|
|
751
|
+
disabled: false,
|
|
752
|
+
},
|
|
753
|
+
}),
|
|
754
|
+
"PracticeSelect": (props, _id) => ({
|
|
755
|
+
type: "PracticeSelect",
|
|
756
|
+
props: {
|
|
757
|
+
...props,
|
|
758
|
+
label: "Choose an answer",
|
|
759
|
+
options: [],
|
|
760
|
+
defaultValue: "",
|
|
761
|
+
required: false,
|
|
762
|
+
disabled: false,
|
|
763
|
+
},
|
|
764
|
+
}),
|
|
765
|
+
"PracticeCheck": (props, _id) => ({
|
|
766
|
+
type: "PracticeCheck",
|
|
767
|
+
props: {
|
|
768
|
+
...props,
|
|
769
|
+
label: "Your choice",
|
|
770
|
+
type: "checkbox",
|
|
771
|
+
defaultChecked: false,
|
|
772
|
+
disabled: false,
|
|
773
|
+
name: "",
|
|
774
|
+
},
|
|
775
|
+
}),
|
|
776
|
+
"PracticeRange": (props, _id) => ({
|
|
777
|
+
type: "PracticeRange",
|
|
778
|
+
props: {
|
|
779
|
+
...props,
|
|
780
|
+
label: "Your rating",
|
|
781
|
+
min: 0,
|
|
782
|
+
max: 100,
|
|
783
|
+
step: 1,
|
|
784
|
+
defaultValue: 50,
|
|
785
|
+
disabled: false,
|
|
786
|
+
},
|
|
787
|
+
}),
|
|
788
|
+
"Breadcrumb": (props, _id) => ({ type: "Breadcrumb", props: { ...props } }),
|
|
789
|
+
"BreadcrumbItem": (props, _id) => ({
|
|
790
|
+
type: "BreadcrumbItem",
|
|
791
|
+
props: { ...props, text: "Location", active: false },
|
|
792
|
+
}),
|
|
793
|
+
"Video": (props, _id) => ({
|
|
794
|
+
type: "Video",
|
|
795
|
+
props: {
|
|
796
|
+
...props,
|
|
797
|
+
src: "",
|
|
798
|
+
poster: "",
|
|
799
|
+
captionsSrc: "",
|
|
800
|
+
captionsLanguage: "en",
|
|
801
|
+
captionsLabel: "Captions",
|
|
802
|
+
controls: true,
|
|
803
|
+
autoPlay: false,
|
|
804
|
+
muted: false,
|
|
805
|
+
loop: false,
|
|
806
|
+
},
|
|
807
|
+
}),
|
|
808
|
+
"Audio": (props, _id) => ({
|
|
809
|
+
type: "Audio",
|
|
810
|
+
props: {
|
|
811
|
+
...props,
|
|
812
|
+
captionsSrc: "",
|
|
813
|
+
captionsLanguage: "en",
|
|
814
|
+
captionsLabel: "Captions",
|
|
815
|
+
src: "",
|
|
816
|
+
controls: true,
|
|
817
|
+
autoPlay: false,
|
|
818
|
+
muted: false,
|
|
819
|
+
loop: false,
|
|
820
|
+
},
|
|
821
|
+
}),
|
|
822
|
+
"Embed": (props, _id) => ({
|
|
823
|
+
type: "Embed",
|
|
824
|
+
props: {
|
|
825
|
+
...props,
|
|
826
|
+
src: "",
|
|
827
|
+
title: "Embedded content",
|
|
828
|
+
allowFullScreen: true,
|
|
829
|
+
},
|
|
830
|
+
}),
|
|
831
|
+
"Container": (props, _id) => ({ type: "Container", props: { ...props, fluid: false, padding: 3 } }),
|
|
832
|
+
"Text": (props, _id) => ({
|
|
833
|
+
type: "Text",
|
|
834
|
+
props: {
|
|
835
|
+
...props,
|
|
836
|
+
text: "Text",
|
|
837
|
+
element: "p",
|
|
838
|
+
format: "plain",
|
|
839
|
+
},
|
|
840
|
+
}),
|
|
841
|
+
"Table": (props, _id) => ({
|
|
842
|
+
type: "Table",
|
|
843
|
+
props: {
|
|
844
|
+
...props,
|
|
845
|
+
striped: false,
|
|
846
|
+
bordered: false,
|
|
847
|
+
hover: false,
|
|
848
|
+
responsive: true,
|
|
849
|
+
},
|
|
850
|
+
}),
|
|
851
|
+
"Stack": (props, _id) => ({
|
|
852
|
+
type: "Stack",
|
|
853
|
+
props: {
|
|
854
|
+
...props,
|
|
855
|
+
direction: "vertical",
|
|
856
|
+
gap: 3,
|
|
857
|
+
justify: "start",
|
|
858
|
+
align: "stretch",
|
|
859
|
+
wrap: true,
|
|
860
|
+
},
|
|
861
|
+
}),
|
|
862
|
+
"Divider": (props, _id) => ({ type: "Divider", props: { ...props, direction: "horizontal" } }),
|
|
863
|
+
"Alert": (props, _id) => ({ type: "Alert", props: { ...props, variant: "info" } }),
|
|
864
|
+
"ContentList": (props, _id) => ({
|
|
865
|
+
type: "ContentList",
|
|
866
|
+
props: {
|
|
867
|
+
...props,
|
|
868
|
+
ordered: false,
|
|
869
|
+
unstyled: false,
|
|
870
|
+
inline: false,
|
|
871
|
+
},
|
|
872
|
+
}),
|
|
873
|
+
"TableCell": (props, _id) => ({ type: "TableCell", props: { ...props, colSpan: 1, rowSpan: 1 } }),
|
|
874
|
+
"TableHeader": (props, _id) => ({
|
|
875
|
+
type: "TableHeader",
|
|
876
|
+
props: { ...props, colSpan: 1, rowSpan: 1, scope: "col" },
|
|
877
|
+
}),
|
|
878
|
+
"Badge": (props, _id) => ({
|
|
879
|
+
type: "Badge",
|
|
880
|
+
props: {
|
|
881
|
+
...props,
|
|
882
|
+
text: "Label",
|
|
883
|
+
variant: "primary",
|
|
884
|
+
pill: false,
|
|
885
|
+
element: "span",
|
|
886
|
+
},
|
|
887
|
+
}),
|
|
888
|
+
"Indicator": (props, _id) => ({
|
|
889
|
+
type: "Indicator",
|
|
890
|
+
props: {
|
|
891
|
+
...props,
|
|
892
|
+
text: "Label",
|
|
893
|
+
variant: "primary",
|
|
894
|
+
pill: false,
|
|
895
|
+
element: "span",
|
|
896
|
+
},
|
|
897
|
+
}),
|
|
898
|
+
"ListGroup": (props, _id) => ({
|
|
899
|
+
type: "ListGroup",
|
|
900
|
+
props: {
|
|
901
|
+
...props,
|
|
902
|
+
horizontal: false,
|
|
903
|
+
flush: false,
|
|
904
|
+
numbered: false,
|
|
905
|
+
},
|
|
906
|
+
}),
|
|
907
|
+
"ListGroupItem": (props, _id) => ({
|
|
908
|
+
type: "ListGroupItem",
|
|
909
|
+
props: { ...props, active: false, disabled: false },
|
|
910
|
+
}),
|
|
911
|
+
"CardTitle": (props, _id) => ({
|
|
912
|
+
type: "CardTitle",
|
|
913
|
+
props: {
|
|
914
|
+
...props,
|
|
915
|
+
text: "Card title",
|
|
916
|
+
element: "h5",
|
|
917
|
+
format: "plain",
|
|
918
|
+
},
|
|
919
|
+
}),
|
|
920
|
+
"CardSubtitle": (props, _id) => ({
|
|
921
|
+
type: "CardSubtitle",
|
|
922
|
+
props: {
|
|
923
|
+
...props,
|
|
924
|
+
text: "Card subtitle",
|
|
925
|
+
element: "h6",
|
|
926
|
+
format: "plain",
|
|
927
|
+
},
|
|
928
|
+
}),
|
|
929
|
+
"CardText": (props, _id) => ({
|
|
930
|
+
type: "CardText",
|
|
931
|
+
props: { ...props, text: "Card text", format: "plain" },
|
|
932
|
+
}),
|
|
933
|
+
"CardLink": (props, _id) => ({
|
|
934
|
+
type: "CardLink",
|
|
935
|
+
props: { ...props, text: "Link", href: "https://example.com" },
|
|
936
|
+
}),
|
|
937
|
+
"CardImage": (props, _id) => ({
|
|
938
|
+
type: "CardImage",
|
|
939
|
+
props: { ...props, src: "", alt: "", position: "top" },
|
|
940
|
+
}),
|
|
941
|
+
"ContentListItem": (props, _id) => ({ type: "ContentListItem", props }),
|
|
942
|
+
"DescriptionList": (props, _id) => ({ type: "DescriptionList", props }),
|
|
943
|
+
"DescriptionTerm": (props, _id) => ({ type: "DescriptionTerm", props }),
|
|
944
|
+
"DescriptionDetails": (props, _id) => ({ type: "DescriptionDetails", props }),
|
|
945
|
+
"Figure": (props, _id) => ({ type: "Figure", props }),
|
|
946
|
+
"Blockquote": (props, _id) => ({ type: "Blockquote", props }),
|
|
947
|
+
"Figcaption": (props, _id) => ({ type: "Figcaption", props }),
|
|
948
|
+
"Cite": (props, _id) => ({ type: "Cite", props }),
|
|
949
|
+
"TableHead": (props, _id) => ({ type: "TableHead", props }),
|
|
950
|
+
"TableBody": (props, _id) => ({ type: "TableBody", props }),
|
|
951
|
+
"TableFoot": (props, _id) => ({ type: "TableFoot", props }),
|
|
952
|
+
"TableRow": (props, _id) => ({ type: "TableRow", props }),
|
|
953
|
+
"TableCaption": (props, _id) => ({ type: "TableCaption", props }),
|
|
954
|
+
"Card": (props, _id) => ({ type: "Card", props }),
|
|
955
|
+
"CardHeader": (props, _id) => ({ type: "CardHeader", props }),
|
|
956
|
+
"CardBody": (props, _id) => ({ type: "CardBody", props }),
|
|
957
|
+
"CardFooter": (props, _id) => ({ type: "CardFooter", props }),
|
|
958
|
+
"CardImageOverlay": (props, _id) => ({ type: "CardImageOverlay", props }),
|
|
959
|
+
"CardGroup": (props, _id) => ({ type: "CardGroup", props }),
|
|
960
|
+
};
|
|
961
|
+
export function createBootstrapBlock(type, id, parentId) {
|
|
962
|
+
if (!isBootstrapBlockType(type))
|
|
963
|
+
throw new TypeError(`Unsupported Bootstrap block type "${String(type)}". Choose a supported BootstrapBlockType.`);
|
|
964
|
+
const props = { id, ...(parentId ? { parentId } : {}) };
|
|
965
|
+
return BLOCK_FACTORIES[type](props, id);
|
|
966
|
+
}
|