@pantheon-systems/pds-toolkit-react 2.0.0-alpha.37 → 2.0.0-alpha.39
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/codemods/v1-to-v2/mappings.json +217 -28
- 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.output.tsx +10 -10
- 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 +10 -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 +33 -2
- package/codemods/v1-to-v2/transforms/removed-prop-values.js +206 -0
- package/dist/components/Dropdown/Dropdown.d.ts +46 -0
- package/dist/components/SiteFooter/SiteFooter.d.ts +4 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/UtilityBar/UtilityBar.d.ts +2 -3
- package/dist/components/buttons/ButtonLink/ButtonLink.d.ts +1 -3
- package/dist/components/buttons/CloseButton/CloseButton.d.ts +2 -2
- package/dist/components/buttons/FilterButton/FilterButton.d.ts +82 -0
- package/dist/components/buttons/SegmentedButton/SegmentedButton.d.ts +7 -1
- package/dist/components/cards/ActionCard/ActionCard.d.ts +2 -2
- package/dist/components/cards/Card/Card.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 +107 -30
- package/dist/components/navigation/Navbar/Navbar.d.ts +10 -1
- package/dist/components/panels/Panel/Panel.d.ts +2 -2
- package/dist/components/progress-indicators/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/progress-indicators/ProgressRing/ProgressRing.d.ts +10 -1
- package/dist/css/component-css/pds-action-card.css +1 -1
- package/dist/css/component-css/pds-button-link.css +1 -1
- package/dist/css/component-css/pds-button.css +1 -1
- package/dist/css/component-css/pds-card.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-dropdown.css +2 -2
- package/dist/css/component-css/pds-filter-button.css +1 -0
- package/dist/css/component-css/pds-icon.css +1 -1
- package/dist/css/component-css/pds-index.css +23 -23
- package/dist/css/component-css/pds-panel.css +1 -1
- package/dist/css/component-css/pds-progress-ring.css +1 -1
- package/dist/css/component-css/pds-radio-group.css +1 -1
- package/dist/css/component-css/pds-segmented-button.css +1 -1
- package/dist/css/component-css/pds-side-nav-global.css +1 -1
- package/dist/css/component-css/pds-site-footer.css +1 -1
- package/dist/css/component-css/pds-site-search.css +1 -1
- package/dist/css/component-css/pds-skeleton.css +1 -1
- package/dist/css/component-css/pds-switch.css +2 -2
- package/dist/css/component-css/pds-utility-bar.css +1 -1
- package/dist/css/component-css/pds-vertical-empty-state.css +1 -1
- package/dist/css/design-tokens/variables.dark.css +6 -2
- package/dist/css/design-tokens/variables.global.css +0 -1
- package/dist/css/design-tokens/variables.light.css +4 -0
- package/dist/css/layout-css/pds-app-layout.css +5 -2
- package/dist/css/layout-css/pds-index.css +5 -2
- package/dist/css/layout-css/pds-sidebar-layout.css +1 -1
- package/dist/css/pds-components.css +23 -23
- package/dist/css/pds-core.css +2 -2
- package/dist/css/pds-layouts.css +5 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1340 -1032
- package/dist/index.js.map +1 -1
- package/dist/index.source.d.ts +3 -0
- package/dist/layouts/AppLayout/AppLayout.d.ts +22 -2
- package/dist/layouts/SidebarLayout/SidebarLayout.d.ts +4 -3
- package/dist/layouts/ThreeItemLayout/ThreeItemLayout.d.ts +3 -3
- package/dist/layouts/TwoItemLayout/TwoItemLayout.d.ts +3 -3
- package/dist/libs/types/custom-types.d.ts +2 -2
- package/dist/libs/types/layout-types.d.ts +2 -1
- package/dist/svg/circleHalfStroke.svg +3 -0
- package/dist/svg/claude.svg +3 -0
- package/dist/svg/clock.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/octagonExclamation.svg +3 -0
- package/dist/svg/openai.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/utilities/FlexContainer/FlexContainer.d.ts +5 -6
- package/dist/utilities/grid/Grid.d.ts +58 -0
- package/dist/utilities/grid/GridItem.d.ts +57 -0
- package/package.json +5 -7
- /package/dist/svg/{arrowDownLeftAndArrowUpRightToCenter.svg → collapseToCenter.svg} +0 -0
- /package/dist/svg/{linkSimple.svg → link.svg} +0 -0
- /package/dist/svg/{arrowsUpDownLeftRight.svg → move.svg} +0 -0
- /package/dist/svg/{linkSimpleSlash.svg → unlink.svg} +0 -0
|
@@ -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';
|
|
@@ -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
|
+
}
|
|
@@ -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
|
/**
|
|
@@ -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?: '
|
|
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 {
|
|
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?:
|
|
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 {};
|
|
@@ -3,7 +3,6 @@ import { ButtonDisplayType, ButtonSize, ButtonVariant } from '../../../libs/type
|
|
|
3
3
|
import { PDSIcon } from '../../icons/Icon/Icon';
|
|
4
4
|
import '../Button/button.css';
|
|
5
5
|
import './button-link.css';
|
|
6
|
-
type ButtonLinkVariant = Exclude<ButtonVariant, 'inline'>;
|
|
7
6
|
/**
|
|
8
7
|
* Prop types for ButtonLink
|
|
9
8
|
*/
|
|
@@ -39,10 +38,9 @@ export interface ButtonLinkProps extends ComponentPropsWithoutRef<'span'> {
|
|
|
39
38
|
/**
|
|
40
39
|
* Variant of the button.
|
|
41
40
|
*/
|
|
42
|
-
variant?:
|
|
41
|
+
variant?: ButtonVariant;
|
|
43
42
|
}
|
|
44
43
|
/**
|
|
45
44
|
* ButtonLink UI component
|
|
46
45
|
*/
|
|
47
46
|
export declare const ButtonLink: ({ className, disabled, displayType, iconName, linkContent, size, tooltipText, variant, ...props }: ButtonLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
export {};
|
|
@@ -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
|
|
20
|
+
* Size of the button.
|
|
21
21
|
*/
|
|
22
|
-
size?: '
|
|
22
|
+
size?: 's' | 'm' | 'l';
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* CloseButton UI component
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import './filter-button.css';
|
|
2
|
+
/**
|
|
3
|
+
* A single option the FilterButton can filter by.
|
|
4
|
+
*/
|
|
5
|
+
export interface FilterButtonOption {
|
|
6
|
+
/**
|
|
7
|
+
* Whether this option is disabled.
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Visible label for the option.
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Unique value used for selection.
|
|
16
|
+
*/
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Prop types for FilterButton
|
|
21
|
+
*/
|
|
22
|
+
export interface FilterButtonProps {
|
|
23
|
+
/**
|
|
24
|
+
* Additional class names.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Text for the clear action in the panel footer.
|
|
29
|
+
*/
|
|
30
|
+
clearLabel?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Disable the entire control.
|
|
33
|
+
*/
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The filter key/dimension name shown in the trigger (e.g. "Status").
|
|
37
|
+
*/
|
|
38
|
+
filterKey: string;
|
|
39
|
+
/**
|
|
40
|
+
* id applied to the trigger button.
|
|
41
|
+
*/
|
|
42
|
+
id?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Show the in-menu search input once the number of options reaches this
|
|
45
|
+
* threshold. Defaults to `8`. Set to `0` to always show it.
|
|
46
|
+
*/
|
|
47
|
+
minFilterItems?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Text shown when the search finds no matching options.
|
|
50
|
+
*/
|
|
51
|
+
noResultsText?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Called with the next selected values whenever the selection changes.
|
|
54
|
+
*/
|
|
55
|
+
onSelectionChange: (values: string[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Options the user can filter by.
|
|
58
|
+
*/
|
|
59
|
+
options: FilterButtonOption[];
|
|
60
|
+
/**
|
|
61
|
+
* Accessible label for the search input.
|
|
62
|
+
*/
|
|
63
|
+
searchLabel?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Placeholder for the search input.
|
|
66
|
+
*/
|
|
67
|
+
searchPlaceholder?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Currently selected option values (controlled).
|
|
70
|
+
*/
|
|
71
|
+
selectedValues: string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* FilterButton — a multiselect filter with a stateful trigger, designed to sit
|
|
75
|
+
* in a UtilityBar above a Table. Composes the Dropdown compound component
|
|
76
|
+
* (checkbox items + a search row + a Clear footer) behind a trigger with three
|
|
77
|
+
* states: default, single selection, and multiple selections (with a count).
|
|
78
|
+
*
|
|
79
|
+
* Selection is controlled: pass `selectedValues` and handle `onSelectionChange`.
|
|
80
|
+
* The consuming app owns filtering the data with those values.
|
|
81
|
+
*/
|
|
82
|
+
export declare const FilterButton: ({ className, clearLabel, disabled, filterKey, id, minFilterItems, noResultsText, onSelectionChange, options, searchLabel, searchPlaceholder, selectedValues, }: FilterButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PDSIcon } from '../../icons/Icon/Icon';
|
|
2
2
|
import './segmented-button.css';
|
|
3
|
+
export type SegmentedButtonSize = 's' | 'xs';
|
|
3
4
|
/**
|
|
4
5
|
* Structure for each option in the SegmentedButton component.
|
|
5
6
|
*/
|
|
@@ -69,6 +70,11 @@ export interface SegmentedButtonProps {
|
|
|
69
70
|
* include an optional icon or spinner before the label and a tally after it.
|
|
70
71
|
*/
|
|
71
72
|
options: OptionType[];
|
|
73
|
+
/**
|
|
74
|
+
* Size of the segmented button. `'s'` matches the small button height (32px);
|
|
75
|
+
* `'xs'` matches the extra-small button height (24px).
|
|
76
|
+
*/
|
|
77
|
+
size?: SegmentedButtonSize;
|
|
72
78
|
/**
|
|
73
79
|
* Controlled value. Cannot be used together with `defaultValue`.
|
|
74
80
|
*/
|
|
@@ -77,5 +83,5 @@ export interface SegmentedButtonProps {
|
|
|
77
83
|
/**
|
|
78
84
|
* SegmentedButton UI component
|
|
79
85
|
*/
|
|
80
|
-
export declare const SegmentedButton: ({ className, defaultValue, disabled, id, label, onChange, options, value, ...props }: SegmentedButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export declare const SegmentedButton: ({ className, defaultValue, disabled, id, label, onChange, options, size, value, ...props }: SegmentedButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
87
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PaddingScale } from '../../../libs/types/layout-types';
|
|
3
3
|
import { CardBackground, CardImageVariant } from '../../cards/Card/Card';
|
|
4
4
|
import './action-card.css';
|
|
5
5
|
export interface ActionCardPrimaryAction {
|
|
@@ -47,7 +47,7 @@ export interface ActionCardProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
47
47
|
/**
|
|
48
48
|
* Relative padding for the `main` and `footer` slots.
|
|
49
49
|
*/
|
|
50
|
-
padding?:
|
|
50
|
+
padding?: PaddingScale;
|
|
51
51
|
/**
|
|
52
52
|
* The card-level primary action. Provide either `linkContent` (for links) or
|
|
53
53
|
* `onClick` (for button actions), plus a required accessible `label`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PaddingScale } from '../../../libs/types/layout-types';
|
|
3
3
|
import './card.css';
|
|
4
4
|
export type CardBackground = 'default' | 'transparent';
|
|
5
5
|
export type CardImageVariant = 'bleed' | 'inset';
|
|
@@ -28,7 +28,7 @@ export interface CardProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
28
28
|
/**
|
|
29
29
|
* Relative padding for the `main` slot.
|
|
30
30
|
*/
|
|
31
|
-
padding?:
|
|
31
|
+
padding?: PaddingScale;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Card UI component
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* serialized by the generate script.
|
|
27
27
|
*
|
|
28
28
|
* Testing:
|
|
29
|
-
* - Check the icon at all sizes (
|
|
29
|
+
* - Check the icon at all sizes (s through 3xl) in Storybook
|
|
30
30
|
* - Verify it looks balanced next to FA icons at the same size
|
|
31
31
|
*/
|
|
32
32
|
import React from 'react';
|