@patternfly/react-core 4.186.0 → 4.187.2
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/CHANGELOG.md +38 -0
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +2 -0
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js +3 -2
- package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +13 -7
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +2 -0
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js +3 -2
- package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +13 -7
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/umd/react-core.js +16 -9
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +6 -6
- package/src/components/ExpandableSection/ExpandableSection.tsx +5 -0
- package/src/components/ExpandableSection/__tests__/ExpandableSection.test.tsx +5 -0
- package/src/components/ExpandableSection/__tests__/__snapshots__/ExpandableSection.test.tsx.snap +35 -0
- package/src/components/ExpandableSection/examples/ExpandableSection.md +35 -0
- package/src/components/Select/Select.tsx +17 -8
- package/src/components/Select/examples/Select.md +31 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.187.2",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.38.2",
|
|
38
|
+
"@patternfly/react-styles": "^4.37.2",
|
|
39
|
+
"@patternfly/react-tokens": "^4.39.2",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.166.
|
|
46
|
+
"@patternfly/patternfly": "4.166.4",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "86b42dd534532822d79ec6be30648a68e1eab707"
|
|
64
64
|
}
|
|
@@ -29,6 +29,8 @@ export interface ExpandableSectionProps extends React.HTMLProps<HTMLDivElement>
|
|
|
29
29
|
displaySize?: 'default' | 'large';
|
|
30
30
|
/** Flag to indicate the width of the component is limited. Set to true for disclosure styling. */
|
|
31
31
|
isWidthLimited?: boolean;
|
|
32
|
+
/** Flag to indicate if the content is indented */
|
|
33
|
+
isIndented?: boolean;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
interface ExpandableSectionState {
|
|
@@ -56,6 +58,7 @@ export class ExpandableSection extends React.Component<ExpandableSectionProps, E
|
|
|
56
58
|
isDetached: false,
|
|
57
59
|
displaySize: 'default',
|
|
58
60
|
isWidthLimited: false,
|
|
61
|
+
isIndented: false,
|
|
59
62
|
contentId: ''
|
|
60
63
|
};
|
|
61
64
|
|
|
@@ -88,6 +91,7 @@ export class ExpandableSection extends React.Component<ExpandableSectionProps, E
|
|
|
88
91
|
isDetached,
|
|
89
92
|
displaySize,
|
|
90
93
|
isWidthLimited,
|
|
94
|
+
isIndented,
|
|
91
95
|
contentId,
|
|
92
96
|
...props
|
|
93
97
|
} = this.props;
|
|
@@ -119,6 +123,7 @@ export class ExpandableSection extends React.Component<ExpandableSectionProps, E
|
|
|
119
123
|
isDetached && styles.modifiers.detached,
|
|
120
124
|
displaySize === 'large' && styles.modifiers.displayLg,
|
|
121
125
|
isWidthLimited && styles.modifiers.limitWidth,
|
|
126
|
+
isIndented && styles.modifiers.indented,
|
|
122
127
|
className
|
|
123
128
|
)}
|
|
124
129
|
>
|
|
@@ -48,3 +48,8 @@ test('Disclosure ExpandableSection', () => {
|
|
|
48
48
|
const view = shallow(<ExpandableSection {...props} displaySize="large" isWidthLimited>test </ExpandableSection>);
|
|
49
49
|
expect(view).toMatchSnapshot();
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
test('Renders ExpandableSection indented', () => {
|
|
53
|
+
const view = shallow(<ExpandableSection isExpanded isIndented> test </ExpandableSection>);
|
|
54
|
+
expect(view).toMatchSnapshot();
|
|
55
|
+
});
|
package/src/components/ExpandableSection/__tests__/__snapshots__/ExpandableSection.test.tsx.snap
CHANGED
|
@@ -9,6 +9,7 @@ Array [
|
|
|
9
9
|
isActive={false}
|
|
10
10
|
isDetached={true}
|
|
11
11
|
isExpanded={true}
|
|
12
|
+
isIndented={false}
|
|
12
13
|
isWidthLimited={false}
|
|
13
14
|
onToggle={[Function]}
|
|
14
15
|
toggleText=""
|
|
@@ -182,6 +183,40 @@ exports[`Renders ExpandableSection expanded 1`] = `
|
|
|
182
183
|
</div>
|
|
183
184
|
`;
|
|
184
185
|
|
|
186
|
+
exports[`Renders ExpandableSection indented 1`] = `
|
|
187
|
+
<div
|
|
188
|
+
className="pf-c-expandable-section pf-m-expanded pf-m-indented"
|
|
189
|
+
>
|
|
190
|
+
<button
|
|
191
|
+
aria-expanded={true}
|
|
192
|
+
className="pf-c-expandable-section__toggle"
|
|
193
|
+
onClick={[Function]}
|
|
194
|
+
type="button"
|
|
195
|
+
>
|
|
196
|
+
<span
|
|
197
|
+
className="pf-c-expandable-section__toggle-icon"
|
|
198
|
+
>
|
|
199
|
+
<AngleRightIcon
|
|
200
|
+
aria-hidden={true}
|
|
201
|
+
color="currentColor"
|
|
202
|
+
noVerticalAlign={false}
|
|
203
|
+
size="sm"
|
|
204
|
+
/>
|
|
205
|
+
</span>
|
|
206
|
+
<span
|
|
207
|
+
className="pf-c-expandable-section__toggle-text"
|
|
208
|
+
/>
|
|
209
|
+
</button>
|
|
210
|
+
<div
|
|
211
|
+
className="pf-c-expandable-section__content"
|
|
212
|
+
hidden={false}
|
|
213
|
+
id=""
|
|
214
|
+
>
|
|
215
|
+
test
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
`;
|
|
219
|
+
|
|
185
220
|
exports[`Renders Uncontrolled ExpandableSection 1`] = `
|
|
186
221
|
<div
|
|
187
222
|
className="pf-c-expandable-section"
|
|
@@ -143,3 +143,38 @@ class DisclosureExpandableSection extends React.Component {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
```
|
|
146
|
+
|
|
147
|
+
### Indented
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
import React from 'react';
|
|
151
|
+
import { ExpandableSection } from '@patternfly/react-core';
|
|
152
|
+
|
|
153
|
+
class SimpleExpandableSection extends React.Component {
|
|
154
|
+
constructor(props) {
|
|
155
|
+
super(props);
|
|
156
|
+
this.state = {
|
|
157
|
+
isExpanded: false
|
|
158
|
+
};
|
|
159
|
+
this.onToggle = isExpanded => {
|
|
160
|
+
this.setState({
|
|
161
|
+
isExpanded
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
render() {
|
|
167
|
+
const { isExpanded } = this.state;
|
|
168
|
+
return (
|
|
169
|
+
<ExpandableSection
|
|
170
|
+
toggleText={isExpanded ? 'Show less' : 'Show more'}
|
|
171
|
+
onToggle={this.onToggle}
|
|
172
|
+
isExpanded={isExpanded}
|
|
173
|
+
isIndented={true}
|
|
174
|
+
>
|
|
175
|
+
This content is visible only when the component is expanded.
|
|
176
|
+
</ExpandableSection>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
@@ -262,17 +262,26 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
262
262
|
this.refCollection[this.state.viewMoreNextIndex][0].focus();
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
if (
|
|
265
|
+
const hasUpdatedChildren =
|
|
267
266
|
prevProps.children.length !== this.props.children.length ||
|
|
268
|
-
prevProps.children.some((
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
prevProps.children.some((prevChild: React.ReactElement, index: number) => {
|
|
268
|
+
const prevChildProps = prevChild.props;
|
|
269
|
+
const currChild = this.props.children[index];
|
|
270
|
+
const { props: currChildProps } = currChild;
|
|
271
|
+
|
|
272
|
+
if (prevChildProps && currChildProps) {
|
|
273
|
+
return (
|
|
274
|
+
prevChildProps.value !== currChildProps.value ||
|
|
275
|
+
prevChildProps.label !== currChildProps.label ||
|
|
276
|
+
prevChildProps.isDisabled !== currChildProps.isDisabled ||
|
|
277
|
+
prevChildProps.isPlaceholder !== currChildProps.isPlaceholder
|
|
278
|
+
);
|
|
271
279
|
} else {
|
|
272
|
-
return
|
|
280
|
+
return prevChild !== currChild;
|
|
273
281
|
}
|
|
274
|
-
})
|
|
275
|
-
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
if (hasUpdatedChildren) {
|
|
276
285
|
this.updateTypeAheadFilteredChildren(prevState.typeaheadInputValue || '', null);
|
|
277
286
|
}
|
|
278
287
|
|
|
@@ -348,7 +348,7 @@ class ValidatedSelect extends React.Component {
|
|
|
348
348
|
console.log('selected:', selection);
|
|
349
349
|
}
|
|
350
350
|
this.setState({
|
|
351
|
-
|
|
351
|
+
validated: validatedState
|
|
352
352
|
});
|
|
353
353
|
};
|
|
354
354
|
|
|
@@ -1183,13 +1183,13 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1183
1183
|
constructor(props) {
|
|
1184
1184
|
super(props);
|
|
1185
1185
|
this.defaultOptions = [
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1186
|
+
{ value: 'Alabama' },
|
|
1187
|
+
{ value: 'Florida', description: 'This is a description' },
|
|
1188
|
+
{ value: 'New Jersey' },
|
|
1189
|
+
{ value: 'New Mexico' },
|
|
1190
|
+
{ value: 'New York' },
|
|
1191
|
+
{ value: 'North Carolina' }
|
|
1192
|
+
];
|
|
1193
1193
|
|
|
1194
1194
|
this.state = {
|
|
1195
1195
|
options: this.defaultOptions,
|
|
@@ -1579,7 +1579,8 @@ class MultiTypeaheadSelectInput extends React.Component {
|
|
|
1579
1579
|
isOpen: false,
|
|
1580
1580
|
selected: [],
|
|
1581
1581
|
isCreatable: false,
|
|
1582
|
-
hasOnCreateOption: false
|
|
1582
|
+
hasOnCreateOption: false,
|
|
1583
|
+
hasDisabledOption: false
|
|
1583
1584
|
};
|
|
1584
1585
|
|
|
1585
1586
|
this.onCreateOption = newValue => {
|
|
@@ -1627,10 +1628,19 @@ class MultiTypeaheadSelectInput extends React.Component {
|
|
|
1627
1628
|
hasOnCreateOption: checked
|
|
1628
1629
|
});
|
|
1629
1630
|
};
|
|
1631
|
+
|
|
1632
|
+
this.toggleOptionDisabled = (toggleIndex) => () => {
|
|
1633
|
+
this.setState(prevState => ({
|
|
1634
|
+
hasDisabledOption: !prevState.hasDisabledOption,
|
|
1635
|
+
options: prevState.options.map((option, index) =>
|
|
1636
|
+
index === toggleIndex ? { ...option, disabled: !option.disabled } : option
|
|
1637
|
+
),
|
|
1638
|
+
}));
|
|
1639
|
+
};
|
|
1630
1640
|
}
|
|
1631
1641
|
|
|
1632
1642
|
render() {
|
|
1633
|
-
const { isOpen, selected, isCreatable, hasOnCreateOption } = this.state;
|
|
1643
|
+
const { isOpen, selected, isCreatable, hasOnCreateOption, options } = this.state;
|
|
1634
1644
|
const titleId = 'multi-typeahead-select-id-1';
|
|
1635
1645
|
|
|
1636
1646
|
return (
|
|
@@ -1651,7 +1661,7 @@ class MultiTypeaheadSelectInput extends React.Component {
|
|
|
1651
1661
|
isCreatable={isCreatable}
|
|
1652
1662
|
onCreateOption={(hasOnCreateOption && this.onCreateOption) || undefined}
|
|
1653
1663
|
>
|
|
1654
|
-
{
|
|
1664
|
+
{options.map((option, index) => (
|
|
1655
1665
|
<SelectOption
|
|
1656
1666
|
isDisabled={option.disabled}
|
|
1657
1667
|
key={index}
|
|
@@ -1676,6 +1686,14 @@ class MultiTypeaheadSelectInput extends React.Component {
|
|
|
1676
1686
|
id="toggle-new-typeahead-multi"
|
|
1677
1687
|
name="toggle-new-typeahead-multi"
|
|
1678
1688
|
/>
|
|
1689
|
+
<Checkbox
|
|
1690
|
+
label="isDisabled (1st option only)"
|
|
1691
|
+
isChecked={this.state.hasDisabledOption}
|
|
1692
|
+
onChange={this.toggleOptionDisabled(0)}
|
|
1693
|
+
aria-label="toggle disable first option"
|
|
1694
|
+
id="toggle-disable-first-option"
|
|
1695
|
+
name="toggle-disable-first-option"
|
|
1696
|
+
/>
|
|
1679
1697
|
</div>
|
|
1680
1698
|
);
|
|
1681
1699
|
}
|
|
@@ -2453,7 +2471,7 @@ class SelectWithFooterCheckbox extends React.Component {
|
|
|
2453
2471
|
Title
|
|
2454
2472
|
</span>
|
|
2455
2473
|
<Select
|
|
2456
|
-
|
|
2474
|
+
variant={SelectVariant.checkbox}
|
|
2457
2475
|
aria-label="Select input"
|
|
2458
2476
|
onToggle={this.onToggle}
|
|
2459
2477
|
onSelect={this.onSelect}
|
|
@@ -2578,7 +2596,7 @@ import {
|
|
|
2578
2596
|
} from '@patternfly/react-core';
|
|
2579
2597
|
|
|
2580
2598
|
class SelectViewMoreCheckbox extends React.Component {
|
|
2581
|
-
|
|
2599
|
+
constructor(props) {
|
|
2582
2600
|
super(props);
|
|
2583
2601
|
|
|
2584
2602
|
this.state = {
|