q2-tecton-elements 1.21.2 → 1.22.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 (152) hide show
  1. package/dist/cjs/installCanvasRenderer-b4d10c92.js +38433 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-badge_2.cjs.entry.js +5 -3
  4. package/dist/cjs/q2-calendar.cjs.entry.js +75 -55
  5. package/dist/cjs/q2-carousel.cjs.entry.js +3 -3
  6. package/dist/cjs/q2-chart-bar.cjs.entry.js +4679 -0
  7. package/dist/cjs/q2-chart-donut.cjs.entry.js +357 -35592
  8. package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  10. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/q2-calendar/index.js +43 -2
  14. package/dist/collection/components/q2-chart-bar/index.js +466 -0
  15. package/dist/collection/components/q2-chart-bar/styles.css +85 -0
  16. package/dist/collection/components/q2-chart-donut/index.js +3 -3
  17. package/dist/collection/components/q2-checkbox/styles.css +5 -1
  18. package/dist/collection/components/q2-editable-field/styles.css +1 -1
  19. package/dist/collection/components/q2-input/formatting/phone.js +2 -2
  20. package/dist/collection/components/q2-input/index.js +21 -0
  21. package/dist/collection/components/q2-input/styles.css +2 -2
  22. package/dist/collection/components/q2-radio/styles.css +1 -1
  23. package/dist/collection/utils/charting.js +182 -0
  24. package/dist/components/click-elsewhere.d.ts +11 -0
  25. package/dist/components/click-elsewhere.js +6 -0
  26. package/dist/components/index.d.ts +62 -0
  27. package/dist/components/index.js +42 -0
  28. package/dist/components/index10.js +84 -0
  29. package/dist/components/index11.js +383 -0
  30. package/dist/components/index12.js +125 -0
  31. package/dist/components/index13.js +602 -0
  32. package/dist/components/index2.js +100 -0
  33. package/dist/components/index3.js +90 -0
  34. package/dist/components/index4.js +62 -0
  35. package/dist/components/index5.js +146 -0
  36. package/dist/components/index6.js +145 -0
  37. package/dist/components/index7.js +2960 -0
  38. package/dist/components/index8.js +3356 -0
  39. package/dist/components/index9.js +101 -0
  40. package/dist/components/installCanvasRenderer.js +38282 -0
  41. package/dist/components/q2-avatar.d.ts +11 -0
  42. package/dist/components/q2-avatar.js +6 -0
  43. package/dist/components/q2-badge.d.ts +11 -0
  44. package/dist/components/q2-badge.js +6 -0
  45. package/dist/components/q2-btn.d.ts +11 -0
  46. package/dist/components/q2-btn.js +6 -0
  47. package/dist/components/q2-calendar.d.ts +11 -0
  48. package/dist/components/q2-calendar.js +3755 -0
  49. package/dist/components/q2-card.d.ts +11 -0
  50. package/dist/components/q2-card.js +187 -0
  51. package/dist/components/q2-carousel-pane.d.ts +11 -0
  52. package/dist/components/q2-carousel-pane.js +97 -0
  53. package/dist/components/q2-carousel.d.ts +11 -0
  54. package/dist/components/q2-carousel.js +5379 -0
  55. package/dist/components/q2-chart-bar.d.ts +11 -0
  56. package/dist/components/q2-chart-bar.js +4710 -0
  57. package/dist/components/q2-chart-donut.d.ts +11 -0
  58. package/dist/components/q2-chart-donut.js +4887 -0
  59. package/dist/components/q2-checkbox-group.d.ts +11 -0
  60. package/dist/components/q2-checkbox-group.js +114 -0
  61. package/dist/components/q2-checkbox.d.ts +11 -0
  62. package/dist/components/q2-checkbox.js +138 -0
  63. package/dist/components/q2-dropdown-item.d.ts +11 -0
  64. package/dist/components/q2-dropdown-item.js +6 -0
  65. package/dist/components/q2-dropdown.d.ts +11 -0
  66. package/dist/components/q2-dropdown.js +345 -0
  67. package/dist/components/q2-editable-field.d.ts +11 -0
  68. package/dist/components/q2-editable-field.js +220 -0
  69. package/dist/components/q2-icon.d.ts +11 -0
  70. package/dist/components/q2-icon.js +6 -0
  71. package/dist/components/q2-input.d.ts +11 -0
  72. package/dist/components/q2-input.js +6 -0
  73. package/dist/components/q2-loading-element.d.ts +11 -0
  74. package/dist/components/q2-loading-element.js +52 -0
  75. package/dist/components/q2-loading.d.ts +11 -0
  76. package/dist/components/q2-loading.js +6 -0
  77. package/dist/components/q2-loc.d.ts +11 -0
  78. package/dist/components/q2-loc.js +40 -0
  79. package/dist/components/q2-message.d.ts +11 -0
  80. package/dist/components/q2-message.js +6 -0
  81. package/dist/components/q2-month-picker.d.ts +11 -0
  82. package/dist/components/q2-month-picker.js +189 -0
  83. package/dist/components/q2-optgroup.d.ts +11 -0
  84. package/dist/components/q2-optgroup.js +75 -0
  85. package/dist/components/q2-option-list.d.ts +11 -0
  86. package/dist/components/q2-option-list.js +6 -0
  87. package/dist/components/q2-option.d.ts +11 -0
  88. package/dist/components/q2-option.js +81 -0
  89. package/dist/components/q2-pagination.d.ts +11 -0
  90. package/dist/components/q2-pagination.js +184 -0
  91. package/dist/components/q2-pill.d.ts +11 -0
  92. package/dist/components/q2-pill.js +216 -0
  93. package/dist/components/q2-popover.d.ts +11 -0
  94. package/dist/components/q2-popover.js +6 -0
  95. package/dist/components/q2-radio-group.d.ts +11 -0
  96. package/dist/components/q2-radio-group.js +191 -0
  97. package/dist/components/q2-radio.d.ts +11 -0
  98. package/dist/components/q2-radio.js +105 -0
  99. package/dist/components/q2-section.d.ts +11 -0
  100. package/dist/components/q2-section.js +218 -0
  101. package/dist/components/q2-select.d.ts +11 -0
  102. package/dist/components/q2-select.js +817 -0
  103. package/dist/components/q2-stepper-pane.d.ts +11 -0
  104. package/dist/components/q2-stepper-pane.js +92 -0
  105. package/dist/components/q2-stepper-vertical.d.ts +11 -0
  106. package/dist/components/q2-stepper-vertical.js +311 -0
  107. package/dist/components/q2-stepper.d.ts +11 -0
  108. package/dist/components/q2-stepper.js +252 -0
  109. package/dist/components/q2-tab-container.d.ts +11 -0
  110. package/dist/components/q2-tab-container.js +288 -0
  111. package/dist/components/q2-tab-pane.d.ts +11 -0
  112. package/dist/components/q2-tab-pane.js +58 -0
  113. package/dist/components/q2-tag.d.ts +11 -0
  114. package/dist/components/q2-tag.js +156 -0
  115. package/dist/components/q2-textarea.d.ts +11 -0
  116. package/dist/components/q2-textarea.js +265 -0
  117. package/dist/components/q2-tooltip.d.ts +11 -0
  118. package/dist/components/q2-tooltip.js +112 -0
  119. package/dist/components/shapes.js +91 -0
  120. package/dist/components/tecton-tab-pane.d.ts +11 -0
  121. package/dist/components/tecton-tab-pane.js +111 -0
  122. package/dist/esm/installCanvasRenderer-0143b52d.js +38282 -0
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/q2-badge_2.entry.js +5 -3
  125. package/dist/esm/q2-calendar.entry.js +75 -55
  126. package/dist/esm/q2-carousel.entry.js +3 -3
  127. package/dist/esm/q2-chart-bar.entry.js +4675 -0
  128. package/dist/esm/q2-chart-donut.entry.js +171 -35406
  129. package/dist/esm/q2-checkbox.entry.js +1 -1
  130. package/dist/esm/q2-editable-field.entry.js +1 -1
  131. package/dist/esm/q2-radio.entry.js +1 -1
  132. package/dist/esm/q2-tecton-elements.js +1 -1
  133. package/dist/q2-tecton-elements/p-1f85cced.js +39 -0
  134. package/dist/q2-tecton-elements/{p-89608314.entry.js → p-4625184b.entry.js} +1 -1
  135. package/dist/q2-tecton-elements/{p-9772b15f.entry.js → p-520c40f6.entry.js} +1 -1
  136. package/dist/q2-tecton-elements/p-6b52a262.entry.js +1 -0
  137. package/dist/q2-tecton-elements/p-c4640b55.entry.js +1 -0
  138. package/dist/q2-tecton-elements/{p-7e8f43d1.entry.js → p-cf41970f.entry.js} +1 -1
  139. package/dist/q2-tecton-elements/p-e4dc9ac0.entry.js +1 -0
  140. package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +1 -0
  141. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  142. package/dist/types/components/q2-calendar/index.d.ts +3 -0
  143. package/dist/types/components/q2-chart-bar/index.d.ts +40 -0
  144. package/dist/types/components/q2-chart-donut/index.d.ts +7 -10
  145. package/dist/types/components/q2-input/index.d.ts +1 -0
  146. package/dist/types/components.d.ts +50 -3
  147. package/dist/types/utils/charting.d.ts +14 -0
  148. package/package.json +5 -2
  149. package/dist/q2-tecton-elements/p-0766a694.entry.js +0 -1
  150. package/dist/q2-tecton-elements/p-5f064e1e.entry.js +0 -39
  151. package/dist/q2-tecton-elements/p-8d25ec52.entry.js +0 -1
  152. /package/dist/types/workspace/workspace/{tecton-production_release_1.21.x → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
@@ -0,0 +1,105 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { c as createGuid, h as handleAriaLabel, o as overrideFocus, l as loc } from './index13.js';
3
+
4
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block}.radio-container{margin-top:var(--tct-radio-margin-vertical, var(--tct-scale-2, 10px));margin-right:var(--tct-radio-margin-horizontal, var(--tct-scale-3, 15px));margin-bottom:var(--tct-radio-margin-vertical, var(--tct-scale-2, 10px))}.radio-container label[for]{font-weight:var(--tct-radio-font-weight, var(--tct-checkbox-font-weight, 400));align-items:center;cursor:pointer;margin-right:1rem;display:grid;grid-template-columns:18px 1fr;gap:var(--tct-scale-1, var(--app-scale-1x, 5px))}.radio-container svg{border-radius:50%;transition:box-shadow var(--tct-tween-1, var(--app-tween-1, 0.2s ease));outline:0;width:100%}.radio-container circle:nth-child(1){stroke-width:2;stroke:var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)))))}.radio-container input:focus+label svg{box-shadow:var(--const-double-focus-ring)}.radio-container input:focus+label circle:nth-child(1){stroke:var(--tct-radio-focus-stroke-color, var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e)))}.radio-container input:checked+label circle:nth-child(1){background-color:var(--tct-radio-checked-bg, transparent);stroke:var(--tct-radio-checked-stroke-color, var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))))}.radio-container input:checked+label .label-content{font-weight:var(--tct-checkbox-selected-font-weight, 600);letter-spacing:var(--tct-checkbox-selected-letter-spacing, 0.25)}.radio-container input:checked+label circle:nth-child(2){fill:var(--tct-radio-checked-fill, var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e)))}.radio-tile{flex-basis:100px;flex-grow:0;flex-wrap:wrap}.radio-tile label[for]{align-items:center;border-radius:3px;border:2px solid var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)))));cursor:pointer;display:block;padding:10px;position:relative;text-align:center;transition:border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));white-space:nowrap}.radio-tile input:focus+label,.radio-tile input:focus:checked+label{border-color:#0079c1;box-shadow:var(--const-double-focus-ring), var(--tct-global-focus, 0 0 0 2px #33b4ff)}.radio-tile input:checked+label{border-color:var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e));box-shadow:inset 0 0 0 2px #ffffff}.radio-tile input:checked+label:after{border-bottom-width:3px;border-bottom:5px solid #0079c1;border-left-width:5px;border-left:8px solid transparent;border-right-width:5px;border-right:8px solid transparent;bottom:0;content:\"\";height:0;left:50%;margin-left:-5px;position:absolute;width:0}input:disabled+label[for]{cursor:not-allowed;opacity:var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))}";
5
+
6
+ const Q2Radio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.change = createEvent(this, "change", 7);
12
+ this.id = `radio-${createGuid()}`;
13
+ this.isLoaded = false;
14
+ this.inputChange = (event) => {
15
+ event.stopPropagation();
16
+ if (this.groupReadonly) {
17
+ event.preventDefault();
18
+ return false;
19
+ }
20
+ if (event.target instanceof HTMLInputElement) {
21
+ this.checked = event.target.checked;
22
+ }
23
+ };
24
+ this.label = undefined;
25
+ this.hideLabel = undefined;
26
+ this.value = undefined;
27
+ this.disabled = false;
28
+ this.checked = false;
29
+ this.name = undefined;
30
+ this.ariaLabel = undefined;
31
+ this.groupDisabled = false;
32
+ this.groupReadonly = false;
33
+ this.groupTileLayout = false;
34
+ }
35
+ ////////// LIFECYCLE HOOKS ////////
36
+ componentWillLoad() {
37
+ handleAriaLabel(this);
38
+ }
39
+ componentDidLoad() {
40
+ this.isLoaded = true;
41
+ overrideFocus(this.hostElement);
42
+ this.hostElement.click = () => this.inputField.click();
43
+ }
44
+ ////////// OBSERVERS //////////
45
+ ariaLabelObserver() {
46
+ handleAriaLabel(this);
47
+ }
48
+ checkedObserver() {
49
+ if (!this.isLoaded)
50
+ return;
51
+ if (!this.checked)
52
+ return;
53
+ this.change.emit({ value: this.value });
54
+ }
55
+ /////// HOST ELEMENT EVENTS ///////
56
+ onHostClick(event) {
57
+ if (this.disabled) {
58
+ event.stopImmediatePropagation();
59
+ }
60
+ }
61
+ delegateFocus(event) {
62
+ if (event.target === this.hostElement) {
63
+ this.inputField.focus();
64
+ }
65
+ }
66
+ render() {
67
+ return (h("div", { class: this.groupTileLayout ? 'radio-tile' : 'radio-container' }, h("input", { ref: el => (this.inputField = el), class: "sr", id: this.id, type: "radio", name: this.name, value: this.value, disabled: this.disabled || this.groupDisabled, checked: this.checked, "aria-label": this.label && this.hideLabel ? loc(this.label) : undefined, onChange: this.inputChange, "test-id": "q2RadioInnerRadioBox" }), h("label", { htmlFor: this.id, "test-id": "radioButton" }, !this.groupTileLayout && (h("svg", { viewBox: "0 0 18 18" }, h("circle", { stroke: "none", fill: "none", cx: "9", cy: "9", r: "8" }), h("circle", { stroke: "none", fill: "none", cx: "9", cy: "9", r: "4" }))), !this.hideLabel && (h("div", { class: "label-content" }, (this.label && loc(this.label)) || '', h("slot", null))))));
68
+ }
69
+ get hostElement() { return this; }
70
+ static get watchers() { return {
71
+ "ariaLabel": ["ariaLabelObserver"],
72
+ "checked": ["checkedObserver"]
73
+ }; }
74
+ static get style() { return stylesCss; }
75
+ }, [1, "q2-radio", {
76
+ "label": [513],
77
+ "hideLabel": [516, "hide-label"],
78
+ "value": [513],
79
+ "disabled": [516],
80
+ "checked": [516],
81
+ "name": [513],
82
+ "ariaLabel": [513, "aria-label"],
83
+ "groupDisabled": [4, "group-disabled"],
84
+ "groupReadonly": [4, "group-readonly"],
85
+ "groupTileLayout": [4, "group-tile-layout"]
86
+ }, [[0, "click", "onHostClick"], [0, "focus", "delegateFocus"]]]);
87
+ function defineCustomElement$1() {
88
+ if (typeof customElements === "undefined") {
89
+ return;
90
+ }
91
+ const components = ["q2-radio"];
92
+ components.forEach(tagName => { switch (tagName) {
93
+ case "q2-radio":
94
+ if (!customElements.get(tagName)) {
95
+ customElements.define(tagName, Q2Radio$1);
96
+ }
97
+ break;
98
+ } });
99
+ }
100
+ defineCustomElement$1();
101
+
102
+ const Q2Radio = Q2Radio$1;
103
+ const defineCustomElement = defineCustomElement$1;
104
+
105
+ export { Q2Radio, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface Q2Section extends Components.Q2Section, HTMLElement {}
4
+ export const Q2Section: {
5
+ prototype: Q2Section;
6
+ new (): Q2Section;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,218 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { r as resizeIframe, o as overrideFocus, i as isEventFromElement, n as nextPaint, l as loc } from './index13.js';
3
+ import { d as defineCustomElement$4 } from './index5.js';
4
+ import { d as defineCustomElement$3 } from './index7.js';
5
+ import { d as defineCustomElement$2 } from './index9.js';
6
+
7
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;background-color:var(--tct-section-background-color, var(--t-section-background-color, var(--tct-section-bg, var(--t-section-bg, var(--app-white, #ffffff)))));color:var(--tct-section-font-color, var(--t-section-font-color, var(--t-text, #4d4d4d)));border-radius:var(--tct-section-border-radius, var(--t-section-border-radius, var(--app-border-radius-1, 3px)));margin:var(--tct-section-margin, var(--t-section-margin, var(--app-scale-3x, 15px)))}@media screen and (max-width: 767px){:host{--comp-default-margin:var(--app-scale-3x, 15px) 0;margin:var(--tct-section-margin, var(--t-section-margin, var(--comp-default-margin)))}}.wrapper{--comp-tween:var(--tct-section-tween, var(--t-section-tween, var(--app-tween-1, 0.2s ease)));--comp-default-wrapper-padding:var(--app-scale-1x, 5px) 0;display:block;padding:var(--tct-section-wrapper-padding, var(--t-section-wrapper-padding, var(--comp-default-wrapper-padding)))}.wrapper:hover{box-shadow:var(--tct-section-wrapper-hover-box-shadow, var(--t-section-wrapper-hover-box-shadow, inherit))}:host([collapsible]) .wrapper{--comp-tween:var(--tct-section-tween, var(--t-section-tween, var(--app-tween-2, 0.4s ease)))}header{--comp-default-header-padding:0 var(--app-scale-3x, 15px);padding:var(--tct-section-header-padding, var(--t-section-header-padding, var(--comp-default-header-padding)));display:flex}header.has-header{min-height:var(--tct-section-header-min-height, var(--t-section-header-min-height, 44px))}.header-content{flex:1 1 100%;min-width:0;align-self:center}:host([collapsible]) .header-content{cursor:pointer}.title{margin:0;font-size:20px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px}q2-icon{transition:transform var(--comp-tween)}:host(:not([expanded])) q2-icon,:host([expanded=false]) q2-icon{transform:rotate(180deg)}.content-wrapper{height:auto}.content-wrapper.is-closed{display:none;overflow:hidden}.content-wrapper.is-transitioning{overflow:hidden}:host([collapsible]) .content-wrapper{transition:height var(--comp-tween)}.content{--comp-default-content-padding:var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);padding:var(--tct-section-content-padding, var(--t-section-content-padding, var(--comp-default-content-padding)))}.content:focus{box-shadow:none}:host([collapsible]) :host(:not([expanded])) .content{visibility:hidden}";
8
+
9
+ const Q2Section$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.__attachShadow();
14
+ this.change = createEvent(this, "change", 7);
15
+ this.titleId = 'title';
16
+ this.contentId = 'content';
17
+ /// Event Handlers ///
18
+ this.onHeaderClick = () => {
19
+ this.change.emit({
20
+ expanded: !this.expanded,
21
+ });
22
+ };
23
+ this.onTransitionEnd = () => {
24
+ if (this.expanded) {
25
+ this.contentHeight = undefined;
26
+ }
27
+ else {
28
+ this.hideContent = true;
29
+ }
30
+ setTimeout(() => {
31
+ // This gives enough time for all values to get passed over
32
+ // Previously, the interval was never cleared and the fn was called indefinitely then filtered
33
+ // Will revisit in TCT-599
34
+ this.clearResizeInterval();
35
+ }, 1000);
36
+ };
37
+ this.onHeaderSlotChange = () => {
38
+ const hasSlotContent = !!this.hostElement.querySelector('[slot="q2-section-header"]');
39
+ if (this.hasYieldedHeader !== hasSlotContent) {
40
+ this.hasYieldedHeader = !!hasSlotContent;
41
+ }
42
+ };
43
+ /// Helpers ///
44
+ this.clearResizeInterval = () => {
45
+ this.resizerFn && clearInterval(this.resizerFn);
46
+ };
47
+ this.addHeaderSlotListener = () => {
48
+ if (this.headerSlot) {
49
+ this.headerSlot.addEventListener('slotchange', this.onHeaderSlotChange);
50
+ return;
51
+ }
52
+ const observer = new MutationObserver(this.onHeaderSlotChange);
53
+ observer.observe(this.headerSlotWrapper, { childList: true });
54
+ this.headerSlotMutationObserver = observer;
55
+ };
56
+ this.removeHeaderSlotListener = () => {
57
+ if (this.headerSlot) {
58
+ this.headerSlot.removeEventListener('slotchange', this.onHeaderSlotChange);
59
+ return;
60
+ }
61
+ this.headerSlotMutationObserver.disconnect();
62
+ };
63
+ this.addContentSlotListener = () => {
64
+ if (this.contentSlot) {
65
+ this.contentSlot.addEventListener('slotchange', resizeIframe);
66
+ return;
67
+ }
68
+ const observer = new MutationObserver(resizeIframe);
69
+ observer.observe(this.contentContainer, { childList: true, subtree: true });
70
+ this.contentSlotMutationObserver = observer;
71
+ };
72
+ this.removeContentSlotListener = () => {
73
+ if (this.contentSlot) {
74
+ this.contentSlot.removeEventListener('slotchange', resizeIframe);
75
+ return;
76
+ }
77
+ this.contentSlotMutationObserver.disconnect();
78
+ };
79
+ this.label = undefined;
80
+ this.collapsible = undefined;
81
+ this.noCollapseIcon = undefined;
82
+ this.expanded = undefined;
83
+ this.contentHeight = undefined;
84
+ this.hideContent = false;
85
+ this.hasYieldedHeader = false;
86
+ }
87
+ componentWillLoad() {
88
+ this.onHeaderSlotChange();
89
+ const { collapsible, expanded } = this;
90
+ this.contentHeight = collapsible && expanded ? undefined : '0px';
91
+ this.hideContent = !expanded;
92
+ }
93
+ componentDidLoad() {
94
+ this.addHeaderSlotListener();
95
+ this.addContentSlotListener();
96
+ overrideFocus(this.hostElement);
97
+ }
98
+ disconnectedCallback() {
99
+ this.removeHeaderSlotListener();
100
+ this.removeContentSlotListener();
101
+ }
102
+ /// Listeners ///
103
+ defaultChangeHandler(event) {
104
+ if (event.target === this.hostElement && !this.hostElement.onchange && !!event.detail) {
105
+ this.expanded = event.detail.expanded;
106
+ }
107
+ }
108
+ delegateFocus(event) {
109
+ if (!isEventFromElement(event, this.hostElement))
110
+ return;
111
+ this.contentContainer.focus();
112
+ }
113
+ /// Watchers ///
114
+ async expandedObserver(expanded) {
115
+ this.clearResizeInterval();
116
+ this.resizerFn = setInterval(resizeIframe, 5);
117
+ if (expanded) {
118
+ this.expandSection();
119
+ }
120
+ else {
121
+ this.collapseSection();
122
+ }
123
+ }
124
+ async collapseSection() {
125
+ this.contentHeight = this.contentContainerHeight;
126
+ await nextPaint(() => {
127
+ this.contentHeight = this.currentHeight;
128
+ });
129
+ }
130
+ async expandSection() {
131
+ this.hideContent = false;
132
+ await nextPaint(() => {
133
+ this.contentHeight = this.currentHeight;
134
+ });
135
+ }
136
+ collapsibleObserver() {
137
+ this.contentHeight = this.currentHeight;
138
+ }
139
+ /// Getters ///
140
+ get currentHeight() {
141
+ const { collapsible, expanded } = this;
142
+ if (!collapsible) {
143
+ return null;
144
+ }
145
+ else if (expanded) {
146
+ return this.contentContainerHeight;
147
+ }
148
+ else {
149
+ return '0';
150
+ }
151
+ }
152
+ get contentContainerHeight() {
153
+ return `${this.contentContainer.offsetHeight || 0}px`;
154
+ }
155
+ render() {
156
+ const hasHeader = this.label || this.hasYieldedHeader;
157
+ const wrapperClasses = ['content-wrapper'];
158
+ const { collapsible, hideContent, contentHeight } = this;
159
+ if (collapsible) {
160
+ if (hideContent)
161
+ wrapperClasses.push('is-closed');
162
+ else if (contentHeight)
163
+ wrapperClasses.push('is-transitioning');
164
+ }
165
+ const showDefaultHeader = !this.hasYieldedHeader && !!this.label;
166
+ return (h("section", { class: "wrapper" }, h("header", { class: hasHeader ? 'has-header' : '' }, h("div", { class: "header-content", id: this.titleId, onClick: this.collapsible && this.onHeaderClick }, showDefaultHeader && h("h2", { class: "title" }, loc(this.label)), h("div", { ref: el => (this.headerSlotWrapper = el), class: "header-slot-wrapper" }, h("slot", { ref: (el) => (this.headerSlot = el), name: "q2-section-header" }))), this.collapsible && !this.noCollapseIcon && (h("q2-btn", { label: loc(this.label || 'tecton.element.section.defaultToggleLabel'), ariaExpanded: `${!!this.expanded}`, ariaControls: this.contentId, "test-id": "toggleButton", "hide-label": true, onClick: this.onHeaderClick }, h("q2-icon", { type: "chevron-up" })))), h("div", { class: wrapperClasses.join(' '), id: this.contentId, "aria-labelledby": this.titleId, role: "region", onTransitionEnd: this.onTransitionEnd, style: this.collapsible && {
167
+ height: this.contentHeight,
168
+ } }, h("div", { ref: el => (this.contentContainer = el), class: "content", tabindex: "-1" }, h("slot", { ref: (el) => (this.contentSlot = el) })))));
169
+ }
170
+ get hostElement() { return this; }
171
+ static get watchers() { return {
172
+ "expanded": ["expandedObserver"],
173
+ "collapsible": ["collapsibleObserver"]
174
+ }; }
175
+ static get style() { return stylesCss; }
176
+ }, [1, "q2-section", {
177
+ "label": [513],
178
+ "collapsible": [516],
179
+ "noCollapseIcon": [516, "no-collapse-icon"],
180
+ "expanded": [1540],
181
+ "contentHeight": [32],
182
+ "hideContent": [32],
183
+ "hasYieldedHeader": [32]
184
+ }, [[0, "change", "defaultChangeHandler"], [0, "focus", "delegateFocus"]]]);
185
+ function defineCustomElement$1() {
186
+ if (typeof customElements === "undefined") {
187
+ return;
188
+ }
189
+ const components = ["q2-section", "q2-btn", "q2-icon", "q2-loading"];
190
+ components.forEach(tagName => { switch (tagName) {
191
+ case "q2-section":
192
+ if (!customElements.get(tagName)) {
193
+ customElements.define(tagName, Q2Section$1);
194
+ }
195
+ break;
196
+ case "q2-btn":
197
+ if (!customElements.get(tagName)) {
198
+ defineCustomElement$4();
199
+ }
200
+ break;
201
+ case "q2-icon":
202
+ if (!customElements.get(tagName)) {
203
+ defineCustomElement$3();
204
+ }
205
+ break;
206
+ case "q2-loading":
207
+ if (!customElements.get(tagName)) {
208
+ defineCustomElement$2();
209
+ }
210
+ break;
211
+ } });
212
+ }
213
+ defineCustomElement$1();
214
+
215
+ const Q2Section = Q2Section$1;
216
+ const defineCustomElement = defineCustomElement$1;
217
+
218
+ export { Q2Section, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface Q2Select extends Components.Q2Select, HTMLElement {}
4
+ export const Q2Select: {
5
+ prototype: Q2Select;
6
+ new (): Q2Select;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;