@rogieking/figui3 1.0.50 → 1.0.52
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/example.html +8 -0
- package/fig.css +3 -2
- package/fig.js +12 -13
- package/package.json +1 -1
package/example.html
CHANGED
|
@@ -44,6 +44,14 @@
|
|
|
44
44
|
<fig-button>Primary</fig-button>
|
|
45
45
|
<fig-button variant="secondary">Secondary</fig-button>
|
|
46
46
|
<fig-button variant="ghost">Ghost</fig-button>
|
|
47
|
+
<fig-button type="select">
|
|
48
|
+
Select
|
|
49
|
+
<fig-dropdown>
|
|
50
|
+
<option>One</option>
|
|
51
|
+
<option>Two</option>
|
|
52
|
+
</fig-dropdown>
|
|
53
|
+
</fig-button>
|
|
54
|
+
|
|
47
55
|
<fig-button variant="ghost"
|
|
48
56
|
type="upload">
|
|
49
57
|
Upload
|
package/fig.css
CHANGED
package/fig.js
CHANGED
|
@@ -1129,16 +1129,17 @@ class FigCheckbox extends HTMLElement {
|
|
|
1129
1129
|
constructor() {
|
|
1130
1130
|
super();
|
|
1131
1131
|
this.input = document.createElement("input");
|
|
1132
|
+
this.name = this.getAttribute("name") || "checkbox";
|
|
1133
|
+
this.value = this.getAttribute("value") || "";
|
|
1132
1134
|
this.input.setAttribute("id", uniqueId());
|
|
1133
|
-
this.input.setAttribute("name", this.
|
|
1135
|
+
this.input.setAttribute("name", this.name);
|
|
1134
1136
|
this.input.setAttribute("type", "checkbox");
|
|
1135
1137
|
this.labelElement = document.createElement("label");
|
|
1136
1138
|
this.labelElement.setAttribute("for", this.input.id);
|
|
1137
1139
|
}
|
|
1138
1140
|
connectedCallback() {
|
|
1139
|
-
this.checked = this.input.checked =
|
|
1140
|
-
|
|
1141
|
-
: false;
|
|
1141
|
+
this.checked = this.input.checked =
|
|
1142
|
+
this.hasAttribute("checked") && this.getAttribute("checked") !== "false";
|
|
1142
1143
|
this.input.addEventListener("change", this.handleInput.bind(this));
|
|
1143
1144
|
|
|
1144
1145
|
if (this.hasAttribute("disabled")) {
|
|
@@ -1155,7 +1156,7 @@ class FigCheckbox extends HTMLElement {
|
|
|
1155
1156
|
this.render();
|
|
1156
1157
|
}
|
|
1157
1158
|
static get observedAttributes() {
|
|
1158
|
-
return ["
|
|
1159
|
+
return ["disabled", "label", "checked", "name", "value"];
|
|
1159
1160
|
}
|
|
1160
1161
|
|
|
1161
1162
|
render() {}
|
|
@@ -1174,12 +1175,13 @@ class FigCheckbox extends HTMLElement {
|
|
|
1174
1175
|
this.labelElement.innerText = newValue;
|
|
1175
1176
|
break;
|
|
1176
1177
|
case "checked":
|
|
1177
|
-
this.checked = this.input.checked =
|
|
1178
|
-
|
|
1179
|
-
|
|
1178
|
+
this.checked = this.input.checked =
|
|
1179
|
+
this.hasAttribute("checked") &&
|
|
1180
|
+
this.getAttribute("checked") !== "false";
|
|
1181
|
+
|
|
1180
1182
|
break;
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
+
default:
|
|
1184
|
+
this.input[name] = newValue;
|
|
1183
1185
|
this.input.setAttribute(name, newValue);
|
|
1184
1186
|
break;
|
|
1185
1187
|
}
|
|
@@ -1207,9 +1209,6 @@ window.customElements.define("fig-radio", FigRadio);
|
|
|
1207
1209
|
class FigSwitch extends FigCheckbox {
|
|
1208
1210
|
render() {
|
|
1209
1211
|
this.input.setAttribute("class", "switch");
|
|
1210
|
-
this.on = this.input.checked = this.hasAttribute("on")
|
|
1211
|
-
? this.getAttribute("on").toLowerCase() === "true"
|
|
1212
|
-
: false;
|
|
1213
1212
|
}
|
|
1214
1213
|
}
|
|
1215
1214
|
window.customElements.define("fig-switch", FigSwitch);
|
package/package.json
CHANGED