@noctuatech/uswds 0.1.2 → 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 (92) hide show
  1. package/package.json +13 -11
  2. package/src/lib/combo-box/combo-box-option/combo-box-option.element.ts +2 -1
  3. package/src/lib/combo-box/combo-box.element.ts +132 -18
  4. package/src/lib/combo-box/combo-box.stories.ts +52 -60
  5. package/src/lib/combo-box/combo-box.test.ts +123 -15
  6. package/target/lib/accordion/accordion.element.js +2 -86
  7. package/target/lib/accordion/accordion.stories.js +1 -26
  8. package/target/lib/accordion/accordion.test.js +5 -72
  9. package/target/lib/alert/alert.element.js +2 -71
  10. package/target/lib/alert/alert.stories.js +1 -41
  11. package/target/lib/alert/alert.test.js +1 -9
  12. package/target/lib/button/button.element.js +2 -142
  13. package/target/lib/button/button.stories.js +1 -6
  14. package/target/lib/button/button.test.js +1 -3
  15. package/target/lib/card/card-body/card-body.element.js +1 -8
  16. package/target/lib/card/card-footer/card-footer.element.js +1 -6
  17. package/target/lib/card/card-group/card-group.element.js +1 -12
  18. package/target/lib/card/card-header/card-header.element.js +1 -16
  19. package/target/lib/card/card-media/card-media.element.js +2 -33
  20. package/target/lib/card/card.element.js +1 -32
  21. package/target/lib/card/card.stories.js +2 -107
  22. package/target/lib/card/card.test.js +1 -20
  23. package/target/lib/checkbox/checkbox-group/checkbox-group.element.js +2 -10
  24. package/target/lib/checkbox/checkbox.element.js +2 -112
  25. package/target/lib/checkbox/checkbox.stories.js +2 -43
  26. package/target/lib/checkbox/checkbox.test.js +4 -28
  27. package/target/lib/collection/collection-item/collection-item.element.js +2 -40
  28. package/target/lib/collection/collection-item/collection-item.test.js +1 -3
  29. package/target/lib/collection/collection.element.js +2 -10
  30. package/target/lib/collection/collection.stories.js +1 -63
  31. package/target/lib/collection/collection.test.js +1 -3
  32. package/target/lib/combo-box/combo-box-option/combo-box-option.element.js +2 -9
  33. package/target/lib/combo-box/combo-box-option/combo-box-option.element.js.map +1 -1
  34. package/target/lib/combo-box/combo-box.element.d.ts +8 -0
  35. package/target/lib/combo-box/combo-box.element.js +73 -64
  36. package/target/lib/combo-box/combo-box.element.js.map +1 -1
  37. package/target/lib/combo-box/combo-box.stories.js +1 -213
  38. package/target/lib/combo-box/combo-box.stories.js.map +1 -1
  39. package/target/lib/combo-box/combo-box.test.js +58 -15
  40. package/target/lib/combo-box/combo-box.test.js.map +1 -1
  41. package/target/lib/config/config.element.js +1 -5
  42. package/target/lib/config/config.test.js +1 -3
  43. package/target/lib/description/description.element.js +1 -7
  44. package/target/lib/description/description.test.js +1 -3
  45. package/target/lib/file-input/file-input-preview/file-input-preview.element.js +2 -61
  46. package/target/lib/file-input/file-input-preview/file-input-preview.test.js +5 -25
  47. package/target/lib/file-input/file-input.element.js +2 -82
  48. package/target/lib/file-input/file-input.stories.js +1 -13
  49. package/target/lib/file-input/file-input.test.js +2 -16
  50. package/target/lib/icon/icon.element.js +1 -14
  51. package/target/lib/icon/icon.stories.js +2 -13
  52. package/target/lib/input/input.element.js +2 -73
  53. package/target/lib/input/input.stories.js +2 -12
  54. package/target/lib/input/input.test.js +4 -24
  55. package/target/lib/input-mask/input-mask.element.js +1 -5
  56. package/target/lib/input-mask/input-mask.stories.js +1 -12
  57. package/target/lib/input-mask/input-mask.test.js +4 -24
  58. package/target/lib/link/link.element.js +2 -18
  59. package/target/lib/modal/modal-close/modal-close.element.js +2 -36
  60. package/target/lib/modal/modal-close/modal-close.test.js +1 -3
  61. package/target/lib/modal/modal-heading/modal-heading.element.js +2 -24
  62. package/target/lib/modal/modal-heading/modal-heading.test.js +1 -3
  63. package/target/lib/modal/modal.element.js +2 -33
  64. package/target/lib/modal/modal.stories.js +1 -18
  65. package/target/lib/modal/modal.test.js +1 -11
  66. package/target/lib/radio/radio-option/radio-option.element.js +2 -16
  67. package/target/lib/radio/radio-option/radio-option.test.js +1 -5
  68. package/target/lib/radio/radio.element.js +2 -98
  69. package/target/lib/radio/radio.stories.js +1 -26
  70. package/target/lib/radio/radio.test.js +5 -103
  71. package/target/lib/range-slider/range-slider.element.js +2 -52
  72. package/target/lib/range-slider/range-slider.test.js +3 -17
  73. package/target/lib/select/select-option/select-option.element.js +1 -5
  74. package/target/lib/select/select.element.js +2 -49
  75. package/target/lib/select/select.stories.js +1 -10
  76. package/target/lib/select/select.test.js +6 -64
  77. package/target/lib/side-nav/side-nav-item/side-nav-item.element.js +2 -67
  78. package/target/lib/side-nav/side-nav.element.js +1 -8
  79. package/target/lib/side-nav/side-nav.stories.js +1 -39
  80. package/target/lib/side-nav/side-nav.test.js +2 -78
  81. package/target/lib/step-indicator/step/step.element.js +2 -96
  82. package/target/lib/step-indicator/step-indicator.element.js +1 -9
  83. package/target/lib/step-indicator/step-indicator.stories.js +1 -21
  84. package/target/lib/step-indicator/step-indicator.test.js +1 -9
  85. package/target/lib/summary-box/summary-box.element.js +2 -14
  86. package/target/lib/summary-box/summary-box.stories.js +1 -1
  87. package/target/lib/summary-box/summary-box.test.js +1 -3
  88. package/target/lib/tag/tag.element.js +1 -22
  89. package/target/lib/tag/tag.stories.js +1 -1
  90. package/target/lib/tag/tag.test.js +1 -3
  91. package/target/lib/textarea/textarea.element.js +2 -49
  92. package/target/lib/textarea/textarea.test.js +4 -24
@@ -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
- :host {
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
- :host {
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;
@@ -4,7 +4,7 @@ const meta = {
4
4
  title: "usa-summary-box",
5
5
  tags: ["autodocs"],
6
6
  render() {
7
- return html `<usa-summary-box> Hello World </usa-summary-box>`;
7
+ return html `<usa-summary-box>Hello World</usa-summary-box>`;
8
8
  },
9
9
  argTypes: {},
10
10
  args: {},
@@ -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
  })];
@@ -5,7 +5,7 @@ const meta = {
5
5
  title: "usa-tag",
6
6
  tags: ["autodocs"],
7
7
  render(args) {
8
- return html `<usa-tag variant=${args.variant}>Hello World</usa-tag>`;
8
+ return html `<usa-tag variant="${args.variant}">Hello World</usa-tag>`;
9
9
  },
10
10
  argTypes: {
11
11
  variant: {
@@ -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
  });
@@ -5,55 +5,8 @@ let USATextareaElement = (() => {
5
5
  let _classDecorators = [element({
6
6
  tagName: "usa-textarea",
7
7
  shadowDom: [
8
- css `
9
- * {
10
- box-sizing: border-box;
11
- }
12
-
13
- :host {
14
- font-size: 1.06rem;
15
- line-height: 1.3;
16
- display: flex;
17
- flex-direction: column;
18
- font-weight: 400;
19
- margin-bottom: 1.5rem;
20
- max-width: 30rem;
21
- position: relative;
22
- height: 9lh;
23
- gap: 0.5rem;
24
- }
25
-
26
- textarea {
27
- font-family: inherit;
28
- font-size: inherit;
29
- border-radius: 0;
30
- color: #1b1b1b;
31
- display: block;
32
- max-width: 30rem;
33
- padding: .5rem;
34
- border-width: 1px;
35
- border-color: #5c5c5c;
36
- border-style: solid;
37
- -webkit-appearance: none;
38
- -moz-appearance: none;
39
- appearance: none;
40
- width: 100%;
41
- resize: none;
42
- flex-grow: 1;
43
- }
44
-
45
- textarea:not(:disabled):focus {
46
- outline: 0.25rem solid #2491ff;
47
- outline-offset: 0;
48
- }
49
- `,
50
- html `
51
- <label for="textarea">
52
- <slot></slot>
53
- </label>
54
-
55
- <textarea id="textarea"></textarea>
56
- `,
8
+ css `*{box-sizing:border-box}:host{font-size:1.06rem;line-height:1.3;display:flex;flex-direction:column;font-weight:400;margin-bottom:1.5rem;max-width:30rem;position:relative;height:9lh;gap:.5rem}textarea{font-family:inherit;font-size:inherit;border-radius:0;color:#1b1b1b;display:block;max-width:30rem;padding:.5rem;border-width:1px;border-color:#5c5c5c;border-style:solid;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;resize:none;flex-grow:1}textarea:not(:disabled):focus{outline:.25rem solid #2491ff;outline-offset:0}`,
9
+ html `<label for="textarea"><slot></slot></label> <textarea id="textarea"></textarea>`,
57
10
  ],
58
11
  })];
59
12
  let _classDescriptor;
@@ -3,30 +3,16 @@ import { assert, fixture, html } from "@open-wc/testing";
3
3
  import { userEvent } from "@testing-library/user-event";
4
4
  describe("usa-textarea", () => {
5
5
  it("should be accessible", async () => {
6
- const form = await fixture(html `
7
- <usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
8
- `);
6
+ const form = await fixture(html `<usa-textarea name="fname" value="Foo">Hello World</usa-textarea>`);
9
7
  return assert.isAccessible(form);
10
8
  });
11
9
  it("should submit form with default values", async () => {
12
- const form = await fixture(html `
13
- <form>
14
- <usa-textarea name="fname" value="Foo">Hello World</usa-textarea>
15
-
16
- <button>Submit</button>
17
- </form>
18
- `);
10
+ const form = await fixture(html `<form><usa-textarea name="fname" value="Foo">Hello World</usa-textarea><button>Submit</button></form>`);
19
11
  const value = new FormData(form);
20
12
  assert.equal(value.get("fname"), "Foo");
21
13
  });
22
14
  it("should update form value as input value changed", async () => {
23
- const form = await fixture(html `
24
- <form>
25
- <usa-textarea name="fname">Hello World</usa-textarea>
26
-
27
- <button>Submit</button>
28
- </form>
29
- `);
15
+ const form = await fixture(html `<form><usa-textarea name="fname">Hello World</usa-textarea><button>Submit</button></form>`);
30
16
  const input = form.querySelector("usa-textarea");
31
17
  const nativeInput = input?.shadowRoot?.querySelector("textarea");
32
18
  if (nativeInput) {
@@ -36,13 +22,7 @@ describe("usa-textarea", () => {
36
22
  assert.equal(value.get("fname"), "Bar");
37
23
  });
38
24
  it("should not submit when not valid", async () => {
39
- const form = await fixture(html `
40
- <form>
41
- <usa-textarea name="fname" required>Hello World</usa-textarea>
42
-
43
- <button>Submit</button>
44
- </form>
45
- `);
25
+ const form = await fixture(html `<form><usa-textarea name="fname" required>Hello World</usa-textarea><button>Submit</button></form>`);
46
26
  assert.equal(form.checkValidity(), false);
47
27
  });
48
28
  });