wj-elements 0.1.100 → 0.1.101
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/dist/wje-option.js +13 -2
- package/package.json +1 -1
package/dist/wje-option.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import WJElement, { event } from "./wje-element.js";
|
|
8
8
|
import Icon from "./wje-icon.js";
|
|
9
|
-
const styles = '/*\r\n[ WJ Option ]\r\n*/\r\n\r\n:host {\r\n display: block;\r\n wje-icon {\r\n visibility: hidden;\r\n margin-inline: 0.5rem;\r\n }\r\n}\r\n\r\n:host([selected]) {\r\n wje-icon {\r\n visibility: visible;\r\n }\r\n}\r\n\r\n.native-option {\r\n display: flex;\r\n align-items: center;\r\n padding-top: var(--wje-option-padding-top);\r\n padding-bottom: var(--wje-option-padding-bottom);\r\n}\r\n\r\n.native-option:hover {\r\n background-color: var(--wje-option-highlighted);\r\n}\r\n\r\n::slotted([slot="start"]) {\r\n flex: 0 0 auto;\r\n display: flex;\r\n align-items: center;\r\n margin-inline-end: .5rem;\r\n}\r\n\r\n::slotted([slot="end"]) {\r\n flex: 0 0 auto;\r\n display: flex;\r\n align-items: center;\r\n margin-inline: auto .5rem;\r\n}';
|
|
9
|
+
const styles = '/*\r\n[ WJ Option ]\r\n*/\r\n\r\n:host {\r\n display: block;\r\n wje-icon {\r\n visibility: hidden;\r\n margin-inline: 0.5rem;\r\n }\r\n}\r\n\r\n:host([selected]) {\r\n wje-icon {\r\n visibility: visible;\r\n }\r\n}\r\n\r\n:host([disabled]){\r\n background-color: lightgray;\r\n opacity: .3;\r\n pointer-events: none;\r\n cursor: not-allowed;\r\n}\r\n\r\n.native-option {\r\n display: flex;\r\n align-items: center;\r\n padding-top: var(--wje-option-padding-top);\r\n padding-bottom: var(--wje-option-padding-bottom);\r\n}\r\n\r\n.native-option:hover {\r\n background-color: var(--wje-option-highlighted);\r\n}\r\n\r\n::slotted([slot="start"]) {\r\n flex: 0 0 auto;\r\n display: flex;\r\n align-items: center;\r\n margin-inline-end: .5rem;\r\n}\r\n\r\n::slotted([slot="end"]) {\r\n flex: 0 0 auto;\r\n display: flex;\r\n align-items: center;\r\n margin-inline: auto .5rem;\r\n}';
|
|
10
10
|
class Option extends WJElement {
|
|
11
11
|
/**
|
|
12
12
|
* Creates an instance of Option.
|
|
@@ -102,7 +102,18 @@ class Option extends WJElement {
|
|
|
102
102
|
* Adds event listeners after the component is drawn.
|
|
103
103
|
*/
|
|
104
104
|
afterDraw() {
|
|
105
|
-
event.addListener(this, "click",
|
|
105
|
+
event.addListener(this, "click", null, (e, b, c) => {
|
|
106
|
+
if (this.hasAttribute("disabled"))
|
|
107
|
+
return;
|
|
108
|
+
this.dispatchEvent(new CustomEvent("wje-option:change", {
|
|
109
|
+
bubbles: true,
|
|
110
|
+
composed: true,
|
|
111
|
+
detail: {
|
|
112
|
+
value: this.value,
|
|
113
|
+
text: this.text
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
Option.define("wje-option", Option);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
3
|
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.101",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|