@zanichelli/albe-web-components 18.2.1 → 18.3.1-rc1

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 (80) hide show
  1. package/CHANGELOG.md +2 -0
  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-anchor-navigation.cjs.entry.js +2 -1
  5. package/dist/cjs/z-anchor-navigation.cjs.entry.js.map +1 -1
  6. package/dist/cjs/z-book-card-app.cjs.entry.js +1 -1
  7. package/dist/cjs/z-book-card-app.cjs.entry.js.map +1 -1
  8. package/dist/cjs/z-book-card.cjs.entry.js +1 -1
  9. package/dist/cjs/z-book-card.cjs.entry.js.map +1 -1
  10. package/dist/cjs/z-toast-notification.cjs.entry.js +7 -43
  11. package/dist/cjs/z-toast-notification.cjs.entry.js.map +1 -1
  12. package/dist/collection/components/z-anchor-navigation/index.js +20 -1
  13. package/dist/collection/components/z-anchor-navigation/index.js.map +1 -1
  14. package/dist/collection/components/z-anchor-navigation/index.stories.js +6 -1
  15. package/dist/collection/components/z-anchor-navigation/index.stories.js.map +1 -1
  16. package/dist/collection/components/z-toast-notification/index.js +7 -43
  17. package/dist/collection/components/z-toast-notification/index.js.map +1 -1
  18. package/dist/collection/components/z-toast-notification/index.stories.js +30 -2
  19. package/dist/collection/components/z-toast-notification/index.stories.js.map +1 -1
  20. package/dist/collection/components/z-toast-notification/styles.css +25 -34
  21. package/dist/collection/tokens/typography.css +88 -0
  22. package/dist/components/z-anchor-navigation.js +3 -1
  23. package/dist/components/z-anchor-navigation.js.map +1 -1
  24. package/dist/components/z-book-card-app.js +1 -1
  25. package/dist/components/z-book-card-app.js.map +1 -1
  26. package/dist/components/z-book-card.js +1 -1
  27. package/dist/components/z-book-card.js.map +1 -1
  28. package/dist/components/z-toast-notification.js +8 -44
  29. package/dist/components/z-toast-notification.js.map +1 -1
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/esm/web-components-library.js +1 -1
  32. package/dist/esm/z-anchor-navigation.entry.js +2 -1
  33. package/dist/esm/z-anchor-navigation.entry.js.map +1 -1
  34. package/dist/esm/z-book-card-app.entry.js +1 -1
  35. package/dist/esm/z-book-card-app.entry.js.map +1 -1
  36. package/dist/esm/z-book-card.entry.js +1 -1
  37. package/dist/esm/z-book-card.entry.js.map +1 -1
  38. package/dist/esm/z-toast-notification.entry.js +8 -44
  39. package/dist/esm/z-toast-notification.entry.js.map +1 -1
  40. package/dist/types/components/z-anchor-navigation/index.d.ts +4 -0
  41. package/dist/types/components/z-anchor-navigation/index.stories.d.ts +1 -0
  42. package/dist/types/components/z-toast-notification/index.d.ts +1 -10
  43. package/dist/types/components/z-toast-notification/index.stories.d.ts +10 -2
  44. package/dist/types/components.d.ts +8 -0
  45. package/dist/web-components-library/p-1dd6dff4.entry.js +7 -0
  46. package/dist/web-components-library/p-1dd6dff4.entry.js.map +1 -0
  47. package/dist/web-components-library/{p-82d52ee6.entry.js → p-1ef90472.entry.js} +2 -2
  48. package/dist/web-components-library/p-1ef90472.entry.js.map +1 -0
  49. package/dist/web-components-library/{p-6a6d30ae.entry.js → p-a3860bef.entry.js} +2 -2
  50. package/dist/web-components-library/p-a3860bef.entry.js.map +1 -0
  51. package/dist/web-components-library/{p-64f5da5f.entry.js → p-b0856b23.entry.js} +2 -2
  52. package/dist/web-components-library/p-b0856b23.entry.js.map +1 -0
  53. package/dist/web-components-library/web-components-library.css +88 -0
  54. package/dist/web-components-library/web-components-library.esm.js +1 -1
  55. package/dist/web-components-library/web-components-library.esm.js.map +1 -1
  56. package/package.json +1 -1
  57. package/www/build/p-1dd6dff4.entry.js +7 -0
  58. package/www/build/p-1dd6dff4.entry.js.map +1 -0
  59. package/www/build/{p-82d52ee6.entry.js → p-1ef90472.entry.js} +2 -2
  60. package/www/build/p-1ef90472.entry.js.map +1 -0
  61. package/www/build/{p-11df33c9.js → p-28efbaa8.js} +1 -1
  62. package/www/build/{p-4f4ec223.css → p-56d35027.css} +88 -0
  63. package/www/build/{p-6a6d30ae.entry.js → p-a3860bef.entry.js} +2 -2
  64. package/www/build/p-a3860bef.entry.js.map +1 -0
  65. package/www/build/{p-64f5da5f.entry.js → p-b0856b23.entry.js} +2 -2
  66. package/www/build/p-b0856b23.entry.js.map +1 -0
  67. package/www/build/web-components-library.css +88 -0
  68. package/www/build/web-components-library.esm.js +1 -1
  69. package/www/build/web-components-library.esm.js.map +1 -1
  70. package/www/index.html +1 -1
  71. package/dist/web-components-library/p-64f5da5f.entry.js.map +0 -1
  72. package/dist/web-components-library/p-6a6d30ae.entry.js.map +0 -1
  73. package/dist/web-components-library/p-72c07bbd.entry.js +0 -7
  74. package/dist/web-components-library/p-72c07bbd.entry.js.map +0 -1
  75. package/dist/web-components-library/p-82d52ee6.entry.js.map +0 -1
  76. package/www/build/p-64f5da5f.entry.js.map +0 -1
  77. package/www/build/p-6a6d30ae.entry.js.map +0 -1
  78. package/www/build/p-72c07bbd.entry.js +0 -7
  79. package/www/build/p-72c07bbd.entry.js.map +0 -1
  80. package/www/build/p-82d52ee6.entry.js.map +0 -1
