@noctuatech/uswds 1.3.2 → 1.3.4

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 (299) hide show
  1. package/package.json +5 -5
  2. package/src/lib/accordion/{accordion.test.ts → accordion.element.test.ts} +28 -31
  3. package/src/lib/accordion/accordion.element.ts +9 -7
  4. package/src/lib/alert/{alert.test.ts → alert.element.test.ts} +5 -6
  5. package/src/lib/alert/alert.element.ts +6 -4
  6. package/src/lib/breadcrumbs/breadcrumb/breadcrumb.element.ts +10 -10
  7. package/src/lib/breadcrumbs/breadcrumbs.element.test.ts +23 -0
  8. package/src/lib/button/button.element.test.ts +15 -0
  9. package/src/lib/button/button.element.ts +37 -42
  10. package/src/lib/button-group/button-group.element.test.ts +13 -0
  11. package/src/lib/card/{card.test.ts → card.element.test.ts} +12 -12
  12. package/src/lib/checkbox/{checkbox.test.ts → checkbox.element.test.ts} +15 -17
  13. package/src/lib/checkbox/checkbox.element.ts +28 -32
  14. package/src/lib/checkbox/checkbox.stories.ts +17 -33
  15. package/src/lib/collection/collection-item/collection-item.element.test.ts +15 -0
  16. package/src/lib/collection/collection.element.test.ts +13 -0
  17. package/src/lib/combo-box/{combo-box.test.ts → combo-box.element.test.ts} +64 -93
  18. package/src/lib/config/config.element.test.ts +13 -0
  19. package/src/lib/description/description.element.test.ts +13 -0
  20. package/src/lib/file-input/file-input-preview/file-input-preview.element.test.ts +93 -0
  21. package/src/lib/file-input/file-input-preview/file-input-preview.element.ts +15 -13
  22. package/src/lib/file-input/file-input.element.test.ts +73 -0
  23. package/src/lib/file-input/file-input.element.ts +10 -20
  24. package/src/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.ts +20 -20
  25. package/src/lib/in-page-nav/{in-page-nav.test.ts → in-page-nav.element.test.ts} +18 -21
  26. package/src/lib/input/{input.test.ts → input.element.test.ts} +11 -0
  27. package/src/lib/input/input.element.ts +57 -41
  28. package/src/lib/input-mask/input-mask.element.ts +1 -1
  29. package/src/lib/input-mask/input-mask.stories.ts +2 -0
  30. package/src/lib/link/link.element.ts +18 -25
  31. package/src/lib/modal/modal-close/modal-close.element.test.ts +13 -0
  32. package/src/lib/modal/modal-heading/modal-heading.element.test.ts +15 -0
  33. package/src/lib/modal/modal.element.test.ts +23 -0
  34. package/src/lib/pagination/pagination-item/pagination-item.element.ts +9 -6
  35. package/src/lib/pagination/pagination-no/pagination-no.element.ts +17 -17
  36. package/src/lib/pagination/pagination.element.test.ts +13 -0
  37. package/src/lib/process-list/{process-list.test.ts → process-list.element.test.ts} +19 -12
  38. package/src/lib/radio/radio-option/radio-option.element.test.ts +20 -0
  39. package/src/lib/radio/radio.element.test.ts +121 -0
  40. package/src/lib/range-slider/range-slider.element.test.ts +57 -0
  41. package/src/lib/range-slider/range-slider.element.ts +48 -33
  42. package/src/lib/search/search.element.test.ts +71 -0
  43. package/src/lib/select/{select.test.ts → select.element.test.ts} +23 -26
  44. package/src/lib/select/select.element.ts +31 -32
  45. package/src/lib/side-nav/{side-nav.test.ts → side-nav.element.test.ts} +13 -23
  46. package/src/lib/step-indicator/step/step.element.ts +16 -16
  47. package/src/lib/step-indicator/{step-indicator.test.ts → step-indicator.element.test.ts} +6 -6
  48. package/src/lib/summary-box/summary-box.element.test.ts +13 -0
  49. package/src/lib/tag/tag.element.test.ts +13 -0
  50. package/src/lib/textarea/{textarea.test.ts → textarea.element.test.ts} +13 -13
  51. package/src/lib/textarea/textarea.element.ts +23 -24
  52. package/target/lib/accordion/accordion.element.js +4 -2
  53. package/target/lib/accordion/accordion.element.js.map +1 -1
  54. package/target/lib/accordion/accordion.element.test.d.ts +1 -0
  55. package/target/lib/accordion/{accordion.test.js → accordion.element.test.js} +19 -19
  56. package/target/lib/accordion/accordion.element.test.js.map +1 -0
  57. package/target/lib/alert/alert.element.js +4 -2
  58. package/target/lib/alert/alert.element.js.map +1 -1
  59. package/target/lib/alert/alert.element.test.d.ts +1 -0
  60. package/target/lib/alert/{alert.test.js → alert.element.test.js} +5 -5
  61. package/target/lib/alert/alert.element.test.js.map +1 -0
  62. package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.d.ts +1 -1
  63. package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js +6 -6
  64. package/target/lib/breadcrumbs/breadcrumbs.element.test.d.ts +2 -0
  65. package/target/lib/breadcrumbs/{breadcrumbs.test.js → breadcrumbs.element.test.js} +6 -6
  66. package/target/lib/breadcrumbs/breadcrumbs.element.test.js.map +1 -0
  67. package/target/lib/button/button.element.d.ts +3 -3
  68. package/target/lib/button/button.element.js +17 -23
  69. package/target/lib/button/button.element.js.map +1 -1
  70. package/target/lib/button/button.element.test.d.ts +1 -0
  71. package/target/lib/button/button.element.test.js +12 -0
  72. package/target/lib/button/button.element.test.js.map +1 -0
  73. package/target/lib/button-group/button-group.element.test.d.ts +1 -0
  74. package/target/lib/button-group/button-group.element.test.js +9 -0
  75. package/target/lib/button-group/button-group.element.test.js.map +1 -0
  76. package/target/lib/card/card.element.test.d.ts +6 -0
  77. package/target/lib/card/{card.test.js → card.element.test.js} +10 -10
  78. package/target/lib/card/card.element.test.js.map +1 -0
  79. package/target/lib/checkbox/checkbox.element.d.ts +3 -2
  80. package/target/lib/checkbox/checkbox.element.js +21 -22
  81. package/target/lib/checkbox/checkbox.element.js.map +1 -1
  82. package/target/lib/checkbox/checkbox.element.test.d.ts +1 -0
  83. package/target/lib/checkbox/{checkbox.test.js → checkbox.element.test.js} +13 -12
  84. package/target/lib/checkbox/checkbox.element.test.js.map +1 -0
  85. package/target/lib/checkbox/checkbox.stories.d.ts +2 -2
  86. package/target/lib/checkbox/checkbox.stories.js +6 -6
  87. package/target/lib/checkbox/checkbox.stories.js.map +1 -1
  88. package/target/lib/collection/collection-item/collection-item.element.test.d.ts +1 -0
  89. package/target/lib/collection/collection-item/collection-item.element.test.js +9 -0
  90. package/target/lib/collection/collection-item/collection-item.element.test.js.map +1 -0
  91. package/target/lib/collection/collection.element.test.d.ts +1 -0
  92. package/target/lib/collection/collection.element.test.js +9 -0
  93. package/target/lib/collection/collection.element.test.js.map +1 -0
  94. package/target/lib/combo-box/combo-box.element.test.d.ts +3 -0
  95. package/target/lib/combo-box/{combo-box.test.js → combo-box.element.test.js} +60 -60
  96. package/target/lib/combo-box/combo-box.element.test.js.map +1 -0
  97. package/target/lib/config/config.element.test.d.ts +1 -0
  98. package/target/lib/config/config.element.test.js +9 -0
  99. package/target/lib/config/config.element.test.js.map +1 -0
  100. package/target/lib/description/description.element.test.d.ts +1 -0
  101. package/target/lib/description/description.element.test.js +9 -0
  102. package/target/lib/description/description.element.test.js.map +1 -0
  103. package/target/lib/file-input/file-input-preview/file-input-preview.element.js +12 -10
  104. package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -1
  105. package/target/lib/file-input/file-input-preview/file-input-preview.element.test.d.ts +2 -0
  106. package/target/lib/file-input/file-input-preview/{file-input-preview.test.js → file-input-preview.element.test.js} +24 -24
  107. package/target/lib/file-input/file-input-preview/file-input-preview.element.test.js.map +1 -0
  108. package/target/lib/file-input/file-input.element.js +5 -6
  109. package/target/lib/file-input/file-input.element.js.map +1 -1
  110. package/target/lib/file-input/file-input.element.test.d.ts +1 -0
  111. package/target/lib/file-input/{file-input.test.js → file-input.element.test.js} +16 -16
  112. package/target/lib/file-input/file-input.element.test.js.map +1 -0
  113. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.d.ts +2 -3
  114. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js +15 -13
  115. package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js.map +1 -1
  116. package/target/lib/in-page-nav/in-page-nav.element.test.d.ts +2 -0
  117. package/target/lib/in-page-nav/{in-page-nav.test.js → in-page-nav.element.test.js} +6 -6
  118. package/target/lib/in-page-nav/in-page-nav.element.test.js.map +1 -0
  119. package/target/lib/input/input.element.d.ts +4 -5
  120. package/target/lib/input/input.element.js +54 -48
  121. package/target/lib/input/input.element.js.map +1 -1
  122. package/target/lib/input/{input.test.js → input.element.test.js} +6 -1
  123. package/target/lib/input/input.element.test.js.map +1 -0
  124. package/target/lib/input-mask/input-mask.element.d.ts +1 -1
  125. package/target/lib/input-mask/input-mask.element.js +1 -1
  126. package/target/lib/input-mask/input-mask.element.js.map +1 -1
  127. package/target/lib/input-mask/{input-mask.test.js → input-mask.element.test.js} +1 -1
  128. package/target/lib/input-mask/input-mask.element.test.js.map +1 -0
  129. package/target/lib/input-mask/input-mask.stories.js +1 -1
  130. package/target/lib/input-mask/input-mask.stories.js.map +1 -1
  131. package/target/lib/link/link.element.d.ts +3 -5
  132. package/target/lib/link/link.element.js +14 -26
  133. package/target/lib/link/link.element.js.map +1 -1
  134. package/target/lib/modal/modal-close/modal-close.element.test.d.ts +1 -0
  135. package/target/lib/modal/modal-close/modal-close.element.test.js +9 -0
  136. package/target/lib/modal/modal-close/modal-close.element.test.js.map +1 -0
  137. package/target/lib/modal/modal-heading/modal-heading.element.test.d.ts +1 -0
  138. package/target/lib/modal/modal-heading/modal-heading.element.test.js +9 -0
  139. package/target/lib/modal/modal-heading/modal-heading.element.test.js.map +1 -0
  140. package/target/lib/modal/modal.element.test.d.ts +3 -0
  141. package/target/lib/modal/modal.element.test.js +11 -0
  142. package/target/lib/modal/modal.element.test.js.map +1 -0
  143. package/target/lib/pagination/pagination-item/pagination-item.element.d.ts +1 -1
  144. package/target/lib/pagination/pagination-item/pagination-item.element.js +3 -3
  145. package/target/lib/pagination/pagination-item/pagination-item.element.js.map +1 -1
  146. package/target/lib/pagination/pagination-no/pagination-no.element.d.ts +2 -3
  147. package/target/lib/pagination/pagination-no/pagination-no.element.js +10 -8
  148. package/target/lib/pagination/pagination-no/pagination-no.element.js.map +1 -1
  149. package/target/lib/pagination/pagination.element.test.d.ts +1 -0
  150. package/target/lib/pagination/pagination.element.test.js +9 -0
  151. package/target/lib/pagination/pagination.element.test.js.map +1 -0
  152. package/target/lib/process-list/process-list.element.test.d.ts +2 -0
  153. package/target/lib/process-list/{process-list.test.js → process-list.element.test.js} +6 -6
  154. package/target/lib/process-list/process-list.element.test.js.map +1 -0
  155. package/target/lib/radio/radio-option/radio-option.element.test.d.ts +2 -0
  156. package/target/lib/radio/radio-option/radio-option.element.test.js +11 -0
  157. package/target/lib/radio/radio-option/radio-option.element.test.js.map +1 -0
  158. package/target/lib/radio/radio.element.test.d.ts +2 -0
  159. package/target/lib/radio/{radio.test.js → radio.element.test.js} +19 -28
  160. package/target/lib/radio/radio.element.test.js.map +1 -0
  161. package/target/lib/range-slider/range-slider.element.d.ts +4 -2
  162. package/target/lib/range-slider/range-slider.element.js +34 -29
  163. package/target/lib/range-slider/range-slider.element.js.map +1 -1
  164. package/target/lib/range-slider/range-slider.element.test.d.ts +1 -0
  165. package/target/lib/range-slider/range-slider.element.test.js +26 -0
  166. package/target/lib/range-slider/range-slider.element.test.js.map +1 -0
  167. package/target/lib/search/search.element.test.d.ts +3 -0
  168. package/target/lib/search/search.element.test.js +52 -0
  169. package/target/lib/search/search.element.test.js.map +1 -0
  170. package/target/lib/select/select.element.d.ts +4 -3
  171. package/target/lib/select/select.element.js +25 -26
  172. package/target/lib/select/select.element.js.map +1 -1
  173. package/target/lib/select/select.element.test.d.ts +2 -0
  174. package/target/lib/select/{select.test.js → select.element.test.js} +23 -27
  175. package/target/lib/select/select.element.test.js.map +1 -0
  176. package/target/lib/services/{icon.service.test.js → icon.service.element.test.js} +1 -1
  177. package/target/lib/services/icon.service.element.test.js.map +1 -0
  178. package/target/lib/side-nav/side-nav.element.test.d.ts +3 -0
  179. package/target/lib/side-nav/{side-nav.test.js → side-nav.element.test.js} +11 -11
  180. package/target/lib/side-nav/side-nav.element.test.js.map +1 -0
  181. package/target/lib/step-indicator/step/step.element.d.ts +2 -2
  182. package/target/lib/step-indicator/step/step.element.js +8 -8
  183. package/target/lib/step-indicator/step-indicator.element.test.d.ts +2 -0
  184. package/target/lib/step-indicator/{step-indicator.test.js → step-indicator.element.test.js} +6 -6
  185. package/target/lib/step-indicator/step-indicator.element.test.js.map +1 -0
  186. package/target/lib/summary-box/summary-box.element.test.d.ts +1 -0
  187. package/target/lib/summary-box/summary-box.element.test.js +9 -0
  188. package/target/lib/summary-box/summary-box.element.test.js.map +1 -0
  189. package/target/lib/tag/tag.element.test.d.ts +1 -0
  190. package/target/lib/tag/tag.element.test.js +9 -0
  191. package/target/lib/tag/tag.element.test.js.map +1 -0
  192. package/target/lib/textarea/textarea.element.d.ts +2 -2
  193. package/target/lib/textarea/textarea.element.js +19 -24
  194. package/target/lib/textarea/textarea.element.js.map +1 -1
  195. package/target/lib/textarea/textarea.element.test.d.ts +1 -0
  196. package/target/lib/textarea/{textarea.test.js → textarea.element.test.js} +14 -14
  197. package/target/lib/textarea/textarea.element.test.js.map +1 -0
  198. package/src/lib/breadcrumbs/breadcrumbs.test.ts +0 -21
  199. package/src/lib/button/button.test.ts +0 -17
  200. package/src/lib/button-group/button-group.test.ts +0 -15
  201. package/src/lib/collection/collection-item/collection-item.test.ts +0 -15
  202. package/src/lib/collection/collection.test.ts +0 -15
  203. package/src/lib/config/config.test.ts +0 -15
  204. package/src/lib/description/description.test.ts +0 -15
  205. package/src/lib/file-input/file-input-preview/file-input-preview.test.ts +0 -95
  206. package/src/lib/file-input/file-input.test.ts +0 -79
  207. package/src/lib/modal/modal-close/modal-close.test.ts +0 -15
  208. package/src/lib/modal/modal-heading/modal-heading.test.ts +0 -15
  209. package/src/lib/modal/modal.test.ts +0 -25
  210. package/src/lib/pagination/pagination.test.ts +0 -15
  211. package/src/lib/radio/radio-option/radio-option.test.ts +0 -20
  212. package/src/lib/radio/radio.test.ts +0 -174
  213. package/src/lib/range-slider/range-slider.test.ts +0 -52
  214. package/src/lib/search/search.test.ts +0 -81
  215. package/src/lib/summary-box/summary-box.test.ts +0 -15
  216. package/src/lib/tag/tag.test.ts +0 -15
  217. package/target/lib/accordion/accordion.test.d.ts +0 -1
  218. package/target/lib/accordion/accordion.test.js.map +0 -1
  219. package/target/lib/alert/alert.test.d.ts +0 -1
  220. package/target/lib/alert/alert.test.js.map +0 -1
  221. package/target/lib/breadcrumbs/breadcrumbs.test.d.ts +0 -2
  222. package/target/lib/breadcrumbs/breadcrumbs.test.js.map +0 -1
  223. package/target/lib/button/button.test.d.ts +0 -1
  224. package/target/lib/button/button.test.js +0 -12
  225. package/target/lib/button/button.test.js.map +0 -1
  226. package/target/lib/button-group/button-group.test.d.ts +0 -1
  227. package/target/lib/button-group/button-group.test.js +0 -9
  228. package/target/lib/button-group/button-group.test.js.map +0 -1
  229. package/target/lib/card/card.test.d.ts +0 -6
  230. package/target/lib/card/card.test.js.map +0 -1
  231. package/target/lib/checkbox/checkbox.test.d.ts +0 -1
  232. package/target/lib/checkbox/checkbox.test.js.map +0 -1
  233. package/target/lib/collection/collection-item/collection-item.test.d.ts +0 -1
  234. package/target/lib/collection/collection-item/collection-item.test.js +0 -9
  235. package/target/lib/collection/collection-item/collection-item.test.js.map +0 -1
  236. package/target/lib/collection/collection.test.d.ts +0 -1
  237. package/target/lib/collection/collection.test.js +0 -9
  238. package/target/lib/collection/collection.test.js.map +0 -1
  239. package/target/lib/combo-box/combo-box.test.d.ts +0 -3
  240. package/target/lib/combo-box/combo-box.test.js.map +0 -1
  241. package/target/lib/config/config.test.d.ts +0 -1
  242. package/target/lib/config/config.test.js +0 -9
  243. package/target/lib/config/config.test.js.map +0 -1
  244. package/target/lib/description/description.test.d.ts +0 -1
  245. package/target/lib/description/description.test.js +0 -9
  246. package/target/lib/description/description.test.js.map +0 -1
  247. package/target/lib/file-input/file-input-preview/file-input-preview.test.d.ts +0 -2
  248. package/target/lib/file-input/file-input-preview/file-input-preview.test.js.map +0 -1
  249. package/target/lib/file-input/file-input.test.d.ts +0 -1
  250. package/target/lib/file-input/file-input.test.js.map +0 -1
  251. package/target/lib/in-page-nav/in-page-nav.test.d.ts +0 -2
  252. package/target/lib/in-page-nav/in-page-nav.test.js.map +0 -1
  253. package/target/lib/input/input.test.js.map +0 -1
  254. package/target/lib/input-mask/input-mask.test.js.map +0 -1
  255. package/target/lib/modal/modal-close/modal-close.test.d.ts +0 -1
  256. package/target/lib/modal/modal-close/modal-close.test.js +0 -9
  257. package/target/lib/modal/modal-close/modal-close.test.js.map +0 -1
  258. package/target/lib/modal/modal-heading/modal-heading.test.d.ts +0 -1
  259. package/target/lib/modal/modal-heading/modal-heading.test.js +0 -9
  260. package/target/lib/modal/modal-heading/modal-heading.test.js.map +0 -1
  261. package/target/lib/modal/modal.test.d.ts +0 -3
  262. package/target/lib/modal/modal.test.js +0 -11
  263. package/target/lib/modal/modal.test.js.map +0 -1
  264. package/target/lib/pagination/pagination.test.d.ts +0 -1
  265. package/target/lib/pagination/pagination.test.js +0 -9
  266. package/target/lib/pagination/pagination.test.js.map +0 -1
  267. package/target/lib/process-list/process-list.test.d.ts +0 -2
  268. package/target/lib/process-list/process-list.test.js.map +0 -1
  269. package/target/lib/radio/radio-option/radio-option.test.d.ts +0 -2
  270. package/target/lib/radio/radio-option/radio-option.test.js +0 -11
  271. package/target/lib/radio/radio-option/radio-option.test.js.map +0 -1
  272. package/target/lib/radio/radio.test.d.ts +0 -2
  273. package/target/lib/radio/radio.test.js.map +0 -1
  274. package/target/lib/range-slider/range-slider.test.d.ts +0 -1
  275. package/target/lib/range-slider/range-slider.test.js +0 -25
  276. package/target/lib/range-slider/range-slider.test.js.map +0 -1
  277. package/target/lib/search/search.test.d.ts +0 -3
  278. package/target/lib/search/search.test.js +0 -52
  279. package/target/lib/search/search.test.js.map +0 -1
  280. package/target/lib/select/select.test.d.ts +0 -2
  281. package/target/lib/select/select.test.js.map +0 -1
  282. package/target/lib/services/icon.service.test.js.map +0 -1
  283. package/target/lib/side-nav/side-nav.test.d.ts +0 -3
  284. package/target/lib/side-nav/side-nav.test.js.map +0 -1
  285. package/target/lib/step-indicator/step-indicator.test.d.ts +0 -2
  286. package/target/lib/step-indicator/step-indicator.test.js.map +0 -1
  287. package/target/lib/summary-box/summary-box.test.d.ts +0 -1
  288. package/target/lib/summary-box/summary-box.test.js +0 -9
  289. package/target/lib/summary-box/summary-box.test.js.map +0 -1
  290. package/target/lib/tag/tag.test.d.ts +0 -1
  291. package/target/lib/tag/tag.test.js +0 -9
  292. package/target/lib/tag/tag.test.js.map +0 -1
  293. package/target/lib/textarea/textarea.test.d.ts +0 -1
  294. package/target/lib/textarea/textarea.test.js.map +0 -1
  295. /package/src/lib/input-mask/{input-mask.test.ts → input-mask.element.test.ts} +0 -0
  296. /package/src/lib/services/{icon.service.test.ts → icon.service.element.test.ts} +0 -0
  297. /package/target/lib/input/{input.test.d.ts → input.element.test.d.ts} +0 -0
  298. /package/target/lib/input-mask/{input-mask.test.d.ts → input-mask.element.test.d.ts} +0 -0
  299. /package/target/lib/services/{icon.service.test.d.ts → icon.service.element.test.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
- import "./checkbox.element.js";
1
+ import './checkbox.element.js';
2
2
 
3
- import { assert, fixture, html } from "@open-wc/testing";
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
4
 
5
- describe("usa-checkbox", () => {
6
- it("should be accessible", async () => {
5
+ describe('usa-checkbox', () => {
6
+ it('should be accessible', async () => {
7
7
  const form = await fixture<HTMLFormElement>(html`
8
8
  <usa-checkbox name="fname" value="Foo">Hello World</usa-checkbox>
9
9
  `);
@@ -11,12 +11,10 @@ describe("usa-checkbox", () => {
11
11
  return assert.isAccessible(form);
12
12
  });
13
13
 
14
- it("should submit form with default values", async () => {
14
+ it('should submit form with default values', async () => {
15
15
  const form = await fixture<HTMLFormElement>(html`
16
16
  <form>
17
- <usa-checkbox name="enabled" value="test" checked>
18
- Hello World
19
- </usa-checkbox>
17
+ <usa-checkbox name="enabled" value="test" checked> Hello World </usa-checkbox>
20
18
 
21
19
  <button>Submit</button>
22
20
  </form>
@@ -24,10 +22,10 @@ describe("usa-checkbox", () => {
24
22
 
25
23
  const value = new FormData(form);
26
24
 
27
- assert.equal(value.get("enabled"), "test");
25
+ assert.equal(value.get('enabled'), 'test');
28
26
  });
29
27
 
30
- it("should update form value as input value changed", async () => {
28
+ it('should update form value as input value changed', async () => {
31
29
  const form = await fixture<HTMLFormElement>(html`
32
30
  <form>
33
31
  <usa-checkbox name="enabled" value="test">Hello World</usa-checkbox>
@@ -36,24 +34,24 @@ describe("usa-checkbox", () => {
36
34
  </form>
37
35
  `);
38
36
 
39
- const checkbox = form.querySelector("usa-checkbox");
40
- const nativeInput = checkbox?.shadowRoot?.querySelector("input");
37
+ const checkbox = form.querySelector('usa-checkbox');
38
+ const nativeInput = checkbox?.shadowRoot?.querySelector('input');
41
39
 
42
40
  if (nativeInput) {
43
41
  nativeInput.click();
44
42
  }
45
43
 
44
+ await Promise.resolve();
45
+
46
46
  const value = new FormData(form);
47
47
 
48
- assert.equal(value.get("enabled"), "test");
48
+ assert.equal(value.get('enabled'), 'test');
49
49
  });
50
50
 
51
- it("should not submit when not valid", async () => {
51
+ it('should not submit when not valid', async () => {
52
52
  const form = await fixture<HTMLFormElement>(html`
53
53
  <form>
54
- <usa-checkbox name="enabled" value="test" required>
55
- Hello World
56
- </usa-checkbox>
54
+ <usa-checkbox name="enabled" value="test" required> Hello World </usa-checkbox>
57
55
 
58
56
  <button>Submit</button>
59
57
  </form>
@@ -1,13 +1,17 @@
1
- import { attr, css, element, html, listen, query } from "@joist/element";
1
+ import '@joist/templating/define.js';
2
+
3
+ import { attr, css, element, html, listen, query } from '@joist/element';
4
+ import { bind } from '@joist/templating';
5
+ import { effect } from '@joist/observable';
2
6
 
3
7
  declare global {
4
8
  interface HTMLElementTagNameMap {
5
- "usa-checkbox": USACheckboxElement;
9
+ 'usa-checkbox': USACheckboxElement;
6
10
  }
7
11
  }
8
12
 
9
13
  @element({
10
- tagName: "usa-checkbox",
14
+ tagName: 'usa-checkbox',
11
15
  shadowDom: [
12
16
  css`
13
17
  * {
@@ -69,9 +73,9 @@ declare global {
69
73
  background-color: #005ea2;
70
74
  box-shadow: 0 0 0 2px #005ea2;
71
75
  }
72
-
76
+
73
77
  input:checked + .checkbox::after {
74
- content: " ";
78
+ content: ' ';
75
79
  display: block;
76
80
  height: 1rem;
77
81
  width: 0.5rem;
@@ -112,14 +116,14 @@ declare global {
112
116
  `,
113
117
  html`
114
118
  <label>
115
- <input type="checkbox" tabindex="0"/>
116
-
117
- <div class="checkbox" part="checkbox"></div>
119
+ <j-bind props="checked,required,disabled" target="input">
120
+ <input type="checkbox" tabindex="0" />
121
+ <div class="checkbox" part="checkbox"></div>
122
+ </j-bind>
118
123
 
119
124
  <div class="title" part="title">
120
- <slot></slot>
121
- </div>
122
- </j-props>
125
+ <slot></slot>
126
+ </div>
123
127
  </label>
124
128
  `,
125
129
  ],
@@ -128,18 +132,23 @@ export class USACheckboxElement extends HTMLElement {
128
132
  static formAssociated = true;
129
133
 
130
134
  @attr()
135
+ @bind()
131
136
  accessor checked = false;
132
137
 
133
138
  @attr()
134
- accessor name = "";
139
+ @bind()
140
+ accessor name = '';
135
141
 
136
142
  @attr()
137
- accessor value = "";
143
+ @bind()
144
+ accessor value = '';
138
145
 
139
146
  @attr()
147
+ @bind()
140
148
  accessor required = false;
141
149
 
142
150
  @attr()
151
+ @bind()
143
152
  accessor disabled = false;
144
153
 
145
154
  @attr({
@@ -147,41 +156,28 @@ export class USACheckboxElement extends HTMLElement {
147
156
  })
148
157
  accessor tiled = false;
149
158
 
150
- #checkbox = query("input");
151
-
159
+ #checkbox = query('input');
152
160
  #internals = this.attachInternals();
153
161
 
154
- attributeChangedCallback() {
155
- this.#checkbox({
156
- checked: this.checked,
157
- name: this.name,
158
- disabled: this.disabled,
159
- required: this.required,
160
- });
161
-
162
+ @effect()
163
+ onChange() {
162
164
  this.#syncFormState();
163
165
  }
164
166
 
165
- @listen("change", "input[type=checkbox]")
167
+ @listen('change', 'input[type=checkbox]')
166
168
  onCheckboxChange() {
167
169
  const checkbox = this.#checkbox();
168
170
  this.checked = checkbox.checked;
169
-
170
- this.#syncFormState();
171
171
  }
172
172
 
173
173
  #syncFormState() {
174
174
  const checkbox = this.#checkbox();
175
175
 
176
176
  this.#internals.setValidity({});
177
- this.#internals.setFormValue(checkbox.checked ? this.value : null);
177
+ this.#internals.setFormValue(this.checked ? this.value : null);
178
178
 
179
179
  if (checkbox.validationMessage) {
180
- this.#internals.setValidity(
181
- { customError: true },
182
- checkbox.validationMessage,
183
- checkbox,
184
- );
180
+ this.#internals.setValidity({ customError: true }, checkbox.validationMessage, checkbox);
185
181
  }
186
182
  }
187
183
  }
@@ -1,12 +1,12 @@
1
- import type { Meta, StoryObj } from "@storybook/web-components";
2
- import { html } from "lit";
1
+ import type { Meta, StoryObj } from '@storybook/web-components';
2
+ import { html } from 'lit';
3
3
 
4
- import type { USACheckboxElement } from "./checkbox.element.js";
4
+ import type { USACheckboxElement } from './checkbox.element.js';
5
5
 
6
6
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
7
  const meta = {
8
- title: "usa-checkbox",
9
- tags: ["autodocs"],
8
+ title: 'usa-checkbox',
9
+ tags: ['autodocs'],
10
10
  argTypes: {},
11
11
  args: {},
12
12
  } satisfies Meta<USACheckboxElement & { description: string }>;
@@ -19,15 +19,15 @@ type Story = StoryObj<USACheckboxElement>;
19
19
  export const Primary: Story = {
20
20
  render(args) {
21
21
  return html`
22
- <usa-checkbox name="${args.name}" value="${args.value}" ?checked=${args.checked} ?disabled=${args.disabled} ?required=${args.required}>
22
+ <usa-checkbox name="${args.name}" value="${args.value}" required>
23
23
  I agree to the above terms and conditions
24
24
  </usa-checkbox>
25
25
  `;
26
26
  },
27
27
  args: {
28
28
  checked: false,
29
- name: "toc",
30
- value: "agree",
29
+ name: 'toc',
30
+ value: 'agree',
31
31
  disabled: false,
32
32
  required: false,
33
33
  },
@@ -39,21 +39,10 @@ export const Group: Story = {
39
39
  <usa-checkbox-group>
40
40
  <legend>Select any historical figure</legend>
41
41
 
42
- <usa-checkbox name="historical-figure" value="sojurner-truth">
43
- Sojourner Truth
44
- </usa-checkbox>
45
-
46
- <usa-checkbox name="historical-figure" value="frederick-douglass">
47
- Frederick Douglass
48
- </usa-checkbox>
49
-
50
- <usa-checkbox name="historical-figure" value="booker-t-washington">
51
- Booker T. Washington
52
- </usa-checkbox>
53
-
54
- <usa-checkbox name="historical-figure" value="gw-carver" disabled>
55
- George Washington Carver
56
- </usa-checkbox>
42
+ <usa-checkbox name="historical-figure" value="sojurner-truth">Sojourner Truth</usa-checkbox>
43
+ <usa-checkbox name="historical-figure" value="frederick-douglass">Frederick Douglass </usa-checkbox>
44
+ <usa-checkbox name="historical-figure" value="booker-t-washington">Booker T. Washington</usa-checkbox>
45
+ <usa-checkbox name="historical-figure" value="gw-carver" disabled>George Washington Carver</usa-checkbox>
57
46
  </usa-checkbox-group>
58
47
  `;
59
48
  },
@@ -67,17 +56,12 @@ export const Tiled: Story = {
67
56
 
68
57
  <usa-checkbox name="historical-figure" value="sojurner-truth" tiled>
69
58
  Sojourner Truth
70
- <usa-description>This is optional text that can be used to describe the label in more detail.</usa-description>
71
- </usa-checkbox>
72
-
73
- <usa-checkbox name="historical-figure" value="frederick-douglass" tiled>
74
- Frederick Douglass
59
+ <usa-description>
60
+ This is optional text that can be used to describe the label in more detail.
61
+ </usa-description>
75
62
  </usa-checkbox>
76
-
77
- <usa-checkbox name="historical-figure" value="booker-t-washington" tiled>
78
- Booker T. Washington
79
- </usa-checkbox>
80
-
63
+ <usa-checkbox name="historical-figure" value="frederick-douglass" tiled> Frederick Douglass </usa-checkbox>
64
+ <usa-checkbox name="historical-figure" value="booker-t-washington" tiled> Booker T. Washington </usa-checkbox>
81
65
  <usa-checkbox name="historical-figure" value="gw-carver" tiled disabled>
82
66
  George Washington Carver
83
67
  </usa-checkbox>
@@ -0,0 +1,15 @@
1
+ import './collection-item.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USACollectionItemElement } from './collection-item.element.js';
6
+
7
+ describe('usa-collection-item', () => {
8
+ it('should be accessible', async () => {
9
+ const collectionItem = await fixture<USACollectionItemElement>(html`
10
+ <usa-collection-item>Hello World</usa-collection-item>
11
+ `);
12
+
13
+ return assert.isAccessible(collectionItem);
14
+ });
15
+ });
@@ -0,0 +1,13 @@
1
+ import './collection.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USACollectionElement } from './collection.element.js';
6
+
7
+ describe('usa-collection', () => {
8
+ it('should be accessible', async () => {
9
+ const collection = await fixture<USACollectionElement>(html` <usa-collection>Hello World</usa-collection> `);
10
+
11
+ return assert.isAccessible(collection);
12
+ });
13
+ });
@@ -1,12 +1,12 @@
1
- import "./combo-box.element.js";
2
- import "./combo-box-option/combo-box-option.element.js";
3
- import "../input/input.element.js";
1
+ import './combo-box.element.js';
2
+ import './combo-box-option/combo-box-option.element.js';
3
+ import '../input/input.element.js';
4
4
 
5
- import { assert, fixture, html } from "@open-wc/testing";
5
+ import { assert, fixture, html } from '@open-wc/testing';
6
6
 
7
- import type { USAComboBoxElement } from "./combo-box.element.js";
7
+ import type { USAComboBoxElement } from './combo-box.element.js';
8
8
 
9
- describe("usa-combo-box", () => {
9
+ describe('usa-combo-box', () => {
10
10
  let autocomplete: USAComboBoxElement;
11
11
  let input: HTMLInputElement;
12
12
 
@@ -25,123 +25,94 @@ describe("usa-combo-box", () => {
25
25
  input = autocomplete.input();
26
26
  });
27
27
 
28
- it("should filter items based on input", async () => {
29
- input.value = "b";
30
- input.dispatchEvent(new Event("input", { bubbles: true }));
28
+ it('should filter items based on input', async () => {
29
+ input.value = 'b';
30
+ input.dispatchEvent(new Event('input', { bubbles: true }));
31
31
 
32
32
  const suggestions = autocomplete.listItems();
33
33
 
34
34
  assert.equal(suggestions.length, 2);
35
- assert.equal(suggestions[0].dataset.value, "Banana");
36
- assert.equal(suggestions[1].dataset.value, "Blueberry");
35
+ assert.equal(suggestions[0].dataset.value, 'Banana');
36
+ assert.equal(suggestions[1].dataset.value, 'Blueberry');
37
37
  });
38
38
 
39
- it("should show all suggestions when input is empty", async () => {
40
- input.value = "";
41
- input.dispatchEvent(new Event("input", { bubbles: true }));
39
+ it('should show all suggestions when input is empty', async () => {
40
+ input.value = '';
41
+ input.dispatchEvent(new Event('input', { bubbles: true }));
42
42
 
43
43
  const suggestions = autocomplete.listItems();
44
44
  assert.equal(suggestions.length, 4);
45
45
  });
46
46
 
47
- it("should handle case-insensitive search", async () => {
48
- input.value = "B";
49
- input.dispatchEvent(new Event("input", { bubbles: true }));
47
+ it('should handle case-insensitive search', async () => {
48
+ input.value = 'B';
49
+ input.dispatchEvent(new Event('input', { bubbles: true }));
50
50
 
51
51
  const suggestions = autocomplete.listItems();
52
52
  assert.equal(suggestions.length, 2);
53
- assert.equal(suggestions[0].dataset.value, "Banana");
54
- assert.equal(suggestions[1].dataset.value, "Blueberry");
53
+ assert.equal(suggestions[0].dataset.value, 'Banana');
54
+ assert.equal(suggestions[1].dataset.value, 'Blueberry');
55
55
  });
56
56
 
57
- it("should navigate suggestions with arrow keys", async () => {
57
+ it('should navigate suggestions with arrow keys', async () => {
58
58
  // select item from list
59
- input.value = "b";
60
- input.dispatchEvent(new Event("input", { bubbles: true }));
59
+ input.value = 'b';
60
+ input.dispatchEvent(new Event('input', { bubbles: true }));
61
61
 
62
62
  // Arrow down
63
- input.dispatchEvent(
64
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
65
- );
66
- assert.equal(
67
- autocomplete.currentItemEl?.getAttribute("data-value"),
68
- "Banana",
69
- );
63
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
64
+ assert.equal(autocomplete.currentItemEl?.getAttribute('data-value'), 'Banana');
70
65
 
71
66
  // Arrow down again
72
- input.dispatchEvent(
73
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
74
- );
75
- assert.equal(
76
- autocomplete.currentItemEl?.getAttribute("data-value"),
77
- "Blueberry",
78
- );
67
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
68
+ assert.equal(autocomplete.currentItemEl?.getAttribute('data-value'), 'Blueberry');
79
69
  });
80
70
 
81
- it("should select suggestion with enter key", async () => {
82
- input.value = "b";
83
- input.dispatchEvent(new Event("input", { bubbles: true }));
71
+ it('should select suggestion with enter key', async () => {
72
+ input.value = 'b';
73
+ input.dispatchEvent(new Event('input', { bubbles: true }));
84
74
 
85
75
  // Navigate to first suggestion
86
- input.dispatchEvent(
87
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
88
- );
76
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
89
77
 
90
78
  // Select suggestion
91
79
  const firstSuggestion = autocomplete.listItems()[0];
92
80
 
93
- firstSuggestion?.dispatchEvent(
94
- new KeyboardEvent("keydown", { key: "Enter", bubbles: true }),
95
- );
81
+ firstSuggestion?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
96
82
 
97
- assert.equal(input.value, "Banana");
98
- assert.equal(autocomplete.list().innerHTML, "");
83
+ assert.equal(input.value, 'Banana');
84
+ assert.equal(autocomplete.list().innerHTML, '');
99
85
  });
100
86
 
101
- it("should focus back on the input if no other items", async () => {
102
- input.value = "b";
103
- input.dispatchEvent(new Event("input", { bubbles: true }));
87
+ it('should focus back on the input if no other items', async () => {
88
+ input.value = 'b';
89
+ input.dispatchEvent(new Event('input', { bubbles: true }));
104
90
 
105
- input.dispatchEvent(
106
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
107
- );
91
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
108
92
 
109
93
  // Try to go up from first suggestion
110
- input.dispatchEvent(
111
- new KeyboardEvent("keydown", { key: "ArrowUp", bubbles: true }),
112
- );
94
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp', bubbles: true }));
113
95
 
114
96
  assert.equal(autocomplete.currentItemEl, null);
115
97
  });
116
98
 
117
- it("should not go below last suggestion with arrow down", async () => {
118
- input.value = "b";
119
- input.dispatchEvent(new Event("input", { bubbles: true }));
99
+ it('should not go below last suggestion with arrow down', async () => {
100
+ input.value = 'b';
101
+ input.dispatchEvent(new Event('input', { bubbles: true }));
120
102
 
121
103
  // Navigate to last suggestion
122
- input.dispatchEvent(
123
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
124
- );
125
-
126
- input.dispatchEvent(
127
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
128
- );
129
-
130
- input.dispatchEvent(
131
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
132
- );
133
-
134
- input.dispatchEvent(
135
- new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }),
136
- );
137
-
138
- assert.equal(
139
- autocomplete.currentItemEl?.getAttribute("data-value"),
140
- "Blueberry",
141
- );
104
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
105
+
106
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
107
+
108
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
109
+
110
+ input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
111
+
112
+ assert.equal(autocomplete.currentItemEl?.getAttribute('data-value'), 'Blueberry');
142
113
  });
143
114
 
144
- it("should submit form with default values", async () => {
115
+ it('should submit form with default values', async () => {
145
116
  const form = await fixture<HTMLFormElement>(html`
146
117
  <form>
147
118
  <usa-combo-box name="search" value="Apple" placeholder="Select a fruit">
@@ -158,10 +129,10 @@ describe("usa-combo-box", () => {
158
129
  `);
159
130
 
160
131
  const value = new FormData(form);
161
- assert.equal(value.get("search"), "Apple");
132
+ assert.equal(value.get('search'), 'Apple');
162
133
  });
163
134
 
164
- it("should update form value when an option is selected", async () => {
135
+ it('should update form value when an option is selected', async () => {
165
136
  const form = await fixture<HTMLFormElement>(html`
166
137
  <form>
167
138
  <usa-combo-box name="search" placeholder="Select a fruit">
@@ -177,35 +148,35 @@ describe("usa-combo-box", () => {
177
148
  </form>
178
149
  `);
179
150
 
180
- const comboBox = form.querySelector("usa-combo-box");
151
+ const comboBox = form.querySelector('usa-combo-box');
181
152
 
182
153
  if (!comboBox) {
183
- throw new Error("Combo box not found");
154
+ throw new Error('Combo box not found');
184
155
  }
185
156
 
186
- const input = comboBox.shadowRoot?.querySelector("input");
157
+ const input = comboBox.shadowRoot?.querySelector('input');
187
158
 
188
159
  if (!input) {
189
- throw new Error("input not found");
160
+ throw new Error('input not found');
190
161
  }
191
162
 
192
163
  // Type to show suggestions
193
- input.value = "Ban";
194
- input.dispatchEvent(new Event("input", { bubbles: true }));
164
+ input.value = 'Ban';
165
+ input.dispatchEvent(new Event('input', { bubbles: true }));
195
166
 
196
167
  // Select the first suggestion
197
168
  const suggestions = comboBox.listItems();
198
169
 
199
170
  suggestions[0]
200
- .querySelector("slot")
171
+ .querySelector('slot')
201
172
  ?.assignedElements()[0]
202
- .dispatchEvent(new MouseEvent("click", { bubbles: true }));
173
+ .dispatchEvent(new MouseEvent('click', { bubbles: true }));
203
174
 
204
175
  const value = new FormData(form);
205
- assert.equal(value.get("search"), "Banana");
176
+ assert.equal(value.get('search'), 'Banana');
206
177
  });
207
178
 
208
- it("should not submit when required and no value is selected", async () => {
179
+ it('should not submit when required and no value is selected', async () => {
209
180
  const form = await fixture<HTMLFormElement>(html`
210
181
  <form>
211
182
  <usa-combo-box name="search" required placeholder="Select a fruit">
@@ -224,7 +195,7 @@ describe("usa-combo-box", () => {
224
195
  assert.equal(form.checkValidity(), false);
225
196
  });
226
197
 
227
- it("should not show suggestions when disabled", async () => {
198
+ it('should not show suggestions when disabled', async () => {
228
199
  const disabledComboBox = await fixture<USAComboBoxElement>(html`
229
200
  <usa-combo-box name="search" disabled placeholder="Select a fruit">
230
201
  <span slot="label">Fruits</span>
@@ -0,0 +1,13 @@
1
+ import './config.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USAConfigElement } from './config.element.js';
6
+
7
+ describe('usa-config', () => {
8
+ it('should be accessible', async () => {
9
+ const config = await fixture<USAConfigElement>(html` <usa-config>Hello World</usa-config> `);
10
+
11
+ return assert.isAccessible(config);
12
+ });
13
+ });
@@ -0,0 +1,13 @@
1
+ import './description.element.js';
2
+
3
+ import { assert, fixture, html } from '@open-wc/testing';
4
+
5
+ import type { USADescriptionElement } from './description.element.js';
6
+
7
+ describe('usa-description', () => {
8
+ it('should be accessible', async () => {
9
+ const description = await fixture<USADescriptionElement>(html` <usa-description>Hello World</usa-description> `);
10
+
11
+ return assert.isAccessible(description);
12
+ });
13
+ });