diff --git a/components/src/DesignTokens/DesignTokens.svelte b/components/src/DesignTokens/DesignTokens.svelte index 3aea3e6..4537620 100644 --- a/components/src/DesignTokens/DesignTokens.svelte +++ b/components/src/DesignTokens/DesignTokens.svelte @@ -19,6 +19,7 @@ '--br-large: 8px', '--br-small: 4px', '--ratio: 1.15', + '--input-height: 2.5rem', '--swr-sans: "SWR-VAR-Sans", sans-serif', '--swr-text: "SWR-VAR-Text", sans-serif', '--fs-small-3: calc(var(--fs-small-2) / var(--ratio))', diff --git a/components/src/Switcher/Switcher.stories.js b/components/src/Switcher/Switcher.stories.js deleted file mode 100644 index 851510f..0000000 --- a/components/src/Switcher/Switcher.stories.js +++ /dev/null @@ -1,38 +0,0 @@ -import { userEvent, within, expect } from "@storybook/test" -import Switcher from "." - -export default { - title: "Example/Switcher", - tags: ["autodocs"], - component: Switcher, -} - -export const TwoOptions = { - args: { - options: ["Option A", "Option B"], - groupName: "two-options", - value: "Option A", - }, -} - -export const FourOptions = { - args: { - options: ["Apples", "Oranges", "Bananas", "Peaches"], - groupName: "four-options", - value: "Oranges", - }, - play: async ({ canvasElement, step }) => { - const canvas = within(canvasElement) - - await step("Clicking selects the expected option", async () => { - const optionA = canvas.getByLabelText("Apples") - const optionB = canvas.getByLabelText("Bananas") - await userEvent.click(optionA) - expect(optionA).toBeChecked() - expect(optionB).not.toBeChecked() - await userEvent.click(optionB) - expect(optionB).toBeChecked() - expect(optionA).not.toBeChecked() - }) - }, -} diff --git a/components/src/Switcher/Switcher.stories.svelte b/components/src/Switcher/Switcher.stories.svelte new file mode 100644 index 0000000..26f621d --- /dev/null +++ b/components/src/Switcher/Switcher.stories.svelte @@ -0,0 +1,55 @@ + + + + + + + + + { + const canvas = within(canvasElement) + await step("Clicking selects the expected option", async () => { + const optionA = canvas.getByLabelText("Apples") + const optionB = canvas.getByLabelText("Bananas") + await userEvent.click(optionA) + expect(optionA).toBeChecked() + expect(optionB).not.toBeChecked() + await userEvent.click(optionB) + expect(optionB).toBeChecked() + expect(optionA).not.toBeChecked() + }) + }}> + + + + diff --git a/components/src/Switcher/Switcher.svelte b/components/src/Switcher/Switcher.svelte index f6f2bf6..4a56c74 100644 --- a/components/src/Switcher/Switcher.svelte +++ b/components/src/Switcher/Switcher.svelte @@ -7,6 +7,9 @@ // Machine-readable name for the form field. Should be unique to other fields in the form. export let groupName: string = ''; + // Type size + export let size: string = 'default'; + // The currently selected option export let value: string = options[0]; @@ -23,7 +26,7 @@ Radio-like form component to choose exactly one of a given set of options. @component --> -
+
{label}