@noctuatech/uswds 0.0.31 → 0.0.33

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 (49) hide show
  1. package/README.md +13 -1
  2. package/package.json +11 -24
  3. package/src/lib/accordion/accordion.element.ts +3 -16
  4. package/src/lib/accordion/events.ts +15 -0
  5. package/src/lib/alert/alert.element.ts +0 -7
  6. package/src/lib/description/description.element.ts +1 -1
  7. package/src/lib/file-input/file-input.element.ts +2 -4
  8. package/src/lib/icon/icon-types.ts +0 -8
  9. package/src/lib/input/input.element.ts +10 -19
  10. package/src/lib/input/input.stories.ts +1 -1
  11. package/src/lib/input-mask/format.ts +24 -22
  12. package/src/lib/input-mask/input-mask.element.ts +8 -6
  13. package/src/lib/radio/radio-option/radio-option.element.ts +10 -11
  14. package/src/lib/radio/radio.element.ts +9 -5
  15. package/src/lib/select/select-option/select-option.element.ts +4 -2
  16. package/src/lib/textarea/textarea.element.ts +13 -16
  17. package/target/lib/accordion/accordion.element.d.ts +1 -6
  18. package/target/lib/accordion/accordion.element.js +2 -12
  19. package/target/lib/accordion/accordion.element.js.map +1 -1
  20. package/target/lib/accordion/events.d.ts +6 -0
  21. package/target/lib/accordion/events.js +11 -0
  22. package/target/lib/accordion/events.js.map +1 -0
  23. package/target/lib/alert/alert.element.js +0 -7
  24. package/target/lib/alert/alert.element.js.map +1 -1
  25. package/target/lib/description/description.element.js +1 -1
  26. package/target/lib/description/description.element.js.map +1 -1
  27. package/target/lib/file-input/file-input.element.js +1 -4
  28. package/target/lib/file-input/file-input.element.js.map +1 -1
  29. package/target/lib/icon/icon-types.d.ts +1 -1
  30. package/target/lib/icon/icon-types.js +0 -8
  31. package/target/lib/icon/icon-types.js.map +1 -1
  32. package/target/lib/input/input.element.d.ts +2 -2
  33. package/target/lib/input/input.element.js +14 -17
  34. package/target/lib/input/input.element.js.map +1 -1
  35. package/target/lib/input/input.stories.js +1 -1
  36. package/target/lib/input-mask/format.d.ts +3 -6
  37. package/target/lib/input-mask/format.js +21 -22
  38. package/target/lib/input-mask/format.js.map +1 -1
  39. package/target/lib/input-mask/input-mask.element.js +6 -9
  40. package/target/lib/input-mask/input-mask.element.js.map +1 -1
  41. package/target/lib/radio/radio-option/radio-option.element.js +10 -10
  42. package/target/lib/radio/radio-option/radio-option.element.js.map +1 -1
  43. package/target/lib/radio/radio.element.js +9 -5
  44. package/target/lib/radio/radio.element.js.map +1 -1
  45. package/target/lib/select/select-option/select-option.element.js +4 -2
  46. package/target/lib/select/select-option/select-option.element.js.map +1 -1
  47. package/target/lib/textarea/textarea.element.js +12 -16
  48. package/target/lib/textarea/textarea.element.js.map +1 -1
  49. package/assets/uswds.min.js +0 -1
package/README.md CHANGED
@@ -23,7 +23,7 @@ npm i @noctuatech/uswds
23
23
  }
24
24
  </style>
25
25
 
26
- <script src="/node_modules/@noctuatech/uswds/assets/uswds.min.js"></script>
26
+ <script type="module" src="https://esm.sh/@noctuatech/uswds@latest"></script>
27
27
 
28
28
  <usa-config icon-path="/node_modules/@noctuatech/uswds/assets/usa-icons/">
29
29
  <usa-alert type="info">
@@ -33,6 +33,18 @@ npm i @noctuatech/uswds
33
33
  <usa-link href="#">consectetur adipiscing</usa-link>&nbsp;elit, sed do
34
34
  eiusmod.
35
35
  </usa-alert>
36
+
37
+ <form>
38
+ <usa-input name="username">
39
+ First name
40
+ </usa-input>
41
+
42
+ <usa-input name="password">
43
+ Last name
44
+ </usa-input>
45
+
46
+ <usa-button type="submit">Submit</usa-button>
47
+ </form>
36
48
  </usa-config>
