@pantheon-systems/pds-toolkit-react 2.0.0-alpha.36 → 2.0.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/codemods/v1-to-v2/mappings.json +319 -41
  2. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.input.tsx +33 -0
  3. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/basic.output.tsx +33 -0
  4. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.input.tsx +8 -0
  5. package/codemods/v1-to-v2/transforms/__testfixtures__/component-renames/only.output.tsx +8 -0
  6. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.input.tsx +31 -0
  7. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-removals/basic.output.tsx +31 -0
  8. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.input.tsx +31 -0
  9. package/codemods/v1-to-v2/transforms/__testfixtures__/css-class-renames/basic.output.tsx +31 -0
  10. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.input.tsx +35 -0
  11. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/basic.output.tsx +35 -0
  12. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.input.tsx +8 -0
  13. package/codemods/v1-to-v2/transforms/__testfixtures__/icon-name-updates/only.output.tsx +8 -0
  14. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.input.tsx +28 -0
  15. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/basic.output.tsx +28 -0
  16. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.input.tsx +8 -0
  17. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-renames/only.output.tsx +8 -0
  18. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/basic.output.tsx +10 -10
  19. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.input.tsx +21 -0
  20. package/codemods/v1-to-v2/transforms/__testfixtures__/prop-value-standardization/only.output.tsx +21 -0
  21. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.input.tsx +60 -0
  22. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/basic.output.tsx +51 -0
  23. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.input.tsx +8 -0
  24. package/codemods/v1-to-v2/transforms/__testfixtures__/removed-prop-values/only.output.tsx +8 -0
  25. package/codemods/v1-to-v2/transforms/__tests__/component-renames.test.js +15 -0
  26. package/codemods/v1-to-v2/transforms/__tests__/css-class-removals.test.js +6 -0
  27. package/codemods/v1-to-v2/transforms/__tests__/css-class-renames.test.js +6 -0
  28. package/codemods/v1-to-v2/transforms/__tests__/icon-name-updates.test.js +15 -0
  29. package/codemods/v1-to-v2/transforms/__tests__/prop-renames.test.js +15 -0
  30. package/codemods/v1-to-v2/transforms/__tests__/prop-value-standardization.test.js +10 -0
  31. package/codemods/v1-to-v2/transforms/__tests__/removed-prop-values.test.js +15 -0
  32. package/codemods/v1-to-v2/transforms/component-renames.js +166 -0
  33. package/codemods/v1-to-v2/transforms/css-class-removals.js +192 -0
  34. package/codemods/v1-to-v2/transforms/css-class-renames.js +114 -0
  35. package/codemods/v1-to-v2/transforms/icon-name-updates.js +124 -0
  36. package/codemods/v1-to-v2/transforms/prop-renames.js +109 -0
  37. package/codemods/v1-to-v2/transforms/prop-value-standardization.js +33 -2
  38. package/codemods/v1-to-v2/transforms/removed-prop-values.js +206 -0
  39. package/dist/components/Callout/Callout.d.ts +6 -2
  40. package/dist/components/CodeBlock/CodeBlock.d.ts +10 -5
  41. package/dist/components/CodeBlock/code-examples.d.ts +1 -0
  42. package/dist/components/CodeBlock/themes/index.d.ts +1 -2
  43. package/dist/components/CodeBlock/themes/{pdsDark.d.ts → pds.d.ts} +1 -1
  44. package/dist/components/Dropdown/Dropdown.d.ts +46 -0
  45. package/dist/components/PantheonLogo/PantheonLogo.d.ts +5 -4
  46. package/dist/components/SiteFooter/SiteFooter.d.ts +4 -1
  47. package/dist/components/Tabs/Tabs.d.ts +1 -6
  48. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  49. package/dist/components/UtilityBar/UtilityBar.d.ts +2 -3
  50. package/dist/components/badges/StatusBadge/StatusBadge.d.ts +2 -1
  51. package/dist/components/buttons/CloseButton/CloseButton.d.ts +2 -2
  52. package/dist/components/buttons/FilterButton/FilterButton.d.ts +82 -0
  53. package/dist/components/buttons/MenuButton/MenuButton.d.ts +1 -1
  54. package/dist/components/buttons/SegmentedButton/SegmentedButton.d.ts +28 -4
  55. package/dist/components/buttons/SplitButton/SplitButton.d.ts +1 -1
  56. package/dist/components/cards/ActionCard/ActionCard.d.ts +2 -2
  57. package/dist/components/cards/Card/Card.d.ts +2 -2
  58. package/dist/components/icons/Icon/custom-icons.d.ts +1 -1
  59. package/dist/components/icons/Icon/generated-icon-data.d.ts +114 -30
  60. package/dist/components/inputs/Combobox/Combobox.d.ts +1 -1
  61. package/dist/components/inputs/ComboboxMultiselect/ComboboxMultiselect.d.ts +1 -1
  62. package/dist/components/inputs/Select/Select.d.ts +1 -1
  63. package/dist/components/inputs/TagsInput/TagsInput.d.ts +1 -1
  64. package/dist/components/inputs/TextInput/TextInput.d.ts +1 -1
  65. package/dist/components/inputs/Textarea/Textarea.d.ts +1 -1
  66. package/dist/components/loading-indicators/Spinner/Spinner.d.ts +5 -4
  67. package/dist/components/navigation/ButtonNav/ButtonNav.d.ts +1 -5
  68. package/dist/components/navigation/Navbar/Navbar.d.ts +9 -21
  69. package/dist/components/navigation/TabMenu/TabMenu.d.ts +1 -6
  70. package/dist/components/navigation/WorkspaceSelector/WorkspaceSelector.d.ts +0 -11
  71. package/dist/components/panels/Panel/Panel.d.ts +3 -3
  72. package/dist/css/component-css/pds-action-card.css +1 -1
  73. package/dist/css/component-css/pds-avatar.css +1 -1
  74. package/dist/css/component-css/pds-button-nav.css +1 -1
  75. package/dist/css/component-css/pds-button.css +1 -1
  76. package/dist/css/component-css/pds-callout.css +1 -1
  77. package/dist/css/component-css/pds-card-select.css +1 -1
  78. package/dist/css/component-css/pds-card.css +1 -1
  79. package/dist/css/component-css/pds-checkbox.css +1 -1
  80. package/dist/css/component-css/pds-close-button.css +1 -1
  81. package/dist/css/component-css/pds-code-block.css +1 -1
  82. package/dist/css/component-css/pds-combobox-multiselect.css +1 -2
  83. package/dist/css/component-css/pds-combobox.css +1 -1
  84. package/dist/css/component-css/pds-datepicker.css +3 -1
  85. package/dist/css/component-css/pds-dropdown.css +2 -2
  86. package/dist/css/component-css/pds-filter-button.css +1 -0
  87. package/dist/css/component-css/pds-icon.css +1 -1
  88. package/dist/css/component-css/pds-index.css +51 -45
  89. package/dist/css/component-css/pds-input-utilities.css +1 -1
  90. package/dist/css/component-css/pds-menu-button.css +4 -1
  91. package/dist/css/component-css/pds-nav-menu.css +1 -1
  92. package/dist/css/component-css/pds-navbar.css +2 -2
  93. package/dist/css/component-css/pds-panel.css +1 -1
  94. package/dist/css/component-css/pds-pantheon-logo.css +1 -1
  95. package/dist/css/component-css/pds-popover.css +1 -1
  96. package/dist/css/component-css/pds-radio-group.css +1 -1
  97. package/dist/css/component-css/pds-segmented-button.css +2 -1
  98. package/dist/css/component-css/pds-select.css +1 -1
  99. package/dist/css/component-css/pds-side-nav-global.css +1 -1
  100. package/dist/css/component-css/pds-side-nav.css +1 -1
  101. package/dist/css/component-css/pds-site-footer.css +1 -1
  102. package/dist/css/component-css/pds-site-search.css +1 -1
  103. package/dist/css/component-css/pds-spinner.css +1 -1
  104. package/dist/css/component-css/pds-split-button.css +1 -1
  105. package/dist/css/component-css/pds-status-badge.css +1 -1
  106. package/dist/css/component-css/pds-status-indicator.css +1 -1
  107. package/dist/css/component-css/pds-switch.css +2 -2
  108. package/dist/css/component-css/pds-tab-menu.css +1 -1
  109. package/dist/css/component-css/pds-tabs.css +1 -1
  110. package/dist/css/component-css/pds-tags-input.css +1 -1
  111. package/dist/css/component-css/pds-text-input.css +1 -1
  112. package/dist/css/component-css/pds-textarea.css +1 -1
  113. package/dist/css/component-css/pds-toaster.css +1 -1
  114. package/dist/css/component-css/pds-user-menu.css +6 -3
  115. package/dist/css/component-css/pds-utility-bar.css +1 -1
  116. package/dist/css/component-css/pds-utility-button.css +1 -1
  117. package/dist/css/component-css/pds-vertical-empty-state.css +1 -1
  118. package/dist/css/component-css/pds-workspace-selector.css +13 -3
  119. package/dist/css/design-tokens/variables.dark.css +26 -21
  120. package/dist/css/design-tokens/variables.global.css +0 -1
  121. package/dist/css/design-tokens/variables.light.css +26 -21
  122. package/dist/css/design-tokens/variables.typography.css +0 -1
  123. package/dist/css/layout-css/pds-app-layout.css +5 -2
  124. package/dist/css/layout-css/pds-index.css +5 -2
  125. package/dist/css/layout-css/pds-sidebar-layout.css +1 -1
  126. package/dist/css/pds-components.css +51 -45
  127. package/dist/css/pds-core.css +2 -2
  128. package/dist/css/pds-layouts.css +5 -2
  129. package/dist/index.css +1 -1
  130. package/dist/index.d.ts +4 -2
  131. package/dist/index.js +3090 -1859
  132. package/dist/index.js.map +1 -1
  133. package/dist/index.source.d.ts +3 -2
  134. package/dist/layouts/AppLayout/AppLayout.d.ts +22 -2
  135. package/dist/layouts/SidebarLayout/SidebarLayout.d.ts +4 -3
  136. package/dist/layouts/ThreeItemLayout/ThreeItemLayout.d.ts +3 -3
  137. package/dist/layouts/TwoItemLayout/TwoItemLayout.d.ts +3 -3
  138. package/dist/libs/components/NavAccordion/NavAccordion.d.ts +1 -1
  139. package/dist/libs/types/custom-types.d.ts +1 -1
  140. package/dist/libs/types/layout-types.d.ts +2 -1
  141. package/dist/svg/circleHalfStroke.svg +3 -0
  142. package/dist/svg/claude.svg +3 -0
  143. package/dist/svg/clock.svg +3 -0
  144. package/dist/svg/diagramVenn.svg +3 -0
  145. package/dist/svg/floppyDisk.svg +3 -0
  146. package/dist/svg/grid.svg +2 -2
  147. package/dist/svg/grid2.svg +3 -0
  148. package/dist/svg/octagonExclamation.svg +3 -0
  149. package/dist/svg/openai.svg +3 -0
  150. package/dist/svg/slider.svg +3 -0
  151. package/dist/svg/squareDashed.svg +3 -0
  152. package/dist/svg/tableColumns.svg +3 -0
  153. package/dist/svg/userSolid.svg +3 -0
  154. package/dist/utilities/FlexContainer/FlexContainer.d.ts +5 -6
  155. package/dist/utilities/grid/Grid.d.ts +58 -0
  156. package/dist/utilities/grid/GridItem.d.ts +57 -0
  157. package/package.json +2 -2
  158. package/dist/components/CodeBlock/themes/pdsLight.d.ts +0 -2
  159. package/dist/components/notifications/NotificationHubIcon/NotificationHubIcon.d.ts +0 -38
  160. package/dist/components/notifications/NotificationsPopover/NotificationsPopover.d.ts +0 -113
  161. package/dist/css/component-css/pds-notification-hub-icon.css +0 -1
  162. package/dist/css/component-css/pds-notifications-popover.css +0 -13
  163. /package/dist/svg/{arrowDownLeftAndArrowUpRightToCenter.svg → collapseToCenter.svg} +0 -0
  164. /package/dist/svg/{linkSimple.svg → link.svg} +0 -0
  165. /package/dist/svg/{arrowsUpDownLeftRight.svg → move.svg} +0 -0
  166. /package/dist/svg/{linkSimpleSlash.svg → unlink.svg} +0 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Codemod: prop-renames
3
+ *
4
+ * Renames PDS v1 prop names to their v2 names on JSX elements.
5
+ * Driven entirely by props.renames in mappings.json.
6
+ *
7
+ * Usage (all renames):
8
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
9
+ * --extensions=tsx,ts,jsx,js \
10
+ * src/
11
+ *
12
+ * Usage (single component — recommended for by-component migrations):
13
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
14
+ * --only=Button \
15
+ * --extensions=tsx,ts,jsx,js \
16
+ * src/
17
+ *
18
+ * Usage (multiple components):
19
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-renames.js \
20
+ * --only=Button,Icon \
21
+ * --extensions=tsx,ts,jsx,js \
22
+ * src/
23
+ *
24
+ * --only accepts a comma-separated list of component names.
25
+ *
26
+ * Limitations:
27
+ * - Renames where `from` is a nested path (e.g. `options[].description`)
28
+ * cannot be transformed at the JSX attribute level and are skipped.
29
+ * These require manual review.
30
+ */
31
+
32
+ const path = require('path');
33
+ const mappings = require(path.join(__dirname, '../mappings.json'));
34
+
35
+ // Build lookup: { 'ComponentName.oldPropName': 'newPropName' }
36
+ // Skips entries where `from` is a nested path (contains '.' or '[]').
37
+ function buildRenamesLookup() {
38
+ const lookup = {};
39
+ for (const entry of mappings.props.renames) {
40
+ const { component, from, to } = entry;
41
+ if (!component || !from || !to) continue;
42
+ // Skip nested paths — these can't be transformed at the attribute level
43
+ if (from.includes('.') || from.includes('[')) continue;
44
+ lookup[`${component}.${from}`] = to;
45
+ }
46
+ return lookup;
47
+ }
48
+
49
+ const ALL_RENAMES = buildRenamesLookup();
50
+
51
+ module.exports = function transform(file, api, options) {
52
+ const j = api.jscodeshift;
53
+ const root = j(file.source);
54
+
55
+ // Parse --only flag: comma-separated component names
56
+ const onlyComponents =
57
+ options && options.only
58
+ ? new Set(
59
+ options.only
60
+ .split(',')
61
+ .map((s) => s.trim())
62
+ .filter(Boolean),
63
+ )
64
+ : null;
65
+
66
+ // Map local import name → exported component name
67
+ const localToExported = new Map();
68
+
69
+ root.find(j.ImportDeclaration).forEach((nodePath) => {
70
+ if (nodePath.node.source.value !== '@pantheon-systems/pds-toolkit-react')
71
+ return;
72
+ nodePath.node.specifiers.forEach((spec) => {
73
+ if (spec.type === 'ImportSpecifier') {
74
+ localToExported.set(spec.local.name, spec.imported.name);
75
+ }
76
+ });
77
+ });
78
+
79
+ if (localToExported.size === 0) return;
80
+
81
+ let changed = false;
82
+
83
+ root.find(j.JSXOpeningElement).forEach((nodePath) => {
84
+ const nameNode = nodePath.node.name;
85
+ if (nameNode.type !== 'JSXIdentifier') return;
86
+
87
+ const exportedName = localToExported.get(nameNode.name);
88
+ if (!exportedName) return;
89
+
90
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
91
+
92
+ nodePath.node.attributes.forEach((attr) => {
93
+ if (attr.type !== 'JSXAttribute') return;
94
+
95
+ const propName = attr.name.name;
96
+ if (typeof propName !== 'string') return;
97
+
98
+ const newPropName = ALL_RENAMES[`${exportedName}.${propName}`];
99
+ if (!newPropName) return;
100
+
101
+ attr.name = j.jsxIdentifier(newPropName);
102
+ changed = true;
103
+ });
104
+ });
105
+
106
+ return changed ? root.toSource() : undefined;
107
+ };
108
+
109
+ module.exports.parser = 'tsx';
@@ -4,10 +4,26 @@
4
4
  * Standardizes size-related prop values across PDS v1→v2.
5
5
  * Driven entirely by props.typeChanges[].migration in mappings.json.
6
6
  *
7
- * Usage:
7
+ * Usage (all components):
8
8
  * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
9
9
  * --extensions=tsx,ts,jsx,js \
10
10
  * src/
11
+ *
12
+ * Usage (single component — recommended for by-component migrations):
13
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
14
+ * --only=Spinner \
15
+ * --extensions=tsx,ts,jsx,js \
16
+ * src/
17
+ *
18
+ * Usage (multiple components):
19
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/prop-value-standardization.js \
20
+ * --only=Spinner,Avatar \
21
+ * --extensions=tsx,ts,jsx,js \
22
+ * src/
23
+ *
24
+ * --only accepts a comma-separated list of exported component names. When
25
+ * provided, only rules for those components are applied. This prevents the
26
+ * transform from rewriting size values on components that are still on V1.
11
27
  */
12
28
 
13
29
  const path = require('path');
@@ -43,10 +59,22 @@ function buildMigrationLookup() {
43
59
 
44
60
  const MIGRATION_LOOKUP = buildMigrationLookup();
45
61
 
46
- module.exports = function transform(file, api) {
62
+ module.exports = function transform(file, api, options) {
47
63
  const j = api.jscodeshift;
48
64
  const root = j(file.source);
49
65
 
66
+ // Parse --only flag into a Set of component names for O(1) lookup.
67
+ // Accepts comma-separated values: --only=Spinner,Avatar
68
+ const onlyComponents =
69
+ options && options.only
70
+ ? new Set(
71
+ options.only
72
+ .split(',')
73
+ .map((s) => s.trim())
74
+ .filter(Boolean),
75
+ )
76
+ : null;
77
+
50
78
  // Map local import name → exported component name
51
79
  // Handles aliased imports: import { Spinner as MySpinner } → { MySpinner: 'Spinner' }
52
80
  const localToExported = new Map();
@@ -73,6 +101,9 @@ module.exports = function transform(file, api) {
73
101
  const exportedName = localToExported.get(nameNode.name);
74
102
  if (!exportedName) return;
75
103
 
104
+ // Skip this component if --only is set and it isn't in the list
105
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
106
+
76
107
  nodePath.node.attributes.forEach((attr) => {
77
108
  if (attr.type !== 'JSXAttribute' || !attr.value) return;
78
109
 
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Codemod: removed-prop-values
3
+ *
4
+ * Handles props that were removed or had specific values removed in PDS v1→v2.
5
+ * Driven entirely by props.removals in mappings.json.
6
+ *
7
+ * Two kinds of change:
8
+ *
9
+ * 1. Value rewrites (entries with `oldValue`):
10
+ * The prop stays but a specific string value changes.
11
+ * e.g. Button variant="brand-secondary" → variant="secondary"
12
+ *
13
+ * 2. Prop removals (all other entries):
14
+ * - Plain removals: the prop is removed unconditionally.
15
+ * e.g. <Panel hasStatusIndicator> → <Panel>
16
+ * - Conditional removals (entries with `removedValues`): the prop is
17
+ * removed only when its value is in the removed set; other values are
18
+ * left untouched.
19
+ * e.g. Card background="mint-gradient" → prop removed
20
+ * Card background="default" → unchanged
21
+ *
22
+ * Usage (all components):
23
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/removed-prop-values.js \
24
+ * --extensions=tsx,ts,jsx,js \
25
+ * src/
26
+ *
27
+ * Usage (single component — recommended for by-component migrations):
28
+ * npx jscodeshift -t codemods/v1-to-v2/transforms/removed-prop-values.js \
29
+ * --only=Button \
30
+ * --extensions=tsx,ts,jsx,js \
31
+ * src/
32
+ *
33
+ * Limitations:
34
+ * - Only static string literals and boolean shorthand attributes are
35
+ * transformed. Dynamic values (variables, expressions) are left as-is
36
+ * and need manual review.
37
+ * - Table.headers is skipped — its removal requires a structural object
38
+ * shape change that cannot be automated at the attribute level.
39
+ */
40
+
41
+ const path = require('path');
42
+ const mappings = require(path.join(__dirname, '../mappings.json'));
43
+
44
+ // Entries that are too complex to automate
45
+ const SKIP_PROPS = new Set(['Table.headers']);
46
+
47
+ function buildLookups() {
48
+ // { 'Component.prop.oldValue': 'newValue' }
49
+ const valueRewrites = {};
50
+ // { 'Component.prop': null | Set<removedValues> }
51
+ // null → remove the prop unconditionally
52
+ // Set → remove only when value is in the set
53
+ const propRemovals = {};
54
+
55
+ for (const entry of mappings.props.removals) {
56
+ const { component, prop } = entry;
57
+ if (!component || !prop) continue;
58
+
59
+ const key = `${component}.${prop}`;
60
+ if (SKIP_PROPS.has(key)) continue;
61
+
62
+ if (entry.oldValue) {
63
+ // Value rewrite: derive new value from the replacement text
64
+ // Replacement is prose like "Use variant=\"secondary\""
65
+ // Extract the first quoted value found, e.g. "secondary"
66
+ const match =
67
+ entry.replacement && entry.replacement.match(/["']([^"']+)["']/);
68
+ const newValue = match ? match[1] : null;
69
+ if (newValue) {
70
+ valueRewrites[`${key}.${entry.oldValue}`] = newValue;
71
+ }
72
+ } else if (entry.removedValues) {
73
+ // Conditional removal: remove only when value is in the set
74
+ propRemovals[key] = new Set(entry.removedValues);
75
+ } else {
76
+ // Unconditional removal
77
+ propRemovals[key] = null;
78
+ }
79
+ }
80
+
81
+ return { valueRewrites, propRemovals };
82
+ }
83
+
84
+ const { valueRewrites: ALL_VALUE_REWRITES, propRemovals: ALL_PROP_REMOVALS } =
85
+ buildLookups();
86
+
87
+ module.exports = function transform(file, api, options) {
88
+ const j = api.jscodeshift;
89
+ const root = j(file.source);
90
+
91
+ // Parse --only flag: comma-separated component names
92
+ const onlyComponents =
93
+ options && options.only
94
+ ? new Set(
95
+ options.only
96
+ .split(',')
97
+ .map((s) => s.trim())
98
+ .filter(Boolean),
99
+ )
100
+ : null;
101
+
102
+ // Map local import name → exported component name
103
+ const localToExported = new Map();
104
+
105
+ root.find(j.ImportDeclaration).forEach((nodePath) => {
106
+ if (nodePath.node.source.value !== '@pantheon-systems/pds-toolkit-react')
107
+ return;
108
+ nodePath.node.specifiers.forEach((spec) => {
109
+ if (spec.type === 'ImportSpecifier') {
110
+ localToExported.set(spec.local.name, spec.imported.name);
111
+ }
112
+ });
113
+ });
114
+
115
+ if (localToExported.size === 0) return;
116
+
117
+ let changed = false;
118
+
119
+ root.find(j.JSXOpeningElement).forEach((nodePath) => {
120
+ const nameNode = nodePath.node.name;
121
+ if (nameNode.type !== 'JSXIdentifier') return;
122
+
123
+ const exportedName = localToExported.get(nameNode.name);
124
+ if (!exportedName) return;
125
+
126
+ if (onlyComponents && !onlyComponents.has(exportedName)) return;
127
+
128
+ const attrsToRemove = [];
129
+
130
+ nodePath.node.attributes.forEach((attr) => {
131
+ if (attr.type !== 'JSXAttribute') return;
132
+
133
+ const propName = attr.name.name;
134
+ if (typeof propName !== 'string') return;
135
+
136
+ const key = `${exportedName}.${propName}`;
137
+
138
+ // --- Value rewrites ---
139
+ // String literal: variant="brand-secondary"
140
+ if (attr.value && attr.value.type === 'StringLiteral') {
141
+ const rewriteKey = `${key}.${attr.value.value}`;
142
+ const newValue = ALL_VALUE_REWRITES[rewriteKey];
143
+ if (newValue) {
144
+ attr.value = j.stringLiteral(newValue);
145
+ changed = true;
146
+ return;
147
+ }
148
+ }
149
+ // JSX expression container: variant={"brand-secondary"}
150
+ if (
151
+ attr.value &&
152
+ attr.value.type === 'JSXExpressionContainer' &&
153
+ attr.value.expression.type === 'StringLiteral'
154
+ ) {
155
+ const rewriteKey = `${key}.${attr.value.expression.value}`;
156
+ const newValue = ALL_VALUE_REWRITES[rewriteKey];
157
+ if (newValue) {
158
+ attr.value.expression = j.stringLiteral(newValue);
159
+ changed = true;
160
+ return;
161
+ }
162
+ }
163
+
164
+ // --- Prop removals ---
165
+ if (!(key in ALL_PROP_REMOVALS)) return;
166
+ const removedValues = ALL_PROP_REMOVALS[key];
167
+
168
+ if (removedValues === null) {
169
+ // Unconditional removal (boolean shorthand or any value)
170
+ attrsToRemove.push(attr);
171
+ changed = true;
172
+ return;
173
+ }
174
+
175
+ // Conditional removal — only remove when value is in the removed set
176
+ let attrValue = null;
177
+ if (!attr.value) {
178
+ // Boolean shorthand e.g. <Card background> — unlikely but handle it
179
+ attrValue = 'true';
180
+ } else if (attr.value.type === 'StringLiteral') {
181
+ attrValue = attr.value.value;
182
+ } else if (
183
+ attr.value.type === 'JSXExpressionContainer' &&
184
+ attr.value.expression.type === 'StringLiteral'
185
+ ) {
186
+ attrValue = attr.value.expression.value;
187
+ }
188
+
189
+ if (attrValue !== null && removedValues.has(attrValue)) {
190
+ attrsToRemove.push(attr);
191
+ changed = true;
192
+ }
193
+ });
194
+
195
+ // Remove collected attributes
196
+ if (attrsToRemove.length > 0) {
197
+ nodePath.node.attributes = nodePath.node.attributes.filter(
198
+ (attr) => !attrsToRemove.includes(attr),
199
+ );
200
+ }
201
+ });
202
+
203
+ return changed ? root.toSource() : undefined;
204
+ };
205
+
206
+ module.exports.parser = 'tsx';
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import { StatusType } from '../../libs/types/custom-types';
2
+ import { HeadingLevelCommon, StatusType } from '../../libs/types/custom-types';
3
3
  import './callout.css';
4
4
  type CalloutType = StatusType | 'code' | 'earlyAccess';
5
5
  type TypeLabels = Record<CalloutType, string>;
@@ -12,6 +12,10 @@ export interface CalloutProps extends ComponentPropsWithoutRef<'div'> {
12
12
  * Additional class names
13
13
  */
14
14
  className?: string;
15
+ /**
16
+ * Semantic element for the title. Styles are identical regardless of element chosen.
17
+ */
18
+ headingLevel?: HeadingLevelCommon;
15
19
  /**
16
20
  * Callout title.
17
21
  */
@@ -28,5 +32,5 @@ export interface CalloutProps extends ComponentPropsWithoutRef<'div'> {
28
32
  /**
29
33
  * Callout UI component
30
34
  */
31
- export declare const Callout: ({ children, className, title, type, typeLabels, ...props }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const Callout: ({ children, className, headingLevel, title, type, typeLabels, ...props }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
32
36
  export {};
@@ -1,4 +1,13 @@
1
1
  import { ComponentPropsWithoutRef } from 'react';
2
+ import 'prismjs/components/prism-markup';
3
+ import 'prismjs/components/prism-css';
4
+ import 'prismjs/components/prism-clike';
5
+ import 'prismjs/components/prism-javascript';
6
+ import 'prismjs/components/prism-typescript';
7
+ import 'prismjs/components/prism-jsx';
8
+ import 'prismjs/components/prism-tsx';
9
+ import 'prismjs/components/prism-json';
10
+ import 'prismjs/components/prism-yaml';
2
11
  import 'prismjs/components/prism-bash';
3
12
  import 'prismjs/components/prism-diff';
4
13
  import './code-block.css';
@@ -16,10 +25,6 @@ export interface CodeBlockProps extends ComponentPropsWithoutRef<'div'> {
16
25
  * Code to display.
17
26
  */
18
27
  code: string;
19
- /**
20
- * Color type. Default is dark.
21
- */
22
- colorType?: 'dark' | 'light';
23
28
  /**
24
29
  * Copy button label. Aria-label and tooltip text for the copy button.
25
30
  */
@@ -81,5 +86,5 @@ export interface CodeBlockProps extends ComponentPropsWithoutRef<'div'> {
81
86
  /**
82
87
  * CodeBlock UI component
83
88
  */
84
- export declare const CodeBlock: ({ className, code, colorType, copyButtonLabel, hasCopyButton, hasLineNumbers, hasPrompt, height, isLoading, language, loadingLineCount, maxHeight, promptSymbol, renderAsLegacy, shouldWrap, ...props }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
89
+ export declare const CodeBlock: ({ className, code, copyButtonLabel, hasCopyButton, hasLineNumbers, hasPrompt, height, isLoading, language, loadingLineCount, maxHeight, promptSymbol, renderAsLegacy, shouldWrap, ...props }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
85
90
  export {};
@@ -3,4 +3,5 @@ export declare const reactExample = "export const ControlledExample = () => {\n
3
3
  export declare const cssExample = ".pds-file-diff {\n align-items: center;\n display: flex;\n gap: 0.25rem;\n height: 1.0625rem;\n max-width: 100%;\n width: 100%;\n\n .pds-file-diff__total-changes {\n color: var(--pds-color-foreground-default-secondary);\n font-size: var(--pds-typography-size-xs);\n }\n\n .pds-file-diff__bars {\n align-items: center;\n display: flex;\n gap: 0.125rem;\n width: 100%;\n }\n\n .pds-file-diff__behind {\n position: relative;\n\n .pds-file-diff__behind-bar {\n background-color: var(--pds-color-status-critical-utility);\n border-bottom-left-radius: 6.25rem;\n border-top-left-radius: 6.25rem;\n height: 8px;\n min-width: 1px;\n right: 0px;\n transition: width 0.3s ease;\n width: 100%;\n }\n }\n\n .pds-file-diff__ahead {\n position: relative;\n\n .pds-file-diff__ahead-bar {\n background-color: var(--pds-color-status-success-utility);\n border-bottom-right-radius: 6.25rem;\n border-top-right-radius: 6.25rem;\n height: 8px;\n left: 0px;\n min-width: 1px;\n transition: width 0.3s ease;\n width: 100%;\n }\n }\n\n .pds-file-diff__tooltip {\n display: block;\n padding-inline: 0;\n }\n}\n";
4
4
  export declare const diffExample = "diff --git a/influitive/index.css b/influitive/index.css\nindex 2069af6..b347ca3 100644\n--- a/influitive/index.css\n+++ b/influitive/index.css\n@@ -1,4 +1,4 @@\n #nav-container ul li.c-nav-list-item a.c-nav-item {\n font-weight: 500 !important;\n- font-family: 'Poppins', san-serif !important;\n+ font-family: 'Poppins', sans-serif !important;\n }";
5
5
  export declare const twigExample = "<div class=\"pds-status-badge pds-status-badge--{{ color|default('transparent')}}{% if extra_classes %} {{ extra_classes }}{% endif %}\">\n\n {% if has_status_indicator %}\n <span class=\"pds-status-badge__status pds-status-badge__status--{{ status_type }}\">\n {% if status_type %}\n <span class=\"visually-hidden\">Status: {{ status_type }}</span>\n {% endif %}\n </span>\n {% endif %}\n\n <span class=\"pds-status-badge__label\">{{ label }}</span>\n</div>";
6
+ export declare const jsonExample = "{\n \"site\": {\n \"id\": \"26d20ebf-b2fb-466e-9db3-4c001db441d6\",\n \"name\": \"my-awesome-site\",\n \"framework\": \"wordpress\",\n \"region\": \"United States\",\n \"created_at\": \"2024-01-15T08:30:00+00:00\",\n \"php_version\": \"8.3\",\n \"upstream\": {\n \"id\": \"e8fe8550-1ab9-4964-8838-2b9abdccf4bf\",\n \"label\": \"WordPress\",\n \"type\": \"core\"\n },\n \"environments\": [\"dev\", \"test\", \"live\"],\n \"frozen\": false,\n \"max_num_cdes\": 10\n }\n}";
6
7
  export declare const legacyExample = "Composer version 2.8.6 2025-02-25 13:03:50<br>PHP version 8.3.21 (&#47;opt&#47;pantheon&#47;php8.3&#47;php)<br>Run the &quot;diagnose&quot; command to get more detailed diagnostics output.<br>Cache directory does not exist (cache-vcs-dir):<br>Cache directory does not exist (cache-repo-dir):<br>Cache directory does not exist (cache-files-dir):<br>Clearing cache (cache-dir): &#47;home&#47;pantheon-app&#47;.composer&#47;cache<br>All caches cleared.<br>Running composer install...<br>composer --no-interaction --no-progress --prefer-dist --ansi install<br><span class=\"term-fg32\">No patches supplied.</span><br><span class=\"term-fg32\">Installing dependencies from lock file (including require-dev)</span><br><span class=\"term-fg32\">Verifying lock file contents can be installed on current platform.</span><br>Nothing to install, update or remove<br><span class=\"term-fg32\">Generating autoload files</span><br><span class=\"term-fg32\">89 packages you are using are looking for funding.</span><br><span class=\"term-fg32\">Use the `composer fund` command to find out more!</span><br><span class=\"term-fg32\">phpstan&#47;extension-installer:</span> Extensions installed";
@@ -1,2 +1 @@
1
- export * from './pdsDark';
2
- export * from './pdsLight';
1
+ export * from './pds';
@@ -1,2 +1,2 @@
1
1
  import type { PrismTheme } from 'prism-react-renderer';
2
- export declare const pdsDark: PrismTheme;
2
+ export declare const pds: PrismTheme;
@@ -25,9 +25,11 @@ export declare const Dropdown: {
25
25
  Trigger: ({ children, className, showTriggerIcon, ...props }: DropdownTriggerProps) => import("react/jsx-runtime").JSX.Element;
26
26
  Panel: ({ children, className, ...props }: DropdownPanelProps) => import("react/jsx-runtime").JSX.Element;
27
27
  Item: ({ children, className, description, disabled, icon, index, isActive, isCritical, onClick, trailingIcon, ...props }: DropdownItemProps) => import("react/jsx-runtime").JSX.Element;
28
+ CheckboxItem: ({ checked, children, className, description, disabled, indeterminate, index, onCheckedChange, onClick, onKeyDown, ...props }: DropdownCheckboxItemProps) => import("react/jsx-runtime").JSX.Element;
28
29
  Heading: ({ children, className, ...props }: DropdownHeadingProps) => import("react/jsx-runtime").JSX.Element;
29
30
  Separator: ({ className, ...props }: DropdownSeparatorProps) => import("react/jsx-runtime").JSX.Element;
30
31
  Filter: ({ className, filterIcon, label, noResultsText, onFilterChange, placeholder, showNoResults, ...props }: DropdownFilterProps) => import("react/jsx-runtime").JSX.Element;
32
+ Footer: ({ children, className, ...props }: DropdownFooterProps) => import("react/jsx-runtime").JSX.Element;
31
33
  };
32
34
  export interface DropdownTriggerProps extends ComponentPropsWithoutRef<'button'> {
33
35
  /**
@@ -91,6 +93,40 @@ export interface DropdownItemProps extends ComponentPropsWithoutRef<'li'> {
91
93
  */
92
94
  trailingIcon?: ReactNode;
93
95
  }
96
+ export interface DropdownCheckboxItemProps extends Omit<ComponentPropsWithoutRef<'li'>, 'onChange'> {
97
+ /**
98
+ * Checked state of the item.
99
+ */
100
+ checked?: boolean;
101
+ /**
102
+ * Item label content.
103
+ */
104
+ children?: ReactNode;
105
+ /**
106
+ * Additional class names.
107
+ */
108
+ className?: string;
109
+ /**
110
+ * Secondary text displayed below the label.
111
+ */
112
+ description?: ReactNode;
113
+ /**
114
+ * Disabled state.
115
+ */
116
+ disabled?: boolean;
117
+ /**
118
+ * Partial/mixed state — renders a dash instead of a check.
119
+ */
120
+ indeterminate?: boolean;
121
+ /**
122
+ * Index of this item in the list (required for keyboard navigation).
123
+ */
124
+ index: number;
125
+ /**
126
+ * Callback fired when the item is toggled, with the next checked value.
127
+ */
128
+ onCheckedChange?: (checked: boolean) => void;
129
+ }
94
130
  export interface DropdownHeadingProps extends ComponentPropsWithoutRef<'li'> {
95
131
  /**
96
132
  * Heading text.
@@ -138,3 +174,13 @@ export interface DropdownFilterProps extends ComponentPropsWithoutRef<'li'> {
138
174
  */
139
175
  showNoResults?: boolean;
140
176
  }
177
+ export interface DropdownFooterProps extends ComponentPropsWithoutRef<'li'> {
178
+ /**
179
+ * Footer content — typically a single link or button (rendered as a link).
180
+ */
181
+ children?: ReactNode;
182
+ /**
183
+ * Additional class names.
184
+ */
185
+ className?: string;
186
+ }
@@ -1,6 +1,7 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
2
  import './pantheon-logo.css';
3
- export type PantheonLogoDisplayType = 'full' | 'icon' | 'wordmark' | 'sub-brand' | 'sub-brand-small';
3
+ export type PantheonLogoDisplayType = 'full' | 'icon' | 'wordmark';
4
+ export type PantheonLogoSize = 's' | 'm' | 'l';
4
5
  /**
5
6
  * Prop types for PantheonLogo
6
7
  */
@@ -22,11 +23,11 @@ export interface PantheonLogoProps extends ComponentPropsWithoutRef<'div'> {
22
23
  */
23
24
  linkContent?: ReactNode;
24
25
  /**
25
- * Accepts a fully-formed link or a string (if a static site name is desired). Will only render if the `display-type` is set to 'sub-brand'.
26
+ * Size of the logo. The wordmark height is the basis `s`, `m`, and `l` map to the corresponding typography size tokens.
26
27
  */
27
- subBrand?: ReactNode | string;
28
+ size?: PantheonLogoSize;
28
29
  }
29
30
  /**
30
31
  * PantheonLogo UI component
31
32
  */
32
- export declare const PantheonLogo: ({ className, colorType, displayType, linkContent, subBrand, ...props }: PantheonLogoProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const PantheonLogo: ({ className, colorType, displayType, linkContent, size, ...props }: PantheonLogoProps) => import("react/jsx-runtime").JSX.Element;
@@ -15,7 +15,10 @@ export interface SiteFooterProps extends ComponentPropsWithoutRef<'footer'> {
15
15
  */
16
16
  className?: string;
17
17
  /**
18
- * PDS container width.
18
+ * PDS container width, controlling the footer's max-width and inline padding.
19
+ * Defaults to 'full' (full width, edge-to-edge, no padding) so the containing
20
+ * layout or app provides the gutter; set a constrained width (e.g. 'x-wide')
21
+ * to have the footer constrain and pad itself.
19
22
  */
20
23
  containerWidth?: ContainerWidth;
21
24
  /**
@@ -30,7 +30,6 @@ interface Tabs {
30
30
  type: 'neutral' | 'critical' | 'warning' | 'info' | 'success';
31
31
  };
32
32
  }
33
- export type TabsSize = 's' | 'm';
34
33
  interface TabsProps extends ComponentPropsWithoutRef<'div'> {
35
34
  /**
36
35
  * Sets tabset aria label
@@ -52,10 +51,6 @@ interface TabsProps extends ComponentPropsWithoutRef<'div'> {
52
51
  * Sets currently selected tab using a zero-based index
53
52
  */
54
53
  selectedTab?: number;
55
- /**
56
- * Size of the tabs.
57
- */
58
- size?: TabsSize;
59
54
  /**
60
55
  * Array of objects for tab data
61
56
  */
@@ -64,5 +59,5 @@ interface TabsProps extends ComponentPropsWithoutRef<'div'> {
64
59
  /**
65
60
  * Tabs UI component
66
61
  */
67
- export declare const Tabs: ({ ariaLabel, className, defaultSelected, onActiveTabChange, selectedTab, size, tabs, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
62
+ export declare const Tabs: ({ ariaLabel, className, defaultSelected, onActiveTabChange, selectedTab, tabs, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
68
63
  export {};
@@ -42,7 +42,7 @@ interface TooltipProps extends ComponentPropsWithoutRef<'div'> {
42
42
  /**
43
43
  * Size of the trigger icon. Uses PDS Icon sizing.
44
44
  */
45
- triggerIconSize?: 'xs' | 's' | 'm' | 'l';
45
+ triggerIconSize?: 's' | 'm' | 'l';
46
46
  /**
47
47
  * Z-index value for the tooltip container. In most cases, the default value should be retained.
48
48
  */
@@ -1,8 +1,7 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import { GridGapOptions } from '../../libs/types/layout-types';
2
+ import { PaddingScale } from '../../libs/types/layout-types';
3
3
  import './utility-bar.css';
4
4
  type UtilityBarBackground = 'default' | 'default-secondary' | 'transparent';
5
- type UtilityBarPadding = GridGapOptions | 'none';
6
5
  export interface UtilityBarProps extends ComponentPropsWithoutRef<'div'> {
7
6
  /**
8
7
  * Background color of the utility bar.
@@ -21,7 +20,7 @@ export interface UtilityBarProps extends ComponentPropsWithoutRef<'div'> {
21
20
  /**
22
21
  * Internal padding. Defaults to 'none'.
23
22
  */
24
- padding?: UtilityBarPadding;
23
+ padding?: PaddingScale;
25
24
  }
26
25
  export declare const UtilityBar: ({ backgroundColor, children, className, padding, ...props }: UtilityBarProps) => import("react/jsx-runtime").JSX.Element;
27
26
  export {};
@@ -27,8 +27,9 @@ export interface StatusBadgeProps extends ComponentPropsWithoutRef<'div'> {
27
27
  statusIndicatorText?: string;
28
28
  /**
29
29
  * Status type for badge. Only renders if `hasStatusIndicator` is true.
30
+ * Use `'working'` to show a spinner in place of the status dot.
30
31
  */
31
- statusType?: StatusType | 'frozen' | 'disabled';
32
+ statusType?: StatusType | 'frozen' | 'disabled' | 'working';
32
33
  }
33
34
  /**
34
35
  * StatusBadge UI component
@@ -17,9 +17,9 @@ export interface CloseButtonProps extends ComponentPropsWithoutRef<'button'> {
17
17
  */
18
18
  onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
19
19
  /**
20
- * Size of the icon.
20
+ * Size of the button.
21
21
  */
22
- size?: 'm' | 'l' | 'xl';
22
+ size?: 's' | 'm' | 'l';
23
23
  }
24
24
  /**
25
25
  * CloseButton UI component