@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.
- package/bin/pds-codemod.cjs +58 -0
- package/codemods/v1-to-v2/css-token-renames.js +186 -0
- package/codemods/v1-to-v2/mappings.json +1787 -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 +55 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.output.tsx +55 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.input.tsx +60 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.output.tsx +60 -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 +37 -0
- package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.output.tsx +37 -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 +262 -0
- package/codemods/v1-to-v2/transforms/css-class-renames.js +178 -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 +5 -1
- 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/prism-setup.d.ts +2 -0
- 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 +192 -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/ResultCount/ResultCount.d.ts +53 -0
- package/dist/components/SiteFooter/SiteFooter.d.ts +45 -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} +6 -19
- package/dist/components/StatusIndicator/StatusIndicator.d.ts +7 -4
- package/dist/components/Table/Table.d.ts +290 -17
- package/dist/components/TableOfContents/TableOfContents.d.ts +1 -5
- package/dist/components/Tag/Tag.d.ts +21 -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 +1 -1
- 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 +92 -0
- package/dist/components/buttons/IconButton/IconButton.d.ts +12 -0
- package/dist/components/buttons/MenuButton/MenuButton.d.ts +24 -17
- package/dist/components/buttons/SSOButton/SSOButton.d.ts +9 -1
- 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 +10 -4
- package/dist/components/cards/CardSelect/CardSelect.d.ts +100 -0
- 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 +31 -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 +24 -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 +13 -8
- 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 +212 -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/CheckboxFieldset/CheckboxFieldset.d.ts +9 -1
- package/dist/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +9 -1
- 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 +217 -14
- package/dist/components/inputs/FileUpload/FileUpload.d.ts +6 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +10 -2
- package/dist/components/inputs/Select/Select.d.ts +11 -2
- package/dist/components/inputs/Switch/Switch.d.ts +5 -5
- package/dist/components/inputs/TagsInput/TagsInput.d.ts +6 -1
- package/dist/components/inputs/TextInput/TextInput.d.ts +4 -4
- package/dist/components/inputs/Textarea/Textarea.d.ts +2 -2
- package/dist/components/inputs/Timepicker/Timepicker.d.ts +94 -0
- package/dist/components/inputs/input-utilities.d.ts +12 -2
- 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 +11 -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 -16
- package/dist/components/navigation/navigation-utilities.d.ts +12 -0
- 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 +2 -2
- package/dist/components/{Pagination → pagination/Pagination}/Pagination.d.ts +7 -2
- package/dist/components/pagination/PaginationChapter/PaginationChapter.d.ts +55 -0
- package/dist/components/pagination/PaginationCompact/PaginationCompact.d.ts +62 -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/panels/PanelStack/PanelStack.d.ts +19 -0
- 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 -1
- 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 +45 -13
- package/dist/css/component-css/pds-callout.css +1 -1
- package/dist/css/component-css/pds-card-select.css +2 -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-group.css +1 -1
- 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-legacy.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 +1 -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-group.css +1 -1
- package/dist/css/component-css/pds-expansion-panel.css +2 -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 +5 -3
- package/dist/css/component-css/pds-icon-story-only.css +1 -1
- 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 +152 -45
- 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-chapter.css +3 -0
- package/dist/css/component-css/pds-pagination-compact.css +1 -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-stack.css +1 -0
- package/dist/css/component-css/pds-panel.css +2 -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-picture.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-result-count.css +1 -0
- 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 +3 -5
- 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 +2 -2
- 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 +6 -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 +5 -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-timepicker.css +1 -0
- 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-story-only.css +1 -1
- 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-video-embed.css +1 -1
- package/dist/css/component-css/pds-workspace-selector.css +26 -1
- package/dist/css/design-tokens/variables.dark.css +385 -338
- package/dist/css/design-tokens/variables.global.css +10 -18
- package/dist/css/design-tokens/variables.light.css +376 -309
- package/dist/css/design-tokens/variables.typography.css +1 -2
- package/dist/css/layout-css/pds-app-layout.css +3 -2
- package/dist/css/layout-css/pds-docs-layout.css +1 -1
- package/dist/css/layout-css/pds-index.css +3 -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/layout-css/pds-three-item-layout.css +1 -1
- package/dist/css/layout-css/pds-two-item-layout.css +1 -1
- package/dist/css/pds-components.css +152 -45
- package/dist/css/pds-core.css +3 -2
- package/dist/css/pds-layouts.css +3 -9
- package/dist/index.css +5 -1
- package/dist/index.d.ts +95 -7
- package/dist/index.js +12738 -4787
- package/dist/index.js.map +1 -1
- package/dist/index.source.d.ts +44 -41
- package/dist/layouts/AppLayout/AppLayout.d.ts +85 -10
- package/dist/layouts/DocsLayout/DocsLayout.d.ts +9 -7
- package/dist/layouts/SidebarLayout/SidebarLayout.d.ts +16 -6
- package/dist/layouts/StepperLayout/StepperLayout.d.ts +13 -1
- 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 +1 -1
- package/dist/libs/types/custom-types.d.ts +11 -5
- package/dist/libs/types/layout-types.d.ts +4 -1
- package/dist/libs/types/navigation-types.d.ts +17 -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/bookmark.svg +3 -0
- package/dist/svg/bookmarkSolid.svg +3 -0
- package/dist/svg/box.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/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/penPaintbrush.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 +35 -0
- package/dist/utilities/context-providers/ThemeContext/ThemeContext.d.ts +113 -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 +138 -0
- package/dist/utilities/hooks/useIsMobile/useIsMobile.d.ts +16 -0
- package/dist/utilities/hooks/useKeyPress/useKeyPress.d.ts +6 -0
- package/dist/utilities/hooks/useKeyboardShortcut/useKeyboardShortcut.d.ts +29 -0
- package/package.json +83 -47
- 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/cards/CardHeading/CardHeading.d.ts +0 -31
- package/dist/components/cards/CardSelectGroup/CardSelectGroup.d.ts +0 -60
- 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 -95
- 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 -34
- 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-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,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
CodeBlock,
|
|
7
|
+
IconButton,
|
|
8
|
+
MenuButton,
|
|
9
|
+
Panel,
|
|
10
|
+
Spinner,
|
|
11
|
+
Switch,
|
|
12
|
+
} from '@pantheon-systems/pds-toolkit-react';
|
|
13
|
+
|
|
14
|
+
// Value rewrites — prop stays, value changes
|
|
15
|
+
const A = () => <Button variant='brand-secondary'>Click</Button>;
|
|
16
|
+
const B = () => <Button variant='navbar'>Click</Button>;
|
|
17
|
+
const C = () => (
|
|
18
|
+
<MenuButton variant='navbar' id='menu' label='Menu' menuItems={[]} />
|
|
19
|
+
);
|
|
20
|
+
const D = () => (
|
|
21
|
+
<IconButton variant='critical-hover' iconName='x' label='Close' />
|
|
22
|
+
);
|
|
23
|
+
const E = () => <Avatar size='xl' />;
|
|
24
|
+
|
|
25
|
+
// JSX expression container value rewrite
|
|
26
|
+
const F = () => <Button variant={'brand-secondary'}>Click</Button>;
|
|
27
|
+
|
|
28
|
+
// Unconditional prop removals
|
|
29
|
+
const G = () => <Spinner colorType='full-color' />;
|
|
30
|
+
const H = () => <CodeBlock colorType='dark' />;
|
|
31
|
+
const I = () => (
|
|
32
|
+
<Panel
|
|
33
|
+
hasStatusIndicator
|
|
34
|
+
statusType='success'
|
|
35
|
+
typeLabels={{ success: 'OK' }}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
const J = () => (
|
|
39
|
+
<Switch
|
|
40
|
+
showStatusLabel
|
|
41
|
+
statusLabelPlacement='end'
|
|
42
|
+
onLabel='On'
|
|
43
|
+
offLabel='Off'
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Conditional removal — remove only deprecated gradient values, leave valid values alone
|
|
48
|
+
const K = () => <Card background='mint-gradient' />;
|
|
49
|
+
const L = () => <Card background='sundown-gradient' />;
|
|
50
|
+
const M = () => <Card background='default' />;
|
|
51
|
+
|
|
52
|
+
// Already correct — should be left alone
|
|
53
|
+
const N = () => <Button variant='secondary'>Click</Button>;
|
|
54
|
+
|
|
55
|
+
// Non-PDS component — should be left alone
|
|
56
|
+
const O = () => <div variant='brand-secondary' />;
|
|
57
|
+
|
|
58
|
+
// Dynamic value — cannot transform, leave as-is
|
|
59
|
+
const myVariant = 'brand-secondary';
|
|
60
|
+
const P = () => <Button variant={myVariant}>Click</Button>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Avatar,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
CodeBlock,
|
|
7
|
+
IconButton,
|
|
8
|
+
MenuButton,
|
|
9
|
+
Panel,
|
|
10
|
+
Spinner,
|
|
11
|
+
Switch,
|
|
12
|
+
} from '@pantheon-systems/pds-toolkit-react';
|
|
13
|
+
|
|
14
|
+
// Value rewrites — prop stays, value changes
|
|
15
|
+
const A = () => <Button variant="secondary">Click</Button>;
|
|
16
|
+
const B = () => <Button variant="subtle">Click</Button>;
|
|
17
|
+
const C = () => (
|
|
18
|
+
<MenuButton variant="subtle" id='menu' label='Menu' menuItems={[]} />
|
|
19
|
+
);
|
|
20
|
+
const D = () => (
|
|
21
|
+
<IconButton variant="critical" iconName='x' label='Close' />
|
|
22
|
+
);
|
|
23
|
+
const E = () => <Avatar size="l" />;
|
|
24
|
+
|
|
25
|
+
// JSX expression container value rewrite
|
|
26
|
+
const F = () => <Button variant={"secondary"}>Click</Button>;
|
|
27
|
+
|
|
28
|
+
// Unconditional prop removals
|
|
29
|
+
const G = () => <Spinner />;
|
|
30
|
+
const H = () => <CodeBlock />;
|
|
31
|
+
const I = () => (
|
|
32
|
+
<Panel />
|
|
33
|
+
);
|
|
34
|
+
const J = () => (
|
|
35
|
+
<Switch />
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Conditional removal — remove only deprecated gradient values, leave valid values alone
|
|
39
|
+
const K = () => <Card />;
|
|
40
|
+
const L = () => <Card />;
|
|
41
|
+
const M = () => <Card background='default' />;
|
|
42
|
+
|
|
43
|
+
// Already correct — should be left alone
|
|
44
|
+
const N = () => <Button variant='secondary'>Click</Button>;
|
|
45
|
+
|
|
46
|
+
// Non-PDS component — should be left alone
|
|
47
|
+
const O = () => <div variant='brand-secondary' />;
|
|
48
|
+
|
|
49
|
+
// Dynamic value — cannot transform, leave as-is
|
|
50
|
+
const myVariant = 'brand-secondary';
|
|
51
|
+
const P = () => <Button variant={myVariant}>Click</Button>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Spinner } from '@pantheon-systems/pds-toolkit-react';
|
|
3
|
+
|
|
4
|
+
// Button — matches --only=Button, should be transformed
|
|
5
|
+
const A = () => <Button variant='brand-secondary'>Click</Button>;
|
|
6
|
+
|
|
7
|
+
// Spinner — not in --only list, should be left alone
|
|
8
|
+
const B = () => <Spinner colorType='full-color' />;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Spinner } from '@pantheon-systems/pds-toolkit-react';
|
|
3
|
+
|
|
4
|
+
// Button — matches --only=Button, should be transformed
|
|
5
|
+
const A = () => <Button variant="secondary">Click</Button>;
|
|
6
|
+
|
|
7
|
+
// Spinner — not in --only list, should be left alone
|
|
8
|
+
const B = () => <Spinner colorType='full-color' />;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { defineTest } = require('jscodeshift/src/testUtils');
|
|
2
|
+
|
|
3
|
+
const transform = 'component-renames';
|
|
4
|
+
|
|
5
|
+
// Unfiltered: renames all components
|
|
6
|
+
defineTest(__dirname, transform, null, `${transform}/basic`, { parser: 'tsx' });
|
|
7
|
+
|
|
8
|
+
// --only=IndicatorBadge: renames only IndicatorBadge; all other components untouched
|
|
9
|
+
defineTest(
|
|
10
|
+
__dirname,
|
|
11
|
+
transform,
|
|
12
|
+
{ only: 'IndicatorBadge' },
|
|
13
|
+
`${transform}/only`,
|
|
14
|
+
{ parser: 'tsx' },
|
|
15
|
+
);
|
|
@@ -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,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codemod: css-class-removals
|
|
3
|
+
*
|
|
4
|
+
* Handles removed PDS CSS utility classes in JSX className attributes — and
|
|
5
|
+
* any other prop ending in "ClassName" (e.g. iconClassName, labelClassName),
|
|
6
|
+
* a common pattern for components with multiple styleable slots.
|
|
7
|
+
* Driven entirely by cssClasses.removals in mappings.json.
|
|
8
|
+
*
|
|
9
|
+
* Three kinds of change:
|
|
10
|
+
*
|
|
11
|
+
* 1. Direct renames — replacement is another class name:
|
|
12
|
+
* pds-button--navbar → pds-button--subtle
|
|
13
|
+
* pds-ts-9xl → pds-ts-8xl
|
|
14
|
+
* Replaced automatically.
|
|
15
|
+
*
|
|
16
|
+
* 2. Safe removals — replacement text says "no class needed":
|
|
17
|
+
* pds-typography--product → removed (product context is now the default)
|
|
18
|
+
* Removed automatically.
|
|
19
|
+
*
|
|
20
|
+
* 3. Flag only — replacement requires manual styling work with design tokens:
|
|
21
|
+
* pds-color-bg-brand, pds-color-fg-brand, pds-lead-text*, pds-quote-text*
|
|
22
|
+
* Left in place; a warning is printed so the developer can find and fix
|
|
23
|
+
* these manually. Removing them silently would break visible styles with
|
|
24
|
+
* no clear path forward.
|
|
25
|
+
*
|
|
26
|
+
* Handles ternaries / logical expressions, as a bare className expression or
|
|
27
|
+
* nested inside a template literal's ${...} slot, as long as every branch
|
|
28
|
+
* reached is itself a plain string literal:
|
|
29
|
+
* className={isActive ? 'pds-button--navbar' : 'other-class'}
|
|
30
|
+
* className={`base ${isEmployee ? 'pds-lead-text' : 'pds-ts-9xl'}`}
|
|
31
|
+
* className={isOpen && 'pds-button--navbar'}
|
|
32
|
+
*
|
|
33
|
+
* Does not handle truly dynamic class names (a variable, function call, or
|
|
34
|
+
* any branch of a ternary/logical expression that isn't itself a string
|
|
35
|
+
* literal).
|
|
36
|
+
*
|
|
37
|
+
* Usage:
|
|
38
|
+
* npx jscodeshift -t codemods/v1-to-v2/transforms/css-class-removals.js \
|
|
39
|
+
* --extensions=tsx,ts,jsx,js \
|
|
40
|
+
* src/
|
|
41
|
+
*
|
|
42
|
+
* No --only flag — CSS utility classes apply to any element globally.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const path = require('path');
|
|
46
|
+
|
|
47
|
+
const mappings = require(path.join(__dirname, '../mappings.json'));
|
|
48
|
+
|
|
49
|
+
// Extract the first pds-* class name from a replacement string, if present.
|
|
50
|
+
// Strips CSS custom property references (var(--pds-*)) first so that token
|
|
51
|
+
// names mentioned in prose explanations aren't mistaken for class names.
|
|
52
|
+
function extractReplacementClass(replacement) {
|
|
53
|
+
if (!replacement) return null;
|
|
54
|
+
const cleaned = replacement.replace(/var\(--[^)]+\)/g, '');
|
|
55
|
+
const match = cleaned.match(/\bpds-[a-z0-9-]+/);
|
|
56
|
+
return match ? match[0] : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Classify each removal entry into one of three buckets.
|
|
60
|
+
function buildLookups() {
|
|
61
|
+
// { oldClass: newClass } — rename automatically
|
|
62
|
+
const renames = {};
|
|
63
|
+
// Set of class names to remove unconditionally
|
|
64
|
+
const removals = new Set();
|
|
65
|
+
// Set of class names to flag with a warning (no safe auto-fix)
|
|
66
|
+
const flags = new Set();
|
|
67
|
+
|
|
68
|
+
for (const entry of mappings.cssClasses.removals) {
|
|
69
|
+
const { old: oldClass, replacement } = entry;
|
|
70
|
+
if (!oldClass) continue;
|
|
71
|
+
|
|
72
|
+
const replacementClass = extractReplacementClass(replacement);
|
|
73
|
+
if (replacementClass) {
|
|
74
|
+
renames[oldClass] = replacementClass;
|
|
75
|
+
} else if (
|
|
76
|
+
replacement &&
|
|
77
|
+
/no class needed|no replacement/i.test(replacement)
|
|
78
|
+
) {
|
|
79
|
+
removals.add(oldClass);
|
|
80
|
+
} else {
|
|
81
|
+
flags.add(oldClass);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { renames, removals, flags };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const { flags: FLAGS, removals: REMOVALS, renames: RENAMES } = buildLookups();
|
|
89
|
+
|
|
90
|
+
// Process a space-separated class string.
|
|
91
|
+
// Returns { result, changed, flagged[] }
|
|
92
|
+
function processClasses(classString) {
|
|
93
|
+
let changed = false;
|
|
94
|
+
const flagged = [];
|
|
95
|
+
|
|
96
|
+
const result = classString
|
|
97
|
+
.split(/(\s+)/)
|
|
98
|
+
.map((token) => {
|
|
99
|
+
if (/^\s+$/.test(token) || token === '') return token;
|
|
100
|
+
|
|
101
|
+
if (RENAMES[token]) {
|
|
102
|
+
changed = true;
|
|
103
|
+
return RENAMES[token];
|
|
104
|
+
}
|
|
105
|
+
if (REMOVALS.has(token)) {
|
|
106
|
+
changed = true;
|
|
107
|
+
return null; // will be filtered out
|
|
108
|
+
}
|
|
109
|
+
if (FLAGS.has(token)) {
|
|
110
|
+
flagged.push(token);
|
|
111
|
+
}
|
|
112
|
+
return token;
|
|
113
|
+
})
|
|
114
|
+
.filter((token) => token !== null)
|
|
115
|
+
.join('');
|
|
116
|
+
|
|
117
|
+
// Normalise any double-spaces left by removed tokens
|
|
118
|
+
const normalised = result.replace(/ +/g, ' ').trim();
|
|
119
|
+
const didChange = changed || normalised !== classString.trim();
|
|
120
|
+
|
|
121
|
+
return { result: normalised, changed: didChange, flagged };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Recursively process any string-literal branch reachable from `node`
|
|
125
|
+
// without crossing into a non-literal value — i.e. it descends into
|
|
126
|
+
// ternaries (ConditionalExpression) and logical expressions (&&/||),
|
|
127
|
+
// processing each branch that is itself a string literal, but leaves
|
|
128
|
+
// anything else (a variable, a function call, a member expression, ...)
|
|
129
|
+
// untouched since its value isn't knowable statically. Returns the
|
|
130
|
+
// (possibly replaced) node, whether anything changed, and any flagged
|
|
131
|
+
// classes found along the way. Does not mutate in place, so callers must
|
|
132
|
+
// reassign the returned node back onto its parent.
|
|
133
|
+
function processStringLiteralBranches(node, j) {
|
|
134
|
+
if (!node) return { node, changed: false, flagged: [] };
|
|
135
|
+
|
|
136
|
+
if (node.type === 'StringLiteral' || node.type === 'Literal') {
|
|
137
|
+
const { changed, flagged, result } = processClasses(node.value);
|
|
138
|
+
return changed
|
|
139
|
+
? { node: j.stringLiteral(result), changed: true, flagged }
|
|
140
|
+
: { node, changed: false, flagged };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (node.type === 'ConditionalExpression') {
|
|
144
|
+
const consequent = processStringLiteralBranches(node.consequent, j);
|
|
145
|
+
const alternate = processStringLiteralBranches(node.alternate, j);
|
|
146
|
+
if (consequent.changed) node.consequent = consequent.node;
|
|
147
|
+
if (alternate.changed) node.alternate = alternate.node;
|
|
148
|
+
return {
|
|
149
|
+
node,
|
|
150
|
+
changed: consequent.changed || alternate.changed,
|
|
151
|
+
flagged: [...consequent.flagged, ...alternate.flagged],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (node.type === 'LogicalExpression') {
|
|
156
|
+
const left = processStringLiteralBranches(node.left, j);
|
|
157
|
+
const right = processStringLiteralBranches(node.right, j);
|
|
158
|
+
if (left.changed) node.left = left.node;
|
|
159
|
+
if (right.changed) node.right = right.node;
|
|
160
|
+
return {
|
|
161
|
+
node,
|
|
162
|
+
changed: left.changed || right.changed,
|
|
163
|
+
flagged: [...left.flagged, ...right.flagged],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return { node, changed: false, flagged: [] };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = function transform(file, api) {
|
|
171
|
+
const j = api.jscodeshift;
|
|
172
|
+
const root = j(file.source);
|
|
173
|
+
|
|
174
|
+
const allFlagged = []; // { file, class } pairs for the summary warning
|
|
175
|
+
let changed = false;
|
|
176
|
+
|
|
177
|
+
root
|
|
178
|
+
.find(j.JSXAttribute)
|
|
179
|
+
.filter((nodePath) => /className$/i.test(nodePath.node.name.name))
|
|
180
|
+
.forEach((nodePath) => {
|
|
181
|
+
const { value } = nodePath.node;
|
|
182
|
+
if (!value) return;
|
|
183
|
+
|
|
184
|
+
// className="pds-button--navbar foo"
|
|
185
|
+
if (value.type === 'StringLiteral') {
|
|
186
|
+
const { changed: c, flagged, result } = processClasses(value.value);
|
|
187
|
+
if (c) {
|
|
188
|
+
nodePath.node.value = j.stringLiteral(result);
|
|
189
|
+
changed = true;
|
|
190
|
+
}
|
|
191
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (value.type !== 'JSXExpressionContainer') return;
|
|
196
|
+
const { expression } = value;
|
|
197
|
+
|
|
198
|
+
// className={`pds-button--navbar ${isActive ? 'a' : 'b'}`}
|
|
199
|
+
if (expression.type === 'TemplateLiteral') {
|
|
200
|
+
expression.quasis.forEach((quasi) => {
|
|
201
|
+
const {
|
|
202
|
+
changed: c,
|
|
203
|
+
flagged,
|
|
204
|
+
result,
|
|
205
|
+
} = processClasses(quasi.value.raw);
|
|
206
|
+
if (c) {
|
|
207
|
+
quasi.value.raw = result;
|
|
208
|
+
quasi.value.cooked = result;
|
|
209
|
+
changed = true;
|
|
210
|
+
}
|
|
211
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
expression.expressions.forEach((expr, index) => {
|
|
215
|
+
const {
|
|
216
|
+
changed: c,
|
|
217
|
+
flagged,
|
|
218
|
+
node: processed,
|
|
219
|
+
} = processStringLiteralBranches(expr, j);
|
|
220
|
+
if (c) {
|
|
221
|
+
expression.expressions[index] = processed;
|
|
222
|
+
changed = true;
|
|
223
|
+
}
|
|
224
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// className={'pds-button--navbar'}
|
|
230
|
+
// className={isActive ? 'pds-button--navbar' : 'other-class'}
|
|
231
|
+
// className={isOpen && 'pds-button--navbar'}
|
|
232
|
+
const {
|
|
233
|
+
changed: c,
|
|
234
|
+
flagged,
|
|
235
|
+
node: processed,
|
|
236
|
+
} = processStringLiteralBranches(expression, j);
|
|
237
|
+
if (c) {
|
|
238
|
+
value.expression = processed;
|
|
239
|
+
changed = true;
|
|
240
|
+
}
|
|
241
|
+
flagged.forEach((cls) => allFlagged.push(cls));
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Emit warnings for classes that need manual attention
|
|
245
|
+
if (allFlagged.length > 0) {
|
|
246
|
+
const unique = [...new Set(allFlagged)];
|
|
247
|
+
process.stderr.write(
|
|
248
|
+
`\n⚠ ${file.path}\n` +
|
|
249
|
+
unique
|
|
250
|
+
.map(
|
|
251
|
+
(cls) =>
|
|
252
|
+
` ${cls} — removed in v2, no direct replacement. See migration guide.`,
|
|
253
|
+
)
|
|
254
|
+
.join('\n') +
|
|
255
|
+
'\n',
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return changed ? root.toSource() : undefined;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
module.exports.parser = 'tsx';
|