[]>(
() => [
{
id: "all",
@@ -365,7 +365,7 @@ const detectedPlatformCount = computed(
- {
MatchRomBodyGrid,
RTextField: true,
RSelect: true,
- RSliderBtnGroup: true,
+ RSegmentedControl: true,
RIcon: true,
RSpinner: true,
RTooltip: true,
diff --git a/frontend/src/components/Dialogs/MatchRomDialog.vue b/frontend/src/components/Dialogs/MatchRomDialog.vue
index f3bdcf43b..ef69a5ea7 100644
--- a/frontend/src/components/Dialogs/MatchRomDialog.vue
+++ b/frontend/src/components/Dialogs/MatchRomDialog.vue
@@ -22,7 +22,7 @@ import {
RDialog,
RIcon,
RSelect,
- RSliderBtnGroup,
+ RSegmentedControl,
RSpinner,
RTextField,
} from "@/lib";
@@ -319,7 +319,7 @@ function closeDialog() {
-
providerLabels.get(slug) ?? slug;
// ── Tri-state mapping helpers ──────────────────────────────────
-// The RSliderBtnGroup speaks string ids; the store speaks `boolean | null`.
+// The RSegmentedControl speaks string ids; the store speaks `boolean | null`.
// One helper makes the binding bidirectional in a few lines.
type TriValue = "all" | "yes" | "no";
function triFor(v: boolean | null): TriValue {
@@ -555,7 +555,7 @@ function saveAsSmartCollection() {
{{ cfg.label }}
-
- {
it("hides the direction toggle while the unsorted order is active", () => {
const sorted = mountWithSortOptions({ unsortedLabel: "Relevance" });
const togglesWhenSorted = sorted.findAllComponents({
- name: "RSliderBtnGroup",
+ name: "RSegmentedControl",
}).length;
sorted.unmount();
@@ -168,9 +168,9 @@ describe("GalleryToolbar sort axis", () => {
unsorted: true,
});
- expect(wrapper.findAllComponents({ name: "RSliderBtnGroup" })).toHaveLength(
- togglesWhenSorted - 1,
- );
+ expect(
+ wrapper.findAllComponents({ name: "RSegmentedControl" }),
+ ).toHaveLength(togglesWhenSorted - 1);
const relevance = wrapper
.findAllComponents({ name: "RMenuItem" })
.find((item) => item.props("label") === "Relevance");
@@ -184,7 +184,7 @@ describe("GalleryToolbar sort axis", () => {
it("ticks nothing and keeps the toggle for a sort it doesn't offer", () => {
const sorted = mountWithSortOptions({ unsortedLabel: "Relevance" });
const togglesWhenSorted = sorted.findAllComponents({
- name: "RSliderBtnGroup",
+ name: "RSegmentedControl",
}).length;
sorted.unmount();
@@ -194,9 +194,9 @@ describe("GalleryToolbar sort axis", () => {
unsorted: false,
});
- expect(wrapper.findAllComponents({ name: "RSliderBtnGroup" })).toHaveLength(
- togglesWhenSorted,
- );
+ expect(
+ wrapper.findAllComponents({ name: "RSegmentedControl" }),
+ ).toHaveLength(togglesWhenSorted);
const ticked = wrapper
.findAllComponents({ name: "RMenuItem" })
.filter(
diff --git a/frontend/src/components/Gallery/GalleryToolbar.vue b/frontend/src/components/Gallery/GalleryToolbar.vue
index 613d9bf87..f974c7c47 100644
--- a/frontend/src/components/Gallery/GalleryToolbar.vue
+++ b/frontend/src/components/Gallery/GalleryToolbar.vue
@@ -25,7 +25,7 @@ import {
RIcon,
RMenu,
RMenuItem,
- RSliderBtnGroup,
+ RSegmentedControl,
RTextField,
} from "@/lib";
import { shouldAutofocusSearch } from "@/utils/autofocus";
@@ -315,7 +315,7 @@ const { smAndUp } = useBreakpoint();
-
-
-
-
`,
};
-const RSliderBtnGroup = {
+const RSegmentedControl = {
props: ["modelValue", "items"],
emits: ["update:modelValue"],
template: ``,
@@ -64,7 +64,7 @@ function openDialog() {
const wrapper = mount(LoadSaveStateDialog, {
global: {
provide: { emitter },
- stubs: { RDialog, RSliderBtnGroup, AssetList, AssetStrip, RBtn: true },
+ stubs: { RDialog, RSegmentedControl, AssetList, AssetStrip, RBtn: true },
},
});
const open = async () => {
diff --git a/frontend/src/components/Player/LoadSaveStateDialog.vue b/frontend/src/components/Player/LoadSaveStateDialog.vue
index 6b3fb96b7..b6070779d 100644
--- a/frontend/src/components/Player/LoadSaveStateDialog.vue
+++ b/frontend/src/components/Player/LoadSaveStateDialog.vue
@@ -11,7 +11,7 @@ import { useBreakpoint } from "@/composables/useBreakpoint";
import { useConfirm } from "@/composables/useConfirm";
import { useEmitterEvent } from "@/composables/useEmitterEvent";
import { useSaveStateTabs } from "@/composables/useSaveStateTabs";
-import { RDialog, RSliderBtnGroup } from "@/lib";
+import { RDialog, RSegmentedControl } from "@/lib";
import type { DetailedRom } from "@/stores/roms";
import type { Events } from "@/types/emitter";
import type { Asset, AssetType } from "@/utils/assets";
@@ -89,7 +89,7 @@ function closeDialog() {
-
(tab);
const first = (list: { id: number }[]) =>
@@ -73,7 +79,7 @@ function renderPanel(
const selectedSaveId = ref(first(saves));
const selectedStateId = ref(first(states));
- const tabs = computed[]>(() => [
+ const tabs = computed[]>(() => [
{
id: "save",
label: `Saves${saves.length ? ` · ${saves.length}` : ""}`,
@@ -147,7 +153,7 @@ function renderPanel(
"
>
-
("name");
const searchQuery = ref("");
-const orderItems = computed[]>(() => [
+const orderItems = computed[]>(() => [
{
id: "name",
icon: "mdi-sort-alphabetical-variant",
@@ -213,7 +213,7 @@ function onRowClick(e: MouseEvent, platformId: number): void {
- `'s
+ toggle; mousedown is stopped too so ``'s
pointer-based active-pill animation doesn't trigger a row
click on release. */
-->
diff --git a/frontend/src/composables/useSaveStateTabs/index.ts b/frontend/src/composables/useSaveStateTabs/index.ts
index c4f46823a..0bb4a4737 100644
--- a/frontend/src/composables/useSaveStateTabs/index.ts
+++ b/frontend/src/composables/useSaveStateTabs/index.ts
@@ -1,7 +1,7 @@
import { computed, toValue, type MaybeRefOrGetter } from "vue";
import { useI18n } from "vue-i18n";
import type { SaveSchema, StateSchema } from "@/__generated__";
-import type { SliderBtnGroupItem } from "@/lib/primitives/RSliderBtnGroup/types";
+import type { SegmentedControlItem } from "@/lib/primitives/RSegmentedControl/types";
import { useStreamingStore } from "@/stores/streaming";
import { isCoreCompatible, type AssetType } from "@/utils/assets";
@@ -25,7 +25,7 @@ export function useSaveStateTabs(
() => compatibleStates.value.length === stateCount.value,
);
- const tabs = computed[]>(() => [
+ const tabs = computed[]>(() => [
{
id: "save",
label: t("common.saves"),
diff --git a/frontend/src/lib/index.ts b/frontend/src/lib/index.ts
index fb379ee85..ccb8f4c13 100644
--- a/frontend/src/lib/index.ts
+++ b/frontend/src/lib/index.ts
@@ -25,8 +25,8 @@ export * from "./primitives/RLetterHeading";
export * from "./primitives/RMarquee";
export * from "./primitives/RProgressCircular";
export * from "./primitives/RProgressLinear";
+export * from "./primitives/RSegmentedControl";
export * from "./primitives/RSkeletonBlock";
-export * from "./primitives/RSliderBtnGroup";
export * from "./primitives/RSpinner";
export * from "./primitives/RSteps";
export * from "./primitives/RTabNav";
diff --git a/frontend/src/lib/primitives/RBtn/RBtn.stories.ts b/frontend/src/lib/primitives/RBtn/RBtn.stories.ts
index 01e5226ae..0c259de70 100644
--- a/frontend/src/lib/primitives/RBtn/RBtn.stories.ts
+++ b/frontend/src/lib/primitives/RBtn/RBtn.stories.ts
@@ -366,7 +366,7 @@ export const FormActions: Story = {
/**
* `surface` gives an outlined icon-only RBtn the same tinted chrome as the
- * `RSliderBtnGroup` beside it.
+ * `RSegmentedControl` beside it.
*/
export const SurfaceWithSlider: Story = {
name: "Surface modifier (icon button next to slider)",
diff --git a/frontend/src/lib/primitives/RBtn/RBtn.vue b/frontend/src/lib/primitives/RBtn/RBtn.vue
index 2fc47d3ed..b25c522be 100644
--- a/frontend/src/lib/primitives/RBtn/RBtn.vue
+++ b/frontend/src/lib/primitives/RBtn/RBtn.vue
@@ -86,7 +86,7 @@ interface Props {
/** Paints the lib's `--r-color-bg-elevated` token behind the button.
* Composes with any variant: use it when the button needs to read
* as "raised on a tinted pill" rather than "transparent on the page",
- * so it visually aligns with adjacent segmented `RSliderBtnGroup`
+ * so it visually aligns with adjacent segmented `RSegmentedControl`
* surfaces (e.g., toolbar icon buttons next to sliders). */
surface?: boolean;
/** Toggle state. Defined → `aria-pressed`; true → translucent tint. */
diff --git a/frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.stories.ts b/frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.stories.ts
similarity index 89%
rename from frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.stories.ts
rename to frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.stories.ts
index 0341c74f6..206199241 100644
--- a/frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.stories.ts
+++ b/frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.stories.ts
@@ -1,12 +1,12 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import { ref } from "vue";
-import RSliderBtnGroup from "./RSliderBtnGroup.vue";
+import RSegmentedControl from "./RSegmentedControl.vue";
// Generic components can't fill Storybook's `component` slot, so it's cast;
// the instantiation types the stories' args.
-const meta: Meta> = {
- title: "Primitives/RSliderBtnGroup",
- component: RSliderBtnGroup as never,
+const meta: Meta> = {
+ title: "Primitives/RSegmentedControl",
+ component: RSegmentedControl as never,
argTypes: {
variant: {
control: "select",
@@ -33,13 +33,13 @@ type Story = StoryObj;
export const Segmented: Story = {
args: { variant: "segmented" },
render: (args) => ({
- components: { RSliderBtnGroup },
+ components: { RSegmentedControl },
setup() {
const layout = ref<"grid" | "list">("grid");
return { args, layout };
},
template: `
- ({
- components: { RSliderBtnGroup },
+ components: { RSegmentedControl },
setup() {
const active = ref<"home" | "favorites" | "platforms">("home");
return { args, active };
},
template: `
- ({
- components: { RSliderBtnGroup },
+ components: { RSegmentedControl },
setup() {
const tool = ref<"scan" | "upload" | "patcher">("scan");
return { args, tool };
},
template: `
-
({
- components: { RSliderBtnGroup },
+ components: { RSegmentedControl },
setup() {
const view = ref<"grid" | "list" | "compact">("grid");
return { args, view };
},
template: `
- ({
- components: { RSliderBtnGroup },
+ components: { RSegmentedControl },
setup() {
const group = ref<"none" | "letter">("none");
return { args, group };
},
template: `
- {
+describe("RSegmentedControl resize", () => {
let frames: FrameRequestCallback[] = [];
let ro: ReturnType;
@@ -24,7 +24,7 @@ describe("RSliderBtnGroup resize", () => {
});
async function render() {
- const wrapper = mount(RSliderBtnGroup, {
+ const wrapper = mount(RSegmentedControl, {
props: {
modelValue: "a",
items: [
@@ -42,11 +42,11 @@ describe("RSliderBtnGroup resize", () => {
it("snaps into place without sliding when a hidden group is shown", async () => {
const wrapper = await render();
- const group = wrapper.get(".r-slider-btn-group").element;
+ const group = wrapper.get(".r-segmented-control").element;
const animated = () =>
wrapper
- .get(".r-slider-btn-group__indicator")
- .classes("r-slider-btn-group__indicator--animate");
+ .get(".r-segmented-control__indicator")
+ .classes("r-segmented-control__indicator--animate");
expect(animated()).toBe(true);
vi.spyOn(group, "getBoundingClientRect").mockReturnValue(
@@ -63,7 +63,7 @@ describe("RSliderBtnGroup resize", () => {
it("stops observing on unmount", async () => {
const wrapper = await render();
- const group = wrapper.get(".r-slider-btn-group").element;
+ const group = wrapper.get(".r-segmented-control").element;
expect(ro.isObserved(group)).toBe(true);
wrapper.unmount();
diff --git a/frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.vue b/frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.vue
similarity index 82%
rename from frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.vue
rename to frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.vue
index 7992f9068..bc8b58719 100644
--- a/frontend/src/lib/primitives/RSliderBtnGroup/RSliderBtnGroup.vue
+++ b/frontend/src/lib/primitives/RSegmentedControl/RSegmentedControl.vue
@@ -1,5 +1,5 @@
@@ -178,20 +178,20 @@ function showBadge(badge: SliderBtnGroupItem["badge"]): boolean {
["badge"]): boolean {
/>
-
+
{{ item.label }}
-
+
{{ item.badge }}
@@ -238,8 +238,8 @@ function showBadge(badge: SliderBtnGroupItem["badge"]): boolean {
variant="text"
density="compact"
size="x-small"
- class="r-slider-btn-group__btn"
- :class="{ 'r-slider-btn-group__btn--active': item.id === modelValue }"
+ class="r-segmented-control__btn"
+ :class="{ 'r-segmented-control__btn--active': item.id === modelValue }"
:aria-label="item.ariaLabel"
:aria-pressed="item.id === modelValue"
:disabled="disabled || item.disabled"
@@ -253,10 +253,10 @@ function showBadge(badge: SliderBtnGroupItem["badge"]): boolean {
/>
-
+
{{ item.label }}
-
+
{{ item.badge }}
@@ -266,7 +266,7 @@ function showBadge(badge: SliderBtnGroupItem["badge"]): boolean {