@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.3

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 (239) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/core/Alert/Alert.d.ts +47 -28
  3. package/cjs/core/Alert/Alert.js +73 -21
  4. package/cjs/core/Avatar/Avatar.js +1 -1
  5. package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
  6. package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
  8. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  9. package/cjs/core/Carousel/Carousel.d.ts +2 -2
  10. package/cjs/core/Carousel/Carousel.js +3 -5
  11. package/cjs/core/Carousel/CarouselDotsList.js +8 -10
  12. package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
  13. package/cjs/core/Carousel/CarouselNavigation.js +3 -5
  14. package/cjs/core/Carousel/CarouselSlider.js +10 -15
  15. package/cjs/core/ColorPicker/ColorBuilder.js +7 -10
  16. package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
  17. package/cjs/core/ColorPicker/ColorPalette.js +4 -6
  18. package/cjs/core/ColorPicker/ColorPicker.js +3 -3
  19. package/cjs/core/ComboBox/ComboBox.js +25 -32
  20. package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
  21. package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
  22. package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
  23. package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
  24. package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
  25. package/cjs/core/ComboBox/helpers.js +4 -5
  26. package/cjs/core/DatePicker/DatePicker.js +32 -32
  27. package/cjs/core/Dialog/Dialog.js +11 -4
  28. package/cjs/core/Dialog/DialogBackdrop.js +1 -1
  29. package/cjs/core/Dialog/DialogContext.d.ts +11 -0
  30. package/cjs/core/Dialog/DialogMain.js +16 -22
  31. package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
  32. package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
  33. package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
  34. package/cjs/core/FileUpload/FileUpload.d.ts +3 -4
  35. package/cjs/core/FileUpload/FileUpload.js +5 -8
  36. package/cjs/core/FileUpload/FileUploadCard.js +9 -10
  37. package/cjs/core/FileUpload/FileUploadTemplate.d.ts +1 -0
  38. package/cjs/core/FileUpload/FileUploadTemplate.js +1 -0
  39. package/cjs/core/InformationPanel/InformationPanel.js +1 -4
  40. package/cjs/core/LabeledInput/LabeledInput.js +1 -1
  41. package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
  42. package/cjs/core/Menu/Menu.js +3 -4
  43. package/cjs/core/Menu/MenuItem.js +8 -11
  44. package/cjs/core/Modal/Modal.d.ts +8 -9
  45. package/cjs/core/Modal/Modal.js +7 -17
  46. package/cjs/core/SearchBox/SearchBox.js +12 -12
  47. package/cjs/core/Select/Select.js +12 -17
  48. package/cjs/core/SideNavigation/SideNavigation.js +2 -2
  49. package/cjs/core/Slider/Slider.js +16 -19
  50. package/cjs/core/Slider/Thumb.js +1 -1
  51. package/cjs/core/StatusMessage/StatusMessage.js +1 -1
  52. package/cjs/core/Stepper/Stepper.js +1 -1
  53. package/cjs/core/Stepper/StepperStep.js +1 -1
  54. package/cjs/core/Table/Table.js +15 -15
  55. package/cjs/core/Table/TablePaginator.js +2 -3
  56. package/cjs/core/Table/TableRowMemoized.js +38 -45
  57. package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
  58. package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
  59. package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
  60. package/cjs/core/Table/cells/DefaultCell.js +1 -1
  61. package/cjs/core/Table/cells/EditableCell.js +6 -12
  62. package/cjs/core/Table/columns/actionColumn.js +3 -6
  63. package/cjs/core/Table/columns/expanderColumn.js +3 -3
  64. package/cjs/core/Table/columns/selectionColumn.js +4 -4
  65. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  66. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  67. package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  68. package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
  69. package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
  70. package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
  71. package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
  72. package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
  73. package/cjs/core/Tabs/Tabs.js +13 -16
  74. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  75. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  76. package/cjs/core/ThemeProvider/ThemeProvider.js +14 -13
  77. package/cjs/core/Tile/Tile.js +2 -3
  78. package/cjs/core/TimePicker/TimePicker.js +13 -13
  79. package/cjs/core/Toast/Toast.d.ts +5 -10
  80. package/cjs/core/Toast/Toast.js +17 -16
  81. package/cjs/core/Toast/Toaster.d.ts +24 -26
  82. package/cjs/core/Toast/Toaster.js +91 -121
  83. package/cjs/core/Toast/index.d.ts +1 -4
  84. package/cjs/core/Toast/index.js +3 -6
  85. package/cjs/core/TransferList/TransferList.js +3 -4
  86. package/cjs/core/Tree/Tree.js +9 -13
  87. package/cjs/core/Tree/TreeNode.js +9 -10
  88. package/cjs/core/index.d.ts +1 -2
  89. package/cjs/core/index.js +2 -5
  90. package/cjs/core/utils/color/ColorValue.js +9 -15
  91. package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  92. package/cjs/core/utils/components/FocusTrap.js +4 -4
  93. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
  94. package/cjs/core/utils/components/Popover.d.ts +1 -1
  95. package/cjs/core/utils/components/Popover.js +5 -8
  96. package/cjs/core/utils/components/Resizer.js +7 -6
  97. package/cjs/core/utils/components/VirtualScroll.js +14 -21
  98. package/cjs/core/utils/functions/dom.d.ts +0 -8
  99. package/cjs/core/utils/functions/dom.js +3 -26
  100. package/cjs/core/utils/functions/polymorphic.d.ts +1 -1
  101. package/cjs/core/utils/functions/polymorphic.js +1 -1
  102. package/cjs/core/utils/functions/supports.js +1 -1
  103. package/cjs/core/utils/hooks/index.d.ts +0 -1
  104. package/cjs/core/utils/hooks/index.js +0 -1
  105. package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
  106. package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
  107. package/cjs/core/utils/hooks/useEventListener.js +1 -1
  108. package/cjs/core/utils/hooks/useGlobals.d.ts +9 -2
  109. package/cjs/core/utils/hooks/useGlobals.js +6 -4
  110. package/cjs/core/utils/hooks/useId.js +1 -2
  111. package/cjs/core/utils/hooks/useIntersection.js +2 -3
  112. package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
  113. package/cjs/core/utils/hooks/useOverflow.js +1 -2
  114. package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
  115. package/cjs/styles.js +1 -4
  116. package/esm/core/Alert/Alert.d.ts +47 -28
  117. package/esm/core/Alert/Alert.js +74 -22
  118. package/esm/core/Avatar/Avatar.js +1 -1
  119. package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
  120. package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
  121. package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
  122. package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  123. package/esm/core/Carousel/Carousel.d.ts +2 -2
  124. package/esm/core/Carousel/Carousel.js +3 -5
  125. package/esm/core/Carousel/CarouselDotsList.js +8 -10
  126. package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
  127. package/esm/core/Carousel/CarouselNavigation.js +3 -5
  128. package/esm/core/Carousel/CarouselSlider.js +10 -15
  129. package/esm/core/ColorPicker/ColorBuilder.js +7 -10
  130. package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
  131. package/esm/core/ColorPicker/ColorPalette.js +4 -6
  132. package/esm/core/ColorPicker/ColorPicker.js +3 -3
  133. package/esm/core/ComboBox/ComboBox.js +25 -32
  134. package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
  135. package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
  136. package/esm/core/ComboBox/ComboBoxInput.js +21 -20
  137. package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
  138. package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
  139. package/esm/core/ComboBox/helpers.js +4 -5
  140. package/esm/core/DatePicker/DatePicker.js +32 -32
  141. package/esm/core/Dialog/Dialog.js +12 -5
  142. package/esm/core/Dialog/DialogBackdrop.js +1 -1
  143. package/esm/core/Dialog/DialogContext.d.ts +11 -0
  144. package/esm/core/Dialog/DialogMain.js +16 -22
  145. package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
  146. package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
  147. package/esm/core/FileUpload/FileEmptyCard.js +1 -1
  148. package/esm/core/FileUpload/FileUpload.d.ts +3 -4
  149. package/esm/core/FileUpload/FileUpload.js +5 -8
  150. package/esm/core/FileUpload/FileUploadCard.js +9 -10
  151. package/esm/core/FileUpload/FileUploadTemplate.d.ts +1 -0
  152. package/esm/core/FileUpload/FileUploadTemplate.js +1 -0
  153. package/esm/core/InformationPanel/InformationPanel.js +1 -4
  154. package/esm/core/LabeledInput/LabeledInput.js +1 -1
  155. package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
  156. package/esm/core/Menu/Menu.js +3 -4
  157. package/esm/core/Menu/MenuItem.js +8 -11
  158. package/esm/core/Modal/Modal.d.ts +8 -9
  159. package/esm/core/Modal/Modal.js +3 -10
  160. package/esm/core/SearchBox/SearchBox.js +12 -12
  161. package/esm/core/Select/Select.js +12 -17
  162. package/esm/core/SideNavigation/SideNavigation.js +2 -2
  163. package/esm/core/Slider/Slider.js +16 -19
  164. package/esm/core/Slider/Thumb.js +1 -1
  165. package/esm/core/StatusMessage/StatusMessage.js +1 -1
  166. package/esm/core/Stepper/Stepper.js +1 -1
  167. package/esm/core/Stepper/StepperStep.js +1 -1
  168. package/esm/core/Table/Table.js +15 -15
  169. package/esm/core/Table/TablePaginator.js +2 -3
  170. package/esm/core/Table/TableRowMemoized.js +38 -45
  171. package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
  172. package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
  173. package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
  174. package/esm/core/Table/cells/DefaultCell.js +1 -1
  175. package/esm/core/Table/cells/EditableCell.js +6 -12
  176. package/esm/core/Table/columns/actionColumn.js +3 -6
  177. package/esm/core/Table/columns/expanderColumn.js +3 -3
  178. package/esm/core/Table/columns/selectionColumn.js +4 -4
  179. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  180. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  181. package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  182. package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
  183. package/esm/core/Table/hooks/useResizeColumns.js +16 -22
  184. package/esm/core/Table/hooks/useScrollToRow.js +1 -2
  185. package/esm/core/Table/hooks/useStickyColumns.js +3 -5
  186. package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
  187. package/esm/core/Tabs/Tabs.js +13 -16
  188. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  189. package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  190. package/esm/core/ThemeProvider/ThemeProvider.js +15 -14
  191. package/esm/core/Tile/Tile.js +2 -3
  192. package/esm/core/TimePicker/TimePicker.js +13 -13
  193. package/esm/core/Toast/Toast.d.ts +5 -10
  194. package/esm/core/Toast/Toast.js +18 -17
  195. package/esm/core/Toast/Toaster.d.ts +24 -26
  196. package/esm/core/Toast/Toaster.js +85 -121
  197. package/esm/core/Toast/index.d.ts +1 -4
  198. package/esm/core/Toast/index.js +1 -3
  199. package/esm/core/TransferList/TransferList.js +3 -4
  200. package/esm/core/Tree/Tree.js +9 -13
  201. package/esm/core/Tree/TreeNode.js +9 -10
  202. package/esm/core/index.d.ts +1 -2
  203. package/esm/core/index.js +1 -1
  204. package/esm/core/utils/color/ColorValue.js +9 -15
  205. package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  206. package/esm/core/utils/components/FocusTrap.js +4 -4
  207. package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
  208. package/esm/core/utils/components/Popover.d.ts +1 -1
  209. package/esm/core/utils/components/Popover.js +5 -8
  210. package/esm/core/utils/components/Resizer.js +7 -6
  211. package/esm/core/utils/components/VirtualScroll.js +14 -21
  212. package/esm/core/utils/functions/dom.d.ts +0 -8
  213. package/esm/core/utils/functions/dom.js +2 -21
  214. package/esm/core/utils/functions/polymorphic.d.ts +1 -1
  215. package/esm/core/utils/functions/polymorphic.js +1 -1
  216. package/esm/core/utils/functions/supports.js +1 -1
  217. package/esm/core/utils/hooks/index.d.ts +0 -1
  218. package/esm/core/utils/hooks/index.js +0 -1
  219. package/esm/core/utils/hooks/useContainerWidth.js +1 -1
  220. package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
  221. package/esm/core/utils/hooks/useEventListener.js +1 -1
  222. package/esm/core/utils/hooks/useGlobals.d.ts +9 -2
  223. package/esm/core/utils/hooks/useGlobals.js +6 -4
  224. package/esm/core/utils/hooks/useId.js +1 -2
  225. package/esm/core/utils/hooks/useIntersection.js +2 -3
  226. package/esm/core/utils/hooks/useMediaQuery.js +6 -8
  227. package/esm/core/utils/hooks/useOverflow.js +1 -2
  228. package/esm/core/utils/hooks/useResizeObserver.js +3 -4
  229. package/esm/styles.js +1 -4
  230. package/package.json +2 -2
  231. package/styles.css +19 -20
  232. package/cjs/core/Toast/ToastWrapper.d.ts +0 -10
  233. package/cjs/core/Toast/ToastWrapper.js +0 -49
  234. package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  235. package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
  236. package/esm/core/Toast/ToastWrapper.d.ts +0 -10
  237. package/esm/core/Toast/ToastWrapper.js +0 -20
  238. package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  239. package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
