io-sanita-theme 2.4.1 → 2.4.3

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.4.3](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.2...2.4.3) (2025-03-04)
4
+
5
+ ### Bug Fixes
6
+
7
+ * a11y ([431f2c8](https://github.com/RedTurtle/io-sanita-theme/commit/431f2c892ae17646f4ffb607b8405049fcd345b9))
8
+ * locales ([fb213b7](https://github.com/RedTurtle/io-sanita-theme/commit/fb213b78a7e976082db2cf39b0c7eb7488dc7eae))
9
+
10
+ ## [2.4.2](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.1...2.4.2) (2025-03-04)
11
+
12
+ ### Bug Fixes
13
+
14
+ * scroll SideMenu with headersticky ([5a3e9d5](https://github.com/RedTurtle/io-sanita-theme/commit/5a3e9d531350933a2fe672ba6625bc30cb7cc5ba))
15
+
3
16
  ## [2.4.1](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.0...2.4.1) (2025-03-04)
4
17
 
5
18
  ### Bug Fixes
package/RELEASE.md CHANGED
@@ -41,6 +41,12 @@
41
41
  - ...
42
42
  -->
43
43
 
44
+ ## Versione 2.4.2 (04/03/2025)
45
+
46
+ ### Fix
47
+
48
+ - sistemato lo scroll del menu laterale nelle viste dei content-type
49
+
44
50
  ## Versione 2.3.3 (26/02/2025)
45
51
 
46
52
  ### Fix
@@ -3363,6 +3363,11 @@ msgstr ""
3363
3363
  msgid "sideMenuNavigation"
3364
3364
  msgstr ""
3365
3365
 
3366
+ #. Default: "Avanzamento della navigazione"
3367
+ #: components/View/commons/SideMenu/SideMenu
3368
+ msgid "sideMenuNavigation_progressBar"
3369
+ msgstr ""
3370
+
3366
3371
  #. Default: "Compatto"
3367
3372
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3368
3373
  msgid "simplecard_listing_appearance_compact"
@@ -3358,6 +3358,11 @@ msgstr "Page content index"
3358
3358
  msgid "sideMenuNavigation"
3359
3359
  msgstr "Page content navigation"
3360
3360
 
3361
+ #. Default: "Avanzamento della navigazione"
3362
+ #: components/View/commons/SideMenu/SideMenu
3363
+ msgid "sideMenuNavigation_progressBar"
3364
+ msgstr "Navigation progress"
3365
+
3361
3366
  #. Default: "Compatto"
3362
3367
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3363
3368
  msgid "simplecard_listing_appearance_compact"
@@ -3365,6 +3365,11 @@ msgstr ""
3365
3365
  msgid "sideMenuNavigation"
3366
3366
  msgstr ""
3367
3367
 
3368
+ #. Default: "Avanzamento della navigazione"
3369
+ #: components/View/commons/SideMenu/SideMenu
3370
+ msgid "sideMenuNavigation_progressBar"
3371
+ msgstr ""
3372
+
3368
3373
  #. Default: "Compatto"
3369
3374
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3370
3375
  msgid "simplecard_listing_appearance_compact"
@@ -3365,6 +3365,11 @@ msgstr ""
3365
3365
  msgid "sideMenuNavigation"
3366
3366
  msgstr ""
3367
3367
 
3368
+ #. Default: "Avanzamento della navigazione"
3369
+ #: components/View/commons/SideMenu/SideMenu
3370
+ msgid "sideMenuNavigation_progressBar"
3371
+ msgstr ""
3372
+
3368
3373
  #. Default: "Compatto"
3369
3374
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3370
3375
  msgid "simplecard_listing_appearance_compact"
@@ -3358,6 +3358,11 @@ msgstr ""
3358
3358
  msgid "sideMenuNavigation"
3359
3359
  msgstr ""
3360
3360
 
3361
+ #. Default: "Avanzamento della navigazione"
3362
+ #: components/View/commons/SideMenu/SideMenu
3363
+ msgid "sideMenuNavigation_progressBar"
3364
+ msgstr ""
3365
+
3361
3366
  #. Default: "Compatto"
3362
3367
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3363
3368
  msgid "simplecard_listing_appearance_compact"
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2025-03-03T14:55:08.885Z\n"
4
+ "POT-Creation-Date: 2025-03-04T14:56:52.091Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "Content-Type: text/plain; charset=utf-8\n"
@@ -3360,6 +3360,11 @@ msgstr ""
3360
3360
  msgid "sideMenuNavigation"
3361
3361
  msgstr ""
3362
3362
 
3363
+ #. Default: "Avanzamento della navigazione"
3364
+ #: components/View/commons/SideMenu/SideMenu
3365
+ msgid "sideMenuNavigation_progressBar"
3366
+ msgstr ""
3367
+
3363
3368
  #. Default: "Compatto"
3364
3369
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3365
3370
  msgid "simplecard_listing_appearance_compact"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -14,16 +14,16 @@ import {
14
14
  const RenderItem = ({ item }) => {
15
15
  switch (item['@type']) {
16
16
  case 'News Item':
17
- return <CardImage item={item} />;
17
+ return <CardImage item={item} titleTag="h3" />;
18
18
  break;
19
19
  case 'Struttura':
20
- return <CardPlace item={item} />;
20
+ return <CardPlace item={item} titleTag="h3" />;
21
21
  break;
22
22
  case 'Persona':
23
- return <CardPersona item={item} />;
23
+ return <CardPersona item={item} titleTag="h3" />;
24
24
  break;
25
25
  default:
26
- return <CardSimple item={item} />;
26
+ return <CardSimple item={item} titleTag="h3" />;
27
27
  }
28
28
  };
29
29
 
@@ -30,6 +30,10 @@ const messages = defineMessages({
30
30
  id: 'sideMenuNavigation',
31
31
  defaultMessage: 'Navigazione della pagina',
32
32
  },
33
+ progressBar: {
34
+ id: 'sideMenuNavigation_progressBar',
35
+ defaultMessage: 'Avanzamento della navigazione',
36
+ },
33
37
  });
34
38
 
35
39
  const extractHeaders = (elements, intl) => {
@@ -82,12 +86,22 @@ const SideMenu = ({ data, content_uid }) => {
82
86
  setIsClient(true);
83
87
  }, []);
84
88
 
85
- const activeItemTitle = headers.find(
86
- (item) => item.id === activeSection,
87
- )?.title;
89
+ const activeItemTitle =
90
+ headers.find((item) => item.id === activeSection)?.title ??
91
+ headers?.[0]?.title ??
92
+ intl.formatMessage(messages.progressBar);
93
+
94
+ const getMainOffset = () => {
95
+ return isClient
96
+ ? document.querySelector('.it-header-wrapper.it-header-sticky')
97
+ ?.clientHeight + 20
98
+ : 0;
99
+ };
100
+ const mainOffset = getMainOffset();
88
101
 
89
102
  const handleScroll = useCallback(() => {
90
- const scrollOffset = 0.1 * window.innerHeight;
103
+ const windowHeight = window.innerHeight * 0.1;
104
+ const mainOffset = getMainOffset();
91
105
  setScrollY(window.scrollY);
92
106
  const headersHeights = headers
93
107
  .map((section) => {
@@ -97,7 +111,8 @@ const SideMenu = ({ data, content_uid }) => {
97
111
  top: element?.getBoundingClientRect()?.top,
98
112
  };
99
113
  })
100
- .filter((section) => section.top <= scrollOffset);
114
+ // .filter((section) => section.top - mainOffset + 40 <= windowHeight);
115
+ .filter((section) => section.top <= mainOffset + 20);
101
116
  if (headersHeights.length > 0) {
102
117
  const section = headersHeights.reduce(
103
118
  (prev, curr) => (prev.top > curr.top ? prev : curr),
@@ -130,6 +145,9 @@ const SideMenu = ({ data, content_uid }) => {
130
145
  }, [headers]);
131
146
 
132
147
  const throttledHandleScroll = throttle(handleScroll, 100);
148
+ const yCountEnd = isClient
149
+ ? document.querySelector('#main-content-section')
150
+ : null;
133
151
 
134
152
  const handleClickAnchor = (id) => (e) => {
135
153
  e.preventDefault();
@@ -143,17 +161,18 @@ const SideMenu = ({ data, content_uid }) => {
143
161
  // Scroll to section
144
162
  // setTimeout hack should wait for rerender after setIsNavOpen
145
163
  setTimeout(() => {
146
- document.getElementById(id)?.scrollIntoView?.({
164
+ // document.getElementById(id)?.scrollIntoView?.({
165
+ // behavior: 'smooth',
166
+ // block: 'start',
167
+ // });
168
+
169
+ window.scrollTo({
147
170
  behavior: 'smooth',
148
- block: 'start',
171
+ top: document.querySelector('#' + id).offsetTop - mainOffset,
149
172
  });
150
173
  }, 0);
151
174
  };
152
175
 
153
- const yCountEnd = isClient
154
- ? document.querySelector('#main-content-section')
155
- : null;
156
-
157
176
  const progressValue = useMemo(() => {
158
177
  if (!isClient) return 0;
159
178
  return yCountEnd
@@ -162,7 +181,10 @@ const SideMenu = ({ data, content_uid }) => {
162
181
  }, [scrollY, isClient]);
163
182
 
164
183
  return headers?.length > 0 ? (
165
- <div className="navbar-wrapper page-side-menu affix-top ">
184
+ <div
185
+ className="navbar-wrapper page-side-menu affix-top"
186
+ style={{ top: mainOffset - 20 }}
187
+ >
166
188
  <nav
167
189
  className="navbar it-navscroll-wrapper navbar-expand-lg"
168
190
  aria-label={intl.formatMessage(messages.sideMenuNavigation)}
@@ -185,7 +207,7 @@ const SideMenu = ({ data, content_uid }) => {
185
207
  <Progress
186
208
  value={progressValue > 0 ? 100 * progressValue : 0}
187
209
  role="progressbar"
188
- aria-labelledby={activeItemTitle}
210
+ aria-label={activeItemTitle}
189
211
  />
190
212
 
191
213
  <AccordionBody active={isNavOpen} id="side-menu-body">