@plone/volto 18.35.0 → 18.36.0
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/CHANGELOG.md +58 -0
- package/locales/af/LC_MESSAGES/volto.po +42 -11
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +42 -11
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +42 -11
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +42 -11
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +42 -11
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +42 -11
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +42 -11
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +42 -11
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +42 -11
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +42 -11
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +42 -11
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +42 -11
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +42 -11
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +42 -11
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +42 -11
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +42 -11
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +42 -11
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +42 -11
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +42 -11
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +42 -11
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +42 -11
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +42 -11
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +42 -11
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +42 -11
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +42 -11
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +42 -11
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +42 -11
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +42 -11
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +42 -11
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +42 -11
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +42 -11
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +42 -11
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +42 -11
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +42 -11
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +42 -11
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +42 -11
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +42 -11
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +42 -11
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +42 -11
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +42 -11
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +42 -11
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +42 -11
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +42 -11
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +42 -11
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +42 -11
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +42 -11
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +42 -11
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +42 -11
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +42 -11
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +42 -11
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +42 -11
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +42 -11
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +42 -11
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +42 -11
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +42 -11
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +42 -11
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +42 -11
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +42 -11
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +42 -11
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +42 -11
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +42 -11
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +42 -11
- package/locales/vi.json +1 -1
- package/locales/volto.pot +40 -9
- package/locales/zh_CN/LC_MESSAGES/volto.po +42 -11
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +42 -11
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +42 -11
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +18 -22
- package/src/actions/querystringsearch/querystringsearch.js +4 -1
- package/src/actions/querystringsearch/querystringsearch.test.js +77 -0
- package/src/components/manage/BlockChooser/BlockChooser.jsx +7 -10
- package/src/components/manage/Blocks/Block/Edit.jsx +9 -10
- package/src/components/manage/Blocks/Block/Order/Item.jsx +9 -4
- package/src/components/manage/Blocks/Image/View.test.jsx +8 -8
- package/src/components/manage/Contents/Contents.jsx +3 -3
- package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +7 -6
- package/src/components/manage/Contents/ContentsItem.jsx +1 -3
- package/src/components/manage/Contents/DropZoneContent.jsx +1 -0
- package/src/components/manage/Sidebar/ObjectBrowser.jsx +7 -0
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +30 -5
- package/src/components/manage/Sidebar/ObjectBrowserBody.test.jsx +52 -0
- package/src/components/manage/Toolbar/More.jsx +13 -0
- package/src/components/manage/Toolbar/Toolbar.jsx +91 -8
- package/src/components/manage/Widgets/ArrayWidget.jsx +3 -2
- package/src/components/manage/Widgets/FileWidget.jsx +71 -17
- package/src/components/manage/Widgets/FormFieldWrapper.jsx +16 -3
- package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +1 -0
- package/src/components/manage/Widgets/QuerystringWidget.jsx +1 -18
- package/src/components/manage/Widgets/QuerystringWidget.test.jsx +45 -2
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +4 -2
- package/src/components/manage/Widgets/SelectStyling.jsx +33 -1
- package/src/components/manage/Widgets/SelectWidget.jsx +3 -2
- package/src/components/manage/Widgets/TextWidget.test.jsx +44 -0
- package/src/components/theme/Sitemap/Sitemap.jsx +21 -28
- package/src/components/theme/Sitemap/Sitemap.test.jsx +18 -0
- package/src/components/theme/Unauthorized/Unauthorized.jsx +1 -2
- package/src/components/theme/View/EventView.stories.jsx +89 -0
- package/src/components/theme/View/FileView.stories.jsx +50 -0
- package/src/components/theme/View/LinkView.stories.jsx +57 -0
- package/src/components/theme/View/ListingView.stories.jsx +70 -0
- package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
- package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
- package/src/components/theme/View/SummaryView.stories.jsx +71 -0
- package/src/components/theme/View/TabularView.stories.jsx +66 -0
- package/src/config/index.js +1 -0
- package/src/helpers/I18n/I18n.test.ts +44 -0
- package/src/helpers/I18n/I18n.ts +31 -0
- package/src/helpers/index.js +1 -0
- package/src/server.jsx +7 -1
- package/theme/themes/pastanaga/extras/focus.less +33 -0
- package/theme/themes/pastanaga/extras/main.less +2 -0
- package/theme/themes/pastanaga/extras/skiplinks.less +0 -2
- package/theme/themes/pastanaga/globals/site.variables +7 -0
- package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
- 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/ObjectBrowserBody.test.d.ts +1 -0
- package/types/components/manage/Widgets/ImageWidget.d.ts +1 -1
- package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/QuerystringWidget.d.ts +0 -4
- package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
- package/types/components/manage/Widgets/index.d.ts +2 -2
- package/types/components/theme/View/EventView.stories.d.ts +19 -0
- package/types/components/theme/View/FileView.stories.d.ts +18 -0
- package/types/components/theme/View/LinkView.stories.d.ts +18 -0
- package/types/components/theme/View/ListingView.stories.d.ts +24 -0
- package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
- package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
- package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
- package/types/components/theme/View/TabularView.stories.d.ts +23 -0
- package/types/helpers/I18n/I18n.d.ts +20 -0
- package/types/helpers/index.d.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
3
4
|
import configureStore from 'redux-mock-store';
|
|
4
5
|
import { Provider } from 'react-intl-redux';
|
|
5
6
|
|
|
@@ -30,3 +31,46 @@ test('renders a text widget component', () => {
|
|
|
30
31
|
const json = component.toJSON();
|
|
31
32
|
expect(json).toMatchSnapshot();
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
test('adds aria-required attribute to input when required prop is true', () => {
|
|
36
|
+
const store = mockStore({
|
|
37
|
+
intl: { locale: 'en', messages: {} },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
render(
|
|
41
|
+
<Provider store={store}>
|
|
42
|
+
<TextWidget
|
|
43
|
+
id="my-field"
|
|
44
|
+
title="My field"
|
|
45
|
+
onChange={() => {}}
|
|
46
|
+
onBlur={() => {}}
|
|
47
|
+
onClick={() => {}}
|
|
48
|
+
required={true}
|
|
49
|
+
/>
|
|
50
|
+
</Provider>,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('aria-required', 'true');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('adds aria-invalid attribute to input when field has errors', () => {
|
|
57
|
+
const store = mockStore({
|
|
58
|
+
intl: { locale: 'en', messages: {} },
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
render(
|
|
62
|
+
<Provider store={store}>
|
|
63
|
+
<TextWidget
|
|
64
|
+
id="my-field"
|
|
65
|
+
title="My field"
|
|
66
|
+
onChange={() => {}}
|
|
67
|
+
onBlur={() => {}}
|
|
68
|
+
onClick={() => {}}
|
|
69
|
+
required={true}
|
|
70
|
+
error={['This field is required']}
|
|
71
|
+
/>
|
|
72
|
+
</Provider>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('aria-invalid', 'true');
|
|
76
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { compose } from 'redux';
|
|
4
|
-
import { connect } from 'react-redux';
|
|
4
|
+
import { connect, useSelector } from 'react-redux';
|
|
5
5
|
import { asyncConnect } from '@plone/volto/helpers/AsyncConnect';
|
|
6
|
+
import { expandToBackendURL } from '@plone/volto/helpers/Url/Url';
|
|
6
7
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
7
8
|
import { Container as SemanticContainer } from 'semantic-ui-react';
|
|
8
9
|
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
9
|
-
import { toBackendLang } from '@plone/volto/helpers/Utils/Utils';
|
|
10
10
|
import { Link } from 'react-router-dom';
|
|
11
11
|
import config from '@plone/volto/registry';
|
|
12
12
|
|
|
@@ -20,6 +20,9 @@ const messages = defineMessages({
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export function getSitemapPath(pathname = '', lang) {
|
|
23
|
+
/* This function is deprecated
|
|
24
|
+
* We keep it for backwards compatibility.
|
|
25
|
+
*/
|
|
23
26
|
const prefix = pathname.replace(/\/sitemap$/gm, '').replace(/^\//, '');
|
|
24
27
|
const path = prefix || lang || '';
|
|
25
28
|
return path;
|
|
@@ -32,18 +35,12 @@ export function getSitemapPath(pathname = '', lang) {
|
|
|
32
35
|
* @returns {JSX.Element} - Rendered component.
|
|
33
36
|
*/
|
|
34
37
|
function Sitemap(props) {
|
|
35
|
-
const {
|
|
36
|
-
location: { pathname },
|
|
37
|
-
lang,
|
|
38
|
-
getNavigation,
|
|
39
|
-
} = props;
|
|
40
|
-
|
|
38
|
+
const { getNavigation, navroot } = props;
|
|
41
39
|
useEffect(() => {
|
|
42
40
|
const { settings } = config;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [pathname, lang, getNavigation]);
|
|
41
|
+
const path = `${expandToBackendURL(navroot?.navroot?.['@id'])}`;
|
|
42
|
+
getNavigation(path, settings.siteMapDepth);
|
|
43
|
+
}, [navroot, getNavigation]);
|
|
47
44
|
|
|
48
45
|
const renderItems = (items) => {
|
|
49
46
|
return (
|
|
@@ -64,12 +61,13 @@ function Sitemap(props) {
|
|
|
64
61
|
const Container =
|
|
65
62
|
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
66
63
|
|
|
64
|
+
const items = useSelector((state) => state.navigation.items);
|
|
67
65
|
return (
|
|
68
66
|
<div id="page-sitemap">
|
|
69
67
|
<Helmet title={props.intl.formatMessage(messages.Sitemap)} />
|
|
70
68
|
<Container className="view-wrapper">
|
|
71
69
|
<h1>{props.intl.formatMessage(messages.Sitemap)} </h1>
|
|
72
|
-
{
|
|
70
|
+
{items && renderItems(items)}
|
|
73
71
|
</Container>
|
|
74
72
|
</div>
|
|
75
73
|
);
|
|
@@ -77,18 +75,15 @@ function Sitemap(props) {
|
|
|
77
75
|
|
|
78
76
|
Sitemap.propTypes = {
|
|
79
77
|
getNavigation: PropTypes.func.isRequired,
|
|
80
|
-
|
|
78
|
+
navroot: PropTypes.object.isRequired,
|
|
81
79
|
intl: PropTypes.object.isRequired,
|
|
82
|
-
lang: PropTypes.string.isRequired,
|
|
83
|
-
items: PropTypes.array.isRequired,
|
|
84
80
|
};
|
|
85
81
|
|
|
86
82
|
export const __test__ = compose(
|
|
87
83
|
injectIntl,
|
|
88
84
|
connect(
|
|
89
85
|
(state) => ({
|
|
90
|
-
|
|
91
|
-
lang: state.intl.locale,
|
|
86
|
+
navroot: state.navroot?.data,
|
|
92
87
|
}),
|
|
93
88
|
{ getNavigation },
|
|
94
89
|
),
|
|
@@ -98,24 +93,22 @@ export default compose(
|
|
|
98
93
|
injectIntl,
|
|
99
94
|
connect(
|
|
100
95
|
(state) => ({
|
|
101
|
-
|
|
102
|
-
lang: state.intl.locale,
|
|
96
|
+
navroot: state.navroot?.data,
|
|
103
97
|
}),
|
|
104
98
|
{ getNavigation },
|
|
105
99
|
),
|
|
106
100
|
asyncConnect([
|
|
107
101
|
{
|
|
108
102
|
key: 'navigation',
|
|
109
|
-
promise: ({
|
|
103
|
+
promise: ({ store: { dispatch, getState } }) => {
|
|
110
104
|
if (!__SERVER__) return;
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
const navroot = getState().navroot.data?.navroot?.['@id'];
|
|
106
|
+
return dispatch(
|
|
107
|
+
getNavigation(
|
|
108
|
+
expandToBackendURL(navroot),
|
|
109
|
+
config.settings.siteMapDepth,
|
|
110
|
+
),
|
|
117
111
|
);
|
|
118
|
-
return dispatch(getNavigation(path, 4));
|
|
119
112
|
},
|
|
120
113
|
},
|
|
121
114
|
]),
|
|
@@ -43,6 +43,15 @@ describe('Sitemap', () => {
|
|
|
43
43
|
locale: 'en',
|
|
44
44
|
messages: {},
|
|
45
45
|
},
|
|
46
|
+
navroot: {
|
|
47
|
+
data: {
|
|
48
|
+
navroot: {
|
|
49
|
+
'@id': `http://localhost:8080/Plone/`,
|
|
50
|
+
'@type': 'Plone Site',
|
|
51
|
+
title: 'Plone Site',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
46
55
|
});
|
|
47
56
|
const component = renderer.create(
|
|
48
57
|
<Provider store={store}>
|
|
@@ -94,6 +103,15 @@ describe('Sitemap in a multilingual site', () => {
|
|
|
94
103
|
locale: 'en',
|
|
95
104
|
messages: {},
|
|
96
105
|
},
|
|
106
|
+
navroot: {
|
|
107
|
+
data: {
|
|
108
|
+
navroot: {
|
|
109
|
+
'@id': `http://localhost:8080/Plone/en`,
|
|
110
|
+
'@type': 'LRF',
|
|
111
|
+
title: 'English',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
97
115
|
});
|
|
98
116
|
const component = renderer.create(
|
|
99
117
|
<Provider store={store}>
|
|
@@ -4,7 +4,6 @@ import { Container } from 'semantic-ui-react';
|
|
|
4
4
|
import { useSelector } from 'react-redux';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { withServerErrorCode } from '@plone/volto/helpers/Utils/Utils';
|
|
7
|
-
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
8
7
|
import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
|
|
9
8
|
|
|
10
9
|
const Unauthorized = () => {
|
|
@@ -33,7 +32,7 @@ const Unauthorized = () => {
|
|
|
33
32
|
login: (
|
|
34
33
|
<Link
|
|
35
34
|
to={{
|
|
36
|
-
pathname: `${
|
|
35
|
+
pathname: `${location.pathname.replace(/\/$/, '')}/login`,
|
|
37
36
|
state: {
|
|
38
37
|
// This is needed to cover the use case of being logged in in
|
|
39
38
|
// another backend (eg. in development), having a token for
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import EventViewComponent from './EventView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
import config from '@plone/volto/registry';
|
|
6
|
+
const IntlEventViewComponent = injectIntl(EventViewComponent);
|
|
7
|
+
const { settings } = config;
|
|
8
|
+
|
|
9
|
+
function StoryComponent(args) {
|
|
10
|
+
return (
|
|
11
|
+
<Wrapper
|
|
12
|
+
customStore={{
|
|
13
|
+
intl: {
|
|
14
|
+
locale: 'en',
|
|
15
|
+
messages: {},
|
|
16
|
+
},
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
20
|
+
<IntlEventViewComponent
|
|
21
|
+
content={{
|
|
22
|
+
'@id': 'http://localhost:8080/Plone/my-page',
|
|
23
|
+
...args,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</Wrapper>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Default = StoryComponent.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
title: 'Hello World!',
|
|
33
|
+
end: '2019-06-23T16:20:00+00:00',
|
|
34
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
35
|
+
attendees: [],
|
|
36
|
+
subjects: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const EventViewAllProps = StoryComponent.bind({});
|
|
40
|
+
EventViewAllProps.args = {
|
|
41
|
+
title: 'Hello World!',
|
|
42
|
+
description: 'Hi',
|
|
43
|
+
text: {
|
|
44
|
+
data: '<p>Hello World!</p>',
|
|
45
|
+
},
|
|
46
|
+
attendees: ['John Doe', 'Mario Rossi'],
|
|
47
|
+
contact_email: 'test@example.com',
|
|
48
|
+
contact_name: 'John Doe',
|
|
49
|
+
contact_phone: '0123456789',
|
|
50
|
+
end: '2019-06-24T15:20:00+00:00',
|
|
51
|
+
event_url: 'https://www.example.com',
|
|
52
|
+
location: 'Volto, Plone',
|
|
53
|
+
open_end: false,
|
|
54
|
+
recurrence: 'RRULE:FREQ=DAILY;INTERVAL=7;COUNT=7',
|
|
55
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
56
|
+
subjects: ['Guillotina', 'Volto'],
|
|
57
|
+
whole_day: false,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const EventViewWithoutLinkToApiInTheText = StoryComponent.bind({});
|
|
61
|
+
EventViewWithoutLinkToApiInTheText.args = {
|
|
62
|
+
title: 'Hello World!',
|
|
63
|
+
attendees: [],
|
|
64
|
+
end: '2019-06-23T16:20:00+00:00',
|
|
65
|
+
start: '2019-06-23T15:20:00+00:00',
|
|
66
|
+
subjects: [],
|
|
67
|
+
text: {
|
|
68
|
+
data: `<p>Hello World!</p><p>This is an <a href="${settings.apiPath}/foo/bar">internal link</a> and a <a href="${settings.apiPath}/foo/baz">second link</a></p>`,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export default {
|
|
72
|
+
title: 'Public components/View/EventView',
|
|
73
|
+
component: EventViewComponent,
|
|
74
|
+
decorators: [
|
|
75
|
+
(Story) => (
|
|
76
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
77
|
+
<Story />
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
],
|
|
81
|
+
argTypes: {
|
|
82
|
+
end: {
|
|
83
|
+
control: 'date',
|
|
84
|
+
},
|
|
85
|
+
start: {
|
|
86
|
+
control: 'date',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import FileViewComponent from './FileView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlFileViewComponent = injectIntl(FileViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper customStore={{}}>
|
|
11
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
12
|
+
<IntlFileViewComponent
|
|
13
|
+
content={{
|
|
14
|
+
...args,
|
|
15
|
+
file: {
|
|
16
|
+
download: 'file:///preview.pdf',
|
|
17
|
+
...args,
|
|
18
|
+
},
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
</Wrapper>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Default = StoryComponent.bind({});
|
|
26
|
+
Default.args = {
|
|
27
|
+
title: 'Hello World!',
|
|
28
|
+
description: 'Hi',
|
|
29
|
+
filename: 'preview.pdf',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
title: 'Public components/View/FileView',
|
|
34
|
+
component: FileViewComponent,
|
|
35
|
+
decorators: [
|
|
36
|
+
(Story) => (
|
|
37
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
38
|
+
<Story />
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
argTypes: {
|
|
43
|
+
title: {
|
|
44
|
+
description: 'Title of the component',
|
|
45
|
+
},
|
|
46
|
+
filename: {
|
|
47
|
+
description: 'Name of the file',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import LinkViewComponent from './LinkView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlLinkViewComponent = injectIntl(LinkViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
userSession: {
|
|
13
|
+
token: null,
|
|
14
|
+
},
|
|
15
|
+
intl: {
|
|
16
|
+
locale: 'en',
|
|
17
|
+
messages: {},
|
|
18
|
+
},
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
22
|
+
<IntlLinkViewComponent
|
|
23
|
+
token="1234"
|
|
24
|
+
content={{
|
|
25
|
+
...args,
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</Wrapper>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Default = StoryComponent.bind({});
|
|
33
|
+
Default.args = {
|
|
34
|
+
title: 'Hello World!',
|
|
35
|
+
description: 'Hi',
|
|
36
|
+
remoteUrl: '/news',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
title: 'Public components/View/LinkView',
|
|
41
|
+
component: LinkViewComponent,
|
|
42
|
+
decorators: [
|
|
43
|
+
(Story) => (
|
|
44
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
45
|
+
<Story />
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
],
|
|
49
|
+
argTypes: {
|
|
50
|
+
title: {
|
|
51
|
+
description: 'Title of the component',
|
|
52
|
+
},
|
|
53
|
+
remoteUrl: {
|
|
54
|
+
description: 'remoteUrl mentioned in the page',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ListingViewComponent from './ListingView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlListingViewComponent = injectIntl(ListingViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
19
|
+
<IntlListingViewComponent
|
|
20
|
+
content={{
|
|
21
|
+
title: 'Hello World!',
|
|
22
|
+
description: 'Hi',
|
|
23
|
+
...args,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</Wrapper>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Default = StoryComponent.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
items: [
|
|
33
|
+
{
|
|
34
|
+
title: 'My item',
|
|
35
|
+
description: 'My item description',
|
|
36
|
+
url: '/item',
|
|
37
|
+
'@type': 'Document',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Second item',
|
|
41
|
+
description: 'My second item description',
|
|
42
|
+
url: '/item2',
|
|
43
|
+
'@type': 'Document',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
title: 'Public components/View/ListingView',
|
|
50
|
+
component: ListingViewComponent,
|
|
51
|
+
decorators: [
|
|
52
|
+
(Story) => (
|
|
53
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
54
|
+
<Story />
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
],
|
|
58
|
+
argTypes: {
|
|
59
|
+
items: {
|
|
60
|
+
control: 'object',
|
|
61
|
+
description: 'Listed pages',
|
|
62
|
+
},
|
|
63
|
+
title: {
|
|
64
|
+
description: 'Title of the page listed',
|
|
65
|
+
},
|
|
66
|
+
description: {
|
|
67
|
+
description: 'Description of the page',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import NewsItemViewComponent from './NewsItemView';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
const IntlNewsItemViewComponent = injectIntl(NewsItemViewComponent);
|
|
7
|
+
|
|
8
|
+
function StoryComponent(args) {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper
|
|
11
|
+
customStore={{
|
|
12
|
+
intl: {
|
|
13
|
+
locale: 'en',
|
|
14
|
+
messages: {},
|
|
15
|
+
},
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
19
|
+
<IntlNewsItemViewComponent
|
|
20
|
+
content={{
|
|
21
|
+
...args,
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</Wrapper>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Default = StoryComponent.bind({});
|
|
29
|
+
Default.args = {
|
|
30
|
+
title: 'Hello World!',
|
|
31
|
+
description: 'Hi',
|
|
32
|
+
text: {
|
|
33
|
+
data: '<p>Hello World!</p>',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
title: 'Public components/View/NewsItemView',
|
|
39
|
+
component: NewsItemViewComponent,
|
|
40
|
+
decorators: [
|
|
41
|
+
(Story) => (
|
|
42
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
43
|
+
<Story />
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
],
|
|
47
|
+
argTypes: {
|
|
48
|
+
title: {
|
|
49
|
+
description: 'Title of the page listed',
|
|
50
|
+
},
|
|
51
|
+
description: {
|
|
52
|
+
description: 'Description of the page',
|
|
53
|
+
},
|
|
54
|
+
text: {
|
|
55
|
+
description: 'Content',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { injectIntl } from 'react-intl';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import RenderBlocksComponent from './RenderBlocks';
|
|
4
|
+
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
|
|
5
|
+
|
|
6
|
+
import config from '@plone/volto/registry';
|
|
7
|
+
|
|
8
|
+
const IntlRenderBlocksComponent = injectIntl(RenderBlocksComponent);
|
|
9
|
+
|
|
10
|
+
function StoryComponent(args) {
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper
|
|
13
|
+
customStore={{
|
|
14
|
+
intl: {
|
|
15
|
+
locale: 'en',
|
|
16
|
+
messages: {},
|
|
17
|
+
},
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<div id="toolbar" style={{ display: 'none' }} />
|
|
21
|
+
<IntlRenderBlocksComponent
|
|
22
|
+
blocksConfig={{
|
|
23
|
+
...config.blocks.blocksConfig,
|
|
24
|
+
custom: {
|
|
25
|
+
id: 'custom',
|
|
26
|
+
...args,
|
|
27
|
+
},
|
|
28
|
+
}}
|
|
29
|
+
content={{
|
|
30
|
+
blocks_layout: {
|
|
31
|
+
items: ['a', 'b'],
|
|
32
|
+
},
|
|
33
|
+
...args,
|
|
34
|
+
}}
|
|
35
|
+
path="/foo"
|
|
36
|
+
/>
|
|
37
|
+
</Wrapper>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Default = StoryComponent.bind({});
|
|
42
|
+
Default.args = {
|
|
43
|
+
view: ({ id, data }) => (
|
|
44
|
+
<div>
|
|
45
|
+
{id} - {data.text}
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
blocks: {
|
|
49
|
+
a: {
|
|
50
|
+
'@type': 'custom',
|
|
51
|
+
text: 'a',
|
|
52
|
+
},
|
|
53
|
+
b: {
|
|
54
|
+
'@type': 'custom',
|
|
55
|
+
text: 'b',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export const PathToBlocks = StoryComponent.bind({});
|
|
60
|
+
PathToBlocks.args = {
|
|
61
|
+
view: ({ id, data, path }) => (
|
|
62
|
+
<div>
|
|
63
|
+
id: {id} - text: {data.text} - path: {path}
|
|
64
|
+
</div>
|
|
65
|
+
),
|
|
66
|
+
|
|
67
|
+
blocks: {
|
|
68
|
+
a: {
|
|
69
|
+
'@type': 'custom',
|
|
70
|
+
text: 'bar',
|
|
71
|
+
},
|
|
72
|
+
b: {
|
|
73
|
+
'@type': 'custom',
|
|
74
|
+
text: 'foo',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const InvalidBlocks = StoryComponent.bind({});
|
|
80
|
+
InvalidBlocks.args = {
|
|
81
|
+
blocks_layout: {
|
|
82
|
+
items: ['MISSING-YOU-1', 'a', 'MISSING-YOU-2'],
|
|
83
|
+
},
|
|
84
|
+
blocks: {
|
|
85
|
+
a: {
|
|
86
|
+
'@type': 'custom',
|
|
87
|
+
text: 'bar',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export default {
|
|
92
|
+
title: 'Internal components/View/RenderBlocks',
|
|
93
|
+
component: RenderBlocksComponent,
|
|
94
|
+
decorators: [
|
|
95
|
+
(Story) => (
|
|
96
|
+
<div className="ui segment form attached" style={{ width: '900px' }}>
|
|
97
|
+
<Story />
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
],
|
|
101
|
+
argTypes: {
|
|
102
|
+
view: {
|
|
103
|
+
description: 'Pattern in which to place block content',
|
|
104
|
+
},
|
|
105
|
+
blocks: {
|
|
106
|
+
description: 'blocks in the page',
|
|
107
|
+
},
|
|
108
|
+
blocks_layout: {
|
|
109
|
+
description: 'block layout in the page',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|