@noctuatech/uswds 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/flags/alabama.svg +5 -0
- package/assets/flags/alaska.svg +14 -0
- package/assets/flags/arizona.svg +7 -0
- package/assets/flags/arkansas.svg +15 -0
- package/assets/flags/california.svg +8 -0
- package/assets/flags/colorado.svg +8 -0
- package/assets/flags/connecticut.svg +5 -0
- package/assets/flags/delaware.svg +7 -0
- package/assets/flags/florida.svg +5 -0
- package/assets/flags/georgia.svg +5 -0
- package/assets/flags/hawaii.svg +19 -0
- package/assets/flags/idaho.svg +5 -0
- package/assets/flags/illinois.svg +5 -0
- package/assets/flags/indiana.svg +15 -0
- package/assets/flags/iowa.svg +13 -0
- package/assets/flags/kansas.svg +5 -0
- package/assets/flags/kentucky.svg +16 -0
- package/assets/flags/louisiana.svg +14 -0
- package/assets/flags/maine.svg +12 -0
- package/assets/flags/maryland.svg +14 -0
- package/assets/flags/massachusetts.svg +15 -0
- package/assets/flags/michigan.svg +5 -0
- package/assets/flags/minnesota.svg +15 -0
- package/assets/flags/mississippi.svg +10 -0
- package/assets/flags/missouri.svg +16 -0
- package/assets/flags/montana.svg +11 -0
- package/assets/flags/nebraska.svg +13 -0
- package/assets/flags/nevada.svg +14 -0
- package/assets/flags/new_hampshire.svg +13 -0
- package/assets/flags/new_jersey.svg +13 -0
- package/assets/flags/new_mexico.svg +7 -0
- package/assets/flags/new_york.svg +13 -0
- package/assets/flags/north_carolina.svg +5 -0
- package/assets/flags/north_dakota.svg +13 -0
- package/assets/flags/ohio.svg +16 -0
- package/assets/flags/oklahoma.svg +12 -0
- package/assets/flags/oregon.svg +13 -0
- package/assets/flags/pennsylvania.svg +15 -0
- package/assets/flags/rhode_island.svg +13 -0
- package/assets/flags/south_carolina.svg +11 -0
- package/assets/flags/south_dakota.svg +15 -0
- package/assets/flags/tennessee.svg +13 -0
- package/assets/flags/texas.svg +8 -0
- package/assets/flags/utah.svg +9 -0
- package/assets/flags/vermont.svg +13 -0
- package/assets/flags/virginia.svg +5 -0
- package/assets/flags/washington.svg +5 -0
- package/assets/flags/west_virginia.svg +24 -0
- package/assets/flags/wisconsin.svg +5 -0
- package/assets/flags/wyoming.svg +5 -0
- package/package.json +13 -11
- package/src/lib/combo-box/combo-box-option/combo-box-option.element.ts +32 -13
- package/src/lib/combo-box/combo-box.element.ts +161 -43
- package/src/lib/combo-box/combo-box.stories.ts +202 -56
- package/src/lib/combo-box/combo-box.test.ts +140 -22
- package/target/lib/accordion/accordion.element.js +2 -86
- package/target/lib/accordion/accordion.stories.js +1 -26
- package/target/lib/accordion/accordion.test.js +5 -72
- package/target/lib/alert/alert.element.js +2 -71
- package/target/lib/alert/alert.stories.js +1 -41
- package/target/lib/alert/alert.test.js +1 -9
- package/target/lib/button/button.element.js +2 -142
- package/target/lib/button/button.stories.js +1 -6
- package/target/lib/button/button.test.js +1 -3
- package/target/lib/card/card-body/card-body.element.js +1 -8
- package/target/lib/card/card-footer/card-footer.element.js +1 -6
- package/target/lib/card/card-group/card-group.element.js +1 -12
- package/target/lib/card/card-header/card-header.element.js +1 -16
- package/target/lib/card/card-media/card-media.element.js +2 -33
- package/target/lib/card/card.element.js +1 -32
- package/target/lib/card/card.stories.js +2 -107
- package/target/lib/card/card.test.js +1 -20
- package/target/lib/checkbox/checkbox-group/checkbox-group.element.js +2 -10
- package/target/lib/checkbox/checkbox.element.js +2 -112
- package/target/lib/checkbox/checkbox.stories.js +2 -43
- package/target/lib/checkbox/checkbox.test.js +4 -28
- package/target/lib/collection/collection-item/collection-item.element.js +2 -40
- package/target/lib/collection/collection-item/collection-item.test.js +1 -3
- package/target/lib/collection/collection.element.js +2 -10
- package/target/lib/collection/collection.stories.js +1 -63
- package/target/lib/collection/collection.test.js +1 -3
- package/target/lib/combo-box/combo-box-option/combo-box-option.element.d.ts +0 -1
- package/target/lib/combo-box/combo-box-option/combo-box-option.element.js +21 -12
- package/target/lib/combo-box/combo-box-option/combo-box-option.element.js.map +1 -1
- package/target/lib/combo-box/combo-box.element.d.ts +9 -1
- package/target/lib/combo-box/combo-box.element.js +92 -86
- package/target/lib/combo-box/combo-box.element.js.map +1 -1
- package/target/lib/combo-box/combo-box.stories.js +1 -59
- package/target/lib/combo-box/combo-box.stories.js.map +1 -1
- package/target/lib/combo-box/combo-box.test.js +65 -22
- package/target/lib/combo-box/combo-box.test.js.map +1 -1
- package/target/lib/config/config.element.js +1 -5
- package/target/lib/config/config.test.js +1 -3
- package/target/lib/description/description.element.js +1 -7
- package/target/lib/description/description.test.js +1 -3
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js +2 -61
- package/target/lib/file-input/file-input-preview/file-input-preview.test.js +5 -25
- package/target/lib/file-input/file-input.element.js +2 -82
- package/target/lib/file-input/file-input.stories.js +1 -13
- package/target/lib/file-input/file-input.test.js +2 -16
- package/target/lib/icon/icon.element.js +1 -14
- package/target/lib/icon/icon.stories.js +2 -13
- package/target/lib/input/input.element.js +2 -73
- package/target/lib/input/input.stories.js +2 -12
- package/target/lib/input/input.test.js +4 -24
- package/target/lib/input-mask/input-mask.element.js +1 -5
- package/target/lib/input-mask/input-mask.stories.js +1 -12
- package/target/lib/input-mask/input-mask.test.js +4 -24
- package/target/lib/link/link.element.js +2 -18
- package/target/lib/modal/modal-close/modal-close.element.js +2 -36
- package/target/lib/modal/modal-close/modal-close.test.js +1 -3
- package/target/lib/modal/modal-heading/modal-heading.element.js +2 -24
- package/target/lib/modal/modal-heading/modal-heading.test.js +1 -3
- package/target/lib/modal/modal.element.js +2 -33
- package/target/lib/modal/modal.stories.js +1 -18
- package/target/lib/modal/modal.test.js +1 -11
- package/target/lib/radio/radio-option/radio-option.element.js +2 -16
- package/target/lib/radio/radio-option/radio-option.test.js +1 -5
- package/target/lib/radio/radio.element.js +2 -98
- package/target/lib/radio/radio.stories.js +1 -26
- package/target/lib/radio/radio.test.js +5 -103
- package/target/lib/range-slider/range-slider.element.js +2 -52
- package/target/lib/range-slider/range-slider.test.js +3 -17
- package/target/lib/select/select-option/select-option.element.js +1 -5
- package/target/lib/select/select.element.js +2 -49
- package/target/lib/select/select.stories.js +1 -10
- package/target/lib/select/select.test.js +6 -64
- package/target/lib/side-nav/side-nav-item/side-nav-item.element.js +2 -67
- package/target/lib/side-nav/side-nav.element.js +1 -8
- package/target/lib/side-nav/side-nav.stories.js +1 -39
- package/target/lib/side-nav/side-nav.test.js +2 -78
- package/target/lib/step-indicator/step/step.element.js +2 -96
- package/target/lib/step-indicator/step-indicator.element.js +1 -9
- package/target/lib/step-indicator/step-indicator.stories.js +1 -21
- package/target/lib/step-indicator/step-indicator.test.js +1 -9
- package/target/lib/summary-box/summary-box.element.js +2 -14
- package/target/lib/summary-box/summary-box.stories.js +1 -1
- package/target/lib/summary-box/summary-box.test.js +1 -3
- package/target/lib/tag/tag.element.js +1 -22
- package/target/lib/tag/tag.stories.js +1 -1
- package/target/lib/tag/tag.test.js +1 -3
- package/target/lib/textarea/textarea.element.js +2 -49
- package/target/lib/textarea/textarea.test.js +4 -24
|
@@ -4,46 +4,18 @@ import { assert, fixture, html } from "@open-wc/testing";
|
|
|
4
4
|
import { userEvent } from "@testing-library/user-event";
|
|
5
5
|
describe("usa-select", () => {
|
|
6
6
|
it("should be accessible", async () => {
|
|
7
|
-
const el = await fixture(html
|
|
8
|
-
<usa-select name="example">
|
|
9
|
-
Hello World
|
|
10
|
-
|
|
11
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
12
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
13
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
14
|
-
</usa-select>
|
|
15
|
-
`);
|
|
7
|
+
const el = await fixture(html `<usa-select name="example">Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select>`);
|
|
16
8
|
return assert.isAccessible(el);
|
|
17
9
|
});
|
|
18
10
|
it("should create local select options", async () => {
|
|
19
|
-
const form = await fixture(html
|
|
20
|
-
<form>
|
|
21
|
-
<usa-select name="example">
|
|
22
|
-
Hello World
|
|
23
|
-
|
|
24
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
25
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
26
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
27
|
-
</usa-select>
|
|
28
|
-
</form>
|
|
29
|
-
`);
|
|
11
|
+
const form = await fixture(html `<form><usa-select name="example">Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select></form>`);
|
|
30
12
|
const nativeInputs = form
|
|
31
13
|
.querySelector("usa-select")
|
|
32
14
|
?.shadowRoot?.querySelectorAll("option");
|
|
33
15
|
assert.deepEqual(Array.from(nativeInputs ?? []).map((input) => input.value), ["first", "second", "third"]);
|
|
34
16
|
});
|
|
35
17
|
it("should remove select options when options are removed", async () => {
|
|
36
|
-
const form = await fixture(html
|
|
37
|
-
<form>
|
|
38
|
-
<usa-select name="example">
|
|
39
|
-
Hello World
|
|
40
|
-
|
|
41
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
42
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
43
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
44
|
-
</usa-select>
|
|
45
|
-
</form>
|
|
46
|
-
`);
|
|
18
|
+
const form = await fixture(html `<form><usa-select name="example">Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select></form>`);
|
|
47
19
|
const options = form.querySelectorAll("usa-select-option");
|
|
48
20
|
options[1].remove();
|
|
49
21
|
const nativeInputs = form
|
|
@@ -52,32 +24,12 @@ describe("usa-select", () => {
|
|
|
52
24
|
assert.deepEqual(Array.from(nativeInputs ?? []).map((input) => input.value), ["first", "third"]);
|
|
53
25
|
});
|
|
54
26
|
it("should submit form with default values", async () => {
|
|
55
|
-
const form = await fixture(html
|
|
56
|
-
<form>
|
|
57
|
-
<usa-select name="example" value="second">
|
|
58
|
-
Hello World
|
|
59
|
-
|
|
60
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
61
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
62
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
63
|
-
</usa-select>
|
|
64
|
-
</form>
|
|
65
|
-
`);
|
|
27
|
+
const form = await fixture(html `<form><usa-select name="example" value="second">Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select></form>`);
|
|
66
28
|
const value = new FormData(form);
|
|
67
29
|
assert.equal(value.get("example"), "second");
|
|
68
30
|
});
|
|
69
31
|
it("should update form value as select value changed", async () => {
|
|
70
|
-
const form = await fixture(html
|
|
71
|
-
<form>
|
|
72
|
-
<usa-select name="example" value="second">
|
|
73
|
-
Hello World
|
|
74
|
-
|
|
75
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
76
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
77
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
78
|
-
</usa-select>
|
|
79
|
-
</form>
|
|
80
|
-
`);
|
|
32
|
+
const form = await fixture(html `<form><usa-select name="example" value="second">Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select></form>`);
|
|
81
33
|
const select = form.querySelector("usa-select");
|
|
82
34
|
const nativeSelect = select?.shadowRoot?.querySelector("select");
|
|
83
35
|
if (nativeSelect) {
|
|
@@ -87,17 +39,7 @@ describe("usa-select", () => {
|
|
|
87
39
|
assert.equal(value.get("example"), "third");
|
|
88
40
|
});
|
|
89
41
|
it("should not submit when not valid", async () => {
|
|
90
|
-
const form = await fixture(html
|
|
91
|
-
<form>
|
|
92
|
-
<usa-select name="example" required>
|
|
93
|
-
Hello World
|
|
94
|
-
|
|
95
|
-
<usa-select-option value="first">First</usa-select-option>
|
|
96
|
-
<usa-select-option value="second">Second</usa-select-option>
|
|
97
|
-
<usa-select-option value="third">Third</usa-select-option>
|
|
98
|
-
</usa-select>
|
|
99
|
-
</form>
|
|
100
|
-
`);
|
|
42
|
+
const form = await fixture(html `<form><usa-select name="example" required>Hello World<usa-select-option value="first">First</usa-select-option><usa-select-option value="second">Second</usa-select-option><usa-select-option value="third">Third</usa-select-option></usa-select></form>`);
|
|
101
43
|
assert.equal(form.checkValidity(), false);
|
|
102
44
|
});
|
|
103
45
|
});
|
|
@@ -4,73 +4,8 @@ let USASideNavItemElement = (() => {
|
|
|
4
4
|
let _classDecorators = [element({
|
|
5
5
|
tagName: "usa-side-nav-item",
|
|
6
6
|
shadowDom: [
|
|
7
|
-
css
|
|
8
|
-
|
|
9
|
-
--usa-nav-item-padding-left: 2rem;
|
|
10
|
-
|
|
11
|
-
display: block;
|
|
12
|
-
border-top: 1px solid #e6e6e6;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.side-nav-item {
|
|
16
|
-
display: flex;
|
|
17
|
-
padding: 0.5rem 1rem;
|
|
18
|
-
text-decoration: none;
|
|
19
|
-
position: relative;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.side-nav-item:hover {
|
|
23
|
-
background-color: #f0f0f0;
|
|
24
|
-
color: #005ea2;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
::slotted(*) {
|
|
28
|
-
color: #5c5c5c;
|
|
29
|
-
text-decoration: none;
|
|
30
|
-
display: block;
|
|
31
|
-
width: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host(:hover) ::slotted(*) {
|
|
35
|
-
color: #005ea2;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:host([current]) ::slotted(*:not(usa-side-nav-item)) {
|
|
39
|
-
color: #005ea2;
|
|
40
|
-
font-weight: 700;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([current]) .side-nav-item::after {
|
|
44
|
-
background-color: #005ea2;
|
|
45
|
-
border-radius: 99rem;
|
|
46
|
-
content: "";
|
|
47
|
-
display: block;
|
|
48
|
-
position: absolute;
|
|
49
|
-
bottom: 0.25rem;
|
|
50
|
-
top: 0.25rem;
|
|
51
|
-
width: 0.25rem;
|
|
52
|
-
left: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:host([slot="children"]) .side-nav-item {
|
|
56
|
-
padding-left: var(--usa-nav-item-padding-left);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
:host([slot="children"]) ::slotted(usa-side-nav-item) {
|
|
60
|
-
--usa-nav-item-padding-left: 3rem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host([slot="children"]) .side-nav-item::after {
|
|
64
|
-
display: none;
|
|
65
|
-
}
|
|
66
|
-
`,
|
|
67
|
-
html `
|
|
68
|
-
<div class="side-nav-item">
|
|
69
|
-
<slot></slot>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<slot name="children"></slot>
|
|
73
|
-
`,
|
|
7
|
+
css `:host{--usa-nav-item-padding-left:2rem;display:block;border-top:1px solid #e6e6e6}.side-nav-item{display:flex;padding:.5rem 1rem;text-decoration:none;position:relative}.side-nav-item:hover{background-color:#f0f0f0;color:#005ea2}::slotted(*){color:#5c5c5c;text-decoration:none;display:block;width:100%}:host(:hover) ::slotted(*){color:#005ea2}:host([current]) ::slotted(:not(usa-side-nav-item)){color:#005ea2;font-weight:700}:host([current]) .side-nav-item::after{background-color:#005ea2;border-radius:99rem;content:"";display:block;position:absolute;bottom:.25rem;top:.25rem;width:.25rem;left:0}:host([slot=children]) .side-nav-item{padding-left:var(--usa-nav-item-padding-left)}:host([slot=children]) ::slotted(usa-side-nav-item){--usa-nav-item-padding-left:3rem}:host([slot=children]) .side-nav-item::after{display:none}`,
|
|
8
|
+
html `<div class="side-nav-item"><slot></slot></div><slot name="children"></slot>`,
|
|
74
9
|
],
|
|
75
10
|
})];
|
|
76
11
|
let _classDescriptor;
|
|
@@ -4,14 +4,7 @@ let USASideNavElement = (() => {
|
|
|
4
4
|
let _classDecorators = [element({
|
|
5
5
|
tagName: "usa-side-nav",
|
|
6
6
|
shadowDom: [
|
|
7
|
-
css
|
|
8
|
-
:host {
|
|
9
|
-
display: block;
|
|
10
|
-
font-size: 1.06rem;
|
|
11
|
-
line-height: 1.3;
|
|
12
|
-
border-bottom: 1px solid #e6e6e6;
|
|
13
|
-
}
|
|
14
|
-
`,
|
|
7
|
+
css `:host{display:block;font-size:1.06rem;line-height:1.3;border-bottom:1px solid #e6e6e6}`,
|
|
15
8
|
html `<slot></slot>`,
|
|
16
9
|
],
|
|
17
10
|
})];
|
|
@@ -4,45 +4,7 @@ const meta = {
|
|
|
4
4
|
title: "usa-side-nav",
|
|
5
5
|
tags: ["autodocs"],
|
|
6
6
|
render() {
|
|
7
|
-
return html
|
|
8
|
-
<usa-side-nav>
|
|
9
|
-
<usa-side-nav-item current>
|
|
10
|
-
<usa-link href="#">Current Page</usa-link>
|
|
11
|
-
|
|
12
|
-
<usa-side-nav-item slot="children">
|
|
13
|
-
<usa-link href="#">Child</usa-link>
|
|
14
|
-
</usa-side-nav-item>
|
|
15
|
-
|
|
16
|
-
<usa-side-nav-item slot="children" current>
|
|
17
|
-
<usa-link href="#">Child</usa-link>
|
|
18
|
-
|
|
19
|
-
<usa-side-nav-item slot="children">
|
|
20
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
21
|
-
</usa-side-nav-item>
|
|
22
|
-
|
|
23
|
-
<usa-side-nav-item slot="children" current>
|
|
24
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
25
|
-
</usa-side-nav-item>
|
|
26
|
-
|
|
27
|
-
<usa-side-nav-item slot="children">
|
|
28
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
29
|
-
</usa-side-nav-item>
|
|
30
|
-
</usa-side-nav-item>
|
|
31
|
-
|
|
32
|
-
<usa-side-nav-item slot="children">
|
|
33
|
-
<usa-link href="#">Child</usa-link>
|
|
34
|
-
</usa-side-nav-item>
|
|
35
|
-
</usa-side-nav-item>
|
|
36
|
-
|
|
37
|
-
<usa-side-nav-item>
|
|
38
|
-
<usa-link href="#">Parent</usa-link>
|
|
39
|
-
</usa-side-nav-item>
|
|
40
|
-
|
|
41
|
-
<usa-side-nav-item>
|
|
42
|
-
<usa-link href="#">Parent</usa-link>
|
|
43
|
-
</usa-side-nav-item>
|
|
44
|
-
</usa-side-nav>
|
|
45
|
-
`;
|
|
7
|
+
return html `<usa-side-nav><usa-side-nav-item current><usa-link href="#">Current Page</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Child</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item></usa-side-nav>`;
|
|
46
8
|
},
|
|
47
9
|
argTypes: {},
|
|
48
10
|
args: {},
|
|
@@ -4,87 +4,11 @@ import "./side-nav-item/side-nav-item.element.js";
|
|
|
4
4
|
import { assert, fixture, html } from "@open-wc/testing";
|
|
5
5
|
describe("usa-side-nav", () => {
|
|
6
6
|
it("should be accessible", async () => {
|
|
7
|
-
const sideNav = await fixture(html
|
|
8
|
-
<usa-side-nav>
|
|
9
|
-
<usa-side-nav-item current>
|
|
10
|
-
<usa-link href="#">Current Page</usa-link>
|
|
11
|
-
|
|
12
|
-
<usa-side-nav-item slot="children">
|
|
13
|
-
<usa-link href="#">Child</usa-link>
|
|
14
|
-
</usa-side-nav-item>
|
|
15
|
-
|
|
16
|
-
<usa-side-nav-item slot="children" current>
|
|
17
|
-
<usa-link href="#">Child</usa-link>
|
|
18
|
-
|
|
19
|
-
<usa-side-nav-item slot="children">
|
|
20
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
21
|
-
</usa-side-nav-item>
|
|
22
|
-
|
|
23
|
-
<usa-side-nav-item slot="children" current>
|
|
24
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
25
|
-
</usa-side-nav-item>
|
|
26
|
-
|
|
27
|
-
<usa-side-nav-item slot="children">
|
|
28
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
29
|
-
</usa-side-nav-item>
|
|
30
|
-
</usa-side-nav-item>
|
|
31
|
-
|
|
32
|
-
<usa-side-nav-item slot="children">
|
|
33
|
-
<usa-link href="#">Child</usa-link>
|
|
34
|
-
</usa-side-nav-item>
|
|
35
|
-
</usa-side-nav-item>
|
|
36
|
-
|
|
37
|
-
<usa-side-nav-item>
|
|
38
|
-
<usa-link href="#">Parent</usa-link>
|
|
39
|
-
</usa-side-nav-item>
|
|
40
|
-
|
|
41
|
-
<usa-side-nav-item>
|
|
42
|
-
<usa-link href="#">Parent</usa-link>
|
|
43
|
-
</usa-side-nav-item>
|
|
44
|
-
</usa-side-nav>
|
|
45
|
-
`);
|
|
7
|
+
const sideNav = await fixture(html `<usa-side-nav><usa-side-nav-item current><usa-link href="#">Current Page</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Child</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item></usa-side-nav>`);
|
|
46
8
|
return assert.isAccessible(sideNav);
|
|
47
9
|
});
|
|
48
10
|
it("should set child padding correctly", async () => {
|
|
49
|
-
const sideNav = await fixture(html
|
|
50
|
-
<usa-side-nav>
|
|
51
|
-
<usa-side-nav-item current>
|
|
52
|
-
<usa-link href="#">Current Page</usa-link>
|
|
53
|
-
|
|
54
|
-
<usa-side-nav-item slot="children">
|
|
55
|
-
<usa-link href="#">Child</usa-link>
|
|
56
|
-
</usa-side-nav-item>
|
|
57
|
-
|
|
58
|
-
<usa-side-nav-item slot="children" current>
|
|
59
|
-
<usa-link href="#">Child</usa-link>
|
|
60
|
-
|
|
61
|
-
<usa-side-nav-item slot="children">
|
|
62
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
63
|
-
</usa-side-nav-item>
|
|
64
|
-
|
|
65
|
-
<usa-side-nav-item slot="children" current>
|
|
66
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
67
|
-
</usa-side-nav-item>
|
|
68
|
-
|
|
69
|
-
<usa-side-nav-item slot="children">
|
|
70
|
-
<usa-link href="#">Grandchild</usa-link>
|
|
71
|
-
</usa-side-nav-item>
|
|
72
|
-
</usa-side-nav-item>
|
|
73
|
-
|
|
74
|
-
<usa-side-nav-item slot="children">
|
|
75
|
-
<usa-link href="#">Child</usa-link>
|
|
76
|
-
</usa-side-nav-item>
|
|
77
|
-
</usa-side-nav-item>
|
|
78
|
-
|
|
79
|
-
<usa-side-nav-item>
|
|
80
|
-
<usa-link href="#">Parent</usa-link>
|
|
81
|
-
</usa-side-nav-item>
|
|
82
|
-
|
|
83
|
-
<usa-side-nav-item>
|
|
84
|
-
<usa-link href="#">Parent</usa-link>
|
|
85
|
-
</usa-side-nav-item>
|
|
86
|
-
</usa-side-nav>
|
|
87
|
-
`);
|
|
11
|
+
const sideNav = await fixture(html `<usa-side-nav><usa-side-nav-item current><usa-link href="#">Current Page</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Child</usa-link><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children" current><usa-link href="#">Grandchild</usa-link></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Grandchild</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item slot="children"><usa-link href="#">Child</usa-link></usa-side-nav-item></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item><usa-side-nav-item><usa-link href="#">Parent</usa-link></usa-side-nav-item></usa-side-nav>`);
|
|
88
12
|
const items = sideNav.querySelectorAll("usa-side-nav-item");
|
|
89
13
|
assert.equal(getComputedStyle(items[1]).getPropertyValue("--usa-nav-item-padding-left"), "2rem");
|
|
90
14
|
assert.equal(getComputedStyle(items[3]).getPropertyValue("--usa-nav-item-padding-left"), "3rem");
|
|
@@ -4,102 +4,8 @@ let USAStepIndicatorStepElement = (() => {
|
|
|
4
4
|
let _classDecorators = [element({
|
|
5
5
|
tagName: "usa-step",
|
|
6
6
|
shadowDom: [
|
|
7
|
-
css
|
|
8
|
-
|
|
9
|
-
color: #5c5c5c;
|
|
10
|
-
display: block;
|
|
11
|
-
flex: 1 1 0%;
|
|
12
|
-
position: relative;
|
|
13
|
-
counter-increment: usa-step-indicator;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:host([counter]):after {
|
|
17
|
-
content: counter(usa-step-indicator);
|
|
18
|
-
height: 2.5rem;
|
|
19
|
-
border-radius: 99rem;
|
|
20
|
-
width: 2.5rem;
|
|
21
|
-
background-color: #fff;
|
|
22
|
-
box-shadow:
|
|
23
|
-
inset 0 0 0 0.25rem #919191,
|
|
24
|
-
0 0 0 0.25rem #fff;
|
|
25
|
-
color: #5c5c5c;
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
font-weight: 700;
|
|
30
|
-
left: 0;
|
|
31
|
-
line-height: 0.9;
|
|
32
|
-
padding: calc((2.5rem - 2ex * 0.9) * 0.5);
|
|
33
|
-
position: absolute;
|
|
34
|
-
z-index: 100;
|
|
35
|
-
top: 0;
|
|
36
|
-
transform: translateY(-40%);
|
|
37
|
-
box-sizing: border-box;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:host([state="complete"]) {
|
|
41
|
-
color: #162e51;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
:host([state="complete"])::before {
|
|
45
|
-
background-color: #162e51;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([state="current"]) {
|
|
49
|
-
color: #005ea2;
|
|
50
|
-
font-weight: bold;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:host([state="current"])::before {
|
|
54
|
-
background-color: #005ea2;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
:host:before {
|
|
58
|
-
background-color: #919191;
|
|
59
|
-
content: "";
|
|
60
|
-
display: block;
|
|
61
|
-
height: 0.5rem;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.label {
|
|
65
|
-
display: block;
|
|
66
|
-
font-size: 1.06rem;
|
|
67
|
-
margin-top: 0.5rem;
|
|
68
|
-
padding-right: 2rem;
|
|
69
|
-
text-align: left;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:host([counter]) .label {
|
|
73
|
-
margin-top: 1.5rem;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:host([counter][state="complete"]):after {
|
|
77
|
-
background-color: #162e51;
|
|
78
|
-
box-shadow: 0 0 0 0.25rem #fff;
|
|
79
|
-
color: #fff;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
:host([counter][state="current"]):after {
|
|
83
|
-
background-color: #005ea2;
|
|
84
|
-
box-shadow: 0 0 0 0.25rem #fff;
|
|
85
|
-
color: #fff;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
:host([counter="small"]):after {
|
|
89
|
-
height: 1.5rem;
|
|
90
|
-
width: 1.5rem;
|
|
91
|
-
font-size: 0.93rem;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host([counter]:last-child):before {
|
|
95
|
-
width: 0;
|
|
96
|
-
}
|
|
97
|
-
`,
|
|
98
|
-
html `
|
|
99
|
-
<div class="label">
|
|
100
|
-
<slot></slot>
|
|
101
|
-
</div>
|
|
102
|
-
`,
|
|
7
|
+
css `:host{color:#5c5c5c;display:block;flex:1 1 0%;position:relative;counter-increment:usa-step-indicator}:host([counter]):after{content:counter(usa-step-indicator);height:2.5rem;border-radius:99rem;width:2.5rem;background-color:#fff;box-shadow:inset 0 0 0 .25rem #919191,0 0 0 .25rem #fff;color:#5c5c5c;display:flex;align-items:center;justify-content:center;font-weight:700;left:0;line-height:.9;padding:calc((2.5rem - 2ex * .9) * .5);position:absolute;z-index:100;top:0;transform:translateY(-40%);box-sizing:border-box}:host([state=complete]){color:#162e51}:host([state=complete])::before{background-color:#162e51}:host([state=current]){color:#005ea2;font-weight:700}:host([state=current])::before{background-color:#005ea2}:host:before{background-color:#919191;content:"";display:block;height:.5rem}.label{display:block;font-size:1.06rem;margin-top:.5rem;padding-right:2rem;text-align:left}:host([counter]) .label{margin-top:1.5rem}:host([counter][state=complete]):after{background-color:#162e51;box-shadow:0 0 0 .25rem #fff;color:#fff}:host([counter][state=current]):after{background-color:#005ea2;box-shadow:0 0 0 .25rem #fff;color:#fff}:host([counter=small]):after{height:1.5rem;width:1.5rem;font-size:.93rem}:host([counter]:last-child):before{width:0}`,
|
|
8
|
+
html `<div class="label"><slot></slot></div>`,
|
|
103
9
|
],
|
|
104
10
|
})];
|
|
105
11
|
let _classDescriptor;
|
|
@@ -4,15 +4,7 @@ let USAStepIndicatorElement = (() => {
|
|
|
4
4
|
let _classDecorators = [element({
|
|
5
5
|
tagName: "usa-step-indicator",
|
|
6
6
|
shadowDom: [
|
|
7
|
-
css
|
|
8
|
-
:host {
|
|
9
|
-
display: flex;
|
|
10
|
-
gap: 2px;
|
|
11
|
-
counter-reset: usa-step-indicator 0;
|
|
12
|
-
padding-top: 1rem;
|
|
13
|
-
margin-bottom: 1rem;
|
|
14
|
-
}
|
|
15
|
-
`,
|
|
7
|
+
css `:host{display:flex;gap:2px;counter-reset:usa-step-indicator 0;padding-top:1rem;margin-bottom:1rem}`,
|
|
16
8
|
html `<slot></slot>`,
|
|
17
9
|
],
|
|
18
10
|
})];
|
|
@@ -5,27 +5,7 @@ const meta = {
|
|
|
5
5
|
title: "usa-step-indicator",
|
|
6
6
|
tags: ["autodocs"],
|
|
7
7
|
render(args) {
|
|
8
|
-
return html
|
|
9
|
-
<usa-step-indicator>
|
|
10
|
-
<usa-step state="complete" counter=${ifDefined(args.counter)}>
|
|
11
|
-
Personal information
|
|
12
|
-
</usa-step>
|
|
13
|
-
|
|
14
|
-
<usa-step state="complete" counter=${ifDefined(args.counter)}>
|
|
15
|
-
Household status
|
|
16
|
-
</usa-step>
|
|
17
|
-
|
|
18
|
-
<usa-step state="current" counter=${ifDefined(args.counter)}>
|
|
19
|
-
Supporting documents
|
|
20
|
-
</usa-step>
|
|
21
|
-
|
|
22
|
-
<usa-step counter=${ifDefined(args.counter)}>Signature</usa-step>
|
|
23
|
-
|
|
24
|
-
<usa-step counter=${ifDefined(args.counter)}>
|
|
25
|
-
Review and submit
|
|
26
|
-
</usa-step>
|
|
27
|
-
</usa-step-indicator>
|
|
28
|
-
`;
|
|
8
|
+
return html `<usa-step-indicator><usa-step state="complete" counter="${ifDefined(args.counter)}">Personal information</usa-step><usa-step state="complete" counter="${ifDefined(args.counter)}">Household status</usa-step><usa-step state="current" counter="${ifDefined(args.counter)}">Supporting documents</usa-step><usa-step counter="${ifDefined(args.counter)}">Signature</usa-step><usa-step counter="${ifDefined(args.counter)}">Review and submit</usa-step></usa-step-indicator>`;
|
|
29
9
|
},
|
|
30
10
|
argTypes: {
|
|
31
11
|
counter: {
|
|
@@ -3,15 +3,7 @@ import "./step/step.element.js";
|
|
|
3
3
|
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
4
|
describe("usa-step-indicator", () => {
|
|
5
5
|
it("should be accessible", async () => {
|
|
6
|
-
const stepIndicator = await fixture(html
|
|
7
|
-
<usa-step-indicator>
|
|
8
|
-
<usa-step state="complete" counter="on">Personal information</usa-step>
|
|
9
|
-
<usa-step state="complete" counter="on">Household status</usa-step>
|
|
10
|
-
<usa-step state="current" counter="on">Supporting documents</usa-step>
|
|
11
|
-
<usa-step counter="on">Signature</usa-step>
|
|
12
|
-
<usa-step counter="on">Review and submit</usa-step>
|
|
13
|
-
</usa-step-indicator>
|
|
14
|
-
`);
|
|
6
|
+
const stepIndicator = await fixture(html `<usa-step-indicator><usa-step state="complete" counter="on">Personal information</usa-step><usa-step state="complete" counter="on">Household status</usa-step><usa-step state="current" counter="on">Supporting documents</usa-step><usa-step counter="on">Signature</usa-step><usa-step counter="on">Review and submit</usa-step></usa-step-indicator>`);
|
|
15
7
|
return assert.isAccessible(stepIndicator);
|
|
16
8
|
});
|
|
17
9
|
});
|
|
@@ -4,20 +4,8 @@ let USASummaryBoxElement = (() => {
|
|
|
4
4
|
let _classDecorators = [element({
|
|
5
5
|
tagName: "usa-summary-box",
|
|
6
6
|
shadowDom: [
|
|
7
|
-
css
|
|
8
|
-
|
|
9
|
-
font-size: 1.06rem;
|
|
10
|
-
line-height: 1.5;
|
|
11
|
-
color: #1b1b1b;
|
|
12
|
-
background-color: #e7f6f8;
|
|
13
|
-
border-radius: 0.25rem;
|
|
14
|
-
border: 1px #99deea solid;
|
|
15
|
-
padding: 1.5rem;
|
|
16
|
-
position: relative;
|
|
17
|
-
display: block;
|
|
18
|
-
}
|
|
19
|
-
`,
|
|
20
|
-
html ` <slot></slot> `,
|
|
7
|
+
css `:host{font-size:1.06rem;line-height:1.5;color:#1b1b1b;background-color:#e7f6f8;border-radius:.25rem;border:1px #99deea solid;padding:1.5rem;position:relative;display:block}`,
|
|
8
|
+
html `<slot></slot>`,
|
|
21
9
|
],
|
|
22
10
|
})];
|
|
23
11
|
let _classDescriptor;
|
|
@@ -2,9 +2,7 @@ import "./summary-box.element.js";
|
|
|
2
2
|
import { assert, fixture, html } from "@open-wc/testing";
|
|
3
3
|
describe("usa-summary-box", () => {
|
|
4
4
|
it("should be accessible", async () => {
|
|
5
|
-
const summaryBox = await fixture(html
|
|
6
|
-
<usa-summary-box>Hello World</usa-summary-box>
|
|
7
|
-
`);
|
|
5
|
+
const summaryBox = await fixture(html `<usa-summary-box>Hello World</usa-summary-box>`);
|
|
8
6
|
return assert.isAccessible(summaryBox);
|
|
9
7
|
});
|
|
10
8
|
});
|
|
@@ -6,28 +6,7 @@ let USATagElement = (() => {
|
|
|
6
6
|
let _classDecorators = [element({
|
|
7
7
|
tagName: "usa-tag",
|
|
8
8
|
shadowDom: [
|
|
9
|
-
css
|
|
10
|
-
:host {
|
|
11
|
-
font-size: 0.93rem;
|
|
12
|
-
color: #1b1b1b;
|
|
13
|
-
text-transform: uppercase;
|
|
14
|
-
background-color: #e6e6e6;
|
|
15
|
-
border-radius: 2px;
|
|
16
|
-
margin-right: 0.25rem;
|
|
17
|
-
padding: 1px 0.5rem;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
:host([variant="big"]) {
|
|
21
|
-
padding-left: 0.5rem;
|
|
22
|
-
padding-right: 0.5rem;
|
|
23
|
-
font-size: 1.06rem;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
:host([type="new"]) {
|
|
27
|
-
background-color: #c05600;
|
|
28
|
-
color: #fff;
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
9
|
+
css `:host{font-size:.93rem;color:#1b1b1b;text-transform:uppercase;background-color:#e6e6e6;border-radius:2px;margin-right:.25rem;padding:1px .5rem}:host([variant=big]){padding-left:.5rem;padding-right:.5rem;font-size:1.06rem}:host([type=new]){background-color:#c05600;color:#fff}`,
|
|
31
10
|
html `<slot></slot>`,
|
|
32
11
|
],
|
|
33
12
|
})];
|
|
@@ -2,9 +2,7 @@ import "./tag.element.js";
|
|
|
2
2
|
import { assert, fixture, html } from "@open-wc/testing";
|
|
3
3
|
describe("usa-tag", () => {
|
|
4
4
|
it("should be accessible", async () => {
|
|
5
|
-
const tag = await fixture(html
|
|
6
|
-
<usa-tag>Hello World</usa-tag>
|
|
7
|
-
`);
|
|
5
|
+
const tag = await fixture(html `<usa-tag>Hello World</usa-tag>`);
|
|
8
6
|
return assert.isAccessible(tag);
|
|
9
7
|
});
|
|
10
8
|
});
|