@rogieking/figui3 2.1.7 → 2.1.9

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.
Files changed (3) hide show
  1. package/components.css +15 -8
  2. package/fig.js +1 -9
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -2308,14 +2308,6 @@ fig-input-number {
2308
2308
  flex: 1;
2309
2309
  color: var(--figma-color-text);
2310
2310
 
2311
- /* When inside a flex container (like fig-field), grow to fill */
2312
- fig-field &,
2313
- [style*="flex"] &,
2314
- [style*="display: flex"] & {
2315
- width: auto;
2316
- flex: 1 1 auto;
2317
- }
2318
-
2319
2311
  &[multiline] {
2320
2312
  display: flex;
2321
2313
  width: 100%; /* Multiline defaults to full width */
@@ -2434,6 +2426,7 @@ fig-slider {
2434
2426
 
2435
2427
  fig-field,
2436
2428
  .fig-field {
2429
+ --field-label-width: 4rem;
2437
2430
  display: flex;
2438
2431
  padding: var(--spacer-1) var(--spacer-3);
2439
2432
  margin: 0;
@@ -2441,8 +2434,16 @@ fig-field,
2441
2434
  gap: 0;
2442
2435
  align-items: start;
2443
2436
 
2437
+ &[direction="row"],
2438
+ &[direction="horizontal"] {
2439
+ flex-direction: row;
2440
+ align-items: center;
2441
+ gap: var(--spacer-2);
2442
+ }
2443
+
2444
2444
  & > [full] {
2445
2445
  flex: 1;
2446
+ flex: 1 1 auto;
2446
2447
  }
2447
2448
 
2448
2449
  & > label {
@@ -2455,6 +2456,12 @@ fig-field,
2455
2456
  width: 100%;
2456
2457
  }
2457
2458
 
2459
+ &[direction="row"] > label,
2460
+ &[direction="horizontal"] > label {
2461
+ width: auto;
2462
+ min-width: var(--field-label-width);
2463
+ }
2464
+
2458
2465
  &[direction="horizontal"] {
2459
2466
  gap: var(--spacer-2);
2460
2467
  align-items: start;
package/fig.js CHANGED
@@ -2292,7 +2292,7 @@ class FigField extends HTMLElement {
2292
2292
  }
2293
2293
 
2294
2294
  static get observedAttributes() {
2295
- return ["direction", "label"];
2295
+ return ["label"];
2296
2296
  }
2297
2297
 
2298
2298
  connectedCallback() {
@@ -2307,19 +2307,11 @@ class FigField extends HTMLElement {
2307
2307
  this.input.setAttribute("id", inputId);
2308
2308
  this.label.setAttribute("for", inputId);
2309
2309
  }
2310
- // Apply direction
2311
- const direction = this.getAttribute("direction");
2312
- if (direction) {
2313
- this.style.flexDirection = direction === "row" ? "row" : "column";
2314
- }
2315
2310
  });
2316
2311
  }
2317
2312
 
2318
2313
  attributeChangedCallback(name, oldValue, newValue) {
2319
2314
  switch (name) {
2320
- case "direction":
2321
- this.style.flexDirection = newValue === "row" ? "row" : "column";
2322
- break;
2323
2315
  case "label":
2324
2316
  if (this.label) {
2325
2317
  this.label.textContent = newValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {