@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.
Files changed (143) hide show
  1. package/assets/flags/alabama.svg +5 -0
  2. package/assets/flags/alaska.svg +14 -0
  3. package/assets/flags/arizona.svg +7 -0
  4. package/assets/flags/arkansas.svg +15 -0
  5. package/assets/flags/california.svg +8 -0
  6. package/assets/flags/colorado.svg +8 -0
  7. package/assets/flags/connecticut.svg +5 -0
  8. package/assets/flags/delaware.svg +7 -0
  9. package/assets/flags/florida.svg +5 -0
  10. package/assets/flags/georgia.svg +5 -0
  11. package/assets/flags/hawaii.svg +19 -0
  12. package/assets/flags/idaho.svg +5 -0
  13. package/assets/flags/illinois.svg +5 -0
  14. package/assets/flags/indiana.svg +15 -0
  15. package/assets/flags/iowa.svg +13 -0
  16. package/assets/flags/kansas.svg +5 -0
  17. package/assets/flags/kentucky.svg +16 -0
  18. package/assets/flags/louisiana.svg +14 -0
  19. package/assets/flags/maine.svg +12 -0
  20. package/assets/flags/maryland.svg +14 -0
  21. package/assets/flags/massachusetts.svg +15 -0
  22. package/assets/flags/michigan.svg +5 -0
  23. package/assets/flags/minnesota.svg +15 -0
  24. package/assets/flags/mississippi.svg +10 -0
  25. package/assets/flags/missouri.svg +16 -0
  26. package/assets/flags/montana.svg +11 -0
  27. package/assets/flags/nebraska.svg +13 -0
  28. package/assets/flags/nevada.svg +14 -0
  29. package/assets/flags/new_hampshire.svg +13 -0
  30. package/assets/flags/new_jersey.svg +13 -0
  31. package/assets/flags/new_mexico.svg +7 -0
  32. package/assets/flags/new_york.svg +13 -0
  33. package/assets/flags/north_carolina.svg +5 -0
  34. package/assets/flags/north_dakota.svg +13 -0
  35. package/assets/flags/ohio.svg +16 -0
  36. package/assets/flags/oklahoma.svg +12 -0
  37. package/assets/flags/oregon.svg +13 -0
  38. package/assets/flags/pennsylvania.svg +15 -0
  39. package/assets/flags/rhode_island.svg +13 -0
  40. package/assets/flags/south_carolina.svg +11 -0
  41. package/assets/flags/south_dakota.svg +15 -0
  42. package/assets/flags/tennessee.svg +13 -0
  43. package/assets/flags/texas.svg +8 -0
  44. package/assets/flags/utah.svg +9 -0
  45. package/assets/flags/vermont.svg +13 -0
  46. package/assets/flags/virginia.svg +5 -0
  47. package/assets/flags/washington.svg +5 -0
  48. package/assets/flags/west_virginia.svg +24 -0
  49. package/assets/flags/wisconsin.svg +5 -0
  50. package/assets/flags/wyoming.svg +5 -0
  51. package/package.json +13 -11
  52. package/src/lib/combo-box/combo-box-option/combo-box-option.element.ts +32 -13
  53. package/src/lib/combo-box/combo-box.element.ts +161 -43
  54. package/src/lib/combo-box/combo-box.stories.ts +202 -56
  55. package/src/lib/combo-box/combo-box.test.ts +140 -22
  56. package/target/lib/accordion/accordion.element.js +2 -86
  57. package/target/lib/accordion/accordion.stories.js +1 -26
  58. package/target/lib/accordion/accordion.test.js +5 -72
  59. package/target/lib/alert/alert.element.js +2 -71
  60. package/target/lib/alert/alert.stories.js +1 -41
  61. package/target/lib/alert/alert.test.js +1 -9
  62. package/target/lib/button/button.element.js +2 -142
  63. package/target/lib/button/button.stories.js +1 -6
  64. package/target/lib/button/button.test.js +1 -3
  65. package/target/lib/card/card-body/card-body.element.js +1 -8
  66. package/target/lib/card/card-footer/card-footer.element.js +1 -6
  67. package/target/lib/card/card-group/card-group.element.js +1 -12
  68. package/target/lib/card/card-header/card-header.element.js +1 -16
  69. package/target/lib/card/card-media/card-media.element.js +2 -33
  70. package/target/lib/card/card.element.js +1 -32
  71. package/target/lib/card/card.stories.js +2 -107
  72. package/target/lib/card/card.test.js +1 -20
  73. package/target/lib/checkbox/checkbox-group/checkbox-group.element.js +2 -10
  74. package/target/lib/checkbox/checkbox.element.js +2 -112
  75. package/target/lib/checkbox/checkbox.stories.js +2 -43
  76. package/target/lib/checkbox/checkbox.test.js +4 -28
  77. package/target/lib/collection/collection-item/collection-item.element.js +2 -40
  78. package/target/lib/collection/collection-item/collection-item.test.js +1 -3
  79. package/target/lib/collection/collection.element.js +2 -10
  80. package/target/lib/collection/collection.stories.js +1 -63
  81. package/target/lib/collection/collection.test.js +1 -3
  82. package/target/lib/combo-box/combo-box-option/combo-box-option.element.d.ts +0 -1
  83. package/target/lib/combo-box/combo-box-option/combo-box-option.element.js +21 -12
  84. package/target/lib/combo-box/combo-box-option/combo-box-option.element.js.map +1 -1
  85. package/target/lib/combo-box/combo-box.element.d.ts +9 -1
  86. package/target/lib/combo-box/combo-box.element.js +92 -86
  87. package/target/lib/combo-box/combo-box.element.js.map +1 -1
  88. package/target/lib/combo-box/combo-box.stories.js +1 -59
  89. package/target/lib/combo-box/combo-box.stories.js.map +1 -1
  90. package/target/lib/combo-box/combo-box.test.js +65 -22
  91. package/target/lib/combo-box/combo-box.test.js.map +1 -1
  92. package/target/lib/config/config.element.js +1 -5
  93. package/target/lib/config/config.test.js +1 -3
  94. package/target/lib/description/description.element.js +1 -7
  95. package/target/lib/description/description.test.js +1 -3
  96. package/target/lib/file-input/file-input-preview/file-input-preview.element.js +2 -61
  97. package/target/lib/file-input/file-input-preview/file-input-preview.test.js +5 -25
  98. package/target/lib/file-input/file-input.element.js +2 -82
  99. package/target/lib/file-input/file-input.stories.js +1 -13
  100. package/target/lib/file-input/file-input.test.js +2 -16
  101. package/target/lib/icon/icon.element.js +1 -14
  102. package/target/lib/icon/icon.stories.js +2 -13
  103. package/target/lib/input/input.element.js +2 -73
  104. package/target/lib/input/input.stories.js +2 -12
  105. package/target/lib/input/input.test.js +4 -24
  106. package/target/lib/input-mask/input-mask.element.js +1 -5
  107. package/target/lib/input-mask/input-mask.stories.js +1 -12
  108. package/target/lib/input-mask/input-mask.test.js +4 -24
  109. package/target/lib/link/link.element.js +2 -18
  110. package/target/lib/modal/modal-close/modal-close.element.js +2 -36
  111. package/target/lib/modal/modal-close/modal-close.test.js +1 -3
  112. package/target/lib/modal/modal-heading/modal-heading.element.js +2 -24
  113. package/target/lib/modal/modal-heading/modal-heading.test.js +1 -3
  114. package/target/lib/modal/modal.element.js +2 -33
  115. package/target/lib/modal/modal.stories.js +1 -18
  116. package/target/lib/modal/modal.test.js +1 -11
  117. package/target/lib/radio/radio-option/radio-option.element.js +2 -16
  118. package/target/lib/radio/radio-option/radio-option.test.js +1 -5
  119. package/target/lib/radio/radio.element.js +2 -98
  120. package/target/lib/radio/radio.stories.js +1 -26
  121. package/target/lib/radio/radio.test.js +5 -103
  122. package/target/lib/range-slider/range-slider.element.js +2 -52
  123. package/target/lib/range-slider/range-slider.test.js +3 -17
  124. package/target/lib/select/select-option/select-option.element.js +1 -5
  125. package/target/lib/select/select.element.js +2 -49
  126. package/target/lib/select/select.stories.js +1 -10
  127. package/target/lib/select/select.test.js +6 -64
  128. package/target/lib/side-nav/side-nav-item/side-nav-item.element.js +2 -67
  129. package/target/lib/side-nav/side-nav.element.js +1 -8
  130. package/target/lib/side-nav/side-nav.stories.js +1 -39
  131. package/target/lib/side-nav/side-nav.test.js +2 -78
  132. package/target/lib/step-indicator/step/step.element.js +2 -96
  133. package/target/lib/step-indicator/step-indicator.element.js +1 -9
  134. package/target/lib/step-indicator/step-indicator.stories.js +1 -21
  135. package/target/lib/step-indicator/step-indicator.test.js +1 -9
  136. package/target/lib/summary-box/summary-box.element.js +2 -14
  137. package/target/lib/summary-box/summary-box.stories.js +1 -1
  138. package/target/lib/summary-box/summary-box.test.js +1 -3
  139. package/target/lib/tag/tag.element.js +1 -22
  140. package/target/lib/tag/tag.stories.js +1 -1
  141. package/target/lib/tag/tag.test.js +1 -3
  142. package/target/lib/textarea/textarea.element.js +2 -49
  143. package/target/lib/textarea/textarea.test.js +4 -24
