@carbon/react 1.53.1 → 1.54.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.
Files changed (114) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +981 -1068
  2. package/es/components/Button/Button.d.ts +1 -1
  3. package/es/components/Button/Button.js +13 -89
  4. package/es/components/Button/ButtonBase.d.ts +10 -0
  5. package/es/components/Button/ButtonBase.js +110 -0
  6. package/es/components/CodeSnippet/CodeSnippet.js +1 -0
  7. package/es/components/ComboBox/ComboBox.js +13 -4
  8. package/es/components/ComboButton/index.js +1 -1
  9. package/es/components/ComposedModal/ComposedModal.js +19 -10
  10. package/es/components/DataTable/DataTable.js +1 -1
  11. package/es/components/DataTable/TableBatchAction.d.ts +1 -1
  12. package/es/components/DataTable/TableToolbarMenu.d.ts +5 -1
  13. package/es/components/DataTable/TableToolbarMenu.js +7 -0
  14. package/es/components/DatePicker/DatePicker.d.ts +4 -0
  15. package/es/components/DatePicker/DatePicker.js +37 -0
  16. package/es/components/IconButton/index.d.ts +1 -1
  17. package/es/components/IconButton/index.js +3 -4
  18. package/es/components/ListBox/ListBox.d.ts +8 -0
  19. package/es/components/ListBox/ListBox.js +15 -3
  20. package/es/components/Loading/Loading.d.ts +1 -1
  21. package/es/components/Menu/Menu.js +2 -0
  22. package/es/components/Modal/Modal.js +14 -5
  23. package/es/components/ModalWrapper/ModalWrapper.d.ts +1 -1
  24. package/es/components/Notification/Notification.js +18 -6
  25. package/es/components/Pagination/Pagination.Skeleton.d.ts +25 -0
  26. package/es/components/Pagination/Pagination.d.ts +102 -0
  27. package/es/components/Pagination/Pagination.js +13 -14
  28. package/es/components/Pagination/index.d.ts +10 -0
  29. package/es/components/Popover/index.d.ts +1 -1
  30. package/es/components/Popover/index.js +175 -108
  31. package/es/components/RadioTile/RadioTile.d.ts +55 -0
  32. package/es/components/RadioTile/RadioTile.js +17 -17
  33. package/es/components/RadioTile/index.d.ts +10 -0
  34. package/es/components/Slider/Slider.Skeleton.js +6 -2
  35. package/es/components/Slug/index.js +23 -2
  36. package/es/components/Stack/HStack.d.ts +10 -0
  37. package/es/components/Stack/HStack.js +23 -0
  38. package/es/components/Stack/Stack.d.ts +1 -1
  39. package/es/components/Stack/Stack.js +2 -2
  40. package/es/components/Stack/VStack.d.ts +10 -0
  41. package/es/components/Stack/{index.js → VStack.js} +1 -8
  42. package/es/components/Stack/index.d.ts +3 -6
  43. package/es/components/StructuredList/StructuredList.d.ts +8 -0
  44. package/es/components/StructuredList/StructuredList.js +28 -10
  45. package/es/components/TileGroup/TileGroup.js +30 -24
  46. package/es/components/Toggletip/index.d.ts +1 -18
  47. package/es/components/Toggletip/index.js +27 -4
  48. package/es/components/Tooltip/Tooltip.js +23 -5
  49. package/es/feature-flags.js +2 -1
  50. package/es/index.d.ts +1 -0
  51. package/es/index.js +5 -4
  52. package/es/internal/FloatingMenu.js +26 -5
  53. package/es/internal/environment.js +5 -1
  54. package/es/internal/keyboard/navigation.js +6 -2
  55. package/es/internal/useOutsideClick.js +31 -0
  56. package/es/internal/wrapFocus.js +51 -1
  57. package/es/tools/createPropAdapter.js +40 -0
  58. package/lib/components/Button/Button.d.ts +1 -1
  59. package/lib/components/Button/Button.js +13 -90
  60. package/lib/components/Button/ButtonBase.d.ts +10 -0
  61. package/lib/components/Button/ButtonBase.js +119 -0
  62. package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
  63. package/lib/components/ComboBox/ComboBox.js +13 -4
  64. package/lib/components/ComboButton/index.js +1 -1
  65. package/lib/components/ComposedModal/ComposedModal.js +17 -8
  66. package/lib/components/DataTable/DataTable.js +1 -1
  67. package/lib/components/DataTable/TableBatchAction.d.ts +1 -1
  68. package/lib/components/DataTable/TableToolbarMenu.d.ts +5 -1
  69. package/lib/components/DataTable/TableToolbarMenu.js +7 -0
  70. package/lib/components/DatePicker/DatePicker.d.ts +4 -0
  71. package/lib/components/DatePicker/DatePicker.js +37 -0
  72. package/lib/components/IconButton/index.d.ts +1 -1
  73. package/lib/components/IconButton/index.js +3 -4
  74. package/lib/components/ListBox/ListBox.d.ts +8 -0
  75. package/lib/components/ListBox/ListBox.js +15 -3
  76. package/lib/components/Loading/Loading.d.ts +1 -1
  77. package/lib/components/Menu/Menu.js +2 -0
  78. package/lib/components/Modal/Modal.js +14 -5
  79. package/lib/components/ModalWrapper/ModalWrapper.d.ts +1 -1
  80. package/lib/components/Notification/Notification.js +15 -3
  81. package/lib/components/Pagination/Pagination.Skeleton.d.ts +25 -0
  82. package/lib/components/Pagination/Pagination.d.ts +102 -0
  83. package/lib/components/Pagination/Pagination.js +13 -14
  84. package/lib/components/Pagination/index.d.ts +10 -0
  85. package/lib/components/Popover/index.d.ts +1 -1
  86. package/lib/components/Popover/index.js +174 -107
  87. package/lib/components/RadioTile/RadioTile.d.ts +55 -0
  88. package/lib/components/RadioTile/RadioTile.js +17 -17
  89. package/lib/components/RadioTile/index.d.ts +10 -0
  90. package/lib/components/Slider/Slider.Skeleton.js +5 -1
  91. package/lib/components/Slug/index.js +23 -2
  92. package/lib/components/Stack/HStack.d.ts +10 -0
  93. package/lib/components/Stack/HStack.js +31 -0
  94. package/lib/components/Stack/Stack.d.ts +1 -1
  95. package/lib/components/Stack/Stack.js +3 -3
  96. package/lib/components/Stack/VStack.d.ts +10 -0
  97. package/lib/components/Stack/{index.js → VStack.js} +0 -8
  98. package/lib/components/Stack/index.d.ts +3 -6
  99. package/lib/components/StructuredList/StructuredList.d.ts +8 -0
  100. package/lib/components/StructuredList/StructuredList.js +27 -9
  101. package/lib/components/TileGroup/TileGroup.js +30 -24
  102. package/lib/components/Toggletip/index.d.ts +1 -18
  103. package/lib/components/Toggletip/index.js +27 -4
  104. package/lib/components/Tooltip/Tooltip.js +23 -5
  105. package/lib/feature-flags.js +2 -1
  106. package/lib/index.d.ts +1 -0
  107. package/lib/index.js +15 -14
  108. package/lib/internal/FloatingMenu.js +44 -4
  109. package/lib/internal/environment.js +5 -1
  110. package/lib/internal/keyboard/navigation.js +6 -2
  111. package/lib/internal/useOutsideClick.js +35 -0
  112. package/lib/internal/wrapFocus.js +51 -0
  113. package/lib/tools/createPropAdapter.js +44 -0
  114. package/package.json +9 -7
