@rogieking/figui3 1.7.9 → 1.8.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/components.css CHANGED
@@ -1877,20 +1877,6 @@ fig-slider {
1877
1877
  position: relative;
1878
1878
  display: block;
1879
1879
  width: 100%;
1880
- box-shadow: none;
1881
- background: var(--figma-color-bg-tertiary);
1882
-
1883
- /* Track */
1884
- &::before {
1885
- box-shadow: none;
1886
- background: var(--figma-color-text-tertiary);
1887
- }
1888
-
1889
- input[type="range"] {
1890
- &::-webkit-slider-runnable-track {
1891
- box-shadow: none;
1892
- }
1893
- }
1894
1880
  }
1895
1881
  fig-input-text {
1896
1882
  height: calc(var(--slider-height) * 2);
@@ -1899,18 +1885,6 @@ fig-slider {
1899
1885
 
1900
1886
  &:hover,
1901
1887
  &:focus-within {
1902
- .fig-slider-input-container {
1903
- background: var(--figma-color-bg-secondary);
1904
- &::before {
1905
- box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
1906
- background: var(--figma-color-bg-brand);
1907
- }
1908
- }
1909
- input[type="range"] {
1910
- &::-webkit-slider-runnable-track {
1911
- box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
1912
- }
1913
- }
1914
1888
  fig-input-text {
1915
1889
  height: auto;
1916
1890
  }
package/example.html CHANGED
@@ -493,6 +493,7 @@
493
493
  is="fig-dialog">
494
494
  <fig-header>
495
495
  <h3>Dialog</h3>
496
+
496
497
  <fig-button variant="ghost"
497
498
  icon="true"
498
499
  close-dialog>
@@ -511,6 +512,12 @@
511
512
  </fig-button>
512
513
  </fig-header>
513
514
  <fig-content>
515
+ <fig-tooltip text="Close dialog">
516
+ <fig-button variant="ghost"
517
+ close-dialog>
518
+ Close
519
+ </fig-button>
520
+ </fig-tooltip>
514
521
  <p>Some content here</p>
515
522
  <fig-field direction="horizontal">
516
523
  <label for="colorLevels">Color Levels</label>
package/fig.js CHANGED
@@ -252,7 +252,9 @@ class FigTooltip extends HTMLElement {
252
252
  clearTimeout(this.#touchTimeout);
253
253
  if (this.action === "hover") {
254
254
  this.removeEventListener("touchstart", this.#handleTouchStart);
255
+ this.removeEventListener("touchmove", this.#handleTouchMove);
255
256
  this.removeEventListener("touchend", this.#handleTouchEnd);
257
+ this.removeEventListener("touchcancel", this.#handleTouchCancel);
256
258
  } else if (this.action === "click") {
257
259
  this.removeEventListener("touchstart", this.showDelayedPopup);
258
260
  }
@@ -294,7 +296,10 @@ class FigTooltip extends HTMLElement {
294
296
  setupEventListeners() {
295
297
  if (this.action === "hover") {
296
298
  this.addEventListener("pointerenter", this.showDelayedPopup.bind(this));
297
- this.addEventListener("pointerleave", this.hidePopup.bind(this));
299
+ this.addEventListener(
300
+ "pointerleave",
301
+ this.#handlePointerLeave.bind(this)
302
+ );
298
303
  // Add mousedown listener instead of dragstart
299
304
  this.addEventListener("mousedown", this.#boundHideOnDragStart);
300
305
 
@@ -302,9 +307,15 @@ class FigTooltip extends HTMLElement {
302
307
  this.addEventListener("touchstart", this.#handleTouchStart.bind(this), {
303
308
  passive: true,
304
309
  });
310
+ this.addEventListener("touchmove", this.#handleTouchMove.bind(this), {
311
+ passive: true,
312
+ });
305
313
  this.addEventListener("touchend", this.#handleTouchEnd.bind(this), {
306
314
  passive: true,
307
315
  });
316
+ this.addEventListener("touchcancel", this.#handleTouchCancel.bind(this), {
317
+ passive: true,
318
+ });
308
319
  } else if (this.action === "click") {
309
320
  this.addEventListener("click", this.showDelayedPopup.bind(this));
310
321
  document.body.addEventListener(
@@ -390,23 +401,52 @@ class FigTooltip extends HTMLElement {
390
401
  }
391
402
  }
392
403
 
404
+ // Pointer event handlers
405
+ #handlePointerLeave(event) {
406
+ // Don't hide immediately if we're in a touch interaction
407
+ if (!this.#isTouching) {
408
+ this.hidePopup();
409
+ }
410
+ }
411
+
393
412
  // Touch event handlers for mobile support
394
413
  #handleTouchStart(event) {
395
414
  if (this.action === "hover") {
396
415
  this.#isTouching = true;
416
+ // Clear any existing touch timeout
417
+ clearTimeout(this.#touchTimeout);
397
418
  // Show popup on touch start for hover action
398
419
  this.showDelayedPopup();
399
420
  }
400
421
  }
401
422
 
423
+ #handleTouchMove(event) {
424
+ if (this.action === "hover" && this.#isTouching) {
425
+ // If user is scrolling/moving, cancel the tooltip after a delay
426
+ clearTimeout(this.#touchTimeout);
427
+ this.#touchTimeout = setTimeout(() => {
428
+ this.#isTouching = false;
429
+ this.hidePopup();
430
+ }, 150);
431
+ }
432
+ }
433
+
402
434
  #handleTouchEnd(event) {
403
435
  if (this.action === "hover" && this.#isTouching) {
404
- this.#isTouching = false;
405
- // Hide popup after a short delay to allow for taps
436
+ // Delay setting isTouching to false to prevent pointerleave from hiding immediately
406
437
  clearTimeout(this.#touchTimeout);
407
438
  this.#touchTimeout = setTimeout(() => {
439
+ this.#isTouching = false;
408
440
  this.hidePopup();
409
- }, 100);
441
+ }, 300); // Increased delay for better mobile UX
442
+ }
443
+ }
444
+
445
+ #handleTouchCancel(event) {
446
+ if (this.action === "hover" && this.#isTouching) {
447
+ this.#isTouching = false;
448
+ clearTimeout(this.#touchTimeout);
449
+ this.hidePopup();
410
450
  }
411
451
  }
412
452
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.7.9",
3
+ "version": "1.8.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {