@refinitiv-ui/elements 0.0.0-dev.2589386127.1 → 0.0.0-dev.2997969095.1
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 +64 -0
- package/lib/calendar/index.js +6 -5
- package/lib/calendar/themes/halo/dark/index.js +1 -1
- package/lib/calendar/themes/halo/light/index.js +1 -1
- 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.d.ts +1 -0
- package/lib/combo-box/index.js +8 -4
- package/lib/datetime-picker/index.js +11 -6
- package/lib/dialog/index.d.ts +6 -4
- package/lib/dialog/index.js +12 -4
- package/lib/interactive-chart/helpers/types.d.ts +1 -0
- package/lib/interactive-chart/index.js +4 -2
- package/lib/list/elements/list-item.d.ts +30 -0
- package/lib/list/elements/list-item.js +19 -0
- package/lib/list/elements/list.d.ts +307 -0
- package/lib/list/elements/list.js +632 -0
- package/lib/list/helpers/renderer.d.ts +0 -1
- package/lib/list/helpers/renderer.js +1 -3
- package/lib/list/index.d.ts +3 -317
- package/lib/list/index.js +3 -641
- package/lib/list/themes/halo/dark/index.js +4 -1
- package/lib/list/themes/halo/light/index.js +4 -1
- package/lib/list/themes/solar/charcoal/index.js +4 -1
- package/lib/list/themes/solar/pearl/index.js +4 -1
- package/lib/overlay/managers/focus-manager.js +2 -2
- package/lib/radio-button/index.js +2 -2
- package/lib/tab-bar/index.d.ts +13 -8
- package/lib/tab-bar/index.js +26 -15
- package/lib/tab-bar/themes/halo/dark/index.js +1 -0
- package/lib/tab-bar/themes/halo/light/index.js +1 -0
- package/lib/tab-bar/themes/solar/charcoal/index.js +1 -0
- package/lib/tab-bar/themes/solar/pearl/index.js +1 -0
- package/lib/tree/elements/tree-item.d.ts +4 -0
- package/lib/tree/elements/tree-item.js +4 -0
- package/lib/tree/elements/tree.d.ts +1 -0
- package/lib/tree/elements/tree.js +1 -0
- package/lib/tree/helpers/renderer.d.ts +0 -1
- package/lib/tree/helpers/renderer.js +0 -2
- package/lib/tree/themes/halo/dark/index.js +1 -2
- package/lib/tree/themes/halo/light/index.js +1 -2
- package/lib/tree/themes/solar/charcoal/index.js +1 -2
- package/lib/tree/themes/solar/pearl/index.js +1 -2
- package/lib/version.js +1 -1
- package/package.json +21 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,70 @@
|
|
|
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.1.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.1.0...@refinitiv-ui/elements@6.1.1) (2022-08-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **combo-box:** incorrect popup logic in some scenarios ([159eb53](https://github.com/Refinitiv/refinitiv-ui/commit/159eb53c7bec583c59de4dfac2542e67c840b2fc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **datetime-picker:** parse invalid value to date object ([#422](https://github.com/Refinitiv/refinitiv-ui/issues/422)) ([dd86b73](https://github.com/Refinitiv/refinitiv-ui/commit/dd86b73fecd03518d2dae78174b91b0ef50fc913))
|
|
23
|
+
* **overlay:** Tab does not work with slotted elements ([16f4b60](https://github.com/Refinitiv/refinitiv-ui/commit/16f4b60e9b840d3b7d225f3d61f15e017dc17855))
|
|
24
|
+
* **radio-button:** check-changed is not fired on arrow keys ([77d7407](https://github.com/Refinitiv/refinitiv-ui/commit/77d7407883ba77e7b07bdaa8483fc49d35c76c14))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **interactive-chart:** add disabledLegend option to hide data legend ([#421](https://github.com/Refinitiv/refinitiv-ui/issues/421)) ([32a6d7b](https://github.com/Refinitiv/refinitiv-ui/commit/32a6d7b1889597a7ae804edbb08fc95fc5c5a04e))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [6.0.4](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.3...@refinitiv-ui/elements@6.0.4) (2022-08-02)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* **calendar:** day cell selected style not work with disabled state ([#410](https://github.com/Refinitiv/refinitiv-ui/issues/410)) ([1d9c931](https://github.com/Refinitiv/refinitiv-ui/commit/1d9c931b4d625b93c6fd60b780060ff2f03d9fc9))
|
|
41
|
+
* **interactive-chart:** show dash text when legend hided ([#402](https://github.com/Refinitiv/refinitiv-ui/issues/402)) ([93631ca](https://github.com/Refinitiv/refinitiv-ui/commit/93631cac4db0623f05c333b53f67728ace953039))
|
|
42
|
+
* **tab-bar:** notify value change event on pressing an arrow key ([#398](https://github.com/Refinitiv/refinitiv-ui/issues/398)) ([e55d152](https://github.com/Refinitiv/refinitiv-ui/commit/e55d152491b97c8763dc628ef7d1c013e4c3f01a))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [6.0.3](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.2...@refinitiv-ui/elements@6.0.3) (2022-07-20)
|
|
49
|
+
|
|
50
|
+
**Note:** Version bump only for package @refinitiv-ui/elements
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## [6.0.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.1...@refinitiv-ui/elements@6.0.2) (2022-07-19)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
* **accordion:** The element should interact only with its direct children ([#378](https://github.com/Refinitiv/refinitiv-ui/issues/378)) ([f8e11d3](https://github.com/Refinitiv/refinitiv-ui/commit/f8e11d391839cb1e53aad3ec2682a089766851ff))
|
|
62
|
+
* **list:** item should not receive focus when click ([#272](https://github.com/Refinitiv/refinitiv-ui/issues/272)) ([e2293e3](https://github.com/Refinitiv/refinitiv-ui/commit/e2293e37126a446d5c1d16be1e5eb503425534f3))
|
|
63
|
+
* **tab-bar:** resize callback is not fired when a new tab has been added ([#389](https://github.com/Refinitiv/refinitiv-ui/issues/389)) ([13408e1](https://github.com/Refinitiv/refinitiv-ui/commit/13408e15302a19cd614fdd5f1b4af9be5f1881bd))
|
|
64
|
+
* use `setAttribute` instead of `AriaMixins` for aria attributes ([#327](https://github.com/Refinitiv/refinitiv-ui/issues/327)) ([09f91fa](https://github.com/Refinitiv/refinitiv-ui/commit/09f91fafdef57fa26722ccf0e19f586833405cbb))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
6
70
|
## [6.0.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.0...@refinitiv-ui/elements@6.0.1) (2022-06-20)
|
|
7
71
|
|
|
8
72
|
|
package/lib/calendar/index.js
CHANGED
|
@@ -156,7 +156,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
156
156
|
[part~=cell-content]:not([tabindex]) {
|
|
157
157
|
pointer-events: none;
|
|
158
158
|
}
|
|
159
|
-
[part~=
|
|
159
|
+
[part~=selectable] {
|
|
160
160
|
cursor: pointer;
|
|
161
161
|
}
|
|
162
162
|
`;
|
|
@@ -307,7 +307,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
307
307
|
* @returns button HTML date button element or null
|
|
308
308
|
*/
|
|
309
309
|
getDateButtonByIndex(index) {
|
|
310
|
-
const elements = Array.from(this.renderRoot.querySelectorAll('[part~=cell] > [part~=
|
|
310
|
+
const elements = Array.from(this.renderRoot.querySelectorAll('[part~=cell] > [part~=selectable]'));
|
|
311
311
|
return elements.find((element) => this.isDateButton(element) && String(element.index) === String(index));
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
@@ -315,7 +315,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
315
315
|
* @returns button HTML date button element or null
|
|
316
316
|
*/
|
|
317
317
|
get activeDateButton() {
|
|
318
|
-
return this.renderRoot.querySelector('[part~=cell][active] > [part~=
|
|
318
|
+
return this.renderRoot.querySelector('[part~=cell][active] > [part~=selectable]');
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
321
|
* Return true if passed target is HTML
|
|
@@ -1118,7 +1118,8 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1118
1118
|
* @returns template result
|
|
1119
1119
|
*/
|
|
1120
1120
|
renderCell(cell) {
|
|
1121
|
-
const
|
|
1121
|
+
const isSelection = cell.value !== undefined;
|
|
1122
|
+
const isSelectable = isSelection && !cell.disabled;
|
|
1122
1123
|
return html `<div
|
|
1123
1124
|
role="gridcell"
|
|
1124
1125
|
part="cell ${cell.view}"
|
|
@@ -1140,7 +1141,7 @@ let Calendar = class Calendar extends ControlElement {
|
|
|
1140
1141
|
value: parse(cell.value),
|
|
1141
1142
|
view: this.renderView
|
|
1142
1143
|
}) : undefined)}"
|
|
1143
|
-
part="cell-content${
|
|
1144
|
+
part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
|
|
1144
1145
|
.value=${cell.value}
|
|
1145
1146
|
.index=${cell.index}>${cell.text}</div>
|
|
1146
1147
|
</div>`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/button/themes/halo/dark';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:active [part~=selection],:host [part~=cell][selected]:active [part~=selection],:host [part~=cell][today]:active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
|
|
3
|
+
elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@refinitiv-ui/elements/button/themes/halo/light';
|
|
2
2
|
|
|
3
|
-
elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:active [part~=selection],:host [part~=cell][selected]:active [part~=selection],:host [part~=cell][today]:active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
|
|
3
|
+
elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
|
|
@@ -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 };
|