feat: migrate Toast and Table with reviewed state focus and SSR contracts
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, h, Fragment, useAttrs, type PropType } from "vue";
|
||||
|
||||
/**
|
||||
* Declarative items renderer for rows. Use the default scoped slot with
|
||||
* each item, matching the upstream Table.Collection API.
|
||||
*/
|
||||
export default defineComponent({
|
||||
name: "TableCollection",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
items: { type: Array as PropType<unknown[]>, default: () => [] },
|
||||
as: { type: String, default: undefined },
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const attrs = useAttrs();
|
||||
return () => {
|
||||
const children = (props.items ?? []).map((item, index) =>
|
||||
slots.default?.({ item, index }),
|
||||
);
|
||||
return props.as
|
||||
? h(props.as, { ...attrs, "data-slot": "table-collection" }, children)
|
||||
: h(Fragment, children);
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user