@patternfly/react-core 5.1.1-prerelease.16 → 5.1.1-prerelease.18

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 (176) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/Chip/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/DragDrop/package.json +1 -1
  28. package/dist/dynamic/components/Drawer/package.json +1 -1
  29. package/dist/dynamic/components/Dropdown/package.json +1 -1
  30. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  31. package/dist/dynamic/components/EmptyState/package.json +1 -1
  32. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  33. package/dist/dynamic/components/FileUpload/package.json +1 -1
  34. package/dist/dynamic/components/Form/package.json +1 -1
  35. package/dist/dynamic/components/FormSelect/package.json +1 -1
  36. package/dist/dynamic/components/HelperText/package.json +1 -1
  37. package/dist/dynamic/components/Hint/package.json +1 -1
  38. package/dist/dynamic/components/Icon/package.json +1 -1
  39. package/dist/dynamic/components/InputGroup/package.json +1 -1
  40. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  41. package/dist/dynamic/components/Label/package.json +1 -1
  42. package/dist/dynamic/components/List/package.json +1 -1
  43. package/dist/dynamic/components/LoginPage/package.json +1 -1
  44. package/dist/dynamic/components/Masthead/package.json +1 -1
  45. package/dist/dynamic/components/Menu/package.json +1 -1
  46. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  47. package/dist/dynamic/components/Modal/package.json +1 -1
  48. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  49. package/dist/dynamic/components/Nav/package.json +1 -1
  50. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  51. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  52. package/dist/dynamic/components/NumberInput/package.json +1 -1
  53. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  54. package/dist/dynamic/components/Page/package.json +1 -1
  55. package/dist/dynamic/components/Pagination/package.json +1 -1
  56. package/dist/dynamic/components/Panel/package.json +1 -1
  57. package/dist/dynamic/components/Popover/package.json +1 -1
  58. package/dist/dynamic/components/Progress/package.json +1 -1
  59. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  60. package/dist/dynamic/components/Radio/package.json +1 -1
  61. package/dist/dynamic/components/SearchInput/package.json +1 -1
  62. package/dist/dynamic/components/Select/package.json +1 -1
  63. package/dist/dynamic/components/Sidebar/package.json +1 -1
  64. package/dist/dynamic/components/SimpleList/package.json +1 -1
  65. package/dist/dynamic/components/Skeleton/package.json +1 -1
  66. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  67. package/dist/dynamic/components/Slider/package.json +1 -1
  68. package/dist/dynamic/components/Spinner/package.json +1 -1
  69. package/dist/dynamic/components/Switch/package.json +1 -1
  70. package/dist/dynamic/components/Tabs/package.json +1 -1
  71. package/dist/dynamic/components/Text/package.json +1 -1
  72. package/dist/dynamic/components/TextArea/package.json +1 -1
  73. package/dist/dynamic/components/TextInput/package.json +1 -1
  74. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  75. package/dist/dynamic/components/Tile/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Select/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  93. package/dist/dynamic/deprecated/components/package.json +1 -1
  94. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  95. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  96. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  97. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  98. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  99. package/dist/dynamic/helpers/constants/package.json +1 -1
  100. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  101. package/dist/dynamic/helpers/favorites/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/next/components/package.json +1 -1
  119. package/dist/esm/components/Dropdown/Dropdown.d.ts +3 -1
  120. package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
  121. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  122. package/dist/esm/components/Menu/MenuContainer.d.ts +1 -1
  123. package/dist/esm/components/Menu/MenuContainer.d.ts.map +1 -1
  124. package/dist/esm/components/Select/Select.d.ts +1 -1
  125. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  126. package/dist/esm/components/Slider/Slider.d.ts +8 -4
  127. package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
  128. package/dist/esm/components/Slider/Slider.js +62 -16
  129. package/dist/esm/components/Slider/Slider.js.map +1 -1
  130. package/dist/esm/components/Timestamp/Timestamp.d.ts +4 -0
  131. package/dist/esm/components/Timestamp/Timestamp.d.ts.map +1 -1
  132. package/dist/esm/components/Timestamp/Timestamp.js +7 -4
  133. package/dist/esm/components/Timestamp/Timestamp.js.map +1 -1
  134. package/dist/esm/helpers/Popper/Popper.d.ts +2 -1
  135. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  136. package/dist/esm/helpers/Popper/Popper.js +27 -5
  137. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  138. package/dist/js/components/Dropdown/Dropdown.d.ts +3 -1
  139. package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
  140. package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
  141. package/dist/js/components/Menu/MenuContainer.d.ts +1 -1
  142. package/dist/js/components/Menu/MenuContainer.d.ts.map +1 -1
  143. package/dist/js/components/Select/Select.d.ts +1 -1
  144. package/dist/js/components/Select/Select.d.ts.map +1 -1
  145. package/dist/js/components/Slider/Slider.d.ts +8 -4
  146. package/dist/js/components/Slider/Slider.d.ts.map +1 -1
  147. package/dist/js/components/Slider/Slider.js +62 -16
  148. package/dist/js/components/Slider/Slider.js.map +1 -1
  149. package/dist/js/components/Timestamp/Timestamp.d.ts +4 -0
  150. package/dist/js/components/Timestamp/Timestamp.d.ts.map +1 -1
  151. package/dist/js/components/Timestamp/Timestamp.js +7 -4
  152. package/dist/js/components/Timestamp/Timestamp.js.map +1 -1
  153. package/dist/js/helpers/Popper/Popper.d.ts +2 -1
  154. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  155. package/dist/js/helpers/Popper/Popper.js +29 -6
  156. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  157. package/dist/umd/react-core.min.js +1 -1
  158. package/helpers/package.json +1 -1
  159. package/layouts/package.json +1 -1
  160. package/next/package.json +1 -1
  161. package/package.json +2 -2
  162. package/src/components/Dropdown/Dropdown.tsx +3 -1
  163. package/src/components/Menu/MenuContainer.tsx +1 -1
  164. package/src/components/Select/Select.tsx +1 -1
  165. package/src/components/Slider/Slider.tsx +69 -20
  166. package/src/components/Slider/_tests_/Slider.test.tsx +3 -3
  167. package/src/components/Slider/examples/SliderActions.tsx +3 -3
  168. package/src/components/Tabs/examples/Tabs.md +1 -3
  169. package/src/components/Timestamp/Timestamp.tsx +12 -3
  170. package/src/components/Timestamp/__tests__/Timestamp.test.tsx +6 -0
  171. package/src/components/Timestamp/examples/Timestamp.md +8 -0
  172. package/src/components/Timestamp/examples/TimestampDefault.tsx +7 -1
  173. package/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx +1 -1
  174. package/src/components/Toolbar/examples/Toolbar.md +0 -6
  175. package/src/helpers/Popper/Popper.tsx +43 -6
  176. package/src/components/Toolbar/examples/Test.tsx +0 -258
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.15","private":true}
1
+ {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.17","private":true}
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.15","private":true}
1
+ {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.17","private":true}
package/next/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.15","private":true}
1
+ {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.17","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "5.1.1-prerelease.16",
3
+ "version": "5.1.1-prerelease.18",
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",
@@ -70,5 +70,5 @@
70
70
  "react": "^17 || ^18",
71
71
  "react-dom": "^17 || ^18"
72
72
  },
73
- "gitHead": "bf516c9a45a29344c825a4d0425726e27c9e565b"
73
+ "gitHead": "2fa883df95ae47f12e4d5f90b6e184cbeca868a7"
74
74
  }
@@ -8,7 +8,7 @@ export interface DropdownPopperProps {
8
8
  /** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
9
9
  direction?: 'up' | 'down';
10
10
  /** Horizontal position of the popper */
11
- position?: 'right' | 'left' | 'center';
11
+ position?: 'right' | 'left' | 'center' | 'start' | 'end';
12
12
  /** Custom width of the popper. If the value is "trigger", it will set the width to the dropdown toggle's width */
13
13
  width?: string | 'trigger';
14
14
  /** Minimum width of the popper. If the value is "trigger", it will set the min width to the dropdown toggle's width */
@@ -17,6 +17,8 @@ export interface DropdownPopperProps {
17
17
  maxWidth?: string | 'trigger';
18
18
  /** Enable to flip the popper when it reaches the boundary */
19
19
  enableFlip?: boolean;
20
+ /** The container to append the popper to. Defaults to 'inline'. */
21
+ appendTo?: HTMLElement | (() => HTMLElement) | 'inline';
20
22
  }
21
23
 
22
24
  export interface DropdownToggleProps {
@@ -5,7 +5,7 @@ export interface MenuPopperProps {
5
5
  /** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
6
6
  direction?: 'up' | 'down';
7
7
  /** Horizontal position of the popper */
8
- position?: 'right' | 'left' | 'center';
8
+ position?: 'right' | 'left' | 'center' | 'start' | 'end';
9
9
  /** Custom width of the popper. If the value is "trigger", it will set the width to the dropdown toggle's width */
10
10
  width?: string | 'trigger';
11
11
  /** Minimum width of the popper. If the value is "trigger", it will set the min width to the dropdown toggle's width */
@@ -8,7 +8,7 @@ export interface SelectPopperProps {
8
8
  /** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
9
9
  direction?: 'up' | 'down';
10
10
  /** Horizontal position of the popper */
11
- position?: 'right' | 'left' | 'center';
11
+ position?: 'right' | 'left' | 'center' | 'start' | 'end';
12
12
  /** Custom width of the popper. If the value is "trigger", it will set the width to the select toggle's width */
13
13
  width?: string | 'trigger';
14
14
  /** Minimum width of the popper. If the value is "trigger", it will set the min width to the select toggle's width */
@@ -46,16 +46,18 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
46
46
  inputAriaLabel?: string;
47
47
  /** Text label that is place after the input field. */
48
48
  inputLabel?: string | number;
49
- /** Position of the input. */
50
- inputPosition?: 'aboveThumb' | 'right';
49
+ /** Position of the input. Note "right" is deprecated. Use "end" instead*/
50
+ inputPosition?: 'aboveThumb' | 'right' | 'end';
51
51
  /** Value displayed in the input field. */
52
52
  inputValue?: number;
53
53
  /** Adds disabled styling, and disables the slider and the input component if present. */
54
54
  isDisabled?: boolean;
55
55
  /** Flag to show value input field. */
56
56
  isInputVisible?: boolean;
57
- /** Actions placed to the left of the slider. */
57
+ /** @deprecated Use startActions instead. Actions placed at the start of the slider. */
58
58
  leftActions?: React.ReactNode;
59
+ /** Actions placed at the start of the slider. */
60
+ startActions?: React.ReactNode;
59
61
  /** The maximum permitted value. */
60
62
  max?: number;
61
63
  /** The minimum permitted value. */
@@ -67,8 +69,10 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
67
69
  inputValue?: number,
68
70
  setLocalInputValue?: React.Dispatch<React.SetStateAction<number>>
69
71
  ) => void;
70
- /** Actions placed to the right of the slider. */
72
+ /** @deprecated Use endActions instead. Actions placed to the right of the slider. */
71
73
  rightActions?: React.ReactNode;
74
+ /** Actions placed at the end of the slider. */
75
+ endActions?: React.ReactNode;
72
76
  /** Flag to indicate if boundaries should be shown for slider that does not have custom steps. */
73
77
  showBoundaries?: boolean;
74
78
  /** Flag to indicate if ticks should be shown for slider that does not have custom steps. */
@@ -95,10 +99,12 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
95
99
  inputAriaLabel = 'Slider value input',
96
100
  thumbAriaLabel = 'Value',
97
101
  hasTooltipOverThumb = false,
98
- inputPosition = 'right',
102
+ inputPosition = 'end',
99
103
  onChange,
100
104
  leftActions,
105
+ startActions,
101
106
  rightActions,
107
+ endActions,
102
108
  step = 1,
103
109
  min = 0,
104
110
  max = 100,
@@ -114,6 +120,12 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
114
120
  const [localValue, setValue] = useState(value);
115
121
  const [localInputValue, setLocalInputValue] = useState(inputValue);
116
122
 
123
+ let isRTL: boolean;
124
+
125
+ React.useEffect(() => {
126
+ isRTL = window.getComputedStyle(sliderRailRef.current).getPropertyValue('direction') === 'rtl';
127
+ });
128
+
117
129
  React.useEffect(() => {
118
130
  setValue(value);
119
131
  }, [value]);
@@ -182,7 +194,11 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
182
194
  e.stopPropagation();
183
195
  e.preventDefault();
184
196
 
185
- diff = e.clientX - thumbRef.current.getBoundingClientRect().left;
197
+ if (isRTL) {
198
+ diff = thumbRef.current.getBoundingClientRect().right - e.clientX;
199
+ } else {
200
+ diff = e.clientX - thumbRef.current.getBoundingClientRect().left;
201
+ }
186
202
 
187
203
  document.addEventListener('mousemove', callbackThumbMove);
188
204
  document.addEventListener('mouseup', callbackThumbUp);
@@ -191,7 +207,11 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
191
207
  const handleTouchStart = (e: React.TouchEvent) => {
192
208
  e.stopPropagation();
193
209
 
194
- diff = e.touches[0].clientX - thumbRef.current.getBoundingClientRect().left;
210
+ if (isRTL) {
211
+ diff = thumbRef.current.getBoundingClientRect().right - e.touches[0].clientX;
212
+ } else {
213
+ diff = e.touches[0].clientX - thumbRef.current.getBoundingClientRect().left;
214
+ }
195
215
 
196
216
  document.addEventListener('touchmove', callbackThumbMove, { passive: false });
197
217
  document.addEventListener('touchend', callbackThumbUp);
@@ -216,8 +236,13 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
216
236
  }
217
237
 
218
238
  const clientPosition = e.touches && e.touches.length ? e.touches[0].clientX : e.clientX;
239
+ let newPosition;
219
240
 
220
- let newPosition = clientPosition - diff - sliderRailRef.current.getBoundingClientRect().left;
241
+ if (isRTL) {
242
+ newPosition = sliderRailRef.current.getBoundingClientRect().right - clientPosition - diff;
243
+ } else {
244
+ newPosition = clientPosition - diff - sliderRailRef.current.getBoundingClientRect().left;
245
+ }
221
246
 
222
247
  const end = sliderRailRef.current.offsetWidth - thumbRef.current.offsetWidth;
223
248
 
@@ -288,21 +313,43 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
288
313
  if (!areCustomStepsContinuous && customSteps) {
289
314
  const stepIndex = customSteps.findIndex((stepObj) => stepObj.value === localValue);
290
315
  if (key === 'ArrowRight') {
291
- if (stepIndex + 1 < customSteps.length) {
292
- {
293
- newValue = customSteps[stepIndex + 1].value;
316
+ if (isRTL) {
317
+ if (stepIndex - 1 >= 0) {
318
+ newValue = customSteps[stepIndex - 1].value;
319
+ }
320
+ } else {
321
+ if (stepIndex + 1 < customSteps.length) {
322
+ {
323
+ newValue = customSteps[stepIndex + 1].value;
324
+ }
294
325
  }
295
326
  }
296
327
  } else if (key === 'ArrowLeft') {
297
- if (stepIndex - 1 >= 0) {
298
- newValue = customSteps[stepIndex - 1].value;
328
+ if (isRTL) {
329
+ if (stepIndex + 1 < customSteps.length) {
330
+ {
331
+ newValue = customSteps[stepIndex + 1].value;
332
+ }
333
+ }
334
+ } else {
335
+ if (stepIndex - 1 >= 0) {
336
+ newValue = customSteps[stepIndex - 1].value;
337
+ }
299
338
  }
300
339
  }
301
340
  } else {
302
341
  if (key === 'ArrowRight') {
303
- newValue = localValue + step <= max ? localValue + step : max;
342
+ if (isRTL) {
343
+ newValue = localValue - step >= min ? localValue - step : min;
344
+ } else {
345
+ newValue = localValue + step <= max ? localValue + step : max;
346
+ }
304
347
  } else if (key === 'ArrowLeft') {
305
- newValue = localValue - step >= min ? localValue - step : min;
348
+ if (isRTL) {
349
+ newValue = localValue + step <= max ? localValue + step : max;
350
+ } else {
351
+ newValue = localValue - step >= min ? localValue - step : min;
352
+ }
306
353
  }
307
354
  }
308
355
 
@@ -347,8 +394,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
347
394
  for (let i = min; i <= max; i = i + step) {
348
395
  const stepValue = getStepValue(i, min, max);
349
396
 
350
- // If we boundaries but not ticks just generate the needed steps
351
- // so that we don't pullute them DOM with empty divs
397
+ // If boundaries but not ticks just generate the needed steps
398
+ // so that we don't pollute them DOM with empty divs
352
399
  if (!showTicks && showBoundaries && i !== min && i !== max) {
353
400
  continue;
354
401
  }
@@ -394,7 +441,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
394
441
  style={{ ...style, ...inputStyle }}
395
442
  {...props}
396
443
  >
397
- {leftActions && <div className={css(styles.sliderActions)}>{leftActions}</div>}
444
+ {(leftActions || startActions) && <div className={css(styles.sliderActions)}>{leftActions || startActions}</div>}
398
445
  <div className={css(styles.sliderMain)}>
399
446
  <div className={css(styles.sliderRail)} ref={sliderRailRef} onClick={!isDisabled ? onSliderRailClick : null}>
400
447
  <div className={css(styles.sliderRailTrack)} />
@@ -434,8 +481,10 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
434
481
  <div className={css(styles.sliderValue, styles.modifiers.floating)}>{displayInput()}</div>
435
482
  )}
436
483
  </div>
437
- {isInputVisible && inputPosition === 'right' && <div className={css(styles.sliderValue)}>{displayInput()}</div>}
438
- {rightActions && <div className={css(styles.sliderActions)}>{rightActions}</div>}
484
+ {isInputVisible && (inputPosition === 'right' || inputPosition === 'end') && (
485
+ <div className={css(styles.sliderValue)}>{displayInput()}</div>
486
+ )}
487
+ {(rightActions || endActions) && <div className={css(styles.sliderActions)}>{rightActions || endActions}</div>}
439
488
  </div>
440
489
  );
441
490
  };
@@ -46,7 +46,7 @@ describe('slider', () => {
46
46
 
47
47
  test('renders slider with input', () => {
48
48
  const { asFragment } = render(
49
- <Slider value={50} isInputVisible inputValue={50} inputLabel="%" inputPosition="right" />
49
+ <Slider value={50} isInputVisible inputValue={50} inputLabel="%" inputPosition="end" />
50
50
  );
51
51
  expect(asFragment()).toMatchSnapshot();
52
52
  });
@@ -62,8 +62,8 @@ describe('slider', () => {
62
62
  const { asFragment } = render(
63
63
  <Slider
64
64
  value={50}
65
- leftActions={<Button variant="plain" aria-label="Minus" />}
66
- rightActions={<Button variant="plain" aria-label="Plus" />}
65
+ startActions={<Button variant="plain" aria-label="Minus" />}
66
+ endActions={<Button variant="plain" aria-label="Plus" />}
67
67
  />
68
68
  );
69
69
  expect(asFragment()).toMatchSnapshot();
@@ -65,12 +65,12 @@ export const SliderActions: React.FunctionComponent = () => {
65
65
  <Slider
66
66
  value={value1}
67
67
  onChange={onChange1}
68
- leftActions={
68
+ startActions={
69
69
  <Button variant="plain" aria-label="Minus" onClick={onMinusClick}>
70
70
  <MinusIcon />
71
71
  </Button>
72
72
  }
73
- rightActions={
73
+ endActions={
74
74
  <Button variant="plain" aria-label="Plus" onClick={onPlusClick}>
75
75
  <PlusIcon />
76
76
  </Button>
@@ -85,7 +85,7 @@ export const SliderActions: React.FunctionComponent = () => {
85
85
  inputLabel="%"
86
86
  isInputVisible
87
87
  isDisabled={isDisabled}
88
- rightActions={buildAction(isDisabled)}
88
+ endActions={buildAction(isDisabled)}
89
89
  />
90
90
  </>
91
91
  );
@@ -28,7 +28,7 @@ You can adjust a tab in the following ways:
28
28
  - To disable a tab, but keep it perceivable to assistive technology users, use the `isAriaDisabled` property. If a disabled tab has a tooltip, use this property instead of `isDisabled`.
29
29
  - To add a tooltip to an aria-disabled tab, use the `tooltip` property.
30
30
 
31
- Most tab variations can either be 'default' or 'boxed':
31
+ Tabs can be styled as 'default' or 'boxed':
32
32
 
33
33
  - Default tabs do not have any borders and use a bottom line to distinguish between a selected tab, a hovered tab, and an inactive tab.
34
34
  - Boxed tabs are outlined to emphasize the area that a tab spans. To preview boxed tabs in the following examples, select the 'isBox' checkbox, which sets the `isBox` property to true.
@@ -207,8 +207,6 @@ The tab its content should only be mounted when the tab is visible.
207
207
 
208
208
  To enable closeable tabs, pass the `onClose` property to the `<Tabs>` component. To enable a button that adds new tabs, pass the `onAdd` property to `<Tabs>`.
209
209
 
210
- Aria labels may be controlled manually by passing the `closeButtonAriaLabel` property to a `<Tab>` and the `addButtonAriaLabel` property to `<Tabs>`.
211
-
212
210
  ```ts file="./TabsDynamic.tsx"
213
211
  ```
214
212
 
@@ -64,6 +64,10 @@ export interface TimestampProps extends React.HTMLProps<HTMLSpanElement> {
64
64
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
65
65
  */
66
66
  locale?: string;
67
+ /** Flag indicating whether the default content should be displayed as a UTC string
68
+ * instead of a local string.
69
+ */
70
+ shouldDisplayUTC?: boolean;
67
71
  /** Determines the format of the displayed time in the timestamp and UTC tooltip. Examples:
68
72
  * "Full" => 11:25:00 AM Eastern Daylight Time
69
73
  * "Long" => 11:25:00 AM EDT
@@ -84,6 +88,7 @@ export const Timestamp: React.FunctionComponent<TimestampProps> = ({
84
88
  displaySuffix = '',
85
89
  is12Hour,
86
90
  locale,
91
+ shouldDisplayUTC,
87
92
  timeFormat,
88
93
  tooltip,
89
94
  ...props
@@ -117,7 +122,6 @@ export const Timestamp: React.FunctionComponent<TimestampProps> = ({
117
122
  ...formatOptions,
118
123
  ...(hasTimeFormat && { timeStyle: timeFormat })
119
124
  });
120
- const defaultDisplay = `${dateAsLocaleString}${displaySuffix ? ' ' + displaySuffix : ''}`;
121
125
 
122
126
  const utcTimeFormat = timeFormat !== 'short' ? 'medium' : 'short';
123
127
  const convertToUTCString = (date: Date) => new Date(date).toUTCString().slice(0, -3);
@@ -125,8 +129,13 @@ export const Timestamp: React.FunctionComponent<TimestampProps> = ({
125
129
  ...formatOptions,
126
130
  ...(hasTimeFormat && { timeStyle: utcTimeFormat })
127
131
  });
128
- const defaultTooltipContent = `${utcDateString}${tooltip?.suffix ? ' ' + tooltip.suffix : ' UTC'}`;
132
+ const defaultUTCSuffix = timeFormat === 'full' ? 'Coordinated Universal Time' : 'UTC';
133
+ const createUTCContent = (customSuffix: string) =>
134
+ `${utcDateString} ${customSuffix ? customSuffix : defaultUTCSuffix}`;
129
135
 
136
+ const defaultDisplay = shouldDisplayUTC
137
+ ? createUTCContent(displaySuffix)
138
+ : `${dateAsLocaleString}${displaySuffix ? ' ' + displaySuffix : ''}`;
130
139
  const { dateTime, ...propsWithoutDateTime } = props;
131
140
 
132
141
  const timestamp = (
@@ -143,7 +152,7 @@ export const Timestamp: React.FunctionComponent<TimestampProps> = ({
143
152
 
144
153
  return tooltip ? (
145
154
  <Tooltip
146
- content={tooltip.variant === TimestampTooltipVariant.default ? defaultTooltipContent : tooltip.content}
155
+ content={tooltip.variant === TimestampTooltipVariant.default ? createUTCContent(tooltip.suffix) : tooltip.content}
147
156
  {...tooltip.tooltipProps}
148
157
  >
149
158
  {timestamp}
@@ -55,6 +55,12 @@ test('Renders passed in date with default formatting', () => {
55
55
  expect(screen.getByText('1/1/2022, 12:00:00 AM')).toBeInTheDocument();
56
56
  });
57
57
 
58
+ test('Renders passed in date as UTC when shouldDisplayUTC is true', () => {
59
+ render(<Timestamp shouldDisplayUTC date={new Date(2022, 0, 1)} />);
60
+
61
+ expect(screen.getByText('1/1/2022, 5:00:00 AM UTC')).toBeInTheDocument();
62
+ });
63
+
58
64
  test('Renders with correct datetime attribute when date is passed in', () => {
59
65
  const passedDate = new Date(2022, 0, 1);
60
66
  render(<Timestamp date={passedDate} />);
@@ -12,7 +12,10 @@ beta: true
12
12
 
13
13
  By default, a timestamp will display the current date and time based on the current locale if the `date` prop is not passed in.
14
14
 
15
+ Passing the `shouldDisplayUTC` property will display the UTC date and time instead of the current or passed in locale.
16
+
15
17
  ```ts file="./TimestampDefault.tsx"
18
+
16
19
  ```
17
20
 
18
21
  ### Basic formats
@@ -22,6 +25,7 @@ The format of the displayed content can be customized by passing in the `dateFor
22
25
  You can also pass in the `displaySuffix` prop to display a custom suffix at the end of the displayed content. This will not override a timezone that is already displayed from the applied time format.
23
26
 
24
27
  ```ts file="./TimestampBasicFormats.tsx"
28
+
25
29
  ```
26
30
 
27
31
  ### Custom format
@@ -29,6 +33,7 @@ You can also pass in the `displaySuffix` prop to display a custom suffix at the
29
33
  The format of the displayed content can be further customized by passing in the `customFormat` prop. Read [datetime format options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options) for a list of options that can be passed in.
30
34
 
31
35
  ```ts file="./TimestampCustomFormat.tsx"
36
+
32
37
  ```
33
38
 
34
39
  ### Default tooltip
@@ -38,6 +43,7 @@ To render a tooltip that displays the timestamp content as a UTC time, you can p
38
43
  You can customize the suffix of this default tooltip variant by passing in `suffix` to the `tooltip` prop.
39
44
 
40
45
  ```ts file="./TimestampDefaultTooltip.tsx"
46
+
41
47
  ```
42
48
 
43
49
  ### Custom content
@@ -47,6 +53,7 @@ To display custom content, such as a relative time or prefacing text, you can pa
47
53
  When also rendering a default tooltip with the `tooltip` prop, you can pass in the `dateFormat` and/or `timeFormat` props to customize the tooltip content without affecting the custom timestamp content.
48
54
 
49
55
  ```ts file="TimestampCustomContent.tsx"
56
+
50
57
  ```
51
58
 
52
59
  ### Custom tooltip
@@ -54,4 +61,5 @@ When also rendering a default tooltip with the `tooltip` prop, you can pass in t
54
61
  By passing in `variant="custom"` and `content` to the `tooltip` prop, you can display custom content within the timestamp's tooltip.
55
62
 
56
63
  ```ts file="TimestampCustomTooltip.tsx"
64
+
57
65
  ```
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Timestamp } from '@patternfly/react-core';
3
3
 
4
- export const TimestampDefault: React.FunctionComponent = () => <Timestamp />;
4
+ export const TimestampDefault: React.FunctionComponent = () => (
5
+ <>
6
+ <Timestamp />
7
+ <br />
8
+ <Timestamp shouldDisplayUTC />
9
+ </>
10
+ );
@@ -11,7 +11,7 @@ export const TimestampDefaultTooltip: React.FunctionComponent = () => {
11
11
  <br />
12
12
  <Timestamp
13
13
  date={currentDate}
14
- tooltip={{ variant: TimestampTooltipVariant.default, suffix: 'Coordinated Universal Time' }}
14
+ tooltip={{ variant: TimestampTooltipVariant.default, suffix: 'Coordinated Universal Time (UTC)' }}
15
15
  />
16
16
  </>
17
17
  );
@@ -14,12 +14,6 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
14
14
 
15
15
  ## Examples
16
16
 
17
- ### TEST - remove before merging
18
-
19
- ```ts file="./Test.tsx"
20
-
21
- ```
22
-
23
17
  ### Toolbar items
24
18
 
25
19
  A toolbar can contain multiple toolbar items, like filters and buttons.
@@ -45,6 +45,21 @@ const getOppositePlacement = (placement: Placement): any =>
45
45
  export const getOpacityTransition = (animationDuration: number) =>
46
46
  `opacity ${animationDuration}ms cubic-bezier(.54, 1.5, .38, 1.11)`;
47
47
 
48
+ export const getLanguageDirection = (targetElement: HTMLElement) => {
49
+ const defaultDirection = 'ltr';
50
+ let direction = defaultDirection;
51
+
52
+ if (targetElement) {
53
+ direction = getComputedStyle(targetElement).getPropertyValue('direction');
54
+ }
55
+
56
+ if (['ltr', 'rtl'].includes(direction)) {
57
+ return direction as 'ltr' | 'rtl';
58
+ }
59
+
60
+ return defaultDirection;
61
+ };
62
+
48
63
  export interface PopperProps {
49
64
  /**
50
65
  * Trigger reference element to which the popper is relatively placed to.
@@ -66,7 +81,7 @@ export interface PopperProps {
66
81
  /** popper direction */
67
82
  direction?: 'up' | 'down';
68
83
  /** popper position */
69
- position?: 'right' | 'left' | 'center';
84
+ position?: 'right' | 'left' | 'center' | 'start' | 'end';
70
85
  /** Instead of direction and position can set the placement of the popper */
71
86
  placement?: Placement;
72
87
  /** Custom width of the popper. If the value is "trigger", it will set the width to the trigger element's width */
@@ -177,7 +192,7 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
177
192
  trigger,
178
193
  popper,
179
194
  direction = 'down',
180
- position = 'left',
195
+ position = 'start',
181
196
  placement,
182
197
  width,
183
198
  minWidth = 'trigger',
@@ -226,6 +241,28 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
226
241
  const refOrTrigger = refElement || triggerElement;
227
242
  const showPopper = isVisible || internalIsVisible;
228
243
 
244
+ const triggerParent = ((triggerRef as React.RefObject<any>)?.current || triggerElement)?.parentElement;
245
+ const languageDirection = getLanguageDirection(triggerParent);
246
+
247
+ const internalPosition = React.useMemo<'left' | 'right' | 'center'>(() => {
248
+ const fixedPositions = { left: 'left', right: 'right', center: 'center' };
249
+
250
+ const positionMap = {
251
+ ltr: {
252
+ start: 'left',
253
+ end: 'right',
254
+ ...fixedPositions
255
+ },
256
+ rtl: {
257
+ start: 'right',
258
+ end: 'left',
259
+ ...fixedPositions
260
+ }
261
+ };
262
+
263
+ return positionMap[languageDirection][position] as 'left' | 'right' | 'center';
264
+ }, [position, languageDirection]);
265
+
229
266
  const onDocumentClickCallback = React.useCallback(
230
267
  (event: MouseEvent) => onDocumentClick(event, refOrTrigger, popperElement),
231
268
  [showPopper, triggerElement, refElement, popperElement, onDocumentClick]
@@ -333,15 +370,15 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
333
370
  return placement;
334
371
  }
335
372
  let convertedPlacement = direction === 'up' ? 'top' : 'bottom';
336
- if (position !== 'center') {
337
- convertedPlacement = `${convertedPlacement}-${position === 'right' ? 'end' : 'start'}`;
373
+ if (internalPosition !== 'center') {
374
+ convertedPlacement = `${convertedPlacement}-${internalPosition === 'right' ? 'end' : 'start'}`;
338
375
  }
339
376
  return convertedPlacement as Placement;
340
377
  };
341
- const getPlacementMemo = React.useMemo(getPlacement, [direction, position, placement]);
378
+ const getPlacementMemo = React.useMemo(getPlacement, [direction, internalPosition, placement]);
342
379
  const getOppositePlacementMemo = React.useMemo(
343
380
  () => getOppositePlacement(getPlacement()),
344
- [direction, position, placement]
381
+ [direction, internalPosition, placement]
345
382
  );
346
383
 
347
384
  const widthMods: Modifier<'widthMods', {}> = React.useMemo(