@rogieking/figui3 9.0.1 → 9.0.3

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.
@@ -9,7 +9,7 @@ Install `fig-editor.css` + `fig-editor.js` (pulls in `fig.js` and `fig-lab.js`).
9
9
  Figma-style listbox. Prefer this over core `fig-dropdown`.
10
10
 
11
11
  ```tsx
12
- <fig-select value={align} label="Align" full onChange={onChange}>
12
+ <fig-select value={align} label="Align" size="large" full onChange={onChange}>
13
13
  <fig-select-options>
14
14
  <fig-select-option value="left">Left</fig-select-option>
15
15
  <fig-select-option value="center">Center</fig-select-option>
@@ -29,7 +29,7 @@ Data-driven (no authored options):
29
29
  />
30
30
  ```
31
31
 
32
- - Attrs: `value`, `label`, `options` (comma / newline / JSON), `variant` (`ghost`), `subtle` (applies the secondary hover/focus fill to every option), `full`, `disabled`, `position` (`bottom left` default, also `bottom right`, `top left`, `top right`, `bottom center`, `top center`), `offset`, `closedby`, `open`
32
+ - Attrs: `value`, `label`, `options` (comma / newline / JSON), `variant` (`ghost`), `size` (`large`, 32px trigger), `subtle` (applies the secondary hover/focus fill to every option), `full`, `disabled`, `position` (`bottom left` default, also `bottom right`, `top left`, `top right`, `bottom center`, `top center`), `offset`, `closedby`, `open`
33
33
  - Events: `input` / `change` on commit; `optionhover` with the option value in `detail` (does not change selection). Use a native listener for `optionhover`.
34
34
  - Do not `stopPropagation` on option click — React light-DOM handlers must run.
35
35
  - Internal popup uses `popover="manual"` so the list works inside `fig-popup variant="popover"`.
@@ -21,9 +21,10 @@ Observed: `value`, `disabled`, `selected`, `label`.
21
21
 
22
22
  ## `fig-select` observed
23
23
 
24
- `value`, `disabled`, `label`, `options`, `position`, `offset`, `closedby`, `open`, `variant`
24
+ `value`, `disabled`, `label`, `options`, `position`, `offset`, `closedby`, `open`, `variant`, `size`
25
25
 
26
26
  - `subtle` applies the secondary hover/focus fill to every option
27
+ - `size="large"` sets a 32px trigger
27
28
 
28
29
  Position enum:
29
30
 
