@zanichelli/albe-web-components 7.2.0 → 7.3.1

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.
Files changed (240) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/cjs/index-e3299e0a.js +10 -6
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/web-components-library.cjs.js +1 -1
  5. package/dist/cjs/z-app-header_2.cjs.entry.js +152 -0
  6. package/dist/cjs/z-button-sort.cjs.entry.js +1 -1
  7. package/dist/cjs/z-button.cjs.entry.js +43 -0
  8. package/dist/cjs/z-card.cjs.entry.js +1 -1
  9. package/dist/cjs/z-chip.cjs.entry.js +6 -3
  10. package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +25 -4
  11. package/dist/cjs/z-list_3.cjs.entry.js +1 -1
  12. package/dist/cjs/z-menu-section.cjs.entry.js +11 -3
  13. package/dist/cjs/z-menu.cjs.entry.js +26 -14
  14. package/dist/cjs/z-myz-card-footer.cjs.entry.js +13 -1
  15. package/dist/cjs/z-myz-card-icon.cjs.entry.js +1 -1
  16. package/dist/cjs/z-myz-card_4.cjs.entry.js +2 -2
  17. package/dist/cjs/z-offcanvas.cjs.entry.js +57 -0
  18. package/dist/cjs/z-searchbar.cjs.entry.js +12 -3
  19. package/dist/cjs/z-stepper-item.cjs.entry.js +1 -1
  20. package/dist/cjs/z-toggle-button.cjs.entry.js +4 -2
  21. package/dist/collection/collection-manifest.json +1 -1
  22. package/dist/collection/components/buttons/z-button-sort/index.js +2 -2
  23. package/dist/collection/components/buttons/z-button-sort/styles.css +1 -1
  24. package/dist/collection/components/buttons/z-chip/index.js +25 -3
  25. package/dist/collection/components/buttons/z-chip/styles.css +28 -21
  26. package/dist/collection/components/buttons/z-toggle-button/index.js +21 -1
  27. package/dist/collection/components/buttons/z-toggle-button/styles.css +1 -3
  28. package/dist/collection/components/indicators/z-stepper-item/styles.css +1 -1
  29. package/dist/collection/components/inputs/z-searchbar/index.js +76 -3
  30. package/dist/collection/components/inputs/z-searchbar/styles.css +23 -0
  31. package/dist/collection/components/list/z-list-element/index.js +1 -1
  32. package/dist/collection/components/modal/z-modal/index.js +43 -4
  33. package/dist/collection/components/navigation/z-app-header/index.js +14 -15
  34. package/dist/collection/components/navigation/z-app-header/styles.css +2 -3
  35. package/dist/collection/components/navigation/z-menu/index.js +45 -21
  36. package/dist/collection/components/navigation/z-menu/styles.css +80 -13
  37. package/dist/collection/components/navigation/z-menu-section/index.js +13 -4
  38. package/dist/collection/components/navigation/z-menu-section/styles.css +37 -4
  39. package/dist/collection/components/notification/z-toast-notification/index.js +1 -1
  40. package/dist/collection/components/z-card/index.js +9 -0
  41. package/dist/collection/components/z-card/styles.css +1 -1
  42. package/dist/collection/components/z-offcanvas/index.js +39 -23
  43. package/dist/collection/components/z-offcanvas/styles.css +5 -5
  44. package/dist/collection/snowflakes/myz/card/z-myz-card-footer/index.js +13 -1
  45. package/dist/collection/snowflakes/myz/card/z-myz-card-header/index.js +1 -1
  46. package/dist/collection/snowflakes/myz/card/z-myz-card-header/styles.css +12 -0
  47. package/dist/collection/snowflakes/myz/card/z-myz-card-icon/styles.css +1 -1
  48. package/dist/collection/utils/storybook-utils.js +1 -1
  49. package/dist/esm/index-a2ca4b97.js +10 -6
  50. package/dist/esm/loader.js +1 -1
  51. package/dist/esm/polyfills/css-shim.js +0 -0
  52. package/dist/esm/web-components-library.js +1 -1
  53. package/dist/esm/z-app-header_2.entry.js +147 -0
  54. package/dist/esm/z-button-sort.entry.js +1 -1
  55. package/dist/esm/z-button.entry.js +39 -0
  56. package/dist/esm/z-card.entry.js +1 -1
  57. package/dist/esm/z-chip.entry.js +7 -4
  58. package/dist/esm/z-dragdrop-area_2.entry.js +25 -4
  59. package/dist/esm/z-list_3.entry.js +1 -1
  60. package/dist/esm/z-menu-section.entry.js +11 -3
  61. package/dist/esm/z-menu.entry.js +26 -14
  62. package/dist/esm/z-myz-card-footer.entry.js +14 -2
  63. package/dist/esm/z-myz-card-icon.entry.js +1 -1
  64. package/dist/esm/z-myz-card_4.entry.js +2 -2
  65. package/dist/esm/z-offcanvas.entry.js +53 -0
  66. package/dist/esm/z-searchbar.entry.js +13 -4
  67. package/dist/esm/z-stepper-item.entry.js +1 -1
  68. package/dist/esm/z-toggle-button.entry.js +4 -2
  69. package/dist/types/beans/index.d.ts +0 -0
  70. package/dist/types/components/buttons/z-button/index.d.ts +0 -0
  71. package/dist/types/components/buttons/z-button-sort/index.d.ts +2 -2
  72. package/dist/types/components/buttons/z-chip/index.d.ts +2 -0
  73. package/dist/types/components/buttons/z-toggle-button/index.d.ts +2 -0
  74. package/dist/types/components/buttons/z-toggle-switch/index.d.ts +0 -0
  75. package/dist/types/components/date-picker/utils.d.ts +0 -0
  76. package/dist/types/components/date-picker/z-date-picker/index.d.ts +0 -0
  77. package/dist/types/components/date-picker/z-range-picker/index.d.ts +0 -0
  78. package/dist/types/components/file-upload/z-dragdrop-area/index.d.ts +0 -0
  79. package/dist/types/components/file-upload/z-file/index.d.ts +0 -0
  80. package/dist/types/components/file-upload/z-file-upload/index.d.ts +0 -0
  81. package/dist/types/components/icons/icons.d.ts +0 -0
  82. package/dist/types/components/icons/z-icon/index.d.ts +0 -0
  83. package/dist/types/components/index.d.ts +0 -0
  84. package/dist/types/components/indicators/z-stepper/index.d.ts +0 -0
  85. package/dist/types/components/indicators/z-stepper-item/index.d.ts +0 -0
  86. package/dist/types/components/inputs/z-combobox/index.d.ts +0 -0
  87. package/dist/types/components/inputs/z-input/index.d.ts +0 -0
  88. package/dist/types/components/inputs/z-input-message/index.d.ts +0 -0
  89. package/dist/types/components/inputs/z-searchbar/index.d.ts +7 -1
  90. package/dist/types/components/inputs/z-select/index.d.ts +0 -0
  91. package/dist/types/components/list/z-list/index.d.ts +0 -0
  92. package/dist/types/components/list/z-list-element/index.d.ts +0 -0
  93. package/dist/types/components/list/z-list-group/index.d.ts +0 -0
  94. package/dist/types/components/list/z-toast-notification-list/index.d.ts +0 -0
  95. package/dist/types/components/logo/z-logo/index.d.ts +0 -0
  96. package/dist/types/components/modal/z-modal/index.d.ts +4 -0
  97. package/dist/types/components/navigation/tabs/z-navigation-tab/index.d.ts +0 -0
  98. package/dist/types/components/navigation/tabs/z-navigation-tab-link/index.d.ts +0 -0
  99. package/dist/types/components/navigation/tabs/z-navigation-tabs/index.d.ts +0 -0
  100. package/dist/types/components/navigation/z-app-header/index.d.ts +2 -4
  101. package/dist/types/components/navigation/z-link/index.d.ts +0 -0
  102. package/dist/types/components/navigation/z-menu/index.d.ts +13 -5
  103. package/dist/types/components/navigation/z-menu-section/index.d.ts +9 -3
  104. package/dist/types/components/notification/z-info-box/index.d.ts +0 -0
  105. package/dist/types/components/notification/z-notification/index.d.ts +0 -0
  106. package/dist/types/components/notification/z-toast-notification/index.d.ts +1 -1
  107. package/dist/types/components/notification/z-tooltip/index.d.ts +0 -0
  108. package/dist/types/components/panel/z-panel-elem/index.d.ts +0 -0
  109. package/dist/types/components/z-anchor-navigation/index.d.ts +0 -0
  110. package/dist/types/components/z-aria-alert/index.d.ts +0 -0
  111. package/dist/types/components/z-avatar/index.d.ts +0 -0
  112. package/dist/types/components/z-card/index.d.ts +9 -0
  113. package/dist/types/components/z-carousel/index.d.ts +0 -0
  114. package/dist/types/components/z-contextual-menu/index.d.ts +0 -0
  115. package/dist/types/components/z-cover-hero/index.d.ts +0 -0
  116. package/dist/types/components/z-divider/index.d.ts +0 -0
  117. package/dist/types/components/z-ghost-loading/index.d.ts +0 -0
  118. package/dist/types/components/z-info-reveal/index.d.ts +0 -0
  119. package/dist/types/components/z-offcanvas/index.d.ts +4 -1
  120. package/dist/types/components/z-pagination/index.d.ts +0 -0
  121. package/dist/types/components/z-popover/index.d.ts +0 -0
  122. package/dist/types/components/z-section-title/index.d.ts +0 -0
  123. package/dist/types/components/z-skip-to-content/index.d.ts +0 -0
  124. package/dist/types/components/z-table/z-table/index.d.ts +0 -0
  125. package/dist/types/components/z-table/z-table-body/index.d.ts +0 -0
  126. package/dist/types/components/z-table/z-table-cell/index.d.ts +0 -0
  127. package/dist/types/components/z-table/z-table-empty-box/index.d.ts +0 -0
  128. package/dist/types/components/z-table/z-table-expanded-row/index.d.ts +0 -0
  129. package/dist/types/components/z-table/z-table-footer/index.d.ts +0 -0
  130. package/dist/types/components/z-table/z-table-head/index.d.ts +0 -0
  131. package/dist/types/components/z-table/z-table-header/index.d.ts +0 -0
  132. package/dist/types/components/z-table/z-table-header-row/index.d.ts +0 -0
  133. package/dist/types/components/z-table/z-table-row/index.d.ts +0 -0
  134. package/dist/types/components/z-table/z-table-sticky-footer/index.d.ts +0 -0
  135. package/dist/types/components/z-tag/index.d.ts +0 -0
  136. package/dist/types/components/z-visually-hidden/index.d.ts +0 -0
  137. package/dist/types/components.d.ts +65 -17
  138. package/dist/types/constants/breakpoints.d.ts +0 -0
  139. package/dist/types/constants/icons.d.ts +0 -0
  140. package/dist/types/index.d.ts +0 -0
  141. package/dist/types/snowflakes/myz/card/z-myz-card/index.d.ts +0 -0
  142. package/dist/types/snowflakes/myz/card/z-myz-card-alert/index.d.ts +0 -0
  143. package/dist/types/snowflakes/myz/card/z-myz-card-body/index.d.ts +0 -0
  144. package/dist/types/snowflakes/myz/card/z-myz-card-cover/index.d.ts +0 -0
  145. package/dist/types/snowflakes/myz/card/z-myz-card-dictionary/index.d.ts +0 -0
  146. package/dist/types/snowflakes/myz/card/z-myz-card-footer/index.d.ts +2 -0
  147. package/dist/types/snowflakes/myz/card/z-myz-card-footer-sections/index.d.ts +0 -0
  148. package/dist/types/snowflakes/myz/card/z-myz-card-header/index.d.ts +0 -0
  149. package/dist/types/snowflakes/myz/card/z-myz-card-icon/index.d.ts +0 -0
  150. package/dist/types/snowflakes/myz/card/z-myz-card-info/index.d.ts +0 -0
  151. package/dist/types/snowflakes/myz/card/z-myz-card-list/index.d.ts +0 -0
  152. package/dist/types/snowflakes/myz/list/z-myz-list/index.d.ts +0 -0
  153. package/dist/types/snowflakes/myz/list/z-myz-list-item/index.d.ts +0 -0
  154. package/dist/types/snowflakes/myz/pocket/z-messages-pocket/index.d.ts +0 -0
  155. package/dist/types/snowflakes/myz/pocket/z-pocket/index.d.ts +0 -0
  156. package/dist/types/snowflakes/myz/pocket/z-pocket-body/index.d.ts +0 -0
  157. package/dist/types/snowflakes/myz/pocket/z-pocket-header/index.d.ts +0 -0
  158. package/dist/types/snowflakes/myz/pocket/z-pocket-message/index.d.ts +0 -0
  159. package/dist/types/snowflakes/myz/z-alert/index.d.ts +0 -0
  160. package/dist/types/snowflakes/myz/z-otp/index.d.ts +0 -0
  161. package/dist/types/snowflakes/myz/z-slideshow/index.d.ts +0 -0
  162. package/dist/types/stencil-public-runtime.d.ts +0 -0
  163. package/dist/types/utils/utils.d.ts +0 -0
  164. package/dist/web-components-library/index.esm.js +0 -0
  165. package/dist/web-components-library/p-068951a7.entry.js +1 -0
  166. package/dist/web-components-library/p-06b7dad4.entry.js +1 -0
  167. package/dist/web-components-library/{p-417b1b6c.entry.js → p-10adc1fa.entry.js} +1 -1
  168. package/dist/web-components-library/p-1570917d.entry.js +1 -0
  169. package/dist/web-components-library/p-157aea3b.entry.js +1 -0
  170. package/dist/web-components-library/p-1c8e7c24.entry.js +1 -0
  171. package/dist/web-components-library/p-20682781.entry.js +1 -0
  172. package/dist/web-components-library/{p-ede9fbf5.entry.js → p-6736e894.entry.js} +1 -1
  173. package/dist/web-components-library/{p-810bd730.entry.js → p-9db2bf11.entry.js} +1 -1
  174. package/dist/web-components-library/p-af283478.entry.js +1 -0
  175. package/dist/web-components-library/p-c722c5a4.entry.js +1 -0
  176. package/dist/web-components-library/p-d0760bb1.entry.js +1 -0
  177. package/dist/web-components-library/p-deda8776.entry.js +1 -0
  178. package/dist/web-components-library/p-f3a8cc14.entry.js +1 -0
  179. package/dist/web-components-library/{p-05ced71c.entry.js → p-f5a99b28.entry.js} +1 -1
  180. package/dist/web-components-library/{p-c081e1f4.entry.js → p-f9f42d17.entry.js} +1 -1
  181. package/dist/web-components-library/web-components-library.css +2 -1
  182. package/dist/web-components-library/web-components-library.esm.js +1 -1
  183. package/loader/cdn.js +0 -0
  184. package/loader/index.cjs.js +0 -0
  185. package/loader/index.d.ts +0 -0
  186. package/loader/index.es2017.js +0 -0
  187. package/loader/index.js +0 -0
  188. package/loader/package.json +0 -0
  189. package/package.json +2 -3
  190. package/readme.md +0 -1
  191. package/www/build/index.esm.js +0 -0
  192. package/www/build/p-068951a7.entry.js +1 -0
  193. package/www/build/p-06b7dad4.entry.js +1 -0
  194. package/www/build/{p-417b1b6c.entry.js → p-10adc1fa.entry.js} +1 -1
  195. package/www/build/p-1570917d.entry.js +1 -0
  196. package/www/build/p-157aea3b.entry.js +1 -0
  197. package/www/build/p-1c8e7c24.entry.js +1 -0
  198. package/www/build/p-20682781.entry.js +1 -0
  199. package/www/build/{p-ede9fbf5.entry.js → p-6736e894.entry.js} +1 -1
  200. package/www/build/p-77d28b14.js +1 -0
  201. package/www/build/{p-810bd730.entry.js → p-9db2bf11.entry.js} +1 -1
  202. package/www/build/p-af283478.entry.js +1 -0
  203. package/www/build/p-c722c5a4.entry.js +1 -0
  204. package/www/build/p-d0760bb1.entry.js +1 -0
  205. package/www/build/p-deda8776.entry.js +1 -0
  206. package/www/build/p-f39bb490.css +2 -0
  207. package/www/build/p-f3a8cc14.entry.js +1 -0
  208. package/www/build/{p-05ced71c.entry.js → p-f5a99b28.entry.js} +1 -1
  209. package/www/build/{p-c081e1f4.entry.js → p-f9f42d17.entry.js} +1 -1
  210. package/www/build/web-components-library.css +2 -1
  211. package/www/build/web-components-library.esm.js +1 -1
  212. package/www/build/web-components-library.js +0 -0
  213. package/www/host.config.json +0 -0
  214. package/www/index.html +1 -37
  215. package/dist/cjs/z-app-header.cjs.entry.js +0 -133
  216. package/dist/cjs/z-button_3.cjs.entry.js +0 -108
  217. package/dist/esm/z-app-header.entry.js +0 -129
  218. package/dist/esm/z-button_3.entry.js +0 -102
  219. package/dist/web-components-library/p-029e4fba.entry.js +0 -1
  220. package/dist/web-components-library/p-14a6abe4.entry.js +0 -1
  221. package/dist/web-components-library/p-19ca449e.entry.js +0 -1
  222. package/dist/web-components-library/p-3a9cc467.entry.js +0 -1
  223. package/dist/web-components-library/p-73d9489b.entry.js +0 -1
  224. package/dist/web-components-library/p-9d03a7d6.entry.js +0 -1
  225. package/dist/web-components-library/p-f158d205.entry.js +0 -1
  226. package/dist/web-components-library/p-f95cc914.entry.js +0 -1
  227. package/dist/web-components-library/p-fa4c203a.entry.js +0 -1
  228. package/dist/web-components-library/p-fffb14e1.entry.js +0 -1
  229. package/www/build/p-029e4fba.entry.js +0 -1
  230. package/www/build/p-14a6abe4.entry.js +0 -1
  231. package/www/build/p-19ca449e.entry.js +0 -1
  232. package/www/build/p-275801c6.css +0 -1
  233. package/www/build/p-3a9cc467.entry.js +0 -1
  234. package/www/build/p-73d9489b.entry.js +0 -1
  235. package/www/build/p-811ee64f.js +0 -1
  236. package/www/build/p-9d03a7d6.entry.js +0 -1
  237. package/www/build/p-f158d205.entry.js +0 -1
  238. package/www/build/p-f95cc914.entry.js +0 -1
  239. package/www/build/p-fa4c203a.entry.js +0 -1
  240. package/www/build/p-fffb14e1.entry.js +0 -1
