Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new accessible date widget #607

Draft
wants to merge 1 commit into
base: 11.x.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,31 @@ msgstr ""
msgid "calendarBlockSidebarTitle"
msgstr ""

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr ""

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr ""

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr ""

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr ""

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr ""

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
25 changes: 25 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,31 @@ msgstr "Navigation path"
msgid "calendarBlockSidebarTitle"
msgstr ""

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr ""

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr ""

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr ""

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr ""

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr ""

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
25 changes: 25 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,31 @@ msgstr ""
msgid "calendarBlockSidebarTitle"
msgstr "Calendario"

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr ""

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr ""

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr ""

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr ""

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr ""

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
25 changes: 25 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,31 @@ msgstr ""
msgid "calendarBlockSidebarTitle"
msgstr ""

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr ""

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr ""

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr ""

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr ""

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr ""

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
25 changes: 25 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,31 @@ msgstr ""
msgid "calendarBlockSidebarTitle"
msgstr "Calendario"

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr "Cancella la selezione"

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr "Valore non valido"

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr "Mese"

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr "Apri il calendario"

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr "Anno"

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
27 changes: 26 additions & 1 deletion locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-03-06T10:48:38.114Z\n"
"POT-Creation-Date: 2024-03-21T15:27:52.153Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -1087,6 +1087,31 @@ msgstr ""
msgid "calendarBlockSidebarTitle"
msgstr ""

#: overrideTranslations
# defaultMessage: Clear selection
msgid "calendarClearDates"
msgstr ""

#: overrideTranslations
# defaultMessage: Invalid value
msgid "calendarInvalid"
msgstr ""

#: overrideTranslations
# defaultMessage: Month
msgid "calendarMonth"
msgstr ""

#: overrideTranslations
# defaultMessage: Open calendar
msgid "calendarOpenCalendar"
msgstr ""

#: overrideTranslations
# defaultMessage: Year
msgid "calendarYear"
msgstr ""

#: components/ItaliaTheme/Blocks/Calendar/Body
# defaultMessage: Prossimo
msgid "calendar_next_arrow"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"design-react-kit": "5.0.0-1",
"htmldiff-js": "1.0.5",
"marked": "9.0.0",
"react-aria-components": "1.1.1",
"react-dropzone": "11.0.1",
"react-focus-lock": "2.9.4",
"react-google-recaptcha-v3": "1.7.0",
Expand Down
56 changes: 33 additions & 23 deletions src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getQueryStringResults } from '@plone/volto/actions';
import { flattenToAppURL } from '@plone/volto/helpers';
import BandiInEvidenceTemplate from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate';
import { Pagination } from 'design-comuni-plone-theme/components/ItaliaTheme';
import { generateFiltersProps } from 'design-comuni-plone-theme/helpers';

import FiltersConfig from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/BandiSearch/FiltersConfig';

Expand All @@ -32,6 +33,14 @@ const messages = defineMessages({
},
});

const BANDI_SEARCH_FILTER_PROPS_OVERRIDES = {
date_filter: {
showInputLabels: false,
textColor: 'light',
controlsBackgroundColor: 'primary',
},
};

const Body = ({ data, inEditMode, path, onChangeBlock }) => {
const intl = useIntl();
const b_size = 6;
Expand Down Expand Up @@ -107,7 +116,6 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => {
let newState = {
...state,
};

if (action.type === 'reset') {
newState = {
...getInitialState(),
Expand Down Expand Up @@ -141,6 +149,12 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => {
setCurrentPage(current);
doRequest(current);
}
const onChangeHandler = (filter, value) => {
dispatchFilter({
filter: filter,
value: value,
});
};

return filterOne || filterTwo || filterThree ? (
<Container>
Expand All @@ -160,36 +174,32 @@ const Body = ({ data, inEditMode, path, onChangeBlock }) => {
{filterOne && (
<>
{React.createElement(filterOne.widget.component, {
...filterOne.widget?.props,
id: 'filterOne',
onChange: (filter, value) => {
dispatchFilter({
filter: filter,
value: value,
});
},
...generateFiltersProps(
filterOne,
'filterOne',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nel backlog accessibilita' ci sono degli automated test che si spaccano quando hai BandiSearch ed EventSearch nella stessa pagina perche' ci sono id uguali. Cambiare a filterOne[CTName]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { v4 as uuid } from 'uuid';

onChangeHandler,
BANDI_SEARCH_FILTER_PROPS_OVERRIDES,
),
})}
</>
)}
{filterTwo &&
React.createElement(filterTwo.widget?.component, {
...filterTwo.widget?.props,
id: 'filterTwo',
onChange: (filter, value) =>
dispatchFilter({
filter: filter,
value: value,
}),
...generateFiltersProps(
filterTwo,
'filterTwo',
onChangeHandler,
BANDI_SEARCH_FILTER_PROPS_OVERRIDES,
),
})}
{filterThree &&
React.createElement(filterThree.widget?.component, {
...filterThree.widget?.props,
id: 'filterThree',
onChange: (filter, value) =>
dispatchFilter({
filter: filter,
value: value,
}),
...generateFiltersProps(
filterThree,
'filterThree',
onChangeHandler,
BANDI_SEARCH_FILTER_PROPS_OVERRIDES,
),
})}

<Button
Expand Down
Loading
Loading