37
49
  ```
38
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noctuatech/uswds",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "workspaces": ["packages/**"],
6
6
  "main": "./target/lib.js",
@@ -29,7 +29,7 @@
29
29
  "dependencies": ["tsc"]
30
30
  },
31
31
  "build": {
32
- "dependencies": ["tsc", "build-storybook", "rollup", "copy_icons"]
32
+ "dependencies": ["tsc", "build-storybook", "copy_icons"]
33
33
  },
34
34
  "preview": {
35
35
  "command": "browser-sync start --server --files \"target/**\" \"index.html\"",
@@ -51,17 +51,6 @@
51
51
  "output": ["target/**", "tsconfig.tsbuildinfo"],
52
52
  "dependencies": ["./packages/testing:build"]
53
53
  },
54
- "rollup": {
55
- "command": "rollup -c rollup.config.js",
56
- "files": ["target/**", "rollup.config.js"],
57
- "output": ["assets/uswds.min.js"],
58
- "dependencies": [
59
- {
60
- "script": "tsc",
61
- "cascade": false
62
- }
63
- ]
64
- },
65
54
  "copy_icons": {
66
55
  "command": "cp -a node_modules/@uswds/uswds/dist/img/usa-icons/. assets/usa-icons/",
67
56
  "files": ["node_modules/@uswds/uswds/dist/img/usa-icons/**"],
@@ -72,9 +61,9 @@
72
61
  "license": "ISC",
73
62
  "description": "",
74
63
  "dependencies": {
75
- "@joist/di": "^4.0.0-next.48",
76
- "@joist/element": "^4.0.0-next.48",
77
- "@joist/observable": "^4.0.0-next.48",
64
+ "@joist/di": "^4.0.0",
65
+ "@joist/element": "^4.0.0",
66
+ "@joist/observable": "^4.0.0",
78
67
  "tslib": "2.8.1"
79
68
  },
80
69
  "devDependencies": {
@@ -82,24 +71,22 @@
82
71
  "@open-wc/testing": "^4.0.0",
83
72
  "@rollup/plugin-node-resolve": "^16.0.0",
84
73
  "@rollup/plugin-terser": "^0.4.4",
85
- "@storybook/addon-essentials": "^8.5.1",
86
- "@storybook/web-components": "^8.5.1",
87
- "@storybook/web-components-vite": "^8.5.1",
74
+ "@storybook/addon-essentials": "^8.6.0",
75
+ "@storybook/web-components": "^8.6.0",
76
+ "@storybook/web-components-vite": "^8.6.0",
88
77
  "@types/mocha": "^10.0.7",
89
78
  "@types/node": "^22.0.0",
90
79
  "@uswds/uswds": "^3.10.0",
91
- "@web/test-runner": "^0.19.0",
80
+ "@web/test-runner": "^0.20.0",
92
81
  "browser-sync": "^3.0.3",
93
82
  "husky": "^9.0.11",
94
83
  "js-beautify": "^1.15.1",
95
84
  "lint-staged": "^15.2.2",
96
85
  "lit": "^3.2.1",
97
- "minify-html-literals": "^1.3.5",
98
86
  "mocha": "^11.0.0",
99
87
  "plop": "^4.0.1",
100
- "rollup": "^4.28.0",
101
- "storybook": "^8.5.1",
102
- "typescript": "^5.6.3",
88
+ "storybook": "^8.6.0",
89
+ "typescript": "^5.8.0-beta",
103
90
  "wireit": "^0.14.9"
104
91
  },
105
92
  "lint-staged": {
@@ -1,5 +1,7 @@
1
1
  import { attr, css, element, html, listen, query } from "@joist/element";
2
2
 
3
+ import { USAAccordionToggleEvent } from "./events.js";
4
+
3
5
  declare global {
4
6
  interface HTMLElementTagNameMap {
5
7
  "usa-accordion": USAAccordionElement;
@@ -111,8 +113,7 @@ export class USAAccordionElement extends HTMLElement {
111
113
  #details = query("details");
112
114
 
113
115
  attributeChangedCallback() {
114
- const details = this.#details();
115
- details.open = this.open;
116
+ this.#details({ open: this.open });
116
117
  }
117
118
 
118
119
  @listen("click", "summary")
@@ -131,17 +132,3 @@ export class USAAccordionElement extends HTMLElement {
131
132
  }
132
133
  }
133
134
  }
134
-
135
- class USAAccordionToggleEvent extends Event {
136
- open;
137
-
138
- get target() {
139
- return super.target as USAAccordionElement;
140
- }
141
-
142
- constructor(open: boolean) {
143
- super("usa::accordion::toggle", { bubbles: true });
144
-
145
- this.open = open;
146
- }
147
- }
@@ -0,0 +1,15 @@
1
+ import type { USAAccordionElement } from "./accordion.element.js";
2
+
3
+ export class USAAccordionToggleEvent extends Event {
4
+ open;
5
+
6
+ get target() {
7
+ return super.target as USAAccordionElement;
8
+ }
9
+
10
+ constructor(open: boolean) {
11
+ super("usa::accordion::toggle", { bubbles: true });
12
+
13
+ this.open = open;
14
+ }
15
+ }
@@ -65,13 +65,6 @@ declare global {
65
65
  }
66
66
 
67
67
  #heading::slotted(*) {
68
- font-family:
69
- Source Sans Pro Web,
70
- Helvetica Neue,
71
- Helvetica,
72
- Roboto,
73
- Arial,
74
- sans-serif;
75
68
  font-size: 1.33rem;
76
69
  line-height: 0.9;
77
70
  margin-top: 0;
@@ -16,7 +16,7 @@ declare global {
16
16
  margin-top: 0.5rem;
17
17
  }
18
18
  `,
