@itwin/itwinui-react 3.14.2 → 3.15.1

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 (105) hide show
  1. package/CHANGELOG.md +76 -2
  2. package/DEV-cjs/core/Carousel/CarouselDotsList.js +11 -4
  3. package/DEV-cjs/core/Carousel/CarouselSlider.js +3 -3
  4. package/DEV-cjs/core/ColorPicker/ColorBuilder.js +72 -24
  5. package/DEV-cjs/core/ColorPicker/ColorInputPanel.js +35 -7
  6. package/DEV-cjs/core/ColorPicker/ColorPalette.js +21 -3
  7. package/DEV-cjs/core/ComboBox/ComboBox.js +2 -1
  8. package/DEV-cjs/core/ComboBox/ComboBoxMenu.js +2 -2
  9. package/DEV-cjs/core/DropdownMenu/DropdownMenu.js +20 -19
  10. package/DEV-cjs/core/Overlay/Overlay.js +0 -18
  11. package/DEV-cjs/core/Popover/Popover.js +17 -10
  12. package/DEV-cjs/core/Select/Select.js +4 -2
  13. package/DEV-cjs/core/Table/Table.js +50 -25
  14. package/DEV-cjs/core/Table/TableExpandableContentMemoized.js +47 -0
  15. package/DEV-cjs/core/Table/TableRowMemoized.js +0 -18
  16. package/DEV-cjs/core/Table/hooks/useColumnDragAndDrop.js +12 -14
  17. package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +18 -0
  18. package/DEV-cjs/core/Toast/Toast.js +6 -7
  19. package/DEV-cjs/core/Tooltip/Tooltip.js +7 -4
  20. package/DEV-cjs/styles.js +1 -1
  21. package/DEV-cjs/utils/components/ShadowRoot.js +22 -8
  22. package/DEV-cjs/utils/hooks/useWarningLogger.js +5 -3
  23. package/DEV-esm/core/Carousel/CarouselDotsList.js +10 -5
  24. package/DEV-esm/core/Carousel/CarouselSlider.js +2 -3
  25. package/DEV-esm/core/ColorPicker/ColorBuilder.js +56 -22
  26. package/DEV-esm/core/ColorPicker/ColorInputPanel.js +37 -8
  27. package/DEV-esm/core/ColorPicker/ColorPalette.js +18 -3
  28. package/DEV-esm/core/ComboBox/ComboBox.js +2 -1
  29. package/DEV-esm/core/ComboBox/ComboBoxMenu.js +2 -2
  30. package/DEV-esm/core/DropdownMenu/DropdownMenu.js +20 -19
  31. package/DEV-esm/core/Overlay/Overlay.js +1 -19
  32. package/DEV-esm/core/Popover/Popover.js +18 -10
  33. package/DEV-esm/core/Select/Select.js +4 -2
  34. package/DEV-esm/core/Table/Table.js +50 -25
  35. package/DEV-esm/core/Table/TableExpandableContentMemoized.js +33 -0
  36. package/DEV-esm/core/Table/TableRowMemoized.js +1 -21
  37. package/DEV-esm/core/Table/hooks/useColumnDragAndDrop.js +12 -6
  38. package/DEV-esm/core/ThemeProvider/ThemeProvider.js +18 -0
  39. package/DEV-esm/core/Toast/Toast.js +5 -5
  40. package/DEV-esm/core/Tooltip/Tooltip.js +7 -4
  41. package/DEV-esm/styles.js +1 -1
  42. package/DEV-esm/utils/components/ShadowRoot.js +22 -8
  43. package/DEV-esm/utils/hooks/useWarningLogger.js +4 -3
  44. package/cjs/core/Buttons/SplitButton.d.ts +5 -0
  45. package/cjs/core/Carousel/CarouselDotsList.js +11 -4
  46. package/cjs/core/Carousel/CarouselSlider.js +3 -3
  47. package/cjs/core/ColorPicker/ColorBuilder.d.ts +22 -1
  48. package/cjs/core/ColorPicker/ColorBuilder.js +72 -24
  49. package/cjs/core/ColorPicker/ColorInputPanel.d.ts +18 -0
  50. package/cjs/core/ColorPicker/ColorInputPanel.js +35 -7
  51. package/cjs/core/ColorPicker/ColorPalette.d.ts +8 -0
  52. package/cjs/core/ColorPicker/ColorPalette.js +21 -3
  53. package/cjs/core/ComboBox/ComboBox.d.ts +3 -2
  54. package/cjs/core/ComboBox/ComboBox.js +2 -1
  55. package/cjs/core/ComboBox/ComboBoxMenu.js +2 -2
  56. package/cjs/core/DropdownMenu/DropdownMenu.d.ts +11 -0
  57. package/cjs/core/DropdownMenu/DropdownMenu.js +20 -19
  58. package/cjs/core/Overlay/Overlay.js +0 -18
  59. package/cjs/core/Popover/Popover.d.ts +4 -1
  60. package/cjs/core/Popover/Popover.js +17 -10
  61. package/cjs/core/Select/Select.d.ts +14 -2
  62. package/cjs/core/Select/Select.js +4 -2
  63. package/cjs/core/Table/Table.js +50 -25
  64. package/cjs/core/Table/TableExpandableContentMemoized.d.ts +10 -0
  65. package/cjs/core/Table/TableExpandableContentMemoized.js +47 -0
  66. package/cjs/core/Table/TableRowMemoized.js +0 -18
  67. package/cjs/core/Table/hooks/useColumnDragAndDrop.js +12 -14
  68. package/cjs/core/ThemeProvider/ThemeProvider.js +18 -0
  69. package/cjs/core/Toast/Toast.js +6 -7
  70. package/cjs/core/Tooltip/Tooltip.js +7 -4
  71. package/cjs/styles.js +1 -1
  72. package/cjs/utils/components/ShadowRoot.js +22 -8
  73. package/cjs/utils/hooks/useWarningLogger.js +1 -0
  74. package/esm/core/Buttons/SplitButton.d.ts +5 -0
  75. package/esm/core/Carousel/CarouselDotsList.js +10 -5
  76. package/esm/core/Carousel/CarouselSlider.js +2 -3
  77. package/esm/core/ColorPicker/ColorBuilder.d.ts +22 -1
  78. package/esm/core/ColorPicker/ColorBuilder.js +56 -22
  79. package/esm/core/ColorPicker/ColorInputPanel.d.ts +18 -0
  80. package/esm/core/ColorPicker/ColorInputPanel.js +37 -8
  81. package/esm/core/ColorPicker/ColorPalette.d.ts +8 -0
  82. package/esm/core/ColorPicker/ColorPalette.js +18 -3
  83. package/esm/core/ComboBox/ComboBox.d.ts +3 -2
  84. package/esm/core/ComboBox/ComboBox.js +2 -1
  85. package/esm/core/ComboBox/ComboBoxMenu.js +2 -2
  86. package/esm/core/DropdownMenu/DropdownMenu.d.ts +11 -0
  87. package/esm/core/DropdownMenu/DropdownMenu.js +20 -19
  88. package/esm/core/Overlay/Overlay.js +1 -19
  89. package/esm/core/Popover/Popover.d.ts +4 -1
  90. package/esm/core/Popover/Popover.js +18 -10
  91. package/esm/core/Select/Select.d.ts +14 -2
  92. package/esm/core/Select/Select.js +4 -2
  93. package/esm/core/Table/Table.js +50 -25
  94. package/esm/core/Table/TableExpandableContentMemoized.d.ts +10 -0
  95. package/esm/core/Table/TableExpandableContentMemoized.js +33 -0
  96. package/esm/core/Table/TableRowMemoized.js +1 -21
  97. package/esm/core/Table/hooks/useColumnDragAndDrop.js +12 -6
  98. package/esm/core/ThemeProvider/ThemeProvider.js +18 -0
  99. package/esm/core/Toast/Toast.js +5 -5
  100. package/esm/core/Tooltip/Tooltip.js +7 -4
  101. package/esm/styles.js +1 -1
  102. package/esm/utils/components/ShadowRoot.js +22 -8
  103. package/esm/utils/hooks/useWarningLogger.js +1 -0
  104. package/package.json +8 -6
  105. package/styles.css +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2263](https://github.com/iTwin/iTwinUI/pull/2263): Default `Tooltip` delay is now correctly applied.
8
+ - [#2266](https://github.com/iTwin/iTwinUI/pull/2266): All instances of `user-select: all` have been removed.
9
+ - Affected components: `Code`, `InformationPanel`, `Slider`, `Stepper`, `Tile`.
10
+
11
+ ## 3.15.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#2233](https://github.com/iTwin/iTwinUI/pull/2233): `Popover` now enables the [`hide` middleware](https://floating-ui.com/docs/hide) to hide the floating content when the trigger is hidden.
16
+ - This also affects other popover-like components (e.g. `Select`, `ComboBox`, `DropdownMenu`, `SplitButton`).
17
+ - If the floating content gets hidden even when it shouldn't (e.g. due to some custom styles interfering with the trigger's hide detection), consider disabling the `hide` middleware.
18
+
19
+ - [#2233](https://github.com/iTwin/iTwinUI/pull/2233): Added a new `dropdownMenuProps` prop to `SplitButton` for additional control over the menu (e.g. to disable the [`hide` middleware](https://floating-ui.com/docs/hide)).
20
+
21
+ - [#2259](https://github.com/iTwin/iTwinUI/pull/2259): `ComboBox` and `Select` now allow customizing the portal behavior of the floating listbox.
22
+
23
+ - To customize `ComboBox` portaling behavior, use `dropdownMenuProps.portal`.
24
+ - To customize `Select` portaling behavior, use `popoverProps.portal`.
25
+
26
+ <details>
27
+ <summary>Example</summary>
28
+
29
+ To turn off the default portaling behavior, use `portal: false`.
30
+
31
+ ```jsx
32
+ <ComboBox
33
+ options={[…]}
34
+ dropdownMenuProps={{ portal: false }}
35
+ />
36
+ ```
37
+
38
+ ```jsx
39
+ <Select
40
+ options={[…]}
41
+ popoverProps={{ portal: false }}
42
+ />
43
+ ```
44
+
45
+ </details>
46
+
47
+ - [#2238](https://github.com/iTwin/iTwinUI/pull/2238): Passing `styleType="borderless"` to `SearchBox.ExpandButton` now works as expected. This is because collapsed `SearchBox` will now hide its border and background in favor of the ones from `SearchBox.ExpandButton`.
48
+
49
+ <details>
50
+ <summary>Example</summary>
51
+
52
+ ```diff
53
+ <SearchBox expandable>
54
+ <SearchBox.CollapsedState>
55
+ - <SearchBox.ExpandButton/>
56
+ + <SearchBox.ExpandButton styleType="borderless"/>
57
+ </SearchBox.CollapsedState>
58
+ <SearchBox.ExpandedState>…</SearchBox.ExpandedState>
59
+ </SearchBox>
60
+ ```
61
+
62
+ </details>
63
+
64
+ - [#2211](https://github.com/iTwin/iTwinUI/pull/2211): Added the ability to have custom `props` for each sub-component of `ColorPicker`.
65
+ - New **ColorBuilder** props: `colorFieldProps`, `colorDotProps`, `opacitySliderProps`, and `hueSliderProps`.
66
+ - New **ColorInputPanel** props: `panelLabelProps`, `colorInputContainerProps`, `inputFieldsGroupProps` and `swapColorFormatButtonProps`.
67
+ - New **ColorPalette** props: `labelProps`, and `paletteContainerProps`.
68
+
69
+ ### Patch Changes
70
+
71
+ - [#2208](https://github.com/iTwin/iTwinUI/pull/2208): Fixed an issue in `Table` where `subComponent` was broken when enabling virtualization.
72
+ - [#2239](https://github.com/iTwin/iTwinUI/pull/2239): Fixed `scrollToRow` in un-virtualized `Table`. In virtualized `Table`, `scrollToRow` now scrolls to the top for consistent behavior.
73
+ - [#2233](https://github.com/iTwin/iTwinUI/pull/2233): `Popover`'s `middleware.hide` prop is now respected.
74
+ - [#2208](https://github.com/iTwin/iTwinUI/pull/2208): `Table`'s animation to show and hide its `subComponent` is now removed.
75
+ - [#2252](https://github.com/iTwin/iTwinUI/pull/2252): Fixed an issue where some components (e.g. `VisuallyHidden` inside `ProgressRadial`) were losing their styles when reparented into a different window.
76
+
3
77
  ## 3.14.2
4
78
 
5
79
  ### Patch Changes
@@ -397,7 +471,7 @@
397
471
 
398
472
  - [#1865](https://github.com/iTwin/iTwinUI/pull/1865): `Dialog`/`Modal` will no longer keep its wrapper in the DOM when `isOpen=false`.
399
473
  - [#1889](https://github.com/iTwin/iTwinUI/pull/1889): `Dialog`/`Modal`'s close button will now be visually aligned based on the icon inside it, excluding the padding.
400
- - [#1906](https://github.com/iTwin/iTwinUI/pull/1906): `Dialog`/`Modal` title will now wrap to multiple lines instead of getting clippped.
474
+ - [#1906](https://github.com/iTwin/iTwinUI/pull/1906): `Dialog`/`Modal` title will now wrap to multiple lines instead of getting clipped.
401
475
  - [#1873](https://github.com/iTwin/iTwinUI/pull/1873): Fixed `Tab` stripe size and position calculation that sometimes used to cause unnecessary overflow and thus cause a horizontal scrollbar in `TabList`.
402
476
  - [#1884](https://github.com/iTwin/iTwinUI/pull/1884): Fixed a bug that caused the `Tabs.Wrapper` to change size dependent on which `Tabs.Tab` was active.
403
477
  - [#1901](https://github.com/iTwin/iTwinUI/pull/1901): Fixed a bug in `Table` where `initialState.columnOrder` was not being respected.
@@ -685,7 +759,7 @@ This release includes a few breaking changes which have been briefly listed belo
685
759
  - [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Added new `Popover` component for public use.
686
760
  - [#1323](https://github.com/iTwin/iTwinUI/pull/1323): Added `placement` prop to `Dialog` to allow placing it at one of the corners.
687
761
  - [#1523](https://github.com/iTwin/iTwinUI/pull/1523): Added `ariaStrategy` prop to Tooltip. Can be used to change how the tooltip is associated with the trigger element.
688
- - [#1477](https://github.com/iTwin/iTwinUI/pull/1477): Added a new `portalContainer` prop to `ThemeProvider`. When specified, all floating elements (tooltips, toats, dialogs) under the ThemeProvider will read this prop from context and portal into it.
762
+ - [#1477](https://github.com/iTwin/iTwinUI/pull/1477): Added a new `portalContainer` prop to `ThemeProvider`. When specified, all floating elements (tooltips, toasts, dialogs) under the ThemeProvider will read this prop from context and portal into it.
689
763
  - [#1362](https://github.com/iTwin/iTwinUI/pull/1362): All elements under the root will now get a default focus styling matching `--iui-color-border-accent`.
690
764
  - [#1373](https://github.com/iTwin/iTwinUI/pull/1373): Converted all physical CSS properties to their logical equivalents.
691
765
  - [#1328](https://github.com/iTwin/iTwinUI/pull/1328): Added new `Overlay` component with customizable subcomponents: `Overlay.Wrapper`, `Overlay.HiddenContent`, `Overlay.Overlay`.
@@ -104,18 +104,25 @@ const CarouselDotsList = _react.forwardRef((props, ref) => {
104
104
  handleSlideChange,
105
105
  ],
106
106
  );
107
+ let motionOk = (0, _index.useMediaQuery)(
108
+ '(prefers-reduced-motion: no-preference)',
109
+ );
107
110
  _react.useEffect(() => {
108
111
  let firstDot = listRef.current?.children[firstVisibleDotIndex];
109
112
  if (!listRef.current || !firstDot) return;
110
- let motionOk = (0, _index.getWindow)()?.matchMedia(
111
- '(prefers-reduced-motion: no-preference)',
112
- )?.matches;
113
113
  listRef.current.scrollTo({
114
114
  left: firstDot.offsetLeft - listRef.current.offsetLeft,
115
115
  behavior: motionOk && !justMounted.current ? 'smooth' : 'auto',
116
116
  });
117
117
  if (justMounted.current) justMounted.current = false;
118
- }, [currentIndex, firstVisibleDotIndex, slideCount, visibleCount, width]);
118
+ }, [
119
+ currentIndex,
120
+ firstVisibleDotIndex,
121
+ motionOk,
122
+ slideCount,
123
+ visibleCount,
124
+ width,
125
+ ]);
119
126
  let handleKeyDown = (event) => {
120
127
  if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
121
128
  return;
@@ -37,13 +37,13 @@ const CarouselSlider = _react.forwardRef((props, ref) => {
37
37
  }, [items.length, setSlideCount]);
38
38
  let sliderRef = _react.useRef(null);
39
39
  let refs = (0, _index.useMergedRefs)(sliderRef, ref);
40
+ let motionOk = (0, _index.useMediaQuery)(
41
+ '(prefers-reduced-motion: no-preference)',
42
+ );
40
43
  scrollToSlide.current = (slideIndex, { instant } = {}) => {
41
44
  isManuallyUpdating.current = true;
42
45
  let slideToShow = sliderRef.current?.children.item(slideIndex);
43
46
  if (!sliderRef.current || !slideToShow) return;
44
- let motionOk = (0, _index.getWindow)()?.matchMedia(
45
- '(prefers-reduced-motion: no-preference)',
46
- )?.matches;
47
47
  sliderRef.current.scrollTo({
48
48
  left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
49
49
  behavior: instant || !motionOk ? 'instant' : 'smooth',
@@ -24,7 +24,14 @@ const getHorizontalPercentageOfRectangle = (rect, pointer) => {
24
24
  return ((position - rect.left) / rect.width) * 100;
25
25
  };
26
26
  const ColorBuilder = _react.forwardRef((props, ref) => {
27
- let { className, ...rest } = props;
27
+ let {
28
+ className,
29
+ colorFieldProps,
30
+ colorDotProps,
31
+ opacitySliderProps,
32
+ hueSliderProps,
33
+ ...rest
34
+ } = props;
28
35
  let builderRef = _react.useRef();
29
36
  let refs = (0, _index.useMergedRefs)(builderRef, ref);
30
37
  let {
@@ -215,54 +222,86 @@ const ColorBuilder = _react.forwardRef((props, ref) => {
215
222
  _react.createElement(
216
223
  _index.Box,
217
224
  {
218
- className: 'iui-color-field',
225
+ as: 'div',
226
+ ...colorFieldProps,
227
+ className: (0, _classnames.default)(
228
+ 'iui-color-field',
229
+ colorFieldProps?.className,
230
+ ),
219
231
  style: {
220
232
  '--iui-color-field-hue': hueColorString,
221
233
  '--iui-color-picker-selected-color': dotColorString,
234
+ ...colorFieldProps?.style,
222
235
  },
223
- ref: squareRef,
224
- onPointerDown: (event) => {
225
- event.preventDefault();
226
- updateSquareValue(event, 'onClick');
227
- setColorDotActive(true);
228
- colorDotRef.current?.focus();
229
- },
236
+ ref: (0, _index.useMergedRefs)(squareRef, colorFieldProps?.ref),
237
+ onPointerDown: (0, _index.mergeEventHandlers)(
238
+ colorFieldProps?.onPointerDown,
239
+ (event) => {
240
+ event.preventDefault();
241
+ updateSquareValue(event, 'onClick');
242
+ setColorDotActive(true);
243
+ colorDotRef.current?.focus();
244
+ },
245
+ ),
230
246
  },
231
247
  _react.createElement(_index.Box, {
232
- className: 'iui-color-dot',
248
+ as: 'div',
249
+ ...colorDotProps,
250
+ className: (0, _classnames.default)(
251
+ 'iui-color-dot',
252
+ colorDotProps?.className,
253
+ ),
233
254
  style: {
234
255
  '--iui-color-dot-inset-block': `${squareTop.toString()}% auto`,
235
256
  '--iui-color-dot-inset-inline': `${squareLeft.toString()}% auto`,
257
+ ...colorDotProps?.style,
236
258
  },
237
- onPointerDown: () => {
238
- setColorDotActive(true);
239
- colorDotRef.current?.focus();
240
- },
241
- onKeyDown: handleColorDotKeyDown,
242
- onKeyUp: handleColorDotKeyUp,
259
+ onPointerDown: (0, _index.mergeEventHandlers)(
260
+ colorDotProps?.onPointerDown,
261
+ () => {
262
+ setColorDotActive(true);
263
+ colorDotRef.current?.focus();
264
+ },
265
+ ),
266
+ onKeyDown: (0, _index.mergeEventHandlers)(
267
+ colorDotProps?.onKeyDown,
268
+ handleColorDotKeyDown,
269
+ ),
270
+ onKeyUp: (0, _index.mergeEventHandlers)(
271
+ colorDotProps?.onKeyUp,
272
+ handleColorDotKeyUp,
273
+ ),
243
274
  tabIndex: 0,
244
- ref: colorDotRef,
275
+ ref: (0, _index.useMergedRefs)(colorDotRef, colorDotProps?.ref),
245
276
  }),
246
277
  ),
247
278
  _react.createElement(_Slider.Slider, {
248
279
  minLabel: '',
249
280
  maxLabel: '',
250
281
  values: [sliderValue],
251
- className: 'iui-hue-slider',
252
282
  trackDisplayMode: 'none',
283
+ min: 0,
284
+ max: 359,
285
+ ...hueSliderProps,
286
+ className: (0, _classnames.default)(
287
+ 'iui-hue-slider',
288
+ hueSliderProps?.className,
289
+ ),
253
290
  tooltipProps: () => ({
254
291
  visible: false,
292
+ ...hueSliderProps?.tooltipProps,
255
293
  }),
256
294
  onChange: (values) => {
295
+ hueSliderProps?.onChange?.(values);
257
296
  updateHueSlider(values[0], true);
258
297
  },
259
298
  onUpdate: (values) => {
299
+ hueSliderProps?.onUpdate?.(values);
260
300
  updateHueSlider(values[0], false);
261
301
  },
262
- min: 0,
263
- max: 359,
264
302
  thumbProps: () => ({
265
303
  'aria-label': 'Hue',
304
+ ...hueSliderProps?.thumbProps,
266
305
  }),
267
306
  }),
268
307
  showAlpha &&
@@ -270,25 +309,34 @@ const ColorBuilder = _react.forwardRef((props, ref) => {
270
309
  minLabel: '',
271
310
  maxLabel: '',
272
311
  values: [alphaValue],
273
- className: 'iui-opacity-slider',
274
312
  trackDisplayMode: 'none',
313
+ min: 0,
314
+ max: 1,
315
+ step: 0.01,
316
+ ...opacitySliderProps,
317
+ className: (0, _classnames.default)(
318
+ 'iui-opacity-slider',
319
+ opacitySliderProps?.className,
320
+ ),
275
321
  tooltipProps: () => ({
276
322
  visible: false,
323
+ ...opacitySliderProps?.tooltipProps,
277
324
  }),
278
325
  onChange: (values) => {
326
+ opacitySliderProps?.onChange?.(values);
279
327
  updateOpacitySlider(values[0], true);
280
328
  },
281
329
  onUpdate: (values) => {
330
+ opacitySliderProps?.onUpdate?.(values);
282
331
  updateOpacitySlider(values[0], false);
283
332
  },
284
- min: 0,
285
- max: 1,
286
- step: 0.01,
287
333
  style: {
288
334
  '--iui-color-picker-selected-color': hueColorString,
335
+ ...opacitySliderProps?.style,
289
336
  },
290
337
  thumbProps: () => ({
291
338
  'aria-label': 'Opacity',
339
+ ...opacitySliderProps?.thumbProps,
292
340
  }),
293
341
  }),
294
342
  );
@@ -21,6 +21,10 @@ const ColorInputPanel = _react.forwardRef((props, ref) => {
21
21
  defaultColorFormat,
22
22
  allowedColorFormats = ['hsl', 'rgb', 'hex'],
23
23
  className,
24
+ colorInputContainerProps,
25
+ panelLabelProps,
26
+ inputFieldsGroupProps,
27
+ swapColorFormatButtonProps,
24
28
  ...rest
25
29
  } = props;
26
30
  let inputsContainerRef = _react.useRef(null);
@@ -364,10 +368,12 @@ const ColorInputPanel = _react.forwardRef((props, ref) => {
364
368
  Number(input[3]) < 0 || Number(input[3]) > 1 ? 'negative' : void 0,
365
369
  }),
366
370
  );
367
- let labelId = (0, _index.useId)();
371
+ let fallbackLabelId = (0, _index.useId)();
372
+ let labelId = panelLabelProps?.id ?? fallbackLabelId;
368
373
  return _react.createElement(
369
374
  _index.Box,
370
375
  {
376
+ as: 'div',
371
377
  className: (0, _classnames.default)('iui-color-input-wrapper', className),
372
378
  ref: ref,
373
379
  ...rest,
@@ -375,7 +381,12 @@ const ColorInputPanel = _react.forwardRef((props, ref) => {
375
381
  _react.createElement(
376
382
  _index.Box,
377
383
  {
378
- className: 'iui-color-picker-section-label',
384
+ as: 'div',
385
+ ...panelLabelProps,
386
+ className: (0, _classnames.default)(
387
+ 'iui-color-picker-section-label',
388
+ panelLabelProps?.className,
389
+ ),
379
390
  id: labelId,
380
391
  },
381
392
  showAlpha && 'hex' !== currentFormat
@@ -385,26 +396,43 @@ const ColorInputPanel = _react.forwardRef((props, ref) => {
385
396
  _react.createElement(
386
397
  _index.Box,
387
398
  {
388
- className: 'iui-color-input',
399
+ as: 'div',
400
+ ...colorInputContainerProps,
401
+ className: (0, _classnames.default)(
402
+ 'iui-color-input',
403
+ colorInputContainerProps?.className,
404
+ ),
389
405
  },
390
406
  allowedColorFormats.length > 1 &&
391
407
  _react.createElement(
392
408
  _IconButton.IconButton,
393
409
  {
394
- styleType: 'borderless',
395
- onClick: swapColorFormat,
396
410
  size: 'small',
411
+ styleType: 'borderless',
397
412
  label: 'Switch format',
413
+ ...swapColorFormatButtonProps,
414
+ onClick: (0, _index.mergeEventHandlers)(
415
+ swapColorFormatButtonProps?.onClick,
416
+ swapColorFormat,
417
+ ),
398
418
  },
399
419
  _react.createElement(_index.SvgSwap, null),
400
420
  ),
401
421
  _react.createElement(
402
422
  _index.Box,
403
423
  {
404
- ref: inputsContainerRef,
405
- className: 'iui-color-input-fields',
424
+ as: 'div',
406
425
  role: 'hex' !== currentFormat ? 'group' : void 0,
407
426
  'aria-labelledby': 'hex' !== currentFormat ? labelId : void 0,
427
+ ...inputFieldsGroupProps,
428
+ ref: (0, _index.useMergedRefs)(
429
+ inputsContainerRef,
430
+ inputFieldsGroupProps?.ref,
431
+ ),
432
+ className: (0, _classnames.default)(
433
+ 'iui-color-input-fields',
434
+ inputFieldsGroupProps?.className,
435
+ ),
408
436
  },
409
437
  'hex' === currentFormat && hexInputField,
410
438
  'rgb' === currentFormat && rgbInputs,
@@ -17,7 +17,15 @@ const _ColorPicker = require('./ColorPicker.js');
17
17
  const _ColorSwatch = require('./ColorSwatch.js');
18
18
  const _ColorPickerContext = require('./ColorPickerContext.js');
19
19
  const ColorPalette = _react.forwardRef((props, ref) => {
20
- let { colors, label, className, children, ...rest } = props;
20
+ let {
21
+ colors,
22
+ label,
23
+ labelProps,
24
+ className,
25
+ children,
26
+ paletteContainerProps,
27
+ ...rest
28
+ } = props;
21
29
  let { activeColor, setActiveColor, onChangeComplete } = (0,
22
30
  _ColorPickerContext.useColorPickerContext)();
23
31
  return _react.createElement(
@@ -34,14 +42,24 @@ const ColorPalette = _react.forwardRef((props, ref) => {
34
42
  _react.createElement(
35
43
  _index.Box,
36
44
  {
37
- className: 'iui-color-picker-section-label',
45
+ as: 'div',
46
+ ...labelProps,
47
+ className: (0, _classnames.default)(
48
+ 'iui-color-picker-section-label',
49
+ labelProps?.className,
50
+ ),
38
51
  },
39
52
  label,
40
53
  ),
41
54
  _react.createElement(
42
55
  _index.Box,
43
56
  {
44
- className: 'iui-color-palette',
57
+ as: 'div',
58
+ ...paletteContainerProps,
59
+ className: (0, _classnames.default)(
60
+ 'iui-color-palette',
61
+ paletteContainerProps?.className,
62
+ ),
45
63
  },
46
64
  children,
47
65
  colors &&
@@ -42,7 +42,7 @@ const ComboBox = _react.forwardRef((props, forwardedRef) => {
42
42
  filterFunction = defaultFilterFunction,
43
43
  inputProps,
44
44
  endIconProps,
45
- dropdownMenuProps,
45
+ dropdownMenuProps: { middleware, ...dropdownMenuProps } = {},
46
46
  emptyStateMessage = 'No options found',
47
47
  itemRenderer,
48
48
  enableVirtualization = false,
@@ -322,6 +322,7 @@ const ComboBox = _react.forwardRef((props, forwardedRef) => {
322
322
  size: {
323
323
  maxHeight: 'var(--iui-menu-max-height)',
324
324
  },
325
+ ...middleware,
325
326
  },
326
327
  closeOnOutsideClick: true,
327
328
  interactions: {
@@ -94,7 +94,7 @@ const VirtualizedComboBoxMenu = (props) => {
94
94
  );
95
95
  };
96
96
  const ComboBoxMenu = _react.forwardRef((props, forwardedRef) => {
97
- let { className, children, style, ...rest } = props;
97
+ let { className, children, style, portal = true, ...rest } = props;
98
98
  let { id, enableVirtualization, popover } = (0, _index.useSafeContext)(
99
99
  _helpers.ComboBoxStateContext,
100
100
  );
@@ -109,7 +109,7 @@ const ComboBoxMenu = _react.forwardRef((props, forwardedRef) => {
109
109
  _react.createElement(
110
110
  _index.Portal,
111
111
  {
112
- portal: true,
112
+ portal: portal,
113
113
  },
114
114
  _react.createElement(
115
115
  _List.List,
@@ -34,6 +34,7 @@ const DropdownMenuContent = _react.forwardRef((props, forwardedRef) => {
34
34
  matchWidth = false,
35
35
  onVisibleChange,
36
36
  portal = true,
37
+ middleware,
37
38
  ...rest
38
39
  } = props;
39
40
  let [visible, setVisible] = (0, _index.useControlledState)(
@@ -47,28 +48,28 @@ const DropdownMenuContent = _react.forwardRef((props, forwardedRef) => {
47
48
  return menuItems;
48
49
  }, [menuItems, setVisible]);
49
50
  return _react.createElement(
50
- _react.Fragment,
51
- null,
52
- _react.createElement(
53
- _Menu.Menu,
54
- {
55
- trigger: children,
56
- onKeyDown: (0, _index.mergeEventHandlers)(props.onKeyDown, (e) => {
57
- if (e.defaultPrevented) return;
58
- if ('Tab' === e.key) setVisible(false);
59
- }),
60
- role: role,
61
- ref: forwardedRef,
62
- portal: portal,
63
- popoverProps: {
51
+ _Menu.Menu,
52
+ {
53
+ trigger: children,
54
+ onKeyDown: (0, _index.mergeEventHandlers)(props.onKeyDown, (e) => {
55
+ if (e.defaultPrevented) return;
56
+ if ('Tab' === e.key) setVisible(false);
57
+ }),
58
+ role: role,
59
+ ref: forwardedRef,
60
+ portal: portal,
61
+ popoverProps: _react.useMemo(
62
+ () => ({
64
63
  placement,
65
64
  matchWidth,
66
65
  visible,
67
66
  onVisibleChange: setVisible,
68
- },
69
- ...rest,
70
- },
71
- menuContent,
72
- ),
67
+ middleware,
68
+ }),
69
+ [matchWidth, middleware, placement, setVisible, visible],
70
+ ),
71
+ ...rest,
72
+ },
73
+ menuContent,
73
74
  );
74
75
  });
@@ -26,7 +26,6 @@ const OverlayComponent = _react.forwardRef((props, forwardedRef) => {
26
26
  OverlayComponent.displayName = 'Overlay';
27
27
  const OverlayHiddenContent = _react.forwardRef((props, ref) => {
28
28
  let { children, ...rest } = props;
29
- useInertPolyfill();
30
29
  return _react.createElement(
31
30
  _index.Box,
32
31
  {
@@ -47,20 +46,3 @@ const Overlay = Object.assign(OverlayComponent, {
47
46
  HiddenContent: OverlayHiddenContent,
48
47
  Overlay: OverlayOverlay,
49
48
  });
50
- const useInertPolyfill = () => {
51
- let loaded = _react.useRef(false);
52
- let modulePath =
53
- 'https://cdn.jsdelivr.net/npm/wicg-inert@3.1.2/dist/inert.min.js';
54
- _react.useEffect(() => {
55
- (async () => {
56
- if (
57
- !HTMLElement.prototype.hasOwnProperty('inert') &&
58
- !loaded.current &&
59
- !_index.isUnitTest
60
- ) {
61
- await new Function('url', 'return import(url)')(modulePath);
62
- loaded.current = true;
63
- }
64
- })();
65
- }, []);
66
- };
@@ -42,21 +42,22 @@ const usePopover = (options) => {
42
42
  } = options;
43
43
  let mergedInteractions = _react.useMemo(
44
44
  () => ({
45
- click: true,
46
- dismiss: true,
47
- hover: false,
48
- focus: false,
49
45
  ...interactionsProp,
46
+ click: interactionsProp?.click ?? true,
47
+ dismiss: interactionsProp?.dismiss ?? true,
48
+ hover: interactionsProp?.hover ?? false,
49
+ focus: interactionsProp?.focus ?? false,
50
50
  }),
51
51
  [interactionsProp],
52
52
  );
53
53
  let tree = (0, _react1.useFloatingTree)();
54
54
  let middleware = _react.useMemo(
55
55
  () => ({
56
- flip: true,
57
- shift: true,
58
- size: true,
59
56
  ...options.middleware,
57
+ flip: options.middleware?.flip ?? true,
58
+ shift: options.middleware?.shift ?? true,
59
+ size: options.middleware?.size ?? true,
60
+ hide: options.middleware?.hide || !_index.isUnitTest,
60
61
  }),
61
62
  [options.middleware],
62
63
  );
@@ -164,17 +165,23 @@ const usePopover = (options) => {
164
165
  maxInlineSize: `min(${2 * referenceWidth}px, 90vw)`,
165
166
  }
166
167
  : {}),
168
+ ...(middleware.hide &&
169
+ floating.middlewareData.hide?.referenceHidden && {
170
+ visibility: 'hidden',
171
+ }),
167
172
  ...userProps?.style,
168
173
  },
169
174
  }),
170
175
  [
171
- floating.floatingStyles,
172
176
  interactions,
173
- matchWidth,
174
- referenceWidth,
177
+ floating.floatingStyles,
178
+ floating.middlewareData.hide?.referenceHidden,
175
179
  middleware.size,
180
+ middleware.hide,
176
181
  availableHeight,
177
182
  maxHeight,
183
+ matchWidth,
184
+ referenceWidth,
178
185
  ],
179
186
  );
180
187
  let getReferenceProps = _react.useCallback(
@@ -117,7 +117,7 @@ const CustomSelect = _react.forwardRef((props, forwardedRef) => {
117
117
  multiple = false,
118
118
  triggerProps,
119
119
  status,
120
- popoverProps,
120
+ popoverProps: { portal = true, ...popoverProps } = {},
121
121
  styleType,
122
122
  ...rest
123
123
  } = props;
@@ -314,7 +314,9 @@ const CustomSelect = _react.forwardRef((props, forwardedRef) => {
314
314
  popover.open &&
315
315
  _react.createElement(
316
316
  _index.Portal,
317
- null,
317
+ {
318
+ portal: portal,
319
+ },
318
320
  _react.createElement(
319
321
  SelectListbox,
320
322
  {