@@ -19,6 +19,7 @@ export class ZAnchorNavigation {
19
19
  constructor() {
20
20
  this.hideUnselected = false;
21
21
  this.autoCurrent = true;
22
+ this.collapsedLabel = "salta a";
22
23
  this.collapsed = false;
23
24
  }
24
25
  /**
@@ -49,7 +50,7 @@ export class ZAnchorNavigation {
49
50
  window.removeEventListener("hashchange", this.setCurrent);
50
51
  }
51
52
  render() {
52
- return (h(Host, { key: '21559cd97e3c519b4b09f5c820200db11cd46fea', collapsed: this.collapsed }, h("z-button", { key: '5e64a3ddca23ea019ccdec281fd352d118b689d6', class: "toggle", variant: ButtonVariant.SECONDARY, icon: this.collapsed ? "chevron-up" : "chevron-down", onClick: this.toggleCollapsed.bind(this) }, "salta a"), h("nav", { key: 'c0be356bcf89ee170536187e0aab628f9463373f', ref: (el) => (this.nav = el) }, h("slot", { key: '833fa42dbc67db1987de137de8a2f3217cc5142b' }))));
53
+ return (h(Host, { key: '3a2bc3f92ecf223c95987e33c48e14bb03909fac', collapsed: this.collapsed }, h("z-button", { key: '5d88809c9fcc1a1ea1d163c3111367038da64f19', class: "toggle", variant: ButtonVariant.SECONDARY, icon: this.collapsed ? "chevron-up" : "chevron-down", onClick: this.toggleCollapsed.bind(this) }, this.collapsedLabel), h("nav", { key: '9f9eabbc84d1fe9ef578cc44b2a73d871c658ab5', ref: (el) => (this.nav = el) }, h("slot", { key: '44a486e2caa4b56f8556494f6fd8c4da8e076e7e' }))));
53
54
  }
54
55
  static get is() { return "z-anchor-navigation"; }
55
56
  static get originalStyleUrls() {
@@ -99,6 +100,24 @@ export class ZAnchorNavigation {
99
100
  "attribute": "auto-current",
100
101
  "reflect": false,
101
102
  "defaultValue": "true"
103
+ },
104
+ "collapsedLabel": {
105
+ "type": "string",
106
+ "mutable": false,
107
+ "complexType": {
108
+ "original": "string",
109
+ "resolved": "string",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": "Sets the label of the button displayed on mobile viewport when the anchor navigation is collapsed"
117
+ },
118
+ "attribute": "collapsed-label",
119
+ "reflect": false,
120
+ "defaultValue": "\"salta a\""
102
121
  }
103
122
  };
104
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-anchor-navigation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,iBAAiB;;8BAMX,KAAK;2BASR,IAAI;yBAMN,KAAK;;IAOjB;;OAEG;IACK,UAAU;QAChB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,C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I,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,EACpD,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,cAG/B;YACX,4DAAK,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;gBAC/B,8DAAa,CACT,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Host, Prop, State} from \"@stencil/core\";\nimport {ButtonVariant} from \"../../beans\";\n\n/**\n * Anchor navigation component.\n * @slot - Anchor navigation items. Use `<a>` elements inside. If you need an extra action element, use a wrapper around it and the anchor.\n * @example\n * ```\n * <z-anchor-navigation>\n * <div>\n * <a href=\"#section-id\">Section name</a>\n * <button type=\"button\">\n * <z-icon name=\"share\" />\n * </button>\n * </div>\n * </z-anchor-navigation>\n * ```\n */\n@Component({\n tag: \"z-anchor-navigation\",\n styleUrl: \"styles.css\",\n shadow: false,\n})\nexport class ZAnchorNavigation {\n /**\n * If enabled, the text of each anchor will be hidden unless\n * for the current one or the one the user is hovering.\n */\n @Prop({reflect: true})\n hideUnselected = false;\n\n /**\n * Enables automatic inference of the current item, listening for hash change\n * and checking the `href` of the slotted anchors.\n * When disabled, the highlight of current item must be handled manually by setting the `data-current`\n * attribute to the correct slotted items and the `aria-current` attribute to the anchors.\n */\n @Prop()\n autoCurrent = true;\n\n /**\n * Whether the mobile list is collapsed.\n */\n @State()\n collapsed = false;\n\n @Element() host: HTMLZAnchorNavigationElement;\n\n /** Reference to the nav element. */\n private nav: HTMLElement;\n\n /**\n * Set `aria-current` attribute to the anchors.\n */\n private setCurrent(): void {\n const currentElement = Array.from(this.nav.querySelectorAll(\"a\")).find(\n (anchor) => anchor.href === this.host.ownerDocument.location.href\n );\n Array.from(this.nav.children).forEach((item) => {\n const anchor = item instanceof HTMLAnchorElement ? item : item.querySelector(\"a\");\n const isCurrent = anchor === currentElement;\n anchor.setAttribute(\"aria-current\", isCurrent.toString());\n item.toggleAttribute(\"data-current\", isCurrent);\n });\n }\n\n /**\n * Toggle collapsed state.\n */\n private toggleCollapsed(): void {\n this.collapsed = !this.collapsed;\n }\n\n componentDidLoad(): void {\n if (this.autoCurrent) {\n window.addEventListener(\"hashchange\", this.setCurrent.bind(this));\n this.setCurrent();\n }\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"hashchange\", this.setCurrent);\n }\n\n render(): HTMLZAnchorNavigationElement {\n return (\n <Host collapsed={this.collapsed}>\n <z-button\n class=\"toggle\"\n variant={ButtonVariant.SECONDARY}\n icon={this.collapsed ? \"chevron-up\" : \"chevron-down\"}\n onClick={this.toggleCollapsed.bind(this)}\n >\n salta a\n </z-button>\n <nav ref={(el) => (this.nav = el)}>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-anchor-navigation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,iBAAiB;;8BAMX,KAAK;2BASR,IAAI;8BAMD,SAAS;yBAMd,KAAK;;IAOjB;;OAEG;IACK,UAAU;QAChB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACpE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAClE,CAAC;QACF,KAAK,CAAC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E,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;gBAC/B,8DAAa,CACT,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Host, Prop, State} from \"@stencil/core\";\nimport {ButtonVariant} from \"../../beans\";\n\n/**\n * Anchor navigation component.\n * @slot - Anchor navigation items. Use `<a>` elements inside. If you need an extra action element, use a wrapper around it and the anchor.\n * @example\n * ```\n * <z-anchor-navigation>\n * <div>\n * <a href=\"#section-id\">Section name</a>\n * <button type=\"button\">\n * <z-icon name=\"share\" />\n * </button>\n * </div>\n * </z-anchor-navigation>\n * ```\n */\n@Component({\n tag: \"z-anchor-navigation\",\n styleUrl: \"styles.css\",\n shadow: false,\n})\nexport class ZAnchorNavigation {\n /**\n * If enabled, the text of each anchor will be hidden unless\n * for the current one or the one the user is hovering.\n */\n @Prop({reflect: true})\n hideUnselected = false;\n\n /**\n * Enables automatic inference of the current item, listening for hash change\n * and checking the `href` of the slotted anchors.\n * When disabled, the highlight of current item must be handled manually by setting the `data-current`\n * attribute to the correct slotted items and the `aria-current` attribute to the anchors.\n */\n @Prop()\n autoCurrent = true;\n\n /**\n * Sets the label of the button displayed on mobile viewport when the anchor navigation is collapsed\n */\n @Prop()\n collapsedLabel = \"salta a\";\n\n /**\n * Whether the mobile list is collapsed.\n */\n @State()\n collapsed = false;\n\n @Element() host: HTMLZAnchorNavigationElement;\n\n /** Reference to the nav element. */\n private nav: HTMLElement;\n\n /**\n * Set `aria-current` attribute to the anchors.\n */\n private setCurrent(): void {\n const currentElement = Array.from(this.nav.querySelectorAll(\"a\")).find(\n (anchor) => anchor.href === this.host.ownerDocument.location.href\n );\n Array.from(this.nav.children).forEach((item) => {\n const anchor = item instanceof HTMLAnchorElement ? item : item.querySelector(\"a\");\n const isCurrent = anchor === currentElement;\n anchor.setAttribute(\"aria-current\", isCurrent.toString());\n item.toggleAttribute(\"data-current\", isCurrent);\n });\n }\n\n /**\n * Toggle collapsed state.\n */\n private toggleCollapsed(): void {\n this.collapsed = !this.collapsed;\n }\n\n componentDidLoad(): void {\n if (this.autoCurrent) {\n window.addEventListener(\"hashchange\", this.setCurrent.bind(this));\n this.setCurrent();\n }\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"hashchange\", this.setCurrent);\n }\n\n render(): HTMLZAnchorNavigationElement {\n return (\n <Host collapsed={this.collapsed}>\n <z-button\n class=\"toggle\"\n variant={ButtonVariant.SECONDARY}\n icon={this.collapsed ? \"chevron-up\" : \"chevron-down\"}\n onClick={this.toggleCollapsed.bind(this)}\n >\n {this.collapsedLabel}\n </z-button>\n <nav ref={(el) => (this.nav = el)}>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"]}
@@ -8,13 +8,17 @@ const StoryMeta = {
8
8
  component: "z-anchor-navigation",
9
9
  args: {
10
10
  hideUnselected: false,
11
+ collapsedLabel: "salta a",
11
12
  },
12
13
  };
13
14
  export default StoryMeta;
14
15
  export const Default = {
15
16
  render: (args) => html `
16
17
  <div class="z-anchor-navigation-story-wrapper">
17
- <z-anchor-navigation .hideUnselected=${args.hideUnselected}>
18
+ <z-anchor-navigation
19
+ collapsed-label=${args.collapsedLabel}
20
+ .hideUnselected=${args.hideUnselected}
21
+ >
18
22
  <div>
19
23
  <a
20
24
  href="#first-section"
@@ -213,6 +217,7 @@ export const AutoCurrentDisabling = {
213
217
  </div>
214
218
  <div class="z-anchor-navigation-story-wrapper">
215
219
  <z-anchor-navigation
220
+ collapsed-label=${args.collapsedLabel}
216
221
  .hideUnselected=${args.hideUnselected}
217
222
  .autoCurrent=${args.autoCurrent}
218
223
  >
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-anchor-navigation/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAE7B,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,qBAAqB;IAChC,IAAI,EAAE;QACJ,cAAc,EAAE,KAAK;KACtB;CACgC,CAAC;AAEpC,eAAe,SAAS,CAAC;AAEzB,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;6CAEqB,IAAI,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwI7D;CACoC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE;QACJ,WAAW,EAAE,KAAK;KACnB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,aAAa,CAAC;SACzB;KACF;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA+CE,IAAI,CAAC,cAAc;uBACtB,IAAI,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6HpC;CACoC,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport {ZAnchorNavigation} from \".\";\nimport \"../z-button/index\";\nimport \"../z-icon/index\";\nimport \"./index\";\nimport \"./index.stories.css\";\n\nconst StoryMeta = {\n title: \"ZAnchorNavigation\",\n component: \"z-anchor-navigation\",\n args: {\n hideUnselected: false,\n },\n} satisfies Meta<ZAnchorNavigation>;\n\nexport default StoryMeta;\n\nexport const Default = {\n render: (args) => html`\n <div class=\"z-anchor-navigation-story-wrapper\">\n <z-anchor-navigation .hideUnselected=${args.hideUnselected}>\n <div>\n <a\n href=\"#first-section\"\n target=\"_self\"\n >First section</a\n >\n <z-button\n variant=\"tertiary\"\n icon=\"share\"\n size=\"x-small\"\n ></z-button>\n </div>\n <div>\n <a\n href=\"#second-section\"\n target=\"_self\"\n >Second section</a\n >\n </div>\n <div>\n <a\n href=\"#third-section\"\n target=\"_self\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n <button\n type=\"button\"\n aria-label=\"share\"\n >\n <z-icon name=\"share\" />\n </button>\n </div>\n <a\n href=\"#fourth-section\"\n target=\"_self\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n </z-anchor-navigation>\n <div>\n <div\n class=\"section\"\n id=\"first-section\"\n >\n <h4>First section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"second-section\"\n >\n <h4>Second section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"third-section\"\n >\n <h4>Third section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"fourth-section\"\n >\n <h4>Fourth section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n </div>\n </div>\n `,\n} satisfies StoryObj<ZAnchorNavigation>;\n\n/**\n * Setting `autoCurrent` to `false` disables the automatic highlighting of the current section in the anchor navigation\n * and allows manual handling.\n * In this story, for example, the highlighting of the current section is done by clicking on the related button.\n */\nexport const AutoCurrentDisabling = {\n args: {\n autoCurrent: false,\n },\n parameters: {\n controls: {\n exclude: [\"autoCurrent\"],\n },\n },\n render: (args) => html`\n <script>\n Array.from(document.querySelectorAll(\".z-anchor-navigation-manual-current z-button\")).forEach((item) =>\n item.addEventListener(\"click\", (ev) => {\n const sectionID = ev.target.closest(\"z-button\")?.dataset.to;\n const current = document.querySelector(\"#\" + sectionID + \"-anchor\");\n const nav = current?.closest(\"nav\");\n Array.from(nav?.children ?? []).forEach((item) => {\n const isCurrent = item.contains(current);\n if (isCurrent) {\n item.setAttribute(\"data-current\", \"\");\n } else {\n item.removeAttribute(\"data-current\");\n }\n const anchor = item.tagName === \"A\" ? item : item.querySelector(\"a\");\n item?.setAttribute(\"aria-current\", isCurrent.toString());\n });\n const section = document.querySelector(\"#\" + sectionID);\n section?.scrollIntoView();\n })\n );\n </script>\n\n <div class=\"z-anchor-navigation-manual-current\">\n <z-button\n size=\"x-small\"\n data-to=\"first-section\"\n >To first section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"second-section\"\n >To second section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"third-section\"\n >To third section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"fourth-section\"\n >Highlight fourth section</z-button\n >\n </div>\n <div class=\"z-anchor-navigation-story-wrapper\">\n <z-anchor-navigation\n .hideUnselected=${args.hideUnselected}\n .autoCurrent=${args.autoCurrent}\n >\n <div>\n <a id=\"first-section-anchor\">First section</a>\n <z-button\n variant=\"tertiary\"\n icon=\"share\"\n size=\"x-small\"\n ></z-button>\n </div>\n <div>\n <a id=\"second-section-anchor\">Second section</a>\n </div>\n <div>\n <a id=\"third-section-anchor\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n <button\n type=\"button\"\n aria-label=\"share\"\n >\n <z-icon name=\"share\" />\n </button>\n </div>\n <a id=\"fourth-section-anchor\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n </z-anchor-navigation>\n <div class=\"z-anchor-navigation-demo-sections\">\n <div\n class=\"section\"\n id=\"first-section\"\n >\n <h4>First section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"second-section\"\n >\n <h4>Second section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"third-section\"\n >\n <h4>Third section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"fourth-section\"\n >\n <h4>Fourth section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n </div>\n </div>\n `,\n} satisfies StoryObj<ZAnchorNavigation>;\n"]}
1
+ {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-anchor-navigation/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAE7B,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,qBAAqB;IAChC,IAAI,EAAE;QACJ,cAAc,EAAE,KAAK;QACrB,cAAc,EAAE,SAAS;KAC1B;CACgC,CAAC;AAEpC,eAAe,SAAS,CAAC;AAEzB,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;;0BAGE,IAAI,CAAC,cAAc;0BACnB,IAAI,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyI1C;CACoC,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE;QACJ,WAAW,EAAE,KAAK;KACnB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EAAE,CAAC,aAAa,CAAC;SACzB;KACF;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA+CE,IAAI,CAAC,cAAc;0BACnB,IAAI,CAAC,cAAc;uBACtB,IAAI,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6HpC;CACoC,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html} from \"lit\";\nimport {ZAnchorNavigation} from \".\";\nimport \"../z-button/index\";\nimport \"../z-icon/index\";\nimport \"./index\";\nimport \"./index.stories.css\";\n\nconst StoryMeta = {\n title: \"ZAnchorNavigation\",\n component: \"z-anchor-navigation\",\n args: {\n hideUnselected: false,\n collapsedLabel: \"salta a\",\n },\n} satisfies Meta<ZAnchorNavigation>;\n\nexport default StoryMeta;\n\nexport const Default = {\n render: (args) => html`\n <div class=\"z-anchor-navigation-story-wrapper\">\n <z-anchor-navigation\n collapsed-label=${args.collapsedLabel}\n .hideUnselected=${args.hideUnselected}\n >\n <div>\n <a\n href=\"#first-section\"\n target=\"_self\"\n >First section</a\n >\n <z-button\n variant=\"tertiary\"\n icon=\"share\"\n size=\"x-small\"\n ></z-button>\n </div>\n <div>\n <a\n href=\"#second-section\"\n target=\"_self\"\n >Second section</a\n >\n </div>\n <div>\n <a\n href=\"#third-section\"\n target=\"_self\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n <button\n type=\"button\"\n aria-label=\"share\"\n >\n <z-icon name=\"share\" />\n </button>\n </div>\n <a\n href=\"#fourth-section\"\n target=\"_self\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n </z-anchor-navigation>\n <div>\n <div\n class=\"section\"\n id=\"first-section\"\n >\n <h4>First section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"second-section\"\n >\n <h4>Second section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"third-section\"\n >\n <h4>Third section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"fourth-section\"\n >\n <h4>Fourth section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n </div>\n </div>\n `,\n} satisfies StoryObj<ZAnchorNavigation>;\n\n/**\n * Setting `autoCurrent` to `false` disables the automatic highlighting of the current section in the anchor navigation\n * and allows manual handling.\n * In this story, for example, the highlighting of the current section is done by clicking on the related button.\n */\nexport const AutoCurrentDisabling = {\n args: {\n autoCurrent: false,\n },\n parameters: {\n controls: {\n exclude: [\"autoCurrent\"],\n },\n },\n render: (args) => html`\n <script>\n Array.from(document.querySelectorAll(\".z-anchor-navigation-manual-current z-button\")).forEach((item) =>\n item.addEventListener(\"click\", (ev) => {\n const sectionID = ev.target.closest(\"z-button\")?.dataset.to;\n const current = document.querySelector(\"#\" + sectionID + \"-anchor\");\n const nav = current?.closest(\"nav\");\n Array.from(nav?.children ?? []).forEach((item) => {\n const isCurrent = item.contains(current);\n if (isCurrent) {\n item.setAttribute(\"data-current\", \"\");\n } else {\n item.removeAttribute(\"data-current\");\n }\n const anchor = item.tagName === \"A\" ? item : item.querySelector(\"a\");\n item?.setAttribute(\"aria-current\", isCurrent.toString());\n });\n const section = document.querySelector(\"#\" + sectionID);\n section?.scrollIntoView();\n })\n );\n </script>\n\n <div class=\"z-anchor-navigation-manual-current\">\n <z-button\n size=\"x-small\"\n data-to=\"first-section\"\n >To first section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"second-section\"\n >To second section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"third-section\"\n >To third section</z-button\n >\n <z-button\n size=\"x-small\"\n data-to=\"fourth-section\"\n >Highlight fourth section</z-button\n >\n </div>\n <div class=\"z-anchor-navigation-story-wrapper\">\n <z-anchor-navigation\n collapsed-label=${args.collapsedLabel}\n .hideUnselected=${args.hideUnselected}\n .autoCurrent=${args.autoCurrent}\n >\n <div>\n <a id=\"first-section-anchor\">First section</a>\n <z-button\n variant=\"tertiary\"\n icon=\"share\"\n size=\"x-small\"\n ></z-button>\n </div>\n <div>\n <a id=\"second-section-anchor\">Second section</a>\n </div>\n <div>\n <a id=\"third-section-anchor\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n <button\n type=\"button\"\n aria-label=\"share\"\n >\n <z-icon name=\"share\" />\n </button>\n </div>\n <a id=\"fourth-section-anchor\"\n >Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n Third section with a very very long title and an icon and the title is repeated so it can go over 2 lines\n </a>\n </z-anchor-navigation>\n <div class=\"z-anchor-navigation-demo-sections\">\n <div\n class=\"section\"\n id=\"first-section\"\n >\n <h4>First section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"second-section\"\n >\n <h4>Second section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"third-section\"\n >\n <h4>Third section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n <div\n class=\"section\"\n id=\"fourth-section\"\n >\n <h4>Fourth section</h4>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quem enim ardorem studii censetis fuisse in\n Archimede, qui dum in pulvere quaedam describit attentius, ne patriam quidem captam esse senserit?\n Possumusne ergo in vita summum bonum dicere, cum id ne in cena quidem posse videamur? Morbo gravissimo\n affectus, exul, orbus, egens, torqueatur eculeo: quem hunc appellas, Zeno? Nam memini etiam quae nolo,\n oblivisci non possum quae volo. Nec vero sum nescius esse utilitatem in historia, non modo voluptatem. Duo\n Reges: constructio interrete. Plane idem, inquit, et maxima quidem, qua fieri nulla maior potest. Hoc autem\n loco tantum explicemus haec honesta, quae dico, praeterquam quod nosmet ipsos diligamus, praeterea suapte\n natura per se esse expetenda. Te enim iudicem aequum puto, modo quae dicat ille bene noris. Si enim Zenoni\n licuit, cum rem aliquam invenisset inusitatam, inauditum quoque ei rei nomen inponere, cur non liceat\n Catoni? Ita cum ea volunt retinere, quae superiori sententiae conveniunt, in Aristonem incidunt; Istam\n voluptatem perpetuam quis potest praestare sapienti? Urgent tamen et nihil remittunt. Sin te auctoritas\n commovebat, nobisne omnibus et Platoni ipsi nescio quem illum anteponebas? Stuprata per vim Lucretia a regis\n filio testata civis se ipsa interemit. Sin autem ad animum, falsum est, quod negas animi ullum esse gaudium,\n quod non referatur ad corpus.\n </p>\n </div>\n <div class=\"separator\"></div>\n </div>\n </div>\n `,\n} satisfies StoryObj<ZAnchorNavigation>;\n"]}
@@ -1,6 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { ToastNotificationTransition } from "../../beans";
3
- import { Breakpoints } from "../../constants/breakpoints";
2
+ import { KeyboardCode, ToastNotificationTransition } from "../../beans";
4
3
  import Hammer from "hammerjs";