@@ -10,16 +10,18 @@ export class ZMenu {
10
10
  * Flag to set the display mode of the list.
11
11
  * If true, the list will be absolutely positioned under the menu label,
12
12
  * stacked beneath it otherwise.
13
- * @default false
14
13
  */
15
14
  this.floating = false;
15
+ /** The opening state of the menu. */
16
+ this.open = false;
16
17
  /**
17
- * The opening state of the menu.
18
- * @default false
18
+ * Tells the component that it's placed in a vertical context with other `ZMenu`s (e.g. in the ZAppHeader's offcanvas).
19
+ * A small border is placed under it as a separator from other elements.
19
20
  */
20
- this.open = false;
21
+ this.verticalContext = false;
21
22
  this.toggle = this.toggle.bind(this);
22
23
  this.checkContent = this.checkContent.bind(this);
24
+ this.onLabelSlotChange = this.onLabelSlotChange.bind(this);
23
25
  this.onItemsChange = this.onItemsChange.bind(this);
24
26
  }
25
27
  toggle() {
@@ -49,6 +51,14 @@ export class ZMenu {
49
51
  componentWillLoad() {
50
52
  this.checkContent();
51
53
  }
54
+ /**
55
+ * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
56
+ * @param ev Slotchange event
57
+ */
58
+ onLabelSlotChange(ev) {
59
+ const labelElement = ev.target.assignedElements()[0];
60
+ labelElement.dataset.text = labelElement === null || labelElement === void 0 ? void 0 : labelElement.textContent;
61
+ }
52
62
  /**
53
63
  * Correctly set position of the floating menu in order to prevent overflow.
54
64
  * @param live Should run the method on every refresh frame.
@@ -70,27 +80,29 @@ export class ZMenu {
70
80
  * Check if some content slot is set.
71
81
  */
72
82
  checkContent() {
73
- this.hasHeader = !!this.hostElement.querySelectorAll('[slot="header"]').length;
74
- this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length || this.hasHeader;
83
+ this.hasHeader = !!this.hostElement.querySelectorAll("[slot=header]").length;
84
+ this.hasContent = !!this.hostElement.querySelectorAll("[slot=item]").length || this.hasHeader;
75
85
  }
76
86
  /**
77
87
  * Set `menuitem` role to all menu items.
88
+ * Set the item's inner text to the `data-text` attribute (this is for using bold text avoiding layout shifts).
78
89
  */
79
90
  onItemsChange() {
80
91
  this.checkContent();
81
- const items = this.hostElement.querySelectorAll('[slot="item"]');
82
- items === null || items === void 0 ? void 0 : items.forEach((item) => item.setAttribute("role", "menuitem"));
92
+ const items = this.hostElement.querySelectorAll("[slot=item]");
93
+ items.forEach((item) => {
94
+ item.setAttribute("role", "menuitem");
95
+ item.dataset.text = item.textContent;
96
+ });
83
97
  }
84
98
  renderMenuLabel() {
85
99
  if (this.hasContent) {
86
- return (h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, h("div", { class: "menu-label-content" }, h("slot", null), h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" }))));
100
+ return (h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, h("div", { class: "menu-label-content" }, h("slot", { onSlotchange: this.onLabelSlotChange }), h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" }))));
87
101
  }
88
- return (h("div", { class: "menu-label" }, h("div", { class: "menu-label-content" }, h("slot", null))));
102
+ return (h("div", { class: "menu-label" }, h("div", { class: "menu-label-content" }, h("slot", { onSlotchange: this.onLabelSlotChange }))));
89
103
  }
90
104
  render() {
91
- return (h(Host, null, this.renderMenuLabel(), h("div", { class: "content", ref: (el) => {
92
- this.content = el;
93
- }, hidden: !this.open }, this.hasHeader && (h("header", { class: "header" }, h("slot", { name: "header", onSlotchange: this.checkContent }))), h("div", { class: "items", role: "menu" }, h("slot", { name: "item", onSlotchange: this.onItemsChange })))));
105
+ return (h(Host, null, this.renderMenuLabel(), this.hasContent && (h("div", { class: "content", ref: (el) => (this.content = el) }, this.hasHeader && (h("header", { class: "header" }, h("slot", { name: "header", onSlotchange: this.checkContent }))), h("div", { class: "items", role: "menu" }, h("slot", { name: "item", onSlotchange: this.onItemsChange }))))));
94
106
  }
95
107
  static get is() { return "z-menu"; }
96
108
  static get encapsulation() { return "shadow"; }
@@ -134,10 +146,7 @@ export class ZMenu {
134
146
  "required": false,
135
147
  "optional": true,
136
148
  "docs": {
137
- "tags": [{
138
- "name": "default",
139
- "text": "false"
140
- }],
149
+ "tags": [],
141
150
  "text": "Flag to set the display mode of the list.\nIf true, the list will be absolutely positioned under the menu label,\nstacked beneath it otherwise."
142
151
  },
143
152
  "attribute": "floating",
@@ -155,15 +164,30 @@ export class ZMenu {
155
164
  "required": false,
156
165
  "optional": false,
157
166
  "docs": {
158
- "tags": [{
159
- "name": "default",
160
- "text": "false"
161
- }],
167
+ "tags": [],
162
168
  "text": "The opening state of the menu."
163
169
  },
164
170
  "attribute": "open",
165
171
  "reflect": true,
166
172
  "defaultValue": "false"
173
+ },
174
+ "verticalContext": {
175
+ "type": "boolean",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "boolean",
179
+ "resolved": "boolean",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": "Tells the component that it's placed in a vertical context with other `ZMenu`s (e.g. in the ZAppHeader's offcanvas).\nA small border is placed under it as a separator from other elements."
187
+ },
188
+ "attribute": "vertical-context",
189
+ "reflect": true,
190
+ "defaultValue": "false"
167
191
  }
168
192
  };
169
193
  }
@@ -11,13 +11,17 @@
11
11
  }
12
12
 
13
13
  ::slotted(a) {
14
- color: var(--color-text01);
15
14
  text-decoration: none;
16
15
  }
17
16
 
18
17
  ::slotted(*) {
18
+ color: var(--color-text01);
19
19
  font-family: var(--font-family-sans);
20
20
  font-weight: var(--font-rg);
21
+
22
+ /* increasing the letter spacing of the regular text helps reduce
23
+ the size difference between regular and bold text */
24
+ letter-spacing: 0.36px;
21
25
  }
22
26
 
23
27
  .menu-label {
@@ -45,38 +49,101 @@ button.menu-label {
45
49
  }
46
50
 
47
51
  .menu-label .menu-label-content {
52
+ position: relative;
48
53
  display: flex;
49
54
  align-items: center;
50
- padding: var(--space-unit) 0;
51
- border-bottom: var(--border-size-large) solid var(--color-surface05);
52
55
  }
53
56
 
54
- :host([active]) .menu-label-content,
55
- :host([open]) .menu-label-content,
56
- .menu-label:hover .menu-label-content,
57
+ :host(:is([active], [open])) .menu-label-content,
58
+ .menu-label .menu-label-content:hover,
57
59
  .menu-label:focus-within .menu-label-content {
58
- border-color: var(--color-secondary01);
60
+ font-weight: var(--font-bd);
61
+ }
62
+
63
+ :host(:is([active], [open])) .menu-label-content ::slotted(*),
64
+ .menu-label .menu-label-content:hover ::slotted(*),
65
+ .menu-label:focus-within .menu-label-content ::slotted(*) {
66
+ letter-spacing: normal;
67
+ }
68
+
69
+ /* border */
70
+ :host(:is([active], [open], [vertical-context])) .menu-label .menu-label-content::after,
71
+ .menu-label .menu-label-content:hover::after,
72
+ .menu-label:focus-within .menu-label-content::after {
73
+ position: absolute;
74
+ bottom: 0;
75
+ left: 0;
76
+ width: 100%;
77
+ content: "";
78
+ pointer-events: none;
79
+ }
80
+
81
+ :host([vertical-context]) .menu-label-content::after {
82
+ height: var(--border-size-small);
83
+ background-color: var(--color-surface03);
59
84
  }
60
85
 
61
- .menu-label ::slotted(*) {
86
+ :host(:is([active], [open])) .menu-label .menu-label-content::after,
87
+ .menu-label .menu-label-content:hover::after,
88
+ .menu-label:focus-within .menu-label-content::after {
89
+ height: var(--border-size-large);
90
+ background-color: var(--color-secondary01);
91
+ }
92
+
93
+ /* Prevents layout shifts on font-weight changes.
94
+ The trick is to put an hidden copy of the text already set to bold,
95
+ so the needed space is correctly calculated before any hover/active state changes the
96
+ font-weight of the real text.
97
+ The hidden text has an height of 0px so it can expand the width without changing the height
98
+ when placed below the real text using `flex-direction: column`. */
99
+ ::slotted([data-text])::after {
100
+ height: 0;
101
+ content: attr(data-text);
102
+ content: attr(data-text) / "";
103
+ font-weight: var(--font-bd);
104
+ letter-spacing: normal;
105
+ pointer-events: none;
106
+ user-select: none;
107
+ visibility: hidden;
108
+ }
109
+
110
+ @media speech {
111
+ ::slotted([data-text])::after {
112
+ display: none;
113
+ }
114
+ }
115
+
116
+ ::slotted([data-text]) {
117
+ display: inline-flex;
118
+ flex-direction: column;
119
+ }
120
+
121
+ .menu-label .menu-label-content ::slotted(*) {
122
+ display: inline-flex;
62
123
  width: 100%;
63
124
  margin: 0;
64
125
  appearance: none;
65
126
  font-size: var(--font-size-5);
127
+ font-weight: inherit;
66
128
  line-height: 1.2;
67
129
  outline: none;
68
130
  }
69
131
 
70
- .menu-label z-icon {
71
- margin-left: calc(var(--space-unit) * 4);
72
- fill: currentcolor;
132
+ .menu-label .menu-label-content ::slotted(*),
133
+ .menu-label .menu-label-content z-icon {
134
+ padding: var(--space-unit) 0;
135
+ }
136
+
137
+ .menu-label .menu-label-content z-icon {
138
+ margin-left: calc(var(--space-unit) * 1.5);
139
+ fill: var(--color-icon02);
73
140
  }
74
141
 
75
142
  .content {
76
143
  background: var(--color-surface01);
77
144
  }
78
145
 
79
- .content[hidden] {
146
+ :host(:not([open])) .content {
80
147
  display: none;
81
148
  }
82
149
 
@@ -123,7 +190,6 @@ button.menu-label {
123
190
  }
124
191
 
125
192
  .items > ::slotted([slot="item"]) {
126
- display: inline-flex;
127
193
  width: 100%;
128
194
  margin: 0;
129
195
  font-size: var(--font-size-3);
@@ -143,4 +209,5 @@ button.menu-label {
143
209
  .items > ::slotted([slot="item"]:hover),
144
210
  .items > ::slotted([slot="item"]:active) {
145
211
  border-color: var(--color-secondary01);
212
+ font-weight: var(--font-bd);
146
213
  }
@@ -1,7 +1,8 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  /**
3
- * @slot - Menu section label
4
- * @slot item - Single entry of the section. Can be slotted multiple times to insert items.
3
+ * A component to create submenus inside the ZMenu.
4
+ * @slot - Label of the menu section.
5
+ * @slot item - Single entry of the section. Set the same slot name to different items to put many of them. Add the `active` attribute to a slotted item to highlight it.
5
6
  */
6
7
  export class ZMenuSection {
7
8
  toggle() {
@@ -23,13 +24,21 @@ export class ZMenuSection {
23
24
  * Check if some content slot is set.
24
25
  */
25
26
  checkContent() {
26
- this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length;
27
+ this.hasContent = this.hostElement.querySelectorAll('[slot="item"]').length > 0;
28
+ }
29
+ /**
30
+ * Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
31
+ * @param ev Slotchange event
32
+ */
33
+ onLabelSlotChange(ev) {
34
+ const labelElement = ev.target.assignedElements()[0];
35
+ labelElement.dataset.text = (labelElement === null || labelElement === void 0 ? void 0 : labelElement.innerText) || null;
27
36
  }
28
37
  componentWillLoad() {
29
38
  this.checkContent();
30
39
  }
31
40
  render() {
32
- return (h(Host, { role: "menu", open: this.open }, h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, h("slot", null), this.hasContent && h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" })), this.open && (h("div", { class: "items" }, h("slot", { name: "item", onSlotchange: this.checkContent.bind(this) })))));
41
+ return (h(Host, { role: "menu", open: this.open }, h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, h("slot", { onSlotchange: this.onLabelSlotChange.bind(this) }), this.hasContent && h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" })), this.open && (h("div", { class: "items" }, h("slot", { name: "item", onSlotchange: this.checkContent.bind(this) })))));
33
42
  }
34
43
  static get is() { return "z-menu-section"; }
35
44
  static get encapsulation() { return "shadow"; }
@@ -23,12 +23,15 @@
23
23
  font-weight: var(--font-rg);
24
24
  }
25
25
 
26
- :host([active]) .label,
27
- :host([open]) .label,
26
+ :host(:is([active], [open])) .label,
28
27
  .label:hover {
29
28
  border-color: var(--color-secondary01);
30
29
  }
31
30
 
31
+ :is(:host(:is([active], [open])) .label, .label:hover) ::slotted(*) {
32
+ font-weight: var(--font-bd);
33
+ }
34
+
32
35
  .label {
33
36
  display: flex;
34
37
  width: 100%;
@@ -43,6 +46,34 @@
43
46
  text-align: left;
44
47
  }
45
48
 
49
+ ::slotted([data-text]) {
50
+ display: inline-flex;
51
+ flex-direction: column;
52
+ }
53
+
54
+ /* Trick to prevent layout shifts on font-weight changes.
55
+ The trick is to put an hidden copy of the text already set to bold,
56
+ so the needed space is correctly calculated before any hover/active state changes the
57
+ font-weight of the real text.
58
+ The hidden text has an height of 0px so it can expand the width without changing the height
59
+ when placed below the real text using `flex-direction: column`. */
60
+ ::slotted([data-text])::after {
61
+ overflow: hidden;
62
+ height: 0;
63
+ content: attr(data-text);
64
+ content: attr(data-text) / "";
65
+ font-weight: var(--font-bd);
66
+ pointer-events: none;
67
+ user-select: none;
68
+ visibility: hidden;
69
+ }
70
+
71
+ @media speech {
72
+ ::slotted([data-text])::after {
73
+ display: none;
74
+ }
75
+ }
76
+
46
77
  .label ::slotted(*) {
47
78
  width: 100%;
48
79
  margin: 0;
@@ -57,7 +88,7 @@
57
88
 
58
89
  .label z-icon {
59
90
  margin-left: calc(var(--space-unit) * 4);
60
- fill: currentcolor;
91
+ fill: var(--color-icon02);
61
92
  }
62
93
 
63
94
  .items {
@@ -86,6 +117,8 @@
86
117
  color: var(--color-secondary01);
87
118
  }
88
119
 
89
- .items > ::slotted([slot="item"]:hover) {
120
+ .items > ::slotted([slot="item"]:hover),
121
+ .items > ::slotted([slot="item"][active]) {
90
122
  color: var(--color-secondary01);
123
+ font-weight: var(--font-bd);
91
124
  }
@@ -295,7 +295,7 @@ export class ZToastNotification {
295
295
  "optional": true,
296
296
  "docs": {
297
297
  "tags": [],
298
- "text": "toast notification type: dark, light, accent, error, success, warning"
298
+ "text": "toast notification type: dark, light, accent, error, success, warning"
299
299
  },
300
300
  "attribute": "type",
301
301
  "reflect": false
@@ -1,5 +1,14 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import { CardVariant } from "../../beans";
3
+ /**
4
+ * ZCard component.
5
+ * @cssprop --aspect-ratio - Cover aspect ratio. Default: `1.62`
6
+ * @cssprop --z-card--border-color - Default: `var(--gray200)`
7
+ * @cssprop --z-card--color-cover-background - Cover color. Default: `var(--color-surface01)`
8
+ * @cssprop --z-card--text-background - Background color for the `text` variant. Default: `var(--color-surface01)`
9
+ * @cssprop --z-card--text-border-radius - Default: `none`
10
+ * @cssprop --z-card--text-border - Configure CSS `border`. Default: `none`
11
+ */
3
12
  export class ZCard {
4
13
  constructor() {
5
14
  /** Enable click interactions on the card. Default: false */
@@ -183,7 +183,7 @@ Unfortunately the `aspect-ratio` property is still experimental */
183
183
 
184
184
  :host([variant="shadow"][clickable]:focus:focus-visible),
185
185
  :host([clickable][showshadow]:focus:focus-visible) {
186
- box-shadow: var(--shadow-4);
186
+ box-shadow: var(--shadow-focus-primary);
187
187
  }
188
188
 
189
189
  :host([variant="shadow"][clickable]:active),
@@ -2,6 +2,7 @@ import { h, Host } from "@stencil/core";
2
2
  import { OffCanvasVariant, TransitionDirection } from "../../beans";
3
3
  /**
4
4
  * @slot canvasContent - set the content of the canvas
5
+ * @method setSkipAanimationOnLoad - set skipAnimation
5
6
  */
6
7
  export class ZOffcanvas {
7
8
  constructor() {
@@ -15,15 +16,20 @@ export class ZOffcanvas {
15
16
  this.open = false;
16
17
  /** open content transitioning in a specified direction left | right. Default: left */
17
18
  this.transitiondirection = TransitionDirection.LEFT;
18
- /** allows you to skip the entry animation on page load, to be used with the open prop at true */
19
+ /** manages the skip for the entry animation*/
19
20
  this.skipanimationonload = false;
20
21
  }
22
+ /** this method allows you to skip the page loading animation, to be used with the prop set to true */
23
+ async setSkipAanimationOnLoad(value) {
24
+ this.skipanimationonload = value;
25
+ }
21
26
  onOpenChanged() {
22
- if (!this.open && this.hostElement.hasAttribute("skipanimationonload")) {
23
- this.hostElement.removeAttribute("skipanimationonload");
27
+ if (!this.open && this.skipanimationonload) {
28
+ this.skipanimationonload = false;
24
29
  }
25
- if (this.open)
30
+ if (this.open) {
26
31
  this.handleOverflowProperty();
32
+ }
27
33
  this.canvasOpenStatusChanged.emit(this.open);
28
34
  }
29
35
  handleOverflowProperty() {
@@ -34,7 +40,7 @@ export class ZOffcanvas {
34
40
  this.handleOverflowProperty();
35
41
  }
36
42
  render() {
37
- return (h(Host, null, h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handledTransitionEnd() }, h("div", { role: "presentation", class: "canvas-content" }, h("slot", { name: "canvasContent" }))), this.variant == OffCanvasVariant.OVERLAY && (h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
43
+ return (h(Host, { class: { "skip-animation": this.skipanimationonload } }, h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handledTransitionEnd() }, h("div", { role: "presentation", class: "canvas-content" }, h("slot", { name: "canvasContent" }))), this.variant == OffCanvasVariant.OVERLAY && (h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
38
44
  }
39
45
  static get is() { return "z-offcanvas"; }
40
46
  static get encapsulation() { return "scoped"; }
@@ -113,27 +119,14 @@ export class ZOffcanvas {
113
119
  "attribute": "transitiondirection",
114
120
  "reflect": true,
115
121
  "defaultValue": "TransitionDirection.LEFT"
116
- },
117
- "skipanimationonload": {
118
- "type": "boolean",
119
- "mutable": false,
120
- "complexType": {
121
- "original": "boolean",
122
- "resolved": "boolean",
123
- "references": {}
124
- },
125
- "required": false,
126
- "optional": false,
127
- "docs": {
128
- "tags": [],
129
- "text": "allows you to skip the entry animation on page load, to be used with the open prop at true"
130
- },
131
- "attribute": "skipanimationonload",
132
- "reflect": false,
133
- "defaultValue": "false"
134
122
  }
135
123
  };
136
124
  }
125
+ static get states() {
126
+ return {
127
+ "skipanimationonload": {}
128
+ };
129
+ }
137
130
  static get events() {
138
131
  return [{
139
132
  "method": "canvasOpenStatusChanged",
@@ -152,6 +145,29 @@ export class ZOffcanvas {
152
145
  }
153
146
  }];
154
147
  }
148
+ static get methods() {
149
+ return {
150
+ "setSkipAanimationOnLoad": {
151
+ "complexType": {
152
+ "signature": "(value: boolean) => Promise<void>",
153
+ "parameters": [{
154
+ "tags": [],
155
+ "text": ""
156
+ }],
157
+ "references": {
158
+ "Promise": {
159
+ "location": "global"
160
+ }
161
+ },
162
+ "return": "Promise<void>"
163
+ },
164
+ "docs": {
165
+ "text": "this method allows you to skip the page loading animation, to be used with the prop set to true",
166
+ "tags": []
167
+ }
168
+ }
169
+ };
170
+ }
155
171
  static get elementRef() { return "hostElement"; }
156
172
  static get watchers() {
157
173
  return [{
@@ -97,11 +97,11 @@
97
97
 
98
98
  /* Mobile */
99
99
  @media only screen and (max-width: 768px) {
100
- :host([open][transitiondirection="left"]:not([skipAnimationOnLoad])) > .canvas-container {
100
+ :host([open][transitiondirection="left"]:not(.skip-animation)) > .canvas-container {
101
101
  animation: enter-right 0.4s ease-out;
102
102
  }
103
103
 
104
- :host([open][transitiondirection="right"]:not([skipAnimationOnLoad])) > .canvas-container {
104
+ :host([open][transitiondirection="right"]:not(.skip-animation)) > .canvas-container {
105
105
  animation: enter-left 0.4s ease-out;
106
106
  }
107
107
  }
@@ -120,7 +120,7 @@
120
120
  min-height: calc(var(--space-unit) * 40);
121
121
  }
122
122
 
123
- :host(:not([variant="overlay"])[open]:not([skipAnimationOnLoad])) {
123
+ :host(:not([variant="overlay"])[open]:not(.skip-animation)) {
124
124
  width: auto;
125
125
  animation: grow 0.4s ease-out;
126
126
  }
@@ -158,11 +158,11 @@
158
158
  }
159
159
  }
160
160
 
161
- :host([open][variant="overlay"][transitiondirection="left"]:not([skipAnimationOnLoad])) > .canvas-container {
161
+ :host([open][variant="overlay"][transitiondirection="left"]:not(.skip-animation)) > .canvas-container {
162
162
  animation: enter-right 0.4s ease-out;
163
163
  }
164
164
 
165
- :host([open][transitiondirection="right"]:not([skipAnimationOnLoad])) > .canvas-container {
165
+ :host([open][transitiondirection="right"]:not(.skip-animation)) > .canvas-container {
166
166
  animation: enter-left 0.4s ease-out;
167
167
  }
168
168
 
@@ -15,6 +15,14 @@ export class ZMyzCardFooter {
15
15
  }
16
16
  handleToggle() {
17
17
  this.isOpen = !this.isOpen;
18
+ if (this.isOpen) {
19
+ const firstElem = this.getFirstListItem();
20
+ if (firstElem) {
21
+ requestAnimationFrame(() => {
22
+ firstElem.focus();
23
+ });
24
+ }
25
+ }
18
26
  }
19
27
  getTitleAuthors() {
20
28
  return this.allowTooltipAuthors ? this.autori : "";
@@ -44,8 +52,11 @@ export class ZMyzCardFooter {
44
52
  this.elementsEllipsis();
45
53
  }
46
54
  }
55
+ getFirstListItem() {
56
+ return this.host.querySelector("[slot=list] > li a");
57
+ }
47
58
  render() {
48
- return (h("div", { class: Object.assign(Object.assign({}, this.retrieveClass()), { wrapper: true }) }, h("footer", { class: this.retrieveClass(), onTransitionEnd: (e) => this.footerTransitionHandler(e) }, h("span", { class: "toggle" }, h("slot", { name: "toggle" })), this.titolo && h("p", { class: { "custom-content": this.customContent } }, this.titolo), h("div", { class: { "content": true, "custom-content": this.customContent } }, h("div", null, h("p", { class: "authors", ref: (el) => (this.ellipsisAuthors = el) }, h("span", { title: this.getTitleAuthors() }, h("span", { class: "bold" }, this.autori))), h("p", { class: "year-isbn" }, h("span", { class: "isbn" }, h("span", null, h("span", { class: "bold" }, this.isbn), " (ed. cartacea)")))), h("div", { class: `slot-handler ${this.isOpen ? "visible" : "hidden"}` }, h("slot", { name: "list" })))), this.customContent && h("slot", { name: "content" })));
59
+ return (h("div", { class: Object.assign(Object.assign({}, this.retrieveClass()), { wrapper: true }) }, h("footer", { class: this.retrieveClass(), onTransitionEnd: (e) => this.footerTransitionHandler(e) }, h("span", { class: "toggle" }, h("slot", { name: "toggle" })), this.titolo && h("p", { class: { "custom-content": this.customContent } }, this.titolo), h("div", { class: { "content": true, "custom-content": this.customContent } }, h("div", null, h("p", { class: "authors", ref: (el) => (this.ellipsisAuthors = el) }, h("span", { title: this.getTitleAuthors() }, h("span", { "aria-description": "Autori", class: "bold" }, this.autori))), h("p", { class: "year-isbn" }, h("span", { class: "isbn" }, h("span", null, h("span", { "aria-description": "ISBN edizione cartacea", class: "bold" }, this.isbn), " ", "(ed. cartacea)")))), h("div", { class: `slot-handler ${this.isOpen ? "visible" : "hidden"}` }, h("slot", { name: "list" })))), this.customContent && h("slot", { name: "content" })));
49
60
  }
50
61
  static get is() { return "z-myz-card-footer"; }
51
62
  static get encapsulation() { return "shadow"; }
@@ -195,6 +206,7 @@ export class ZMyzCardFooter {
195
206
  "allowTooltipAuthors": {}
196
207
  };
197
208
  }
209
+ static get elementRef() { return "host"; }
198
210
  static get listeners() {
199
211
  return [{
200
212
  "name": "toggleClick",
@@ -27,7 +27,7 @@ export class ZMyzCardHeader {
27
27
  };
28
28
  }
29
29
  render() {
30
- return (h("header", { class: this.retrieveClass() }, h("span", { class: "card-title", ref: (el) => (this.ellipsis = el), title: this.getTitle() }, this.titolo), h("slot", { name: "icon" })));
30
+ return (h("header", { class: this.retrieveClass() }, h("slot", { name: "aria-heading" }), h("span", { class: "card-title", ref: (el) => (this.ellipsis = el), title: this.getTitle() }, this.titolo), h("slot", { name: "icon" })));
31
31
  }
32
32
  static get is() { return "z-myz-card-header"; }
33
33
  static get encapsulation() { return "shadow"; }
@@ -11,6 +11,18 @@ header {
11
11
  border-radius: var(--border-radius) var(--border-radius) var(--border-no-radius) var(--border-no-radius);
12
12
  }
13
13
 
14
+ slot[name="aria-heading"]::slotted(*) {
15
+ position: absolute;
16
+ overflow: hidden !important;
17
+ width: 1px !important;
18
+ height: 1px !important;
19
+ padding: 0 !important;
20
+ border: 0 none !important;
21
+ margin: -1px !important;
22
+ clip: rect(0, 0, 0, 0) !important;
23
+ white-space: nowrap !important;
24
+ }
25
+
14
26
  header.real,
15
27
  header.trial,
16
28
  header.temp {
@@ -41,7 +41,7 @@ button:hover > span {
41
41
  button:focus > span {
42
42
  background: var(--color-surface01);
43
43
  border-radius: var(--border-radius);
44
- box-shadow: 0 0 2px 2px var(--accent-dark);
44
+ box-shadow: var(--shadow-focus-primary);
45
45
  }
46
46
 
47
47
  button:active > span {
@@ -18,8 +18,8 @@ function getRootCssProperties() {
18
18
  * @example ```
19
19
  * argTypes={{
20
20
  * "--z-component--background-color": {
21
+ * control: { type: "select" },
21
22
  * options: getColorTokens(),
22
- * control: { type: "select" }
23
23
  * }
24
24
  * }}```
25
25
  *