@kitconcept/volto-light-theme 8.0.0-alpha.0 → 8.0.0-alpha.2
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 +3 -10
- package/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/src/components/Blocks/Button/schema.js +0 -41
- package/src/components/Blocks/Separator/schema.js +0 -52
- package/src/components/Blocks/Slider/schema.js +0 -34
- package/src/components/Widgets/AlignWidget.tsx +84 -0
- package/src/components/Widgets/BlockAlignment.tsx +9 -9
- package/src/components/Widgets/BlockWidth.tsx +9 -9
- package/src/components/Widgets/Buttons.tsx +79 -52
- package/src/components/Widgets/ObjectList.tsx +8 -2
- package/src/components/Widgets/Size.tsx +12 -9
- package/src/config/blocks.tsx +5 -24
- package/src/config/widgets.ts +6 -18
- package/src/theme/_bgcolor-blocks-layout.scss +1 -1
- package/src/theme/_widgets.scss +5 -0
- package/src/theme/blocks/_button.scss +14 -8
- package/src/theme/blocks/_slider.scss +3 -18
- package/src/components/Blocks/Slider/Data.jsx +0 -161
- package/src/components/Blocks/Slider/DefaultBody.jsx +0 -154
- package/src/components/Blocks/Slider/SliderVariants.jsx +0 -153
- package/src/components/Blocks/Slider/View.jsx +0 -180
- package/src/customizations/@kitconcept/volto-slider-block/components/Data.jsx +0 -11
- package/src/customizations/@kitconcept/volto-slider-block/components/DefaultBody.jsx +0 -11
- package/src/customizations/@kitconcept/volto-slider-block/components/View.jsx +0 -11
package/.changelog.draft
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
## 8.0.0-alpha.
|
|
2
|
-
|
|
3
|
-
### Breaking
|
|
4
|
-
|
|
5
|
-
- Use Volto 19a9. @sneridagh
|
|
6
|
-
Use `@plone/components` 4.0.0 alpha.
|
|
7
|
-
Recommended add-ons are not included by default as `peerDependencies`.
|
|
8
|
-
|
|
9
|
-
Breaking change: Please, check the [upgrade guide](https://volto-light-theme.readthedocs.io/how-to-guides/upgrade-guide.html) for more information. [#693](https://github.com/kitconcept/volto-light-theme/pull/693)
|
|
1
|
+
## 8.0.0-alpha.2 (2025-10-29)
|
|
10
2
|
|
|
11
3
|
### Feature
|
|
12
4
|
|
|
13
|
-
-
|
|
5
|
+
- Refactor `volto-button-block`, transfer all the customizations to the block. @sneridagh [#697](https://github.com/kitconcept/volto-light-theme/pull/697)
|
|
6
|
+
- Refactor `volto-separator-block`, transfer all the customizations to the block. @sneridagh [#698](https://github.com/kitconcept/volto-light-theme/pull/698)
|
|
14
7
|
|
|
15
8
|
|
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
<!-- towncrier release notes start -->
|
|
10
10
|
|
|
11
|
+
## 8.0.0-alpha.2 (2025-10-29)
|
|
12
|
+
|
|
13
|
+
### Feature
|
|
14
|
+
|
|
15
|
+
- Refactor `volto-button-block`, transfer all the customizations to the block. @sneridagh [#697](https://github.com/kitconcept/volto-light-theme/pull/697)
|
|
16
|
+
- Refactor `volto-separator-block`, transfer all the customizations to the block. @sneridagh [#698](https://github.com/kitconcept/volto-light-theme/pull/698)
|
|
17
|
+
|
|
18
|
+
## 8.0.0-alpha.1 (2025-10-27)
|
|
19
|
+
|
|
20
|
+
### Breaking
|
|
21
|
+
|
|
22
|
+
- Transfer all custom code related to slider to the add-on. @sneridagh [#694](https://github.com/kitconcept/volto-light-theme/pull/694)
|
|
23
|
+
|
|
11
24
|
## 8.0.0-alpha.0 (2025-10-24)
|
|
12
25
|
|
|
13
26
|
### Breaking
|
package/package.json
CHANGED
|
@@ -1,48 +1,7 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
1
|
import { defaultStylingSchema } from '../schema';
|
|
3
2
|
|
|
4
|
-
const messages = defineMessages({
|
|
5
|
-
BlockWidth: {
|
|
6
|
-
id: 'Block Width',
|
|
7
|
-
defaultMessage: 'Block Width',
|
|
8
|
-
},
|
|
9
|
-
Alignment: {
|
|
10
|
-
id: 'Alignment',
|
|
11
|
-
defaultMessage: 'Alignment',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
3
|
export const ButtonStylingSchema = ({ schema, formData, intl }) => {
|
|
16
4
|
defaultStylingSchema({ schema, formData, intl });
|
|
17
5
|
|
|
18
|
-
schema.fieldsets[0].fields = schema.fieldsets[0].fields.filter(
|
|
19
|
-
(field) => field !== 'inneralign',
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
delete schema.properties?.inneralign;
|
|
23
|
-
|
|
24
|
-
schema.properties.styles.schema.fieldsets[0].fields = [
|
|
25
|
-
'blockWidth:noprefix',
|
|
26
|
-
...schema.properties.styles.schema.fieldsets[0].fields,
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
schema.properties.styles.schema.fieldsets[0].fields = [
|
|
30
|
-
'align:noprefix',
|
|
31
|
-
...schema.properties.styles.schema.fieldsets[0].fields,
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
schema.properties.styles.schema.properties['blockWidth:noprefix'] = {
|
|
35
|
-
widget: 'blockWidth',
|
|
36
|
-
title: intl.formatMessage(messages.BlockWidth),
|
|
37
|
-
default: 'default',
|
|
38
|
-
filterActions: ['narrow', 'default'],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
schema.properties.styles.schema.properties['align:noprefix'] = {
|
|
42
|
-
widget: 'blockAlignment',
|
|
43
|
-
title: intl.formatMessage(messages.Alignment),
|
|
44
|
-
default: 'left',
|
|
45
|
-
};
|
|
46
|
-
|
|
47
6
|
return schema;
|
|
48
7
|
};
|
|
@@ -1,59 +1,7 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
1
|
import { defaultStylingSchema } from '../schema';
|
|
3
2
|
|
|
4
|
-
const messages = defineMessages({
|
|
5
|
-
BlockWidth: {
|
|
6
|
-
id: 'Block Width',
|
|
7
|
-
defaultMessage: 'Block Width',
|
|
8
|
-
},
|
|
9
|
-
Alignment: {
|
|
10
|
-
id: 'Alignment',
|
|
11
|
-
defaultMessage: 'Alignment',
|
|
12
|
-
},
|
|
13
|
-
shortline: {
|
|
14
|
-
id: 'Short line',
|
|
15
|
-
defaultMessage: 'Short line',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
3
|
export const SeparatorStylingSchema = ({ schema, formData, intl }) => {
|
|
20
4
|
defaultStylingSchema({ schema, formData, intl });
|
|
21
5
|
|
|
22
|
-
schema.properties.styles.schema.fieldsets[0].fields = [
|
|
23
|
-
'blockWidth:noprefix',
|
|
24
|
-
...schema.properties.styles.schema.fieldsets[0].fields,
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
schema.properties.styles.schema.properties['blockWidth:noprefix'] = {
|
|
28
|
-
widget: 'blockWidth',
|
|
29
|
-
title: intl.formatMessage(messages.BlockWidth),
|
|
30
|
-
default: 'default',
|
|
31
|
-
filterActions: ['narrow', 'default'],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
schema.properties.styles.schema.fieldsets[0].fields = [
|
|
35
|
-
'align:noprefix',
|
|
36
|
-
...schema.properties.styles.schema.fieldsets[0].fields,
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
schema.properties.styles.schema.properties['align:noprefix'] = {
|
|
40
|
-
widget: 'blockAlignment',
|
|
41
|
-
title: intl.formatMessage(messages.Alignment),
|
|
42
|
-
default: 'left',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
schema.properties.styles.schema.fieldsets[0].fields = [
|
|
46
|
-
'shortLine',
|
|
47
|
-
...schema.properties.styles.schema.fieldsets[0].fields,
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
schema.properties.styles.schema.properties.shortLine = {
|
|
51
|
-
title: intl.formatMessage(messages.shortline),
|
|
52
|
-
type: 'boolean',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
schema.properties.styles.schema.properties['align:noprefix'].disabled =
|
|
56
|
-
!formData?.styles?.shortLine;
|
|
57
|
-
|
|
58
6
|
return schema;
|
|
59
7
|
};
|
|
@@ -1,41 +1,7 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
1
|
import { defaultStylingSchema } from '../schema';
|
|
3
2
|
|
|
4
|
-
const messages = defineMessages({
|
|
5
|
-
flagAlign: {
|
|
6
|
-
id: 'Flag align',
|
|
7
|
-
defaultMessage: 'Align',
|
|
8
|
-
},
|
|
9
|
-
buttonText: {
|
|
10
|
-
id: 'Button text',
|
|
11
|
-
defaultMessage: 'Button text',
|
|
12
|
-
},
|
|
13
|
-
hideButton: {
|
|
14
|
-
id: 'Hide Button',
|
|
15
|
-
defaultMessage: 'Hide Button',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
3
|
export const sliderBlockSchemaEnhancer = ({ formData, schema, intl }) => {
|
|
20
4
|
defaultStylingSchema({ schema, formData, intl });
|
|
21
5
|
|
|
22
|
-
schema.properties.slides.schema.fieldsets[0].fields.push('buttonText');
|
|
23
|
-
schema.properties.slides.schema.properties.buttonText = {
|
|
24
|
-
title: intl.formatMessage(messages.buttonText),
|
|
25
|
-
};
|
|
26
|
-
schema.properties.slides.schema.fieldsets[0].fields.push('hideButton');
|
|
27
|
-
schema.properties.slides.schema.properties.hideButton = {
|
|
28
|
-
title: intl.formatMessage(messages.hideButton),
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
schema.properties.slides.schema.fieldsets[0].fields.push('flagAlign');
|
|
33
|
-
schema.properties.slides.schema.properties.flagAlign = {
|
|
34
|
-
widget: 'inner_align',
|
|
35
|
-
title: intl.formatMessage(messages.flagAlign),
|
|
36
|
-
actions: ['left', 'right'],
|
|
37
|
-
default: 'left',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
6
|
return schema;
|
|
41
7
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
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;
|
|
@@ -8,6 +8,7 @@ import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
|
8
8
|
import imageLeftSVG from '@plone/volto/icons/image-left.svg';
|
|
9
9
|
import imageRightSVG from '@plone/volto/icons/image-right.svg';
|
|
10
10
|
import type { IntlShape } from 'react-intl';
|
|
11
|
+
import type { StyleDefinition } from '@plone/types';
|
|
11
12
|
|
|
12
13
|
const messages = defineMessages({
|
|
13
14
|
left: {
|
|
@@ -34,7 +35,7 @@ export const defaultActionsInfo = ({
|
|
|
34
35
|
center: [imageFitSVG, intl.formatMessage(messages.center)],
|
|
35
36
|
});
|
|
36
37
|
|
|
37
|
-
const DEFAULT_ACTIONS = [
|
|
38
|
+
const DEFAULT_ACTIONS: StyleDefinition[] = [
|
|
38
39
|
{
|
|
39
40
|
style: {
|
|
40
41
|
'--block-alignment': 'var(--align-left)',
|
|
@@ -62,14 +63,13 @@ const BlockAlignmentWidget = (props: ButtonsWidgetProps) => {
|
|
|
62
63
|
const intl = useIntl();
|
|
63
64
|
|
|
64
65
|
const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
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
73
|
|
|
74
74
|
const actionsInfo = {
|
|
75
75
|
...defaultActionsInfo({ intl }),
|
|
@@ -9,6 +9,7 @@ import imageFitSVG from '@plone/volto/icons/image-fit.svg';
|
|
|
9
9
|
import imageNarrowSVG from '@plone/volto/icons/image-narrow.svg';
|
|
10
10
|
import imageWideSVG from '@plone/volto/icons/image-wide.svg';
|
|
11
11
|
import imageFullSVG from '@plone/volto/icons/image-full.svg';
|
|
12
|
+
import type { StyleDefinition } from '@plone/types';
|
|
12
13
|
|
|
13
14
|
const messages = defineMessages({
|
|
14
15
|
narrow: {
|
|
@@ -40,7 +41,7 @@ export const defaultActionsInfo = ({
|
|
|
40
41
|
full: [imageFullSVG, intl.formatMessage(messages.full)],
|
|
41
42
|
});
|
|
42
43
|
|
|
43
|
-
const DEFAULT_ACTIONS = [
|
|
44
|
+
const DEFAULT_ACTIONS: StyleDefinition[] = [
|
|
44
45
|
{
|
|
45
46
|
style: {
|
|
46
47
|
'--block-width': 'var(--narrow-container-width)',
|
|
@@ -75,14 +76,13 @@ const BlockWidthWidget = (props: ButtonsWidgetProps) => {
|
|
|
75
76
|
const intl = useIntl();
|
|
76
77
|
|
|
77
78
|
const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
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
86
|
|
|
87
87
|
const actionsInfo = {
|
|
88
88
|
...defaultActionsInfo({ intl }),
|
|
@@ -3,25 +3,15 @@ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWr
|
|
|
3
3
|
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
4
|
import { Button } from '@plone/components';
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
export type Actions =
|
|
9
|
-
| {
|
|
10
|
-
name: string;
|
|
11
|
-
label: string;
|
|
12
|
-
style: Record<`--${string}`, string>;
|
|
13
|
-
}
|
|
14
|
-
| {
|
|
15
|
-
name: string;
|
|
16
|
-
label: string;
|
|
17
|
-
style: undefined;
|
|
18
|
-
};
|
|
6
|
+
import type { StyleDefinition } from '@plone/types';
|
|
19
7
|
|
|
20
8
|
/**
|
|
21
9
|
* A tuple that has an icon in the first element and a i18n string in the second.
|
|
22
10
|
*/
|
|
23
11
|
export type ActionInfo = [React.ReactElement<any>, string] | [string, string];
|
|
24
12
|
|
|
13
|
+
type ActionValue = string | Record<`--${string}`, string>;
|
|
14
|
+
|
|
25
15
|
export type ButtonsWidgetProps = {
|
|
26
16
|
/**
|
|
27
17
|
* Unique identifier for the widget.
|
|
@@ -31,84 +21,121 @@ export type ButtonsWidgetProps = {
|
|
|
31
21
|
/**
|
|
32
22
|
* Callback function to handle changes.
|
|
33
23
|
*/
|
|
34
|
-
onChange:
|
|
24
|
+
onChange: (id: string, value: ActionValue) => void;
|
|
35
25
|
|
|
36
26
|
/**
|
|
37
27
|
* List of actions available for the widget.
|
|
38
28
|
*/
|
|
39
|
-
actions
|
|
29
|
+
actions?: Array<StyleDefinition | string>;
|
|
40
30
|
|
|
41
31
|
/**
|
|
42
32
|
* Map containing additional the information (icon and i18n string) for each action.
|
|
43
33
|
*/
|
|
44
|
-
actionsInfoMap
|
|
34
|
+
actionsInfoMap?: Record<string, ActionInfo>;
|
|
45
35
|
|
|
46
36
|
/**
|
|
47
37
|
* List of actions to be filtered out. In case that we don't want the default ones
|
|
48
38
|
* we can filter them out.
|
|
49
39
|
*/
|
|
50
|
-
filterActions
|
|
40
|
+
filterActions?: string[];
|
|
51
41
|
|
|
52
42
|
/**
|
|
53
43
|
* Current value of the widget.
|
|
54
44
|
*/
|
|
55
|
-
value
|
|
45
|
+
value?: ActionValue;
|
|
56
46
|
|
|
57
47
|
/**
|
|
58
48
|
* Default value of the widget.
|
|
59
49
|
*/
|
|
60
|
-
default
|
|
50
|
+
default?: ActionValue;
|
|
61
51
|
|
|
62
52
|
/**
|
|
63
53
|
* Indicates if the widget is disabled.
|
|
64
54
|
*/
|
|
65
|
-
disabled
|
|
55
|
+
disabled?: boolean;
|
|
66
56
|
|
|
67
57
|
/**
|
|
68
58
|
* Indicates if the widget is disabled (alternative flag for compatibility reasons).
|
|
69
59
|
*/
|
|
70
|
-
isDisabled
|
|
60
|
+
isDisabled?: boolean;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type NormalizedAction = {
|
|
65
|
+
name: string;
|
|
66
|
+
value: ActionValue;
|
|
71
67
|
};
|
|
72
68
|
|
|
73
69
|
const ButtonsWidget = (props: ButtonsWidgetProps) => {
|
|
74
|
-
const {
|
|
75
|
-
|
|
70
|
+
const {
|
|
71
|
+
disabled,
|
|
72
|
+
id,
|
|
73
|
+
onChange,
|
|
74
|
+
actions = [],
|
|
75
|
+
actionsInfoMap,
|
|
76
|
+
value,
|
|
77
|
+
isDisabled,
|
|
78
|
+
default: defaultValue,
|
|
79
|
+
} = props;
|
|
80
|
+
const normalizedActions = React.useMemo<NormalizedAction[]>(
|
|
81
|
+
() =>
|
|
82
|
+
actions.map((action) =>
|
|
83
|
+
typeof action === 'string'
|
|
84
|
+
? { name: action, value: action }
|
|
85
|
+
: {
|
|
86
|
+
name: action.name,
|
|
87
|
+
value: action.style ?? action.name,
|
|
88
|
+
},
|
|
89
|
+
),
|
|
90
|
+
[actions],
|
|
91
|
+
);
|
|
76
92
|
|
|
77
93
|
React.useEffect(() => {
|
|
78
|
-
if (!
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
if (!value && defaultValue) {
|
|
95
|
+
const nextValue =
|
|
96
|
+
typeof defaultValue === 'string'
|
|
97
|
+
? normalizedActions.find(({ name }) => name === defaultValue)
|
|
98
|
+
?.value ?? defaultValue
|
|
99
|
+
: defaultValue;
|
|
100
|
+
|
|
101
|
+
onChange(id, nextValue);
|
|
83
102
|
}
|
|
84
|
-
});
|
|
103
|
+
}, [defaultValue, id, normalizedActions, onChange, value]);
|
|
85
104
|
|
|
86
105
|
return (
|
|
87
106
|
<FormFieldWrapper {...props} className="widget">
|
|
88
107
|
<div className="buttons buttons-widget">
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
{normalizedActions.map((action) => {
|
|
109
|
+
const actionInfo = actionsInfoMap?.[action.name];
|
|
110
|
+
const [iconOrText, ariaLabel] = actionInfo ?? [
|
|
111
|
+
action.name,
|
|
112
|
+
action.name,
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Button
|
|
117
|
+
key={action.name}
|
|
118
|
+
aria-label={ariaLabel}
|
|
119
|
+
onPress={() => onChange(id, action.value)}
|
|
120
|
+
className={
|
|
121
|
+
isEqual(value, action.value)
|
|
122
|
+
? 'react-aria-Button active'
|
|
123
|
+
: 'react-aria-Button'
|
|
124
|
+
}
|
|
125
|
+
isDisabled={disabled || isDisabled}
|
|
126
|
+
>
|
|
127
|
+
{typeof iconOrText === 'string' ? (
|
|
128
|
+
<div className="image-sizes-text">{iconOrText}</div>
|
|
129
|
+
) : (
|
|
130
|
+
<Icon
|
|
131
|
+
name={iconOrText}
|
|
132
|
+
title={ariaLabel || action.name}
|
|
133
|
+
size="24px"
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
</Button>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
112
139
|
</div>
|
|
113
140
|
</FormFieldWrapper>
|
|
114
141
|
);
|
|
@@ -215,8 +215,14 @@ const ObjectListWidget = (props: ObjectListWidgetProps) => {
|
|
|
215
215
|
intl,
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
const newValue = [...(value || []), dataWithDefaults];
|
|
219
|
+
|
|
220
|
+
onChange(id, newValue);
|
|
221
|
+
|
|
222
|
+
// Set active the new object ensuring the state is updated after adding the new item
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
setActiveObject(newValue.length - 1);
|
|
225
|
+
}, 0);
|
|
220
226
|
}}
|
|
221
227
|
>
|
|
222
228
|
<Icon name={addSVG} size="18px" />
|
|
@@ -4,6 +4,7 @@ import ButtonsWidget, {
|
|
|
4
4
|
type ButtonsWidgetProps,
|
|
5
5
|
} from './Buttons';
|
|
6
6
|
import type { IntlShape } from 'react-intl';
|
|
7
|
+
import type { StyleDefinition } from '@plone/types';
|
|
7
8
|
|
|
8
9
|
const messages = defineMessages({
|
|
9
10
|
s: {
|
|
@@ -30,18 +31,21 @@ export const defaultActionsInfo = ({
|
|
|
30
31
|
l: ['L', intl.formatMessage(messages.l)],
|
|
31
32
|
});
|
|
32
33
|
|
|
33
|
-
const DEFAULT_ACTIONS = [
|
|
34
|
+
const DEFAULT_ACTIONS: StyleDefinition[] = [
|
|
34
35
|
{
|
|
35
36
|
name: 's',
|
|
36
37
|
label: 'Small',
|
|
38
|
+
style: undefined,
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
name: 'm',
|
|
40
42
|
label: 'Medium',
|
|
43
|
+
style: undefined,
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
46
|
name: 'l',
|
|
44
47
|
label: 'Large',
|
|
48
|
+
style: undefined,
|
|
45
49
|
},
|
|
46
50
|
];
|
|
47
51
|
|
|
@@ -49,14 +53,13 @@ const SizeWidget = (props: ButtonsWidgetProps) => {
|
|
|
49
53
|
const intl = useIntl();
|
|
50
54
|
|
|
51
55
|
const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
56
|
+
const filteredActions =
|
|
57
|
+
filterActions && filterActions.length > 0
|
|
58
|
+
? actions.filter((action) => {
|
|
59
|
+
const actionName = typeof action === 'string' ? action : action.name;
|
|
60
|
+
return filterActions.includes(actionName);
|
|
61
|
+
})
|
|
62
|
+
: actions;
|
|
60
63
|
|
|
61
64
|
const actionsInfo = {
|
|
62
65
|
...defaultActionsInfo({ intl }),
|
package/src/config/blocks.tsx
CHANGED
|
@@ -46,8 +46,6 @@ import SearchBlockViewEvent from '../components/Blocks/EventCalendar/Search/Sear
|
|
|
46
46
|
import SearchBlockEditEvent from '../components/Blocks/EventCalendar/Search/SearchBlockEdit';
|
|
47
47
|
import SearchBlockSchemaEvent from '../components/Blocks/EventCalendar/Search/schema';
|
|
48
48
|
import EventCalenderTemplate from '../components/Blocks/EventCalendar/Search/components/EventTemplate';
|
|
49
|
-
import SliderVariants from '../components/Blocks/Slider/SliderVariants';
|
|
50
|
-
import DefaultBody from '../customizations/@kitconcept/volto-slider-block/components/DefaultBody';
|
|
51
49
|
|
|
52
50
|
declare module '@plone/types' {
|
|
53
51
|
export interface BlocksConfigData {
|
|
@@ -403,10 +401,10 @@ export default function install(config: ConfigType) {
|
|
|
403
401
|
|
|
404
402
|
// Check if the separator is present before enhancing it
|
|
405
403
|
if (config.blocks.blocksConfig?.separator?.id) {
|
|
406
|
-
config.blocks.blocksConfig.separator =
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
404
|
+
config.blocks.blocksConfig.separator.schemaEnhancer = composeSchema(
|
|
405
|
+
config.blocks.blocksConfig.separator.schemaEnhancer,
|
|
406
|
+
SeparatorStylingSchema,
|
|
407
|
+
);
|
|
410
408
|
}
|
|
411
409
|
|
|
412
410
|
// TOC Block
|
|
@@ -418,24 +416,7 @@ export default function install(config: ConfigType) {
|
|
|
418
416
|
};
|
|
419
417
|
|
|
420
418
|
// Slider Block
|
|
421
|
-
config.blocks.blocksConfig.slider =
|
|
422
|
-
...config.blocks.blocksConfig.slider,
|
|
423
|
-
variations: [
|
|
424
|
-
{
|
|
425
|
-
id: 'default',
|
|
426
|
-
title: 'Default',
|
|
427
|
-
isDefault: true,
|
|
428
|
-
view: DefaultBody,
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
{
|
|
432
|
-
id: 'simple',
|
|
433
|
-
title: 'Simple',
|
|
434
|
-
view: SliderVariants,
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
schemaEnhancer: sliderBlockSchemaEnhancer,
|
|
438
|
-
};
|
|
419
|
+
config.blocks.blocksConfig.slider.schemaEnhancer = sliderBlockSchemaEnhancer;
|
|
439
420
|
|
|
440
421
|
return config;
|
|
441
422
|
}
|