5
4
  export class ZToastNotification {
6
5
  constructor() {
@@ -45,12 +44,10 @@ export class ZToastNotification {
45
44
  this.toastClose.emit();
46
45
  }
47
46
  componentWillLoad() {
48
- this.isMobile = window.innerWidth <= Breakpoints.MOBILE;
49
47
  this.validateAutoclose();
50
48
  this.percentage = 0;
51
49
  }
52
50
  componentDidLoad() {
53
- this.isTextLong = this.detectWrap() || this.toastText.offsetHeight > 20;
54
51
  this.startTime = Date.now();
55
52
  if (this.autoclose && this.pauseonfocusloss) {
56
53
  document.addEventListener("visibilitychange", this.visibilityChangeEventHandler);
@@ -131,56 +128,23 @@ export class ZToastNotification {
131
128
  startClosingTimeout(time) {
132
129
  this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);
133
130
  }
134
- detectWrap() {
135
- const parentWidth = this.container.offsetWidth;
136
- const children = this.container.children;
137
- let totalWidth = 0;
138
- for (let i = 0; i < children.length; i++) {
139
- totalWidth += children[i].offsetWidth;
140
- }
141
- return totalWidth > parentWidth;
142
- }
143
- renderText() {
144
- return (h("div", { id: "text", ref: (el) => (this.toastText = el) }, this.heading && h("span", { class: "title" }, this.heading), h("span", { class: "message" }, this.message)));
145
- }
146
- renderButton() {
147
- return (h("div", { id: "button" }, h("slot", { name: "button" })));
148
- }
149
- renderCloseIcon() {
150
- if (!this.closebutton) {
151
- return;
152
- }
153
- return (h("div", { id: "icon" }, h("z-icon", { tabIndex: 0, name: "multiply-circled", width: 15, height: 15, onClick: () => this.emitToastClose(this.mapSlideOutClass()), onKeyPress: (e) => {
154
- if (e.keyCode == 32 || e.keyCode == 13) {
131
+ renderContent() {
132
+ return (h("div", { id: "external-container", tabIndex: 0, class: { [this.type]: !!this.type } }, h("div", { id: "inner-container" }, h("div", { id: "text" }, this.heading && h("span", { class: "title" }, this.heading), h("span", { class: "message" }, this.message)), h("div", { id: "button" }, h("slot", { name: "button" }))), h("div", { id: "icon" }, this.closebutton && (h("z-icon", { tabIndex: 0, name: "multiply-circled", width: 15, height: 15, onClick: () => this.emitToastClose(this.mapSlideOutClass()), onKeyPress: (e) => {
133
+ if (e.code == KeyboardCode.SPACE || e.code == KeyboardCode.ENTER) {
155
134
  e.preventDefault();
156
135
  this.emitToastClose(this.mapSlideOutClass());
157
136
  }
158
- } })));
159
- }
160
- renderContainer() {
161
- return (h("div", { tabIndex: 0, id: "external-container", class: {
162
- [this.type]: !!this.type,
163
- "several-lines-padding": this.isTextLong,
164
- }, ref: (el) => (this.container = el) }, this.renderText(), this.renderButton(), this.renderCloseIcon()));
165
- }
166
- renderMobileContainer() {
167
- return (h("div", { id: "external-container", class: {
168
- [this.type]: !!this.type,
169
- "several-lines-padding": this.isTextLong,
170
- "mobile-wrapped": this.isTextLong,
171
- } }, h("div", { id: "flex-container", ref: (el) => (this.container = el) }, this.renderText(), this.renderButton()), this.renderCloseIcon()));
137
+ } })))));
172
138
  }
173
139
  render() {
174
- return (h(Host, { key: '1fcfaf1bf2d6d6701eabab75ef95d956e2886fb3', style: {
175
- "--percentuale": `${this.percentage}%`,
176
- }, class: this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN, onAnimationEnd: (e) => {
140
+ return (h(Host, { key: 'f9b4a2fe7d3642b1cbbe6f2e433ddbbde49568fd', style: { "--percentuale": `${this.percentage}%` }, class: this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN, onAnimationEnd: (e) => {
177
141
  if (this.autoclose && e.animationName.includes("slidein")) {
178
142
  this.startClosingTimeout(this.autoclose);
179
143
  }
180
144
  if (e.animationName.includes("slideout")) {
181
145
  this.hostElement.parentNode.removeChild(this.hostElement);
182
146
  }
183
- } }, this.isMobile ? this.renderMobileContainer() : this.renderContainer()));
147
+ } }, this.renderContent()));
184
148
  }
185
149
  static get is() { return "z-toast-notification"; }
186
150
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAExD,OAAO,MAAM,MAAM,UAAU,CAAC;AAO9B,MAAM,OAAO,kBAAkB;;QA0DrB,uBAAkB,GAAG,KAAK,CAAC;;;;;gCArCN,IAAI;;2BAQT,IAAI;mCAIG,EAAE;;;;IA4BjC,oBAAoB,CAAC,QAAiB;QACpC,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAGD,kBAAkB,CAAC,QAAgB;QACjC,YAAY,CAAC,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AAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC3C,CAAC;gBACD,IAAI,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;oBACzC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC,IAEA,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CACjE,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ToastNotification, ToastNotificationTransition} from \"../../beans\";\nimport {Breakpoints} from \"../../constants/breakpoints\";\n\nimport Hammer from \"hammerjs\";\n\n@Component({\n tag: \"z-toast-notification\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZToastNotification {\n @Element() hostElement: HTMLZToastNotificationElement;\n\n /** toast notification's title */\n @Prop()\n heading?: string;\n\n /** toast notification's message */\n @Prop()\n message: string;\n\n /** toggles closing button rendering */\n @Prop()\n closebutton: boolean;\n\n /** toast notification closing timeout (ms) */\n @Prop()\n autoclose?: number;\n\n /** toast notification autoclose can be paused */\n @Prop()\n pauseonfocusloss?: boolean = true;\n\n /** toast notification type: dark, light, accent, error, success, warning */\n @Prop()\n type?: ToastNotification;\n\n /** toast notification can be draggable*/\n @Prop()\n isdraggable?: boolean = true;\n\n /** toast notification draggable percentage*/\n @Prop()\n draggablepercentage?: number = 80;\n\n /** toast notification animation type: slide-in-left, slide-in-right, slide-in-down, slide-in-up*/\n @Prop()\n transition?: ToastNotificationTransition;\n\n @State()\n percentage: number;\n\n private isTextLong: boolean;\n\n private container!: HTMLElement;\n\n private toastText!: HTMLElement;\n\n private sliderManager: HammerManager;\n\n private elapsedTime: number;\n\n private timeoutHandle: number;\n\n private startTime: number;\n\n private isMobile: boolean;\n\n private isCloseEventCalled = false;\n\n @Watch(\"isdraggable\")\n watchPropIsdraggable(newValue: boolean): void {\n if (newValue) {\n this.sliderManager.get(\"pan\").set({enable: true});\n } else {\n this.sliderManager.get(\"pan\").set({enable: false});\n }\n }\n\n @Watch(\"autoclose\")\n watchPropAutoclose(newValue: number): void {\n clearTimeout(this.timeoutHandle);\n this.startClosingTimeout(newValue);\n }\n\n @Watch(\"pauseonfocusloss\")\n watchPropPauseonfocusloss(newValue: boolean): void {\n if (this.autoclose) {\n if (newValue) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n } else {\n document.removeEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n }\n }\n\n /** notification close event */\n @Event()\n toastClose: EventEmitter;\n\n private emitToastClose(cssClass: string): void {\n this.timeoutHandle = null;\n this.elapsedTime = null;\n this.hostElement.classList.add(cssClass);\n this.toastClose.emit();\n }\n\n componentWillLoad(): void {\n this.isMobile = window.innerWidth <= Breakpoints.MOBILE;\n this.validateAutoclose();\n this.percentage = 0;\n }\n\n componentDidLoad(): void {\n this.isTextLong = this.detectWrap() || this.toastText.offsetHeight > 20;\n this.startTime = Date.now();\n if (this.autoclose && this.pauseonfocusloss) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n\n this.isdraggable && this.handleSlideOutDragAnimation();\n }\n\n private visibilityChangeEventHandler(): void {\n if (document.visibilityState === \"hidden\") {\n this.timeoutHandle && this.onBlur();\n } else {\n this.elapsedTime && this.onFocus();\n }\n }\n\n private validateAutoclose(): void {\n if (!this.autoclose && !this.closebutton) {\n console.error(\"At least one between autoclose and closebutton must be present\");\n }\n }\n\n private mapSlideOutClass(): ToastNotificationTransition {\n switch (this.transition) {\n case ToastNotificationTransition.SLIDE_IN_DOWN:\n return ToastNotificationTransition.SLIDE_OUT_UP;\n case ToastNotificationTransition.SLIDE_IN_UP:\n return ToastNotificationTransition.SLIDE_OUT_DOWN;\n case ToastNotificationTransition.SLIDE_IN_LEFT:\n return ToastNotificationTransition.SLIDE_OUT_RIGHT;\n case ToastNotificationTransition.SLIDE_IN_RIGHT:\n return ToastNotificationTransition.SLIDE_OUT_LEFT;\n }\n }\n\n private calculateDraggedPercentage(e): number {\n const bounding = this.hostElement.getBoundingClientRect();\n\n return Math.round((100 * e.deltaX) / bounding.width);\n }\n\n private handleSlideOutDragAnimation(): void {\n this.sliderManager = new Hammer(this.hostElement);\n this.sliderManager.get(\"pan\").set({\n direction: Hammer.DIRECTION_HORIZONTAL,\n });\n\n this.sliderManager.on(\"pan\", (e) => {\n this.percentage = this.calculateDraggedPercentage(e);\n this.hostElement.style.transition = \"none\";\n this.hostElement.classList.remove(this.transition);\n const translateObj = {\n translate: `translateX(${this.percentage}%)`,\n translateBack: \"translateX(0)\",\n };\n\n this.hostElement.style.opacity = `${100 - Math.abs(this.percentage)}%`;\n if (e.eventType === Hammer.DIRECTION_LEFT || e.eventType === Hammer.DIRECTION_RIGHT) {\n this.hostElement.style.transform = translateObj.translate;\n if (Math.abs(this.percentage) > this.draggablepercentage && !this.isCloseEventCalled) {\n this.isCloseEventCalled = true;\n this.emitToastClose(e.direction === Hammer.DIRECTION_LEFT ? \"slide-out-left\" : \"slide-out-right\");\n }\n }\n\n if (e.isFinal && Math.abs(this.percentage) < this.draggablepercentage) {\n this.hostElement.style.transform = translateObj.translateBack;\n this.hostElement.style.transition = \"all 1s\";\n this.hostElement.style.opacity = \"100%\";\n this.percentage = 0;\n }\n });\n }\n\n private onFocus(): void {\n let time = this.autoclose;\n if (this.elapsedTime) {\n time = this.autoclose - this.elapsedTime;\n }\n if (time > 0) {\n this.startClosingTimeout(time);\n }\n }\n\n private onBlur(): void {\n this.elapsedTime = Date.now() - this.startTime;\n clearTimeout(this.timeoutHandle);\n }\n\n private startClosingTimeout(time: number): void {\n this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);\n }\n\n private detectWrap(): boolean {\n const parentWidth = this.container.offsetWidth;\n const children = this.container.children;\n let totalWidth = 0;\n\n for (let i = 0; i < children.length; i++) {\n totalWidth += (children[i] as HTMLElement).offsetWidth;\n }\n\n return totalWidth > parentWidth;\n }\n\n private renderText(): HTMLDivElement {\n return (\n <div\n id=\"text\"\n ref={(el) => (this.toastText = el as HTMLElement)}\n >\n {this.heading && <span class=\"title\">{this.heading}</span>}\n <span class=\"message\">{this.message}</span>\n </div>\n );\n }\n\n private renderButton(): HTMLDivElement {\n return (\n <div id=\"button\">\n <slot name=\"button\" />\n </div>\n );\n }\n\n private renderCloseIcon(): HTMLDivElement {\n if (!this.closebutton) {\n return;\n }\n\n return (\n <div id=\"icon\">\n <z-icon\n tabIndex={0}\n name=\"multiply-circled\"\n width={15}\n height={15}\n onClick={() => this.emitToastClose(this.mapSlideOutClass())}\n onKeyPress={(e) => {\n if (e.keyCode == 32 || e.keyCode == 13) {\n e.preventDefault();\n this.emitToastClose(this.mapSlideOutClass());\n }\n }}\n />\n </div>\n );\n }\n\n private renderContainer(): HTMLDivElement {\n return (\n <div\n tabIndex={0}\n id=\"external-container\"\n class={{\n [this.type]: !!this.type,\n \"several-lines-padding\": this.isTextLong,\n }}\n ref={(el) => (this.container = el as HTMLElement)}\n >\n {this.renderText()}\n {this.renderButton()}\n {this.renderCloseIcon()}\n </div>\n );\n }\n\n private renderMobileContainer(): HTMLDivElement {\n return (\n <div\n id=\"external-container\"\n class={{\n [this.type]: !!this.type,\n \"several-lines-padding\": this.isTextLong,\n \"mobile-wrapped\": this.isTextLong,\n }}\n >\n <div\n id=\"flex-container\"\n ref={(el) => (this.container = el as HTMLElement)}\n >\n {this.renderText()}\n {this.renderButton()}\n </div>\n {this.renderCloseIcon()}\n </div>\n );\n }\n\n render(): HTMLZToastNotificationElement {\n return (\n <Host\n style={{\n \"--percentuale\": `${this.percentage}%`,\n }}\n class={this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN}\n onAnimationEnd={(e: AnimationEvent) => {\n if (this.autoclose && e.animationName.includes(\"slidein\")) {\n this.startClosingTimeout(this.autoclose);\n }\n if (e.animationName.includes(\"slideout\")) {\n this.hostElement.parentNode.removeChild(this.hostElement);\n }\n }}\n >\n {this.isMobile ? this.renderMobileContainer() : this.renderContainer()}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAEzF,OAAO,MAAM,MAAM,UAAU,CAAC;AAO9B,MAAM,OAAO,kBAAkB;;QAkDrB,uBAAkB,GAAG,KAAK,CAAC;;;;;gCA7BN,IAAI;;2BAQT,IAAI;mCAIG,EAAE;;;;IAoBjC,oBAAoB,CAAC,QAAiB;QACpC,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAGD,kBAAkB,CAAC,Q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ACH,CAAC,IAEA,IAAI,CAAC,aAAa,EAAE,CAChB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, ToastNotification, ToastNotificationTransition} from \"../../beans\";\n\nimport Hammer from \"hammerjs\";\n\n@Component({\n tag: \"z-toast-notification\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZToastNotification {\n @Element() hostElement: HTMLZToastNotificationElement;\n\n /** toast notification's title */\n @Prop()\n heading?: string;\n\n /** toast notification's message */\n @Prop()\n message: string;\n\n /** toggles closing button rendering */\n @Prop()\n closebutton: boolean;\n\n /** toast notification closing timeout (ms) */\n @Prop()\n autoclose?: number;\n\n /** toast notification autoclose can be paused */\n @Prop()\n pauseonfocusloss?: boolean = true;\n\n /** toast notification type: dark, light, accent, error, success, warning */\n @Prop()\n type?: ToastNotification;\n\n /** toast notification can be draggable*/\n @Prop()\n isdraggable?: boolean = true;\n\n /** toast notification draggable percentage*/\n @Prop()\n draggablepercentage?: number = 80;\n\n /** toast notification animation type: slide-in-left, slide-in-right, slide-in-down, slide-in-up*/\n @Prop()\n transition?: ToastNotificationTransition;\n\n @State()\n percentage: number;\n\n private sliderManager: HammerManager;\n\n private elapsedTime: number;\n\n private timeoutHandle: number;\n\n private startTime: number;\n\n private isCloseEventCalled = false;\n\n @Watch(\"isdraggable\")\n watchPropIsdraggable(newValue: boolean): void {\n if (newValue) {\n this.sliderManager.get(\"pan\").set({enable: true});\n } else {\n this.sliderManager.get(\"pan\").set({enable: false});\n }\n }\n\n @Watch(\"autoclose\")\n watchPropAutoclose(newValue: number): void {\n clearTimeout(this.timeoutHandle);\n this.startClosingTimeout(newValue);\n }\n\n @Watch(\"pauseonfocusloss\")\n watchPropPauseonfocusloss(newValue: boolean): void {\n if (this.autoclose) {\n if (newValue) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n } else {\n document.removeEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n }\n }\n\n /** notification close event */\n @Event()\n toastClose: EventEmitter;\n\n private emitToastClose(cssClass: string): void {\n this.timeoutHandle = null;\n this.elapsedTime = null;\n this.hostElement.classList.add(cssClass);\n this.toastClose.emit();\n }\n\n componentWillLoad(): void {\n this.validateAutoclose();\n this.percentage = 0;\n }\n\n componentDidLoad(): void {\n this.startTime = Date.now();\n if (this.autoclose && this.pauseonfocusloss) {\n document.addEventListener(\"visibilitychange\", this.visibilityChangeEventHandler);\n }\n\n this.isdraggable && this.handleSlideOutDragAnimation();\n }\n\n private visibilityChangeEventHandler(): void {\n if (document.visibilityState === \"hidden\") {\n this.timeoutHandle && this.onBlur();\n } else {\n this.elapsedTime && this.onFocus();\n }\n }\n\n private validateAutoclose(): void {\n if (!this.autoclose && !this.closebutton) {\n console.error(\"At least one between autoclose and closebutton must be present\");\n }\n }\n\n private mapSlideOutClass(): ToastNotificationTransition {\n switch (this.transition) {\n case ToastNotificationTransition.SLIDE_IN_DOWN:\n return ToastNotificationTransition.SLIDE_OUT_UP;\n case ToastNotificationTransition.SLIDE_IN_UP:\n return ToastNotificationTransition.SLIDE_OUT_DOWN;\n case ToastNotificationTransition.SLIDE_IN_LEFT:\n return ToastNotificationTransition.SLIDE_OUT_RIGHT;\n case ToastNotificationTransition.SLIDE_IN_RIGHT:\n return ToastNotificationTransition.SLIDE_OUT_LEFT;\n }\n }\n\n private calculateDraggedPercentage(e): number {\n const bounding = this.hostElement.getBoundingClientRect();\n\n return Math.round((100 * e.deltaX) / bounding.width);\n }\n\n private handleSlideOutDragAnimation(): void {\n this.sliderManager = new Hammer(this.hostElement);\n this.sliderManager.get(\"pan\").set({\n direction: Hammer.DIRECTION_HORIZONTAL,\n });\n\n this.sliderManager.on(\"pan\", (e) => {\n this.percentage = this.calculateDraggedPercentage(e);\n this.hostElement.style.transition = \"none\";\n this.hostElement.classList.remove(this.transition);\n const translateObj = {\n translate: `translateX(${this.percentage}%)`,\n translateBack: \"translateX(0)\",\n };\n\n this.hostElement.style.opacity = `${100 - Math.abs(this.percentage)}%`;\n if (e.eventType === Hammer.DIRECTION_LEFT || e.eventType === Hammer.DIRECTION_RIGHT) {\n this.hostElement.style.transform = translateObj.translate;\n if (Math.abs(this.percentage) > this.draggablepercentage && !this.isCloseEventCalled) {\n this.isCloseEventCalled = true;\n this.emitToastClose(e.direction === Hammer.DIRECTION_LEFT ? \"slide-out-left\" : \"slide-out-right\");\n }\n }\n\n if (e.isFinal && Math.abs(this.percentage) < this.draggablepercentage) {\n this.hostElement.style.transform = translateObj.translateBack;\n this.hostElement.style.transition = \"all 1s\";\n this.hostElement.style.opacity = \"100%\";\n this.percentage = 0;\n }\n });\n }\n\n private onFocus(): void {\n let time = this.autoclose;\n if (this.elapsedTime) {\n time = this.autoclose - this.elapsedTime;\n }\n if (time > 0) {\n this.startClosingTimeout(time);\n }\n }\n\n private onBlur(): void {\n this.elapsedTime = Date.now() - this.startTime;\n clearTimeout(this.timeoutHandle);\n }\n\n private startClosingTimeout(time: number): void {\n this.timeoutHandle = window.setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div\n id=\"external-container\"\n tabIndex={0}\n class={{[this.type]: !!this.type}}\n >\n <div id=\"inner-container\">\n <div id=\"text\">\n {this.heading && <span class=\"title\">{this.heading}</span>}\n <span class=\"message\">{this.message}</span>\n </div>\n <div id=\"button\">\n <slot name=\"button\" />\n </div>\n </div>\n <div id=\"icon\">\n {this.closebutton && (\n <z-icon\n tabIndex={0}\n name=\"multiply-circled\"\n width={15}\n height={15}\n onClick={() => this.emitToastClose(this.mapSlideOutClass())}\n onKeyPress={(e) => {\n if (e.code == KeyboardCode.SPACE || e.code == KeyboardCode.ENTER) {\n e.preventDefault();\n this.emitToastClose(this.mapSlideOutClass());\n }\n }}\n />\n )}\n </div>\n </div>\n );\n }\n\n render(): HTMLZToastNotificationElement {\n return (\n <Host\n style={{\"--percentuale\": `${this.percentage}%`}}\n class={this.transition ? this.transition : ToastNotificationTransition.SLIDE_IN_DOWN}\n onAnimationEnd={(e: AnimationEvent) => {\n if (this.autoclose && e.animationName.includes(\"slidein\")) {\n this.startClosingTimeout(this.autoclose);\n }\n if (e.animationName.includes(\"slideout\")) {\n this.hostElement.parentNode.removeChild(this.hostElement);\n }\n }}\n >\n {this.renderContent()}\n </Host>\n );\n }\n}\n"]}
@@ -2,6 +2,7 @@ import { html } from "lit";
2
2
  import { ToastNotification, ToastNotificationTransition } from "../../beans";
3
3
  import "../z-button/index";
4
4
  import "./index";
5
+ const longText = "Testo decisamente lungo, che non sta su 1 sola riga. Questo testo occupa varie righe ed è un esempio di come vengono posizionati gli elementi in caso di testo lungo.";
5
6
  const template = (args) => html `<div class="toast-container">
6
7
  <z-toast-notification
7
8
  heading="${args.heading}"
@@ -52,14 +53,16 @@ export const SlideInLeft = {
52
53
  transition: ToastNotificationTransition.SLIDE_IN_LEFT,
53
54
  },
54
55
  };
55
- export const SlideInDown = {
56
+ export const SlideInDownNoCloseButton = {
56
57
  args: {
57
58
  transition: ToastNotificationTransition.SLIDE_IN_DOWN,
59
+ closebutton: false,
58
60
  },
59
61
  };
60
- export const SlideInUp = {
62
+ export const SlideInUpLongText = {
61
63
  args: {
62
64
  transition: ToastNotificationTransition.SLIDE_IN_UP,
65
+ message: longText,
63
66
  },
64
67
  };
65
68
  export const SlottedButton = {
@@ -87,4 +90,29 @@ export const SlottedButton = {
87
90
  </z-toast-notification>
88
91
  </div>`,
89
92
  };
93
+ export const SlottedButtonLongText = {
94
+ args: {
95
+ transition: ToastNotificationTransition.SLIDE_IN_DOWN,
96
+ },
97
+ render: (args) => html `<div class="toast-container slotted-button">
98
+ <z-toast-notification
99
+ heading="Titolo abbastanza lungo"
100
+ message=${longText}
101
+ closebutton="${args.closebutton}"
102
+ autoclose="${args.autoclose}"
103
+ pauseonfocusloss="${args.pauseonfocusloss}"
104
+ type="${args.type}"
105
+ isdraggable="${args.isdraggable}"
106
+ draggablepercentage="${args.draggablepercentage}"
107
+ transition="${args.transition}"
108
+ >
109
+ <z-button
110
+ slot="button"
111
+ size="small"
112
+ variant="tertiary"
113
+ >button</z-button
114
+ >
115
+ </z-toast-notification>
116
+ </div>`,
117
+ };
90
118
  //# sourceMappingURL=index.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAsB,MAAM,KAAK,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,SAAS,CAAC;AAEjB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAkB,EAAE,CACxC,IAAI,CAAA;;iBAEW,IAAI,CAAC,OAAO;iBACZ,IAAI,CAAC,OAAO;qBACR,IAAI,CAAC,WAAW;mBAClB,IAAI,CAAC,SAAS;0BACP,IAAI,CAAC,gBAAgB;cACjC,IAAI,CAAC,IAAI;qBACF,IAAI,CAAC,WAAW;6BACR,IAAI,CAAC,mBAAmB;oBACjC,IAAI,CAAC,UAAU;;SAE1B,CAAC;AACV,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBA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AI,CAAC,WAAW;+BACR,IAAI,CAAC,mBAAmB;sBACjC,IAAI,CAAC,UAAU;;;;;;;;;WAS1B;CACM,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html, type TemplateResult} from \"lit\";\nimport {type ZToastNotification} from \".\";\nimport {ToastNotification, ToastNotificationTransition} from \"../../beans\";\nimport \"../z-button/index\";\nimport \"./index\";\n\nconst template = (args): TemplateResult =>\n html`<div class=\"toast-container\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n ></z-toast-notification>\n </div>`;\nconst StoryMeta = {\n title: \"ZToastNotification\",\n component: \"z-toast-notification\",\n argTypes: {\n type: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotification),\n },\n transition: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotificationTransition),\n },\n },\n args: {\n heading: \"Titolo\",\n message: \"Questo è un messaggio di prova.\",\n closebutton: true,\n autoclose: null,\n pauseonfocusloss: false,\n type: ToastNotification.DARK,\n isdraggable: true,\n draggablepercentage: 80,\n transition: ToastNotificationTransition.SLIDE_IN_RIGHT,\n },\n render: (args) => template(args),\n} satisfies Meta<ZToastNotification>;\nexport default StoryMeta;\n\ntype Story = StoryObj<ZToastNotification>;\nexport const SlideInRight = {} satisfies Story;\n\nexport const SlideInLeft = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_LEFT,\n },\n} satisfies Story;\n\nexport const SlideInDown = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n} satisfies Story;\n\nexport const SlideInUp = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_UP,\n },\n} satisfies Story;\n\nexport const SlottedButton = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n render: (args) =>\n html`<div class=\"toast-container slotted-button\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n >\n <z-button\n slot=\"button\"\n size=\"small\"\n variant=\"tertiary\"\n >button</z-button\n >\n </z-toast-notification>\n </div>`,\n} satisfies Story;\n"]}
1
+ {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../../../src/components/z-toast-notification/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAsB,MAAM,KAAK,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,SAAS,CAAC;AAEjB,MAAM,QAAQ,GACZ,uKAAuK,CAAC;AAE1K,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAkB,EAAE,CACxC,IAAI,CAAA;;iBAEW,IAAI,CAAC,OAAO;iBACZ,IAAI,CAAC,OAAO;qBACR,IAAI,CAAC,WAAW;mBAClB,IAAI,CAAC,SAAS;0BACP,IAAI,CAAC,gBAAgB;cACjC,IAAI,CAAC,IAAI;qBACF,IAAI,CAAC,WAAW;6BACR,IAAI,CAAC,mBAAmB;oBACjC,IAAI,CAAC,UAAU;;SAE1B,CAAC;AAEV,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;aACf;YACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;SAC1C;QACD,UAAU,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IAAI,CAAC,IAAI;uBACF,IAAI,CAAC,WAAW;+BACR,IAAI,CAAC,mBAAmB;sBACjC,IAAI,CAAC,UAAU;;;;;;;;;WAS1B;CACM,CAAC;AAElB,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE;QACJ,UAAU,EAAE,2BAA2B,CAAC,aAAa;KACtD;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,IAAI,CAAA;;;kBAGU,QAAQ;uBACH,IAAI,CAAC,WAAW;qBAClB,IAAI,CAAC,SAAS;4BACP,IAAI,CAAC,gBAAgB;gBACjC,IAAI,CAAC,IAAI;uBACF,IAAI,CAAC,WAAW;+BACR,IAAI,CAAC,mBAAmB;sBACjC,IAAI,CAAC,UAAU;;;;;;;;;WAS1B;CACM,CAAC","sourcesContent":["import {Meta, StoryObj} from \"@storybook/web-components\";\nimport {html, type TemplateResult} from \"lit\";\nimport {type ZToastNotification} from \".\";\nimport {ToastNotification, ToastNotificationTransition} from \"../../beans\";\nimport \"../z-button/index\";\nimport \"./index\";\n\nconst longText =\n \"Testo decisamente lungo, che non sta su 1 sola riga. Questo testo occupa varie righe ed è un esempio di come vengono posizionati gli elementi in caso di testo lungo.\";\n\nconst template = (args): TemplateResult =>\n html`<div class=\"toast-container\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n ></z-toast-notification>\n </div>`;\n\nconst StoryMeta = {\n title: \"ZToastNotification\",\n component: \"z-toast-notification\",\n argTypes: {\n type: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotification),\n },\n transition: {\n control: {\n type: \"select\",\n },\n options: Object.values(ToastNotificationTransition),\n },\n },\n args: {\n heading: \"Titolo\",\n message: \"Questo è un messaggio di prova.\",\n closebutton: true,\n autoclose: null,\n pauseonfocusloss: false,\n type: ToastNotification.DARK,\n isdraggable: true,\n draggablepercentage: 80,\n transition: ToastNotificationTransition.SLIDE_IN_RIGHT,\n },\n render: (args) => template(args),\n} satisfies Meta<ZToastNotification>;\n\nexport default StoryMeta;\n\ntype Story = StoryObj<ZToastNotification>;\nexport const SlideInRight = {} satisfies Story;\n\nexport const SlideInLeft = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_LEFT,\n },\n} satisfies Story;\n\nexport const SlideInDownNoCloseButton = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n closebutton: false,\n },\n} satisfies Story;\n\nexport const SlideInUpLongText = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_UP,\n message: longText,\n },\n} satisfies Story;\n\nexport const SlottedButton = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n render: (args) =>\n html`<div class=\"toast-container slotted-button\">\n <z-toast-notification\n heading=\"${args.heading}\"\n message=\"${args.message}\"\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n >\n <z-button\n slot=\"button\"\n size=\"small\"\n variant=\"tertiary\"\n >button</z-button\n >\n </z-toast-notification>\n </div>`,\n} satisfies Story;\n\nexport const SlottedButtonLongText = {\n args: {\n transition: ToastNotificationTransition.SLIDE_IN_DOWN,\n },\n render: (args) =>\n html`<div class=\"toast-container slotted-button\">\n <z-toast-notification\n heading=\"Titolo abbastanza lungo\"\n message=${longText}\n closebutton=\"${args.closebutton}\"\n autoclose=\"${args.autoclose}\"\n pauseonfocusloss=\"${args.pauseonfocusloss}\"\n type=\"${args.type}\"\n isdraggable=\"${args.isdraggable}\"\n draggablepercentage=\"${args.draggablepercentage}\"\n transition=\"${args.transition}\"\n >\n <z-button\n slot=\"button\"\n size=\"small\"\n variant=\"tertiary\"\n >button</z-button\n >\n </z-toast-notification>\n </div>`,\n} satisfies Story;\n"]}
@@ -142,10 +142,10 @@
142
142
 
143
143
  :host > #external-container {
144
144
  display: flex;
145
+ min-height: calc(var(--space-unit) * 8.5);
145
146
  box-sizing: border-box;
146
- align-items: flex-start;
147
147
  justify-content: space-between;
148
- padding: calc(var(--space-unit) * 2);
148
+ padding: calc(var(--space-unit) * 2) 14px calc(var(--space-unit) * 2) calc(var(--space-unit) * 2);
149
149
  border-radius: var(--border-size-large);
150
150
  box-shadow: var(--shadow-3);
151
151
  font-family: var(--font-family-sans);
@@ -154,58 +154,50 @@
154
154
  letter-spacing: 0.16px;
155
155
  }
156
156
 
157
- :host > #external-container.mobile-wrapped > #icon {
158
- align-self: flex-start;
159
- }
160
-
161
- :host > #external-container.several-lines-padding {
162
- padding: calc(var(--space-unit) * 2);
163
- }
164
-
165
- :host > #external-container > #flex-container {
157
+ :host > #external-container > #inner-container {
166
158
  display: flex;
167
159
  width: 100%;
168
- flex-wrap: wrap;
169
- align-items: center;
160
+ flex-direction: column;
170
161
  justify-content: space-between;
171
162
  }
172
163
 
173
- :host > #external-container #text {
174
- margin-right: calc(var(--space-unit) * 2);
164
+ :host > #external-container #inner-container #text {
165
+ padding: var(--space-unit) 0;
175
166
  color: var(--color-text-inverse);
176
167
  letter-spacing: 0.16px;
177
168
  line-height: 20px;
178
- text-align: left;
169
+ text-align: start;
179
170
  }
180
171
 
181
- :host > #external-container #text > .title {
172
+ :host > #external-container #inner-container #text > .title {
182
173
  margin-right: calc(var(--space-unit) / 2);
183
- font-weight: 600;
174
+ font-weight: var(--font-sb);
184
175
  }
185
176
 
186
- :host > #external-container.mobile-wrapped #button ::slotted(z-button) {
187
- margin-top: calc(var(--space-unit) * 2);
177
+ :host > #external-container #inner-container ::slotted([slot="button"]) {
178
+ margin-top: var(--space-unit);
188
179
  }
