@kitconcept/volto-light-theme 6.0.0-alpha.6 → 6.0.0-alpha.7

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.draft CHANGED
@@ -1,7 +1,15 @@
1
- ## 6.0.0-alpha.6 (2024-12-10)
1
+ ## 6.0.0-alpha.7 (2024-12-11)
2
+
3
+ ### Feature
4
+
5
+ - Image aspect-ratio handlers for Teaser/Image inside a grid. @sneridagh [#447](https://github.com/kitconcept/volto-light-theme/pull/447)
2
6
 
3
7
  ### Bugfix
4
8
 
5
- - Fixed footerlinks error if the link is created but not set. @sneridagh [#445](https://github.com/kitconcept/volto-light-theme/pull/445)
9
+ - Don't show image size and alignment settings for image block inside a grid. @danalvrz [#435](https://github.com/kitconcept/volto-light-theme/pull/435)
10
+
11
+ ### Documentation
12
+
13
+ - Update compatibility matrix. @sneridagh [#447](https://github.com/kitconcept/volto-light-theme/pull/447)
6
14
 
7
15
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,20 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 6.0.0-alpha.7 (2024-12-11)
12
+
13
+ ### Feature
14
+
15
+ - Image aspect-ratio handlers for Teaser/Image inside a grid. @sneridagh [#447](https://github.com/kitconcept/volto-light-theme/pull/447)
16
+
17
+ ### Bugfix
18
+
19
+ - Don't show image size and alignment settings for image block inside a grid. @danalvrz [#435](https://github.com/kitconcept/volto-light-theme/pull/435)
20
+
21
+ ### Documentation
22
+
23
+ - Update compatibility matrix. @sneridagh [#447](https://github.com/kitconcept/volto-light-theme/pull/447)
24
+
11
25
  ## 6.0.0-alpha.6 (2024-12-10)
12
26
 
13
27
  ### Bugfix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "6.0.0-alpha.6",
3
+ "version": "6.0.0-alpha.7",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/types/index.d.ts",
@@ -1,5 +1,6 @@
1
1
  import { defineMessages } from 'react-intl';
2
- import { insertInArray, reorderArray } from '@plone/volto/helpers/Utils/Utils';
2
+ import { insertInArray } from '@plone/volto/helpers/Utils/Utils';
3
+ import { addStyling } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer';
3
4
  import config from '@plone/volto/registry';
4
5
 
5
6
  const messages = defineMessages({
@@ -19,7 +20,6 @@ const messages = defineMessages({
19
20
 
20
21
  export const imageBlockSchemaEnhancer = ({ formData, schema, intl }) => {
21
22
  if (formData.url) {
22
- schema.fieldsets = reorderArray(schema.fieldsets, 2, 1);
23
23
  schema.fieldsets[0].fields = insertInArray(
24
24
  schema.fieldsets[0].fields,
25
25
  'description',
@@ -31,6 +31,29 @@ export const imageBlockSchemaEnhancer = ({ formData, schema, intl }) => {
31
31
  1,
32
32
  );
33
33
 
34
+ schema.properties.description = {
35
+ title: intl.formatMessage(messages.Description),
36
+ widget: 'textarea',
37
+ };
38
+ schema.properties.title = {
39
+ title: intl.formatMessage(messages.Title),
40
+ };
41
+ }
42
+
43
+ return schema;
44
+ };
45
+
46
+ export const standAloneImageBlockSchemaEnhancer = ({
47
+ formData,
48
+ schema,
49
+ intl,
50
+ }) => {
51
+ if (formData.url) {
52
+ schema.properties.align.default = 'center';
53
+ schema.properties.align.actions = ['left', 'right', 'center'];
54
+
55
+ schema.properties.size.default = 'l';
56
+ schema.properties.size.disabled = formData.align === 'center';
34
57
  schema.properties.styles.schema.fieldsets[0].fields = [
35
58
  'blockWidth:noprefix',
36
59
  '--image-aspect-ratio',
@@ -49,28 +72,33 @@ export const imageBlockSchemaEnhancer = ({ formData, schema, intl }) => {
49
72
  widget: 'select',
50
73
  title: 'Aspect Ratio',
51
74
  choices: [
52
- ['1', '1:1'],
53
75
  ['16 / 9', '16/9'],
76
+ ['1', '1:1'],
54
77
  ],
55
78
  };
56
79
 
57
- schema.properties.description = {
58
- title: intl.formatMessage(messages.Description),
59
- widget: 'textarea',
60
- };
61
- schema.properties.title = {
62
- title: intl.formatMessage(messages.Title),
63
- };
64
-
65
- schema.properties.align.default = 'center';
66
- schema.properties.align.actions = ['left', 'right', 'center'];
67
-
68
- schema.properties.size.default = 'l';
69
- schema.properties.size.disabled = formData.align === 'center';
70
-
71
80
  schema.properties.styles.schema.properties['blockWidth:noprefix'].disabled =
72
81
  formData.align === 'left' || formData.align === 'right';
73
82
  }
74
83
 
75
84
  return schema;
76
85
  };
86
+
87
+ export function aspectRatioSchemaEnhancer({ schema, intl }) {
88
+ addStyling({ schema, intl });
89
+
90
+ schema.properties.styles.schema.fieldsets[0].fields = [
91
+ ...schema.properties.styles.schema.fieldsets[0].fields,
92
+ '--image-aspect-ratio',
93
+ ];
94
+ schema.properties.styles.schema.properties['--image-aspect-ratio'] = {
95
+ widget: 'select',
96
+ title: 'Aspect Ratio',
97
+ choices: [
98
+ ['16 / 9', '16/9'],
99
+ ['1', '1:1'],
100
+ ],
101
+ };
102
+
103
+ return schema;
104
+ }
@@ -28,3 +28,15 @@ export const gridTeaserDisableStylingSchema = ({ schema, formData, intl }) => {
28
28
  schema.properties.styles.schema.fieldsets[0].fields = [];
29
29
  return schema;
30
30
  };
31
+
32
+ export const gridTeaserDisableAlignHandlersSchema = ({
33
+ schema,
34
+ formData,
35
+ intl,
36
+ }) => {
37
+ schema.properties.styles.schema.fieldsets[0].fields =
38
+ schema.properties.styles.schema.fieldsets[0].fields.filter(
39
+ (item) => !['align'].includes(item),
40
+ );
41
+ return schema;
42
+ };
@@ -3,8 +3,7 @@ import config from '@plone/volto/registry';
3
3
  import type { ColorPickerWidgetProps } from '@plone/volto/components/manage/Widgets/ColorPickerWidget';
4
4
 
5
5
  const BackgroundColorWidget = (props: ColorPickerWidgetProps) => {
6
- const colors: ColorPickerWidgetProps['colors'] =
7
- config.settings.backgroundColors;
6
+ const colors: ColorPickerWidgetProps['colors'] = config.blocks.themes;
8
7
 
9
8
  const defaultValue = colors.find(
10
9
  (color) => color.name === config.settings.defaultBackgroundColor,
@@ -6,9 +6,12 @@ import cloneDeep from 'lodash/cloneDeep';
6
6
  import { composeSchema } from '@plone/volto/helpers/Extensions';
7
7
  import { findStyleByName } from '@plone/volto/helpers/Blocks/Blocks';
8
8
  import { defaultStylingSchema } from '../components/Blocks/schema';
9
- import { teaserSchemaEnhancer } from '../components/Blocks/Teaser/schema';
9
+ import {
10
+ gridTeaserDisableAlignHandlersSchema,
11
+ teaserSchemaEnhancer,
12
+ } from '../components/Blocks/Teaser/schema';
10
13
  import { videoBlockSchemaEnhancer } from '../components/Blocks/Video/schema';
11
- import { gridTeaserDisableStylingSchema } from '@plone/volto/components/manage/Blocks/Teaser/schema';
14
+
12
15
  import { gridImageDisableSizeAndPositionHandlersSchema } from '@plone/volto/components/manage/Blocks/Image/schema';
13
16
  import { disableBgColorSchema } from '../components/Blocks/disableBgColorSchema';
14
17
 
@@ -18,7 +21,11 @@ import GridListingBlockTemplate from '../components/Blocks/Listing/GridTemplate'
18
21
  import { ButtonStylingSchema } from '../components/Blocks/Button/schema';
19
22
  import { SeparatorStylingSchema } from '../components/Blocks/Separator/schema';
20
23
 
21
- import { imageBlockSchemaEnhancer } from '../components/Blocks/Image/schema';
24
+ import {
25
+ imageBlockSchemaEnhancer,
26
+ standAloneImageBlockSchemaEnhancer,
27
+ aspectRatioSchemaEnhancer,
28
+ } from '../components/Blocks/Image/schema';
22
29
  import { ImageBlockDataAdapter } from '../components/Blocks/Image/adapter';
23
30
 
24
31
  import { AccordionSchemaEnhancer } from '../components/Blocks/Accordion/schema';
@@ -206,6 +213,7 @@ export default function install(config: ConfigType) {
206
213
  schemaEnhancer: composeSchema(
207
214
  defaultStylingSchema,
208
215
  imageBlockSchemaEnhancer,
216
+ standAloneImageBlockSchemaEnhancer,
209
217
  ),
210
218
  dataAdapter: ImageBlockDataAdapter,
211
219
  };
@@ -238,13 +246,14 @@ export default function install(config: ConfigType) {
238
246
  config.blocks.blocksConfig.gridBlock.blocksConfig.image.schemaEnhancer =
239
247
  composeSchema(
240
248
  imageBlockSchemaEnhancer,
249
+ aspectRatioSchemaEnhancer,
241
250
  gridImageDisableSizeAndPositionHandlersSchema,
242
251
  );
243
252
  config.blocks.blocksConfig.gridBlock.blocksConfig.image.dataAdapter =
244
253
  ImageBlockDataAdapter;
245
254
 
246
255
  config.blocks.blocksConfig.gridBlock.blocksConfig.teaser.schemaEnhancer =
247
- composeSchema(gridTeaserDisableStylingSchema, teaserSchemaEnhancer);
256
+ composeSchema(gridTeaserDisableAlignHandlersSchema, teaserSchemaEnhancer);
248
257
 
249
258
  config.blocks.blocksConfig.gridBlock.blocksConfig.listing.allowed_headline_tags =
250
259
  [['h2', 'h2']];
@@ -145,11 +145,11 @@ $secondary-grey: #ececec !default;
145
145
  --link-foreground-color: var(--link-color);
146
146
 
147
147
  // It is possible to set an aspect ratio for all images, using the folowing CSS custom property:
148
- // --image-aspect-ratio: 16/9;
148
+ // --image-aspect-ratio: calc(16 / 9);
149
149
  }
150
150
 
151
151
  // Image Aspect Ratio
152
- $aspect-ratio: 16/9 !default;
152
+ $aspect-ratio: calc(16 / 9) !default;
153
153
 
154
154
  // Weights
155
155
  $thin: 100 !default;
@@ -30,7 +30,7 @@
30
30
 
31
31
  // Override the Image component `aspect-ratio`
32
32
  .block.image img {
33
- aspect-ratio: $aspect-ratio !important;
33
+ aspect-ratio: var(--image-aspect-ratio, $aspect-ratio) !important;
34
34
  }
35
35
 
36
36
  .block.teaser {