@kitconcept/volto-light-theme 8.0.0-alpha.2 → 8.0.0-alpha.21

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 (101) hide show
  1. package/.changelog.draft +3 -4
  2. package/CHANGELOG.md +232 -0
  3. package/locales/de/LC_MESSAGES/volto.po +30 -115
  4. package/locales/en/LC_MESSAGES/volto.po +30 -115
  5. package/locales/es/LC_MESSAGES/volto.po +31 -116
  6. package/locales/eu/LC_MESSAGES/volto.po +58 -124
  7. package/locales/pt_BR/LC_MESSAGES/volto.po +38 -123
  8. package/locales/volto.pot +31 -116
  9. package/package.json +7 -4
  10. package/src/__mocks__/semantic-ui-react.ts +31 -0
  11. package/src/components/Blocks/Block/Edit.jsx +14 -6
  12. package/src/components/Blocks/Block/EditBlockWrapper.jsx +9 -3
  13. package/src/components/Blocks/Block/ErrorBoundary.test.tsx +55 -0
  14. package/src/components/Blocks/Block/ErrorBoundary.tsx +92 -0
  15. package/src/components/Blocks/Block/ErrorBoundaryMessage.tsx +66 -0
  16. package/src/components/Blocks/EventCalendar/Search/components/EventTemplate.tsx +1 -1
  17. package/src/components/Blocks/Image/Edit.jsx +1 -0
  18. package/src/components/Blocks/Listing/DefaultTemplate.jsx +12 -6
  19. package/src/components/Blocks/Listing/GridTemplate.jsx +16 -7
  20. package/src/components/Blocks/Listing/ListingBody.jsx +4 -1
  21. package/src/components/Blocks/Listing/SummaryTemplate.jsx +16 -7
  22. package/src/components/Blocks/Teaser/DefaultBody.tsx +25 -5
  23. package/src/components/Blocks/schema.ts +69 -0
  24. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +128 -0
  25. package/src/components/Breadcrumbs/Breadcrumbs.tsx +117 -0
  26. package/src/components/Caption/Caption.test.tsx +31 -0
  27. package/src/components/Caption/{Caption.jsx → Caption.tsx} +14 -21
  28. package/src/components/Footer/ColumnLinks.tsx +2 -2
  29. package/src/components/Footer/slots/Colophon.tsx +13 -1
  30. package/src/components/Footer/slots/CoreFooter.tsx +4 -2
  31. package/src/components/Header/Header.tsx +3 -3
  32. package/src/components/LanguageSelector/LanguageSelector.tsx +91 -0
  33. package/src/components/MobileNavigation/MobileNavigation.jsx +11 -9
  34. package/src/components/Navigation/Navigation.test.tsx +176 -0
  35. package/src/components/Navigation/{Navigation.jsx → Navigation.tsx} +77 -37
  36. package/src/components/StickyMenu/MobileCarouselArrowButton.tsx +81 -0
  37. package/src/components/StickyMenu/MobileStickyMenu.tsx +76 -0
  38. package/src/components/Summary/DefaultSummary.tsx +10 -3
  39. package/src/components/Summary/EventSummary.tsx +10 -3
  40. package/src/components/Summary/FileSummary.tsx +10 -3
  41. package/src/components/Summary/NewsItemSummary.tsx +10 -3
  42. package/src/components/Summary/PersonSummary.tsx +10 -3
  43. package/src/components/Summary/Summary.stories.tsx +46 -30
  44. package/src/components/Tags/Tags.test.tsx +71 -0
  45. package/src/components/Tags/{Tags.jsx → Tags.tsx} +9 -25
  46. package/src/components/Theme/EventView.jsx +4 -4
  47. package/src/components/Theme/NewsItemView.jsx +4 -4
  48. package/src/components/Theme/RenderBlocks.jsx +45 -37
  49. package/src/components/Theme/RenderBlocksV2.jsx +51 -20
  50. package/src/components/Widgets/ColorSwatch.stories.tsx +197 -0
  51. package/src/components/Widgets/ColorSwatch.test.tsx +188 -0
  52. package/src/components/Widgets/ColorSwatch.tsx +77 -39
  53. package/src/components/Widgets/SoftTextWidget.tsx +129 -0
  54. package/src/components/Widgets/SoftTextareaWidget.tsx +118 -0
  55. package/src/components/Widgets/ThemeColorSwatch.tsx +5 -9
  56. package/src/config/blocks.tsx +21 -29
  57. package/src/config/slots.ts +7 -0
  58. package/src/config/widgets.ts +5 -9
  59. package/src/customizations/volto/components/manage/DragDropList/DragDropList.jsx +263 -0
  60. package/src/customizations/volto/components/theme/LanguageSelector/LanguageSelector.tsx +10 -0
  61. package/src/helpers/styleDefinitions.test.tsx +30 -0
  62. package/src/helpers/styleDefinitions.ts +49 -0
  63. package/src/internalChecks.test.ts +94 -0
  64. package/src/primitives/Card/Card.stories.tsx +4 -1
  65. package/src/primitives/Card/Card.test.tsx +11 -33
  66. package/src/primitives/Card/Card.tsx +33 -43
  67. package/src/primitives/IconLinkList.tsx +53 -52
  68. package/src/theme/_bgcolor-blocks-layout.scss +43 -45
  69. package/src/theme/_content.scss +12 -13
  70. package/src/theme/_export_import.scss +94 -0
  71. package/src/theme/_footer.scss +64 -19
  72. package/src/theme/_header.scss +21 -4
  73. package/src/theme/_insets.scss +1 -1
  74. package/src/theme/_layout.scss +34 -15
  75. package/src/theme/_mobile-sticky-menu.scss +92 -0
  76. package/src/theme/_search-page.scss +249 -0
  77. package/src/theme/_typo-custom.scss +16 -5
  78. package/src/theme/_variables.scss +19 -4
  79. package/src/theme/_widgets.scss +15 -27
  80. package/src/theme/blocks/_accordion.scss +11 -4
  81. package/src/theme/blocks/_grid.scss +9 -77
  82. package/src/theme/blocks/_listing.scss +60 -126
  83. package/src/theme/blocks/_search.scss +3 -4
  84. package/src/theme/blocks/_table.scss +1 -0
  85. package/src/theme/blocks/_teaser.scss +7 -117
  86. package/src/theme/blocks/error-boundary.scss +11 -0
  87. package/src/theme/card.scss +107 -70
  88. package/src/theme/main.scss +5 -0
  89. package/src/theme/notfound.scss +27 -0
  90. package/src/theme/person.scss +28 -12
  91. package/src/theme/sticky-menu.scss +7 -5
  92. package/src/types.d.ts +1 -0
  93. package/vitest.config.mjs +4 -0
  94. package/razzle.extend.js +0 -38
  95. package/src/components/Blocks/schema.js +0 -44
  96. package/src/components/Breadcrumbs/Breadcrumbs.jsx +0 -118
  97. package/src/components/Widgets/AlignWidget.tsx +0 -84
  98. package/src/components/Widgets/BlockAlignment.tsx +0 -88
  99. package/src/components/Widgets/BlockWidth.tsx +0 -101
  100. package/src/components/Widgets/Buttons.tsx +0 -144
  101. package/src/components/Widgets/Size.tsx +0 -78
