@pantheon-systems/pds-toolkit-react 2.0.0-alpha.7 → 2.0.0-alpha.71

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 (403) hide show
  1. package/bin/pds-codemod.cjs +58 -0
  2. package/codemods/v1-to-v2/css-token-renames.js +186 -0
  3. package/codemods/v1-to-v2/mappings.json +1787 -0
  4. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.input.tsx +33 -0
  5. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.output.tsx +33 -0
  6. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.input.tsx +8 -0
  7. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.output.tsx +8 -0
  8. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.input.tsx +55 -0
  9. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.output.tsx +55 -0
  10. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.input.tsx +60 -0
  11. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.output.tsx +60 -0
  12. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.input.tsx +35 -0
  13. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.output.tsx +35 -0
  14. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.input.tsx +8 -0
  15. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.output.tsx +8 -0
  16. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.input.tsx +28 -0
  17. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.output.tsx +28 -0
  18. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.input.tsx +8 -0
  19. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.output.tsx +8 -0
  20. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.input.tsx +37 -0
  21. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.output.tsx +37 -0
  22. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.input.tsx +21 -0
  23. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.output.tsx +21 -0
  24. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.input.tsx +60 -0
  25. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.output.tsx +51 -0
  26. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.input.tsx +8 -0
  27. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.output.tsx +8 -0
  28. package/codemods/v1-to-v2/transforms/__tests__/component-renames.test.js +15 -0
  29. package/codemods/v1-to-v2/transforms/__tests__/css-class-removals.test.js +6 -0
  30. package/codemods/v1-to-v2/transforms/__tests__/css-class-renames.test.js +6 -0
  31. package/codemods/v1-to-v2/transforms/__tests__/icon-name-updates.test.js +15 -0
  32. package/codemods/v1-to-v2/transforms/__tests__/prop-renames.test.js +15 -0
  33. package/codemods/v1-to-v2/transforms/__tests__/prop-value-standardization.test.js +16 -0
  34. package/codemods/v1-to-v2/transforms/__tests__/removed-prop-values.test.js +15 -0
  35. package/codemods/v1-to-v2/transforms/component-renames.js +166 -0
  36. package/codemods/v1-to-v2/transforms/css-class-removals.js +262 -0
  37. package/codemods/v1-to-v2/transforms/css-class-renames.js +178 -0
  38. package/codemods/v1-to-v2/transforms/icon-name-updates.js +124 -0
  39. package/codemods/v1-to-v2/transforms/prop-renames.js +109 -0
  40. package/codemods/v1-to-v2/transforms/prop-value-standardization.js +143 -0
  41. package/codemods/v1-to-v2/transforms/removed-prop-values.js +206 -0
  42. package/dist/components/Avatar/Avatar.d.ts +5 -1
  43. package/dist/components/Callout/Callout.d.ts +6 -2
  44. package/dist/components/CodeBlock/CodeBlock.d.ts +10 -5
  45. package/dist/components/CodeBlock/code-examples.d.ts +2 -1
  46. package/dist/components/CodeBlock/prism-setup.d.ts +2 -0
  47. package/dist/components/CodeBlock/themes/index.d.ts +1 -2
  48. package/dist/components/CodeBlock/themes/{pdsDark.d.ts → pds.d.ts} +1 -1
  49. package/dist/components/ComparisonList/ComparisonList.d.ts +6 -1
  50. package/dist/components/Dropdown/Dropdown.d.ts +192 -0
  51. package/dist/components/Dropdown/DropdownSelectedIcon.d.ts +7 -0
  52. package/dist/components/FileDiff/FileDiff.d.ts +2 -2
  53. package/dist/components/IdentityBlock/IdentityBlock.d.ts +37 -0
  54. package/dist/components/PantheonLogo/PantheonLogo.d.ts +5 -4
  55. package/dist/components/Popover/Popover.d.ts +5 -1
  56. package/dist/components/ResultCount/ResultCount.d.ts +53 -0
  57. package/dist/components/SiteFooter/SiteFooter.d.ts +45 -0
  58. package/dist/components/{navigation/DashboardSearch/DashboardSearch.d.ts → SiteSearch/SiteSearch.d.ts} +6 -11
  59. package/dist/components/SortableList/SortableList.d.ts +8 -0
  60. package/dist/components/SortableList/SortableListHeader.d.ts +7 -0
  61. package/dist/components/SortableList/SortableRow.d.ts +16 -0
  62. package/dist/components/SortableList/sortable-utils.d.ts +19 -0
  63. package/dist/components/SortableList/types.d.ts +142 -0
  64. package/dist/components/SortableList/useSortableTree.d.ts +18 -0
  65. package/dist/components/{RefreshChecker/RefreshChecker.d.ts → StatusChecker/StatusChecker.d.ts} +6 -19
  66. package/dist/components/StatusIndicator/StatusIndicator.d.ts +7 -4
  67. package/dist/components/Table/Table.d.ts +290 -17
  68. package/dist/components/TableOfContents/TableOfContents.d.ts +1 -5
  69. package/dist/components/Tag/Tag.d.ts +21 -3
  70. package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +29 -8
  71. package/dist/components/Tooltip/Tooltip.d.ts +6 -2
  72. package/dist/components/UtilityBar/UtilityBar.d.ts +26 -0
  73. package/dist/components/badges/Badge/Badge.d.ts +1 -1
  74. package/dist/components/badges/StatusBadge/StatusBadge.d.ts +2 -1
  75. package/dist/components/buttons/Button/Button.d.ts +15 -0
  76. package/dist/components/buttons/ButtonLink/ButtonLink.d.ts +1 -3
  77. package/dist/components/buttons/ClipboardButton/ClipboardButton.d.ts +5 -1
  78. package/dist/components/buttons/CloseButton/CloseButton.d.ts +4 -4
  79. package/dist/components/buttons/FilterButton/FilterButton.d.ts +92 -0
  80. package/dist/components/buttons/IconButton/IconButton.d.ts +12 -0
  81. package/dist/components/buttons/MenuButton/MenuButton.d.ts +24 -17
  82. package/dist/components/buttons/SSOButton/SSOButton.d.ts +9 -1
  83. package/dist/components/buttons/SegmentedButton/SegmentedButton.d.ts +44 -8
  84. package/dist/components/cards/ActionCard/ActionCard.d.ts +64 -0
  85. package/dist/components/cards/Card/Card.d.ts +10 -4
  86. package/dist/components/cards/CardSelect/CardSelect.d.ts +100 -0
  87. package/dist/components/charts/BarChart/BarChart.d.ts +21 -0
  88. package/dist/components/charts/LineChart/LineChart.d.ts +22 -0
  89. package/dist/components/charts/PieChart/PieChart.d.ts +59 -0
  90. package/dist/components/charts/ProportionBar/ProportionBar.d.ts +57 -0
  91. package/dist/components/charts/shared/ChartAccessibleTable.d.ts +17 -0
  92. package/dist/components/charts/shared/ChartLegend.d.ts +31 -0
  93. package/dist/components/charts/shared/ChartSkeleton.d.ts +11 -0
  94. package/dist/components/charts/shared/chart-colors.d.ts +30 -0
  95. package/dist/components/charts/shared/chart-styles.d.ts +24 -0
  96. package/dist/components/charts/shared/formatters.d.ts +12 -0
  97. package/dist/components/charts/shared/types.d.ts +128 -0
  98. package/dist/components/empty-states/HorizontalEmptyState/HorizontalEmptyState.d.ts +13 -8
  99. package/dist/components/icons/Icon/Icon.d.ts +2 -2
  100. package/dist/components/icons/Icon/custom-icons.d.ts +1 -1
  101. package/dist/components/icons/Icon/generated-icon-data.d.ts +212 -16
  102. package/dist/components/icons/PaymentIcon/PaymentIcon.d.ts +7 -3
  103. package/dist/components/icons/PlatformIcon/PlatformIcon.d.ts +6 -6
  104. package/dist/components/inputs/Checkbox/Checkbox.d.ts +3 -3
  105. package/dist/components/inputs/CheckboxFieldset/CheckboxFieldset.d.ts +9 -1
  106. package/dist/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +9 -1
  107. package/dist/components/inputs/Combobox/Combobox.d.ts +17 -7
  108. package/dist/components/inputs/ComboboxMultiselect/ComboboxMultiselect.d.ts +10 -5
  109. package/dist/components/inputs/Datepicker/Datepicker.d.ts +217 -14
  110. package/dist/components/inputs/FileUpload/FileUpload.d.ts +6 -1
  111. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +10 -2
  112. package/dist/components/inputs/Select/Select.d.ts +11 -2
  113. package/dist/components/inputs/Switch/Switch.d.ts +5 -5
  114. package/dist/components/inputs/TagsInput/TagsInput.d.ts +6 -1
  115. package/dist/components/inputs/TextInput/TextInput.d.ts +4 -4
  116. package/dist/components/inputs/Textarea/Textarea.d.ts +2 -2
  117. package/dist/components/inputs/Timepicker/Timepicker.d.ts +94 -0
  118. package/dist/components/inputs/input-utilities.d.ts +12 -2
  119. package/dist/components/{CTALink → links/CTALink}/CTALink.d.ts +1 -1
  120. package/dist/components/{LinkNewWindow → links/LinkNewWindow}/LinkNewWindow.d.ts +1 -1
  121. package/dist/components/loading-indicators/Spinner/Spinner.d.ts +5 -4
  122. package/dist/components/navigation/ButtonNav/ButtonNav.d.ts +11 -5
  123. package/dist/components/navigation/DropdownMenu/DropdownMenu.d.ts +1 -0
  124. package/dist/components/navigation/Navbar/Navbar.d.ts +9 -21
  125. package/dist/components/navigation/SideNav/SideNav.d.ts +7 -1
  126. package/dist/components/navigation/SideNavGlobal/SideNavGlobal.d.ts +5 -15
  127. package/dist/components/navigation/SideNavGlobal/SideNavGlobalItem.d.ts +15 -1
  128. package/dist/components/navigation/SiteMenu/SiteMenu.d.ts +26 -0
  129. package/dist/components/navigation/SiteMenu/SiteMenuDropdown.d.ts +23 -0
  130. package/dist/components/navigation/TreeNav/TreeNav.d.ts +48 -0
  131. package/dist/components/navigation/UserMenu/UserMenu.d.ts +20 -5
  132. package/dist/components/navigation/WorkspaceSelector/WorkspaceSelector.d.ts +2 -16
  133. package/dist/components/navigation/navigation-utilities.d.ts +12 -0
  134. package/dist/components/notifications/Toaster/Toast.d.ts +12 -1
  135. package/dist/components/notifications/Toaster/Toaster.d.ts +16 -7
  136. package/dist/components/notifications/Toaster/useToast.d.ts +2 -0
  137. package/dist/components/overlays/Drawer/Drawer.d.ts +58 -0
  138. package/dist/components/overlays/FullScreenOverlay/FullScreenOverlay.d.ts +45 -0
  139. package/dist/components/{Modal → overlays/Modal}/Modal.d.ts +2 -2
  140. package/dist/components/{Pagination → pagination/Pagination}/Pagination.d.ts +7 -2
  141. package/dist/components/pagination/PaginationChapter/PaginationChapter.d.ts +55 -0
  142. package/dist/components/pagination/PaginationCompact/PaginationCompact.d.ts +62 -0
  143. package/dist/components/panels/ExpansionPanel/ExpansionPanel.d.ts +1 -2
  144. package/dist/components/panels/ExpansionPanelGroup/ExpansionPanelGroup.d.ts +1 -2
  145. package/dist/components/panels/Panel/Panel.d.ts +4 -21
  146. package/dist/components/panels/PanelList/PanelList.d.ts +1 -1
  147. package/dist/components/panels/PanelStack/PanelStack.d.ts +19 -0
  148. package/dist/components/progress-indicators/ProgressBar/ProgressBar.d.ts +4 -5
  149. package/dist/components/progress-indicators/ProgressRing/ProgressRing.d.ts +12 -4
  150. package/dist/components/{FlowSteps/FlowSteps.d.ts → steppers/StepList/StepList.d.ts} +7 -7
  151. package/dist/css/component-css/pds-action-card.css +1 -0
  152. package/dist/css/component-css/pds-avatar.css +1 -1
  153. package/dist/css/component-css/pds-badge.css +1 -1
  154. package/dist/css/component-css/pds-banner.css +1 -1
  155. package/dist/css/component-css/pds-bar-chart.css +1 -0
  156. package/dist/css/component-css/pds-branch-diff.css +1 -1
  157. package/dist/css/component-css/pds-breadcrumb.css +1 -1
  158. package/dist/css/component-css/pds-button-link.css +1 -1
  159. package/dist/css/component-css/pds-button-nav.css +1 -1
  160. package/dist/css/component-css/pds-button.css +45 -13
  161. package/dist/css/component-css/pds-callout.css +1 -1
  162. package/dist/css/component-css/pds-card-select.css +2 -0
  163. package/dist/css/component-css/pds-card.css +1 -1
  164. package/dist/css/component-css/pds-chart-legend.css +1 -0
  165. package/dist/css/component-css/pds-chart-wrapper.css +1 -0
  166. package/dist/css/component-css/pds-checkbox-group.css +1 -1
  167. package/dist/css/component-css/pds-checkbox.css +1 -1
  168. package/dist/css/component-css/pds-close-button.css +1 -1
  169. package/dist/css/component-css/pds-code-block-legacy.css +1 -1
  170. package/dist/css/component-css/pds-code-block.css +1 -1
  171. package/dist/css/component-css/pds-combobox-multiselect.css +3 -2
  172. package/dist/css/component-css/pds-combobox.css +1 -1
  173. package/dist/css/component-css/pds-compact-empty-state.css +1 -1
  174. package/dist/css/component-css/pds-comparison-list.css +1 -1
  175. package/dist/css/component-css/pds-cta-link.css +1 -1
  176. package/dist/css/component-css/pds-datepicker.css +1 -3
  177. package/dist/css/component-css/pds-drawer.css +1 -0
  178. package/dist/css/component-css/pds-dropdown-menu.css +2 -2
  179. package/dist/css/component-css/pds-dropdown.css +2 -0
  180. package/dist/css/component-css/pds-expansion-panel-group.css +1 -1
  181. package/dist/css/component-css/pds-expansion-panel.css +2 -1
  182. package/dist/css/component-css/pds-file-diff.css +1 -1
  183. package/dist/css/component-css/pds-file-upload.css +3 -3
  184. package/dist/css/component-css/pds-filter-button.css +1 -0
  185. package/dist/css/component-css/pds-full-screen-overlay.css +1 -0
  186. package/dist/css/component-css/pds-horizontal-empty-state.css +1 -1
  187. package/dist/css/component-css/pds-icon-button.css +5 -3
  188. package/dist/css/component-css/pds-icon-story-only.css +1 -1
  189. package/dist/css/component-css/pds-icon.css +1 -1
  190. package/dist/css/component-css/pds-identity-block.css +1 -0
  191. package/dist/css/component-css/pds-index.css +152 -45
  192. package/dist/css/component-css/pds-inline-message.css +1 -1
  193. package/dist/css/component-css/pds-input-group.css +1 -1
  194. package/dist/css/component-css/pds-input-utilities.css +1 -1
  195. package/dist/css/component-css/pds-line-chart.css +1 -0
  196. package/dist/css/component-css/pds-link-new-window.css +1 -1
  197. package/dist/css/component-css/pds-menu-button.css +7 -1
  198. package/dist/css/component-css/pds-modal.css +1 -1
  199. package/dist/css/component-css/pds-nav-menu.css +1 -5
  200. package/dist/css/component-css/pds-navbar.css +4 -1
  201. package/dist/css/component-css/pds-pagination-chapter.css +3 -0
  202. package/dist/css/component-css/pds-pagination-compact.css +1 -0
  203. package/dist/css/component-css/pds-pagination.css +1 -1
  204. package/dist/css/component-css/pds-panel-list.css +1 -1
  205. package/dist/css/component-css/pds-panel-stack.css +1 -0
  206. package/dist/css/component-css/pds-panel.css +2 -1
  207. package/dist/css/component-css/pds-pantheon-logo.css +1 -1
  208. package/dist/css/component-css/pds-payment-icon.css +1 -1
  209. package/dist/css/component-css/pds-picture.css +1 -1
  210. package/dist/css/component-css/pds-pie-chart.css +1 -0
  211. package/dist/css/component-css/pds-platform-icon.css +1 -1
  212. package/dist/css/component-css/pds-popover.css +1 -1
  213. package/dist/css/component-css/pds-progress-bar.css +1 -1
  214. package/dist/css/component-css/pds-progress-ring.css +1 -1
  215. package/dist/css/component-css/pds-proportion-bar.css +1 -0
  216. package/dist/css/component-css/pds-radio-group.css +1 -1
  217. package/dist/css/component-css/pds-result-count.css +1 -0
  218. package/dist/css/component-css/pds-section-message.css +1 -1
  219. package/dist/css/component-css/pds-segmented-button.css +2 -1
  220. package/dist/css/component-css/pds-select.css +1 -1
  221. package/dist/css/component-css/pds-side-nav-global.css +3 -5
  222. package/dist/css/component-css/pds-side-nav.css +3 -1
  223. package/dist/css/component-css/pds-site-footer.css +1 -1
  224. package/dist/css/component-css/pds-site-search.css +1 -0
  225. package/dist/css/component-css/pds-skeleton.css +1 -1
  226. package/dist/css/component-css/pds-skiplink.css +1 -1
  227. package/dist/css/component-css/pds-sortable-list.css +8 -0
  228. package/dist/css/component-css/pds-spinner.css +1 -1
  229. package/dist/css/component-css/pds-split-button.css +1 -1
  230. package/dist/css/component-css/pds-sso-button.css +2 -2
  231. package/dist/css/component-css/pds-status-badge.css +1 -1
  232. package/dist/css/component-css/pds-status-checker.css +1 -0
  233. package/dist/css/component-css/pds-status-indicator.css +1 -1
  234. package/dist/css/component-css/pds-step-list.css +1 -0
  235. package/dist/css/component-css/pds-stepper.css +3 -1
  236. package/dist/css/component-css/pds-switch.css +6 -11
  237. package/dist/css/component-css/pds-tab-menu.css +2 -2
  238. package/dist/css/component-css/pds-table-of-contents.css +1 -1
  239. package/dist/css/component-css/pds-table.css +5 -1
  240. package/dist/css/component-css/pds-tabs.css +1 -1
  241. package/dist/css/component-css/pds-tag.css +1 -1
  242. package/dist/css/component-css/pds-tags-input.css +1 -1
  243. package/dist/css/component-css/pds-tally.css +1 -1
  244. package/dist/css/component-css/pds-text-input.css +1 -1
  245. package/dist/css/component-css/pds-textarea.css +1 -1
  246. package/dist/css/component-css/pds-theme-switcher.css +1 -1
  247. package/dist/css/component-css/pds-timepicker.css +1 -0
  248. package/dist/css/component-css/pds-toaster.css +1 -1
  249. package/dist/css/component-css/pds-tooltip.css +1 -1
  250. package/dist/css/component-css/pds-tree-nav.css +1 -0
  251. package/dist/css/component-css/pds-user-menu-story-only.css +1 -1
  252. package/dist/css/component-css/pds-user-menu.css +32 -1
  253. package/dist/css/component-css/pds-utility-bar.css +1 -0
  254. package/dist/css/component-css/pds-utility-button.css +3 -1
  255. package/dist/css/component-css/pds-vertical-empty-state.css +1 -1
  256. package/dist/css/component-css/pds-vertical-stepper.css +1 -1
  257. package/dist/css/component-css/pds-video-embed.css +1 -1
  258. package/dist/css/component-css/pds-workspace-selector.css +26 -1
  259. package/dist/css/design-tokens/variables.dark.css +385 -338
  260. package/dist/css/design-tokens/variables.global.css +10 -18
  261. package/dist/css/design-tokens/variables.light.css +376 -309
  262. package/dist/css/design-tokens/variables.typography.css +1 -2
  263. package/dist/css/layout-css/pds-app-layout.css +3 -2
  264. package/dist/css/layout-css/pds-docs-layout.css +1 -1
  265. package/dist/css/layout-css/pds-index.css +3 -9
  266. package/dist/css/layout-css/pds-sidebar-layout.css +5 -0
  267. package/dist/css/layout-css/pds-stepper-layout.css +1 -1
  268. package/dist/css/layout-css/pds-three-item-layout.css +1 -1
  269. package/dist/css/layout-css/pds-two-item-layout.css +1 -1
  270. package/dist/css/pds-components.css +152 -45
  271. package/dist/css/pds-core.css +3 -2
  272. package/dist/css/pds-layouts.css +3 -9
  273. package/dist/index.css +5 -1
  274. package/dist/index.d.ts +95 -7
  275. package/dist/index.js +12738 -4787
  276. package/dist/index.js.map +1 -1
  277. package/dist/index.source.d.ts +44 -41
  278. package/dist/layouts/AppLayout/AppLayout.d.ts +85 -10
  279. package/dist/layouts/DocsLayout/DocsLayout.d.ts +9 -7
  280. package/dist/layouts/SidebarLayout/SidebarLayout.d.ts +16 -6
  281. package/dist/layouts/StepperLayout/StepperLayout.d.ts +13 -1
  282. package/dist/layouts/ThreeItemLayout/ThreeItemLayout.d.ts +3 -3
  283. package/dist/layouts/TwoItemLayout/TwoItemLayout.d.ts +3 -3
  284. package/dist/libs/components/NavAccordion/NavAccordion.d.ts +27 -0
  285. package/dist/libs/components/StatusDot/StatusDot.d.ts +15 -0
  286. package/dist/libs/components/utils.d.ts +1 -1
  287. package/dist/libs/types/custom-types.d.ts +11 -5
  288. package/dist/libs/types/layout-types.d.ts +4 -1
  289. package/dist/libs/types/navigation-types.d.ts +17 -1
  290. package/dist/svg/anglesDown.svg +3 -0
  291. package/dist/svg/anglesUp.svg +3 -0
  292. package/dist/svg/barsStaggered.svg +3 -0
  293. package/dist/svg/bookmark.svg +3 -0
  294. package/dist/svg/bookmarkSolid.svg +3 -0
  295. package/dist/svg/box.svg +3 -0
  296. package/dist/svg/circleExclamationSolid.svg +3 -0
  297. package/dist/svg/circleHalfStroke.svg +3 -0
  298. package/dist/svg/circleInfoSolid.svg +3 -0
  299. package/dist/svg/circleQuestionSolid.svg +3 -0
  300. package/dist/svg/claude.svg +3 -0
  301. package/dist/svg/clock.svg +3 -0
  302. package/dist/svg/collapseToCenter.svg +3 -0
  303. package/dist/svg/compress.svg +3 -0
  304. package/dist/svg/diagramVenn.svg +3 -0
  305. package/dist/svg/floppyDisk.svg +3 -0
  306. package/dist/svg/grid.svg +2 -2
  307. package/dist/svg/grid2.svg +3 -0
  308. package/dist/svg/landmark.svg +3 -0
  309. package/dist/svg/move.svg +3 -0
  310. package/dist/svg/octagonExclamation.svg +3 -0
  311. package/dist/svg/openai.svg +3 -0
  312. package/dist/svg/pause.svg +3 -0
  313. package/dist/svg/penPaintbrush.svg +3 -0
  314. package/dist/svg/sidebar.svg +3 -0
  315. package/dist/svg/slider.svg +3 -0
  316. package/dist/svg/squareDashed.svg +3 -0
  317. package/dist/svg/tableColumns.svg +3 -0
  318. package/dist/svg/userSolid.svg +3 -0
  319. package/dist/{layouts → utilities}/FlexContainer/FlexContainer.d.ts +6 -6
  320. package/dist/utilities/GlobalWrapper/GlobalWrapper.d.ts +35 -0
  321. package/dist/utilities/context-providers/ThemeContext/ThemeContext.d.ts +113 -0
  322. package/dist/utilities/grid/Grid.d.ts +58 -0
  323. package/dist/utilities/grid/GridItem.d.ts +57 -0
  324. package/dist/utilities/hooks/useDropdown/index.d.ts +1 -0
  325. package/dist/utilities/hooks/useDropdown/useDropdown.d.ts +138 -0
  326. package/dist/utilities/hooks/useIsMobile/useIsMobile.d.ts +16 -0
  327. package/dist/utilities/hooks/useKeyPress/useKeyPress.d.ts +6 -0
  328. package/dist/utilities/hooks/useKeyboardShortcut/useKeyboardShortcut.d.ts +29 -0
  329. package/package.json +83 -47
  330. package/tailwind/README.md +220 -0
  331. package/tailwind/TESTING.md +457 -0
  332. package/tailwind/v3/preset.cjs +258 -0
  333. package/tailwind/v4/theme.css +230 -0
  334. package/dist/components/CTASlice/CTASlice.d.ts +0 -43
  335. package/dist/components/CodeBlock/themes/pdsLight.d.ts +0 -2
  336. package/dist/components/DashboardStat/DashboardStat.d.ts +0 -28
  337. package/dist/components/PullQuote/PullQuote.d.ts +0 -34
  338. package/dist/components/SiteDashboardHeading/SiteDashboardHeading.d.ts +0 -62
  339. package/dist/components/SocialLinks/SocialLinks.d.ts +0 -23
  340. package/dist/components/cards/CardHeading/CardHeading.d.ts +0 -31
  341. package/dist/components/cards/CardSelectGroup/CardSelectGroup.d.ts +0 -60
  342. package/dist/components/cards/EmptyStateCard/EmptyStateCard.d.ts +0 -36
  343. package/dist/components/cards/LinksCard/LinksCard.d.ts +0 -29
  344. package/dist/components/cards/LinksCard/links-card-sample-data.d.ts +0 -2
  345. package/dist/components/cards/NewSiteCard/NewSiteCard.d.ts +0 -61
  346. package/dist/components/cards/PaymentCard/PaymentCard.d.ts +0 -47
  347. package/dist/components/cards/PricingCard/PricingCard.d.ts +0 -95
  348. package/dist/components/cards/SiteCard/SiteCard.d.ts +0 -50
  349. package/dist/components/footer/FooterHeading/FooterHeading.d.ts +0 -22
  350. package/dist/components/footer/FooterLinks/FooterLinks.d.ts +0 -26
  351. package/dist/components/footer/SiteFooter/SiteFooter.d.ts +0 -34
  352. package/dist/components/footer/SiteFooter/footer-content.d.ts +0 -1
  353. package/dist/components/navigation/DashboardNav/DashboardNav.d.ts +0 -35
  354. package/dist/components/navigation/DashboardNav/DashboardNavItem.d.ts +0 -24
  355. package/dist/components/navigation/NavMenu/NavMenu.d.ts +0 -33
  356. package/dist/components/navigation/NavMenu/NavMenuDropdown.d.ts +0 -24
  357. package/dist/components/navigation/SideNavCompact/SideNavCompact.d.ts +0 -53
  358. package/dist/components/notifications/NotificationHubIcon/NotificationHubIcon.d.ts +0 -38
  359. package/dist/components/notifications/NotificationsPopover/NotificationsPopover.d.ts +0 -118
  360. package/dist/components/tiles/AvatarTileList/AvatarTileList.d.ts +0 -28
  361. package/dist/components/tiles/Tile/Tile.d.ts +0 -42
  362. package/dist/components/tiles/TileGrid/TileGrid.d.ts +0 -29
  363. package/dist/css/component-css/pds-avatar-tile-list.css +0 -1
  364. package/dist/css/component-css/pds-card-heading.css +0 -1
  365. package/dist/css/component-css/pds-card-select-group.css +0 -1
  366. package/dist/css/component-css/pds-cta-slice.css +0 -1
  367. package/dist/css/component-css/pds-dashboard-nav.css +0 -5
  368. package/dist/css/component-css/pds-dashboard-search.css +0 -1
  369. package/dist/css/component-css/pds-dashboard-stat.css +0 -1
  370. package/dist/css/component-css/pds-empty-state-card.css +0 -1
  371. package/dist/css/component-css/pds-flow-steps.css +0 -1
  372. package/dist/css/component-css/pds-footer-heading.css +0 -1
  373. package/dist/css/component-css/pds-footer-links.css +0 -1
  374. package/dist/css/component-css/pds-links-card.css +0 -1
  375. package/dist/css/component-css/pds-new-site-card.css +0 -1
  376. package/dist/css/component-css/pds-notification-hub-icon.css +0 -1
  377. package/dist/css/component-css/pds-notifications-popover.css +0 -1
  378. package/dist/css/component-css/pds-payment-card.css +0 -1
  379. package/dist/css/component-css/pds-pricing-card-local.css +0 -1
  380. package/dist/css/component-css/pds-pricing-card.css +0 -1
  381. package/dist/css/component-css/pds-pull-quote.css +0 -1
  382. package/dist/css/component-css/pds-refresh-checker.css +0 -1
  383. package/dist/css/component-css/pds-side-nav-compact.css +0 -1
  384. package/dist/css/component-css/pds-site-card.css +0 -1
  385. package/dist/css/component-css/pds-site-dashboard-heading.css +0 -1
  386. package/dist/css/component-css/pds-social-links.css +0 -1
  387. package/dist/css/component-css/pds-tile.css +0 -1
  388. package/dist/css/component-css/pds-tiles-common.css +0 -1
  389. package/dist/css/layout-css/pds-dashboard-global.css +0 -8
  390. package/dist/css/layout-css/pds-dashboard-inner.css +0 -1
  391. package/dist/css/layout-css/pds-flex-container.css +0 -1
  392. package/dist/layouts/DashboardGlobal/DashboardGlobal.d.ts +0 -57
  393. package/dist/layouts/DashboardInner/DashboardInner.d.ts +0 -30
  394. package/dist/layouts/GlobalWrapper/GlobalWrapper.d.ts +0 -19
  395. package/dist/utilities/context-providers/ResponsiveContext/ResponsiveContext.d.ts +0 -6
  396. /package/dist/components/{Skiplink → links/Skiplink}/Skiplink.d.ts +0 -0
  397. /package/dist/components/{Picture → media/Picture}/Picture.d.ts +0 -0
  398. /package/dist/components/{VideoEmbed → media/VideoEmbed}/VideoEmbed.d.ts +0 -0
  399. /package/dist/components/{Pagination → pagination/Pagination}/usePagination.d.ts +0 -0
  400. /package/dist/components/{FlowSteps → steppers/StepList}/example-steps.d.ts +0 -0
  401. /package/dist/svg/{linkSimple.svg → link.svg} +0 -0
  402. /package/dist/svg/{linkSimpleSlash.svg → unlink.svg} +0 -0
  403. /package/dist/{layouts → utilities}/Container/Container.d.ts +0 -0
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Codemod: css-class-renames
3
+ *
4
+ * Renames PDS CSS utility classes in JSX className attributes — and any
5
+ * other prop ending in "ClassName" (e.g. iconClassName, labelClassName),
6
+ * a common pattern for components with multiple styleable slots.
7
+ * Driven entirely by cssClasses.renames in mappings.json.
8
+ *
9
+ * Usage:
10
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/css-class-renames.js \
11
+ * --extensions=tsx,ts,jsx,js \
12
+ * src/
13
+ *
14
+ * Handles:
15
+ * - String literals: className="pds-overline-text foo"
16
+ * - Expression containers: className={'pds-overline-text'}
17
+ * - Template literals: className={`pds-overline-text ${styles.x}`}
18
+ * - Ternaries / logical expressions, as a bare className expression or
19
+ * nested inside a template literal's ${...} slot, as long as every
20
+ * branch reached is itself a plain string literal:
21
+ * className={isActive ? 'pds-overline-text' : 'other-class'}
22
+ * className={`base ${isEmployee ? 'pds-color-bg-info' : 'pds-color-bg-default'}`}
23
+ * className={isOpen && 'pds-overline-text'}
24
+ * - Any other *ClassName prop, matched the same way as className:
25
+ * iconClassName={isActive ? 'pds-overline-text' : 'other-class'}
26
+ *
27
+ * Does not handle:
28
+ * - CSS/SCSS files — run a find-and-replace over those separately.
29
+ * - Truly dynamic class names (a variable, function call, or any branch
30
+ * of a ternary/logical expression that isn't itself a string literal).
31
+ *
32
+ * No --only flag: CSS utility classes can appear on any element (including
33
+ * native HTML), so there is no meaningful component-level scope to filter by.
34
+ * This transform is safe to run globally.
35
+ */
36
+
37
+ const path = require('path');
38
+
39
+ const mappings = require(path.join(__dirname, '../mappings.json'));
40
+
41
+ // Build lookup: { 'oldClass': 'newClass' }
42
+ function buildRenamesLookup() {
43
+ const lookup = {};
44
+ for (const entry of mappings.cssClasses.renames) {
45
+ if (entry.old && entry.new) lookup[entry.old] = entry.new;
46
+ }
47
+ return lookup;
48
+ }
49
+
50
+ const RENAMES = buildRenamesLookup();
51
+
52
+ // Replace class names in a space-separated class string.
53
+ // Splits on whitespace and does exact token matching, so 'pds-overline-text'
54
+ // won't incorrectly mangle 'pds-overline-text--sm'.
55
+ function renameClasses(classString) {
56
+ let changed = false;
57
+ const result = classString
58
+ .split(/(\s+)/)
59
+ .map((token) => {
60
+ // Preserve whitespace tokens unchanged
61
+ if (/^\s+$/.test(token) || token === '') return token;
62
+ const renamed = RENAMES[token];
63
+ if (renamed) {
64
+ changed = true;
65
+ return renamed;
66
+ }
67
+ return token;
68
+ })
69
+ .join('');
70
+ return { result, changed };
71
+ }
72
+
73
+ // Recursively rename any string-literal branch reachable from `node` without
74
+ // crossing into a non-literal value — i.e. it descends into ternaries
75
+ // (ConditionalExpression) and logical expressions (&&/||), renaming each
76
+ // branch that is itself a string literal, but leaves anything else (a
77
+ // variable, a function call, a member expression, ...) untouched since its
78
+ // value isn't knowable statically. Returns the (possibly replaced) node and
79
+ // whether anything changed; does not mutate in place, so callers must
80
+ // reassign the returned node back onto its parent.
81
+ function renameStringLiteralBranches(node, j) {
82
+ if (!node) return { node, changed: false };
83
+
84
+ if (node.type === 'StringLiteral' || node.type === 'Literal') {
85
+ const { changed, result } = renameClasses(node.value);
86
+ return changed
87
+ ? { node: j.stringLiteral(result), changed: true }
88
+ : { node, changed: false };
89
+ }
90
+
91
+ if (node.type === 'ConditionalExpression') {
92
+ const consequent = renameStringLiteralBranches(node.consequent, j);
93
+ const alternate = renameStringLiteralBranches(node.alternate, j);
94
+ if (consequent.changed) node.consequent = consequent.node;
95
+ if (alternate.changed) node.alternate = alternate.node;
96
+ return { node, changed: consequent.changed || alternate.changed };
97
+ }
98
+
99
+ if (node.type === 'LogicalExpression') {
100
+ const left = renameStringLiteralBranches(node.left, j);
101
+ const right = renameStringLiteralBranches(node.right, j);
102
+ if (left.changed) node.left = left.node;
103
+ if (right.changed) node.right = right.node;
104
+ return { node, changed: left.changed || right.changed };
105
+ }
106
+
107
+ return { node, changed: false };
108
+ }
109
+
110
+ module.exports = function transform(file, api) {
111
+ const j = api.jscodeshift;
112
+ const root = j(file.source);
113
+
114
+ if (Object.keys(RENAMES).length === 0) return;
115
+
116
+ let changed = false;
117
+
118
+ root
119
+ .find(j.JSXAttribute)
120
+ .filter((nodePath) => /className$/i.test(nodePath.node.name.name))
121
+ .forEach((nodePath) => {
122
+ const { value } = nodePath.node;
123
+ if (!value) return;
124
+
125
+ // className="pds-overline-text foo"
126
+ if (value.type === 'StringLiteral') {
127
+ const { changed: c, result } = renameClasses(value.value);
128
+ if (c) {
129
+ nodePath.node.value = j.stringLiteral(result);
130
+ changed = true;
131
+ }
132
+ return;
133
+ }
134
+
135
+ if (value.type !== 'JSXExpressionContainer') return;
136
+ const { expression } = value;
137
+
138
+ // className={`pds-overline-text ${isActive ? 'a' : 'b'}`}
139
+ if (expression.type === 'TemplateLiteral') {
140
+ expression.quasis.forEach((quasi) => {
141
+ const { changed: c, result } = renameClasses(quasi.value.raw);
142
+ if (c) {
143
+ quasi.value.raw = result;
144
+ quasi.value.cooked = result;
145
+ changed = true;
146
+ }
147
+ });
148
+
149
+ expression.expressions.forEach((expr, index) => {
150
+ const { changed: c, node: renamed } = renameStringLiteralBranches(
151
+ expr,
152
+ j,
153
+ );
154
+ if (c) {
155
+ expression.expressions[index] = renamed;
156
+ changed = true;
157
+ }
158
+ });
159
+ return;
160
+ }
161
+
162
+ // className={'pds-overline-text'}
163
+ // className={isActive ? 'pds-overline-text' : 'other-class'}
164
+ // className={isOpen && 'pds-overline-text'}
165
+ const { changed: c, node: renamed } = renameStringLiteralBranches(
166
+ expression,
167
+ j,
168
+ );
169
+ if (c) {
170
+ value.expression = renamed;
171
+ changed = true;
172
+ }
173
+ });
174
+
175
+ return changed ? root.toSource() : undefined;
176
+ };
177
+
178
+ module.exports.parser = 'tsx';
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Codemod: icon-name-updates
3
+ *
4
+ * Rewrites removed icon names to their v2 equivalents on any PDS component
5
+ * that accepts an `iconName` prop.
6
+ *
7
+ * The icon registry is shared across all components, so any component using
8
+ * a renamed icon name (e.g. Button, ButtonLink, IconButton, Alert, etc.)
9
+ * needs updating — not just the Icon component itself.
10
+ *
11
+ * Driven by props.typeChanges[prop=iconName].migration in mappings.json.
12
+ *
13
+ * Usage (all components):
14
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/icon-name-updates.js \
15
+ * --extensions=tsx,ts,jsx,js \
16
+ * src/
17
+ *
18
+ * Usage (single component — recommended for by-component migrations):
19
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/icon-name-updates.js \
20
+ * --only=Button \
21
+ * --extensions=tsx,ts,jsx,js \
22
+ * src/
23
+ *
24
+ * Limitations:
25
+ * - Only static string literals and JSX expression containers are
26
+ * transformed. Dynamic values (variables, expressions) are left as-is
27
+ * and need manual review.
28
+ */
29
+
30
+ const path = require('path');
31
+ const mappings = require(path.join(__dirname, '../mappings.json'));
32
+
33
+ // Build a flat map of oldIconName → newIconName from all iconName typeChanges
34
+ function buildIconNameMap() {
35
+ const map = {};
36
+ for (const entry of mappings.props.typeChanges) {
37
+ if (entry.prop !== 'iconName' || !entry.migration) continue;
38
+ for (const [from, to] of Object.entries(entry.migration)) {
39
+ if (from === 'note') continue;
40
+ const cleanTo = to.split(' ')[0];
41
+ if (cleanTo !== from) map[from] = cleanTo;
42
+ }
43
+ }
44
+ return map;
45
+ }
46
+
47
+ const ICON_NAME_MAP = buildIconNameMap();
48
+
49
+ module.exports = function transform(file, api, options) {
50
+ const j = api.jscodeshift;
51
+ const root = j(file.source);
52
+
53
+ if (Object.keys(ICON_NAME_MAP).length === 0) return;
54
+
55
+ // Parse --only flag: comma-separated component names
56
+ const onlyComponents =
57
+ options && options.only
58
+ ? new Set(
59
+ options.only
60
+ .split(',')
61
+ .map((s) => s.trim())
62
+ .filter(Boolean),
63
+ )
64
+ : null;
65
+
66
+ // Map local import name → exported component name
67
+ const localToExported = new Map();
68
+
69
+ root.find(j.ImportDeclaration).forEach((nodePath) => {
70
+ if (nodePath.node.source.value !== '@pantheon-systems/pds-toolkit-react')
71
+ return;
72
+ nodePath.node.specifiers.forEach((spec) => {
73
+ if (spec.type === 'ImportSpecifier') {
74
+ localToExported.set(spec.local.name, spec.imported.name);
75
+ }
76
+ });
77
+ });
78
+
79
+ if (localToExported.size === 0) return;
80
+
81
+ let changed = false;
82
+
83
+ root.find(j.JSXOpeningElement).forEach((nodePath) => {
84
+ const nameNode = nodePath.node.name;
85
+ if (nameNode.type !== 'JSXIdentifier') return;
86
+
87
+ const exportedName = localToExported.get(nameNode.name);
88
+ if (!exportedName) return;
89
+
90
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
91
+
92
+ nodePath.node.attributes.forEach((attr) => {
93
+ if (attr.type !== 'JSXAttribute') return;
94
+ if (attr.name.name !== 'iconName') return;
95
+ if (!attr.value) return;
96
+
97
+ // iconName="circlePlusOutline"
98
+ if (attr.value.type === 'StringLiteral') {
99
+ const newName = ICON_NAME_MAP[attr.value.value];
100
+ if (newName) {
101
+ attr.value = j.stringLiteral(newName);
102
+ changed = true;
103
+ }
104
+ return;
105
+ }
106
+
107
+ // iconName={"circlePlusOutline"}
108
+ if (
109
+ attr.value.type === 'JSXExpressionContainer' &&
110
+ attr.value.expression.type === 'StringLiteral'
111
+ ) {
112
+ const newName = ICON_NAME_MAP[attr.value.expression.value];
113
+ if (newName) {
114
+ attr.value.expression = j.stringLiteral(newName);
115
+ changed = true;
116
+ }
117
+ }
118
+ });
119
+ });
120
+
121
+ return changed ? root.toSource() : undefined;
122
+ };
123
+
124
+ module.exports.parser = 'tsx';
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Codemod: prop-renames
3
+ *
4
+ * Renames PDS v1 prop names to their v2 names on JSX elements.
5
+ * Driven entirely by props.renames in mappings.json.
6
+ *
7
+ * Usage (all renames):
8
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
9
+ * --extensions=tsx,ts,jsx,js \
10
+ * src/
11
+ *
12
+ * Usage (single component — recommended for by-component migrations):
13
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
14
+ * --only=Button \
15
+ * --extensions=tsx,ts,jsx,js \
16
+ * src/
17
+ *
18
+ * Usage (multiple components):
19
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
20
+ * --only=Button,Icon \
21
+ * --extensions=tsx,ts,jsx,js \
22
+ * src/
23
+ *
24
+ * --only accepts a comma-separated list of component names.
25
+ *
26
+ * Limitations:
27
+ * - Renames where `from` is a nested path (e.g. `options[].description`)
28
+ * cannot be transformed at the JSX attribute level and are skipped.
29
+ * These require manual review.
30
+ */
31
+
32
+ const path = require('path');
33
+ const mappings = require(path.join(__dirname, '../mappings.json'));
34
+
35
+ // Build lookup: { 'ComponentName.oldPropName': 'newPropName' }
36
+ // Skips entries where `from` is a nested path (contains '.' or '[]').
37
+ function buildRenamesLookup() {
38
+ const lookup = {};
39
+ for (const entry of mappings.props.renames) {
40
+ const { component, from, to } = entry;
41
+ if (!component || !from || !to) continue;
42
+ // Skip nested paths — these can't be transformed at the attribute level
43
+ if (from.includes('.') || from.includes('[')) continue;
44
+ lookup[`${component}.${from}`] = to;
45
+ }
46
+ return lookup;
47
+ }
48
+
49
+ const ALL_RENAMES = buildRenamesLookup();
50
+
51
+ module.exports = function transform(file, api, options) {
52
+ const j = api.jscodeshift;
53
+ const root = j(file.source);
54
+
55
+ // Parse --only flag: comma-separated component names
56
+ const onlyComponents =
57
+ options && options.only
58
+ ? new Set(
59
+ options.only
60
+ .split(',')
61
+ .map((s) => s.trim())
62
+ .filter(Boolean),
63
+ )
64
+ : null;
65
+
66
+ // Map local import name → exported component name
67
+ const localToExported = new Map();
68
+
69
+ root.find(j.ImportDeclaration).forEach((nodePath) => {
70
+ if (nodePath.node.source.value !== '@pantheon-systems/pds-toolkit-react')
71
+ return;
72
+ nodePath.node.specifiers.forEach((spec) => {
73
+ if (spec.type === 'ImportSpecifier') {
74
+ localToExported.set(spec.local.name, spec.imported.name);
75
+ }
76
+ });
77
+ });
78
+
79
+ if (localToExported.size === 0) return;
80
+
81
+ let changed = false;
82
+
83
+ root.find(j.JSXOpeningElement).forEach((nodePath) => {
84
+ const nameNode = nodePath.node.name;
85
+ if (nameNode.type !== 'JSXIdentifier') return;
86
+
87
+ const exportedName = localToExported.get(nameNode.name);
88
+ if (!exportedName) return;
89
+
90
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
91
+
92
+ nodePath.node.attributes.forEach((attr) => {
93
+ if (attr.type !== 'JSXAttribute') return;
94
+
95
+ const propName = attr.name.name;
96
+ if (typeof propName !== 'string') return;
97
+
98
+ const newPropName = ALL_RENAMES[`${exportedName}.${propName}`];
99
+ if (!newPropName) return;
100
+
101
+ attr.name = j.jsxIdentifier(newPropName);
102
+ changed = true;
103
+ });
104
+ });
105
+
106
+ return changed ? root.toSource() : undefined;
107
+ };
108
+
109
+ module.exports.parser = 'tsx';
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Codemod: prop-value-standardization
3
+ *
4
+ * Standardizes size-related prop values across PDS v1→v2.
5
+ * Driven entirely by props.typeChanges[].migration in mappings.json.
6
+ *
7
+ * Usage (all components):
8
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
9
+ * --extensions=tsx,ts,jsx,js \
10
+ * src/
11
+ *
12
+ * Usage (single component — recommended for by-component migrations):
13
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
14
+ * --only=Spinner \
15
+ * --extensions=tsx,ts,jsx,js \
16
+ * src/
17
+ *
18
+ * Usage (multiple components):
19
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
20
+ * --only=Spinner,Avatar \
21
+ * --extensions=tsx,ts,jsx,js \
22
+ * src/
23
+ *
24
+ * --only accepts a comma-separated list of exported component names. When
25
+ * provided, only rules for those components are applied. This prevents the
26
+ * transform from rewriting size values on components that are still on V1.
27
+ */
28
+
29
+ const path = require('path');
30
+ const mappings = require(path.join(__dirname, '../mappings.json'));
31
+
32
+ // Build lookup: { 'ComponentName.propName': { oldValue: newValue } }
33
+ // Skips entries that are notes or no-ops.
34
+ function buildMigrationLookup() {
35
+ const lookup = {};
36
+
37
+ for (const entry of mappings.props.typeChanges) {
38
+ const { component, prop, migration } = entry;
39
+ if (!migration || typeof migration !== 'object' || Array.isArray(migration))
40
+ continue;
41
+
42
+ const map = {};
43
+ for (const [from, to] of Object.entries(migration)) {
44
+ if (from === 'note') continue;
45
+ // Strip parenthetical notes e.g. "s (removed, use 's' instead)" → "s"
46
+ const cleanTo = to.split(' ')[0];
47
+ // Skip no-op entries where value is unchanged
48
+ if (cleanTo === from) continue;
49
+ map[from] = cleanTo;
50
+ }
51
+
52
+ if (Object.keys(map).length > 0) {
53
+ lookup[`${component}.${prop}`] = map;
54
+ }
55
+ }
56
+
57
+ return lookup;
58
+ }
59
+
60
+ const MIGRATION_LOOKUP = buildMigrationLookup();
61
+
62
+ module.exports = function transform(file, api, options) {
63
+ const j = api.jscodeshift;
64
+ const root = j(file.source);
65
+
66
+ // Parse --only flag into a Set of component names for O(1) lookup.
67
+ // Accepts comma-separated values: --only=Spinner,Avatar
68
+ const onlyComponents =
69
+ options && options.only
70
+ ? new Set(
71
+ options.only
72
+ .split(',')
73
+ .map((s) => s.trim())
74
+ .filter(Boolean),
75
+ )
76
+ : null;
77
+
78
+ // Map local import name → exported component name
79
+ // Handles aliased imports: import { Spinner as MySpinner } → { MySpinner: 'Spinner' }
80
+ const localToExported = new Map();
81
+
82
+ root.find(j.ImportDeclaration).forEach((nodePath) => {
83
+ if (nodePath.node.source.value !== '@pantheon-systems/pds-toolkit-react')
84
+ return;
85
+ nodePath.node.specifiers.forEach((spec) => {
86
+ if (spec.type === 'ImportSpecifier') {
87
+ localToExported.set(spec.local.name, spec.imported.name);
88
+ }
89
+ });
90
+ });
91
+
92
+ if (localToExported.size === 0) return;
93
+
94
+ let changed = false;
95
+
96
+ root.find(j.JSXOpeningElement).forEach((nodePath) => {
97
+ const nameNode = nodePath.node.name;
98
+ // Skip member expressions like <Foo.Bar />
99
+ if (nameNode.type !== 'JSXIdentifier') return;
100
+
101
+ const exportedName = localToExported.get(nameNode.name);
102
+ if (!exportedName) return;
103
+
104
+ // Skip this component if --only is set and it isn't in the list
105
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
106
+
107
+ nodePath.node.attributes.forEach((attr) => {
108
+ if (attr.type !== 'JSXAttribute' || !attr.value) return;
109
+
110
+ const propName = attr.name.name;
111
+ if (typeof propName !== 'string') return;
112
+
113
+ const map = MIGRATION_LOOKUP[`${exportedName}.${propName}`];
114
+ if (!map) return;
115
+
116
+ // size="sm"
117
+ if (attr.value.type === 'StringLiteral') {
118
+ const newValue = map[attr.value.value];
119
+ if (newValue) {
120
+ attr.value = j.stringLiteral(newValue);
121
+ changed = true;
122
+ }
123
+ return;
124
+ }
125
+
126
+ // size={"sm"}
127
+ if (
128
+ attr.value.type === 'JSXExpressionContainer' &&
129
+ attr.value.expression.type === 'StringLiteral'
130
+ ) {
131
+ const newValue = map[attr.value.expression.value];
132
+ if (newValue) {
133
+ attr.value.expression = j.stringLiteral(newValue);
134
+ changed = true;
135
+ }
136
+ }
137
+ });
138
+ });
139
+
140
+ return changed ? root.toSource() : undefined;
141
+ };
142
+
143
+ module.exports.parser = 'tsx';