189
180
 
190
181
  :host > #external-container #icon {
191
- display: flex;
192
- height: 20px;
193
- align-items: center;
194
- margin-left: calc(var(--space-unit) * 2);
182
+ padding-top: var(--space-unit);
183
+ margin: 0 calc(var(--space-unit) / 4);
195
184
  cursor: pointer;
196
185
  fill: var(--color-inverse-icon);
197
186
  }
198
187
 
199
- z-icon {
200
- display: inline-block;
201
- vertical-align: 0;
188
+ :host > #external-container #icon:focus-within {
189
+ margin: 0;
190
+ }
191
+
192
+ :host > #external-container #icon z-icon {
193
+ margin: 0 0 0 14px;
202
194
  }
203
195
 
204
- z-icon:focus {
196
+ :host > #external-container #icon z-icon:focus {
197
+ display: inline-block;
205
198
  padding: calc(var(--space-unit) / 4);
206
199
  border-radius: 50%;
207
200
  box-shadow: var(--shadow-focus-primary);
208
- outline: none !important;
209
201
  }
210
202
 
211
203
  :host > #external-container.dark {
@@ -252,19 +244,18 @@ z-icon:focus {
252
244
  max-width: 50vw;
253
245
  }
254
246
 
255
- :host > #external-container > #flex-container {
256
- flex-wrap: nowrap;
247
+ :host > #external-container #inner-container {
248
+ flex-direction: row;
257
249
  }
258
250
 
259
- :host > #external-container #text {
260
- width: 100%;
251
+ :host > #external-container #inner-container ::slotted([slot="button"]) {
252
+ margin: 0 0 0 calc(var(--space-unit) * 2);
261
253
  }
262
254
  }
263
255
 
264
256
  /* Wide breakpoint */
265
257
  @media (min-width: 1366px) {
266
258
  :host {
267
- width: unset;
268
259
  max-width: 33vw;
269
260
  }
270
261
  }