@@ -36,10 +36,15 @@
36
36
  @import 'blocks/eventMetadata';
37
37
  @import 'blocks/rss';
38
38
  @import 'blocks/eventSearch';
39
+ @import 'blocks/error-boundary';
39
40
  @import 'sticky-menu';
41
+ @import 'mobile-sticky-menu';
40
42
  @import 'card';
41
43
  @import 'insets';
42
44
  @import 'person';
45
+ @import 'notfound';
46
+ @import 'search-page';
47
+ @import 'export_import';
43
48
 
44
49
  @import 'temp';
45
50
 
@@ -0,0 +1,27 @@
1
+ .view-editview.is-anonymous,
2
+ .view-unauthorized,
3
+ .page-not-found {
4
+ .content-area {
5
+ @include default-container-width();
6
+ @include adjustMarginsToContainer($default-container-width);
7
+ .view-wrapper {
8
+ padding-top: $spacing-xlarge;
9
+ padding-bottom: $spacing-xlarge;
10
+ }
11
+ h1 {
12
+ margin-bottom: $spacing-large;
13
+ font-size: 48px;
14
+ font-weight: 700;
15
+ line-height: 56px;
16
+ }
17
+ p,
18
+ a {
19
+ font-size: 24px;
20
+ font-weight: 300;
21
+ line-height: 33px;
22
+ }
23
+ a {
24
+ color: $black;
25
+ }
26
+ }
27
+ }
@@ -166,11 +166,17 @@ body .block.gridBlock .contained .person-teaser .card-inner {
166
166
  display: flex;
167
167
  align-items: center;
168
168
  margin-bottom: $spacing-small;
169
+ svg {
170
+ margin-right: 0.25em;
171
+ }
169
172
  }
