@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
@@ -20,10 +20,9 @@ export const MenuItem = React.forwardRef((props, ref) => {
20
20
  const { ref: parentMenuItemRef } = React.useContext(MenuItemContext);
21
21
  const subMenuRef = React.useRef(null);
22
22
  const [isSubmenuVisible, setIsSubmenuVisible] = React.useState(false);
23
- const startIcon = startIconProp !== null && startIconProp !== void 0 ? startIconProp : icon;
24
- const endIcon = endIconProp !== null && endIconProp !== void 0 ? endIconProp : badge;
23
+ const startIcon = startIconProp ?? icon;
24
+ const endIcon = endIconProp ?? badge;
25
25
  const onKeyDown = (event) => {
26
- var _a;
27
26
  if (event.altKey) {
28
27
  return;
29
28
  }
@@ -31,7 +30,7 @@ export const MenuItem = React.forwardRef((props, ref) => {
31
30
  case 'Enter':
32
31
  case ' ':
33
32
  case 'Spacebar': {
34
- !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(value));
33
+ !disabled && onClick?.(value);
35
34
  event.preventDefault();
36
35
  break;
37
36
  }
@@ -44,7 +43,7 @@ export const MenuItem = React.forwardRef((props, ref) => {
44
43
  break;
45
44
  }
46
45
  case 'ArrowLeft': {
47
- (_a = parentMenuItemRef === null || parentMenuItemRef === void 0 ? void 0 : parentMenuItemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
46
+ parentMenuItemRef?.current?.focus();
48
47
  event.stopPropagation();
49
48
  event.preventDefault();
50
49
  break;
@@ -53,10 +52,9 @@ export const MenuItem = React.forwardRef((props, ref) => {
53
52
  break;
54
53
  }
55
54
  };
56
- const listItem = (React.createElement(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) => {
57
- var _a;
55
+ const listItem = (React.createElement(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) => {
58
56
  if (!(e.relatedTarget instanceof Node) ||
59
- !((_a = subMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))) {
57
+ !subMenuRef.current?.contains(e.relatedTarget)) {
60
58
  setIsSubmenuVisible(false);
61
59
  }
62
60
  }, ...rest },
@@ -69,10 +67,9 @@ export const MenuItem = React.forwardRef((props, ref) => {
69
67
  endIcon && (React.createElement(ListItem.Icon, { as: 'span', "aria-hidden": true }, endIcon))));
70
68
  return subMenuItems.length === 0 ? (listItem) : (React.createElement(MenuItemContext.Provider, { value: { ref: menuItemRef } },
71
69
  React.createElement(Popover, { placement: 'right-start', visible: isSubmenuVisible, appendTo: 'parent', content: React.createElement("div", { onMouseLeave: () => setIsSubmenuVisible(false), onBlur: (e) => {
72
- var _a, _b;
73
70
  !!(e.relatedTarget instanceof Node) &&
74
- !((_a = subMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) &&
75
- !((_b = subMenuRef.current) === null || _b === void 0 ? void 0 : _b.isEqualNode(e.relatedTarget)) &&
71
+ !subMenuRef.current?.contains(e.relatedTarget) &&
72
+ !subMenuRef.current?.isEqualNode(e.relatedTarget) &&
76
73
  setIsSubmenuVisible(false);
77
74
  } },
78
75
  React.createElement(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
  */
@@ -3,8 +3,6 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
- import ReactDOM from 'react-dom';
7
- import { getContainer, getDocument } from '../utils/index.js';
8
6
  import { Dialog } from '../Dialog/index.js';
9
7
  /**
10
8
  * Modal component which can wrap any content.
@@ -28,16 +26,11 @@ import { Dialog } from '../Dialog/index.js';
28
26
  * </Modal>
29
27
  */
30
28
  export const Modal = React.forwardRef((props, forwardedRef) => {
31
- const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, modalRootId = 'iui-react-portal-container', ownerDocument = getDocument(), ...rest } = props;
32
- const [container, setContainer] = React.useState();
33
- React.useEffect(() => {
34
- setContainer(getContainer(modalRootId, ownerDocument));
35
- return () => setContainer(undefined);
36
- }, [ownerDocument, modalRootId]);
37
- return !!container ? (ReactDOM.createPortal(React.createElement(Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef },
29
+ const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, portal = true, ...rest } = props;
30
+ return (React.createElement(Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef, portal: portal },
38
31
  React.createElement(Dialog.Backdrop, null),
39
32
  React.createElement(Dialog.Main, { "aria-modal": true, ...rest },
40
33
  React.createElement(Dialog.TitleBar, { titleText: title }),
41
- children)), container)) : (React.createElement(React.Fragment, null));
34
+ children)));
42
35
  });
43
36
  export default Modal;
@@ -14,16 +14,16 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
14
14
  const inputRef = React.useRef(null);
15
15
  const openButtonRef = React.useRef(null);
16
16
  const [localExpanded, setLocalExpanded] = React.useState(isExpandedProp);
17
- const isExpanded = isExpandedProp !== null && isExpandedProp !== void 0 ? isExpandedProp : localExpanded;
17
+ const isExpanded = isExpandedProp ?? localExpanded;
18
18
  const onCollapse = () => {
19
19
  setLocalExpanded(false);
20
- onCollapseProp === null || onCollapseProp === void 0 ? void 0 : onCollapseProp();
21
- queueMicrotask(() => { var _a; return (_a = openButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
20
+ onCollapseProp?.();
21
+ queueMicrotask(() => openButtonRef.current?.focus({ preventScroll: true }));
22
22
  };
23
23
  const onExpand = () => {
24
24
  setLocalExpanded(true);
25
- onExpandProp === null || onExpandProp === void 0 ? void 0 : onExpandProp();
26
- queueMicrotask(() => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
25
+ onExpandProp?.();
26
+ queueMicrotask(() => inputRef.current?.focus({ preventScroll: true }));
27
27
  };
28
28
  return (React.createElement(SearchBoxContext.Provider, { value: {
29
29
  size,
@@ -37,7 +37,7 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
37
37
  isExpanded,
38
38
  expandable,
39
39
  } },
40
- React.createElement(InputFlexContainer, { ref: ref, className: cx('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,
40
+ React.createElement(InputFlexContainer, { ref: ref, className: cx('iui-searchbox', { 'iui-expandable-searchbox': expandable }, className), "data-iui-size": size, isDisabled: isDisabled, "data-iui-expanded": isExpanded, ...rest }, children ?? (React.createElement(React.Fragment, null,
41
41
  React.createElement(SearchBoxCollapsedState, null,
42
42
  React.createElement(SearchBoxExpandButton, null)),
43
43
  React.createElement(SearchBoxExpandedState, null,
@@ -51,7 +51,7 @@ const SearchBoxCollapsedState = ({ children, }) => {
51
51
  if (!expandable || isExpanded) {
52
52
  return null;
53
53
  }
54
- return React.createElement(React.Fragment, null, children !== null && children !== void 0 ? children : React.createElement(SearchBoxExpandButton, null));
54
+ return React.createElement(React.Fragment, null, children ?? React.createElement(SearchBoxExpandButton, null));
55
55
  };
56
56
  SearchBoxCollapsedState.displayName = 'SearchBox.CollapsedState';
57
57
  // ----------------------------------------------------------------------------
@@ -66,7 +66,7 @@ SearchBoxExpandedState.displayName = 'SearchBox.ExpandedState';
66
66
  // ----------------------------------------------------------------------------
67
67
  const SearchBoxIcon = React.forwardRef((props, ref) => {
68
68
  const { className, children, ...rest } = props;
69
- return (React.createElement(Icon, { "aria-hidden": true, className: cx('iui-search-icon', className), ref: ref, ...rest }, children !== null && children !== void 0 ? children : React.createElement(SvgSearch, null)));
69
+ return (React.createElement(Icon, { "aria-hidden": true, className: cx('iui-search-icon', className), ref: ref, ...rest }, children ?? React.createElement(SvgSearch, null)));
70
70
  });
71
71
  SearchBoxIcon.displayName = 'SearchBox.Icon';
72
72
  // ----------------------------------------------------------------------------
@@ -78,28 +78,28 @@ const SearchBoxInput = React.forwardRef((props, ref) => {
78
78
  setInputId(idProp);
79
79
  }
80
80
  }, [idProp, inputId, setInputId]);
81
- return (React.createElement(Box, { as: 'input', id: idProp !== null && idProp !== void 0 ? idProp : inputId, ref: useMergedRefs(ref, inputRef), role: 'searchbox', type: 'text', className: cx('iui-search-input', className), disabled: isDisabled, ...rest }));
81
+ return (React.createElement(Box, { as: 'input', id: idProp ?? inputId, ref: useMergedRefs(ref, inputRef), role: 'searchbox', type: 'text', className: cx('iui-search-input', className), disabled: isDisabled, ...rest }));
82
82
  });
83
83
  SearchBoxInput.displayName = 'SearchBox.Input';
84
84
  // ----------------------------------------------------------------------------
85
85
  const SearchBoxButton = React.forwardRef((props, ref) => {
86
86
  const { children, ...rest } = props;
87
87
  const { size: sizeContext, isDisabled } = useSafeContext(SearchBoxContext);
88
- return (React.createElement(IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children !== null && children !== void 0 ? children : React.createElement(SvgSearch, null)));
88
+ return (React.createElement(IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children ?? React.createElement(SvgSearch, null)));
89
89
  });
90
90
  SearchBoxButton.displayName = 'SearchBox.Button';
91
91
  // ----------------------------------------------------------------------------
92
92
  const SearchBoxCollapseButton = React.forwardRef((props, ref) => {
93
93
  const { children, onClick: onClickProp, ...rest } = props;
94
94
  const { onCollapse, size: sizeContext, isDisabled, } = useSafeContext(SearchBoxContext);
95
- return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: mergeEventHandlers(onClickProp, onCollapse), ...rest }, children !== null && children !== void 0 ? children : React.createElement(SvgCloseSmall, null)));
95
+ return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: mergeEventHandlers(onClickProp, onCollapse), ...rest }, children ?? React.createElement(SvgCloseSmall, null)));
96
96
  });
97
97
  SearchBoxCollapseButton.displayName = 'SearchBox.CollapseButton';
98
98
  // ----------------------------------------------------------------------------
99
99
  const SearchBoxExpandButton = React.forwardRef((props, ref) => {
100
100
  const { children, className, onClick: onClickProp, ...rest } = props;
101
101
  const { onExpand, size: sizeContext, isDisabled, openButtonRef, } = useSafeContext(SearchBoxContext);
102
- return (React.createElement(SearchBoxButton, { ref: useMergedRefs(ref, openButtonRef), className: cx('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: mergeEventHandlers(onClickProp, onExpand), ...rest }, children !== null && children !== void 0 ? children : React.createElement(SvgSearch, null)));
102
+ return (React.createElement(SearchBoxButton, { ref: useMergedRefs(ref, openButtonRef), className: cx('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: mergeEventHandlers(onClickProp, onExpand), ...rest }, children ?? React.createElement(SvgSearch, null)));
103
103
  });
104
104
  SearchBoxExpandButton.displayName = 'SearchBox.ExpandButton';
105
105
  // ----------------------------------------------------------------------------
@@ -65,24 +65,22 @@ const isSingleOnChange = (onChange, multiple) => {
65
65
  * />
66
66
  */
67
67
  export const Select = (props) => {
68
- var _a;
69
68
  const uid = useId();
70
69
  const { options, value, onChange, placeholder, disabled = false, size, setFocus = false, itemRenderer, selectedItemRenderer, className, style, menuClassName, menuStyle, onShow, onHide, popoverProps, multiple = false, triggerProps, ...rest } = props;
71
70
  const [isOpenState, setIsOpen] = React.useState(false);
72
- const isOpen = (_a = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.visible) !== null && _a !== void 0 ? _a : isOpenState;
71
+ const isOpen = popoverProps?.visible ?? isOpenState;
73
72
  const [minWidth, setMinWidth] = React.useState(0);
74
73
  const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
75
74
  const selectRef = React.useRef(null);
76
75
  const toggleButtonRef = React.useRef(null);
77
76
  const onShowHandler = React.useCallback((instance) => {
78
77
  setIsOpen(true);
79
- onShow === null || onShow === void 0 ? void 0 : onShow(instance);
78
+ onShow?.(instance);
80
79
  }, [onShow]);
81
80
  const onHideHandler = React.useCallback((instance) => {
82
- var _a;
83
81
  setIsOpen(false);
84
- (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); // move focus back to select button
85
- onHide === null || onHide === void 0 ? void 0 : onHide(instance);
82
+ selectRef.current?.focus({ preventScroll: true }); // move focus back to select button
83
+ onHide?.(instance);
86
84
  }, [onHide]);
87
85
  React.useEffect(() => {
88
86
  if (selectRef.current && !disabled && setFocus) {
@@ -112,13 +110,12 @@ export const Select = (props) => {
112
110
  };
113
111
  const menuItems = React.useMemo(() => {
114
112
  return options.map((option, index) => {
115
- var _a;
116
113
  const isSelected = isMultipleEnabled(value, multiple)
117
- ? (_a = value === null || value === void 0 ? void 0 : value.includes(option.value)) !== null && _a !== void 0 ? _a : false
114
+ ? value?.includes(option.value) ?? false
118
115
  : value === option.value;
119
116
  const menuItem = itemRenderer ? (itemRenderer(option, { close: () => setIsOpen(false), isSelected })) : (React.createElement(MenuItem, null, option.label));
120
117
  const { label, icon, startIcon: startIconProp, ...restOption } = option;
121
- const startIcon = startIconProp !== null && startIconProp !== void 0 ? startIconProp : icon;
118
+ const startIcon = startIconProp ?? icon;
122
119
  return React.cloneElement(menuItem, {
123
120
  key: `${label}-${index}`,
124
121
  isSelected,
@@ -128,11 +125,11 @@ export const Select = (props) => {
128
125
  return;
129
126
  }
130
127
  if (isSingleOnChange(onChange, multiple)) {
131
- onChange === null || onChange === void 0 ? void 0 : onChange(option.value);
128
+ onChange?.(option.value);
132
129
  setIsOpen(false);
133
130
  }
134
131
  else {
135
- onChange === null || onChange === void 0 ? void 0 : onChange(option.value, isSelected ? 'removed' : 'added');
132
+ onChange?.(option.value, isSelected ? 'removed' : 'added');
136
133
  }
137
134
  // update live region
138
135
  if (isMultipleEnabled(value, multiple)) {
@@ -149,7 +146,7 @@ export const Select = (props) => {
149
146
  },
150
147
  ref: (el) => {
151
148
  if (isSelected && !multiple) {
152
- el === null || el === void 0 ? void 0 : el.scrollIntoView({ block: 'nearest' });
149
+ el?.scrollIntoView({ block: 'nearest' });
153
150
  }
154
151
  },
155
152
  role: 'option',
@@ -175,15 +172,14 @@ export const Select = (props) => {
175
172
  maxWidth: `min(${minWidth * 2}px, 90vw)`,
176
173
  ...menuStyle,
177
174
  }, id: `${uid}-menu`, key: `${uid}-menu` }, menuItems), placement: 'bottom-start', aria: { content: null }, onShow: onShowHandler, onHide: onHideHandler, ...popoverProps, visible: isOpen, onClickOutside: (_, { target }) => {
178
- var _a;
179
- if (!((_a = toggleButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
175
+ if (!toggleButtonRef.current?.contains(target)) {
180
176
  setIsOpen(false);
181
177
  }
182
178
  } },
183
179
  React.createElement(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: cx('iui-select-button', {
184
180
  'iui-placeholder': (!selectedItems || selectedItems.length === 0) && !!placeholder,
185
181
  'iui-disabled': disabled,
186
- }, triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className) },
182
+ }, triggerProps?.className) },
187
183
  (!selectedItems || selectedItems.length === 0) && (React.createElement(Box, { as: 'span', className: 'iui-content' }, placeholder)),
188
184
  isMultipleEnabled(selectedItems, multiple) ? (React.createElement(MultipleSelectButton, { selectedItems: selectedItems, selectedItemsRenderer: selectedItemRenderer, tagRenderer: tagRenderer })) : (React.createElement(SingleSelectButton, { selectedItem: selectedItems, selectedItemRenderer: selectedItemRenderer })))),
189
185
  React.createElement(Box, { as: 'span', "aria-hidden": true, ref: toggleButtonRef, className: cx('iui-end-icon', {
@@ -195,8 +191,7 @@ export const Select = (props) => {
195
191
  multiple ? (React.createElement(AutoclearingHiddenLiveRegion, { text: liveRegionSelection })) : null));
196
192
  };
197
193
  const SingleSelectButton = ({ selectedItem, selectedItemRenderer, }) => {
198
- var _a;
199
- 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;
194
+ const startIcon = selectedItem?.startIcon ?? selectedItem?.icon;
200
195
  return (React.createElement(React.Fragment, null,
201
196
  selectedItem &&
202
197
  selectedItemRenderer &&
@@ -29,7 +29,7 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
29
29
  }, [isExpanded]);
30
30
  const ExpandButton = (React.createElement(IconButton, { className: 'iui-sidenav-button iui-expand', onClick: React.useCallback(() => {
31
31
  _setIsExpanded((expanded) => !expanded);
32
- onExpanderClick === null || onExpanderClick === void 0 ? void 0 : onExpanderClick();
32
+ onExpanderClick?.();
33
33
  }, [onExpanderClick]) },
34
34
  React.createElement(SvgChevronRight, null)));
35
35
  return (React.createElement(Box, { className: cx('iui-side-navigation-wrapper', className), ref: forwardedRef, ...rest },
@@ -40,7 +40,7 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
40
40
  expanderPlacement === 'top' && ExpandButton,
41
41
  React.createElement(Box, { className: 'iui-sidenav-content' },
42
42
  React.createElement(Box, { className: 'iui-top' }, items.map((sidenavButton, index) => !_isExpanded ? (React.createElement(Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton))),
43
- React.createElement(Box, { className: 'iui-bottom' }, secondaryItems === null || secondaryItems === void 0 ? void 0 : secondaryItems.map((sidenavButton, index) => !_isExpanded ? (React.createElement(Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton)))),
43
+ React.createElement(Box, { className: 'iui-bottom' }, secondaryItems?.map((sidenavButton, index) => !_isExpanded ? (React.createElement(Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton)))),
44
44
  expanderPlacement === 'bottom' && ExpandButton),
45
45
  submenu && (React.createElement(WithCSSTransition, { in: isSubmenuOpen, dimension: 'width', timeout: 200, classNames: 'iui' }, submenu))));
46
46
  });
@@ -42,10 +42,9 @@ const formatNumberValue = (value, step, numDecimals) => {
42
42
  * Focus specified thumb on Slider control
43
43
  */
44
44
  const focusThumb = (sliderContainer, activeIndex) => {
45
- var _a;
46
45
  const doc = sliderContainer.ownerDocument;
47
46
  if (!sliderContainer.contains(doc.activeElement) ||
48
- Number((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-index')) !== activeIndex) {
47
+ Number(doc.activeElement?.getAttribute('data-index')) !== activeIndex) {
49
48
  const thumbToFocus = sliderContainer.querySelector(`[data-index="${activeIndex}"]`);
50
49
  thumbToFocus && thumbToFocus.focus();
51
50
  }
@@ -59,19 +58,18 @@ const focusThumb = (sliderContainer, activeIndex) => {
59
58
  * thumbMode='allow-crossing' />
60
59
  */
61
60
  export const Slider = React.forwardRef((props, ref) => {
62
- var _a, _b;
63
61
  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;
64
62
  const [currentValues, setCurrentValues] = React.useState(values);
65
63
  React.useEffect(() => {
66
64
  setCurrentValues(values);
67
65
  }, [values]);
68
- const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel !== null && minLabel !== void 0 ? minLabel : min.toString());
66
+ const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel ?? min.toString());
69
67
  React.useEffect(() => {
70
- setMinValueLabel(minLabel !== null && minLabel !== void 0 ? minLabel : min.toString());
68
+ setMinValueLabel(minLabel ?? min.toString());
71
69
  }, [minLabel, min]);
72
- const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString());
70
+ const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel ?? max.toString());
73
71
  React.useEffect(() => {
74
- setMaxValueLabel(maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString());
72
+ setMaxValueLabel(maxLabel ?? max.toString());
75
73
  }, [maxLabel, max]);
76
74
  const [trackDisplay, setTrackDisplay] = React.useState(() => getDefaultTrackDisplay(trackDisplayMode, currentValues));
77
75
  React.useEffect(() => {
@@ -111,11 +109,11 @@ export const Slider = React.forwardRef((props, ref) => {
111
109
  newValues[activeThumbIndex] = pointerValue;
112
110
  setCurrentValues(newValues);
113
111
  'onChange' === callbackType
114
- ? onChange === null || onChange === void 0 ? void 0 : onChange(newValues)
115
- : onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
112
+ ? onChange?.(newValues)
113
+ : onUpdate?.(newValues);
116
114
  }
117
115
  else if ('onChange' === callbackType) {
118
- onChange === null || onChange === void 0 ? void 0 : onChange(currentValues);
116
+ onChange?.(currentValues);
119
117
  }
120
118
  }
121
119
  }, [
@@ -143,12 +141,12 @@ export const Slider = React.forwardRef((props, ref) => {
143
141
  return;
144
142
  }
145
143
  if (keyboardReleased) {
146
- onChange === null || onChange === void 0 ? void 0 : onChange(currentValues); // currentValues since key up should not change value but only stop continuous value selection
144
+ onChange?.(currentValues); // currentValues since key up should not change value but only stop continuous value selection
147
145
  }
148
146
  else {
149
147
  const newValues = [...currentValues]; // newValues since key down should change value
150
148
  newValues[index] = value;
151
- onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
149
+ onUpdate?.(newValues);
152
150
  setCurrentValues(newValues);
153
151
  }
154
152
  }, [currentValues, onUpdate, onChange]);
@@ -178,8 +176,8 @@ export const Slider = React.forwardRef((props, ref) => {
178
176
  const newValues = [...currentValues];
179
177
  newValues[closestValueIndex] = pointerValue;
180
178
  setCurrentValues(newValues);
181
- onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
182
- onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
179
+ onChange?.(newValues);
180
+ onUpdate?.(newValues);
183
181
  focusThumb(containerRef.current, closestValueIndex);
184
182
  event.preventDefault();
185
183
  event.stopPropagation();
@@ -194,8 +192,8 @@ export const Slider = React.forwardRef((props, ref) => {
194
192
  onUpdate,
195
193
  orientation,
196
194
  ]);
197
- useEventListener('pointermove', handlePointerMove, (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
198
- useEventListener('pointerup', handlePointerUp, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
195
+ useEventListener('pointermove', handlePointerMove, containerRef.current?.ownerDocument);
196
+ useEventListener('pointerup', handlePointerUp, containerRef.current?.ownerDocument);
199
197
  const tickMarkArea = React.useMemo(() => {
200
198
  if (!tickLabels) {
201
199
  return null;
@@ -223,10 +221,9 @@ export const Slider = React.forwardRef((props, ref) => {
223
221
  }), onPointerDown: handlePointerDownOnSlider, ...railContainerProps },
224
222
  React.createElement(Box, { className: 'iui-slider-rail' }),
225
223
  currentValues.map((thumbValue, index) => {
226
- var _a;
227
224
  const [minVal, maxVal] = getAllowableThumbRange(index);
228
- const thisThumbProps = thumbProps === null || thumbProps === void 0 ? void 0 : thumbProps(index);
229
- return (React.createElement(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 }));
225
+ const thisThumbProps = thumbProps?.(index);
226
+ return (React.createElement(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 }));
230
227
  }),
231
228
  React.createElement(Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues, orientation: orientation }),
232
229
  tickMarkArea),
@@ -57,7 +57,7 @@ export const Thumb = (props) => {
57
57
  return (100.0 * (adjustedValue - sliderMin)) / (sliderMax - sliderMin);
58
58
  }, [adjustedValue, sliderMax, sliderMin]);
59
59
  const { style, className, ...rest } = thumbProps || {};
60
- return (React.createElement(Tooltip, { placement: 'top', trigger: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.visible) == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
60
+ return (React.createElement(Tooltip, { placement: 'top', trigger: tooltipProps?.visible == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
61
61
  React.createElement(Box, { ...rest, "data-index": index, ref: thumbRef, style: {
62
62
  ...style,
63
63
  ...(orientation === 'horizontal'
@@ -11,7 +11,7 @@ import { Box, StatusIconMap } from '../utils/index.js';
11
11
  * <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
12
12
  */
13
13
  export const StatusMessage = ({ startIcon: userStartIcon, children, status, }) => {
14
- const icon = userStartIcon !== null && userStartIcon !== void 0 ? userStartIcon : (status && StatusIconMap[status]());
14
+ const icon = userStartIcon ?? (status && StatusIconMap[status]());
15
15
  return (React.createElement(React.Fragment, null,
16
16
  !!icon ? (React.createElement(Box, { as: 'span', className: 'iui-input-icon', "aria-hidden": true }, icon)) : null,
17
17
  React.createElement(Box, { className: 'iui-message' }, children)));
@@ -10,7 +10,7 @@ const defaultStepperLocalization = {
10
10
  };
11
11
  export const Stepper = React.forwardRef((props, ref) => {
12
12
  const { currentStep, steps, type = 'default', localization = defaultStepperLocalization, onStepClick, ...rest } = props;
13
- const boundedCurrentStep = Math.min(Math.max(0, currentStep !== null && currentStep !== void 0 ? currentStep : 0), steps.length - 1);
13
+ const boundedCurrentStep = Math.min(Math.max(0, currentStep ?? 0), steps.length - 1);
14
14
  return (React.createElement(Box, { className: 'iui-stepper', ref: ref, ...rest },
15
15
  React.createElement("ol", null, steps.map((s, index) => (React.createElement(StepperStep, { key: index, index: index, title: type === 'long' ? '' : s.name, currentStepNumber: boundedCurrentStep, totalSteps: steps.length, type: type, onClick: onStepClick, description: s.description })))),
16
16
  type === 'long' && (React.createElement(Box, { className: 'iui-stepper-steps-label' },
@@ -13,7 +13,7 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
13
13
  const isClickable = isPast && !!onClick;
14
14
  const onCompletedClick = () => {
15
15
  if (isClickable) {
16
- onClick === null || onClick === void 0 ? void 0 : onClick(index);
16
+ onClick?.(index);
17
17
  }
18
18
  };
19
19
  const onKeyDown = (e) => {
@@ -25,7 +25,7 @@ let isDev = false;
25
25
  try {
26
26
  isDev = process.env.NODE_ENV !== 'production';
27
27
  }
28
- catch (_a) { }
28
+ catch { }
29
29
  const flattenColumns = (columns) => {
30
30
  const flatColumns = [];
31
31
  columns.forEach((column) => {
@@ -110,11 +110,11 @@ export const Table = (props) => {
110
110
  return;
111
111
  }
112
112
  const ownerDoc = ownerDocument.current;
113
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keydown', disableUserSelect);
114
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.addEventListener('keyup', enableUserSelect);
113
+ ownerDoc?.addEventListener('keydown', disableUserSelect);
114
+ ownerDoc?.addEventListener('keyup', enableUserSelect);
115
115
  return () => {
116
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keydown', disableUserSelect);
117
- ownerDoc === null || ownerDoc === void 0 ? void 0 : ownerDoc.removeEventListener('keyup', enableUserSelect);
116
+ ownerDoc?.removeEventListener('keydown', disableUserSelect);
117
+ ownerDoc?.removeEventListener('keyup', enableUserSelect);
118
118
  };
119
119
  }, [
120
120
  isSelectable,
@@ -128,7 +128,7 @@ export const Table = (props) => {
128
128
  const tableStateReducer = React.useCallback((newState, action, previousState, instance) => {
129
129
  switch (action.type) {
130
130
  case TableActions.toggleSortBy:
131
- onSort === null || onSort === void 0 ? void 0 : onSort(newState);
131
+ onSort?.(newState);
132
132
  break;
133
133
  case TableActions.setFilter:
134
134
  currentFilter.current = onFilterHandler(newState, action, previousState, currentFilter.current, instance);
@@ -214,13 +214,13 @@ export const Table = (props) => {
214
214
  return result;
215
215
  }, {});
216
216
  const areFiltersSet = allColumns.some((column) => column.filterValue != null && column.filterValue !== '') || !!globalFilterValue;
217
- const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter;
217
+ const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter && !!column.Filter;
218
218
  const showSortButton = (column) => data.length !== 0 && column.canSort;
219
219
  const onRowClickHandler = React.useCallback((event, row) => {
220
- const isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
220
+ const isDisabled = isRowDisabled?.(row.original);
221
221
  const ctrlPressed = event.ctrlKey || event.metaKey;
222
222
  if (!isDisabled) {
223
- onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(event, row);
223
+ onRowClick?.(event, row);
224
224
  }
225
225
  if (isSelectable &&
226
226
  !isDisabled &&
@@ -261,7 +261,7 @@ export const Table = (props) => {
261
261
  React.useEffect(() => {
262
262
  if (previousFilter.current !== currentFilter.current) {
263
263
  previousFilter.current = currentFilter.current;
264
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(currentFilter.current, state, instance.filteredRows);
264
+ onFilter?.(currentFilter.current, state, instance.filteredRows);
265
265
  }
266
266
  }, [state, instance.filteredRows, onFilter]);
267
267
  const lastPassedColumns = React.useRef([]);
@@ -335,7 +335,7 @@ export const Table = (props) => {
335
335
  const getPreparedRow = React.useCallback((index) => {
336
336
  const row = page[index];
337
337
  prepareRow(row);
338
- return (React.createElement(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 }));
338
+ return (React.createElement(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 }));
339
339
  }, [
340
340
  page,
341
341
  prepareRow,
@@ -380,7 +380,7 @@ export const Table = (props) => {
380
380
  const isHeaderDirectClick = React.useRef(false);
381
381
  return (React.createElement(React.Fragment, null,
382
382
  React.createElement(Box, { ref: (element) => {
383
- ownerDocument.current = element === null || element === void 0 ? void 0 : element.ownerDocument;
383
+ ownerDocument.current = element?.ownerDocument;
384
384
  if (isResizable) {
385
385
  resizeRef(element);
386
386
  }
@@ -431,7 +431,7 @@ export const Table = (props) => {
431
431
  }, onClick: (e) => {
432
432
  // Prevents from triggering sort when resizing and mouse is released in the middle of header
433
433
  if (isHeaderDirectClick.current) {
434
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
434
+ onClick?.(e);
435
435
  isHeaderDirectClick.current = false;
436
436
  }
437
437
  }, tabIndex: showSortButton(column) ? 0 : undefined, onKeyDown: (e) => {
@@ -480,7 +480,7 @@ export const Table = (props) => {
480
480
  !isLoading &&
481
481
  (data.length === 0 || rows.length === 0) &&
482
482
  areFiltersSet && (React.createElement(Box, { className: 'iui-table-empty' },
483
- React.createElement("div", null, emptyFilteredTableContent)))), paginatorRenderer === null || paginatorRenderer === void 0 ? void 0 :
484
- paginatorRenderer(paginatorRendererProps))));
483
+ React.createElement("div", null, emptyFilteredTableContent)))),
484
+ paginatorRenderer?.(paginatorRendererProps))));
485
485
  };
486
486
  export default Table;
@@ -40,12 +40,11 @@ export const TablePaginator = (props) => {
40
40
  const needFocus = React.useRef(false);
41
41
  const isMounted = React.useRef(false);
42
42
  React.useEffect(() => {
43
- var _a, _b;
44
43
  // Checking `isMounted.current` prevents from focusing on initial load.
45
44
  // Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
46
45
  if (isMounted.current && needFocus.current) {
47
- 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(); });
48
- buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
46
+ const buttonToFocus = Array.from(pageListRef.current?.querySelectorAll('.iui-table-paginator-page-button') ?? []).find((el) => el.textContent?.trim() === (focusedIndex + 1).toString());
47
+ buttonToFocus?.focus();
49
48
  needFocus.current = false;
50
49
  }
51
50
  isMounted.current = true;