diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d418d078..fc2bce8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ +## [11.8.1](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.8.0...v11.8.1) (2024-03-26) + + +### Bug Fixes + +* moved HeaderSlim compoonent inside his folder to enable customizations ([#602](https://github.com/redturtle/design-comuni-plone-theme/issues/602)) ([38c6f3d](https://github.com/redturtle/design-comuni-plone-theme/commit/38c6f3d1312f3b7dbd2e73875cc51af0811adabd)) +* view background image in icons block ([#580](https://github.com/redturtle/design-comuni-plone-theme/issues/580)) ([fee11d1](https://github.com/redturtle/design-comuni-plone-theme/commit/fee11d1126f764d1cb4b3cde720714a1f2934b75)) +* volto-form-block ([#600](https://github.com/redturtle/design-comuni-plone-theme/issues/600)) ([9ac3cac](https://github.com/redturtle/design-comuni-plone-theme/commit/9ac3cac30ff846ae716b73fd1db2019e01760adc)) + + +### Documentation + +* updated publiccode ([ac87cf3](https://github.com/redturtle/design-comuni-plone-theme/commit/ac87cf398b789b1cd9dcd3c4cfed3030e8809499)) + +## [11.8.0](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.7.0...v11.8.0) (2024-03-19) + + +### Features + +* added download link to filename in file widget ([#587](https://github.com/redturtle/design-comuni-plone-theme/issues/587)) ([96649e2](https://github.com/redturtle/design-comuni-plone-theme/commit/96649e29e79a7b71bf93a27406baa4fc1994a213)) +* print styles for UO ([#581](https://github.com/redturtle/design-comuni-plone-theme/issues/581)) ([91b4752](https://github.com/redturtle/design-comuni-plone-theme/commit/91b47526b69b0957eba6c8e803798f4b3ffcf9bb)) +* TextWidget to add alt text to image ([#573](https://github.com/redturtle/design-comuni-plone-theme/issues/573)) ([d183f27](https://github.com/redturtle/design-comuni-plone-theme/commit/d183f2749a2604ebecb0f0df09ec8770d84c7f59)) +* updated volto-form-block with email validation ([#596](https://github.com/redturtle/design-comuni-plone-theme/issues/596)) ([c21f65b](https://github.com/redturtle/design-comuni-plone-theme/commit/c21f65bc7e54d2fa092ae4bcfbfd1c99670cab5c)) + + +### Bug Fixes + +* link in header doesn't change color when inside cms-ui ([#583](https://github.com/redturtle/design-comuni-plone-theme/issues/583)) ([d076b0a](https://github.com/redturtle/design-comuni-plone-theme/commit/d076b0a540cf3de3c9f7f08cefca27eff3917f70)) +* updated volto-querywidget-with-browser to fix infinite loops on lost reference ([#599](https://github.com/redturtle/design-comuni-plone-theme/issues/599)) ([c6d4cb6](https://github.com/redturtle/design-comuni-plone-theme/commit/c6d4cb6b51447514fedf2938f40031e42779644e)) +* view form block ([5ff7ea7](https://github.com/redturtle/design-comuni-plone-theme/commit/5ff7ea70474963e3dca126a44d531cc4dc17be74)) + + +### Maintenance + +* updated volto-form-block to fix view form ([80a6586](https://github.com/redturtle/design-comuni-plone-theme/commit/80a6586ac7d458c46efe51bcc4fa4a9cb3b8d619)) + + +### Documentation + +* updated publiccode and release log ([3c52c12](https://github.com/redturtle/design-comuni-plone-theme/commit/3c52c12edfed3c12a4fdac212b9f229644bf913f)) + ## [11.7.0](https://github.com/redturtle/design-comuni-plone-theme/compare/v11.6.2...v11.7.0) (2024-03-15) diff --git a/RELEASE.md b/RELEASE.md index ab1d3f158..253e128da 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -34,7 +34,7 @@ ### Novità -- ... [`Istruzioni`](url della documentazione relativa alla novità) +- ... ### Fix @@ -46,6 +46,33 @@ ### Fix - Aggiustato il layout della card per il CT persone quando è impostata un'immagine. +### Migliorie + +- Migliorata l'accessibilità del blocco Icone. +- ... + +### Novità + +- ... + +### Fix + +- ... + +## Versione 11.8.0 (19/03/2024) + +### Migliorie + +- Gli stili del tipo di contenuto Unità Organizzativa sono stati ottimizzati per la stampa. + +### Novità + +- È possibile scaricare il file o l'immagine caricata dal widget di upload file cliccando sul nome del file stesso. +- È possibile aggiungere un testo alternativo per l'immagine del blocco Card con Immagine. + +### Fix + +- Nel blocco con icone, se era impostata una immagine di sfondo non si vedeva. ## Versione 11.7.0 (15/03/2024) diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index 986324175..35af469fd 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -778,6 +778,11 @@ msgstr "" msgid "allegati" msgstr "" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po index 6a0c569ee..7a22d634d 100644 --- a/locales/en/LC_MESSAGES/volto.po +++ b/locales/en/LC_MESSAGES/volto.po @@ -763,6 +763,11 @@ msgstr "All topics" msgid "allegati" msgstr "Attached documents" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/locales/es/LC_MESSAGES/volto.po b/locales/es/LC_MESSAGES/volto.po index af0188c2f..45dab89cb 100644 --- a/locales/es/LC_MESSAGES/volto.po +++ b/locales/es/LC_MESSAGES/volto.po @@ -772,6 +772,11 @@ msgstr "Todos los temas" msgid "allegati" msgstr "Documentos adjuntos" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/locales/fr/LC_MESSAGES/volto.po b/locales/fr/LC_MESSAGES/volto.po index 93196a701..0b105fceb 100644 --- a/locales/fr/LC_MESSAGES/volto.po +++ b/locales/fr/LC_MESSAGES/volto.po @@ -780,6 +780,11 @@ msgstr "Tous les sujets" msgid "allegati" msgstr "Documents attachés" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po index e1d3de2d7..b53d4f229 100644 --- a/locales/it/LC_MESSAGES/volto.po +++ b/locales/it/LC_MESSAGES/volto.po @@ -763,6 +763,11 @@ msgstr "Tutti gli argomenti" msgid "allegati" msgstr "Documenti allegati" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/locales/volto.pot b/locales/volto.pot index 845d7b47d..dd3f2d722 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -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-07T15:23:38.346Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "MIME-Version: 1.0\n" @@ -765,6 +765,11 @@ msgstr "" msgid "allegati" msgstr "" +#: components/ItaliaTheme/Blocks/TextCard/CardWithImage/Sidebar +# defaultMessage: Testo alternativo per l'immagine +msgid "altText" +msgstr "" + #: components/ItaliaTheme/View/PersonaView/PersonaDocumenti # defaultMessage: Altre cariche msgid "altre_cariche" diff --git a/package.json b/package.json index 2d21bbb80..f6125dc02 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "design-comuni-plone-theme", "description": "Volto Theme for Italia design guidelines", "license": "GPL-v3", - "version": "11.7.0", + "version": "11.8.1", "main": "src/index.js", "keywords": [ "volto-addon", @@ -146,11 +146,11 @@ "volto-dropdownmenu": "4.1.1", "volto-editablefooter": "5.1.0", "volto-feedback": "0.3.0", - "volto-form-block": "3.5.2", + "volto-form-block": "3.7.1", "volto-gdpr-privacy": "2.1.1", "volto-google-analytics": "2.0.0", "volto-multilingual-widget": "3.0.0", - "volto-querywidget-with-browser": "0.4.1", + "volto-querywidget-with-browser": "0.4.2", "volto-rss-block": "3.0.0", "volto-secondarymenu": "4.0.0", "volto-social-settings": "3.0.0", diff --git a/publiccode.yml b/publiccode.yml index e8acbf330..2bd9fccf3 100644 --- a/publiccode.yml +++ b/publiccode.yml @@ -227,9 +227,9 @@ maintenance: name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici platforms: - web -releaseDate: '2024-03-15' +releaseDate: '2024-03-26' softwareType: standalone/web -softwareVersion: 11.7.0 +softwareVersion: 11.8.1 url: 'https://github.com/italia/design-comuni-plone-theme' usedBy: - ASP Comuni Modenesi Area Nord diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx index 6af951579..5a638ba5d 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx @@ -37,7 +37,7 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => { {data.icon?.length > 0 && (
- +
)} diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx index 685266b06..d6aa29d36 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx @@ -8,7 +8,7 @@ import { defineMessages } from 'react-intl'; import { Container, Row, Col } from 'design-react-kit'; import { SidebarPortal } from '@plone/volto/components'; -import { flattenToAppURL, addAppURL } from '@plone/volto/helpers'; +import { flattenToAppURL } from '@plone/volto/helpers'; import { UniversalLink } from '@plone/volto/components'; import { @@ -21,6 +21,8 @@ import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaThe import EditBlock from './Block/EditBlock'; import Sidebar from './Sidebar.jsx'; +import config from '@plone/volto/registry'; + const messages = defineMessages({ addItem: { id: 'Add accordion item', @@ -54,23 +56,23 @@ class Edit extends SubblocksEdit { if (__SERVER__) { return
; } + const Image = config.getComponent({ name: 'Image' }).component; return (
{this.props.data.background?.[0] ? ( -
+
+ +
) : ( -
+
)} diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx index 3b1476cd2..b43183683 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx @@ -58,7 +58,10 @@ const Sidebar = ({ description="" required={false} widgetOptions={{ - pattern_options: { selectableTypes: ['Image'] }, + pattern_options: { + selectableTypes: ['Image'], + maximumSelectionSize: 1, + }, }} value={data.background ?? []} onChange={(id, value) => diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx index 15ce7125a..85f498126 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx @@ -1,5 +1,5 @@ /** - * View Accordion block. + * View IconsBlock block. * @module components/ItaliaTheme/Blocks/Accordion/View */ @@ -8,35 +8,36 @@ import PropTypes from 'prop-types'; import redraft from 'redraft'; import ViewBlock from './Block/ViewBlock'; import { Container, Row, Col } from 'design-react-kit'; -import { flattenToAppURL, addAppURL } from '@plone/volto/helpers'; +import { flattenToAppURL } from '@plone/volto/helpers'; import { UniversalLink } from '@plone/volto/components'; import config from '@plone/volto/registry'; import { checkRedraftHasContent } from 'design-comuni-plone-theme/helpers'; /** - * View Accordion block class. + * View IconsBlock block class. * @class View * @extends Component */ -const AccordionView = ({ data, block }) => { +const IconsBlockView = ({ data, block }) => { const id = new Date().getTime(); + const Image = config.getComponent({ name: 'Image' }).component; return (
{data.background?.[0] ? ( -
+
+ +
) : ( -
+
)}
@@ -94,8 +95,8 @@ const AccordionView = ({ data, block }) => { * @property {Object} propTypes Property types. * @static */ -AccordionView.propTypes = { +IconsBlockView.propTypes = { data: PropTypes.objectOf(PropTypes.any).isRequired, }; -export default AccordionView; +export default IconsBlockView; diff --git a/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx b/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx index c1f084b73..5857eb02c 100644 --- a/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +++ b/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx @@ -24,7 +24,7 @@ const messages = defineMessages({ }, }); -const renderImage = (image, showImage, sizeNatural) => +const renderImage = (image, showImage, sizeNatural, altText = '') => showImage && image ? (
@@ -117,7 +117,12 @@ const Block = ({ > {hasImage && ( - {renderImage(data?.image, hasImage, data?.sizeNatural)} + {renderImage( + data?.image, + hasImage, + data?.sizeNatural, + data?.altText, + )} )}
- {renderImage(data?.image, hasImage, data?.sizeNatural)} + {renderImage( + data?.image, + hasImage, + data?.sizeNatural, + data?.altText, + )}
{ @@ -105,6 +110,14 @@ const Sidebar = ({ data, block, onChangeBlock }) => { value={data.sizeImage || 's'} /> + { + onChangeBlock({ ...data, altText: value }); + }} + /> diff --git a/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx b/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx index a136004ed..8ff0e5fd1 100644 --- a/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +++ b/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx @@ -378,10 +378,8 @@ test('View renders all fields', async () => { screen.getByText(/With his brim pulled way down low/i), ).toBeInTheDocument(); //immagine di background - const backgroundImage = document.querySelector('.background-image'); - expect(backgroundImage).toHaveStyle( - `background-image: url(http://localhost:3000/is-this-the-real-life/business-teamwork-join-hands-together-business-teamwork-concept_1150-1804.webp/@@images/image/huge);`, - ); + const backgroundImage = document.querySelector('.background-image img'); + expect(backgroundImage).toBeInTheDocument(); //link ad altro expect( screen.getByRole('link', { diff --git a/src/components/ItaliaTheme/Header/HeaderSlim.jsx b/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim.jsx similarity index 95% rename from src/components/ItaliaTheme/Header/HeaderSlim.jsx rename to src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim.jsx index 4dc990b40..775e2f06a 100644 --- a/src/components/ItaliaTheme/Header/HeaderSlim.jsx +++ b/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim.jsx @@ -1,6 +1,6 @@ /** * HeaderSlim component. - * @module components/ItaliaTheme/Header/HeaderSlim + * @module components/ItaliaTheme/Header/HeaderSlim/HeaderSlim */ import React from 'react'; diff --git a/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone.jsx b/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone.jsx index 83403e903..e0986da01 100644 --- a/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone.jsx +++ b/src/components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone.jsx @@ -1,6 +1,6 @@ /** * HeaderSlim component. - * @module components/ItaliaTheme/Header/HeaderSlim + * @module components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone */ import React from 'react'; diff --git a/src/components/ItaliaTheme/Header/HeaderSlim/index.js b/src/components/ItaliaTheme/Header/HeaderSlim/index.js new file mode 100644 index 000000000..97f96ab06 --- /dev/null +++ b/src/components/ItaliaTheme/Header/HeaderSlim/index.js @@ -0,0 +1,3 @@ +import HeaderSlim from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim'; + +export default HeaderSlim; diff --git a/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx b/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx index 70b8a39ac..fa17e5fd6 100644 --- a/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx +++ b/src/components/ItaliaTheme/Icons/FontAwesomeIcon.jsx @@ -35,8 +35,8 @@ const FontAwesomeIcon = (props) => { prefixKey === 'fab' ? 'brands' : prefixKey === 'far' - ? 'regular' - : 'solid', + ? 'regular' + : 'solid', iconName, ]; }; @@ -74,6 +74,7 @@ const FontAwesomeIcon = (props) => { ? `${title}${loadedIcon.module.content}` : loadedIcon.module.content, }} + aria-hidden={props['aria-hidden']} /> ) : icon ? ( diff --git a/src/components/ItaliaTheme/Icons/Icon.jsx b/src/components/ItaliaTheme/Icons/Icon.jsx index 06939fb88..e768ec6b2 100644 --- a/src/components/ItaliaTheme/Icons/Icon.jsx +++ b/src/components/ItaliaTheme/Icons/Icon.jsx @@ -12,6 +12,7 @@ import { FontAwesomeIcon } from 'design-comuni-plone-theme/components/ItaliaThem const Icon = (props) => { const { icon, className, color, size, padding, ...rest } = props; + if (icon) { const classes = classNames( 'icon', diff --git a/src/components/ItaliaTheme/View/Commons/PageMetadata.jsx b/src/components/ItaliaTheme/View/Commons/PageMetadata.jsx index 550b48c0b..025f16973 100644 --- a/src/components/ItaliaTheme/View/Commons/PageMetadata.jsx +++ b/src/components/ItaliaTheme/View/Commons/PageMetadata.jsx @@ -25,7 +25,7 @@ const PageMetadata = ({ content, children }) => { {intl.formatMessage(messages.modified)}: {' '} - {viewDate(intl.locale, content.modified, 'DD-MM-Y HH:MM')} + {viewDate(intl.locale, content.modified, 'DD-MM-Y HH:mm')} {children} ); diff --git a/src/components/ItaliaTheme/index.js b/src/components/ItaliaTheme/index.js index e9dd9bd30..71199cc45 100644 --- a/src/components/ItaliaTheme/index.js +++ b/src/components/ItaliaTheme/index.js @@ -32,7 +32,7 @@ export GalleryPreview from 'design-comuni-plone-theme/components/ItaliaTheme/Gal /********* LAYOUT ********* */ export LanguageSelector from 'design-comuni-plone-theme/components/ItaliaTheme/LanguageSelector/LanguageSelector'; -export HeaderSlim from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim'; +export HeaderSlim from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim/HeaderSlim'; export HeaderSlimRightZone from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim/HeaderSlimRightZone'; export HeaderLogin from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim/HeaderLogin'; export LoginButton from 'design-comuni-plone-theme/components/ItaliaTheme/Header/HeaderSlim/LoginButton'; diff --git a/src/customizations/volto/components/manage/Widgets/FileWidget.jsx b/src/customizations/volto/components/manage/Widgets/FileWidget.jsx new file mode 100644 index 000000000..0b879046a --- /dev/null +++ b/src/customizations/volto/components/manage/Widgets/FileWidget.jsx @@ -0,0 +1,232 @@ +// CUSTOMIZATION: +// - 177-179: Added link to download uploaded file + +/** + * FileWidget component. + * @module components/manage/Widgets/FileWidget + */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button, Image, Dimmer } from 'semantic-ui-react'; +import { readAsDataURL } from 'promise-file-reader'; +import { injectIntl } from 'react-intl'; +import deleteSVG from '@plone/volto/icons/delete.svg'; +import { Icon, FormFieldWrapper, UniversalLink } from '@plone/volto/components'; +import loadable from '@loadable/component'; +import { flattenToAppURL, validateFileUploadSize } from '@plone/volto/helpers'; +import { defineMessages, useIntl } from 'react-intl'; + +const imageMimetypes = [ + 'image/png', + 'image/jpeg', + 'image/webp', + 'image/jpg', + 'image/gif', + 'image/svg+xml', +]; +const Dropzone = loadable(() => import('react-dropzone')); + +const messages = defineMessages({ + releaseDrag: { + id: 'Drop files here ...', + defaultMessage: 'Drop files here ...', + }, + editFile: { + id: 'Drop file here to replace the existing file', + defaultMessage: 'Drop file here to replace the existing file', + }, + fileDrag: { + id: 'Drop file here to upload a new file', + defaultMessage: 'Drop file here to upload a new file', + }, + replaceFile: { + id: 'Replace existing file', + defaultMessage: 'Replace existing file', + }, + addNewFile: { + id: 'Choose a file', + defaultMessage: 'Choose a file', + }, +}); + +/** + * FileWidget component class. + * @function FileWidget + * @returns {string} Markup of the component. + * + * To use it, in schema properties, declare a field like: + * + * ```jsx + * { + * title: "File", + * widget: 'file', + * } + * ``` + * or: + * + * ```jsx + * { + * title: "File", + * type: 'object', + * } + * ``` + * + */ +const FileWidget = (props) => { + const { id, value, onChange, isDisabled } = props; + const [fileType, setFileType] = React.useState(false); + const intl = useIntl(); + + React.useEffect(() => { + if (value && imageMimetypes.includes(value['content-type'])) { + setFileType(true); + } + }, [value]); + + const imgsrc = value?.download + ? `${flattenToAppURL(value?.download)}?id=${Date.now()}` + : null || value?.data + ? `data:${value['content-type']};${value.encoding},${value.data}` + : null; + + /** + * Drop handler + * @method onDrop + * @param {array} files File objects + * @returns {undefined} + */ + const onDrop = (files) => { + const file = files[0]; + if (!validateFileUploadSize(file, intl.formatMessage)) return; + readAsDataURL(file).then((data) => { + const fields = data.match(/^data:(.*);(.*),(.*)$/); + onChange(id, { + data: fields[3], + encoding: fields[2], + 'content-type': fields[1], + filename: file.name, + }); + }); + + let reader = new FileReader(); + reader.onload = function () { + const fields = reader.result.match(/^data:(.*);(.*),(.*)$/); + if (imageMimetypes.includes(fields[1])) { + setFileType(true); + let imagePreview = document.getElementById(`field-${id}-image`); + imagePreview.src = reader.result; + } else { + setFileType(false); + } + }; + reader.readAsDataURL(files[0]); + }; + + return ( + + + {({ getRootProps, getInputProps, isDragActive }) => ( +
+ {isDragActive && } + {fileType ? ( + + ) : ( +
+ {isDragActive ? ( +

+ {intl.formatMessage(messages.releaseDrag)} +

+ ) : value ? ( +

+ {intl.formatMessage(messages.editFile)} +

+ ) : ( +

+ {intl.formatMessage(messages.fileDrag)} +

+ )} +
+ )} + + + +
+ )} +
+
+ {value && ( + + {value.filename} + + )} + {value && ( + + )} +
+
+ ); +}; + +/** + * Property types. + * @property {Object} propTypes Property types. + * @static + */ +FileWidget.propTypes = { + id: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + description: PropTypes.string, + required: PropTypes.bool, + error: PropTypes.arrayOf(PropTypes.string), + value: PropTypes.shape({ + '@type': PropTypes.string, + title: PropTypes.string, + }), + onChange: PropTypes.func.isRequired, + wrapped: PropTypes.bool, +}; + +/** + * Default properties. + * @property {Object} defaultProps Default properties. + * @static + */ +FileWidget.defaultProps = { + description: null, + required: false, + error: [], + value: null, +}; + +export default injectIntl(FileWidget); diff --git a/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss b/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss index 663fa53ec..ecb4c52d4 100644 --- a/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +++ b/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss @@ -26,17 +26,35 @@ left: 0; width: 100%; height: 100%; - background-position: top center; - background-repeat: no-repeat; - background-size: cover; + overflow: hidden; + img { + position: absolute; + min-width: 100%; + min-height: 100%; + height: auto; + width: auto; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: unset; + } &:after { position: absolute; width: 100%; height: 100%; - background-color: $primary; + background-color: rgba( + $primary, + 0.85 + ); // serve per fare la trasparenza sull'immagine di sfondo. content: ''; } + + &.no-image { + &:after { + background-color: $primary; + } + } } .block-header { diff --git a/src/theme/ItaliaTheme/Print/_all_pages.scss b/src/theme/ItaliaTheme/Print/_all_pages.scss index 1cdcfd817..c2b5126bf 100644 --- a/src/theme/ItaliaTheme/Print/_all_pages.scss +++ b/src/theme/ItaliaTheme/Print/_all_pages.scss @@ -174,6 +174,9 @@ display: none; } } + .leaflet-container { + break-inside: avoid; + } #contenuti-correlati { display: none; diff --git a/src/theme/ItaliaTheme/Print/_uo.scss b/src/theme/ItaliaTheme/Print/_uo.scss new file mode 100644 index 000000000..98d52c025 --- /dev/null +++ b/src/theme/ItaliaTheme/Print/_uo.scss @@ -0,0 +1,88 @@ +.contenttype-unitaorganizzativa { + @media print { + .documentDescription { + font-size: 1rem; + } + + .card-wrapper { + padding-bottom: 0px; + &.card-teaser-wrapper { + margin: 0px; + &.row, + & { + --bs-gutter-y: 0px !important; + + .card { + border: none !important; + &.card-big-io-comune .card-body { + padding: 0px !important; + + .category-top { + display: none; + } + + .card-title a { + font-size: 16px; + display: flex; + + &::before { + content: '•'; + display: block; + margin-right: 5px; + } + } + } + + .avatar { + display: none; + } + + &.p-3, + &.p-4 { + padding: 0px !important; + } + + &.my-3 { + margin-top: 0px !important; + margin-bottom: 0px !important; + } + + &:after { + display: none; + } + + &.shadow-sm { + box-shadow: none !important; + } + } + } + } + } + + .ruolo-persone-struttura { + .card .card-body { + .card-title { + margin-bottom: 0px !important; + } + .card-text { + padding-top: 0px; + } + + h4 { + &.card-title { + & + .card-text { + padding-top: 0px; + } + } + } + } + .mb-3 { + margin-bottom: 6px !important; + } + } + + .anchor-offset:before { + display: none; + } + } +} diff --git a/src/theme/_cms-ui.scss b/src/theme/_cms-ui.scss index b4209fd67..fe3cf30ce 100644 --- a/src/theme/_cms-ui.scss +++ b/src/theme/_cms-ui.scss @@ -108,7 +108,7 @@ body.cms-ui { } } - .public-ui { + .public-ui:not(:has(.it-header-wrapper)) { a:not(.btn) { color: $link-color; } diff --git a/src/theme/site.scss b/src/theme/site.scss index 2703fc96c..eb25da48f 100644 --- a/src/theme/site.scss +++ b/src/theme/site.scss @@ -139,6 +139,7 @@ @import 'ItaliaTheme/Print/persona'; @import 'ItaliaTheme/Print/event'; @import 'ItaliaTheme/Print/servizio'; +@import 'ItaliaTheme/Print/uo'; @import 'ItaliaTheme/Print/blocks'; @import 'addonsThemeCustomizationsMain'; diff --git a/yarn.lock b/yarn.lock index fa26d7336..8ae76f1ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6576,11 +6576,11 @@ __metadata: volto-dropdownmenu: 4.1.1 volto-editablefooter: 5.1.0 volto-feedback: 0.3.0 - volto-form-block: 3.5.2 + volto-form-block: 3.7.1 volto-gdpr-privacy: 2.1.1 volto-google-analytics: 2.0.0 volto-multilingual-widget: 3.0.0 - volto-querywidget-with-browser: 0.4.1 + volto-querywidget-with-browser: 0.4.2 volto-rss-block: 3.0.0 volto-secondarymenu: 4.0.0 volto-social-settings: 3.0.0 @@ -14355,9 +14355,9 @@ __metadata: languageName: node linkType: hard -"volto-form-block@npm:3.5.2": - version: 3.5.2 - resolution: "volto-form-block@npm:3.5.2" +"volto-form-block@npm:3.7.1": + version: 3.7.1 + resolution: "volto-form-block@npm:3.7.1" dependencies: "@hcaptcha/react-hcaptcha": ^0.3.6 file-saver: ^2.0.5 @@ -14366,7 +14366,7 @@ __metadata: peerDependencies: "@plone/volto": ">=16.0.0-alpha.38" volto-subblocks: ^2.0.0 - checksum: 8154132d440df4cd6d240fb4b913607890ca9128fae7b9efc7d2037bf47fbe0007cab51cc009fca14793db5dc38b18432383e5b491d0d9aeb56ab89cf65942df + checksum: 6cdbcb91d5bca43fa4ee828e7816df37573816854552fd00965053dd7f2496c8ee4c87838cbaa9d5e10b5496b51da1ed573ff3c300806f8d7a2e0ad55a8ca962 languageName: node linkType: hard @@ -14402,12 +14402,12 @@ __metadata: languageName: node linkType: hard -"volto-querywidget-with-browser@npm:0.4.1": - version: 0.4.1 - resolution: "volto-querywidget-with-browser@npm:0.4.1" +"volto-querywidget-with-browser@npm:0.4.2": + version: 0.4.2 + resolution: "volto-querywidget-with-browser@npm:0.4.2" peerDependencies: "@plone/volto": ^17.0.0 - checksum: a01eacb7fa67561066f288c7ba18f5af177a88deca142f57c33638eb63bc1894d46ac66f01c6d2e3ea4e4f43479b762a63246a08f6600d665174d55d2a49c207 + checksum: 881cede295a8609f1f01d67835533b73f0f8199e3fc2c209f350897b670a40f9c631567dacbbd0db8160a94c36c9b97465e87c2b90a82e2e128619f07658a212 languageName: node linkType: hard