170
173
 
171
174
  .summary-room-phone {
172
175
  display: flex;
173
176
  gap: $spacing-small;
177
+ svg {
178
+ margin-right: 0.25em;
179
+ }
174
180
  }
175
181
 
176
182
  // One person teaser in Grid, edit mode
@@ -214,7 +220,7 @@ body .block.gridBlock .contained .person-teaser .card-inner {
214
220
 
215
221
  img {
216
222
  width: 100%;
217
- height: 100%;
223
+ height: 100% !important;
218
224
  object-fit: cover;
219
225
  object-position: center;
220
226
  }
@@ -325,24 +331,34 @@ body.person-squared-images,
325
331
  }
326
332
  }
327
333
  }
328
- // person with Four columns
334
+
335
+ // person with Four columns (edit mode and view mode)
336
+ .block.gridBlock .four.grid-items .person-teaser .card-summary,
337
+ .ui.stackable.stretched.four.column.grid .card-summary {
338
+ .summary-extra-info {
339
+ &.email {
340
+ min-width: 0;
341
+
342
+ a {
343
+ display: block;
344
+ overflow: hidden;
345
+ text-overflow: ellipsis;
346
+ white-space: nowrap;
347
+ }
348
+ }
349
+ }
350
+ }
351
+
352
+ // Additional styles for view mode only
329
353
  .ui.stackable.stretched.four.column.grid {
330
354
  .card-summary {
331
355
  display: grid;
356
+
332
357
  .summary-extra-info {
333
358
  gap: 5px;
334
- &.email {
335
- min-width: 0;
336
-
337
- a {
338
- display: block;
339
- overflow: hidden;
340
- text-overflow: ellipsis;
341
- white-space: nowrap;
342
- }
343
- }
344
359
  }
345
360
  }
361
+
346
362
  .block.listing,
347
363
  .block.search {
348
364
  .listing-item.person-listing .card-summary {
@@ -10,7 +10,7 @@ body.cms-ui .sticky-menu {
10
10
  transform: translateY(-50%);
11
11
  transition: all 0.2s linear;
12
12
 
13
- @media (min-height: 920px) {
13
+ @media (min-height: 969px) {
14
14
  top: 373px;
15
15
  transform: none;
16
16
  }
@@ -21,7 +21,9 @@ body.cms-ui .sticky-menu {
21
21
  flex-direction: column;
22
22
  padding: 0;
23
23
  margin: 0;
24
+ gap: 1px;
24
25
  list-style: none;
26
+ text-align: center;
25
27
 
26
28
  li a {
27
29
  display: flex;
@@ -34,24 +36,24 @@ body.cms-ui .sticky-menu {
34
36
  font-size: 10px;
35
37
  font-style: normal;
36
38
  font-weight: 700;
37
- line-height: 18px; /* 180% */
39
+ line-height: 12px;
38
40
  text-transform: capitalize;
39
41
  }
40
42
 
41
43
  li {
42
44
  display: flex;
43
- height: 93px;
45
+ min-height: 97px;
44
46
  flex-direction: column;
45
47
  align-items: center;
46
48
  justify-content: center;
47
- margin-bottom: 2px;
49
+ padding: 5px 10px;
48
50
  background: var(--sticky-menu-color, #555);
49
51
  color: var(--sticky-menu-foreground-color, #fff);
50
52
  font-family: Inter;
51
53
  font-size: 10px;
52
54
  font-style: normal;
53
55
  font-weight: 700;
54
- line-height: 18px; /* 180% */
56
+ line-height: 12px;
55
57
  text-transform: capitalize;
56
58
  }
57
59
 
package/src/types.d.ts CHANGED
@@ -81,6 +81,7 @@ export type StickyMenuSettings = {
81
81
  sticky_menu: Array<iconLink>;
82
82
  sticky_menu_color: string;
83
83
  sticky_menu_foreground_color: string;
84
+ enable_mobile_sticky_menu: boolean;
84
85
  };
85
86
 
86
87
  export type PloneGobrSocialMediaSettings = {
package/vitest.config.mjs CHANGED
@@ -10,6 +10,10 @@ export default defineConfig({
10
10
  // Alias for absolute imports
11
11
  '@kitconcept/volto-light-theme': path.resolve(__dirname, './src'),
12
12
  '@kitconcept/volto-light-theme/': path.resolve(__dirname, './src/'),
13
+ 'semantic-ui-react': path.resolve(
14
+ __dirname,
15
+ './src/__mocks__/semantic-ui-react.ts',
16
+ ),
13
17
  },
14
18
  },
15
19
  server: {
package/razzle.extend.js DELETED
@@ -1,38 +0,0 @@
1
- const plugins = (defaultPlugins) => {
2
- const newPlugins = defaultPlugins.filter((plugin) => plugin !== 'scss');
3
- newPlugins.push({
4
- name: 'scss',
5
- options: {
6
- sass: {
7
- dev: {
8
- sassOptions: {
9
- includePaths: ['node_modules'],
10
- outputStyle: 'expanded',
11
- sourceMap: true,
12
- silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
13
- quietDeps: true,
14
- },
15
- },
16
- prod: {
17
- sassOptions: {
18
- includePaths: ['node_modules'],
19
- outputStyle: 'expanded',
20
- sourceMap: true,
21
- silenceDeprecations: ['legacy-js-api', 'mixed-decls', 'import'],
22
- quietDeps: true,
23
- },
24
- },
25
- },
26
- },
27
- });
28
- return newPlugins;
29
- };
30
-
31
- const modify = (config, { target, dev }, webpack) => {
32
- return config;
33
- };
34
-
35
- module.exports = {
36
- plugins,
37
- modify,
38
- };
@@ -1,44 +0,0 @@
1
- import { addStyling } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
2
- import { defineMessages } from 'react-intl';
3
- import config from '@plone/volto/registry';
4
-
5
- const messages = defineMessages({
6
- backgroundColor: {
7
- id: 'Background color',
8
- defaultMessage: 'Background color',
9
- },
10
- });
11
-
12
- export const defaultStylingSchema = ({ schema, formData, intl }) => {
13
- const themes =
14
- config.blocks?.blocksConfig?.[formData['@type']]?.themes ||
15
- config.blocks.themes;
16
-
17
- const defaultTheme =
18
- config.blocks?.blocksConfig?.[formData['@type']]?.defaultTheme ||
19
- // The default color is the first color in the themes list
20
- config.blocks.themes?.[0].name;
21
-
22
- addStyling({ schema, intl });
23
-
24
- const stylingIndex = schema.fieldsets.findIndex(
25
- (item) => item.id === 'styling',
26
- );
27
- schema.fieldsets[stylingIndex].fields = [
28
- ...schema.fieldsets[stylingIndex].fields,
29
- 'theme',
30
- ];
31
- schema.properties.theme = {
32
- widget: 'color_picker',
33
- title: intl.formatMessage(messages.backgroundColor),
34
- themes,
35
- default: defaultTheme,
36
- };
37
-
38
- return schema;
39
- };
40
-
41
- export const removeStylingSchema = ({ schema, formData, intl }) => {
42
- schema.fieldsets = schema.fieldsets.filter((item) => item.id !== 'styling');
43
- return schema;
44
- };
@@ -1,118 +0,0 @@
1
- // SemanticUI-free pre-@plone/components
2
- import React, { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { connect } from 'react-redux';
5
- import { compose } from 'redux';
6
- import { Link } from 'react-router-dom';
7
- import { defineMessages, injectIntl } from 'react-intl';
8
- import { Container } from '@plone/components';
9
-
10
- import Icon from '@plone/volto/components/theme/Icon/Icon';
11
- import { getBreadcrumbs } from '@plone/volto/actions/breadcrumbs/breadcrumbs';
12
- import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
13
- import { hasApiExpander } from '@plone/volto/helpers/Utils/Utils';
14
-
15
- import homeSVG from '@plone/volto/icons/home.svg';
16
-
17
- const messages = defineMessages({
18
- home: {
19
- id: 'Home',
20
- defaultMessage: 'Home',
21
- },
22
- breadcrumbs: {
23
- id: 'Breadcrumbs',
24
- defaultMessage: 'Breadcrumbs',
25
- },
26
- });
27
-
28
- /**
29
- * Breadcrumbs container class.
30
- */
31
- export class BreadcrumbsComponent extends Component {
32
- /**
33
- * Property types.
34
- * @property {Object} propTypes Property types.
35
- * @static
36
- */
37
- static propTypes = {
38
- getBreadcrumbs: PropTypes.func.isRequired,
39
- pathname: PropTypes.string.isRequired,
40
- root: PropTypes.string,
41
- items: PropTypes.arrayOf(
42
- PropTypes.shape({
43
- title: PropTypes.string,
44
- url: PropTypes.string,
45
- }),
46
- ).isRequired,
47
- };
48
-
49
- componentDidMount() {
50
- if (!hasApiExpander('breadcrumbs', getBaseUrl(this.props.pathname))) {
51
- this.props.getBreadcrumbs(getBaseUrl(this.props.pathname));
52
- }
53
- }
54
-
55
- /**
56
- * Component will receive props
57
- * @method componentWillReceiveProps
58
- * @param {Object} nextProps Next properties
59
- * @returns {undefined}
60
- */
61
- UNSAFE_componentWillReceiveProps(nextProps) {
62
- if (nextProps.pathname !== this.props.pathname) {
63
- if (!hasApiExpander('breadcrumbs', getBaseUrl(this.props.pathname))) {
64
- this.props.getBreadcrumbs(getBaseUrl(nextProps.pathname));
65
- }
66
- }
67
- }
68
-
69
- /**
70
- * Render method.
71
- * @method render
72
- * @returns {string} Markup for the component.
73
- */
74
- render() {
75
- return (
76
- <div
77
- role="navigation"
78
- aria-label={this.props.intl.formatMessage(messages.breadcrumbs)}
79
- className="breadcrumbs"
80
- >
81
- <Container layout>
82
- <div className="breadcrumb">
83
- <Link
84
- to={this.props.root || '/'}
85
- className="home"
86
- title={this.props.intl.formatMessage(messages.home)}
87
- >
88
- <Icon name={homeSVG} size="25px" />
89
- </Link>
90
- {this.props.items.map((item, index, items) => [
91
- <div className="divider" key={`divider-${item.url}`} />,
92
- index < items.length - 1 ? (
93
- <Link key={item.url} to={item.url} className="section">
94
- {item.title}
95
- </Link>
96
- ) : (
97
- <div className="section active" key={item.url}>
98
- {item.title}
99
- </div>
100
- ),
101
- ])}
102
- </div>
103
- </Container>
104
- </div>
105
- );
106
- }
107
- }
108
-
109
- export default compose(
110
- injectIntl,
111
- connect(
112
- (state) => ({
113
- items: state.breadcrumbs.items,
114
- root: state.breadcrumbs.root,
115
- }),
116
- { getBreadcrumbs },
117
- ),
118
- )(BreadcrumbsComponent);
@@ -1,84 +0,0 @@
1
- import React from 'react';
2
- import { defineMessages, useIntl } from 'react-intl';
3
- import ButtonsWidget, {
4
- type ActionInfo,
5
- type ButtonsWidgetProps,
6
- } from './Buttons';
7
- import imageLeftSVG from '@plone/volto/icons/image-left.svg';
8
- import imageRightSVG from '@plone/volto/icons/image-right.svg';
9
- import imageFitSVG from '@plone/volto/icons/image-fit.svg';
10
- import imageNarrowSVG from '@plone/volto/icons/image-narrow.svg';
11
- import imageWideSVG from '@plone/volto/icons/image-wide.svg';
12
- import imageFullSVG from '@plone/volto/icons/image-full.svg';
13
- import type { IntlShape } from 'react-intl';
14
-
15
- const messages = defineMessages({
16
- left: {
17
- id: 'Left',
18
- defaultMessage: 'Left',
19
- },
20
- right: {
21
- id: 'Right',
22
- defaultMessage: 'Right',
23
- },
24
- center: {
25
- id: 'Center',
26
- defaultMessage: 'Center',
27
- },
28
- narrow: {
29
- id: 'Narrow',
30
- defaultMessage: 'Narrow',
31
- },
32
- wide: {
33
- id: 'Wide',
34
- defaultMessage: 'Wide',
35
- },
36
- full: {
37
- id: 'Full',
38
- defaultMessage: 'Full',
39
- },
40
- });
41
-
42
- export const defaultActionsInfo = ({
43
- intl,
44
- }: {
45
- intl: IntlShape;
46
- }): Record<string, ActionInfo> => ({
47
- left: [imageLeftSVG, intl.formatMessage(messages.left)],
48
- center: [imageFitSVG, intl.formatMessage(messages.center)],
49
- right: [imageRightSVG, intl.formatMessage(messages.right)],
50
- narrow: [imageNarrowSVG, intl.formatMessage(messages.narrow)],
51
- wide: [imageWideSVG, intl.formatMessage(messages.wide)],
52
- full: [imageFullSVG, intl.formatMessage(messages.full)],
53
- });
54
-
55
- type AlignWidgetProps = ButtonsWidgetProps & {
56
- defaultAction?: string;
57
- };
58
-
59
- const AlignWidget = (props: AlignWidgetProps) => {
60
- const intl = useIntl();
61
-
62
- const {
63
- actions = ['left', 'center', 'right', 'full'],
64
- actionsInfoMap,
65
- default: defaultValue,
66
- defaultAction,
67
- } = props;
68
-
69
- const actionsInfo = {
70
- ...defaultActionsInfo({ intl }),
71
- ...actionsInfoMap,
72
- };
73
-
74
- return (
75
- <ButtonsWidget
76
- {...props}
77
- actions={actions}
78
- actionsInfoMap={actionsInfo}
79
- default={defaultValue ?? defaultAction ?? 'center'}
80
- />
81
- );
82
- };
83
-
84
- export default AlignWidget;
@@ -1,88 +0,0 @@
1
- import React from 'react';
2
- import { defineMessages, useIntl } from 'react-intl';
3
- import ButtonsWidget, {
4
- type ActionInfo,
5
- type ButtonsWidgetProps,
6
- } from './Buttons';
7
- import imageFitSVG from '@plone/volto/icons/image-fit.svg';
8
- import imageLeftSVG from '@plone/volto/icons/image-left.svg';
9
- import imageRightSVG from '@plone/volto/icons/image-right.svg';
10
- import type { IntlShape } from 'react-intl';
11
- import type { StyleDefinition } from '@plone/types';
12
-
13
- const messages = defineMessages({
14
- left: {
15
- id: 'Left',
16
- defaultMessage: 'Left',
17
- },
18
- right: {
19
- id: 'Right',
20
- defaultMessage: 'Right',
21
- },
22
- center: {
23
- id: 'Center',
24
- defaultMessage: 'Center',
25
- },
26
- });
27
-
28
- export const defaultActionsInfo = ({
29
- intl,
30
- }: {
31
- intl: IntlShape;
32
- }): Record<string, ActionInfo> => ({
33
- left: [imageLeftSVG, intl.formatMessage(messages.left)],
34
- right: [imageRightSVG, intl.formatMessage(messages.right)],
35
- center: [imageFitSVG, intl.formatMessage(messages.center)],
36
- });
37
-
38
- const DEFAULT_ACTIONS: StyleDefinition[] = [
39
- {
40
- style: {
41
- '--block-alignment': 'var(--align-left)',
42
- },
43
- name: 'left',
44
- label: 'Left',
45
- },
46
- {
47
- style: {
48
- '--block-alignment': 'var(--align-center)',
49
- },
50
- name: 'center',
51
- label: 'Center',
52
- },
53
- {
54
- style: {
55
- '--block-alignment': 'var(--align-right)',
56
- },
57
- name: 'right',
58
- label: 'Right',
59
- },
60
- ];
61
-
62
- const BlockAlignmentWidget = (props: ButtonsWidgetProps) => {
63
- const intl = useIntl();
64
-
65
- const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
66
- const filteredActions =
67
- filterActions && filterActions.length > 0
68
- ? actions.filter((action) => {
69
- const actionName = typeof action === 'string' ? action : action.name;
70
- return filterActions.includes(actionName);
71
- })
72
- : actions;
73
-
74
- const actionsInfo = {
75
- ...defaultActionsInfo({ intl }),
76
- ...actionsInfoMap,
77
- };
78
-
79
- return (
80
- <ButtonsWidget
81
- {...props}
82
- actions={filteredActions}
83
- actionsInfoMap={actionsInfo}
84
- />
85
- );
86
- };
87
-
88
- export default BlockAlignmentWidget;
@@ -1,101 +0,0 @@
1
- import React from 'react';
2
- import { defineMessages, useIntl } from 'react-intl';
3
- import type { IntlShape } from 'react-intl';
4
- import ButtonsWidget, {
5
- type ActionInfo,
6
- type ButtonsWidgetProps,
7
- } from './Buttons';
8
- import imageFitSVG from '@plone/volto/icons/image-fit.svg';
9
- import imageNarrowSVG from '@plone/volto/icons/image-narrow.svg';
10
- import imageWideSVG from '@plone/volto/icons/image-wide.svg';
11
- import imageFullSVG from '@plone/volto/icons/image-full.svg';
12
- import type { StyleDefinition } from '@plone/types';
13
-
14
- const messages = defineMessages({
15
- narrow: {
16
- id: 'Narrow',
17
- defaultMessage: 'Narrow',
18
- },
19
- default: {
20
- id: 'Default',
21
- defaultMessage: 'Default',
22
- },
23
- layout: {
24
- id: 'Layout',
25
- defaultMessage: 'Layout',
26
- },
27
- full: {
28
- id: 'Full',
29
- defaultMessage: 'Full',
30
- },
31
- });
32
-
33
- export const defaultActionsInfo = ({
34
- intl,
35
- }: {
36
- intl: IntlShape;
37
- }): Record<string, ActionInfo> => ({
38
- narrow: [imageNarrowSVG, intl.formatMessage(messages.narrow)],
39
- default: [imageFitSVG, intl.formatMessage(messages.default)],
40
- layout: [imageWideSVG, intl.formatMessage(messages.layout)],
41
- full: [imageFullSVG, intl.formatMessage(messages.full)],
42
- });
43
-
44
- const DEFAULT_ACTIONS: StyleDefinition[] = [
45
- {
46
- style: {
47
- '--block-width': 'var(--narrow-container-width)',
48
- },
49
- name: 'narrow',
50
- label: 'Narrow',
51
- },
52
- {
53
- style: {
54
- '--block-width': 'var(--default-container-width)',
55
- },
56
- name: 'default',
57
- label: 'Default',
58
- },
59
- {
60
- style: {
61
- '--block-width': 'var(--layout-container-width)',
62
- },
63
- name: 'layout',
64
- label: 'Layout',
65
- },
66
- {
67
- style: {
68
- '--block-width': 'unset',
69
- },
70
- name: 'full',
71
- label: 'Full',
72
- },
73
- ];
74
-
75
- const BlockWidthWidget = (props: ButtonsWidgetProps) => {
76
- const intl = useIntl();
77
-
78
- const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
79
- const filteredActions =
80
- filterActions && filterActions.length > 0
81
- ? actions.filter((action) => {
82
- const actionName = typeof action === 'string' ? action : action.name;
83
- return filterActions.includes(actionName);
84
- })
85
- : actions;
86
-
87
- const actionsInfo = {
88
- ...defaultActionsInfo({ intl }),
89
- ...actionsInfoMap,
90
- };
91
-
92
- return (
93
- <ButtonsWidget
94
- {...props}
95
- actions={filteredActions}
96
- actionsInfoMap={actionsInfo}
97
- />
98
- );
99
- };
100
-
101
- export default BlockWidthWidget;