@rogieking/figui3 1.9.1 → 1.9.3

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/components.css CHANGED
@@ -2159,7 +2159,8 @@ fig-input-color,
2159
2159
  fig-checkbox,
2160
2160
  fig-radio,
2161
2161
  fig-tab,
2162
- fig-tabs {
2162
+ fig-tabs,
2163
+ fig-segmented-control {
2163
2164
  display: inline-flex;
2164
2165
  gap: var(--spacer-2);
2165
2166
  user-select: none;
package/example.html CHANGED
@@ -28,6 +28,16 @@
28
28
  </fig-header>
29
29
 
30
30
 
31
+ <fig-field direction="horizontal">
32
+ <label>Position</label>
33
+ <fig-dropdown value="outside">
34
+ <option value="inside">Inside</option>
35
+ <option value="center">Center</option>
36
+ <option value="outside">Outside</option>
37
+ </fig-dropdown>
38
+ </fig-field>
39
+
40
+
31
41
 
32
42
 
33
43
 
@@ -346,7 +356,10 @@
346
356
  </fig-field>
347
357
  <fig-field>
348
358
  <label>Submit Button</label>
349
- <fig-button type="submit">Submit</fig-button>
359
+ <form action="https://www.google.com/search?q=rogie"
360
+ method="get">
361
+ <fig-button type="submit">Submit</fig-button>
362
+ </form>
350
363
  </fig-field>
351
364
  <fig-field>
352
365
  <label>Disabled Button</label>
@@ -978,6 +991,13 @@
978
991
  </fig-field>
979
992
  </fig-content>
980
993
 
994
+ <script>
995
+ document.addEventListener("input", (e) => {
996
+ console.log("input", e.target, e.target.value);
997
+ });
998
+
999
+ </script>
1000
+
981
1001
  </body>
982
1002
 
983
1003
  </html>
package/fig.js CHANGED
@@ -73,7 +73,10 @@ class FigButton extends HTMLElement {
73
73
  this.toggleAttribute("selected", !this.hasAttribute("selected"));
74
74
  }
75
75
  if (this.type === "submit") {
76
- this.closest("form").dispatchEvent(new Event("submit"));
76
+ let form = this.closest("form");
77
+ if (form) {
78
+ form.submit();
79
+ }
77
80
  }
78
81
  if (this.type === "link") {
79
82
  const href = this.getAttribute("href");
@@ -167,11 +170,25 @@ class FigDropdown extends HTMLElement {
167
170
  #handleSelectInput(e) {
168
171
  this.value = e.target.value;
169
172
  this.setAttribute("value", this.value);
173
+ this.dispatchEvent(
174
+ new CustomEvent("input", {
175
+ detail: this.value,
176
+ bubbles: true,
177
+ composed: true,
178
+ })
179
+ );
170
180
  }
171
- #handleSelectChange() {
181
+ #handleSelectChange(e) {
172
182
  if (this.type === "dropdown") {
173
183
  this.select.selectedIndex = -1;
174
184
  }
185
+ this.dispatchEvent(
186
+ new CustomEvent("change", {
187
+ detail: this.value,
188
+ bubbles: true,
189
+ composed: true,
190
+ })
191
+ );
175
192
  }
176
193
  focus() {
177
194
  this.select.focus();
@@ -405,10 +422,13 @@ class FigTooltip extends HTMLElement {
405
422
  hidePopup() {
406
423
  clearTimeout(this.timeout);
407
424
  clearTimeout(this.#touchTimeout);
408
- this.popup.style.opacity = "0";
409
- this.popup.style.display = "block";
410
- this.popup.style.pointerEvents = "none";
411
- this.destroy();
425
+ if (this.popup) {
426
+ this.popup.style.opacity = "0";
427
+ this.popup.style.display = "block";
428
+ this.popup.style.pointerEvents = "none";
429
+ this.destroy();
430
+ }
431
+
412
432
  this.isOpen = false;
413
433
  }
414
434
 
@@ -959,7 +979,9 @@ class FigSlider extends HTMLElement {
959
979
  if (this.figInputText) {
960
980
  this.value = this.input.value = this.figInputText.value;
961
981
  this.#syncProperties();
962
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
982
+ this.dispatchEvent(
983
+ new CustomEvent("input", { detail: this.value, bubbles: true })
984
+ );
963
985
  }
964
986
  }
965
987
  #calculateNormal(value) {
@@ -985,7 +1007,9 @@ class FigSlider extends HTMLElement {
985
1007
 
986
1008
  #handleInput() {
987
1009
  this.#syncValue();
988
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
1010
+ this.dispatchEvent(
1011
+ new CustomEvent("input", { detail: this.value, bubbles: true })
1012
+ );
989
1013
  }
990
1014
 
991
1015
  static get observedAttributes() {
@@ -1172,8 +1196,12 @@ class FigInputText extends HTMLElement {
1172
1196
  }
1173
1197
  this.value = value;
1174
1198
  this.input.value = valueTransformed;
1175
- this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
1176
- this.dispatchEvent(new CustomEvent("change", { bubbles: true }));
1199
+ this.dispatchEvent(
1200
+ new CustomEvent("input", { detail: this.value, bubbles: true })
1201
+ );
1202
+ this.dispatchEvent(
1203
+ new CustomEvent("change", { detail: this.value, bubbles: true })
1204
+ );
1177
1205
  }
1178
1206
  #handleMouseMove(e) {
1179
1207
  if (this.type !== "number") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/rogie/figui3.git"
17
+ "url": "git+https://github.com/rogie/figui3.git"
18
18
  },
19
19
  "homepage": "https://github.com/rogie/figui3#readme",
20
20
  "bugs": {