@rogieking/figui3 1.5.6 → 1.5.7

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "liveServer.settings.port": 5501
3
+ }
package/components.css CHANGED
@@ -1967,17 +1967,27 @@ fig-tooltip {
1967
1967
  }
1968
1968
  .fig-tooltip {
1969
1969
  inset: unset;
1970
- display: block;
1970
+ display: inline-block;
1971
1971
  color: var(--color-tooltip);
1972
1972
  background-color: var(--bg-tooltip);
1973
1973
  padding: var(--spacer-1) var(--spacer-2);
1974
1974
  line-height: 1rem !important;
1975
- display: inline-flex;
1976
1975
  font-weight: inherit;
1977
1976
  border-radius: var(--radius-medium, 0.3125rem);
1978
-
1979
- font: inherit;
1980
- font-weight: normal;
1977
+ max-width: 180px;
1978
+ width: max-content;
1979
+
1980
+ & > span {
1981
+ text-wrap: balance;
1982
+ max-height: 2.5rem;
1983
+ overflow-y: hidden;
1984
+ display: -webkit-box;
1985
+ -webkit-line-clamp: 2;
1986
+ -webkit-box-orient: vertical;
1987
+ line-clamp: 2;
1988
+ text-overflow: ellipsis;
1989
+ width: auto;
1990
+ }
1981
1991
 
1982
1992
  &:after {
1983
1993
  content: "";
package/example.html CHANGED
@@ -26,7 +26,49 @@
26
26
  <h2><label>Effects/</label>UI3 Components</h2>
27
27
  </fig-header>
28
28
  <fig-content>
29
- <fig-button type="button"
29
+
30
+ <br /><br /><br /><br /><br /><br /><br /><br /><br />
31
+ <hstack>
32
+ <fig-tooltip text="Tooltip"
33
+ delay="0">
34
+ <fig-button>
35
+ Test
36
+ </fig-button>
37
+ </fig-tooltip>
38
+ <fig-tooltip text="Tooltip that is a bit longer"
39
+ delay="0">
40
+ <fig-button>
41
+ Test
42
+ </fig-button>
43
+ </fig-tooltip>
44
+ <fig-tooltip text="Tooltip that is a bit longer ish"
45
+ delay="0">
46
+ <fig-button>
47
+ Test
48
+ </fig-button>
49
+ </fig-tooltip>
50
+ <fig-tooltip text="Tooltip that is a bit longer ish yet"
51
+ delay="0">
52
+ <fig-button>
53
+ Test
54
+ </fig-button>
55
+ </fig-tooltip>
56
+ <fig-tooltip text="Tooltip that is a bit longer and has a lot of text and even more text"
57
+ delay="0">
58
+ <fig-button>
59
+ Test
60
+ </fig-button>
61
+ </fig-tooltip>
62
+ <fig-tooltip text="Super mega fuckin long ass tooltip that likely shouldn't even be possible to fit in the space"
63
+ delay="0">
64
+ <fig-button>
65
+ Test
66
+ </fig-button>
67
+ </fig-tooltip>
68
+
69
+ </hstack>
70
+ <br /><br /><br /><br /><br /><br /><br /><br /><br />
71
+ <fig-button type="link"
30
72
  href="https://www.google.com">
31
73
  <svg width="24"
32
74
  height="24"
@@ -39,7 +81,8 @@
39
81
  </svg>
40
82
 
41
83
  Install</fig-button>
42
- <fig-button type="button"
84
+ <fig-button type="link"
85
+ target="_blank"
43
86
  size="large"
44
87
  href="https://www.google.com">
45
88
  <svg width="24"
package/fig.js CHANGED
@@ -77,8 +77,13 @@ class FigButton extends HTMLElement {
77
77
  }
78
78
  if (this.type === "link") {
79
79
  const href = this.getAttribute("href");
80
+ const target = this.getAttribute("target");
80
81
  if (href) {
81
- window.open(href, "_blank");
82
+ if (target) {
83
+ window.open(href, target);
84
+ } else {
85
+ window.location.href = href;
86
+ }
82
87
  }
83
88
  }
84
89
  }
@@ -249,14 +254,24 @@ class FigTooltip extends HTMLElement {
249
254
 
250
255
  render() {
251
256
  this.destroy();
257
+ let content = document.createElement("span");
252
258
  this.popup = document.createElement("span");
253
259
  this.popup.setAttribute("class", "fig-tooltip");
254
260
  this.popup.style.position = "fixed";
255
261
  this.popup.style.visibility = "hidden";
256
262
  this.popup.style.display = "inline-flex";
257
263
  this.popup.style.pointerEvents = "none";
258
- this.popup.innerText = this.getAttribute("text");
264
+ this.popup.append(content);
265
+ content.innerText = this.getAttribute("text");
259
266
  document.body.append(this.popup);
267
+ const text = content.childNodes[0];
268
+ if (text) {
269
+ const range = document.createRange();
270
+ range.setStartBefore(text);
271
+ range.setEndAfter(text);
272
+ const clientRect = range.getBoundingClientRect();
273
+ content.style.width = `${clientRect.width}px`;
274
+ }
260
275
  }
261
276
 
262
277
  destroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {