@swisspost/design-system-components 1.6.1 → 1.6.2

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 (164) hide show
  1. package/dist/cjs/{index-b619e205.js → index-e7618bb3.js} +16 -6
  2. package/dist/cjs/index-e7618bb3.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +26 -0
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/package-041a8597.js +7 -0
  7. package/dist/cjs/package-041a8597.js.map +1 -0
  8. package/dist/cjs/post-accordion.cjs.entry.js +2 -2
  9. package/dist/cjs/post-alert-1fb90f2d.js +101 -0
  10. package/dist/cjs/post-alert-1fb90f2d.js.map +1 -0
  11. package/dist/cjs/post-alert.cjs.entry.js +7 -94
  12. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  13. package/dist/cjs/post-collapsible-e46002bb.js +93 -0
  14. package/dist/cjs/post-collapsible-e46002bb.js.map +1 -0
  15. package/dist/cjs/post-collapsible.cjs.entry.js +5 -86
  16. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  17. package/dist/cjs/post-components.cjs.js +2 -2
  18. package/dist/cjs/post-components.cjs.js.map +1 -1
  19. package/dist/cjs/post-icon-91f6603a.js +105 -0
  20. package/dist/cjs/post-icon-91f6603a.js.map +1 -0
  21. package/dist/cjs/post-icon.cjs.entry.js +6 -98
  22. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  23. package/dist/cjs/post-tab-header-a3845fe5.js +33 -0
  24. package/dist/cjs/post-tab-header-a3845fe5.js.map +1 -0
  25. package/dist/cjs/post-tab-header.cjs.entry.js +5 -26
  26. package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
  27. package/dist/cjs/post-tab-panel-b7326ff8.js +27 -0
  28. package/dist/cjs/post-tab-panel-b7326ff8.js.map +1 -0
  29. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -20
  30. package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
  31. package/dist/cjs/post-tabs-384a1fab.js +153 -0
  32. package/dist/cjs/post-tabs-384a1fab.js.map +1 -0
  33. package/dist/cjs/post-tabs.cjs.entry.js +5 -146
  34. package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
  35. package/dist/cjs/post-tooltip-2becc97a.js +5167 -0
  36. package/dist/cjs/post-tooltip-2becc97a.js.map +1 -0
  37. package/dist/cjs/post-tooltip.cjs.entry.js +5 -5088
  38. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  39. package/dist/collection/collection-manifest.json +4 -4
  40. package/dist/collection/components/post-alert/post-alert.css +1 -1
  41. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  42. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  43. package/dist/collection/index.js +8 -1
  44. package/dist/collection/index.js.map +1 -1
  45. package/dist/components/index.js +7 -0
  46. package/dist/components/index.js.map +1 -1
  47. package/dist/components/package.js +1 -1
  48. package/dist/components/post-alert.js +1 -134
  49. package/dist/components/post-alert.js.map +1 -1
  50. package/dist/components/post-alert2.js +138 -0
  51. package/dist/components/post-alert2.js.map +1 -0
  52. package/dist/components/post-collapsible.js +1 -113
  53. package/dist/components/post-collapsible.js.map +1 -1
  54. package/dist/components/post-collapsible2.js +117 -0
  55. package/dist/components/post-collapsible2.js.map +1 -0
  56. package/dist/components/post-tab-header.js +1 -47
  57. package/dist/components/post-tab-header.js.map +1 -1
  58. package/dist/components/post-tab-header2.js +51 -0
  59. package/dist/components/post-tab-header2.js.map +1 -0
  60. package/dist/components/post-tab-panel.js +1 -39
  61. package/dist/components/post-tab-panel.js.map +1 -1
  62. package/dist/components/post-tab-panel2.js +43 -0
  63. package/dist/components/post-tab-panel2.js.map +1 -0
  64. package/dist/components/post-tabs.js +1 -165
  65. package/dist/components/post-tabs.js.map +1 -1
  66. package/dist/components/post-tabs2.js +169 -0
  67. package/dist/components/post-tabs2.js.map +1 -0
  68. package/dist/components/post-tooltip.js +1 -5113
  69. package/dist/components/post-tooltip.js.map +1 -1
  70. package/dist/components/post-tooltip2.js +5189 -0
  71. package/dist/components/post-tooltip2.js.map +1 -0
  72. package/dist/docs.json +5 -5
  73. package/dist/esm/{index-4eff5fc5.js → index-08d62a75.js} +16 -6
  74. package/dist/esm/index-08d62a75.js.map +1 -0
  75. package/dist/esm/index.js +14 -1
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/loader.js +2 -2
  78. package/dist/esm/package-a962a93d.js +5 -0
  79. package/dist/esm/package-a962a93d.js.map +1 -0
  80. package/dist/esm/post-accordion.entry.js +2 -2
  81. package/dist/{post-components/p-10c47e0a.entry.js → esm/post-alert-46926902.js} +99 -2
  82. package/dist/esm/post-alert-46926902.js.map +1 -0
  83. package/dist/esm/post-alert.entry.js +6 -97
  84. package/dist/esm/post-alert.entry.js.map +1 -1
  85. package/dist/esm/post-collapsible-f1b6592d.js +91 -0
  86. package/dist/esm/post-collapsible-f1b6592d.js.map +1 -0
  87. package/dist/esm/post-collapsible.entry.js +4 -89
  88. package/dist/esm/post-collapsible.entry.js.map +1 -1
  89. package/dist/esm/post-components.js +3 -3
  90. package/dist/esm/post-components.js.map +1 -1
  91. package/dist/esm/post-icon-fb627697.js +103 -0
  92. package/dist/esm/post-icon-fb627697.js.map +1 -0
  93. package/dist/esm/post-icon.entry.js +5 -101
  94. package/dist/esm/post-icon.entry.js.map +1 -1
  95. package/dist/esm/post-tab-header-84b12382.js +31 -0
  96. package/dist/esm/post-tab-header-84b12382.js.map +1 -0
  97. package/dist/esm/post-tab-header.entry.js +4 -29
  98. package/dist/esm/post-tab-header.entry.js.map +1 -1
  99. package/dist/esm/post-tab-panel-216c0b6e.js +25 -0
  100. package/dist/esm/post-tab-panel-216c0b6e.js.map +1 -0
  101. package/dist/esm/post-tab-panel.entry.js +3 -23
  102. package/dist/esm/post-tab-panel.entry.js.map +1 -1
  103. package/dist/esm/post-tabs-e235d663.js +151 -0
  104. package/dist/esm/post-tabs-e235d663.js.map +1 -0
  105. package/dist/esm/post-tabs.entry.js +4 -149
  106. package/dist/esm/post-tabs.entry.js.map +1 -1
  107. package/dist/esm/post-tooltip-47f2146d.js +5165 -0
  108. package/dist/esm/post-tooltip-47f2146d.js.map +1 -0
  109. package/dist/esm/post-tooltip.entry.js +4 -5091
  110. package/dist/esm/post-tooltip.entry.js.map +1 -1
  111. package/dist/post-components/index.esm.js +1 -1
  112. package/dist/post-components/p-03fe58da.js +2 -0
  113. package/dist/post-components/{p-08d942a0.entry.js.map → p-03fe58da.js.map} +1 -1
  114. package/dist/post-components/p-151b55c0.entry.js +2 -0
  115. package/dist/post-components/p-21549a50.js +2 -0
  116. package/dist/post-components/{p-871ade93.entry.js.map → p-21549a50.js.map} +1 -1
  117. package/dist/post-components/p-4cb18ddf.js +9 -0
  118. package/dist/post-components/p-4cb18ddf.js.map +1 -0
  119. package/dist/post-components/p-4e24f13b.entry.js +2 -0
  120. package/dist/post-components/p-4e24f13b.entry.js.map +1 -0
  121. package/dist/post-components/{p-2755ba2e.entry.js → p-57b48dff.js} +2 -2
  122. package/dist/post-components/p-57fdeeab.js +2 -0
  123. package/dist/post-components/{p-10c47e0a.entry.js.map → p-57fdeeab.js.map} +1 -1
  124. package/dist/post-components/p-58cc7b5a.entry.js +2 -0
  125. package/dist/post-components/p-58cc7b5a.entry.js.map +1 -0
  126. package/dist/post-components/p-6cafa644.entry.js +2 -0
  127. package/dist/post-components/p-6cafa644.entry.js.map +1 -0
  128. package/dist/post-components/p-7f370d77.entry.js +2 -0
  129. package/dist/post-components/p-7f370d77.entry.js.map +1 -0
  130. package/dist/post-components/p-7f4eba57.js +2 -0
  131. package/dist/post-components/p-8c006e7d.js +3 -0
  132. package/dist/post-components/p-8c006e7d.js.map +1 -0
  133. package/dist/post-components/p-aee47e1a.entry.js +2 -0
  134. package/dist/post-components/p-aee47e1a.entry.js.map +1 -0
  135. package/dist/post-components/p-b5e1fd89.js +2 -0
  136. package/dist/post-components/{p-a18e1d1c.entry.js.map → p-b5e1fd89.js.map} +1 -1
  137. package/dist/post-components/{p-6a0a1ce4.entry.js → p-ce907090.entry.js} +2 -2
  138. package/dist/post-components/p-d13111f2.js +2 -0
  139. package/dist/post-components/p-d13111f2.js.map +1 -0
  140. package/dist/post-components/p-f35c2075.entry.js +2 -0
  141. package/dist/post-components/p-f35c2075.entry.js.map +1 -0
  142. package/dist/post-components/post-components.esm.js +1 -1
  143. package/dist/post-components/post-components.esm.js.map +1 -1
  144. package/dist/types/index.d.ts +7 -0
  145. package/package.json +12 -12
  146. package/dist/cjs/index-b619e205.js.map +0 -1
  147. package/dist/cjs/package-bd70f73c.js +0 -7
  148. package/dist/cjs/package-bd70f73c.js.map +0 -1
  149. package/dist/esm/index-4eff5fc5.js.map +0 -1
  150. package/dist/esm/package-f3f12016.js +0 -5
  151. package/dist/esm/package-f3f12016.js.map +0 -1
  152. package/dist/post-components/p-08d942a0.entry.js +0 -2
  153. package/dist/post-components/p-4aae941f.js +0 -2
  154. package/dist/post-components/p-7d91397a.entry.js +0 -2
  155. package/dist/post-components/p-871ade93.entry.js +0 -2
  156. package/dist/post-components/p-a18e1d1c.entry.js +0 -2
  157. package/dist/post-components/p-a7649277.js +0 -3
  158. package/dist/post-components/p-a7649277.js.map +0 -1
  159. package/dist/post-components/p-b4b7e30c.entry.js +0 -9
  160. package/dist/post-components/p-b4b7e30c.entry.js.map +0 -1
  161. /package/dist/post-components/{p-4aae941f.js.map → p-151b55c0.entry.js.map} +0 -0
  162. /package/dist/post-components/{p-2755ba2e.entry.js.map → p-57b48dff.js.map} +0 -0
  163. /package/dist/post-components/{p-7d91397a.entry.js.map → p-7f4eba57.js.map} +0 -0
  164. /package/dist/post-components/{p-6a0a1ce4.entry.js.map → p-ce907090.entry.js.map} +0 -0
@@ -1,116 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { v as version } from './package.js';
3
- import { d as checkEmptyOrType, b as checkEmptyOrOneOf } from './index2.js';
4
-
5
- function isMotionReduced() {
6
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
7
- }
8
-
9
- const collapseDuration = 350;
10
- const collapseEasing = 'ease';
11
- const collapsedKeyframe = { height: '0', overflow: 'hidden' };
12
- const collapse = (el) => {
13
- const { height } = window.getComputedStyle(el);
14
- const expandedKeyframe = { height };
15
- return el.animate([expandedKeyframe, collapsedKeyframe], { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' });
16
- };
17
- const expand = (el) => {
18
- const expandedKeyframe = { height: `${el.scrollHeight}px` };
19
- return el.animate([collapsedKeyframe, expandedKeyframe], { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' });
20
- };
21
-
22
- const HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
23
-
24
- const postCollapsibleCss = ".accordion-item{border-block-start:2px solid #e6e6e6}.accordion-header{font-size:1.0625rem;font-weight:700;line-height:1.5;margin:0}@media (min-width: 1024px){.accordion-header{font-size:1.25rem}}.accordion-button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button;width:100%;position:relative;padding-block:1rem;padding-inline-start:1rem;padding-inline-end:2.5rem;text-align:start}.accordion-button:not(:disabled){cursor:pointer}.accordion-button:disabled{opacity:.4}.accordion-button:focus{outline:none;box-shadow:0 0 0 .125rem rgba(51,51,51,.25)}.accordion-button::after{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m23.6 18.3-.9.9-6.7-6.6-6.6 6.6-.9-.9 7.5-7.6 7.6 7.6z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m23.6 18.3-.9.9-6.7-6.6-6.6 6.6-.9-.9 7.5-7.6 7.6 7.6z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor;content:\"\";display:block;height:1.5rem;width:1.5rem;position:absolute;inset-inline-end:1rem;inset-block-start:50%;transform:translateY(-50%);transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1);border:1px solid rgb(var(--post-bg-rgb, 255, 255, 255))}.accordion-button.collapsed::after{transform:translateY(-50%) rotate(-180deg)}.accordion-button>.text-truncate{display:block}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:hover:not(:disabled),.accordion-button:focus-visible:not(:disabled){outline:2px solid Highlight}.accordion-button:disabled{opacity:1 !important}}.accordion-body{padding:.75rem 1rem 2.5rem;border-block-start:2px solid #e6e6e6}.accordion-body h1,.accordion-body .h1{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h1,.accordion-body .h1{font-size:1.25rem}}.accordion-body h2,.accordion-body .h2{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h2,.accordion-body .h2{font-size:1.25rem}}.accordion-body h3,.accordion-body .h3{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h3,.accordion-body .h3{font-size:1.25rem}}.accordion-body h4,.accordion-body .h4{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h4,.accordion-body .h4{font-size:1.25rem}}.accordion-body h5,.accordion-body .h5{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h5,.accordion-body .h5{font-size:1.25rem}}.accordion-body h6,.accordion-body .h6{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h6,.accordion-body .h6{font-size:1.25rem}}.accordion-button>:first-child,.accordion-body>:first-child{margin-block-start:0 !important}.accordion-button>:last-child,.accordion-body>:last-child{margin-block-end:0 !important}:host{display:block}:host .accordion-button>::slotted(.text-truncate){display:block}";
25
-
26
- const PostCollapsible$1 = /*@__PURE__*/ proxyCustomElement(class PostCollapsible extends HTMLElement {
27
- constructor() {
28
- super();
29
- this.__registerHost();
30
- this.__attachShadow();
31
- this.collapseChange = createEvent(this, "collapseChange", 7);
32
- this.isLoaded = false;
33
- this.id = undefined;
34
- this.isOpen = true;
35
- this.hasHeader = undefined;
36
- this.headingTag = undefined;
37
- this.collapsed = false;
38
- this.headingLevel = 2;
39
- }
40
- validateCollapsed(newValue = this.collapsed) {
41
- checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
42
- }
43
- validateHeadingLevel(newValue = this.headingLevel) {
44
- checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');
45
- }
46
- connectedCallback() {
47
- this.validateCollapsed();
48
- this.validateHeadingLevel();
49
- }
50
- componentWillRender() {
51
- var _a;
52
- this.id = this.host.id || `c${crypto.randomUUID()}`;
53
- this.hasHeader = this.host.querySelectorAll('[slot="header"]').length > 0;
54
- this.headingTag = `h${(_a = this.headingLevel) !== null && _a !== void 0 ? _a : 2}`;
55
- }
56
- componentDidLoad() {
57
- if (this.collapsed)
58
- void this.toggle(false);
59
- this.isLoaded = true;
60
- }
61
- /**
62
- * Triggers the collapse programmatically.
63
- *
64
- * If there is a collapsing transition running already, it will be reversed.
65
- */
66
- async toggle(open = !this.isOpen) {
67
- if (open === this.isOpen)
68
- return open;
69
- this.isOpen = !this.isOpen;
70
- if (this.isLoaded)
71
- this.collapseChange.emit();
72
- const animation = open ? expand(this.collapsible) : collapse(this.collapsible);
73
- if (!this.isLoaded || isMotionReduced())
74
- animation.finish();
75
- await animation.finished;
76
- animation.commitStyles();
77
- return this.isOpen;
78
- }
79
- render() {
80
- const collapse = (h("div", { "aria-labelledby": this.hasHeader ? `${this.id}--header` : undefined, class: `collapse${this.hasHeader ? ' accordion-collapse' : ''}`, id: `${this.id}--collapse`, ref: el => this.collapsible = el }, this.hasHeader ? (h("div", { class: "accordion-body" }, h("slot", null))) : (h("slot", null))));
81
- return (h(Host, { id: this.id, "data-version": version }, this.hasHeader ? (h("div", { class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.id}--header` }, h("button", { "aria-controls": `${this.id}--collapse`, "aria-expanded": `${this.isOpen}`, class: `accordion-button${this.isOpen ? '' : ' collapsed'}`, onClick: () => this.toggle(), type: "button" }, h("slot", { name: "header" }))), collapse)) : collapse));
82
- }
83
- get host() { return this; }
84
- static get watchers() { return {
85
- "collapsed": ["validateCollapsed"],
86
- "headingLevel": ["validateHeadingLevel"]
87
- }; }
88
- static get style() { return postCollapsibleCss; }
89
- }, [1, "post-collapsible", {
90
- "collapsed": [4],
91
- "headingLevel": [2, "heading-level"],
92
- "id": [32],
93
- "isOpen": [32],
94
- "hasHeader": [32],
95
- "headingTag": [32],
96
- "toggle": [64]
97
- }, undefined, {
98
- "collapsed": ["validateCollapsed"],
99
- "headingLevel": ["validateHeadingLevel"]
100
- }]);
101
- function defineCustomElement$1() {
102
- if (typeof customElements === "undefined") {
103
- return;
104
- }
105
- const components = ["post-collapsible"];
106
- components.forEach(tagName => { switch (tagName) {
107
- case "post-collapsible":
108
- if (!customElements.get(tagName)) {
109
- customElements.define(tagName, PostCollapsible$1);
110
- }
111
- break;
112
- } });
113
- }
1
+ import { P as PostCollapsible$1, d as defineCustomElement$1 } from './post-collapsible2.js';
114
2
 
115
3
  const PostCollapsible = PostCollapsible$1;
116
4
  const defineCustomElement = defineCustomElement$1;
@@ -1 +1 @@
1
- {"file":"post-collapsible.js","mappings":";;;;SAAgB,eAAe;EAC7B,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE;;ACFA,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,iBAAi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AAC,SAAS,GAAG,GAAG,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,EAClE,KAAK,EAAE,WAAW,IAAI,CAAC,SAAS,GAAG,qBAAqB,GAAG,EAAE,EAAE,EAC/D,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,YAAY,EAC1B,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,IAE/B,IAAI,CAAC,SAAS,IACb,WAAK,KAAK,EAAC,gBAAgB,IACzB,eAAO,CACH,KAEN,eAAO,CACR,CACG,CACP,CAAC;IAEF,QACE,EAAC,IAAI,IAAC,EAAE,EAAE,IAAI,CAAC,EAAE,kBAAgB,OAAO,IACrC,IAAI,CAAC,SAAS,IACb,WAAK,KAAK,EAAC,gBAAgB,IACzB,EAAC,IAAI,CAAC,UAAU,IAAC,KAAK,EAAC,kBAAkB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,UAAU,IAChE,+BACiB,GAAG,IAAI,CAAC,EAAE,YAAY,mBACtB,GAAG,IAAI,CAAC,MAAM,EAAE,EAC/B,KAAK,EAAE,mBAAmB,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,YAAY,EAAE,EAC3D,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,EAC5B,IAAI,EAAC,QAAQ,IAEb,YAAM,IAAI,EAAC,QAAQ,GAAE,CACd,CACO,EAEjB,QAAQ,CACL,IACJ,QAAQ,CACP,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostCollapsible"],"sources":["src/utils/is-motion-reduced.ts","src/animations/collapse.ts","src/components/post-collapsible/heading-levels.ts","src/components/post-collapsible/post-collapsible.scss?tag=post-collapsible&encapsulation=shadow","src/components/post-collapsible/post-collapsible.tsx"],"sourcesContent":["export function isMotionReduced(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n","const collapseDuration = 350;\nconst collapseEasing = 'ease';\nconst collapsedKeyframe: Keyframe = { height: '0', overflow: 'hidden' };\n\nexport const collapse = (el: HTMLElement): Animation => {\n const { height } = window.getComputedStyle(el);\n const expandedKeyframe: Keyframe = { height };\n\n return el.animate(\n [expandedKeyframe, collapsedKeyframe],\n { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' },\n );\n};\n\nexport const expand = (el: HTMLElement): Animation => {\n const expandedKeyframe: Keyframe = { height: `${el.scrollHeight}px` };\n\n return el.animate(\n [collapsedKeyframe, expandedKeyframe],\n { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' },\n );\n};\n","export const HEADING_LEVELS = [1, 2, 3, 4, 5, 6] as const;\n\nexport type HeadingLevel = typeof HEADING_LEVELS[number];\n","@use '@swisspost/design-system-styles/components/accordion';\n\n:host {\n display: block;\n\n .accordion-button > ::slotted(.text-truncate) {\n display: block;\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { collapse, expand } from '../../animations/collapse';\nimport { checkEmptyOrOneOf, checkEmptyOrType, isMotionReduced } from '../../utils';\nimport { HEADING_LEVELS, HeadingLevel } from './heading-levels';\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private isLoaded = false;\n private collapsible: HTMLElement;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() id: string;\n @State() isOpen = true;\n @State() hasHeader: boolean;\n @State() headingTag: string;\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: HeadingLevel = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');\n }\n\n /**\n * An event emitted when the collapse element is shown or hidden, before the transition. It has no payload.\n */\n @Event() collapseChange: EventEmitter<void>;\n\n connectedCallback() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n }\n\n componentWillRender() {\n this.id = this.host.id || `c${crypto.randomUUID()}`;\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n this.headingTag = `h${this.headingLevel ?? 2}`;\n }\n\n componentDidLoad() {\n if (this.collapsed) void this.toggle(false);\n this.isLoaded = true;\n }\n\n /**\n * Triggers the collapse programmatically.\n *\n * If there is a collapsing transition running already, it will be reversed.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open === this.isOpen) return open;\n\n this.isOpen = !this.isOpen;\n if (this.isLoaded) this.collapseChange.emit();\n\n const animation = open ? expand(this.collapsible): collapse(this.collapsible);\n\n if (!this.isLoaded || isMotionReduced()) animation.finish();\n\n await animation.finished;\n\n animation.commitStyles();\n\n return this.isOpen;\n }\n\n render() {\n const collapse = (\n <div\n aria-labelledby={this.hasHeader ? `${this.id}--header` : undefined}\n class={`collapse${this.hasHeader ? ' accordion-collapse' : ''}`}\n id={`${this.id}--collapse`}\n ref={el => this.collapsible = el}\n >\n {this.hasHeader ? (\n <div class=\"accordion-body\">\n <slot/>\n </div>\n ) : (\n <slot/>\n )}\n </div>\n );\n\n return (\n <Host id={this.id} data-version={version}>\n {this.hasHeader ? (\n <div class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.id}--header`}>\n <button\n aria-controls={`${this.id}--collapse`}\n aria-expanded={`${this.isOpen}`}\n class={`accordion-button${this.isOpen ? '' : ' collapsed'}`}\n onClick={() => this.toggle()}\n type=\"button\"\n >\n <slot name=\"header\"/>\n </button>\n </this.headingTag>\n\n {collapse}\n </div>\n ) : collapse}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-collapsible.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,117 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+ import { d as checkEmptyOrType, b as checkEmptyOrOneOf } from './index2.js';
4
+
5
+ function isMotionReduced() {
6
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
7
+ }
8
+
9
+ const collapseDuration = 350;
10
+ const collapseEasing = 'ease';
11
+ const collapsedKeyframe = { height: '0', overflow: 'hidden' };
12
+ const collapse = (el) => {
13
+ const { height } = window.getComputedStyle(el);
14
+ const expandedKeyframe = { height };
15
+ return el.animate([expandedKeyframe, collapsedKeyframe], { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' });
16
+ };
17
+ const expand = (el) => {
18
+ const expandedKeyframe = { height: `${el.scrollHeight}px` };
19
+ return el.animate([collapsedKeyframe, expandedKeyframe], { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' });
20
+ };
21
+
22
+ const HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
23
+
24
+ const postCollapsibleCss = ".accordion-item{border-block-start:2px solid #e6e6e6}.accordion-header{font-size:1.0625rem;font-weight:700;line-height:1.5;margin:0}@media (min-width: 1024px){.accordion-header{font-size:1.25rem}}.accordion-button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button;width:100%;position:relative;padding-block:1rem;padding-inline-start:1rem;padding-inline-end:2.5rem;text-align:start}.accordion-button:not(:disabled){cursor:pointer}.accordion-button:disabled{opacity:.4}.accordion-button:focus{outline:none;box-shadow:0 0 0 .125rem rgba(51,51,51,.25)}.accordion-button::after{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m23.6 18.3-.9.9-6.7-6.6-6.6 6.6-.9-.9 7.5-7.6 7.6 7.6z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m23.6 18.3-.9.9-6.7-6.6-6.6 6.6-.9-.9 7.5-7.6 7.6 7.6z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor;content:\"\";display:block;height:1.5rem;width:1.5rem;position:absolute;inset-inline-end:1rem;inset-block-start:50%;transform:translateY(-50%);transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1);border:1px solid rgb(var(--post-bg-rgb, 255, 255, 255))}.accordion-button.collapsed::after{transform:translateY(-50%) rotate(-180deg)}.accordion-button>.text-truncate{display:block}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:hover:not(:disabled),.accordion-button:focus-visible:not(:disabled){outline:2px solid Highlight}.accordion-button:disabled{opacity:1 !important}}.accordion-body{padding:.75rem 1rem 2.5rem;border-block-start:2px solid #e6e6e6}.accordion-body h1,.accordion-body .h1{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h1,.accordion-body .h1{font-size:1.25rem}}.accordion-body h2,.accordion-body .h2{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h2,.accordion-body .h2{font-size:1.25rem}}.accordion-body h3,.accordion-body .h3{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h3,.accordion-body .h3{font-size:1.25rem}}.accordion-body h4,.accordion-body .h4{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h4,.accordion-body .h4{font-size:1.25rem}}.accordion-body h5,.accordion-body .h5{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h5,.accordion-body .h5{font-size:1.25rem}}.accordion-body h6,.accordion-body .h6{font-size:1.0625rem;margin:2.5rem 0 0;font-weight:700}@media (min-width: 1024px){.accordion-body h6,.accordion-body .h6{font-size:1.25rem}}.accordion-button>:first-child,.accordion-body>:first-child{margin-block-start:0 !important}.accordion-button>:last-child,.accordion-body>:last-child{margin-block-end:0 !important}:host{display:block}:host .accordion-button>::slotted(.text-truncate){display:block}";
25
+
26
+ const PostCollapsible = /*@__PURE__*/ proxyCustomElement(class PostCollapsible extends HTMLElement {
27
+ constructor() {
28
+ super();
29
+ this.__registerHost();
30
+ this.__attachShadow();
31
+ this.collapseChange = createEvent(this, "collapseChange", 7);
32
+ this.isLoaded = false;
33
+ this.id = undefined;
34
+ this.isOpen = true;
35
+ this.hasHeader = undefined;
36
+ this.headingTag = undefined;
37
+ this.collapsed = false;
38
+ this.headingLevel = 2;
39
+ }
40
+ validateCollapsed(newValue = this.collapsed) {
41
+ checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
42
+ }
43
+ validateHeadingLevel(newValue = this.headingLevel) {
44
+ checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');
45
+ }
46
+ connectedCallback() {
47
+ this.validateCollapsed();
48
+ this.validateHeadingLevel();
49
+ }
50
+ componentWillRender() {
51
+ var _a;
52
+ this.id = this.host.id || `c${crypto.randomUUID()}`;
53
+ this.hasHeader = this.host.querySelectorAll('[slot="header"]').length > 0;
54
+ this.headingTag = `h${(_a = this.headingLevel) !== null && _a !== void 0 ? _a : 2}`;
55
+ }
56
+ componentDidLoad() {
57
+ if (this.collapsed)
58
+ void this.toggle(false);
59
+ this.isLoaded = true;
60
+ }
61
+ /**
62
+ * Triggers the collapse programmatically.
63
+ *
64
+ * If there is a collapsing transition running already, it will be reversed.
65
+ */
66
+ async toggle(open = !this.isOpen) {
67
+ if (open === this.isOpen)
68
+ return open;
69
+ this.isOpen = !this.isOpen;
70
+ if (this.isLoaded)
71
+ this.collapseChange.emit();
72
+ const animation = open ? expand(this.collapsible) : collapse(this.collapsible);
73
+ if (!this.isLoaded || isMotionReduced())
74
+ animation.finish();
75
+ await animation.finished;
76
+ animation.commitStyles();
77
+ return this.isOpen;
78
+ }
79
+ render() {
80
+ const collapse = (h("div", { "aria-labelledby": this.hasHeader ? `${this.id}--header` : undefined, class: `collapse${this.hasHeader ? ' accordion-collapse' : ''}`, id: `${this.id}--collapse`, ref: el => this.collapsible = el }, this.hasHeader ? (h("div", { class: "accordion-body" }, h("slot", null))) : (h("slot", null))));
81
+ return (h(Host, { id: this.id, "data-version": version }, this.hasHeader ? (h("div", { class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.id}--header` }, h("button", { "aria-controls": `${this.id}--collapse`, "aria-expanded": `${this.isOpen}`, class: `accordion-button${this.isOpen ? '' : ' collapsed'}`, onClick: () => this.toggle(), type: "button" }, h("slot", { name: "header" }))), collapse)) : collapse));
82
+ }
83
+ get host() { return this; }
84
+ static get watchers() { return {
85
+ "collapsed": ["validateCollapsed"],
86
+ "headingLevel": ["validateHeadingLevel"]
87
+ }; }
88
+ static get style() { return postCollapsibleCss; }
89
+ }, [1, "post-collapsible", {
90
+ "collapsed": [4],
91
+ "headingLevel": [2, "heading-level"],
92
+ "id": [32],
93
+ "isOpen": [32],
94
+ "hasHeader": [32],
95
+ "headingTag": [32],
96
+ "toggle": [64]
97
+ }, undefined, {
98
+ "collapsed": ["validateCollapsed"],
99
+ "headingLevel": ["validateHeadingLevel"]
100
+ }]);
101
+ function defineCustomElement() {
102
+ if (typeof customElements === "undefined") {
103
+ return;
104
+ }
105
+ const components = ["post-collapsible"];
106
+ components.forEach(tagName => { switch (tagName) {
107
+ case "post-collapsible":
108
+ if (!customElements.get(tagName)) {
109
+ customElements.define(tagName, PostCollapsible);
110
+ }
111
+ break;
112
+ } });
113
+ }
114
+
115
+ export { PostCollapsible as P, defineCustomElement as d };
116
+
117
+ //# sourceMappingURL=post-collapsible2.js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","src/components/post-collapsible/heading-levels.ts","src/components/post-collapsible/post-collapsible.scss?tag=post-collapsible&encapsulation=shadow","src/components/post-collapsible/post-collapsible.tsx"],"sourcesContent":["export function isMotionReduced(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n","const collapseDuration = 350;\nconst collapseEasing = 'ease';\nconst collapsedKeyframe: Keyframe = { height: '0', overflow: 'hidden' };\n\nexport const collapse = (el: HTMLElement): Animation => {\n const { height } = window.getComputedStyle(el);\n const expandedKeyframe: Keyframe = { height };\n\n return el.animate(\n [expandedKeyframe, collapsedKeyframe],\n { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' },\n );\n};\n\nexport const expand = (el: HTMLElement): Animation => {\n const expandedKeyframe: Keyframe = { height: `${el.scrollHeight}px` };\n\n return el.animate(\n [collapsedKeyframe, expandedKeyframe],\n { duration: collapseDuration, easing: collapseEasing, fill: 'forwards' },\n );\n};\n","export const HEADING_LEVELS = [1, 2, 3, 4, 5, 6] as const;\n\nexport type HeadingLevel = typeof HEADING_LEVELS[number];\n","@use '@swisspost/design-system-styles/components/accordion';\n\n:host {\n display: block;\n\n .accordion-button > ::slotted(.text-truncate) {\n display: block;\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { collapse, expand } from '../../animations/collapse';\nimport { checkEmptyOrOneOf, checkEmptyOrType, isMotionReduced } from '../../utils';\nimport { HEADING_LEVELS, HeadingLevel } from './heading-levels';\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private isLoaded = false;\n private collapsible: HTMLElement;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() id: string;\n @State() isOpen = true;\n @State() hasHeader: boolean;\n @State() headingTag: string;\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: HeadingLevel = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');\n }\n\n /**\n * An event emitted when the collapse element is shown or hidden, before the transition. It has no payload.\n */\n @Event() collapseChange: EventEmitter<void>;\n\n connectedCallback() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n }\n\n componentWillRender() {\n this.id = this.host.id || `c${crypto.randomUUID()}`;\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n this.headingTag = `h${this.headingLevel ?? 2}`;\n }\n\n componentDidLoad() {\n if (this.collapsed) void this.toggle(false);\n this.isLoaded = true;\n }\n\n /**\n * Triggers the collapse programmatically.\n *\n * If there is a collapsing transition running already, it will be reversed.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open === this.isOpen) return open;\n\n this.isOpen = !this.isOpen;\n if (this.isLoaded) this.collapseChange.emit();\n\n const animation = open ? expand(this.collapsible): collapse(this.collapsible);\n\n if (!this.isLoaded || isMotionReduced()) animation.finish();\n\n await animation.finished;\n\n animation.commitStyles();\n\n return this.isOpen;\n }\n\n render() {\n const collapse = (\n <div\n aria-labelledby={this.hasHeader ? `${this.id}--header` : undefined}\n class={`collapse${this.hasHeader ? ' accordion-collapse' : ''}`}\n id={`${this.id}--collapse`}\n ref={el => this.collapsible = el}\n >\n {this.hasHeader ? (\n <div class=\"accordion-body\">\n <slot/>\n </div>\n ) : (\n <slot/>\n )}\n </div>\n );\n\n return (\n <Host id={this.id} data-version={version}>\n {this.hasHeader ? (\n <div class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.id}--header`}>\n <button\n aria-controls={`${this.id}--collapse`}\n aria-expanded={`${this.isOpen}`}\n class={`accordion-button${this.isOpen ? '' : ' collapsed'}`}\n onClick={() => this.toggle()}\n type=\"button\"\n >\n <slot name=\"header\"/>\n </button>\n </this.headingTag>\n\n {collapse}\n </div>\n ) : collapse}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,50 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { v as version } from './package.js';
3
- import { c as checkNonEmpty } from './check-non-empty.js';
4
-
5
- const postTabHeaderCss = ".tab-title[role=tab]{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button}";
6
-
7
- const PostTabHeader$1 = /*@__PURE__*/ proxyCustomElement(class PostTabHeader extends HTMLElement {
8
- constructor() {
9
- super();
10
- this.__registerHost();
11
- this.__attachShadow();
12
- this.tabId = undefined;
13
- this.panel = undefined;
14
- }
15
- validateFor(newValue) {
16
- checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
17
- }
18
- componentWillLoad() {
19
- this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
20
- }
21
- render() {
22
- return (h(Host, { "data-version": version }, h("button", { "aria-selected": "false", class: "tab-title", id: this.tabId, role: "tab", tabindex: "-1", type: "button" }, h("slot", null))));
23
- }
24
- get host() { return this; }
25
- static get watchers() { return {
26
- "panel": ["validateFor"]
27
- }; }
28
- static get style() { return postTabHeaderCss; }
29
- }, [1, "post-tab-header", {
30
- "panel": [1],
31
- "tabId": [32]
32
- }, undefined, {
33
- "panel": ["validateFor"]
34
- }]);
35
- function defineCustomElement$1() {
36
- if (typeof customElements === "undefined") {
37
- return;
38
- }
39
- const components = ["post-tab-header"];
40
- components.forEach(tagName => { switch (tagName) {
41
- case "post-tab-header":
42
- if (!customElements.get(tagName)) {
43
- customElements.define(tagName, PostTabHeader$1);
44
- }
45
- break;
46
- } });
47
- }
1
+ import { P as PostTabHeader$1, d as defineCustomElement$1 } from './post-tab-header2.js';
48
2
 
49
3
  const PostTabHeader = PostTabHeader$1;
50
4
  const defineCustomElement = defineCustomElement$1;
@@ -1 +1 @@
1
- {"file":"post-tab-header.js","mappings":";;;;AAAA,MAAM,gBAAgB,GAAG,k+LAAk+L;;MCS9+LA,eAAa;;;;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnD,aAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;GAClF;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC3D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,+BAAsB,OAAO,EAAC,KAAK,EAAC,WAAW,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,IACpG,eAAQ,CACD,CACJ,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostTabHeader"],"sources":["src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n}\n\n.tab-title {\n @include post.reset-button;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <button aria-selected=\"false\" class=\"tab-title\" id={this.tabId} role=\"tab\" tabindex=\"-1\" type=\"button\">\n <slot />\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-tab-header.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,51 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+ import { c as checkNonEmpty } from './check-non-empty.js';
4
+
5
+ const postTabHeaderCss = ".tab-title[role=tab]{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button}";
6
+
7
+ const PostTabHeader = /*@__PURE__*/ proxyCustomElement(class PostTabHeader extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.tabId = undefined;
13
+ this.panel = undefined;
14
+ }
15
+ validateFor(newValue) {
16
+ checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
17
+ }
18
+ componentWillLoad() {
19
+ this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
20
+ }
21
+ render() {
22
+ return (h(Host, { "data-version": version }, h("button", { "aria-selected": "false", class: "tab-title", id: this.tabId, role: "tab", tabindex: "-1", type: "button" }, h("slot", null))));
23
+ }
24
+ get host() { return this; }
25
+ static get watchers() { return {
26
+ "panel": ["validateFor"]
27
+ }; }
28
+ static get style() { return postTabHeaderCss; }
29
+ }, [1, "post-tab-header", {
30
+ "panel": [1],
31
+ "tabId": [32]
32
+ }, undefined, {
33
+ "panel": ["validateFor"]
34
+ }]);
35
+ function defineCustomElement() {
36
+ if (typeof customElements === "undefined") {
37
+ return;
38
+ }
39
+ const components = ["post-tab-header"];
40
+ components.forEach(tagName => { switch (tagName) {
41
+ case "post-tab-header":
42
+ if (!customElements.get(tagName)) {
43
+ customElements.define(tagName, PostTabHeader);
44
+ }
45
+ break;
46
+ } });
47
+ }
48
+
49
+ export { PostTabHeader as P, defineCustomElement as d };
50
+
51
+ //# sourceMappingURL=post-tab-header2.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-header2.js","mappings":";;;;AAAA,MAAM,gBAAgB,GAAG,k+LAAk+L;;MCS9+L,aAAa;;;;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnD,aAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;GAClF;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC3D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,+BAAsB,OAAO,EAAC,KAAK,EAAC,WAAW,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,IACpG,eAAQ,CACD,CACJ,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n}\n\n.tab-title {\n @include post.reset-button;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <button aria-selected=\"false\" class=\"tab-title\" id={this.tabId} role=\"tab\" tabindex=\"-1\" type=\"button\">\n <slot />\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,42 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { v as version } from './package.js';
3
-
4
- const postTabPanelCss = ":host{display:none}";
5
-
6
- const PostTabPanel$1 = /*@__PURE__*/ proxyCustomElement(class PostTabPanel extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
11
- this.panelId = undefined;
12
- this.name = undefined;
13
- }
14
- componentWillLoad() {
15
- // get the id set on the host element or use a random id by default
16
- this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
17
- }
18
- render() {
19
- return (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
20
- }
21
- get host() { return this; }
22
- static get style() { return postTabPanelCss; }
23
- }, [1, "post-tab-panel", {
24
- "name": [1],
25
- "panelId": [32]
26
- }]);
27
- function defineCustomElement$1() {
28
- if (typeof customElements === "undefined") {
29
- return;
30
- }
31
- const components = ["post-tab-panel"];
32
- components.forEach(tagName => { switch (tagName) {
33
- case "post-tab-panel":
34
- if (!customElements.get(tagName)) {
35
- customElements.define(tagName, PostTabPanel$1);
36
- }
37
- break;
38
- } });
39
- }
1
+ import { P as PostTabPanel$1, d as defineCustomElement$1 } from './post-tab-panel2.js';
40
2
 
41
3
  const PostTabPanel = PostTabPanel$1;
42
4
  const defineCustomElement = defineCustomElement$1;
@@ -1 +1 @@
1
- {"file":"post-tab-panel.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhCA,cAAY;;;;;;;;EAUvB,iBAAiB;;IAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC/D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEf,eAAO,CACH,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostTabPanel"],"sources":["src/components/post-tab-panel/post-tab-panel.scss?tag=post-tab-panel&encapsulation=shadow","src/components/post-tab-panel/post-tab-panel.tsx"],"sourcesContent":[":host {\n display: none;\n}\n","import { Component, Element, h, Host, Prop, State } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-tab-panel',\n styleUrl: 'post-tab-panel.scss',\n shadow: true,\n})\nexport class PostTabPanel {\n @Element() host: HTMLPostTabPanelElement;\n\n @State() panelId: string;\n\n /**\n * The name of the panel, used to associate it with a tab header.\n */\n @Prop() readonly name: string;\n\n componentWillLoad() {\n // get the id set on the host element or use a random id by default\n this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n class=\"tab-pane\"\n id={this.panelId}\n role=\"tabpanel\"\n >\n <slot/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-tab-panel.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,43 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+
4
+ const postTabPanelCss = ":host{display:none}";
5
+
6
+ const PostTabPanel = /*@__PURE__*/ proxyCustomElement(class PostTabPanel extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.panelId = undefined;
12
+ this.name = undefined;
13
+ }
14
+ componentWillLoad() {
15
+ // get the id set on the host element or use a random id by default
16
+ this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
17
+ }
18
+ render() {
19
+ return (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
20
+ }
21
+ get host() { return this; }
22
+ static get style() { return postTabPanelCss; }
23
+ }, [1, "post-tab-panel", {
24
+ "name": [1],
25
+ "panelId": [32]
26
+ }]);
27
+ function defineCustomElement() {
28
+ if (typeof customElements === "undefined") {
29
+ return;
30
+ }
31
+ const components = ["post-tab-panel"];
32
+ components.forEach(tagName => { switch (tagName) {
33
+ case "post-tab-panel":
34
+ if (!customElements.get(tagName)) {
35
+ customElements.define(tagName, PostTabPanel);
36
+ }
37
+ break;
38
+ } });
39
+ }
40
+
41
+ export { PostTabPanel as P, defineCustomElement as d };
42
+
43
+ //# sourceMappingURL=post-tab-panel2.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-panel2.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhC,YAAY;;;;;;;;EAUvB,iBAAiB;;IAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC/D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEf,eAAO,CACH,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/post-tab-panel/post-tab-panel.scss?tag=post-tab-panel&encapsulation=shadow","src/components/post-tab-panel/post-tab-panel.tsx"],"sourcesContent":[":host {\n display: none;\n}\n","import { Component, Element, h, Host, Prop, State } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-tab-panel',\n styleUrl: 'post-tab-panel.scss',\n shadow: true,\n})\nexport class PostTabPanel {\n @Element() host: HTMLPostTabPanelElement;\n\n @State() panelId: string;\n\n /**\n * The name of the panel, used to associate it with a tab header.\n */\n @Prop() readonly name: string;\n\n componentWillLoad() {\n // get the id set on the host element or use a random id by default\n this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n class=\"tab-pane\"\n id={this.panelId}\n role=\"tabpanel\"\n >\n <slot/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}