19
- html` <slot></slot> `,
19
+ html`<slot></slot>`,
20
20
  ],
21
21
  })
22
22
  export class USADescriptionElement extends HTMLElement {}
@@ -131,14 +131,12 @@ export class USAFileInputElement extends HTMLElement {
131
131
 
132
132
  const formData = new FormData();
133
133
 
134
- if (this.files?.length) {
135
- box.style.display = "none";
134
+ box.style.display = this.files?.length ? "none" : "flex";
136
135
 
136
+ if (this.files?.length) {
137
137
  for (const file of this.files) {
138
138
  formData.append(this.name, file);
139
139
  }
140
- } else {
141
- box.style.display = "flex";
142
140
  }
143
141
 
144
142
  this.#internals.setFormValue(formData);
@@ -71,7 +71,6 @@ export const ICON_TYPES = [
71
71
  "event",
72
72
  "expand_less",
73
73
  "expand_more",
74
- "facebook",
75
74
  "fast_forward",
76
75
  "fast_rewind",
77
76
  "favorite",
@@ -85,7 +84,6 @@ export const ICON_TYPES = [
85
84
  "fingerprint",
86
85
  "first_page",
87
86
  "flag",
88
- "flickr",
89
87
  "flight",
90
88
  "flooding",
91
89
  "folder",
@@ -93,7 +91,6 @@ export const ICON_TYPES = [
93
91
  "format_quote",
94
92
  "format_size",
95
93
  "forum",
96
- "github",
97
94
  "grid_view",
98
95
  "group_add",
99
96
  "groups",
@@ -112,7 +109,6 @@ export const ICON_TYPES = [
112
109
  "info",
113
110
  "info_outline",
114
111
  "insights",
115
- "instagram",
116
112
  "keyboard",
117
113
  "label",
118
114
  "language",
@@ -122,7 +118,6 @@ export const ICON_TYPES = [
122
118
  "lightbulb_outline",
123
119
  "link",
124
120
  "link_off",
125
- "linkedin",
126
121
  "list",
127
122
  "local_cafe",
128
123
  "local_fire_department",
@@ -222,7 +217,6 @@ export const ICON_TYPES = [
222
217
  "translate",
223
218
  "trending_down",
224
219
  "trending_up",
225
- "twitter",
226
220
  "undo",
227
221
  "unfold_less",
228
222
  "unfold_more",
@@ -237,8 +231,6 @@ export const ICON_TYPES = [
237
231
  "wash",
238
232
  "wifi",
239
233
  "work",
240
- "x",
241
- "youtube",
242
234
  "zoom_in",
243
235
  "zoom_out_map",
244
236
  "zoom_out",
@@ -1,5 +1,5 @@
1
1
  import { attr, css, element, html, listen, query, ready } from "@joist/element";
2
- import { type Changes, effect, observe } from "@joist/observable";
2
+ import { effect, observe } from "@joist/observable";
3
3
 
4
4
  import type { MaskableElement } from "../input-mask/maskable.element.js";
5
5
 
@@ -105,6 +105,9 @@ export class USATextInputElement
105
105
  @attr()
106
106
  accessor required = false;
107
107
 
108
+ @attr()
109
+ accessor type: "text" | "password" | "number" = "text";
110
+
108
111
  @attr({
109
112
  observed: false,
110
113
  })
@@ -131,11 +134,9 @@ export class USATextInputElement
131
134
  }
132
135
 
133
136
  attributeChangedCallback() {
134
- this.#input({
135
- autocomplete: this.autocomplete,
136
- placeholder: this.placeholder,
137
- name: this.name,
138
- });
137
+ const { autocomplete, placeholder, name, type } = this;
138
+
139
+ this.#input({ autocomplete, placeholder, name, type });
139
140
  }
140
141
 
141
142
  connectedCallback() {
@@ -143,20 +144,10 @@ export class USATextInputElement
143
144
  }
144
145
 
145
146
  @effect()
146
- onChange(changes: Changes<this>) {
147
- const input = this.#input();
147
+ onChange() {
148
+ const { value, selectionStart, selectionEnd } = this;
148
149
 
149
- if (input.value !== this.value) {
150
- input.value = this.value;
151
- }
152
-
153
- if (changes.has("selectionStart")) {
154
- input.selectionStart = this.selectionStart;
155
- }
156
-
157
- if (changes.has("selectionEnd")) {
158
- input.selectionEnd = this.selectionEnd;
159
- }
150
+ this.#input({ value, selectionStart, selectionEnd });
160
151
 
161
152
  this.#syncFormState();
162
153
  }
@@ -16,7 +16,7 @@ const meta = {
16
16
 
17
17
  console.log(Array.from(data.entries()));
18
18
  }}>
19
- <usa-input name="fname" value="Danny" autocomplete="off" detail="pfx">
19
+ <usa-input name="fname" autocomplete="off" detail="pfx">
20
20
  <usa-icon icon="credit_card" slot="detail"></usa-icon>
21
21
 
22
22
  First name
@@ -1,10 +1,6 @@
1
- export enum PatternChar {
2
- Any = "*",
3
- Number = "9",
4
- Letter = "A",
5
- }
1
+ export const PATTERN_CHARS = ["*", "9", "A"] as const;
6
2
 
7
- export const PATTERN_CHARS = Object.values(PatternChar);
3
+ export type PatternChar = (typeof PATTERN_CHARS)[number];
8
4
 
9
5
  export const REG_EXPS = {
10
6
  Letters: /^[a-z]/i,
@@ -28,24 +24,26 @@ export function format(value: string, pattern: string): FormattedResult {
28
24
  const char = chars[count];
29
25
 
30
26
  if (char && patternChar) {
31
- if (patternChar === PatternChar.Any) {
32
- // Any letter or number
33
- formatted += char;
34
- count++;
35
- } else if (patternChar === PatternChar.Number) {
36
- // Numbers only
37
- if (/^[0-9]/i.test(char)) {
38
- formatted += char;
39
- }
40
-
41
- count++;
42
- } else if (patternChar === PatternChar.Letter) {
43
- // Letters only
44
- if (/^[a-z]/i.test(char)) {
27
+ if (isPatternChar(patternChar)) {
28
+ if (patternChar === "*") {
29
+ // Any letter or number
45
30
  formatted += char;
31
+ count++;
32
+ } else if (patternChar === "9") {
33
+ // Numbers only
34
+ if (/^[0-9]/i.test(char)) {
35
+ formatted += char;
36
+ }
37
+
38
+ count++;
39
+ } else if (patternChar === "A") {
40
+ // Letters only
41
+ if (/^[a-z]/i.test(char)) {
42
+ formatted += char;
43
+ }
44
+
45
+ count++;
46
46
  }
47
-
48
- count++;
49
47
  } else {
50
48
  formatted += patternChar;
51
49
  }
@@ -54,3 +52,7 @@ export function format(value: string, pattern: string): FormattedResult {
54
52
 
55
53
  return { raw, formatted };
56
54
  }
55
+
56
+ export function isPatternChar(char: unknown): char is PatternChar {
57
+ return PATTERN_CHARS.some((c) => char === c);
58
+ }
@@ -1,6 +1,6 @@
1
- import { attr, css, element, html, listen } from "@joist/element";
1
+ import { attr, css, element, html, listen, queryAll } from "@joist/element";
2
2
 
3
- import { PATTERN_CHARS, PatternChar, REG_EXPS, format } from "./format.js";
3
+ import { PATTERN_CHARS, type PatternChar, REG_EXPS, format } from "./format.js";
4
4
  import type { MaskableElement } from "./maskable.element.js";
5
5
 
6
6
  declare global {
@@ -24,8 +24,10 @@ export class USAInputMaskElement extends HTMLElement {
24
24
  @attr()
25
25
  accessor mask = "";
26
26
 
27
+ #maskables = queryAll<MaskableElement>("[mask]", this);
28
+
27
29
  connectedCallback() {
28
- for (const input of this.querySelectorAll<MaskableElement>("[mask]")) {
30
+ for (const input of this.#maskables()) {
29
31
  const { formatted } = format(input.value, this.#getMaskFor(input));
30
32
 
31
33
  if (formatted) {
@@ -62,7 +64,7 @@ export class USAInputMaskElement extends HTMLElement {
62
64
  onKeyDown(e: KeyboardEvent) {
63
65
  const input = e.target as MaskableElement;
64
66
  const mask = this.#getMaskFor(input);
65
- const patternChar = mask[input.selectionStart || 0];
67
+ const patternChar = mask[input.selectionStart || 0] as PatternChar;
66
68
 
67
69
  if (e.key.length === 1 && /^[a-z0-9]/i.test(e.key)) {
68
70
  // check that the key is a single character and that it is a letter or number
@@ -70,12 +72,12 @@ export class USAInputMaskElement extends HTMLElement {
70
72
  if (input.value.length >= mask.length) {
71
73
  // prevent default once value is the same as the mask length
72
74
  e.preventDefault();
73
- } else if (patternChar === PatternChar.Number) {
75
+ } else if (patternChar === "9") {
74
76
  if (!REG_EXPS.Numbers.test(e.key)) {
75
77
  // if pattern char specifies number and is not
76
78
  e.preventDefault();
77
79
  }
78
- } else if (patternChar === PatternChar.Letter) {
80
+ } else if (patternChar === "A") {
79
81
  if (!REG_EXPS.Letters.test(e.key)) {
80
82
  // if pattern char specifies letter and is not
81
83
  e.preventDefault();
@@ -43,32 +43,31 @@ export class USARadioOptionElement extends HTMLElement {
43
43
  #radio = inject(RADIO_CTX);
44
44
 
45
45
  #observer = new MutationObserver(() => {
46
- const input = this.#input();
47
46
  const radio = this.#radio();
48
47
 
49
- input.name = radio.name;
50
- input.checked = radio.value === this.value;
48
+ this.#input({
49
+ name: radio.name,
50
+ checked: radio.value === this.value,
51
+ });
51
52
  });
52
53
 
53
54
  attributeChangedCallback() {
54
- const input = this.#input();
55
- const slot = this.#slot();
55
+ this.#input({ value: this.value });
56
+ this.#slot({ name: this.value });
56
57
 
57
58
  this.slot = this.value;
58
-
59
- slot.name = this.value;
60
- input.value = this.value;
61
59
  }
62
60
 
63
61
  @injected()
64
62
  onInjected() {
65
- const input = this.#input();
66
63
  const radio = this.#radio();
67
64
 
68
65
  radio.addRadioOption(this.#label());
69
66
 
70
- input.name = radio.name;
71
- input.checked = radio.value === this.value;
67
+ this.#input({
68
+ name: radio.name,
69
+ checked: radio.value === this.value,
70
+ });
72
71
 
73
72
  this.#observer.observe(radio, {
74
73
  attributeFilter: ["value", "name"],
@@ -18,6 +18,10 @@ declare global {
18
18
  shadowDom: [
19
19
  css`
20
20
  :host {
21
+ --usa-radio-active-color: #005ea2;
22
+ --usa-radio-tiled-bg: rgba(0, 94, 162, 0.1);
23
+ --usa-radio-focus-color: #2491ff;
24
+
21
25
  display: flex;
22
26
  flex-direction: column;
23
27
  gap: 1rem;
@@ -51,14 +55,14 @@ declare global {
51
55
  }
52
56
 
53
57
  label:has(input:checked)::before {
54
- background-color: #005ea2;
58
+ background-color: var(--usa-radio-active-color);
55
59
  box-shadow:
56
- 0 0 0 2px #005ea2,
60
+ 0 0 0 2px var(--usa-radio-active-color),
57
61
  inset 0 0 0 2px #fff;
58
62
  }
59
63
 
60
64
  label:has(input:focus)::before {
61
- outline: 0.25rem solid #2491ff;
65
+ outline: 0.25rem solid var(--usa-radio-focus-color);
62
66
  outline-offset: 0.25rem;
63
67
  }
64
68
 
@@ -75,8 +79,8 @@ declare global {
75
79
  }
76
80
 
77
81
  :host([tiled]) label:has(input:checked) {
78
- background-color: rgba(0, 94, 162, 0.1);
79
- border-color: #005ea2;
82
+ background-color: var(--usa-radio-tiled-bg);
83
+ border-color: var(--usa-radio-active-color);
80
84
  }
81
85
 
82
86
  slot {
@@ -1,6 +1,6 @@
1
+ import { inject, injectable, injected } from "@joist/di";
1
2
  import { attr, css, element, html, listen } from "@joist/element";
2
3
 
3
- import { inject, injectable, injected } from "@joist/di";
4
4
  import { SELECT_CONTEXT } from "../context.js";
5
5
 
6
6
  declare global {
@@ -20,7 +20,9 @@ declare global {
20
20
  html`<slot></slot>`,
21
21
  ],
22
22
  })
23
- @injectable()
23
+ @injectable({
24
+ name: "usa-select-option-ctx",
25
+ })
24
26
  export class USASelecOptionElement extends HTMLElement {
25
27
  @attr()
26
28
  accessor value = "";
@@ -18,12 +18,14 @@ declare global {
18
18
  :host {
19
19
  font-size: 1.06rem;
20
20
  line-height: 1.3;
21
- display: block;
21
+ display: flex;
22
+ flex-direction: column;
22
23
  font-weight: 400;
23
- max-width: 30rem;
24
24
  margin-bottom: 1.5rem;
25
+ max-width: 30rem;
25
26
  position: relative;
26
- height: calc(6lh + .5rem);
27
+ height: 9lh;
28
+ gap: 0.5rem;
27
29
  }
28
30
 
29
31
  textarea {
@@ -32,7 +34,6 @@ declare global {
32
34
  border-radius: 0;
33
35
  color: #1b1b1b;
34
36
  display: block;
35
- margin-top: .5rem;
36
37
  max-width: 30rem;
37
38
  padding: .5rem;
38
39
  border-width: 1px;
@@ -42,8 +43,8 @@ declare global {
42
43
  -moz-appearance: none;
43
44
  appearance: none;
44
45
  width: 100%;
45
- height: 100%;
46
46
  resize: none;
47
+ flex-grow: 1;
47
48
  }
48
49
 
49
50
  textarea:not(:disabled):focus {
@@ -52,11 +53,11 @@ declare global {
52
53
  }
53
54
  `,
54
55
  html`
55
- <label>
56
+ <label for="textarea">
56
57
  <slot></slot>
57
-
58
- <textarea></textarea>
59
58
  </label>
59
+
60
+ <textarea id="textarea"></textarea>
60
61
  `,
61
62
  ],
62
63
  })
@@ -96,9 +97,7 @@ export class USATextareaElement extends HTMLElement {
96
97
 
97
98
  @effect()
98
99
  onChange() {
99
- this.#input({
100
- value: this.value,
101
- });
100
+ this.#input({ value: this.value });
102
101
 
103
102
  this.#syncFormState();
104
103
  }
@@ -109,11 +108,9 @@ export class USATextareaElement extends HTMLElement {
109
108
  }
110
109
 
111
110
  attributeChangedCallback() {
112
- this.#input({
113
- name: this.name,
114
- placeholder: this.placeholder,
115
- autocomplete: this.autocomplete,
116
- });
111
+ const { name, placeholder, autocomplete } = this;
112
+
113
+ this.#input({ name, placeholder, autocomplete });
117
114
  }
118
115
 
119
116
  #syncFormState() {
@@ -1,3 +1,4 @@
1
+ import { USAAccordionToggleEvent } from "./events.js";
1
2
  declare global {
2
3
  interface HTMLElementTagNameMap {
3
4
  "usa-accordion": USAAccordionElement;
@@ -11,9 +12,3 @@ export declare class USAAccordionElement extends HTMLElement {
11
12
  onClick(e: Event): void;
12
13
  onAccordionToggle(e: USAAccordionToggleEvent): void;
13
14
  }
14
- declare class USAAccordionToggleEvent extends Event {
15
- open: boolean;
16
- get target(): USAAccordionElement;
17
- constructor(open: boolean);
18
- }
19
- export {};
@@ -1,5 +1,6 @@
1
1
  import { __esDecorate, __runInitializers } from "tslib";
2
2
  import { attr, css, element, html, listen, query } from "@joist/element";
3
+ import { USAAccordionToggleEvent } from "./events.js";
3
4
  let USAAccordionElement = (() => {
4
5
  let _classDecorators = [element({
5
6
  tagName: "usa-accordion",
@@ -134,8 +135,7 @@ let USAAccordionElement = (() => {
134
135
  set open(value) { this.#open_accessor_storage = value; }
135
136
  #details = (__runInitializers(this, _open_extraInitializers), query("details"));
136
137
  attributeChangedCallback() {
137
- const details = this.#details();
138
- details.open = this.open;
138
+ this.#details({ open: this.open });
139
139
  }
140
140
  onClick(e) {
141
141
  e.preventDefault();
@@ -153,14 +153,4 @@ let USAAccordionElement = (() => {
153
153
  return USAAccordionElement = _classThis;
154
154
  })();
155
155
  export { USAAccordionElement };
156
- class USAAccordionToggleEvent extends Event {
157
- open;
158
- get target() {
159
- return super.target;
160
- }
161
- constructor(open) {
162
- super("usa::accordion::toggle", { bubbles: true });
163
- this.open = open;
164
- }
165
- }
166
156
  //# sourceMappingURL=accordion.element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.element.js","sourceRoot":"","sources":["../../../src/lib/accordion/accordion.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;IAuG5D,mBAAmB;4BA/F/B,OAAO,CAAC;YACP,OAAO,EAAE,eAAe;YACxB,aAAa,EAAE;gBACb,IAAI,EAAE,MAAM;gBACZ,cAAc,EAAE,IAAI;aACrB;YACD,SAAS,EAAE;gBACT,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuEF;gBACD,IAAI,CAAA;;;;;;;;;;;;;KAaH;aACF;SACF,CAAC;;;;sBACuC,WAAW;;;;;;;;;;mCAAnB,SAAQ,WAAW;;;;gCACjD,IAAI,EAAE;gCAGN,IAAI,EAAE;mCAUN,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;6CAO1B,MAAM,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;YAnBtD,iKAAS,IAAI,6BAAJ,IAAI,mFAAM;YAGnB,iKAAS,IAAI,6BAAJ,IAAI,mFAAS;YAUtB,wKAAA,OAAO,6DAIN;YAGD,sMAAA,iBAAiB,6DAMhB;YA5BH,6KA6BC;;;YA7BY,uDAAmB;;QAE9B,0BAFW,mDAAmB,8CAEd,EAAE,GAAC;QAAnB,IAAS,IAAI,0CAAM;QAAnB,IAAS,IAAI,gDAAM;QAGnB,wHAAgB,KAAK,GAAC;QAAtB,IAAS,IAAI,0CAAS;QAAtB,IAAS,IAAI,gDAAS;QAEtB,QAAQ,sDAAG,KAAK,CAAC,SAAS,CAAC,EAAC;QAE5B,wBAAwB;YACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,OAA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C,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC;YAC1C,CAAC;iBAAM,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;gBAC7B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;YACrB,CAAC;QACH,CAAC;;;;SA3BU,mBAAmB"}
@@ -0,0 +1,6 @@
1
+ import type { USAAccordionElement } from "./accordion.element.js";
2
+ export declare class USAAccordionToggleEvent extends Event {
3
+ open: boolean;
4
+ get target(): USAAccordionElement;
5
+ constructor(open: boolean);
6
+ }