| 16 | import { checkReorder } from "./utils/check-reorder" |
| 17 | |
| 18 | export interface Props< |
| 19 | V, |
| 20 | TagName extends ReorderElementTag = DefaultGroupElement |
| 21 | > { |
| 22 | /** |
| 23 | * A HTML element to render this component as. Defaults to `"ul"`. |
| 24 | * |
| 25 | * @public |
| 26 | */ |
| 27 | as?: TagName |
| 28 | |
| 29 | /** |
| 30 | * The axis to reorder along. By default, items will be draggable on this axis. |
| 31 | * To make draggable on both axes, set `<Reorder.Item drag />` |
| 32 | * |
| 33 | * @public |
| 34 | */ |
| 35 | axis?: "x" | "y" |
| 36 | |
| 37 | /** |
| 38 | * A callback to fire with the new value order. For instance, if the values |
| 39 | * are provided as a state from `useState`, this could be the set state function. |
| 40 | * |
| 41 | * @public |
| 42 | */ |
| 43 | onReorder: (newOrder: V[]) => void |
| 44 | |
| 45 | /** |
| 46 | * The latest values state. |
| 47 | * |
| 48 | * ```jsx |
| 49 | * function Component() { |
| 50 | * const [items, setItems] = useState([0, 1, 2]) |
| 51 | * |
| 52 | * return ( |
| 53 | * <Reorder.Group values={items} onReorder={setItems}> |
| 54 | * {items.map((item) => <Reorder.Item key={item} value={item} />)} |
| 55 | * </Reorder.Group> |
| 56 | * ) |
| 57 | * } |
| 58 | * ``` |
| 59 | * |
| 60 | * @public |
| 61 | */ |
| 62 | values: V[] |
| 63 | } |
| 64 | |
| 65 | type ReorderGroupProps< |
| 66 | V, |
nothing calls this directly
no outgoing calls
no test coverage detected