@vonage/vivid 5.4.0 → 5.5.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/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +2 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +2 -2
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +217 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +83 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +114 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +87 -84
- package/bundled/definition2.cjs +9 -9
- package/bundled/definition2.js +84 -129
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -1
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +48 -35
- package/bundled/mixins.cjs +1 -1
- package/bundled/mixins.js +1 -1
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +35 -56
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +13 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +172 -144
- package/color-picker/definition.cjs +208 -112
- package/color-picker/definition.js +208 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +49 -0
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +139 -0
- package/dial-pad/definition.js +139 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +177 -100
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/locales/de-DE.cjs +16 -3
- package/locales/de-DE.js +16 -3
- package/locales/en-GB.cjs +17 -4
- package/locales/en-GB.js +17 -4
- package/locales/en-US.cjs +17 -4
- package/locales/en-US.js +17 -4
- package/locales/ja-JP.cjs +16 -3
- package/locales/ja-JP.js +16 -3
- package/locales/zh-CN.cjs +15 -2
- package/locales/zh-CN.js +15 -2
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +3 -3
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +3 -3
- package/select/definition.cjs +6 -3
- package/select/definition.js +6 -3
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/simple-color-picker/definition.cjs +8 -6
- package/simple-color-picker/definition.js +8 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +2 -2
- package/tooltip/definition.js +2 -2
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/unbundled/base-color-picker.cjs +36 -18
- package/unbundled/base-color-picker.js +36 -18
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/picker-field.template.cjs +2 -35
- package/unbundled/picker-field.template.js +2 -34
- package/unbundled/time-selection-picker.template.cjs +2 -1
- package/unbundled/time-selection-picker.template.js +2 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
"use strict";const m=require("./form-associated.cjs"),u=require("./vivid-element.cjs"),
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";const m=require("./form-associated.cjs"),u=require("./vivid-element.cjs"),g=require("./when.cjs"),y=require("./localized.cjs"),S=require("./form-element.cjs"),b=require("./class-names.cjs");function C(a){if(!a)return null;const s=a.trim().replace(/^#/,"");return/^[0-9a-fA-F]{3}$/.test(s)?s.split("").map(n=>n+n).join("").toLowerCase():/^[0-9a-fA-F]{6}$/.test(s)?s.toLowerCase():null}function I(a){return C(a)!==null}function w(a){const s=C(a);if(!s)return 0;const n=parseInt(s.slice(0,2),16)/255,t=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255,e=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return .2126*e+.7152*r+.0722*l}function B(a,s){const n=w(a),t=w(s),o=Math.max(n,t),e=Math.min(n,t);return(o+.05)/(e+.05)}function _(a,s){return s||(s=document.querySelector(".vvd-root")||document.documentElement),getComputedStyle(s).getPropertyValue(a).trim()}var $=Object.defineProperty,d=(a,s,n,t)=>{for(var o=void 0,e=a.length-1,r;e>=0;e--)(r=a[e])&&(o=r(s,n,o)||o);return o&&$(s,n,o),o};const A=a=>{class s extends y.Localized(S.FormElement(m.FormAssociated(a))){constructor(){super(...arguments),this.proxy=document.createElement("input"),this.open=!1,this.swatches=[],this._canvasColor=""}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._refreshCanvasColor()})}get _computedCanvasColor(){return this._canvasColor||(this._canvasColor=_("--vvd-color-canvas",this)),this._canvasColor}_refreshCanvasColor(){this._canvasColor=_("--vvd-color-canvas",this)}_applyContrastClass(t,o=3){if(!t)return!1;const e=this._computedCanvasColor;return e?B(t,e)<o:!1}_getRowLength(){return 7}_handleSwatchSelection(t){this.value===t?this.value="":this.value=t,this.$emit("change"),this.open=!1}_handleColorSaving(){}_getFocusReturnEl(){return null}_returnFocusToAnchor(){const t=this._getFocusReturnEl();t&&u.Updates.enqueue(()=>t.focus())}_getGridCells(){const t=this.shadowRoot?.querySelector('[role="grid"]');return t?Array.from(t.querySelectorAll('[role="gridcell"], [data-vvd-role="gridcell"]')):[]}_handleCellKeydown(t,o,e,r){const l=this._getRowLength(),c=this._getGridCells().length,h=Math.floor(e/l),f=e%l,p=Math.ceil(c/l);switch(t.key){case"ArrowRight":return f<l-1&&e+1<c&&this._focusSwatchByIndex(e+1),!1;case"ArrowLeft":return f>0&&this._focusSwatchByIndex(e-1),!1;case"ArrowDown":return h<p-1&&e+l<c&&this._focusSwatchByIndex(e+l),!1;case"ArrowUp":return h>0&&this._focusSwatchByIndex(e-l),!1;case"PageDown":{const i=(p-1)*l,v=Math.min(i+f,c-1);return e!==v&&this._focusSwatchByIndex(v),!1}case"PageUp":{const i=Math.min(f,c-1);return e!==i&&this._focusSwatchByIndex(i),!1}case"Home":return t.ctrlKey?this._focusSwatchByIndex(0):this._focusSwatchByIndex(h*l),!1;case"End":if(t.ctrlKey)this._focusSwatchByIndex(c-1);else{const i=Math.min((h+1)*l-1,c-1);this._focusSwatchByIndex(i)}return!1;case"Enter":case" ":return r&&this._handleColorSaving(),o&&!r&&(this._handleSwatchSelection(o),this._returnFocusToAnchor()),!1;case"Escape":return this.open=!1,this._returnFocusToAnchor(),!1;case"Tab":return this.open=!1,!0;default:return!0}}_focusSwatchByIndex(t){const o=this._getGridCells();t<0||t>=o.length||o[t]?.focus()}_renderColorSwatch(t,o){return u.html`
|
|
2
|
+
<${o} placement="top"
|
|
3
|
+
text="${e=>e.label??e.value}"
|
|
4
|
+
exportparts="vvd-theme-alternate">
|
|
5
|
+
<button
|
|
6
|
+
slot="anchor"
|
|
7
|
+
class="swatch ${(e,r)=>b.classNames(r.parent.value===e.value?"selected":"",r.parent._applyContrastClass(e.value)?"contrast":"")}"
|
|
8
|
+
role="gridcell"
|
|
9
|
+
style="--swatch-color: ${e=>e.value};"
|
|
10
|
+
tabindex="${(e,r)=>r.index===0?"0":"-1"}"
|
|
11
|
+
aria-label="${(e,r)=>r.parent.locale.baseColorPicker.colorSwatchLabel(e.value,e.label,r.parent.value===e.value)}"
|
|
12
|
+
@click="${(e,r)=>r.parent._handleSwatchSelection(e.value)}"
|
|
13
|
+
@keydown="${(e,r)=>r.parent._handleCellKeydown(r.event,e.value,r.index)}"
|
|
14
|
+
>
|
|
15
|
+
${g.when((e,r)=>r.parent.value===e.value,u.html`<${t} size="-6" name="check-solid" aria-hidden="true"></${t}>`)}
|
|
16
|
+
</button>
|
|
17
|
+
</${o}>
|
|
18
|
+
`}}return d([u.attr({mode:"boolean"})],s.prototype,"open"),d([u.observable],s.prototype,"swatches"),d([u.observable],s.prototype,"_canvasColor"),s};exports.BaseColorPicker=A;exports.isValidHexColor=I;
|
|
@@ -1,56 +1,66 @@
|
|
|
1
|
-
import { F as
|
|
2
|
-
import { U as
|
|
3
|
-
import { w as
|
|
4
|
-
import { L as
|
|
5
|
-
import { F as
|
|
6
|
-
import { c as
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
9
|
-
const s =
|
|
10
|
-
return /^[0-9a-fA-F]{3}$/.test(s) ? s.split("").map((
|
|
1
|
+
import { F as g } from "./form-associated.js";
|
|
2
|
+
import { U as y, h as m, a as S, o as w } from "./vivid-element.js";
|
|
3
|
+
import { w as b } from "./when.js";
|
|
4
|
+
import { L as I } from "./localized.js";
|
|
5
|
+
import { F as B } from "./form-element.js";
|
|
6
|
+
import { c as $ } from "./class-names.js";
|
|
7
|
+
function C(a) {
|
|
8
|
+
if (!a) return null;
|
|
9
|
+
const s = a.trim().replace(/^#/, "");
|
|
10
|
+
return /^[0-9a-fA-F]{3}$/.test(s) ? s.split("").map((n) => n + n).join("").toLowerCase() : /^[0-9a-fA-F]{6}$/.test(s) ? s.toLowerCase() : null;
|
|
11
11
|
}
|
|
12
|
-
function P(
|
|
13
|
-
return
|
|
12
|
+
function P(a) {
|
|
13
|
+
return C(a) !== null;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const s =
|
|
15
|
+
function _(a) {
|
|
16
|
+
const s = C(a);
|
|
17
17
|
if (!s) return 0;
|
|
18
|
-
const
|
|
19
|
-
return 0.2126 *
|
|
18
|
+
const n = parseInt(s.slice(0, 2), 16) / 255, t = parseInt(s.slice(2, 4), 16) / 255, o = parseInt(s.slice(4, 6), 16) / 255, e = n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4), r = t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4), l = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
19
|
+
return 0.2126 * e + 0.7152 * r + 0.0722 * l;
|
|
20
20
|
}
|
|
21
|
-
function A(
|
|
22
|
-
const
|
|
23
|
-
return (
|
|
21
|
+
function A(a, s) {
|
|
22
|
+
const n = _(a), t = _(s), o = Math.max(n, t), e = Math.min(n, t);
|
|
23
|
+
return (o + 0.05) / (e + 0.05);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return s || (s = document.querySelector(".vvd-root") || document.documentElement), getComputedStyle(s).getPropertyValue(
|
|
25
|
+
function v(a, s) {
|
|
26
|
+
return s || (s = document.querySelector(".vvd-root") || document.documentElement), getComputedStyle(s).getPropertyValue(a).trim();
|
|
27
27
|
}
|
|
28
|
-
var x = Object.defineProperty,
|
|
29
|
-
for (var
|
|
30
|
-
(
|
|
31
|
-
return
|
|
28
|
+
var x = Object.defineProperty, f = (a, s, n, t) => {
|
|
29
|
+
for (var o = void 0, e = a.length - 1, r; e >= 0; e--)
|
|
30
|
+
(r = a[e]) && (o = r(s, n, o) || o);
|
|
31
|
+
return o && x(s, n, o), o;
|
|
32
32
|
};
|
|
33
|
-
const q = (
|
|
34
|
-
class s extends
|
|
35
|
-
|
|
33
|
+
const q = (a) => {
|
|
34
|
+
class s extends I(
|
|
35
|
+
B(g(a))
|
|
36
36
|
) {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments), this.proxy = document.createElement("input"), this.open = !1, this.swatches = [], this._canvasColor = "";
|
|
39
39
|
}
|
|
40
40
|
connectedCallback() {
|
|
41
|
-
super.connectedCallback(),
|
|
41
|
+
super.connectedCallback(), requestAnimationFrame(() => {
|
|
42
|
+
this._refreshCanvasColor();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
get _computedCanvasColor() {
|
|
49
|
+
return this._canvasColor || (this._canvasColor = v("--vvd-color-canvas", this)), this._canvasColor;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* @internal
|
|
45
53
|
*/
|
|
46
54
|
_refreshCanvasColor() {
|
|
47
|
-
this._canvasColor =
|
|
55
|
+
this._canvasColor = v("--vvd-color-canvas", this);
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* @internal
|
|
51
59
|
*/
|
|
52
|
-
_applyContrastClass(
|
|
53
|
-
|
|
60
|
+
_applyContrastClass(t, o = 3) {
|
|
61
|
+
if (!t) return !1;
|
|
62
|
+
const e = this._computedCanvasColor;
|
|
63
|
+
return e ? A(t, e) < o : !1;
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
56
66
|
* @internal
|
|
@@ -61,8 +71,8 @@ const q = (o) => {
|
|
|
61
71
|
/**
|
|
62
72
|
* @internal
|
|
63
73
|
*/
|
|
64
|
-
_handleSwatchSelection(
|
|
65
|
-
this.value ===
|
|
74
|
+
_handleSwatchSelection(t) {
|
|
75
|
+
this.value === t ? this.value = "" : this.value = t, this.$emit("change"), this.open = !1;
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
78
|
* @internal
|
|
@@ -79,16 +89,16 @@ const q = (o) => {
|
|
|
79
89
|
* @internal
|
|
80
90
|
*/
|
|
81
91
|
_returnFocusToAnchor() {
|
|
82
|
-
const
|
|
83
|
-
|
|
92
|
+
const t = this._getFocusReturnEl();
|
|
93
|
+
t && y.enqueue(() => t.focus());
|
|
84
94
|
}
|
|
85
95
|
/**
|
|
86
96
|
* @internal
|
|
87
97
|
*/
|
|
88
98
|
_getGridCells() {
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
|
|
99
|
+
const t = this.shadowRoot?.querySelector('[role="grid"]');
|
|
100
|
+
return t ? Array.from(
|
|
101
|
+
t.querySelectorAll(
|
|
92
102
|
'[role="gridcell"], [data-vvd-role="gridcell"]'
|
|
93
103
|
)
|
|
94
104
|
) : [];
|
|
@@ -96,36 +106,36 @@ const q = (o) => {
|
|
|
96
106
|
/**
|
|
97
107
|
* @internal
|
|
98
108
|
*/
|
|
99
|
-
_handleCellKeydown(
|
|
100
|
-
const
|
|
101
|
-
switch (
|
|
109
|
+
_handleCellKeydown(t, o, e, r) {
|
|
110
|
+
const l = this._getRowLength(), c = this._getGridCells().length, u = Math.floor(e / l), h = e % l, d = Math.ceil(c / l);
|
|
111
|
+
switch (t.key) {
|
|
102
112
|
case "ArrowRight":
|
|
103
|
-
return h <
|
|
113
|
+
return h < l - 1 && e + 1 < c && this._focusSwatchByIndex(e + 1), !1;
|
|
104
114
|
case "ArrowLeft":
|
|
105
|
-
return h > 0 && this._focusSwatchByIndex(
|
|
115
|
+
return h > 0 && this._focusSwatchByIndex(e - 1), !1;
|
|
106
116
|
case "ArrowDown":
|
|
107
|
-
return u <
|
|
117
|
+
return u < d - 1 && e + l < c && this._focusSwatchByIndex(e + l), !1;
|
|
108
118
|
case "ArrowUp":
|
|
109
|
-
return u > 0 && this._focusSwatchByIndex(
|
|
119
|
+
return u > 0 && this._focusSwatchByIndex(e - l), !1;
|
|
110
120
|
case "PageDown": {
|
|
111
|
-
const i = (
|
|
121
|
+
const i = (d - 1) * l, p = Math.min(
|
|
112
122
|
i + h,
|
|
113
123
|
c - 1
|
|
114
124
|
);
|
|
115
|
-
return
|
|
125
|
+
return e !== p && this._focusSwatchByIndex(p), !1;
|
|
116
126
|
}
|
|
117
127
|
case "PageUp": {
|
|
118
128
|
const i = Math.min(h, c - 1);
|
|
119
|
-
return
|
|
129
|
+
return e !== i && this._focusSwatchByIndex(i), !1;
|
|
120
130
|
}
|
|
121
131
|
case "Home":
|
|
122
|
-
return
|
|
132
|
+
return t.ctrlKey ? this._focusSwatchByIndex(0) : this._focusSwatchByIndex(u * l), !1;
|
|
123
133
|
case "End":
|
|
124
|
-
if (
|
|
134
|
+
if (t.ctrlKey)
|
|
125
135
|
this._focusSwatchByIndex(c - 1);
|
|
126
136
|
else {
|
|
127
137
|
const i = Math.min(
|
|
128
|
-
(u + 1) *
|
|
138
|
+
(u + 1) * l - 1,
|
|
129
139
|
c - 1
|
|
130
140
|
);
|
|
131
141
|
this._focusSwatchByIndex(i);
|
|
@@ -133,7 +143,7 @@ const q = (o) => {
|
|
|
133
143
|
return !1;
|
|
134
144
|
case "Enter":
|
|
135
145
|
case " ":
|
|
136
|
-
return
|
|
146
|
+
return r && this._handleColorSaving(), o && !r && (this._handleSwatchSelection(o), this._returnFocusToAnchor()), !1;
|
|
137
147
|
case "Escape":
|
|
138
148
|
return this.open = !1, this._returnFocusToAnchor(), !1;
|
|
139
149
|
case "Tab":
|
|
@@ -145,48 +155,55 @@ const q = (o) => {
|
|
|
145
155
|
/**
|
|
146
156
|
* @internal
|
|
147
157
|
*/
|
|
148
|
-
_focusSwatchByIndex(
|
|
149
|
-
const
|
|
150
|
-
|
|
158
|
+
_focusSwatchByIndex(t) {
|
|
159
|
+
const o = this._getGridCells();
|
|
160
|
+
t < 0 || t >= o.length || o[t]?.focus();
|
|
151
161
|
}
|
|
152
162
|
/**
|
|
153
163
|
* @internal
|
|
154
164
|
*/
|
|
155
|
-
_renderColorSwatch(
|
|
156
|
-
return
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
_renderColorSwatch(t, o) {
|
|
166
|
+
return m`
|
|
167
|
+
<${o} placement="top"
|
|
168
|
+
text="${(e) => e.label ?? e.value}"
|
|
169
|
+
exportparts="vvd-theme-alternate">
|
|
170
|
+
<button
|
|
171
|
+
slot="anchor"
|
|
172
|
+
class="swatch ${(e, r) => $(
|
|
173
|
+
r.parent.value === e.value ? "selected" : "",
|
|
174
|
+
r.parent._applyContrastClass(e.value) ? "contrast" : ""
|
|
161
175
|
)}"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
role="gridcell"
|
|
177
|
+
style="--swatch-color: ${(e) => e.value};"
|
|
178
|
+
tabindex="${(e, r) => r.index === 0 ? "0" : "-1"}"
|
|
179
|
+
aria-label="${(e, r) => r.parent.locale.baseColorPicker.colorSwatchLabel(
|
|
166
180
|
e.value,
|
|
167
181
|
e.label,
|
|
168
|
-
|
|
182
|
+
r.parent.value === e.value
|
|
169
183
|
)}"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
@click="${(e, r) => r.parent._handleSwatchSelection(e.value)}"
|
|
185
|
+
@keydown="${(e, r) => r.parent._handleCellKeydown(
|
|
186
|
+
r.event,
|
|
173
187
|
e.value,
|
|
174
|
-
|
|
188
|
+
r.index
|
|
175
189
|
)}"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(e,
|
|
179
|
-
|
|
190
|
+
>
|
|
191
|
+
${b(
|
|
192
|
+
(e, r) => r.parent.value === e.value,
|
|
193
|
+
m`<${t} size="-6" name="check-solid" aria-hidden="true"></${t}>`
|
|
180
194
|
)}
|
|
181
|
-
|
|
195
|
+
</button>
|
|
196
|
+
</${o}>
|
|
182
197
|
`;
|
|
183
198
|
}
|
|
184
199
|
}
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
], s.prototype, "open"),
|
|
188
|
-
|
|
189
|
-
], s.prototype, "swatches"),
|
|
200
|
+
return f([
|
|
201
|
+
S({ mode: "boolean" })
|
|
202
|
+
], s.prototype, "open"), f([
|
|
203
|
+
w
|
|
204
|
+
], s.prototype, "swatches"), f([
|
|
205
|
+
w
|
|
206
|
+
], s.prototype, "_canvasColor"), s;
|
|
190
207
|
};
|
|
191
208
|
export {
|
|
192
209
|
q as B,
|