wings-plugin-ui 0.1.0 → 0.1.1

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 (4) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/ui.d.ts +2 -1
  4. package/ui.js +6 -1
package/README.md CHANGED
@@ -70,11 +70,11 @@ message.
70
70
  | `List`, `ListItem`, `ListButton` | `ordered` and `compact` on `List`, `align` on the rows | A list of rows; a `ListButton` in a `ListItem` makes the row a button |
71
71
  | `Dot`, `Spinner` | `tone`, `size`, `label`; `Dot` also `color` | A status dot or a spinner, announced only with a `label`. A dot's `color` comes from your data, like a work item type's `#cc293d` |
72
72
  | `Pill`, `Tag` | `tone` | A filled pill, or an outlined tag like a branch |
73
- | `Loading`, `Empty` | `Empty`: `title`, `detail` | Before the first data, and nothing to show |
73
+ | `Loading`, `Empty` | `Empty`: `title`, `description` | Before the first data, and nothing to show |
74
74
  | `Button` | `variant` (`primary`, `ghost`, `danger`), `size` (`small`), `busy` | A button, `type="button"`; `busy` shows a spinner and ignores clicks, keeping focus |
75
75
  | `Chip`, `Chips` | `pressed`; `Chips`: `label`, `options`, `value`, `onChange` | A small quiet button, and a group of them that picks one, with `aria-pressed`. An option's other props, like `id`, go to its chip |
76
76
  | `Tabs` | `label`, `items`, `value`, `onChange`, `children` | Tabs with arrow keys, Home and End, over their panel |
77
- | `Field` | `label`, `hint`, `error`, `id`, `inline` | A labelled field that names and describes the input in it. `id` becomes the input's, for a page that puts focus back by id; `inline` puts the label beside it |
77
+ | `Field` | `label`, `hint`, `error`, `id`, `inline` | A labelled field that names and describes the one input in it (a second input goes beside it: Base UI gives every input in a Field the first one's id). `id` becomes the input's, for a page that puts focus back by id; `inline` puts the label beside it |
78
78
  | `FieldGroup` | `label`, `hint`, `error` | Several controls under one label, like checkboxes: a `fieldset` with its `legend`, described by the hint; an error marks each checkbox invalid |
79
79
  | `TextInput`, `SearchField`, `Select` | `label`; `Select`: `options`, `value`, `onChange` | Inputs Wings styles; outside a `Field`, `label` names them |
80
80
  | `Checkbox` | `checked`, `onChange`, `children` | A checkbox with its label |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React components and the stylesheet for Wings plugin pages, on Base UI like the Wings app's shadcn/ui components.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/ui.d.ts CHANGED
@@ -167,7 +167,8 @@ export function Tabs<V extends string>(
167
167
 
168
168
  /**
169
169
  * A labelled field with a `hint` or an `error` under it, for the `TextInput`, `SearchField`, `Select` or `Combobox` in
170
- * `children`, on Base UI's Field.
170
+ * `children`, on Base UI's Field. It takes one input: Base UI gives every input in a Field the first one's id, so a
171
+ * second input goes beside the Field.
171
172
  */
172
173
  export function Field(
173
174
  props: Props<"div"> & {
package/ui.js CHANGED
@@ -356,7 +356,12 @@ export function Select({ label, options, value, defaultValue, onChange, disabled
356
356
  items: options,
357
357
  // Like a native select, one without a `value` starts on its first option.
358
358
  ...(value === undefined ? { defaultValue: defaultValue ?? options[0]?.value ?? null } : { value }),
359
- onValueChange: (next) => onChange?.(next),
359
+ onValueChange: (next, details) => {
360
+ // Base UI clears a pick whose option left the list, but checks against the value from before the render, so
361
+ // a page that picks and drops an option (a "Choose…" row) at once would get null for a value still listed.
362
+ if (next === null && details.reason === "none" && options.some((o) => o.value === value)) return;
363
+ onChange?.(next);
364
+ },
360
365
  disabled,
361
366
  name,
362
367
  required,