@@ -31,13 +31,13 @@ Handlers below assume `onInput` / `onChange` / `onClick` from [react.md](react.m
31
31
  ### `fig-dropdown`
32
32
 
33
33
  ```tsx
34
- <fig-dropdown value={value} variant="ghost" full onChange={onChange}>
34
+ <fig-dropdown value={value} variant="ghost" size="large" full onChange={onChange}>
35
35
  <option value="left">Left</option>
36
36
  <option value="center">Center</option>
37
37
  </fig-dropdown>
38
38
  ```
39
39
 
40
- - Attrs: `value`, `type` (`select` | `dropdown`), `variant` (`ghost`), `full`, `disabled`
40
+ - Attrs: `value`, `type` (`select` | `dropdown`), `variant` (`ghost`), `size` (`large`), `full`, `disabled`
41
41
  - Events: `input` / `change` → `currentTarget.value`
42
42
  - Prefer `fig-select` (editor) for Figma-style menus.
43
43
 
@@ -25,7 +25,7 @@ Public API: `README.md`. React recipes: [components.md](components.md).
25
25
 
26
26
  ## `fig-dropdown`
27
27
 
28
- - `value`, `type="select|dropdown"`, `variant="ghost"`, `full`, `disabled`
28
+ - `value`, `type="select|dropdown"`, `variant="ghost"`, `size="large"` (32px), `full`, `disabled`
29
29
  - Children: native `<option>` / `<optgroup>`
30
30
 
31
31
  ## `fig-slider`
package/README.md CHANGED
@@ -190,10 +190,11 @@ Minimal example:
190
190
  | `type` | string | `"select"` | `"select"` or `"dropdown"` |
191
191
  | `label` | string | — | Accessible label for the generated native `<select>` |
192
192
  | `variant` | string | — | `"ghost"` for a borderless control with secondary hover fill |
193
+ | `size` | string | — | `"large"` for a 32px-tall control |
193
194
  | `disabled` | boolean | `false` | Disabled state |
194
195
 
195
196
  ```html
196
- <fig-dropdown value="2">
197
+ <fig-dropdown value="2" size="large">
197
198
  <option value="1">Option 1</option>
198
199
  <option value="2">Option 2</option>
199
200
  </fig-dropdown>
@@ -215,6 +216,7 @@ Custom listbox select with overflow chevrons, grouped options, and sticky separa
215
216
  | `label` | string | — | Closed-state / accessible label |
216
217
  | `options` | string | — | Comma, newline, or JSON options if no authored `fig-select-option` children |
217
218
  | `variant` | string | — | `"ghost"` for a borderless control with secondary hover fill |
219
+ | `size` | string | — | `"large"` for a 32px-tall trigger |
218
220
  | `subtle` | boolean | `false` | Use the secondary hover/focus fill for every option |
219
221
  | `full` | boolean | `false` | Stretch to available width |
220
222
  | `position` | string | `"bottom left"` | Popup position |
@@ -223,7 +225,7 @@ Custom listbox select with overflow chevrons, grouped options, and sticky separa
223
225
  Author options in `<fig-select-options>`, or pass `options`. Add `subtle` to one `<fig-select-option>` for the secondary hover/focus fill, or to `<fig-select>` to apply it to every option. Use `label` on `<fig-select-option>` when the option content is rich. `fig-separator` with `sticky` pins group labels while scrolling.
224
226
 
225
227
  ```html
226
- <fig-select value="center" label="Align">
228
+ <fig-select value="center" label="Align" size="large">
227
229
  <fig-select-options>
228
230
  <fig-select-option value="left">Left</fig-select-option>
229
231
  <fig-select-option value="center">Center</fig-select-option>
@@ -829,11 +831,41 @@ An interactive bezier or spring easing curve editor with a preset dropdown and m
829
831
 
830
832
  | Attribute | Type | Default | Description |
831
833
  |---|---|---|---|
832
- | `value` | string | — | Bezier: `"0.42, 0, 0.58, 1"` or Spring: `"spring(200, 15, 1)"` |
834
+ | `value` | string | — | Bezier/spring shorthand or a serialized easing object |
833
835
  | `mode` | string | — | Optional `"bezier"` or `"spring"` constraint; filters presets and rejects the other value type |
834
836
  | `precision` | number | `2` | Decimal places |
835
837
  | `aspect-ratio` | string | — | Editor aspect ratio |
836
838
  | `edit` | boolean | `true` | Show the editor and custom bezier/spring options; set to `"false"` for preset-only |
839
+ | `presets` | boolean | `true` | Show the preset selector; set to `"false"` to hide it |
840
+ | `text` | boolean | `true` | Show the bezier value or normalized spring bounce input; set to `"false"` to hide it |
841
+
842
+ The `value` property also accepts a structured object. Structured values require a `type` unless the `mode` attribute supplies it. If both are present, they must agree.
843
+
844
+ ```js
845
+ curve.value = {
846
+ type: "spring",
847
+ mass: 1,
848
+ stiffness: 200,
849
+ damping: 12,
850
+ initialVelocity: 0,
851
+ };
852
+
853
+ curve.spring; // A cloned { mass, stiffness, damping, initialVelocity } object
854
+ curve.value; // "spring(200, 12, 1)"
855
+ ```
856
+
857
+ The same data can be supplied declaratively. With `mode="spring"`, `type` is optional:
858
+
859
+ ```html
860
+ <fig-easing-curve
861
+ mode="spring"
862
+ value='{"mass":1,"stiffness":200,"damping":12,"initialVelocity":0}'
863
+ ></fig-easing-curve>
864
+ ```
865
+
866
+ Bezier objects use `{ type: "bezier", x1, y1, x2, y2 }`. Spring shorthand accepts an optional fourth initial-velocity value: `spring(stiffness, damping, mass, initialVelocity)`.
867
+
868
+ In spring mode, the compact number input edits normalized bounce from `0` (critically damped) to `1` (undamped). Bounce is converted to the equivalent damping value in the structured spring configuration.
837
869
 
838
870
  **Static:** `FigEasingCurve.PRESETS` — built-in preset array. `FigEasingCurve.curveIcon(value)` — SVG icon helper.
839
871
 
@@ -841,12 +873,13 @@ An interactive bezier or spring easing curve editor with a preset dropdown and m
841
873
 
842
874
  | Event | Detail |
843
875
  |---|---|
844
- | `input` | `{ mode, value, cssValue, preset }` — while dragging |
845
- | `change` | `{ mode, value, cssValue, preset }` — on release |
876
+ | `input` | `{ mode, value, cssValue, preset, spring? }` — while dragging |
877
+ | `change` | `{ mode, value, cssValue, preset, spring? }` — on release |
846
878
 
847
879
  ```html
848
880
  <fig-easing-curve value="0.42, 0, 0.58, 1"></fig-easing-curve>
849
881
  <fig-easing-curve value="spring(200, 15, 1)" edit="false"></fig-easing-curve>
882
+ <fig-easing-curve value="0.42, 0, 0.58, 1" presets="false" text="false"></fig-easing-curve>
850
883
  ```
851
884
 
852
885
  Editable bezier and spring handles are keyboard operable. Bezier handles keep tab order aligned with the visual handle order.
package/components.css CHANGED
@@ -686,7 +686,7 @@ input[type="text"][list] {
686
686
 
687
687
 
688
688
  &:not([multiple]) {
689
- height: var(--spacer-4);
689
+ height: var(--fig-dropdown-height, var(--spacer-4));
690
690
  padding: 0 var(--spacer-4) 0 var(--spacer-2);
691
691
  background: calc(100% - var(--spacer-1)) 50% / 1rem no-repeat
692
692
  var(--icon-16-chevron);
@@ -1924,8 +1924,9 @@ fig-easing-curve {
1924
1924
 
1925
1925
  width: 100%;
1926
1926
  .fig-easing-curve-svg {
1927
+ display: block;
1927
1928
  width: 100%;
1928
- aspect-ratio: var(--aspect-ratio);
1929
+ height: 100%;
1929
1930
  overflow: visible;
1930
1931
  }
1931
1932
  .fig-easing-curve-svg-container {
@@ -3457,6 +3458,10 @@ fig-input-palette {
3457
3458
  }
3458
3459
 
3459
3460
  fig-dropdown {
3461
+ &[size="large"] {
3462
+ --fig-dropdown-height: var(--spacer-5);
3463
+ }
3464
+
3460
3465
  &[full]:not([full="false"]) {
3461
3466
  display: flex;
3462
3467
  width: 100%;