diff --git a/src/runtime/components/ChangelogVersion.vue b/src/runtime/components/ChangelogVersion.vue index e2b147564f..1a092be73e 100644 --- a/src/runtime/components/ChangelogVersion.vue +++ b/src/runtime/components/ChangelogVersion.vue @@ -99,7 +99,8 @@ const [DefineDateTemplate, ReuseDateTemplate] = createReusableTemplate<{ hidden? // eslint-disable-next-line vue/no-dupe-keys const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.changelogVersion || {}) })({ - to: !!props.to || !!props.onClick + to: !!props.to || !!props.onClick, + indicator: !!props.indicator || !!slots.indicator })) // eslint-disable-next-line vue/no-dupe-keys diff --git a/src/theme/changelog-version.ts b/src/theme/changelog-version.ts index faa9a7ebc6..b71fc572b0 100644 --- a/src/theme/changelog-version.ts +++ b/src/theme/changelog-version.ts @@ -39,6 +39,15 @@ export default (options: Required) => ({ true: { date: 'lg:hidden' } + }, + indicator: { + true: { + // Reserve the indicator gutter (`w-32`) on both sides so the centered container + // never slides under the absolutely positioned indicator on narrow containers. + // The `50%` floor keeps the container from collapsing to `0` when the root is + // narrower than the reservation itself. + container: 'lg:w-[max(50%,calc(100%-16rem))]' + } } } }) diff --git a/test/components/__snapshots__/ChangelogVersion-vue.spec.ts.snap b/test/components/__snapshots__/ChangelogVersion-vue.spec.ts.snap index 5fa4aa8393..adf68e7818 100644 --- a/test/components/__snapshots__/ChangelogVersion-vue.spec.ts.snap +++ b/test/components/__snapshots__/ChangelogVersion-vue.spec.ts.snap @@ -8,7 +8,7 @@ exports[`ChangelogVersion > renders with actions slot correctly 1`] = `
-
+
Actions slot @@ -25,7 +25,7 @@ exports[`ChangelogVersion > renders with as correctly 1`] = `
-
+
@@ -40,7 +40,7 @@ exports[`ChangelogVersion > renders with authors correctly 1`] = `
-
+
@@ -65,7 +65,7 @@ exports[`ChangelogVersion > renders with authors slot correctly 1`] = `
-
+
Authors slot
@@ -82,7 +82,7 @@ exports[`ChangelogVersion > renders with badge correctly 1`] = `
-
+
Badge @@ -105,7 +105,7 @@ exports[`ChangelogVersion > renders with badge object correctly 1`] = `
-
+
Badge @@ -128,7 +128,7 @@ exports[`ChangelogVersion > renders with badge slot correctly 1`] = `
-
+
Badge slot @@ -150,7 +150,7 @@ exports[`ChangelogVersion > renders with body slot correctly 1`] = `
-
+
Body slot
@@ -165,7 +165,7 @@ exports[`ChangelogVersion > renders with class correctly 1`] = `
-
+
@@ -179,7 +179,7 @@ exports[`ChangelogVersion > renders with date correctly 1`] = `
-
+
@@ -201,7 +201,7 @@ exports[`ChangelogVersion > renders with date slot correctly 1`] = `
-
+
@@ -224,7 +224,7 @@ exports[`ChangelogVersion > renders with description correctly 1`] = `
-
+
@@ -244,7 +244,7 @@ exports[`ChangelogVersion > renders with description slot correctly 1`] = `
-
+
@@ -264,7 +264,7 @@ exports[`ChangelogVersion > renders with description slot correctly 2`] = `
-
+
@@ -284,7 +284,7 @@ exports[`ChangelogVersion > renders with footer slot correctly 1`] = `
-
+
Footer slot
@@ -299,7 +299,7 @@ exports[`ChangelogVersion > renders with header slot correctly 1`] = `
-
+
Header slot
@@ -314,7 +314,7 @@ exports[`ChangelogVersion > renders with image correctly 1`] = `
-
+
@@ -336,7 +336,7 @@ exports[`ChangelogVersion > renders with image slot correctly 1`] = `
-
+
@@ -353,7 +353,7 @@ exports[`ChangelogVersion > renders with image slot correctly 1`] = ` exports[`ChangelogVersion > renders with indicator slot correctly 1`] = ` "
-
+
@@ -368,7 +368,7 @@ exports[`ChangelogVersion > renders with title correctly 1`] = `
-
+

@@ -390,7 +390,7 @@ exports[`ChangelogVersion > renders with title slot correctly 1`] = `

-
+

@@ -412,7 +412,7 @@ exports[`ChangelogVersion > renders with title slot correctly 2`] = `

-
+

@@ -434,7 +434,7 @@ exports[`ChangelogVersion > renders with to & image correctly 1`] = `

-
+
@@ -454,7 +454,7 @@ exports[`ChangelogVersion > renders with to correctly 1`] = `
-
+
@@ -469,7 +469,7 @@ exports[`ChangelogVersion > renders with ui correctly 1`] = `
-
+
diff --git a/test/components/__snapshots__/ChangelogVersion.spec.ts.snap b/test/components/__snapshots__/ChangelogVersion.spec.ts.snap index 5fa4aa8393..adf68e7818 100644 --- a/test/components/__snapshots__/ChangelogVersion.spec.ts.snap +++ b/test/components/__snapshots__/ChangelogVersion.spec.ts.snap @@ -8,7 +8,7 @@ exports[`ChangelogVersion > renders with actions slot correctly 1`] = `
-
+
Actions slot @@ -25,7 +25,7 @@ exports[`ChangelogVersion > renders with as correctly 1`] = `
-
+
@@ -40,7 +40,7 @@ exports[`ChangelogVersion > renders with authors correctly 1`] = `
-
+
@@ -65,7 +65,7 @@ exports[`ChangelogVersion > renders with authors slot correctly 1`] = `
-
+
Authors slot
@@ -82,7 +82,7 @@ exports[`ChangelogVersion > renders with badge correctly 1`] = `
-
+
Badge @@ -105,7 +105,7 @@ exports[`ChangelogVersion > renders with badge object correctly 1`] = `
-
+
Badge @@ -128,7 +128,7 @@ exports[`ChangelogVersion > renders with badge slot correctly 1`] = `
-
+
Badge slot @@ -150,7 +150,7 @@ exports[`ChangelogVersion > renders with body slot correctly 1`] = `
-
+
Body slot
@@ -165,7 +165,7 @@ exports[`ChangelogVersion > renders with class correctly 1`] = `
-
+
@@ -179,7 +179,7 @@ exports[`ChangelogVersion > renders with date correctly 1`] = `
-
+
@@ -201,7 +201,7 @@ exports[`ChangelogVersion > renders with date slot correctly 1`] = `
-
+
@@ -224,7 +224,7 @@ exports[`ChangelogVersion > renders with description correctly 1`] = `
-
+
@@ -244,7 +244,7 @@ exports[`ChangelogVersion > renders with description slot correctly 1`] = `
-
+
@@ -264,7 +264,7 @@ exports[`ChangelogVersion > renders with description slot correctly 2`] = `
-
+
@@ -284,7 +284,7 @@ exports[`ChangelogVersion > renders with footer slot correctly 1`] = `
-
+
Footer slot
@@ -299,7 +299,7 @@ exports[`ChangelogVersion > renders with header slot correctly 1`] = `
-
+
Header slot
@@ -314,7 +314,7 @@ exports[`ChangelogVersion > renders with image correctly 1`] = `
-
+
@@ -336,7 +336,7 @@ exports[`ChangelogVersion > renders with image slot correctly 1`] = `
-
+
@@ -353,7 +353,7 @@ exports[`ChangelogVersion > renders with image slot correctly 1`] = ` exports[`ChangelogVersion > renders with indicator slot correctly 1`] = ` "
-
+
@@ -368,7 +368,7 @@ exports[`ChangelogVersion > renders with title correctly 1`] = `
-
+

@@ -390,7 +390,7 @@ exports[`ChangelogVersion > renders with title slot correctly 1`] = `

-
+

@@ -412,7 +412,7 @@ exports[`ChangelogVersion > renders with title slot correctly 2`] = `

-
+

@@ -434,7 +434,7 @@ exports[`ChangelogVersion > renders with to & image correctly 1`] = `

-
+
@@ -454,7 +454,7 @@ exports[`ChangelogVersion > renders with to correctly 1`] = `
-
+
@@ -469,7 +469,7 @@ exports[`ChangelogVersion > renders with ui correctly 1`] = `
-
+
diff --git a/test/components/__snapshots__/ChangelogVersions-vue.spec.ts.snap b/test/components/__snapshots__/ChangelogVersions-vue.spec.ts.snap index c49cfb2ca5..b0427f338d 100644 --- a/test/components/__snapshots__/ChangelogVersions-vue.spec.ts.snap +++ b/test/components/__snapshots__/ChangelogVersions-vue.spec.ts.snap @@ -14,7 +14,7 @@ exports[`ChangelogVersions > renders with as correctly 1`] = `
-
+
Badge @@ -58,7 +58,7 @@ exports[`ChangelogVersions > renders with class correctly 1`] = `
-
+
Badge @@ -109,7 +109,7 @@ exports[`ChangelogVersions > renders with indicator slot correctly 1`] = `
-
+
Badge @@ -153,7 +153,7 @@ exports[`ChangelogVersions > renders with ui correctly 1`] = `
-
+
Badge @@ -197,7 +197,7 @@ exports[`ChangelogVersions > renders with versions correctly 1`] = `
-
+
Badge diff --git a/test/components/__snapshots__/ChangelogVersions.spec.ts.snap b/test/components/__snapshots__/ChangelogVersions.spec.ts.snap index c49cfb2ca5..b0427f338d 100644 --- a/test/components/__snapshots__/ChangelogVersions.spec.ts.snap +++ b/test/components/__snapshots__/ChangelogVersions.spec.ts.snap @@ -14,7 +14,7 @@ exports[`ChangelogVersions > renders with as correctly 1`] = `
-
+
Badge @@ -58,7 +58,7 @@ exports[`ChangelogVersions > renders with class correctly 1`] = `
-
+
Badge @@ -109,7 +109,7 @@ exports[`ChangelogVersions > renders with indicator slot correctly 1`] = `
-
+
Badge @@ -153,7 +153,7 @@ exports[`ChangelogVersions > renders with ui correctly 1`] = `
-
+
Badge @@ -197,7 +197,7 @@ exports[`ChangelogVersions > renders with versions correctly 1`] = `
-
+
Badge