@rogieking/figui3 10.0.2 → 10.0.4

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.
@@ -447,6 +447,7 @@ Handlers below assume `onInput` / `onChange` / `onClick` from [react.md](react.m
447
447
 
448
448
  - Attrs (chooser): `value`, `layout` (`vertical` | `horizontal` | `grid`), `columns`, `drag`, `loop`, `auto-scroll`, `scroll-behavior`
449
449
  - Choice: always set `value`. Omit chooser `value` to select first; `value=""` means none.
450
+ - A selected choice reflects `selected` to its direct element children.
450
451
  - Children stay in light DOM.
451
452
 
452
453
  ### `fig-separator` / `fig-menu-separator`
@@ -610,7 +611,7 @@ toastRef.current?.showToast();
610
611
  />
611
612
  ```
612
613
 
613
- - Attrs: `type`, `src`, `caption`, `aspect-ratio`, `fit`, `upload`, `loading-indicator`, `checkerboard`, `controls`, `autoplay`, `loop`, `muted`, `poster`
614
+ - Attrs: `type`, `src`, read-only `loaded` (image mode), `caption`, `aspect-ratio`, `fit`, `upload`, `loading-indicator`, `checkerboard`, `controls`, `autoplay`, `loop`, `muted`, `poster`
614
615
  - Events: `loaded` (`detail.src`), `input` / `change`
615
616
 
616
617
  ### `fig-image`
@@ -619,7 +620,8 @@ toastRef.current?.showToast();
619
620
  <fig-image src={src} fit="cover" upload checkerboard="true" onChange={onChange} />
620
621
  ```
621
622
 
622
- - Attrs: same media surface attrs. `loaded` → `detail.src`
623
+ - Attrs: same media surface attrs. The read-only `loaded` attribute supports CSS loaded-state selectors.
624
+ - Events: `load`, `error`, and `loaded` (`detail.src`)
623
625
 
624
626
  ### `fig-video`
625
627
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [10.0.4]
6
+
7
+ ### Changed
8
+
9
+ - Refined selected `fig-card` media to use a 1px selection outline.
10
+
11
+ ## [10.0.3]
12
+
13
+ ### Added
14
+
15
+ - Added a read-only `loaded` state to `fig-image` and image-mode `fig-media` for CSS styling.
16
+ - Selected `fig-choice` elements now reflect `selected` to their direct element children.
17
+
18
+ ### Changed
19
+
20
+ - Arrow keys now move chooser focus without selecting; Enter, Space, and clicks commit selection.
21
+ - Chooser card and color examples now use `fig-card` and `fig-swatch` directly as custom choices.
22
+ - Refined chooser and card focus and selection outlines.
23
+
24
+ ### Fixed
25
+
26
+ - Replaced fragile grid first-row markers with native row gaps and kept overflow controls out of chooser grid flow.
27
+
5
28
  ## [10.0.2]
6
29
 
7
30
  ### Added
package/README.md CHANGED
@@ -881,7 +881,7 @@ When app code rebuilds a chooser by setting `fig-chooser.innerHTML`, the chooser
881
881
  | Attribute | Type | Default | Description |
882
882
  |---|---|---|---|
883
883
  | `value` | string | — | Choice identifier |
884
- | `selected` | boolean | `false` | Selected state |
884
+ | `selected` | boolean | `false` | Selected state; reflected to direct element children |
885
885
  | `disabled` | boolean | `false` | Disabled state |
886
886
 
887
887
  **Events (on fig-chooser):** `input`, `change` — detail is the selected value string.
@@ -1535,6 +1535,7 @@ Unified media component that supports image/video modes and shared sizing/upload
1535
1535
  | `type` | string | `"image"` | `"image"` or `"video"` |
1536
1536
  | `src` | string | — | Media URL |
1537
1537
  | `alt` | string | `""` | Alt text forwarded to the generated `<img>` (image mode) |
1538
+ | `loaded` | boolean | `false` | Read-only reflected state after an image loads successfully |
1538
1539
  | `upload` | boolean | `false` | Show upload overlay (`fig-input-file`) |
1539
1540
  | `loading-indicator` | boolean | `true` | Set to `"false"` to disable the delayed loading spinner for generated images |
1540
1541
  | `label` | string | `"Upload"` | Upload button label |
@@ -1579,6 +1580,7 @@ An image display component with optional upload, aspect ratio, and object-fit co
1579
1580
  |---|---|---|---|
1580
1581
  | `src` | string | — | Image URL |
1581
1582
  | `alt` | string | `""` | Alt text forwarded to the generated `<img>` |
1583
+ | `loaded` | boolean | `false` | Read-only reflected state after the image loads successfully |
1582
1584
  | `upload` | boolean | `false` | Show upload overlay (`fig-input-file`) |
1583
1585
  | `loading-indicator` | boolean | `true` | Set to `"false"` to disable the delayed loading spinner |
1584
1586
  | `label` | string | `"Upload"` | Upload button label |
@@ -1591,6 +1593,7 @@ An image display component with optional upload, aspect ratio, and object-fit co
1591
1593
  Use meaningful `alt` text for informative images. Use `alt=""` for decorative previews, thumbnails with visible labels, or upload placeholders.
1592
1594
 
1593
1595
  The generated image's native `load` and `error` events are re-emitted from `fig-image` as bubbling, composed `CustomEvent`s with `src`, `media`, and `originalEvent` in `event.detail`.
1596
+ The `loaded` attribute is removed when `src` changes or loading fails, so it can be used as a CSS state selector such as `fig-image[loaded]`.
1594
1597
 
1595
1598
  ```html
1596
1599
  <fig-image src="photo.jpg" alt="Selected image"></fig-image>
package/components.css CHANGED
@@ -89,8 +89,10 @@
89
89
  --figma-color-border-slot: light-dark(#ff24bd, #f316b0);
90
90
 
91
91
  /* Focus */
92
- --figma-focus-outline: 1px solid var(--figma-color-border-selected);
93
- --figma-focus-outline-offset: -1px;
92
+ --figma-focus-outline-width: 1.5px;
93
+ --figma-focus-outline-color: var(--figma-color-border-selected);
94
+ --figma-focus-outline: var(--figma-focus-outline-width) solid var(--figma-focus-outline-color);
95
+ --figma-focus-outline-offset: var(--figma-focus-outline-width);
94
96
  --figma-focus-outline-radius: inherit;
95
97
 
96
98
  /* Icon Colors */
@@ -6241,7 +6243,7 @@ fig-chooser {
6241
6243
  &[layout="grid"] {
6242
6244
  display: grid;
6243
6245
  column-gap: var(--fig-chooser-gap);
6244
- row-gap: 0;
6246
+ row-gap: var(--fig-chooser-gap);
6245
6247
  grid-template-columns: repeat(
6246
6248
  var(--fig-chooser-grid-columns, 2),
6247
6249
  minmax(0, 1fr)
@@ -6251,11 +6253,6 @@ fig-chooser {
6251
6253
 
6252
6254
  > :not(.fig-overflow) {
6253
6255
  margin: 0;
6254
- margin-block-start: var(--fig-chooser-gap);
6255
- }
6256
-
6257
- > [data-fig-chooser-first-row] {
6258
- margin-block-start: 0;
6259
6256
  }
6260
6257
 
6261
6258
  > .fig-overflow {
@@ -6306,6 +6303,11 @@ fig-card {
6306
6303
  border-radius: 0.5625rem;
6307
6304
  box-sizing: border-box;
6308
6305
 
6306
+ &:focus-visible{
6307
+ outline: var(--figma-focus-outline);
6308
+ outline-offset: var(--figma-focus-outline-offset);
6309
+ }
6310
+
6309
6311
  &[full]:not([full="false"]) {
6310
6312
  width: 100%;
6311
6313
  }
@@ -6378,6 +6380,9 @@ fig-card {
6378
6380
  max-width: none;
6379
6381
  border-radius: var(--fig-card-media-radius);
6380
6382
  min-height: auto;
6383
+ &::after{
6384
+ visibility: hidden;
6385
+ }
6381
6386
  }
6382
6387
 
6383
6388
  > fig-footer {
@@ -6460,15 +6465,8 @@ fig-card {
6460
6465
  }
6461
6466
 
6462
6467
  &[selected]:not([selected="false"]) > :is(fig-image, fig-media, fig-preview) {
6463
- outline: var(--figma-focus-outline);
6464
- outline-offset: var(--figma-focus-outline-offset);
6465
- }
6466
-
6467
- &[selected]:not([selected="false"])
6468
- > :is(fig-image, fig-media)
6469
- > fig-preview::after,
6470
- &[selected]:not([selected="false"]) > fig-preview::after {
6471
- box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
6468
+ outline: 1px solid var(--figma-focus-outline-color);
6469
+ outline-offset: 0;
6472
6470
  }
6473
6471
 
6474
6472
  &[disabled]:not([disabled="false"]),
@@ -6484,6 +6482,7 @@ fig-choice {
6484
6482
  --fig-choice-border-radius: var(--radius-medium);
6485
6483
  --fig-choice-min-height: 1.5rem;
6486
6484
  --fig-choice-min-width: 1.5rem;
6485
+ --fig-choice-selection-ring-width: 1.5px;
6487
6486
 
6488
6487
  min-height: var(--fig-choice-min-height);
6489
6488
  min-width: var(--fig-choice-min-width);
@@ -6505,32 +6504,24 @@ fig-choice {
6505
6504
  background-color: var(--figma-color-bg-secondary);
6506
6505
  }
6507
6506
 
6508
- &:focus-visible {
6509
- outline: var(--figma-focus-outline);
6510
- outline-offset: var(--figma-focus-outline-offset);
6511
- }
6512
-
6513
6507
  &[padding]:not([padding="false"]) {
6514
6508
  --fig-choice-padding: var(--spacer-1);
6515
6509
  --fig-choice-border-radius: var(--radius-medium-large);
6516
6510
  }
6517
6511
 
6518
- &[selected]:not([selected="false"]) {
6519
- position: relative;
6520
- &::after {
6521
- content: "";
6522
- position: absolute;
6523
- inset: 0;
6524
- border-radius: calc(
6525
- var(--fig-choice-border-radius)
6526
- );
6527
- pointer-events: none;
6528
- z-index: 1;
6529
- outline: var(--fig-choice-selection-ring-width, 2px) solid
6512
+ &:focus-visible,
6513
+ &[selected]:not([selected="false"]){
6514
+ outline: var(--fig-choice-selection-ring-width) solid
6530
6515
  var(--figma-color-border-selected);
6531
- outline-offset: var(--fig-choice-selection-ring-width, 2px);
6516
+ outline-offset: var(--fig-choice-selection-ring-width);
6517
+ }
6518
+
6519
+ &[selected]:not([selected="false"]) {
6520
+ background-color: var(--figma-color-bg-selected);
6521
+ &>*,
6522
+ &:hover{
6523
+ background-color: transparent;
6532
6524
  }
6533
- background-color: var(--figma-color-bg-secondary);
6534
6525
  }
6535
6526
 
6536
6527
  &[disabled]:not([disabled="false"]),