@itwin/itwinui-react 2.0.0 → 2.0.2

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 (66) hide show
  1. package/CHANGELOG.md +28 -4
  2. package/cjs/core/Avatar/Avatar.d.ts +1 -1
  3. package/cjs/core/AvatarGroup/AvatarGroup.d.ts +1 -1
  4. package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
  5. package/cjs/core/Carousel/CarouselSlider.js +2 -2
  6. package/cjs/core/ColorPicker/ColorBuilder.js +2 -7
  7. package/cjs/core/ColorPicker/ColorPalette.js +1 -1
  8. package/cjs/core/ColorPicker/ColorPicker.js +1 -3
  9. package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
  10. package/cjs/core/ComboBox/ComboBox.js +1 -1
  11. package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
  12. package/cjs/core/ComboBox/ComboBoxMenu.js +1 -1
  13. package/cjs/core/Dialog/DialogMain.js +1 -1
  14. package/cjs/core/LabeledInput/LabeledInput.d.ts +1 -1
  15. package/cjs/core/Modal/ModalButtonBar.d.ts +1 -1
  16. package/cjs/core/Modal/ModalButtonBar.js +10 -1
  17. package/cjs/core/Modal/ModalContent.d.ts +1 -1
  18. package/cjs/core/Modal/ModalContent.js +10 -1
  19. package/cjs/core/Table/Table.js +1 -1
  20. package/cjs/core/Table/TablePaginator.d.ts +6 -0
  21. package/cjs/core/Table/TablePaginator.js +2 -1
  22. package/cjs/core/Table/hooks/useColumnDragAndDrop.js +3 -1
  23. package/cjs/core/Tabs/Tabs.js +3 -3
  24. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +21 -3
  25. package/cjs/core/utils/color/ColorValue.js +4 -2
  26. package/cjs/core/utils/components/Popover.d.ts +1 -1
  27. package/cjs/core/utils/components/Resizer.js +3 -2
  28. package/cjs/core/utils/components/VirtualScroll.js +7 -8
  29. package/cjs/core/utils/functions/styles.d.ts +1 -1
  30. package/cjs/core/utils/functions/styles.js +1 -1
  31. package/cjs/core/utils/hooks/useDragAndDrop.js +1 -1
  32. package/cjs/core/utils/hooks/useOverflow.js +4 -3
  33. package/cjs/core/utils/hooks/useTheme.js +2 -2
  34. package/esm/core/Avatar/Avatar.d.ts +1 -1
  35. package/esm/core/AvatarGroup/AvatarGroup.d.ts +1 -1
  36. package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
  37. package/esm/core/Carousel/CarouselSlider.js +3 -3
  38. package/esm/core/ColorPicker/ColorBuilder.js +2 -7
  39. package/esm/core/ColorPicker/ColorPalette.js +1 -1
  40. package/esm/core/ColorPicker/ColorPicker.js +1 -3
  41. package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
  42. package/esm/core/ComboBox/ComboBox.js +2 -2
  43. package/esm/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
  44. package/esm/core/ComboBox/ComboBoxMenu.js +1 -1
  45. package/esm/core/Dialog/DialogMain.js +2 -2
  46. package/esm/core/LabeledInput/LabeledInput.d.ts +1 -1
  47. package/esm/core/Modal/ModalButtonBar.d.ts +1 -1
  48. package/esm/core/Modal/ModalButtonBar.js +6 -1
  49. package/esm/core/Modal/ModalContent.d.ts +1 -1
  50. package/esm/core/Modal/ModalContent.js +6 -1
  51. package/esm/core/Table/Table.js +2 -2
  52. package/esm/core/Table/TablePaginator.d.ts +6 -0
  53. package/esm/core/Table/TablePaginator.js +2 -1
  54. package/esm/core/Table/hooks/useColumnDragAndDrop.js +3 -1
  55. package/esm/core/Tabs/Tabs.js +4 -4
  56. package/esm/core/ThemeProvider/ThemeProvider.d.ts +21 -3
  57. package/esm/core/utils/color/ColorValue.js +4 -2
  58. package/esm/core/utils/components/Popover.d.ts +1 -1
  59. package/esm/core/utils/components/Resizer.js +3 -2
  60. package/esm/core/utils/components/VirtualScroll.js +7 -8
  61. package/esm/core/utils/functions/styles.d.ts +1 -1
  62. package/esm/core/utils/functions/styles.js +1 -1
  63. package/esm/core/utils/hooks/useDragAndDrop.js +1 -1
  64. package/esm/core/utils/hooks/useOverflow.js +4 -3
  65. package/esm/core/utils/hooks/useTheme.js +2 -2
  66. package/package.json +7 -6
