@patternfly/react-core 4.206.2 → 4.206.5
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 +27 -0
- package/dist/umd/react-core.min.css +31 -31
- package/package.json +5 -5
- package/src/demos/DateTimePicker.md +67 -51
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 4.206.5 (2022-04-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 4.206.4 (2022-04-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **DateTimePicker:** update date placeholder ([#7266](https://github.com/patternfly/patternfly-react/issues/7266)) ([4e9a73e](https://github.com/patternfly/patternfly-react/commit/4e9a73e8f7645b7a885d15754f99b9e078449806))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 4.206.3 (2022-04-23)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## 4.206.2 (2022-04-21)
|
|
7
34
|
|
|
8
35
|
|
|
@@ -260,6 +260,37 @@
|
|
|
260
260
|
--pf-c-accordion__expanded-content-body--PaddingTop: var(--pf-c-accordion__expanded-content-body--expanded-content-body--PaddingTop);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
.pf-c-action-list {
|
|
264
|
+
--pf-c-action-list--m-icon--spacer: 0;
|
|
265
|
+
--pf-c-action-list--child--spacer-base: var(--pf-global--spacer--md);
|
|
266
|
+
--pf-c-action-list--group--spacer-base: var(--pf-global--spacer--2xl);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.pf-c-action-list,
|
|
270
|
+
.pf-c-action-list__group {
|
|
271
|
+
--pf-c-action-list--child--spacer: var(--pf-c-action-list--child--spacer-base);
|
|
272
|
+
--pf-c-action-list--group--spacer: var(--pf-c-action-list--group--spacer-base);
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.pf-c-action-list > * + *,
|
|
278
|
+
.pf-c-action-list__group > * + * {
|
|
279
|
+
margin-left: var(--pf-c-action-list--child--spacer);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.pf-c-action-list > * + .pf-c-action-list__group,
|
|
283
|
+
.pf-c-action-list .pf-c-action-list__group + *,
|
|
284
|
+
.pf-c-action-list__group > * + .pf-c-action-list__group,
|
|
285
|
+
.pf-c-action-list__group .pf-c-action-list__group + * {
|
|
286
|
+
margin-left: var(--pf-c-action-list--group--spacer);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.pf-c-action-list.pf-m-icons,
|
|
290
|
+
.pf-c-action-list__group.pf-m-icons {
|
|
291
|
+
--pf-c-action-list--child--spacer: var(--pf-c-action-list--m-icon--spacer);
|
|
292
|
+
}
|
|
293
|
+
|
|
263
294
|
.pf-c-alert {
|
|
264
295
|
--pf-global--Color--100: var(--pf-global--Color--dark-100);
|
|
265
296
|
--pf-global--Color--200: var(--pf-global--Color--dark-200);
|
|
@@ -478,37 +509,6 @@
|
|
|
478
509
|
--pf-c-alert__title--FontWeight: var(--pf-global--FontWeight--normal);
|
|
479
510
|
}
|
|
480
511
|
|
|
481
|
-
.pf-c-action-list {
|
|
482
|
-
--pf-c-action-list--m-icon--spacer: 0;
|
|
483
|
-
--pf-c-action-list--child--spacer-base: var(--pf-global--spacer--md);
|
|
484
|
-
--pf-c-action-list--group--spacer-base: var(--pf-global--spacer--2xl);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.pf-c-action-list,
|
|
488
|
-
.pf-c-action-list__group {
|
|
489
|
-
--pf-c-action-list--child--spacer: var(--pf-c-action-list--child--spacer-base);
|
|
490
|
-
--pf-c-action-list--group--spacer: var(--pf-c-action-list--group--spacer-base);
|
|
491
|
-
display: flex;
|
|
492
|
-
align-items: center;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.pf-c-action-list > * + *,
|
|
496
|
-
.pf-c-action-list__group > * + * {
|
|
497
|
-
margin-left: var(--pf-c-action-list--child--spacer);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.pf-c-action-list > * + .pf-c-action-list__group,
|
|
501
|
-
.pf-c-action-list .pf-c-action-list__group + *,
|
|
502
|
-
.pf-c-action-list__group > * + .pf-c-action-list__group,
|
|
503
|
-
.pf-c-action-list__group .pf-c-action-list__group + * {
|
|
504
|
-
margin-left: var(--pf-c-action-list--group--spacer);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.pf-c-action-list.pf-m-icons,
|
|
508
|
-
.pf-c-action-list__group.pf-m-icons {
|
|
509
|
-
--pf-c-action-list--child--spacer: var(--pf-c-action-list--m-icon--spacer);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
512
|
.pf-c-app-launcher {
|
|
513
513
|
--pf-c-app-launcher__menu--BackgroundColor: var(--pf-global--BackgroundColor--light-100);
|
|
514
514
|
--pf-c-app-launcher__menu--BoxShadow: var(--pf-global--BoxShadow--md);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.206.
|
|
3
|
+
"version": "4.206.5",
|
|
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.57.
|
|
38
|
-
"@patternfly/react-styles": "^4.56.
|
|
39
|
-
"@patternfly/react-tokens": "^4.58.
|
|
37
|
+
"@patternfly/react-icons": "^4.57.5",
|
|
38
|
+
"@patternfly/react-styles": "^4.56.5",
|
|
39
|
+
"@patternfly/react-tokens": "^4.58.5",
|
|
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": "c0f634afc3fb81b215b00b14cf337f09fd8f37cd"
|
|
64
64
|
}
|
|
@@ -15,18 +15,28 @@ In this demo, learn how to use a [CalendarMonth](/components/calendar-month) com
|
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
17
|
import React from 'react';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Dropdown,
|
|
20
|
+
DropdownToggle,
|
|
21
|
+
DropdownItem,
|
|
22
|
+
CalendarMonth,
|
|
23
|
+
InputGroup,
|
|
24
|
+
TextInput,
|
|
25
|
+
Button,
|
|
26
|
+
Popover
|
|
27
|
+
} from '@patternfly/react-core';
|
|
19
28
|
import OutlinedCalendarAltIcon from '@patternfly/react-icons/dist/esm/icons/outlined-calendar-alt-icon';
|
|
20
29
|
import OutlinedClockIcon from '@patternfly/react-icons/dist/esm/icons/outlined-clock-icon';
|
|
21
30
|
|
|
22
31
|
DateTimePicker = () => {
|
|
23
32
|
const [isCalendarOpen, setIsCalendarOpen] = React.useState(false);
|
|
24
33
|
const [isTimeOpen, setIsTimeOpen] = React.useState(false);
|
|
25
|
-
const [valueDate, setValueDate] = React.useState(
|
|
26
|
-
const [valueTime, setValueTime] = React.useState(
|
|
34
|
+
const [valueDate, setValueDate] = React.useState('MM-DD-YYYY');
|
|
35
|
+
const [valueTime, setValueTime] = React.useState('HH:MM');
|
|
27
36
|
const times = Array.from(new Array(10), (_, i) => i + 8);
|
|
28
|
-
const defaultTime =
|
|
29
|
-
const dateFormat = date =>
|
|
37
|
+
const defaultTime = '0:00';
|
|
38
|
+
const dateFormat = date =>
|
|
39
|
+
date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-');
|
|
30
40
|
|
|
31
41
|
const onToggleCalendar = () => {
|
|
32
42
|
setIsCalendarOpen(!isCalendarOpen);
|
|
@@ -34,69 +44,75 @@ DateTimePicker = () => {
|
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
const onToggleTime = ev => {
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
setIsTimeOpen(!isTimeOpen);
|
|
48
|
+
setIsCalendarOpen(false);
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
const onSelectCalendar = newValueDate => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
const newValue = dateFormat(newValueDate);
|
|
53
|
+
setValueDate(newValue);
|
|
54
|
+
setIsCalendarOpen(!isCalendarOpen);
|
|
55
|
+
// setting default time when it is not picked
|
|
56
|
+
if (valueTime === 'HH:MM') {
|
|
57
|
+
setValueTime(defaultTime);
|
|
58
|
+
}
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
const onSelectTime = ev => {
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
setValueTime(ev.target.value);
|
|
63
|
+
setIsTimeOpen(!isTimeOpen);
|
|
54
64
|
};
|
|
55
65
|
|
|
56
66
|
const timeOptions = times.map(time => (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
<DropdownItem key={time} component="button" value={`${time}:00`}>
|
|
68
|
+
{`${time}:00`}
|
|
69
|
+
</DropdownItem>
|
|
60
70
|
));
|
|
61
|
-
const calendar =
|
|
62
|
-
<CalendarMonth
|
|
63
|
-
date={valueDate}
|
|
64
|
-
onChange={onSelectCalendar}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
71
|
+
const calendar = <CalendarMonth date={valueDate} onChange={onSelectCalendar} />;
|
|
67
72
|
const time = (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
<Dropdown
|
|
74
|
+
onSelect={onSelectTime}
|
|
75
|
+
toggle={
|
|
76
|
+
<DropdownToggle
|
|
77
|
+
aria-label="Toggle the time picker menu"
|
|
78
|
+
toggleIndicator={null}
|
|
79
|
+
onToggle={onToggleTime}
|
|
80
|
+
style={{ padding: '6px 16px' }}
|
|
81
|
+
>
|
|
82
|
+
<OutlinedClockIcon />
|
|
83
|
+
</DropdownToggle>
|
|
84
|
+
}
|
|
85
|
+
isOpen={isTimeOpen}
|
|
86
|
+
dropdownItems={timeOptions}
|
|
77
87
|
/>
|
|
78
88
|
);
|
|
79
89
|
const calendarButton = (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
<Button variant="control" aria-label="Toggle the calendar" onClick={onToggleCalendar}>
|
|
91
|
+
<OutlinedCalendarAltIcon />
|
|
92
|
+
</Button>
|
|
83
93
|
);
|
|
84
94
|
return (
|
|
85
95
|
<div style={{ width: '300px' }}>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
<Popover
|
|
97
|
+
position="bottom"
|
|
98
|
+
bodyContent={calendar}
|
|
99
|
+
showClose={false}
|
|
100
|
+
isVisible={isCalendarOpen}
|
|
101
|
+
hasNoPadding
|
|
102
|
+
hasAutoWidth
|
|
103
|
+
>
|
|
104
|
+
<InputGroup>
|
|
105
|
+
<TextInput
|
|
106
|
+
type="'datetime-local"
|
|
107
|
+
id="date-time"
|
|
108
|
+
aria-label="date and time picker demo"
|
|
109
|
+
value={valueDate + ' ' + valueTime}
|
|
110
|
+
isReadOnly
|
|
111
|
+
/>
|
|
112
|
+
{calendarButton}
|
|
113
|
+
{time}
|
|
114
|
+
</InputGroup>
|
|
115
|
+
</Popover>
|
|
100
116
|
</div>
|
|
101
117
|
);
|
|
102
118
|
};
|