@rogieking/figui3 1.0.53 → 1.0.54
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 +14 -0
- package/fig.css +1 -1
- package/fig.js +2 -2
- package/package.json +1 -1
package/example.html
CHANGED
|
@@ -91,6 +91,20 @@
|
|
|
91
91
|
</fig-tooltip>
|
|
92
92
|
</hstack>
|
|
93
93
|
<br />
|
|
94
|
+
<fig-field direction="horizontal">
|
|
95
|
+
<label>Grouped options</label>
|
|
96
|
+
<fig-dropdown>
|
|
97
|
+
<optgroup label="Numbers">
|
|
98
|
+
<option>One</option>
|
|
99
|
+
<option>Two</option>
|
|
100
|
+
</optgroup>
|
|
101
|
+
<optgroup label="Fruits">
|
|
102
|
+
<option>Apple</option>
|
|
103
|
+
<option>Banana</option>
|
|
104
|
+
</optgroup>
|
|
105
|
+
</fig-dropdown>
|
|
106
|
+
</fig-field>
|
|
107
|
+
<br />
|
|
94
108
|
<fig-field direction="horizontal">
|
|
95
109
|
<label>Dropdown</label>
|
|
96
110
|
<fig-dropdown>
|
package/fig.css
CHANGED
package/fig.js
CHANGED
|
@@ -98,13 +98,12 @@ class FigDropdown extends HTMLElement {
|
|
|
98
98
|
connectedCallback() {
|
|
99
99
|
this.type = this.getAttribute("type") || "select";
|
|
100
100
|
this.value = this.getAttribute("value") || "";
|
|
101
|
+
|
|
101
102
|
this.select = document.createElement("select");
|
|
102
103
|
this.optionsSlot = document.createElement("slot");
|
|
103
|
-
|
|
104
104
|
this.appendChild(this.select);
|
|
105
105
|
this.shadowRoot.appendChild(this.optionsSlot);
|
|
106
106
|
|
|
107
|
-
// Move slotted options into the select element
|
|
108
107
|
this.optionsSlot.addEventListener("slotchange", this.slotChange.bind(this));
|
|
109
108
|
|
|
110
109
|
this.select.addEventListener("input", this.handleDropdownInput.bind(this));
|
|
@@ -132,6 +131,7 @@ class FigDropdown extends HTMLElement {
|
|
|
132
131
|
this.select.selectedIndex = -1;
|
|
133
132
|
}
|
|
134
133
|
}
|
|
134
|
+
|
|
135
135
|
handleDropdownInput() {
|
|
136
136
|
if (this.type === "dropdown") {
|
|
137
137
|
this.value = this.select.value;
|
package/package.json
CHANGED