@@ -4,51 +4,18 @@ import { screen } from "@testing-library/dom";
4
4
  import { userEvent } from "@testing-library/user-event";
5
5
  describe("usa-accordion", () => {
6
6
  it("should be accessible", async () => {
7
- const accordion = await fixture(html `
8
- <usa-accordion id="first" name="ammendment">
9
- <h4 slot="heading">First Ammendment</h4>
10
-
11
- <div class="content">
12
- Congress shall make no law respecting an establishment of religion, or
13
- prohibiting the free exercise thereof; or abridging the freedom of
14
- speech, or of the press; or the right of the people peaceably to
15
- assemble, and to petition the Government for a redress of grievances.
16
- </div>
17
- </usa-accordion>
18
- `);
7
+ const accordion = await fixture(html `<usa-accordion id="first" name="ammendment"><h4 slot="heading">First Ammendment</h4><div class="content">Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.</div></usa-accordion>`);
19
8
  return assert.isAccessible(accordion);
20
9
  });
21
10
  it("should toggle the open state when clicked", async () => {
22
- const accordion = await fixture(html `
23
- <usa-accordion id="first" name="ammendment">
24
- <h4 slot="heading">First Ammendment</h4>
25
-
26
- <div class="content">
27
- Congress shall make no law respecting an establishment of religion, or
28
- prohibiting the free exercise thereof; or abridging the freedom of
29
- speech, or of the press; or the right of the people peaceably to
30
- assemble, and to petition the Government for a redress of grievances.
31
- </div>
32
- </usa-accordion>
33
- `);
11
+ const accordion = await fixture(html `<usa-accordion id="first" name="ammendment"><h4 slot="heading">First Ammendment</h4><div class="content">Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.</div></usa-accordion>`);
34
12
  const heading = await screen.findByRole("heading");
35
13
  const content = accordion.querySelector(".content");
36
14
  await userEvent.click(heading);
37
15
  assert.isTrue(content?.checkVisibility());
38
16
  });
39
17
  it("should toggle the open state when clicked", async () => {
40
- const accordion = await fixture(html `
41
- <usa-accordion id="first" name="ammendment">
42
- <h4 slot="heading">First Ammendment</h4>
43
-
44
- <div class="content">
45
- Congress shall make no law respecting an establishment of religion, or
46
- prohibiting the free exercise thereof; or abridging the freedom of
47
- speech, or of the press; or the right of the people peaceably to
48
- assemble, and to petition the Government for a redress of grievances.
49
- </div>
50
- </usa-accordion>
51
- `);
18
+ const accordion = await fixture(html `<usa-accordion id="first" name="ammendment"><h4 slot="heading">First Ammendment</h4><div class="content">Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.</div></usa-accordion>`);
52
19
  const heading = await screen.findByRole("heading");
53
20
  const content = accordion.querySelector(".content");
54
21
  assert.isFalse(content?.checkVisibility());
@@ -56,24 +23,7 @@ describe("usa-accordion", () => {
56
23
  assert.isTrue(content.checkVisibility());
57
24
  });
58
25
  it("should only allow a single accordion in a group to be open", async () => {
59
- const el = await fixture(html `
60
- <section>
61
- <usa-accordion name="ammendment">
62
- <h4 slot="heading">First Ammendment</h4>
63
- <div class="content">Content for First</div>
64
- </usa-accordion>
65
-
66
- <usa-accordion name="ammendment">
67
- <h4 slot="heading">Second Ammendment</h4>
68
- <div class="content">Content for Second</div>
69
- </usa-accordion>
70
-
71
- <usa-accordion name="ammendment">
72
- <h4 slot="heading">Third Ammendment</h4>
73
- <div class="content">Content for Third</div>
74
- </usa-accordion>
75
- </section>
76
- `);
26
+ const el = await fixture(html `<section><usa-accordion name="ammendment"><h4 slot="heading">First Ammendment</h4><div class="content">Content for First</div></usa-accordion><usa-accordion name="ammendment"><h4 slot="heading">Second Ammendment</h4><div class="content">Content for Second</div></usa-accordion><usa-accordion name="ammendment"><h4 slot="heading">Third Ammendment</h4><div class="content">Content for Third</div></usa-accordion></section>`);
77
27
  const headings = el.querySelectorAll("h4");
78
28
  const content = Array.from(el.querySelectorAll(".content"));
79
29
  await userEvent.click(headings[0]);
@@ -84,24 +34,7 @@ describe("usa-accordion", () => {
84
34
  assert.deepEqual(content.map((el) => el.checkVisibility()), [false, false, true]);
85
35
  });
86
36
  it("should not close accordion not in the same group", async () => {
87
- const el = await fixture(html `
88
- <section>
89
- <usa-accordion name="ammendment">
90
- <h4 slot="heading">First Ammendment</h4>
91
- <div class="content">Content for First</div>
92
- </usa-accordion>
93
-
94
- <usa-accordion name="ammendment">
95
- <h4 slot="heading">Second Ammendment</h4>
96
- <div class="content">Content for Second</div>
97
- </usa-accordion>
98
-
99
- <usa-accordion name="different">
100
- <h4 slot="heading">Third Ammendment</h4>
101
- <div class="content">Content for Third</div>
102
- </usa-accordion>
103
- </section>
104
- `);
37
+ const el = await fixture(html `<section><usa-accordion name="ammendment"><h4 slot="heading">First Ammendment</h4><div class="content">Content for First</div></usa-accordion><usa-accordion name="ammendment"><h4 slot="heading">Second Ammendment</h4><div class="content">Content for Second</div></usa-accordion><usa-accordion name="different"><h4 slot="heading">Third Ammendment</h4><div class="content">Content for Third</div></usa-accordion></section>`);
105
38
  const headings = el.querySelectorAll("h4");
106
39
  const content = Array.from(el.querySelectorAll(".content"));
107
40
  await userEvent.click(headings[0]);
@@ -9,77 +9,8 @@ let USAAlertElement = (() => {
9
9
  delegatesFocus: true,
10
10
  },
11
11
  shadowDom: [
12
- css `
13
- :host {
14
- display: block;
15
- border-left: 0.5rem solid #adadad;
16
- padding: 1rem 1.2rem;
17
- color: #1b1b1b;
18
- margin-bottom: 1rem;
19
- }
20
-
21
- :host([type="info"]) {
22
- border-left-color: #00bde3;
23
- background-color: #e7f6f8;
24
- }
25
-
26
- :host([type="warning"]) {
27
- background-color: #faf3d1;
28
- border-left-color: #ffbe2e;
29
- }
30
-
31
- :host([type="success"]) {
32
- background-color: #ecf3ec;
33
- border-left-color: #00a91c;
34
- }
35
-
36
- :host([type="error"]) {
37
- background-color: #f4e3db;
38
- border-left-color: #d54309;
39
- }
40
-
41
- :host([type="emergency"]) {
42
- background-color: #9c3d10;
43
- border-left-color: #9c3d10;
44
- color: #fff;
45
- }
46
-
47
- :host([type="emergency"]) ::slotted(*) {
48
- color: #fff;
49
- }
50
-
51
- .alert-heading {
52
- display: grid;
53
- grid-template-columns: auto 1fr;
54
- align-items: center;
55
- }
56
-
57
- usa-icon {
58
- margin: -0.28rem 0.75rem 0 0;
59
- }
60
-
61
- #heading::slotted(*) {
62
- font-size: 1.33rem;
63
- line-height: 0.9;
64
- margin-top: 0;
65
- margin-bottom: 0.5rem;
66
- }
67
- `,
68
- html `
69
- <div class="alert-heading">
70
- <usa-icon icon="check_circle"></usa-icon>
71
-
72
- <div>
73
- <slot id="heading" name="heading"></slot>
74
- </div>
75
-
76
- <div class="spacer"></div>
77
-
78
- <div>
79
- <slot></slot>
80
- </div>
81
- </div>
82
- `,
12
+ css `:host{display:block;border-left:.5rem solid #adadad;padding:1rem 1.2rem;color:#1b1b1b;margin-bottom:1rem}:host([type=info]){border-left-color:#00bde3;background-color:#e7f6f8}:host([type=warning]){background-color:#faf3d1;border-left-color:#ffbe2e}:host([type=success]){background-color:#ecf3ec;border-left-color:#00a91c}:host([type=error]){background-color:#f4e3db;border-left-color:#d54309}:host([type=emergency]){background-color:#9c3d10;border-left-color:#9c3d10;color:#fff}:host([type=emergency]) ::slotted(*){color:#fff}.alert-heading{display:grid;grid-template-columns:auto 1fr;align-items:center}usa-icon{margin:-.28rem .75rem 0 0}#heading::slotted(*){font-size:1.33rem;line-height:.9;margin-top:0;margin-bottom:.5rem}`,
13
+ html `<div class="alert-heading"><usa-icon icon="check_circle"></usa-icon><div><slot id="heading" name="heading"></slot></div><div class="spacer"></div><div><slot></slot></div></div>`,
83
14
  ],
84
15
  })];
85
16
  let _classDescriptor;
@@ -10,47 +10,7 @@ export default meta;
10
10
  // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
11
11
  export const Primary = {
12
12
  render() {
13
- return html `
14
- <usa-alert type="info">
15
- <h3 slot="heading">Informative status</h3>
16
-
17
- Lorem ipsum dolor sit amet,&nbsp;
18
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
19
- eiusmod.
20
- </usa-alert>
21
-
22
- <usa-alert type="warning">
23
- <h3 slot="heading">Warning status</h3>
24
-
25
- Lorem ipsum dolor sit amet,&nbsp;
26
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
27
- eiusmod.
28
- </usa-alert>
29
-
30
- <usa-alert type="success">
31
- <h3 slot="heading">Success status</h3>
32
-
33
- Lorem ipsum dolor sit amet,&nbsp;
34
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
35
- eiusmod.
36
- </usa-alert>
37
-
38
- <usa-alert type="error">
39
- <h3 slot="heading">Error status</h3>
40
-
41
- Lorem ipsum dolor sit amet,&nbsp;
42
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
43
- eiusmod.
44
- </usa-alert>
45
-
46
- <usa-alert type="emergency">
47
- <h3 slot="heading">Emergency status</h3>
48
-
49
- Lorem ipsum dolor sit amet,&nbsp;
50
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
51
- eiusmod.
52
- </usa-alert>
53
- `;
13
+ return html `<usa-alert type="info"><h3 slot="heading">Informative status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert><usa-alert type="warning"><h3 slot="heading">Warning status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert><usa-alert type="success"><h3 slot="heading">Success status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert><usa-alert type="error"><h3 slot="heading">Error status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert><usa-alert type="emergency"><h3 slot="heading">Emergency status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert>`;
54
14
  },
55
15
  };
56
16
  //# sourceMappingURL=alert.stories.js.map
@@ -4,15 +4,7 @@ import { USA_ALERT_TYPES } from "./alert-types.js";
4
4
  describe("usa-alert", () => {
5
5
  for (const alert of USA_ALERT_TYPES) {
6
6
  it(`should be accessible: ${alert}`, async () => {
7
- const form = await fixture(html `
8
- <usa-alert type=${alert}>
9
- <h3 slot="heading">Status</h3>
10
-
11
- Lorem ipsum dolor sit amet,&nbsp;
12
- <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
13
- eiusmod.
14
- </usa-alert>
15
- `);
7
+ const form = await fixture(html `<usa-alert type="${alert}"><h3 slot="heading">Status</h3>Lorem ipsum dolor sit amet, <usa-link href="#">consectetur adipiscing</usa-link> elit, sed do eiusmod.</usa-alert>`);
16
8
  return assert.isAccessible(form);
17
9
  });
18
10
  }
@@ -15,148 +15,8 @@ let USAButtonElement = (() => {
15
15
  delegatesFocus: true,
16
16
  },
17
17
  shadowDom: [
18
- css `
19
- :host {
20
- display: contents;
21
- }
22
-
23
- button {
24
- box-sizing: border-box;
25
- font-size: 1.06rem;
26
- line-height: 0.9;
27
- color: white;
28
- background-color: #005ea2;
29
- -webkit-appearance: none;
30
- -moz-appearance: none;
31
- appearance: none;
32
- align-items: center;
33
- border: 0;
34
- border-radius: 0.25rem;
35
- cursor: pointer;
36
- -moz-column-gap: 0.5rem;
37
- column-gap: 0.5rem;
38
- display: inline-flex;
39
- font-weight: 700;
40
- justify-content: center;
41
- padding: 0.75rem 1.25rem;
42
- text-align: center;
43
- text-decoration: none;
44
- width: 100%;
45
- cursor: pointer;
46
- }
47
-
48
- @media all and (min-width: 30em) {
49
- button {
50
- width: auto;
51
- }
52
- }
53
-
54
- button:visited {
55
- color: white;
56
- }
57
-
58
- button:hover {
59
- color: white;
60
- background-color: #1a4480;
61
- border-bottom: 0;
62
- text-decoration: none;
63
- }
64
-
65
- button:active {
66
- color: white;
67
- background-color: #162e51;
68
- }
69
-
70
- button:not([disabled]):focus {
71
- outline-offset: 0.25rem;
72
- }
73
-
74
- button:disabled {
75
- color: #454545;
76
- background-color: #c9c9c9;
77
- cursor: not-allowed;
78
- opacity: 1;
79
- }
80
-
81
- button:disabled:hover,
82
- button:disabled:active,
83
- button:disabled:focus {
84
- color: #454545;
85
- background-color: #c9c9c9;
86
- }
87
-
88
- button:focus {
89
- outline: 0.25rem solid #2491ff;
90
- outline-offset: 0;
91
- }
92
-
93
- /** Secondary */
94
- :host([variant="secondary"]) button {
95
- color: #fff;
96
- background-color: #d83933;
97
- }
98
-
99
- :host([variant="secondary"]) button:hover {
100
- background-color: #b50909;
101
- }
102
-
103
- :host([variant="secondary"]) button:active {
104
- background-color: #8b0a03;
105
- }
106
-
107
- /** cool */
108
- :host([variant="cool"]) button {
109
- color: #1b1b1b;
110
- background-color: #00bde3;
111
- }
112
-
113
- :host([variant="cool"]) button:hover {
114
- background-color: #28a0cb;
115
- }
116
-
117
- :host([variant="cool"]) button:active {
118
- color: #fff;
119
- background-color: #07648d;
120
- }
121
-
122
- /** warm */
123
- :host([variant="warm"]) button {
124
- color: #1b1b1b;
125
- background-color: #fa9441;
126
- }
127
-
128
- :host([variant="warm"]) button:hover {
129
- color: #fff;
130
- background-color: #c05600;
131
- }
132
-
133
- :host([variant="warm"]) button:active {
134
- color: #fff;
135
- background-color: #775540;
136
- }
137
-
138
- /** outline */
139
- :host([variant="outline"]) button {
140
- background-color: transparent;
141
- box-shadow: inset 0 0 0 2px #005ea2;
142
- color: #005ea2;
143
- }
144
-
145
- :host([variant="outline"]) button:hover {
146
- box-shadow: inset 0 0 0 2px #1a4480;
147
- color: #1a4480;
148
- }
149
-
150
- :host([variant="outline"]) button:active {
151
- box-shadow: inset 0 0 0 2px #162e51;
152
- color: #162e51;
153
- }
154
- `,
155
- html `
156
- <button tabindex="0">
157
- <slot></slot>
158
- </button>
159
- `,
18
+ css `:host{display:contents}button{box-sizing:border-box;font-size:1.06rem;line-height:.9;color:#fff;background-color:#005ea2;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-items:center;border:0;border-radius:.25rem;cursor:pointer;-moz-column-gap:.5rem;column-gap:.5rem;display:inline-flex;font-weight:700;justify-content:center;padding:.75rem 1.25rem;text-align:center;text-decoration:none;width:100%;cursor:pointer}@media all and (min-width:30em){button{width:auto}}button:visited{color:#fff}button:hover{color:#fff;background-color:#1a4480;border-bottom:0;text-decoration:none}button:active{color:#fff;background-color:#162e51}button:not([disabled]):focus{outline-offset:.25rem}button:disabled{color:#454545;background-color:#c9c9c9;cursor:not-allowed;opacity:1}button:disabled:active,button:disabled:focus,button:disabled:hover{color:#454545;background-color:#c9c9c9}button:focus{outline:.25rem solid #2491ff;outline-offset:0}:host([variant=secondary]) button{color:#fff;background-color:#d83933}:host([variant=secondary]) button:hover{background-color:#b50909}:host([variant=secondary]) button:active{background-color:#8b0a03}:host([variant=cool]) button{color:#1b1b1b;background-color:#00bde3}:host([variant=cool]) button:hover{background-color:#28a0cb}:host([variant=cool]) button:active{color:#fff;background-color:#07648d}:host([variant=warm]) button{color:#1b1b1b;background-color:#fa9441}:host([variant=warm]) button:hover{color:#fff;background-color:#c05600}:host([variant=warm]) button:active{color:#fff;background-color:#775540}:host([variant=outline]) button{background-color:transparent;box-shadow:inset 0 0 0 2px #005ea2;color:#005ea2}:host([variant=outline]) button:hover{box-shadow:inset 0 0 0 2px #1a4480;color:#1a4480}:host([variant=outline]) button:active{box-shadow:inset 0 0 0 2px #162e51;color:#162e51}`,
19
+ html `<button tabindex="0"><slot></slot></button>`,
160
20
  ],
161
21
  })];
162
22
  let _classDescriptor;
@@ -5,12 +5,7 @@ const meta = {
5
5
  title: "usa-button",
6
6
  tags: ["autodocs"],
7
7
  render() {
8
- return html `
9
- <div style="display: inline-flex; flex-direction: column; gap: 1rem">
10
- ${BUTTON_VARIANTS.map((variant, i) => html `<usa-button variant=${variant}>Hello World</usa-button> ${i === BUTTON_VARIANTS.length - 1 ? "" : "\n\n"}`)}
11
- <usa-button disabled>Disabled</usa-button>
12
- </div>
13
- `;
8
+ return html `<div style="display:inline-flex;flex-direction:column;gap:1rem">${BUTTON_VARIANTS.map((variant, i) => html `<usa-button variant="${variant}">Hello World</usa-button>${i === BUTTON_VARIANTS.length - 1 ? "" : "\n\n"}`)}<usa-button disabled="disabled">Disabled</usa-button></div>`;
14
9
  },
15
10
  argTypes: {},
16
11
  args: {},
@@ -4,9 +4,7 @@ import { BUTTON_VARIANTS } from "./button.element.js";
4
4
  describe("usa-button", () => {
5
5
  for (const variant of BUTTON_VARIANTS) {
6
6
  it("should be accessible", async () => {
7
- const button = await fixture(html `
8
- <usa-button variant=${variant}>Hello World</usa-button>
9
- `);
7
+ const button = await fixture(html `<usa-button variant="${variant}">Hello World</usa-button>`);
10
8
  return assert.isAccessible(button);
11
9
  });
12
10
  }
@@ -4,14 +4,7 @@ let USACardBodyElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card-body",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- display: flex;
10
- flex: 1 1 0%;
11
- padding: 0.5rem 1.5rem;
12
- flex-basis: auto;
13
- }
14
- `,
7
+ css `:host{display:flex;flex:1 1 0%;padding:.5rem 1.5rem;flex-basis:auto}`,
15
8
  html `<slot></slot>`,
16
9
  ],
17
10
  })];
@@ -4,12 +4,7 @@ let USACardFooterElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card-footer",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- display: flex;
10
- padding: 0.5rem 1.5rem 1.5rem;
11
- }
12
- `,
7
+ css `:host{display:flex;padding:.5rem 1.5rem 1.5rem}`,
13
8
  html `<slot></slot>`,
14
9
  ],
15
10
  })];
@@ -4,18 +4,7 @@ let USACardGroupElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card-group",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- display: grid;
10
- grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
11
- gap: 1rem;
12
- margin-bottom: 1rem;
13
- }
14
-
15
- :host([variant="flag"]) {
16
- grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
17
- }
18
- `,
7
+ css `:host{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:1rem;margin-bottom:1rem}:host([variant=flag]){grid-template-columns:repeat(auto-fit,minmax(450px,1fr))}`,
19
8
  html `<slot></slot>`,
20
9
  ],
21
10
  })];
@@ -4,22 +4,7 @@ let USACardHeaderElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card-header",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- font-family:
10
- Merriweather Web,
11
- Georgia,
12
- Cambria,
13
- Times New Roman,
14
- Times,
15
- serif !important;
16
- display: flex;
17
- padding: 1.5rem 1.5rem 0.5rem;
18
- font-size: 1.22rem;
19
- font-weight: bold;
20
- line-height: 1.2;
21
- }
22
- `,
7
+ css `:host{font-family:Merriweather Web,Georgia,Cambria,Times New Roman,Times,serif!important;display:flex;padding:1.5rem 1.5rem .5rem;font-size:1.22rem;font-weight:700;line-height:1.2}`,
23
8
  html `<slot></slot>`,
24
9
  ],
25
10
  })];
@@ -4,39 +4,8 @@ let USACardImgElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card-media",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- display: block;
10
- border-top-left-radius: calc(0.25rem - 2px);
11
- border-top-right-radius: calc(0.25rem - 2px);
12
- background-color: #f0f0f0;
13
- position: relative;
14
- overflow: hidden;
15
- box-sizing: border-box;
16
- }
17
-
18
- :host([variant="inset"]) {
19
- background-color: #fff;
20
- padding-top: 1.5rem;
21
- padding-left: 1.5rem;
22
- padding-right: 1.5rem;
23
- }
24
-
25
- ::slotted(img) {
26
- display: block;
27
- height: 100%;
28
- width: 100%;
29
- -o-object-fit: cover;
30
- object-fit: cover;
31
- }
32
-
33
- :host(:not(:first-child)) {
34
- margin-top: 0.5rem;
35
- border-top-left-radius: 0;
36
- border-top-right-radius: 0;
37
- }
38
- `,
39
- html ` <slot></slot> `,
7
+ css `:host{display:block;border-top-left-radius:calc(.25rem - 2px);border-top-right-radius:calc(.25rem - 2px);background-color:#f0f0f0;position:relative;overflow:hidden;box-sizing:border-box}:host([variant=inset]){background-color:#fff;padding-top:1.5rem;padding-left:1.5rem;padding-right:1.5rem}::slotted(img){display:block;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}:host(:not(:first-child)){margin-top:.5rem;border-top-left-radius:0;border-top-right-radius:0}`,
8
+ html `<slot></slot>`,
40
9
  ],
