|
8563 | 8563 | "whenNotToUse": "" |
8564 | 8564 | } |
8565 | 8565 | }, |
| 8566 | + { |
| 8567 | + "slug": "sortable-list", |
| 8568 | + "import": "@robomous/ui-core", |
| 8569 | + "source": "src/components/sortable-list.tsx", |
| 8570 | + "docsPage": "examples/catalog/src/content/components/sortable-list.mdx", |
| 8571 | + "extracted": { |
| 8572 | + "exports": [ |
| 8573 | + "SortableList", |
| 8574 | + "SortableListHandle", |
| 8575 | + "SortableListItem", |
| 8576 | + "SortableListAnnouncement", |
| 8577 | + "SortableListChangeDetails", |
| 8578 | + "SortableListChangeReason" |
| 8579 | + ], |
| 8580 | + "parts": [ |
| 8581 | + { |
| 8582 | + "name": "SortableList", |
| 8583 | + "description": "A list whose order the reader changes: drag an item, or focus it, press Space, move it with the arrows and press Space again. Each item is a `SortableListItem` with a stable, unique `value`, written as a child of the list (directly or inside a Fragment): a child without a string `value` prop, such as a component that wraps an item, is not rendered. The list renders them in the order `value` (or `defaultValue`) gives, and asks for a new order through `onValueChange` once per move. An item the order leaves out goes at the end, and a key with no item is ignored, so adding or removing an item just works. Name it with `aria-label` or `aria-labelledby`. An item can hold no button or link of its own unless the list has `handle`: then each item is a plain list item and its `SortableListHandle` is what the reader drags and moves.", |
| 8584 | + "extends": [ |
| 8585 | + "Omit<React.ComponentProps<\"ul\">, \"children\" | \"defaultValue\" | \"onChange\" | \"role\">", |
| 8586 | + "{ \"aria-label\": string } | { \"aria-labelledby\": string }" |
| 8587 | + ], |
| 8588 | + "props": [ |
| 8589 | + { |
| 8590 | + "name": "value", |
| 8591 | + "type": "string[]", |
| 8592 | + "default": "", |
| 8593 | + "required": false, |
| 8594 | + "description": "The order, as the items' `value`s. Pass it with `onValueChange` to control the list." |
| 8595 | + }, |
| 8596 | + { |
| 8597 | + "name": "defaultValue", |
| 8598 | + "type": "string[]", |
| 8599 | + "default": "", |
| 8600 | + "required": false, |
| 8601 | + "description": "The starting order of an uncontrolled list." |
| 8602 | + }, |
| 8603 | + { |
| 8604 | + "name": "onValueChange", |
| 8605 | + "type": "(value: string[], details: SortableListChangeDetails) => void", |
| 8606 | + "default": "", |
| 8607 | + "required": false, |
| 8608 | + "description": "Called once per move, when the item is dropped, with the new order and why." |
| 8609 | + }, |
| 8610 | + { |
| 8611 | + "name": "orientation", |
| 8612 | + "type": "\"vertical\" | \"horizontal\"", |
| 8613 | + "default": "\"vertical\"", |
| 8614 | + "required": false, |
| 8615 | + "description": "Which way the items run: `horizontal` moves them with Left and Right." |
| 8616 | + }, |
| 8617 | + { |
| 8618 | + "name": "handle", |
| 8619 | + "type": "boolean", |
| 8620 | + "default": "false", |
| 8621 | + "required": false, |
| 8622 | + "description": "Drag and move items by their `SortableListHandle` instead of the whole item." |
| 8623 | + }, |
| 8624 | + { |
| 8625 | + "name": "disabled", |
| 8626 | + "type": "boolean", |
| 8627 | + "default": "false", |
| 8628 | + "required": false, |
| 8629 | + "description": "Keeps every item in place, as `disabled` on each item does." |
| 8630 | + }, |
| 8631 | + { |
| 8632 | + "name": "itemLabel", |
| 8633 | + "type": "(value: string) => string | undefined", |
| 8634 | + "default": "", |
| 8635 | + "required": false, |
| 8636 | + "description": "The name a screen reader hears for an item, when its text says more than its name." |
| 8637 | + }, |
| 8638 | + { |
| 8639 | + "name": "announce", |
| 8640 | + "type": "(announcement: SortableListAnnouncement) => string | undefined", |
| 8641 | + "default": "", |
| 8642 | + "required": false, |
| 8643 | + "description": "Puts a step into words for a screen reader. Return `undefined` for the English default, or `\"\"` to say nothing. Use it to translate." |
| 8644 | + }, |
| 8645 | + { |
| 8646 | + "name": "instructions", |
| 8647 | + "type": "string", |
| 8648 | + "default": "", |
| 8649 | + "required": false, |
| 8650 | + "description": "How to reorder from the keyboard, read with each item (or handle). An English sentence by default: \"To reorder, press Space to pick an item up…\"." |
| 8651 | + }, |
| 8652 | + { |
| 8653 | + "name": "roleDescription", |
| 8654 | + "type": "{ list?: string; item?: string }", |
| 8655 | + "default": "", |
| 8656 | + "required": false, |
| 8657 | + "description": "What a screen reader calls the list and its items, in place of \"sortable list\" and \"sortable item\". Translate it with `instructions` and `announce`." |
| 8658 | + }, |
| 8659 | + { |
| 8660 | + "name": "className", |
| 8661 | + "type": "string", |
| 8662 | + "default": "", |
| 8663 | + "required": false, |
| 8664 | + "description": "" |
| 8665 | + } |
| 8666 | + ], |
| 8667 | + "variants": [], |
| 8668 | + "dataSlots": [ |
| 8669 | + "sortable-list" |
| 8670 | + ], |
| 8671 | + "state": [ |
| 8672 | + { |
| 8673 | + "prop": "value", |
| 8674 | + "defaultProp": "defaultValue", |
| 8675 | + "onChange": "onValueChange" |
| 8676 | + } |
| 8677 | + ], |
| 8678 | + "asChild": false |
| 8679 | + }, |
| 8680 | + { |
| 8681 | + "name": "SortableListHandle", |
| 8682 | + "description": "The grip a reader drags an item by, in a SortableList with `handle`. It is a button, so it needs a name that says which item it moves: `aria-label=\"Reorder Mosaic\"`. It is disabled with its item, never on its own, so it stays focusable and says why it does nothing.", |
| 8683 | + "extends": [ |
| 8684 | + "Omit<React.ComponentProps<\"button\">, \"type\" | \"value\" | \"disabled\">" |
| 8685 | + ], |
| 8686 | + "props": [ |
| 8687 | + { |
| 8688 | + "name": "\"aria-label\"", |
| 8689 | + "type": "string", |
| 8690 | + "default": "", |
| 8691 | + "required": true, |
| 8692 | + "description": "Names the item it moves: `Reorder Mosaic`." |
| 8693 | + }, |
| 8694 | + { |
| 8695 | + "name": "className", |
| 8696 | + "type": "string", |
| 8697 | + "default": "", |
| 8698 | + "required": false, |
| 8699 | + "description": "" |
| 8700 | + } |
| 8701 | + ], |
| 8702 | + "variants": [], |
| 8703 | + "dataSlots": [ |
| 8704 | + "sortable-list-handle" |
| 8705 | + ], |
| 8706 | + "state": [], |
| 8707 | + "asChild": false |
| 8708 | + }, |
| 8709 | + { |
| 8710 | + "name": "SortableListItem", |
| 8711 | + "description": "One entry of a SortableList. `value` is its stable key, the string the order is made of; `disabled` keeps it in place (it can't be picked up, the others move past it). Without `handle` on the list, the whole item is what the reader drags and moves, so it holds text, icons or a Badge, never a control.", |
| 8712 | + "extends": [ |
| 8713 | + "Omit<React.ComponentProps<\"li\">, \"value\" | \"role\">" |
| 8714 | + ], |
| 8715 | + "props": [ |
| 8716 | + { |
| 8717 | + "name": "value", |
| 8718 | + "type": "string", |
| 8719 | + "default": "", |
| 8720 | + "required": true, |
| 8721 | + "description": "The item's stable key: one of the list's `value`s." |
| 8722 | + }, |
| 8723 | + { |
| 8724 | + "name": "disabled", |
| 8725 | + "type": "boolean", |
| 8726 | + "default": "", |
| 8727 | + "required": false, |
| 8728 | + "description": "Keeps the item in place: it can't be picked up, and the others move past it." |
| 8729 | + }, |
| 8730 | + { |
| 8731 | + "name": "className", |
| 8732 | + "type": "string", |
| 8733 | + "default": "", |
| 8734 | + "required": false, |
| 8735 | + "description": "" |
| 8736 | + } |
| 8737 | + ], |
| 8738 | + "variants": [], |
| 8739 | + "dataSlots": [ |
| 8740 | + "sortable-list-item" |
| 8741 | + ], |
| 8742 | + "state": [], |
| 8743 | + "asChild": false |
| 8744 | + } |
| 8745 | + ], |
| 8746 | + "helpers": [ |
| 8747 | + "SortableListAnnouncement", |
| 8748 | + "SortableListChangeDetails", |
| 8749 | + "SortableListChangeReason" |
| 8750 | + ], |
| 8751 | + "types": [ |
| 8752 | + "SortableListAnnouncement", |
| 8753 | + "SortableListChangeDetails", |
| 8754 | + "SortableListChangeReason" |
| 8755 | + ], |
| 8756 | + "foundation": [ |
| 8757 | + "@ui-sdk/react/primitive" |
| 8758 | + ], |
| 8759 | + "composes": [ |
| 8760 | + "Button" |
| 8761 | + ], |
| 8762 | + "demos": [ |
| 8763 | + "examples/catalog/src/demos/sortable-list/basic.tsx", |
| 8764 | + "examples/catalog/src/demos/sortable-list/controlled.tsx", |
| 8765 | + "examples/catalog/src/demos/sortable-list/custom-content.tsx", |
| 8766 | + "examples/catalog/src/demos/sortable-list/disabled.tsx", |
| 8767 | + "examples/catalog/src/demos/sortable-list/handle.tsx", |
| 8768 | + "examples/catalog/src/demos/sortable-list/horizontal.tsx", |
| 8769 | + "examples/catalog/src/demos/sortable-list/keyboard.tsx", |
| 8770 | + "examples/catalog/src/demos/sortable-list/long-list.tsx" |
| 8771 | + ] |
| 8772 | + }, |
| 8773 | + "authored": { |
| 8774 | + "title": "SortableList", |
| 8775 | + "category": "Forms", |
| 8776 | + "summary": "A list the reader puts in order, by dragging an item or by moving it with the keyboard. Its value is the order, as an array of the items' keys.", |
| 8777 | + "related": [ |
| 8778 | + "toggle-group", |
| 8779 | + "scroll-area", |
| 8780 | + "item" |
| 8781 | + ], |
| 8782 | + "builtOn": [ |
| 8783 | + "UI SDK createReorder" |
| 8784 | + ], |
| 8785 | + "whenToUse": "The reader decides an order that matters, such as pipeline steps, priorities or precedence, and the list is short enough to see or scroll through.", |
| 8786 | + "whenNotToUse": "The order is a sort the data already has, such as by date or by score; sort a Table instead. Don't use it to pick items; that is a Checkbox list or a Combobox." |
| 8787 | + } |
| 8788 | + }, |
8566 | 8789 | { |
8567 | 8790 | "slug": "spinner", |
8568 | 8791 | "import": "@robomous/ui-core", |
|
0 commit comments