@solexllc/usx-react 0.1.0

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 (359) hide show
  1. package/README.md +45 -0
  2. package/dist/index.cjs +6017 -0
  3. package/dist/index.js +6015 -0
  4. package/package.json +48 -0
  5. package/src/components/accordion/Accordion.jsx +170 -0
  6. package/src/components/accordion/accordion.django.html +47 -0
  7. package/src/components/accordion/accordion.html +304 -0
  8. package/src/components/accordion/config.json +31 -0
  9. package/src/components/alert/Alert.tsx +88 -0
  10. package/src/components/alert/alert.django.html +45 -0
  11. package/src/components/alert/alert.html +192 -0
  12. package/src/components/alert/config.json +70 -0
  13. package/src/components/attribution/Attribution.tsx +40 -0
  14. package/src/components/attribution/attribution.django.html +21 -0
  15. package/src/components/attribution/attribution.html +26 -0
  16. package/src/components/attribution/config.json +32 -0
  17. package/src/components/avatar/Avatar.tsx +85 -0
  18. package/src/components/avatar/avatar.django.html +27 -0
  19. package/src/components/avatar/avatar.html +101 -0
  20. package/src/components/avatar/config.json +59 -0
  21. package/src/components/avatar-group/AvatarGroup.tsx +43 -0
  22. package/src/components/avatar-group/avatar-group.django.html +8 -0
  23. package/src/components/avatar-group/avatar-group.html +208 -0
  24. package/src/components/avatar-group/config.json +60 -0
  25. package/src/components/back-to-top/BackToTop.tsx +60 -0
  26. package/src/components/back-to-top/back-to-top.django.html +38 -0
  27. package/src/components/back-to-top/back-to-top.html +107 -0
  28. package/src/components/back-to-top/config.json +44 -0
  29. package/src/components/banner/Banner.tsx +111 -0
  30. package/src/components/banner/banner.django.html +80 -0
  31. package/src/components/banner/banner.html +411 -0
  32. package/src/components/banner/config.json +47 -0
  33. package/src/components/block/Block.tsx +78 -0
  34. package/src/components/block/block.django.html +26 -0
  35. package/src/components/block/block.html +162 -0
  36. package/src/components/block/config.json +88 -0
  37. package/src/components/breadcrumb/Breadcrumb.tsx +83 -0
  38. package/src/components/breadcrumb/breadcrumb.django.html +24 -0
  39. package/src/components/breadcrumb/breadcrumb.html +108 -0
  40. package/src/components/breadcrumb/config.json +74 -0
  41. package/src/components/button/Button.tsx +121 -0
  42. package/src/components/button/button.django.html +58 -0
  43. package/src/components/button/button.html +363 -0
  44. package/src/components/button/config.json +103 -0
  45. package/src/components/button-group/ButtonGroup.tsx +33 -0
  46. package/src/components/button-group/button-group.django.html +9 -0
  47. package/src/components/button-group/button-group.html +159 -0
  48. package/src/components/button-group/config.json +25 -0
  49. package/src/components/calendar-date/CalendarDate.tsx +40 -0
  50. package/src/components/calendar-date/calendar-date.django.html +8 -0
  51. package/src/components/calendar-date/calendar-date.html +17 -0
  52. package/src/components/calendar-date/config.json +17 -0
  53. package/src/components/card/Card.tsx +137 -0
  54. package/src/components/card/card.django.html +40 -0
  55. package/src/components/card/card.html +67 -0
  56. package/src/components/card/config.json +115 -0
  57. package/src/components/card-group/CardGroup.tsx +23 -0
  58. package/src/components/card-group/card-group.django.html +6 -0
  59. package/src/components/card-group/card-group.html +164 -0
  60. package/src/components/card-group/config.json +21 -0
  61. package/src/components/carousel/Carousel.tsx +101 -0
  62. package/src/components/carousel/carousel.django.html +41 -0
  63. package/src/components/carousel/carousel.html +64 -0
  64. package/src/components/carousel/config.json +38 -0
  65. package/src/components/character-count/CharacterCount.tsx +77 -0
  66. package/src/components/character-count/character-count.django.html +19 -0
  67. package/src/components/character-count/character-count.html +110 -0
  68. package/src/components/character-count/config.json +78 -0
  69. package/src/components/checkbox/Checkbox.tsx +90 -0
  70. package/src/components/checkbox/checkbox.django.html +16 -0
  71. package/src/components/checkbox/checkbox.html +266 -0
  72. package/src/components/checkbox/config.json +71 -0
  73. package/src/components/checkbox-group/CheckboxGroup.tsx +67 -0
  74. package/src/components/checkbox-group/checkbox-group.django.html +12 -0
  75. package/src/components/checkbox-group/checkbox-group.html +36 -0
  76. package/src/components/checkbox-group/config.json +50 -0
  77. package/src/components/clickable/Clickable.tsx +78 -0
  78. package/src/components/clickable/clickable.django.html +5 -0
  79. package/src/components/clickable/clickable.html +133 -0
  80. package/src/components/clickable/config.json +26 -0
  81. package/src/components/code/Code.tsx +60 -0
  82. package/src/components/code/code.django.html +21 -0
  83. package/src/components/code/code.html +71 -0
  84. package/src/components/code/config.json +40 -0
  85. package/src/components/collection/Collection.tsx +99 -0
  86. package/src/components/collection/collection.django.html +48 -0
  87. package/src/components/collection/collection.html +384 -0
  88. package/src/components/collection/config.json +60 -0
  89. package/src/components/combobox/Combobox.tsx +114 -0
  90. package/src/components/combobox/combobox.django.html +61 -0
  91. package/src/components/combobox/combobox.html +509 -0
  92. package/src/components/combobox/config.json +80 -0
  93. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +48 -0
  94. package/src/components/copy-to-clipboard/config.json +30 -0
  95. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +16 -0
  96. package/src/components/copy-to-clipboard/copy-to-clipboard.html +68 -0
  97. package/src/components/date-picker/DatePicker.jsx +83 -0
  98. package/src/components/date-picker/config.json +71 -0
  99. package/src/components/date-picker/date-picker.django.html +67 -0
  100. package/src/components/date-picker/date-picker.html +104 -0
  101. package/src/components/date-range-picker/DateRangePicker.jsx +113 -0
  102. package/src/components/date-range-picker/config.json +92 -0
  103. package/src/components/date-range-picker/date-range-picker.django.html +66 -0
  104. package/src/components/date-range-picker/date-range-picker.html +190 -0
  105. package/src/components/error-message/ErrorMessage.tsx +23 -0
  106. package/src/components/error-message/config.json +19 -0
  107. package/src/components/error-message/error-message.django.html +2 -0
  108. package/src/components/error-message/error-message.html +2 -0
  109. package/src/components/eyebrow/Eyebrow.tsx +15 -0
  110. package/src/components/eyebrow/config.json +15 -0
  111. package/src/components/eyebrow/eyebrow.django.html +4 -0
  112. package/src/components/eyebrow/eyebrow.html +4 -0
  113. package/src/components/fieldset/Fieldset.tsx +54 -0
  114. package/src/components/fieldset/config.json +47 -0
  115. package/src/components/fieldset/fieldset.django.html +22 -0
  116. package/src/components/fieldset/fieldset.html +17 -0
  117. package/src/components/file-input/FileInput.jsx +174 -0
  118. package/src/components/file-input/config.json +80 -0
  119. package/src/components/file-input/file-input.django.html +57 -0
  120. package/src/components/file-input/file-input.html +258 -0
  121. package/src/components/file-list/FileList.jsx +105 -0
  122. package/src/components/file-list/config.json +43 -0
  123. package/src/components/file-list/file-list.django.html +30 -0
  124. package/src/components/file-list/file-list.html +61 -0
  125. package/src/components/footer/Footer.tsx +365 -0
  126. package/src/components/footer/config.json +83 -0
  127. package/src/components/footer/footer.django.html +260 -0
  128. package/src/components/footer/footer.html +392 -0
  129. package/src/components/form-group/FormGroup.tsx +26 -0
  130. package/src/components/form-group/config.json +22 -0
  131. package/src/components/form-group/form-group.django.html +4 -0
  132. package/src/components/form-group/form-group.html +17 -0
  133. package/src/components/header/Branding.tsx +101 -0
  134. package/src/components/header/Header.tsx +229 -0
  135. package/src/components/header/HeaderBranding.jsx +4 -0
  136. package/src/components/header/config.json +58 -0
  137. package/src/components/header/header.django.html +194 -0
  138. package/src/components/header/header.html +823 -0
  139. package/src/components/hero/Hero.tsx +64 -0
  140. package/src/components/hero/config.json +70 -0
  141. package/src/components/hero/hero.django.html +22 -0
  142. package/src/components/hero/hero.html +75 -0
  143. package/src/components/hint/Hint.tsx +23 -0
  144. package/src/components/hint/config.json +19 -0
  145. package/src/components/hint/hint.django.html +2 -0
  146. package/src/components/hint/hint.html +2 -0
  147. package/src/components/icon/Icon.tsx +46 -0
  148. package/src/components/icon/config.json +60 -0
  149. package/src/components/icon/icon.django.html +26 -0
  150. package/src/components/icon/icon.html +289 -0
  151. package/src/components/icon/icons_list.json +247 -0
  152. package/src/components/icon-list/IconList.tsx +59 -0
  153. package/src/components/icon-list/config.json +86 -0
  154. package/src/components/icon-list/icon-list.django.html +17 -0
  155. package/src/components/icon-list/icon-list.html +227 -0
  156. package/src/components/identifier/Identifier.tsx +193 -0
  157. package/src/components/identifier/config.json +133 -0
  158. package/src/components/identifier/identifier.django.html +99 -0
  159. package/src/components/identifier/identifier.html +737 -0
  160. package/src/components/image/Image.tsx +106 -0
  161. package/src/components/image/config.json +64 -0
  162. package/src/components/image/image.django.html +62 -0
  163. package/src/components/image/image.html +53 -0
  164. package/src/components/in-page-nav/InPageNav.jsx +76 -0
  165. package/src/components/in-page-nav/config.json +69 -0
  166. package/src/components/in-page-nav/in-page-nav.django.html +28 -0
  167. package/src/components/in-page-nav/in-page-nav.html +183 -0
  168. package/src/components/indicator/Indicator.tsx +32 -0
  169. package/src/components/indicator/README.md +1 -0
  170. package/src/components/indicator/config.json +19 -0
  171. package/src/components/indicator/indicator.django.html +10 -0
  172. package/src/components/indicator/indicator.html +42 -0
  173. package/src/components/input/Input.tsx +85 -0
  174. package/src/components/input/config.json +73 -0
  175. package/src/components/input/input.django.html +55 -0
  176. package/src/components/input/input.html +59 -0
  177. package/src/components/label/Label.tsx +42 -0
  178. package/src/components/label/config.json +39 -0
  179. package/src/components/label/label.django.html +23 -0
  180. package/src/components/label/label.html +23 -0
  181. package/src/components/language-selector/LanguageSelector.jsx +224 -0
  182. package/src/components/language-selector/config.json +107 -0
  183. package/src/components/language-selector/language-selector.django.html +40 -0
  184. package/src/components/language-selector/language-selector.html +85 -0
  185. package/src/components/layout/Layout.tsx +131 -0
  186. package/src/components/layout/config.json +36 -0
  187. package/src/components/layout/layout.django.html +28 -0
  188. package/src/components/layout/layout.html +29 -0
  189. package/src/components/legend/Legend.tsx +34 -0
  190. package/src/components/legend/config.json +27 -0
  191. package/src/components/legend/legend.django.html +11 -0
  192. package/src/components/legend/legend.html +12 -0
  193. package/src/components/link/Link.tsx +45 -0
  194. package/src/components/link/config.json +39 -0
  195. package/src/components/link/link.django.html +8 -0
  196. package/src/components/link/link.html +47 -0
  197. package/src/components/list/List.tsx +82 -0
  198. package/src/components/list/_list-items.django.html +17 -0
  199. package/src/components/list/config.json +25 -0
  200. package/src/components/list/list.django.html +11 -0
  201. package/src/components/list/list.html +26 -0
  202. package/src/components/memorable-date/MemorableDate.jsx +167 -0
  203. package/src/components/memorable-date/config.json +104 -0
  204. package/src/components/memorable-date/memorable-date.django.html +86 -0
  205. package/src/components/memorable-date/memorable-date.html +275 -0
  206. package/src/components/misc-banner/MiscBanner.tsx +112 -0
  207. package/src/components/misc-banner/config.json +57 -0
  208. package/src/components/misc-banner/misc-banner.django.html +63 -0
  209. package/src/components/misc-banner/misc-banner.html +191 -0
  210. package/src/components/modal/Modal.tsx +71 -0
  211. package/src/components/modal/config.json +57 -0
  212. package/src/components/modal/modal.django.html +43 -0
  213. package/src/components/modal/modal.html +222 -0
  214. package/src/components/page/Page.jsx +34 -0
  215. package/src/components/page/config.json +34 -0
  216. package/src/components/page/page.django.html +5 -0
  217. package/src/components/page/page.html +23 -0
  218. package/src/components/pagination/Pagination.tsx +112 -0
  219. package/src/components/pagination/config.json +135 -0
  220. package/src/components/pagination/container/PaginationContainer.tsx +38 -0
  221. package/src/components/pagination/navigation/PaginationNavigation.tsx +219 -0
  222. package/src/components/pagination/navigation/pagination-navigation.django.html +64 -0
  223. package/src/components/pagination/pagination.django.html +48 -0
  224. package/src/components/pagination/pagination.html +613 -0
  225. package/src/components/pagination/step-options/PaginationStepOptions.tsx +43 -0
  226. package/src/components/pagination/step-options/pagination-step-options.django.html +7 -0
  227. package/src/components/pagination/summary/PaginationSummary.tsx +33 -0
  228. package/src/components/pagination/summary/pagination-summary.django.html +12 -0
  229. package/src/components/process-list/ProcessList.tsx +52 -0
  230. package/src/components/process-list/config.json +15 -0
  231. package/src/components/process-list/process-list.django.html +15 -0
  232. package/src/components/process-list/process-list.html +90 -0
  233. package/src/components/prose/Prose.tsx +32 -0
  234. package/src/components/prose/config.json +28 -0
  235. package/src/components/prose/prose.django.html +35 -0
  236. package/src/components/prose/prose.html +91 -0
  237. package/src/components/radio-buttons/RadioButtons.tsx +82 -0
  238. package/src/components/radio-buttons/config.json +57 -0
  239. package/src/components/radio-buttons/radio-buttons.django.html +28 -0
  240. package/src/components/radio-buttons/radio-buttons.html +189 -0
  241. package/src/components/range-slider/RangeSlider.jsx +84 -0
  242. package/src/components/range-slider/config.json +89 -0
  243. package/src/components/range-slider/range-slider.django.html +65 -0
  244. package/src/components/range-slider/range-slider.html +106 -0
  245. package/src/components/required/Required.tsx +25 -0
  246. package/src/components/required/config.json +20 -0
  247. package/src/components/required/required.django.html +2 -0
  248. package/src/components/required/required.html +6 -0
  249. package/src/components/search/Search.tsx +92 -0
  250. package/src/components/search/config.json +69 -0
  251. package/src/components/search/search.django.html +59 -0
  252. package/src/components/search/search.html +76 -0
  253. package/src/components/section/Section.tsx +28 -0
  254. package/src/components/section/config.json +27 -0
  255. package/src/components/section/section.django.html +5 -0
  256. package/src/components/section/section.html +16 -0
  257. package/src/components/select/Select.tsx +107 -0
  258. package/src/components/select/config.json +80 -0
  259. package/src/components/select/select.django.html +64 -0
  260. package/src/components/select/select.html +62 -0
  261. package/src/components/sidenav/SideNav.tsx +74 -0
  262. package/src/components/sidenav/config.json +45 -0
  263. package/src/components/sidenav/sidenav.django.html +29 -0
  264. package/src/components/sidenav/sidenav.html +84 -0
  265. package/src/components/site-alert/SiteAlert.tsx +101 -0
  266. package/src/components/site-alert/config.json +62 -0
  267. package/src/components/site-alert/site-alert.django.html +34 -0
  268. package/src/components/site-alert/site-alert.html +312 -0
  269. package/src/components/skipnav/Skipnav.tsx +41 -0
  270. package/src/components/skipnav/config.json +29 -0
  271. package/src/components/skipnav/skipnav.django.html +11 -0
  272. package/src/components/skipnav/skipnav.html +1 -0
  273. package/src/components/spinner/Spinner.tsx +46 -0
  274. package/src/components/spinner/config.json +44 -0
  275. package/src/components/spinner/spinner.django.html +8 -0
  276. package/src/components/spinner/spinner.html +219 -0
  277. package/src/components/status/Status.tsx +28 -0
  278. package/src/components/status/config.json +47 -0
  279. package/src/components/status/status.django.html +2 -0
  280. package/src/components/status/status.html +31 -0
  281. package/src/components/step-indicator/StepIndicator.tsx +80 -0
  282. package/src/components/step-indicator/config.json +54 -0
  283. package/src/components/step-indicator/step-indicator.django.html +29 -0
  284. package/src/components/step-indicator/step-indicator.html +243 -0
  285. package/src/components/summary-box/SummaryBox.tsx +41 -0
  286. package/src/components/summary-box/config.json +30 -0
  287. package/src/components/summary-box/summary-box.django.html +19 -0
  288. package/src/components/summary-box/summary-box.html +210 -0
  289. package/src/components/swap/Swap.tsx +47 -0
  290. package/src/components/swap/config.json +61 -0
  291. package/src/components/swap/swap.django.html +14 -0
  292. package/src/components/swap/swap.html +163 -0
  293. package/src/components/switch/Switch.tsx +73 -0
  294. package/src/components/switch/config.json +55 -0
  295. package/src/components/switch/switch.django.html +28 -0
  296. package/src/components/switch/switch.html +56 -0
  297. package/src/components/table/Table.tsx +334 -0
  298. package/src/components/table/TableBody.tsx +253 -0
  299. package/src/components/table/TableCell.tsx +37 -0
  300. package/src/components/table/TableContext.tsx +87 -0
  301. package/src/components/table/TableFoot.tsx +68 -0
  302. package/src/components/table/TableGroup.tsx +69 -0
  303. package/src/components/table/TableHead.tsx +139 -0
  304. package/src/components/table/TableRow.tsx +56 -0
  305. package/src/components/table/__pycache__/table_helper.cpython-312.pyc +0 -0
  306. package/src/components/table/config.json +297 -0
  307. package/src/components/table/hooks/useRowDetails.ts +34 -0
  308. package/src/components/table/hooks/useTableGroups.ts +61 -0
  309. package/src/components/table/hooks/useTableSelect.ts +82 -0
  310. package/src/components/table/hooks/useTableSort.ts +60 -0
  311. package/src/components/table/table-body.django.html +68 -0
  312. package/src/components/table/table-detail-row.django.html +14 -0
  313. package/src/components/table/table-foot.django.html +31 -0
  314. package/src/components/table/table-group.django.html +40 -0
  315. package/src/components/table/table-head.django.html +85 -0
  316. package/src/components/table/table-row.django.html +98 -0
  317. package/src/components/table/table.django.html +60 -0
  318. package/src/components/table/table.html +1186 -0
  319. package/src/components/table/table_helper.py +298 -0
  320. package/src/components/table/types.ts +68 -0
  321. package/src/components/tag/Tag.tsx +75 -0
  322. package/src/components/tag/config.json +54 -0
  323. package/src/components/tag/tag.django.html +39 -0
  324. package/src/components/tag/tag.html +45 -0
  325. package/src/components/tag-group/TagGroup.tsx +35 -0
  326. package/src/components/tag-group/config.json +24 -0
  327. package/src/components/tag-group/tag-group.django.html +11 -0
  328. package/src/components/tag-group/tag-group.html +36 -0
  329. package/src/components/task-list/TaskList.tsx +40 -0
  330. package/src/components/task-list/config.json +41 -0
  331. package/src/components/task-list/task-list.django.html +21 -0
  332. package/src/components/task-list/task-list.html +24 -0
  333. package/src/components/text-area/TextArea.tsx +78 -0
  334. package/src/components/text-area/config.json +78 -0
  335. package/src/components/text-area/text-area.django.html +53 -0
  336. package/src/components/text-area/text-area.html +59 -0
  337. package/src/components/theme-picker/ThemePicker.tsx +106 -0
  338. package/src/components/theme-picker/config.json +39 -0
  339. package/src/components/theme-picker/theme-picker.django.html +32 -0
  340. package/src/components/theme-picker/theme-picker.html +67 -0
  341. package/src/components/time-picker/TimePicker.jsx +87 -0
  342. package/src/components/time-picker/config.json +76 -0
  343. package/src/components/time-picker/time-picker.django.html +67 -0
  344. package/src/components/time-picker/time-picker.html +123 -0
  345. package/src/components/toggle/Toggle.tsx +80 -0
  346. package/src/components/toggle/config.json +69 -0
  347. package/src/components/toggle/toggle.django.html +19 -0
  348. package/src/components/toggle/toggle.html +85 -0
  349. package/src/components/tooltip/Tooltip.tsx +33 -0
  350. package/src/components/tooltip/config.json +33 -0
  351. package/src/components/tooltip/tooltip.django.html +5 -0
  352. package/src/components/tooltip/tooltip.html +57 -0
  353. package/src/components/villain/Villain.tsx +47 -0
  354. package/src/components/villain/config.json +44 -0
  355. package/src/components/villain/villain.django.html +19 -0
  356. package/src/components/villain/villain.html +39 -0
  357. package/src/declarations.d.ts +1 -0
  358. package/src/index.js +82 -0
  359. package/src/styles/core.scss +12 -0
@@ -0,0 +1,106 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ export interface ImageSource {
5
+ srcSet: string;
6
+ media?: string;
7
+ type?: string;
8
+ sizes?: string;
9
+ }
10
+
11
+ export interface ResponsiveImage {
12
+ fallback: string;
13
+ sources: ImageSource[];
14
+ }
15
+
16
+ export interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
17
+ src: string | ResponsiveImage;
18
+ alt?: string;
19
+ href?: string;
20
+ rounded?: boolean;
21
+ circular?: boolean;
22
+ caption?: string;
23
+ hideCaption?: boolean;
24
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down' | '';
25
+ maxWidth?: string | number;
26
+ maxHeight?: string | number;
27
+ className?: string;
28
+ }
29
+
30
+ export default function Image({
31
+ src,
32
+ alt,
33
+ href,
34
+ rounded = false,
35
+ circular = false,
36
+ caption,
37
+ hideCaption = false,
38
+ objectFit = '',
39
+ maxWidth,
40
+ maxHeight,
41
+ className = '',
42
+ ...props
43
+ }: ImageProps) {
44
+ const classes = classNames(
45
+ 'usx-image',
46
+ {
47
+ 'usx-image--rounded': rounded,
48
+ 'usx-image--circular': circular,
49
+ [`usx-object-fit-${objectFit}`]: objectFit,
50
+ },
51
+ className
52
+ );
53
+
54
+ const style: React.CSSProperties = {};
55
+ if (maxWidth) style.maxWidth = maxWidth;
56
+ if (maxHeight) style.maxHeight = maxHeight;
57
+ if (maxHeight && !maxWidth) style.width = 'auto';
58
+ if (maxWidth && !maxHeight) style.height = 'auto';
59
+
60
+ const captionClasses = classNames(
61
+ 'usx-image--caption',
62
+ { 'usa-sr-only': hideCaption }
63
+ );
64
+
65
+ const isResponsive = src && typeof src === 'object';
66
+
67
+ const imgElement = !src ? (
68
+ 'Image'
69
+ ) : isResponsive ? (
70
+ <picture>
71
+ {(src as ResponsiveImage).sources.map((source, i) => (
72
+ <source
73
+ key={i}
74
+ {...(source.media ? { media: source.media } : {})}
75
+ srcSet={source.srcSet}
76
+ {...(source.type ? { type: source.type } : {})}
77
+ {...(source.sizes ? { sizes: source.sizes } : {})}
78
+ />
79
+ ))}
80
+ <img src={(src as ResponsiveImage).fallback} alt={alt} style={style} {...props} />
81
+ </picture>
82
+ ) : (
83
+ <img src={src as string} alt={alt} style={style} {...props} />
84
+ );
85
+
86
+ if (caption) {
87
+ return (
88
+ <figure className={classes} style={style}>
89
+ {imgElement}
90
+ <figcaption className={captionClasses} aria-hidden={hideCaption}>{caption}</figcaption>
91
+ </figure>
92
+ );
93
+ }
94
+
95
+ const Element: React.ElementType = href ? 'a' : 'div';
96
+
97
+ return (
98
+ <Element
99
+ {...(href ? { href } : {})}
100
+ className={classes}
101
+ style={style}
102
+ >
103
+ {imgElement}
104
+ </Element>
105
+ );
106
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "image",
3
+ "template": "image/image.django.html",
4
+ "version": 1,
5
+ "required": [
6
+ "src"
7
+ ],
8
+ "props": {
9
+ "src": {
10
+ "type": "string",
11
+ "description": "Image source URL"
12
+ },
13
+ "alt": {
14
+ "type": "string",
15
+ "description": "Alt text for accessibility"
16
+ },
17
+ "href": {
18
+ "type": "string",
19
+ "description": "(OPTIONAL) If provided, the image will be wrapped in a link pointing to this URL"
20
+ },
21
+ "rounded": {
22
+ "type": "boolean",
23
+ "default": false,
24
+ "description": "Whether to apply rounded corners"
25
+ },
26
+ "circular": {
27
+ "type": "boolean",
28
+ "default": false,
29
+ "description": "Whether to make the image circular"
30
+ },
31
+ "caption": {
32
+ "type": "string",
33
+ "description": "Caption text for the image"
34
+ },
35
+ "hideCaption": {
36
+ "type": "boolean",
37
+ "default": false,
38
+ "description": "Whether to visually hide the caption while keeping it accessible to screen readers"
39
+ },
40
+ "objectFit": {
41
+ "type": "select",
42
+ "description": "How the image should be resized to fit its container",
43
+ "options": [
44
+ "cover",
45
+ "contain",
46
+ "fill",
47
+ "none",
48
+ "scale-down"
49
+ ]
50
+ },
51
+ "maxWidth": {
52
+ "type": "string",
53
+ "description": "Maximum width of the image container (CSS value like '300px' or '50%')"
54
+ },
55
+ "maxHeight": {
56
+ "type": "string",
57
+ "description": "Maximum height of the image container (CSS value like '200px' or '50%')"
58
+ },
59
+ "className": {
60
+ "type": "string",
61
+ "description": "Additional CSS classes"
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,62 @@
1
+ {# Django template for Image #}
2
+ {# Props: src, alt, href, rounded, circular, objectFit, maxWidth, maxHeight, caption, hideCaption, className #}
3
+ {# For responsive images, src may be an object: { fallback, sources: [{ srcSet, media?, type?, sizes? }] } #}
4
+
5
+ {% comment %} Build shared values {% endcomment %}
6
+ {% with classes="usx-image"|add:" usx-image--rounded"|yesno:","|slice:"0" %}
7
+ {% endwith %}
8
+
9
+ {% comment %} Inline image element (string src or picture) {% endcomment %}
10
+ {% with img_style=""|add:"" %}
11
+ {% endwith %}
12
+
13
+ {% if caption %}
14
+ <figure class="usx-image{% if rounded %} usx-image--rounded{% endif %}{% if circular %} usx-image--circular{% endif %}{% if objectFit %} usx-object-fit-{{ objectFit }}{% endif %}{% if className %} {{ className }}{% endif %}"
15
+ {% if maxWidth or maxHeight %} style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %}>
16
+ {% if src.fallback %}
17
+ <picture>
18
+ {% for source in src.sources %}
19
+ <source srcset="{{ source.srcSet }}"
20
+ {% if source.media %}media="{{ source.media }}"{% endif %}
21
+ {% if source.type %}type="{{ source.type }}"{% endif %}
22
+ {% if source.sizes %}sizes="{{ source.sizes }}"{% endif %}
23
+ />
24
+ {% endfor %}
25
+ <img src="{{ src.fallback }}"{% if alt %} alt="{{ alt }}"{% endif %}
26
+ {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
27
+ </picture>
28
+ {% elif src %}
29
+ <img src="{{ src }}"{% if alt %} alt="{{ alt }}"{% endif %}
30
+ {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
31
+ {% else %}
32
+ Image
33
+ {% endif %}
34
+ <figcaption class="usx-image--caption{% if hideCaption %} usa-sr-only{% endif %}">{{ caption }}</figcaption>
35
+ </figure>
36
+ {% else %}
37
+ {% if href %}<a href="{{ href }}"
38
+ {% else %}<div
39
+ {% endif %}
40
+ class="usx-image{% if rounded %} usx-image--rounded{% endif %}{% if circular %} usx-image--circular{% endif %}{% if objectFit %} usx-object-fit-{{ objectFit }}{% endif %}{% if className %} {{ className }}{% endif %}"
41
+ {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %}
42
+ >
43
+ {% if src.fallback %}
44
+ <picture>
45
+ {% for source in src.sources %}
46
+ <source srcset="{{ source.srcSet }}"
47
+ {% if source.media %}media="{{ source.media }}"{% endif %}
48
+ {% if source.type %}type="{{ source.type }}"{% endif %}
49
+ {% if source.sizes %}sizes="{{ source.sizes }}"{% endif %}
50
+ />
51
+ {% endfor %}
52
+ <img src="{{ src.fallback }}"{% if alt %} alt="{{ alt }}"{% endif %}
53
+ {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
54
+ </picture>
55
+ {% elif src %}
56
+ <img src="{{ src }}"{% if alt %} alt="{{ alt }}"{% endif %}
57
+ {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
58
+ {% else %}
59
+ Image
60
+ {% endif %}
61
+ {% if href %}</a>{% else %}</div>{% endif %}
62
+ {% endif %}
@@ -0,0 +1,53 @@
1
+ <h3 class="site-preview-heading margin-bottom-0">Default</h3>
2
+ <div class="usx-image">
3
+ <img src="https://picsum.photos/600/400?random=1" alt="Example image 1" />
4
+ </div>
5
+
6
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">Rounded</h3>
7
+ <div class="usx-image usx-image--rounded">
8
+ <img src="https://picsum.photos/600/400?random=2" alt="Example image 2" />
9
+ </div>
10
+
11
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">Circular</h3>
12
+ <div class="usx-image usx-image--circular">
13
+ <img src="https://picsum.photos/600/400?random=3" alt="Example image 3" />
14
+ </div>
15
+
16
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">With Caption</h3>
17
+ <figure class="usx-image">
18
+ <img src="https://picsum.photos/600/400?random=10" alt="Example image 10" />
19
+ <figcaption class="usx-image--caption">This is a caption describing the image above.</figcaption>
20
+ </figure>
21
+
22
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">Responsive (&lt;picture&gt;)</h3>
23
+ <div class="usx-image">
24
+ <picture>
25
+ <source media="(min-width: 64em)" srcset="/linear-w-symbol_left.svg" />
26
+ <source media="(min-width: 40em)" srcset="/linear.svg" />
27
+ <source media="(min-width: 20em)" srcset="/solex-only.svg" />
28
+ <img src="/symbol-only.svg" alt="SOLEX" />
29
+ </picture>
30
+ </div>
31
+
32
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">Fit</h3>
33
+ <div class="usx-image usx-image--fit">
34
+ <img src="https://picsum.photos/400/300?random=12" alt="Example image 12" />
35
+ </div>
36
+
37
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">With Max Width</h3>
38
+ <figure class="usx-image usx-image--fit" style="max-width: 200px; height: auto;">
39
+ <img src="https://picsum.photos/600/400?random=13" alt="Example image 13" style="max-width: 200px; height: auto;" />
40
+ <figcaption class="usx-image--caption">This is a caption describing the image above.</figcaption>
41
+ </figure>
42
+
43
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">With Max Height</h3>
44
+ <figure class="usx-image usx-image--fit" style="max-height: 150px; width: auto;">
45
+ <img src="https://picsum.photos/600/400?random=14" alt="Example image 14" style="max-height: 150px; width: auto;" />
46
+ <figcaption class="usx-image--caption">This is a caption describing the image above.</figcaption>
47
+ </figure>
48
+
49
+ <h3 class="site-preview-heading margin-top-7 margin-bottom-0">Long Caption</h3>
50
+ <figure class="usx-image">
51
+ <img src="https://picsum.photos/600/400?random=15" alt="Example image 15" />
52
+ <figcaption class="usx-image--caption">This is a longer caption that provides more detailed information about the image above. It can span multiple lines and gives context to the visual content.</figcaption>
53
+ </figure>
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classNames from 'classnames';
4
+
5
+ // USWDS's own JS (usa-in-page-navigation) builds the <nav>/<ul> list into
6
+ // the empty <aside> below by reading headings out of the element matched by
7
+ // data-main-content-selector — it does not render anything itself. Call ONLY
8
+ // `.init()` around this component the same way other JS-enhanced components
9
+ // (DatePicker, FileInput, RangeSlider) do — never `.on()`/`.off()`; see the
10
+ // story decorators and Combobox.tsx for why.
11
+ export default function InPageNav({
12
+ id = 'in-page-nav',
13
+ headingElements = 'h2 h3',
14
+ mainContentSelector = null,
15
+ titleHeadingLevel = 'h4',
16
+ titleText = 'On this page',
17
+ scrollOffset = 0,
18
+ rootMargin = '0px 0px 0px 0px',
19
+ threshold = 1,
20
+ minimumHeadingCount = 2,
21
+ content = '',
22
+ children = null,
23
+ className = '',
24
+ contentClassName = '',
25
+ ...props
26
+ }) {
27
+ const contentId = `${id}-content`;
28
+ // Real USWDS points data-main-content-selector at a real <main> landmark,
29
+ // but that only works for a single instance per page — Storybook (and any
30
+ // page rendering more than one InPageNav, e.g. the Theme Playground) can
31
+ // have several on screen at once, and document.querySelector('main')
32
+ // would only ever find the first. Defaulting to this instance's own id
33
+ // keeps every instance independently observable.
34
+ const resolvedSelector = mainContentSelector || `#${contentId}`;
35
+
36
+ return (
37
+ <div className="usa-in-page-nav-container usx-in-page-nav-container">
38
+ <aside
39
+ id={id}
40
+ className={classNames('usa-in-page-nav', 'usx-in-page-nav', className)}
41
+ data-heading-elements={headingElements}
42
+ data-main-content-selector={resolvedSelector}
43
+ data-title-heading-level={titleHeadingLevel}
44
+ data-title-text={titleText}
45
+ data-scroll-offset={scrollOffset}
46
+ data-root-margin={rootMargin}
47
+ data-threshold={threshold}
48
+ data-minimum-heading-count={minimumHeadingCount}
49
+ {...props}
50
+ />
51
+ <div
52
+ id={contentId}
53
+ className={classNames('usx-in-page-nav__content', 'usa-prose', contentClassName)}
54
+ {...(children ? {} : { dangerouslySetInnerHTML: { __html: content } })}
55
+ >
56
+ {children || null}
57
+ </div>
58
+ </div>
59
+ );
60
+ }
61
+
62
+ InPageNav.propTypes = {
63
+ id: PropTypes.string,
64
+ headingElements: PropTypes.string,
65
+ mainContentSelector: PropTypes.string,
66
+ titleHeadingLevel: PropTypes.string,
67
+ titleText: PropTypes.string,
68
+ scrollOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
69
+ rootMargin: PropTypes.string,
70
+ threshold: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
71
+ minimumHeadingCount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
72
+ content: PropTypes.string,
73
+ children: PropTypes.node,
74
+ className: PropTypes.string,
75
+ contentClassName: PropTypes.string,
76
+ };
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "in-page-nav",
3
+ "template": "in-page-nav/in-page-nav.django.html",
4
+ "version": 1,
5
+ "default": {
6
+ "id": "in-page-nav-default",
7
+ "content": "<h2>Introduction</h2><p>This page walks through setting up and using the example project.</p><p>It's also meant to demonstrate how the in-page navigation component tracks scroll position and highlights whichever section is currently in view. Scroll down through each section below to see the link list on the side update automatically.</p><p>None of the copy on this page is meant to be read closely — it exists purely to give the navigation something substantial enough to observe.</p><h2>Getting started</h2><p>Before you begin, make sure the prerequisites below are met.</p><p>Getting started with any new project usually means working through a short checklist before the real work begins. The sections below cover what you'll need and how to get everything installed.</p><h3>Prerequisites</h3><p>A recent browser and a working internet connection.</p><p>You'll also want a modern code editor and enough disk space for the dependencies. Nothing here is unusual — most standard front-end tooling already satisfies these requirements.</p><p>If you already have Node.js and a package manager installed, you can skip ahead to the installation section below.</p><h3>Installation</h3><p>Download the package and follow the setup instructions.</p><p>Installation typically takes just a few minutes. Run the installer, accept the default options, and confirm that the command-line tool reports a successful install before moving on.</p><p>If you run into trouble, double-check that your environment matches the prerequisites listed above before trying again.</p><h2>Advanced usage</h2><p>Once installed, explore the configuration options to fit your workflow.</p><p>Advanced users can customize almost every aspect of the setup, from heading detection to scroll offsets and intersection thresholds — all of which this component exposes as simple data attributes.</p><p>Most projects never need to touch these settings, but they're available for the cases that do.</p><h2>Conclusion</h2><p>You should now be ready to explore the rest of the documentation.</p><p>Thanks for reading through this example. Scroll back up and watch the navigation list highlight each section as it passes by — that's the entire behavior this component provides.</p>"
8
+ },
9
+ "props": {
10
+ "id": {
11
+ "type": "string",
12
+ "default": "in-page-nav",
13
+ "description": "id for the aside element. The observed content container id is derived from this (<id>-content) unless mainContentSelector is set."
14
+ },
15
+ "headingElements": {
16
+ "type": "string",
17
+ "default": "h2 h3",
18
+ "description": "Space-separated heading levels to include in the link list. Sets data-heading-elements."
19
+ },
20
+ "mainContentSelector": {
21
+ "type": "string",
22
+ "description": "CSS selector for the element the component pulls headings from. Defaults to this instance's own generated content container (#<id>-content). Sets data-main-content-selector."
23
+ },
24
+ "titleHeadingLevel": {
25
+ "type": "string",
26
+ "default": "h4",
27
+ "description": "Heading level of the nav's own title. Sets data-title-heading-level."
28
+ },
29
+ "titleText": {
30
+ "type": "string",
31
+ "default": "On this page",
32
+ "description": "Text of the nav's title heading. Sets data-title-text."
33
+ },
34
+ "scrollOffset": {
35
+ "type": "number",
36
+ "default": 0,
37
+ "description": "Pixels to offset scroll from the top of the parent element. Sets data-scroll-offset."
38
+ },
39
+ "rootMargin": {
40
+ "type": "string",
41
+ "default": "0px 0px 0px 0px",
42
+ "description": "Observable margin around the root used to calculate the active section. Sets data-root-margin."
43
+ },
44
+ "threshold": {
45
+ "type": "number",
46
+ "default": 1,
47
+ "description": "Percentage (0-1) of a section that must be visible before it's marked current. Sets data-threshold."
48
+ },
49
+ "minimumHeadingCount": {
50
+ "type": "number",
51
+ "default": 2,
52
+ "description": "Minimum number of matching headings required for the component to initialize. Sets data-minimum-heading-count."
53
+ },
54
+ "content": {
55
+ "type": "string",
56
+ "description": "HTML content (with headings) to render inside the observed content container. Ignored if children are provided (React only)."
57
+ },
58
+ "className": {
59
+ "type": "string",
60
+ "default": "",
61
+ "description": "Additional classes for the usa-in-page-nav aside."
62
+ },
63
+ "contentClassName": {
64
+ "type": "string",
65
+ "default": "",
66
+ "description": "Additional classes for the observed content container."
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,28 @@
1
+ {# ─── USX InPageNav ──────────────────────────────────────────────────────── #}
2
+ {# Props: id, headingElements, mainContentSelector, titleHeadingLevel, #}
3
+ {# titleText, scrollOffset, rootMargin, threshold, #}
4
+ {# minimumHeadingCount, content, className, contentClassName #}
5
+ {# The <aside> below is left empty — usa-in-page-navigation's JS builds the #}
6
+ {# <nav>/<ul> list into it after scanning the content container for #}
7
+ {# headings. Call ONLY inPageNavigation.init() around the rendered markup, #}
8
+ {# never .on()/.off(). #}
9
+ {# ─────────────────────────────────────────────────────────────────────── #}
10
+ {% with content_id=id|default:"in-page-nav"|add:"-content" %}
11
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
12
+ <aside
13
+ id="{{ id|default:'in-page-nav' }}"
14
+ class="usa-in-page-nav usx-in-page-nav{% if className %} {{ className }}{% endif %}"
15
+ data-heading-elements="{{ headingElements|default:'h2 h3' }}"
16
+ data-main-content-selector="{% if mainContentSelector %}{{ mainContentSelector }}{% else %}#{{ content_id }}{% endif %}"
17
+ data-title-heading-level="{{ titleHeadingLevel|default:'h4' }}"
18
+ data-title-text="{{ titleText|default:'On this page' }}"
19
+ data-scroll-offset="{{ scrollOffset|default:0 }}"
20
+ data-root-margin="{{ rootMargin|default:'0px 0px 0px 0px' }}"
21
+ data-threshold="{{ threshold|default:1 }}"
22
+ data-minimum-heading-count="{{ minimumHeadingCount|default:2 }}"
23
+ ></aside>
24
+ <div id="{{ content_id }}" class="usx-in-page-nav__content usa-prose{% if contentClassName %} {{ contentClassName }}{% endif %}">
25
+ {{ content|safe }}
26
+ </div>
27
+ </div>
28
+ {% endwith %}
@@ -0,0 +1,183 @@
1
+ <!-- Default -->
2
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
3
+ <aside
4
+ id="in-page-nav-default"
5
+ class="usa-in-page-nav usx-in-page-nav"
6
+ data-heading-elements="h2 h3"
7
+ data-main-content-selector="#in-page-nav-default-content"
8
+ data-title-heading-level="h4"
9
+ data-title-text="On this page"
10
+ data-scroll-offset="0"
11
+ data-root-margin="0px 0px 0px 0px"
12
+ data-threshold="1"
13
+ data-minimum-heading-count="2"
14
+ ></aside>
15
+ <div id="in-page-nav-default-content" class="usx-in-page-nav__content usa-prose">
16
+ <h2>Introduction</h2>
17
+ <p>This page walks through setting up and using the example project.</p>
18
+ <p>It's also meant to demonstrate how the in-page navigation component tracks scroll
19
+ position and highlights whichever section is currently in view. Scroll down through
20
+ each section below to see the link list on the side update automatically.</p>
21
+ <p>None of the copy on this page is meant to be read closely — it exists purely to give
22
+ the navigation something substantial enough to observe.</p>
23
+ <h2>Getting started</h2>
24
+ <p>Before you begin, make sure the prerequisites below are met.</p>
25
+ <p>Getting started with any new project usually means working through a short checklist
26
+ before the real work begins. The sections below cover what you'll need and how to get
27
+ everything installed.</p>
28
+ <h3>Prerequisites</h3>
29
+ <p>A recent browser and a working internet connection.</p>
30
+ <p>You'll also want a modern code editor and enough disk space for the dependencies.
31
+ Nothing here is unusual — most standard front-end tooling already satisfies these
32
+ requirements.</p>
33
+ <p>If you already have Node.js and a package manager installed, you can skip ahead to
34
+ the installation section below.</p>
35
+ <h3>Installation</h3>
36
+ <p>Download the package and follow the setup instructions.</p>
37
+ <p>Installation typically takes just a few minutes. Run the installer, accept the
38
+ default options, and confirm that the command-line tool reports a successful install
39
+ before moving on.</p>
40
+ <p>If you run into trouble, double-check that your environment matches the
41
+ prerequisites listed above before trying again.</p>
42
+ <h2>Advanced usage</h2>
43
+ <p>Once installed, explore the configuration options to fit your workflow.</p>
44
+ <p>Advanced users can customize almost every aspect of the setup, from heading
45
+ detection to scroll offsets and intersection thresholds — all of which this component
46
+ exposes as simple data attributes.</p>
47
+ <p>Most projects never need to touch these settings, but they're available for the
48
+ cases that do.</p>
49
+ <h2>Conclusion</h2>
50
+ <p>You should now be ready to explore the rest of the documentation.</p>
51
+ <p>Thanks for reading through this example. Scroll back up and watch the navigation
52
+ list highlight each section as it passes by — that's the entire behavior this
53
+ component provides.</p>
54
+ </div>
55
+ </div>
56
+
57
+ <!-- CustomHeadingElements -->
58
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
59
+ <aside
60
+ id="in-page-nav-custom-headings"
61
+ class="usa-in-page-nav usx-in-page-nav"
62
+ data-heading-elements="h2"
63
+ data-main-content-selector="#in-page-nav-custom-headings-content"
64
+ data-title-heading-level="h4"
65
+ data-title-text="On this page"
66
+ data-scroll-offset="0"
67
+ data-root-margin="0px 0px 0px 0px"
68
+ data-threshold="1"
69
+ data-minimum-heading-count="2"
70
+ ></aside>
71
+ <div id="in-page-nav-custom-headings-content" class="usx-in-page-nav__content usa-prose">
72
+ <h2>Introduction</h2>
73
+ <p>Only top-level (h2) headings are listed in this variant.</p>
74
+ <p>Scroll through the sections below and notice that the h3 heading further down never
75
+ appears in the link list, even though its section is observed the same as any other.</p>
76
+ <h2>Getting started</h2>
77
+ <p>Before you begin, make sure the prerequisites below are met.</p>
78
+ <p>Getting started with any new project usually means working through a short checklist
79
+ before the real work begins.</p>
80
+ <h3>Prerequisites</h3>
81
+ <p>This h3 is skipped because data-heading-elements is set to "h2" only.</p>
82
+ <p>A recent browser and a working internet connection are still all you need — this
83
+ section just isn't linked from the nav.</p>
84
+ <h2>Advanced usage</h2>
85
+ <p>Once installed, explore the configuration options to fit your workflow.</p>
86
+ <p>Advanced users can customize almost every aspect of the setup, from heading
87
+ detection to scroll offsets and intersection thresholds.</p>
88
+ <h2>Conclusion</h2>
89
+ <p>You should now be ready to explore the rest of the documentation.</p>
90
+ <p>Scroll back up and watch the navigation list highlight each h2 section as it passes
91
+ by, skipping right over the h3 in between.</p>
92
+ </div>
93
+ </div>
94
+
95
+ <!-- CustomTitle -->
96
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
97
+ <aside
98
+ id="in-page-nav-custom-title"
99
+ class="usa-in-page-nav usx-in-page-nav"
100
+ data-heading-elements="h2 h3"
101
+ data-main-content-selector="#in-page-nav-custom-title-content"
102
+ data-title-heading-level="h3"
103
+ data-title-text="Jump to a section"
104
+ data-scroll-offset="0"
105
+ data-root-margin="0px 0px 0px 0px"
106
+ data-threshold="1"
107
+ data-minimum-heading-count="2"
108
+ ></aside>
109
+ <div id="in-page-nav-custom-title-content" class="usx-in-page-nav__content usa-prose">
110
+ <h2>Introduction</h2>
111
+ <p>This variant uses a custom title heading level and title text.</p>
112
+ <p>Everything else about the component behaves the same — only the heading above the
113
+ link list and its heading level have changed.</p>
114
+ <h2>Getting started</h2>
115
+ <p>Before you begin, make sure the prerequisites below are met.</p>
116
+ <p>Getting started with any new project usually means working through a short checklist
117
+ before the real work begins.</p>
118
+ <h3>Prerequisites</h3>
119
+ <p>A recent browser and a working internet connection.</p>
120
+ <p>You'll also want a modern code editor and enough disk space for the dependencies.</p>
121
+ <h2>Conclusion</h2>
122
+ <p>You should now be ready to explore the rest of the documentation.</p>
123
+ <p>Scroll back up and confirm the custom title text stays put above the link list while
124
+ the active link still updates as you pass each section.</p>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- CustomContentSelector -->
129
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
130
+ <aside
131
+ id="in-page-nav-custom-selector"
132
+ class="usa-in-page-nav usx-in-page-nav"
133
+ data-heading-elements="h2 h3"
134
+ data-main-content-selector="#in-page-nav-custom-selector-region"
135
+ data-title-heading-level="h4"
136
+ data-title-text="On this page"
137
+ data-scroll-offset="0"
138
+ data-root-margin="0px 0px 0px 0px"
139
+ data-threshold="1"
140
+ data-minimum-heading-count="2"
141
+ ></aside>
142
+ <div class="usx-in-page-nav__content usa-prose">
143
+ <h3>Heading outside the observed region</h3>
144
+ <p>This heading is not counted because it lives outside the element matched by data-main-content-selector.</p>
145
+ <div id="in-page-nav-custom-selector-region">
146
+ <h2>Introduction</h2>
147
+ <p>Only headings inside this inner region are observed.</p>
148
+ <p>The nav on the left is watching <code>#in-page-nav-custom-selector-region</code> specifically,
149
+ rather than this component's own default content container — so any heading outside that div,
150
+ including the one above, is invisible to it.</p>
151
+ <h2>Getting started</h2>
152
+ <p>Before you begin, make sure the prerequisites below are met.</p>
153
+ <p>Getting started with any new project usually means working through a short checklist
154
+ before the real work begins.</p>
155
+ <h3>Prerequisites</h3>
156
+ <p>A recent browser and a working internet connection.</p>
157
+ <p>You'll also want a modern code editor and enough disk space for the dependencies.
158
+ Scroll through this section and the two above it to watch the active link update.</p>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- BelowMinimumHeadingCount -->
164
+ <div class="usa-in-page-nav-container usx-in-page-nav-container">
165
+ <aside
166
+ id="in-page-nav-below-minimum"
167
+ class="usa-in-page-nav usx-in-page-nav"
168
+ data-heading-elements="h2 h3"
169
+ data-main-content-selector="#in-page-nav-below-minimum-content"
170
+ data-title-heading-level="h4"
171
+ data-title-text="On this page"
172
+ data-scroll-offset="0"
173
+ data-root-margin="0px 0px 0px 0px"
174
+ data-threshold="1"
175
+ data-minimum-heading-count="3"
176
+ ></aside>
177
+ <div id="in-page-nav-below-minimum-content" class="usx-in-page-nav__content usa-prose">
178
+ <h2>Introduction</h2>
179
+ <p>This content only has two headings, but data-minimum-heading-count is set to 3, so the nav does not render.</p>
180
+ <h2>Conclusion</h2>
181
+ <p>No <code>&lt;nav&gt;</code> is injected into the aside above.</p>
182
+ </div>
183
+ </div>