@itwin/itwinui-react 3.14.2 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -2
- package/DEV-cjs/core/Carousel/CarouselDotsList.js +11 -4
- package/DEV-cjs/core/Carousel/CarouselSlider.js +3 -3
- package/DEV-cjs/core/ColorPicker/ColorBuilder.js +72 -24
- package/DEV-cjs/core/ColorPicker/ColorInputPanel.js +35 -7
- package/DEV-cjs/core/ColorPicker/ColorPalette.js +21 -3
- package/DEV-cjs/core/ComboBox/ComboBox.js +2 -1
- package/DEV-cjs/core/ComboBox/ComboBoxMenu.js +2 -2
- package/DEV-cjs/core/DropdownMenu/DropdownMenu.js +20 -19
- package/DEV-cjs/core/Overlay/Overlay.js +0 -18
- package/DEV-cjs/core/Popover/Popover.js +17 -10
- package/DEV-cjs/core/Select/Select.js +4 -2
- package/DEV-cjs/core/Table/Table.js +50 -25
- package/DEV-cjs/core/Table/TableExpandableContentMemoized.js +47 -0
- package/DEV-cjs/core/Table/TableRowMemoized.js +0 -18
- package/DEV-cjs/core/Table/hooks/useColumnDragAndDrop.js +12 -14
- package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +18 -0
- package/DEV-cjs/core/Toast/Toast.js +6 -7
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/components/ShadowRoot.js +22 -8
- package/DEV-cjs/utils/hooks/useWarningLogger.js +5 -3
- package/DEV-esm/core/Carousel/CarouselDotsList.js +10 -5
- package/DEV-esm/core/Carousel/CarouselSlider.js +2 -3
- package/DEV-esm/core/ColorPicker/ColorBuilder.js +56 -22
- package/DEV-esm/core/ColorPicker/ColorInputPanel.js +37 -8
- package/DEV-esm/core/ColorPicker/ColorPalette.js +18 -3
- package/DEV-esm/core/ComboBox/ComboBox.js +2 -1
- package/DEV-esm/core/ComboBox/ComboBoxMenu.js +2 -2
- package/DEV-esm/core/DropdownMenu/DropdownMenu.js +20 -19
- package/DEV-esm/core/Overlay/Overlay.js +1 -19
- package/DEV-esm/core/Popover/Popover.js +18 -10
- package/DEV-esm/core/Select/Select.js +4 -2
- package/DEV-esm/core/Table/Table.js +50 -25
- package/DEV-esm/core/Table/TableExpandableContentMemoized.js +33 -0
- package/DEV-esm/core/Table/TableRowMemoized.js +1 -21
- package/DEV-esm/core/Table/hooks/useColumnDragAndDrop.js +12 -6
- package/DEV-esm/core/ThemeProvider/ThemeProvider.js +18 -0
- package/DEV-esm/core/Toast/Toast.js +5 -5
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/components/ShadowRoot.js +22 -8
- package/DEV-esm/utils/hooks/useWarningLogger.js +4 -3
- package/cjs/core/Buttons/SplitButton.d.ts +5 -0
- package/cjs/core/Carousel/CarouselDotsList.js +11 -4
- package/cjs/core/Carousel/CarouselSlider.js +3 -3
- package/cjs/core/ColorPicker/ColorBuilder.d.ts +22 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +72 -24
- package/cjs/core/ColorPicker/ColorInputPanel.d.ts +18 -0
- package/cjs/core/ColorPicker/ColorInputPanel.js +35 -7
- package/cjs/core/ColorPicker/ColorPalette.d.ts +8 -0
- package/cjs/core/ColorPicker/ColorPalette.js +21 -3
- package/cjs/core/ComboBox/ComboBox.d.ts +3 -2
- package/cjs/core/ComboBox/ComboBox.js +2 -1
- package/cjs/core/ComboBox/ComboBoxMenu.js +2 -2
- package/cjs/core/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/cjs/core/DropdownMenu/DropdownMenu.js +20 -19
- package/cjs/core/Overlay/Overlay.js +0 -18
- package/cjs/core/Popover/Popover.d.ts +4 -1
- package/cjs/core/Popover/Popover.js +17 -10
- package/cjs/core/Select/Select.d.ts +14 -2
- package/cjs/core/Select/Select.js +4 -2
- package/cjs/core/Table/Table.js +50 -25
- package/cjs/core/Table/TableExpandableContentMemoized.d.ts +10 -0
- package/cjs/core/Table/TableExpandableContentMemoized.js +47 -0
- package/cjs/core/Table/TableRowMemoized.js +0 -18
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +12 -14
- package/cjs/core/ThemeProvider/ThemeProvider.js +18 -0
- package/cjs/core/Toast/Toast.js +6 -7
- package/cjs/styles.js +1 -1
- package/cjs/utils/components/ShadowRoot.js +22 -8
- package/cjs/utils/hooks/useWarningLogger.js +1 -0
- package/esm/core/Buttons/SplitButton.d.ts +5 -0
- package/esm/core/Carousel/CarouselDotsList.js +10 -5
- package/esm/core/Carousel/CarouselSlider.js +2 -3
- package/esm/core/ColorPicker/ColorBuilder.d.ts +22 -1
- package/esm/core/ColorPicker/ColorBuilder.js +56 -22
- package/esm/core/ColorPicker/ColorInputPanel.d.ts +18 -0
- package/esm/core/ColorPicker/ColorInputPanel.js +37 -8
- package/esm/core/ColorPicker/ColorPalette.d.ts +8 -0
- package/esm/core/ColorPicker/ColorPalette.js +18 -3
- package/esm/core/ComboBox/ComboBox.d.ts +3 -2
- package/esm/core/ComboBox/ComboBox.js +2 -1
- package/esm/core/ComboBox/ComboBoxMenu.js +2 -2
- package/esm/core/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/esm/core/DropdownMenu/DropdownMenu.js +20 -19
- package/esm/core/Overlay/Overlay.js +1 -19
- package/esm/core/Popover/Popover.d.ts +4 -1
- package/esm/core/Popover/Popover.js +18 -10
- package/esm/core/Select/Select.d.ts +14 -2
- package/esm/core/Select/Select.js +4 -2
- package/esm/core/Table/Table.js +50 -25
- package/esm/core/Table/TableExpandableContentMemoized.d.ts +10 -0
- package/esm/core/Table/TableExpandableContentMemoized.js +33 -0
- package/esm/core/Table/TableRowMemoized.js +1 -21
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +12 -6
- package/esm/core/ThemeProvider/ThemeProvider.js +18 -0
- package/esm/core/Toast/Toast.js +5 -5
- package/esm/styles.js +1 -1
- package/esm/utils/components/ShadowRoot.js +22 -8
- package/esm/utils/hooks/useWarningLogger.js +1 -0
- package/package.json +8 -6
- package/styles.css +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
- This also affects other popover-like components (e.g. `Select`, `ComboBox`, `DropdownMenu`, `SplitButton`).
|
|
9
|
+
- 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.
|
|
10
|
+
|
|
11
|
+
- [#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)).
|
|
12
|
+
|
|
13
|
+
- [#2259](https://github.com/iTwin/iTwinUI/pull/2259): `ComboBox` and `Select` now allow customizing the portal behavior of the floating listbox.
|
|
14
|
+
|
|
15
|
+
- To customize `ComboBox` portaling behavior, use `dropdownMenuProps.portal`.
|
|
16
|
+
- To customize `Select` portaling behavior, use `popoverProps.portal`.
|
|
17
|
+
|
|
18
|
+
<details>
|
|
19
|
+
<summary>Example</summary>
|
|
20
|
+
|
|
21
|
+
To turn off the default portaling behavior, use `portal: false`.
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<ComboBox
|
|
25
|
+
options={[…]}
|
|
26
|
+
dropdownMenuProps={{ portal: false }}
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
<Select
|
|
32
|
+
options={[…]}
|
|
33
|
+
popoverProps={{ portal: false }}
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
</details>
|
|
38
|
+
|
|
39
|
+
- [#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`.
|
|
40
|
+
|
|
41
|
+
<details>
|
|
42
|
+
<summary>Example</summary>
|
|
43
|
+
|
|
44
|
+
```diff
|
|
45
|
+
<SearchBox expandable>
|
|
46
|
+
<SearchBox.CollapsedState>
|
|
47
|
+
- <SearchBox.ExpandButton/>
|
|
48
|
+
+ <SearchBox.ExpandButton styleType="borderless"/>
|
|
49
|
+
</SearchBox.CollapsedState>
|
|
50
|
+
<SearchBox.ExpandedState>…</SearchBox.ExpandedState>
|
|
51
|
+
</SearchBox>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
- [#2211](https://github.com/iTwin/iTwinUI/pull/2211): Added the ability to have custom `props` for each sub-component of `ColorPicker`.
|
|
57
|
+
- New **ColorBuilder** props: `colorFieldProps`, `colorDotProps`, `opacitySliderProps`, and `hueSliderProps`.
|
|
58
|
+
- New **ColorInputPanel** props: `panelLabelProps`, `colorInputContainerProps`, `inputFieldsGroupProps` and `swapColorFormatButtonProps`.
|
|
59
|
+
- New **ColorPalette** props: `labelProps`, and `paletteContainerProps`.
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- [#2208](https://github.com/iTwin/iTwinUI/pull/2208): Fixed an issue in `Table` where `subComponent` was broken when enabling virtualization.
|
|
64
|
+
- [#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.
|
|
65
|
+
- [#2233](https://github.com/iTwin/iTwinUI/pull/2233): `Popover`'s `middleware.hide` prop is now respected.
|
|
66
|
+
- [#2208](https://github.com/iTwin/iTwinUI/pull/2208): `Table`'s animation to show and hide its `subComponent` is now removed.
|
|
67
|
+
- [#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.
|
|
68
|
+
|
|
3
69
|
## 3.14.2
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
|
@@ -397,7 +463,7 @@
|
|
|
397
463
|
|
|
398
464
|
- [#1865](https://github.com/iTwin/iTwinUI/pull/1865): `Dialog`/`Modal` will no longer keep its wrapper in the DOM when `isOpen=false`.
|
|
399
465
|
- [#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
|
|
466
|
+
- [#1906](https://github.com/iTwin/iTwinUI/pull/1906): `Dialog`/`Modal` title will now wrap to multiple lines instead of getting clipped.
|
|
401
467
|
- [#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
468
|
- [#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
469
|
- [#1901](https://github.com/iTwin/iTwinUI/pull/1901): Fixed a bug in `Table` where `initialState.columnOrder` was not being respected.
|
|
@@ -685,7 +751,7 @@ This release includes a few breaking changes which have been briefly listed belo
|
|
|
685
751
|
- [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Added new `Popover` component for public use.
|
|
686
752
|
- [#1323](https://github.com/iTwin/iTwinUI/pull/1323): Added `placement` prop to `Dialog` to allow placing it at one of the corners.
|
|
687
753
|
- [#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,
|
|
754
|
+
- [#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
755
|
- [#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
756
|
- [#1373](https://github.com/iTwin/iTwinUI/pull/1373): Converted all physical CSS properties to their logical equivalents.
|
|
691
757
|
- [#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
|
-
}, [
|
|
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 {
|
|
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
|
-
|
|
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: (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
174
|
-
|
|
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
|
-
|
|
317
|
+
{
|
|
318
|
+
portal: portal,
|
|
319
|
+
},
|
|
318
320
|
_react.createElement(
|
|
319
321
|
SelectListbox,
|
|
320
322
|
{
|