@patternfly/react-core 4.192.1 → 4.192.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/esm/components/DatePicker/DatePicker.d.ts +2 -0
  3. package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
  4. package/dist/esm/components/DatePicker/DatePicker.js +7 -3
  5. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  6. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  7. package/dist/esm/components/Select/Select.js +2 -2
  8. package/dist/esm/components/Select/Select.js.map +1 -1
  9. package/dist/esm/components/Select/SelectOption.d.ts +2 -0
  10. package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
  11. package/dist/esm/components/Select/SelectOption.js +70 -48
  12. package/dist/esm/components/Select/SelectOption.js.map +1 -1
  13. package/dist/js/components/DatePicker/DatePicker.d.ts +2 -0
  14. package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
  15. package/dist/js/components/DatePicker/DatePicker.js +7 -3
  16. package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
  17. package/dist/js/components/Select/Select.d.ts.map +1 -1
  18. package/dist/js/components/Select/Select.js +2 -2
  19. package/dist/js/components/Select/Select.js.map +1 -1
  20. package/dist/js/components/Select/SelectOption.d.ts +2 -0
  21. package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
  22. package/dist/js/components/Select/SelectOption.js +70 -48
  23. package/dist/js/components/Select/SelectOption.js.map +1 -1
  24. package/dist/umd/react-core.js +79 -53
  25. package/dist/umd/react-core.min.js +1 -1
  26. package/index.d.ts +4 -0
  27. package/package.json +5 -5
  28. package/src/components/BackToTop/examples/BackToTop.css +3 -3
  29. package/src/components/BackToTop/examples/BackToTop.md +1 -6
  30. package/src/components/BackToTop/examples/BackToTopBasic.tsx +4 -0
  31. package/src/components/Backdrop/examples/Backdrop.md +3 -12
  32. package/src/components/Backdrop/examples/BackdropBasic.tsx +4 -0
  33. package/src/components/Backdrop/examples/BackdropSpinner.tsx +10 -0
  34. package/src/components/BackgroundImage/examples/BackgroundImage.md +2 -21
  35. package/src/components/BackgroundImage/examples/BackgroundImageBasic.tsx +15 -0
  36. package/src/components/Badge/examples/Badge.md +3 -24
  37. package/src/components/Badge/examples/BadgeRead.tsx +19 -0
  38. package/src/components/Badge/examples/BadgeUnread.tsx +8 -0
  39. package/src/components/Banner/examples/Banner.md +1 -14
  40. package/src/components/Banner/examples/BannerBasic.tsx +16 -0
  41. package/src/components/Brand/examples/Brand.md +3 -5
  42. package/src/components/Brand/examples/BrandBasic.tsx +5 -0
  43. package/src/components/Breadcrumb/examples/Breadcrumb.md +4 -105
  44. package/src/components/Breadcrumb/examples/BreadcrumbBasic.tsx +13 -0
  45. package/src/components/Breadcrumb/examples/BreadcrumbDropdown.tsx +53 -0
  46. package/src/components/Breadcrumb/examples/BreadcrumbWithHeading.tsx +12 -0
  47. package/src/components/Breadcrumb/examples/BreadcrumbWithoutHomeLink.tsx +15 -0
  48. package/src/components/Button/examples/ButtonAriaDisabled.tsx +33 -37
  49. package/src/components/Button/examples/ButtonCallToAction.tsx +8 -6
  50. package/src/components/Button/examples/ButtonDisabled.tsx +33 -37
  51. package/src/components/Button/examples/ButtonInlineSpanLink.tsx +2 -2
  52. package/src/components/Button/examples/ButtonLinks.tsx +6 -6
  53. package/src/components/Button/examples/ButtonProgress.tsx +8 -5
  54. package/src/components/Button/examples/ButtonSmall.tsx +9 -7
  55. package/src/components/Button/examples/ButtonTypes.tsx +4 -6
  56. package/src/components/Button/examples/ButtonVariations.tsx +31 -36
  57. package/src/components/DatePicker/DatePicker.tsx +10 -2
  58. package/src/components/DatePicker/examples/DatePicker.md +4 -1
  59. package/src/components/JumpLinks/examples/JumpLinks.md +0 -1
  60. package/src/components/Select/Select.tsx +2 -1
  61. package/src/components/Select/SelectOption.tsx +188 -133
  62. package/src/demos/JumpLinks.md +0 -1
@@ -1,43 +1,39 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
  import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
4
  import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
5
5
 
