q2-tecton-elements 1.28.3 → 1.29.1
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.
- package/dist/cjs/click-elsewhere_2.cjs.entry.js +4 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +10 -5
- package/dist/cjs/q2-badge.cjs.entry.js +43 -0
- package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-calendar.cjs.entry.js +5 -0
- package/dist/cjs/q2-checkbox.cjs.entry.js +16 -7
- package/dist/cjs/q2-data-table.cjs.entry.js +287 -0
- package/dist/cjs/{q2-badge_2.cjs.entry.js → q2-input.cjs.entry.js} +1 -38
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/q2-action-sheet/index.js +26 -4
- package/dist/collection/components/q2-action-sheet/styles.css +2 -2
- package/dist/collection/components/q2-btn/styles.css +4 -0
- package/dist/collection/components/q2-calendar/index.js +5 -0
- package/dist/collection/components/q2-checkbox/index.js +15 -6
- package/dist/collection/components/q2-checkbox/styles.css +5 -0
- package/dist/collection/components/q2-data-table/index.js +539 -0
- package/dist/collection/components/q2-data-table/styles.css +192 -0
- package/dist/collection/components/q2-input/styles.css +1 -1
- package/dist/collection/components/q2-popover/index.js +4 -3
- package/dist/collection/components/q2-section/styles.css +17 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index10.js +72 -55
- package/dist/components/index11.js +56 -44
- package/dist/components/index12.js +42 -42
- package/dist/components/index13.js +40 -538
- package/dist/components/index14.js +518 -136
- package/dist/components/index15.js +174 -574
- package/dist/components/index16.js +589 -0
- package/dist/components/index3.js +1 -1
- package/dist/components/index5.js +3 -3
- package/dist/components/index6.js +93 -94
- package/dist/components/index7.js +112 -2927
- package/dist/components/index8.js +2919 -3347
- package/dist/components/index9.js +3343 -56
- package/dist/components/q2-action-sheet.js +18 -12
- package/dist/components/q2-calendar.js +11 -6
- package/dist/components/q2-card.js +2 -2
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +3 -3
- package/dist/components/q2-chart-area.js +1 -1
- package/dist/components/q2-chart-bar.js +1 -1
- package/dist/components/q2-chart-donut.js +2 -2
- package/dist/components/q2-checkbox-group.js +2 -2
- package/dist/components/q2-checkbox.js +1 -133
- package/dist/components/q2-data-table.d.ts +11 -0
- package/dist/components/q2-data-table.js +349 -0
- package/dist/components/q2-dropdown-item.js +1 -1
- package/dist/components/q2-dropdown.js +5 -5
- package/dist/components/q2-editable-field.js +4 -4
- package/dist/components/q2-icon.js +1 -1
- package/dist/components/q2-input.js +1 -1
- package/dist/components/q2-loading.js +1 -1
- package/dist/components/q2-loc.js +1 -1
- package/dist/components/q2-message.js +1 -1
- package/dist/components/q2-month-picker.js +3 -3
- package/dist/components/q2-optgroup.js +1 -1
- package/dist/components/q2-option-list.js +1 -1
- package/dist/components/q2-option.js +1 -1
- package/dist/components/q2-pagination.js +4 -4
- package/dist/components/q2-pill.js +4 -4
- package/dist/components/q2-popover.js +1 -1
- package/dist/components/q2-radio-group.js +2 -2
- package/dist/components/q2-radio.js +1 -1
- package/dist/components/q2-section.js +4 -4
- package/dist/components/q2-select.js +6 -6
- package/dist/components/q2-stepper-pane.js +1 -1
- package/dist/components/q2-stepper-vertical.js +2 -2
- package/dist/components/q2-stepper.js +3 -3
- package/dist/components/q2-tab-container.js +3 -3
- package/dist/components/q2-tag.js +4 -4
- package/dist/components/q2-textarea.js +2 -2
- package/dist/components/q2-tooltip.js +1 -1
- package/dist/docs.json +280 -3
- package/dist/esm/click-elsewhere_2.entry.js +4 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +10 -5
- package/dist/esm/q2-badge.entry.js +39 -0
- package/dist/esm/q2-btn_2.entry.js +1 -1
- package/dist/esm/q2-calendar.entry.js +5 -0
- package/dist/esm/q2-checkbox.entry.js +16 -7
- package/dist/esm/q2-data-table.entry.js +283 -0
- package/dist/esm/{q2-badge_2.entry.js → q2-input.entry.js} +3 -39
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/q2-tecton-elements/p-00b2c345.entry.js +1 -0
- package/dist/q2-tecton-elements/p-0112df78.entry.js +1 -0
- package/dist/q2-tecton-elements/p-08286237.entry.js +1 -0
- package/dist/q2-tecton-elements/p-18df4e0d.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-6975e5e4.entry.js → p-38885cc4.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-42d03011.entry.js +1 -0
- package/dist/q2-tecton-elements/p-47aefcc2.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9a327827.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-807e2e44.entry.js → p-ccc497d5.entry.js} +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/types/components/q2-action-sheet/index.d.ts +1 -0
- package/dist/types/components/q2-checkbox/index.d.ts +4 -0
- package/dist/types/components/q2-data-table/index.d.ts +94 -0
- package/dist/types/components.d.ts +47 -0
- package/package.json +3 -3
- package/dist/q2-tecton-elements/p-0b7003c4.entry.js +0 -1
- package/dist/q2-tecton-elements/p-1b9e07b4.entry.js +0 -1
- package/dist/q2-tecton-elements/p-3bf06809.entry.js +0 -1
- package/dist/q2-tecton-elements/p-92e746c8.entry.js +0 -1
- package/dist/q2-tecton-elements/p-d6824ce5.entry.js +0 -1
- /package/dist/types/workspace/workspace/{tecton-production_release_1.28.x → tecton-production_release_1.29.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
|
@@ -1,589 +1,189 @@
|
|
|
1
|
-
import { h } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */
|
|
19
|
-
(function () {
|
|
20
|
-
|
|
21
|
-
// polyfill
|
|
22
|
-
function polyfill() {
|
|
23
|
-
// aliases
|
|
24
|
-
var w = window;
|
|
25
|
-
var d = document;
|
|
26
|
-
|
|
27
|
-
// return if scroll behavior is supported and polyfill is not forced
|
|
28
|
-
if (
|
|
29
|
-
'scrollBehavior' in d.documentElement.style &&
|
|
30
|
-
w.__forceSmoothScrollPolyfill__ !== true
|
|
31
|
-
) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// globals
|
|
36
|
-
var Element = w.HTMLElement || w.Element;
|
|
37
|
-
var SCROLL_TIME = 468;
|
|
38
|
-
|
|
39
|
-
// object gathering original scroll methods
|
|
40
|
-
var original = {
|
|
41
|
-
scroll: w.scroll || w.scrollTo,
|
|
42
|
-
scrollBy: w.scrollBy,
|
|
43
|
-
elementScroll: Element.prototype.scroll || scrollElement,
|
|
44
|
-
scrollIntoView: Element.prototype.scrollIntoView
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { r as resizeIframe, w as waitForNextPaint } from './index16.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;width:100%}:host([align=right]){display:block;position:absolute;right:0;text-align:end;left:unset}.container{display:none;overflow:hidden;opacity:0;height:0;position:absolute;top:var(--tct-popover-top, var(--t-popover-top, initial));visibility:hidden;background-color:var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));color:var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));z-index:var(--tct-popover-z-index, var(--t-popover-z-index, 100));width:max-content;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, 135px));box-shadow:var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));text-align:start;left:0;border-radius:var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));max-height:var(--comp-pop-max-height);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.container::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.container::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.container::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host([block]) .container{left:unset;right:unset;width:100%;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, unset))}:host([align=right]) .container{right:0;text-align:end;left:unset}.container :host([open]){display:block}:host([open]) .container.show{height:auto;overflow:auto;opacity:1;visibility:visible}.container.up{bottom:var(--comp-pop-offset)}click-elsewhere{position:relative;display:block}.content{height:auto}";
|
|
5
|
+
|
|
6
|
+
const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.popoverStateChanged = createEvent(this, "popoverStateChanged", 7);
|
|
12
|
+
this.scheduledAfterRender = [];
|
|
13
|
+
/// Helpers ///
|
|
14
|
+
this.viewPortChanged = () => {
|
|
15
|
+
if (!this.open)
|
|
16
|
+
return;
|
|
17
|
+
this.determinePopDirection();
|
|
45
18
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.scrollLeft = x;
|
|
81
|
-
this.scrollTop = y;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* returns result of applying ease math function to a number
|
|
86
|
-
* @method ease
|
|
87
|
-
* @param {Number} k
|
|
88
|
-
* @returns {Number}
|
|
89
|
-
*/
|
|
90
|
-
function ease(k) {
|
|
91
|
-
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* indicates if a smooth behavior should be applied
|
|
96
|
-
* @method shouldBailOut
|
|
97
|
-
* @param {Number|Object} firstArg
|
|
98
|
-
* @returns {Boolean}
|
|
99
|
-
*/
|
|
100
|
-
function shouldBailOut(firstArg) {
|
|
101
|
-
if (
|
|
102
|
-
firstArg === null ||
|
|
103
|
-
typeof firstArg !== 'object' ||
|
|
104
|
-
firstArg.behavior === undefined ||
|
|
105
|
-
firstArg.behavior === 'auto' ||
|
|
106
|
-
firstArg.behavior === 'instant'
|
|
107
|
-
) {
|
|
108
|
-
// first argument is not an object/null
|
|
109
|
-
// or behavior is auto, instant or undefined
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
|
|
114
|
-
// first argument is an object and behavior is smooth
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// throw error when behavior is not supported
|
|
119
|
-
throw new TypeError(
|
|
120
|
-
'behavior member of ScrollOptions ' +
|
|
121
|
-
firstArg.behavior +
|
|
122
|
-
' is not a valid value for enumeration ScrollBehavior.'
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* indicates if an element has scrollable space in the provided axis
|
|
128
|
-
* @method hasScrollableSpace
|
|
129
|
-
* @param {Node} el
|
|
130
|
-
* @param {String} axis
|
|
131
|
-
* @returns {Boolean}
|
|
132
|
-
*/
|
|
133
|
-
function hasScrollableSpace(el, axis) {
|
|
134
|
-
if (axis === 'Y') {
|
|
135
|
-
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (axis === 'X') {
|
|
139
|
-
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
|
|
140
|
-
}
|
|
19
|
+
this.direction = undefined;
|
|
20
|
+
this.align = undefined;
|
|
21
|
+
this.open = undefined;
|
|
22
|
+
this.block = undefined;
|
|
23
|
+
this.minHeight = undefined;
|
|
24
|
+
this.controlElement = undefined;
|
|
25
|
+
this.currentDirection = undefined;
|
|
26
|
+
this.show = false;
|
|
27
|
+
}
|
|
28
|
+
/// Lifecycle hooks ///
|
|
29
|
+
componentDidLoad() {
|
|
30
|
+
if (this.open)
|
|
31
|
+
this.determinePopDirection();
|
|
32
|
+
}
|
|
33
|
+
componentDidRender() {
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
this.scheduledAfterRender.forEach(fn => fn());
|
|
36
|
+
this.scheduledAfterRender = [];
|
|
37
|
+
}, 25);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
this.removeViewportListeners();
|
|
41
|
+
}
|
|
42
|
+
/// Methods ///
|
|
43
|
+
async toggle() {
|
|
44
|
+
this.open = !this.open;
|
|
45
|
+
}
|
|
46
|
+
/// Watchers ///
|
|
47
|
+
openChanged(open) {
|
|
48
|
+
this.popoverStateChanged.emit({ open });
|
|
49
|
+
this.scheduledAfterRender.push(resizeIframe);
|
|
50
|
+
if (open) {
|
|
51
|
+
this.addViewportListeners();
|
|
52
|
+
this.determinePopDirection();
|
|
141
53
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
* @returns {Boolean}
|
|
149
|
-
*/
|
|
150
|
-
function canOverflow(el, axis) {
|
|
151
|
-
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
|
|
152
|
-
|
|
153
|
-
return overflowValue === 'auto' || overflowValue === 'scroll';
|
|
54
|
+
else {
|
|
55
|
+
this.removeViewportListeners();
|
|
56
|
+
this.currentDirection = undefined;
|
|
57
|
+
this.containerElement.style.removeProperty('display');
|
|
58
|
+
this.containerElement.style.removeProperty('--comp-pop-max-height');
|
|
59
|
+
this.show = false;
|
|
154
60
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
61
|
+
}
|
|
62
|
+
/// Listeners ///
|
|
63
|
+
popoverStateHandler(event) {
|
|
64
|
+
const { detail: { open }, } = event;
|
|
65
|
+
if (open === this.open)
|
|
66
|
+
return;
|
|
67
|
+
this.open = open;
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
}
|
|
70
|
+
addViewportListeners() {
|
|
71
|
+
// window.visualViewport.addEventListener('scroll', this.viewPortChanged);
|
|
72
|
+
window.visualViewport.addEventListener('resize', this.viewPortChanged);
|
|
73
|
+
}
|
|
74
|
+
removeViewportListeners() {
|
|
75
|
+
// window.visualViewport.removeEventListener('scroll', this.viewPortChanged);
|
|
76
|
+
window.visualViewport.removeEventListener('resize', this.viewPortChanged);
|
|
77
|
+
}
|
|
78
|
+
async setDirectionAndShow(direction) {
|
|
79
|
+
if (direction === 'up') {
|
|
80
|
+
this.determinePopOffset();
|
|
168
81
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
82
|
+
this.currentDirection = direction;
|
|
83
|
+
this.show = true;
|
|
84
|
+
}
|
|
85
|
+
async determinePopDirection() {
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
87
|
+
const { containerElement, contentElement, direction, controlElement, currentDirection } = this;
|
|
88
|
+
if (containerElement)
|
|
89
|
+
containerElement.style.maxHeight = null;
|
|
90
|
+
// If the direction is already set then use it, otherwise use the current direction
|
|
91
|
+
const currentOrStatedDirection = direction !== null && direction !== void 0 ? direction : currentDirection;
|
|
92
|
+
// Set the container to block so we can get the height
|
|
93
|
+
containerElement.style.setProperty('display', 'block');
|
|
94
|
+
await waitForNextPaint();
|
|
95
|
+
// Determine the dimensions of the control element
|
|
96
|
+
const { top: topOffset, height } = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {
|
|
97
|
+
top: 0,
|
|
98
|
+
height: 0,
|
|
99
|
+
};
|
|
100
|
+
const contentHeight = contentElement.clientHeight;
|
|
101
|
+
const scrollY = ((_c = (_b = window.Tecton) === null || _b === void 0 ? void 0 : _b.platformDimensions) === null || _c === void 0 ? void 0 : _c.scrollY) ||
|
|
102
|
+
((_d = window.visualViewport) === null || _d === void 0 ? void 0 : _d.offsetTop) || // Only Android Chrome provides this which we need when scrolled
|
|
103
|
+
0;
|
|
104
|
+
const outletOffset = scrollY + (((_f = (_e = window.Tecton) === null || _e === void 0 ? void 0 : _e.platformDimensions) === null || _f === void 0 ? void 0 : _f.outletOffset) || 0);
|
|
105
|
+
const innerHeight = ((_h = (_g = window.Tecton) === null || _g === void 0 ? void 0 : _g.platformDimensions) === null || _h === void 0 ? void 0 : _h.innerHeight) || ((_j = window.visualViewport) === null || _j === void 0 ? void 0 : _j.height) || window.innerHeight;
|
|
106
|
+
const bottomOffset = scrollY + innerHeight - topOffset - height - outletOffset;
|
|
107
|
+
const canShowFullSizeBelow = bottomOffset > contentHeight;
|
|
108
|
+
const canShowFullSizeAbove = contentHeight <= topOffset;
|
|
109
|
+
let determinedDirection;
|
|
110
|
+
// Show the full-size popover below or above if it will fit
|
|
111
|
+
if (currentOrStatedDirection === 'down' && canShowFullSizeBelow)
|
|
112
|
+
return this.setDirectionAndShow('down');
|
|
113
|
+
else if (currentOrStatedDirection === 'up' && canShowFullSizeAbove)
|
|
114
|
+
return this.setDirectionAndShow('up');
|
|
115
|
+
else if (currentOrStatedDirection === undefined && canShowFullSizeBelow)
|
|
116
|
+
determinedDirection = 'down';
|
|
117
|
+
else if (currentOrStatedDirection === undefined && canShowFullSizeAbove)
|
|
118
|
+
determinedDirection = 'up';
|
|
119
|
+
if (determinedDirection)
|
|
120
|
+
return this.setDirectionAndShow(determinedDirection);
|
|
121
|
+
// If full size will not fit then make it as tall as possible
|
|
122
|
+
const { minHeight = 150 } = this;
|
|
123
|
+
const displayBuffer = 5;
|
|
124
|
+
const canShowMinHeightBelow = bottomOffset >= minHeight + displayBuffer;
|
|
125
|
+
let maxHeight;
|
|
126
|
+
if (currentOrStatedDirection === 'down') {
|
|
127
|
+
maxHeight = Math.max(bottomOffset - displayBuffer, minHeight);
|
|
128
|
+
determinedDirection = 'down';
|
|
182
129
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
* @method step
|
|
187
|
-
* @param {Object} context
|
|
188
|
-
* @returns {undefined}
|
|
189
|
-
*/
|
|
190
|
-
function step(context) {
|
|
191
|
-
var time = now();
|
|
192
|
-
var value;
|
|
193
|
-
var currentX;
|
|
194
|
-
var currentY;
|
|
195
|
-
var elapsed = (time - context.startTime) / SCROLL_TIME;
|
|
196
|
-
|
|
197
|
-
// avoid elapsed times higher than one
|
|
198
|
-
elapsed = elapsed > 1 ? 1 : elapsed;
|
|
199
|
-
|
|
200
|
-
// apply easing to elapsed time
|
|
201
|
-
value = ease(elapsed);
|
|
202
|
-
|
|
203
|
-
currentX = context.startX + (context.x - context.startX) * value;
|
|
204
|
-
currentY = context.startY + (context.y - context.startY) * value;
|
|
205
|
-
|
|
206
|
-
context.method.call(context.scrollable, currentX, currentY);
|
|
207
|
-
|
|
208
|
-
// scroll more if we have not reached our destination
|
|
209
|
-
if (currentX !== context.x || currentY !== context.y) {
|
|
210
|
-
w.requestAnimationFrame(step.bind(w, context));
|
|
211
|
-
}
|
|
130
|
+
else if (currentOrStatedDirection === 'up') {
|
|
131
|
+
maxHeight = Math.max(topOffset - displayBuffer, minHeight);
|
|
132
|
+
determinedDirection = 'up';
|
|
212
133
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
* @method smoothScroll
|
|
217
|
-
* @param {Object|Node} el
|
|
218
|
-
* @param {Number} x
|
|
219
|
-
* @param {Number} y
|
|
220
|
-
* @returns {undefined}
|
|
221
|
-
*/
|
|
222
|
-
function smoothScroll(el, x, y) {
|
|
223
|
-
var scrollable;
|
|
224
|
-
var startX;
|
|
225
|
-
var startY;
|
|
226
|
-
var method;
|
|
227
|
-
var startTime = now();
|
|
228
|
-
|
|
229
|
-
// define scroll context
|
|
230
|
-
if (el === d.body) {
|
|
231
|
-
scrollable = w;
|
|
232
|
-
startX = w.scrollX || w.pageXOffset;
|
|
233
|
-
startY = w.scrollY || w.pageYOffset;
|
|
234
|
-
method = original.scroll;
|
|
235
|
-
} else {
|
|
236
|
-
scrollable = el;
|
|
237
|
-
startX = el.scrollLeft;
|
|
238
|
-
startY = el.scrollTop;
|
|
239
|
-
method = scrollElement;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// scroll looping over a frame
|
|
243
|
-
step({
|
|
244
|
-
scrollable: scrollable,
|
|
245
|
-
method: method,
|
|
246
|
-
startTime: startTime,
|
|
247
|
-
startX: startX,
|
|
248
|
-
startY: startY,
|
|
249
|
-
x: x,
|
|
250
|
-
y: y
|
|
251
|
-
});
|
|
134
|
+
else if (canShowMinHeightBelow) {
|
|
135
|
+
maxHeight = Math.max(bottomOffset - displayBuffer, minHeight);
|
|
136
|
+
determinedDirection = 'down';
|
|
252
137
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
w.scroll = w.scrollTo = function() {
|
|
257
|
-
// avoid action when no arguments are passed
|
|
258
|
-
if (arguments[0] === undefined) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// avoid smooth behavior if not required
|
|
263
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
264
|
-
original.scroll.call(
|
|
265
|
-
w,
|
|
266
|
-
arguments[0].left !== undefined
|
|
267
|
-
? arguments[0].left
|
|
268
|
-
: typeof arguments[0] !== 'object'
|
|
269
|
-
? arguments[0]
|
|
270
|
-
: w.scrollX || w.pageXOffset,
|
|
271
|
-
// use top prop, second argument if present or fallback to scrollY
|
|
272
|
-
arguments[0].top !== undefined
|
|
273
|
-
? arguments[0].top
|
|
274
|
-
: arguments[1] !== undefined
|
|
275
|
-
? arguments[1]
|
|
276
|
-
: w.scrollY || w.pageYOffset
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// LET THE SMOOTHNESS BEGIN!
|
|
283
|
-
smoothScroll.call(
|
|
284
|
-
w,
|
|
285
|
-
d.body,
|
|
286
|
-
arguments[0].left !== undefined
|
|
287
|
-
? ~~arguments[0].left
|
|
288
|
-
: w.scrollX || w.pageXOffset,
|
|
289
|
-
arguments[0].top !== undefined
|
|
290
|
-
? ~~arguments[0].top
|
|
291
|
-
: w.scrollY || w.pageYOffset
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// w.scrollBy
|
|
296
|
-
w.scrollBy = function() {
|
|
297
|
-
// avoid action when no arguments are passed
|
|
298
|
-
if (arguments[0] === undefined) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// avoid smooth behavior if not required
|
|
303
|
-
if (shouldBailOut(arguments[0])) {
|
|
304
|
-
original.scrollBy.call(
|
|
305
|
-
w,
|
|
306
|
-
arguments[0].left !== undefined
|
|
307
|
-
? arguments[0].left
|
|
308
|
-
: typeof arguments[0] !== 'object' ? arguments[0] : 0,
|
|
309
|
-
arguments[0].top !== undefined
|
|
310
|
-
? arguments[0].top
|
|
311
|
-
: arguments[1] !== undefined ? arguments[1] : 0
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// LET THE SMOOTHNESS BEGIN!
|
|
318
|
-
smoothScroll.call(
|
|
319
|
-
w,
|
|
320
|
-
d.body,
|
|
321
|
-
~~arguments[0].left + (w.scrollX || w.pageXOffset),
|
|
322
|
-
~~arguments[0].top + (w.scrollY || w.pageYOffset)
|
|
323
|
-
);
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// Element.prototype.scroll and Element.prototype.scrollTo
|
|
327
|
-
Element.prototype.scroll = Element.prototype.scrollTo = function() {
|
|
328
|
-
// avoid action when no arguments are passed
|
|
329
|
-
if (arguments[0] === undefined) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// avoid smooth behavior if not required
|
|
334
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
335
|
-
// if one number is passed, throw error to match Firefox implementation
|
|
336
|
-
if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
|
|
337
|
-
throw new SyntaxError('Value could not be converted');
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
original.elementScroll.call(
|
|
341
|
-
this,
|
|
342
|
-
// use left prop, first number argument or fallback to scrollLeft
|
|
343
|
-
arguments[0].left !== undefined
|
|
344
|
-
? ~~arguments[0].left
|
|
345
|
-
: typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,
|
|
346
|
-
// use top prop, second argument or fallback to scrollTop
|
|
347
|
-
arguments[0].top !== undefined
|
|
348
|
-
? ~~arguments[0].top
|
|
349
|
-
: arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
var left = arguments[0].left;
|
|
356
|
-
var top = arguments[0].top;
|
|
357
|
-
|
|
358
|
-
// LET THE SMOOTHNESS BEGIN!
|
|
359
|
-
smoothScroll.call(
|
|
360
|
-
this,
|
|
361
|
-
this,
|
|
362
|
-
typeof left === 'undefined' ? this.scrollLeft : ~~left,
|
|
363
|
-
typeof top === 'undefined' ? this.scrollTop : ~~top
|
|
364
|
-
);
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
// Element.prototype.scrollBy
|
|
368
|
-
Element.prototype.scrollBy = function() {
|
|
369
|
-
// avoid action when no arguments are passed
|
|
370
|
-
if (arguments[0] === undefined) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// avoid smooth behavior if not required
|
|
375
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
376
|
-
original.elementScroll.call(
|
|
377
|
-
this,
|
|
378
|
-
arguments[0].left !== undefined
|
|
379
|
-
? ~~arguments[0].left + this.scrollLeft
|
|
380
|
-
: ~~arguments[0] + this.scrollLeft,
|
|
381
|
-
arguments[0].top !== undefined
|
|
382
|
-
? ~~arguments[0].top + this.scrollTop
|
|
383
|
-
: ~~arguments[1] + this.scrollTop
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
this.scroll({
|
|
390
|
-
left: ~~arguments[0].left + this.scrollLeft,
|
|
391
|
-
top: ~~arguments[0].top + this.scrollTop,
|
|
392
|
-
behavior: arguments[0].behavior
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
// Element.prototype.scrollIntoView
|
|
397
|
-
Element.prototype.scrollIntoView = function() {
|
|
398
|
-
// avoid smooth behavior if not required
|
|
399
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
400
|
-
original.scrollIntoView.call(
|
|
401
|
-
this,
|
|
402
|
-
arguments[0] === undefined ? true : arguments[0]
|
|
403
|
-
);
|
|
404
|
-
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// LET THE SMOOTHNESS BEGIN!
|
|
409
|
-
var scrollableParent = findScrollableParent(this);
|
|
410
|
-
var parentRects = scrollableParent.getBoundingClientRect();
|
|
411
|
-
var clientRects = this.getBoundingClientRect();
|
|
412
|
-
|
|
413
|
-
if (scrollableParent !== d.body) {
|
|
414
|
-
// reveal element inside parent
|
|
415
|
-
smoothScroll.call(
|
|
416
|
-
this,
|
|
417
|
-
scrollableParent,
|
|
418
|
-
scrollableParent.scrollLeft + clientRects.left - parentRects.left,
|
|
419
|
-
scrollableParent.scrollTop + clientRects.top - parentRects.top
|
|
420
|
-
);
|
|
421
|
-
|
|
422
|
-
// reveal parent in viewport unless is fixed
|
|
423
|
-
if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
|
|
424
|
-
w.scrollBy({
|
|
425
|
-
left: parentRects.left,
|
|
426
|
-
top: parentRects.top,
|
|
427
|
-
behavior: 'smooth'
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
} else {
|
|
431
|
-
// reveal element in viewport
|
|
432
|
-
w.scrollBy({
|
|
433
|
-
left: clientRects.left,
|
|
434
|
-
top: clientRects.top,
|
|
435
|
-
behavior: 'smooth'
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
{
|
|
442
|
-
// commonjs
|
|
443
|
-
module.exports = { polyfill: polyfill };
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
}());
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
function isMobile() {
|
|
450
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile|IEMobile|Windows Phone|Opera Mini/i.test(navigator.userAgent);
|
|
451
|
-
}
|
|
452
|
-
function isHostLosingFocus(event, hostElement) {
|
|
453
|
-
const type = event.type;
|
|
454
|
-
const focusInTypes = ['focusin', 'focus'];
|
|
455
|
-
const isFocusIn = focusInTypes.includes(type);
|
|
456
|
-
// on focusin: `target` is element losing focus, `relatedTarget` is element gaining focus
|
|
457
|
-
// on focusout: `target` is element gaining focus, `relatedTarget` is element losing focus
|
|
458
|
-
const elementGainingFocus = isFocusIn ? event.target : event.relatedTarget;
|
|
459
|
-
const isElementNestedInHostElement = (element) => {
|
|
460
|
-
if (element === hostElement)
|
|
461
|
-
return true;
|
|
462
|
-
if (element.parentElement) {
|
|
463
|
-
return isElementNestedInHostElement(element.parentElement);
|
|
138
|
+
else {
|
|
139
|
+
maxHeight = Math.max(topOffset - scrollY - displayBuffer, minHeight);
|
|
140
|
+
determinedDirection = 'up';
|
|
464
141
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
if (!(elementGainingFocus instanceof HTMLElement))
|
|
468
|
-
return true;
|
|
469
|
-
return !isElementNestedInHostElement(elementGainingFocus);
|
|
470
|
-
}
|
|
471
|
-
function isRelatedTargetWithinHost(event, element) {
|
|
472
|
-
return event.relatedTarget !== element && !element.contains(event.relatedTarget);
|
|
473
|
-
}
|
|
474
|
-
function isEventFromElement(event, element) {
|
|
475
|
-
var _a;
|
|
476
|
-
return ((_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event)[0]) === element;
|
|
477
|
-
}
|
|
478
|
-
function overrideFocus(hostElement) {
|
|
479
|
-
hostElement.focus = () => hostElement === null || hostElement === void 0 ? void 0 : hostElement.dispatchEvent(new FocusEvent('focus', { bubbles: false }));
|
|
480
|
-
}
|
|
481
|
-
function addSmoothScrollPolyfill() {
|
|
482
|
-
if (!isSafari())
|
|
483
|
-
return false;
|
|
484
|
-
smoothscroll.polyfill();
|
|
485
|
-
return (window.__forceSmoothScrollPolyfill__ = true);
|
|
486
|
-
}
|
|
487
|
-
function isFirefox() {
|
|
488
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
489
|
-
return userAgent.includes('firefox');
|
|
490
|
-
}
|
|
491
|
-
function isTouchDevice() {
|
|
492
|
-
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
493
|
-
}
|
|
494
|
-
function isSafari() {
|
|
495
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
496
|
-
return userAgent.includes('safari') && !userAgent.includes('chrome');
|
|
497
|
-
}
|
|
498
|
-
let guid = 1000;
|
|
499
|
-
function createGuid() {
|
|
500
|
-
return guid++;
|
|
501
|
-
}
|
|
502
|
-
function nextPaint(fn) {
|
|
503
|
-
requestAnimationFrame(() => {
|
|
504
|
-
requestAnimationFrame(fn);
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
function waitForNextPaint() {
|
|
508
|
-
return new Promise(resolve => nextPaint(resolve));
|
|
509
|
-
}
|
|
510
|
-
function loc(key, subs) {
|
|
511
|
-
var _a, _b, _c;
|
|
512
|
-
if (!key)
|
|
513
|
-
return '';
|
|
514
|
-
if (((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.noStrings) === true) {
|
|
515
|
-
return key;
|
|
142
|
+
containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);
|
|
143
|
+
return this.setDirectionAndShow(determinedDirection);
|
|
516
144
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
return;
|
|
523
|
-
let helpText = '';
|
|
524
|
-
if (target.optional) {
|
|
525
|
-
helpText = h("span", { class: "optional-tag" }, loc('tecton.element.input.optional'));
|
|
145
|
+
determinePopOffset() {
|
|
146
|
+
var _a;
|
|
147
|
+
const { controlElement, containerElement } = this;
|
|
148
|
+
const dropdownHeight = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect().height) !== null && _a !== void 0 ? _a : 0;
|
|
149
|
+
containerElement.style.setProperty('--comp-pop-offset', `${dropdownHeight}px`);
|
|
526
150
|
}
|
|
527
|
-
|
|
528
|
-
|
|
151
|
+
/// DOM ///
|
|
152
|
+
render() {
|
|
153
|
+
const containerClasses = ['container', this.currentDirection];
|
|
154
|
+
if (this.show)
|
|
155
|
+
containerClasses.push('show');
|
|
156
|
+
return (h("div", { ref: el => (this.containerElement = el), class: containerClasses.join(' '), "test-id": "outerContainer" }, h("div", { ref: el => (this.contentElement = el), class: "content" }, h("slot", null))));
|
|
529
157
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
function
|
|
547
|
-
if (typeof
|
|
158
|
+
get hostElement() { return this; }
|
|
159
|
+
static get watchers() { return {
|
|
160
|
+
"open": ["openChanged"]
|
|
161
|
+
}; }
|
|
162
|
+
static get style() { return stylesCss; }
|
|
163
|
+
}, [1, "q2-popover", {
|
|
164
|
+
"direction": [513],
|
|
165
|
+
"align": [513],
|
|
166
|
+
"open": [1540],
|
|
167
|
+
"block": [516],
|
|
168
|
+
"minHeight": [2, "min-height"],
|
|
169
|
+
"controlElement": [16],
|
|
170
|
+
"currentDirection": [32],
|
|
171
|
+
"show": [32],
|
|
172
|
+
"toggle": [64]
|
|
173
|
+
}, [[0, "popoverState", "popoverStateHandler"]]]);
|
|
174
|
+
function defineCustomElement() {
|
|
175
|
+
if (typeof customElements === "undefined") {
|
|
548
176
|
return;
|
|
549
|
-
target[newProp] = target[oldProp];
|
|
550
|
-
if (removeOldProp) {
|
|
551
|
-
delete target[oldProp];
|
|
552
177
|
}
|
|
178
|
+
const components = ["q2-popover"];
|
|
179
|
+
components.forEach(tagName => { switch (tagName) {
|
|
180
|
+
case "q2-popover":
|
|
181
|
+
if (!customElements.get(tagName)) {
|
|
182
|
+
customElements.define(tagName, Q2Popover);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
} });
|
|
553
186
|
}
|
|
554
|
-
|
|
555
|
-
const type = target.hasError ? 'danger' : 'info';
|
|
556
|
-
return (h("div", { class: "messages-container" },
|
|
557
|
-
h("q2-message", { appearance: "minimal", description: true, type: type, "test-id": "message" },
|
|
558
|
-
h("ul", { id: target.inputDescribedBy }, target.messages.map(message => (h("li", { "test-id": "messageListItem" }, loc(message))))))));
|
|
559
|
-
}
|
|
560
|
-
function setMessageHeight(target) {
|
|
561
|
-
const messageContainer = target.hostElement.shadowRoot.querySelector('.messages-container');
|
|
562
|
-
const q2Message = messageContainer.querySelector('q2-message');
|
|
563
|
-
nextPaint(() => {
|
|
564
|
-
const height = target.showMessages && target.hasFocus ? q2Message.getBoundingClientRect().height : 0;
|
|
565
|
-
if (messageContainer.style.getPropertyValue('height') === `${height}px`)
|
|
566
|
-
return;
|
|
567
|
-
if (height === 0) {
|
|
568
|
-
q2Message.classList.add('invisible');
|
|
569
|
-
messageContainer.style.removeProperty('height');
|
|
570
|
-
}
|
|
571
|
-
else {
|
|
572
|
-
q2Message.classList.remove('invisible');
|
|
573
|
-
messageContainer.style.setProperty('height', `${height}px`);
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
const resizeIframe = () => {
|
|
578
|
-
var _a, _b;
|
|
579
|
-
return (_b = (_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.resizeIframe) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
580
|
-
};
|
|
581
|
-
// Handling color attribute (deprecated)
|
|
582
|
-
const handleColor = (target) => {
|
|
583
|
-
if (!target.intent && ['primary', 'secondary'].includes(target.color)) {
|
|
584
|
-
target.intent = `workflow-${target.color}`;
|
|
585
|
-
target.color = undefined;
|
|
586
|
-
}
|
|
587
|
-
};
|
|
187
|
+
defineCustomElement();
|
|
588
188
|
|
|
589
|
-
export {
|
|
189
|
+
export { Q2Popover as Q, defineCustomElement as d };
|