@refinitiv-ui/elements 6.8.7 → 6.8.9
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/CHANGELOG.md +180 -433
- package/LICENSE +1 -1
- package/README.md +13 -11
- package/lib/accordion/index.d.ts +1 -1
- package/lib/accordion/index.js +4 -7
- package/lib/appstate-bar/index.d.ts +2 -2
- package/lib/appstate-bar/index.js +10 -4
- package/lib/autosuggest/index.d.ts +7 -7
- package/lib/autosuggest/index.js +85 -80
- package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
- package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
- package/lib/button/index.js +7 -10
- package/lib/button-bar/index.d.ts +1 -1
- package/lib/button-bar/index.js +12 -12
- package/lib/calendar/index.d.ts +39 -39
- package/lib/calendar/index.js +160 -125
- package/lib/calendar/utils.js +2 -2
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +2 -4
- package/lib/card/helpers/types.d.ts +2 -2
- package/lib/card/index.d.ts +5 -5
- package/lib/card/index.js +34 -28
- package/lib/chart/helpers/legend.js +10 -8
- package/lib/chart/index.d.ts +3 -3
- package/lib/chart/index.js +17 -17
- package/lib/chart/plugins/doughnut-center-label.js +6 -5
- package/lib/checkbox/index.d.ts +1 -1
- package/lib/checkbox/index.js +12 -13
- package/lib/clock/index.d.ts +55 -55
- package/lib/clock/index.js +84 -95
- package/lib/clock/themes/halo/dark/index.js +1 -1
- package/lib/clock/themes/halo/light/index.js +1 -1
- package/lib/clock/themes/solar/charcoal/index.js +1 -1
- package/lib/clock/themes/solar/pearl/index.js +1 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse/index.js +28 -19
- package/lib/collapse/themes/halo/dark/index.js +1 -1
- package/lib/collapse/themes/halo/light/index.js +1 -1
- package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/color-palettes.js +5 -6
- package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
- package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
- package/lib/color-dialog/elements/palettes.js +5 -4
- package/lib/color-dialog/helpers/value-model.js +7 -9
- package/lib/color-dialog/index.d.ts +6 -6
- package/lib/color-dialog/index.js +53 -37
- package/lib/color-picker/index.d.ts +2 -2
- package/lib/color-picker/index.js +40 -34
- package/lib/combo-box/helpers/filter.d.ts +2 -2
- package/lib/combo-box/helpers/types.d.ts +1 -1
- package/lib/combo-box/index.d.ts +9 -9
- package/lib/combo-box/index.js +61 -55
- package/lib/configuration/elements/configuration.d.ts +1 -1
- package/lib/configuration/elements/configuration.js +2 -2
- package/lib/counter/index.d.ts +4 -4
- package/lib/counter/index.js +9 -7
- package/lib/datetime-field/index.d.ts +4 -5
- package/lib/datetime-field/index.js +32 -23
- package/lib/datetime-field/utils.js +11 -1
- package/lib/datetime-picker/index.d.ts +75 -75
- package/lib/datetime-picker/index.js +151 -132
- package/lib/datetime-picker/locales.js +5 -5
- package/lib/datetime-picker/utils.js +9 -9
- package/lib/dialog/draggable-element.js +1 -2
- package/lib/dialog/index.d.ts +6 -6
- package/lib/dialog/index.js +48 -38
- package/lib/email-field/index.d.ts +1 -1
- package/lib/email-field/index.js +6 -6
- package/lib/events.d.ts +1 -1
- package/lib/flag/index.d.ts +1 -1
- package/lib/flag/index.js +6 -5
- package/lib/flag/utils/FlagLoader.js +1 -1
- package/lib/header/index.d.ts +1 -1
- package/lib/header/index.js +2 -2
- package/lib/header/themes/halo/dark/index.js +1 -1
- package/lib/header/themes/halo/light/index.js +1 -1
- package/lib/header/themes/solar/charcoal/index.js +1 -1
- package/lib/header/themes/solar/pearl/index.js +1 -1
- package/lib/heatmap/helpers/color.d.ts +1 -1
- package/lib/heatmap/helpers/color.js +11 -5
- package/lib/heatmap/helpers/track.js +3 -3
- package/lib/heatmap/index.d.ts +9 -9
- package/lib/heatmap/index.js +51 -42
- package/lib/icon/index.d.ts +2 -2
- package/lib/icon/index.js +6 -8
- package/lib/icon/utils/IconLoader.d.ts +1 -0
- package/lib/icon/utils/IconLoader.js +9 -1
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +34 -34
- package/lib/interactive-chart/index.js +72 -57
- package/lib/item/helpers/types.d.ts +1 -1
- package/lib/item/index.d.ts +3 -3
- package/lib/item/index.js +24 -20
- package/lib/jsx.d.ts +6 -4
- package/lib/label/index.d.ts +1 -1
- package/lib/label/index.js +11 -8
- package/lib/layout/index.d.ts +7 -7
- package/lib/layout/index.js +7 -7
- package/lib/led-gauge/index.d.ts +1 -1
- package/lib/led-gauge/index.js +10 -10
- package/lib/list/elements/list.d.ts +3 -3
- package/lib/list/elements/list.js +10 -12
- package/lib/list/helpers/renderer.js +2 -2
- package/lib/list/helpers/types.d.ts +1 -1
- package/lib/list/index.d.ts +1 -1
- package/lib/list/renderer.d.ts +7 -7
- package/lib/loader/index.js +7 -8
- package/lib/multi-input/index.d.ts +6 -6
- package/lib/multi-input/index.js +39 -45
- package/lib/notification/elements/notification-tray.d.ts +2 -2
- package/lib/notification/elements/notification-tray.js +3 -3
- package/lib/notification/elements/notification.d.ts +2 -2
- package/lib/notification/elements/notification.js +22 -14
- package/lib/notification/helpers/status.js +1 -1
- package/lib/number-field/index.d.ts +5 -6
- package/lib/number-field/index.js +37 -47
- package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
- package/lib/overlay/elements/overlay.d.ts +2 -2
- package/lib/overlay/elements/overlay.js +154 -98
- package/lib/overlay/helpers/types.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
- package/lib/overlay/managers/backdrop-manager.js +2 -2
- package/lib/overlay/managers/close-manager.js +2 -1
- package/lib/overlay/managers/focus-manager.js +23 -13
- package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
- package/lib/overlay/managers/interaction-lock-manager.js +33 -25
- package/lib/overlay/managers/viewport-manager.d.ts +2 -2
- package/lib/overlay/managers/viewport-manager.js +3 -2
- package/lib/overlay/managers/zindex-manager.js +4 -2
- package/lib/overlay-menu/helpers/types.d.ts +2 -2
- package/lib/overlay-menu/index.d.ts +1 -1
- package/lib/overlay-menu/index.js +44 -33
- package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
- package/lib/overlay-menu/managers/menu-manager.js +15 -13
- package/lib/pagination/index.d.ts +4 -4
- package/lib/pagination/index.js +39 -14
- package/lib/panel/index.js +1 -1
- package/lib/password-field/index.d.ts +2 -2
- package/lib/password-field/index.js +4 -4
- package/lib/pill/index.d.ts +1 -1
- package/lib/pill/index.js +22 -19
- package/lib/progress-bar/index.d.ts +1 -1
- package/lib/progress-bar/index.js +38 -37
- package/lib/radio-button/index.d.ts +2 -2
- package/lib/radio-button/index.js +17 -12
- package/lib/radio-button/radio-button-registry.js +8 -5
- package/lib/rating/index.d.ts +1 -1
- package/lib/rating/index.js +2 -5
- package/lib/rating/utils.d.ts +6 -6
- package/lib/rating/utils.js +6 -6
- package/lib/search-field/index.d.ts +2 -2
- package/lib/search-field/index.js +4 -4
- package/lib/select/index.d.ts +34 -34
- package/lib/select/index.js +70 -83
- package/lib/sidebar-layout/index.d.ts +2 -2
- package/lib/sidebar-layout/index.js +7 -9
- package/lib/slider/index.d.ts +2 -2
- package/lib/slider/index.js +57 -45
- package/lib/slider/utils.d.ts +10 -10
- package/lib/slider/utils.js +10 -10
- package/lib/sparkline/index.d.ts +1 -1
- package/lib/sparkline/index.js +7 -8
- package/lib/swing-gauge/helpers.js +2 -2
- package/lib/swing-gauge/index.d.ts +19 -19
- package/lib/swing-gauge/index.js +91 -81
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +16 -27
- package/lib/tab/themes/halo/dark/index.js +1 -1
- package/lib/tab/themes/halo/light/index.js +1 -1
- package/lib/tab/themes/solar/charcoal/index.js +1 -1
- package/lib/tab/themes/solar/pearl/index.js +1 -1
- package/lib/tab-bar/helpers/animate.js +1 -1
- package/lib/tab-bar/index.d.ts +1 -1
- package/lib/tab-bar/index.js +34 -18
- package/lib/tab-bar/themes/halo/dark/index.js +1 -1
- package/lib/tab-bar/themes/halo/light/index.js +1 -1
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/index.js +36 -33
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +104 -90
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +4 -3
- package/lib/tooltip/elements/title-tooltip.js +2 -2
- package/lib/tooltip/index.d.ts +27 -27
- package/lib/tooltip/index.js +42 -38
- package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
- package/lib/tornado-chart/elements/tornado-chart.js +1 -1
- package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
- package/lib/tornado-chart/elements/tornado-item.js +12 -10
- package/lib/tree/elements/tree-item.d.ts +3 -3
- package/lib/tree/elements/tree-item.js +21 -19
- package/lib/tree/elements/tree.d.ts +1 -1
- package/lib/tree/elements/tree.js +12 -11
- package/lib/tree/helpers/renderer.js +4 -3
- package/lib/tree/index.d.ts +1 -1
- package/lib/tree/managers/tree-manager.d.ts +1 -1
- package/lib/tree/managers/tree-manager.js +17 -18
- package/lib/tree/themes/solar/charcoal/index.js +1 -1
- package/lib/tree/themes/solar/pearl/index.js +1 -1
- package/lib/tree-select/index.d.ts +9 -9
- package/lib/tree-select/index.js +91 -82
- package/lib/tree-select/themes/halo/dark/index.js +1 -1
- package/lib/tree-select/themes/halo/light/index.js +1 -1
- package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
- package/lib/tree-select/themes/solar/pearl/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +16 -16
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var Overlay_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
|
-
import { ResponsiveElement,
|
|
3
|
+
import { ResponsiveElement, css, html, triggerResize } from '@refinitiv-ui/core';
|
|
4
4
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
5
5
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
6
|
+
import { AnimationTaskRunner, MicroTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
7
|
+
import { isEdge, isIE } from '@refinitiv-ui/utils/browser.js';
|
|
6
8
|
import { VERSION } from '../../version.js';
|
|
7
|
-
import {
|
|
8
|
-
import { isIE, isEdge } from '@refinitiv-ui/utils/browser.js';
|
|
9
|
+
import { valueOrNull, valueOrZero } from '../helpers/functions.js';
|
|
9
10
|
import { DEFAULT_ALIGN, DEFAULT_TARGET_STRATEGY } from '../helpers/types.js';
|
|
10
|
-
import {
|
|
11
|
+
import { deregister as backdropDeregister, register as backdropRegister } from '../managers/backdrop-manager.js';
|
|
12
|
+
import { deregister as closeDeregister, register as closeRegister } from '../managers/close-manager.js';
|
|
13
|
+
import { deregister as focusableDeregister, register as focusableRegister } from '../managers/focus-manager.js';
|
|
11
14
|
import { applyLock } from '../managers/interaction-lock-manager.js';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { register as backdropRegister, deregister as backdropDeregister } from '../managers/backdrop-manager.js';
|
|
15
|
-
import { register as closeRegister, deregister as closeDeregister } from '../managers/close-manager.js';
|
|
16
|
-
import { register as focusableRegister, deregister as focusableDeregister } from '../managers/focus-manager.js';
|
|
15
|
+
import { getViewAreaInfo, deregister as viewportDeregister, register as viewportRegister } from '../managers/viewport-manager.js';
|
|
16
|
+
import { toFront, deregister as zIndexDeregister, register as zIndexRegister } from '../managers/zindex-manager.js';
|
|
17
17
|
/**
|
|
18
18
|
* Possible states of the overlay
|
|
19
19
|
*/
|
|
20
20
|
var OpenedState;
|
|
21
21
|
(function (OpenedState) {
|
|
22
|
-
OpenedState[OpenedState["CLOSED"] = 0] = "CLOSED";
|
|
23
|
-
OpenedState[OpenedState["OPENING"] = 1] = "OPENING";
|
|
24
|
-
OpenedState[OpenedState["OPENED"] = 2] = "OPENED";
|
|
22
|
+
OpenedState[OpenedState["CLOSED"] = 0] = "CLOSED"; /* overlay is not visible on the screen */
|
|
23
|
+
OpenedState[OpenedState["OPENING"] = 1] = "OPENING"; /* overlay is visible on the screen, but opening animation is still running */
|
|
24
|
+
OpenedState[OpenedState["OPENED"] = 2] = "OPENED"; /* overlay is visible on the screen */
|
|
25
25
|
OpenedState[OpenedState["CLOSING"] = 3] = "CLOSING"; /* overlay is visible on the screen, but closing animation is still running */
|
|
26
26
|
})(OpenedState || (OpenedState = {}));
|
|
27
27
|
/**
|
|
@@ -56,11 +56,28 @@ const hasNumberChanged = (newVal, oldVal) => oldVal === undefined ? false : newV
|
|
|
56
56
|
/**
|
|
57
57
|
* When these properties change render is called
|
|
58
58
|
*/
|
|
59
|
-
const shouldUpdateProperties = [
|
|
59
|
+
const shouldUpdateProperties = [
|
|
60
|
+
'withShadow',
|
|
61
|
+
'transparent',
|
|
62
|
+
'spacing',
|
|
63
|
+
'transitionStyle',
|
|
64
|
+
'fullScreen',
|
|
65
|
+
'zIndex'
|
|
66
|
+
];
|
|
60
67
|
/**
|
|
61
68
|
* When these properties change refit is called
|
|
62
69
|
*/
|
|
63
|
-
const shouldRefitProperties = [
|
|
70
|
+
const shouldRefitProperties = [
|
|
71
|
+
'position',
|
|
72
|
+
'x',
|
|
73
|
+
'y',
|
|
74
|
+
'positionTarget',
|
|
75
|
+
'horizontalOffset',
|
|
76
|
+
'verticalOffset',
|
|
77
|
+
'offset',
|
|
78
|
+
'fullScreen',
|
|
79
|
+
'noOverlap'
|
|
80
|
+
];
|
|
64
81
|
/**
|
|
65
82
|
* Element to help building modals, dialogs and other overlay content
|
|
66
83
|
* @fires closed - Fired when overlay becomes invisible and close animation finished
|
|
@@ -211,7 +228,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
211
228
|
}
|
|
212
229
|
|
|
213
230
|
:host(:not([animation-ready])) {
|
|
214
|
-
animation: none
|
|
231
|
+
animation: none !important;
|
|
215
232
|
transition: none !important;
|
|
216
233
|
transform: none !important;
|
|
217
234
|
top: 0;
|
|
@@ -228,82 +245,104 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
228
245
|
}
|
|
229
246
|
|
|
230
247
|
@keyframes popup-scale {
|
|
231
|
-
from {
|
|
232
|
-
|
|
248
|
+
from {
|
|
249
|
+
transform: scale(0, 0);
|
|
250
|
+
}
|
|
251
|
+
to {
|
|
252
|
+
transform: scale(1, 1);
|
|
253
|
+
}
|
|
233
254
|
}
|
|
234
255
|
|
|
235
256
|
@keyframes popup-scale-vertical {
|
|
236
|
-
from {
|
|
237
|
-
|
|
257
|
+
from {
|
|
258
|
+
transform: scaleY(0);
|
|
259
|
+
}
|
|
260
|
+
to {
|
|
261
|
+
transform: scaleY(1);
|
|
262
|
+
}
|
|
238
263
|
}
|
|
239
264
|
|
|
240
265
|
@keyframes popup-scale-horizontal {
|
|
241
|
-
from {
|
|
242
|
-
|
|
266
|
+
from {
|
|
267
|
+
transform: scaleX(0);
|
|
268
|
+
}
|
|
269
|
+
to {
|
|
270
|
+
transform: scaleX(1);
|
|
271
|
+
}
|
|
243
272
|
}
|
|
244
273
|
|
|
245
274
|
@keyframes popup-scale-fade {
|
|
246
|
-
from {
|
|
247
|
-
|
|
248
|
-
|
|
275
|
+
from {
|
|
276
|
+
opacity: 0;
|
|
277
|
+
}
|
|
278
|
+
58% {
|
|
279
|
+
opacity: 0.3;
|
|
280
|
+
}
|
|
281
|
+
to {
|
|
282
|
+
opacity: 1;
|
|
283
|
+
}
|
|
249
284
|
}
|
|
250
285
|
|
|
251
286
|
@keyframes popup-fade {
|
|
252
|
-
from {
|
|
253
|
-
|
|
287
|
+
from {
|
|
288
|
+
opacity: 0;
|
|
289
|
+
}
|
|
290
|
+
to {
|
|
291
|
+
opacity: 1;
|
|
292
|
+
}
|
|
254
293
|
}
|
|
255
294
|
|
|
256
295
|
/* set origins */
|
|
257
|
-
:host([transition-style=
|
|
258
|
-
:host([transition-style=
|
|
296
|
+
:host([transition-style='slide-down']),
|
|
297
|
+
:host([transition-style='slide'][animation-position='bottom']) {
|
|
259
298
|
transform-origin: center top;
|
|
260
299
|
}
|
|
261
|
-
:host([transition-style=
|
|
262
|
-
:host([transition-style=
|
|
300
|
+
:host([transition-style='slide-up']),
|
|
301
|
+
:host([transition-style='slide'][animation-position='top']) {
|
|
263
302
|
transform-origin: center bottom;
|
|
264
303
|
}
|
|
265
|
-
:host([transition-style=
|
|
266
|
-
:host([transition-style=
|
|
304
|
+
:host([transition-style='slide-left']),
|
|
305
|
+
:host([transition-style='slide'][animation-position='left']) {
|
|
267
306
|
transform-origin: right center;
|
|
268
307
|
}
|
|
269
|
-
:host([transition-style=
|
|
270
|
-
:host([transition-style=
|
|
308
|
+
:host([transition-style='slide-right']),
|
|
309
|
+
:host([transition-style='slide'][animation-position='right']) {
|
|
271
310
|
transform-origin: left center;
|
|
272
311
|
}
|
|
273
|
-
:host([transition-style=
|
|
312
|
+
:host([transition-style='slide-right-down']) {
|
|
274
313
|
transform-origin: left top;
|
|
275
314
|
}
|
|
276
|
-
:host([transition-style=
|
|
315
|
+
:host([transition-style='slide-right-up']) {
|
|
277
316
|
transform-origin: left bottom;
|
|
278
317
|
}
|
|
279
|
-
:host([transition-style=
|
|
318
|
+
:host([transition-style='slide-left-down']) {
|
|
280
319
|
transform-origin: right top;
|
|
281
320
|
}
|
|
282
|
-
:host([transition-style=
|
|
321
|
+
:host([transition-style='slide-left-up']) {
|
|
283
322
|
transform-origin: right bottom;
|
|
284
323
|
}
|
|
285
324
|
|
|
286
325
|
/* set animation names */
|
|
287
|
-
:host([transition-style=
|
|
288
|
-
:host([transition-style=
|
|
289
|
-
:host([transition-style=
|
|
290
|
-
:host([transition-style=
|
|
291
|
-
:host([transition-style=
|
|
326
|
+
:host([transition-style='slide-right-down']),
|
|
327
|
+
:host([transition-style='slide-right-up']),
|
|
328
|
+
:host([transition-style='slide-left-down']),
|
|
329
|
+
:host([transition-style='slide-left-up']),
|
|
330
|
+
:host([transition-style='zoom']) {
|
|
292
331
|
animation-name: popup-scale, popup-scale-fade;
|
|
293
332
|
}
|
|
294
|
-
:host([transition-style=
|
|
333
|
+
:host([transition-style='fade']) {
|
|
295
334
|
animation-name: popup-fade;
|
|
296
335
|
}
|
|
297
|
-
:host([transition-style=
|
|
298
|
-
:host([transition-style=
|
|
299
|
-
:host([transition-style=
|
|
300
|
-
:host([transition-style=
|
|
336
|
+
:host([transition-style='slide-down']),
|
|
337
|
+
:host([transition-style='slide'][animation-position='bottom']),
|
|
338
|
+
:host([transition-style='slide-up']),
|
|
339
|
+
:host([transition-style='slide'][animation-position='top']) {
|
|
301
340
|
animation-name: popup-scale-vertical, popup-scale-fade;
|
|
302
341
|
}
|
|
303
|
-
:host([transition-style=
|
|
304
|
-
:host([transition-style=
|
|
305
|
-
:host([transition-style=
|
|
306
|
-
:host([transition-style=
|
|
342
|
+
:host([transition-style='slide-left']),
|
|
343
|
+
:host([transition-style='slide'][animation-position='left']),
|
|
344
|
+
:host([transition-style='slide-right']),
|
|
345
|
+
:host([transition-style='slide'][animation-position='right']) {
|
|
307
346
|
animation-name: popup-scale-horizontal, popup-scale-fade;
|
|
308
347
|
}
|
|
309
348
|
|
|
@@ -352,7 +391,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
352
391
|
return undefined;
|
|
353
392
|
}
|
|
354
393
|
const positionList = [...this.position];
|
|
355
|
-
const positionStrategy = this._positionStrategy = [];
|
|
394
|
+
const positionStrategy = (this._positionStrategy = []);
|
|
356
395
|
while (positionList.length) {
|
|
357
396
|
const position = positionList.shift();
|
|
358
397
|
if (!position) {
|
|
@@ -378,7 +417,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
378
417
|
const { viewHeight, viewWidth, viewOffsetTop, viewOffsetLeft } = this.viewAreaInfo;
|
|
379
418
|
let left;
|
|
380
419
|
let top;
|
|
381
|
-
if (this.fullScreen) {
|
|
420
|
+
if (this.fullScreen) {
|
|
421
|
+
/* keep it for caching only to not break other algorithms */
|
|
382
422
|
return {
|
|
383
423
|
rect: {
|
|
384
424
|
top: 0,
|
|
@@ -556,7 +596,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
556
596
|
let shouldUpdate = opening || closing || !this.hasUpdated || changedProperties.size === 0;
|
|
557
597
|
// Element may need to be updated if other attributes has been changed while the overlay is opened
|
|
558
598
|
if (!shouldUpdate && isOpened) {
|
|
559
|
-
if (shouldUpdateProperties.find(property => changedProperties.has(property))) {
|
|
599
|
+
if (shouldUpdateProperties.find((property) => changedProperties.has(property))) {
|
|
560
600
|
shouldUpdate = true;
|
|
561
601
|
}
|
|
562
602
|
}
|
|
@@ -568,7 +608,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
568
608
|
}
|
|
569
609
|
else if (this.opened) {
|
|
570
610
|
// Explicitly call hard refit
|
|
571
|
-
if (shouldRefitProperties.find(property => changedProperties.has(property))) {
|
|
611
|
+
if (shouldRefitProperties.find((property) => changedProperties.has(property))) {
|
|
572
612
|
this.refit();
|
|
573
613
|
}
|
|
574
614
|
}
|
|
@@ -581,7 +621,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
581
621
|
*/
|
|
582
622
|
openedChange() {
|
|
583
623
|
if (!this.opened) {
|
|
584
|
-
if (this._fullyOpened === OpenedState.OPENED) {
|
|
624
|
+
if (this._fullyOpened === OpenedState.OPENED) {
|
|
625
|
+
/* cannot set to closing if the overlay has not been fully opened */
|
|
585
626
|
this._fullyOpened = OpenedState.CLOSING;
|
|
586
627
|
}
|
|
587
628
|
this.removeMainRegisters();
|
|
@@ -632,7 +673,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
632
673
|
else if (disablingFocusManagement) {
|
|
633
674
|
focusableDeregister(this);
|
|
634
675
|
}
|
|
635
|
-
if (opening ||
|
|
676
|
+
if (opening ||
|
|
677
|
+
changedProperties.has('noInteractionLock') ||
|
|
678
|
+
changedProperties.has('lockPositionTarget') ||
|
|
679
|
+
changedProperties.has('interactiveElements')) {
|
|
636
680
|
applyLock();
|
|
637
681
|
}
|
|
638
682
|
const enablingBackdrop = (opening && this.withBackdrop) || (opened && changedProperties.get('withBackdrop') === false);
|
|
@@ -768,6 +812,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
768
812
|
const style = this.style;
|
|
769
813
|
// get minWidth and maxWidth
|
|
770
814
|
this._sizingInfo = {
|
|
815
|
+
/* cache any sizing info defined in styles, as we may operate on these values */
|
|
771
816
|
computed: {
|
|
772
817
|
minWidth: valueOrNull(computeStyle.minWidth),
|
|
773
818
|
maxWidth: valueOrNull(computeStyle.maxWidth),
|
|
@@ -834,19 +879,23 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
834
879
|
const limit = () => {
|
|
835
880
|
const { width, height } = this.sizingRect;
|
|
836
881
|
let secondRun = false;
|
|
837
|
-
if (computed.minWidth && computed.minWidth > maxWidth) {
|
|
882
|
+
if (computed.minWidth && computed.minWidth > maxWidth) {
|
|
883
|
+
/* Adjust min-width to always fit */
|
|
838
884
|
this.setPropertyIf('min-width', `${maxWidth}px`);
|
|
839
885
|
secondRun = true;
|
|
840
886
|
}
|
|
841
|
-
if (width > viewAreaWidth) {
|
|
887
|
+
if (width > viewAreaWidth) {
|
|
888
|
+
/* Adjust max-width to always fit */
|
|
842
889
|
this.setPropertyIf('max-width', `${maxWidth}px`);
|
|
843
890
|
secondRun = true;
|
|
844
891
|
}
|
|
845
|
-
if (computed.minHeight && computed.minHeight > maxHeight) {
|
|
892
|
+
if (computed.minHeight && computed.minHeight > maxHeight) {
|
|
893
|
+
/* Adjust min-height to always fit */
|
|
846
894
|
this.setPropertyIf('min-height', `${maxHeight}px`);
|
|
847
895
|
secondRun = true;
|
|
848
896
|
}
|
|
849
|
-
if (height > viewAreaHeight) {
|
|
897
|
+
if (height > viewAreaHeight) {
|
|
898
|
+
/* Adjust max-height to always fit */
|
|
850
899
|
this.setPropertyIf('max-height', `${maxHeight}px`);
|
|
851
900
|
secondRun = true;
|
|
852
901
|
}
|
|
@@ -912,7 +961,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
912
961
|
});
|
|
913
962
|
};
|
|
914
963
|
const { height, width } = this.sizingRect; /* need this for IE, as width and height is 0 on first render */
|
|
915
|
-
if (this.refitString && this.refitString === getRefitString() ||
|
|
964
|
+
if ((this.refitString && this.refitString === getRefitString()) || !height || !width) {
|
|
916
965
|
return;
|
|
917
966
|
}
|
|
918
967
|
clb();
|
|
@@ -936,7 +985,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
936
985
|
*/
|
|
937
986
|
fitPositionTarget() {
|
|
938
987
|
this.resetSizingInfo();
|
|
939
|
-
if (this.fullScreen) {
|
|
988
|
+
if (this.fullScreen) {
|
|
989
|
+
/* no need to calculate anything else in full screen mode */
|
|
940
990
|
this.setPositionStyle({
|
|
941
991
|
top: 0,
|
|
942
992
|
left: 0,
|
|
@@ -958,10 +1008,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
958
1008
|
const { viewHeight, viewWidth } = this.viewAreaInfo;
|
|
959
1009
|
const { width, height } = this.sizingRect;
|
|
960
1010
|
const calculatedPositionList = [];
|
|
961
|
-
const isOutsideView = targetRect.bottom < 0
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1011
|
+
const isOutsideView = targetRect.bottom < 0 ||
|
|
1012
|
+
targetRect.top > viewHeight ||
|
|
1013
|
+
targetRect.right < 0 ||
|
|
1014
|
+
targetRect.left > viewWidth; /* position target is outside view */
|
|
965
1015
|
const canAlignPosition = (isVertical, align) => {
|
|
966
1016
|
if (isVertical) {
|
|
967
1017
|
let left;
|
|
@@ -1030,10 +1080,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1030
1080
|
}
|
|
1031
1081
|
const position = strategy[Position];
|
|
1032
1082
|
const align = strategy[Alignment];
|
|
1033
|
-
if ((isVertical && isBefore && position === 'bottom')
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1083
|
+
if ((isVertical && isBefore && position === 'bottom') ||
|
|
1084
|
+
(isVertical && !isBefore && position === 'top') ||
|
|
1085
|
+
(!isVertical && isBefore && position === 'right') ||
|
|
1086
|
+
(!isVertical && !isBefore && position === 'left')) {
|
|
1037
1087
|
return align;
|
|
1038
1088
|
}
|
|
1039
1089
|
}
|
|
@@ -1057,14 +1107,16 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1057
1107
|
position = 'left';
|
|
1058
1108
|
right = 0;
|
|
1059
1109
|
}
|
|
1060
|
-
if (top === undefined && bottom === undefined) {
|
|
1110
|
+
if (top === undefined && bottom === undefined) {
|
|
1111
|
+
/* position target is outside left or right */
|
|
1061
1112
|
// always attach to the middle of the screen
|
|
1062
1113
|
const align = findAlignMatch(false, targetRect.right <= 0);
|
|
1063
1114
|
const alignPosition = canAlignPosition(false, align);
|
|
1064
1115
|
top = alignPosition.top;
|
|
1065
1116
|
bottom = alignPosition.bottom;
|
|
1066
1117
|
}
|
|
1067
|
-
if (right === undefined && left === undefined) {
|
|
1118
|
+
if (right === undefined && left === undefined) {
|
|
1119
|
+
/* position target is outside top or bottom */
|
|
1068
1120
|
const align = findAlignMatch(true, targetRect.bottom <= 0);
|
|
1069
1121
|
const alignPosition = canAlignPosition(true, align);
|
|
1070
1122
|
left = alignPosition.left;
|
|
@@ -1114,10 +1166,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1114
1166
|
area = Math.min(viewHeight, height) * targetRect.left;
|
|
1115
1167
|
canPosition = right >= 0 && right + width <= viewWidth;
|
|
1116
1168
|
break;
|
|
1117
|
-
case 'center'
|
|
1169
|
+
case 'center' /* noOverlap is not valid for center. Center can be always positioned */:
|
|
1118
1170
|
top = targetRect.top + targetRect.height / 2 - height / 2 + positionVerticalOffset;
|
|
1119
1171
|
bottom = top + height > viewHeight ? 0 : undefined;
|
|
1120
|
-
top = top < 0 ? 0 :
|
|
1172
|
+
top = top < 0 ? 0 : bottom === undefined ? top : undefined;
|
|
1121
1173
|
canPosition = true; /* no overlap does not make sense here */
|
|
1122
1174
|
area = Infinity;
|
|
1123
1175
|
break;
|
|
@@ -1133,7 +1185,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1133
1185
|
top = alignPosition.top;
|
|
1134
1186
|
bottom = alignPosition.bottom;
|
|
1135
1187
|
}
|
|
1136
|
-
if (canAlign && canPosition) {
|
|
1188
|
+
if (canAlign && canPosition) {
|
|
1189
|
+
/* no need to continue */
|
|
1137
1190
|
this.calculated.position = position;
|
|
1138
1191
|
this.setPositionStyle({
|
|
1139
1192
|
top,
|
|
@@ -1198,21 +1251,25 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1198
1251
|
const { isVertical, top, position, left, right, bottom } = calculatedPositionList[0];
|
|
1199
1252
|
const getNewPosition = () => {
|
|
1200
1253
|
if (isVertical) {
|
|
1201
|
-
return position === 'bottom'
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1254
|
+
return position === 'bottom'
|
|
1255
|
+
? {
|
|
1256
|
+
bottom: 0 /* position bottom-up */,
|
|
1257
|
+
top: null
|
|
1258
|
+
}
|
|
1259
|
+
: {
|
|
1260
|
+
bottom: null,
|
|
1261
|
+
top: 0 /* position up-bottom */
|
|
1262
|
+
};
|
|
1208
1263
|
}
|
|
1209
|
-
return position === 'right'
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1264
|
+
return position === 'right'
|
|
1265
|
+
? {
|
|
1266
|
+
right: 0 /* position right-left */,
|
|
1267
|
+
left: null
|
|
1268
|
+
}
|
|
1269
|
+
: {
|
|
1270
|
+
right: null,
|
|
1271
|
+
left: 0 /* position left-right */
|
|
1272
|
+
};
|
|
1216
1273
|
};
|
|
1217
1274
|
this.calculated.position = position;
|
|
1218
1275
|
this.setPositionStyle(Object.assign({
|
|
@@ -1273,10 +1330,12 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1273
1330
|
this.fitNonThrottled();
|
|
1274
1331
|
if (this.opened && this.firstResizeDone === false) {
|
|
1275
1332
|
this.firstResizeDone = true;
|
|
1276
|
-
if (this._fullyOpened === OpenedState.CLOSED) {
|
|
1333
|
+
if (this._fullyOpened === OpenedState.CLOSED) {
|
|
1334
|
+
/* cannot set to opening if the overlay has not been fully closed */
|
|
1277
1335
|
this._fullyOpened = OpenedState.OPENING;
|
|
1278
1336
|
}
|
|
1279
|
-
if (this.transitionStyle) {
|
|
1337
|
+
if (this.transitionStyle) {
|
|
1338
|
+
/* this must come last when all register actions are completed */
|
|
1280
1339
|
this.onOpenedChangedAnimation();
|
|
1281
1340
|
}
|
|
1282
1341
|
else {
|
|
@@ -1387,7 +1446,7 @@ __decorate([
|
|
|
1387
1446
|
if (!oldVal || newVal.length !== oldVal.length) {
|
|
1388
1447
|
return true;
|
|
1389
1448
|
}
|
|
1390
|
-
return newVal.some(el => !oldVal.includes(el));
|
|
1449
|
+
return newVal.some((el) => !oldVal.includes(el));
|
|
1391
1450
|
}
|
|
1392
1451
|
})
|
|
1393
1452
|
], Overlay.prototype, "interactiveElements", void 0);
|
|
@@ -1405,10 +1464,7 @@ __decorate([
|
|
|
1405
1464
|
},
|
|
1406
1465
|
converter: {
|
|
1407
1466
|
fromAttribute: (value) => {
|
|
1408
|
-
return value.toLocaleLowerCase()
|
|
1409
|
-
.replace(/ /g, '')
|
|
1410
|
-
.replace(/\|/g, ',')
|
|
1411
|
-
.split(',');
|
|
1467
|
+
return value.toLocaleLowerCase().replace(/ /g, '').replace(/\|/g, ',').split(',');
|
|
1412
1468
|
}
|
|
1413
1469
|
}
|
|
1414
1470
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type Position =
|
|
1
|
+
type Position = 'top' | 'right' | 'bottom' | 'left' | 'center' | 'top-start' | 'top-middle' | 'top-end' | 'right-start' | 'right-middle' | 'right-end' | 'bottom-start' | 'bottom-middle' | 'bottom-end' | 'left-start' | 'left-middle' | 'left-end' | 'center-middle';
|
|
2
2
|
type PositionTarget = HTMLElement | 'top' | 'right' | 'bottom' | 'left' | 'center' | 'top right' | 'right top' | 'top center' | 'center top' | 'top left' | 'left top' | 'bottom right' | 'right bottom' | 'bottom center' | 'center bottom' | 'bottom left' | 'left bottom' | 'center left' | 'left center' | 'center right' | 'right center' | 'center center';
|
|
3
3
|
type TransitionStyle = 'slide' | 'fade' | 'zoom' | 'slide-down' | 'slide-up' | 'slide-right' | 'slide-left' | 'slide-right-down' | 'slide-right-up' | 'slide-left-down' | 'slide-left-up';
|
|
4
4
|
type Calculated = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getOverlayLayers } from './zindex-manager.js';
|
|
2
1
|
import '../elements/overlay-backdrop.js';
|
|
2
|
+
import { getOverlayLayers } from './zindex-manager.js';
|
|
3
3
|
/**
|
|
4
4
|
* Backdrop manager adds a backdrop to the body
|
|
5
5
|
* @returns {void}
|
|
@@ -61,7 +61,7 @@ export class BackdropManager {
|
|
|
61
61
|
* @returns {void}
|
|
62
62
|
*/
|
|
63
63
|
clear() {
|
|
64
|
-
this.registry.forEach(overlay => this.deregister(overlay));
|
|
64
|
+
this.registry.forEach((overlay) => this.deregister(overlay));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
const backdropManager = new BackdropManager();
|
|
@@ -39,7 +39,7 @@ export class CloseManager {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
get overlays() {
|
|
42
|
-
return getOverlays().filter(overlay => this.registry.has(overlay));
|
|
42
|
+
return getOverlays().filter((overlay) => this.registry.has(overlay));
|
|
43
43
|
}
|
|
44
44
|
getTopOverlay() {
|
|
45
45
|
const overlay = this.overlays[0];
|
|
@@ -67,6 +67,7 @@ export class CloseManager {
|
|
|
67
67
|
closeCallback();
|
|
68
68
|
}
|
|
69
69
|
register(overlay, closeCallback) {
|
|
70
|
+
/* we must pass closeCallback as it is a private function for overlay */
|
|
70
71
|
if (!this.registry.size) {
|
|
71
72
|
const eventOptions = {
|
|
72
73
|
capture: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FocusableHelper, isBasicElement } from '@refinitiv-ui/core';
|
|
1
2
|
import { AnimationTaskRunner } from '@refinitiv-ui/utils/async.js';
|
|
2
3
|
import { getOverlays } from './zindex-manager.js';
|
|
3
|
-
import { isBasicElement, FocusableHelper } from '@refinitiv-ui/core';
|
|
4
4
|
/**
|
|
5
5
|
* Focus manager ensures that the correct
|
|
6
6
|
* element receives the focus
|
|
@@ -42,12 +42,12 @@ export class FocusManager {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
get overlays() {
|
|
45
|
-
return getOverlays().filter(overlay => this.registry.has(overlay));
|
|
45
|
+
return getOverlays().filter((overlay) => this.registry.has(overlay));
|
|
46
46
|
}
|
|
47
47
|
get focusBoundaryElements() {
|
|
48
48
|
return getOverlays()
|
|
49
|
-
.map(overlay => overlay.focusBoundary)
|
|
50
|
-
.filter(focusBoundary => focusBoundary !== null);
|
|
49
|
+
.map((overlay) => overlay.focusBoundary)
|
|
50
|
+
.filter((focusBoundary) => focusBoundary !== null);
|
|
51
51
|
}
|
|
52
52
|
getTabbableElements(overlay) {
|
|
53
53
|
return overlay.focusBoundary ? FocusableHelper.getTabbableNodes(overlay.focusBoundary) : [];
|
|
@@ -59,17 +59,19 @@ export class FocusManager {
|
|
|
59
59
|
for (let i = 0; i < sorted.length; i += 1) {
|
|
60
60
|
const overlay = sorted[i];
|
|
61
61
|
const tabbable = this.getTabbableElements(overlay);
|
|
62
|
-
tabbable.forEach(node => tabbableMap.set(node, overlay));
|
|
62
|
+
tabbable.forEach((node) => tabbableMap.set(node, overlay));
|
|
63
63
|
if (reverse) {
|
|
64
64
|
nodes.push(...tabbable);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
nodes.splice(0, 0, ...tabbable);
|
|
68
68
|
}
|
|
69
|
-
if (overlay.withBackdrop) {
|
|
69
|
+
if (overlay.withBackdrop) {
|
|
70
|
+
/* if the overlay has backdrop all other overlays with smaller z-index are outside tab scope */
|
|
70
71
|
break;
|
|
71
72
|
}
|
|
72
|
-
if (document.activeElement === overlay && nodes.length) {
|
|
73
|
+
if (document.activeElement === overlay && nodes.length) {
|
|
74
|
+
/* if overlay itself is in focus, try to always focus withing the focused overlay */
|
|
73
75
|
break;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -86,7 +88,8 @@ export class FocusManager {
|
|
|
86
88
|
if (nodes.length === 0) {
|
|
87
89
|
return;
|
|
88
90
|
}
|
|
89
|
-
if (nodes.length === 1) {
|
|
91
|
+
if (nodes.length === 1) {
|
|
92
|
+
/* no other focusable nodes */
|
|
90
93
|
event.preventDefault();
|
|
91
94
|
nodes[0].focus();
|
|
92
95
|
return;
|
|
@@ -110,7 +113,9 @@ export class FocusManager {
|
|
|
110
113
|
if (isBasicElement(activeElement) && activeElement.delegatesFocus) {
|
|
111
114
|
activeElement = activeElement.tabbableElements[0] || activeElement;
|
|
112
115
|
}
|
|
113
|
-
if (!activeElement ||
|
|
116
|
+
if (!activeElement ||
|
|
117
|
+
activeElement === nodes[nodes.length - 1] ||
|
|
118
|
+
!this.isFocusBoundaryDescendant(activeElement)) {
|
|
114
119
|
return nodes[0];
|
|
115
120
|
}
|
|
116
121
|
return null;
|
|
@@ -128,17 +133,22 @@ export class FocusManager {
|
|
|
128
133
|
const focusBoundaryElements = this.focusBoundaryElements;
|
|
129
134
|
let node = element.assignedSlot || element.parentNode;
|
|
130
135
|
while (node) {
|
|
131
|
-
if ((node instanceof HTMLElement || node instanceof ShadowRoot) &&
|
|
136
|
+
if ((node instanceof HTMLElement || node instanceof ShadowRoot) &&
|
|
137
|
+
focusBoundaryElements.includes(node)) {
|
|
132
138
|
return true;
|
|
133
139
|
}
|
|
134
140
|
// parenNode is not defined if the node is inside document fragment. Use host instead
|
|
135
|
-
node =
|
|
141
|
+
node =
|
|
142
|
+
node.nodeType === Node.DOCUMENT_FRAGMENT_NODE
|
|
143
|
+
? node.host
|
|
144
|
+
: node.assignedSlot || node.parentNode;
|
|
136
145
|
}
|
|
137
146
|
return false;
|
|
138
147
|
}
|
|
139
148
|
register(overlay) {
|
|
140
149
|
if (!this.registry.size) {
|
|
141
|
-
this.restoreFocusElement =
|
|
150
|
+
this.restoreFocusElement =
|
|
151
|
+
this.getActiveElement(); /* store this only once, as overlay order may change */
|
|
142
152
|
document.addEventListener('keydown', this.onDocumentKeyDown, { capture: true });
|
|
143
153
|
}
|
|
144
154
|
if (!this.registry.has(overlay)) {
|
|
@@ -198,7 +208,7 @@ export class FocusManager {
|
|
|
198
208
|
* @returns {void}
|
|
199
209
|
*/
|
|
200
210
|
clear() {
|
|
201
|
-
this.registry.forEach(overlay => this.deregister(overlay));
|
|
211
|
+
this.registry.forEach((overlay) => this.deregister(overlay));
|
|
202
212
|
}
|
|
203
213
|
}
|
|
204
214
|
const focusManager = new FocusManager();
|
|
@@ -131,8 +131,8 @@ export declare class ScrollLockManager {
|
|
|
131
131
|
private shouldCancelScroll;
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
|
-
* Lock the screen and make top most overlay
|
|
135
|
-
* and its position target interactive
|
|
136
|
-
* @returns {void}
|
|
137
|
-
*/
|
|
134
|
+
* Lock the screen and make top most overlay
|
|
135
|
+
* and its position target interactive
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
138
|
export declare const applyLock: () => void;
|