@pantheon-systems/pds-toolkit-react 2.0.0-alpha.4 → 2.0.0-alpha.41
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.
- package/bin/pds-codemod.cjs +58 -0
- package/codemods/v1-to-v2/mappings.json +1602 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.input.tsx +33 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.output.tsx +33 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.input.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.output.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.input.tsx +31 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.output.tsx +31 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.input.tsx +31 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.output.tsx +31 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.input.tsx +35 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.output.tsx +35 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.input.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.output.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.input.tsx +28 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.output.tsx +28 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.input.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.output.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.input.tsx +36 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.output.tsx +36 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.input.tsx +21 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.output.tsx +21 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.input.tsx +60 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.output.tsx +51 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.input.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.output.tsx +8 -0
- package/codemods/v1-to-v2/transforms/__tests__/component-renames.test.js +15 -0
- package/codemods/v1-to-v2/transforms/__tests__/css-class-removals.test.js +6 -0
- package/codemods/v1-to-v2/transforms/__tests__/css-class-renames.test.js +6 -0
- package/codemods/v1-to-v2/transforms/__tests__/icon-name-updates.test.js +15 -0
- package/codemods/v1-to-v2/transforms/__tests__/prop-renames.test.js +15 -0
- package/codemods/v1-to-v2/transforms/__tests__/prop-value-standardization.test.js +16 -0
- package/codemods/v1-to-v2/transforms/__tests__/removed-prop-values.test.js +15 -0
- package/codemods/v1-to-v2/transforms/component-renames.js +166 -0
- package/codemods/v1-to-v2/transforms/css-class-removals.js +192 -0
- package/codemods/v1-to-v2/transforms/css-class-renames.js +114 -0
- package/codemods/v1-to-v2/transforms/icon-name-updates.js +124 -0
- package/codemods/v1-to-v2/transforms/prop-renames.js +109 -0
- package/codemods/v1-to-v2/transforms/prop-value-standardization.js +143 -0
- package/codemods/v1-to-v2/transforms/removed-prop-values.js +206 -0
- package/dist/components/Avatar/Avatar.d.ts +6 -2
- package/dist/components/Callout/Callout.d.ts +6 -2
- package/dist/components/CodeBlock/CodeBlock.d.ts +10 -5
- package/dist/components/CodeBlock/code-examples.d.ts +2 -1
- package/dist/components/CodeBlock/themes/index.d.ts +1 -2
- package/dist/components/CodeBlock/themes/{pdsDark.d.ts → pds.d.ts} +1 -1
- package/dist/components/ComparisonList/ComparisonList.d.ts +6 -1
- package/dist/components/Dropdown/Dropdown.d.ts +186 -0
- package/dist/components/Dropdown/DropdownSelectedIcon.d.ts +7 -0
- package/dist/components/FileDiff/FileDiff.d.ts +2 -2
- package/dist/components/IdentityBlock/IdentityBlock.d.ts +37 -0
- package/dist/components/PantheonLogo/PantheonLogo.d.ts +5 -4
- package/dist/components/Popover/Popover.d.ts +5 -1
- package/dist/components/SiteFooter/SiteFooter.d.ts +41 -0
- package/dist/components/{navigation/DashboardSearch/DashboardSearch.d.ts → SiteSearch/SiteSearch.d.ts} +6 -11
- package/dist/components/SortableList/SortableList.d.ts +8 -0
- package/dist/components/SortableList/SortableListHeader.d.ts +7 -0
- package/dist/components/SortableList/SortableRow.d.ts +16 -0
- package/dist/components/SortableList/sortable-utils.d.ts +19 -0
- package/dist/components/SortableList/types.d.ts +142 -0
- package/dist/components/SortableList/useSortableTree.d.ts +18 -0
- package/dist/components/{RefreshChecker/RefreshChecker.d.ts → StatusChecker/StatusChecker.d.ts} +5 -19
- package/dist/components/StatusIndicator/StatusIndicator.d.ts +8 -5
- package/dist/components/Table/Table.d.ts +247 -17
- package/dist/components/TableOfContents/TableOfContents.d.ts +1 -5
- package/dist/components/Tag/Tag.d.ts +17 -3
- package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +29 -8
- package/dist/components/Tooltip/Tooltip.d.ts +6 -2
- package/dist/components/UtilityBar/UtilityBar.d.ts +26 -0
- package/dist/components/badges/Badge/Badge.d.ts +28 -0
- package/dist/components/badges/StatusBadge/StatusBadge.d.ts +2 -1
- package/dist/components/buttons/Button/Button.d.ts +15 -0
- package/dist/components/buttons/ButtonLink/ButtonLink.d.ts +1 -3
- package/dist/components/buttons/ClipboardButton/ClipboardButton.d.ts +5 -1
- package/dist/components/buttons/CloseButton/CloseButton.d.ts +4 -4
- package/dist/components/buttons/FilterButton/FilterButton.d.ts +82 -0
- package/dist/components/buttons/IconButton/IconButton.d.ts +12 -0
- package/dist/components/buttons/MenuButton/MenuButton.d.ts +21 -13
- package/dist/components/buttons/SegmentedButton/SegmentedButton.d.ts +44 -8
- package/dist/components/cards/ActionCard/ActionCard.d.ts +64 -0
- package/dist/components/cards/Card/Card.d.ts +11 -4
- package/dist/components/cards/{CardSelectGroup/CardSelectGroup.d.ts → CardSelect/CardSelect.d.ts} +13 -8
- package/dist/components/charts/BarChart/BarChart.d.ts +21 -0
- package/dist/components/charts/LineChart/LineChart.d.ts +22 -0
- package/dist/components/charts/PieChart/PieChart.d.ts +59 -0
- package/dist/components/charts/ProportionBar/ProportionBar.d.ts +57 -0
- package/dist/components/charts/shared/ChartAccessibleTable.d.ts +17 -0
- package/dist/components/charts/shared/ChartLegend.d.ts +25 -0
- package/dist/components/charts/shared/ChartSkeleton.d.ts +11 -0
- package/dist/components/charts/shared/chart-colors.d.ts +30 -0
- package/dist/components/charts/shared/chart-styles.d.ts +16 -0
- package/dist/components/charts/shared/formatters.d.ts +12 -0
- package/dist/components/charts/shared/types.d.ts +128 -0
- package/dist/components/empty-states/HorizontalEmptyState/HorizontalEmptyState.d.ts +1 -1
- package/dist/components/icons/Icon/Icon.d.ts +2 -2
- package/dist/components/icons/Icon/custom-icons.d.ts +1 -1
- package/dist/components/icons/Icon/generated-icon-data.d.ts +191 -16
- package/dist/components/icons/PaymentIcon/PaymentIcon.d.ts +7 -3
- package/dist/components/icons/PlatformIcon/PlatformIcon.d.ts +6 -6
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/inputs/Combobox/Combobox.d.ts +17 -7
- package/dist/components/inputs/ComboboxMultiselect/ComboboxMultiselect.d.ts +10 -5
- package/dist/components/inputs/Datepicker/Datepicker.d.ts +31 -8
- package/dist/components/inputs/FileUpload/FileUpload.d.ts +6 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/inputs/Select/Select.d.ts +11 -2
- package/dist/components/inputs/Select/select-sample-data.d.ts +1 -0
- package/dist/components/inputs/Switch/Switch.d.ts +1 -17
- package/dist/components/inputs/TagsInput/TagsInput.d.ts +6 -1
- package/dist/components/inputs/TextInput/TextInput.d.ts +5 -1
- package/dist/components/inputs/Textarea/Textarea.d.ts +5 -1
- package/dist/components/inputs/input-utilities.d.ts +5 -4
- package/dist/components/{CTALink → links/CTALink}/CTALink.d.ts +1 -1
- package/dist/components/{LinkNewWindow → links/LinkNewWindow}/LinkNewWindow.d.ts +1 -1
- package/dist/components/loading-indicators/Spinner/Spinner.d.ts +5 -4
- package/dist/components/navigation/ButtonNav/ButtonNav.d.ts +5 -5
- package/dist/components/navigation/DropdownMenu/DropdownMenu.d.ts +1 -0
- package/dist/components/navigation/Navbar/Navbar.d.ts +9 -21
- package/dist/components/navigation/SideNav/SideNav.d.ts +7 -1
- package/dist/components/navigation/SideNavGlobal/SideNavGlobal.d.ts +5 -15
- package/dist/components/navigation/SideNavGlobal/SideNavGlobalItem.d.ts +15 -1
- package/dist/components/navigation/SiteMenu/SiteMenu.d.ts +26 -0
- package/dist/components/navigation/SiteMenu/SiteMenuDropdown.d.ts +23 -0
- package/dist/components/navigation/TreeNav/TreeNav.d.ts +48 -0
- package/dist/components/navigation/UserMenu/UserMenu.d.ts +20 -5
- package/dist/components/navigation/WorkspaceSelector/WorkspaceSelector.d.ts +2 -17
- package/dist/components/navigation/navigation-utilities.d.ts +12 -0
- package/dist/components/notifications/Banner/Banner.d.ts +6 -2
- package/dist/components/notifications/SectionMessage/SectionMessage.d.ts +6 -2
- package/dist/components/notifications/Toaster/Toast.d.ts +12 -1
- package/dist/components/notifications/Toaster/Toaster.d.ts +16 -7
- package/dist/components/notifications/Toaster/useToast.d.ts +2 -0
- package/dist/components/overlays/Drawer/Drawer.d.ts +58 -0
- package/dist/components/overlays/FullScreenOverlay/FullScreenOverlay.d.ts +45 -0
- package/dist/components/{Modal → overlays/Modal}/Modal.d.ts +1 -1
- package/dist/components/{Pagination → pagination/Pagination}/Pagination.d.ts +7 -2
- package/dist/components/pagination/PaginationCompact/PaginationCompact.d.ts +49 -0
- package/dist/components/pagination/PaginationMini/PaginationMini.d.ts +55 -0
- package/dist/components/panels/ExpansionPanel/ExpansionPanel.d.ts +1 -2
- package/dist/components/panels/ExpansionPanelGroup/ExpansionPanelGroup.d.ts +1 -2
- package/dist/components/panels/Panel/Panel.d.ts +4 -21
- package/dist/components/panels/PanelList/PanelList.d.ts +1 -1
- package/dist/components/progress-indicators/ProgressBar/ProgressBar.d.ts +4 -5
- package/dist/components/progress-indicators/ProgressRing/ProgressRing.d.ts +12 -4
- package/dist/components/{FlowSteps/FlowSteps.d.ts → steppers/StepList/StepList.d.ts} +7 -7
- package/dist/css/component-css/pds-action-card.css +1 -0
- package/dist/css/component-css/pds-avatar.css +1 -1
- package/dist/css/component-css/pds-badge.css +1 -0
- package/dist/css/component-css/pds-banner.css +1 -1
- package/dist/css/component-css/pds-bar-chart.css +1 -0
- package/dist/css/component-css/pds-branch-diff.css +1 -1
- package/dist/css/component-css/pds-breadcrumb.css +1 -1
- package/dist/css/component-css/pds-button-link.css +1 -1
- package/dist/css/component-css/pds-button-nav.css +1 -1
- package/dist/css/component-css/pds-button.css +44 -12
- package/dist/css/component-css/pds-callout.css +1 -1
- package/dist/css/component-css/pds-card-select.css +1 -0
- package/dist/css/component-css/pds-card.css +1 -1
- package/dist/css/component-css/pds-chart-legend.css +1 -0
- package/dist/css/component-css/pds-chart-wrapper.css +1 -0
- package/dist/css/component-css/pds-checkbox.css +1 -1
- package/dist/css/component-css/pds-close-button.css +1 -1
- package/dist/css/component-css/pds-code-block.css +1 -1
- package/dist/css/component-css/pds-combobox-multiselect.css +3 -2
- package/dist/css/component-css/pds-combobox.css +1 -1
- package/dist/css/component-css/pds-compact-empty-state.css +1 -1
- package/dist/css/component-css/pds-comparison-list.css +1 -1
- package/dist/css/component-css/pds-cta-link.css +1 -1
- package/dist/css/component-css/pds-datepicker.css +5 -3
- package/dist/css/component-css/pds-drawer.css +1 -0
- package/dist/css/component-css/pds-dropdown-menu.css +2 -2
- package/dist/css/component-css/pds-dropdown.css +2 -0
- package/dist/css/component-css/pds-expansion-panel.css +1 -1
- package/dist/css/component-css/pds-file-diff.css +1 -1
- package/dist/css/component-css/pds-file-upload.css +3 -3
- package/dist/css/component-css/pds-filter-button.css +1 -0
- package/dist/css/component-css/pds-full-screen-overlay.css +1 -0
- package/dist/css/component-css/pds-horizontal-empty-state.css +1 -1
- package/dist/css/component-css/pds-icon-button.css +6 -4
- package/dist/css/component-css/pds-icon.css +1 -1
- package/dist/css/component-css/pds-identity-block.css +1 -0
- package/dist/css/component-css/pds-index.css +150 -70
- package/dist/css/component-css/pds-inline-message.css +1 -1
- package/dist/css/component-css/pds-input-group.css +1 -1
- package/dist/css/component-css/pds-input-utilities.css +1 -1
- package/dist/css/component-css/pds-line-chart.css +1 -0
- package/dist/css/component-css/pds-link-new-window.css +1 -1
- package/dist/css/component-css/pds-menu-button.css +7 -1
- package/dist/css/component-css/pds-modal.css +1 -1
- package/dist/css/component-css/pds-nav-menu.css +1 -5
- package/dist/css/component-css/pds-navbar.css +4 -1
- package/dist/css/component-css/pds-pagination-compact.css +1 -0
- package/dist/css/component-css/pds-pagination-mini.css +3 -0
- package/dist/css/component-css/pds-pagination.css +1 -1
- package/dist/css/component-css/pds-panel-list.css +1 -1
- package/dist/css/component-css/pds-panel.css +1 -1
- package/dist/css/component-css/pds-pantheon-logo.css +1 -1
- package/dist/css/component-css/pds-payment-icon.css +1 -1
- package/dist/css/component-css/pds-pie-chart.css +1 -0
- package/dist/css/component-css/pds-platform-icon.css +1 -1
- package/dist/css/component-css/pds-popover.css +1 -1
- package/dist/css/component-css/pds-progress-bar.css +1 -1
- package/dist/css/component-css/pds-progress-ring.css +1 -1
- package/dist/css/component-css/pds-proportion-bar.css +1 -0
- package/dist/css/component-css/pds-radio-group.css +1 -1
- package/dist/css/component-css/pds-section-message.css +1 -1
- package/dist/css/component-css/pds-segmented-button.css +2 -1
- package/dist/css/component-css/pds-select.css +1 -1
- package/dist/css/component-css/pds-side-nav-global.css +2 -4
- package/dist/css/component-css/pds-side-nav.css +3 -1
- package/dist/css/component-css/pds-site-footer.css +1 -1
- package/dist/css/component-css/pds-site-search.css +1 -0
- package/dist/css/component-css/pds-skeleton.css +1 -1
- package/dist/css/component-css/pds-skiplink.css +1 -1
- package/dist/css/component-css/pds-sortable-list.css +8 -0
- package/dist/css/component-css/pds-spinner.css +1 -1
- package/dist/css/component-css/pds-split-button.css +1 -1
- package/dist/css/component-css/pds-sso-button.css +1 -1
- package/dist/css/component-css/pds-status-badge.css +1 -1
- package/dist/css/component-css/pds-status-checker.css +1 -0
- package/dist/css/component-css/pds-status-indicator.css +1 -1
- package/dist/css/component-css/pds-step-list.css +1 -0
- package/dist/css/component-css/pds-stepper.css +3 -1
- package/dist/css/component-css/pds-switch.css +4 -11
- package/dist/css/component-css/pds-tab-menu.css +2 -2
- package/dist/css/component-css/pds-table-of-contents.css +1 -1
- package/dist/css/component-css/pds-table.css +3 -1
- package/dist/css/component-css/pds-tabs.css +1 -1
- package/dist/css/component-css/pds-tag.css +1 -1
- package/dist/css/component-css/pds-tags-input.css +1 -1
- package/dist/css/component-css/pds-tally.css +1 -1
- package/dist/css/component-css/pds-text-input.css +1 -1
- package/dist/css/component-css/pds-textarea.css +1 -1
- package/dist/css/component-css/pds-theme-switcher.css +1 -1
- package/dist/css/component-css/pds-toaster.css +1 -1
- package/dist/css/component-css/pds-tooltip.css +1 -1
- package/dist/css/component-css/pds-tree-nav.css +1 -0
- package/dist/css/component-css/pds-user-menu.css +32 -1
- package/dist/css/component-css/pds-utility-bar.css +1 -0
- package/dist/css/component-css/pds-utility-button.css +3 -1
- package/dist/css/component-css/pds-vertical-empty-state.css +1 -1
- package/dist/css/component-css/pds-vertical-stepper.css +1 -1
- package/dist/css/component-css/pds-workspace-selector.css +26 -1
- package/dist/css/design-tokens/variables.dark.css +405 -239
- package/dist/css/design-tokens/variables.global.css +8 -15
- package/dist/css/design-tokens/variables.light.css +361 -217
- package/dist/css/design-tokens/variables.typography.css +3 -2
- package/dist/css/layout-css/pds-app-layout.css +6 -2
- package/dist/css/layout-css/pds-docs-layout.css +1 -1
- package/dist/css/layout-css/pds-index.css +6 -9
- package/dist/css/layout-css/pds-sidebar-layout.css +5 -0
- package/dist/css/layout-css/pds-stepper-layout.css +1 -1
- package/dist/css/pds-components.css +150 -70
- package/dist/css/pds-core.css +3 -2
- package/dist/css/pds-layouts.css +6 -9
- package/dist/index.css +1 -1
- package/dist/index.d.ts +95 -6
- package/dist/index.js +12112 -4520
- package/dist/index.js.map +1 -1
- package/dist/index.source.d.ts +39 -42
- package/dist/layouts/AppLayout/AppLayout.d.ts +68 -7
- package/dist/layouts/DocsLayout/DocsLayout.d.ts +9 -7
- package/dist/layouts/SidebarLayout/SidebarLayout.d.ts +16 -6
- package/dist/layouts/ThreeItemLayout/ThreeItemLayout.d.ts +3 -3
- package/dist/layouts/TwoItemLayout/TwoItemLayout.d.ts +3 -3
- package/dist/libs/components/NavAccordion/NavAccordion.d.ts +27 -0
- package/dist/libs/components/StatusDot/StatusDot.d.ts +15 -0
- package/dist/libs/components/utils.d.ts +0 -1
- package/dist/libs/types/custom-types.d.ts +12 -6
- package/dist/libs/types/layout-types.d.ts +2 -1
- package/dist/libs/types/navigation-types.d.ts +9 -1
- package/dist/svg/anglesDown.svg +3 -0
- package/dist/svg/anglesUp.svg +3 -0
- package/dist/svg/barsStaggered.svg +3 -0
- package/dist/svg/circleExclamationSolid.svg +3 -0
- package/dist/svg/circleHalfStroke.svg +3 -0
- package/dist/svg/circleInfoSolid.svg +3 -0
- package/dist/svg/circleQuestionSolid.svg +3 -0
- package/dist/svg/claude.svg +3 -0
- package/dist/svg/clock.svg +3 -0
- package/dist/svg/collapseToCenter.svg +3 -0
- package/dist/svg/compress.svg +3 -0
- package/dist/svg/diagramVenn.svg +3 -0
- package/dist/svg/floppyDisk.svg +3 -0
- package/dist/svg/grid.svg +2 -2
- package/dist/svg/grid2.svg +3 -0
- package/dist/svg/landmark.svg +3 -0
- package/dist/svg/locationCrosshairs.svg +3 -0
- package/dist/svg/move.svg +3 -0
- package/dist/svg/octagonExclamation.svg +3 -0
- package/dist/svg/openai.svg +3 -0
- package/dist/svg/pause.svg +3 -0
- package/dist/svg/sidebar.svg +3 -0
- package/dist/svg/slider.svg +3 -0
- package/dist/svg/squareDashed.svg +3 -0
- package/dist/svg/tableColumns.svg +3 -0
- package/dist/svg/userSolid.svg +3 -0
- package/dist/{layouts → utilities}/FlexContainer/FlexContainer.d.ts +6 -6
- package/dist/utilities/GlobalWrapper/GlobalWrapper.d.ts +21 -0
- package/dist/utilities/grid/Grid.d.ts +58 -0
- package/dist/utilities/grid/GridItem.d.ts +57 -0
- package/dist/utilities/hooks/useDropdown/index.d.ts +1 -0
- package/dist/utilities/hooks/useDropdown/useDropdown.d.ts +121 -0
- package/package.json +68 -41
- package/tailwind/README.md +220 -0
- package/tailwind/TESTING.md +457 -0
- package/tailwind/v3/preset.cjs +258 -0
- package/tailwind/v4/theme.css +230 -0
- package/dist/components/CTASlice/CTASlice.d.ts +0 -43
- package/dist/components/CodeBlock/themes/pdsLight.d.ts +0 -2
- package/dist/components/DashboardStat/DashboardStat.d.ts +0 -28
- package/dist/components/PullQuote/PullQuote.d.ts +0 -34
- package/dist/components/SiteDashboardHeading/SiteDashboardHeading.d.ts +0 -62
- package/dist/components/SocialLinks/SocialLinks.d.ts +0 -23
- package/dist/components/badges/IndicatorBadge/IndicatorBadge.d.ts +0 -27
- package/dist/components/cards/CardHeading/CardHeading.d.ts +0 -31
- package/dist/components/cards/EmptyStateCard/EmptyStateCard.d.ts +0 -36
- package/dist/components/cards/LinksCard/LinksCard.d.ts +0 -29
- package/dist/components/cards/LinksCard/links-card-sample-data.d.ts +0 -2
- package/dist/components/cards/NewSiteCard/NewSiteCard.d.ts +0 -61
- package/dist/components/cards/PaymentCard/PaymentCard.d.ts +0 -47
- package/dist/components/cards/PricingCard/PricingCard.d.ts +0 -90
- package/dist/components/cards/SiteCard/SiteCard.d.ts +0 -50
- package/dist/components/footer/FooterHeading/FooterHeading.d.ts +0 -22
- package/dist/components/footer/FooterLinks/FooterLinks.d.ts +0 -26
- package/dist/components/footer/SiteFooter/SiteFooter.d.ts +0 -30
- package/dist/components/footer/SiteFooter/footer-content.d.ts +0 -1
- package/dist/components/navigation/DashboardNav/DashboardNav.d.ts +0 -35
- package/dist/components/navigation/DashboardNav/DashboardNavItem.d.ts +0 -24
- package/dist/components/navigation/NavMenu/NavMenu.d.ts +0 -33
- package/dist/components/navigation/NavMenu/NavMenuDropdown.d.ts +0 -24
- package/dist/components/navigation/SideNavCompact/SideNavCompact.d.ts +0 -53
- package/dist/components/notifications/NotificationHubIcon/NotificationHubIcon.d.ts +0 -38
- package/dist/components/notifications/NotificationsPopover/NotificationsPopover.d.ts +0 -118
- package/dist/components/tiles/AvatarTileList/AvatarTileList.d.ts +0 -28
- package/dist/components/tiles/Tile/Tile.d.ts +0 -42
- package/dist/components/tiles/TileGrid/TileGrid.d.ts +0 -29
- package/dist/css/component-css/pds-avatar-tile-list.css +0 -1
- package/dist/css/component-css/pds-card-heading.css +0 -1
- package/dist/css/component-css/pds-card-select-group.css +0 -1
- package/dist/css/component-css/pds-cta-slice.css +0 -1
- package/dist/css/component-css/pds-dashboard-nav.css +0 -5
- package/dist/css/component-css/pds-dashboard-search.css +0 -1
- package/dist/css/component-css/pds-dashboard-stat.css +0 -1
- package/dist/css/component-css/pds-empty-state-card.css +0 -1
- package/dist/css/component-css/pds-flow-steps.css +0 -1
- package/dist/css/component-css/pds-footer-heading.css +0 -1
- package/dist/css/component-css/pds-footer-links.css +0 -1
- package/dist/css/component-css/pds-indicator-badge.css +0 -25
- package/dist/css/component-css/pds-links-card.css +0 -1
- package/dist/css/component-css/pds-new-site-card.css +0 -1
- package/dist/css/component-css/pds-notification-hub-icon.css +0 -1
- package/dist/css/component-css/pds-notifications-popover.css +0 -1
- package/dist/css/component-css/pds-payment-card.css +0 -1
- package/dist/css/component-css/pds-pricing-card-local.css +0 -1
- package/dist/css/component-css/pds-pricing-card.css +0 -1
- package/dist/css/component-css/pds-pull-quote.css +0 -1
- package/dist/css/component-css/pds-refresh-checker.css +0 -1
- package/dist/css/component-css/pds-side-nav-compact.css +0 -1
- package/dist/css/component-css/pds-site-card.css +0 -1
- package/dist/css/component-css/pds-site-dashboard-heading.css +0 -1
- package/dist/css/component-css/pds-social-links.css +0 -1
- package/dist/css/component-css/pds-tile.css +0 -1
- package/dist/css/component-css/pds-tiles-common.css +0 -1
- package/dist/css/layout-css/pds-dashboard-global.css +0 -8
- package/dist/css/layout-css/pds-dashboard-inner.css +0 -1
- package/dist/css/layout-css/pds-flex-container.css +0 -1
- package/dist/layouts/DashboardGlobal/DashboardGlobal.d.ts +0 -57
- package/dist/layouts/DashboardInner/DashboardInner.d.ts +0 -30
- package/dist/layouts/GlobalWrapper/GlobalWrapper.d.ts +0 -19
- package/dist/utilities/context-providers/ResponsiveContext/ResponsiveContext.d.ts +0 -6
- /package/dist/components/{Skiplink → links/Skiplink}/Skiplink.d.ts +0 -0
- /package/dist/components/{Picture → media/Picture}/Picture.d.ts +0 -0
- /package/dist/components/{VideoEmbed → media/VideoEmbed}/VideoEmbed.d.ts +0 -0
- /package/dist/components/{Pagination → pagination/Pagination}/usePagination.d.ts +0 -0
- /package/dist/components/{FlowSteps → steppers/StepList}/example-steps.d.ts +0 -0
- /package/dist/svg/{linkSimple.svg → link.svg} +0 -0
- /package/dist/svg/{linkSimpleSlash.svg → unlink.svg} +0 -0
- /package/dist/{layouts → utilities}/Container/Container.d.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { defineTest } = require('jscodeshift/src/testUtils');
|
|
2
|
+
|
|
3
|
+
const transform = 'icon-name-updates';
|
|
4
|
+
|
|
5
|
+
// Unfiltered: updates iconName on all PDS components
|
|
6
|
+
defineTest(__dirname, transform, null, `${transform}/basic`, { parser: 'tsx' });
|
|
7
|
+
|
|
8
|
+
// --only=Icon: updates only Icon's iconName; Button is untouched
|
|
9
|
+
defineTest(
|
|
10
|
+
__dirname,
|
|
11
|
+
transform,
|
|
12
|
+
{ only: 'Icon' },
|
|
13
|
+
`${transform}/only`,
|
|
14
|
+
{ parser: 'tsx' },
|
|
15
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { defineTest } = require('jscodeshift/src/testUtils');
|
|
2
|
+
|
|
3
|
+
const transform = 'prop-renames';
|
|
4
|
+
|
|
5
|
+
// Unfiltered: renames all components' props
|
|
6
|
+
defineTest(__dirname, transform, null, `${transform}/basic`, { parser: 'tsx' });
|
|
7
|
+
|
|
8
|
+
// --only=Button: renames only Button's props; Icon and others are untouched
|
|
9
|
+
defineTest(
|
|
10
|
+
__dirname,
|
|
11
|
+
transform,
|
|
12
|
+
{ only: 'Button' },
|
|
13
|
+
`${transform}/only`,
|
|
14
|
+
{ parser: 'tsx' },
|
|
15
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { defineTest } = require('jscodeshift/src/testUtils');
|
|
2
|
+
|
|
3
|
+
const transform = 'prop-value-standardization';
|
|
4
|
+
const fixtures = `${__dirname}/../__testfixtures__/${transform}`;
|
|
5
|
+
|
|
6
|
+
// Unfiltered: rewrites all components with size migration rules
|
|
7
|
+
defineTest(__dirname, transform, null, `${transform}/basic`, { parser: 'tsx' });
|
|
8
|
+
|
|
9
|
+
// --only=Spinner: rewrites only Spinner; all other PDS components are untouched
|
|
10
|
+
defineTest(
|
|
11
|
+
__dirname,
|
|
12
|
+
transform,
|
|
13
|
+
{ only: 'Spinner' },
|
|
14
|
+
`${transform}/only`,
|
|
15
|
+
{ parser: 'tsx' },
|
|
16
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { defineTest } = require('jscodeshift/src/testUtils');
|
|
2
|
+
|
|
3
|
+
const transform = 'removed-prop-values';
|
|
4
|
+
|
|
5
|
+
// Unfiltered: applies all value rewrites and prop removals
|
|
6
|
+
defineTest(__dirname, transform, null, `${transform}/basic`, { parser: 'tsx' });
|
|
7
|
+
|
|
8
|
+
// --only=Button: transforms Button props only; Spinner is untouched
|
|
9
|
+
defineTest(
|
|
10
|
+
__dirname,
|
|
11
|
+
transform,
|
|
12
|
+
{ only: 'Button' },
|
|
13
|
+
`${transform}/only`,
|
|
14
|
+
{ parser: 'tsx' },
|
|
15
|
+
);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codemod: component-renames
|
|
3
|
+
*
|
|
4
|
+
* Renames PDS v1 components to their v2 names. Handles two import styles:
|
|
5
|
+
*
|
|
6
|
+
* 1. Root package imports (most common):
|
|
7
|
+
* import { IndicatorBadge } from '@pantheon-systems/pds-toolkit-react'
|
|
8
|
+
* → import { Badge } from '@pantheon-systems/pds-toolkit-react'
|
|
9
|
+
* Driven by components.renames in mappings.json.
|
|
10
|
+
*
|
|
11
|
+
* 2. Deep path imports:
|
|
12
|
+
* import { IndicatorBadge } from '@pantheon-systems/pds-toolkit-react/components/badges/IndicatorBadge/IndicatorBadge'
|
|
13
|
+
* → import { Badge } from '@pantheon-systems/pds-toolkit-react/components/badges/Badge/Badge'
|
|
14
|
+
* Driven by imports.pathChanges in mappings.json.
|
|
15
|
+
*
|
|
16
|
+
* In both cases, non-aliased imports also update every JSX tag in the file.
|
|
17
|
+
* Aliased imports preserve the local alias — only the imported name changes.
|
|
18
|
+
*
|
|
19
|
+
* Usage (all renames):
|
|
20
|
+
* npx jscodeshift -t codemods/v1-to-v2/transforms/component-renames.js \
|
|
21
|
+
* --extensions=tsx,ts,jsx,js \
|
|
22
|
+
* src/
|
|
23
|
+
*
|
|
24
|
+
* Usage (single component — recommended for by-component migrations):
|
|
25
|
+
* npx jscodeshift -t codemods/v1-to-v2/transforms/component-renames.js \
|
|
26
|
+
* --only=IndicatorBadge \
|
|
27
|
+
* --extensions=tsx,ts,jsx,js \
|
|
28
|
+
* src/
|
|
29
|
+
*
|
|
30
|
+
* --only accepts a comma-separated list of OLD (v1) component names.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const path = require('path');
|
|
34
|
+
const mappings = require(path.join(__dirname, '../mappings.json'));
|
|
35
|
+
|
|
36
|
+
// Build lookup for root package imports: { 'OldName': 'NewName' }
|
|
37
|
+
function buildRenamesLookup() {
|
|
38
|
+
const lookup = {};
|
|
39
|
+
for (const entry of mappings.components.renames) {
|
|
40
|
+
lookup[entry.from] = entry.to;
|
|
41
|
+
}
|
|
42
|
+
return lookup;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Build list for deep path imports: [{ from, to, oldName, newName }]
|
|
46
|
+
function buildPathChangesLookup() {
|
|
47
|
+
return mappings.imports.pathChanges.map((entry) => ({
|
|
48
|
+
from: entry.from,
|
|
49
|
+
to: entry.to,
|
|
50
|
+
oldName: entry.from.split('/').pop(),
|
|
51
|
+
newName: entry.component || entry.to.split('/').pop(),
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ALL_RENAMES = buildRenamesLookup();
|
|
56
|
+
const ALL_PATH_CHANGES = buildPathChangesLookup();
|
|
57
|
+
|
|
58
|
+
module.exports = function transform(file, api, options) {
|
|
59
|
+
const j = api.jscodeshift;
|
|
60
|
+
const root = j(file.source);
|
|
61
|
+
|
|
62
|
+
// Parse --only flag: comma-separated OLD (v1) component names
|
|
63
|
+
const onlyComponents =
|
|
64
|
+
options && options.only
|
|
65
|
+
? new Set(
|
|
66
|
+
options.only
|
|
67
|
+
.split(',')
|
|
68
|
+
.map((s) => s.trim())
|
|
69
|
+
.filter(Boolean),
|
|
70
|
+
)
|
|
71
|
+
: null;
|
|
72
|
+
|
|
73
|
+
// Apply --only filter to both lookups
|
|
74
|
+
const renames = onlyComponents
|
|
75
|
+
? Object.fromEntries(
|
|
76
|
+
Object.entries(ALL_RENAMES).filter(([from]) =>
|
|
77
|
+
onlyComponents.has(from),
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
: ALL_RENAMES;
|
|
81
|
+
|
|
82
|
+
const pathChanges = onlyComponents
|
|
83
|
+
? ALL_PATH_CHANGES.filter((p) => onlyComponents.has(p.oldName))
|
|
84
|
+
: ALL_PATH_CHANGES;
|
|
85
|
+
|
|
86
|
+
if (Object.keys(renames).length === 0 && pathChanges.length === 0) return;
|
|
87
|
+
|
|
88
|
+
// Track non-aliased renames so JSX tags can be updated in Step 2.
|
|
89
|
+
const localRenameMap = new Map(); // oldLocalName → newLocalName
|
|
90
|
+
|
|
91
|
+
let changed = false;
|
|
92
|
+
|
|
93
|
+
// Step 1: Update import declarations
|
|
94
|
+
root.find(j.ImportDeclaration).forEach((nodePath) => {
|
|
95
|
+
const source = nodePath.node.source.value;
|
|
96
|
+
|
|
97
|
+
// 1a. Root package imports
|
|
98
|
+
if (source === '@pantheon-systems/pds-toolkit-react') {
|
|
99
|
+
nodePath.node.specifiers.forEach((spec) => {
|
|
100
|
+
if (spec.type !== 'ImportSpecifier') return;
|
|
101
|
+
|
|
102
|
+
const importedName = spec.imported.name;
|
|
103
|
+
const newName = renames[importedName];
|
|
104
|
+
if (!newName) return;
|
|
105
|
+
|
|
106
|
+
const isAliased = spec.local.name !== spec.imported.name;
|
|
107
|
+
spec.imported = j.identifier(newName);
|
|
108
|
+
changed = true;
|
|
109
|
+
|
|
110
|
+
if (!isAliased) {
|
|
111
|
+
spec.local = j.identifier(newName);
|
|
112
|
+
localRenameMap.set(importedName, newName);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 1b. Deep path imports
|
|
119
|
+
for (const { from, to, oldName, newName } of pathChanges) {
|
|
120
|
+
if (!source.includes(from)) continue;
|
|
121
|
+
|
|
122
|
+
nodePath.node.source = j.stringLiteral(source.replace(from, to));
|
|
123
|
+
changed = true;
|
|
124
|
+
|
|
125
|
+
nodePath.node.specifiers.forEach((spec) => {
|
|
126
|
+
if (spec.type !== 'ImportSpecifier') return;
|
|
127
|
+
if (spec.imported.name !== oldName) return;
|
|
128
|
+
|
|
129
|
+
const isAliased = spec.local.name !== spec.imported.name;
|
|
130
|
+
spec.imported = j.identifier(newName);
|
|
131
|
+
|
|
132
|
+
if (!isAliased) {
|
|
133
|
+
spec.local = j.identifier(newName);
|
|
134
|
+
localRenameMap.set(oldName, newName);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
break; // a source string can only match one path change
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (!changed) return;
|
|
143
|
+
|
|
144
|
+
// Step 2: Rewrite JSX tags for non-aliased renames
|
|
145
|
+
if (localRenameMap.size > 0) {
|
|
146
|
+
root.find(j.JSXOpeningElement).forEach((nodePath) => {
|
|
147
|
+
const nameNode = nodePath.node.name;
|
|
148
|
+
if (nameNode.type !== 'JSXIdentifier') return;
|
|
149
|
+
|
|
150
|
+
const newName = localRenameMap.get(nameNode.name);
|
|
151
|
+
if (newName) nodePath.node.name = j.jsxIdentifier(newName);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
root.find(j.JSXClosingElement).forEach((nodePath) => {
|
|
155
|
+
const nameNode = nodePath.node.name;
|
|
156
|
+
if (nameNode.type !== 'JSXIdentifier') return;
|
|
157
|
+
|
|
158
|
+
const newName = localRenameMap.get(nameNode.name);
|
|
159
|
+
if (newName) nodePath.node.name = j.jsxIdentifier(newName);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return root.toSource();
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
module.exports.parser = 'tsx';
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codemod: css-class-removals
|
|
3
|
+
*
|
|
4
|
+
* Handles removed PDS CSS utility classes in JSX className attributes.
|
|
5
|
+
* Driven entirely by cssClasses.removals in mappings.json.
|
|
6
|
+
*
|
|
7
|
+
* Three kinds of change:
|
|
8
|
+
*
|
|
9
|
+
* 1. Direct renames — replacement is another class name:
|
|
10
|
+
* pds-button--navbar → pds-button--subtle
|
|
11
|
+
* pds-ts-9xl → pds-ts-8xl
|
|
12
|
+
* Replaced automatically.
|
|
13
|
+
*
|
|
14
|
+
* 2. Safe removals — replacement text says "no class needed":
|
|
15
|
+
* pds-typography--product → removed (product context is now the default)
|
|
16
|
+
* Removed automatically.
|
|
17
|
+
*
|
|
18
|
+
* 3. Flag only — replacement requires manual styling work with design tokens:
|
|
19
|
+
* pds-color-bg-brand, pds-color-fg-brand, pds-lead-text*, pds-quote-text*
|
|
20
|
+
* Left in place; a warning is printed so the developer can find and fix
|
|
21
|
+
* these manually. Removing them silently would break visible styles with
|
|
22
|
+
* no clear path forward.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* npx jscodeshift -t codemods/v1-to-v2/transforms/css-class-removals.js \
|
|
26
|
+
* --extensions=tsx,ts,jsx,js \
|
|
27
|
+
* src/
|
|
28
|
+
*
|
|
29
|
+
* No --only flag — CSS utility classes apply to any element globally.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const path = require('path');
|
|
33
|
+
const mappings = require(path.join(__dirname, '../mappings.json'));
|
|
34
|
+
|
|
35
|
+
// Extract the first pds-* class name from a replacement string, if present.
|
|
36
|
+
// Strips CSS custom property references (var(--pds-*)) first so that token
|
|
37
|
+
// names mentioned in prose explanations aren't mistaken for class names.
|
|
38
|
+
function extractReplacementClass(replacement) {
|
|
39
|
+
if (!replacement) return null;
|
|
40
|
+
const cleaned = replacement.replace(/var\(--[^)]+\)/g, '');
|
|
41
|
+
const match = cleaned.match(/\bpds-[a-z0-9-]+/);
|
|
42
|
+
return match ? match[0] : null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Classify each removal entry into one of three buckets.
|
|
46
|
+
function buildLookups() {
|
|
47
|
+
// { oldClass: newClass } — rename automatically
|
|
48
|
+
const renames = {};
|
|
49
|
+
// Set of class names to remove unconditionally
|
|
50
|
+
const removals = new Set();
|
|
51
|
+
// Set of class names to flag with a warning (no safe auto-fix)
|
|
52
|
+
const flags = new Set();
|
|
53
|
+
|
|
54
|
+
for (const entry of mappings.cssClasses.removals) {
|
|
55
|
+
const { old: oldClass, replacement } = entry;
|
|
56
|
+
if (!oldClass) continue;
|
|
57
|
+
|
|
58
|
+
const replacementClass = extractReplacementClass(replacement);
|
|
59
|
+
if (replacementClass) {
|
|
60
|
+
renames[oldClass] = replacementClass;
|
|
61
|
+
} else if (
|
|
62
|
+
replacement &&
|
|
63
|
+
/no class needed|no replacement/i.test(replacement)
|
|
64
|
+
) {
|
|
65
|
+
removals.add(oldClass);
|
|
66
|
+
} else {
|
|
67
|
+
flags.add(oldClass);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return { renames, removals, flags };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const { renames: RENAMES, removals: REMOVALS, flags: FLAGS } = buildLookups();
|
|
75
|
+
|
|
76
|
+
// Process a space-separated class string.
|
|
77
|
+
// Returns { result, changed, flagged[] }
|
|
78
|
+
function processClasses(classString, filePath) {
|
|
79
|
+
let changed = false;
|
|
80
|
+
const flagged = [];
|
|
81
|
+
|
|
82
|
+
const result = classString
|
|
83
|
+
.split(/(\s+)/)
|
|
84
|
+
.map((token) => {
|
|
85
|
+
if (/^\s+$/.test(token) || token === '') return token;
|
|
86
|
+
|
|
87
|
+
if (RENAMES[token]) {
|
|
88
|
+
changed = true;
|
|
89
|
+
return RENAMES[token];
|
|
90
|
+
}
|
|
91
|
+
if (REMOVALS.has(token)) {
|
|
92
|
+
changed = true;
|
|
93
|
+
return null; // will be filtered out
|
|
94
|
+
}
|
|
95
|
+
if (FLAGS.has(token)) {
|
|
96
|
+
flagged.push(token);
|
|
97
|
+
}
|
|
98
|
+
return token;
|
|
99
|
+
})
|
|
100
|
+
.filter((token) => token !== null)
|
|
101
|
+
.join('');
|
|
102
|
+
|
|
103
|
+
// Normalise any double-spaces left by removed tokens
|
|
104
|
+
const normalised = result.replace(/ +/g, ' ').trim();
|
|
105
|
+
const didChange = changed || normalised !== classString.trim();
|
|
106
|
+
|
|
107
|
+
return { result: normalised, changed: didChange, flagged };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
module.exports = function transform(file, api) {
|
|
111
|
+
const j = api.jscodeshift;
|
|
112
|
+
const root = j(file.source);
|
|
113
|
+
|
|
114
|
+
const allFlagged = []; // { file, class } pairs for the summary warning
|
|
115
|
+
let changed = false;
|
|
116
|
+
|
|
117
|
+
root
|
|
118
|
+
.find(j.JSXAttribute, { name: { name: 'className' } })
|
|
119
|
+
.forEach((nodePath) => {
|
|
120
|
+
const { value } = nodePath.node;
|
|
121
|
+
if (!value) return;
|
|
122
|
+
|
|
123
|
+
// className="pds-button--navbar foo"
|
|
124
|
+
if (value.type === 'StringLiteral') {
|
|
125
|
+
const {
|
|
126
|
+
result,
|
|
127
|
+
changed: c,
|
|
128
|
+
flagged,
|
|
129
|
+
} = processClasses(value.value, file.path);
|
|
130
|
+
if (c) {
|
|
131
|
+
nodePath.node.value = j.stringLiteral(result);
|
|
132
|
+
changed = true;
|
|
133
|
+
}
|
|
134
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (value.type !== 'JSXExpressionContainer') return;
|
|
139
|
+
const { expression } = value;
|
|
140
|
+
|
|
141
|
+
// className={'pds-button--navbar'}
|
|
142
|
+
if (expression.type === 'StringLiteral') {
|
|
143
|
+
const {
|
|
144
|
+
result,
|
|
145
|
+
changed: c,
|
|
146
|
+
flagged,
|
|
147
|
+
} = processClasses(expression.value, file.path);
|
|
148
|
+
if (c) {
|
|
149
|
+
value.expression = j.stringLiteral(result);
|
|
150
|
+
changed = true;
|
|
151
|
+
}
|
|
152
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// className={`pds-button--navbar ${x}`}
|
|
157
|
+
if (expression.type === 'TemplateLiteral') {
|
|
158
|
+
expression.quasis.forEach((quasi) => {
|
|
159
|
+
const {
|
|
160
|
+
result,
|
|
161
|
+
changed: c,
|
|
162
|
+
flagged,
|
|
163
|
+
} = processClasses(quasi.value.raw, file.path);
|
|
164
|
+
if (c) {
|
|
165
|
+
quasi.value.raw = result;
|
|
166
|
+
quasi.value.cooked = result;
|
|
167
|
+
changed = true;
|
|
168
|
+
}
|
|
169
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Emit warnings for classes that need manual attention
|
|
175
|
+
if (allFlagged.length > 0) {
|
|
176
|
+
const unique = [...new Set(allFlagged)];
|
|
177
|
+
process.stderr.write(
|
|
178
|
+
`\n⚠ ${file.path}\n` +
|
|
179
|
+
unique
|
|
180
|
+
.map(
|
|
181
|
+
(cls) =>
|
|
182
|
+
` ${cls} — removed in v2, no direct replacement. See migration guide.`,
|
|
183
|
+
)
|
|
184
|
+
.join('\n') +
|
|
185
|
+
'\n',
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return changed ? root.toSource() : undefined;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
module.exports.parser = 'tsx';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codemod: css-class-renames
|
|
3
|
+
*
|
|
4
|
+
* Renames PDS CSS utility classes in JSX className attributes.
|
|
5
|
+
* Driven entirely by cssClasses.renames in mappings.json.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx jscodeshift -t codemods/v1-to-v2/transforms/css-class-renames.js \
|
|
9
|
+
* --extensions=tsx,ts,jsx,js \
|
|
10
|
+
* src/
|
|
11
|
+
*
|
|
12
|
+
* Handles:
|
|
13
|
+
* - String literals: className="pds-overline-text foo"
|
|
14
|
+
* - Expression containers: className={'pds-overline-text'}
|
|
15
|
+
* - Template literals: className={`pds-overline-text ${styles.x}`}
|
|
16
|
+
*
|
|
17
|
+
* Does not handle:
|
|
18
|
+
* - CSS/SCSS files — run a find-and-replace over those separately.
|
|
19
|
+
* - Dynamic class names built at runtime (e.g. computed from variables).
|
|
20
|
+
*
|
|
21
|
+
* No --only flag: CSS utility classes can appear on any element (including
|
|
22
|
+
* native HTML), so there is no meaningful component-level scope to filter by.
|
|
23
|
+
* This transform is safe to run globally.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const mappings = require(path.join(__dirname, '../mappings.json'));
|
|
28
|
+
|
|
29
|
+
// Build lookup: { 'oldClass': 'newClass' }
|
|
30
|
+
function buildRenamesLookup() {
|
|
31
|
+
const lookup = {};
|
|
32
|
+
for (const entry of mappings.cssClasses.renames) {
|
|
33
|
+
if (entry.old && entry.new) lookup[entry.old] = entry.new;
|
|
34
|
+
}
|
|
35
|
+
return lookup;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const RENAMES = buildRenamesLookup();
|
|
39
|
+
|
|
40
|
+
// Replace class names in a space-separated class string.
|
|
41
|
+
// Splits on whitespace and does exact token matching, so 'pds-overline-text'
|
|
42
|
+
// won't incorrectly mangle 'pds-overline-text--sm'.
|
|
43
|
+
function renameClasses(classString) {
|
|
44
|
+
let changed = false;
|
|
45
|
+
const result = classString
|
|
46
|
+
.split(/(\s+)/)
|
|
47
|
+
.map((token) => {
|
|
48
|
+
// Preserve whitespace tokens unchanged
|
|
49
|
+
if (/^\s+$/.test(token) || token === '') return token;
|
|
50
|
+
const renamed = RENAMES[token];
|
|
51
|
+
if (renamed) {
|
|
52
|
+
changed = true;
|
|
53
|
+
return renamed;
|
|
54
|
+
}
|
|
55
|
+
return token;
|
|
56
|
+
})
|
|
57
|
+
.join('');
|
|
58
|
+
return { result, changed };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = function transform(file, api) {
|
|
62
|
+
const j = api.jscodeshift;
|
|
63
|
+
const root = j(file.source);
|
|
64
|
+
|
|
65
|
+
if (Object.keys(RENAMES).length === 0) return;
|
|
66
|
+
|
|
67
|
+
let changed = false;
|
|
68
|
+
|
|
69
|
+
root
|
|
70
|
+
.find(j.JSXAttribute, { name: { name: 'className' } })
|
|
71
|
+
.forEach((nodePath) => {
|
|
72
|
+
const { value } = nodePath.node;
|
|
73
|
+
if (!value) return;
|
|
74
|
+
|
|
75
|
+
// className="pds-overline-text foo"
|
|
76
|
+
if (value.type === 'StringLiteral') {
|
|
77
|
+
const { result, changed: c } = renameClasses(value.value);
|
|
78
|
+
if (c) {
|
|
79
|
+
nodePath.node.value = j.stringLiteral(result);
|
|
80
|
+
changed = true;
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (value.type !== 'JSXExpressionContainer') return;
|
|
86
|
+
const { expression } = value;
|
|
87
|
+
|
|
88
|
+
// className={'pds-overline-text'}
|
|
89
|
+
if (expression.type === 'StringLiteral') {
|
|
90
|
+
const { result, changed: c } = renameClasses(expression.value);
|
|
91
|
+
if (c) {
|
|
92
|
+
value.expression = j.stringLiteral(result);
|
|
93
|
+
changed = true;
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// className={`pds-overline-text ${styles.x}`}
|
|
99
|
+
if (expression.type === 'TemplateLiteral') {
|
|
100
|
+
expression.quasis.forEach((quasi) => {
|
|
101
|
+
const { result, changed: c } = renameClasses(quasi.value.raw);
|
|
102
|
+
if (c) {
|
|
103
|
+
quasi.value.raw = result;
|
|
104
|
+
quasi.value.cooked = result;
|
|
105
|
+
changed = true;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return changed ? root.toSource() : undefined;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
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';
|