@eeacms/volto-accordion-block
Advanced tools
Comparing version 3.3.1 to 3.4.0
@@ -7,4 +7,12 @@ ### Changelog | ||
#### [3.4.0](https://github.com/eea/volto-accordion-block/compare/3.3.1...3.4.0) | ||
- Add block extenders and i18n aware [`#20`](https://github.com/eea/volto-accordion-block/pull/20) | ||
- Release 3.4.0 [`d2be3bc`](https://github.com/eea/volto-accordion-block/commit/d2be3bcea7deb2e0aecf6e96c84a331c288d3823) | ||
#### [3.3.1](https://github.com/eea/volto-accordion-block/compare/3.3.0...3.3.1) | ||
> 7 September 2021 | ||
- Release - Visual improvements (#18) [`#19`](https://github.com/eea/volto-accordion-block/pull/19) | ||
- Visual improvements [`#18`](https://github.com/eea/volto-accordion-block/pull/18) | ||
@@ -11,0 +19,0 @@ |
{ | ||
"name": "@eeacms/volto-accordion-block", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "volto-accordion-block: Volto accordion block", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
import { BlocksForm, Icon, SidebarPortal } from '@plone/volto/components'; | ||
import InlineForm from '@plone/volto/components/manage/Form/InlineForm'; | ||
import { emptyBlocksForm } from '@plone/volto/helpers'; | ||
@@ -8,2 +7,5 @@ import helpSVG from '@plone/volto/icons/help.svg'; | ||
import { Button, Segment } from 'semantic-ui-react'; | ||
import { withBlockExtensions } from '@plone/volto/helpers'; | ||
import { BlockDataForm } from '@plone/volto/components'; | ||
import { useIntl } from 'react-intl'; | ||
import AccordionEdit from './AccordionEdit'; | ||
@@ -26,3 +28,3 @@ import EditBlockWrapper from './EditBlockWrapper'; | ||
} = props; | ||
const intl = useIntl(); | ||
const properties = isEmpty(data?.data?.blocks) | ||
@@ -38,3 +40,3 @@ ? emptyAccordion(3) | ||
const setInitialData = () => { | ||
const accordionSchema = accordionBlockSchema(); | ||
const accordionSchema = accordionBlockSchema({ intl }); | ||
const defaultValues = Object.keys(accordionSchema.properties).reduce( | ||
@@ -228,4 +230,4 @@ (accumulator, currentVal) => { | ||
{!data?.readOnlySettings && ( | ||
<InlineForm | ||
schema={accordionBlockSchema()} | ||
<BlockDataForm | ||
schema={accordionBlockSchema({ intl })} | ||
title="Accordion block" | ||
@@ -239,2 +241,3 @@ onChangeField={(id, value) => { | ||
formData={data} | ||
block={block} | ||
/> | ||
@@ -247,2 +250,2 @@ )} | ||
export default Edit; | ||
export default withBlockExtensions(Edit); |
@@ -0,1 +1,46 @@ | ||
import { defineMessages } from 'react-intl'; | ||
const messages = defineMessages({ | ||
Accordion: { | ||
id: 'Accordion', | ||
defaultMessage: 'Accordion', | ||
}, | ||
Style: { | ||
id: 'Style', | ||
defaultMessage: 'Style', | ||
}, | ||
Title: { | ||
id: 'Title', | ||
defaultMessage: 'Title', | ||
}, | ||
friendly_name: { | ||
id: 'Friendly name', | ||
defaultMessage: 'Friendly name', | ||
}, | ||
title_size: { | ||
id: 'Title size', | ||
defaultMessage: 'Title size', | ||
}, | ||
title_size_description: { | ||
id: 'Accordion Title size', | ||
defaultMessage: 'Accordion Title size', | ||
}, | ||
right_arrows: { | ||
id: 'Title Icon on the right', | ||
defaultMessage: 'Title Icon on the right', | ||
}, | ||
collapsed: { | ||
id: 'Collapsed by default', | ||
defaultMessage: 'Collapsed by default', | ||
}, | ||
non_exclusive: { | ||
id: 'Non exclusive', | ||
defaultMessage: 'Non exclusive', | ||
}, | ||
non_exclusive_description: { | ||
id: 'Allow multiple panels open at a time', | ||
defaultMessage: 'Allow multiple panels open at a time', | ||
}, | ||
}); | ||
export const AccordionSchema = { | ||
@@ -18,3 +63,3 @@ title: 'Accordion', | ||
export const accordionBlockSchema = () => ({ | ||
export const accordionBlockSchema = ({ intl }) => ({ | ||
title: 'Accordion block', | ||
@@ -29,3 +74,3 @@ fieldsets: [ | ||
id: 'style', | ||
title: 'Style', | ||
title: intl.formatMessage(messages.Style), | ||
fields: [ | ||
@@ -42,8 +87,8 @@ 'title', | ||
title: { | ||
title: 'Title', | ||
description: 'Friendly name', | ||
title: intl.formatMessage(messages.Title), | ||
description: intl.formatMessage(messages.friendly_name), | ||
type: 'string', | ||
}, | ||
data: { | ||
title: 'Accordion', | ||
title: intl.formatMessage(messages.Accordion), | ||
type: 'panels', | ||
@@ -53,4 +98,4 @@ schema: AccordionSchema, | ||
title_size: { | ||
title: 'Title size', | ||
description: 'Accordion Title size', | ||
title: intl.formatMessage(messages.title_size), | ||
description: intl.formatMessage(messages.title_size_description), | ||
type: 'string', | ||
@@ -67,3 +112,3 @@ factory: 'Choice', | ||
right_arrows: { | ||
title: 'Title Icon on the right', | ||
title: intl.formatMessage(messages.right_arrows), | ||
type: 'boolean', | ||
@@ -73,3 +118,3 @@ default: false, | ||
collapsed: { | ||
title: 'Collapsed by default', | ||
title: intl.formatMessage(messages.collapsed), | ||
type: 'boolean', | ||
@@ -79,4 +124,4 @@ default: true, | ||
non_exclusive: { | ||
title: 'Non exclusive', | ||
description: 'Allow multiple panels open at a time', | ||
title: intl.formatMessage(messages.non_exclusive), | ||
description: intl.formatMessage(messages.non_exclusive_description), | ||
type: 'boolean', | ||
@@ -83,0 +128,0 @@ default: true, |
@@ -5,2 +5,3 @@ import React from 'react'; | ||
import { Accordion } from 'semantic-ui-react'; | ||
import { withBlockExtensions } from '@plone/volto/helpers'; | ||
@@ -97,2 +98,2 @@ import cx from 'classnames'; | ||
export default View; | ||
export default withBlockExtensions(View); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93228
1622