@kitconcept/volto-light-theme 5.0.0 → 6.0.0-alpha.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.
Files changed (112) hide show
  1. package/.changelog.draft +26 -10
  2. package/CHANGELOG.md +44 -0
  3. package/README.md +7 -367
  4. package/package.json +23 -10
  5. package/razzle.extend.js +38 -0
  6. package/src/components/Anontools/Anontools.jsx +1 -1
  7. package/src/components/Blocks/Button/schema.js +25 -5
  8. package/src/components/Blocks/EventMetadata/View.jsx +8 -7
  9. package/src/components/Blocks/Image/Edit.jsx +4 -6
  10. package/src/components/Blocks/Image/ImageSidebar.jsx +4 -2
  11. package/src/components/Blocks/Image/View.jsx +3 -6
  12. package/src/components/Blocks/Image/schema.js +37 -6
  13. package/src/components/Blocks/Listing/DefaultTemplate.jsx +3 -2
  14. package/src/components/Blocks/Listing/GridTemplate.jsx +4 -2
  15. package/src/components/Blocks/Listing/ImageGallery.jsx +2 -2
  16. package/src/components/Blocks/Listing/SummaryTemplate.jsx +3 -2
  17. package/src/components/Blocks/Search/components/SearchInput.jsx +1 -1
  18. package/src/components/Blocks/Separator/schema.js +59 -0
  19. package/src/components/Blocks/Slider/DefaultBody.jsx +4 -2
  20. package/src/components/Blocks/Teaser/schema.js +21 -1
  21. package/src/components/Blocks/schema.js +16 -15
  22. package/src/components/Breadcrumbs/Breadcrumbs.jsx +4 -3
  23. package/src/components/Footer/Footer.jsx +77 -27
  24. package/src/components/Header/Header.jsx +37 -30
  25. package/src/components/LanguageSelector/{LanguageSelector.js → LanguageSelector.jsx} +11 -7
  26. package/src/components/Logo/Logo.jsx +28 -22
  27. package/src/components/MobileNavigation/MobileNavigation.jsx +3 -2
  28. package/src/components/MobileNavigation/MobileToolsFooter.jsx +1 -1
  29. package/src/components/Navigation/Navigation.jsx +4 -3
  30. package/src/components/SearchWidget/IntranetSearchWidget.jsx +1 -1
  31. package/src/components/SearchWidget/SearchWidget.jsx +1 -1
  32. package/src/components/Theme/EventView.jsx +3 -2
  33. package/src/components/Theme/FileView.jsx +1 -1
  34. package/src/components/Theme/NewsItemView.jsx +1 -1
  35. package/src/components/Theming/Theming.tsx +52 -0
  36. package/src/components/Widgets/AlignWidget.jsx +2 -2
  37. package/src/components/Widgets/BackgroundColorWidget.tsx +18 -0
  38. package/src/components/Widgets/BlockAlignmentWidget.tsx +81 -0
  39. package/src/components/Widgets/BlockWidthWidget.tsx +94 -0
  40. package/src/components/Widgets/BlocksObjectWidget.tsx +333 -0
  41. package/src/components/Widgets/ButtonsWidget.tsx +68 -0
  42. package/src/components/Widgets/ColorPickerWidget.tsx +60 -0
  43. package/src/components/Widgets/FooterLinksWidget.tsx +106 -0
  44. package/src/components/Widgets/FooterLogosWidget.tsx +120 -0
  45. package/src/components/Widgets/ThemingColorPicker.tsx +33 -0
  46. package/src/config/blocks.tsx +352 -0
  47. package/src/config/classExtenders.ts +101 -0
  48. package/src/config/settings.ts +35 -0
  49. package/src/config/slots.ts +12 -0
  50. package/src/config/widgets.ts +31 -0
  51. package/src/customizations/volto/components/theme/View/RenderBlocks.jsx +97 -80
  52. package/src/customizations/volto/components/theme/View/RenderBlocks.test.jsx +16 -48
  53. package/src/helpers/helpers.test.ts +51 -0
  54. package/src/helpers/helpers.ts +48 -0
  55. package/src/index.ts +54 -0
  56. package/src/theme/_bgcolor-blocks-layout.scss +1127 -20
  57. package/src/theme/_footer.scss +8 -5
  58. package/src/theme/_header.scss +3 -8
  59. package/src/theme/_layout.scss +24 -7
  60. package/src/theme/_typo-custom.scss +1 -1
  61. package/src/theme/_variables.scss +95 -12
  62. package/src/theme/_widgets.scss +102 -0
  63. package/src/theme/blocks/_accordion.scss +2 -4
  64. package/src/theme/blocks/_button.scss +32 -31
  65. package/src/theme/blocks/_eventMetadata.scss +7 -0
  66. package/src/theme/blocks/_grid.scss +11 -36
  67. package/src/theme/blocks/_highlight.scss +1 -0
  68. package/src/theme/blocks/_image.scss +38 -17
  69. package/src/theme/blocks/_introduction.scss +16 -0
  70. package/src/theme/blocks/_listing.scss +1 -6
  71. package/src/theme/blocks/_search.scss +1 -23
  72. package/src/theme/blocks/_separator.scss +17 -20
  73. package/src/theme/blocks/_slider.scss +57 -56
  74. package/src/theme/blocks/_teaser.scss +3 -3
  75. package/src/theme/main.scss +1 -0
  76. package/src/transforms/to6.ts +94 -0
  77. package/tsconfig.json +33 -0
  78. package/.release-it.json +0 -31
  79. package/babel.config.js +0 -17
  80. package/build/messages/src/components/Anontools/Anontools.json +0 -10
  81. package/build/messages/src/components/Blocks/Button/schema.json +0 -6
  82. package/build/messages/src/components/Blocks/EventMetadata/View.json +0 -30
  83. package/build/messages/src/components/Blocks/Image/Edit.json +0 -10
  84. package/build/messages/src/components/Blocks/Image/ImageSidebar.json +0 -18
  85. package/build/messages/src/components/Blocks/Image/schema.json +0 -10
  86. package/build/messages/src/components/Blocks/Listing/ListingBody.json +0 -26
  87. package/build/messages/src/components/Blocks/Search/TopSideFacets.json +0 -10
  88. package/build/messages/src/components/Blocks/Search/components/SearchDetails.json +0 -10
  89. package/build/messages/src/components/Blocks/Search/components/SearchInput.json +0 -6
  90. package/build/messages/src/components/Blocks/Slider/DefaultBody.json +0 -18
  91. package/build/messages/src/components/Blocks/Slider/schema.json +0 -14
  92. package/build/messages/src/components/Blocks/schema.json +0 -6
  93. package/build/messages/src/components/Breadcrumbs/Breadcrumbs.json +0 -10
  94. package/build/messages/src/components/Footer/Footer.json +0 -30
  95. package/build/messages/src/components/Header/Header.json +0 -6
  96. package/build/messages/src/components/LanguageSelector/LanguageSelector.json +0 -6
  97. package/build/messages/src/components/Logo/Logo.json +0 -10
  98. package/build/messages/src/components/MobileNavigation/MobileNavigation.json +0 -26
  99. package/build/messages/src/components/Navigation/Navigation.json +0 -10
  100. package/build/messages/src/components/SearchWidget/IntranetSearchWidget.json +0 -14
  101. package/build/messages/src/components/SearchWidget/SearchWidget.json +0 -10
  102. package/build/messages/src/components/Theme/EventView.json +0 -6
  103. package/build/messages/src/components/Widgets/AlignWidget.json +0 -22
  104. package/build/messages/src/index.json +0 -10
  105. package/news/.gitkeep +0 -0
  106. package/src/components/Atoms/Container/Container.jsx +0 -32
  107. package/src/components/Atoms/README.md +0 -1
  108. package/src/components/Atoms/helpers.jsx +0 -9
  109. package/src/components/CQPolyfill.jsx +0 -9
  110. package/src/index.js +0 -367
  111. package/towncrier.toml +0 -33
  112. /package/src/components/Blocks/Slate/{ExtraAlignWrapper.js → ExtraAlignWrapper.jsx} +0 -0
