@umbraco-ui/uui-color-swatch 1.10.0 → 1.11.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/custom-elements.json +18 -5
- package/lib/index.js +12 -4
- package/lib/uui-color-swatch.element.d.ts +11 -3
- package/package.json +4 -4
package/custom-elements.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"name": "uui-color-swatch",
|
|
6
6
|
"path": "./lib/uui-color-swatch.element.ts",
|
|
7
|
-
"description": "Color swatch, can have label and be selectable.",
|
|
7
|
+
"description": "Color swatch, can have label and be selectable, disabled or readonly.",
|
|
8
8
|
"attributes": [
|
|
9
9
|
{
|
|
10
10
|
"name": "value",
|
|
@@ -18,9 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"name": "disabled",
|
|
21
|
-
"description": "
|
|
21
|
+
"description": "Sets the swatch to disabled.",
|
|
22
22
|
"type": "boolean",
|
|
23
|
-
"default": "false"
|
|
23
|
+
"default": "\"false\""
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "readonly",
|
|
27
|
+
"description": "Sets the swatch to readonly mode.",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"default": "\"false\""
|
|
24
30
|
},
|
|
25
31
|
{
|
|
26
32
|
"name": "show-label",
|
|
@@ -67,9 +73,16 @@
|
|
|
67
73
|
{
|
|
68
74
|
"name": "disabled",
|
|
69
75
|
"attribute": "disabled",
|
|
70
|
-
"description": "
|
|
76
|
+
"description": "Sets the swatch to disabled.",
|
|
71
77
|
"type": "boolean",
|
|
72
|
-
"default": "false"
|
|
78
|
+
"default": "\"false\""
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "readonly",
|
|
82
|
+
"attribute": "readonly",
|
|
83
|
+
"description": "Sets the swatch to readonly mode.",
|
|
84
|
+
"type": "boolean",
|
|
85
|
+
"default": "\"false\""
|
|
73
86
|
},
|
|
74
87
|
{
|
|
75
88
|
"name": "showLabel",
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ let UUIColorSwatchElement = class extends LabelMixin(
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
this.disabled = false;
|
|
24
|
+
this.readonly = false;
|
|
24
25
|
this.showLabel = false;
|
|
25
26
|
this.addEventListener("click", this._setAriaAttributes);
|
|
26
27
|
}
|
|
@@ -48,10 +49,10 @@ let UUIColorSwatchElement = class extends LabelMixin(
|
|
|
48
49
|
this._setAriaAttributes();
|
|
49
50
|
}
|
|
50
51
|
willUpdate(changedProperties) {
|
|
51
|
-
if (changedProperties.has("disabled")) {
|
|
52
|
+
if (changedProperties.has("disabled") || changedProperties.has("readonly")) {
|
|
52
53
|
if (this.selectable) {
|
|
53
|
-
this.selectable = !this.disabled;
|
|
54
|
-
this.deselectable = !this.disabled;
|
|
54
|
+
this.selectable = !this.disabled && !this.readonly;
|
|
55
|
+
this.deselectable = !this.disabled && !this.readonly;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
if (changedProperties.has("selectable") || changedProperties.has("selected")) {
|
|
@@ -63,7 +64,7 @@ let UUIColorSwatchElement = class extends LabelMixin(
|
|
|
63
64
|
<button
|
|
64
65
|
id="swatch"
|
|
65
66
|
aria-label=${this.label}
|
|
66
|
-
|
|
67
|
+
?disabled="${this.disabled}"
|
|
67
68
|
title="${this.label}">
|
|
68
69
|
<div class="color-swatch color-swatch--transparent-bg">
|
|
69
70
|
<div
|
|
@@ -126,6 +127,10 @@ UUIColorSwatchElement.styles = [
|
|
|
126
127
|
opacity: 0.5;
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
:host([readonly]) {
|
|
131
|
+
cursor: default;
|
|
132
|
+
}
|
|
133
|
+
|
|
129
134
|
#swatch {
|
|
130
135
|
cursor: inherit;
|
|
131
136
|
outline: none;
|
|
@@ -261,6 +266,9 @@ __decorateClass([
|
|
|
261
266
|
__decorateClass([
|
|
262
267
|
property({ type: Boolean, reflect: true })
|
|
263
268
|
], UUIColorSwatchElement.prototype, "disabled", 2);
|
|
269
|
+
__decorateClass([
|
|
270
|
+
property({ type: Boolean, reflect: true })
|
|
271
|
+
], UUIColorSwatchElement.prototype, "readonly", 2);
|
|
264
272
|
__decorateClass([
|
|
265
273
|
property({ type: Boolean, attribute: "show-label", reflect: true })
|
|
266
274
|
], UUIColorSwatchElement.prototype, "showLabel", 2);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
declare const UUIColorSwatchElement_base: (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").LabelMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").SelectableMixinInterface) & (new (...args: any[]) => import("@umbraco-ui/uui-base/lib/mixins").ActiveMixinInterface) & typeof LitElement;
|
|
3
3
|
/**
|
|
4
|
-
* Color swatch, can have label and be selectable.
|
|
4
|
+
* Color swatch, can have label and be selectable, disabled or readonly.
|
|
5
5
|
*
|
|
6
6
|
* @element uui-color-swatch
|
|
7
7
|
* @cssprop --uui-swatch-size - The size of the swatch.
|
|
@@ -23,11 +23,19 @@ export declare class UUIColorSwatchElement extends UUIColorSwatchElement_base {
|
|
|
23
23
|
set color(newValue: string);
|
|
24
24
|
private _color?;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Sets the swatch to disabled.
|
|
27
|
+
* @type {boolean}
|
|
28
28
|
* @attr
|
|
29
|
+
* @default false
|
|
29
30
|
*/
|
|
30
31
|
disabled: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the swatch to readonly mode.
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @attr
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
readonly: boolean;
|
|
31
39
|
/**
|
|
32
40
|
* When true shows element label below the color checkbox
|
|
33
41
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-color-swatch",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.
|
|
34
|
-
"@umbraco-ui/uui-icon-registry-essential": "1.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.11.0",
|
|
34
|
+
"@umbraco-ui/uui-icon-registry-essential": "1.11.0",
|
|
35
35
|
"colord": "^2.9.3"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-color-swatch",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "414ce88901f82c5fc7d6be942779047bb34a1407"
|
|
47
47
|
}
|