@@ -47,8 +47,10 @@ const ListBox = /*#__PURE__*/React__default["default"].forwardRef(function ListB
47
47
  size,
48
48
  invalid,
49
49
  invalidText,
50
+ invalidTextId,
50
51
  warn,
51
52
  warnText,
53
+ warnTextId,
52
54
  light,
53
55
  isOpen,
54
56
  ...rest
@@ -80,9 +82,11 @@ const ListBox = /*#__PURE__*/React__default["default"].forwardRef(function ListB
80
82
  }), children), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
81
83
  className: `${prefix}--list-box__divider`
82
84
  }), invalid ? /*#__PURE__*/React__default["default"].createElement("div", {
83
- className: `${prefix}--form-requirement`
85
+ className: `${prefix}--form-requirement`,
86
+ id: invalidTextId
84
87
  }, invalidText) : null, showWarning ? /*#__PURE__*/React__default["default"].createElement("div", {
85
- className: `${prefix}--form-requirement`
88
+ className: `${prefix}--form-requirement`,
89
+ id: warnTextId
86
90
  }, warnText) : null);
87
91
  });
88
92
  ListBox.displayName = 'ListBox';
@@ -107,6 +111,10 @@ ListBox.propTypes = {
107
111
  * Specify the text to be displayed when the control is invalid
108
112
  */
109
113
  invalidText: PropTypes__default["default"].node,
114
+ /**
115
+ * Specify the id to be applied to the element containing the invalid text
116
+ */
117
+ invalidTextId: PropTypes__default["default"].string,
110
118
  /**
111
119
  * Specify if the control should render open
112
120
  */
@@ -132,7 +140,11 @@ ListBox.propTypes = {
132
140
  /**
133
141
  * Provide the text that is displayed when the control is in warning state
134
142
  */
135
- warnText: PropTypes__default["default"].node
143
+ warnText: PropTypes__default["default"].string,
144
+ /**
145
+ * Specify the id to be applied to the element containing the warn text
146
+ */
147
+ warnTextId: PropTypes__default["default"].string
136
148
  };
137
149
 
138
150
  exports["default"] = ListBox;
@@ -30,7 +30,7 @@ export interface LoadingProps extends ReactAttr<HTMLDivElement> {
30
30
  /**
31
31
  * Specify whether you want the loader to be applied with an overlay
32
32
  */
33
- withOverlay: boolean;
33
+ withOverlay?: boolean;
34
34
  }
35
35
  declare function Loading({ active, className: customClassName, withOverlay, small, description, ...rest }: LoadingProps): import("react/jsx-runtime").JSX.Element;
36
36
  declare namespace Loading {
@@ -42,6 +42,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
42
42
  onOpen,
43
43
  open,
44
44
  size = 'sm',
45
+ // TODO: #16004
46
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
45
47
  target = document.body,
46
48
  x = 0,
47
49
  y = 0,
@@ -25,9 +25,10 @@ var debounce = require('lodash.debounce');
25
25
  var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
26
26
  var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
27
27
  var usePrefix = require('../../internal/usePrefix.js');
28
- var index = require('../IconButton/index.js');
28
+ var index$1 = require('../IconButton/index.js');
29
29
  var noopFn = require('../../internal/noopFn.js');
30
30
  require('../Text/index.js');
31
+ var index = require('../FeatureFlags/index.js');
31
32
  var Text = require('../Text/Text.js');
32
33
  var match = require('../../internal/keyboard/match.js');
33
34
  var keys = require('../../internal/keyboard/keys.js');
@@ -93,6 +94,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
93
94
  [`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
94
95
  });
95
96
  const loadingActive = loadingStatus !== 'inactive';
97
+ const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
96
98
  function isCloseButton(element) {
97
99
  return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
98
100
  }
@@ -105,6 +107,13 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
105
107
  if (match.match(evt, keys.Enter) && shouldSubmitOnEnter && !isCloseButton(evt.target)) {
106
108
  onRequestSubmit(evt);
107
109
  }
110
+ if (focusTrapWithoutSentinels && match.match(evt, keys.Tab) && innerModal.current) {
111
+ wrapFocus.wrapFocusWithoutSentinels({
112
+ containerNode: innerModal.current,
113
+ currentActiveNode: evt.target,
114
+ event: evt
115
+ });
116
+ }
108
117
  }
109
118
  }
110
119
  function handleMousedown(evt) {
@@ -237,7 +246,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
237
246
  }
238
247
  const modalButton = /*#__PURE__*/React__default["default"].createElement("div", {
239
248
  className: `${prefix}--modal-close-button`
240
- }, /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
249
+ }, /*#__PURE__*/React__default["default"].createElement(index$1.IconButton, {
241
250
  className: modalCloseButtonClass,
242
251
  label: closeButtonLabel,
243
252
  onClick: onRequestClose,
@@ -306,16 +315,16 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
306
315
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
307
316
  onKeyDown: handleKeyDown,
308
317
  onMouseDown: handleMousedown,
309
- onBlur: handleBlur,
318
+ onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
310
319
  className: modalClasses,
311
320
  role: "presentation",
312
321
  ref: ref
313
- }), /*#__PURE__*/React__default["default"].createElement("span", {
322
+ }), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
314
323
  ref: startTrap,
315
324
  tabIndex: 0,
316
325
  role: "link",
317
326
  className: `${prefix}--visually-hidden`
318
- }, "Focus sentinel"), modalBody, /*#__PURE__*/React__default["default"].createElement("span", {
327
+ }, "Focus sentinel"), modalBody, !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
319
328
  ref: endTrap,
320
329
  tabIndex: 0,
321
330
  role: "link",
@@ -59,7 +59,7 @@ export default class ModalWrapper extends React.Component<ModalWrapperProps, Mod
59
59
  shouldCloseAfterSubmit: PropTypes.Requireable<boolean>;
60
60
  status: PropTypes.Requireable<string>;
61
61
  triggerButtonIconDescription: PropTypes.Requireable<string>;
62
- triggerButtonKind: PropTypes.Requireable<"primary" | "secondary" | "ghost" | "tertiary" | "danger" | "danger--primary" | "danger--ghost" | "danger--tertiary">;
62
+ triggerButtonKind: PropTypes.Requireable<"primary" | "secondary" | "danger" | "ghost" | "danger--primary" | "danger--ghost" | "danger--tertiary" | "tertiary">;
63
63
  withHeader: PropTypes.Requireable<boolean>;
64
64
  };
65
65
  triggerButton: React.RefObject<HTMLButtonElement>;
@@ -24,6 +24,7 @@ var usePrefix = require('../../internal/usePrefix.js');
24
24
  var useId = require('../../internal/useId.js');
25
25
  var noopFn = require('../../internal/noopFn.js');
26
26
  var wrapFocus = require('../../internal/wrapFocus.js');
27
+ var index = require('../FeatureFlags/index.js');
27
28
  var Text = require('../Text/Text.js');
28
29
  var match = require('../../internal/keyboard/match.js');
29
30
  var keys = require('../../internal/keyboard/keys.js');
@@ -521,6 +522,7 @@ function ActionableNotification(_ref6) {
521
522
  const startTrap = React.useRef(null);
522
523
  const endTrap = React.useRef(null);
523
524
  const ref = React.useRef(null);
525
+ const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
524
526
  useIsomorphicEffect["default"](() => {
525
527
  if (hasFocus) {
526
528
  const button = document.querySelector('button.cds--actionable-notification__action-button');
@@ -551,6 +553,15 @@ function ActionableNotification(_ref6) {
551
553
  });
552
554
  }
553
555
  }
556
+ function handleKeyDown(event) {
557
+ if (isOpen && match.match(event, keys.Tab) && ref.current) {
558
+ wrapFocus.wrapFocusWithoutSentinels({
559
+ containerNode: ref.current,
560
+ currentActiveNode: event.target,
561
+ event
562
+ });
563
+ }
564
+ }
554
565
  const handleClose = evt => {
555
566
  if (!onClose || onClose(evt) !== false) {
556
567
  setIsOpen(false);
@@ -569,8 +580,9 @@ function ActionableNotification(_ref6) {
569
580
  role: role,
570
581
  className: containerClassName,
571
582
  "aria-labelledby": title ? id : subtitleId,
572
- onBlur: handleBlur
573
- }), /*#__PURE__*/React__default["default"].createElement("span", {
583
+ onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
584
+ onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : () => {}
585
+ }), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
574
586
  ref: startTrap,
575
587
  tabIndex: 0,
576
588
  role: "link",
@@ -603,7 +615,7 @@ function ActionableNotification(_ref6) {
603
615
  "aria-label": deprecatedAriaLabel || ariaLabel,
604
616
  notificationType: "actionable",
605
617
  onClick: handleCloseButtonClick
606
- })), /*#__PURE__*/React__default["default"].createElement("span", {
618
+ })), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
607
619
  ref: endTrap,
608
620
  tabIndex: 0,
609
621
  role: "link",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ export interface PaginationSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * Specify an optional className to add.
12
+ */
13
+ className?: string;
14
+ }
15
+ declare function PaginationSkeleton({ className, ...rest }: PaginationSkeletonProps): import("react/jsx-runtime").JSX.Element;
16
+ declare namespace PaginationSkeleton {
17
+ var propTypes: {
18
+ /**
19
+ * Specify an optional className to add.
20
+ */
21
+ className: PropTypes.Requireable<string>;
22
+ };
23
+ }
24
+ export default PaginationSkeleton;
25
+ export { PaginationSkeleton };
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ type ExcludedAttributes = 'id' | 'onChange';
9
+ export interface PaginationPageSize {
10
+ text: string;
11
+ value: number;
12
+ }
13
+ export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLDivElement>, ExcludedAttributes> {
14
+ /**
15
+ * The description for the backward icon.
16
+ */
17
+ backwardText?: string;
18
+ /**
19
+ * The CSS class names.
20
+ */
21
+ className?: string;
22
+ /**
23
+ * `true` if the backward/forward buttons, as well as the page select elements, should be disabled.
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * The description for the forward icon.
28
+ */
29
+ forwardText?: string;
30
+ /**
31
+ * The unique ID of this component instance.
32
+ */
33
+ id?: string | number;
34
+ /**
35
+ * `true` if the current page should be the last page.
36
+ */
37
+ isLastPage?: boolean;
38
+ /**
39
+ * The function returning a translatable text showing where the current page is,
40
+ * in a manner of the range of items.
41
+ */
42
+ itemRangeText?: (min: number, max: number, total: number) => string;
43
+ /**
44
+ * A variant of `itemRangeText`, used if the total number of items is unknown.
45
+ */
46
+ itemText?: (min: number, max: number) => string;
47
+ /**
48
+ * The translatable text indicating the number of items per page.
49
+ */
50
+ itemsPerPageText?: string;
51
+ /**
52
+ * The callback function called when the current page changes.
53
+ */
54
+ onChange?: (data: {
55
+ page: number;
56
+ pageSize: number;
57
+ ref?: React.RefObject<any>;
58
+ }) => void;
59
+ /**
60
+ * The current page.
61
+ */
62
+ page?: number;
63
+ /**
64
+ * `true` if the select box to change the page should be disabled.
65
+ */
66
+ pageInputDisabled?: boolean;
67
+ pageNumberText?: string;
68
+ /**
69
+ * A function returning PII showing where the current page is.
70
+ */
71
+ pageRangeText?: (current: number, total: number) => string;
72
+ /**
73
+ * The number dictating how many items a page contains.
74
+ */
75
+ pageSize?: number;
76
+ /**
77
+ * `true` if the select box to change the items per page should be disabled.
78
+ */
79
+ pageSizeInputDisabled?: boolean;
80
+ /**
81
+ * The choices for `pageSize`.
82
+ */
83
+ pageSizes: number[] | PaginationPageSize[];
84
+ /**
85
+ * The translatable text showing the current page.
86
+ */
87
+ pageText?: (page: number, pagesUnknown?: boolean) => string;
88
+ /**
89
+ * `true` if the total number of items is unknown.
90
+ */
91
+ pagesUnknown?: boolean;
92
+ /**
93
+ * Specify the size of the Pagination.
94
+ */
95
+ size?: 'sm' | 'md' | 'lg';
96
+ /**
97
+ * The total number of items.
98
+ */
99
+ totalItems?: number;
100
+ }
101
+ declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLDivElement>>;
102
+ export default Pagination;
@@ -37,7 +37,7 @@ function mapPageSizesToObject(sizes) {
37
37
  }
38
38
  function renderSelectItems(total) {
39
39
  let counter = 1;
40
- let itemArr = [];
40
+ const itemArr = [];
41
41
  while (counter <= total) {
42
42
  itemArr.push( /*#__PURE__*/React__default["default"].createElement(SelectItem["default"], {
43
43
  key: counter,
@@ -62,7 +62,7 @@ function getPageSize(pageSizes, pageSize) {
62
62
  const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pagination(_ref, ref) {
63
63
  let {
64
64
  backwardText = 'Previous page',
65
- className: customClassName,
65
+ className: customClassName = '',
66
66
  disabled = false,
67
67
  forwardText = 'Next page',
68
68
  id,
@@ -81,11 +81,11 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
81
81
  pageText = (page, pagesUnknown) => `page ${pagesUnknown ? '' : page}`,
82
82
  pagesUnknown = false,
83
83
  size = 'md',
84
- totalItems,
84
+ totalItems = 1,
85
85
  ...rest
86
86
  } = _ref;
87
87
  const prefix = usePrefix.usePrefix();
88
- const inputId = useId.useFallbackId(id);
88
+ const inputId = useId.useFallbackId(id?.toString());
89
89
  const backBtnRef = React.useRef(null);
90
90
  const forwardBtnRef = React.useRef(null);
91
91
  const [pageSizes, setPageSizes] = React.useState(() => {
@@ -173,14 +173,14 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
173
173
  // the icon button becomes disabled and the focus shifts to `main`
174
174
  // this presents an a11y problem for keyboard & screen reader users
175
175
  // instead, we want the focus to shift to the other pagination btn
176
- if (nextPage === totalPages) {
176
+ if (nextPage === totalPages && backBtnRef?.current) {
177
177
  backBtnRef.current.focus();
178
178
  }
179
179
  if (onChange) {
180
180
  onChange({
181
181
  page: nextPage,
182
182
  pageSize,
183
- backBtnRef
183
+ ref: backBtnRef
184
184
  });
185
185
  }
186
186
  }
@@ -192,14 +192,14 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
192
192
  // the icon button becomes disabled and the focus shifts to `main`
193
193
  // this presents an a11y problem for keyboard & screen reader users
194
194
  // instead, we want the focus to shift to the other pagination btn
195
- if (nextPage === 1) {
195
+ if (nextPage === 1 && forwardBtnRef?.current) {
196
196
  forwardBtnRef.current.focus();
197
197
  }
198
198
  if (onChange) {
199
199
  onChange({
200
200
  page: nextPage,
201
201
  pageSize,
202
- forwardBtnRef
202
+ ref: forwardBtnRef
203
203
  });
204
204
  }
205
205
  }
@@ -330,10 +330,10 @@ Pagination.propTypes = {
330
330
  /**
331
331
  * The choices for `pageSize`.
332
332
  */
333
- pageSizes: PropTypes__default["default"].oneOfType([PropTypes__default["default"].arrayOf(PropTypes__default["default"].number), PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
334
- text: PropTypes__default["default"].text,
335
- value: PropTypes__default["default"].number
336
- }))]).isRequired,
333
+ pageSizes: PropTypes__default["default"].oneOfType([PropTypes__default["default"].arrayOf(PropTypes__default["default"].number.isRequired), PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
334
+ text: PropTypes__default["default"].string.isRequired,
335
+ value: PropTypes__default["default"].number.isRequired
336
+ }).isRequired)]).isRequired,
337
337
  /**
338
338
  * The translatable text showing the current page.
339
339
  */
@@ -351,6 +351,5 @@ Pagination.propTypes = {
351
351
  */
352
352
  totalItems: PropTypes__default["default"].number
353
353
  };
354
- var Pagination$1 = Pagination;
355
354
 
356
- exports["default"] = Pagination$1;
355
+ exports["default"] = Pagination;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import Pagination from './Pagination';
8
+ export * from './Pagination.Skeleton';
9
+ export default Pagination;
10
+ export { Pagination };
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
8
  import { type PolymorphicProps } from '../../types/common';
9
- export type PopoverAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
9
+ export type PopoverAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
10
10
  interface PopoverBaseProps {
11
11
  /**
12
12
  * Specify how the popover should align with the trigger element