6
6
  export const ButtonDisabled: React.FunctionComponent = () => (
7
- <Flex direction={{ default: 'column' }}>
8
- <Flex>
9
- <Button isDisabled>Primary disabled</Button>
10
- <Button isDisabled>Secondary disabled</Button>
11
- <Button variant="secondary" isDanger isDisabled>
12
- Danger secondary disabled
13
- </Button>
14
- <Button isDisabled variant="tertiary">
15
- Tertiary disabled
16
- </Button>
17
- <Button isDisabled variant="danger">
18
- Danger disabled
19
- </Button>
20
- <Button isDisabled variant="warning">
21
- Warning disabled
22
- </Button>
23
- </Flex>
24
-
25
- <Flex>
26
- <Button isDisabled variant="link" icon={<PlusCircleIcon />}>
27
- Link disabled
28
- </Button>
29
- <Button isDisabled variant="link" isInline>
30
- Inline link disabled
31
- </Button>
32
- <Button variant="link" isDanger isDisabled>
33
- Danger link disabled
34
- </Button>
35
- <Button isDisabled variant="plain" aria-label="Action">
36
- <TimesIcon />
37
- </Button>
38
- <Button isDisabled variant="control">
39
- Control disabled
40
- </Button>
41
- </Flex>
42
- </Flex>
7
+ <React.Fragment>
8
+ <Button isDisabled>Primary disabled</Button> <Button isDisabled>Secondary disabled</Button>{' '}
9
+ <Button variant="secondary" isDanger isDisabled>
10
+ Danger secondary disabled
11
+ </Button>{' '}
12
+ <Button isDisabled variant="tertiary">
13
+ Tertiary disabled
14
+ </Button>{' '}
15
+ <Button isDisabled variant="danger">
16
+ Danger disabled
17
+ </Button>{' '}
18
+ <Button isDisabled variant="warning">
19
+ Warning disabled
20
+ </Button>
21
+ <br />
22
+ <br />
23
+ <Button isDisabled variant="link" icon={<PlusCircleIcon />}>
24
+ Link disabled
25
+ </Button>{' '}
26
+ <Button isDisabled variant="link" isInline>
27
+ Inline link disabled
28
+ </Button>{' '}
29
+ <Button variant="link" isDanger isDisabled>
30
+ Danger link disabled
31
+ </Button>{' '}
32
+ <Button isDisabled variant="plain" aria-label="Action">
33
+ <TimesIcon />
34
+ </Button>{' '}
35
+ <Button isDisabled variant="control">
36
+ Control disabled
37
+ </Button>
38
+ </React.Fragment>
43
39
  );
@@ -13,7 +13,7 @@ const handleKeydown = (event: React.KeyboardEvent<HTMLButtonElement>) => {
13
13
  };
14
14
 
