Skip to content

Commit d53cdd1

Browse files
feat(input) - update radio and checkbox components for shine (#2060)
* Update docs - TEMP change * add checkmark class * update docs * Add radio svelte component * Add Checkbox and Checkmark svelte components * add changeset * fix tests * remove todo * use black-300 instead of opacity for checkmark * update a11y and visual tests * Update site-navigation.json * update tests * update based on comments * update visual regression tests * visual tests * Checkbox, radio refactor (#2078) * Checkbox, radio refactor * Cleanup * update based on comments * update based on comments * update visual tests * Update based on comments * Update Checkmark.test.ts * Docs updates for checkbox, radio, checkmark, menu (#2090) * Update menu docs * Update docs, minor styling fixes * Update check control tests * cleanup * Replace Checkbox/Radio w/ CheckControl, Add CheckGroup * Modify docs icons class appending to support new icons * Minor updates * Create MenuCheckItem * Make type prop optional * Add CheckControl, CheckGroup tests * Update Menu tests * visual test images * formatting * fix lint errors * revert table test image changes not related to this PR * revert select test image changes not related to this PR * Remove .s-check, .s-radio, rename .s-check-control to .s-check * remove a couple missed .s-checkbox, .s-radio references * Update table test images that contain checkboxes * Rename docs page to "Check" * Fix minor bugs; include disabled input in visual test * Fix .s-menu > .s-check-group gap; add visual test * Replace .s-check with .s-checkbox, .s-radio * Fix validation state border color * Add Checkbox, Radio Svelte components; hide Check * Give checkbox and radio independent docs pages * Split .s-check-group into .s-checkbox-group, .s-radio-group * Split CheckGroup into CheckboxGroup, RadioGroup * Rename group files in stacks-classic * Regenerate visual regresssion test images * Formatting * Revert some screenshots to reduce PR noise * Replace CheckboxGroup, RadioGroup with FormGroup * Remove Check * Update Radio, Checkbox * CheckboxGroup, RadioGroup updates * Minor docs updates * target correct classes in menu * Update table tests * Consolidate Svelte structure, add/update tests * Formatting and linting * Update stacks svelte radio link * Add stories for change events and bindings * Lift `onValueChange` up to `FormGroup` * Update CheckboxGroup story with onValueChange * Update migration guide, changeset * Minor fixes * Minor fixes * update visual tests --------- Co-authored-by: Dan Cormier <[email protected]> Co-authored-by: Dan Cormier <[email protected]>
1 parent 0b92e2c commit d53cdd1

File tree

1,101 files changed

+7019
-1554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,101 files changed

+7019
-1554
lines changed

.changeset/lemon-shoes-tease.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@stackoverflow/stacks": minor
3+
"@stackoverflow/stacks-svelte": minor
4+
---
5+
6+
Updated checkbox and radio styling in Stacks Classic and documentation for SHINE
7+
`.s-check-control` has been removed
8+
Renamed `.s-check-group` to `.s-form-group`
9+
`.s-checkbox` and `.s-radio` are now expected to be on the container where `.s-check-control` would previously be applied. They are no longer needed on the input itself
10+
Added `.s-checkbox__checkmark` and `.s-radio__checkmark` to Stacks Classic
11+
Added `Checkbox`, `CheckboxGroup`, `Radio`, `RadioGroup` components to Stacks Svelte

MIGRATION_GUIDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
- The variant `Muted` has been removed, `Tonal` has been added
4949
- `s-btn__md` has been removed, `s-btn__lg` has been added
5050

51+
#### Checkbox & Radio
52+
- The `s-checkbox` and `s-radio` classes should now be applied to the container including the `input` and `label`. These classes replace `.s-check-control`
53+
- The `s-checkbox` and `s-radio` classes are no longer needed on the `input` element itself
54+
- The `s-check-group` class has been renamed to `s-form-group`
55+
- Added `.s-checkbox__checkmark` and `.s-radio__checkmark` modifier classes for checkmark-style variants
56+
5157
#### Inputs
5258
- `s-input__md` removed
5359
- `s-input__xl` removed

packages/stacks-classic/lib/components/check-control/check-control.a11y.test.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/stacks-classic/lib/components/check-control/check-control.less

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/stacks-classic/lib/components/check-control/check-control.visual.test.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/stacks-classic/lib/components/check-group/check-group.a11y.test.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/stacks-classic/lib/components/check-group/check-group.less

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/stacks-classic/lib/components/check-group/check-group.visual.test.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

packages/stacks-classic/lib/components/checkbox_radio/checkbox_radio.a11y.test.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
import { html } from "@open-wc/testing";
21
import { runA11yTests } from "../../test/a11y-test-utils";
32
import "../../index";
43

5-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6-
const checkboxTemplate = ({ component, testid, id }: any) =>
7-
html` <div class="s-check-control" data-testid="${testid}">
8-
${component}
9-
<label class="s-label" for="${id}">Label</label>
10-
</div>`;
4+
["s-checkbox", "s-radio"].forEach((atomicClass) => {
5+
const type = atomicClass.replace("s-", "");
116

12-
["checkbox", "radio"].forEach((type) => {
137
describe(type, () => {
148
// TODO include indeterminate
159
["checked", "unchecked"].forEach((state) => {
1610
runA11yTests({
17-
tag: "input",
18-
baseClass: `s-${type}`,
19-
attributes: {
20-
name: "test-name",
21-
id: "test-id",
22-
type,
23-
...(state === "checked" ? { checked: "checked" } : {}),
11+
baseClass: atomicClass,
12+
modifiers: {
13+
global: ["has-warning", "has-error", "has-success"],
14+
primary: ["checkmark"],
15+
},
16+
children: {
17+
default: `
18+
<input
19+
type="${type}"
20+
id="test-input"
21+
name=""
22+
${state === "checked" ? "checked" : ""}/>
23+
<label class="s-label" for="test-input">
24+
Label ${type}
25+
<p class="s-input-message">Description</p>
26+
</label>
27+
`,
2428
},
25-
template: ({ component, testid }) =>
26-
checkboxTemplate({
27-
component,
28-
testid,
29-
id: "test-id",
30-
}),
3129
options: {
32-
testidSuffix: state,
30+
testidSuffix: `${state}-${type}`,
3331
},
3432
});
3533
});

0 commit comments

Comments
 (0)