@patternfly/react-core 4.189.5 → 4.191.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/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +13 -1
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts +6 -4
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +37 -26
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePickerUtils.d.ts +3 -2
- package/dist/esm/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePickerUtils.js +57 -42
- package/dist/esm/components/TimePicker/TimePickerUtils.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +13 -1
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts +6 -4
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +36 -25
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/TimePicker/TimePickerUtils.d.ts +3 -2
- package/dist/js/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePickerUtils.js +59 -43
- package/dist/js/components/TimePicker/TimePickerUtils.js.map +1 -1
- package/dist/umd/react-core.js +105 -68
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/NumberInput/NumberInput.tsx +17 -0
- package/src/components/NumberInput/__tests__/__snapshots__/NumberInput.test.tsx.snap +10 -0
- package/src/components/NumberInput/examples/NumberInput.md +43 -0
- package/src/components/TimePicker/TimePicker.tsx +54 -31
- package/src/components/TimePicker/TimePickerUtils.tsx +76 -39
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +49 -11
- package/src/components/TimePicker/examples/TimePicker.md +19 -2
- package/src/demos/Button.md +67 -0
- package/src/demos/Tabs.md +7 -0
- package/src/demos/examples/Tabs/ModalTabs.tsx +142 -0
|
@@ -15,13 +15,14 @@ import React from 'react';
|
|
|
15
15
|
import { TimePicker } from '@patternfly/react-core';
|
|
16
16
|
|
|
17
17
|
SimpleTimePicker = () => {
|
|
18
|
-
const onChange = (time, hour, minute, isValid) => {
|
|
18
|
+
const onChange = (time, hour, minute, seconds, isValid) => {
|
|
19
19
|
console.log("time", time);
|
|
20
20
|
console.log("hour", hour);
|
|
21
21
|
console.log("minute", minute);
|
|
22
|
+
console.log("seconds", seconds);
|
|
22
23
|
console.log("isValid", isValid);
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
return <TimePicker time="3:35 AM" onChange={onChange}/>;
|
|
26
27
|
}
|
|
27
28
|
```
|
|
@@ -52,3 +53,19 @@ import { TimePicker } from '@patternfly/react-core';
|
|
|
52
53
|
|
|
53
54
|
<TimePicker is24Hour minTime="9:30" maxTime="17:15" placeholder="14:00"/>
|
|
54
55
|
```
|
|
56
|
+
|
|
57
|
+
### With seconds
|
|
58
|
+
```js
|
|
59
|
+
import React from 'react';
|
|
60
|
+
import { TimePicker } from '@patternfly/react-core';
|
|
61
|
+
|
|
62
|
+
SimpleTimePicker = () => <TimePicker time="3:35:20 PM" includeSeconds />;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 24 hours with seconds
|
|
66
|
+
```js
|
|
67
|
+
import React from 'react';
|
|
68
|
+
import { TimePicker } from '@patternfly/react-core';
|
|
69
|
+
|
|
70
|
+
SimpleTimePicker = () => <TimePicker time="12:35:50" includeSeconds is24Hour />;
|
|
71
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Button
|
|
3
|
+
section: components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
7
|
+
|
|
8
|
+
## Demos
|
|
9
|
+
|
|
10
|
+
### Progress button
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { Form, FormGroup, ActionGroup, InputGroup, TextInput, Button } from '@patternfly/react-core';
|
|
15
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
16
|
+
|
|
17
|
+
const ProgressButton: React.FunctionComponent = () => {
|
|
18
|
+
const [loginState, setLoginState] = React.useState<'notLoggedIn' | 'loading' | 'loggedIn'>('notLoggedIn');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Form>
|
|
22
|
+
<FormGroup label="Username" isRequired fieldId="progress-button-initial-login">
|
|
23
|
+
<TextInput
|
|
24
|
+
isRequired
|
|
25
|
+
type="text"
|
|
26
|
+
id="progress-button-initial-login"
|
|
27
|
+
name="progress-button-initial-login"
|
|
28
|
+
value="johndoe"
|
|
29
|
+
aria-label="username input"
|
|
30
|
+
/>
|
|
31
|
+
</FormGroup>
|
|
32
|
+
<FormGroup label="Password" isRequired fieldId="progress-button-initial-password">
|
|
33
|
+
<TextInput
|
|
34
|
+
isRequired
|
|
35
|
+
type="password"
|
|
36
|
+
value="p@ssw0rd"
|
|
37
|
+
id="progress-button-initial-password"
|
|
38
|
+
name="progress-button-initial-password"
|
|
39
|
+
aria-label="password input"
|
|
40
|
+
/>
|
|
41
|
+
</FormGroup>
|
|
42
|
+
<ActionGroup>
|
|
43
|
+
<Button
|
|
44
|
+
variant="primary"
|
|
45
|
+
onClick={
|
|
46
|
+
loginState === 'notLoggedIn'
|
|
47
|
+
? () => {
|
|
48
|
+
setLoginState('loading');
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
setLoginState('loggedIn');
|
|
51
|
+
}, 3000);
|
|
52
|
+
}
|
|
53
|
+
: null
|
|
54
|
+
}
|
|
55
|
+
isLoading={loginState === 'loading'}
|
|
56
|
+
icon={loginState === 'loggedIn' ? <CheckCircleIcon /> : null}
|
|
57
|
+
spinnerAriaValueText="Loading..."
|
|
58
|
+
>
|
|
59
|
+
{loginState === 'notLoggedIn' && 'Link account and log in'}
|
|
60
|
+
{loginState === 'loading' && 'Linking account'}
|
|
61
|
+
{loginState === 'loggedIn' && 'Logged in'}
|
|
62
|
+
</Button>
|
|
63
|
+
</ActionGroup>
|
|
64
|
+
</Form>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
```
|
package/src/demos/Tabs.md
CHANGED
|
@@ -444,9 +444,16 @@ TabsOpenWithSecondaryTabsDemo = () => {
|
|
|
444
444
|
```
|
|
445
445
|
|
|
446
446
|
### Nested tabs
|
|
447
|
+
|
|
447
448
|
```js isFullscreen file="./Tabs/NestedTabsDemo.js"
|
|
448
449
|
```
|
|
449
450
|
|
|
450
451
|
### Tables and tabs
|
|
452
|
+
|
|
451
453
|
```js isFullscreen file="./examples/Tabs/TabsAndTable.tsx"
|
|
452
454
|
```
|
|
455
|
+
|
|
456
|
+
### Modal tabs
|
|
457
|
+
|
|
458
|
+
```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
|
|
459
|
+
```
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DashboardWrapper from '../DashboardWrapper';
|
|
3
|
+
import {
|
|
4
|
+
PageSection,
|
|
5
|
+
TextContent,
|
|
6
|
+
Text,
|
|
7
|
+
Gallery,
|
|
8
|
+
Card,
|
|
9
|
+
CardBody,
|
|
10
|
+
CardTitle,
|
|
11
|
+
PageSectionVariants,
|
|
12
|
+
Modal,
|
|
13
|
+
ModalVariant,
|
|
14
|
+
Tab,
|
|
15
|
+
Tabs,
|
|
16
|
+
TabTitleText,
|
|
17
|
+
List,
|
|
18
|
+
ListItem,
|
|
19
|
+
Grid,
|
|
20
|
+
GridItem,
|
|
21
|
+
TabContent
|
|
22
|
+
} from '@patternfly/react-core';
|
|
23
|
+
|
|
24
|
+
interface Product {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const products: Product[] = [
|
|
31
|
+
{
|
|
32
|
+
id: 0,
|
|
33
|
+
name: 'PatternFly',
|
|
34
|
+
description: 'PatternFly is a community project that promotes design commonality and improves user experience.'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 1,
|
|
38
|
+
name: 'ActiveMQ',
|
|
39
|
+
description:
|
|
40
|
+
'The ActiveMQ component allows messages to be sent to a JMS Queue or Topic; or messages to be consumed from a JMS Queue or Topic using Apache ActiveMQ.'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 2,
|
|
44
|
+
name: 'Apache Spark',
|
|
45
|
+
description: 'This documentation page covers the Apache Spark component for the Apache Camel.'
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
export const ModalTabs: React.FunctionComponent = () => {
|
|
50
|
+
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
51
|
+
const [selectedProduct, setSelectedProduct] = React.useState<Product>();
|
|
52
|
+
const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
|
|
53
|
+
|
|
54
|
+
const onCardClick = React.useCallback(
|
|
55
|
+
(product: Product) => () => {
|
|
56
|
+
setSelectedProduct(product);
|
|
57
|
+
setIsModalOpen(true);
|
|
58
|
+
},
|
|
59
|
+
[]
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const onCardKeyPress = React.useCallback(
|
|
63
|
+
(product: Product) => (event: React.KeyboardEvent<HTMLElement>) => {
|
|
64
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
65
|
+
onCardClick(product)();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const closeModal = React.useCallback(() => {
|
|
72
|
+
setSelectedProduct(undefined);
|
|
73
|
+
setIsModalOpen(false);
|
|
74
|
+
setActiveTabKey(0);
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
const onTabSelect = React.useCallback(
|
|
78
|
+
(_event: React.MouseEvent<HTMLElement, MouseEvent>, tabIndex: string | number) => setActiveTabKey(tabIndex),
|
|
79
|
+
[]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<React.Fragment>
|
|
84
|
+
<DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
|
|
85
|
+
<PageSection variant={PageSectionVariants.light}>
|
|
86
|
+
<TextContent>
|
|
87
|
+
<Text component="h1">Projects</Text>
|
|
88
|
+
<Text component="p">Click any project card to view Tabs within Modals.</Text>
|
|
89
|
+
</TextContent>
|
|
90
|
+
</PageSection>
|
|
91
|
+
<PageSection isFilled>
|
|
92
|
+
<Gallery hasGutter>
|
|
93
|
+
{products.map(product => (
|
|
94
|
+
<Card
|
|
95
|
+
isSelectable
|
|
96
|
+
isSelectableRaised
|
|
97
|
+
isCompact
|
|
98
|
+
key={product.id}
|
|
99
|
+
onClick={onCardClick(product)}
|
|
100
|
+
onKeyPress={onCardKeyPress(product)}
|
|
101
|
+
>
|
|
102
|
+
<CardTitle>{product.name}</CardTitle>
|
|
103
|
+
<CardBody>{product.description}</CardBody>
|
|
104
|
+
</Card>
|
|
105
|
+
))}
|
|
106
|
+
</Gallery>
|
|
107
|
+
</PageSection>
|
|
108
|
+
</DashboardWrapper>
|
|
109
|
+
|
|
110
|
+
{selectedProduct && (
|
|
111
|
+
<Modal variant={ModalVariant.small} title={selectedProduct.name} isOpen={isModalOpen} onClose={closeModal}>
|
|
112
|
+
<Grid hasGutter>
|
|
113
|
+
<GridItem>
|
|
114
|
+
<Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary>
|
|
115
|
+
<Tab eventKey={0} tabContentId="details-tab" title={<TabTitleText>Details</TabTitleText>} />
|
|
116
|
+
<Tab eventKey={1} tabContentId="doc-tab" title={<TabTitleText>Documentation</TabTitleText>} />
|
|
117
|
+
</Tabs>
|
|
118
|
+
</GridItem>
|
|
119
|
+
<GridItem>
|
|
120
|
+
<TabContent eventKey={0} id="details-tab" hidden={activeTabKey !== 0}>
|
|
121
|
+
{selectedProduct.description}
|
|
122
|
+
</TabContent>
|
|
123
|
+
<TabContent eventKey={1} id="doc-tab" hidden={activeTabKey !== 1}>
|
|
124
|
+
<List>
|
|
125
|
+
<ListItem>
|
|
126
|
+
<a>Doc link 1</a>
|
|
127
|
+
</ListItem>
|
|
128
|
+
<ListItem>
|
|
129
|
+
<a>Doc link 2</a>
|
|
130
|
+
</ListItem>
|
|
131
|
+
<ListItem>
|
|
132
|
+
<a>Doc link 3</a>
|
|
133
|
+
</ListItem>
|
|
134
|
+
</List>
|
|
135
|
+
</TabContent>
|
|
136
|
+
</GridItem>
|
|
137
|
+
</Grid>
|
|
138
|
+
</Modal>
|
|
139
|
+
)}
|
|
140
|
+
</React.Fragment>
|
|
141
|
+
);
|
|
142
|
+
};
|