@@ -11,7 +11,7 @@ export declare type StatusTitles = {
11
11
  };
12
12
  export declare type AvatarProps = {
13
13
  /**
14
- * Size of a avatar.
14
+ * Size of an avatar.
15
15
  * @default 'small'
16
16
  */
17
17
  size?: 'small' | 'medium' | 'large' | 'x-large';
@@ -44,7 +44,7 @@ export declare type UserIconGroupProps = AvatarGroupProps;
44
44
  * You can add custom Count Avatar behavior by using `countAvatarProps`.
45
45
  *
46
46
  * @example
47
- * <AvatarGroup avatarSize='medium'>
47
+ * <AvatarGroup iconSize='medium'>
48
48
  * <Avatar
49
49
  * abbreviation="TR"
50
50
  * backgroundColor={getUserColor("Terry Rivers")}
@@ -15,7 +15,7 @@ import '@itwin/itwinui-css/css/avatar.css';
15
15
  * You can add custom Count Avatar behavior by using `countAvatarProps`.
16
16
  *
17
17
  * @example
18
- * <AvatarGroup avatarSize='medium'>
18
+ * <AvatarGroup iconSize='medium'>
19
19
  * <Avatar
20
20
  * abbreviation="TR"
21
21
  * backgroundColor={getUserColor("Terry Rivers")}
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { CarouselContext } from './CarouselContext';
8
- import { getWindow, useMergedRefs } from '../utils';
8
+ import { getWindow, useMergedRefs, useIsomorphicLayoutEffect } from '../utils';
9
9
  /**
10
10
  * `CarouselSlider` is the scrollable list that should consist of `CarouselSlide` components.
11
11
  */
@@ -15,7 +15,7 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
15
15
  if (!context) {
16
16
  throw new Error('CarouselSlider must be used within Carousel');
17
17
  }
18
- const { setSlideCount, idPrefix, scrollToSlide, isManuallyUpdating, } = context;
18
+ const { setSlideCount, idPrefix, scrollToSlide, isManuallyUpdating } = context;
19
19
  const items = React.useMemo(() => {
20
20
  var _a;
21
21
  return (_a = React.Children.map(children, (child, index) => React.isValidElement(child)
@@ -25,7 +25,7 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
25
25
  })
26
26
  : child)) !== null && _a !== void 0 ? _a : [];
27
27
  }, [children, idPrefix]);
