@refinitiv-ui/elements 6.1.0 → 6.2.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 +30 -0
- package/lib/color-dialog/elements/palettes.js +1 -2
- package/lib/color-dialog/helpers/color-helpers.d.ts +0 -7
- package/lib/color-dialog/helpers/color-helpers.js +0 -15
- package/lib/color-dialog/helpers/value-model.js +1 -2
- package/lib/color-dialog/index.js +1 -2
- package/lib/color-picker/custom-elements.json +71 -0
- package/lib/color-picker/custom-elements.md +19 -0
- package/lib/color-picker/index.d.ts +130 -0
- package/lib/color-picker/index.js +235 -0
- package/lib/color-picker/themes/halo/dark/index.js +3 -0
- package/lib/color-picker/themes/halo/light/index.js +3 -0
- package/lib/color-picker/themes/solar/charcoal/index.js +3 -0
- package/lib/color-picker/themes/solar/pearl/index.js +3 -0
- package/lib/combo-box/index.js +4 -1
- package/lib/dialog/index.d.ts +6 -4
- package/lib/dialog/index.js +12 -4
- package/lib/interactive-chart/index.d.ts +11 -7
- package/lib/interactive-chart/index.js +35 -25
- package/lib/interactive-chart/themes/halo/dark/index.js +1 -1
- package/lib/interactive-chart/themes/halo/light/index.js +1 -1
- package/lib/interactive-chart/themes/solar/charcoal/index.js +1 -1
- package/lib/interactive-chart/themes/solar/pearl/index.js +1 -1
- package/lib/item/custom-elements.json +0 -5
- package/lib/item/custom-elements.md +0 -1
- package/lib/item/index.d.ts +36 -8
- package/lib/item/index.js +71 -18
- package/lib/list/themes/halo/dark/index.js +1 -1
- package/lib/list/themes/halo/light/index.js +1 -1
- package/lib/list/themes/solar/charcoal/index.js +1 -1
- package/lib/list/themes/solar/pearl/index.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +22 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.2.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.1.1...@refinitiv-ui/elements@6.2.0) (2022-09-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **color-picker:** update snapshot and remove backdrop ([#447](https://github.com/Refinitiv/refinitiv-ui/issues/447)) ([d6c086c](https://github.com/Refinitiv/refinitiv-ui/commit/d6c086c4ab405d8183258c72bc566f4bb640a635))
|
|
12
|
+
* **dialog:** change withBackdrop and withShadow to proprerty ([#445](https://github.com/Refinitiv/refinitiv-ui/issues/445)) ([2740f00](https://github.com/Refinitiv/refinitiv-ui/commit/2740f008b5163a396dd244570a93064bf0c8d844))
|
|
13
|
+
* **interactive-chart:** fix left position on legend ([#449](https://github.com/Refinitiv/refinitiv-ui/issues/449)) ([ede4f93](https://github.com/Refinitiv/refinitiv-ui/commit/ede4f93776671f9261675a3a0d5bd32a62c317d5))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **color-picker:** add color picker ([#444](https://github.com/Refinitiv/refinitiv-ui/issues/444)) ([3718003](https://github.com/Refinitiv/refinitiv-ui/commit/37180039a77d908acd731c89067ecfce3f23955f))
|
|
19
|
+
* **item:** show tooltip when text ellipsis ([#394](https://github.com/Refinitiv/refinitiv-ui/issues/394)) ([8943eb6](https://github.com/Refinitiv/refinitiv-ui/commit/8943eb625bfd54a6014f6815940eacd924d67ab4))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [6.1.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.1.0...@refinitiv-ui/elements@6.1.1) (2022-08-29)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **combo-box:** incorrect popup logic in some scenarios ([159eb53](https://github.com/Refinitiv/refinitiv-ui/commit/159eb53c7bec583c59de4dfac2542e67c840b2fc))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [6.1.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.4...@refinitiv-ui/elements@6.1.0) (2022-08-16)
|
|
7
37
|
|
|
8
38
|
|
|
@@ -3,8 +3,7 @@ import { BasicElement, svg } from '@refinitiv-ui/core';
|
|
|
3
3
|
import { property } from '@refinitiv-ui/core/decorators/property.js';
|
|
4
4
|
import { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
5
5
|
import { VERSION } from '../../version.js';
|
|
6
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
7
|
-
import { isHex } from '../helpers/color-helpers.js';
|
|
6
|
+
import { rgb, isHex } from '@refinitiv-ui/utils/color.js';
|
|
8
7
|
/**
|
|
9
8
|
* Element base class usually used
|
|
10
9
|
* for creating palettes elements.
|
|
@@ -7,10 +7,3 @@ export declare const COLOR_ITEMS: string[][];
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const GRAYSCALE_ITEMS: string[][];
|
|
9
9
|
export declare const NOCOLOR_POINTS = "6, 2, 15, 6, 15, 17, 6, 21, -3, 17, -3, 6";
|
|
10
|
-
export declare const isHex: (value: string) => boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Remove hash (#) sign from hex value
|
|
13
|
-
* @param hex Hex to check
|
|
14
|
-
* @returns hex value without # sign
|
|
15
|
-
*/
|
|
16
|
-
export declare const removeHashSign: (hex: string) => string;
|
|
@@ -144,18 +144,3 @@ export const GRAYSCALE_ITEMS = [
|
|
|
144
144
|
['155, 2, 164, 6, 164, 17, 155, 21, 146, 17, 146, 6', '#000000']
|
|
145
145
|
];
|
|
146
146
|
export const NOCOLOR_POINTS = '6, 2, 15, 6, 15, 17, 6, 21, -3, 17, -3, 6';
|
|
147
|
-
const HEX_REGEXP = /^#([0-9A-F]{3}){1,2}$/i; // used to validate HEX
|
|
148
|
-
export const isHex = (value) => HEX_REGEXP.test(value);
|
|
149
|
-
/**
|
|
150
|
-
* Remove hash (#) sign from hex value
|
|
151
|
-
* @param hex Hex to check
|
|
152
|
-
* @returns hex value without # sign
|
|
153
|
-
*/
|
|
154
|
-
export const removeHashSign = (hex) => {
|
|
155
|
-
if (hex) {
|
|
156
|
-
if (hex.startsWith('#')) {
|
|
157
|
-
hex = hex.slice(1);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return hex;
|
|
161
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
2
|
-
import { isHex } from './color-helpers.js';
|
|
1
|
+
import { rgb, isHex } from '@refinitiv-ui/utils/color.js';
|
|
3
2
|
const rgbNumberToString = (value) => isNaN(value) ? '' : `${value}`; // replace NaN with empty string
|
|
4
3
|
/**
|
|
5
4
|
* A helper model in order to keep and update values between RGB and HEX
|
|
@@ -4,10 +4,9 @@ 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
6
|
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
7
|
-
import { rgb } from '@refinitiv-ui/utils/color.js';
|
|
7
|
+
import { rgb, isHex, removeHashSign } from '@refinitiv-ui/utils/color.js';
|
|
8
8
|
import { VERSION } from '../version.js';
|
|
9
9
|
import { ValueModel } from './helpers/value-model.js';
|
|
10
|
-
import { isHex, removeHashSign } from './helpers/color-helpers.js';
|
|
11
10
|
import '../button/index.js';
|
|
12
11
|
import '../number-field/index.js';
|
|
13
12
|
import '../text-field/index.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "experimental",
|
|
3
|
+
"tags": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ef-color-picker",
|
|
6
|
+
"description": "\nColor picker control",
|
|
7
|
+
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "allow-nocolor",
|
|
10
|
+
"description": "Set the color dialog to activate no-color option",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": "false"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "opened",
|
|
16
|
+
"description": "Toggles the opened state of the dialog",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": "false"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "readonly",
|
|
22
|
+
"description": "Set readonly state",
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": "false"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "disabled",
|
|
28
|
+
"description": "Set disabled state",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": "false"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"properties": [
|
|
34
|
+
{
|
|
35
|
+
"name": "allowNocolor",
|
|
36
|
+
"attribute": "allow-nocolor",
|
|
37
|
+
"description": "Set the color dialog to activate no-color option",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": "false"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "opened",
|
|
43
|
+
"attribute": "opened",
|
|
44
|
+
"description": "Toggles the opened state of the dialog",
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"default": "false"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "readonly",
|
|
50
|
+
"attribute": "readonly",
|
|
51
|
+
"description": "Set readonly state",
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": "false"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "disabled",
|
|
57
|
+
"attribute": "disabled",
|
|
58
|
+
"description": "Set disabled state",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"default": "false"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"events": [
|
|
64
|
+
{
|
|
65
|
+
"name": "value-changed",
|
|
66
|
+
"description": "Dispatched when value changes"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ef-color-picker
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Color picker control
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
| Property | Attribute | Type | Default | Description |
|
|
9
|
+
|----------------|-----------------|-----------|---------|--------------------------------------------------|
|
|
10
|
+
| `allowNocolor` | `allow-nocolor` | `boolean` | false | Set the color dialog to activate no-color option |
|
|
11
|
+
| `disabled` | `disabled` | `boolean` | false | Set disabled state |
|
|
12
|
+
| `opened` | `opened` | `boolean` | false | Toggles the opened state of the dialog |
|
|
13
|
+
| `readonly` | `readonly` | `boolean` | false | Set readonly state |
|
|
14
|
+
|
|
15
|
+
## Events
|
|
16
|
+
|
|
17
|
+
| Event | Description |
|
|
18
|
+
|-----------------|-------------------------------|
|
|
19
|
+
| `value-changed` | Dispatched when value changes |
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { JSXInterface } from '../jsx';
|
|
2
|
+
import { ControlElement, PropertyValues, TemplateResult, CSSResult } from '@refinitiv-ui/core';
|
|
3
|
+
import '../color-dialog/index.js';
|
|
4
|
+
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Color picker control
|
|
8
|
+
* @fires value-changed - Dispatched when value changes
|
|
9
|
+
*
|
|
10
|
+
* @attr {boolean} readonly - Set readonly state
|
|
11
|
+
* @prop {boolean} [readonly=false] - Set readonly state
|
|
12
|
+
*
|
|
13
|
+
* @attr {boolean} disabled - Set disabled state
|
|
14
|
+
* @prop {boolean} [disabled=false] - Set disabled state
|
|
15
|
+
*/
|
|
16
|
+
export declare class ColorPicker extends ControlElement {
|
|
17
|
+
/**
|
|
18
|
+
* Element version number
|
|
19
|
+
* @returns version number
|
|
20
|
+
*/
|
|
21
|
+
static get version(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Set the color dialog to activate no-color option
|
|
24
|
+
*/
|
|
25
|
+
allowNocolor: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Set lang to color dialog
|
|
28
|
+
* @ignore
|
|
29
|
+
*/
|
|
30
|
+
lang: string;
|
|
31
|
+
/**
|
|
32
|
+
* A `CSSResult` that will be used
|
|
33
|
+
* to style the host, slotted children
|
|
34
|
+
* and the internal template of the element.
|
|
35
|
+
* @returns CSS template
|
|
36
|
+
*/
|
|
37
|
+
static get styles(): CSSResult | CSSResult[];
|
|
38
|
+
private lazyRendered;
|
|
39
|
+
/**
|
|
40
|
+
* Toggles the opened state of the dialog
|
|
41
|
+
*/
|
|
42
|
+
opened: boolean;
|
|
43
|
+
private dialogEl?;
|
|
44
|
+
/**
|
|
45
|
+
* Check if value is valid HEX value (including #)
|
|
46
|
+
* @param value Value to check
|
|
47
|
+
* @returns true if value is valid
|
|
48
|
+
*/
|
|
49
|
+
protected isValidValue(value: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Used to show a warning when the value does not pass the validation
|
|
52
|
+
* @param value that is invalid
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
protected warnInvalidValue(value: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Return true if popup can be opened
|
|
58
|
+
*/
|
|
59
|
+
private get canOpenPopup();
|
|
60
|
+
/**
|
|
61
|
+
* Called after the component is first rendered
|
|
62
|
+
* @param changedProperties Properties which have changed
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
protected firstUpdated(changedProperties: PropertyValues): void;
|
|
66
|
+
/**
|
|
67
|
+
* Updates the element
|
|
68
|
+
* @param changedProperties Properties that has changed
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
protected update(changedProperties: PropertyValues): void;
|
|
72
|
+
/**
|
|
73
|
+
* Run on tap event
|
|
74
|
+
* @param event Tap event
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
private onTap;
|
|
78
|
+
/**
|
|
79
|
+
* Handles key input on color picker
|
|
80
|
+
* @param event Key down event object
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
private onKeyDown;
|
|
84
|
+
/**
|
|
85
|
+
* Set opened state with event
|
|
86
|
+
* @param opened True if opened
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
private setOpened;
|
|
90
|
+
/**
|
|
91
|
+
* Run on color dialog value-changed event
|
|
92
|
+
* @param event value-changed event
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
private onColorDialogValueChanged;
|
|
96
|
+
/**
|
|
97
|
+
* Run on color dialog opened-changed event
|
|
98
|
+
* @param event opened-changed event
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
private onColorDialogOpenedChanged;
|
|
102
|
+
/**
|
|
103
|
+
* Color dialog template
|
|
104
|
+
*/
|
|
105
|
+
private get dialogTemplate();
|
|
106
|
+
/**
|
|
107
|
+
* Color item template
|
|
108
|
+
*/
|
|
109
|
+
private get colorItemTemplate();
|
|
110
|
+
/**
|
|
111
|
+
* A `TemplateResult` that will be used
|
|
112
|
+
* to render the updated internal template.
|
|
113
|
+
* @return Render template
|
|
114
|
+
*/
|
|
115
|
+
protected render(): TemplateResult;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
'ef-color-picker': ColorPicker;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
namespace JSX {
|
|
124
|
+
interface IntrinsicElements {
|
|
125
|
+
'ef-color-picker': Partial<ColorPicker> | JSXInterface.ControlHTMLAttributes<ColorPicker>;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ControlElement, html, css, WarningNotice } 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 { query } from '@refinitiv-ui/core/decorators/query.js';
|
|
6
|
+
import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
|
|
7
|
+
import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
|
|
8
|
+
import { VERSION } from '../version.js';
|
|
9
|
+
import { isHex } from '@refinitiv-ui/utils/color.js';
|
|
10
|
+
import '../color-dialog/index.js';
|
|
11
|
+
import '@refinitiv-ui/phrasebook/locale/en/color-picker.js';
|
|
12
|
+
const DIALOG_POSITION = ['right-start', 'right-end', 'right-middle', 'left-start', 'left-end', 'left-middle'];
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Color picker control
|
|
16
|
+
* @fires value-changed - Dispatched when value changes
|
|
17
|
+
*
|
|
18
|
+
* @attr {boolean} readonly - Set readonly state
|
|
19
|
+
* @prop {boolean} [readonly=false] - Set readonly state
|
|
20
|
+
*
|
|
21
|
+
* @attr {boolean} disabled - Set disabled state
|
|
22
|
+
* @prop {boolean} [disabled=false] - Set disabled state
|
|
23
|
+
*/
|
|
24
|
+
let ColorPicker = class ColorPicker extends ControlElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
/**
|
|
28
|
+
* Set the color dialog to activate no-color option
|
|
29
|
+
*/
|
|
30
|
+
this.allowNocolor = false;
|
|
31
|
+
/**
|
|
32
|
+
* Set lang to color dialog
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
this.lang = '';
|
|
36
|
+
this.lazyRendered = false; /* speed up rendering by not populating color dialog on first load */
|
|
37
|
+
/**
|
|
38
|
+
* Toggles the opened state of the dialog
|
|
39
|
+
*/
|
|
40
|
+
this.opened = false;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Element version number
|
|
44
|
+
* @returns version number
|
|
45
|
+
*/
|
|
46
|
+
static get version() {
|
|
47
|
+
return VERSION;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A `CSSResult` that will be used
|
|
51
|
+
* to style the host, slotted children
|
|
52
|
+
* and the internal template of the element.
|
|
53
|
+
* @returns CSS template
|
|
54
|
+
*/
|
|
55
|
+
static get styles() {
|
|
56
|
+
return css `
|
|
57
|
+
:host {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
}
|
|
60
|
+
[part=color-item][no-color] {
|
|
61
|
+
background: linear-gradient(to bottom right, transparent calc(50% - 1px),
|
|
62
|
+
var(--no-color-line-color, #ff0000) calc(50% - 1px),
|
|
63
|
+
var(--no-color-line-color, #ff0000) calc(50% + 1px),
|
|
64
|
+
transparent calc(50% + 1px));
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check if value is valid HEX value (including #)
|
|
70
|
+
* @param value Value to check
|
|
71
|
+
* @returns true if value is valid
|
|
72
|
+
*/
|
|
73
|
+
isValidValue(value) {
|
|
74
|
+
return value === '' || isHex(value);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Used to show a warning when the value does not pass the validation
|
|
78
|
+
* @param value that is invalid
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
warnInvalidValue(value) {
|
|
82
|
+
new WarningNotice(`The specified value "${value}" is not valid value. The correct value should look like "#fff" or "#ffffff".`).show();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Return true if popup can be opened
|
|
86
|
+
*/
|
|
87
|
+
get canOpenPopup() {
|
|
88
|
+
return !(this.disabled || this.readonly);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Called after the component is first rendered
|
|
92
|
+
* @param changedProperties Properties which have changed
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
firstUpdated(changedProperties) {
|
|
96
|
+
super.firstUpdated(changedProperties);
|
|
97
|
+
this.addEventListener('tap', this.onTap);
|
|
98
|
+
this.addEventListener('keydown', this.onKeyDown);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Updates the element
|
|
102
|
+
* @param changedProperties Properties that has changed
|
|
103
|
+
* @returns {void}
|
|
104
|
+
*/
|
|
105
|
+
update(changedProperties) {
|
|
106
|
+
if (changedProperties.has('opened') && this.opened) {
|
|
107
|
+
this.lazyRendered = true;
|
|
108
|
+
}
|
|
109
|
+
// make sure to close dialog for disabled
|
|
110
|
+
if (this.opened && !this.canOpenPopup) {
|
|
111
|
+
this.opened = false; /* this cannot be nor stopped nor listened */
|
|
112
|
+
}
|
|
113
|
+
super.update(changedProperties);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Run on tap event
|
|
117
|
+
* @param event Tap event
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
onTap(event) {
|
|
121
|
+
const path = event.composedPath();
|
|
122
|
+
if ((this.dialogEl && path.includes(this.dialogEl)) || event.defaultPrevented) {
|
|
123
|
+
return; /* dialog is managed separately */
|
|
124
|
+
}
|
|
125
|
+
this.setOpened(!this.opened);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Handles key input on color picker
|
|
129
|
+
* @param event Key down event object
|
|
130
|
+
* @returns {void}
|
|
131
|
+
*/
|
|
132
|
+
onKeyDown(event) {
|
|
133
|
+
if (event.defaultPrevented) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
switch (event.key) {
|
|
137
|
+
case 'Enter':
|
|
138
|
+
case ' ':
|
|
139
|
+
case 'Spacebar':
|
|
140
|
+
this.setOpened(true);
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Set opened state with event
|
|
149
|
+
* @param opened True if opened
|
|
150
|
+
* @returns {void}
|
|
151
|
+
*/
|
|
152
|
+
setOpened(opened) {
|
|
153
|
+
if (opened && !this.canOpenPopup) { /* never allow to open popup if cannot do so */
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (this.opened !== opened) {
|
|
157
|
+
this.opened = opened;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Run on color dialog value-changed event
|
|
162
|
+
* @param event value-changed event
|
|
163
|
+
* @returns {void}
|
|
164
|
+
*/
|
|
165
|
+
onColorDialogValueChanged(event) {
|
|
166
|
+
const value = event.detail.value;
|
|
167
|
+
this.value = value;
|
|
168
|
+
this.setAttribute('value', this.value);
|
|
169
|
+
this.notifyPropertyChange('value', this.value);
|
|
170
|
+
this.setOpened(false);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Run on color dialog opened-changed event
|
|
174
|
+
* @param event opened-changed event
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
onColorDialogOpenedChanged(event) {
|
|
178
|
+
this.setOpened(event.detail.value);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Color dialog template
|
|
182
|
+
*/
|
|
183
|
+
get dialogTemplate() {
|
|
184
|
+
if (this.lazyRendered) {
|
|
185
|
+
return html `<ef-color-dialog
|
|
186
|
+
offset="4"
|
|
187
|
+
part="dialog"
|
|
188
|
+
.lang=${ifDefined(this.lang || undefined)}
|
|
189
|
+
.value=${this.value}
|
|
190
|
+
.focusBoundary=${this}
|
|
191
|
+
.positionTarget=${this}
|
|
192
|
+
.position=${DIALOG_POSITION}
|
|
193
|
+
.withBackdrop=${false}
|
|
194
|
+
?opened=${this.opened}
|
|
195
|
+
?allow-nocolor=${this.allowNocolor}
|
|
196
|
+
@opened-changed=${this.onColorDialogOpenedChanged}
|
|
197
|
+
@value-changed=${this.onColorDialogValueChanged}></ef-color-dialog>`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Color item template
|
|
202
|
+
*/
|
|
203
|
+
get colorItemTemplate() {
|
|
204
|
+
return html `<div part="color-item" ?no-color=${!this.value} style=${styleMap({ backgroundColor: this.value })}></div>`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A `TemplateResult` that will be used
|
|
208
|
+
* to render the updated internal template.
|
|
209
|
+
* @return Render template
|
|
210
|
+
*/
|
|
211
|
+
render() {
|
|
212
|
+
return html `
|
|
213
|
+
${this.colorItemTemplate}
|
|
214
|
+
${this.dialogTemplate}
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean, attribute: 'allow-nocolor' })
|
|
220
|
+
], ColorPicker.prototype, "allowNocolor", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: String })
|
|
223
|
+
], ColorPicker.prototype, "lang", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property({ type: Boolean, reflect: true })
|
|
226
|
+
], ColorPicker.prototype, "opened", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
query('[part=dialog]')
|
|
229
|
+
], ColorPicker.prototype, "dialogEl", void 0);
|
|
230
|
+
ColorPicker = __decorate([
|
|
231
|
+
customElement('ef-color-picker', {
|
|
232
|
+
alias: 'emerald-color-picker'
|
|
233
|
+
})
|
|
234
|
+
], ColorPicker);
|
|
235
|
+
export { ColorPicker };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/halo/dark';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:24px;min-width:24px;border:1px solid #404040}:host([disabled]),:host([readonly]){border-color:rgba(64,64,64,.5)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#334bff}:host(:not([readonly]):not([disabled]):not([focused]):hover){border-color:grey}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/halo/light';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:24px;min-width:24px;border:1px solid #595959}:host([disabled]),:host([readonly]){border-color:rgba(89,89,89,.5)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#334bff}:host(:not([readonly]):not([disabled]):not([focused]):hover){border-color:#0d0d0d}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/solar/charcoal';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:23px;min-width:23px;border:1px solid #4a4a52}:host([disabled]),:host([readonly]){border-color:rgba(74,74,82,.6)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#f93;border-style:dotted}');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@refinitiv-ui/elements/color-dialog/themes/solar/pearl';
|
|
2
|
+
|
|
3
|
+
elf.customStyles.define('ef-color-picker', ':host{outline:0;box-sizing:border-box;height:23px;min-width:23px;border:1px solid #a9afba}:host([disabled]),:host([readonly]){border-color:rgba(169,175,186,.6)}:host [part=color-item]{cursor:pointer;height:100%}:host([disabled]) [part=color-item],:host([readonly]) [part=color-item]{pointer-events:none}:host([focused=visible]){border-color:#f93;border-style:dotted}');
|
package/lib/combo-box/index.js
CHANGED
|
@@ -802,7 +802,10 @@ let ComboBox = class ComboBox extends FormFieldElement {
|
|
|
802
802
|
this.freeTextValue = inputText;
|
|
803
803
|
this.notifyPropertyChange('value', inputText);
|
|
804
804
|
}
|
|
805
|
-
|
|
805
|
+
// The popup can only be opened if input element has focus
|
|
806
|
+
if (this.shadowRoot && this.shadowRoot.activeElement === this.inputElement) {
|
|
807
|
+
this.setOpened(true);
|
|
808
|
+
}
|
|
806
809
|
}
|
|
807
810
|
/**
|
|
808
811
|
* Handle list value changed
|
package/lib/dialog/index.d.ts
CHANGED
|
@@ -85,12 +85,14 @@ export declare class Dialog extends Overlay {
|
|
|
85
85
|
private footerElement;
|
|
86
86
|
noCancelOnOutsideClick: boolean;
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* @ignore
|
|
89
|
+
* Hiding from document to avoid property overridden
|
|
90
|
+
*/
|
|
90
91
|
withBackdrop: boolean;
|
|
91
92
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
* @ignore
|
|
94
|
+
* Hiding from document to avoid property overridden
|
|
95
|
+
*/
|
|
94
96
|
withShadow: boolean;
|
|
95
97
|
disconnectedCallback(): void;
|
|
96
98
|
/**
|
package/lib/dialog/index.js
CHANGED
|
@@ -61,12 +61,14 @@ let Dialog = class Dialog extends Overlay {
|
|
|
61
61
|
this.draggable = false;
|
|
62
62
|
this.noCancelOnOutsideClick = true;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
* @ignore
|
|
65
|
+
* Hiding from document to avoid property overridden
|
|
66
|
+
*/
|
|
66
67
|
this.withBackdrop = true;
|
|
67
68
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
* @ignore
|
|
70
|
+
* Hiding from document to avoid property overridden
|
|
71
|
+
*/
|
|
70
72
|
this.withShadow = true;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
@@ -345,6 +347,12 @@ __decorate([
|
|
|
345
347
|
__decorate([
|
|
346
348
|
query('[part=footer]')
|
|
347
349
|
], Dialog.prototype, "footerElement", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
property({ type: Boolean, attribute: false })
|
|
352
|
+
], Dialog.prototype, "withBackdrop", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
property({ type: Boolean, reflect: true, attribute: 'with-shadow' })
|
|
355
|
+
], Dialog.prototype, "withShadow", void 0);
|
|
348
356
|
Dialog = __decorate([
|
|
349
357
|
customElement('ef-dialog', {
|
|
350
358
|
alias: 'coral-dialog'
|