@refinitiv-ui/elements 7.9.0 → 7.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/lib/calendar/custom-elements.json +1 -1
- package/lib/calendar/custom-elements.md +1 -1
- package/lib/calendar/index.d.ts +1 -1
- package/lib/calendar/index.js +3 -2
- package/lib/calendar/types.d.ts +2 -0
- package/lib/chart/elements/chart.js +2 -1
- package/lib/combo-box/index.js +4 -0
- package/lib/datetime-picker/custom-elements.json +17 -0
- package/lib/datetime-picker/custom-elements.md +13 -9
- package/lib/datetime-picker/index.d.ts +17 -0
- package/lib/datetime-picker/index.js +75 -9
- package/lib/interactive-chart/index.js +1 -1
- package/lib/select/custom-elements.json +33 -33
- package/lib/select/custom-elements.md +1 -1
- package/lib/select/index.d.ts +22 -27
- package/lib/select/index.js +69 -95
- package/lib/slider/elements/slider-marker.d.ts +49 -0
- package/lib/slider/elements/slider-marker.js +72 -0
- package/lib/slider/elements/slider.d.ts +508 -0
- package/lib/slider/elements/slider.js +1431 -0
- package/lib/slider/index.d.ts +2 -469
- package/lib/slider/index.js +2 -1309
- package/lib/slider/themes/halo/dark/index.js +2 -1
- package/lib/slider/themes/halo/light/index.js +2 -1
- package/lib/slider/themes/solar/charcoal/index.js +2 -1
- package/lib/slider/themes/solar/pearl/index.js +2 -1
- package/lib/time-picker/index.d.ts +5 -0
- package/lib/time-picker/index.js +34 -28
- package/lib/version.js +1 -1
- package/package.json +9 -9
package/lib/select/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { FocusedPropertyKey, FormFieldElement, css, html, nothing } 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 { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
|
|
@@ -44,13 +44,21 @@ var Navigation;
|
|
|
44
44
|
* @attr {boolean} disabled - Set disabled state
|
|
45
45
|
* @prop {boolean} [disabled=false] - Set disabled state
|
|
46
46
|
*
|
|
47
|
+
* @attr {string} placeholder - Set placeholder text
|
|
48
|
+
* @prop {string} [placeholder=""] - Set placeholder text
|
|
49
|
+
*
|
|
50
|
+
* @attr {boolean} error - Set error state
|
|
51
|
+
* @prop {boolean} [error=false] - Set error state
|
|
52
|
+
*
|
|
53
|
+
* @attr {boolean} warning - Set warning state
|
|
54
|
+
* @prop {boolean} [warning=false] - Set warning state
|
|
55
|
+
*
|
|
47
56
|
* @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
|
|
48
57
|
* @fires opened-changed - Fired when the user opens or closes control's popup. The event is not triggered if `opened` property is changed programmatically.
|
|
49
58
|
*/
|
|
50
|
-
let Select = class Select extends
|
|
59
|
+
let Select = class Select extends FormFieldElement {
|
|
51
60
|
constructor() {
|
|
52
61
|
super(...arguments);
|
|
53
|
-
this.defaultRole = 'combobox';
|
|
54
62
|
this.composer = new CollectionComposer([]);
|
|
55
63
|
this._data = null;
|
|
56
64
|
this.popupDynamicStyles = {}; /* set popup min-width based on select width or CSS vars */
|
|
@@ -60,22 +68,10 @@ let Select = class Select extends ControlElement {
|
|
|
60
68
|
this.keySearchTerm = ''; /* used for quick search */
|
|
61
69
|
this.keySearchThrottler = new TimeoutTaskRunner(KEY_SEARCH_DEBOUNCER);
|
|
62
70
|
this.resizeThrottler = new AnimationTaskRunner();
|
|
63
|
-
/**
|
|
64
|
-
* Placeholder to display when no value is set
|
|
65
|
-
*/
|
|
66
|
-
this.placeholder = '';
|
|
67
71
|
/**
|
|
68
72
|
* Toggles the opened state of the list
|
|
69
73
|
*/
|
|
70
74
|
this.opened = false;
|
|
71
|
-
/**
|
|
72
|
-
* Set error state
|
|
73
|
-
*/
|
|
74
|
-
this.error = false;
|
|
75
|
-
/**
|
|
76
|
-
* Set warning state
|
|
77
|
-
*/
|
|
78
|
-
this.warning = false;
|
|
79
75
|
/**
|
|
80
76
|
* This variable is here to ensure that the value and data are in sync when data is set after the value.
|
|
81
77
|
* This is developer error to use both, selected and value to control the selections.
|
|
@@ -151,6 +147,9 @@ let Select = class Select extends ControlElement {
|
|
|
151
147
|
display: none;
|
|
152
148
|
}
|
|
153
149
|
#box {
|
|
150
|
+
outline: none;
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 100%;
|
|
154
153
|
align-items: center;
|
|
155
154
|
display: inline-flex;
|
|
156
155
|
flex-flow: row nowrap;
|
|
@@ -173,19 +172,6 @@ let Select = class Select extends ControlElement {
|
|
|
173
172
|
left: 0;
|
|
174
173
|
cursor: pointer;
|
|
175
174
|
}
|
|
176
|
-
#select {
|
|
177
|
-
position: absolute;
|
|
178
|
-
top: 0;
|
|
179
|
-
left: 0;
|
|
180
|
-
right: 0;
|
|
181
|
-
bottom: 0;
|
|
182
|
-
width: 100%;
|
|
183
|
-
height: 100%;
|
|
184
|
-
opacity: 0;
|
|
185
|
-
border: none;
|
|
186
|
-
padding: 0;
|
|
187
|
-
margin: 0;
|
|
188
|
-
}
|
|
189
175
|
`;
|
|
190
176
|
}
|
|
191
177
|
/**
|
|
@@ -279,15 +265,6 @@ let Select = class Select extends ControlElement {
|
|
|
279
265
|
}
|
|
280
266
|
return this.selectedSlotItems.map((item) => this.getItemValue(item));
|
|
281
267
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Called when connected to DOM
|
|
284
|
-
* @returns {void}
|
|
285
|
-
*/
|
|
286
|
-
connectedCallback() {
|
|
287
|
-
super.connectedCallback();
|
|
288
|
-
// Indicating that this select has a popup of type listbox
|
|
289
|
-
this.setAttribute('aria-haspopup', 'listbox');
|
|
290
|
-
}
|
|
291
268
|
/**
|
|
292
269
|
* Updates the element
|
|
293
270
|
* @param changedProperties Properties that has changed
|
|
@@ -312,10 +289,6 @@ let Select = class Select extends ControlElement {
|
|
|
312
289
|
else {
|
|
313
290
|
this.closing();
|
|
314
291
|
}
|
|
315
|
-
this.setAttribute('aria-expanded', this.opened ? 'true' : 'false');
|
|
316
|
-
}
|
|
317
|
-
if (changedProperties.has('error')) {
|
|
318
|
-
this.setAttribute('aria-invalid', this.error ? 'true' : 'false');
|
|
319
292
|
}
|
|
320
293
|
super.update(changedProperties);
|
|
321
294
|
}
|
|
@@ -871,17 +844,6 @@ let Select = class Select extends ControlElement {
|
|
|
871
844
|
get labelTemplate() {
|
|
872
845
|
return html `<div part="label" ${ref(this.labelRef)}>${this.labelText}</div>`;
|
|
873
846
|
}
|
|
874
|
-
/**
|
|
875
|
-
* Edit template when select is not readonly or disabled
|
|
876
|
-
*/
|
|
877
|
-
get editTemplate() {
|
|
878
|
-
if (!this.readonly && !this.disabled) {
|
|
879
|
-
return html `
|
|
880
|
-
<div id="trigger" @tapstart="${this.toggleOpened}"></div>
|
|
881
|
-
${this.popupTemplate}
|
|
882
|
-
`;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
847
|
/**
|
|
886
848
|
* Get default slot template
|
|
887
849
|
*/
|
|
@@ -895,37 +857,44 @@ let Select = class Select extends ControlElement {
|
|
|
895
857
|
return html `${this.composer.queryItems(() => true).map((item) => this.toItem(item))}`;
|
|
896
858
|
}
|
|
897
859
|
/**
|
|
898
|
-
*
|
|
899
|
-
*/
|
|
900
|
-
get
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
860
|
+
* `ef-items` template generated from slot or `data`
|
|
861
|
+
*/
|
|
862
|
+
get itemsTemplate() {
|
|
863
|
+
return this.hasDataItems() ? this.dataContent : this.slottedContent;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Template of a listbox containing ef-item(s)
|
|
867
|
+
*/
|
|
868
|
+
get listboxTemplate() {
|
|
869
|
+
return this.lazyRendered
|
|
870
|
+
? html `<ef-overlay
|
|
871
|
+
${ref(this.menuRef)}
|
|
872
|
+
tabindex="-1"
|
|
873
|
+
id="menu"
|
|
874
|
+
part="list"
|
|
875
|
+
role="listbox"
|
|
876
|
+
style=${styleMap(this.popupDynamicStyles)}
|
|
877
|
+
with-shadow
|
|
878
|
+
lock-position-target
|
|
879
|
+
.positionTarget=${this}
|
|
880
|
+
.position=${POPUP_POSITION}
|
|
881
|
+
?opened=${this.opened}
|
|
882
|
+
@tap=${this.onPopupTap}
|
|
883
|
+
@mousemove=${this.onPopupMouseMove}
|
|
884
|
+
@keydown=${this.onPopupKeyDown}
|
|
885
|
+
@opened-changed="${this.onPopupOpenedChanged}"
|
|
886
|
+
@opened="${this.onPopupOpened}"
|
|
887
|
+
@refit=${this.onPopupRefit}
|
|
888
|
+
@closed="${this.onPopupClosed}"
|
|
889
|
+
>${this.itemsTemplate}</ef-overlay
|
|
890
|
+
>`
|
|
891
|
+
: nothing;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Area that allows select to be clickable and toggle between open and close
|
|
895
|
+
*/
|
|
896
|
+
get triggerTemplate() {
|
|
897
|
+
return html ` <div id="trigger" @tapstart="${this.toggleOpened}"></div>`;
|
|
929
898
|
}
|
|
930
899
|
/**
|
|
931
900
|
* A `TemplateResult` that will be used
|
|
@@ -933,11 +902,25 @@ let Select = class Select extends ControlElement {
|
|
|
933
902
|
* @return Render template
|
|
934
903
|
*/
|
|
935
904
|
render() {
|
|
936
|
-
return html
|
|
905
|
+
return html `<div
|
|
906
|
+
id="box"
|
|
907
|
+
tabindex="0"
|
|
908
|
+
role="combobox"
|
|
909
|
+
placeholder=${this.placeholder || nothing}
|
|
910
|
+
aria-haspopup="listbox"
|
|
911
|
+
aria-controls="menu"
|
|
912
|
+
aria-invalid=${this.error ? 'true' : 'false'}
|
|
913
|
+
aria-expanded=${this.opened ? 'true' : 'false'}
|
|
914
|
+
aria-required=${this.inputAriaRequired}
|
|
915
|
+
aria-label=${this.inputAriaLabel ?? nothing}
|
|
916
|
+
aria-description=${this.inputAriaDescription ?? nothing}
|
|
917
|
+
>
|
|
937
918
|
<div id="text">${this.placeholderHidden() ? this.labelTemplate : this.placeholderTemplate}</div>
|
|
938
|
-
<ef-icon icon="down" part="icon"></ef-icon>
|
|
919
|
+
<ef-icon aria-hidden="true" icon="down" part="icon"></ef-icon>
|
|
939
920
|
</div>
|
|
940
|
-
${this.
|
|
921
|
+
${!this.readonly && !this.disabled
|
|
922
|
+
? html ` ${this.triggerTemplate} ${this.listboxTemplate} `
|
|
923
|
+
: nothing}`;
|
|
941
924
|
}
|
|
942
925
|
};
|
|
943
926
|
__decorate([
|
|
@@ -946,18 +929,9 @@ __decorate([
|
|
|
946
929
|
__decorate([
|
|
947
930
|
property({ type: Array, attribute: false })
|
|
948
931
|
], Select.prototype, "labels", null);
|
|
949
|
-
__decorate([
|
|
950
|
-
property({ type: String })
|
|
951
|
-
], Select.prototype, "placeholder", void 0);
|
|
952
932
|
__decorate([
|
|
953
933
|
property({ type: Boolean, reflect: true })
|
|
954
934
|
], Select.prototype, "opened", void 0);
|
|
955
|
-
__decorate([
|
|
956
|
-
property({ type: Boolean, reflect: true })
|
|
957
|
-
], Select.prototype, "error", void 0);
|
|
958
|
-
__decorate([
|
|
959
|
-
property({ type: Boolean, reflect: true })
|
|
960
|
-
], Select.prototype, "warning", void 0);
|
|
961
935
|
__decorate([
|
|
962
936
|
property({ type: Boolean })
|
|
963
937
|
], Select.prototype, "multiple", null);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JSXInterface } from '../../jsx';
|
|
2
|
+
import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
|
|
3
|
+
export declare class SliderMarker extends BasicElement {
|
|
4
|
+
/**
|
|
5
|
+
* Element version number
|
|
6
|
+
* @returns version number
|
|
7
|
+
*/
|
|
8
|
+
static get version(): string;
|
|
9
|
+
static get styles(): CSSResultGroup;
|
|
10
|
+
/**
|
|
11
|
+
* Used to determine the position of the marker on the scale.
|
|
12
|
+
*/
|
|
13
|
+
value: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify label alignment
|
|
16
|
+
*/
|
|
17
|
+
labelAlign: 'left' | 'right' | 'center' | null;
|
|
18
|
+
/**
|
|
19
|
+
* On first updated lifecycle
|
|
20
|
+
* @param changedProperties changed properties
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
24
|
+
/**
|
|
25
|
+
* A `TemplateResult` that will be used
|
|
26
|
+
* to render the updated internal template.
|
|
27
|
+
* @returns Render template
|
|
28
|
+
*/
|
|
29
|
+
protected render(): TemplateResult;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
'ef-slider-marker': SliderMarker;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'ef-slider-marker': SliderMarker;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
namespace JSX {
|
|
43
|
+
interface IntrinsicElements {
|
|
44
|
+
'ef-slider-marker': Partial<SliderMarker> | JSXInterface.HTMLAttributes<SliderMarker>;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { BasicElement, css, html } from '@refinitiv-ui/core';
|
|
3
|
+
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
|
|
4
|
+
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
5
|
+
import { VERSION } from '../../version.js';
|
|
6
|
+
let SliderMarker = class SliderMarker extends BasicElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* Used to determine the position of the marker on the scale.
|
|
11
|
+
*/
|
|
12
|
+
this.value = '';
|
|
13
|
+
/**
|
|
14
|
+
* Specify label alignment
|
|
15
|
+
*/
|
|
16
|
+
this.labelAlign = null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Element version number
|
|
20
|
+
* @returns version number
|
|
21
|
+
*/
|
|
22
|
+
static get version() {
|
|
23
|
+
return VERSION;
|
|
24
|
+
}
|
|
25
|
+
static get styles() {
|
|
26
|
+
return css `
|
|
27
|
+
:host {
|
|
28
|
+
position: absolute;
|
|
29
|
+
}
|
|
30
|
+
[part='marker'] {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
[part='label'] {
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
position: absolute;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* On first updated lifecycle
|
|
42
|
+
* @param changedProperties changed properties
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
firstUpdated(changedProperties) {
|
|
46
|
+
super.firstUpdated(changedProperties);
|
|
47
|
+
this.setAttribute('aria-hidden', 'true');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A `TemplateResult` that will be used
|
|
51
|
+
* to render the updated internal template.
|
|
52
|
+
* @returns Render template
|
|
53
|
+
*/
|
|
54
|
+
render() {
|
|
55
|
+
return html `
|
|
56
|
+
<div part="marker"></div>
|
|
57
|
+
<div part="label">
|
|
58
|
+
<slot></slot>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: String })
|
|
65
|
+
], SliderMarker.prototype, "value", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: String, reflect: true, attribute: 'label-align' })
|
|
68
|
+
], SliderMarker.prototype, "labelAlign", void 0);
|
|
69
|
+
SliderMarker = __decorate([
|
|
70
|
+
customElement('ef-slider-marker')
|
|
71
|
+
], SliderMarker);
|
|
72
|
+
export { SliderMarker };
|