@rogieking/figui3 10.0.1 → 10.0.2

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/fig.js CHANGED
@@ -14057,9 +14057,11 @@ figDefineElement("fig-video", FigVideo);
14057
14057
  * @attr {boolean} disabled - Dim + non-interactive
14058
14058
  * @attr {boolean} full - Stretch to available width (CSS; default width is already 100%)
14059
14059
  * @attr {string} size - Set to `large` for spacer-2 card padding and spacer-1 label spacing
14060
+ * @attr {string} direction - `vertical` (default) or `horizontal` list layout
14060
14061
  * @attr {string} aspect-ratio - Forwarded to fig-image (default `1/1`)
14061
14062
  * @attr {string} fit - Forwarded to fig-image (default `contain`)
14062
14063
  * @attr {string} label-line-clamp - `1` (default) or `2`
14064
+ * @attr {string} label-overflow - `ellipsis` (default) or horizontal `fade`
14063
14065
  */
14064
14066
  class FigCard extends HTMLElement {
14065
14067
  static get observedAttributes() {
@@ -14073,9 +14075,11 @@ class FigCard extends HTMLElement {
14073
14075
  "disabled",
14074
14076
  "full",
14075
14077
  "size",
14078
+ "direction",
14076
14079
  "aspect-ratio",
14077
14080
  "fit",
14078
14081
  "label-line-clamp",
14082
+ "label-overflow",
14079
14083
  ];
14080
14084
  }
14081
14085
 
@@ -14273,6 +14277,16 @@ class FigCard extends HTMLElement {
14273
14277
  this.appendChild(this.#footerEl);
14274
14278
  }
14275
14279
 
14280
+ #syncLabelOverflow() {
14281
+ const fade = this.getAttribute("label-overflow") === "fade";
14282
+ this.querySelectorAll(
14283
+ ":scope > fig-footer > :is(.fig-card-label, .fig-card-sublabel)",
14284
+ ).forEach((element) => {
14285
+ element.classList.toggle("fig-overflow-fade", fade);
14286
+ element.classList.toggle("fig-overflow-fade-horizontal", fade);
14287
+ });
14288
+ }
14289
+
14276
14290
  #sync() {
14277
14291
  if (!this.#usesGeneratedMedia()) {
14278
14292
  this.#syncManual();
@@ -14329,6 +14343,7 @@ class FigCard extends HTMLElement {
14329
14343
  if (this.#footerEl) {
14330
14344
  this.#footerEl.hidden = !label && !sublabel;
14331
14345
  }
14346
+ this.#syncLabelOverflow();
14332
14347
  }
14333
14348
 
14334
14349
  #syncManual() {
@@ -14352,6 +14367,7 @@ class FigCard extends HTMLElement {
14352
14367
  this.#labelEl.hidden = !label;
14353
14368
  }
14354
14369
  if (this.#sublabelEl) this.#sublabelEl.textContent = sublabel;
14370
+ this.#syncLabelOverflow();
14355
14371
  }
14356
14372
  }
14357
14373
  figDefineElement("fig-card", FigCard);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "10.0.1",
3
+ "version": "10.0.2",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "SEE LICENSE IN LICENSE",