Skip to content

feat: mp-3203-add a small size to KvSwitch - #902

Merged
infante-jaime merged 3 commits into
mainfrom
feature/mp-3203-kv-switch-small-size
Sep 11, 2026
Merged

infante-jaime merged 3 commits into
mainfrom
feature/mp-3203-kv-switch-small-size

Conversation

@infante-jaime

@infante-jaime infante-jaime commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

https://kiva.atlassian.net/browse/MP-3203

What this does

Adds a size prop to KvSwitch: default and small.

Checkout's tip-from-balance experiment needs a 48×28 switch per design, and KvSwitch hardcoded 56×32 with no way to change it — the consuming app is currently doing it with a scoped :deep override of the component's internals, which is the kind of thing this prop exists to remove.

The prop

Follows the KvButton size pattern: validated string, default | small, computed classes per size.

default — 56×32 track, 24px knob, 24px travel. Byte-for-byte the same classes as before, just moved from the static class attribute into the computed's default branch, so every existing consumer renders unchanged.
small — 48×28 track, 20px knob, 20px travel. The travel is derived from the geometry (track minus knob minus its margins), so the knob sits flush at both ends.
Tests

Both sizes pinned in the spec — including default, so a future change to the stock size fails a test instead of slipping through. The 53 pre-existing failures in unrelated suites are identical on main.

Story

Added a Small story and a size select control. This meant rewriting KvSwitch.stories.js to the modern args pattern (setup() { return { args }; }, as in KvButton.stories.js) — the old Vue 2-style props: Object.keys(argTypes) template was silently ignoring args in the current Storybook, so the existing Disabled story has been rendering an enabled switch. That's fixed as a side effect. The dead checked arg (never a real prop) and the console.log on change were dropped in the rewrite.

Consumer follow-up

Once this publishes, ui swaps its :deep override for size="small" (change already staged there, riding with the version bump).

@infante-jaime
infante-jaime requested a review from a team September 11, 2026 03:40
@infante-jaime
infante-jaime force-pushed the feature/mp-3203-kv-switch-small-size branch from e24fbb6 to 68f79ba Compare September 11, 2026 04:16
@roger-in-kiva

Copy link
Copy Markdown
Collaborator

We should probably add documentation using this prompt:
https://github.com/kiva/kv-ui-elements/blob/main/%40kiva/kv-components/docs/ai-documentation-prompt.md

@dyersituations dyersituations left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good pending using Skill to update docs.

@dyersituations dyersituations added the b2c Sends B2C team a message in Slack on PR creation label Sep 11, 2026
@eddieferrer

eddieferrer commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

I don't think this is related to this change specifically, but I noticed that the "disabled" functionality is not working:
https://608b4cf87f686c00213841b1-dgkmnopcrj.chromatic.com/?path=/story/forms-kvswitch--disabled

@mcstover mcstover left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. We should make sure that Design knows about the updates as they are incorporating these into the design system

@cristhianDt cristhianDt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , just add the link to the ticket please, or any additional confirmation by design/product team, thanks

@infante-jaime

Copy link
Copy Markdown
Contributor Author

I don't think this is related to this change specifically, but I noticed that the "disabled" functionality is not working: https://608b4cf87f686c00213841b1-dgkmnopcrj.chromatic.com/?path=/story/forms-kvswitch--disabled

Hey @eddieferrer, you're right. I just made a quick fix. It was only a Storybook issue, not component-related, so I think it's fine to include it here.

@mcstover

Copy link
Copy Markdown
Collaborator

@infante-jaime Need a small update to the Kitchen Sink story for the disabled state too:
https://www.chromatic.com/test?appId=608b4cf87f686c00213841b1&id=6aa42c87b3b17366c39bcca1

@infante-jaime

Copy link
Copy Markdown
Contributor Author

@infante-jaime Need a small update to the Kitchen Sink story for the disabled state too: https://www.chromatic.com/test?appId=608b4cf87f686c00213841b1&id=6aa42c87b3b17366c39bcca1

yes on it TY

@infante-jaime
infante-jaime merged commit dc13c52 into main Sep 11, 2026
5 checks passed

@dyersituations dyersituations left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

b2c Sends B2C team a message in Slack on PR creation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants