@patternfly/react-core 4.186.1 → 4.187.0
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 +11 -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/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/umd/react-core.css +143 -143
- package/dist/umd/react-core.js +3 -2
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.187.0",
|
|
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,9 +34,9 @@
|
|
|
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.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.37.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.39.0",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -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": "b30c7c3f64a443451b47ca5ab30a8a13de521bdd"
|
|
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
|
+
```
|