@rogieking/figui3 2.1.7 → 2.1.8

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 +14 -0
  2. package/fig.js +1 -9
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -2434,6 +2434,7 @@ fig-slider {
2434
2434
 
2435
2435
  fig-field,
2436
2436
  .fig-field {
2437
+ --field-label-width: 4rem;
2437
2438
  display: flex;
2438
2439
  padding: var(--spacer-1) var(--spacer-3);
2439
2440
  margin: 0;
@@ -2441,6 +2442,13 @@ fig-field,
2441
2442
  gap: 0;
2442
2443
  align-items: start;
2443
2444
 
2445
+ &[direction="row"],
2446
+ &[direction="horizontal"] {
2447
+ flex-direction: row;
2448
+ align-items: center;
2449
+ gap: var(--spacer-2);
2450
+ }
2451
+
2444
2452
  & > [full] {
2445
2453
  flex: 1;
2446
2454
  }
@@ -2455,6 +2463,12 @@ fig-field,
2455
2463
  width: 100%;
2456
2464
  }
2457
2465
 
2466
+ &[direction="row"] > label,
2467
+ &[direction="horizontal"] > label {
2468
+ width: auto;
2469
+ min-width: var(--field-label-width);
2470
+ }
2471
+
2458
2472
  &[direction="horizontal"] {
2459
2473
  gap: var(--spacer-2);
2460
2474
  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.8",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {