@webiny/app-website-builder 6.6.0-alpha.0 → 6.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/BaseEditor/commandHandlers/CloneElement.d.ts +1 -0
  2. package/BaseEditor/commandHandlers/CloneElement.js +17 -0
  3. package/BaseEditor/commandHandlers/CloneElement.js.map +1 -0
  4. package/BaseEditor/commandHandlers/index.js +2 -1
  5. package/BaseEditor/commandHandlers/index.js.map +1 -1
  6. package/BaseEditor/commands.d.ts +3 -0
  7. package/BaseEditor/commands.js +2 -0
  8. package/BaseEditor/commands.js.map +1 -1
  9. package/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js +4 -1
  10. package/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js.map +1 -1
  11. package/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js.map +1 -1
  12. package/BaseEditor/defaultConfig/Content/Preview/Iframe.d.ts +2 -2
  13. package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlays.d.ts +2 -2
  14. package/BaseEditor/defaultConfig/DefaultEditorConfig.js +9 -0
  15. package/BaseEditor/defaultConfig/DefaultEditorConfig.js.map +1 -1
  16. package/BaseEditor/defaultConfig/DocumentStateEditor/DocumentStateEditor.d.ts +2 -2
  17. package/BaseEditor/defaultConfig/ElementInputRenderers.js +4 -0
  18. package/BaseEditor/defaultConfig/ElementInputRenderers.js.map +1 -1
  19. package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.d.ts +2 -0
  20. package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.js +25 -0
  21. package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.js.map +1 -0
  22. package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.d.ts +2 -0
  23. package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.js +26 -0
  24. package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.js.map +1 -0
  25. package/BaseEditor/defaultConfig/Sidebar/ElementPreview.js +12 -2
  26. package/BaseEditor/defaultConfig/Sidebar/ElementPreview.js.map +1 -1
  27. package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js +1 -6
  28. package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js.map +1 -1
  29. package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js +11 -2
  30. package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js.map +1 -1
  31. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundColor.d.ts +6 -2
  32. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundImage.d.ts +6 -2
  33. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundPosition.d.ts +6 -2
  34. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundScaling.d.ts +6 -2
  35. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderColor.d.ts +2 -2
  36. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderRadius.d.ts +2 -2
  37. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderStyle.d.ts +2 -2
  38. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderWidth.d.ts +2 -2
  39. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Layout/Alignment.d.ts +6 -2
  40. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Layout/LengthWithUnitInput.d.ts +2 -2
  41. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/MarginPadding/Margin.d.ts +2 -2
  42. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/MarginPadding/Padding.d.ts +2 -2
  43. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Visibility/Visibility.d.ts +2 -2
  44. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/StyleProperties.js +7 -7
  45. package/BaseEditor/defaultConfig/Sidebar/StyleSettings/StyleProperties.js.map +1 -1
  46. package/BaseEditor/defaultConfig/Toolbar/Navigator/Navigator.d.ts +2 -2
  47. package/DocumentEditor/DocumentEditor.d.ts +14 -5
  48. package/DocumentEditor/DocumentEditor.js +10 -6
  49. package/DocumentEditor/DocumentEditor.js.map +1 -1
  50. package/DocumentEditor/StateInspector.d.ts +4 -2
  51. package/Extension.js +7 -1
  52. package/Extension.js.map +1 -1
  53. package/ecommerce/components/ResourcePage.d.ts +6 -2
  54. package/ecommerce/components/ResourcesList.d.ts +4 -4
  55. package/ecommerce/components/ResourcesPicker.d.ts +9 -4
  56. package/editorSdk/CommandBus.js.map +1 -1
  57. package/editorSdk/utils/$cloneElement.d.ts +2 -0
  58. package/editorSdk/utils/$cloneElement.js +112 -0
  59. package/editorSdk/utils/$cloneElement.js.map +1 -0
  60. package/editorSdk/utils/index.d.ts +1 -0
  61. package/editorSdk/utils/index.js +1 -0
  62. package/features/experiments/ExperimentsGateway.d.ts +30 -0
  63. package/features/experiments/ExperimentsGateway.js +326 -0
  64. package/features/experiments/ExperimentsGateway.js.map +1 -0
  65. package/features/experiments/abstractions.d.ts +25 -0
  66. package/features/experiments/abstractions.js +5 -0
  67. package/features/experiments/abstractions.js.map +1 -0
  68. package/features/experiments/feature.d.ts +3 -0
  69. package/features/experiments/feature.js +17 -0
  70. package/features/experiments/feature.js.map +1 -0
  71. package/features/experiments/index.d.ts +3 -0
  72. package/features/experiments/index.js +2 -0
  73. package/features/experiments/types.d.ts +61 -0
  74. package/features/experiments/types.js +0 -0
  75. package/inputRenderers/ColorPickerInput.d.ts +3 -0
  76. package/inputRenderers/ColorPickerInput.js +29 -0
  77. package/inputRenderers/ColorPickerInput.js.map +1 -0
  78. package/inputRenderers/FileInput.js +93 -8
  79. package/inputRenderers/FileInput.js.map +1 -1
  80. package/inputRenderers/LexicalInput/LexicalEditor.js +15 -8
  81. package/inputRenderers/LexicalInput/LexicalEditor.js.map +1 -1
  82. package/inputRenderers/LexicalInput/TypographyDropDown.js +3 -2
  83. package/inputRenderers/LexicalInput/TypographyDropDown.js.map +1 -1
  84. package/inputRenderers/LexicalInput/wbStaticToolbar.css +72 -103
  85. package/modules/AbTesting.d.ts +2 -0
  86. package/modules/AbTesting.js +19 -0
  87. package/modules/AbTesting.js.map +1 -0
  88. package/package.json +28 -28
  89. package/presentation/components/LanguageCodeTag.js +5 -4
  90. package/presentation/components/LanguageCodeTag.js.map +1 -1
  91. package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.d.ts +30 -0
  92. package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.js +202 -0
  93. package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.js.map +1 -0
  94. package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.d.ts +65 -0
  95. package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.js +5 -0
  96. package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.js.map +1 -0
  97. package/presentation/experiments/ExperimentForm/components/ExperimentFormView.d.ts +12 -0
  98. package/presentation/experiments/ExperimentForm/components/ExperimentFormView.js +149 -0
  99. package/presentation/experiments/ExperimentForm/components/ExperimentFormView.js.map +1 -0
  100. package/presentation/experiments/ExperimentForm/components/VariantSplitRow.d.ts +17 -0
  101. package/presentation/experiments/ExperimentForm/components/VariantSplitRow.js +122 -0
  102. package/presentation/experiments/ExperimentForm/components/VariantSplitRow.js.map +1 -0
  103. package/presentation/experiments/ExperimentForm/feature.d.ts +3 -0
  104. package/presentation/experiments/ExperimentForm/feature.js +17 -0
  105. package/presentation/experiments/ExperimentForm/feature.js.map +1 -0
  106. package/presentation/experiments/ExperimentForm/index.d.ts +3 -0
  107. package/presentation/experiments/ExperimentForm/index.js +3 -0
  108. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.d.ts +18 -0
  109. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.js +25 -0
  110. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.js.map +1 -0
  111. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.d.ts +67 -0
  112. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.js +224 -0
  113. package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.js.map +1 -0
  114. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.d.ts +10 -0
  115. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.js +5 -0
  116. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.js.map +1 -0
  117. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.d.ts +58 -0
  118. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.js +5 -0
  119. package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.js.map +1 -0
  120. package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.d.ts +15 -0
  121. package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.js +110 -0
  122. package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.js.map +1 -0
  123. package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.d.ts +9 -0
  124. package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.js +178 -0
  125. package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.js.map +1 -0
  126. package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.d.ts +11 -0
  127. package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.js +51 -0
  128. package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.js.map +1 -0
  129. package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.d.ts +14 -0
  130. package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.js +147 -0
  131. package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.js.map +1 -0
  132. package/presentation/experiments/ExperimentsEditor/feature.d.ts +3 -0
  133. package/presentation/experiments/ExperimentsEditor/feature.js +21 -0
  134. package/presentation/experiments/ExperimentsEditor/feature.js.map +1 -0
  135. package/presentation/experiments/ExperimentsEditor/index.d.ts +4 -0
  136. package/presentation/experiments/ExperimentsEditor/index.js +3 -0
  137. package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.d.ts +39 -0
  138. package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.js +219 -0
  139. package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.js.map +1 -0
  140. package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.d.ts +52 -0
  141. package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.js +5 -0
  142. package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.js.map +1 -0
  143. package/presentation/experiments/ExperimentsManager/components/ExperimentCard.d.ts +10 -0
  144. package/presentation/experiments/ExperimentsManager/components/ExperimentCard.js +296 -0
  145. package/presentation/experiments/ExperimentsManager/components/ExperimentCard.js.map +1 -0
  146. package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.d.ts +2 -0
  147. package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.js +92 -0
  148. package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.js.map +1 -0
  149. package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.d.ts +6 -0
  150. package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.js +103 -0
  151. package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.js.map +1 -0
  152. package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.d.ts +9 -0
  153. package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.js +58 -0
  154. package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.js.map +1 -0
  155. package/presentation/experiments/ExperimentsManager/feature.d.ts +3 -0
  156. package/presentation/experiments/ExperimentsManager/feature.js +17 -0
  157. package/presentation/experiments/ExperimentsManager/feature.js.map +1 -0
  158. package/presentation/experiments/ExperimentsManager/index.d.ts +4 -0
  159. package/presentation/experiments/ExperimentsManager/index.js +3 -0
  160. package/presentation/experiments/VariantPageEditorConfig.d.ts +7 -0
  161. package/presentation/experiments/VariantPageEditorConfig.js +26 -0
  162. package/presentation/experiments/VariantPageEditorConfig.js.map +1 -0
  163. package/presentation/experiments/config/ExperimentsEditorConfig.d.ts +8 -0
  164. package/presentation/experiments/config/ExperimentsEditorConfig.js +21 -0
  165. package/presentation/experiments/config/ExperimentsEditorConfig.js.map +1 -0
  166. package/presentation/experiments/config/VariantAutoSave.d.ts +5 -0
  167. package/presentation/experiments/config/VariantAutoSave.js +41 -0
  168. package/presentation/experiments/config/VariantAutoSave.js.map +1 -0
  169. package/presentation/experiments/shared/variantColors.d.ts +11 -0
  170. package/presentation/experiments/shared/variantColors.js +13 -0
  171. package/presentation/experiments/shared/variantColors.js.map +1 -0
  172. package/presentation/experiments/shared/variantDocument.d.ts +16 -0
  173. package/presentation/experiments/shared/variantDocument.js +31 -0
  174. package/presentation/experiments/shared/variantDocument.js.map +1 -0
  175. package/presentation/navigation/Extension.js +9 -5
  176. package/presentation/navigation/Extension.js.map +1 -1
  177. package/presentation/navigation/NextjsConfig/NextjsConfigDialog.d.ts +2 -2
  178. package/presentation/navigation/StarterKitConfigDialog.js +1 -1
  179. package/presentation/navigation/StarterKitConfigDialog.js.map +1 -1
  180. package/presentation/pages/CreatePage/CreatePageDialog.d.ts +2 -2
  181. package/presentation/pages/CreatePage/CreatePagePresenter.js +1 -1
  182. package/presentation/pages/CreatePage/CreatePagePresenter.js.map +1 -1
  183. package/presentation/pages/CreatePage/WithLanguageSelector.js +3 -3
  184. package/presentation/pages/CreatePage/WithLanguageSelector.js.map +1 -1
  185. package/presentation/pages/CreatePage/feature.js +3 -3
  186. package/presentation/pages/CreatePage/feature.js.map +1 -1
  187. package/presentation/pages/PageEditor/PageEditor.experiments.d.ts +2 -0
  188. package/presentation/pages/PageEditor/PageEditor.experiments.js +54 -0
  189. package/presentation/pages/PageEditor/PageEditor.experiments.js.map +1 -0
  190. package/presentation/pages/PageEditor/PageEditorSurface.d.ts +15 -0
  191. package/presentation/pages/PageEditor/PageEditorSurface.js +63 -0
  192. package/presentation/pages/PageEditor/PageEditorSurface.js.map +1 -0
  193. package/presentation/pages/PageEditor/TopBar/PageSettingsDrawer.d.ts +2 -2
  194. package/presentation/pages/PageEditor/pageDocument.d.ts +4 -0
  195. package/presentation/pages/PageEditor/pageDocument.js +15 -0
  196. package/presentation/pages/PageEditor/pageDocument.js.map +1 -0
  197. package/presentation/pages/PageList/components/BulkActions/BulkActionDelete.d.ts +2 -2
  198. package/presentation/pages/PageList/components/BulkActions/BulkActionDuplicate.d.ts +2 -2
  199. package/presentation/pages/PageList/components/BulkActions/BulkActionMovePage.d.ts +2 -2
  200. package/presentation/pages/PageList/components/BulkActions/BulkActionPublish.d.ts +2 -2
  201. package/presentation/pages/PageList/components/BulkActions/BulkActionUnpublish.d.ts +2 -2
  202. package/presentation/pages/PageList/components/DocumentList.d.ts +2 -2
  203. package/presentation/pages/PageList/components/PagesList.js +2 -1
  204. package/presentation/pages/PageList/components/PagesList.js.map +1 -1
  205. package/presentation/pages/PageList/components/Table/Table.d.ts +2 -2
  206. package/presentation/pages/PageList/components/WbPagesBreadcrumbs.d.ts +9 -0
  207. package/presentation/pages/PageList/components/WbPagesBreadcrumbs.js +40 -0
  208. package/presentation/pages/PageList/components/WbPagesBreadcrumbs.js.map +1 -0
  209. package/presentation/pages/TranslatePage/TranslatePageConfig.d.ts +1 -1
  210. package/presentation/pages/TranslatePage/TranslatePageConfig.js +6 -2
  211. package/presentation/pages/TranslatePage/TranslatePageConfig.js.map +1 -1
  212. package/presentation/pages/TranslatePage/TranslatePageDialog.js +22 -10
  213. package/presentation/pages/TranslatePage/TranslatePageDialog.js.map +1 -1
  214. package/presentation/pages/TranslatePage/translatePageSchema.d.ts +1 -1
  215. package/presentation/pages/TranslatePage/translatePageSchema.js +1 -1
  216. package/presentation/pages/TranslatePage/translatePageSchema.js.map +1 -1
  217. package/presentation/pages/TrashBin/WbTrashBin.d.ts +2 -2
  218. package/presentation/redirects/RedirectList/components/BulkActionDelete.d.ts +2 -2
  219. package/presentation/redirects/RedirectList/components/BulkActionMove.d.ts +2 -2
  220. package/presentation/redirects/RedirectList/components/CreateRedirectDialog.d.ts +2 -2
  221. package/presentation/redirects/RedirectList/components/DocumentList.d.ts +2 -2
  222. package/presentation/redirects/RedirectList/components/EditRedirectDialog.d.ts +2 -2
  223. package/presentation/redirects/RedirectList/components/Table/Table.d.ts +2 -2
  224. package/shared/fileManagerItemToValue.d.ts +8 -9
  225. package/shared/fileManagerItemToValue.js +22 -7
  226. package/shared/fileManagerItemToValue.js.map +1 -1
  227. package/inputRenderers/LexicalInput/icons/list-ol.js +0 -20
  228. package/inputRenderers/LexicalInput/icons/list-ol.js.map +0 -1
  229. package/inputRenderers/LexicalInput/icons/list-ol.svg +0 -1
  230. package/inputRenderers/LexicalInput/icons/list-ul.js +0 -18
  231. package/inputRenderers/LexicalInput/icons/list-ul.js.map +0 -1
  232. package/inputRenderers/LexicalInput/icons/list-ul.svg +0 -1
  233. package/static/svg/list-ol.d64946f3.svg +0 -1
  234. package/static/svg/list-ul.1d54da3f.svg +0 -1
@@ -1,15 +1,41 @@
1
- import react from "react";
2
- import { FilePicker } from "@webiny/admin-ui";
1
+ import react, { useState } from "react";
2
+ import { FilePicker, ImageEditor, RichItemPreview, getCroppedImageRenderStyles } from "@webiny/admin-ui";
3
3
  import { FileManager } from "@webiny/app-admin";
4
4
  import { useBreakpoint } from "../BaseEditor/hooks/useBreakpoint.js";
5
+ import { getAssetCropParam, normalizeToAsset } from "@webiny/website-builder-sdk";
5
6
  import { fileManagerItemToValue } from "../shared/fileManagerItemToValue.js";
7
+ const isEditableImage = (asset)=>!!asset?.src && "string" == typeof asset.type && asset.type.startsWith("image/") && "image/svg+xml" !== asset.type;
8
+ const hasImageEdit = (image)=>{
9
+ if (!image?.width || !image?.height) return false;
10
+ const c = image.crop;
11
+ const fullCrop = !c || 0 === c.top && 0 === c.left && 0 === c.bottom && 0 === c.right;
12
+ const fp = image.focalPoint;
13
+ const centeredFocal = !fp || 0.5 === fp.x && 0.5 === fp.y;
14
+ return !fullCrop || !centeredFocal;
15
+ };
16
+ const toEditorValue = (image)=>{
17
+ if (!image) return;
18
+ return {
19
+ crop: image.crop,
20
+ hotspot: image.focalPoint ? {
21
+ x: image.focalPoint.x,
22
+ y: image.focalPoint.y,
23
+ width: 1,
24
+ height: 1
25
+ } : void 0,
26
+ alt: image.alt,
27
+ caption: image.caption
28
+ };
29
+ };
6
30
  const FileInputRenderer = ({ value, onChange, label, ...props })=>{
7
31
  const input = props.input;
8
32
  const { isBaseBreakpoint } = useBreakpoint();
33
+ const [editorOpen, setEditorOpen] = useState(false);
34
+ const asset = normalizeToAsset(value) ?? void 0;
35
+ const editable = isEditableImage(asset);
9
36
  const onFileChange = (file)=>{
10
37
  onChange(({ value })=>{
11
- const newValue = fileManagerItemToValue(file);
12
- value.set(newValue);
38
+ value.set(fileManagerItemToValue(file));
13
39
  });
14
40
  };
15
41
  const onRemove = ()=>{
@@ -18,19 +44,78 @@ const FileInputRenderer = ({ value, onChange, label, ...props })=>{
18
44
  else value.set(null);
19
45
  });
20
46
  };
