@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
@@ -9,19 +9,7 @@ const meta = {
9
9
  const data = new FormData(e.target);
10
10
  console.log(data.getAll("upload"));
11
11
  }
12
- return html `
13
- <form @submit=${onSubmit}>
14
- <usa-file-input name="upload" required>
15
- Input accepts a single file
16
-
17
- <div slot="description">
18
- Drag file here or <usa-link>choose from folder</usa-link>
19
- </div>
20
- </usa-file-input>
21
-
22
- <usa-button type="submit">SUBMIT</usa-button>
23
- </form>
24
- `;
12
+ return html `<form @submit="${onSubmit}"><usa-file-input name="upload" required>Input accepts a single file<div slot="description">Drag file here or<usa-link>choose from folder</usa-link></div></usa-file-input><usa-button type="submit">SUBMIT</usa-button></form>`;
25
13
  },
26
14
  argTypes: {},
27
15
  args: {},
@@ -2,28 +2,14 @@ import "./file-input.element.js";
2
2
  import { assert, fixture, html } from "@open-wc/testing";
3
3
  describe("usa-file-input", () => {
4
4
  it("should be accessible", async () => {
5
- const fileInput = await fixture(html `
6
- <usa-file-input>Hello World</usa-file-input>
7
- `);
5
+ const fileInput = await fixture(html `<usa-file-input>Hello World</usa-file-input>`);
8
6
  return assert.isAccessible(fileInput);
9
7
  });
10
8
  it("should submit files with the form", async () => {
11
9
  const data = new DataTransfer();
12
10
  data.items.add(new File([], "first.txt"));
13
11
  data.items.add(new File([], "second.txt"));
14
- const form = await fixture(html `
15
- <form>
16
- <usa-file-input name="upload" .files=${data.files}>
17
- Input accepts a single file
18
-
19
- <div slot="description">
20
- Drag file here or <usa-link>choose from folder</usa-link>
21
- </div>
22
- </usa-file-input>
23
-
24
- <button>Submit</button>
25
- </form>
26
- `);
12
+ const form = await fixture(html `<form><usa-file-input name="upload" .files="${data.files}">Input accepts a single file<div slot="description">Drag file here or<usa-link>choose from folder</usa-link></div></usa-file-input><button>Submit</button></form>`);
27
13
  const formData = new FormData(form);
28
14
  const fileNames = formData.getAll("upload").map((file) => {
29
15
  if (file instanceof File) {
@@ -6,20 +6,7 @@ let USAIconElement = (() => {
6
6
  let _classDecorators = [element({
7
7
  tagName: "usa-icon",
8
8
  shadowDom: [
9
- css `
10
- :host {
11
- display: inline-block;
12
- height: 2rem;
13
- position: relative;
14
- width: 2rem;
15
- }
16
-
17
- svg {
18
- fill: currentColor;
19
- height: 100%;
20
- width: 100%;
21
- }
22
- `,
9
+ css `:host{display:inline-block;height:2rem;position:relative;width:2rem}svg{fill:currentColor;height:100%;width:100%}`,
23
10
  ],
24
11
  }), injectable({
25
12
  name: "usa-icon-ctx",
@@ -5,7 +5,7 @@ const meta = {
5
5
  title: "usa-icon",
6
6
  tags: [],
7
7
  render(args) {
8
- return html `<usa-icon icon=${args.icon}></usa-icon>`;
8
+ return html `<usa-icon icon="${args.icon}"></usa-icon>`;
9
9
  },
10
10
  argTypes: {},
11
11
  args: {},
@@ -22,18 +22,7 @@ export const AllIcons = {
22
22
  console.error("Failed to copy: ", err);
23
23
  }
24
24
  }
25
- return html `<div style="display: flex; flex-wrap: wrap; gap: .75rem;">
26
- ${html `${ICON_TYPES.map((icon) => html `
27
- <button
28
- @click=${() => copyIcon(icon)}
29
- style="padding: .5rem 1rem .5rem .5rem; cursor: pointer; background: #fff; border-radius: 4px; gap: .5rem; display: flex; align-items: center"
30
- >
31
- <usa-icon icon=${icon}></usa-icon>
32
-
33
- ${icon}
34
- </button>
35
- `)}`}
36
- </div>`;
25
+ return html `<div style="display:flex;flex-wrap:wrap;gap:.75rem">${html `${ICON_TYPES.map((icon) => html `<button @click="${() => copyIcon(icon)}" style="padding:.5rem 1rem .5rem .5rem;cursor:pointer;background:#fff;border-radius:4px;gap:.5rem;display:flex;align-items:center"><usa-icon icon="${icon}"></usa-icon>${icon}</button>`)}`}</div>`;
37
26
  },
38
27
  };
39
28
  //# sourceMappingURL=icon.stories.js.map
@@ -5,79 +5,8 @@ let USATextInputElement = (() => {
5
5
  let _classDecorators = [element({
6
6
  tagName: "usa-input",
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: block;
17
- font-weight: 400;
18
- max-width: 30rem;
19
- margin-bottom: 1.5rem;
20
- position: relative;
21
- }
22
-
23
- input {
24
- border-width: 1px;
25
- border-color: #5c5c5c;
26
- border-style: solid;
27
- border-radius: 0;
28
- color: #1b1b1b;
29
- display: block;
30
- height: 2.5rem;
31
- line-height: 1.3;
32
- font-size: 1.06rem;
33
- margin-top: 0.5rem;
34
- padding: 0.5rem;
35
- width: 100%;
36
- }
37
-
38
- input:not(:disabled):focus {
39
- outline: 0.25rem solid #2491ff;
40
- outline-offset: 0;
41
- }
42
-
43
- slot[name="detail"]::slotted(*) {
44
- color: #757575;
45
- }
46
-
47
- slot[name="detail"]::slotted(usa-icon) {
48
- width: 1.5rem;
49
- height: 1.5rem;
50
- }
51
-
52
- slot[name="detail"] {
53
- display: block;
54
- position: absolute;
55
- bottom: 0.21rem;
56
- left: 0.5rem;
57
- }
58
-
59
- :host([detail="pfx"]) input {
60
- padding-left: 2.5rem;
61
- }
62
-
63
- :host([detail="sfx"]) input {
64
- padding-right: 2.5rem;
65
- }
66
-
67
- :host([detail="sfx"]) slot[name="detail"] {
68
- right: 0.5rem;
69
- left: auto;
70
- }
71
- `,
72
- html `
73
- <label>
74
- <slot name="detail"></slot>
75
-
76
- <slot></slot>
77
-
78
- <input tabindex="0" />
79
- </label>
80
- `,
8
+ css `*{box-sizing:border-box}:host{font-size:1.06rem;line-height:1.3;display:block;font-weight:400;max-width:30rem;margin-bottom:1.5rem;position:relative}input{border-width:1px;border-color:#5c5c5c;border-style:solid;border-radius:0;color:#1b1b1b;display:block;height:2.5rem;line-height:1.3;font-size:1.06rem;margin-top:.5rem;padding:.5rem;width:100%}input:not(:disabled):focus{outline:.25rem solid #2491ff;outline-offset:0}slot[name=detail]::slotted(*){color:#757575}slot[name=detail]::slotted(usa-icon){width:1.5rem;height:1.5rem}slot[name=detail]{display:block;position:absolute;bottom:.21rem;left:.5rem}:host([detail=pfx]) input{padding-left:2.5rem}:host([detail=sfx]) input{padding-right:2.5rem}:host([detail=sfx]) slot[name=detail]{right:.5rem;left:auto}`,
9
+ html `<label><slot name="detail"></slot><slot></slot><input tabindex="0"></label>`,
81
10
  ],
82
11
  })];
83
12
  let _classDescriptor;
@@ -4,21 +4,11 @@ const meta = {
4
4
  title: "usa-input",
5
5
  tags: ["autodocs"],
6
6
  render() {
7
- return html `
8
- <form @submit=${(e) => {
7
+ return html `<form @submit="${(e) => {
9
8
  e.preventDefault();
10
9
  const data = new FormData(e.target);
11
10
  console.log(Array.from(data.entries()));
12
- }}>
13
- <usa-input name="fname" autocomplete="off" detail="pfx">
14
- <usa-icon icon="credit_card" slot="detail"></usa-icon>
15
-
16
- First name
17
- </usa-input>
18
-
19
- <usa-button type="submit">Submit</usa-button>
20
- </form>
21
- `;
11
+ }}"><usa-input name="fname" autocomplete="off" detail="pfx"><usa-icon icon="credit_card" slot="detail"></usa-icon>First name</usa-input><usa-button type="submit">Submit</usa-button></form>`;
22
12
  },
23
13
  argTypes: {},
24
14
  args: {},
@@ -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-input", () => {
5
5
  it("should be accessible", async () => {
6
- const form = await fixture(html `
7
- <usa-input name="fname" value="Foo">Hello World</usa-input>
8
- `);
6
+ const form = await fixture(html `<usa-input name="fname" value="Foo">Hello World</usa-input>`);
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-input name="fname" value="Foo">Hello World</usa-input>
15
-
16
- <button>Submit</button>
17
- </form>
18
- `);
10
+ const form = await fixture(html `<form><usa-input name="fname" value="Foo">Hello World</usa-input><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-input name="fname">Hello World</usa-input>
26
-
27
- <button>Submit</button>
28
- </form>
29
- `);
15
+ const form = await fixture(html `<form><usa-input name="fname">Hello World</usa-input><button>Submit</button></form>`);
30
16
  const input = form.querySelector("usa-input");
31
17
  const nativeInput = input?.shadowRoot?.querySelector("input");
32
18
  if (nativeInput) {
@@ -36,13 +22,7 @@ describe("usa-input", () => {
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-input name="fname" required>Hello World</usa-input>
42
-
43
- <button>Submit</button>
44
- </form>
45
- `);
25
+ const form = await fixture(html `<form><usa-input name="fname" required>Hello World</usa-input><button>Submit</button></form>`);
46
26
  assert.equal(form.checkValidity(), false);
47
27
  });
48
28
  });
@@ -5,11 +5,7 @@ let USAInputMaskElement = (() => {
5
5
  let _classDecorators = [element({
6
6
  tagName: "usa-input-mask",
7
7
  shadowDom: [
8
- css `
9
- :host {
10
- display: contents;
11
- }
12
- `,
8
+ css `:host{display:contents}`,
13
9
  html `<slot></slot>`,
14
10
  ],
15
11
  })];
@@ -4,18 +4,7 @@ const meta = {
4
4
  title: "input-mask",
5
5
  tags: ["autodocs"],
6
6
  render(args) {
7
- return html `
8
- <usa-input-mask>
9
- <usa-input
10
- name="phone"
11
- placeholder=${args.mask}
12
- autocomplete="off"
13
- mask=${args.mask}
14
- >
15
- Phone:
16
- </usa-input>
17
- </usa-input-mask>
18
- `;
7
+ return html `<usa-input-mask><usa-input name="phone" placeholder="${args.mask}" autocomplete="off" mask="${args.mask}">Phone:</usa-input></usa-input-mask>`;
19
8
  },
20
9
  argTypes: {},
21
10
  args: {
@@ -36,20 +36,12 @@ describe("format", () => {
36
36
  });
37
37
  describe("usa-input-mask", () => {
38
38
  it("should format default value", async () => {
39
- const el = await fixture(html `
40
- <usa-input-mask mask="(999) 999-9999">
41
- <input name="phone" value="1234567890" mask />
42
- </usa-input-mask>
43
- `);
39
+ const el = await fixture(html `<usa-input-mask mask="(999) 999-9999"><input name="phone" value="1234567890" mask></usa-input-mask>`);
44
40
  const input = el.querySelector("input");
45
41
  assert.equal(input?.value, "(123) 456-7890");
46
42
  });
47
43
  it("should update value when on input event", async () => {
48
- const el = await fixture(html `
49
- <usa-input-mask>
50
- <input name="phone" mask="(999) 999-9999" />
51
- </usa-input-mask>
52
- `);
44
+ const el = await fixture(html `<usa-input-mask><input name="phone" mask="(999) 999-9999"></usa-input-mask>`);
53
45
  const input = el.querySelector("input");
54
46
  if (input) {
55
47
  input.value = "8888888888";
@@ -60,24 +52,12 @@ describe("usa-input-mask", () => {
60
52
  });
61
53
  describe("usa-input-mask with usa-input", () => {
62
54
  it("should format default value", async () => {
63
- const el = await fixture(html `
64
- <usa-input-mask mask="(999) 999-9999">
65
- <usa-input name="phone" value="1234567890" id="TEST" mask></usa-input>
66
- </usa-input-mask>
67
- `);
55
+ const el = await fixture(html `<usa-input-mask mask="(999) 999-9999"><usa-input name="phone" value="1234567890" id="TEST" mask></usa-input></usa-input-mask>`);
68
56
  const input = el.querySelector("usa-input");
69
57
  assert.equal(input?.value, "(123) 456-7890");
70
58
  });
71
59
  it("should update value when on input event", async () => {
72
- const el = await fixture(html `
73
- <usa-input-mask>
74
- <usa-input
75
- name="phone"
76
- value="1234567890"
77
- mask="(999) 999-9999"
78
- ></usa-input>
79
- </usa-input-mask>
80
- `);
60
+ const el = await fixture(html `<usa-input-mask><usa-input name="phone" value="1234567890" mask="(999) 999-9999"></usa-input></usa-input-mask>`);
81
61
  const input = el.querySelector("usa-input");
82
62
  if (input) {
83
63
  input.value = "8888888888";
@@ -4,24 +4,8 @@ let USALinkElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-link",
6
6
  shadowDom: [
7
- css `
8
- :host {
9
- display: inline-flex;
10
- color: #005ea2;
11
- text-decoration: underline;
12
- }
13
-
14
- a {
15
- color: inherit;
16
- text-decoration: inherit;
17
- display: inherit;
18
- }
19
- `,
20
- html `
21
- <a>
22
- <slot></slot>
23
- </a>
24
- `,
7
+ css `:host{display:inline-flex;color:#005ea2;text-decoration:underline}a{color:inherit;text-decoration:inherit;display:inherit}`,
8
+ html `<a><slot></slot></a>`,
25
9
  ],
26
10
  })];
27
11
  let _classDescriptor;
@@ -4,42 +4,8 @@ let USAModalCloseElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-modal-close",
6
6
  shadowDom: [
7
- css `
8
- * {
9
- box-sizing: border-box;
10
- }
11
-
12
- :host {
13
- display: block;
14
- position: absolute;
15
- top: 1rem;
16
- right: 1rem;
17
- }
18
-
19
- button {
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- background: none;
24
- border: none;
25
- cursor: pointer;
26
- height: 100%;
27
- width: 100%;
28
- border-radius: 100%;
29
- padding: 0;
30
- margin: 0;
31
- }
32
-
33
- button:focus {
34
- outline: 0.25rem solid #2491ff;
35
- outline-offset: 0;
36
- }
37
- `,
38
- html `
39
- <button aria-label="close modal">
40
- <usa-icon icon="close"></usa-icon>
41
- </button>
42
- `,
7
+ css `*{box-sizing:border-box}:host{display:block;position:absolute;top:1rem;right:1rem}button{display:flex;align-items:center;justify-content:center;background:0 0;border:none;cursor:pointer;height:100%;width:100%;border-radius:100%;padding:0;margin:0}button:focus{outline:.25rem solid #2491ff;outline-offset:0}`,
8
+ html `<button aria-label="close modal"><usa-icon icon="close"></usa-icon></button>`,
43
9
  ],
44
10
  })];
45
11
  let _classDescriptor;
@@ -2,9 +2,7 @@ import "./modal-close.element.js";
2
2
  import { assert, fixture, html } from "@open-wc/testing";
3
3
  describe("usa-modal-close", () => {
4
4
  it("should be accessible", async () => {
5
- const modalClose = await fixture(html `
6
- <usa-modal-close>Hello World</usa-modal-close>
7
- `);
5
+ const modalClose = await fixture(html `<usa-modal-close>Hello World</usa-modal-close>`);
8
6
  return assert.isAccessible(modalClose);
9
7
  });
10
8
  });
@@ -4,30 +4,8 @@ let USAModalHeadingElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-modal-heading",
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
-
17
- font-size: 1.22rem;
18
- }
19
-
20
- h2 {
21
- margin-top: 0;
22
- line-height: 1.4;
23
- font-size: 1.45rem;
24
- }
25
- `,
26
- html `
27
- <h2>
28
- <slot></slot>
29
- </h2>
30
- `,
7
+ css `:host{font-family:Merriweather Web,Georgia,Cambria,Times New Roman,Times,serif!important;font-size:1.22rem}h2{margin-top:0;line-height:1.4;font-size:1.45rem}`,
8
+ html `<h2><slot></slot></h2>`,
31
9
  ],
32
10
  })];
33
11
  let _classDescriptor;
@@ -2,9 +2,7 @@ import "./modal-heading.element.js";
2
2
  import { assert, fixture, html } from "@open-wc/testing";
3
3
  describe("usa-modal-heading", () => {
4
4
  it("should be accessible", async () => {
5
- const modalHeading = await fixture(html `
6
- <usa-modal-heading>Hello World</usa-modal-heading>
7
- `);
5
+ const modalHeading = await fixture(html `<usa-modal-heading>Hello World</usa-modal-heading>`);
8
6
  return assert.isAccessible(modalHeading);
9
7
  });
10
8
  });
@@ -4,39 +4,8 @@ let USAModalElement = (() => {
4
4
  let _classDecorators = [element({
5
5
  tagName: "usa-modal",
6
6
  shadowDom: [
7
- css `
8
- * {
9
- box-sizing: border-box;
10
- }
11
-
12
- :host {
13
- display: contents;
14
- }
15
-
16
- dialog {
17
- border: none;
18
- font-size: 1.06rem;
19
- line-height: 1.5;
20
- border-radius: 0.5rem;
21
- background: #fff;
22
- color: #1b1b1b;
23
- max-width: 30rem;
24
- padding-top: 4rem;
25
- padding-left: 4rem;
26
- padding-right: 4rem;
27
- padding-bottom: 2rem;
28
- width: 100%;
29
- }
30
-
31
- ::backdrop {
32
- background: rgba(0, 0, 0, 0.7);
33
- }
34
- `,
35
- html `
36
- <dialog>
37
- <slot></slot>
38
- </dialog>
39
- `,
7
+ css `*{box-sizing:border-box}:host{display:contents}dialog{border:none;font-size:1.06rem;line-height:1.5;border-radius:.5rem;background:#fff;color:#1b1b1b;max-width:30rem;padding-top:4rem;padding-left:4rem;padding-right:4rem;padding-bottom:2rem;width:100%}::backdrop{background:rgba(0,0,0,.7)}`,
8
+ html `<dialog><slot></slot></dialog>`,
40
9
  ],
41
10
  })];
42
11
  let _classDescriptor;
@@ -4,24 +4,7 @@ const meta = {
4
4
  title: "usa-modal",
5
5
  tags: ["autodocs"],
6
6
  render() {
7
- return html `
8
- <usa-button modal-target="mymodal">Open Modal</usa-button>
9
-
10
- <usa-modal id="mymodal">
11
- <usa-modal-close></usa-modal-close>
12
-
13
- <usa-modal-heading>
14
- Are you sure you want to continue?
15
- </usa-modal-heading>
16
-
17
- <usa-input placeholder="foo@email.com" autofocus>
18
- Enter your email to continue
19
- </usa-input>
20
-
21
- <usa-button modal-action="confirm">Yes I am sure</usa-button>
22
- <usa-button modal-action="cancel" variant="outline">Cancel</usa-button>
23
- </usa-modal>
24
- `;
7
+ return html `<usa-button modal-target="mymodal">Open Modal</usa-button><usa-modal id="mymodal"><usa-modal-close></usa-modal-close><usa-modal-heading>Are you sure you want to continue?</usa-modal-heading><usa-input placeholder="foo@email.com" autofocus>Enter your email to continue</usa-input><usa-button modal-action="confirm">Yes I am sure</usa-button><usa-button modal-action="cancel" variant="outline">Cancel</usa-button></usa-modal>`;
25
8
  },
26
9
  argTypes: {},
27
10
  args: {},
@@ -4,17 +4,7 @@ import "./modal-close/modal-close.element.js";
4
4
  import { assert, fixture, html } from "@open-wc/testing";
5
5
  describe("usa-modal", () => {
6
6
  it("should be accessible", async () => {
7
- const modal = await fixture(html `
8
- <usa-modal open>
9
- <usa-modal-close></usa-modal-close>
10
-
11
- <usa-modal-heading>
12
- Are you sure you want to continue?
13
- </usa-modal-heading>
14
-
15
- <p>This is some other example of content</p>
16
- </usa-modal>
17
- `);
7
+ const modal = await fixture(html `<usa-modal open><usa-modal-close></usa-modal-close><usa-modal-heading>Are you sure you want to continue?</usa-modal-heading><p>This is some other example of content</p></usa-modal>`);
18
8
  return assert.isAccessible(modal);
19
9
  });
20
10
  });
@@ -8,22 +8,8 @@ let USARadioOptionElement = (() => {
8
8
  }), element({
9
9
  tagName: "usa-radio-option",
10
10
  shadowDom: [
11
- css `
12
- :host {
13
- display: flex;
14
- flex-direction: column;
15
- margin-top: 0.05rem;
16
- }
17
- `,
18
- html `
19
- <!-- This label will be moved to the shadow dom of its parent -->
20
- <label>
21
- <input type="radio" tabindex="0" />
22
- <slot name="reserved"></slot>
23
- </label>
24
-
25
- <slot></slot>
26
- `,
11
+ css `:host{display:flex;flex-direction:column;margin-top:.05rem}`,
12
+ html `<label><input type="radio" tabindex="0"><slot name="reserved"></slot></label><slot></slot>`,
27
13
  ],
28
14
  })];
29
15
  let _classDescriptor;
@@ -3,11 +3,7 @@ import "./radio-option.element.js";
3
3
  import { assert, fixture, html } from "@open-wc/testing";
4
4
  describe("usa-radio-option", () => {
5
5
  it("should map value to slot", async () => {
6
- const radio = await fixture(html `
7
- <usa-radio>
8
- <usa-radio-option value="first">First</usa-radio-option>
9
- </usa-radio>
10
- `);
6
+ const radio = await fixture(html `<usa-radio><usa-radio-option value="first">First</usa-radio-option></usa-radio>`);
11
7
  const option = radio.querySelectorAll("usa-radio-option");
12
8
  assert.equal(option[0].value, option[0].slot);
13
9
  });