@zanichelli/albe-web-components 7.2.0 → 7.3.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.
Files changed (148) hide show
  1. package/dist/cjs/index-e3299e0a.js +10 -6
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/web-components-library.cjs.js +1 -1
  4. package/dist/cjs/z-app-header_2.cjs.entry.js +152 -0
  5. package/dist/cjs/z-button-sort.cjs.entry.js +1 -1
  6. package/dist/cjs/z-button.cjs.entry.js +43 -0
  7. package/dist/cjs/z-card.cjs.entry.js +1 -1
  8. package/dist/cjs/z-chip.cjs.entry.js +6 -3
  9. package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +25 -4
  10. package/dist/cjs/z-list_3.cjs.entry.js +1 -1
  11. package/dist/cjs/z-menu-section.cjs.entry.js +11 -3
  12. package/dist/cjs/z-menu.cjs.entry.js +26 -14
  13. package/dist/cjs/z-myz-card-footer.cjs.entry.js +13 -1
  14. package/dist/cjs/z-myz-card-icon.cjs.entry.js +1 -1
  15. package/dist/cjs/z-myz-card_4.cjs.entry.js +2 -2
  16. package/dist/cjs/z-offcanvas.cjs.entry.js +57 -0
  17. package/dist/cjs/z-searchbar.cjs.entry.js +12 -3
  18. package/dist/cjs/z-stepper-item.cjs.entry.js +1 -1
  19. package/dist/cjs/z-toggle-button.cjs.entry.js +4 -2
  20. package/dist/collection/collection-manifest.json +1 -1
  21. package/dist/collection/components/buttons/z-button-sort/index.js +2 -2
  22. package/dist/collection/components/buttons/z-button-sort/styles.css +1 -1
  23. package/dist/collection/components/buttons/z-chip/index.js +25 -3
  24. package/dist/collection/components/buttons/z-chip/styles.css +28 -21
  25. package/dist/collection/components/buttons/z-toggle-button/index.js +21 -1
  26. package/dist/collection/components/buttons/z-toggle-button/styles.css +1 -3
  27. package/dist/collection/components/indicators/z-stepper-item/styles.css +1 -1
  28. package/dist/collection/components/inputs/z-searchbar/index.js +76 -3
  29. package/dist/collection/components/inputs/z-searchbar/styles.css +23 -0
  30. package/dist/collection/components/list/z-list-element/index.js +1 -1
  31. package/dist/collection/components/modal/z-modal/index.js +43 -4
  32. package/dist/collection/components/navigation/z-app-header/index.js +14 -15
  33. package/dist/collection/components/navigation/z-app-header/styles.css +2 -3
  34. package/dist/collection/components/navigation/z-menu/index.js +45 -21
  35. package/dist/collection/components/navigation/z-menu/styles.css +80 -13
  36. package/dist/collection/components/navigation/z-menu-section/index.js +13 -4
  37. package/dist/collection/components/navigation/z-menu-section/styles.css +37 -4
  38. package/dist/collection/components/notification/z-toast-notification/index.js +1 -1
  39. package/dist/collection/components/z-card/index.js +9 -0
  40. package/dist/collection/components/z-card/styles.css +1 -1
  41. package/dist/collection/components/z-offcanvas/index.js +39 -23
  42. package/dist/collection/components/z-offcanvas/styles.css +5 -5
  43. package/dist/collection/snowflakes/myz/card/z-myz-card-footer/index.js +13 -1
  44. package/dist/collection/snowflakes/myz/card/z-myz-card-header/index.js +1 -1
  45. package/dist/collection/snowflakes/myz/card/z-myz-card-header/styles.css +12 -0
  46. package/dist/collection/snowflakes/myz/card/z-myz-card-icon/styles.css +1 -1
  47. package/dist/collection/utils/storybook-utils.js +1 -1
  48. package/dist/esm/index-a2ca4b97.js +10 -6
  49. package/dist/esm/loader.js +1 -1
  50. package/dist/esm/web-components-library.js +1 -1
  51. package/dist/esm/z-app-header_2.entry.js +147 -0
  52. package/dist/esm/z-button-sort.entry.js +1 -1
  53. package/dist/esm/z-button.entry.js +39 -0
  54. package/dist/esm/z-card.entry.js +1 -1
  55. package/dist/esm/z-chip.entry.js +7 -4
  56. package/dist/esm/z-dragdrop-area_2.entry.js +25 -4
  57. package/dist/esm/z-list_3.entry.js +1 -1
  58. package/dist/esm/z-menu-section.entry.js +11 -3
  59. package/dist/esm/z-menu.entry.js +26 -14
  60. package/dist/esm/z-myz-card-footer.entry.js +14 -2
  61. package/dist/esm/z-myz-card-icon.entry.js +1 -1
  62. package/dist/esm/z-myz-card_4.entry.js +2 -2
  63. package/dist/esm/z-offcanvas.entry.js +53 -0
  64. package/dist/esm/z-searchbar.entry.js +13 -4
  65. package/dist/esm/z-stepper-item.entry.js +1 -1
  66. package/dist/esm/z-toggle-button.entry.js +4 -2
  67. package/dist/types/components/buttons/z-button-sort/index.d.ts +2 -2
  68. package/dist/types/components/buttons/z-chip/index.d.ts +2 -0
  69. package/dist/types/components/buttons/z-toggle-button/index.d.ts +2 -0
  70. package/dist/types/components/inputs/z-searchbar/index.d.ts +7 -1
  71. package/dist/types/components/modal/z-modal/index.d.ts +4 -0
  72. package/dist/types/components/navigation/z-app-header/index.d.ts +2 -4
  73. package/dist/types/components/navigation/z-menu/index.d.ts +13 -5
  74. package/dist/types/components/navigation/z-menu-section/index.d.ts +9 -3
  75. package/dist/types/components/notification/z-toast-notification/index.d.ts +1 -1
  76. package/dist/types/components/z-card/index.d.ts +9 -0
  77. package/dist/types/components/z-offcanvas/index.d.ts +4 -1
  78. package/dist/types/components.d.ts +65 -17
  79. package/dist/types/snowflakes/myz/card/z-myz-card-footer/index.d.ts +2 -0
  80. package/dist/web-components-library/p-068951a7.entry.js +1 -0
  81. package/dist/web-components-library/p-06b7dad4.entry.js +1 -0
  82. package/dist/web-components-library/{p-417b1b6c.entry.js → p-10adc1fa.entry.js} +1 -1
  83. package/dist/web-components-library/p-1570917d.entry.js +1 -0
  84. package/dist/web-components-library/p-157aea3b.entry.js +1 -0
  85. package/dist/web-components-library/p-1c8e7c24.entry.js +1 -0
  86. package/dist/web-components-library/p-20682781.entry.js +1 -0
  87. package/dist/web-components-library/{p-ede9fbf5.entry.js → p-6736e894.entry.js} +1 -1
  88. package/dist/web-components-library/{p-810bd730.entry.js → p-9db2bf11.entry.js} +1 -1
  89. package/dist/web-components-library/p-af283478.entry.js +1 -0
  90. package/dist/web-components-library/p-c722c5a4.entry.js +1 -0
  91. package/dist/web-components-library/p-d0760bb1.entry.js +1 -0
  92. package/dist/web-components-library/p-deda8776.entry.js +1 -0
  93. package/dist/web-components-library/p-f3a8cc14.entry.js +1 -0
  94. package/dist/web-components-library/{p-05ced71c.entry.js → p-f5a99b28.entry.js} +1 -1
  95. package/dist/web-components-library/{p-c081e1f4.entry.js → p-f9f42d17.entry.js} +1 -1
  96. package/dist/web-components-library/web-components-library.css +1 -1
  97. package/dist/web-components-library/web-components-library.esm.js +1 -1
  98. package/package.json +2 -3
  99. package/readme.md +0 -1
  100. package/www/build/p-068951a7.entry.js +1 -0
  101. package/www/build/p-06b7dad4.entry.js +1 -0
  102. package/www/build/{p-417b1b6c.entry.js → p-10adc1fa.entry.js} +1 -1
  103. package/www/build/p-1570917d.entry.js +1 -0
  104. package/www/build/p-157aea3b.entry.js +1 -0
  105. package/www/build/p-1c8e7c24.entry.js +1 -0
  106. package/www/build/p-20682781.entry.js +1 -0
  107. package/www/build/{p-ede9fbf5.entry.js → p-6736e894.entry.js} +1 -1
  108. package/www/build/p-77d28b14.js +1 -0
  109. package/www/build/{p-810bd730.entry.js → p-9db2bf11.entry.js} +1 -1
  110. package/www/build/p-ab4e13f7.css +1 -0
  111. package/www/build/p-af283478.entry.js +1 -0
  112. package/www/build/p-c722c5a4.entry.js +1 -0
  113. package/www/build/p-d0760bb1.entry.js +1 -0
  114. package/www/build/p-deda8776.entry.js +1 -0
  115. package/www/build/p-f3a8cc14.entry.js +1 -0
  116. package/www/build/{p-05ced71c.entry.js → p-f5a99b28.entry.js} +1 -1
  117. package/www/build/{p-c081e1f4.entry.js → p-f9f42d17.entry.js} +1 -1
  118. package/www/build/web-components-library.css +1 -1
  119. package/www/build/web-components-library.esm.js +1 -1
  120. package/www/index.html +1 -37
  121. package/CHANGELOG.md +0 -2337
  122. package/dist/cjs/z-app-header.cjs.entry.js +0 -133
  123. package/dist/cjs/z-button_3.cjs.entry.js +0 -108
  124. package/dist/esm/z-app-header.entry.js +0 -129
  125. package/dist/esm/z-button_3.entry.js +0 -102
  126. package/dist/web-components-library/p-029e4fba.entry.js +0 -1
  127. package/dist/web-components-library/p-14a6abe4.entry.js +0 -1
  128. package/dist/web-components-library/p-19ca449e.entry.js +0 -1
  129. package/dist/web-components-library/p-3a9cc467.entry.js +0 -1
  130. package/dist/web-components-library/p-73d9489b.entry.js +0 -1
  131. package/dist/web-components-library/p-9d03a7d6.entry.js +0 -1
  132. package/dist/web-components-library/p-f158d205.entry.js +0 -1
  133. package/dist/web-components-library/p-f95cc914.entry.js +0 -1
  134. package/dist/web-components-library/p-fa4c203a.entry.js +0 -1
  135. package/dist/web-components-library/p-fffb14e1.entry.js +0 -1
  136. package/src-react/index.ts +0 -1
  137. package/www/build/p-029e4fba.entry.js +0 -1
  138. package/www/build/p-14a6abe4.entry.js +0 -1
  139. package/www/build/p-19ca449e.entry.js +0 -1
  140. package/www/build/p-275801c6.css +0 -1
  141. package/www/build/p-3a9cc467.entry.js +0 -1
  142. package/www/build/p-73d9489b.entry.js +0 -1
  143. package/www/build/p-811ee64f.js +0 -1
  144. package/www/build/p-9d03a7d6.entry.js +0 -1
  145. package/www/build/p-f158d205.entry.js +0 -1
  146. package/www/build/p-f95cc914.entry.js +0 -1
  147. package/www/build/p-fa4c203a.entry.js +0 -1
  148. package/www/build/p-fffb14e1.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- :host > button {
1
+ :host > .z-chip-container {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  padding: 0 calc(var(--space-unit) * 1.5);
@@ -12,46 +12,53 @@
12
12
  font-weight: var(--font-sb);
13
13
  }
14
14
 
15
- :host > button:not(:disabled) > z-icon:last-child:hover {
15
+ :host > .z-chip-container:not([aria-disabled]) button > z-icon:last-child:hover {
16
16
  color: var(--color-hover-primary);
17
17
  fill: var(--color-hover-primary);
18
18
  }
19
19
 
20
- :host > button:hover:not(:disabled) > z-icon:first-child {
20
+ :host > .z-chip-container:hover:not([aria-disabled]) > z-icon:first-child {
21
21
  fill: var(--color-icon02);
22
22
  }
23
23
 
24
- :host > button > z-icon.icon-sx {
24
+ :host > .z-chip-container > button {
25
+ padding: 0;
26
+ border: none;
27
+ margin-left: var(--space-unit);
28
+ background-color: transparent;
29
+ cursor: pointer;
30
+ }
31
+
32
+ :host > .z-chip-container > z-icon.icon-sx {
25
33
  margin-right: calc(var(--space-unit) / 2);
26
34
  }
27
35
 
28
- :host > button > z-icon:last-child {
29
- margin-left: var(--space-unit);
30
- cursor: pointer;
36
+ :host > .z-chip-container > button > z-icon:last-child {
31
37
  fill: var(--color-primary01);
32
38
  }
33
39
 
34
- :host > button:disabled,
35
- :host > button:disabled > z-icon {
40
+ :host > .z-chip-container[aria-disabled],
41
+ :host > .z-chip-container[aria-disabled] > z-icon,
42
+ :host > .z-chip-container[aria-disabled] > button > z-icon {
36
43
  color: var(--color-disabled03);
37
44
  fill: var(--color-disabled03);
38
45
  }
39
46
 
40
- :host > button:disabled > z-icon {
47
+ :host > .z-chip-container[aria-disabled] > button > z-icon {
41
48
  cursor: auto;
42
49
  }
43
50
 
44
- :host > button:disabled {
51
+ :host > .z-chip-container[aria-disabled] {
45
52
  border: var(--border-size-small) solid var(--color-disabled01);
46
53
  }
47
54
 
48
- :host > button:focus:focus-visible,
49
- :host > div:focus:focus-visible {
55
+ :host > .z-chip-container > button:focus:focus-visible {
56
+ border-radius: 100%;
50
57
  box-shadow: var(--shadow-focus-primary);
51
58
  outline: none;
52
59
  }
53
60
 
54
- :host > button:hover:not(:disabled):active:hover > z-icon:last-child {
61
+ :host > button:hover:not(:disabled):active:hover > button > z-icon:last-child {
55
62
  color: var(--color-primary01);
56
63
  fill: var(--color-primary01);
57
64
  }
@@ -76,21 +83,21 @@
76
83
  }
77
84
 
78
85
  /* :host type */
79
- :host > button.default,
86
+ :host > .z-chip-container.default,
80
87
  :host > div.default {
81
88
  min-height: 44px;
82
89
  border-radius: 22px;
83
90
  line-height: 44px;
84
91
  }
85
92
 
86
- :host > button.medium,
93
+ :host > .z-chip-container.medium,
87
94
  :host > div.medium {
88
95
  min-height: 40px;
89
96
  border-radius: 22px;
90
97
  line-height: 40px;
91
98
  }
92
99
 
93
- :host > button.small,
100
+ :host > .z-chip-container.small,
94
101
  :host > div.small {
95
102
  min-height: 36px;
96
103
  border-radius: 22px;
@@ -99,7 +106,7 @@
99
106
 
100
107
  /* Desktop breakpoint */
101
108
  @media only screen and (min-width: 1152px) {
102
- :host > button {
109
+ :host > .z-chip-container {
103
110
  font-size: 12px;
104
111
  }
105
112
 
@@ -108,21 +115,21 @@
108
115
  }
109
116
 
110
117
  /* :host type */
111
- :host > button.default,
118
+ :host > .z-chip-container.default,
112
119
  :host > div.default {
113
120
  min-height: 32px;
114
121
  border-radius: 16px;
115
122
  line-height: 32px;
116
123
  }
117
124
 
118
- :host > button.medium,
125
+ :host > .z-chip-container.medium,
119
126
  :host > div.medium {
120
127
  min-height: 28px;
121
128
  border-radius: 16px;
122
129
  line-height: 28px;
123
130
  }
124
131
 
125
- :host > button.small,
132
+ :host > .z-chip-container.small,
126
133
  :host > div.small {
127
134
  min-height: 24px;
128
135
  border-radius: 16px;
@@ -5,6 +5,8 @@ export class ZToggleButton {
5
5
  this.isdisabled = false;
6
6
  /** open by default (optional) */
7
7
  this.opened = false;
8
+ /** aria-label for the button */
9
+ this.ariaLabel = "";
8
10
  }
9
11
  emitToggleClick() {
10
12
  if (this.isdisabled) {
@@ -17,7 +19,7 @@ export class ZToggleButton {
17
19
  return (h("button", { tabindex: this.avoidclick ? "-1" : "0", class: {
18
20
  "isopen": this.opened,
19
21
  "avoid-clicks": this.avoidclick,
20
- }, disabled: this.isdisabled, onClick: () => this.emitToggleClick() }, h("z-icon", { name: this.opened ? "chevron-down" : "chevron-up", width: 16, height: 16 }), this.label));
22
+ }, disabled: this.isdisabled, "aria-expanded": this.opened ? "true" : "false", "aria-label": this.ariaLabel, onClick: () => this.emitToggleClick() }, h("z-icon", { name: this.opened ? "chevron-down" : "chevron-up", width: 16, height: 16 }), this.label));
21
23
  }
22
24
  static get is() { return "z-toggle-button"; }
23
25
  static get encapsulation() { return "shadow"; }
@@ -102,6 +104,24 @@ export class ZToggleButton {
102
104
  "attribute": "opened",
103
105
  "reflect": false,
104
106
  "defaultValue": "false"
107
+ },
108
+ "ariaLabel": {
109
+ "type": "string",
110
+ "mutable": false,
111
+ "complexType": {
112
+ "original": "string",
113
+ "resolved": "string",
114
+ "references": {}
115
+ },
116
+ "required": false,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": "aria-label for the button"
121
+ },
122
+ "attribute": "aria-label",
123
+ "reflect": false,
124
+ "defaultValue": "\"\""
105
125
  }
106
126
  };
107
127
  }
@@ -15,7 +15,6 @@ button {
15
15
  font-weight: var(--font-sb);
16
16
  outline: none;
17
17
  text-transform: uppercase;
18
- transition: all 200ms linear;
19
18
  }
20
19
 
21
20
  button::-moz-focus-inner {
@@ -28,8 +27,7 @@ button:hover {
28
27
  }
29
28
 
30
29
  button:focus {
31
- border-color: var(--myz-blue);
32
- box-shadow: 0 0 2px 2px var(--accent-dark);
30
+ box-shadow: var(--shadow-focus-primary);
33
31
  color: var(--myz-blue);
34
32
  fill: var(--myz-blue);
35
33
  }
@@ -78,7 +78,7 @@
78
78
  }
79
79
 
80
80
  :host(:not([disabled]):focus-within) .indicator {
81
- box-shadow: 0 0 2px 2px var(--accent-dark);
81
+ box-shadow: var(--shadow-focus-primary);
82
82
  }
83
83
 
84
84
  :host([disabled]) .indicator {
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { ButtonVariant, ListDividerType } from "../../../beans";
2
+ import { ButtonVariant, ListDividerType, ControlSize, } from "../../../beans";
3
3
  import { handleEnterKeydSubmit, randomId } from "../../../utils/utils";
4
4
  /**
5
5
  * @cssprop --z-searchbar-results-height - Max height of the results container (default: 540px)
@@ -22,6 +22,12 @@ export class ZSearchbar {
22
22
  this.sortResultsItems = false;
23
23
  /** Show submit button */
24
24
  this.showSearchButton = false;
25
+ /** Set button icon without label*/
26
+ this.searchButtonIconOnly = false;
27
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
28
+ this.size = ControlSize.BIG;
29
+ /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
30
+ this.variant = ButtonVariant.PRIMARY;
25
31
  this.searchString = "";
26
32
  this.currResultsCount = 0;
27
33
  this.showResults = false;
@@ -134,13 +140,16 @@ export class ZSearchbar {
134
140
  renderInput() {
135
141
  return (h("z-input", { ref: (val) => {
136
142
  this.inputRef = val;
137
- }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value }));
143
+ }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value, size: this.size }));
138
144
  }
139
145
  renderButton() {
140
146
  if (!this.showSearchButton) {
141
147
  return null;
142
148
  }
143
- return (h("z-button", { disabled: this.preventSubmit, variant: ButtonVariant.PRIMARY, onClick: () => this.handleSubmit() }, "CERCA"));
149
+ const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
150
+ const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
151
+ const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
152
+ return h("z-button", Object.assign({}, defaultProps), buttonLabel);
144
153
  }
145
154
  renderResults() {
146
155
  if (!this.showResults ||
@@ -448,6 +457,70 @@ export class ZSearchbar {
448
457
  "attribute": "show-search-button",
449
458
  "reflect": false,
450
459
  "defaultValue": "false"
460
+ },
461
+ "searchButtonIconOnly": {
462
+ "type": "boolean",
463
+ "mutable": false,
464
+ "complexType": {
465
+ "original": "boolean",
466
+ "resolved": "boolean",
467
+ "references": {}
468
+ },
469
+ "required": false,
470
+ "optional": true,
471
+ "docs": {
472
+ "tags": [],
473
+ "text": "Set button icon without label"
474
+ },
475
+ "attribute": "search-button-icon-only",
476
+ "reflect": false,
477
+ "defaultValue": "false"
478
+ },
479
+ "size": {
480
+ "type": "string",
481
+ "mutable": false,
482
+ "complexType": {
483
+ "original": "ControlSize",
484
+ "resolved": "ControlSize.BIG | ControlSize.SMALL | ControlSize.X_SMALL",
485
+ "references": {
486
+ "ControlSize": {
487
+ "location": "import",
488
+ "path": "../../../beans"
489
+ }
490
+ }
491
+ },
492
+ "required": false,
493
+ "optional": true,
494
+ "docs": {
495
+ "tags": [],
496
+ "text": "Available sizes: `big`, `small` and `x-small`. Defaults to `big`."
497
+ },
498
+ "attribute": "size",
499
+ "reflect": false,
500
+ "defaultValue": "ControlSize.BIG"
501
+ },
502
+ "variant": {
503
+ "type": "string",
504
+ "mutable": false,
505
+ "complexType": {
506
+ "original": "ButtonVariant",
507
+ "resolved": "ButtonVariant.DARK_BG | ButtonVariant.PRIMARY | ButtonVariant.SECONDARY | ButtonVariant.TERTIARY",
508
+ "references": {
509
+ "ButtonVariant": {
510
+ "location": "import",
511
+ "path": "../../../beans"
512
+ }
513
+ }
514
+ },
515
+ "required": false,
516
+ "optional": true,
517
+ "docs": {
518
+ "tags": [],
519
+ "text": "Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`."
520
+ },
521
+ "attribute": "variant",
522
+ "reflect": false,
523
+ "defaultValue": "ButtonVariant.PRIMARY"
451
524
  }
452
525
  };
453
526
  }
@@ -209,3 +209,26 @@
209
209
  line-height: var(--font-size-6);
210
210
  }
211
211
  }
212
+
213
+ :host([size="small"]) > div > div.results-wrapper > div.results .item,
214
+ :host([size="x-small"]) > div > div.results-wrapper > div.results .item,
215
+ :host([size="small"]) > div > div.results-wrapper > div.results .category-heading,
216
+ :host([size="x-small"]) > div > div.results-wrapper > div.results .category-heading {
217
+ font-size: var(--font-size-2);
218
+ }
219
+
220
+ :host([size="small"]) > div > div.results-wrapper > div.results .item:not(.has-category),
221
+ :host([size="x-small"]) > div > div.results-wrapper > div.results .item:not(.has-category) {
222
+ --z-icon-height: 16px;
223
+ --z-icon-width: 16px;
224
+ }
225
+
226
+ :host([size="small"])::part(list-item-container) {
227
+ min-height: calc(var(--space-unit) * 4.5);
228
+ padding: 0;
229
+ }
230
+
231
+ :host([size="x-small"])::part(list-item-container) {
232
+ min-height: calc(var(--space-unit) * 4);
233
+ padding: 0;
234
+ }
@@ -158,7 +158,7 @@ export class ZListElement {
158
158
  }
159
159
  }
160
160
  render() {
161
- return (h(Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}` }, h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === ListDividerType.ELEMENT && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
161
+ return (h(Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}`, part: "list-item-container" }, h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === ListDividerType.ELEMENT && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
162
162
  }
163
163
  static get is() { return "z-list-element"; }
164
164
  static get encapsulation() { return "shadow"; }
@@ -11,15 +11,21 @@ export class ZModal {
11
11
  this.closeButtonLabel = "chiudi modale";
12
12
  /** add role "alertdialog" to dialog (optional, default is false) */
13
13
  this.alertdialog = false;
14
+ /** if true, the modal is closable (optional, default is true) */
15
+ this.closable = true;
14
16
  }
15
17
  emitModalClose() {
16
- this.modalClose.emit({ modalid: this.modalid });
18
+ if (this.closable) {
19
+ this.modalClose.emit({ modalid: this.modalid });
20
+ }
17
21
  }
18
22
  emitModalHeaderActive() {
19
23
  this.modalHeaderActive.emit({ modalid: this.modalid });
20
24
  }
21
25
  emitBackgroundClick() {
22
- this.modalBackgroundClick.emit({ modalid: this.modalid });
26
+ if (this.closable) {
27
+ this.modalBackgroundClick.emit({ modalid: this.modalid });
28
+ }
23
29
  }
24
30
  componentDidLoad() {
25
31
  this.open();
@@ -32,7 +38,9 @@ export class ZModal {
32
38
  /** close modal */
33
39
  async close() {
34
40
  var _a;
35
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
41
+ if (this.closable) {
42
+ (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
43
+ }
36
44
  }
37
45
  /**
38
46
  * Get a list of focusable elements in the dialog.
@@ -67,8 +75,21 @@ export class ZModal {
67
75
  firstFocusableElement.focus();
68
76
  }
69
77
  }
78
+ closeButtonSlot() {
79
+ if (this.closable) {
80
+ return (h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" }))));
81
+ }
82
+ }
83
+ handleEscape(e) {
84
+ if (this.closable) {
85
+ return;
86
+ }
87
+ e.preventDefault();
88
+ }
70
89
  render() {
71
- return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose() }, h("div", { class: "modal-container", id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" })))), h("div", { class: "modal-content", id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
90
+ return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose(),
91
+ // @ts-ignore
92
+ onCancel: (e) => this.handleEscape(e) }, h("div", { class: "modal-container", id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), this.closeButtonSlot()), h("div", { class: "modal-content", id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
72
93
  this.emitBackgroundClick();
73
94
  this.close();
74
95
  } })));
@@ -173,6 +194,24 @@ export class ZModal {
173
194
  "attribute": "alertdialog",
174
195
  "reflect": false,
175
196
  "defaultValue": "false"
197
+ },
198
+ "closable": {
199
+ "type": "boolean",
200
+ "mutable": false,
201
+ "complexType": {
202
+ "original": "boolean",
203
+ "resolved": "boolean",
204
+ "references": {}
205
+ },
206
+ "required": false,
207
+ "optional": true,
208
+ "docs": {
209
+ "tags": [],
210
+ "text": "if true, the modal is closable (optional, default is true)"
211
+ },
212
+ "attribute": "closable",
213
+ "reflect": false,
214
+ "defaultValue": "true"
176
215
  }
177
216
  };
178
217
  }
@@ -68,8 +68,6 @@ export class ZAppHeader {
68
68
  * - auto: the menu bar is positioned near the title
69
69
  * - stack: the menu bar is positioned below the title
70
70
  * - offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu
71
- *
72
- * **Optional**
73
71
  */
74
72
  this.flow = "auto";
75
73
  /**
@@ -88,11 +86,17 @@ export class ZAppHeader {
88
86
  });
89
87
  this.openDrawer = this.openDrawer.bind(this);
90
88
  this.closeDrawer = this.closeDrawer.bind(this);
91
- this.collectMenuElements.bind(this);
89
+ this.collectMenuElements = this.collectMenuElements.bind(this);
92
90
  }
93
91
  emitStickingEvent() {
94
92
  this.sticking.emit(this._stuck);
95
93
  }
94
+ openDrawer() {
95
+ this.drawerOpen = true;
96
+ }
97
+ closeDrawer() {
98
+ this.drawerOpen = false;
99
+ }
96
100
  componentDidLoad() {
97
101
  this.collectMenuElements();
98
102
  this.onStuckMode();
@@ -147,19 +151,14 @@ export class ZAppHeader {
147
151
  return;
148
152
  }
149
153
  const elements = this.menuElements;
150
- for (let i = 0, len = elements.length; i < len; i++) {
151
- elements[i].open = false;
152
- elements[i].floating = !this.drawerOpen;
153
- }
154
+ elements.forEach((element) => {
155
+ element.open = false;
156
+ element.floating = !this.drawerOpen;
157
+ element.verticalContext = this.drawerOpen;
158
+ });
154
159
  }
155
160
  render() {
156
- return (h(Host, { "menu-length": this.menuLength }, h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, h("div", { class: "hero-container" }, h("slot", { name: "hero" }, this.hero && (h("img", { alt: "", src: this.hero })))), h("div", { class: "heading-container" }, h("div", { class: "heading-title" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("slot", { name: "title" })), h("div", { class: "heading-subtitle" }, h("slot", { name: "subtitle" }))), h("div", { class: "menu-container" }, !this.drawerOpen && this.flow !== "offcanvas" && (h("slot", { name: "menu", onSlotchange: () => this.collectMenuElements() })))), h("div", { class: "drawer-container" }, h("div", { class: "drawer-overlay", onClick: this.closeDrawer }), h("div", { class: "drawer-panel" }, h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content" }, this.drawerOpen && (h("slot", { name: "menu", onSlotchange: () => this.collectMenuElements() }))))), this._stuck && (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("div", { class: "heading-title" }, h("slot", { name: "stucked-title" }, this.title)))))));
157
- }
158
- openDrawer() {
159
- this.drawerOpen = true;
160
- }
161
- closeDrawer() {
162
- this.drawerOpen = false;
161
+ return (h(Host, { "menu-length": this.menuLength }, h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, h("div", { class: "hero-container" }, h("slot", { name: "hero" }, this.hero && (h("img", { alt: "", src: this.hero })))), h("div", { class: "heading-container" }, h("div", { class: "heading-title" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("slot", { name: "title" })), h("div", { class: "heading-subtitle" }, h("slot", { name: "subtitle" }))), h("div", { class: "menu-container" }, !this.drawerOpen && this.flow !== "offcanvas" && (h("slot", { name: "menu", onSlotchange: this.collectMenuElements })))), h("div", { class: "drawer-container" }, h("div", { class: "drawer-overlay", onClick: this.closeDrawer }), h("div", { class: "drawer-panel" }, h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content" }, this.drawerOpen && (h("slot", { name: "menu", onSlotchange: this.collectMenuElements }))))), this._stuck && (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("div", { class: "heading-title" }, h("slot", { name: "stucked-title" }, this.title)))))));
163
162
  }
164
163
  static get is() { return "z-app-header"; }
165
164
  static get encapsulation() { return "shadow"; }
@@ -240,7 +239,7 @@ export class ZAppHeader {
240
239
  "optional": false,
241
240
  "docs": {
242
241
  "tags": [],
243
- "text": "Control menu bar position in the header.\n- auto: the menu bar is positioned near the title\n- stack: the menu bar is positioned below the title\n- offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu\n\n**Optional**"
242
+ "text": "Control menu bar position in the header.\n- auto: the menu bar is positioned near the title\n- stack: the menu bar is positioned below the title\n- offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu"
244
243
  },
245
244
  "attribute": "flow",
246
245
  "reflect": true,
@@ -38,9 +38,8 @@
38
38
  --app-header-typography-11-tracking: calc(-2.2 / 1em);
39
39
  --app-header-typography-12-tracking: calc(-2.4 / 1em);
40
40
 
41
- /**
42
- * Variable to set stuck header and drawer's top offset. Useful when something is absolutely positioned above the header.
43
- */
41
+ /* Variable to set stuck header and drawer's top offset.
42
+ Useful when something is absolutely positioned above the header. */
44
43
  --app-header-top-offset: 48px;
45
44
  --app-header-drawer-trigger-size: calc(var(--space-unit) * 4);
46
45
 
@@ -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
  }