47
+ const onSaveEdit = (edit)=>{
48
+ onChange(({ value })=>{
49
+ if (!asset) return;
50
+ const image = {
51
+ width: asset.image?.width,
52
+ height: asset.image?.height,
53
+ crop: edit.crop,
54
+ focalPoint: edit.hotspot ? {
55
+ x: edit.hotspot.x,
56
+ y: edit.hotspot.y
57
+ } : void 0,
58
+ alt: edit.alt,
59
+ caption: edit.caption
60
+ };
61
+ const updated = {
62
+ ...asset,
63
+ image
64
+ };
65
+ const cropParam = getAssetCropParam(updated);
66
+ if (cropParam) {
67
+ const sep = asset.src.includes("?") ? "&" : "?";
68
+ updated.url = `${asset.src}${sep}crop=${cropParam}`;
69
+ } else updated.url = asset.src;
70
+ value.set(updated);
71
+ });
72
+ };
21
73
  return /*#__PURE__*/ react.createElement(FileManager, {
22
74
  accept: input.allowedFileTypes,
23
75
  onChange: onFileChange,
24
- render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(FilePicker, {
76
+ render: ({ showFileManager })=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(FilePicker, {
25
77
  variant: "secondary",
26
78
  label: label,
27
79
  description: input.description,
28
80
  type: "compact",
29
- value: value,
81
+ value: asset?.src,
82
+ renderFilePreview: editable && asset?.src && hasImageEdit(asset.image) ? (previewProps)=>/*#__PURE__*/ react.createElement(RichItemPreview, {
83
+ ...previewProps,
84
+ renderImage: ({ name })=>{
85
+ const { wrapper, image } = getCroppedImageRenderStyles(asset.image?.width ?? 0, asset.image?.height ?? 0, asset.image?.crop, asset.image?.focalPoint ? {
86
+ x: asset.image.focalPoint.x,
87
+ y: asset.image.focalPoint.y,
88
+ width: 1,
89
+ height: 1
90
+ } : void 0, {
91
+ boxWidth: 1,
92
+ boxHeight: 1,
93
+ fit: "cover"
94
+ });
95
+ return /*#__PURE__*/ react.createElement("div", {
96
+ style: wrapper
97
+ }, /*#__PURE__*/ react.createElement("img", {
98
+ src: asset.src,
99
+ alt: name,
100
+ draggable: false,
101
+ style: image
102
+ }));
103
+ }
104
+ }) : void 0,
30
105
  onSelectItem: ()=>showFileManager(),
31
106
  onRemoveItem: onRemove,
32
- onEditItem: ()=>showFileManager()
33
- })
107
+ onEditItem: editable ? ()=>setEditorOpen(true) : void 0
108
+ }), editable ? /*#__PURE__*/ react.createElement(ImageEditor, {
109
+ open: editorOpen,
110
+ onClose: ()=>setEditorOpen(false),
111
+ image: {
112
+ src: asset.src,
113
+ width: asset.image?.width ?? 0,
114
+ height: asset.image?.height ?? 0
115
+ },
116
+ value: toEditorValue(asset.image),
117
+ onSave: onSaveEdit
118
+ }) : null)
34
119
  });
35
120
  };
36
121
  export { FileInputRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"inputRenderers/FileInput.js","sources":["../../src/inputRenderers/FileInput.tsx"],"sourcesContent":["import React from \"react\";\nimport { FilePicker } from \"@webiny/admin-ui\";\nimport type { ElementInputRendererProps } from \"~/BaseEditor/index.js\";\nimport { FileManager, type FileManagerFileItem } from \"@webiny/app-admin\";\nimport { useBreakpoint } from \"~/BaseEditor/hooks/useBreakpoint.js\";\nimport type { FileInput } from \"@webiny/website-builder-sdk\";\nimport { fileManagerItemToValue } from \"~/shared/fileManagerItemToValue.js\";\n\nexport const FileInputRenderer = ({\n value,\n onChange,\n label,\n ...props\n}: ElementInputRendererProps) => {\n const input = props.input as FileInput;\n const { isBaseBreakpoint } = useBreakpoint();\n\n const onFileChange = (file: FileManagerFileItem) => {\n onChange(({ value }) => {\n const newValue = fileManagerItemToValue(file);\n value.set(newValue);\n });\n };\n\n const onRemove = () => {\n onChange(({ value }) => {\n if (isBaseBreakpoint) {\n value.set(undefined);\n } else {\n value.set(null);\n }\n });\n };\n\n return (\n <FileManager\n accept={input.allowedFileTypes}\n onChange={onFileChange}\n render={({ showFileManager }) => (\n <FilePicker\n variant={\"secondary\"}\n label={label}\n description={input.description}\n type=\"compact\"\n value={value}\n onSelectItem={() => showFileManager()}\n onRemoveItem={onRemove}\n onEditItem={() => showFileManager()}\n />\n )}\n />\n );\n};\n"],"names":["FileInputRenderer","value","onChange","label","props","input","isBaseBreakpoint","useBreakpoint","onFileChange","file","newValue","fileManagerItemToValue","onRemove","undefined","FileManager","showFileManager","FilePicker"],"mappings":";;;;;AAQO,MAAMA,oBAAoB,CAAC,EAC9BC,KAAK,EACLC,QAAQ,EACRC,KAAK,EACL,GAAGC,OACqB;IACxB,MAAMC,QAAQD,MAAM,KAAK;IACzB,MAAM,EAAEE,gBAAgB,EAAE,GAAGC;IAE7B,MAAMC,eAAe,CAACC;QAClBP,SAAS,CAAC,EAAED,KAAK,EAAE;YACf,MAAMS,WAAWC,uBAAuBF;YACxCR,MAAM,GAAG,CAACS;QACd;IACJ;IAEA,MAAME,WAAW;QACbV,SAAS,CAAC,EAAED,KAAK,EAAE;YACf,IAAIK,kBACAL,MAAM,GAAG,CAACY;iBAEVZ,MAAM,GAAG,CAAC;QAElB;IACJ;IAEA,OAAO,WAAP,GACI,oBAACa,aAAWA;QACR,QAAQT,MAAM,gBAAgB;QAC9B,UAAUG;QACV,QAAQ,CAAC,EAAEO,eAAe,EAAE,iBACxB,oBAACC,YAAUA;gBACP,SAAS;gBACT,OAAOb;gBACP,aAAaE,MAAM,WAAW;gBAC9B,MAAK;gBACL,OAAOJ;gBACP,cAAc,IAAMc;gBACpB,cAAcH;gBACd,YAAY,IAAMG;;;AAKtC"}
