feat: migrate Pagination Header and InputOTP with field and event regressions
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, h, inject, useAttrs } from "vue";
|
||||
import { paginationContextKey } from "./context";
|
||||
|
||||
export default defineComponent({
|
||||
name: "PaginationSummary",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
/** Render the summary as a custom element instead of `div`. */
|
||||
as: {
|
||||
type: String,
|
||||
default: "div",
|
||||
},
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const attrs = useAttrs();
|
||||
const context = inject(paginationContextKey, null);
|
||||
|
||||
function render() {
|
||||
const { class: cls, dir, ...rest } = attrs as Record<string, unknown>;
|
||||
return h(
|
||||
props.as,
|
||||
{
|
||||
...rest,
|
||||
// Auto-detect base direction from the summary's own text so mixed
|
||||
// number/word content is not bidi-reordered by an RTL ancestor.
|
||||
// Explicit `dir` still overrides.
|
||||
dir: dir === undefined ? "auto" : dir,
|
||||
class: [context?.slots.value.summary(), cls],
|
||||
"data-slot": "pagination-summary",
|
||||
},
|
||||
slots.default?.(),
|
||||
);
|
||||
}
|
||||
|
||||
return render;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user