package/src/index.js DELETED
@@ -1,367 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
- import { cloneDeep } from 'lodash';
3
-
4
- import { composeSchema, getPreviousNextBlock } from '@plone/volto/helpers';
5
- import {
6
- defaultStylingSchema,
7
- removeStylingSchema,
8
- } from './components/Blocks/schema';
9
- import { teaserSchemaEnhancer } from './components/Blocks/Teaser/schema';
10
- import { videoBlockSchemaEnhancer } from './components/Blocks/Video/schema';
11
- import { gridTeaserDisableStylingSchema } from '@plone/volto/components/manage/Blocks/Teaser/schema';
12
- import { gridImageDisableSizeAndPositionHandlersSchema } from '@plone/volto/components/manage/Blocks/Image/schema';
13
- import { disableBgColorSchema } from './components/Blocks/disableBgColorSchema';
14
- import BlockSettingsSchema from '@plone/volto/components/manage/Blocks/Block/Schema';
15
-
16
- import ContainerQueriesPolyfill from './components/CQPolyfill';
17
- import { Container } from '@plone/components';
18
- import TopSideFacets from './components/Blocks/Search/TopSideFacets';
19
-
20
- import GridListingBlockTemplate from './components/Blocks/Listing/GridTemplate';
21
- import { ButtonStylingSchema } from './components/Blocks/Button/schema';
22
-
23
- import { imageBlockSchemaEnhancer } from './components/Blocks/Image/schema';
24
- import { ImageBlockDataAdapter } from './components/Blocks/Image/adapter';
25
-
26
- import { AccordionSchemaEnhancer } from './components/Blocks/Accordion/schema';
27
-
28
- import { searchBlockSchemaEnhancer } from './components/Blocks/Search/schema';
29
-
30
- import gridSVG from './icons/block_icn_grid.svg';
31
- import accordionSVG from './icons/block_icn_accordion.svg';
32
- import descriptionSVG from '@plone/volto/icons/description.svg';
33
- import EventView from './components/Theme/EventView';
34
- import { tocBlockSchemaEnhancer } from './components/Blocks/Toc/schema';
35
- import { mapsBlockSchemaEnhancer } from './components/Blocks/Maps/schema';
36
- import { sliderBlockSchemaEnhancer } from './components/Blocks/Slider/schema';
37
- import EventMetadataView from './components/Blocks/EventMetadata/View';
38
-
39
- const BG_COLORS = [
40
- { name: 'transparent', label: 'Transparent' },
41
- { name: 'grey', label: 'Grey' },
42
- ];
43
-
44
- defineMessages({
45
- Press: {
46
- id: 'Press',
47
- defaultMessage: 'Press',
48
- },
49
- Sitemap: {
50
- id: 'Sitemap',
51
- defaultMessage: 'Sitemap',
52
- },
53
- });
54
-
55
- const applyConfig = (config) => {
56
- config.settings.enableAutoBlockGroupingByBackgroundColor = true;
57
- config.settings.navDepth = 3;
58
- config.settings.enableFatMenu = true;
59
- config.settings.slate.useLinkedHeadings = false;
60
- config.settings.contentMetadataTagsImageField = 'preview_image';
61
-
62
- // Initial block for event content type
63
- config.blocks.initialBlocks = {
64
- Event: [
65
- { '@type': 'title' },
66
- { '@type': 'eventMetadata', fixed: true, required: true },
67
- { '@type': 'slate' },
68
- ],
69
- };
70
-
71
- config.settings.siteLabel = '';
72
- config.settings.intranetHeader = false;
73
-
74
- // Remove Hero Block
75
- if (config.blocks.blocksConfig?.hero) {
76
- config.blocks.blocksConfig.hero.restricted = true;
77
- }
78
-
79
- // No required blocks (eg. Title)
80
- config.blocks.requiredBlocks = [
81
- ...config.blocks.requiredBlocks,
82
- 'eventMetadata',
83
- ];
84
-
85
- // Register our custom Container component
86
- config.registerComponent({
87
- name: 'Container',
88
- component: Container,
89
- });
90
-
91
- // Register custom StyleWrapper ClassNames
92
- config.settings.styleClassNameExtenders = [
93
- ({ block, content, data, classNames }) => {
94
- let styles = [];
95
- const [previousBlock, nextBlock] = getPreviousNextBlock({
96
- content,
97
- block,
98
- });
99
-
100
- // Inject a class depending of which type is the next block
101
- if (nextBlock?.['@type']) {
102
- styles.push(`next--is--${nextBlock['@type']}`);
103
- }
104
-
105
- // Inject a class depending if previous is the same type of block
106
- if (data?.['@type'] === previousBlock?.['@type']) {
107
- styles.push('previous--is--same--block-type');
108
- }
109
-
110
- // Inject a class depending if next is the same type of block
111
- if (data?.['@type'] === nextBlock?.['@type']) {
112
- styles.push('next--is--same--block-type');
113
- }
114
-
115
- // Inject a class depending if it's the first of block type
116
- if (data?.['@type'] !== previousBlock?.['@type']) {
117
- styles.push('is--first--of--block-type');
118
- }
119
-
120
- // Inject a class depending if it's the last of block type
121
- if (data?.['@type'] !== nextBlock?.['@type']) {
122
- styles.push('is--last--of--block-type');
123
- }
124
-
125
- // Inject a class depending if it has a headline
126
- if (data?.headline || previousBlock?.['@type'] === 'heading') {
127
- styles.push('has--headline');
128
- }
129
-
130
- // Given a StyleWrapper defined `backgroundColor` style
131
- const previousColor =
132
- previousBlock?.styles?.backgroundColor ?? 'transparent';
133
- const currentColor = data?.styles?.backgroundColor ?? 'transparent';
134
- const nextColor = nextBlock?.styles?.backgroundColor ?? 'transparent';
135
-
136
- // Inject a class depending if the previous block has the same `backgroundColor`
137
- if (currentColor === previousColor) {
138
- styles.push('previous--has--same--backgroundColor');
139
- } else if (currentColor !== previousColor) {
140
- styles.push('previous--has--different--backgroundColor');
141
- }
142
-
143
- // Inject a class depending if the next block has the same `backgroundColor`
144
- if (currentColor === nextColor) {
145
- styles.push('next--has--same--backgroundColor');
146
- } else if (currentColor !== nextColor) {
147
- styles.push('next--has--different--backgroundColor');
148
- }
149
-
150
- return [...classNames, ...styles];
151
- },
152
- ];
153
-
154
- config.settings.slidingSearchAnimation = true;
155
- config.settings.openExternalLinkInNewTab = true;
156
-
157
- config.blocks.blocksConfig.accordion = {
158
- ...config.blocks.blocksConfig.accordion,
159
- mostUsed: true,
160
- icon: accordionSVG,
161
- allowedBlocks: [
162
- 'slate',
163
- 'teaser',
164
- 'image',
165
- 'listing',
166
- 'slateTable',
167
- 'separator',
168
- ],
169
- colors: BG_COLORS,
170
- schemaEnhancer: composeSchema(
171
- AccordionSchemaEnhancer,
172
- defaultStylingSchema,
173
- ),
174
- sidebarTab: 1,
175
- };
176
-
177
- config.blocks.blocksConfig.slateTable = {
178
- ...config.blocks.blocksConfig.slateTable,
179
- schemaEnhancer: defaultStylingSchema,
180
- colors: BG_COLORS,
181
- };
182
-
183
- config.blocks.blocksConfig.listing = {
184
- ...config.blocks.blocksConfig.listing,
185
- colors: BG_COLORS,
186
- schemaEnhancer: defaultStylingSchema,
187
- allowed_headline_tags: [['h2', 'h2']],
188
- variations: [
189
- ...config.blocks.blocksConfig.listing.variations,
190
- {
191
- id: 'grid',
192
- title: 'Grid',
193
- template: GridListingBlockTemplate,
194
- },
195
- ],
196
- };
197
-
198
- config.blocks.blocksConfig.image = {
199
- ...config.blocks.blocksConfig.image,
200
- schemaEnhancer: imageBlockSchemaEnhancer,
201
- dataAdapter: ImageBlockDataAdapter,
202
- };
203
-
204
- // Accordion internal `blocksConfig` amendments
205
- // We cloneDeep the blocksConfig to avoid modifying the original object
206
- // in subsequent modifications of the accordion block config
207
- config.blocks.blocksConfig.accordion.blocksConfig = cloneDeep(
208
- config.blocks.blocksConfig,
209
- );
210
-
211
- config.blocks.blocksConfig.accordion.blocksConfig.teaser.schemaEnhancer =
212
- composeSchema(teaserSchemaEnhancer, disableBgColorSchema);
213
-
214
- config.blocks.blocksConfig.gridBlock.colors = BG_COLORS;
215
- config.blocks.blocksConfig.gridBlock.schemaEnhancer = defaultStylingSchema;
216
- config.blocks.blocksConfig.gridBlock.icon = gridSVG;
217
-
218
- // Grids internal `blocksConfig` amendments
219
- // Slate in grids must have an extra wrapper with the `slate` className
220
- const OriginalSlateBlockView = config.blocks.blocksConfig.slate.view;
221
- config.blocks.blocksConfig.gridBlock.blocksConfig.slate.view = (props) => {
222
- return (
223
- <div className="slate">
224
- <OriginalSlateBlockView {...props} />
225
- </div>
226
- );
227
- };
228
-
229
- config.blocks.blocksConfig.gridBlock.blocksConfig.image.schemaEnhancer =
230
- composeSchema(
231
- imageBlockSchemaEnhancer,
232
- gridImageDisableSizeAndPositionHandlersSchema,
233
- );
234
- config.blocks.blocksConfig.gridBlock.blocksConfig.image.dataAdapter =
235
- ImageBlockDataAdapter;
236
-
237
- config.blocks.blocksConfig.gridBlock.blocksConfig.teaser.schemaEnhancer =
238
- composeSchema(gridTeaserDisableStylingSchema, teaserSchemaEnhancer);
239
-
240
- config.blocks.blocksConfig.gridBlock.blocksConfig.listing.allowed_headline_tags =
241
- [['h2', 'h2']];
242
- config.blocks.blocksConfig.gridBlock.blocksConfig.listingschemaEnhancer =
243
- removeStylingSchema;
244
- config.blocks.blocksConfig.gridBlock.blocksConfig.listingvariations = [];
245
-
246
- config.blocks.blocksConfig.introduction = {
247
- ...config.blocks.blocksConfig.introduction,
248
- unwantedButtons: ['heading-three', 'blockquote'],
249
- };
250
-
251
- config.blocks.blocksConfig.slate = {
252
- ...config.blocks.blocksConfig.slate,
253
- colors: BG_COLORS,
254
- schemaEnhancer: defaultStylingSchema,
255
- sidebarTab: 1,
256
- };
257
-
258
- config.blocks.blocksConfig.teaser = {
259
- ...config.blocks.blocksConfig.teaser,
260
- group: 'teasers',
261
- imageScale: 'larger',
262
- colors: BG_COLORS,
263
- schemaEnhancer: composeSchema(defaultStylingSchema, teaserSchemaEnhancer),
264
- };
265
-
266
- config.blocks.blocksConfig.video = {
267
- ...config.blocks.blocksConfig.video,
268
- colors: BG_COLORS,
269
- schemaEnhancer: composeSchema(
270
- defaultStylingSchema,
271
- videoBlockSchemaEnhancer,
272
- ),
273
- };
274
- config.blocks.blocksConfig.maps = {
275
- ...config.blocks.blocksConfig.maps,
276
- colors: BG_COLORS,
277
- schemaEnhancer: composeSchema(
278
- defaultStylingSchema,
279
- mapsBlockSchemaEnhancer,
280
- ),
281
- };
282
-
283
- config.blocks.blocksConfig.heading = {
284
- ...config.blocks.blocksConfig.heading,
285
- sidebarTab: 0,
286
- allowed_headings: [['h2', 'h2']],
287
- colors: BG_COLORS,
288
- schemaEnhancer: defaultStylingSchema,
289
- };
290
-
291
- config.blocks.blocksConfig.search = {
292
- ...config.blocks.blocksConfig.search,
293
- schemaEnhancer: searchBlockSchemaEnhancer,
294
- variations: [
295
- {
296
- id: 'facetsTopSide',
297
- title: 'Facets on top',
298
- view: TopSideFacets,
299
- isDefault: true,
300
- },
301
- ],
302
- };
303
-
304
- config.blocks.blocksConfig.__button = {
305
- ...config.blocks.blocksConfig.__button,
306
- schemaEnhancer: ButtonStylingSchema,
307
- colors: BG_COLORS,
308
- };
309
-
310
- config.blocks.blocksConfig.eventMetadata = {
311
- id: 'eventMetadata',
312
- title: 'EventMetadata',
313
- icon: descriptionSVG,
314
- group: 'common',
315
- view: EventMetadataView,
316
- edit: EventMetadataView,
317
- schema: BlockSettingsSchema,
318
- restricted: ({ properties, block }) =>
319
- properties['@type'] === 'Event' ? false : true,
320
- mostUsed: false,
321
- sidebarTab: 0,
322
- };
323
-
324
- // Check if the separator is present before enhancing it
325
- if (config.blocks.blocksConfig?.separator?.id) {
326
- config.blocks.blocksConfig.separator = {
327
- ...config.blocks.blocksConfig.separator,
328
- schemaEnhancer: composeSchema(
329
- config.blocks.blocksConfig.separator.schemaEnhancer,
330
- defaultStylingSchema,
331
- ),
332
- colors: BG_COLORS,
333
- };
334
- }
335
-
336
- config.views.contentTypesViews.Event = EventView;
337
-
338
- // TOC Block
339
- config.blocks.blocksConfig.toc = {
340
- ...config.blocks.blocksConfig.toc,
341
- schemaEnhancer: composeSchema(tocBlockSchemaEnhancer, defaultStylingSchema),
342
- // remove horizontal variation
343
- variations: [config.blocks.blocksConfig.toc.variations[0]],
344
- };
345
-
346
- // Slider Block
347
- config.blocks.blocksConfig.slider = {
348
- ...config.blocks.blocksConfig.slider,
349
- schemaEnhancer: sliderBlockSchemaEnhancer,
350
- };
351
-
352
- return config;
353
- };
354
-
355
- export const withContainerQueryPolyfill = (config) => {
356
- config.settings.appExtras = [
357
- ...config.settings.appExtras,
358
- {
359
- match: '',
360
- component: ContainerQueriesPolyfill,
361
- },
362
- ];
363
-
364
- return config;
365
- };
366
-
367
- export default applyConfig;
package/towncrier.toml DELETED
@@ -1,33 +0,0 @@
1
- [tool.towncrier]
2
- filename = "CHANGELOG.md"
3
- directory = "news/"
4
- title_format = "## {version} ({project_date})"
5
- underlines = ["", "", ""]
6
- template = "./node_modules/@plone/scripts/templates/towncrier_template.jinja"
7
- start_string = "<!-- towncrier release notes start -->\n"
8
- issue_format = "[#{issue}](https://github.com/kitconcept/volto-light-theme/pull/{issue})"
9
-
10
- [[tool.towncrier.type]]
11
- directory = "breaking"
12
- name = "Breaking"
13
- showcontent = true
14
-
15
- [[tool.towncrier.type]]
16
- directory = "feature"
17
- name = "Feature"
18
- showcontent = true
19
-
20
- [[tool.towncrier.type]]
21
- directory = "bugfix"
22
- name = "Bugfix"
23
- showcontent = true
24
-
25
- [[tool.towncrier.type]]
26
- directory = "internal"
27
- name = "Internal"
28
- showcontent = true
29
-
30
- [[tool.towncrier.type]]
31
- directory = "documentation"
32
- name = "Documentation"
33
- showcontent = true