@refinitiv-ui/elements 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -449
- package/LICENSE +2 -2
- package/README.md +12 -10
- package/cli.mjs +5 -3
- 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 +80 -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 +156 -123
- package/lib/calendar/utils.js +1 -1
- 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/elements/chart.d.ts +4 -4
- package/lib/chart/elements/chart.js +39 -33
- package/lib/chart/plugins/doughnut-center-label.d.ts +3 -3
- package/lib/chart/plugins/doughnut-center-label.js +13 -9
- 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 +27 -18
- 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.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 +150 -131
- 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 +5 -5
- package/lib/dialog/index.js +51 -47
- 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 +8 -10
- package/lib/interactive-chart/helpers/types.d.ts +3 -3
- package/lib/interactive-chart/index.d.ts +29 -29
- package/lib/interactive-chart/index.js +69 -55
- 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 +10 -7
- 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 +14 -13
- package/lib/notification/helpers/status.js +1 -1
- package/lib/notification/themes/halo/dark/index.js +1 -1
- package/lib/notification/themes/halo/light/index.js +1 -1
- package/lib/notification/themes/solar/charcoal/index.js +1 -1
- package/lib/notification/themes/solar/pearl/index.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 +152 -96
- 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 +14 -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 +3 -3
- 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 +68 -81
- 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 +34 -31
- package/lib/time-picker/index.d.ts +6 -6
- package/lib/time-picker/index.js +103 -89
- package/lib/toggle/index.d.ts +1 -1
- package/lib/toggle/index.js +4 -3
- package/lib/toggle/themes/halo/dark/index.js +1 -1
- package/lib/toggle/themes/halo/light/index.js +1 -1
- package/lib/toggle/themes/solar/charcoal/index.js +1 -1
- package/lib/toggle/themes/solar/pearl/index.js +1 -1
- 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 +2 -2
- 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 +17 -17
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
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';
|
|
6
7
|
import { VERSION } from '../../version.js';
|
|
7
|
-
import {
|
|
8
|
+
import { valueOrNull, valueOrZero } from '../helpers/functions.js';
|
|
8
9
|
import { DEFAULT_ALIGN, DEFAULT_TARGET_STRATEGY } from '../helpers/types.js';
|
|
9
|
-
import {
|
|
10
|
+
import { deregister as backdropDeregister, register as backdropRegister } from '../managers/backdrop-manager.js';
|
|
11
|
+
import { deregister as closeDeregister, register as closeRegister } from '../managers/close-manager.js';
|
|
12
|
+
import { deregister as focusableDeregister, register as focusableRegister } from '../managers/focus-manager.js';
|
|
10
13
|
import { applyLock } from '../managers/interaction-lock-manager.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { register as backdropRegister, deregister as backdropDeregister } from '../managers/backdrop-manager.js';
|
|
14
|
-
import { register as closeRegister, deregister as closeDeregister } from '../managers/close-manager.js';
|
|
15
|
-
import { register as focusableRegister, deregister as focusableDeregister } from '../managers/focus-manager.js';
|
|
14
|
+
import { getViewAreaInfo, deregister as viewportDeregister, register as viewportRegister } from '../managers/viewport-manager.js';
|
|
15
|
+
import { toFront, deregister as zIndexDeregister, register as zIndexRegister } from '../managers/zindex-manager.js';
|
|
16
16
|
/**
|
|
17
17
|
* Possible states of the overlay
|
|
18
18
|
*/
|
|
19
19
|
var OpenedState;
|
|
20
20
|
(function (OpenedState) {
|
|
21
|
-
OpenedState[OpenedState["CLOSED"] = 0] = "CLOSED";
|
|
22
|
-
OpenedState[OpenedState["OPENING"] = 1] = "OPENING";
|
|
23
|
-
OpenedState[OpenedState["OPENED"] = 2] = "OPENED";
|
|
21
|
+
OpenedState[OpenedState["CLOSED"] = 0] = "CLOSED"; /* overlay is not visible on the screen */
|
|
22
|
+
OpenedState[OpenedState["OPENING"] = 1] = "OPENING"; /* overlay is visible on the screen, but opening animation is still running */
|
|
23
|
+
OpenedState[OpenedState["OPENED"] = 2] = "OPENED"; /* overlay is visible on the screen */
|
|
24
24
|
OpenedState[OpenedState["CLOSING"] = 3] = "CLOSING"; /* overlay is visible on the screen, but closing animation is still running */
|
|
25
25
|
})(OpenedState || (OpenedState = {}));
|
|
26
26
|
/**
|
|
@@ -55,11 +55,28 @@ const hasNumberChanged = (newVal, oldVal) => oldVal === undefined ? false : newV
|
|
|
55
55
|
/**
|
|
56
56
|
* When these properties change render is called
|
|
57
57
|
*/
|
|
58
|
-
const shouldUpdateProperties = [
|
|
58
|
+
const shouldUpdateProperties = [
|
|
59
|
+
'withShadow',
|
|
60
|
+
'transparent',
|
|
61
|
+
'spacing',
|
|
62
|
+
'transitionStyle',
|
|
63
|
+
'fullScreen',
|
|
64
|
+
'zIndex'
|
|
65
|
+
];
|
|
59
66
|
/**
|
|
60
67
|
* When these properties change refit is called
|
|
61
68
|
*/
|
|
62
|
-
const shouldRefitProperties = [
|
|
69
|
+
const shouldRefitProperties = [
|
|
70
|
+
'position',
|
|
71
|
+
'x',
|
|
72
|
+
'y',
|
|
73
|
+
'positionTarget',
|
|
74
|
+
'horizontalOffset',
|
|
75
|
+
'verticalOffset',
|
|
76
|
+
'offset',
|
|
77
|
+
'fullScreen',
|
|
78
|
+
'noOverlap'
|
|
79
|
+
];
|
|
63
80
|
/**
|
|
64
81
|
* Element to help building modals, dialogs and other overlay content
|
|
65
82
|
* @fires closed - Fired when overlay becomes invisible and close animation finished
|
|
@@ -204,7 +221,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
204
221
|
}
|
|
205
222
|
|
|
206
223
|
:host(:not([animation-ready])) {
|
|
207
|
-
animation: none
|
|
224
|
+
animation: none !important;
|
|
208
225
|
transition: none !important;
|
|
209
226
|
transform: none !important;
|
|
210
227
|
top: 0;
|
|
@@ -221,82 +238,104 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
221
238
|
}
|
|
222
239
|
|
|
223
240
|
@keyframes popup-scale {
|
|
224
|
-
from {
|
|
225
|
-
|
|
241
|
+
from {
|
|
242
|
+
transform: scale(0, 0);
|
|
243
|
+
}
|
|
244
|
+
to {
|
|
245
|
+
transform: scale(1, 1);
|
|
246
|
+
}
|
|
226
247
|
}
|
|
227
248
|
|
|
228
249
|
@keyframes popup-scale-vertical {
|
|
229
|
-
from {
|
|
230
|
-
|
|
250
|
+
from {
|
|
251
|
+
transform: scaleY(0);
|
|
252
|
+
}
|
|
253
|
+
to {
|
|
254
|
+
transform: scaleY(1);
|
|
255
|
+
}
|
|
231
256
|
}
|
|
232
257
|
|
|
233
258
|
@keyframes popup-scale-horizontal {
|
|
234
|
-
from {
|
|
235
|
-
|
|
259
|
+
from {
|
|
260
|
+
transform: scaleX(0);
|
|
261
|
+
}
|
|
262
|
+
to {
|
|
263
|
+
transform: scaleX(1);
|
|
264
|
+
}
|
|
236
265
|
}
|
|
237
266
|
|
|
238
267
|
@keyframes popup-scale-fade {
|
|
239
|
-
from {
|
|
240
|
-
|
|
241
|
-
|
|
268
|
+
from {
|
|
269
|
+
opacity: 0;
|
|
270
|
+
}
|
|
271
|
+
58% {
|
|
272
|
+
opacity: 0.3;
|
|
273
|
+
}
|
|
274
|
+
to {
|
|
275
|
+
opacity: 1;
|
|
276
|
+
}
|
|
242
277
|
}
|
|
243
278
|
|
|
244
279
|
@keyframes popup-fade {
|
|
245
|
-
from {
|
|
246
|
-
|
|
280
|
+
from {
|
|
281
|
+
opacity: 0;
|
|
282
|
+
}
|
|
283
|
+
to {
|
|
284
|
+
opacity: 1;
|
|
285
|
+
}
|
|
247
286
|
}
|
|
248
287
|
|
|
249
288
|
/* set origins */
|
|
250
|
-
:host([transition-style=
|
|
251
|
-
:host([transition-style=
|
|
289
|
+
:host([transition-style='slide-down']),
|
|
290
|
+
:host([transition-style='slide'][animation-position='bottom']) {
|
|
252
291
|
transform-origin: center top;
|
|
253
292
|
}
|
|
254
|
-
:host([transition-style=
|
|
255
|
-
:host([transition-style=
|
|
293
|
+
:host([transition-style='slide-up']),
|
|
294
|
+
:host([transition-style='slide'][animation-position='top']) {
|
|
256
295
|
transform-origin: center bottom;
|
|
257
296
|
}
|
|
258
|
-
:host([transition-style=
|
|
259
|
-
:host([transition-style=
|
|
297
|
+
:host([transition-style='slide-left']),
|
|
298
|
+
:host([transition-style='slide'][animation-position='left']) {
|
|
260
299
|
transform-origin: right center;
|
|
261
300
|
}
|
|
262
|
-
:host([transition-style=
|
|
263
|
-
:host([transition-style=
|
|
301
|
+
:host([transition-style='slide-right']),
|
|
302
|
+
:host([transition-style='slide'][animation-position='right']) {
|
|
264
303
|
transform-origin: left center;
|
|
265
304
|
}
|
|
266
|
-
:host([transition-style=
|
|
305
|
+
:host([transition-style='slide-right-down']) {
|
|
267
306
|
transform-origin: left top;
|
|
268
307
|
}
|
|
269
|
-
:host([transition-style=
|
|
308
|
+
:host([transition-style='slide-right-up']) {
|
|
270
309
|
transform-origin: left bottom;
|
|
271
310
|
}
|
|
272
|
-
:host([transition-style=
|
|
311
|
+
:host([transition-style='slide-left-down']) {
|
|
273
312
|
transform-origin: right top;
|
|
274
313
|
}
|
|
275
|
-
:host([transition-style=
|
|
314
|
+
:host([transition-style='slide-left-up']) {
|
|
276
315
|
transform-origin: right bottom;
|
|
277
316
|
}
|
|
278
317
|
|
|
279
318
|
/* set animation names */
|
|
280
|
-
:host([transition-style=
|
|
281
|
-
:host([transition-style=
|
|
282
|
-
:host([transition-style=
|
|
283
|
-
:host([transition-style=
|
|
284
|
-
:host([transition-style=
|
|
319
|
+
:host([transition-style='slide-right-down']),
|
|
320
|
+
:host([transition-style='slide-right-up']),
|
|
321
|
+
:host([transition-style='slide-left-down']),
|
|
322
|
+
:host([transition-style='slide-left-up']),
|
|
323
|
+
:host([transition-style='zoom']) {
|
|
285
324
|
animation-name: popup-scale, popup-scale-fade;
|
|
286
325
|
}
|
|
287
|
-
:host([transition-style=
|
|
326
|
+
:host([transition-style='fade']) {
|
|
288
327
|
animation-name: popup-fade;
|
|
289
328
|
}
|
|
290
|
-
:host([transition-style=
|
|
291
|
-
:host([transition-style=
|
|
292
|
-
:host([transition-style=
|
|
293
|
-
:host([transition-style=
|
|
329
|
+
:host([transition-style='slide-down']),
|
|
330
|
+
:host([transition-style='slide'][animation-position='bottom']),
|
|
331
|
+
:host([transition-style='slide-up']),
|
|
332
|
+
:host([transition-style='slide'][animation-position='top']) {
|
|
294
333
|
animation-name: popup-scale-vertical, popup-scale-fade;
|
|
295
334
|
}
|
|
296
|
-
:host([transition-style=
|
|
297
|
-
:host([transition-style=
|
|
298
|
-
:host([transition-style=
|
|
299
|
-
:host([transition-style=
|
|
335
|
+
:host([transition-style='slide-left']),
|
|
336
|
+
:host([transition-style='slide'][animation-position='left']),
|
|
337
|
+
:host([transition-style='slide-right']),
|
|
338
|
+
:host([transition-style='slide'][animation-position='right']) {
|
|
300
339
|
animation-name: popup-scale-horizontal, popup-scale-fade;
|
|
301
340
|
}
|
|
302
341
|
|
|
@@ -343,7 +382,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
343
382
|
return undefined;
|
|
344
383
|
}
|
|
345
384
|
const positionList = [...this.position];
|
|
346
|
-
const positionStrategy = this._positionStrategy = [];
|
|
385
|
+
const positionStrategy = (this._positionStrategy = []);
|
|
347
386
|
while (positionList.length) {
|
|
348
387
|
const position = positionList.shift();
|
|
349
388
|
if (!position) {
|
|
@@ -369,7 +408,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
369
408
|
const { viewHeight, viewWidth, viewOffsetTop, viewOffsetLeft } = this.viewAreaInfo;
|
|
370
409
|
let left;
|
|
371
410
|
let top;
|
|
372
|
-
if (this.fullScreen) {
|
|
411
|
+
if (this.fullScreen) {
|
|
412
|
+
/* keep it for caching only to not break other algorithms */
|
|
373
413
|
return {
|
|
374
414
|
rect: {
|
|
375
415
|
top: 0,
|
|
@@ -534,7 +574,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
534
574
|
let shouldUpdate = opening || closing || !this.hasUpdated || changedProperties.size === 0;
|
|
535
575
|
// Element may need to be updated if other attributes has been changed while the overlay is opened
|
|
536
576
|
if (!shouldUpdate && isOpened) {
|
|
537
|
-
if (shouldUpdateProperties.find(property => changedProperties.has(property))) {
|
|
577
|
+
if (shouldUpdateProperties.find((property) => changedProperties.has(property))) {
|
|
538
578
|
shouldUpdate = true;
|
|
539
579
|
}
|
|
540
580
|
}
|
|
@@ -546,7 +586,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
546
586
|
}
|
|
547
587
|
else if (this.opened) {
|
|
548
588
|
// Explicitly call hard refit
|
|
549
|
-
if (shouldRefitProperties.find(property => changedProperties.has(property))) {
|
|
589
|
+
if (shouldRefitProperties.find((property) => changedProperties.has(property))) {
|
|
550
590
|
this.refit();
|
|
551
591
|
}
|
|
552
592
|
}
|
|
@@ -559,7 +599,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
559
599
|
*/
|
|
560
600
|
openedChange() {
|
|
561
601
|
if (!this.opened) {
|
|
562
|
-
if (this._fullyOpened === OpenedState.OPENED) {
|
|
602
|
+
if (this._fullyOpened === OpenedState.OPENED) {
|
|
603
|
+
/* cannot set to closing if the overlay has not been fully opened */
|
|
563
604
|
this._fullyOpened = OpenedState.CLOSING;
|
|
564
605
|
}
|
|
565
606
|
this.removeMainRegisters();
|
|
@@ -600,7 +641,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
600
641
|
else if (disablingFocusManagement) {
|
|
601
642
|
focusableDeregister(this);
|
|
602
643
|
}
|
|
603
|
-
if (opening ||
|
|
644
|
+
if (opening ||
|
|
645
|
+
changedProperties.has('noInteractionLock') ||
|
|
646
|
+
changedProperties.has('lockPositionTarget') ||
|
|
647
|
+
changedProperties.has('interactiveElements')) {
|
|
604
648
|
applyLock();
|
|
605
649
|
}
|
|
606
650
|
const enablingBackdrop = (opening && this.withBackdrop) || (opened && changedProperties.get('withBackdrop') === false);
|
|
@@ -735,6 +779,7 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
735
779
|
const style = this.style;
|
|
736
780
|
// get minWidth and maxWidth
|
|
737
781
|
this._sizingInfo = {
|
|
782
|
+
/* cache any sizing info defined in styles, as we may operate on these values */
|
|
738
783
|
computed: {
|
|
739
784
|
minWidth: valueOrNull(computeStyle.minWidth),
|
|
740
785
|
maxWidth: valueOrNull(computeStyle.maxWidth),
|
|
@@ -801,19 +846,23 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
801
846
|
const limit = () => {
|
|
802
847
|
const { width, height } = this.sizingRect;
|
|
803
848
|
let secondRun = false;
|
|
804
|
-
if (computed.minWidth && computed.minWidth > maxWidth) {
|
|
849
|
+
if (computed.minWidth && computed.minWidth > maxWidth) {
|
|
850
|
+
/* Adjust min-width to always fit */
|
|
805
851
|
this.setPropertyIf('min-width', `${maxWidth}px`);
|
|
806
852
|
secondRun = true;
|
|
807
853
|
}
|
|
808
|
-
if (width > viewAreaWidth) {
|
|
854
|
+
if (width > viewAreaWidth) {
|
|
855
|
+
/* Adjust max-width to always fit */
|
|
809
856
|
this.setPropertyIf('max-width', `${maxWidth}px`);
|
|
810
857
|
secondRun = true;
|
|
811
858
|
}
|
|
812
|
-
if (computed.minHeight && computed.minHeight > maxHeight) {
|
|
859
|
+
if (computed.minHeight && computed.minHeight > maxHeight) {
|
|
860
|
+
/* Adjust min-height to always fit */
|
|
813
861
|
this.setPropertyIf('min-height', `${maxHeight}px`);
|
|
814
862
|
secondRun = true;
|
|
815
863
|
}
|
|
816
|
-
if (height > viewAreaHeight) {
|
|
864
|
+
if (height > viewAreaHeight) {
|
|
865
|
+
/* Adjust max-height to always fit */
|
|
817
866
|
this.setPropertyIf('max-height', `${maxHeight}px`);
|
|
818
867
|
secondRun = true;
|
|
819
868
|
}
|
|
@@ -902,7 +951,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
902
951
|
*/
|
|
903
952
|
fitPositionTarget() {
|
|
904
953
|
this.resetSizingInfo();
|
|
905
|
-
if (this.fullScreen) {
|
|
954
|
+
if (this.fullScreen) {
|
|
955
|
+
/* no need to calculate anything else in full screen mode */
|
|
906
956
|
this.setPositionStyle({
|
|
907
957
|
top: 0,
|
|
908
958
|
left: 0,
|
|
@@ -924,10 +974,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
924
974
|
const { viewHeight, viewWidth } = this.viewAreaInfo;
|
|
925
975
|
const { width, height } = this.sizingRect;
|
|
926
976
|
const calculatedPositionList = [];
|
|
927
|
-
const isOutsideView = targetRect.bottom < 0
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
977
|
+
const isOutsideView = targetRect.bottom < 0 ||
|
|
978
|
+
targetRect.top > viewHeight ||
|
|
979
|
+
targetRect.right < 0 ||
|
|
980
|
+
targetRect.left > viewWidth; /* position target is outside view */
|
|
931
981
|
const canAlignPosition = (isVertical, align) => {
|
|
932
982
|
if (isVertical) {
|
|
933
983
|
let left;
|
|
@@ -996,10 +1046,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
996
1046
|
}
|
|
997
1047
|
const position = strategy[Position];
|
|
998
1048
|
const align = strategy[Alignment];
|
|
999
|
-
if ((isVertical && isBefore && position === 'bottom')
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1049
|
+
if ((isVertical && isBefore && position === 'bottom') ||
|
|
1050
|
+
(isVertical && !isBefore && position === 'top') ||
|
|
1051
|
+
(!isVertical && isBefore && position === 'right') ||
|
|
1052
|
+
(!isVertical && !isBefore && position === 'left')) {
|
|
1003
1053
|
return align;
|
|
1004
1054
|
}
|
|
1005
1055
|
}
|
|
@@ -1023,14 +1073,16 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1023
1073
|
position = 'left';
|
|
1024
1074
|
right = 0;
|
|
1025
1075
|
}
|
|
1026
|
-
if (top === undefined && bottom === undefined) {
|
|
1076
|
+
if (top === undefined && bottom === undefined) {
|
|
1077
|
+
/* position target is outside left or right */
|
|
1027
1078
|
// always attach to the middle of the screen
|
|
1028
1079
|
const align = findAlignMatch(false, targetRect.right <= 0);
|
|
1029
1080
|
const alignPosition = canAlignPosition(false, align);
|
|
1030
1081
|
top = alignPosition.top;
|
|
1031
1082
|
bottom = alignPosition.bottom;
|
|
1032
1083
|
}
|
|
1033
|
-
if (right === undefined && left === undefined) {
|
|
1084
|
+
if (right === undefined && left === undefined) {
|
|
1085
|
+
/* position target is outside top or bottom */
|
|
1034
1086
|
const align = findAlignMatch(true, targetRect.bottom <= 0);
|
|
1035
1087
|
const alignPosition = canAlignPosition(true, align);
|
|
1036
1088
|
left = alignPosition.left;
|
|
@@ -1080,10 +1132,10 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1080
1132
|
area = Math.min(viewHeight, height) * targetRect.left;
|
|
1081
1133
|
canPosition = right >= 0 && right + width <= viewWidth;
|
|
1082
1134
|
break;
|
|
1083
|
-
case 'center'
|
|
1135
|
+
case 'center' /* noOverlap is not valid for center. Center can be always positioned */:
|
|
1084
1136
|
top = targetRect.top + targetRect.height / 2 - height / 2 + positionVerticalOffset;
|
|
1085
1137
|
bottom = top + height > viewHeight ? 0 : undefined;
|
|
1086
|
-
top = top < 0 ? 0 :
|
|
1138
|
+
top = top < 0 ? 0 : bottom === undefined ? top : undefined;
|
|
1087
1139
|
canPosition = true; /* no overlap does not make sense here */
|
|
1088
1140
|
area = Infinity;
|
|
1089
1141
|
break;
|
|
@@ -1099,7 +1151,8 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1099
1151
|
top = alignPosition.top;
|
|
1100
1152
|
bottom = alignPosition.bottom;
|
|
1101
1153
|
}
|
|
1102
|
-
if (canAlign && canPosition) {
|
|
1154
|
+
if (canAlign && canPosition) {
|
|
1155
|
+
/* no need to continue */
|
|
1103
1156
|
this.calculated.position = position;
|
|
1104
1157
|
this.setPositionStyle({
|
|
1105
1158
|
top,
|
|
@@ -1164,21 +1217,25 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1164
1217
|
const { isVertical, top, position, left, right, bottom } = calculatedPositionList[0];
|
|
1165
1218
|
const getNewPosition = () => {
|
|
1166
1219
|
if (isVertical) {
|
|
1167
|
-
return position === 'bottom'
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1220
|
+
return position === 'bottom'
|
|
1221
|
+
? {
|
|
1222
|
+
bottom: 0 /* position bottom-up */,
|
|
1223
|
+
top: null
|
|
1224
|
+
}
|
|
1225
|
+
: {
|
|
1226
|
+
bottom: null,
|
|
1227
|
+
top: 0 /* position up-bottom */
|
|
1228
|
+
};
|
|
1174
1229
|
}
|
|
1175
|
-
return position === 'right'
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1230
|
+
return position === 'right'
|
|
1231
|
+
? {
|
|
1232
|
+
right: 0 /* position right-left */,
|
|
1233
|
+
left: null
|
|
1234
|
+
}
|
|
1235
|
+
: {
|
|
1236
|
+
right: null,
|
|
1237
|
+
left: 0 /* position left-right */
|
|
1238
|
+
};
|
|
1182
1239
|
};
|
|
1183
1240
|
this.calculated.position = position;
|
|
1184
1241
|
this.setPositionStyle(Object.assign({
|
|
@@ -1238,10 +1295,12 @@ let Overlay = Overlay_1 = class Overlay extends ResponsiveElement {
|
|
|
1238
1295
|
this.setResizeSizingInfo();
|
|
1239
1296
|
this.fitNonThrottled();
|
|
1240
1297
|
if (this.opened) {
|
|
1241
|
-
if (this._fullyOpened === OpenedState.CLOSED) {
|
|
1298
|
+
if (this._fullyOpened === OpenedState.CLOSED) {
|
|
1299
|
+
/* cannot set to opening if the overlay has not been fully closed */
|
|
1242
1300
|
this._fullyOpened = OpenedState.OPENING;
|
|
1243
1301
|
}
|
|
1244
|
-
if (this.transitionStyle) {
|
|
1302
|
+
if (this.transitionStyle) {
|
|
1303
|
+
/* this must come last when all register actions are completed */
|
|
1245
1304
|
this.onOpenedChangedAnimation();
|
|
1246
1305
|
}
|
|
1247
1306
|
else {
|
|
@@ -1352,7 +1411,7 @@ __decorate([
|
|
|
1352
1411
|
if (!oldVal || newVal.length !== oldVal.length) {
|
|
1353
1412
|
return true;
|
|
1354
1413
|
}
|
|
1355
|
-
return newVal.some(el => !oldVal.includes(el));
|
|
1414
|
+
return newVal.some((el) => !oldVal.includes(el));
|
|
1356
1415
|
}
|
|
1357
1416
|
})
|
|
1358
1417
|
], Overlay.prototype, "interactiveElements", void 0);
|
|
@@ -1370,10 +1429,7 @@ __decorate([
|
|
|
1370
1429
|
},
|
|
1371
1430
|
converter: {
|
|
1372
1431
|
fromAttribute: (value) => {
|
|
1373
|
-
return value.toLocaleLowerCase()
|
|
1374
|
-
.replace(/ /g, '')
|
|
1375
|
-
.replace(/\|/g, ',')
|
|
1376
|
-
.split(',');
|
|
1432
|
+
return value.toLocaleLowerCase().replace(/ /g, '').replace(/\|/g, ',').split(',');
|
|
1377
1433
|
}
|
|
1378
1434
|
}
|
|
1379
1435
|
})
|
|
@@ -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];
|
|
@@ -69,6 +69,7 @@ export class CloseManager {
|
|
|
69
69
|
closeCallback();
|
|
70
70
|
}
|
|
71
71
|
register(overlay, closeCallback) {
|
|
72
|
+
/* we must pass closeCallback as it is a private function for overlay */
|
|
72
73
|
if (!this.registry.size) {
|
|
73
74
|
const eventOptions = {
|
|
74
75
|
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)) {
|
|
@@ -199,7 +209,7 @@ export class FocusManager {
|
|
|
199
209
|
* @returns {void}
|
|
200
210
|
*/
|
|
201
211
|
clear() {
|
|
202
|
-
this.registry.forEach(overlay => this.deregister(overlay));
|
|
212
|
+
this.registry.forEach((overlay) => this.deregister(overlay));
|
|
203
213
|
}
|
|
204
214
|
}
|
|
205
215
|
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;
|