@eeacms/volto-accordion-block
Advanced tools
Comparing version 10.1.1 to 10.2.0
@@ -7,2 +7,12 @@ ### Changelog | ||
### [10.2.0](https://github.com/eea/volto-accordion-block/compare/10.1.1...10.2.0) - 28 August 2023 | ||
#### :rocket: New Features | ||
- feat(accordion): improve a11n by providing aria-expanded and open close using spacebar on header [David Ichim - [`26951d9`](https://github.com/eea/volto-accordion-block/commit/26951d9f729b868658feba0971cd3c68fdb228be)] | ||
#### :hammer_and_wrench: Others | ||
- Release 10.2.0 [Alin Voinea - [`357dce5`](https://github.com/eea/volto-accordion-block/commit/357dce5d45f87b42f705f2a5d35d6e601168bb12)] | ||
- update test snapshot after latest a11n changes [David Ichim - [`12cc58f`](https://github.com/eea/volto-accordion-block/commit/12cc58fd5f8831f8daba4cf9b3d8bb0392a3c129)] | ||
### [10.1.1](https://github.com/eea/volto-accordion-block/compare/10.1.0...10.1.1) - 23 August 2023 | ||
@@ -141,4 +151,2 @@ | ||
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`83cfef7`](https://github.com/eea/volto-accordion-block/commit/83cfef72305789fe95c4d463956d446e934e37bd)] | ||
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`e8d2ff3`](https://github.com/eea/volto-accordion-block/commit/e8d2ff341ff2db8baec52b9e839e2ace6eee7c1a)] | ||
@@ -151,3 +159,2 @@ #### :hammer_and_wrench: Others | ||
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`67a0667`](https://github.com/eea/volto-accordion-block/commit/67a0667ee563e8ee01c5e660cd2b127eaa1da4fc)] | ||
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`9c06bd0`](https://github.com/eea/volto-accordion-block/commit/9c06bd0f3d262bb553541ec884c659d31fea70d5)] | ||
## [8.0.0](https://github.com/eea/volto-accordion-block/compare/7.1.0...8.0.0) - 24 March 2023 | ||
@@ -165,3 +172,2 @@ | ||
- Release 7.1.0 [Alin Voinea - [`207318f`](https://github.com/eea/volto-accordion-block/commit/207318f45321d9caf2e9e88a36786d6a6dfbfce6)] | ||
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`a1279b2`](https://github.com/eea/volto-accordion-block/commit/a1279b20f134b8da44ca45e1e3eecf50401372f8)] | ||
## [7.0.0](https://github.com/eea/volto-accordion-block/compare/6.0.0...7.0.0) - 7 February 2023 | ||
@@ -178,8 +184,3 @@ | ||
- Add theme picker widget [dana-cfc4 - [`b567515`](https://github.com/eea/volto-accordion-block/commit/b5675150e1b5a811e1686404cbefcd9e6b92d515)] | ||
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`dd14109`](https://github.com/eea/volto-accordion-block/commit/dd14109b3df7aee49ab1fdb57b8ac749193723c7)] | ||
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`6169240`](https://github.com/eea/volto-accordion-block/commit/6169240953e8b81fbf1200bfa7b77c1be3be318f)] | ||
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`bbf12a0`](https://github.com/eea/volto-accordion-block/commit/bbf12a07558ea1f2c9d6e62fa4bf897d1c27ad71)] | ||
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`cb18b3c`](https://github.com/eea/volto-accordion-block/commit/cb18b3c7d12318a671e6031054cb6cb98c5e4766)] | ||
- yarn 3 [Alin Voinea - [`26994da`](https://github.com/eea/volto-accordion-block/commit/26994dab66bce3873911fee6fb46fc51dfce44d7)] | ||
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`5803993`](https://github.com/eea/volto-accordion-block/commit/5803993b263352f7d3a5e4c14f5ac5b1607a1dc2)] | ||
## [6.0.0](https://github.com/eea/volto-accordion-block/compare/5.0.0...6.0.0) - 16 November 2022 | ||
@@ -214,3 +215,2 @@ | ||
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`3c0236e`](https://github.com/eea/volto-accordion-block/commit/3c0236ef0e055bbbac852b66139767cee8631aad)] | ||
- test(cypress): Add missing md5 dependency [Alin Voinea - [`1afae5d`](https://github.com/eea/volto-accordion-block/commit/1afae5d677de53778d5727334f9a6add8120d046)] | ||
@@ -233,3 +233,2 @@ ## [4.0.0](https://github.com/eea/volto-accordion-block/compare/3.5.0...4.0.0) - 27 September 2022 | ||
- Use volto@16.0.0-alpha.14 in cypress tests [Miu Razvan - [`f4dd7a1`](https://github.com/eea/volto-accordion-block/commit/f4dd7a1221ef2437b813d45b232efbf8c04bb8c5)] | ||
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`20652bc`](https://github.com/eea/volto-accordion-block/commit/20652bcea7bd1f4f7271cf0b2fe8223401401a4f)] | ||
- update(jest): add @plone/volto-slate resolver refs- #153447 [nileshgulia1 - [`7a1af55`](https://github.com/eea/volto-accordion-block/commit/7a1af55061b0c75ecb77fdbae9e2e6586df3b50c)] | ||
@@ -241,3 +240,2 @@ ### [3.5.0](https://github.com/eea/volto-accordion-block/compare/3.4.16...3.5.0) - 30 June 2022 | ||
- Release 3.5.0 [Alin Voinea - [`c237343`](https://github.com/eea/volto-accordion-block/commit/c237343daa82eb0fb0ddb49e04ee6c49578b8fd2)] | ||
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`5de2964`](https://github.com/eea/volto-accordion-block/commit/5de296427472925998273bf9c164ba5b65895a14)] | ||
### [3.4.16](https://github.com/eea/volto-accordion-block/compare/3.4.15...3.4.16) - 17 May 2022 | ||
@@ -252,4 +250,2 @@ | ||
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`66fada5`](https://github.com/eea/volto-accordion-block/commit/66fada5a7084e1adb36ef5ff950d498391729eab)] | ||
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`9d96b9d`](https://github.com/eea/volto-accordion-block/commit/9d96b9d392004dd8791c061c5fa39deee253c16a)] | ||
### [3.4.14](https://github.com/eea/volto-accordion-block/compare/3.4.13...3.4.14) - 3 March 2022 | ||
@@ -278,3 +274,2 @@ | ||
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`197c242`](https://github.com/eea/volto-accordion-block/commit/197c2426f18e3b74296c18ef86781e63596bcd4b)] | ||
### [3.4.10](https://github.com/eea/volto-accordion-block/compare/3.4.9...3.4.10) - 10 December 2021 | ||
@@ -298,3 +293,2 @@ | ||
- cy: make tests run with both slate and draftjs [nileshgulia1 - [`e51f7a5`](https://github.com/eea/volto-accordion-block/commit/e51f7a5c36804240d90e19baa9c7b321e41a7c23)] | ||
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`9f515c3`](https://github.com/eea/volto-accordion-block/commit/9f515c3e1055b07ea5ea7ac8dbf72eb2e4b79c74)] | ||
### [3.4.7](https://github.com/eea/volto-accordion-block/compare/3.4.6...3.4.7) - 25 October 2021 | ||
@@ -305,4 +299,2 @@ | ||
- Refs #34 ensure floated images from content area don't spill over next accordion title [David Ichim - [`79abc8c`](https://github.com/eea/volto-accordion-block/commit/79abc8c1b13eb26fb78b9dbe53fc2711c02a1ed1)] | ||
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`f5c2cf9`](https://github.com/eea/volto-accordion-block/commit/f5c2cf969763a5400e4d9fb66bafad761cd17f2f)] | ||
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`92cd189`](https://github.com/eea/volto-accordion-block/commit/92cd1891291a33e92c1f4488ff2afb90642d2706)] | ||
### [3.4.6](https://github.com/eea/volto-accordion-block/compare/3.4.5...3.4.6) - 6 October 2021 | ||
@@ -316,3 +308,2 @@ | ||
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`c0bc59d`](https://github.com/eea/volto-accordion-block/commit/c0bc59d897ece309834ffef8ddea516aceef1e5f)] | ||
### [3.4.5](https://github.com/eea/volto-accordion-block/compare/3.4.4...3.4.5) - 29 September 2021 | ||
@@ -329,3 +320,2 @@ | ||
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`046f3aa`](https://github.com/eea/volto-accordion-block/commit/046f3aae09e1725d44bcdc371d07ed32e8309423)] | ||
### [3.4.3](https://github.com/eea/volto-accordion-block/compare/3.4.2...3.4.3) - 17 September 2021 | ||
@@ -340,3 +330,2 @@ | ||
- Add missing onChangeField to make it work with Metadata section block - refs #137434 [Alin Voinea - [`5253b74`](https://github.com/eea/volto-accordion-block/commit/5253b74a52043a3ad7e2e813abaf2d27f0e83a7a)] | ||
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`1e4d3dc`](https://github.com/eea/volto-accordion-block/commit/1e4d3dc937bc63825bd1fc6156eca9b6d073a40b)] | ||
### [3.4.0](https://github.com/eea/volto-accordion-block/compare/3.3.1...3.4.0) - 7 September 2021 | ||
@@ -354,3 +343,2 @@ | ||
- Release 3.3.0 [Alin Voinea - [`2cbb1d5`](https://github.com/eea/volto-accordion-block/commit/2cbb1d53ce62b9cb42751c4c4997577ba4165649)] | ||
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`ab257ac`](https://github.com/eea/volto-accordion-block/commit/ab257acb0c2c8e38b906fcce8f6e148e4690d473)] | ||
### [3.2.4](https://github.com/eea/volto-accordion-block/compare/3.2.3...3.2.4) - 21 July 2021 | ||
@@ -482,3 +470,2 @@ | ||
- add accordion title as a slate editor [nileshgulia1 - [`38e841d`](https://github.com/eea/volto-accordion-block/commit/38e841d9a1a2d1d6a9d657ed6d611220615cbd40)] | ||
- yarn prettier [Alin Voinea - [`afc2d37`](https://github.com/eea/volto-accordion-block/commit/afc2d379490cc4bdd4e2c2296229fac5d549d6a1)] | ||
- make title editable [nileshgulia1 - [`e3233b0`](https://github.com/eea/volto-accordion-block/commit/e3233b00f3e0e1b0ef240a035d4aca7384a23b3c)] | ||
@@ -485,0 +472,0 @@ ### 0.1.0 - 9 November 2020 |
118
DEVELOP.md
@@ -9,3 +9,3 @@ # volto-accordion-block | ||
```Bash | ||
```bash | ||
git clone https://github.com/eea/volto-accordion-block.git | ||
@@ -18,3 +18,3 @@ cd volto-accordion-block | ||
1. Wait for `Volto started at 0.0.0.0:3000` meesage | ||
1. Wait for `Volto started at 0.0.0.0:3000` message | ||
@@ -25,3 +25,3 @@ 1. Go to http://localhost:3000 | ||
```Bash | ||
```bash | ||
cd src/addons/volto-accordion-block/ | ||
@@ -32,7 +32,7 @@ ``` | ||
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/) | ||
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://6.docs.plone.org/volto/getting-started/install.html) | ||
1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer` | ||
```Bash | ||
```bash | ||
npm install -g yo @plone/generator-volto mrs-developer | ||
@@ -43,3 +43,3 @@ ``` | ||
```Bash | ||
```bash | ||
yo @plone/volto my-volto-project --addon @eeacms/volto-accordion-block --skip-install | ||
@@ -64,4 +64,3 @@ cd my-volto-project | ||
```Bash | ||
make develop | ||
```bash | ||
yarn | ||
@@ -72,7 +71,7 @@ ``` | ||
```Bash | ||
```bash | ||
docker compose up backend | ||
``` | ||
...wait for backend to setup and start - `Ready to handle requests`: | ||
...wait for backend to set up and start - `Ready to handle requests`: | ||
@@ -83,3 +82,3 @@ ...you can also check http://localhost:8080/Plone | ||
```BASH | ||
```bash | ||
yarn start | ||
@@ -92,6 +91,8 @@ ``` | ||
```BASH | ||
```bash | ||
cd src/addons/volto-accordion-block/ | ||
``` | ||
--- | ||
## Cypress | ||
@@ -101,3 +102,3 @@ | ||
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend | ||
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend | ||
project where you added `volto-accordion-block` to `mrs.developer.json` | ||
@@ -107,3 +108,3 @@ | ||
```BASH | ||
```bash | ||
cd src/addons/volto-accordion-block/ | ||
@@ -114,3 +115,3 @@ ``` | ||
```Bash | ||
```bash | ||
make | ||
@@ -124,3 +125,3 @@ make start | ||
```Bash | ||
```bash | ||
make cypress-open | ||
@@ -131,4 +132,87 @@ ``` | ||
```Bash | ||
```bash | ||
make cypress-run | ||
``` | ||
--- | ||
## Prettier | ||
[Prettier](https://www.npmjs.com/package/prettier) is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it | ||
with its own rules that take the maximum line length into account, wrapping code when necessary. | ||
Run ``prettier`` linter, executing the following command: | ||
```bash | ||
make prettier | ||
``` | ||
To fix the ``prettier`` warnings, execute the following command: | ||
```bash | ||
make prettier-fix | ||
``` | ||
--- | ||
## Eslint | ||
[ESLint](https://www.npmjs.com/package/eslint) is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. | ||
Eslint should run just fine using the setup config from any Volto projects generated by `volto project generator`. | ||
If for some reason that doesn't work, and you need to manually install eslint, | ||
you can also use the following steps to install eslint. | ||
For installing ``eslint``, execute the following command: | ||
```bash | ||
yarn add --dev eslint eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-flowtype | ||
``` | ||
For setting up ``eslint``, execute the following command: | ||
```bash | ||
cp .project.eslintrc.js .eslintrc.js | ||
``` | ||
Run ``eslint``, executing the following command: | ||
```bash | ||
make lint | ||
``` | ||
To fix the problems found by ``eslint``, execute the following command: | ||
```bash | ||
make lint-fix | ||
``` | ||
--- | ||
## Stylelint | ||
[Stylelint](https://www.npmjs.com/package/stylelint) is a mighty CSS linter that helps you avoid errors and enforce conventions. | ||
For installing ``stylelint``, execute the following command: | ||
```bash | ||
yarn add --dev stylelint | ||
``` | ||
To run ``stylelint``, execute the following command: | ||
```bash | ||
make stylelint | ||
``` | ||
If you need to run ``stylelint`` on styles found in .overrides files, execute the following command: | ||
```bash | ||
make stylelint-overrides | ||
``` | ||
To auto fix the found issues by ``stylelint``, execute the following command: | ||
```bash | ||
make stylelint-fix | ||
``` |
{ | ||
"name": "@eeacms/volto-accordion-block", | ||
"version": "10.1.1", | ||
"version": "10.2.0", | ||
"description": "volto-accordion-block: Volto accordion block", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -21,4 +21,7 @@ # volto-accordion-block | ||
![Volto Block Accordion](https://github.com/eea/volto-accordion-block/raw/docs/docs/volto-accordion-block.gif) | ||
- [Accordion Component Storybook](https://eea.github.io/eea-storybook/?path=/story/components-accordion--default). | ||
![Volto Block Accordion](https://raw.githubusercontent.com/eea/volto-accordion-block/docs/docs/volto-accordion-block.gif "Volto Block Accordion") | ||
## Getting started | ||
@@ -28,6 +31,8 @@ | ||
git clone https://github.com/eea/volto-accordion-block.git | ||
cd volto-accordion-block | ||
make | ||
make start | ||
```bash | ||
git clone https://github.com/eea/volto-accordion-block.git | ||
cd volto-accordion-block | ||
make | ||
make start | ||
``` | ||
@@ -40,3 +45,3 @@ Go to http://localhost:3000 | ||
```Bash | ||
```bash | ||
docker compose up backend | ||
@@ -49,26 +54,26 @@ ``` | ||
```JSON | ||
"addons": [ | ||
"@eeacms/volto-accordion-block" | ||
], | ||
```json | ||
"addons": [ | ||
"@eeacms/volto-accordion-block" | ||
], | ||
"dependencies": { | ||
"@eeacms/volto-accordion-block": "*" | ||
} | ||
``` | ||
"dependencies": { | ||
"@eeacms/volto-accordion-block": "*" | ||
} | ||
``` | ||
- If not, create one: | ||
``` | ||
npm install -g yo @plone/generator-volto | ||
yo @plone/volto my-volto-project --addon @eeacms/volto-accordion-block | ||
cd my-volto-project | ||
``` | ||
```bash | ||
npm install -g yo @plone/generator-volto | ||
yo @plone/volto my-volto-project --addon @eeacms/volto-accordion-block | ||
cd my-volto-project | ||
``` | ||
1. Install new add-ons and restart Volto: | ||
``` | ||
yarn | ||
yarn start | ||
``` | ||
```bash | ||
yarn | ||
yarn start | ||
``` | ||
@@ -75,0 +80,0 @@ 1. Go to http://localhost:3000 |
@@ -7,4 +7,12 @@ import cx from 'classnames'; | ||
import config from '@plone/volto/registry'; | ||
import { defineMessages, injectIntl } from 'react-intl'; | ||
export default (props) => { | ||
const messages = defineMessages({ | ||
EnterTitle: { | ||
id: 'Enter Title', | ||
defaultMessage: 'Enter Title', | ||
}, | ||
}); | ||
const AccordionEdit = (props) => { | ||
const { | ||
@@ -18,2 +26,3 @@ children, | ||
index, | ||
intl, | ||
} = props; | ||
@@ -81,3 +90,3 @@ const [activeIndex, setActiveIndex] = React.useState([0]); | ||
transparent | ||
placeholder="Enter Title" | ||
placeholder={intl.formatMessage(messages.EnterTitle)} | ||
value={panel?.title || ''} | ||
@@ -105,1 +114,3 @@ onClick={(e) => { | ||
}; | ||
export default injectIntl(AccordionEdit); |
@@ -6,4 +6,8 @@ import { render, fireEvent } from '@testing-library/react'; | ||
import config from '@plone/volto/registry'; | ||
import { Provider } from 'react-intl-redux'; | ||
import configureStore from 'redux-mock-store'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
const mockStore = configureStore(); | ||
config.blocks.blocksConfig.accordion = { | ||
@@ -31,2 +35,9 @@ ...config.blocks.blocksConfig.accordion, | ||
const store = mockStore({ | ||
intl: { | ||
locale: 'en', | ||
messages: {}, | ||
formatMessage: () => 'Select layout', | ||
}, | ||
}); | ||
describe('AccordionEdit', () => { | ||
@@ -57,10 +68,12 @@ const uid = 'uid'; | ||
const component = renderer.create( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/> | ||
</Provider>, | ||
); | ||
@@ -73,10 +86,12 @@ const json = component.toJSON(); | ||
const { getByText } = render( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data1} | ||
index={index} | ||
/>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data1} | ||
index={index} | ||
/> | ||
</Provider>, | ||
); | ||
@@ -89,10 +104,12 @@ | ||
const { getByDisplayValue } = render( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/> | ||
</Provider>, | ||
); | ||
@@ -107,10 +124,12 @@ | ||
const { getByDisplayValue } = render( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
/> | ||
</Provider>, | ||
); | ||
@@ -133,12 +152,14 @@ | ||
const { container, getByText } = render( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
> | ||
<p>Accordion Content</p> | ||
</AccordionEdit>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={data} | ||
index={index} | ||
> | ||
<p>Accordion Content</p> | ||
</AccordionEdit> | ||
</Provider>, | ||
); | ||
@@ -154,12 +175,14 @@ const accordionTitle = container.querySelector('.accordion-title'); | ||
const { container, getByText } = render( | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={{ ...data, non_exclusive: false }} | ||
index={index} | ||
> | ||
<p>Accordion Content</p> | ||
</AccordionEdit>, | ||
<Provider store={store}> | ||
<AccordionEdit | ||
handleTitleChange={handleTitleChange} | ||
handleTitleClick={handleTitleClick} | ||
uid={uid} | ||
panel={panel} | ||
data={{ ...data, non_exclusive: false }} | ||
index={index} | ||
> | ||
<p>Accordion Content</p> | ||
</AccordionEdit> | ||
</Provider>, | ||
); | ||
@@ -166,0 +189,0 @@ const accordionTitle = container.querySelector('.accordion-title'); |
@@ -17,3 +17,3 @@ import { | ||
import { Button, Segment } from 'semantic-ui-react'; | ||
import { useIntl } from 'react-intl'; | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import AccordionEdit from './AccordionEdit'; | ||
@@ -27,2 +27,17 @@ import AccordionFilter from './AccordionFilter'; | ||
const messages = defineMessages({ | ||
SectionHelp: { | ||
id: 'Section help', | ||
defaultMessage: 'Section help', | ||
}, | ||
AccordionBlock: { | ||
id: 'Accordion block', | ||
defaultMessage: 'Accordion block', | ||
}, | ||
Accordion: { | ||
id: 'Accordion', | ||
defaultMessage: 'Accordion', | ||
}, | ||
}); | ||
const Edit = (props) => { | ||
@@ -381,3 +396,3 @@ const [selectedBlock, setSelectedBlock] = useState({}); | ||
basic | ||
title="Section help" | ||
title={intl.formatMessage(messages.SectionHelp)} | ||
onClick={() => { | ||
@@ -384,0 +399,0 @@ setSelectedBlock({}); |
@@ -24,2 +24,10 @@ import React from 'react'; | ||
}, | ||
dragAndDrop: { | ||
id: 'Drag and drop', | ||
defaultMessage: 'Drag and drop', | ||
}, | ||
removeBlock: { | ||
id: 'Remove block', | ||
defaultMessage: 'Remove block', | ||
}, | ||
}); | ||
@@ -86,3 +94,7 @@ | ||
> | ||
<Button icon basic title="Drag and drop"> | ||
<Button | ||
icon | ||
basic | ||
title={intl.formatMessage(messages.dragAndDrop)} | ||
> | ||
<Icon name={dragSVG} size="19px" /> | ||
@@ -107,3 +119,3 @@ </Button> | ||
basic | ||
title="Remove block" | ||
title={intl.formatMessage(messages.removeBlock)} | ||
onClick={() => onDeleteBlock(block)} | ||
@@ -110,0 +122,0 @@ className="delete-button-accordion-block" |
@@ -0,7 +1,129 @@ | ||
import { defineMessages, createIntlCache, createIntl } from 'react-intl'; | ||
const messages = defineMessages({ | ||
AccordionBlockSettings: { | ||
id: 'Accordion block settings', | ||
defaultMessage: 'Accordion block settings', | ||
}, | ||
Default: { | ||
id: 'Default', | ||
defaultMessage: 'Default', | ||
}, | ||
Title: { | ||
id: 'Title', | ||
defaultMessage: 'Title', | ||
}, | ||
SectionFriendlyName: { | ||
id: 'Section friendly name', | ||
defaultMessage: 'Section friendly name', | ||
}, | ||
AllowedBlocks: { | ||
id: 'Allowed blocks', | ||
defaultMessage: 'Allowed blocks', | ||
}, | ||
AllowOnlyFollowingBlocksTypes: { | ||
id: 'Allow only the following blocks types', | ||
defaultMessage: 'Allow only the following blocks types', | ||
}, | ||
HelperText: { | ||
id: 'Helper text', | ||
defaultMessage: 'Helper text', | ||
}, | ||
ShortHintThatDescribesExpectedValueWithinThisBlock: { | ||
id: 'A short hint that describes the expected value within this block', | ||
defaultMessage: | ||
'A short hint that describes the expected value within this block', | ||
}, | ||
Instructions: { | ||
id: 'Instructions', | ||
defaultMessage: 'Instructions', | ||
}, | ||
DetailedExpectedValueWithinThisBlock: { | ||
id: 'Detailed expected value within this block', | ||
defaultMessage: 'Detailed expected value within this block', | ||
}, | ||
Required: { | ||
id: 'Required', | ||
defaultMessage: 'Required', | ||
}, | ||
DontAllowDeletionOfThisBlock: { | ||
id: "Don't allow deletion of this block", | ||
defaultMessage: "Don't allow deletion of this block", | ||
}, | ||
FixedPosition: { | ||
id: 'Fixed position', | ||
defaultMessage: 'Fixed position', | ||
}, | ||
DisableDragDropOnThisBlock: { | ||
id: 'Disable drag & drop on this block', | ||
defaultMessage: 'Disable drag & drop on this block', | ||
}, | ||
FixedLayout: { | ||
id: 'Fixed layout', | ||
defaultMessage: 'Fixed layout', | ||
}, | ||
FixedlayoutNewPanesTabs: { | ||
id: | ||
'Fixed layout, New panes (tabs) created by Editor within this block will be ignored', | ||
defaultMessage: | ||
'Fixed layout, New panes (tabs) created by Editor within this block will be ignored', | ||
}, | ||
DisableNewBlocks: { | ||
id: 'Disable new blocks', | ||
defaultMessage: 'Disable new blocks', | ||
}, | ||
DisableCreationNewBlocks: { | ||
id: 'Disable creation of new blocks after this block', | ||
defaultMessage: 'Disable creation of new blocks after this block', | ||
}, | ||
ReadOnly: { | ||
id: 'Read-only', | ||
defaultMessage: 'Read-only', | ||
}, | ||
DisableEditingBlock: { | ||
id: 'Disable editing on this block', | ||
defaultMessage: 'Disable editing on this block', | ||
}, | ||
ReadOnlyTitles: { | ||
id: 'Read-only titles', | ||
defaultMessage: 'Read-only titles', | ||
}, | ||
DisableEditingOnAccordionTitles: { | ||
id: 'Disable editing on accordion titles', | ||
defaultMessage: 'Disable editing on accordion titles', | ||
}, | ||
ReadOnlySettings: { | ||
id: 'Read-only settings', | ||
defaultMessage: 'Read-only settings', | ||
}, | ||
DisableEditingOnAccordionBlockSettings: { | ||
id: 'Disable editing on accordion block settings', | ||
defaultMessage: 'Disable editing on accordion block settings', | ||
}, | ||
DisableInnerButtons: { | ||
id: 'Disable inner buttons', | ||
defaultMessage: 'Disable inner buttons', | ||
}, | ||
HideAllBlockRelatedButtonsWithinThisBlock: { | ||
id: 'Hide all block related buttons within this block', | ||
defaultMessage: 'Hide all block related buttons within this block', | ||
}, | ||
}); | ||
const cache = createIntlCache(); | ||
const intl = createIntl( | ||
{ | ||
locale: 'en', | ||
messages: messages, | ||
}, | ||
cache, | ||
); | ||
const Schema = { | ||
title: 'Accordion block settings', | ||
title: intl.formatMessage(messages.AccordionBlockSettings), | ||
fieldsets: [ | ||
{ | ||
id: 'default', | ||
title: 'Default', | ||
title: intl.formatMessage(messages.Default), | ||
fields: [ | ||
@@ -25,9 +147,9 @@ 'title', | ||
title: { | ||
title: 'Title', | ||
description: 'Section friendly name', | ||
title: intl.formatMessage(messages.Title), | ||
description: intl.formatMessage(messages.SectionFriendlyName), | ||
type: 'string', | ||
}, | ||
allowedBlocks: { | ||
title: 'Allowed blocks', | ||
description: 'Allow only the following blocks types', | ||
title: intl.formatMessage(messages.AllowedBlocks), | ||
description: intl.formatMessage(messages.AllowOnlyFollowingBlocksTypes), | ||
type: 'array', | ||
@@ -39,10 +161,13 @@ items: { | ||
placeholder: { | ||
title: 'Helper text', | ||
description: | ||
'A short hint that describes the expected value within this block', | ||
title: intl.formatMessage(messages.HelperText), | ||
description: intl.formatMessage( | ||
messages.ShortHintThatDescribesExpectedValueWithinThisBlock, | ||
), | ||
type: 'string', | ||
}, | ||
instructions: { | ||
title: 'Instructions', | ||
description: 'Detailed expected value within this block', | ||
title: intl.formatMessage(messages.Instructions), | ||
description: intl.formatMessage( | ||
messages.DetailedExpectedValueWithinThisBlock, | ||
), | ||
type: 'string', | ||
@@ -52,40 +177,43 @@ widget: 'richtext', | ||
required: { | ||
title: 'Required', | ||
description: "Don't allow deletion of this block", | ||
title: intl.formatMessage(messages.Required), | ||
description: intl.formatMessage(messages.DontAllowDeletionOfThisBlock), | ||
type: 'boolean', | ||
}, | ||
fixed: { | ||
title: 'Fixed position', | ||
description: 'Disable drag & drop on this block', | ||
title: intl.formatMessage(messages.FixedPosition), | ||
description: intl.formatMessage(messages.DisableDragDropOnThisBlock), | ||
type: 'boolean', | ||
}, | ||
fixedLayout: { | ||
title: 'Fixed layout', | ||
description: | ||
'Fixed layout, New panes (tabs) created by Editor within this block will be ignored', | ||
title: intl.formatMessage(messages.FixedLayout), | ||
description: intl.formatMessage(messages.FixedlayoutNewPanesTabs), | ||
type: 'boolean', | ||
}, | ||
disableNewBlocks: { | ||
title: 'Disable new blocks', | ||
description: 'Disable creation of new blocks after this block', | ||
title: intl.formatMessage(messages.DisableNewBlocks), | ||
description: intl.formatMessage(messages.DisableCreationNewBlocks), | ||
type: 'boolean', | ||
}, | ||
readOnly: { | ||
title: 'Read-only', | ||
description: 'Disable editing on this block', | ||
title: intl.formatMessage(messages.ReadOnly), | ||
description: intl.formatMessage(messages.DisableEditingBlock), | ||
type: 'boolean', | ||
}, | ||
readOnlyTitles: { | ||
title: 'Read-only titles', | ||
description: 'Disable editing on accordion titles', | ||
title: intl.formatMessage(messages.ReadOnlyTitles), | ||
description: intl.formatMessage(messages.DisableEditingOnAccordionTitles), | ||
type: 'boolean', | ||
}, | ||
readOnlySettings: { | ||
title: 'Read-only settings', | ||
description: 'Disable editing on accordion block settings', | ||
title: intl.formatMessage(messages.ReadOnlySettings), | ||
description: intl.formatMessage( | ||
messages.DisableEditingOnAccordionBlockSettings, | ||
), | ||
type: 'boolean', | ||
}, | ||
disableInnerButtons: { | ||
title: 'Disable inner buttons', | ||
description: 'Hide all block related buttons within this block', | ||
title: intl.formatMessage(messages.DisableInnerButtons), | ||
description: intl.formatMessage( | ||
messages.HideAllBlockRelatedButtonsWithinThisBlock, | ||
), | ||
type: 'boolean', | ||
@@ -92,0 +220,0 @@ }, |
import React from 'react'; | ||
import { defineMessages, injectIntl } from 'react-intl'; | ||
import { Button, Ref } from 'semantic-ui-react'; | ||
@@ -8,2 +9,9 @@ import { BlockChooser, Icon } from '@plone/volto/components'; | ||
const messages = defineMessages({ | ||
AddBlockInPosition: { | ||
id: 'add_block_in_position', | ||
defaultMessage: 'Add block in position', | ||
}, | ||
}); | ||
const OpenedBlocksChooser = (props) => { | ||
@@ -38,3 +46,3 @@ const { blocksConfig, block, onInsertBlock } = props; | ||
const NewBlockAddButton = (props) => { | ||
const { index } = props; | ||
const { index, intl } = props; | ||
const [isOpenMenu, setOpenMenu] = React.useState(false); | ||
@@ -67,3 +75,5 @@ | ||
className="add-block-button" | ||
aria-label={`Add block in position ${index}`} | ||
aria-label={`${intl.formatMessage( | ||
messages.AddBlockInPosition, | ||
)} ${index}`} | ||
> | ||
@@ -89,2 +99,2 @@ <Icon name={addSVG} className="circled" size="19px" /> | ||
export default NewBlockAddButton; | ||
export default injectIntl(NewBlockAddButton); |
@@ -10,2 +10,14 @@ import config from '@plone/volto/registry'; | ||
}, | ||
Options: { | ||
id: 'Options', | ||
defaultMessage: 'Options', | ||
}, | ||
Default: { | ||
id: 'Default', | ||
defaultMessage: 'Default', | ||
}, | ||
AccordionTitle: { | ||
id: 'Accordion title', | ||
defaultMessage: 'Accordion title', | ||
}, | ||
AccordionBlock: { | ||
@@ -15,6 +27,22 @@ id: 'Accordion block', | ||
}, | ||
Options: { | ||
id: 'Options', | ||
defaultMessage: 'Options', | ||
Heading2: { | ||
id: 'Heading 2', | ||
defaultMessage: 'Heading 2', | ||
}, | ||
Heading3: { | ||
id: 'Heading 3', | ||
defaultMessage: 'Heading 3', | ||
}, | ||
Heading4: { | ||
id: 'Heading 4', | ||
defaultMessage: 'Heading 4', | ||
}, | ||
Heading5: { | ||
id: 'Heading 5', | ||
defaultMessage: 'Heading 5', | ||
}, | ||
Heading6: { | ||
id: 'Heading 6', | ||
defaultMessage: 'Heading 6', | ||
}, | ||
Title: { | ||
@@ -88,3 +116,3 @@ id: 'Title', | ||
id: 'default', | ||
title: 'Default', | ||
title: intl.formatMessage(messages.Default), | ||
fields: ['panel_title'], | ||
@@ -95,3 +123,3 @@ }, | ||
panel_title: { | ||
title: 'Accordion title', | ||
title: intl.formatMessage(messages.AccordionTitle), | ||
}, | ||
@@ -108,3 +136,3 @@ }, | ||
id: 'default', | ||
title: 'Default', | ||
title: intl.formatMessage(messages.Default), | ||
fields: ['data'], | ||
@@ -146,7 +174,7 @@ }, | ||
choices: [ | ||
['h2', 'Heading 2'], | ||
['h3', 'Heading 3'], | ||
['h4', 'Heading 4'], | ||
['h5', 'Heading 5'], | ||
['h6', 'Heading 6'], | ||
['h2', intl.formatMessage(messages.Heading2)], | ||
['h3', intl.formatMessage(messages.Heading3)], | ||
['h4', intl.formatMessage(messages.Heading4)], | ||
['h5', intl.formatMessage(messages.Heading5)], | ||
['h6', intl.formatMessage(messages.Heading6)], | ||
], | ||
@@ -188,3 +216,3 @@ }, | ||
id: 'default', | ||
title: 'Default', | ||
title: intl.formatMessage(messages.Default), | ||
fields: ['theme'], | ||
@@ -191,0 +219,0 @@ }, |
@@ -155,14 +155,17 @@ import React from 'react'; | ||
active={active} | ||
aria-expanded={active} | ||
className={cx('accordion-title', { | ||
'align-arrow-left': !iconOnRight, | ||
'align-arrow-right': iconOnRight, | ||
})} | ||
index={index} | ||
tabIndex={0} | ||
onClick={(e) => handleClick(e, { index, id })} | ||
onKeyDown={(e) => { | ||
if (e.keyCode === 13) { | ||
if (e.keyCode === 13 || e.keyCode === 32) { | ||
e.preventDefault(); | ||
handleClick(e, { index, id }); | ||
} | ||
}} | ||
className={cx('accordion-title', { | ||
'align-arrow-left': !iconOnRight, | ||
'align-arrow-right': iconOnRight, | ||
})} | ||
role="button" | ||
tabIndex={0} | ||
> | ||
@@ -169,0 +172,0 @@ <Icon |
@@ -18,2 +18,6 @@ import React from 'react'; | ||
add: { id: 'Add', defaultMessage: 'Add' }, | ||
panelIndex: { | ||
id: 'panel_index', | ||
defaultMessage: 'Panel {panel_index}', | ||
}, | ||
}); | ||
@@ -119,3 +123,6 @@ | ||
<div className="label"> | ||
{child.title || `Panel ${index + 1}`} | ||
{child.title || | ||
`${intl.formatMessage(messages.panelIndex, { | ||
panel_index: `${index + 1}`, | ||
})}`} | ||
</div> | ||
@@ -122,0 +129,0 @@ {value.blocks_layout?.items?.length > 1 ? ( |
@@ -14,3 +14,21 @@ import accordionSVG from '@plone/volto/icons/list-arrows.svg'; | ||
import clearSVG from '@plone/volto/icons/clear.svg'; | ||
import { defineMessages, createIntlCache, createIntl } from 'react-intl'; | ||
const messages = defineMessages({ | ||
accordionTitle: { | ||
id: 'Accordion', | ||
defaultMessage: 'Accordion', | ||
}, | ||
}); | ||
const cache = createIntlCache(); | ||
const intl = createIntl( | ||
{ | ||
locale: 'en', | ||
messages: messages, | ||
}, | ||
cache, | ||
); | ||
const extendedSchema = (config) => { | ||
@@ -28,3 +46,3 @@ const choices = Object.keys(config.blocks.blocksConfig) | ||
choices.push(['accordion', 'Accordion']); | ||
choices.push(['accordion', intl.formatMessage(messages.accordionTitle)]); | ||
@@ -48,3 +66,3 @@ return { | ||
id: 'accordion', | ||
title: 'Accordion', | ||
title: intl.formatMessage(messages.accordionTitle), | ||
icon: accordionSVG, | ||
@@ -51,0 +69,0 @@ group: 'common', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
193681
40
2620
98