@@ -46,10 +46,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
46
46
  const { ref: parentMenuItemRef } = React.useContext(MenuItemContext);
47
47
  const subMenuRef = React.useRef(null);
48
48
  const [isSubmenuVisible, setIsSubmenuVisible] = React.useState(false);
49
- const startIcon = startIconProp !== null && startIconProp !== void 0 ? startIconProp : icon;
50
- const endIcon = endIconProp !== null && endIconProp !== void 0 ? endIconProp : badge;
49
+ const startIcon = startIconProp ?? icon;
50
+ const endIcon = endIconProp ?? badge;
51
51
  const onKeyDown = (event) => {
52
- var _a;
53
52
  if (event.altKey) {
54
53
  return;
55
54
  }
@@ -57,7 +56,7 @@ exports.MenuItem = React.forwardRef((props, ref) => {
57
56
  case 'Enter':
58
57
  case ' ':
59
58
  case 'Spacebar': {
60
- !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(value));
59
+ !disabled && onClick?.(value);
61
60
  event.preventDefault();
62
61
  break;
63
62
  }
@@ -70,7 +69,7 @@ exports.MenuItem = React.forwardRef((props, ref) => {
70
69
  break;
71
70
  }
72
71
  case 'ArrowLeft': {
73
- (_a = parentMenuItemRef === null || parentMenuItemRef === void 0 ? void 0 : parentMenuItemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
72
+ parentMenuItemRef?.current?.focus();
74
73
  event.stopPropagation();
75
74
  event.preventDefault();
76
75
  break;
@@ -79,10 +78,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
79
78
  break;
80
79
  }
81
80
  };
82
- const listItem = (React.createElement(ListItem_js_1.ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, onClick: () => !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(value)), ref: refs, role: role, tabIndex: disabled || role === 'presentation' ? undefined : -1, "aria-selected": isSelected, "aria-haspopup": subMenuItems.length > 0, "aria-disabled": disabled, onKeyDown: onKeyDown, onMouseEnter: () => setIsSubmenuVisible(true), onMouseLeave: (e) => {
83
- var _a;
81
+ const listItem = (React.createElement(ListItem_js_1.ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, onClick: () => !disabled && onClick?.(value), ref: refs, role: role, tabIndex: disabled || role === 'presentation' ? undefined : -1, "aria-selected": isSelected, "aria-haspopup": subMenuItems.length > 0, "aria-disabled": disabled, onKeyDown: onKeyDown, onMouseEnter: () => setIsSubmenuVisible(true), onMouseLeave: (e) => {
84
82
  if (!(e.relatedTarget instanceof Node) ||
85
- !((_a = subMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))) {
83
+ !subMenuRef.current?.contains(e.relatedTarget)) {
86
84
  setIsSubmenuVisible(false);
87
85
  }
88
86
  }, ...rest },
@@ -95,10 +93,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
95
93
  endIcon && (React.createElement(ListItem_js_1.ListItem.Icon, { as: 'span', "aria-hidden": true }, endIcon))));
96
94
  return subMenuItems.length === 0 ? (listItem) : (React.createElement(MenuItemContext.Provider, { value: { ref: menuItemRef } },
97
95
  React.createElement(index_js_1.Popover, { placement: 'right-start', visible: isSubmenuVisible, appendTo: 'parent', content: React.createElement("div", { onMouseLeave: () => setIsSubmenuVisible(false), onBlur: (e) => {
98
- var _a, _b;
99
96
  !!(e.relatedTarget instanceof Node) &&
100
- !((_a = subMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) &&
101
- !((_b = subMenuRef.current) === null || _b === void 0 ? void 0 : _b.isEqualNode(e.relatedTarget)) &&
97
+ !subMenuRef.current?.contains(e.relatedTarget) &&
98
+ !subMenuRef.current?.isEqualNode(e.relatedTarget) &&
102
99
  setIsSubmenuVisible(false);
103
100
  } },
104
101
  React.createElement(Menu_js_1.Menu, { ref: subMenuRef }, subMenuItems)) }, listItem)));
@@ -30,16 +30,15 @@ declare type ModalProps = {
30
30
  */
31
31
  onKeyDown?: React.KeyboardEventHandler;
32
32
  /**
33
- * Id of the root where the modal will be rendered in.
34
- * @default 'iui-react-portal-container'
35
- */
36
- modalRootId?: string;
37
- /**
38
- * Document where the modal will be rendered.
39
- * Can be specified to render in a different document (e.g. a popup window).
40
- * @default document
33
+ * If true, the dialog will be portaled into a <div> inside the nearest `ThemeProvider`.
34
+ *
35
+ * Can be set to an object with a `to` property to portal into a specific element.
36
+ *
37
+ * @default true
41
38
  */
42
- ownerDocument?: Document;
39
+ portal?: boolean | {
40
+ to: HTMLElement;
41
+ };
43
42
  /**
44
43
  * Content of the modal.
45
44
  */
@@ -22,9 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.Modal = void 0;
30
27
  /*---------------------------------------------------------------------------------------------
@@ -32,9 +29,7 @@ exports.Modal = void 0;
32
29
  * See LICENSE.md in the project root for license terms and full copyright notice.
33
30
  *--------------------------------------------------------------------------------------------*/
34
31
  const React = __importStar(require("react"));
35
- const react_dom_1 = __importDefault(require("react-dom"));
36
- const index_js_1 = require("../utils/index.js");
37
- const index_js_2 = require("../Dialog/index.js");
32
+ const index_js_1 = require("../Dialog/index.js");
38
33
  /**
39
34
  * Modal component which can wrap any content.
40
35
  * @example
@@ -57,16 +52,11 @@ const index_js_2 = require("../Dialog/index.js");
57
52
  * </Modal>
58
53
  */
59
54
  exports.Modal = React.forwardRef((props, forwardedRef) => {
60
- const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, modalRootId = 'iui-react-portal-container', ownerDocument = (0, index_js_1.getDocument)(), ...rest } = props;
61
- const [container, setContainer] = React.useState();
62
- React.useEffect(() => {
63
- setContainer((0, index_js_1.getContainer)(modalRootId, ownerDocument));
64
- return () => setContainer(undefined);
65
- }, [ownerDocument, modalRootId]);
66
- return !!container ? (react_dom_1.default.createPortal(React.createElement(index_js_2.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef },
67
- React.createElement(index_js_2.Dialog.Backdrop, null),
68
- React.createElement(index_js_2.Dialog.Main, { "aria-modal": true, ...rest },
69
- React.createElement(index_js_2.Dialog.TitleBar, { titleText: title }),
70
- children)), container)) : (React.createElement(React.Fragment, null));
55
+ const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, portal = true, ...rest } = props;
56
+ return (React.createElement(index_js_1.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef, portal: portal },
57
+ React.createElement(index_js_1.Dialog.Backdrop, null),
58
+ React.createElement(index_js_1.Dialog.Main, { "aria-modal": true, ...rest },
59
+ React.createElement(index_js_1.Dialog.TitleBar, { titleText: title }),
60
+ children)));
71
61
  });
72
62
  exports.default = exports.Modal;
@@ -43,16 +43,16 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
43
43
  const inputRef = React.useRef(null);
44
44
  const openButtonRef = React.useRef(null);
45
45
  const [localExpanded, setLocalExpanded] = React.useState(isExpandedProp);
46
- const isExpanded = isExpandedProp !== null && isExpandedProp !== void 0 ? isExpandedProp : localExpanded;
46
+ const isExpanded = isExpandedProp ?? localExpanded;
47
47
  const onCollapse = () => {
48
48
  setLocalExpanded(false);
49
- onCollapseProp === null || onCollapseProp === void 0 ? void 0 : onCollapseProp();
50
- queueMicrotask(() => { var _a; return (_a = openButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
49
+ onCollapseProp?.();
50
+ queueMicrotask(() => openButtonRef.current?.focus({ preventScroll: true }));
51
51
  };
52
52
  const onExpand = () => {
53
53
  setLocalExpanded(true);
54
- onExpandProp === null || onExpandProp === void 0 ? void 0 : onExpandProp();
55
- queueMicrotask(() => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
54
+ onExpandProp?.();
55
+ queueMicrotask(() => inputRef.current?.focus({ preventScroll: true }));
56
56
  };
57
57
  return (React.createElement(SearchBoxContext.Provider, { value: {
58
58
  size,
@@ -66,7 +66,7 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
66
66
  isExpanded,
67
67
  expandable,
68
68
  } },
69
- React.createElement(index_js_1.InputFlexContainer, { ref: ref, className: (0, classnames_1.default)('iui-searchbox', { 'iui-expandable-searchbox': expandable }, className), "data-iui-size": size, isDisabled: isDisabled, "data-iui-expanded": isExpanded, ...rest }, children !== null && children !== void 0 ? children : (React.createElement(React.Fragment, null,
69
+ React.createElement(index_js_1.InputFlexContainer, { ref: ref, className: (0, classnames_1.default)('iui-searchbox', { 'iui-expandable-searchbox': expandable }, className), "data-iui-size": size, isDisabled: isDisabled, "data-iui-expanded": isExpanded, ...rest }, children ?? (React.createElement(React.Fragment, null,
70
70
  React.createElement(SearchBoxCollapsedState, null,
71
71
  React.createElement(SearchBoxExpandButton, null)),
72
72
  React.createElement(SearchBoxExpandedState, null,
@@ -80,7 +80,7 @@ const SearchBoxCollapsedState = ({ children, }) => {
80
80
  if (!expandable || isExpanded) {
81
81
  return null;
82
82
  }
83
- return React.createElement(React.Fragment, null, children !== null && children !== void 0 ? children : React.createElement(SearchBoxExpandButton, null));
83
+ return React.createElement(React.Fragment, null, children ?? React.createElement(SearchBoxExpandButton, null));
84
84
  };
85
85
  SearchBoxCollapsedState.displayName = 'SearchBox.CollapsedState';
86
86
  // ----------------------------------------------------------------------------
@@ -95,7 +95,7 @@ SearchBoxExpandedState.displayName = 'SearchBox.ExpandedState';
95
95
  // ----------------------------------------------------------------------------
96
96
  const SearchBoxIcon = React.forwardRef((props, ref) => {
97
97
  const { className, children, ...rest } = props;
98
- return (React.createElement(index_js_1.Icon, { "aria-hidden": true, className: (0, classnames_1.default)('iui-search-icon', className), ref: ref, ...rest }, children !== null && children !== void 0 ? children : React.createElement(index_js_1.SvgSearch, null)));
98
+ return (React.createElement(index_js_1.Icon, { "aria-hidden": true, className: (0, classnames_1.default)('iui-search-icon', className), ref: ref, ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
99
99
  });
100
100
  SearchBoxIcon.displayName = 'SearchBox.Icon';
101
101
  // ----------------------------------------------------------------------------
@@ -107,28 +107,28 @@ const SearchBoxInput = React.forwardRef((props, ref) => {
107
107
  setInputId(idProp);
108
108
  }
109
109
  }, [idProp, inputId, setInputId]);
110
- return (React.createElement(index_js_1.Box, { as: 'input', id: idProp !== null && idProp !== void 0 ? idProp : inputId, ref: (0, index_js_1.useMergedRefs)(ref, inputRef), role: 'searchbox', type: 'text', className: (0, classnames_1.default)('iui-search-input', className), disabled: isDisabled, ...rest }));
110
+ return (React.createElement(index_js_1.Box, { as: 'input', id: idProp ?? inputId, ref: (0, index_js_1.useMergedRefs)(ref, inputRef), role: 'searchbox', type: 'text', className: (0, classnames_1.default)('iui-search-input', className), disabled: isDisabled, ...rest }));
111
111
  });
112
112
  SearchBoxInput.displayName = 'SearchBox.Input';
113
113
  // ----------------------------------------------------------------------------
114
114
  const SearchBoxButton = React.forwardRef((props, ref) => {
115
115
  const { children, ...rest } = props;
116
116
  const { size: sizeContext, isDisabled } = (0, index_js_1.useSafeContext)(SearchBoxContext);
117
- return (React.createElement(index_js_2.IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children !== null && children !== void 0 ? children : React.createElement(index_js_1.SvgSearch, null)));
117
+ return (React.createElement(index_js_2.IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
118
118
  });
119
119
  SearchBoxButton.displayName = 'SearchBox.Button';
120
120
  // ----------------------------------------------------------------------------
121
121
  const SearchBoxCollapseButton = React.forwardRef((props, ref) => {
122
122
  const { children, onClick: onClickProp, ...rest } = props;
123
123
  const { onCollapse, size: sizeContext, isDisabled, } = (0, index_js_1.useSafeContext)(SearchBoxContext);
124
- return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onCollapse), ...rest }, children !== null && children !== void 0 ? children : React.createElement(index_js_1.SvgCloseSmall, null)));
124
+ return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onCollapse), ...rest }, children ?? React.createElement(index_js_1.SvgCloseSmall, null)));
125
125
  });
126
126
  SearchBoxCollapseButton.displayName = 'SearchBox.CollapseButton';
127
127
  // ----------------------------------------------------------------------------
128
128
  const SearchBoxExpandButton = React.forwardRef((props, ref) => {
129
129
  const { children, className, onClick: onClickProp, ...rest } = props;
130
130
  const { onExpand, size: sizeContext, isDisabled, openButtonRef, } = (0, index_js_1.useSafeContext)(SearchBoxContext);
131
- return (React.createElement(SearchBoxButton, { ref: (0, index_js_1.useMergedRefs)(ref, openButtonRef), className: (0, classnames_1.default)('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onExpand), ...rest }, children !== null && children !== void 0 ? children : React.createElement(index_js_1.SvgSearch, null)));
131
+ return (React.createElement(SearchBoxButton, { ref: (0, index_js_1.useMergedRefs)(ref, openButtonRef), className: (0, classnames_1.default)('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onExpand), ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
132
132
  });
133
133
  SearchBoxExpandButton.displayName = 'SearchBox.ExpandButton';
134
134
  // ----------------------------------------------------------------------------
@@ -94,24 +94,22 @@ const isSingleOnChange = (onChange, multiple) => {
94
94
  * />
95
95
  */
96
96
  const Select = (props) => {
97
- var _a;
98
97
  const uid = (0, index_js_2.useId)();
99
98
  const { options, value, onChange, placeholder, disabled = false, size, setFocus = false, itemRenderer, selectedItemRenderer, className, style, menuClassName, menuStyle, onShow, onHide, popoverProps, multiple = false, triggerProps, ...rest } = props;
100
99
  const [isOpenState, setIsOpen] = React.useState(false);
101
- const isOpen = (_a = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.visible) !== null && _a !== void 0 ? _a : isOpenState;
100
+ const isOpen = popoverProps?.visible ?? isOpenState;
102
101
  const [minWidth, setMinWidth] = React.useState(0);
103
102
  const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
104
103
  const selectRef = React.useRef(null);
105
104
  const toggleButtonRef = React.useRef(null);
106
105
  const onShowHandler = React.useCallback((instance) => {
107
106
  setIsOpen(true);
108
- onShow === null || onShow === void 0 ? void 0 : onShow(instance);
107
+ onShow?.(instance);
109
108
  }, [onShow]);
110
109
  const onHideHandler = React.useCallback((instance) => {
111
- var _a;
112
110
  setIsOpen(false);
113
- (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); // move focus back to select button
114
- onHide === null || onHide === void 0 ? void 0 : onHide(instance);
111
+ selectRef.current?.focus({ preventScroll: true }); // move focus back to select button
112
+ onHide?.(instance);
115
113
  }, [onHide]);
116
114
  React.useEffect(() => {
117
115
  if (selectRef.current && !disabled && setFocus) {
@@ -141,13 +139,12 @@ const Select = (props) => {
141
139
  };
142
140
  const menuItems = React.useMemo(() => {
143
141
  return options.map((option, index) => {
144
- var _a;
145
142
  const isSelected = isMultipleEnabled(value, multiple)
146
- ? (_a = value === null || value === void 0 ? void 0 : value.includes(option.value)) !== null && _a !== void 0 ? _a : false
143
+ ? value?.includes(option.value) ?? false
147
144
  : value === option.value;
148
145
  const menuItem = itemRenderer ? (itemRenderer(option, { close: () => setIsOpen(false), isSelected })) : (React.createElement(index_js_1.MenuItem, null, option.label));
149
146
  const { label, icon, startIcon: startIconProp, ...restOption } = option;
150
- const startIcon = startIconProp !== null && startIconProp !== void 0 ? startIconProp : icon;
147
+ const startIcon = startIconProp ?? icon;
151
148
  return React.cloneElement(menuItem, {
152
149
  key: `${label}-${index}`,
153
150
  isSelected,
@@ -157,11 +154,11 @@ const Select = (props) => {
157
154
  return;
158
155
  }
159
156
  if (isSingleOnChange(onChange, multiple)) {
160
- onChange === null || onChange === void 0 ? void 0 : onChange(option.value);
157
+ onChange?.(option.value);
161
158
  setIsOpen(false);
162
159
  }
163
160
  else {
164
- onChange === null || onChange === void 0 ? void 0 : onChange(option.value, isSelected ? 'removed' : 'added');
161
+ onChange?.(option.value, isSelected ? 'removed' : 'added');
165
162
  }
166
163
  // update live region
167
164
  if (isMultipleEnabled(value, multiple)) {
@@ -178,7 +175,7 @@ const Select = (props) => {
178
175
  },
179
176
  ref: (el) => {
180
177
  if (isSelected && !multiple) {
181
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ block: 'nearest' });
178
+ el?.scrollIntoView({ block: 'nearest' });
182
179
  }
183
180
  },
184
181
  role: 'option',
@@ -204,15 +201,14 @@ const Select = (props) => {
204
201
  maxWidth: `min(${minWidth * 2}px, 90vw)`,
205
202
  ...menuStyle,
206
203
  }, id: `${uid}-menu`, key: `${uid}-menu` }, menuItems), placement: 'bottom-start', aria: { content: null }, onShow: onShowHandler, onHide: onHideHandler, ...popoverProps, visible: isOpen, onClickOutside: (_, { target }) => {
207
- var _a;
208
- if (!((_a = toggleButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
204
+ if (!toggleButtonRef.current?.contains(target)) {
209
205
  setIsOpen(false);
210
206
  }
211
207
  } },
212
208
  React.createElement(index_js_2.Box, { tabIndex: 0, role: 'combobox', ref: selectRef, "data-iui-size": size, onClick: () => !disabled && setIsOpen((o) => !o), onKeyDown: (e) => !disabled && onKeyDown(e), "aria-disabled": disabled, "aria-autocomplete": 'none', "aria-expanded": isOpen, "aria-haspopup": 'listbox', "aria-controls": `${uid}-menu`, ...triggerProps, className: (0, classnames_1.default)('iui-select-button', {
213
209
  'iui-placeholder': (!selectedItems || selectedItems.length === 0) && !!placeholder,
214
210
  'iui-disabled': disabled,
215
- }, triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className) },
211
+ }, triggerProps?.className) },
216
212
  (!selectedItems || selectedItems.length === 0) && (React.createElement(index_js_2.Box, { as: 'span', className: 'iui-content' }, placeholder)),
217
213
  isMultipleEnabled(selectedItems, multiple) ? (React.createElement(MultipleSelectButton, { selectedItems: selectedItems, selectedItemsRenderer: selectedItemRenderer, tagRenderer: tagRenderer })) : (React.createElement(SingleSelectButton, { selectedItem: selectedItems, selectedItemRenderer: selectedItemRenderer })))),
218
214
  React.createElement(index_js_2.Box, { as: 'span', "aria-hidden": true, ref: toggleButtonRef, className: (0, classnames_1.default)('iui-end-icon', {
@@ -225,8 +221,7 @@ const Select = (props) => {
225
221
  };
226
222
  exports.Select = Select;
227
223
  const SingleSelectButton = ({ selectedItem, selectedItemRenderer, }) => {
228
- var _a;
229
- const startIcon = (_a = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.startIcon) !== null && _a !== void 0 ? _a : selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
224
+ const startIcon = selectedItem?.startIcon ?? selectedItem?.icon;
230
225
  return (React.createElement(React.Fragment, null,
231
226
  selectedItem &&
232
227
  selectedItemRenderer &&
@@ -58,7 +58,7 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
58
58
  }, [isExpanded]);
59
59
  const ExpandButton = (React.createElement(index_js_2.IconButton, { className: 'iui-sidenav-button iui-expand', onClick: React.useCallback(() => {
60
60
  _setIsExpanded((expanded) => !expanded);
61
- onExpanderClick === null || onExpanderClick === void 0 ? void 0 : onExpanderClick();
61
+ onExpanderClick?.();
62
62
  }, [onExpanderClick]) },
63
63
  React.createElement(index_js_1.SvgChevronRight, null)));
64
64
  return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-side-navigation-wrapper', className), ref: forwardedRef, ...rest },
@@ -69,7 +69,7 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
69
69
  expanderPlacement === 'top' && ExpandButton,
70
70
  React.createElement(index_js_1.Box, { className: 'iui-sidenav-content' },
71
71
  React.createElement(index_js_1.Box, { className: 'iui-top' }, items.map((sidenavButton, index) => !_isExpanded ? (React.createElement(index_js_3.Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton))),
72
- React.createElement(index_js_1.Box, { className: 'iui-bottom' }, secondaryItems === null || secondaryItems === void 0 ? void 0 : secondaryItems.map((sidenavButton, index) => !_isExpanded ? (React.createElement(index_js_3.Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton)))),
72
+ React.createElement(index_js_1.Box, { className: 'iui-bottom' }, secondaryItems?.map((sidenavButton, index) => !_isExpanded ? (React.createElement(index_js_3.Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton)))),
73
73
  expanderPlacement === 'bottom' && ExpandButton),
74
74
  submenu && (React.createElement(index_js_1.WithCSSTransition, { in: isSubmenuOpen, dimension: 'width', timeout: 200, classNames: 'iui' }, submenu))));
75
75
  });
@@ -71,10 +71,9 @@ const formatNumberValue = (value, step, numDecimals) => {
71
71
  * Focus specified thumb on Slider control
72
72
  */
73
73
  const focusThumb = (sliderContainer, activeIndex) => {
74
- var _a;
75
74
  const doc = sliderContainer.ownerDocument;
76
75
  if (!sliderContainer.contains(doc.activeElement) ||
77
- Number((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-index')) !== activeIndex) {
76
+ Number(doc.activeElement?.getAttribute('data-index')) !== activeIndex) {
78
77
  const thumbToFocus = sliderContainer.querySelector(`[data-index="${activeIndex}"]`);
79
78
  thumbToFocus && thumbToFocus.focus();
80
79
  }
@@ -88,19 +87,18 @@ const focusThumb = (sliderContainer, activeIndex) => {
88
87
  * thumbMode='allow-crossing' />
89
88
  */
90
89
  exports.Slider = React.forwardRef((props, ref) => {
91
- var _a, _b;
92
90
  const { min = 0, max = 100, values, step = 1, setFocus = false, tooltipProps, disabled = false, tickLabels, minLabel, maxLabel, trackDisplayMode = 'auto', thumbMode = 'inhibit-crossing', onChange, onUpdate, thumbProps, className, railContainerProps, orientation = 'horizontal', ...rest } = props;
93
91
  const [currentValues, setCurrentValues] = React.useState(values);
94
92
  React.useEffect(() => {
95
93
  setCurrentValues(values);
96
94
  }, [values]);
97
- const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel !== null && minLabel !== void 0 ? minLabel : min.toString());
95
+ const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel ?? min.toString());
98
96
  React.useEffect(() => {
99
- setMinValueLabel(minLabel !== null && minLabel !== void 0 ? minLabel : min.toString());
97
+ setMinValueLabel(minLabel ?? min.toString());
100
98
  }, [minLabel, min]);
101
- const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString());
99
+ const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel ?? max.toString());
102
100
  React.useEffect(() => {
103
- setMaxValueLabel(maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString());
101
+ setMaxValueLabel(maxLabel ?? max.toString());
104
102
  }, [maxLabel, max]);
105
103
  const [trackDisplay, setTrackDisplay] = React.useState(() => getDefaultTrackDisplay(trackDisplayMode, currentValues));
106
104
  React.useEffect(() => {
@@ -140,11 +138,11 @@ exports.Slider = React.forwardRef((props, ref) => {
140
138
  newValues[activeThumbIndex] = pointerValue;
141
139
  setCurrentValues(newValues);
142
140
  'onChange' === callbackType
143
- ? onChange === null || onChange === void 0 ? void 0 : onChange(newValues)
144
- : onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
141
+ ? onChange?.(newValues)
142
+ : onUpdate?.(newValues);
145
143
  }
146
144
  else if ('onChange' === callbackType) {
147
- onChange === null || onChange === void 0 ? void 0 : onChange(currentValues);
145
+ onChange?.(currentValues);
148
146
  }
149
147
  }
150
148
  }, [
@@ -172,12 +170,12 @@ exports.Slider = React.forwardRef((props, ref) => {
172
170
  return;
173
171
  }
174
172
  if (keyboardReleased) {
175
- onChange === null || onChange === void 0 ? void 0 : onChange(currentValues); // currentValues since key up should not change value but only stop continuous value selection
173
+ onChange?.(currentValues); // currentValues since key up should not change value but only stop continuous value selection
176
174
  }
177
175
  else {
178
176
  const newValues = [...currentValues]; // newValues since key down should change value
179
177
  newValues[index] = value;
180
- onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
178
+ onUpdate?.(newValues);
181
179
  setCurrentValues(newValues);
182
180
  }
183
181
  }, [currentValues, onUpdate, onChange]);
@@ -207,8 +205,8 @@ exports.Slider = React.forwardRef((props, ref) => {
207
205
  const newValues = [...currentValues];
208
206
  newValues[closestValueIndex] = pointerValue;
209
207
  setCurrentValues(newValues);
210
- onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
211
- onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
208
+ onChange?.(newValues);
209
+ onUpdate?.(newValues);
212
210
  focusThumb(containerRef.current, closestValueIndex);
213
211
  event.preventDefault();
214
212
  event.stopPropagation();
@@ -223,8 +221,8 @@ exports.Slider = React.forwardRef((props, ref) => {
223
221
  onUpdate,
224
222
  orientation,
225
223
  ]);
226
- (0, index_js_1.useEventListener)('pointermove', handlePointerMove, (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
227
- (0, index_js_1.useEventListener)('pointerup', handlePointerUp, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
224
+ (0, index_js_1.useEventListener)('pointermove', handlePointerMove, containerRef.current?.ownerDocument);
225
+ (0, index_js_1.useEventListener)('pointerup', handlePointerUp, containerRef.current?.ownerDocument);
228
226
  const tickMarkArea = React.useMemo(() => {
229
227
  if (!tickLabels) {
230
228
  return null;
@@ -252,10 +250,9 @@ exports.Slider = React.forwardRef((props, ref) => {
252
250
  }), onPointerDown: handlePointerDownOnSlider, ...railContainerProps },
253
251
  React.createElement(index_js_1.Box, { className: 'iui-slider-rail' }),
254
252
  currentValues.map((thumbValue, index) => {
255
- var _a;
256
253
  const [minVal, maxVal] = getAllowableThumbRange(index);
257
- const thisThumbProps = thumbProps === null || thumbProps === void 0 ? void 0 : thumbProps(index);
258
- return (React.createElement(Thumb_js_1.Thumb, { key: (_a = thisThumbProps === null || thisThumbProps === void 0 ? void 0 : thisThumbProps.id) !== null && _a !== void 0 ? _a : index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max, orientation: orientation }));
254
+ const thisThumbProps = thumbProps?.(index);
255
+ return (React.createElement(Thumb_js_1.Thumb, { key: thisThumbProps?.id ?? index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max, orientation: orientation }));
259
256
  }),
260
257
  React.createElement(Track_js_1.Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues, orientation: orientation }),
261
258
  tickMarkArea),
@@ -86,7 +86,7 @@ const Thumb = (props) => {
86
86
  return (100.0 * (adjustedValue - sliderMin)) / (sliderMax - sliderMin);
87
87
  }, [adjustedValue, sliderMax, sliderMin]);
88
88
  const { style, className, ...rest } = thumbProps || {};
89
- return (React.createElement(index_js_1.Tooltip, { placement: 'top', trigger: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.visible) == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
89
+ return (React.createElement(index_js_1.Tooltip, { placement: 'top', trigger: tooltipProps?.visible == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
90
90
  React.createElement(index_js_2.Box, { ...rest, "data-index": index, ref: thumbRef, style: {
91
91
  ...style,
92
92
  ...(orientation === 'horizontal'
@@ -37,7 +37,7 @@ const index_js_1 = require("../utils/index.js");
37
37
  * <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
38
38
  */
39
39
  const StatusMessage = ({ startIcon: userStartIcon, children, status, }) => {
40
- const icon = userStartIcon !== null && userStartIcon !== void 0 ? userStartIcon : (status && index_js_1.StatusIconMap[status]());
40
+ const icon = userStartIcon ?? (status && index_js_1.StatusIconMap[status]());
41
41
  return (React.createElement(React.Fragment, null,
42
42
  !!icon ? (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-input-icon', "aria-hidden": true }, icon)) : null,
43
43
  React.createElement(index_js_1.Box, { className: 'iui-message' }, children)));
@@ -36,7 +36,7 @@ const defaultStepperLocalization = {
36
36
  };
37
37
  exports.Stepper = React.forwardRef((props, ref) => {
38
38
  const { currentStep, steps, type = 'default', localization = defaultStepperLocalization, onStepClick, ...rest } = props;
39
- const boundedCurrentStep = Math.min(Math.max(0, currentStep !== null && currentStep !== void 0 ? currentStep : 0), steps.length - 1);
39
+ const boundedCurrentStep = Math.min(Math.max(0, currentStep ?? 0), steps.length - 1);
40
40
  return (React.createElement(index_js_1.Box, { className: 'iui-stepper', ref: ref, ...rest },
41
41
  React.createElement("ol", null, steps.map((s, index) => (React.createElement(StepperStep_js_1.StepperStep, { key: index, index: index, title: type === 'long' ? '' : s.name, currentStepNumber: boundedCurrentStep, totalSteps: steps.length, type: type, onClick: onStepClick, description: s.description })))),
42
42
  type === 'long' && (React.createElement(index_js_1.Box, { className: 'iui-stepper-steps-label' },
@@ -42,7 +42,7 @@ exports.StepperStep = React.forwardRef((props, forwardedRef) => {
42
42
  const isClickable = isPast && !!onClick;
43
43
  const onCompletedClick = () => {
44
44
  if (isClickable) {
45
- onClick === null || onClick === void 0 ? void 0 : onClick(index);
45
+ onClick?.(index);
46
46
  }
47
47
  };
48
48
  const onKeyDown = (e) => {
@@ -54,7 +54,7 @@ let isDev = false;
54
54
  try {
55
55
  isDev = process.env.NODE_ENV !== 'production';
56
56
  }
57
- catch (_a) { }
57
+ catch { }
58
58
  const flattenColumns = (columns) => {
59
59
  const flatColumns = [];
60
60
  columns.forEach((column) => {
@@ -139,11 +139,11 @@ const Table = (props) => {
139
139
  return;
140
140
  }
141
141
  const ownerDoc = ownerDocument.current;
142
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keydown', disableUserSelect);
143
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keyup', enableUserSelect);
142
+ ownerDoc?.addEventListener('keydown', disableUserSelect);
143
+ ownerDoc?.addEventListener('keyup', enableUserSelect);
144
144
  return () => {
145
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keydown', disableUserSelect);
146
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keyup', enableUserSelect);
145
+ ownerDoc?.removeEventListener('keydown', disableUserSelect);
146
+ ownerDoc?.removeEventListener('keyup', enableUserSelect);
147
147
  };
148
148
  }, [
149
149
  isSelectable,
@@ -157,7 +157,7 @@ const Table = (props) => {
157
157
  const tableStateReducer = React.useCallback((newState, action, previousState, instance) => {
158
158
  switch (action.type) {
159
159
  case react_table_1.actions.toggleSortBy:
160
- onSort === null || onSort === void 0 ? void 0 : onSort(newState);
160
+ onSort?.(newState);
161
161
  break;
162
162
  case react_table_1.actions.setFilter:
163
163
  currentFilter.current = (0, index_js_5.onFilterHandler)(newState, action, previousState, currentFilter.current, instance);
@@ -243,13 +243,13 @@ const Table = (props) => {
243
243
  return result;
244
244
  }, {});
245
245
  const areFiltersSet = allColumns.some((column) => column.filterValue != null && column.filterValue !== '') || !!globalFilterValue;
246
- const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter;
246
+ const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter && !!column.Filter;
247
247
  const showSortButton = (column) => data.length !== 0 && column.canSort;
248
248
  const onRowClickHandler = React.useCallback((event, row) => {
249
- const isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
249
+ const isDisabled = isRowDisabled?.(row.original);
250
250
  const ctrlPressed = event.ctrlKey || event.metaKey;
251
251
  if (!isDisabled) {
252
- onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(event, row);
252
+ onRowClick?.(event, row);
253
253
  }
254
254
  if (isSelectable &&
255
255
  !isDisabled &&
@@ -290,7 +290,7 @@ const Table = (props) => {
290
290
  React.useEffect(() => {
291
291
  if (previousFilter.current !== currentFilter.current) {
292
292
  previousFilter.current = currentFilter.current;
293
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(currentFilter.current, state, instance.filteredRows);
293
+ onFilter?.(currentFilter.current, state, instance.filteredRows);
294
294
  }
295
295
  }, [state, instance.filteredRows, onFilter]);
296
296
  const lastPassedColumns = React.useRef([]);
@@ -364,7 +364,7 @@ const Table = (props) => {
364
364
  const getPreparedRow = React.useCallback((index) => {
365
365
  const row = page[index];
366
366
  prepareRow(row);
367
- return (React.createElement(TableRowMemoized_js_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell, bodyRef: bodyRef.current, tableRowRef: enableVirtualization ? undefined : tableRowRef(row), density: density }));
367
+ return (React.createElement(TableRowMemoized_js_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!isRowDisabled?.(row.original), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell, bodyRef: bodyRef.current, tableRowRef: enableVirtualization ? undefined : tableRowRef(row), density: density }));
368
368
  }, [
369
369
  page,
370
370
  prepareRow,
@@ -409,7 +409,7 @@ const Table = (props) => {
409
409
  const isHeaderDirectClick = React.useRef(false);
410
410
  return (React.createElement(React.Fragment, null,
411
411
  React.createElement(index_js_2.Box, { ref: (element) => {
412
- ownerDocument.current = element === null || element === void 0 ? void 0 : element.ownerDocument;
412
+ ownerDocument.current = element?.ownerDocument;
413
413
  if (isResizable) {
414
414
  resizeRef(element);
415
415
  }
@@ -460,7 +460,7 @@ const Table = (props) => {
460
460
  }, onClick: (e) => {
461
461
  // Prevents from triggering sort when resizing and mouse is released in the middle of header
462
462
  if (isHeaderDirectClick.current) {
463
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
463
+ onClick?.(e);
464
464
  isHeaderDirectClick.current = false;
465
465
  }
466
466
  }, tabIndex: showSortButton(column) ? 0 : undefined, onKeyDown: (e) => {
@@ -509,8 +509,8 @@ const Table = (props) => {
509
509
  !isLoading &&
510
510
  (data.length === 0 || rows.length === 0) &&
511
511
  areFiltersSet && (React.createElement(index_js_2.Box, { className: 'iui-table-empty' },
512
- React.createElement("div", null, emptyFilteredTableContent)))), paginatorRenderer === null || paginatorRenderer === void 0 ? void 0 :
513
- paginatorRenderer(paginatorRendererProps))));
512
+ React.createElement("div", null, emptyFilteredTableContent)))),
513
+ paginatorRenderer?.(paginatorRendererProps))));
514
514
  };
515
515
  exports.Table = Table;
516
516
  exports.default = exports.Table;
@@ -69,12 +69,11 @@ const TablePaginator = (props) => {
69
69
  const needFocus = React.useRef(false);
70
70
  const isMounted = React.useRef(false);
71
71
  React.useEffect(() => {
72
- var _a, _b;
73
72
  // Checking `isMounted.current` prevents from focusing on initial load.
74
73
  // Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
75
74
  if (isMounted.current && needFocus.current) {
76
- const buttonToFocus = Array.from((_b = (_a = pageListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.iui-table-paginator-page-button')) !== null && _b !== void 0 ? _b : []).find((el) => { var _a; return ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (focusedIndex + 1).toString(); });
77
- buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
75
+ const buttonToFocus = Array.from(pageListRef.current?.querySelectorAll('.iui-table-paginator-page-button') ?? []).find((el) => el.textContent?.trim() === (focusedIndex + 1).toString());
76
+ buttonToFocus?.focus();
78
77
  needFocus.current = false;
79
78
  }
80
79
  isMounted.current = true;