1
+ {"version":3,"file":"inputRenderers/FileInput.js","sources":["../../src/inputRenderers/FileInput.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport {\n FilePicker,\n ImageEditor,\n RichItemPreview,\n getCroppedImageRenderStyles,\n type ImageEditorValue\n} from \"@webiny/admin-ui\";\nimport type { ElementInputRendererProps } from \"~/BaseEditor/index.js\";\nimport { FileManager, type FileManagerFileItem } from \"@webiny/app-admin\";\nimport { useBreakpoint } from \"~/BaseEditor/hooks/useBreakpoint.js\";\nimport {\n normalizeToAsset,\n getAssetCropParam,\n type Asset,\n type AssetImage\n} from \"@webiny/website-builder-sdk\";\nimport type { FileInput } from \"@webiny/website-builder-sdk\";\nimport { fileManagerItemToValue } from \"~/shared/fileManagerItemToValue.js\";\n\nconst isEditableImage = (asset: Asset | undefined): asset is Asset => {\n return (\n !!asset?.src &&\n typeof asset.type === \"string\" &&\n asset.type.startsWith(\"image/\") &&\n asset.type !== \"image/svg+xml\"\n );\n};\n\n/** True when the image carries a non-trivial crop or focal point worth previewing. */\nconst hasImageEdit = (image: AssetImage | undefined): boolean => {\n if (!image?.width || !image?.height) {\n return false;\n }\n const c = image.crop;\n const fullCrop = !c || (c.top === 0 && c.left === 0 && c.bottom === 0 && c.right === 0);\n const fp = image.focalPoint;\n const centeredFocal = !fp || (fp.x === 0.5 && fp.y === 0.5);\n return !fullCrop || !centeredFocal;\n};\n\n/** Map the stored asset image into the shared `ImageEditor` value (focalPoint → hotspot). */\nconst toEditorValue = (image: AssetImage | undefined): ImageEditorValue | undefined => {\n if (!image) {\n return undefined;\n }\n return {\n crop: image.crop,\n hotspot: image.focalPoint\n ? { x: image.focalPoint.x, y: image.focalPoint.y, width: 1, height: 1 }\n : undefined,\n alt: image.alt,\n caption: image.caption\n };\n};\n\nexport const FileInputRenderer = ({\n value,\n onChange,\n label,\n ...props\n}: ElementInputRendererProps) => {\n const input = props.input as FileInput;\n const { isBaseBreakpoint } = useBreakpoint();\n const [editorOpen, setEditorOpen] = useState(false);\n\n const asset = normalizeToAsset(value) ?? undefined;\n const editable = isEditableImage(asset);\n\n const onFileChange = (file: FileManagerFileItem) => {\n onChange(({ value }) => {\n value.set(fileManagerItemToValue(file));\n });\n };\n\n const onRemove = () => {\n onChange(({ value }) => {\n if (isBaseBreakpoint) {\n value.set(undefined);\n } else {\n value.set(null);\n }\n });\n };\n\n // Save the per-usage crop / focal point / alt override onto the element value,\n // writing the unified asset shape (hotspot → focalPoint).\n const onSaveEdit = (edit: ImageEditorValue) => {\n onChange(({ value }) => {\n if (!asset) {\n return;\n }\n const image: AssetImage = {\n width: asset.image?.width,\n height: asset.image?.height,\n crop: edit.crop,\n focalPoint: edit.hotspot ? { x: edit.hotspot.x, y: edit.hotspot.y } : undefined,\n alt: edit.alt,\n caption: edit.caption\n };\n const updated = { ...asset, image };\n const cropParam = getAssetCropParam(updated);\n if (cropParam) {\n const sep = asset.src.includes(\"?\") ? \"&\" : \"?\";\n updated.url = `${asset.src}${sep}crop=${cropParam}`;\n } else {\n updated.url = asset.src;\n }\n value.set(updated);\n });\n };\n\n return (\n <FileManager\n accept={input.allowedFileTypes}\n onChange={onFileChange}\n render={({ showFileManager }) => (\n <>\n <FilePicker\n variant={\"secondary\"}\n label={label}\n description={input.description}\n type=\"compact\"\n value={asset?.src}\n // Reflect the per-usage crop + focal point in the thumbnail.\n renderFilePreview={\n editable && asset?.src && hasImageEdit(asset.image)\n ? previewProps => (\n <RichItemPreview\n {...previewProps}\n renderImage={({ name }) => {\n const { wrapper, image } =\n getCroppedImageRenderStyles(\n asset.image?.width ?? 0,\n asset.image?.height ?? 0,\n asset.image?.crop,\n asset.image?.focalPoint\n ? {\n x: asset.image.focalPoint.x,\n y: asset.image.focalPoint.y,\n width: 1,\n height: 1\n }\n : undefined,\n { boxWidth: 1, boxHeight: 1, fit: \"cover\" }\n );\n return (\n <div style={wrapper}>\n <img\n src={asset.src as string}\n alt={name}\n draggable={false}\n style={image}\n />\n </div>\n );\n }}\n />\n )\n : undefined\n }\n onSelectItem={() => showFileManager()}\n onRemoveItem={onRemove}\n // The \"Edit\" (pencil) action edits the image (crop / focal\n // point / alt). Replacing the file is done by clicking the\n // preview. For non-images there is nothing to edit, so the\n // pencil is hidden.\n onEditItem={editable ? () => setEditorOpen(true) : undefined}\n />\n {editable ? (\n <ImageEditor\n open={editorOpen}\n onClose={() => setEditorOpen(false)}\n image={{\n src: asset.src,\n width: asset.image?.width ?? 0,\n height: asset.image?.height ?? 0\n }}\n value={toEditorValue(asset.image)}\n onSave={onSaveEdit}\n />\n ) : null}\n </>\n )}\n />\n );\n};\n"],"names":["isEditableImage","asset","hasImageEdit","image","c","fullCrop","fp","centeredFocal","toEditorValue","undefined","FileInputRenderer","value","onChange","label","props","input","isBaseBreakpoint","useBreakpoint","editorOpen","setEditorOpen","useState","normalizeToAsset","editable","onFileChange","file","fileManagerItemToValue","onRemove","onSaveEdit","edit","updated","cropParam","getAssetCropParam","sep","FileManager","showFileManager","FilePicker","previewProps","RichItemPreview","name","wrapper","getCroppedImageRenderStyles","ImageEditor"],"mappings":"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"}
@@ -1,35 +1,42 @@
1
1
  import react from "react";
2
- import { CompositionScope, LexicalEditor } from "@webiny/app-admin";
2
+ import { AdminConfig, CompositionScope, LexicalEditor } from "@webiny/app-admin";
3
3
  import { StaticToolbar } from "@webiny/lexical-editor";
4
4
  import { createLexicalTokens } from "@webiny/lexical-theme/createLexicalEditorTokens.js";
5
5
  import { useWebsiteBuilderTheme } from "../../BaseEditor/components/index.js";
6
6
  import "./wbStaticToolbar.css";
7
7
  const placeholderStyles = {
8
8
  position: "absolute",
9
- top: 40,
10
- left: 25
9
+ top: 0,
10
+ left: 0,
11
+ padding: "8px 12px",
12
+ marginTop: 0,
13
+ color: "var(--text-color-neutral-muted)"
11
14
  };
12
15
  const contentEditableStyles = {
13
16
  minHeight: 200,
14
17
  display: "block",
15
- padding: 10
18
+ padding: "8px 12px"
16
19
  };
17
20
  const styles = {
18
- backgroundColor: "#fff",
19
- border: "1px solid #e1e1e1",
20
- padding: "10px 14px",
21
+ backgroundColor: "var(--color-neutral-base)",
22
+ border: "1px solid var(--border-color-neutral-muted)",
23
+ borderTop: "none",
24
+ borderRadius: "0 0 var(--radius-md) var(--radius-md)",
21
25
  minHeight: 200,
22
26
  maxHeight: 350,
23
27
  fontFamily: "var(--wb-theme-font-family)"
24
28
  };
25
29
  const lexicalTokens = createLexicalTokens("wb-lx-");
30
+ const { useAdminConfig: useAdminConfig } = AdminConfig;
26
31
  const LexicalEditorComponent = (props)=>{
27
32
  const { theme } = useWebsiteBuilderTheme();
33
+ const { lexicalTheme } = useAdminConfig();
28
34
  const editorTheme = {
29
35
  colors: theme?.colors ?? [],
30
36
  typography: theme?.typography ?? {},
31
37
  fontSizes: theme?.fontSizes ?? [],
32
- tokens: lexicalTokens
38
+ tokens: lexicalTokens,
39
+ allowCustomColors: theme?.allowCustomColors ?? lexicalTheme.allowCustomColors
33
40
  };
34
41
  return /*#__PURE__*/ react.createElement(LexicalEditor, {
35
42
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"inputRenderers/LexicalInput/LexicalEditor.js","sources":["../../../src/inputRenderers/LexicalInput/LexicalEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { LexicalEditor as BaseLexicalEditor } from \"@webiny/app-admin\";\nimport { StaticToolbar } from \"@webiny/lexical-editor\";\nimport type { EditorTheme } from \"@webiny/lexical-theme\";\nimport { createLexicalTokens } from \"@webiny/lexical-theme/createLexicalEditorTokens.js\";\nimport { useWebsiteBuilderTheme } from \"~/BaseEditor/components/index.js\";\nimport \"./wbStaticToolbar.css\";\nimport { CompositionScope } from \"@webiny/app-admin\";\n\nconst placeholderStyles: React.CSSProperties = { position: \"absolute\", top: 40, left: 25 };\n\nconst contentEditableStyles: React.CSSProperties = {\n minHeight: 200,\n display: \"block\",\n padding: 10\n};\n\nconst styles: React.CSSProperties = {\n backgroundColor: \"#fff\",\n border: \"1px solid #e1e1e1\",\n padding: \"10px 14px\",\n minHeight: 200,\n maxHeight: 350,\n fontFamily: \"var(--wb-theme-font-family)\"\n};\n\nconst lexicalTokens = createLexicalTokens(\"wb-lx-\");\n\nexport type LexicalEditorProps = Omit<React.ComponentProps<typeof BaseLexicalEditor>, \"theme\">;\n\nconst LexicalEditorComponent = (props: LexicalEditorProps) => {\n const { theme } = useWebsiteBuilderTheme();\n\n const editorTheme: EditorTheme = {\n colors: theme?.colors ?? [],\n typography: theme?.typography ?? {},\n fontSizes: theme?.fontSizes ?? [],\n tokens: lexicalTokens\n };\n\n return (\n <BaseLexicalEditor\n {...props}\n staticToolbar={<StaticToolbar className={\"wb-static-toolbar\"} />}\n tag={\"p\"}\n placeholder={props?.placeholder || \"Enter your text here...\"}\n placeholderStyles={placeholderStyles}\n contentEditableStyles={contentEditableStyles}\n styles={styles}\n theme={editorTheme}\n />\n );\n};\n\nconst ExpandedLexicalEditor = (props: LexicalEditorProps) => {\n return (\n <CompositionScope name={\"expanded\"}>\n <LexicalEditorComponent {...props} />\n </CompositionScope>\n );\n};\n\nconst CompactLexicalEditor = (props: LexicalEditorProps) => {\n return (\n <CompositionScope name={\"compact\"}>\n <LexicalEditorComponent {...props} />\n </CompositionScope>\n );\n};\n\nexport const LexicalEditor = {\n Expanded: ExpandedLexicalEditor,\n Compact: CompactLexicalEditor\n};\n"],"names":["placeholderStyles","contentEditableStyles","styles","lexicalTokens","createLexicalTokens","LexicalEditorComponent","props","theme","useWebsiteBuilderTheme","editorTheme","BaseLexicalEditor","StaticToolbar","ExpandedLexicalEditor","CompositionScope","CompactLexicalEditor","LexicalEditor"],"mappings":";;;;;;AASA,MAAMA,oBAAyC;IAAE,UAAU;IAAY,KAAK;IAAI,MAAM;AAAG;AAEzF,MAAMC,wBAA6C;IAC/C,WAAW;IACX,SAAS;IACT,SAAS;AACb;AAEA,MAAMC,SAA8B;IAChC,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,YAAY;AAChB;AAEA,MAAMC,gBAAgBC,oBAAoB;AAI1C,MAAMC,yBAAyB,CAACC;IAC5B,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAElB,MAAMC,cAA2B;QAC7B,QAAQF,OAAO,UAAU,EAAE;QAC3B,YAAYA,OAAO,cAAc,CAAC;QAClC,WAAWA,OAAO,aAAa,EAAE;QACjC,QAAQJ;IACZ;IAEA,OAAO,WAAP,GACI,oBAACO,eAAiBA;QACb,GAAGJ,KAAK;QACT,6BAAe,oBAACK,eAAaA;YAAC,WAAW;;QACzC,KAAK;QACL,aAAaL,OAAO,eAAe;QACnC,mBAAmBN;QACnB,uBAAuBC;QACvB,QAAQC;QACR,OAAOO;;AAGnB;AAEA,MAAMG,wBAAwB,CAACN,QACpB,WAAP,GACI,oBAACO,kBAAgBA;QAAC,MAAM;qBACpB,oBAACR,wBAA2BC;AAKxC,MAAMQ,uBAAuB,CAACR,QACnB,WAAP,GACI,oBAACO,kBAAgBA;QAAC,MAAM;qBACpB,oBAACR,wBAA2BC;AAKjC,MAAMS,8BAAgB;IACzB,UAAUH;IACV,SAASE;AACb"}
1
+ {"version":3,"file":"inputRenderers/LexicalInput/LexicalEditor.js","sources":["../../../src/inputRenderers/LexicalInput/LexicalEditor.tsx"],"sourcesContent":["import React from \"react\";\nimport { LexicalEditor as BaseLexicalEditor, AdminConfig } from \"@webiny/app-admin\";\nimport { StaticToolbar } from \"@webiny/lexical-editor\";\nimport type { EditorTheme } from \"@webiny/lexical-theme\";\nimport { createLexicalTokens } from \"@webiny/lexical-theme/createLexicalEditorTokens.js\";\nimport { useWebsiteBuilderTheme } from \"~/BaseEditor/components/index.js\";\nimport \"./wbStaticToolbar.css\";\nimport { CompositionScope } from \"@webiny/app-admin\";\n\n// Overlay the contentEditable: same origin + same padding as `contentEditableStyles`, and\n// neutralize the Placeholder component's default -20px margin. This makes the placeholder's\n// first line land exactly on the editor's text start.\nconst placeholderStyles: React.CSSProperties = {\n position: \"absolute\",\n top: 0,\n left: 0,\n padding: \"8px 12px\",\n marginTop: 0,\n // Font size/family come from the paragraph typography class (applied by RichTextEditor);\n // keep the placeholder muted.\n color: \"var(--text-color-neutral-muted)\"\n};\n\nconst contentEditableStyles: React.CSSProperties = {\n minHeight: 200,\n display: \"block\",\n padding: \"8px 12px\"\n};\n\nconst styles: React.CSSProperties = {\n backgroundColor: \"var(--color-neutral-base)\",\n border: \"1px solid var(--border-color-neutral-muted)\",\n // The static toolbar carries the top border; the body drops it and rounds only the\n // bottom corners so the two read as one seamless rounded box (matches Figma).\n borderTop: \"none\",\n borderRadius: \"0 0 var(--radius-md) var(--radius-md)\",\n // Padding lives on the contentEditable only (avoids doubled inset).\n minHeight: 200,\n maxHeight: 350,\n fontFamily: \"var(--wb-theme-font-family)\"\n};\n\nconst lexicalTokens = createLexicalTokens(\"wb-lx-\");\n\nexport type LexicalEditorProps = Omit<React.ComponentProps<typeof BaseLexicalEditor>, \"theme\">;\n\nconst { useAdminConfig } = AdminConfig;\n\nconst LexicalEditorComponent = (props: LexicalEditorProps) => {\n const { theme } = useWebsiteBuilderTheme();\n const { lexicalTheme } = useAdminConfig();\n\n const editorTheme: EditorTheme = {\n colors: theme?.colors ?? [],\n typography: theme?.typography ?? {},\n fontSizes: theme?.fontSizes ?? [],\n tokens: lexicalTokens,\n allowCustomColors: theme?.allowCustomColors ?? lexicalTheme.allowCustomColors\n };\n\n return (\n <BaseLexicalEditor\n {...props}\n staticToolbar={<StaticToolbar className={\"wb-static-toolbar\"} />}\n tag={\"p\"}\n placeholder={props?.placeholder || \"Enter your text here...\"}\n placeholderStyles={placeholderStyles}\n contentEditableStyles={contentEditableStyles}\n styles={styles}\n theme={editorTheme}\n />\n );\n};\n\nconst ExpandedLexicalEditor = (props: LexicalEditorProps) => {\n return (\n <CompositionScope name={\"expanded\"}>\n <LexicalEditorComponent {...props} />\n </CompositionScope>\n );\n};\n\nconst CompactLexicalEditor = (props: LexicalEditorProps) => {\n return (\n <CompositionScope name={\"compact\"}>\n <LexicalEditorComponent {...props} />\n </CompositionScope>\n );\n};\n\nexport const LexicalEditor = {\n Expanded: ExpandedLexicalEditor,\n Compact: CompactLexicalEditor\n};\n"],"names":["placeholderStyles","contentEditableStyles","styles","lexicalTokens","createLexicalTokens","useAdminConfig","AdminConfig","LexicalEditorComponent","props","theme","useWebsiteBuilderTheme","lexicalTheme","editorTheme","BaseLexicalEditor","StaticToolbar","ExpandedLexicalEditor","CompositionScope","CompactLexicalEditor","LexicalEditor"],"mappings":";;;;;;AAYA,MAAMA,oBAAyC;IAC3C,UAAU;IACV,KAAK;IACL,MAAM;IACN,SAAS;IACT,WAAW;IAGX,OAAO;AACX;AAEA,MAAMC,wBAA6C;IAC/C,WAAW;IACX,SAAS;IACT,SAAS;AACb;AAEA,MAAMC,SAA8B;IAChC,iBAAiB;IACjB,QAAQ;IAGR,WAAW;IACX,cAAc;IAEd,WAAW;IACX,WAAW;IACX,YAAY;AAChB;AAEA,MAAMC,gBAAgBC,oBAAoB;AAI1C,MAAM,EAAEC,gBAAAA,cAAc,EAAE,GAAGC;AAE3B,MAAMC,yBAAyB,CAACC;IAC5B,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAM,EAAEC,YAAY,EAAE,GAAGN;IAEzB,MAAMO,cAA2B;QAC7B,QAAQH,OAAO,UAAU,EAAE;QAC3B,YAAYA,OAAO,cAAc,CAAC;QAClC,WAAWA,OAAO,aAAa,EAAE;QACjC,QAAQN;QACR,mBAAmBM,OAAO,qBAAqBE,aAAa,iBAAiB;IACjF;IAEA,OAAO,WAAP,GACI,oBAACE,eAAiBA;QACb,GAAGL,KAAK;QACT,6BAAe,oBAACM,eAAaA;YAAC,WAAW;;QACzC,KAAK;QACL,aAAaN,OAAO,eAAe;QACnC,mBAAmBR;QACnB,uBAAuBC;QACvB,QAAQC;QACR,OAAOU;;AAGnB;AAEA,MAAMG,wBAAwB,CAACP,QACpB,WAAP,GACI,oBAACQ,kBAAgBA;QAAC,MAAM;qBACpB,oBAACT,wBAA2BC;AAKxC,MAAMS,uBAAuB,CAACT,QACnB,WAAP,GACI,oBAACQ,kBAAgBA;QAAC,MAAM;qBACpB,oBAACT,wBAA2BC;AAKjC,MAAMU,8BAAgB;IACzB,UAAUH;IACV,SAASE;AACb"}
@@ -47,14 +47,15 @@ const TypographyDropDown = ()=>{
47
47
  element
48
48
  ]);
49
49
  return /*#__PURE__*/ react.createElement(react.Fragment, null, styles?.length ? /*#__PURE__*/ react.createElement(DropDown, {
50
- buttonClassName: "toolbar-item typography-dropdown",
50
+ buttonClassName: "toolbar-item typography-dropdown block-type-dropdown",
51
51
  buttonAriaLabel: "Typography formatting options",
52
52
  buttonLabel: value?.label || "Typography",
53
53
  stopCloseOnClickSelf: true,
54
54
  disabled: false,
55
55
  showScroll: true
56
56
  }, styles?.map((option)=>/*#__PURE__*/ react.createElement(DropDownItem, {
57
- className: `item typography-item ${value?.id === option.id ? "active dropdown-item-active" : ""}`,
57
+ className: "item typography-item",
58
+ selected: value?.id === option.id,
58
59
  onClick: ()=>applyTypography(option),
59
60
  key: option.id
60
61
  }, /*#__PURE__*/ react.createElement("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"inputRenderers/LexicalInput/TypographyDropDown.js","sources":["../../../src/inputRenderers/LexicalInput/TypographyDropDown.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport { $getNearestNodeOfType } from \"@lexical/utils\";\nimport {\n DropDown,\n DropDownItem,\n useCurrentSelection,\n useCurrentElement,\n useTypographyAction\n} from \"@webiny/lexical-editor\";\nimport {\n $isHeadingNode,\n $isParagraphNode,\n $isQuoteNode,\n $isListNode,\n ListNode\n} from \"@webiny/lexical-nodes\";\nimport { useWebsiteBuilderTheme } from \"~/BaseEditor/components/index.js\";\nimport type { TypographyStyle } from \"@webiny/website-builder-sdk/types/WebsiteBuilderTheme.js\";\n\nexport const TypographyDropDown = () => {\n const { value, applyTypography } = useTypographyAction();\n const { theme } = useWebsiteBuilderTheme();\n const [styles, setStyles] = useState<TypographyStyle[]>([]);\n const { element } = useCurrentElement();\n const { rangeSelection } = useCurrentSelection();\n\n const getAllTextStyles = (): TypographyStyle[] => {\n if (!theme?.typography) {\n return [];\n }\n const headingsStyles = theme.typography?.headings || [];\n const paragraphStyles = theme.typography?.paragraphs || [];\n return [...headingsStyles, ...paragraphStyles];\n };\n\n useEffect(() => {\n // In static toolbar typography, styles always need to be visible.\n if (theme?.typography) {\n setStyles(getAllTextStyles());\n }\n }, [theme?.typography]);\n\n const getListStyles = (tag: string): TypographyStyle[] => {\n const listStyles = theme?.typography.lists?.filter(x => x.tag === tag) || [];\n if (listStyles.length > 0) {\n return listStyles;\n }\n\n const fallbackTag = tag === \"ul\" ? \"ol\" : \"ul\";\n return theme?.typography.lists?.filter(x => x.tag === fallbackTag) || [];\n };\n\n useEffect(() => {\n if (!element || !rangeSelection) {\n return;\n }\n\n if ($isParagraphNode(element) || $isHeadingNode(element)) {\n setStyles(getAllTextStyles());\n } else if ($isListNode(element)) {\n let type;\n try {\n const anchorNode = rangeSelection.anchor.getNode();\n const parentList = $getNearestNodeOfType<ListNode>(anchorNode, ListNode);\n if (parentList) {\n type = parentList.getListType();\n }\n } catch {\n type = element.getListType();\n }\n\n if (type === \"bullet\") {\n setStyles(getListStyles(\"ul\"));\n } else {\n setStyles(getListStyles(\"ol\"));\n }\n } else if ($isQuoteNode(element)) {\n setStyles(theme?.typography?.quotes || []);\n } else {\n setStyles([]);\n }\n }, [element]);\n\n return (\n <>\n {!!styles?.length ? (\n <DropDown\n buttonClassName=\"toolbar-item typography-dropdown\"\n buttonAriaLabel={\"Typography formatting options\"}\n buttonLabel={value?.label || \"Typography\"}\n stopCloseOnClickSelf={true}\n disabled={false}\n showScroll={true}\n >\n {styles?.map(option => (\n <DropDownItem\n className={`item typography-item ${\n value?.id === option.id ? \"active dropdown-item-active\" : \"\"\n }`}\n onClick={() => applyTypography(option)}\n key={option.id}\n >\n <span className=\"text\">{option.label}</span>\n </DropDownItem>\n ))}\n </DropDown>\n ) : null}\n </>\n );\n};\n"],"names":["TypographyDropDown","value","applyTypography","useTypographyAction","theme","useWebsiteBuilderTheme","styles","setStyles","useState","element","useCurrentElement","rangeSelection","useCurrentSelection","getAllTextStyles","headingsStyles","paragraphStyles","useEffect","getListStyles","tag","listStyles","x","fallbackTag","$isParagraphNode","$isHeadingNode","$isListNode","type","anchorNode","parentList","$getNearestNodeOfType","ListNode","$isQuoteNode","DropDown","option","DropDownItem"],"mappings":";;;;;AAmBO,MAAMA,qBAAqB;IAC9B,MAAM,EAAEC,KAAK,EAAEC,eAAe,EAAE,GAAGC;IACnC,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAM,CAACC,QAAQC,UAAU,GAAGC,SAA4B,EAAE;IAC1D,MAAM,EAAEC,OAAO,EAAE,GAAGC;IACpB,MAAM,EAAEC,cAAc,EAAE,GAAGC;IAE3B,MAAMC,mBAAmB;QACrB,IAAI,CAACT,OAAO,YACR,OAAO,EAAE;QAEb,MAAMU,iBAAiBV,MAAM,UAAU,EAAE,YAAY,EAAE;QACvD,MAAMW,kBAAkBX,MAAM,UAAU,EAAE,cAAc,EAAE;QAC1D,OAAO;eAAIU;eAAmBC;SAAgB;IAClD;IAEAC,UAAU;QAEN,IAAIZ,OAAO,YACPG,UAAUM;IAElB,GAAG;QAACT,OAAO;KAAW;IAEtB,MAAMa,gBAAgB,CAACC;QACnB,MAAMC,aAAaf,OAAO,WAAW,OAAO,OAAOgB,CAAAA,IAAKA,EAAE,GAAG,KAAKF,QAAQ,EAAE;QAC5E,IAAIC,WAAW,MAAM,GAAG,GACpB,OAAOA;QAGX,MAAME,cAAcH,AAAQ,SAARA,MAAe,OAAO;QAC1C,OAAOd,OAAO,WAAW,OAAO,OAAOgB,CAAAA,IAAKA,EAAE,GAAG,KAAKC,gBAAgB,EAAE;IAC5E;IAEAL,UAAU;QACN,IAAI,CAACP,WAAW,CAACE,gBACb;QAGJ,IAAIW,iBAAiBb,YAAYc,eAAed,UAC5CF,UAAUM;aACP,IAAIW,YAAYf,UAAU;YAC7B,IAAIgB;YACJ,IAAI;gBACA,MAAMC,aAAaf,eAAe,MAAM,CAAC,OAAO;gBAChD,MAAMgB,aAAaC,sBAAgCF,YAAYG;gBAC/D,IAAIF,YACAF,OAAOE,WAAW,WAAW;YAErC,EAAE,OAAM;gBACJF,OAAOhB,QAAQ,WAAW;YAC9B;YAEa,aAATgB,OACAlB,UAAUU,cAAc,SAExBV,UAAUU,cAAc;QAEhC,OAAWa,aAAarB,WACpBF,UAAUH,OAAO,YAAY,UAAU,EAAE,IAEzCG,UAAU,EAAE;IAEpB,GAAG;QAACE;KAAQ;IAEZ,OAAO,WAAP,GACI,0CACK,AAAEH,QAAQ,SAAS,WAAT,GACP,oBAACyB,UAAQA;QACL,iBAAgB;QAChB,iBAAiB;QACjB,aAAa9B,OAAO,SAAS;QAC7B,sBAAsB;QACtB,UAAU;QACV,YAAY;OAEXK,QAAQ,IAAI0B,CAAAA,SAAAA,WAAAA,GACT,oBAACC,cAAYA;YACT,WAAW,CAAC,qBAAqB,EAC7BhC,OAAO,OAAO+B,OAAO,EAAE,GAAG,gCAAgC,IAC5D;YACF,SAAS,IAAM9B,gBAAgB8B;YAC/B,KAAKA,OAAO,EAAE;yBAEd,oBAAC;YAAK,WAAU;WAAQA,OAAO,KAAK,OAIhD;AAGhB"}
1
+ {"version":3,"file":"inputRenderers/LexicalInput/TypographyDropDown.js","sources":["../../../src/inputRenderers/LexicalInput/TypographyDropDown.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport { $getNearestNodeOfType } from \"@lexical/utils\";\nimport {\n DropDown,\n DropDownItem,\n useCurrentSelection,\n useCurrentElement,\n useTypographyAction\n} from \"@webiny/lexical-editor\";\nimport {\n $isHeadingNode,\n $isParagraphNode,\n $isQuoteNode,\n $isListNode,\n ListNode\n} from \"@webiny/lexical-nodes\";\nimport { useWebsiteBuilderTheme } from \"~/BaseEditor/components/index.js\";\nimport type { TypographyStyle } from \"@webiny/website-builder-sdk/types/WebsiteBuilderTheme.js\";\n\nexport const TypographyDropDown = () => {\n const { value, applyTypography } = useTypographyAction();\n const { theme } = useWebsiteBuilderTheme();\n const [styles, setStyles] = useState<TypographyStyle[]>([]);\n const { element } = useCurrentElement();\n const { rangeSelection } = useCurrentSelection();\n\n const getAllTextStyles = (): TypographyStyle[] => {\n if (!theme?.typography) {\n return [];\n }\n const headingsStyles = theme.typography?.headings || [];\n const paragraphStyles = theme.typography?.paragraphs || [];\n return [...headingsStyles, ...paragraphStyles];\n };\n\n useEffect(() => {\n // In static toolbar typography, styles always need to be visible.\n if (theme?.typography) {\n setStyles(getAllTextStyles());\n }\n }, [theme?.typography]);\n\n const getListStyles = (tag: string): TypographyStyle[] => {\n const listStyles = theme?.typography.lists?.filter(x => x.tag === tag) || [];\n if (listStyles.length > 0) {\n return listStyles;\n }\n\n const fallbackTag = tag === \"ul\" ? \"ol\" : \"ul\";\n return theme?.typography.lists?.filter(x => x.tag === fallbackTag) || [];\n };\n\n useEffect(() => {\n if (!element || !rangeSelection) {\n return;\n }\n\n if ($isParagraphNode(element) || $isHeadingNode(element)) {\n setStyles(getAllTextStyles());\n } else if ($isListNode(element)) {\n let type;\n try {\n const anchorNode = rangeSelection.anchor.getNode();\n const parentList = $getNearestNodeOfType<ListNode>(anchorNode, ListNode);\n if (parentList) {\n type = parentList.getListType();\n }\n } catch {\n type = element.getListType();\n }\n\n if (type === \"bullet\") {\n setStyles(getListStyles(\"ul\"));\n } else {\n setStyles(getListStyles(\"ol\"));\n }\n } else if ($isQuoteNode(element)) {\n setStyles(theme?.typography?.quotes || []);\n } else {\n setStyles([]);\n }\n }, [element]);\n\n return (\n <>\n {!!styles?.length ? (\n <DropDown\n buttonClassName=\"toolbar-item typography-dropdown block-type-dropdown\"\n buttonAriaLabel={\"Typography formatting options\"}\n buttonLabel={value?.label || \"Typography\"}\n stopCloseOnClickSelf={true}\n disabled={false}\n showScroll={true}\n >\n {styles?.map(option => (\n <DropDownItem\n className=\"item typography-item\"\n selected={value?.id === option.id}\n onClick={() => applyTypography(option)}\n key={option.id}\n >\n <span className=\"text\">{option.label}</span>\n </DropDownItem>\n ))}\n </DropDown>\n ) : null}\n </>\n );\n};\n"],"names":["TypographyDropDown","value","applyTypography","useTypographyAction","theme","useWebsiteBuilderTheme","styles","setStyles","useState","element","useCurrentElement","rangeSelection","useCurrentSelection","getAllTextStyles","headingsStyles","paragraphStyles","useEffect","getListStyles","tag","listStyles","x","fallbackTag","$isParagraphNode","$isHeadingNode","$isListNode","type","anchorNode","parentList","$getNearestNodeOfType","ListNode","$isQuoteNode","DropDown","option","DropDownItem"],"mappings":";;;;;AAmBO,MAAMA,qBAAqB;IAC9B,MAAM,EAAEC,KAAK,EAAEC,eAAe,EAAE,GAAGC;IACnC,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAM,CAACC,QAAQC,UAAU,GAAGC,SAA4B,EAAE;IAC1D,MAAM,EAAEC,OAAO,EAAE,GAAGC;IACpB,MAAM,EAAEC,cAAc,EAAE,GAAGC;IAE3B,MAAMC,mBAAmB;QACrB,IAAI,CAACT,OAAO,YACR,OAAO,EAAE;QAEb,MAAMU,iBAAiBV,MAAM,UAAU,EAAE,YAAY,EAAE;QACvD,MAAMW,kBAAkBX,MAAM,UAAU,EAAE,cAAc,EAAE;QAC1D,OAAO;eAAIU;eAAmBC;SAAgB;IAClD;IAEAC,UAAU;QAEN,IAAIZ,OAAO,YACPG,UAAUM;IAElB,GAAG;QAACT,OAAO;KAAW;IAEtB,MAAMa,gBAAgB,CAACC;QACnB,MAAMC,aAAaf,OAAO,WAAW,OAAO,OAAOgB,CAAAA,IAAKA,EAAE,GAAG,KAAKF,QAAQ,EAAE;QAC5E,IAAIC,WAAW,MAAM,GAAG,GACpB,OAAOA;QAGX,MAAME,cAAcH,AAAQ,SAARA,MAAe,OAAO;QAC1C,OAAOd,OAAO,WAAW,OAAO,OAAOgB,CAAAA,IAAKA,EAAE,GAAG,KAAKC,gBAAgB,EAAE;IAC5E;IAEAL,UAAU;QACN,IAAI,CAACP,WAAW,CAACE,gBACb;QAGJ,IAAIW,iBAAiBb,YAAYc,eAAed,UAC5CF,UAAUM;aACP,IAAIW,YAAYf,UAAU;YAC7B,IAAIgB;YACJ,IAAI;gBACA,MAAMC,aAAaf,eAAe,MAAM,CAAC,OAAO;gBAChD,MAAMgB,aAAaC,sBAAgCF,YAAYG;gBAC/D,IAAIF,YACAF,OAAOE,WAAW,WAAW;YAErC,EAAE,OAAM;gBACJF,OAAOhB,QAAQ,WAAW;YAC9B;YAEa,aAATgB,OACAlB,UAAUU,cAAc,SAExBV,UAAUU,cAAc;QAEhC,OAAWa,aAAarB,WACpBF,UAAUH,OAAO,YAAY,UAAU,EAAE,IAEzCG,UAAU,EAAE;IAEpB,GAAG;QAACE;KAAQ;IAEZ,OAAO,WAAP,GACI,0CACK,AAAEH,QAAQ,SAAS,WAAT,GACP,oBAACyB,UAAQA;QACL,iBAAgB;QAChB,iBAAiB;QACjB,aAAa9B,OAAO,SAAS;QAC7B,sBAAsB;QACtB,UAAU;QACV,YAAY;OAEXK,QAAQ,IAAI0B,CAAAA,SAAAA,WAAAA,GACT,oBAACC,cAAYA;YACT,WAAU;YACV,UAAUhC,OAAO,OAAO+B,OAAO,EAAE;YACjC,SAAS,IAAM9B,gBAAgB8B;YAC/B,KAAKA,OAAO,EAAE;yBAEd,oBAAC;YAAK,WAAU;WAAQA,OAAO,KAAK,OAIhD;AAGhB"}
@@ -1,11 +1,19 @@
1
+ /*
2
+ * Mirrors @webiny/lexical-editor's StaticToolbar.css, scoped to `.wb-static-toolbar`.
3
+ * The dropdown menu (`.lexical-dropdown`) is styled by the shared file (always imported),
4
+ * so only the toolbar rules + website-builder-only bits live here.
5
+ */
1
6
  .wb-static-toolbar {
2
7
  display: flex;
3
8
  position: relative;
4
9
  padding: 4px;
5
10
  vertical-align: middle;
6
- border: 1px solid #eee;
11
+ border: 1px solid var(--border-color-neutral-muted);
12
+ /* No divider between toolbar and body: the body carries the bottom border. */
13
+ border-bottom: none;
14
+ border-radius: var(--radius-md) var(--radius-md) 0 0;
7
15
  will-change: transform;
8
- background: #fff;
16
+ background: var(--color-neutral-base);
9
17
  flex-wrap: wrap;
10
18
  z-index: 1;
11
19
  }
@@ -13,8 +21,10 @@
13
21
  .wb-static-toolbar button.popup-item {
14
22
  border: 0;
15
23
  display: flex;
16
- background: #fff;
17
- border-radius: 10px;
24
+ align-items: center;
25
+ justify-content: center;
26
+ background: transparent;
27
+ border-radius: var(--radius-md);
18
28
  padding: 8px;
19
29
  cursor: pointer;
20
30
  vertical-align: middle;
@@ -28,43 +38,33 @@
28
38
  margin-right: 2px;
29
39
  }
30
40
 
31
- .wb-static-toolbar button.popup-item i.format {
32
- background-size: contain;
33
- display: inline-block;
34
- height: 18px;
35
- width: 18px;
36
- margin-top: 2px;
37
- vertical-align: -0.25em;
41
+ .wb-static-toolbar button.popup-item .format {
38
42
  display: flex;
39
- }
40
-
41
- .wb-static-toolbar button.popup-item:disabled i.format {
42
- opacity: 0.2;
43
+ height: 16px;
44
+ width: 16px;
45
+ flex-shrink: 0;
43
46
  }
44
47
 
45
48
  .wb-static-toolbar button.popup-item.active {
46
- background-color: rgba(223, 232, 250, 0.3);
47
- }
48
-
49
- .wb-static-toolbar button.popup-item.active i {
50
- opacity: 1;
49
+ background-color: var(--color-primary-subtle);
51
50
  }
52
51
 
53
52
  .wb-static-toolbar .popup-item:hover:not([disabled]) {
54
- background-color: #eee;
53
+ /* Matches admin-ui ghost IconButton hover (bg-neutral-dark/5). */
54
+ background-color: color-mix(in oklab, var(--color-neutral-dark) 5%, transparent);
55
55
  }
56
56
 
57
57
  .wb-static-toolbar select.popup-item {
58
58
  border: 0;
59
59
  display: flex;
60
- border-radius: 10px;
60
+ border-radius: var(--radius-md);
61
61
  padding: 8px;
62
62
  vertical-align: middle;
63
63
  -webkit-appearance: none;
64
64
  -moz-appearance: none;
65
65
  width: 70px;
66
66
  font-size: 14px;
67
- color: #777;
67
+ color: var(--text-color-neutral-strong);
68
68
  text-overflow: ellipsis;
69
69
  }
70
70
 
@@ -76,12 +76,11 @@
76
76
  .wb-static-toolbar .popup-item .text {
77
77
  display: flex;
78
78
  line-height: 20px;
79
- width: 200px;
79
+ width: 70px;
80
80
  vertical-align: middle;
81
81
  font-size: 14px;
82
- color: #777;
82
+ color: var(--text-color-neutral-strong);
83
83
  text-overflow: ellipsis;
84
- width: 70px;
85
84
  overflow: hidden;
86
85
  height: 20px;
87
86
  text-align: left;
@@ -89,25 +88,20 @@
89
88
 
90
89
  .wb-static-toolbar .popup-item .icon {
91
90
  display: flex;
92
- width: 20px;
93
- height: 20px;
91
+ width: 16px;
92
+ height: 16px;
94
93
  user-select: none;
95
- line-height: 16px;
96
- background-size: contain;
97
94
  }
98
95
 
99
- .wb-static-toolbar i.chevron-down {
100
- margin-top: 3px;
96
+ .wb-static-toolbar .chevron-down {
101
97
  width: 16px;
102
98
  height: 16px;
103
99
  display: flex;
100
+ flex-shrink: 0;
104
101
  user-select: none;
105
102
  }
106
103
 
107
- .wb-static-toolbar i.chevron-down.inside {
108
- width: 16px;
109
- height: 16px;
110
- display: flex;
104
+ .wb-static-toolbar .chevron-down.inside {
111
105
  margin-left: -25px;
112
106
  margin-top: 11px;
113
107
  margin-right: 10px;
@@ -116,30 +110,20 @@
116
110
 
117
111
  .wb-static-toolbar .divider {
118
112
  width: 1px;
119
- background-color: #eee;
113
+ background-color: var(--border-color-neutral-dimmed);
120
114
  margin: 0 4px;
121
115
  }
122
116
 
123
- .wb-static-toolbar .icon.bullet-list,
124
- .wb-static-toolbar .icon.bullet {
125
- background-image: url("./icons/list-ul.svg");
126
- }
127
-
128
- .wb-static-toolbar .icon.numbered-list,
129
- .wb-static-toolbar .icon.number {
130
- background-image: url("./icons/list-ol.svg");
131
- }
132
-
133
117
  .wb-static-toolbar .link-editor .button.active,
134
118
  .wb-static-toolbar .button.active {
135
- background-color: rgb(223, 232, 250);
119
+ background-color: var(--color-primary-subtle);
136
120
  }
137
121
 
138
122
  .wb-static-toolbar button.toolbar-item {
139
123
  border: 0;
140
124
  display: flex;
141
125
  background: none;
142
- border-radius: 10px;
126
+ border-radius: var(--radius-md);
143
127
  padding: 8px;
144
128
  cursor: pointer;
145
129
  vertical-align: middle;
@@ -156,33 +140,26 @@
156
140
  margin-right: 2px;
157
141
  }
158
142
 
159
- .wb-static-toolbar button.toolbar-item i.format {
160
- background-size: contain;
161
- display: inline-block;
162
- height: 18px;
163
- width: 18px;
164
- vertical-align: -0.25em;
143
+ .wb-static-toolbar button.toolbar-item .format {
165
144
  display: flex;
166
- opacity: 0.6;
145
+ height: 16px;
146
+ width: 16px;
147
+ flex-shrink: 0;
167
148
  }
168
149
 
169
150
  .wb-static-toolbar button.toolbar-item:disabled .icon,
170
151
  .wb-static-toolbar button.toolbar-item:disabled .text,
171
- .wb-static-toolbar button.toolbar-item:disabled i.format,
172
152
  .wb-static-toolbar button.toolbar-item:disabled .chevron-down {
173
153
  opacity: 0.2;
174
154
  }
175
155
 
176
156
  .wb-static-toolbar button.toolbar-item.active {
177
- background-color: rgba(223, 232, 250, 0.3);
178
- }
179
-
180
- .wb-static-toolbar button.toolbar-item.active i {
181
- opacity: 1;
157
+ background-color: var(--color-primary-subtle);
182
158
  }
183
159
 
184
160
  .wb-static-toolbar .toolbar-item:hover:not([disabled]) {
185
- background-color: #eee;
161
+ /* Matches admin-ui ghost IconButton hover (bg-neutral-dark/5). */
162
+ background-color: color-mix(in oklab, var(--color-neutral-dark) 5%, transparent);
186
163
  }
187
164
 
188
165
  .wb-static-toolbar .toolbar-item.font-family .text {
@@ -194,12 +171,20 @@
194
171
  width: 150px;
195
172
  }
196
173
 
174
+ /* Fixed-width label so the trigger doesn't resize as the selected heading changes. */
175
+ .wb-static-toolbar .block-type-dropdown .dropdown-button-text {
176
+ width: 92px;
177
+ overflow: hidden;
178
+ white-space: nowrap;
179
+ text-overflow: ellipsis;
180
+ }
181
+
197
182
  .wb-static-toolbar .toolbar-item .text {
198
183
  display: flex;
199
184
  line-height: 20px;
200
185
  vertical-align: middle;
201
186
  font-size: 14px;
202
- color: #777;
187
+ color: var(--text-color-neutral-strong);
203
188
  text-overflow: ellipsis;
204
189
  overflow: hidden;
205
190
  height: 20px;
@@ -209,56 +194,40 @@
209
194
 
210
195
  .wb-static-toolbar .toolbar-item .icon {
211
196
  display: flex;
212
- width: 20px;
213
- height: 20px;
214
- user-select: none;
215
- margin-right: 8px;
216
- line-height: 16px;
217
- background-size: contain;
218
- }
219
-
220
- .wb-static-toolbar i.chevron-down {
221
- margin-top: 3px;
222
197
  width: 16px;
223
198
  height: 16px;
224
- display: flex;
225
199
  user-select: none;
226
200
  }
227
201
 
228
- .wb-static-toolbar i.chevron-down.inside {
229
- width: 16px;
230
- height: 16px;
231
- display: flex;
232
- margin-left: -25px;
233
- margin-top: 11px;
234
- margin-right: 10px;
235
- pointer-events: none;
202
+ /*
203
+ * Toolbar icons are inline SVGs from @webiny/icons (shared action components);
204
+ * color via `fill`.
205
+ */
206
+ .wb-static-toolbar .format,
207
+ .wb-static-toolbar .icon {
208
+ fill: var(--fill-neutral-xstrong);
236
209
  }
237
210
 
238
- .wb-static-toolbar .divider {
239
- width: 1px;
240
- background-color: #eee;
241
- margin: 0 4px;
211
+ .wb-static-toolbar .chevron-down {
212
+ fill: var(--fill-neutral-strong);
242
213
  }
243
214
 
244
- .lexical-dropdown-container {
245
- position: absolute;
246
- bottom: -5px;
247
- left: 0;
248
- }
249
-
250
- .wb-static-toolbar button.item i {
251
- opacity: 0.6;
252
- }
253
-
254
- .wb-static-toolbar button.item.dropdown-item-active {
255
- background-color: rgba(223, 232, 250, 0.3);
256
- }
257
-
258
- .wb-static-toolbar button.item.dropdown-item-active i {
259
- opacity: 1;
215
+ .wb-static-toolbar button:disabled .format,
216
+ .wb-static-toolbar button:disabled .icon,
217
+ .wb-static-toolbar button:disabled .chevron-down {
218
+ fill: var(--fill-neutral-disabled);
260
219
  }
261
220
 
221
+ /* Website-builder-only: fullscreen/expand toggle (still a background-image glyph). */
262
222
  .wb-static-toolbar i.expand {
223
+ background-size: contain;
224
+ background-repeat: no-repeat;
225
+ background-position: center;
263
226
  background-image: url("./icons/fullscreen.svg");
264
227
  }
228
+
229
+ .lexical-dropdown-container {
230
+ position: absolute;
231
+ bottom: -5px;
232
+ left: 0;
233
+ }
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const AbTesting: () => React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import react from "react";
2
+ import { RegisterFeature } from "@webiny/app-admin";
3
+ import { ExperimentsFeature } from "../features/experiments/index.js";
4
+ import { ExperimentsEditorPresenterFeature } from "../presentation/experiments/ExperimentsEditor/index.js";
5
+ import { ExperimentsManagerPresenterFeature } from "../presentation/experiments/ExperimentsManager/index.js";
6
+ import { ExperimentFormPresenterFeature } from "../presentation/experiments/ExperimentForm/index.js";
7
+ import { ExperimentsEditorConfig } from "../presentation/experiments/config/ExperimentsEditorConfig.js";
8
+ const AbTesting = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
9
+ feature: ExperimentsFeature
10
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
11
+ feature: ExperimentsEditorPresenterFeature
12
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
13
+ feature: ExperimentsManagerPresenterFeature
14
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
15
+ feature: ExperimentFormPresenterFeature
16
+ }), /*#__PURE__*/ react.createElement(ExperimentsEditorConfig, null));
17
+ export { AbTesting };
18
+
19
+ //# sourceMappingURL=AbTesting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules/AbTesting.js","sources":["../../src/modules/AbTesting.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { ExperimentsFeature } from \"~/features/experiments/index.js\";\nimport { ExperimentsEditorPresenterFeature } from \"~/presentation/experiments/ExperimentsEditor/index.js\";\nimport { ExperimentsManagerPresenterFeature } from \"~/presentation/experiments/ExperimentsManager/index.js\";\nimport { ExperimentFormPresenterFeature } from \"~/presentation/experiments/ExperimentForm/index.js\";\nimport { ExperimentsEditorConfig } from \"~/presentation/experiments/config/ExperimentsEditorConfig.js\";\n\nexport const AbTesting = () => {\n return (\n <>\n <RegisterFeature feature={ExperimentsFeature} />\n <RegisterFeature feature={ExperimentsEditorPresenterFeature} />\n <RegisterFeature feature={ExperimentsManagerPresenterFeature} />\n <RegisterFeature feature={ExperimentFormPresenterFeature} />\n <ExperimentsEditorConfig />\n </>\n );\n};\n"],"names":["AbTesting","RegisterFeature","ExperimentsFeature","ExperimentsEditorPresenterFeature","ExperimentsManagerPresenterFeature","ExperimentFormPresenterFeature","ExperimentsEditorConfig"],"mappings":";;;;;;;AAQO,MAAMA,YAAY,IACd,WAAP,GACI,wDACI,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACH,iBAAeA;QAAC,SAASI;sBAC1B,oBAACC,yBAAuBA"}