@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,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/icon/themes/solar/charcoal';
|
|
2
2
|
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification-tray', styles: ':host{--max:1;--default-timeout:5000;display:flex;flex-flow:column nowrap;justify-content:flex-end}:host([attach]){position:fixed;z-index:100000}:host([attach=top]){top:0;left:0;right:0}:host([attach=right]){top:0;right:0;bottom:0}:host([attach=bottom]){left:0;right:0;bottom:0}:host([attach=left]){top:0;left:0;bottom:0}' }}));
|
|
3
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification', styles: ':host{touch-action:manipulation;perspective:2000px;position:relative;height:var(--bar-height,3em);overflow:hidden;display:flex;align-items:center;text-align:center;color:var(--color,#c2c2c2);animation:.4s forwards notification-open;--bar-height:30px;--background-color:#295e8c;color:#fff}:host [part=container]{height:var(--bar-height,3em);width:100%;position:relative;overflow:hidden;box-sizing:border-box;display:flex;align-items:center;justify-content:center
|
|
3
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification', styles: ':host{touch-action:manipulation;perspective:2000px;position:relative;height:var(--bar-height,3em);overflow:hidden;display:flex;align-items:center;text-align:center;color:var(--color,#c2c2c2);animation:.4s forwards notification-open;-webkit-user-select:none;-moz-user-select:none;user-select:none;--bar-height:30px;--background-color:#295e8c;color:#fff}:host [part=container]{height:var(--bar-height,3em);width:100%;position:relative;overflow:hidden;box-sizing:border-box;display:flex;align-items:center;justify-content:center;padding:6px 27px 6px 10px;background-color:var(--background-color,#19aaee);animation:.4s notification-container-open}:host [part=container]::before{content:\'\';display:block;position:absolute;top:0;right:0;bottom:0;width:3em;opacity:0;transition:opacity .2s;color:var(--background-color,#19aaee);background:currentColor;box-shadow:0 0 1em 1em currentColor}:host [part=content]{width:100%;text-align:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host [part=clear]{touch-action:manipulation;margin:auto;display:block;position:absolute;top:0;bottom:0;opacity:0;transition:opacity .2s;right:.5em;width:16px;height:16px;stroke-width:1.5px;opacity:1}:host(:hover) [part=clear],:host(:hover) [part=container]::before{opacity:1}:host([confirm]){--background-color:#2ec57e;--background-color:#237843}:host([warning]){--background-color:#FF9933;--background-color:#cc7f33}:host([error]){--background-color:#F5475B;--background-color:#a8313f}:host([collapsed]){animation-fill-mode:forwards;animation-name:notification-close}:host([collapsed]) [part=container]{animation-name:notification-container-close}:host([collapsed]) [part=clear],:host([collapsed]) [part=container]::before{opacity:0}@keyframes notification-open{from{height:0}to{height:var(--bar-height,3em)}}@keyframes notification-close{from{height:var(--bar-height,3em)}to{height:0}}@keyframes notification-container-open{0%{opacity:.1;transform:rotateX(-90deg)}100%,80%,90%{opacity:1;transform:rotateX(0)}}@keyframes notification-container-close{from{opacity:1;transform:rotateX(0)}to{transform:rotateX(90deg)}}:host [part=content] ::slotted(a){color:inherit!important;text-decoration:underline!important}:host [part=content] ::slotted(a:hover){cursor:pointer!important;text-decoration-color:inherit!important}' }}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/icon/themes/solar/pearl';
|
|
2
2
|
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification-tray', styles: ':host{--max:1;--default-timeout:5000;display:flex;flex-flow:column nowrap;justify-content:flex-end}:host([attach]){position:fixed;z-index:100000}:host([attach=top]){top:0;left:0;right:0}:host([attach=right]){top:0;right:0;bottom:0}:host([attach=bottom]){left:0;right:0;bottom:0}:host([attach=left]){top:0;left:0;bottom:0}' }}));
|
|
3
|
-
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification', styles: ':host{touch-action:manipulation;perspective:2000px;position:relative;height:var(--bar-height,3em);overflow:hidden;display:flex;align-items:center;text-align:center;color:var(--color,#505050);animation:.4s forwards notification-open;--bar-height:30px;--background-color:#295e8c;color:#fff}:host [part=container]{height:var(--bar-height,3em);width:100%;position:relative;overflow:hidden;box-sizing:border-box;display:flex;align-items:center;justify-content:center
|
|
3
|
+
dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-notification', styles: ':host{touch-action:manipulation;perspective:2000px;position:relative;height:var(--bar-height,3em);overflow:hidden;display:flex;align-items:center;text-align:center;color:var(--color,#505050);animation:.4s forwards notification-open;-webkit-user-select:none;-moz-user-select:none;user-select:none;--bar-height:30px;--background-color:#295e8c;color:#fff}:host [part=container]{height:var(--bar-height,3em);width:100%;position:relative;overflow:hidden;box-sizing:border-box;display:flex;align-items:center;justify-content:center;padding:6px 27px 6px 10px;background-color:var(--background-color,#19aaee);animation:.4s notification-container-open}:host [part=container]::before{content:\'\';display:block;position:absolute;top:0;right:0;bottom:0;width:3em;opacity:0;transition:opacity .2s;color:var(--background-color,#19aaee);background:currentColor;box-shadow:0 0 1em 1em currentColor}:host [part=content]{width:100%;text-align:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host [part=clear]{touch-action:manipulation;margin:auto;display:block;position:absolute;top:0;bottom:0;opacity:0;transition:opacity .2s;right:.5em;width:16px;height:16px;stroke-width:1.5px;opacity:1}:host(:hover) [part=clear],:host(:hover) [part=container]::before{opacity:1}:host([confirm]){--background-color:#2ec57e;--background-color:#237843}:host([warning]){--background-color:#FF9933;--background-color:#cc7f33}:host([error]){--background-color:#D94255;--background-color:#a8313f}:host([collapsed]){animation-fill-mode:forwards;animation-name:notification-close}:host([collapsed]) [part=container]{animation-name:notification-container-close}:host([collapsed]) [part=clear],:host([collapsed]) [part=container]::before{opacity:0}@keyframes notification-open{from{height:0}to{height:var(--bar-height,3em)}}@keyframes notification-close{from{height:var(--bar-height,3em)}to{height:0}}@keyframes notification-container-open{0%{opacity:.1;transform:rotateX(-90deg)}100%,80%,90%{opacity:1;transform:rotateX(0)}}@keyframes notification-container-close{from{opacity:1;transform:rotateX(0)}to{transform:rotateX(90deg)}}:host [part=content] ::slotted(a){color:inherit!important;text-decoration:underline!important}:host [part=content] ::slotted(a:hover){cursor:pointer!important;text-decoration-color:inherit!important}' }}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSXInterface } from '../jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSResultGroup, FormFieldElement, PropertyValues, TapEvent, TemplateResult } from '@refinitiv-ui/core';
|
|
3
3
|
import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
|
|
4
4
|
import '../icon/index.js';
|
|
5
5
|
type SelectionDirection = 'forward' | 'backward' | 'none';
|
|
@@ -67,10 +67,10 @@ export declare class NumberField extends FormFieldElement {
|
|
|
67
67
|
max: string | null;
|
|
68
68
|
private interimValueState;
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
* The value of the number entered into the input.
|
|
71
|
+
* @param value number-field value
|
|
72
|
+
* @default -
|
|
73
|
+
*/
|
|
74
74
|
set value(value: string);
|
|
75
75
|
get value(): string;
|
|
76
76
|
/**
|
|
@@ -313,7 +313,6 @@ export declare class NumberField extends FormFieldElement {
|
|
|
313
313
|
* type="text" - always `text`
|
|
314
314
|
* part="input" - always "input", used for styling
|
|
315
315
|
* inputmode="decimal" - show decimals keyboard by default
|
|
316
|
-
* pattern="'^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$'" - numbers only
|
|
317
316
|
* role="spinbutton" - number field is actually a spinner
|
|
318
317
|
* aria-valuenow - current value or 0
|
|
319
318
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { FocusedPropertyKey, FormFieldElement, css, html } from '@refinitiv-ui/core';
|
|
3
3
|
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
4
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
5
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
-
import { VERSION } from '../version.js';
|
|
7
6
|
import '../icon/index.js';
|
|
8
|
-
|
|
7
|
+
import { VERSION } from '../version.js';
|
|
9
8
|
const DEFAULT_STEP_BASE = 1;
|
|
10
9
|
const ANY_STEP = 'any';
|
|
11
10
|
var Direction;
|
|
@@ -81,41 +80,43 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
81
80
|
:host {
|
|
82
81
|
display: inline-block;
|
|
83
82
|
}
|
|
84
|
-
:host(:focus),
|
|
83
|
+
:host(:focus),
|
|
84
|
+
:host input:focus {
|
|
85
85
|
outline: none;
|
|
86
86
|
}
|
|
87
87
|
:host([transparent]) {
|
|
88
88
|
background: none !important;
|
|
89
89
|
border: none !important;
|
|
90
90
|
}
|
|
91
|
-
[part=input] {
|
|
91
|
+
[part='input'] {
|
|
92
92
|
font: inherit;
|
|
93
93
|
background: none;
|
|
94
94
|
color: currentColor;
|
|
95
95
|
border: none;
|
|
96
96
|
text-align: inherit;
|
|
97
97
|
}
|
|
98
|
-
[part=spinner]{
|
|
98
|
+
[part='spinner'] {
|
|
99
99
|
display: flex;
|
|
100
100
|
flex-direction: column;
|
|
101
101
|
}
|
|
102
|
-
[part=spinner-up],
|
|
102
|
+
[part='spinner-up'],
|
|
103
|
+
[part='spinner-down'] {
|
|
103
104
|
display: flex;
|
|
104
105
|
height: 50%;
|
|
105
106
|
cursor: pointer;
|
|
106
107
|
user-select: none;
|
|
107
108
|
}
|
|
108
|
-
[part^=spinner][disabled],
|
|
109
|
-
[part^=spinner][readonly] {
|
|
109
|
+
[part^='spinner'][disabled],
|
|
110
|
+
[part^='spinner'][readonly] {
|
|
110
111
|
cursor: default;
|
|
111
112
|
}
|
|
112
113
|
`;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
* The value of the number entered into the input.
|
|
117
|
+
* @param value number-field value
|
|
118
|
+
* @default -
|
|
119
|
+
*/
|
|
119
120
|
set value(value) {
|
|
120
121
|
this.interimValueState = true;
|
|
121
122
|
super.value = value;
|
|
@@ -194,7 +195,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
194
195
|
if (Math.floor(value) === value || isNaN(value) || !isFinite(value)) {
|
|
195
196
|
return 0;
|
|
196
197
|
}
|
|
197
|
-
return new Intl.NumberFormat('en', { minimumSignificantDigits: 1 }).format(value).split('.')[1].length || 0;
|
|
198
|
+
return (new Intl.NumberFormat('en', { minimumSignificantDigits: 1 }).format(value).split('.')[1].length || 0);
|
|
198
199
|
}
|
|
199
200
|
/**
|
|
200
201
|
* Get number of decimals based on step base and allowed value step
|
|
@@ -304,7 +305,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
304
305
|
const selectionEnd = inputEl.selectionEnd || 0;
|
|
305
306
|
const newInput = `${oldInput.substring(0, selectionStart)}${data}${oldInput.substring(selectionEnd)}`;
|
|
306
307
|
const validatedInput = this.stripeInvalidCharacters(newInput, oldInput, data);
|
|
307
|
-
const insertionData = validatedInput
|
|
308
|
+
const insertionData = validatedInput
|
|
309
|
+
.slice(0, validatedInput.length - (oldInput.length - selectionEnd))
|
|
310
|
+
.substring(selectionStart);
|
|
308
311
|
// Invalid characters or sequence of characters
|
|
309
312
|
if (!insertionData.length) {
|
|
310
313
|
event.preventDefault();
|
|
@@ -378,18 +381,18 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
378
381
|
if (dotIndex !== -1) {
|
|
379
382
|
input = `${input.substring(0, dotIndex + 1)}${input.substring(dotIndex + 1).replace(/\./g, '')}`;
|
|
380
383
|
if (!valueHasE) {
|
|
381
|
-
input = `${input.substring(0, dotIndex).replace(/e/
|
|
384
|
+
input = `${input.substring(0, dotIndex).replace(/e/gi, '')}${input.substring(dotIndex)}`;
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
387
|
// stripe all dots after e and multiple e occurrences
|
|
385
388
|
if (eIndex !== -1) {
|
|
386
|
-
input = `${input.substring(0, eIndex + 1)}${input.substring(eIndex + 1).replace(/e/
|
|
389
|
+
input = `${input.substring(0, eIndex + 1)}${input.substring(eIndex + 1).replace(/e/gi, '')}`;
|
|
387
390
|
if (!valueHasDot) {
|
|
388
391
|
input = `${input.substring(0, eIndex)}${input.substring(eIndex).replace(/\./g, '')}`;
|
|
389
392
|
}
|
|
390
393
|
}
|
|
391
394
|
// stripe all other invalid characters and make sure that + and - signs are correct
|
|
392
|
-
return input.replace(/(^[-+]|[e][-+])|[-+]|[^0-9e.+-]/
|
|
395
|
+
return input.replace(/(^[-+]|[e][-+])|[-+]|[^0-9e.+-]/gi, '$1');
|
|
393
396
|
}
|
|
394
397
|
/**
|
|
395
398
|
* On *user-interaction* set the value and notify.
|
|
@@ -498,7 +501,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
498
501
|
*/
|
|
499
502
|
findNearestSteppedValue(value, stepBase, allowedValueStep, direction) {
|
|
500
503
|
// TODO: there is probably much better way on how to implement this function
|
|
501
|
-
let newValue = this.toFixedNumber(value + (stepBase - value) % allowedValueStep);
|
|
504
|
+
let newValue = this.toFixedNumber(value + ((stepBase - value) % allowedValueStep));
|
|
502
505
|
if (direction === Direction.Up) {
|
|
503
506
|
// with float number rounding this may need to run more than once to find the valid value
|
|
504
507
|
while (newValue <= value) {
|
|
@@ -575,7 +578,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
575
578
|
}
|
|
576
579
|
// If either the method invoked was the stepDown() method and value is greater than valueBeforeStepping
|
|
577
580
|
// or the method invoked was the stepUp() method and value is less than valueBeforeStepping, then return.
|
|
578
|
-
if (!isNaN(inputValue) &&
|
|
581
|
+
if (!isNaN(inputValue) &&
|
|
582
|
+
((direction === Direction.Up && value < valueBeforeStepping) ||
|
|
583
|
+
(direction === Direction.Down && value > valueBeforeStepping))) {
|
|
579
584
|
return;
|
|
580
585
|
}
|
|
581
586
|
this.inputValue = String(value);
|
|
@@ -650,7 +655,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
650
655
|
*/
|
|
651
656
|
/* c8 ignore start */
|
|
652
657
|
set selectionStart(index) {
|
|
653
|
-
throw new Error(
|
|
658
|
+
throw new Error("Failed to set the 'selectionStart' property on 'NumberField': The element does not support selection.");
|
|
654
659
|
}
|
|
655
660
|
/* c8 ignore stop */
|
|
656
661
|
/**
|
|
@@ -668,7 +673,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
668
673
|
*/
|
|
669
674
|
/* c8 ignore start */
|
|
670
675
|
set selectionEnd(index) {
|
|
671
|
-
throw new Error(
|
|
676
|
+
throw new Error("Failed to set the 'selectionEnd' property on 'NumberField': The element does not support selection.");
|
|
672
677
|
}
|
|
673
678
|
/* c8 ignore stop */
|
|
674
679
|
/**
|
|
@@ -686,7 +691,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
686
691
|
*/
|
|
687
692
|
/* c8 ignore start */
|
|
688
693
|
set selectionDirection(direction) {
|
|
689
|
-
throw new Error(
|
|
694
|
+
throw new Error("Failed to set the 'selectionDirection' property on 'NumberField': The element does not support selection.");
|
|
690
695
|
}
|
|
691
696
|
/* c8 ignore stop */
|
|
692
697
|
/**
|
|
@@ -696,7 +701,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
696
701
|
/* c8 ignore start */
|
|
697
702
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
698
703
|
setSelectionRange(startSelection, endSelection, selectionDirection) {
|
|
699
|
-
throw new Error(
|
|
704
|
+
throw new Error("Failed to execute 'setSelectionRange' on 'NumberField': The element does not support selection.");
|
|
700
705
|
}
|
|
701
706
|
/* c8 ignore stop */
|
|
702
707
|
/**
|
|
@@ -705,20 +710,9 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
705
710
|
*/
|
|
706
711
|
renderSpinner() {
|
|
707
712
|
return html `
|
|
708
|
-
<div
|
|
709
|
-
part="spinner"
|
|
710
|
-
|
|
711
|
-
<ef-icon
|
|
712
|
-
icon="up"
|
|
713
|
-
part="spinner-up"
|
|
714
|
-
?readonly=${this.readonly}
|
|
715
|
-
?disabled=${this.disabled}>
|
|
716
|
-
</ef-icon>
|
|
717
|
-
<ef-icon
|
|
718
|
-
icon="down"
|
|
719
|
-
part="spinner-down"
|
|
720
|
-
?readonly=${this.readonly}
|
|
721
|
-
?disabled=${this.disabled}>
|
|
713
|
+
<div part="spinner" @tap=${this.onSpinnerTap}>
|
|
714
|
+
<ef-icon icon="up" part="spinner-up" ?readonly=${this.readonly} ?disabled=${this.disabled}> </ef-icon>
|
|
715
|
+
<ef-icon icon="down" part="spinner-down" ?readonly=${this.readonly} ?disabled=${this.disabled}>
|
|
722
716
|
</ef-icon>
|
|
723
717
|
</div>
|
|
724
718
|
`;
|
|
@@ -728,7 +722,6 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
728
722
|
* type="text" - always `text`
|
|
729
723
|
* part="input" - always "input", used for styling
|
|
730
724
|
* inputmode="decimal" - show decimals keyboard by default
|
|
731
|
-
* pattern="'^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$'" - numbers only
|
|
732
725
|
* role="spinbutton" - number field is actually a spinner
|
|
733
726
|
* aria-valuenow - current value or 0
|
|
734
727
|
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
|
|
@@ -738,11 +731,10 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
738
731
|
get decorateInputMap() {
|
|
739
732
|
return {
|
|
740
733
|
...super.decorateInputMap,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
'
|
|
745
|
-
'role': 'spinbutton',
|
|
734
|
+
type: 'text',
|
|
735
|
+
part: 'input',
|
|
736
|
+
inputmode: 'decimal',
|
|
737
|
+
role: 'spinbutton',
|
|
746
738
|
'aria-valuenow': `${this.value || 0}`,
|
|
747
739
|
'@keydown': this.onInputKeyDown,
|
|
748
740
|
'@beforeinput': this.onBeforeInputChange
|
|
@@ -754,9 +746,7 @@ let NumberField = class NumberField extends FormFieldElement {
|
|
|
754
746
|
* @return {TemplateResult} Render template
|
|
755
747
|
*/
|
|
756
748
|
render() {
|
|
757
|
-
return html `
|
|
758
|
-
${super.render()}
|
|
759
|
-
${this.noSpinner ? null : this.renderSpinner()}`;
|
|
749
|
+
return html ` ${super.render()} ${this.noSpinner ? null : this.renderSpinner()}`;
|
|
760
750
|
}
|
|
761
751
|
};
|
|
762
752
|
__decorate([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSXInterface } from '../../jsx';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
|
|
3
|
+
import { NullOrUndefined, Position, PositionTarget, PositionTargetStrategy, TransitionStyle } from '../helpers/types.js';
|
|
4
4
|
export type { TransitionStyle, PositionTarget, Position, PositionTargetStrategy };
|
|
5
5
|
/**
|
|
6
6
|
* Element to help building modals, dialogs and other overlay content
|