@plone/volto 19.0.0-alpha.2 → 19.0.0-alpha.20
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/.eslintignore +1 -0
- package/.eslintrc +37 -3
- package/CHANGELOG.md +338 -1
- package/README.md +20 -16
- package/babel.js +1 -3
- package/cypress/docker/prefixed-rules.yml +26 -0
- package/cypress/docker/prefixed.yml +24 -0
- package/cypress/support/commands.js +12 -6
- package/cypress/support/guillotina.js +1 -0
- package/cypress.config.js +1 -0
- package/global-test-setup.js +1 -2
- package/locales/af.json +1 -0
- package/locales/ar.json +1 -0
- package/locales/bg.json +1 -0
- package/locales/bn.json +1 -0
- package/locales/ca/LC_MESSAGES/volto.po +124 -17
- package/locales/ca.json +1 -1
- package/locales/cs.json +1 -0
- package/locales/cy.json +1 -0
- package/locales/da.json +1 -0
- package/locales/de/LC_MESSAGES/volto.po +135 -28
- package/locales/de.json +1 -1
- package/locales/el.json +1 -0
- package/locales/en/LC_MESSAGES/volto.po +125 -18
- package/locales/en.json +1 -1
- package/locales/en_AU.json +1 -0
- package/locales/en_GB.json +1 -0
- package/locales/eo.json +1 -0
- package/locales/es/LC_MESSAGES/volto.po +125 -18
- package/locales/es.json +1 -1
- package/locales/et.json +1 -0
- package/locales/eu/LC_MESSAGES/volto.po +124 -17
- package/locales/eu.json +1 -1
- package/locales/fa.json +1 -0
- package/locales/fi/LC_MESSAGES/volto.po +124 -17
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +125 -18
- package/locales/fr.json +1 -1
- package/locales/fu.json +1 -0
- package/locales/gl.json +1 -0
- package/locales/he.json +1 -0
- package/locales/hi/LC_MESSAGES/volto.po +128 -21
- package/locales/hi.json +1 -1
- package/locales/hr.json +1 -0
- package/locales/hu.json +1 -0
- package/locales/hy.json +1 -0
- package/locales/id.json +1 -0
- package/locales/it/LC_MESSAGES/volto.po +129 -22
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +124 -17
- package/locales/ja.json +1 -1
- package/locales/ka.json +1 -0
- package/locales/kn.json +1 -0
- package/locales/ko.json +1 -0
- package/locales/lt.json +1 -0
- package/locales/lv.json +1 -0
- package/locales/mi.json +1 -0
- package/locales/mk.json +1 -0
- package/locales/my.json +1 -0
- package/locales/nb_NO.json +1 -0
- package/locales/nl/LC_MESSAGES/volto.po +128 -21
- package/locales/nl.json +1 -1
- package/locales/nn.json +1 -0
- package/locales/pl.json +1 -0
- package/locales/pt/LC_MESSAGES/volto.po +124 -17
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +147 -40
- package/locales/pt_BR.json +1 -1
- package/locales/rm.json +1 -0
- package/locales/ro/LC_MESSAGES/volto.po +128 -21
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +128 -21
- package/locales/ru.json +1 -1
- package/locales/sk.json +1 -0
- package/locales/sl.json +1 -0
- package/locales/sm.json +1 -0
- package/locales/sq.json +1 -0
- package/locales/sr.json +1 -0
- package/locales/sr@cyrl.json +1 -0
- package/locales/sr@latn.json +1 -0
- package/locales/sv.json +1 -1
- package/locales/ta.json +1 -0
- package/locales/te.json +1 -0
- package/locales/th.json +1 -0
- package/locales/to.json +1 -0
- package/locales/tr.json +1 -0
- package/locales/uk.json +1 -0
- package/locales/vi.json +1 -0
- package/locales/volto.pot +125 -18
- package/locales/zh_CN/LC_MESSAGES/volto.po +124 -17
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant.json +1 -0
- package/locales/zh_Hant_HK.json +1 -0
- package/package.json +43 -100
- package/razzle.config.js +21 -21
- package/src/actions/content/content.js +0 -1
- package/src/actions/controlpanels/controlpanels.js +13 -7
- package/src/actions/controlpanels/controlpanels.test.js +11 -5
- package/src/actions/users/users.js +2 -2
- package/src/components/manage/Actions/Actions.test.jsx +1 -5
- package/src/components/manage/Add/Add.jsx +5 -6
- package/src/components/manage/BlockChooser/BlockChooser.jsx +1 -0
- package/src/components/manage/Blocks/Block/BlocksForm.test.jsx +1 -5
- package/src/components/manage/Blocks/Block/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
- package/src/components/manage/Blocks/Block/Settings.test.jsx +1 -5
- package/src/components/manage/Blocks/HTML/Edit.test.jsx +1 -5
- package/src/components/manage/Blocks/Image/Edit.jsx +5 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/LeadImage/Edit.jsx +2 -2
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +1 -1
- package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Listing/ImageGallery.jsx +6 -4
- package/src/components/manage/Blocks/Maps/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.test.jsx +1 -5
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +21 -4
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +1 -6
- package/src/components/manage/Blocks/Teaser/Data.jsx +21 -7
- package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +1 -1
- package/src/components/manage/Blocks/Teaser/schema.js +8 -3
- package/src/components/manage/Blocks/Video/Edit.jsx +2 -1
- package/src/components/manage/Blocks/Video/VideoSidebar.test.jsx +1 -5
- package/src/components/manage/Contents/Contents.jsx +689 -654
- package/src/components/manage/Contents/Contents.test.jsx +8 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.Multilingual.test.jsx +18 -5
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +20 -26
- package/src/components/manage/Contents/ContentsBreadcrumbs.test.jsx +14 -0
- package/src/components/manage/Contents/ContentsDeleteModal.jsx +258 -206
- package/src/components/manage/Contents/ContentsDeleteModal.stories.jsx +26 -8
- package/src/components/manage/Contents/ContentsItem.jsx +10 -2
- package/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsRenameModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsTagsModal.test.jsx +1 -5
- package/src/components/manage/Contents/ContentsUploadModal.test.jsx +13 -22
- package/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +1 -5
- package/src/components/manage/Contents/DropZoneContent.jsx +323 -0
- package/src/components/manage/Contents/__mocks__/index.tsx +2 -18
- package/src/components/manage/Controlpanels/Aliases.test.jsx +1 -5
- package/src/components/manage/Controlpanels/ContentType.jsx +1 -1
- package/src/components/manage/Controlpanels/ContentType.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +1 -1
- package/src/components/manage/Controlpanels/Rules/AddRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Rules/EditRule.test.jsx +1 -5
- package/src/components/manage/Controlpanels/UndoControlpanel.test.jsx +1 -5
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +156 -175
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +575 -630
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +4 -3
- package/src/components/manage/Diff/Diff.test.jsx +1 -6
- package/src/components/manage/Diff/DiffField.test.jsx +1 -6
- package/src/components/manage/Display/Display.test.jsx +2 -11
- package/src/components/manage/Edit/Edit.jsx +2 -3
- package/src/components/manage/Edit/Edit.test.jsx +1 -5
- package/src/components/manage/Form/BlockDataForm.test.jsx +1 -5
- package/src/components/manage/Form/Form.test.jsx +1 -5
- package/src/components/manage/Form/InlineForm.jsx +2 -2
- package/src/components/manage/Form/InlineForm.test.jsx +1 -5
- package/src/components/manage/Form/ModalForm.jsx +12 -10
- package/src/components/manage/Form/ModalForm.test.jsx +27 -5
- package/src/components/manage/Form/__mocks__/index.tsx +9 -27
- package/src/components/manage/Multilingual/CompareLanguages.jsx +2 -5
- package/src/components/manage/Multilingual/CreateTranslation.jsx +8 -8
- package/src/components/manage/Multilingual/ManageTranslations.jsx +4 -2
- package/src/components/manage/Multilingual/ManageTranslations.test.jsx +5 -1
- package/src/components/manage/Multilingual/TranslationObject.jsx +1 -1
- package/src/components/manage/Preferences/ChangePassword.test.jsx +1 -5
- package/src/components/manage/Preferences/PersonalPreferences.test.jsx +1 -17
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +3 -0
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +13 -1
- package/src/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
- package/src/components/manage/Sidebar/SidebarPortal.test.tsx +42 -0
- package/src/components/manage/Sidebar/SidebarPortal.tsx +48 -0
- package/src/components/manage/TemplateChooser/TemplateChooser.jsx +2 -1
- package/src/components/manage/Toolbar/More.jsx +4 -1
- package/src/components/manage/Toolbar/More.test.jsx +3 -0
- package/src/components/manage/Toolbar/PersonalTools.jsx +2 -1
- package/src/components/manage/Toolbar/Toolbar.jsx +3 -4
- package/src/components/manage/Toolbar/Types.jsx +7 -7
- package/src/components/manage/UniversalLink/UniversalLink.tsx +1 -0
- package/src/components/manage/Widgets/AlignWidget.stories.jsx +9 -0
- package/src/components/manage/Widgets/AlignWidget.test.tsx +95 -0
- package/src/components/manage/Widgets/{AlignWidget.jsx → AlignWidget.tsx} +23 -7
- package/src/components/manage/Widgets/ArrayWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/BlockAlignment.stories.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.test.tsx +104 -0
- package/src/components/manage/Widgets/BlockAlignment.tsx +88 -0
- package/src/components/manage/Widgets/BlockWidth.stories.tsx +69 -0
- package/src/components/manage/Widgets/BlockWidth.test.tsx +62 -0
- package/src/components/manage/Widgets/BlockWidth.tsx +101 -0
- package/src/components/manage/Widgets/ButtonsWidget.stories.jsx +61 -0
- package/src/components/manage/Widgets/ButtonsWidget.test.tsx +138 -0
- package/src/components/manage/Widgets/ButtonsWidget.tsx +176 -0
- package/src/components/manage/Widgets/CheckboxGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/DatetimeWidget.jsx +16 -1
- package/src/components/manage/Widgets/DatetimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/FileWidget.jsx +14 -8
- package/src/components/manage/Widgets/FormFieldWrapper.jsx +146 -168
- package/src/components/manage/Widgets/ImageWidget.jsx +171 -38
- package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +8 -0
- package/src/components/manage/Widgets/ObjectListWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/ObjectWidget.test.jsx +1 -5
- package/src/components/manage/Widgets/QueryWidget.jsx +137 -9
- package/src/components/manage/Widgets/RadioGroupWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/RegistryImageWidget.test.jsx +3 -2
- package/src/components/manage/Widgets/SchemaWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/SchemaWidgetFieldset.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectAutoComplete.jsx +29 -12
- package/src/components/manage/Widgets/SelectAutoComplete.test.jsx +1 -6
- package/src/components/manage/Widgets/SelectWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/Size.stories.tsx +69 -0
- package/src/components/manage/Widgets/Size.test.tsx +59 -0
- package/src/components/manage/Widgets/Size.tsx +78 -0
- package/src/components/manage/Widgets/TimeWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/TokenWidget.test.jsx +1 -6
- package/src/components/manage/Widgets/UrlWidget.jsx +2 -0
- package/src/components/manage/Widgets/VocabularyTermsWidget.test.jsx +2 -11
- package/src/components/manage/Widgets/__mocks__/index.tsx +33 -51
- package/src/components/manage/Widgets/index.tsx +21 -0
- package/src/components/manage/Workflow/Workflow.test.jsx +2 -11
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.jsx +1 -3
- package/src/components/theme/AlternateHrefLangs/AlternateHrefLangs.test.jsx +0 -4
- package/src/components/theme/App/App.jsx +5 -1
- package/src/components/theme/App/App.test.jsx +1 -0
- package/src/components/theme/Avatar/Avatar.jsx +2 -1
- package/src/components/theme/Comments/CommentEditModal.test.jsx +1 -5
- package/src/components/theme/Comments/Comments.test.jsx +2 -11
- package/src/components/theme/ContactForm/ContactForm.test.jsx +1 -5
- package/src/components/theme/FormattedDate/FormattedDate.stories.jsx +20 -2
- package/src/components/theme/Image/Image.jsx +11 -8
- package/src/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.tsx +7 -0
- package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +6 -6
- package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
- package/src/components/theme/Logo/Logo.Multilingual.test.jsx +0 -5
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +10 -14
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.test.jsx +3 -5
- package/src/components/theme/Navigation/NavItem.jsx +1 -5
- package/src/components/theme/Navigation/Navigation.Multilingual.test.jsx +0 -5
- package/src/components/theme/NotFound/NotFound.jsx +5 -2
- package/src/components/theme/NotFound/NotFound.test.jsx +3 -0
- package/src/components/theme/PasswordReset/RequestPasswordReset.test.jsx +1 -5
- package/src/components/theme/PreviewImage/PreviewImage.jsx +1 -1
- package/src/components/theme/Register/Register.test.jsx +1 -5
- package/src/components/theme/RequestTimeout/RequestTimeout.jsx +1 -1
- package/src/components/theme/Sitemap/Sitemap.jsx +6 -5
- package/src/components/theme/Sitemap/Sitemap.test.jsx +0 -1
- package/src/components/theme/Unauthorized/Unauthorized.jsx +5 -2
- package/src/components/theme/View/EventDatesInfo.test.jsx +1 -6
- package/src/components/theme/View/EventView.test.jsx +1 -6
- package/src/components/theme/View/FileView.jsx +9 -1
- package/src/components/theme/View/View.jsx +8 -1
- package/src/components/theme/Widgets/ImageWidget.jsx +2 -1
- package/src/config/ControlPanels.js +1 -0
- package/src/config/Widgets.jsx +7 -0
- package/src/config/index.js +18 -25
- package/src/config/server.js +0 -2
- package/src/config/slots.js +19 -0
- package/src/express-middleware/devproxy.js +20 -5
- package/src/helpers/Api/APIResourceWithAuth.js +8 -3
- package/src/helpers/Api/Api.js +7 -4
- package/src/helpers/AsyncConnect/ssr.js +4 -1
- package/src/helpers/Content/Content.js +23 -0
- package/src/helpers/Content/Content.test.js +39 -0
- package/src/helpers/Content/withClientSideContent.jsx +35 -0
- package/src/helpers/Extensions/withBlockSchemaEnhancer.jsx +4 -1
- package/src/helpers/Html/Html.jsx +13 -7
- package/src/helpers/LanguageMap/LanguageMap.js +115 -8
- package/src/helpers/Loadable/__mocks__/Loadable.jsx +7 -22
- package/src/helpers/MessageLabels/MessageLabels.js +5 -0
- package/src/helpers/Sitemap/Sitemap.js +4 -4
- package/src/helpers/Url/Url.js +33 -2
- package/src/helpers/Url/Url.test.js +62 -0
- package/src/hooks/user/useUser.js +1 -1
- package/src/internalChecks.test.ts +11 -0
- package/src/middleware/Api.test.js +4 -0
- package/src/middleware/api.js +82 -28
- package/src/middleware/storeProtectLoadUtils.test.js +3 -3
- package/src/reducers/content/content.js +3 -18
- package/src/reducers/diff/diff.js +5 -1
- package/src/reducers/diff/diff.test.js +60 -4
- package/src/reducers/querystring/querystring.js +8 -1
- package/src/routes.js +4 -2
- package/src/server.jsx +45 -14
- package/src/start-client.jsx +9 -6
- package/src/start-server.js +9 -3
- package/test-addons-loader.js +3 -0
- package/test-setup-config.jsx +0 -2
- package/test-setup-globals.js +30 -2
- package/theme/themes/pastanaga/extras/blocks.less +26 -0
- package/theme/themes/pastanaga/extras/contents.less +80 -5
- package/theme/themes/pastanaga/extras/main.less +17 -2
- package/theme/themes/pastanaga/extras/widgets.less +79 -0
- package/tsconfig.declarations.json +1 -1
- package/tsconfig.json +4 -5
- package/types/components/manage/Blocks/Teaser/schema.d.ts +1 -0
- package/types/components/manage/Contents/DropZoneContent.d.ts +2 -0
- package/types/components/manage/Contents/__mocks__/index.d.ts +2 -2
- package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
- package/types/components/manage/Controlpanels/Users/RenderUsers.d.ts +18 -2
- package/types/components/manage/Controlpanels/Users/UsersControlpanel.d.ts +6 -2
- package/types/components/manage/Controlpanels/index.d.ts +2 -2
- package/types/components/manage/Form/__mocks__/index.d.ts +8 -8
- package/types/components/manage/Multilingual/ManageTranslations.d.ts +1 -1
- package/types/components/manage/Sidebar/ObjectBrowser.d.ts +1 -1
- package/types/components/manage/Sidebar/SidebarPortal.d.ts +7 -15
- package/types/components/manage/Widgets/AlignWidget.d.ts +8 -10
- package/types/components/manage/Widgets/AlignWidget.stories.d.ts +1 -0
- package/types/components/manage/Widgets/BlockAlignment.d.ts +7 -0
- package/types/components/manage/Widgets/BlockAlignment.stories.d.ts +8 -0
- package/types/components/manage/Widgets/BlockWidth.d.ts +7 -0
- package/types/components/manage/Widgets/BlockWidth.stories.d.ts +6 -0
- package/types/components/manage/Widgets/ButtonsWidget.d.ts +48 -1
- package/types/components/manage/Widgets/ButtonsWidget.stories.d.ts +3 -0
- package/types/components/manage/Widgets/FormFieldWrapper.d.ts +28 -5
- package/types/components/manage/Widgets/ImageWidget.d.ts +41 -1
- package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/ObjectBrowserWidget.d.ts +2 -0
- package/types/components/manage/Widgets/QueryWidget.d.ts +5 -2
- package/types/components/manage/Widgets/RecurrenceWidget/Utils.d.ts +12 -18
- package/types/components/manage/Widgets/Size.d.ts +7 -0
- package/types/components/manage/Widgets/Size.stories.d.ts +6 -0
- package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/__mocks__/index.d.ts +33 -33
- package/types/components/manage/Widgets/index.d.ts +11 -6
- package/types/components/theme/FormattedDate/FormattedDate.stories.d.ts +1 -1
- package/types/components/theme/InjectPloneComponentsCSS/InjectPloneComponentsCSS.d.ts +3 -0
- package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
- package/types/components/theme/Unauthorized/Unauthorized.d.ts +2 -2
- package/types/config/Widgets.d.ts +6 -0
- package/types/config/slots.d.ts +7 -0
- package/types/helpers/Content/Content.d.ts +7 -0
- package/types/helpers/Content/withClientSideContent.d.ts +1 -0
- package/types/helpers/Extensions/withBlockSchemaEnhancer.d.ts +4 -5
- package/types/helpers/Helmet/Helmet.d.ts +1 -1
- package/types/helpers/LanguageMap/LanguageMap.d.ts +428 -4
- package/types/helpers/Loadable/__mocks__/Loadable.d.ts +2 -2
- package/types/helpers/MessageLabels/MessageLabels.d.ts +68 -62
- package/types/helpers/Url/Url.d.ts +14 -0
- package/types/helpers/Url/bulkFlattenToAppURL.d.ts +5 -0
- package/types/middleware/api.d.ts +6 -9
- package/types/reducers/index.d.ts +1 -0
- package/types/start-client.d.ts +0 -1
- package/vitest.config.mjs +4 -4
- package/webpack-plugins/webpack-scss-plugin.js +172 -0
- package/jest-addons-loader.js +0 -3
- package/jest-extender-plugin.js +0 -39
- package/jest-setup-afterenv.js +0 -2
- package/jest-svgsystem-transform.js +0 -10
- package/package-why.json +0 -34
- package/patches/patchit.sh +0 -2
- package/patches/razzle-jest.patch +0 -10
- package/src/actions/content/content.multilingual.test.js +0 -17
- package/src/components/manage/Contents/__mocks__/index.vitest.tsx +0 -5
- package/src/components/manage/Form/__mocks__/index.vitest.tsx +0 -73
- package/src/components/manage/Sidebar/SidebarPortal.jsx +0 -47
- package/src/components/manage/Sidebar/SidebarPortal.test.jsx +0 -26
- package/src/components/manage/Widgets/AlignWidget.test.jsx +0 -59
- package/src/components/manage/Widgets/ButtonsWidget.jsx +0 -41
- package/src/components/manage/Widgets/ButtonsWidget.test.jsx +0 -70
- package/src/components/manage/Widgets/__mocks__/index.vitest.tsx +0 -41
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -77
- package/src/helpers/Loadable/__mocks__/Loadable.vitest.jsx +0 -39
- package/test-setup-globals-vitest.js +0 -46
- package/theme/themes/pastanaga/extras/utils.less +0 -63
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/* Razzle SCSS Webpack Plugin `razzle-plugin-scss`
|
|
2
|
+
Forked from https://github.com/jaredpalmer/razzle/blob/master/packages/razzle-plugin-scss/index.js
|
|
3
|
+
version 4.2.18
|
|
4
|
+
See Volto's upgrade guide for more information:
|
|
5
|
+
https://6.docs.plone.org/volto/upgrade-guide/index.html
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const autoprefixer = require('autoprefixer');
|
|
9
|
+
const merge = require('deepmerge');
|
|
10
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
11
|
+
const paths = require('@plone/razzle/config/paths');
|
|
12
|
+
const postcssLoadConfig = require('postcss-load-config');
|
|
13
|
+
|
|
14
|
+
const hasPostCssConfig = () => {
|
|
15
|
+
try {
|
|
16
|
+
return !!postcssLoadConfig.sync();
|
|
17
|
+
} catch (_error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
modifyWebpackConfig(opts) {
|
|
24
|
+
const isServer = opts.env.target !== 'web';
|
|
25
|
+
const constantEnv = opts.env.dev ? 'dev' : 'prod';
|
|
26
|
+
|
|
27
|
+
const razzleOptions = opts.options.razzleOptions;
|
|
28
|
+
const config = Object.assign({}, opts.webpackConfig);
|
|
29
|
+
|
|
30
|
+
const defaultOptions = {
|
|
31
|
+
postcss: {
|
|
32
|
+
dev: {
|
|
33
|
+
sourceMap: true,
|
|
34
|
+
ident: 'postcss',
|
|
35
|
+
},
|
|
36
|
+
prod: {
|
|
37
|
+
sourceMap: razzleOptions.enableSourceMaps,
|
|
38
|
+
ident: 'postcss',
|
|
39
|
+
},
|
|
40
|
+
plugins: [
|
|
41
|
+
[
|
|
42
|
+
autoprefixer,
|
|
43
|
+
{
|
|
44
|
+
overrideBrowserslist: opts.options.razzleOptions.browserslist || [
|
|
45
|
+
'>1%',
|
|
46
|
+
'last 4 versions',
|
|
47
|
+
'Firefox ESR',
|
|
48
|
+
'not ie < 9',
|
|
49
|
+
],
|
|
50
|
+
flexbox: 'no-2009',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
sass: {
|
|
56
|
+
dev: {
|
|
57
|
+
sassOptions: {
|
|
58
|
+
sourceMap: true,
|
|
59
|
+
includePaths: [paths.appNodeModules],
|
|
60
|
+
outputStyle: 'expanded',
|
|
61
|
+
silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
|
|
62
|
+
quiet: true,
|
|
63
|
+
quietDeps: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
prod: {
|
|
67
|
+
sassOptions: {
|
|
68
|
+
// XXX Source maps are required for the resolve-url-loader to properly
|
|
69
|
+
// function. Disable them in later stages if you do not want source maps.
|
|
70
|
+
sourceMap: true,
|
|
71
|
+
sourceMapContents: false,
|
|
72
|
+
includePaths: [paths.appNodeModules],
|
|
73
|
+
outputStyle: 'expanded',
|
|
74
|
+
silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
|
|
75
|
+
quiet: true,
|
|
76
|
+
quietDeps: true,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
css: {
|
|
81
|
+
dev: {
|
|
82
|
+
sourceMap: true,
|
|
83
|
+
importLoaders: 1,
|
|
84
|
+
modules: {
|
|
85
|
+
auto: true,
|
|
86
|
+
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
prod: {
|
|
90
|
+
sourceMap: razzleOptions.enableSourceMaps,
|
|
91
|
+
importLoaders: 1,
|
|
92
|
+
modules: {
|
|
93
|
+
auto: true,
|
|
94
|
+
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
style: {},
|
|
99
|
+
resolveUrl: {
|
|
100
|
+
dev: {},
|
|
101
|
+
prod: {},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const options = Object.assign(
|
|
106
|
+
{},
|
|
107
|
+
defaultOptions,
|
|
108
|
+
opts.options.pluginOptions,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const styleLoader = {
|
|
112
|
+
loader: require.resolve('style-loader'),
|
|
113
|
+
options: options.style,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const cssLoader = {
|
|
117
|
+
loader: require.resolve('css-loader'),
|
|
118
|
+
options: options.css[constantEnv],
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const resolveUrlLoader = {
|
|
122
|
+
loader: require.resolve('resolve-url-loader'),
|
|
123
|
+
options: options.resolveUrl[constantEnv],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const postCssLoader = {
|
|
127
|
+
loader: require.resolve('postcss-loader'),
|
|
128
|
+
options: hasPostCssConfig()
|
|
129
|
+
? undefined
|
|
130
|
+
: {
|
|
131
|
+
postcssOptions: Object.assign({}, options.postcss[constantEnv], {
|
|
132
|
+
plugins: options.postcss.plugins,
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const sassLoader = {
|
|
138
|
+
loader: require.resolve('sass-loader'),
|
|
139
|
+
options: options.sass[constantEnv],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
config.module.rules = [
|
|
143
|
+
...config.module.rules,
|
|
144
|
+
{
|
|
145
|
+
test: /\.(sa|sc)ss$/,
|
|
146
|
+
use: isServer
|
|
147
|
+
? [
|
|
148
|
+
{
|
|
149
|
+
loader: require.resolve('css-loader'),
|
|
150
|
+
options: merge(options.css[constantEnv], {
|
|
151
|
+
modules: {
|
|
152
|
+
exportOnlyLocals: true,
|
|
153
|
+
},
|
|
154
|
+
}),
|
|
155
|
+
},
|
|
156
|
+
resolveUrlLoader,
|
|
157
|
+
postCssLoader,
|
|
158
|
+
sassLoader,
|
|
159
|
+
]
|
|
160
|
+
: [
|
|
161
|
+
opts.env.dev ? styleLoader : MiniCssExtractPlugin.loader,
|
|
162
|
+
cssLoader,
|
|
163
|
+
postCssLoader,
|
|
164
|
+
resolveUrlLoader,
|
|
165
|
+
sassLoader,
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
return config;
|
|
171
|
+
},
|
|
172
|
+
};
|
package/jest-addons-loader.js
DELETED
package/jest-extender-plugin.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Extends the Volto test configuration by injecting the keys in `jest.config.js`
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const projectRootPath = path.resolve('.');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
modifyJestConfig({
|
|
8
|
-
jestConfig: config,
|
|
9
|
-
webpackObject,
|
|
10
|
-
options: { razzleOptions, pluginOptions },
|
|
11
|
-
paths,
|
|
12
|
-
}) {
|
|
13
|
-
// If the RAZZLE_JEST_CONFIG env var exists,
|
|
14
|
-
// use it as the file with the Jest config overrides
|
|
15
|
-
if (process.env.RAZZLE_JEST_CONFIG) {
|
|
16
|
-
if (fs.existsSync(path.resolve(process.env.RAZZLE_JEST_CONFIG))) {
|
|
17
|
-
const jestConfigPath = path.resolve(process.env.RAZZLE_JEST_CONFIG);
|
|
18
|
-
const jestConfig = require(jestConfigPath);
|
|
19
|
-
config = { ...config, ...jestConfig };
|
|
20
|
-
return config;
|
|
21
|
-
}
|
|
22
|
-
if (
|
|
23
|
-
fs.existsSync(`${projectRootPath}/${process.env.RAZZLE_JEST_CONFIG}`)
|
|
24
|
-
) {
|
|
25
|
-
const jestConfig = require(
|
|
26
|
-
`${projectRootPath}/${process.env.RAZZLE_JEST_CONFIG}`,
|
|
27
|
-
);
|
|
28
|
-
config = { ...config, ...jestConfig };
|
|
29
|
-
}
|
|
30
|
-
// if not, use the sensible default, `jest.config.js`
|
|
31
|
-
} else {
|
|
32
|
-
if (fs.existsSync(`${projectRootPath}/jest.config.js`)) {
|
|
33
|
-
const jestConfig = require(`${projectRootPath}/jest.config.js`);
|
|
34
|
-
config = { ...config, ...jestConfig };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return config;
|
|
38
|
-
},
|
|
39
|
-
};
|
package/jest-setup-afterenv.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
process(src, filename) {
|
|
5
|
-
if (filename.includes('src/icons')) {
|
|
6
|
-
return `module.exports = { attributes: { xmlns: '', viewBox: ''}}`;
|
|
7
|
-
}
|
|
8
|
-
return `module.exports = ${JSON.stringify(path.basename(filename))}`;
|
|
9
|
-
},
|
|
10
|
-
};
|
package/package-why.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scripts": {
|
|
3
|
-
"postinstall": "Description for `npm run postinstall` command",
|
|
4
|
-
"analyze": "Description for `npm run analyze` command",
|
|
5
|
-
"start": "Description for `npm run start` command",
|
|
6
|
-
"build": "Description for `npm run build` command",
|
|
7
|
-
"build:clean": "Description for `npm run build:clean` command",
|
|
8
|
-
"dist:clean": "Description for `npm run dist:clean` command",
|
|
9
|
-
"build:dist": "Description for `npm run build:dist` command",
|
|
10
|
-
"test": "Description for `npm run test` command",
|
|
11
|
-
"test:ci": "Description for `npm run test:ci` command",
|
|
12
|
-
"test:husky": "Description for `npm run test:husky` command",
|
|
13
|
-
"test:debug": "Description for `npm run test:debug` command",
|
|
14
|
-
"start:prod": "Description for `npm run start:prod` command",
|
|
15
|
-
"start:dist": "Description for `npm run start:dist` command",
|
|
16
|
-
"prettier": "Description for `npm run prettier` command",
|
|
17
|
-
"prettier:fix": "Description for `npm run prettier:fix` command",
|
|
18
|
-
"stylelint": "Description for `npm run stylelint` command",
|
|
19
|
-
"stylelint:overrides": "Description for `npm run stylelint:overrides` command",
|
|
20
|
-
"stylelint:fix": "Description for `npm run stylelint:fix` command",
|
|
21
|
-
"lint": "Description for `npm run lint` command",
|
|
22
|
-
"lint:fix": "Description for `npm run lint:fix` command",
|
|
23
|
-
"i18n": "Description for `npm run i18n` command",
|
|
24
|
-
"i18n:ci": "Description for `npm run i18n:ci` command",
|
|
25
|
-
"stylelint:patches": "Description for `npm run stylelint:patches` command",
|
|
26
|
-
"patches": "Description for `npm run patches` command",
|
|
27
|
-
"dry-release": "Description for `npm run dry-release` command",
|
|
28
|
-
"release": "Description for `npm run release` command",
|
|
29
|
-
"release-major-alpha": "Description for `npm run release-major-alpha` command",
|
|
30
|
-
"release-alpha": "Description for `npm run release-alpha` command",
|
|
31
|
-
"storybook": "Description for `npm run storybook` command",
|
|
32
|
-
"build-storybook": "Description for `npm run build-storybook` command"
|
|
33
|
-
}
|
|
34
|
-
}
|
package/patches/patchit.sh
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
--- /Users/sneridagh/Development/plone/volto/node_modules/razzle/config/createJestConfig.js 2020-11-07 16:11:14.489360747 +0100
|
|
2
|
-
+++ /Users/sneridagh/Development/plone/volto/node_modules/razzle/config/createJestConfigNew.js 2020-11-07 16:13:44.816817775 +0100
|
|
3
|
-
@@ -84,6 +84,7 @@
|
|
4
|
-
'mapCoverage',
|
|
5
|
-
'moduleDirectories',
|
|
6
|
-
'moduleFileExtensions',
|
|
7
|
-
+ 'modulePathIgnorePatterns',
|
|
8
|
-
'moduleNameMapper',
|
|
9
|
-
'modulePaths',
|
|
10
|
-
'snapshotSerializers',
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getContent } from './content';
|
|
2
|
-
import { GET_CONTENT } from '@plone/volto/constants/ActionTypes';
|
|
3
|
-
import config from '@plone/volto/registry';
|
|
4
|
-
|
|
5
|
-
config.settings.isMultilingual = true;
|
|
6
|
-
config.settings.supportedLanguages = ['de', 'es'];
|
|
7
|
-
|
|
8
|
-
describe('getContent', () => {
|
|
9
|
-
it('[Multilingual] should create an action to get content', () => {
|
|
10
|
-
const url = 'http://localhost';
|
|
11
|
-
const action = getContent(url);
|
|
12
|
-
|
|
13
|
-
expect(action.type).toEqual(GET_CONTENT);
|
|
14
|
-
expect(action.request.op).toEqual('get');
|
|
15
|
-
expect(action.request.path).toEqual(`${url}?expand=translations`);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema } from '@plone/types';
|
|
2
|
-
import type { Ref } from 'react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
const cleanupSchema = (schema: JSONSchema | null): JSONSchema | null => {
|
|
6
|
-
if (!schema || !schema.properties) return schema;
|
|
7
|
-
return {
|
|
8
|
-
...schema,
|
|
9
|
-
properties: Object.entries(schema.properties).reduce<Record<string, any>>(
|
|
10
|
-
(acc, [key, value]) => {
|
|
11
|
-
acc[key] = {
|
|
12
|
-
...value,
|
|
13
|
-
description:
|
|
14
|
-
typeof value.description === 'string'
|
|
15
|
-
? value.description
|
|
16
|
-
: undefined,
|
|
17
|
-
};
|
|
18
|
-
return acc;
|
|
19
|
-
},
|
|
20
|
-
{},
|
|
21
|
-
),
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Field = vi.fn((props) => (
|
|
26
|
-
<div className="Field" id={props.id}>
|
|
27
|
-
{props.title}
|
|
28
|
-
</div>
|
|
29
|
-
));
|
|
30
|
-
|
|
31
|
-
export const InlineForm = vi.fn((props) => (
|
|
32
|
-
<div
|
|
33
|
-
id="InlineForm"
|
|
34
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
35
|
-
/>
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
export const ModalForm = vi.fn((props) => (
|
|
39
|
-
<div
|
|
40
|
-
id="ModalForm"
|
|
41
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
42
|
-
/>
|
|
43
|
-
));
|
|
44
|
-
|
|
45
|
-
export const UndoToolbar = vi.fn(() => <div id="UndoToolbar" />);
|
|
46
|
-
|
|
47
|
-
export const BlocksToolbar = vi.fn(() => <div id="BlocksToolbar" />);
|
|
48
|
-
|
|
49
|
-
export const BlockDataForm = vi.fn((props) => (
|
|
50
|
-
<div
|
|
51
|
-
id="BlockDataForm"
|
|
52
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
53
|
-
/>
|
|
54
|
-
));
|
|
55
|
-
|
|
56
|
-
export const BlocksForm = vi.fn((props) => (
|
|
57
|
-
<div
|
|
58
|
-
id="BlocksForm"
|
|
59
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
60
|
-
/>
|
|
61
|
-
));
|
|
62
|
-
|
|
63
|
-
const MockForm = forwardRef(
|
|
64
|
-
(props: { schema: JSONSchema | null }, ref: Ref<any>) => (
|
|
65
|
-
<div
|
|
66
|
-
id="Form"
|
|
67
|
-
data-schema={JSON.stringify(cleanupSchema(props.schema), null, 2)}
|
|
68
|
-
ref={ref}
|
|
69
|
-
/>
|
|
70
|
-
),
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
export const Form = vi.fn((props) => <MockForm {...props} />);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Portal that wraps Sidebar components
|
|
7
|
-
* @param {React.ReactNode} children Sidebar content
|
|
8
|
-
* @param {bool} selected Sidebar needs to know when the related block is selected
|
|
9
|
-
* @param {string} tab Element id where to insert sidebar content, default: sidebar-properties
|
|
10
|
-
* @returns {string} Rendered sidebar
|
|
11
|
-
*/
|
|
12
|
-
const SidebarPortal = ({ children, selected, tab = 'sidebar-properties' }) => {
|
|
13
|
-
const [isClient, setIsClient] = React.useState(null);
|
|
14
|
-
|
|
15
|
-
React.useEffect(() => setIsClient(true), []);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
{isClient &&
|
|
20
|
-
selected &&
|
|
21
|
-
createPortal(
|
|
22
|
-
<div role="form" style={{ height: '100%' }}>
|
|
23
|
-
<div
|
|
24
|
-
style={{ height: '100%' }}
|
|
25
|
-
role="presentation"
|
|
26
|
-
onClick={(e) => {
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
}}
|
|
29
|
-
onKeyDown={(e) => {
|
|
30
|
-
e.stopPropagation();
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</div>
|
|
35
|
-
</div>,
|
|
36
|
-
document.getElementById(tab),
|
|
37
|
-
)}
|
|
38
|
-
</>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
SidebarPortal.propTypes = {
|
|
43
|
-
children: PropTypes.any,
|
|
44
|
-
selected: PropTypes.bool.isRequired,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default SidebarPortal;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ShallowRenderer from 'react-test-renderer/shallow';
|
|
3
|
-
|
|
4
|
-
import SidebarPortal from './SidebarPortal';
|
|
5
|
-
|
|
6
|
-
test('sidebar portal is rendered when the block is selected', () => {
|
|
7
|
-
const renderer = new ShallowRenderer();
|
|
8
|
-
renderer.render(
|
|
9
|
-
<SidebarPortal selected={true}>
|
|
10
|
-
<p>Tested!</p>
|
|
11
|
-
</SidebarPortal>,
|
|
12
|
-
);
|
|
13
|
-
const component = renderer.getRenderOutput();
|
|
14
|
-
expect(component).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('sidebar portal is not rendered when the block is not selected', () => {
|
|
18
|
-
const renderer = new ShallowRenderer();
|
|
19
|
-
renderer.render(
|
|
20
|
-
<SidebarPortal selected={false}>
|
|
21
|
-
<p>Tested, but you shouldn't see this in the snapshot!</p>
|
|
22
|
-
</SidebarPortal>,
|
|
23
|
-
);
|
|
24
|
-
const component = renderer.getRenderOutput();
|
|
25
|
-
expect(component).toMatchSnapshot();
|
|
26
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
|
-
import { Provider } from 'react-intl-redux';
|
|
5
|
-
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
6
|
-
|
|
7
|
-
import AlignWidget from './AlignWidget';
|
|
8
|
-
|
|
9
|
-
const mockStore = configureStore();
|
|
10
|
-
|
|
11
|
-
describe('renders an align widget component', () => {
|
|
12
|
-
it('basic', () => {
|
|
13
|
-
const store = mockStore({
|
|
14
|
-
intl: {
|
|
15
|
-
locale: 'en',
|
|
16
|
-
messages: {},
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const { asFragment } = render(
|
|
21
|
-
<Provider store={store}>
|
|
22
|
-
<AlignWidget
|
|
23
|
-
id="align"
|
|
24
|
-
title="Alignment"
|
|
25
|
-
fieldSet="default"
|
|
26
|
-
onChange={() => {}}
|
|
27
|
-
/>
|
|
28
|
-
</Provider>,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
expect(asFragment()).toMatchSnapshot();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('extended with actions and actionsInfoMap props', () => {
|
|
35
|
-
const store = mockStore({
|
|
36
|
-
intl: {
|
|
37
|
-
locale: 'en',
|
|
38
|
-
messages: {},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const { asFragment } = render(
|
|
43
|
-
<Provider store={store}>
|
|
44
|
-
<AlignWidget
|
|
45
|
-
id="align"
|
|
46
|
-
title="Alignment"
|
|
47
|
-
fieldSet="default"
|
|
48
|
-
onChange={() => {}}
|
|
49
|
-
actions={['additional']}
|
|
50
|
-
actionsInfoMap={{
|
|
51
|
-
additional: [imageFullSVG, 'Additional action title'],
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
</Provider>,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
expect(asFragment()).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
3
|
-
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
|
-
import { Button } from 'semantic-ui-react';
|
|
5
|
-
|
|
6
|
-
// The ButtonsWidget
|
|
7
|
-
const ButtonsWidget = (props) => {
|
|
8
|
-
const { id, onChange, actions, actionsInfoMap, defaultAction, value } = props;
|
|
9
|
-
|
|
10
|
-
React.useEffect(() => {
|
|
11
|
-
if (!props.value && props.default) {
|
|
12
|
-
props.onChange(props.id, props.default);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<FormFieldWrapper {...props} className="align-widget">
|
|
18
|
-
<div className="align-buttons">
|
|
19
|
-
{actions.map((action) => (
|
|
20
|
-
<Button.Group key={action}>
|
|
21
|
-
<Button
|
|
22
|
-
icon
|
|
23
|
-
basic
|
|
24
|
-
aria-label={actionsInfoMap[action][1]}
|
|
25
|
-
onClick={() => onChange(id, action)}
|
|
26
|
-
active={(action === defaultAction && !value) || value === action}
|
|
27
|
-
>
|
|
28
|
-
<Icon
|
|
29
|
-
name={actionsInfoMap[action][0]}
|
|
30
|
-
title={actionsInfoMap[action][1] || action}
|
|
31
|
-
size="24px"
|
|
32
|
-
/>
|
|
33
|
-
</Button>
|
|
34
|
-
</Button.Group>
|
|
35
|
-
))}
|
|
36
|
-
</div>
|
|
37
|
-
</FormFieldWrapper>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default ButtonsWidget;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import configureStore from 'redux-mock-store';
|
|
4
|
-
import { Provider } from 'react-intl-redux';
|
|
5
|
-
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
6
|
-
import textJustifiedSVG from '@plone/volto/icons/align-justify.svg';
|
|
7
|
-
import textCenteredSVG from '@plone/volto/icons/align-center.svg';
|
|
8
|
-
import textLeftSVG from '@plone/volto/icons/align-left.svg';
|
|
9
|
-
import textRightSVG from '@plone/volto/icons/align-right.svg';
|
|
10
|
-
|
|
11
|
-
import ButtonsWidget from './ButtonsWidget';
|
|
12
|
-
|
|
13
|
-
const mockStore = configureStore();
|
|
14
|
-
|
|
15
|
-
describe('renders an align widget component', () => {
|
|
16
|
-
it('basic', () => {
|
|
17
|
-
const store = mockStore({
|
|
18
|
-
intl: {
|
|
19
|
-
locale: 'en',
|
|
20
|
-
messages: {},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const { asFragment } = render(
|
|
25
|
-
<Provider store={store}>
|
|
26
|
-
<ButtonsWidget
|
|
27
|
-
id="align"
|
|
28
|
-
title="Alignment"
|
|
29
|
-
fieldSet="default"
|
|
30
|
-
onChange={() => {}}
|
|
31
|
-
actions={['left', 'right', 'centered', 'justified']}
|
|
32
|
-
actionsInfoMap={{
|
|
33
|
-
left: [textLeftSVG, 'Text Left'],
|
|
34
|
-
right: [textRightSVG, 'Text Right'],
|
|
35
|
-
justified: [textJustifiedSVG, 'Text Justified'],
|
|
36
|
-
centered: [textCenteredSVG, 'Text Centered'],
|
|
37
|
-
}}
|
|
38
|
-
/>
|
|
39
|
-
</Provider>,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(asFragment()).toMatchSnapshot();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('extended with actions and actionsInfoMap props', () => {
|
|
46
|
-
const store = mockStore({
|
|
47
|
-
intl: {
|
|
48
|
-
locale: 'en',
|
|
49
|
-
messages: {},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const { asFragment } = render(
|
|
54
|
-
<Provider store={store}>
|
|
55
|
-
<ButtonsWidget
|
|
56
|
-
id="align"
|
|
57
|
-
title="Alignment"
|
|
58
|
-
fieldSet="default"
|
|
59
|
-
onChange={() => {}}
|
|
60
|
-
actions={['additional']}
|
|
61
|
-
actionsInfoMap={{
|
|
62
|
-
additional: [imageFullSVG, 'Additional action title'],
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
</Provider>,
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
expect(asFragment()).toMatchSnapshot();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const AlignWidget = vi.fn(() => <div id="AlignWidget" />);
|
|
2
|
-
export const ButtonsWidget = vi.fn(() => <div id="ButtonsWidget" />);
|
|
3
|
-
export const ArrayWidget = vi.fn(() => <div id="ArrayWidget" />);
|
|
4
|
-
export const CheckboxWidget = vi.fn(() => <div id="CheckboxWidget" />);
|
|
5
|
-
export const FileWidget = vi.fn(() => <div id="FileWidget" />);
|
|
6
|
-
export const IdWidget = vi.fn(() => <div id="IdWidget" />);
|
|
7
|
-
export const PasswordWidget = vi.fn(() => <div id="PasswordWidget" />);
|
|
8
|
-
export const QueryWidget = vi.fn(() => <div id="QueryWidget" />);
|
|
9
|
-
export const QuerySortOnWidget = vi.fn(() => <div id="QuerySortOnWidget" />);
|
|
10
|
-
export const QuerystringWidget = vi.fn(() => <div id="QuerystringWidget" />);
|
|
11
|
-
export const SchemaWidget = vi.fn(() => <div id="SchemaWidget" />);
|
|
12
|
-
export const SelectWidget = vi.fn(() => <div id="SelectWidget" />);
|
|
13
|
-
export const TextareaWidget = vi.fn(() => <div id="TextareaWidget" />);
|
|
14
|
-
export const TextWidget = vi.fn(() => <div id="TextWidget" />);
|
|
15
|
-
export const TokenWidget = vi.fn(() => <div id="TokenWidget" />);
|
|
16
|
-
export const WysiwygWidget = vi.fn(() => <div id="WysiwygWidget" />);
|
|
17
|
-
export const UrlWidget = vi.fn(() => <div id="UrlWidget" />);
|
|
18
|
-
export const InternalUrlWidget = vi.fn(() => <div id="InternalUrlWidget" />);
|
|
19
|
-
export const EmailWidget = vi.fn(() => <div id="EmailWidget" />);
|
|
20
|
-
export const NumberWidget = vi.fn(() => <div id="NumberWidget" />);
|
|
21
|
-
export const ImageSizeWidget = vi.fn(() => <div id="ImageSizeWidget" />);
|
|
22
|
-
export const RegistryImageWidget = vi.fn(() => (
|
|
23
|
-
<div id="RegistryImageWidget" />
|
|
24
|
-
));
|
|
25
|
-
export const ReferenceWidget = vi.fn(() => <div id="ReferenceWidget" />);
|
|
26
|
-
export const ObjectBrowserWidget = vi.fn(() => (
|
|
27
|
-
<div id="ObjectBrowserWidget" />
|
|
28
|
-
));
|
|
29
|
-
export const ObjectWidget = vi.fn(() => <div id="ObjectWidget" />);
|
|
30
|
-
export const ObjectListWidget = vi.fn(() => <div id="ObjectListWidget" />);
|
|
31
|
-
export const VocabularyTermsWidget = vi.fn(() => (
|
|
32
|
-
<div id="VocabularyTermsWidget" />
|
|
33
|
-
));
|
|
34
|
-
export const SelectMetadataWidget = vi.fn(() => (
|
|
35
|
-
<div id="SelectMetadataWidget" />
|
|
36
|
-
));
|
|
37
|
-
export const SelectAutoComplete = vi.fn(() => <div id="SelectAutoComplete" />);
|
|
38
|
-
export const ColorPickerWidget = vi.fn(() => <div id="ColorPickerWidget" />);
|
|
39
|
-
export const DatetimeWidget = vi.fn(() => <div id="DatetimeWidget" />);
|
|
40
|
-
export const RecurrenceWidget = vi.fn(() => <div id="RecurrenceWidget" />);
|
|
41
|
-
export const FormFieldWrapper = vi.fn(() => <div id="FormFieldWrapper" />);
|