41
10
  })];
42
11
  let _classDescriptor;
@@ -4,38 +4,7 @@ let USACardElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-card",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- color: #1b1b1b;
10
- background-color: #fff;
11
- font-size: 1.06rem;
12
- line-height: 1.5;
13
- border-width: 2px;
14
- border-color: #e6e6e6;
15
- border-style: solid;
16
- display: flex;
17
- flex-direction: column;
18
- position: relative;
19
- border-radius: 0.25rem;
20
- }
21
-
22
- :host([variant="flag"]) {
23
- padding-left: 15rem;
24
- }
25
-
26
- :host([variant="flag"]) ::slotted(usa-card-media) {
27
- position: absolute;
28
- bottom: 0;
29
- top: 0;
30
- left: 0;
31
- width: 15rem;
32
- }
33
-
34
- :host([variant="flag"]) ::slotted(usa-card-media[variant="inset"]) {
35
- padding-bottom: 1.5rem;
36
- padding-right: 0;
37
- }
38
- `,
7
+ css `:host{color:#1b1b1b;background-color:#fff;font-size:1.06rem;line-height:1.5;border-width:2px;border-color:#e6e6e6;border-style:solid;display:flex;flex-direction:column;position:relative;border-radius:.25rem}:host([variant=flag]){padding-left:15rem}:host([variant=flag]) ::slotted(usa-card-media){position:absolute;bottom:0;top:0;left:0;width:15rem}:host([variant=flag]) ::slotted(usa-card-media[variant=inset]){padding-bottom:1.5rem;padding-right:0}`,
39
8
  html `<slot></slot>`,
40
9
  ],
41
10
  })];