15
15
  export const ButtonInlineSpanLink: React.FunctionComponent = () => (
16
- <>
16
+ <React.Fragment>
17
17
  <p>
18
18
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
19
19
  <Button variant="link" isInline component="span">
@@ -32,5 +32,5 @@ export const ButtonInlineSpanLink: React.FunctionComponent = () => (
32
32
  </Button>
33
33
  Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
34
34
  </p>
35
- </>
35
+ </React.Fragment>
36
36
  );
@@ -1,19 +1,19 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
 
4
4
  export const ButtonLinks: React.FunctionComponent = () => (
5
- <Flex>
5
+ <React.Fragment>
6
6
  <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="primary">
7
7
  Link to core docs
8
- </Button>
8
+ </Button>{' '}
9
9
  <Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="secondary">
10
10
  Secondary link to core docs
11
- </Button>
11
+ </Button>{' '}
12
12
  <Button isDisabled component="a" href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
13
13
  Tertiary link to core docs
14
- </Button>
14
+ </Button>{' '}
15
15
  <Button component="a" href="https://pf4.patternfly.org/contribution/#modifiers" variant="link">
16
16
  Jump to modifiers in contribution guidelines
17
17
  </Button>
18
- </Flex>
18
+ </React.Fragment>
19
19
  );
@@ -1,22 +1,23 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
 
4
4
  export const ButtonProgress: React.FunctionComponent = () => {
5
5
  const [isPrimaryLoading, setIsPrimaryLoading] = React.useState<boolean>(true);
6
6
  const [isSecondaryLoading, setIsSecondaryLoading] = React.useState<boolean>(true);
7
7
 
8
8
  return (
9
- <Flex>
9
+ <React.Fragment>
10
10
  <Button
11
+ spinnerAriaValueText={isPrimaryLoading ? 'Loading' : undefined}
11
12
  isLoading={isPrimaryLoading}
12
13
  variant="primary"
13
14
  onClick={() => setIsPrimaryLoading(!isPrimaryLoading)}
14
15
  {...(isPrimaryLoading && { spinnerAriaValueText: 'Loading' })}
15
16
  >
16
17
  {isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
17
- </Button>
18
-
18
+ </Button>{' '}
19
19
  <Button
20
+ spinnerAriaValueText={isSecondaryLoading ? 'Loading' : undefined}
20
21
  isLoading={isSecondaryLoading}
21
22
  variant="secondary"
22
23
  onClick={() => setIsSecondaryLoading(!isSecondaryLoading)}
@@ -24,6 +25,8 @@ export const ButtonProgress: React.FunctionComponent = () => {
24
25
  >
25
26
  {isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
26
27
  </Button>
27
- </Flex>
28
+ <br />
29
+ <br />
30
+ </React.Fragment>
28
31
  );
29
32
  };
@@ -1,22 +1,24 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
 
4
4
  export const ButtonSmall: React.FunctionComponent = () => (
5
- <Flex>
5
+ <React.Fragment>
6
6
  <Button variant="primary" isSmall>
7
7
  Primary
8
- </Button>
8
+ </Button>{' '}
9
9
  <Button variant="secondary" isSmall>
10
10
  Secondary
11
- </Button>
11
+ </Button>{' '}
12
12
  <Button variant="tertiary" isSmall>
13
13
  Tertiary
14
- </Button>
14
+ </Button>{' '}
15
15
  <Button variant="danger" isSmall>
16
16
  Danger
17
- </Button>
17
+ </Button>{' '}
18
18
  <Button variant="warning" isSmall>
19
19
  Warning
20
20
  </Button>
21
- </Flex>
21
+ <br />
22
+ <br />
23
+ </React.Fragment>
22
24
  );
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
 
4
4
  export const ButtonTypes: React.FunctionComponent = () => (
5
- <Flex>
6
- <Button type="submit">Submit</Button>
7
- <Button type="reset">Reset</Button>
8
- <Button>Default</Button>
9
- </Flex>
5
+ <React.Fragment>
6
+ <Button type="submit">Submit</Button> <Button type="reset">Reset</Button> <Button>Default</Button>
7
+ </React.Fragment>
10
8
  );
@@ -1,47 +1,42 @@
1
1
  import React from 'react';
2
- import { Button, Flex } from '@patternfly/react-core';
2
+ import { Button } from '@patternfly/react-core';
3
3
  import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
4
  import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
5
5
  import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
6
6
  import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
7
7
 
8
8
  export const ButtonVariations: React.FunctionComponent = () => (
9
- <Flex direction={{ default: 'column' }} alignItems={{ default: 'alignItemsFlexStart' }}>
10
- <Flex>
11
- <Button variant="primary">Primary</Button>
12
- <Button variant="secondary">Secondary</Button>
13
- <Button variant="secondary" isDanger>
14
- Danger Secondary
15
- </Button>
16
- <Button variant="tertiary">Tertiary</Button>
17
- <Button variant="danger">Danger</Button>
18
- <Button variant="warning">Warning</Button>
19
- </Flex>
20
-
21
- <Flex>
22
- <Button variant="link" icon={<PlusCircleIcon />}>
23
- Link
24
- </Button>
25
- <Button variant="link" icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
26
- Link
27
- </Button>
28
- <Button variant="link" isInline>
29
- Inline link
30
- </Button>
31
- <Button variant="link" isDanger>
32
- Danger link
33
- </Button>
34
- </Flex>
35
-
9
+ <React.Fragment>
10
+ <Button variant="primary">Primary</Button> <Button variant="secondary">Secondary</Button>{' '}
11
+ <Button variant="secondary" isDanger>
12
+ Danger Secondary
13
+ </Button>{' '}
14
+ <Button variant="tertiary">Tertiary</Button> <Button variant="danger">Danger</Button>{' '}
15
+ <Button variant="warning">Warning</Button>
16
+ <br />
17
+ <br />
18
+ <Button variant="link" icon={<PlusCircleIcon />}>
19
+ Link
20
+ </Button>{' '}
21
+ <Button variant="link" icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
22
+ Link
23
+ </Button>{' '}
24
+ <Button variant="link" isInline>
25
+ Inline link
26
+ </Button>{' '}
27
+ <Button variant="link" isDanger>
28
+ Danger link
29
+ </Button>
30
+ <br />
31
+ <br />
36
32
  <Button variant="plain" aria-label="Action">
37
33
  <TimesIcon />
38
34
  </Button>
39
-
40
- <Flex>
41
- <Button variant="control">Control</Button>
42
- <Button variant="control" aria-label="Copy">
43
- <CopyIcon />
44
- </Button>
45
- </Flex>
46
- </Flex>
35
+ <br />
36
+ <br />
37
+ <Button variant="control">Control</Button>{' '}
38
+ <Button variant="control" aria-label="Copy">
39
+ <CopyIcon />
40
+ </Button>
41
+ </React.Fragment>
47
42
  );
@@ -30,6 +30,8 @@ export interface DatePickerProps
30
30
  invalidFormatText?: string;
31
31
  /** Callback called every time the input value changes */
32
32
  onChange?: (value: string, date?: Date) => void;
33
+ /** Callback called every time the input loses focus */
34
+ onBlur?: (value: string, date?: Date) => void;
33
35
  /** Text for label */
34
36
  helperText?: React.ReactNode;
35
37
  /** Aria label for the button to open the date picker */
@@ -69,6 +71,7 @@ const DatePickerBase = (
69
71
  'aria-label': ariaLabel = 'Date picker',
70
72
  buttonAriaLabel = 'Toggle date picker',
71
73
  onChange = (): any => undefined,
74
+ onBlur = (): any => undefined,
72
75
  invalidFormatText = 'Invalid date',
73
76
  helperText,
74
77
  appendTo,
@@ -101,10 +104,13 @@ const DatePickerBase = (
101
104
  setValueDate(dateParse(valueProp));
102
105
  }, [valueProp]);
103
106
 
107
+ React.useEffect(() => {
108
+ setPristine(!value);
109
+ }, [value]);
110
+
104
111
  const setError = (date: Date) => setErrorText(validators.map(validator => validator(date)).join('\n') || '');
105
112
 
106
113
  const onTextInput = (value: string) => {
107
- setPristine(false);
108
114
  setValue(value);
109
115
  setErrorText('');
110
116
  const newValueDate = dateParse(value);
@@ -122,8 +128,10 @@ const DatePickerBase = (
122
128
  }
123
129
  const newValueDate = dateParse(value);
124
130
  if (isValidDate(newValueDate)) {
131
+ onBlur(value, new Date(newValueDate));
125
132
  setError(newValueDate);
126
133
  } else {
134
+ onBlur(value);
127
135
  setErrorText(invalidFormatText);
128
136
  }
129
137
  };
@@ -230,4 +238,4 @@ const DatePickerBase = (
230
238
  };
231
239
 
232
240
  export const DatePicker = React.forwardRef<DatePickerRef, DatePickerProps>(DatePickerBase);
233
- DatePicker.displayName = 'DatePickerBase';
241
+ DatePicker.displayName = 'DatePicker';
@@ -12,7 +12,10 @@ beta: true
12
12
  import React from 'react';
13
13
  import { DatePicker } from '@patternfly/react-core';
14
14
 
15
- <DatePicker onChange={(str, date) => console.log('onChange', str, date)} />
15
+ <DatePicker
16
+ onBlur={(str, date) => console.log('onBlur', str, date)}
17
+ onChange={(str, date) => console.log('onChange', str, date)}
18
+ />
16
19
  ```
17
20
 
18
21
  ### American format
@@ -2,7 +2,6 @@
2
2
  id: Jump links
3
3
  section: components
4
4
  propComponents: ['JumpLinks', 'JumpLinksItem']
5
- beta: true
6
5
  ---
7
6
 
8
7
  ## Examples
@@ -856,7 +856,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
856
856
  if (renderableItems.find(item => (item as any)?.key === 'loading') === undefined) {
857
857
  if (loadingVariant === 'spinner') {
858
858
  renderableItems.push(
859
- <SelectOption isLoading key="loading" value="loading">
859
+ <SelectOption isLoading key="loading" value="loading" isGrouped>
860
860
  <Spinner size="lg" />
861
861
  </SelectOption>
862
862
  );
@@ -866,6 +866,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
866
866
  isLoad
867
867
  key="loading"
868
868
  value={loadingVariant.text}
869
+ isGrouped
869
870
  setViewMoreNextIndex={this.setVieMoreNextIndex}
870
871
  onClick={loadingVariant?.onClick}
871
872
  />