@zanichelli/albe-web-components 18.4.2 → 18.5.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 (158) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/cjs/_commonjsHelpers-68cdf74f.js +7 -0
  3. package/dist/cjs/_commonjsHelpers-68cdf74f.js.map +1 -0
  4. package/dist/cjs/index-299de208.js +47 -0
  5. package/dist/cjs/index-299de208.js.map +1 -0
  6. package/dist/cjs/{index-443b084a.js → index-e1eead16.js} +2 -2
  7. package/dist/cjs/index-e1eead16.js.map +1 -0
  8. package/dist/cjs/{index-f67078cb.js → index-fb88ce4a.js} +5 -5
  9. package/dist/cjs/index-fb88ce4a.js.map +1 -0
  10. package/dist/cjs/{utils-021d5bc3.js → utils-eacc6b3a.js} +3 -5
  11. package/dist/cjs/utils-eacc6b3a.js.map +1 -0
  12. package/dist/cjs/z-date-picker.cjs.entry.js +3 -2
  13. package/dist/cjs/z-date-picker.cjs.entry.js.map +1 -1
  14. package/dist/cjs/z-range-picker.cjs.entry.js +2 -1
  15. package/dist/cjs/z-range-picker.cjs.entry.js.map +1 -1
  16. package/dist/cjs/z-table.cjs.entry.js +3 -3
  17. package/dist/cjs/z-td.cjs.entry.js +1 -1
  18. package/dist/cjs/z-th.cjs.entry.js +1 -1
  19. package/dist/cjs/z-toast-notification.cjs.entry.js +1386 -10
  20. package/dist/cjs/z-toast-notification.cjs.entry.js.map +1 -1
  21. package/dist/cjs/z-tr.cjs.entry.js +3 -3
  22. package/dist/collection/components/table/cells/z-td/index.js +1 -1
  23. package/dist/collection/components/table/cells/z-td/index.js.map +1 -1
  24. package/dist/collection/components/table/cells/z-td/styles.css +6 -0
  25. package/dist/collection/components/table/cells/z-th/styles.css +6 -5
  26. package/dist/collection/components/table/z-tr/index.js +1 -1
  27. package/dist/collection/components/table/z-tr/index.js.map +1 -1
  28. package/dist/collection/components/table/z-tr/styles.css +13 -0
  29. package/dist/collection/components/z-toast-notification/index.js +28 -10
  30. package/dist/collection/components/z-toast-notification/index.js.map +1 -1
  31. package/dist/collection/components/z-toast-notification/index.stories.js +10 -2
  32. package/dist/collection/components/z-toast-notification/index.stories.js.map +1 -1
  33. package/dist/components/_commonjsHelpers.js +5 -0
  34. package/dist/components/_commonjsHelpers.js.map +1 -0
  35. package/dist/components/utils2.js +2 -3
  36. package/dist/components/utils2.js.map +1 -1
  37. package/dist/components/z-date-picker.js +2 -1
  38. package/dist/components/z-date-picker.js.map +1 -1
  39. package/dist/components/z-td.js +2 -2
  40. package/dist/components/z-td.js.map +1 -1
  41. package/dist/components/z-th.js +1 -1
  42. package/dist/components/z-th.js.map +1 -1
  43. package/dist/components/z-toast-notification.js +1386 -10
  44. package/dist/components/z-toast-notification.js.map +1 -1
  45. package/dist/components/z-tr.js +2 -2
  46. package/dist/components/z-tr.js.map +1 -1
  47. package/dist/esm/_commonjsHelpers-1c8beb5f.js +5 -0
  48. package/dist/esm/_commonjsHelpers-1c8beb5f.js.map +1 -0
  49. package/dist/esm/{index-be3c8aaa.js → index-28b819c7.js} +5 -5
  50. package/dist/esm/index-28b819c7.js.map +1 -0
  51. package/dist/esm/index-49edcc7b.js +45 -0
  52. package/dist/esm/index-49edcc7b.js.map +1 -0
  53. package/dist/esm/{index-2a26d10b.js → index-bf02a37c.js} +2 -2
  54. package/dist/esm/index-bf02a37c.js.map +1 -0
  55. package/dist/esm/{utils-90416845.js → utils-50e4c211.js} +3 -4
  56. package/dist/esm/utils-50e4c211.js.map +1 -0
  57. package/dist/esm/z-date-picker.entry.js +2 -1
  58. package/dist/esm/z-date-picker.entry.js.map +1 -1
  59. package/dist/esm/z-range-picker.entry.js +2 -1
  60. package/dist/esm/z-range-picker.entry.js.map +1 -1
  61. package/dist/esm/z-table.entry.js +3 -3
  62. package/dist/esm/z-td.entry.js +1 -1
  63. package/dist/esm/z-th.entry.js +1 -1
  64. package/dist/esm/z-toast-notification.entry.js +1386 -10
  65. package/dist/esm/z-toast-notification.entry.js.map +1 -1
  66. package/dist/esm/z-tr.entry.js +3 -3
  67. package/dist/types/components/z-toast-notification/index.stories.d.ts +10 -2
  68. package/dist/web-components-library/p-04f21233.entry.js +2 -0
  69. package/dist/web-components-library/p-4573c419.js +2 -0
  70. package/dist/web-components-library/p-68ac9eba.js +2 -0
  71. package/dist/web-components-library/p-68ac9eba.js.map +1 -0
  72. package/dist/web-components-library/p-76fe2d00.entry.js +2 -0
  73. package/dist/web-components-library/p-97b78a20.js +2 -0
  74. package/dist/web-components-library/p-97b78a20.js.map +1 -0
  75. package/dist/web-components-library/p-a55dce3e.js +2 -0
  76. package/{www/build/p-f670c5ad.js.map → dist/web-components-library/p-a55dce3e.js.map} +1 -1
  77. package/dist/web-components-library/{p-aff88c50.entry.js → p-c2fc251c.entry.js} +3 -3
  78. package/{www/build/p-aff88c50.entry.js.map → dist/web-components-library/p-c2fc251c.entry.js.map} +1 -1
  79. package/dist/web-components-library/p-d9f9d864.entry.js +8 -0
  80. package/dist/web-components-library/p-d9f9d864.entry.js.map +1 -0
  81. package/dist/web-components-library/p-e0cf7f5e.js +2 -0
  82. package/dist/web-components-library/p-e0cf7f5e.js.map +1 -0
  83. package/dist/web-components-library/p-e90d3072.entry.js +2 -0
  84. package/dist/web-components-library/p-f7d3e1cc.entry.js +2 -0
  85. package/dist/web-components-library/{p-fb12af88.entry.js.map → p-f7d3e1cc.entry.js.map} +1 -1
  86. package/dist/web-components-library/p-f97b82aa.entry.js +2 -0
  87. package/dist/web-components-library/web-components-library.esm.js +1 -1
  88. package/package.json +3 -1
  89. package/www/build/p-04f21233.entry.js +2 -0
  90. package/www/build/{p-01619706.js → p-4020f8c5.js} +1 -1
  91. package/www/build/p-4573c419.js +2 -0
  92. package/www/build/p-68ac9eba.js +2 -0
  93. package/www/build/p-68ac9eba.js.map +1 -0
  94. package/www/build/p-76fe2d00.entry.js +2 -0
  95. package/www/build/p-76fe2d00.entry.js.map +1 -0
  96. package/www/build/p-97b78a20.js +2 -0
  97. package/www/build/p-97b78a20.js.map +1 -0
  98. package/www/build/p-a55dce3e.js +2 -0
  99. package/{dist/web-components-library/p-f670c5ad.js.map → www/build/p-a55dce3e.js.map} +1 -1
  100. package/www/build/{p-aff88c50.entry.js → p-c2fc251c.entry.js} +3 -3
  101. package/{dist/web-components-library/p-aff88c50.entry.js.map → www/build/p-c2fc251c.entry.js.map} +1 -1
  102. package/www/build/p-d9f9d864.entry.js +8 -0
  103. package/www/build/p-d9f9d864.entry.js.map +1 -0
  104. package/www/build/p-e0cf7f5e.js +2 -0
  105. package/www/build/p-e0cf7f5e.js.map +1 -0
  106. package/www/build/p-e90d3072.entry.js +2 -0
  107. package/www/build/p-e90d3072.entry.js.map +1 -0
  108. package/www/build/p-f7d3e1cc.entry.js +2 -0
  109. package/www/build/{p-fb12af88.entry.js.map → p-f7d3e1cc.entry.js.map} +1 -1
  110. package/www/build/p-f97b82aa.entry.js +2 -0
  111. package/www/build/web-components-library.esm.js +1 -1
  112. package/www/index.html +1 -1
  113. package/dist/cjs/index-443b084a.js.map +0 -1
  114. package/dist/cjs/index-e98b419e.js +0 -47
  115. package/dist/cjs/index-e98b419e.js.map +0 -1
  116. package/dist/cjs/index-f67078cb.js.map +0 -1
  117. package/dist/cjs/utils-021d5bc3.js.map +0 -1
  118. package/dist/esm/index-2a26d10b.js.map +0 -1
  119. package/dist/esm/index-406138db.js +0 -45
  120. package/dist/esm/index-406138db.js.map +0 -1
  121. package/dist/esm/index-be3c8aaa.js.map +0 -1
  122. package/dist/esm/utils-90416845.js.map +0 -1
  123. package/dist/web-components-library/p-06b31bf5.js +0 -2
  124. package/dist/web-components-library/p-06b31bf5.js.map +0 -1
  125. package/dist/web-components-library/p-36e71b13.js +0 -2
  126. package/dist/web-components-library/p-36e71b13.js.map +0 -1
  127. package/dist/web-components-library/p-37d31461.entry.js +0 -2
  128. package/dist/web-components-library/p-725b253d.entry.js +0 -2
  129. package/dist/web-components-library/p-84635654.js +0 -2
  130. package/dist/web-components-library/p-84635654.js.map +0 -1
  131. package/dist/web-components-library/p-a4e05ee2.entry.js +0 -2
  132. package/dist/web-components-library/p-e91ece0c.entry.js +0 -7
  133. package/dist/web-components-library/p-e91ece0c.entry.js.map +0 -1
  134. package/dist/web-components-library/p-f20f1ed3.entry.js +0 -2
  135. package/dist/web-components-library/p-f670c5ad.js +0 -2
  136. package/dist/web-components-library/p-fb12af88.entry.js +0 -2
  137. package/www/build/p-06b31bf5.js +0 -2
  138. package/www/build/p-06b31bf5.js.map +0 -1
  139. package/www/build/p-36e71b13.js +0 -2
  140. package/www/build/p-36e71b13.js.map +0 -1
  141. package/www/build/p-37d31461.entry.js +0 -2
  142. package/www/build/p-725b253d.entry.js +0 -2
  143. package/www/build/p-84635654.js +0 -2
  144. package/www/build/p-84635654.js.map +0 -1
  145. package/www/build/p-a4e05ee2.entry.js +0 -2
  146. package/www/build/p-e91ece0c.entry.js +0 -7
  147. package/www/build/p-e91ece0c.entry.js.map +0 -1
  148. package/www/build/p-f20f1ed3.entry.js +0 -2
  149. package/www/build/p-f670c5ad.js +0 -2
  150. package/www/build/p-fb12af88.entry.js +0 -2
  151. /package/dist/web-components-library/{p-725b253d.entry.js.map → p-04f21233.entry.js.map} +0 -0
  152. /package/dist/web-components-library/{p-a4e05ee2.entry.js.map → p-4573c419.js.map} +0 -0
  153. /package/dist/web-components-library/{p-f20f1ed3.entry.js.map → p-76fe2d00.entry.js.map} +0 -0
  154. /package/{www/build/p-725b253d.entry.js.map → dist/web-components-library/p-e90d3072.entry.js.map} +0 -0
  155. /package/dist/web-components-library/{p-37d31461.entry.js.map → p-f97b82aa.entry.js.map} +0 -0
  156. /package/www/build/{p-a4e05ee2.entry.js.map → p-04f21233.entry.js.map} +0 -0
  157. /package/www/build/{p-f20f1ed3.entry.js.map → p-4573c419.js.map} +0 -0
  158. /package/www/build/{p-37d31461.entry.js.map → p-f97b82aa.entry.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"file":"index-2a26d10b.js","mapp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AAa,EACZ,IAAI,CAAC,WAAW,KACf,+DACE,KAAK,EAAC,mBAAmB,EACzB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAEnC,+DACE,IAAI,EAAE,IAAI,CAAC,aAAa,KAAK,aAAa,CAAC,IAAI,GAAG,iBAAiB,GAAG,mBAAmB,EACzF,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,GACV,CACK,CACV,EACA,IAAI,CAAC,QAAQ,KACZ,4DAAK,KAAK,EAAC,sBAAsB,IAC/B,iEACE,OAAO,EAAE,aAAa,CAAC,QAAQ,EAC/B,IAAI,EAAC,iBAAiB,EACtB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,WAAW,GAAG,EAAiB,CAAC,EACnD,OAAO,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAC3D,EACF,kEACE,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,SAAS,GAAG,EAAyB,CAAC,EACzD,MAAM,EAAE,IAAI,CAAC,WAAW,EACxB,YAAY,EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAC9D,QAAQ,EAAE,IAAI,CAAC,eAAe,IAE9B,6DAAM,IAAI,EAAC,iBAAiB,GAAQ,CAC1B,CACR,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/table/cells/z-th/styles.css?tag=z-th&encapsulation=shadow","src/components/table/cells/z-th/index.tsx"],"sourcesContent":["@import \"../z-table-cells.css\";\n\n:host {\n z-index: 1;\n padding: 0;\n background-color: var(--color-background);\n font-weight: var(--font-sb);\n}\n\n.cell--content {\n padding: var(--z-table--cells-padding, calc(var(--space-unit) * 2));\n}\n\n:host([show-sorting]) .cell--content {\n column-gap: var(--space-unit);\n}\n\n.z-th--sort-button {\n padding: 0;\n border: none;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n}\n\n@media (min-width: 768px) and (hover: hover) {\n :host([show-sorting=\"hover\"]) .z-th--sort-button {\n opacity: 0;\n pointer-events: none;\n }\n\n :host([show-sorting=\"hover\"]:hover) .z-th--sort-button,\n :host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible,\n :host([show-sorting=\"always\"]) .z-th--sort-button,\n :host([sorted]) .z-th--sort-button {\n opacity: 1;\n pointer-events: all;\n }\n}\n\n:host([show-sorting=\"hover\"]:hover) .z-th--sort-button::after,\n:host([show-sorting=\"hover\"]) .z-th--sort-button:focus:focus-visible::after,\n:host([show-sorting=\"always\"]) .z-th--sort-button::after,\n:host([sorted]) .z-th--sort-button::after {\n position: absolute;\n top: 6px;\n left: 6px;\n width: calc(100% - 12px);\n height: calc(100% - 10px);\n background-color: transparent;\n content: \"\";\n}\n\n:host([sorted]) .z-th--sort-button::after,\n.z-th--sort-button:focus:focus-visible::after {\n box-shadow: var(--shadow-focus-primary);\n}\n","import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, ControlSize, PopoverPosition, SortDirection, VisibilityCondition} from \"../../../../beans\";\n\n/**\n * ZTh component.\n * @slot - ZTh content.\n * @slot contextual-menu - Contextual menu content. Only visible when `showMenu` is true.\n */\n@Component({\n tag: \"z-th\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZTh {\n @Element() host: HTMLZThElement;\n\n /**\n * Number of columns that the cell should span.\n */\n @Prop()\n colspan: number;\n\n /**\n * Enables the contextual menu.\n * Can be set to \"hover\" or \"always\" to show the button only on cell hover or always.\n * Set a nullish value to hide the menu button.\n */\n @Prop({reflect: true})\n showMenu: VisibilityCondition = null;\n\n /**\n * Enables the sorting button.\n * Can be set to \"hover\" or \"always\" to show the button only on cell hover or always.\n * Set a nullish value to hide the sort button.\n */\n @Prop({reflect: true})\n showSorting: VisibilityCondition = null;\n\n /**\n * Whether the cell should stick.\n */\n @Prop({reflect: true})\n sticky = false;\n\n /**\n * Current sorting direction.\n */\n @Prop({mutable: true})\n sortDirection?: SortDirection;\n\n /**\n * Sorted state of the column.\n */\n @Prop({reflect: true, mutable: true})\n sorted: boolean | null = false;\n\n /**\n * Set popover position.\n */\n @Prop()\n popoverPosition = PopoverPosition.AUTO;\n\n /**\n * Store the open state of the menu.\n */\n @State()\n isMenuOpen = false;\n\n /**\n * Sort event fired when the user clicks on the sort button.\n * The sorting logic must be implemented by the app.\n * You can set an `id` on the `z-th` to easly identify the column in the event listener.\n */\n @Event()\n private sort: EventEmitter;\n\n private menuTrigger: HTMLElement;\n\n private popoverEl: HTMLZPopoverElement;\n\n /**\n * Get the value to set to the `aria-sort` attribute based on the current sort direction.\n */\n private get ariaSortDirection(): string {\n if (!this.sortDirection) {\n return null;\n }\n\n return this.sortDirection === SortDirection.ASC ? \"ascending\" : \"descending\";\n }\n\n /**\n * Handle the click on the sort button.\n * @fires sort\n */\n private handleSort(): void {\n if (!this.sortDirection) {\n this.sorted = false;\n\n return;\n }\n\n this.sortDirection = this.sortDirection === SortDirection.ASC ? SortDirection.DESC : SortDirection.ASC;\n this.sorted = true;\n\n this.sort.emit({sortDirection: this.sortDirection});\n }\n\n @Watch(\"colspan\")\n protected updateColspan(): void {\n if (this.colspan) {\n this.host.style.gridColumn = `span ${this.colspan}`;\n } else {\n this.host.style.removeProperty(\"grid-column\");\n }\n }\n\n componentWillLoad(): void {\n this.updateColspan();\n }\n\n render(): HTMLZThElement {\n return (\n <Host\n role=\"columnheader\"\n menu-open={this.isMenuOpen}\n aria-sort={this.ariaSortDirection}\n sortable={this.showSorting}\n >\n <div class=\"cell--content\">\n <slot></slot>\n {this.showSorting && (\n <button\n class=\"z-th--sort-button\"\n type=\"button\"\n onClick={this.handleSort.bind(this)}\n >\n <z-icon\n name={this.sortDirection === SortDirection.DESC ? \"arrow-simple-up\" : \"arrow-simple-down\"}\n width={14}\n height={14}\n />\n </button>\n )}\n {this.showMenu && (\n <div class=\"cell--menu-container\">\n <z-button\n variant={ButtonVariant.TERTIARY}\n icon=\"contextual-menu\"\n size={ControlSize.X_SMALL}\n ref={(el) => (this.menuTrigger = el as HTMLElement)}\n onClick={() => (this.popoverEl.open = !this.popoverEl.open)}\n />\n <z-popover\n ref={(el) => (this.popoverEl = el as HTMLZPopoverElement)}\n bindTo={this.menuTrigger}\n onOpenChange={(event) => (this.isMenuOpen = event.detail.open)}\n position={this.popoverPosition}\n >\n <slot name=\"contextual-menu\"></slot>\n </z-popover>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,45 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-c8ceadeb.js';
2
- import { P as PopoverPosition, B as ButtonVariant, e as ControlSize } from './index-9f584e0a.js';
3
-
4
- const stylesCss = ":host{position:relative;display:flex;max-width:100%;align-items:center;padding:var(--z-table--cells-padding, calc(var(--space-unit) * 2));background-color:var(--color-surface01);gap:calc(var(--space-unit) * 2) var(--space-unit)}:host,*{box-sizing:border-box}:host([sticky]){position:sticky;z-index:1;top:0;left:0;box-shadow:8px 0 16px -8px var(--shadow-color-base)}:host([menu-open]){z-index:2}.cell--content{display:flex;width:100%;height:100%;align-items:center}:host([show-menu]) .cell--content{column-gap:var(--space-unit)}.cell--menu-container{margin-left:auto}:host(:not([show-menu])) .cell--menu-container{opacity:0;pointer-events:none}:host(:is([show-menu],[menu-open])) .cell--menu-container,:host([show-menu]) .cell--menu-container:focus-within{z-index:1;opacity:1;pointer-events:all}:host .cell-popover{z-index:100}@media (min-width: 768px) and (hover: hover){:host([show-menu=\"hover\"]) .cell--menu-container{opacity:0;pointer-events:none}:host([show-menu=\"hover\"]:hover) .cell--menu-container{z-index:1;opacity:1;pointer-events:all}}";
5
- const ZTdStyle0 = stylesCss;
6
-
7
- const ZTd = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.colspanChange = createEvent(this, "colspanChange", 6);
11
- this.colspan = undefined;
12
- this.sticky = false;
13
- this.showMenu = null;
14
- this.popoverPosition = PopoverPosition.AUTO;
15
- this.isMenuOpen = false;
16
- }
17
- updateColspan() {
18
- if (this.colspan) {
19
- this.host.style.gridColumn = `span ${this.colspan}`;
20
- }
21
- else {
22
- this.host.style.removeProperty("grid-column");
23
- }
24
- this.colspanChange.emit(this.colspan || 1);
25
- }
26
- onMenuButtonClick(ev) {
27
- ev.stopPropagation();
28
- this.popoverEl.open = !this.popoverEl.open;
29
- }
30
- componentWillLoad() {
31
- this.updateColspan();
32
- }
33
- render() {
34
- return (h(Host, { key: 'c9c2a31f99dc72acd54744c8c1abdbb56b0a7df3', role: "cell", "menu-open": this.isMenuOpen }, h("div", { key: 'f503630802052c5c3566b725aba40ea0923d60da', class: "cell--content" }, h("slot", { key: 'e26dc22a7b21eef5475d10124312384593957bf8' }), this.showMenu && (h("div", { key: '4c7204766c53e4502ff24e51e9ea751620246278', class: "cell--menu-container prevent-expand" }, h("z-button", { key: '3d0f59414241c2b195dd45cf74f678b15e957cac', variant: ButtonVariant.TERTIARY, icon: "contextual-menu", size: ControlSize.X_SMALL, ref: (el) => (this.menuTrigger = el), onClick: this.onMenuButtonClick.bind(this) }), h("z-popover", { key: '68d2f577c442c9a72009dd6365cd4182e9333d5a', class: "cell-popover", ref: (el) => (this.popoverEl = el), bindTo: this.menuTrigger, onOpenChange: (event) => (this.isMenuOpen = event.detail.open), position: this.popoverPosition }, h("slot", { key: 'c90cf570174b2e2af659ae02e217d725a1951cb4', name: "contextual-menu" })))))));
35
- }
36
- get host() { return getElement(this); }
37
- static get watchers() { return {
38
- "colspan": ["updateColspan"]
39
- }; }
40
- };
41
- ZTd.style = ZTdStyle0;
42
-
43
- export { ZTd as Z };
44
-
45
- //# sourceMappingURL=index-406138db.js.map
@@ -1 +0,0 @@
1
- {"file":"index-406138db.js","mappings":";;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MAAM,EAAE,IAAI,CAAC,WAA0B,EACvC,YAAY,EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAC9D,QAAQ,EAAE,IAAI,CAAC,eAAe,IAE9B,6DAAM,IAAI,EAAC,iBAAiB,GAAQ,CAC1B,CACR,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/table/cells/z-td/styles.css?tag=z-td&encapsulation=shadow","src/components/table/cells/z-td/index.tsx"],"sourcesContent":["@import \"../z-table-cells.css\";\n","import {Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ButtonVariant, ControlSize, PopoverPosition, VisibilityCondition} from \"../../../../beans\";\n\n/**\n * ZTd component.\n * @slot - ZTd content.\n */\n@Component({\n tag: \"z-td\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZTd {\n @Element() host: HTMLZTdElement;\n\n /**\n * Number of columns that the cell should span.\n */\n @Prop()\n colspan: number;\n\n /**\n * Whether the cell should stick.\n */\n @Prop({reflect: true})\n sticky = false;\n\n /**\n * Enables the contextual menu.\n * Can be set to \"hover\" or \"always\" to show the button only on cell hover or always.\n * Set a nullish value to hide the menu button.\n */\n @Prop({reflect: true})\n showMenu: VisibilityCondition = null;\n\n /**\n * Set the popover position, the default is \"auto\".\n */\n @Prop()\n popoverPosition?: PopoverPosition = PopoverPosition.AUTO;\n\n /**\n * Store the open state of the menu.\n */\n @State()\n isMenuOpen = false;\n\n private menuTrigger: HTMLZButtonElement;\n\n private popoverEl: HTMLZPopoverElement;\n\n /**\n * Emitted when the value of the `colspan` changes.\n */\n @Event({\n bubbles: true,\n cancelable: false,\n })\n colspanChange: EventEmitter<number>;\n\n @Watch(\"colspan\")\n protected updateColspan(): void {\n if (this.colspan) {\n this.host.style.gridColumn = `span ${this.colspan}`;\n } else {\n this.host.style.removeProperty(\"grid-column\");\n }\n\n this.colspanChange.emit(this.colspan || 1);\n }\n\n private onMenuButtonClick(ev: MouseEvent): void {\n ev.stopPropagation();\n this.popoverEl.open = !this.popoverEl.open;\n }\n\n componentWillLoad(): void {\n this.updateColspan();\n }\n\n render(): HTMLZTdElement {\n return (\n <Host\n role=\"cell\"\n menu-open={this.isMenuOpen}\n >\n <div class=\"cell--content\">\n <slot></slot>\n {this.showMenu && (\n <div class=\"cell--menu-container prevent-expand\">\n <z-button\n variant={ButtonVariant.TERTIARY}\n icon=\"contextual-menu\"\n size={ControlSize.X_SMALL}\n ref={(el) => (this.menuTrigger = el as HTMLZButtonElement)}\n onClick={this.onMenuButtonClick.bind(this)}\n />\n <z-popover\n class=\"cell-popover\"\n ref={(el) => (this.popoverEl = el as HTMLZPopoverElement)}\n bindTo={this.menuTrigger as HTMLElement}\n onOpenChange={(event) => (this.isMenuOpen = event.detail.open)}\n position={this.popoverPosition}\n >\n <slot name=\"contextual-menu\"></slot>\n </z-popover>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"index-be3c8aaa.js","mappings":";;;;;AAAA,MAAM,SAAS,GAAG,ojDAAojD,CAAC;AACvkD,kBAAe,SAAS;;MCeX,GAAG;;;;0BAaD,KAAK;wBAMP,KAAK;;;IAeN,aAAa;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAkC,YAAY,CAAC,CAAC,CAAC;QACpG,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,KAAK,CAAC,GAAG,EAAE,CAAC;SACb;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CA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I,CAAC,IAAI,CAAC,GAAS,CACrD,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/table/z-tr/styles.css?tag=z-tr&encapsulation=shadow","src/components/table/z-tr/index.tsx"],"sourcesContent":[":host {\n /* number of columns of the row. will be set in component's ts code */\n --columns: 1;\n\n display: grid;\n box-sizing: border-box;\n grid-auto-flow: column;\n grid-template-columns: var(--z-table--expand-button-size, 0) repeat(var(--columns), minmax(128px, 1fr));\n}\n\n* {\n box-sizing: border-box;\n}\n\n.z-tr--expand-button-container,\n::slotted(*) {\n border-bottom: var(--z-table--cells-bottom-border-size, var(--border-size-small)) solid var(--color-surface03);\n}\n\n::slotted(*:not(:last-child)) {\n border-right: var(--z-table--cell-left-border, none);\n}\n\n:host([expandable]) {\n --show-expandable-button: visible;\n\n cursor: pointer;\n}\n\n:host([expandable]) ::slotted(*) {\n grid-row: 1;\n}\n\n:host([expandable]) ::slotted(:nth-last-child(2)) {\n border-right: none;\n}\n\n:host([expandable]) ::slotted(*:last-child) {\n border-left: 0;\n grid-column: 1 / span calc(var(--columns) + 1);\n grid-row: 2;\n}\n\n:host([expandable]:not([expanded])) ::slotted(*:last-child) {\n display: none;\n}\n\n:host([expanded]) {\n margin-bottom: 4px; /* prevents shadow to be cut by the next element */\n box-shadow: 0 4px 4px -2px var(--shadow-color-base);\n}\n\n:host([expanded]) .z-tr--expand-button-container,\n:host([expanded]) ::slotted(*) {\n background-color: var(--color-background);\n}\n\n.z-tr--expand-button-container {\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--z-table--cells-background, var(--color-surface01));\n}\n\n.z-tr--expand-button-container button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: none;\n margin: auto;\n appearance: none;\n background: transparent;\n cursor: pointer;\n visibility: var(--show-expandable-button, hidden);\n}\n\n.z-tr--expand-button-container button:focus {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.z-tr--expand-button-container button z-icon {\n --z-icon-width: 16px;\n --z-icon-height: 16px;\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {randomId} from \"../../../utils/utils\";\nimport \"../cells/z-td/index\";\nimport \"../cells/z-th/index\";\n\n/**\n * ZTr component.\n * When the row is `expandable`, you can set the `prevent-expand` css class on an interactive element inside the row\n * to prevent the row from expanding.\n * @slot - ZTr content (`z-td` or `z-th`).\n */\n@Component({\n tag: \"z-tr\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZTr {\n @Element() host: HTMLZTrElement;\n\n /**\n * Whether the row is expandable.\n * Use a `z-td` as the last cell of the row for the additional content.\n * It will show a button to expand/collapse the row.\n * The last cell will be hidden until the button or row is clicked.\n *\n * If some element inside the expandable row contains the `prevent-expand` css class,\n * the row will not expand by clicking that element.\n */\n @Prop({reflect: true})\n expandable = false;\n\n /**\n * Whether the row is currently expanded.\n */\n @State()\n expanded = false;\n\n /**\n * HTML Id of the expandable content.\n * It is used to link the button to the content through the `aria-controls` attribute.\n */\n @State()\n expandableContentId: string;\n\n /** Row has been expanded */\n @Event()\n expand: EventEmitter;\n\n @Watch(\"expandable\")\n @Listen(\"colspanchange\")\n protected updateColumns(): void {\n const cells = Array.from(this.host.querySelectorAll<HTMLZTdElement | HTMLZThElement>(\"z-td, z-th\"));\n if (this.expandable) {\n cells.pop();\n }\n\n const columns = cells.map((cell) => cell.colspan || 1).reduce((a, b) => a + b, 0);\n this.host.style.setProperty(\"--columns\", `${columns}`);\n\n if (this.expandable) {\n const expandableContent = cells.pop();\n expandableContent.id = expandableContent.id || `z-tr-expandable-content-${randomId()}`;\n this.expandableContentId = expandableContent.id;\n }\n }\n\n /**\n * Handle click on row.\n * Skip expansion if the click is on a element with `prevent-expand` css class.\n */\n private onRowClick(event: MouseEvent): void {\n const preventExpand = (event.target as HTMLElement).closest(\".prevent-expand\");\n if (!this.expandable || preventExpand) {\n return;\n }\n\n this.expanded = !this.expanded;\n this.expand.emit({expanded: this.expanded});\n }\n\n componentWillLoad(): void {\n this.updateColumns();\n }\n\n render(): HTMLZTrElement {\n return (\n <Host\n role=\"row\"\n onClick={this.onRowClick.bind(this)}\n expanded={this.expanded}\n >\n <div class=\"z-tr--expand-button-container\">\n {this.expandable && (\n <button\n aria-expanded={this.expanded ? \"true\" : \"false\"}\n aria-label={this.expanded ? \"Comprimi riga\" : \"Espandi riga\"}\n aria-controls={this.expandableContentId}\n type=\"button\"\n >\n <z-icon name={this.expanded ? \"minus-circled\" : \"plus-circled\"}></z-icon>\n </button>\n )}\n </div>\n <slot onSlotchange={this.updateColumns.bind(this)}></slot>\n </Host>\n );\n }\n}\n"],"version":3}