28
- React.useLayoutEffect(() => {
28
+ useIsomorphicLayoutEffect(() => {
29
29
  setSlideCount(items.length);
30
30
  }, [items.length, setSlideCount]);
31
31
  const sliderRef = React.useRef(null);
@@ -31,14 +31,9 @@ export const ColorBuilder = React.forwardRef((props, ref) => {
31
31
  // Set values for slider
32
32
  const hueSliderColor = React.useMemo(() => ColorValue.create({ h: hsvColor.h, s: 100, v: 100 }), [hsvColor.h]);
33
33
  const sliderValue = React.useMemo(() => hsvColor.h, [hsvColor]);
34
- const alphaValue = React.useMemo(() => { var _a; return (showAlpha ? (_a = hsvColor.a) !== null && _a !== void 0 ? _a : 1 : 1); }, [
35
- hsvColor.a,
36
- showAlpha,
37
- ]);
34
+ const alphaValue = React.useMemo(() => { var _a; return (showAlpha ? (_a = hsvColor.a) !== null && _a !== void 0 ? _a : 1 : 1); }, [hsvColor.a, showAlpha]);
38
35
  // Set values for color square and color dot
39
- const dotColorString = React.useMemo(() => activeColor.toHexString(), [
40
- activeColor,
41
- ]);
36
+ const dotColorString = React.useMemo(() => activeColor.toHexString(), [activeColor]);
42
37
  const [colorDotActive, setColorDotActive] = React.useState(false);
43
38
  const hueColorString = hueSliderColor.toHexString();
44
39
  const squareTop = 100 - hsvColor.v;
@@ -23,7 +23,7 @@ import '@itwin/itwinui-css/css/color-picker.css';
23
23
  export const ColorPalette = React.forwardRef((props, ref) => {
24
24
  const { colors, label, className, children, ...rest } = props;
25
25
  useTheme();
26
- const { activeColor, setActiveColor, onChangeComplete, } = useColorPickerContext();
26
+ const { activeColor, setActiveColor, onChangeComplete } = useColorPickerContext();
27
27
  const [focusedIndex, setFocusedIndex] = React.useState();
28
28
  // callback ref to set tabindex=0 on first child if none of the swatches are tabbable
29
29
  const setDefaultTabIndex = (el) => {
@@ -37,9 +37,7 @@ export const ColorPicker = (props) => {
37
37
  tabbableElements[0].focus();
38
38
  }
39
39
  }, [setFocus]);
40
- const inColor = React.useMemo(() => getColorValue(selectedColor), [
41
- selectedColor,
42
- ]);
40
+ const inColor = React.useMemo(() => getColorValue(selectedColor), [selectedColor]);
43
41
  const activeColorTbgr = React.useRef(inColor.toTbgr());
44
42
  const [activeColor, setActiveColor] = React.useState(inColor); // Color of colorDot or active ColorSwatch
45
43
  React.useEffect(() => {
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
17
17
  * <ColorSwatch color='#23450b' onClick={onClick}/>
18
18
  * <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
19
19
  */
20
- export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
20
+ export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "children" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
21
21
  export default ColorSwatch;
@@ -6,7 +6,7 @@ import React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { MenuExtraContent } from '../Menu';
8
8
  import { Text } from '../Typography';
9
- import { useTheme, getRandomValue, mergeRefs, useLatestRef, } from '../utils';
9
+ import { useTheme, getRandomValue, mergeRefs, useLatestRef, useIsomorphicLayoutEffect, } from '../utils';
10
10
  import 'tippy.js/animations/shift-away.css';
11
11
  import { ComboBoxActionContext, comboBoxReducer, ComboBoxRefsContext, ComboBoxStateContext, } from './helpers';
12
12
  import { ComboBoxDropdown } from './ComboBoxDropdown';
@@ -73,7 +73,7 @@ export const ComboBox = (props) => {
73
73
  : -1,
74
74
  focusedIndex: -1,
75
75
  });
76
- React.useLayoutEffect(() => {
76
+ useIsomorphicLayoutEffect(() => {
77
77
  var _a, _b;
78
78
  // When the dropdown opens
79
79
  if (isOpen) {
@@ -3,5 +3,5 @@ import { PopoverProps } from '../utils';
3
3
  declare type ComboBoxDropdownProps = PopoverProps & {
4
4
  children: JSX.Element;
5
5
  };
6
- export declare const ComboBoxDropdown: React.ForwardRefExoticComponent<Pick<ComboBoxDropdownProps, "disabled" | "theme" | "className" | "role" | "children" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "plugins" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "zIndex" | "singleton" | "reference"> & React.RefAttributes<Element>>;
6
+ export declare const ComboBoxDropdown: React.ForwardRefExoticComponent<Pick<ComboBoxDropdownProps, "disabled" | "theme" | "children" | "className" | "role" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "plugins" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "zIndex" | "singleton" | "reference"> & React.RefAttributes<Element>>;
7
7
  export {};
@@ -10,7 +10,7 @@ import { useSafeContext, useMergedRefs, useVirtualization, mergeRefs, getWindow,
10
10
  import { ComboBoxStateContext, ComboBoxRefsContext } from './helpers';
11
11
  const VirtualizedComboBoxMenu = React.forwardRef(({ children, className, style, ...rest }, forwardedRef) => {
12
12
  var _a, _b, _c;
13
- const { minWidth, id, filteredOptions, getMenuItem, focusedIndex, } = useSafeContext(ComboBoxStateContext);
13
+ const { minWidth, id, filteredOptions, getMenuItem, focusedIndex } = useSafeContext(ComboBoxStateContext);
14
14
  const { menuRef } = useSafeContext(ComboBoxRefsContext);
15
15
  const virtualItemRenderer = React.useCallback((index) => filteredOptions.length > 0
16
16
  ? getMenuItem(filteredOptions[index], index)
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from 'react';
6
6
  import cx from 'classnames';
7
- import { FocusTrap, getTranslateValues, useLatestRef, Resizer, useMergedRefs, useTheme, } from '../utils';
7
+ import { FocusTrap, getTranslateValues, useLatestRef, Resizer, useMergedRefs, useTheme, useIsomorphicLayoutEffect, } from '../utils';
8
8
  import '@itwin/itwinui-css/css/dialog.css';
9
9
  import { useDialogContext } from './DialogContext';
10
10
  import { CSSTransition } from 'react-transition-group';
@@ -102,7 +102,7 @@ export const DialogMain = React.forwardRef((props, ref) => {
102
102
  }
103
103
  }, [isDraggable, onPointerDown]);
104
104
  // Prevents dialog from moving when window is being resized
105
- React.useLayoutEffect(() => {
105
+ useIsomorphicLayoutEffect(() => {
106
106
  var _a;
107
107
  if (!isDraggable || !isOpen) {
108
108
  return;
@@ -84,7 +84,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
84
84
  * - 'inline' - appears in the same line as input.
85
85
  * @default 'default'
86
86
  */
87
- displayStyle?: "default" | "inline" | undefined;
87
+ displayStyle?: "inline" | "default" | undefined;
88
88
  /**
89
89
  * Set display style of icon.
90
90
  * Supported values:
@@ -9,5 +9,5 @@ export declare type ModalButtonBarProps = {
9
9
  /**
10
10
  * Container for Buttons in modal.
11
11
  */
12
- export declare const ModalButtonBar: React.ForwardRefExoticComponent<Pick<import("../Dialog/DialogButtonBar").DialogButtonBarProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const ModalButtonBar: (props: ModalButtonBarProps) => JSX.Element;
13
13
  export default ModalButtonBar;
@@ -1,6 +1,11 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from 'react';
1
6
  import { DialogButtonBar } from '../Dialog/DialogButtonBar';
2
7
  /**
3
8
  * Container for Buttons in modal.
4
9
  */
5
- export const ModalButtonBar = DialogButtonBar;
10
+ export const ModalButtonBar = (props) => (React.createElement(DialogButtonBar, { ...props }));
6
11
  export default ModalButtonBar;
@@ -9,5 +9,5 @@ export declare type ModalContentProps = {
9
9
  /**
10
10
  * Container for content in `Modal`.
11
11
  */
12
- export declare const ModalContent: React.ForwardRefExoticComponent<Pick<import("../Dialog/DialogContent").DialogContentProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const ModalContent: (props: ModalContentProps) => JSX.Element;
13
13
  export default ModalContent;
@@ -1,6 +1,11 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from 'react';
1
6
  import { DialogContent } from '../Dialog/DialogContent';
2
7
  /**
3
8
  * Container for content in `Modal`.
4
9
  */
5
- export const ModalContent = DialogContent;
10
+ export const ModalContent = (props) => (React.createElement(DialogContent, { ...props }));
6
11
  export default ModalContent;
@@ -6,7 +6,7 @@ import React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { actions as TableActions, useFlexLayout, useFilters, useRowSelect, useSortBy, useTable, useExpanded, usePagination, useColumnOrder, useGlobalFilter, } from 'react-table';
8
8
  import { ProgressRadial } from '../ProgressIndicators';
9
- import { useTheme, useResizeObserver, SvgSortDown, SvgSortUp, } from '../utils';
9
+ import { useTheme, useResizeObserver, SvgSortDown, SvgSortUp, useIsomorphicLayoutEffect, } from '../utils';
10
10
  import '@itwin/itwinui-css/css/table.css';
11
11
  import { getCellStyle, getStickyStyle } from './utils';
12
12
  import { TableRowMemoized } from './TableRowMemoized';
@@ -285,7 +285,7 @@ export const Table = (props) => {
285
285
  }, [dispatch, state.columnResizing.columnWidths, flatHeaders, instance]);
286
286
  const [resizeRef] = useResizeObserver(onTableResize);
287
287
  // Flexbox handles columns resize so we take new column widths before browser repaints.
288
- React.useLayoutEffect(() => {
288
+ useIsomorphicLayoutEffect(() => {
289
289
  if (state.isTableResizing) {
290
290
  const newColumnWidths = {};
291
291
  flatHeaders.forEach((column) => {
@@ -56,6 +56,12 @@ export declare type TablePaginatorProps = {
56
56
  * @default 'Rows per page'
57
57
  */
58
58
  rowsPerPageLabel?: string | null;
59
+ /**
60
+ * Function that returns a label shown in the bottom left to notify how many rows are selected.
61
+ * Only used if multi-selection mode is enabled.
62
+ * @default (totalSelectedRowsCount: number) => `${totalSelectedRowsCount} ${totalSelectedRowsCount === 1 ? 'row' : 'rows'} selected`;
63
+ */
64
+ rowsSelectedLabel?: (totalSelectedRowsCount: number) => string;
59
65
  };
60
66
  } & TablePaginatorRendererProps & Omit<CommonProps, 'title'>;
61
67
  /**
@@ -18,6 +18,7 @@ const defaultLocalization = {
18
18
  nextPage: 'Next page',
19
19
  goToPageLabel: (page) => `Go to page ${page}`,
20
20
  rowsPerPageLabel: 'Rows per page',
21
+ rowsSelectedLabel: (totalSelectedRowsCount) => `${totalSelectedRowsCount} ${totalSelectedRowsCount === 1 ? 'row' : 'rows'} selected`,
21
22
  };
22
23
  /**
23
24
  * Table paginator component. Recommended to pass to the `Table` as `paginatorRenderer` prop.
@@ -120,7 +121,7 @@ export const TablePaginator = (props) => {
120
121
  return null;
121
122
  }
122
123
  return (React.createElement("div", { className: cx('iui-table-paginator', className), ref: paginatorResizeRef, ...rest },
123
- React.createElement("div", { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null, `${totalSelectedRowsCount} ${totalSelectedRowsCount === 1 ? 'row' : 'rows'} selected`))),
124
+ React.createElement("div", { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null, localization.rowsSelectedLabel(totalSelectedRowsCount)))),
124
125
  showPagesList && (React.createElement("div", { className: 'iui-center', ref: overflowRef },
125
126
  React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: () => onPageChange(currentPage - 1), size: buttonSize, "aria-label": localization.previousPage },
126
127
  React.createElement(SvgChevronLeft, null)),
@@ -39,7 +39,9 @@ const defaultGetDragAndDropProps = (isEnabled) => (props, { instance, header, })
39
39
  event.preventDefault();
40
40
  const headerIndex = instance.flatHeaders.indexOf(header);
41
41
  if (instance.state.columnReorderStartIndex !== headerIndex) {
42
- setOnDragColumnStyle(event, instance.state.columnReorderStartIndex > headerIndex ? 'left' : 'right');
42
+ setOnDragColumnStyle(event, instance.state.columnReorderStartIndex > headerIndex
43
+ ? 'left'
44
+ : 'right');
43
45
  }
44
46
  };
45
47
  const onDragLeave = (event) => {
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import cx from 'classnames';
6
6
  import React from 'react';
7
- import { useTheme, useMergedRefs, getBoundedValue, useContainerWidth, } from '../utils';
7
+ import { useTheme, useMergedRefs, getBoundedValue, useContainerWidth, useIsomorphicLayoutEffect, } from '../utils';
8
8
  import '@itwin/itwinui-css/css/tabs.css';
9
9
  import { Tab } from './Tab';
10
10
  /**
@@ -43,14 +43,14 @@ export const Tabs = (props) => {
43
43
  const [currentActiveIndex, setCurrentActiveIndex] = React.useState(() => activeIndex != null
44
44
  ? getBoundedValue(activeIndex, 0, labels.length - 1)
45
45
  : 0);
46
- React.useLayoutEffect(() => {
46
+ useIsomorphicLayoutEffect(() => {
47
47
  if (activeIndex != null && currentActiveIndex !== activeIndex) {
48
48
  setCurrentActiveIndex(getBoundedValue(activeIndex, 0, labels.length - 1));
49
49
  }
50
50
  }, [activeIndex, currentActiveIndex, labels.length]);
51
51
  // CSS custom properties to place the active stripe
52
52
  const [stripeProperties, setStripeProperties] = React.useState({});
53
- React.useLayoutEffect(() => {
53
+ useIsomorphicLayoutEffect(() => {
54
54
  if (type !== 'default' && tablistRef.current != undefined) {
55
55
  const activeTab = tablistRef.current.children[currentActiveIndex];
56
56
  const activeTabRect = activeTab.getBoundingClientRect();
@@ -74,7 +74,7 @@ export const Tabs = (props) => {
74
74
  }
75
75
  }, [focusedIndex]);
76
76
  const [hasSublabel, setHasSublabel] = React.useState(false); // used for setting size
77
- React.useLayoutEffect(() => {
77
+ useIsomorphicLayoutEffect(() => {
78
78
  var _a;
79
79
  setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
80
80
  !!((_a = tablistRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.iui-tab-description')));
@@ -1,8 +1,26 @@
1
1
  import React from 'react';
2
- import type { PolymorphicComponentProps, PolymorphicForwardRefComponent, ThemeOptions, ThemeType, UseThemeProps } from '../utils';
2
+ import type { PolymorphicComponentProps, PolymorphicForwardRefComponent, ThemeOptions, ThemeType } from '../utils';
3
3
  import '@itwin/itwinui-css/css/global.css';
4
4
  import '@itwin/itwinui-variables/index.css';
5
- export declare type ThemeProviderProps<T extends React.ElementType = 'div'> = PolymorphicComponentProps<T, UseThemeProps>;
5
+ export declare type ThemeProviderProps<T extends React.ElementType = 'div'> = PolymorphicComponentProps<T, ThemeProviderOwnProps>;
6
+ declare type ThemeProviderOwnProps = {
7
+ /**
8
+ * Theme to be applied. Can be 'light' or 'dark' or 'os'.
9
+ *
10
+ * Note that 'os' will respect the system preference on client but will fallback to 'light'
11
+ * in SSR environments because it is not possible detect system preference on the server.
12
+ * This can cause a flash of incorrect theme on first render.
13
+ *
14
+ * @default 'light'
15
+ */
16
+ theme?: ThemeType;
17
+ } & ({
18
+ themeOptions?: Pick<ThemeOptions, 'highContrast'>;
19
+ children: Required<React.ReactNode>;
20
+ } | {
21
+ themeOptions?: ThemeOptions;
22
+ children?: undefined;
23
+ });
6
24
  /**
7
25
  * This component provides global styles and applies theme to the entire tree
8
26
  * that it is wrapping around. The `theme` prop is optional and defaults to the
@@ -23,7 +41,7 @@ export declare type ThemeProviderProps<T extends React.ElementType = 'div'> = Po
23
41
  * <App />
24
42
  * </ThemeProvider>
25
43
  */
26
- export declare const ThemeProvider: PolymorphicForwardRefComponent<"div", UseThemeProps>;
44
+ export declare const ThemeProvider: PolymorphicForwardRefComponent<"div", ThemeProviderOwnProps>;
27
45
  export default ThemeProvider;
28
46
  export declare const ThemeContext: React.Context<{
29
47
  theme?: ThemeType | undefined;
@@ -213,7 +213,8 @@ export class ColorValue {
213
213
  switch (name) {
214
214
  case 'rgb':
215
215
  case 'rgba':
216
- color = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
216
+ color =
217
+ /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
217
218
  if (color) {
218
219
  // rgb(255,0,0) rgba(255,0,0,0.5)
219
220
  return [
@@ -226,7 +227,8 @@ export class ColorValue {
226
227
  break;
227
228
  case 'hsl':
228
229
  case 'hsla':
229
- color = /^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
230
+ color =
231
+ /^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
230
232
  if (color) {
231
233
  // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
232
234
  const h = parseFloat(color[1]);
@@ -26,7 +26,7 @@ export declare type PopoverProps = {
26
26
  * with pre-configured props and plugins (e.g. lazy mounting, focus, etc).
27
27
  * @private
28
28
  */
29
- export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "disabled" | "theme" | "className" | "role" | "children" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "plugins" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "zIndex" | "singleton" | "reference"> & React.RefAttributes<unknown>>;
29
+ export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "disabled" | "theme" | "children" | "className" | "role" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "plugins" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "zIndex" | "singleton" | "reference"> & React.RefAttributes<unknown>>;
30
30
  /**
31
31
  * Plugin to hide Popover when either Esc key is pressed,
32
32
  * or when the content inside is not tabbable and Tab key is pressed.
@@ -26,7 +26,7 @@ export const Resizer = (props) => {
26
26
  const initialPointerX = event.clientX;
27
27
  const initialPointerY = event.clientY;
28
28
  const [initialTranslateX, initialTranslateY] = getTranslateValues(elementRef.current);
29
- const { width: initialWidth, height: initialHeight, } = elementRef.current.getBoundingClientRect();
29
+ const { width: initialWidth, height: initialHeight } = elementRef.current.getBoundingClientRect();
30
30
  let width = `${initialWidth}px`;
31
31
  let height = `${initialHeight}px`;
32
32
  let translateX = initialTranslateX;
@@ -126,7 +126,8 @@ export const Resizer = (props) => {
126
126
  elementRef.current.ownerDocument.addEventListener('pointerup', () => {
127
127
  document.removeEventListener('pointermove', onResizePointerMove);
128
128
  if (elementRef.current) {
129
- elementRef.current.ownerDocument.body.style.userSelect = originalUserSelect;
129
+ elementRef.current.ownerDocument.body.style.userSelect =
130
+ originalUserSelect;
130
131
  isResizing.current = false;
131
132
  onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd({
132
133
  width,
@@ -3,8 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from 'react';
6
- import { mergeRefs } from '../hooks';
7
- import { useResizeObserver } from '../hooks/useResizeObserver';
6
+ import { mergeRefs, useResizeObserver, useIsomorphicLayoutEffect, } from '../hooks';
8
7
  const getScrollableParent = (element, ownerDocument = document) => {
9
8
  if (!element || element === ownerDocument.body) {
10
9
  return ownerDocument.body;
@@ -146,18 +145,18 @@ export const useVirtualization = (props) => {
146
145
  const [resizeRef, resizeObserver] = useResizeObserver(onResize);
147
146
  // Find scrollable parent
148
147
  // Needed only on init
149
- React.useLayoutEffect(() => {
148
+ useIsomorphicLayoutEffect(() => {
150
149
  var _a;
151
150
  const scrollableParent = getScrollableParent(parentRef.current, (_a = parentRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
152
151
  scrollContainer.current = scrollableParent;
153
152
  resizeRef(scrollableParent);
154
153
  }, [resizeRef]);
155
154
  // Stop watching resize, when virtual scroll is unmounted
156
- React.useLayoutEffect(() => {
155
+ useIsomorphicLayoutEffect(() => {
157
156
  return () => resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
158
157
  }, [resizeObserver]);
159
158
  // Get child height when children available
160
- React.useLayoutEffect(() => updateChildHeight(), [updateChildHeight]);
159
+ useIsomorphicLayoutEffect(() => updateChildHeight(), [updateChildHeight]);
161
160
  const updateVirtualScroll = React.useCallback(() => {
162
161
  const scrollableContainer = getScrollableContainer();
163
162
  if (!scrollableContainer) {
@@ -191,7 +190,7 @@ export const useVirtualization = (props) => {
191
190
  : scrollContainer.current.removeEventListener('scroll', onScrollRef.current);
192
191
  }, []);
193
192
  // Add event listener to the scrollable container.
194
- React.useLayoutEffect(() => {
193
+ useIsomorphicLayoutEffect(() => {
195
194
  var _a, _b;
196
195
  removeScrollListener();
197
196
  onScrollRef.current = onScroll;
@@ -204,7 +203,7 @@ export const useVirtualization = (props) => {
204
203
  }
205
204
  return removeScrollListener;
206
205
  }, [onScroll, removeScrollListener]);
207
- React.useLayoutEffect(() => {
206
+ useIsomorphicLayoutEffect(() => {
208
207
  if (!isMounted) {
209
208
  return;
210
209
  }
@@ -256,7 +255,7 @@ export const useVirtualization = (props) => {
256
255
  }
257
256
  }
258
257
  }, [scrollToIndex, isMounted]);
259
- React.useLayoutEffect(() => {
258
+ useIsomorphicLayoutEffect(() => {
260
259
  if (!scrollContainerHeight) {
261
260
  return;
262
261
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Returns translate values as an array of a given element.
3
3
  * @param element HTML element you want to get translate value of
4
- * @returns Translate values in pixels in a array `[translateX, translateY]`
4
+ * @returns Translate values in pixels in an array `[translateX, translateY]`
5
5
  */
6
6
  export declare const getTranslateValues: (element: HTMLElement | null | undefined) => number[];
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Returns translate values as an array of a given element.
7
7
  * @param element HTML element you want to get translate value of
8
- * @returns Translate values in pixels in a array `[translateX, translateY]`
8
+ * @returns Translate values in pixels in an array `[translateX, translateY]`
9
9
  */
10
10
  export const getTranslateValues = (element) => {
11
11
  if (!element) {
@@ -35,7 +35,7 @@ export const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
35
35
  if (!elementRef.current || !enabled) {
36
36
  return;
37
37
  }
38
- const { top, right, bottom, left, } = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
38
+ const { top, right, bottom, left } = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
39
39
  let [newTranslateX, newTranslateY] = getTranslateValues(elementRef.current);
40
40
  containerRectRef.current = getContainerRect(containerRef);
41
41
  if (bottom > containerRectRef.current.bottom) {
@@ -5,6 +5,7 @@
5
5
  import React from 'react';
6
6
  import { useMergedRefs } from './useMergedRefs';
7
7
  import { useResizeObserver } from './useResizeObserver';
8
+ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
8
9
  const STARTING_MAX_ITEMS_COUNT = 20;
9
10
  /**
10
11
  * Hook that observes the size of an element and returns the number of items
@@ -37,7 +38,7 @@ export const useOverflow = (items, disabled = false, orientation = 'horizontal')
37
38
  const updateContainerSize = React.useCallback(({ width, height }) => setContainerSize(orientation === 'horizontal' ? width : height), [orientation]);
38
39
  const [resizeRef, observer] = useResizeObserver(updateContainerSize);
39
40
  const resizeObserverRef = React.useRef(observer);
40
- React.useLayoutEffect(() => {
41
+ useIsomorphicLayoutEffect(() => {
41
42
  if (disabled) {
42
43
  setVisibleCount(items.length);
43
44
  }
@@ -47,7 +48,7 @@ export const useOverflow = (items, disabled = false, orientation = 'horizontal')
47
48
  }
48
49
  }, [containerSize, disabled, items]);
49
50
  const mergedRefs = useMergedRefs(containerRef, resizeRef);
50
- React.useLayoutEffect(() => {
51
+ useIsomorphicLayoutEffect(() => {
51
52
  var _a;
52
53
  if (!containerRef.current || disabled) {
53
54
  (_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
@@ -75,7 +76,7 @@ export const useOverflow = (items, disabled = false, orientation = 'horizontal')
75
76
  }
76
77
  needsFullRerender.current = false;
77
78
  }, [containerSize, visibleCount, disabled, items.length, orientation]);
78
- React.useLayoutEffect(() => {
79
+ useIsomorphicLayoutEffect(() => {
79
80
  previousContainerSize.current = containerSize;
80
81
  }, [containerSize]);
81
82
  return [mergedRefs, visibleCount];
@@ -22,8 +22,8 @@ export const useTheme = (theme, themeOptions) => {
22
22
  const themeContext = React.useContext(ThemeContext);
23
23
  const ownerDocument = (_a = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.ownerDocument) !== null && _a !== void 0 ? _a : getDocument();
24
24
  useIsomorphicLayoutEffect(() => {
25
- // exit early if theme was already set by provider
26
- if (themeContext || !ownerDocument) {
25
+ // exit early if theme was already set by provider or is present on <body>
26
+ if (themeContext || !ownerDocument || ownerDocument.body.dataset.iuiTheme) {
27
27
  return;
28
28
  }
29
29
  ownerDocument.body.classList.toggle('iui-root', true);