io-sanita-theme 2.7.0 → 2.8.0

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.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.8.0](https://github.com/RedTurtle/io-sanita-theme/compare/2.7.0...2.8.0) (2025-03-19)
4
+
5
+ ### Features
6
+
7
+ * added new listing variation attachments ([#73](https://github.com/RedTurtle/io-sanita-theme/issues/73)) ([2100d3c](https://github.com/RedTurtle/io-sanita-theme/commit/2100d3c65c2368d15fcae6c259c9effbf5600ffa))
8
+
9
+ ### Bug Fixes
10
+
11
+ * a11y for menuItems ([c32015c](https://github.com/RedTurtle/io-sanita-theme/commit/c32015ce6df944f8228d57691411e194a852c230))
12
+ * avoid sass deprecation warning on saturation ([ed6963b](https://github.com/RedTurtle/io-sanita-theme/commit/ed6963b80fa562b9f70695aa4db34c6a7f249d99))
13
+ * subsites css variables ([005b669](https://github.com/RedTurtle/io-sanita-theme/commit/005b669273532f17880009a60d9051118830cd57))
14
+
15
+ ### Maintenance
16
+
17
+ * preparing release 2.8.0 ([79c9414](https://github.com/RedTurtle/io-sanita-theme/commit/79c9414aea0403ae18a329ac7e3debaf0e657790))
18
+
3
19
  ## [2.7.0](https://github.com/RedTurtle/io-sanita-theme/compare/2.6.0...2.7.0) (2025-03-12)
4
20
 
5
21
  ### Features
package/RELEASE.md CHANGED
@@ -41,6 +41,12 @@
41
41
  - ...
42
42
  -->
43
43
 
44
+ ## Versione 2.8.0 (19/03/2025)
45
+
46
+ ### Novità
47
+
48
+ - Aggiunta variazione del blocco listing Allegati
49
+
44
50
  ## Versione 2.6.0 (11/03/2025)
45
51
 
46
52
  ### Novità
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -0,0 +1,56 @@
1
+ /* Variation Card Allegati of Listing block */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
5
+ import { Row, Col } from 'design-react-kit';
6
+ import { ListingContainer } from 'io-sanita-theme/components/Blocks';
7
+ import { LinkMore } from 'io-sanita-theme/components';
8
+ import { CardFile } from 'io-sanita-theme/components';
9
+
10
+ import AttachmentCardTemplateSkeleton from '../Skeletons/AttachmentCardTemplateSkeleton';
11
+
12
+ const AttachmentCardTemplate = (props) => {
13
+ const {
14
+ items,
15
+ title,
16
+ isEditMode,
17
+ linkAlign,
18
+ linkTitle,
19
+ linkHref,
20
+ show_block_bg,
21
+ show_pdf_preview,
22
+ linkmore_id_lighthouse,
23
+ } = props;
24
+ return (
25
+ <div className="attachment-card-template">
26
+ <ListingContainer data={props} isEditMode={isEditMode}>
27
+ {items.length > 0 && (
28
+ <Row className="attachments">
29
+ {items.map((item, _i) => (
30
+ <Col lg={4} className="py-lg-2" key={item['@id']}>
31
+ <CardFile item={item} showPDFPreview={show_pdf_preview} />
32
+ </Col>
33
+ ))}
34
+ </Row>
35
+ )}
36
+ <LinkMore
37
+ title={linkTitle}
38
+ href={linkHref}
39
+ linkAlign={linkAlign}
40
+ className="my-4"
41
+ linkmoreIdLighthouse={linkmore_id_lighthouse}
42
+ />
43
+ </ListingContainer>
44
+ </div>
45
+ );
46
+ };
47
+
48
+ AttachmentCardTemplate.propTypes = {
49
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
50
+ linkTitle: PropTypes.any,
51
+ linkHref: PropTypes.any,
52
+ isEditMode: PropTypes.bool,
53
+ title: PropTypes.string,
54
+ };
55
+
56
+ export default AttachmentCardTemplate;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Row, Col, Card, CardBody, CardTitle } from 'design-react-kit';
4
+ import { ListingContainer } from 'io-sanita-theme/components/Blocks';
5
+
6
+ const AttachmentCardTemplateSkeleton = (props) => {
7
+ const { isEditMode, title, linkHref, show_block_bg, show_pdf_preview } =
8
+ props;
9
+ return (
10
+ <div className="attachment-card-skeleton-template">
11
+ <ListingContainer data={props} isEditMode={isEditMode}>
12
+ <div className="skeleton-template">
13
+ {title && (
14
+ <Row>
15
+ <Col>
16
+ <h2 className="mb-4">{title}</h2>
17
+ </Col>
18
+ </Row>
19
+ )}
20
+
21
+ <Row>
22
+ {[0, 1, 2].map((i) => (
23
+ <Col lg={4}>
24
+ <Card
25
+ className="align-items-top rounded shadow no-after"
26
+ noWrapper
27
+ teaser
28
+ key={i}
29
+ >
30
+ <CardBody className="pb-5">
31
+ <CardTitle tag="h3"> </CardTitle>
32
+ </CardBody>
33
+ </Card>
34
+ </Col>
35
+ ))}
36
+ </Row>
37
+ </div>
38
+ </ListingContainer>
39
+ </div>
40
+ );
41
+ };
42
+
43
+ AttachmentCardTemplateSkeleton.propTypes = {
44
+ linkHref: PropTypes.any,
45
+ isEditMode: PropTypes.bool,
46
+ title: PropTypes.string,
47
+ };
48
+
49
+ export default AttachmentCardTemplateSkeleton;
@@ -94,6 +94,7 @@ export MapTemplate from 'io-sanita-theme/components/Blocks/Listing/Map/MapTempla
94
94
  export SimpleCardTemplate from 'io-sanita-theme/components/Blocks/Listing/SimpleCard/SimpleCardTemplate';
95
95
  export SimpleListTemplate from 'io-sanita-theme/components/Blocks/Listing/SimpleList/SimpleListTemplate';
96
96
  export SmallBlockLinksTemplate from 'io-sanita-theme/components/Blocks/Listing/SmallBlockLinks/SmallBlockLinksTemplate';
97
+ export AttachmentCardTemplate from 'io-sanita-theme/components/Blocks/Listing/AttachmentCard/AttachmentCardTemplate';
97
98
 
98
99
  /*Skeleton*/
99
100
  export BandiTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listing/Skeletons/BandiTemplateSkeleton';
@@ -106,6 +107,7 @@ export InEvidenceTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listin
106
107
  export MapTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listing/Skeletons/MapTemplateSkeleton';
107
108
  export SimpleListTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listing/Skeletons/SimpleListTemplateSkeleton';
108
109
  export SmallBlockLinksTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listing/Skeletons/SmallBlockLinksTemplateSkeleton';
110
+ export AttachmentCardTemplateSkeleton from 'io-sanita-theme/components/Blocks/Listing/Skeletons/AttachmentCardTemplateSkeleton';
109
111
 
110
112
  /*Rss block (as listing)*/
111
113
  export CardWithoutImageRssTemplate from 'io-sanita-theme/components/Blocks/Rss/CardWithoutImageRssTemplate';
@@ -56,6 +56,7 @@ export const CardFile = ({
56
56
  file = null,
57
57
  titleDataElement,
58
58
  showModified = false,
59
+ showPDFPreview = false,
59
60
  }) => {
60
61
  const intl = useIntl();
61
62
  let _item = null;
@@ -82,11 +83,14 @@ export const CardFile = ({
82
83
  if (item.file) {
83
84
  _item = item.file;
84
85
  }
85
- if (item['@id'].indexOf('/@@download/') < 0) {
86
+ if (item['@id'].indexOf('/@@download/') < 0 && !showPDFPreview) {
86
87
  _item['@id'] = `${item['@id']}/@@download/file`;
87
88
  } else {
88
89
  _item['@id'] = item['@id'];
89
90
  }
91
+ if (showPDFPreview) {
92
+ _item['@id'] = `${item['@id']}/@@display-file/file`;
93
+ }
90
94
  break;
91
95
  case 'Image':
92
96
  if (item.image) {
@@ -135,12 +139,12 @@ export const CardFile = ({
135
139
  <CardBody>
136
140
  <div className={cx('card-file-content', _item['@type'])}>
137
141
  <CardTitle tag={titleTag} className="d-flex mb-0 align-items-center">
138
- {!file ? (
142
+ {!file || showPDFPreview ? (
139
143
  <UniversalLink
140
144
  item={!isEditMode ? _item : null}
141
145
  href={isEditMode ? '#' : ''}
142
146
  className="card-title-link flex-grow-1 pe-4"
143
- target={_item['@type'] === 'Link' ? '_blank' : '_self'}
147
+ target={_item['@type'] === 'Link' || showPDFPreview ? '_blank' : '_self'}
144
148
  rel={_item['@type'] === 'Link' ? 'noopener noreferrer' : ''}
145
149
  data-element={titleDataElement}
146
150
  >
@@ -239,7 +239,7 @@ const MegaMenu = ({ item, pathname }) => {
239
239
  tag="li"
240
240
  className={isItemActive ? 'focus--mouse megamenu' : 'megamenu'}
241
241
  active={isItemActive}
242
- role="none"
242
+ role="menuitem"
243
243
  >
244
244
  <UncontrolledDropdown
245
245
  nav
@@ -18,6 +18,8 @@ import {
18
18
  SimpleListTemplateSkeleton,
19
19
  SmallBlockLinksTemplate,
20
20
  SmallBlockLinksTemplateSkeleton,
21
+ AttachmentCardTemplate,
22
+ AttachmentCardTemplateSkeleton
21
23
  } from 'io-sanita-theme/components/Blocks';
22
24
 
23
25
  import CarouselTemplate from 'io-sanita-theme/components/Blocks/Listing/Carousel/CarouselTemplate.jsx';
@@ -53,6 +55,7 @@ import {
53
55
  addSimpleListTemplateOptions,
54
56
  addSmallBlockLinksTemplateOptions,
55
57
  addCarouselTemplateOptions,
58
+ addAttachmentCardTemplateOptions,
56
59
  // addRibbonCardTemplateOptions,
57
60
  // addBandiInEvidenceTemplateOptions,
58
61
 
@@ -157,6 +160,20 @@ const iosanitaListingVariations = [
157
160
  },
158
161
  cloneData: cloneBlock,
159
162
  },
163
+ {
164
+ id: 'attachmentCardTemplate',
165
+ isDefault: false,
166
+ title: 'Allegati',
167
+ template: AttachmentCardTemplate,
168
+ skeleton: AttachmentCardTemplateSkeleton,
169
+ schemaEnhancer: ({ schema, formData, intl }) => {
170
+ let pos = addDefaultOptions(schema, formData, intl);
171
+ addAttachmentCardTemplateOptions(schema, formData, intl, pos);
172
+ addLinkMoreOptions(schema, formData, intl);
173
+ return schema;
174
+ },
175
+ cloneData: cloneBlock,
176
+ },
160
177
  {
161
178
  id: 'completeBlockLinksTemplate',
162
179
  isDefault: false,
@@ -67,12 +67,8 @@
67
67
  $subsite-bg-primary-lightest: hsl($subsite-primary-h, 50%, 97%);
68
68
  $subsite-bg-primary-lighter: hsl($subsite-primary-h, 50%, 87%);
69
69
 
70
- $subsite-primary-dark: hsl($subsite-primary-h, $subsite-primary-s * 1%, 20%);
71
- $subsite-primary-darker: hsl(
72
- $subsite-primary-h,
73
- $subsite-primary-s * 1%,
74
- 12%
75
- );
70
+ $subsite-primary-dark: hsl($subsite-primary-h, $subsite-primary-s, 20%);
71
+ $subsite-primary-darker: hsl($subsite-primary-h, $subsite-primary-s, 12%);
76
72
 
77
73
  $subsite-accent: $subsite-primary;
78
74
  $subsite-footer-borders: 1px solid hsla($subsite-primary-h, 70.59%, 20%);
@@ -82,19 +78,20 @@
82
78
  $subsite-bg-primary-lighter: hsl(hue($subsite-secondary), 50%, 87%);
83
79
  $subsite-primary-dark: hsl(
84
80
  $subsite-secondary-h,
85
- $subsite-secondary-s * 1%,
81
+ $subsite-secondary-s,
86
82
  20%
87
83
  ) !default;
88
84
  $subsite-primary-darker: hsl(
89
85
  $subsite-secondary-h,
90
- $subsite-secondary-s * 1%,
86
+ $subsite-secondary-s,
91
87
  12%
92
88
  ) !default;
93
89
  $subsite-accent: $subsite-secondary;
94
90
  $subsite-footer-borders: 1px solid hsla($subsite-secondary-h, 70.59%, 20%);
95
91
  }
96
92
 
97
- :root {
93
+ body.subsite-#{$subsite-style} {
94
+ //override css variables
98
95
  --primary: #{$subsite-primary};
99
96
  --bs-primary: #{$subsite-primary};
100
97
  --bs-primary-rgb: #{to-rgb($subsite-primary)};
@@ -108,8 +105,7 @@
108
105
  --is-accent: #{$subsite-accent};
109
106
  --is-footer-borders: #{$subsite-footer-borders};
110
107
  --bs-link-color: #{$subsite-link-color};
111
- }
112
- body.subsite-#{$subsite-style} {
108
+
113
109
  &,
114
110
  .public-ui,
115
111
  .cms-ui {