@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
|
@@ -25,7 +25,6 @@ const OverlayComponent = _react.forwardRef((props, forwardedRef) => {
|
|
|
25
25
|
});
|
|
26
26
|
const OverlayHiddenContent = _react.forwardRef((props, ref) => {
|
|
27
27
|
let { children, ...rest } = props;
|
|
28
|
-
useInertPolyfill();
|
|
29
28
|
return _react.createElement(
|
|
30
29
|
_index.Box,
|
|
31
30
|
{
|
|
@@ -43,20 +42,3 @@ const Overlay = Object.assign(OverlayComponent, {
|
|
|
43
42
|
HiddenContent: OverlayHiddenContent,
|
|
44
43
|
Overlay: OverlayOverlay,
|
|
45
44
|
});
|
|
46
|
-
const useInertPolyfill = () => {
|
|
47
|
-
let loaded = _react.useRef(false);
|
|
48
|
-
let modulePath =
|
|
49
|
-
'https://cdn.jsdelivr.net/npm/wicg-inert@3.1.2/dist/inert.min.js';
|
|
50
|
-
_react.useEffect(() => {
|
|
51
|
-
(async () => {
|
|
52
|
-
if (
|
|
53
|
-
!HTMLElement.prototype.hasOwnProperty('inert') &&
|
|
54
|
-
!loaded.current &&
|
|
55
|
-
!_index.isUnitTest
|
|
56
|
-
) {
|
|
57
|
-
await new Function('url', 'return import(url)')(modulePath);
|
|
58
|
-
loaded.current = true;
|
|
59
|
-
}
|
|
60
|
-
})();
|
|
61
|
-
}, []);
|
|
62
|
-
};
|
|
@@ -26,7 +26,10 @@ type PopoverOptions = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Middleware options.
|
|
28
28
|
*
|
|
29
|
-
* By default, `flip`, `shift` and `
|
|
29
|
+
* By default, `flip`, `shift`, `size`, and `hide` are enabled.
|
|
30
|
+
*
|
|
31
|
+
* If the floating content gets hidden even when it shouldn't (e.g. some custom styles interfering with the trigger's
|
|
32
|
+
* hide detection) consider disabling the `hide` middleware.
|
|
30
33
|
*
|
|
31
34
|
* @see https://floating-ui.com/docs/middleware
|
|
32
35
|
*/
|
|
@@ -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(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { CommonProps } from '../../utils/index.js';
|
|
2
|
+
import type { CommonProps, PortalProps } from '../../utils/index.js';
|
|
3
3
|
import { usePopover } from '../Popover/Popover.js';
|
|
4
4
|
/**
|
|
5
5
|
* Select component to select value from options.
|
|
@@ -182,7 +182,19 @@ export type CustomSelectProps<T> = SelectCommonProps & {
|
|
|
182
182
|
/**
|
|
183
183
|
* Props to customize Popover behavior.
|
|
184
184
|
*/
|
|
185
|
-
popoverProps?: Pick<Parameters<typeof usePopover>[0], 'visible' | 'onVisibleChange' | 'placement' | 'matchWidth' | 'closeOnOutsideClick'
|
|
185
|
+
popoverProps?: Pick<Parameters<typeof usePopover>[0], 'visible' | 'onVisibleChange' | 'placement' | 'matchWidth' | 'closeOnOutsideClick'> & {
|
|
186
|
+
/**
|
|
187
|
+
* Middleware options.
|
|
188
|
+
*
|
|
189
|
+
* By default, `hide` is enabled. If the floating options get hidden even when they shouldn't (e.g. some custom
|
|
190
|
+
* styles interfering with the trigger's hide detection) consider disabling the `hide` middleware.
|
|
191
|
+
*
|
|
192
|
+
* @see https://floating-ui.com/docs/middleware
|
|
193
|
+
*/
|
|
194
|
+
middleware?: {
|
|
195
|
+
hide?: boolean;
|
|
196
|
+
};
|
|
197
|
+
} & Pick<PortalProps, 'portal'>;
|
|
186
198
|
/**
|
|
187
199
|
* Props to pass to the select button (trigger) element.
|
|
188
200
|
*/
|
|
@@ -116,7 +116,7 @@ const CustomSelect = _react.forwardRef((props, forwardedRef) => {
|
|
|
116
116
|
multiple = false,
|
|
117
117
|
triggerProps,
|
|
118
118
|
status,
|
|
119
|
-
popoverProps,
|
|
119
|
+
popoverProps: { portal = true, ...popoverProps } = {},
|
|
120
120
|
styleType,
|
|
121
121
|
...rest
|
|
122
122
|
} = props;
|
|
@@ -313,7 +313,9 @@ const CustomSelect = _react.forwardRef((props, forwardedRef) => {
|
|
|
313
313
|
popover.open &&
|
|
314
314
|
_react.createElement(
|
|
315
315
|
_index.Portal,
|
|
316
|
-
|
|
316
|
+
{
|
|
317
|
+
portal: portal,
|
|
318
|
+
},
|
|
317
319
|
_react.createElement(
|
|
318
320
|
SelectListbox,
|
|
319
321
|
{
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -31,6 +31,7 @@ const _index1 = require('./hooks/index.js');
|
|
|
31
31
|
const _index2 = require('./actionHandlers/index.js');
|
|
32
32
|
const _index3 = require('./columns/index.js');
|
|
33
33
|
const _ColumnHeader = require('./ColumnHeader.js');
|
|
34
|
+
const _TableExpandableContentMemoized = require('./TableExpandableContentMemoized.js');
|
|
34
35
|
const singleRowSelectedAction = 'singleRowSelected';
|
|
35
36
|
const shiftRowSelectedAction = 'shiftRowSelected';
|
|
36
37
|
const tableResizeStartAction = 'tableResizeStart';
|
|
@@ -224,6 +225,17 @@ const Table = (props) => {
|
|
|
224
225
|
),
|
|
225
226
|
[data, getSubRows],
|
|
226
227
|
);
|
|
228
|
+
let [rowHasParent] = _react.useState(() => new WeakSet());
|
|
229
|
+
let getSubRowsWithSubComponents = _react.useCallback(
|
|
230
|
+
(originalRow) => {
|
|
231
|
+
if (!rowHasParent.has(originalRow)) {
|
|
232
|
+
rowHasParent.add(originalRow);
|
|
233
|
+
return [originalRow];
|
|
234
|
+
}
|
|
235
|
+
return originalRow.subRows || [];
|
|
236
|
+
},
|
|
237
|
+
[rowHasParent],
|
|
238
|
+
);
|
|
227
239
|
let instance = (0, _reacttable.useTable)(
|
|
228
240
|
{
|
|
229
241
|
manualPagination: !paginatorRenderer,
|
|
@@ -236,7 +248,7 @@ const Table = (props) => {
|
|
|
236
248
|
filterTypes,
|
|
237
249
|
selectSubRows,
|
|
238
250
|
data,
|
|
239
|
-
getSubRows,
|
|
251
|
+
getSubRows: subComponent ? getSubRowsWithSubComponents : getSubRows,
|
|
240
252
|
initialState: {
|
|
241
253
|
pageSize,
|
|
242
254
|
...props.initialState,
|
|
@@ -433,39 +445,54 @@ const Table = (props) => {
|
|
|
433
445
|
(0, _index.useLayoutEffect)(() => {
|
|
434
446
|
if (scrollToIndex)
|
|
435
447
|
virtualizer.scrollToIndex(scrollToIndex, {
|
|
436
|
-
align: '
|
|
448
|
+
align: 'start',
|
|
437
449
|
});
|
|
438
450
|
}, [virtualizer, scrollToIndex]);
|
|
439
451
|
let getPreparedRow = _react.useCallback(
|
|
440
452
|
(index, virtualItem, virtualizer) => {
|
|
441
453
|
let row = page[index];
|
|
442
454
|
prepareRow(row);
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
455
|
+
if (row.subRows.length > 0 || !subComponent)
|
|
456
|
+
return _react.createElement(_TableRowMemoized.TableRowMemoized, {
|
|
457
|
+
row: row,
|
|
458
|
+
rowProps: rowProps,
|
|
459
|
+
isLast: index === page.length - 1,
|
|
460
|
+
onRowInViewport: onRowInViewportRef,
|
|
461
|
+
onBottomReached: onBottomReachedRef,
|
|
462
|
+
intersectionMargin: intersectionMargin,
|
|
463
|
+
state: state,
|
|
464
|
+
key: row.getRowProps().key,
|
|
465
|
+
onClick: onRowClickHandler,
|
|
466
|
+
subComponent: subComponent,
|
|
467
|
+
isDisabled: !!isRowDisabled?.(row.original),
|
|
468
|
+
tableHasSubRows: hasAnySubRows,
|
|
469
|
+
tableInstance: instance,
|
|
470
|
+
expanderCell: expanderCell,
|
|
471
|
+
scrollContainerRef: tableRef.current,
|
|
472
|
+
tableRowRef: enableVirtualization ? void 0 : tableRowRef(row),
|
|
473
|
+
density: density,
|
|
474
|
+
virtualItem: virtualItem,
|
|
475
|
+
virtualizer: virtualizer,
|
|
476
|
+
});
|
|
477
|
+
return _react.createElement(
|
|
478
|
+
_TableExpandableContentMemoized.TableExpandableContentMemoized,
|
|
479
|
+
{
|
|
480
|
+
key: row.getRowProps().key,
|
|
481
|
+
virtualItem: virtualItem,
|
|
482
|
+
ref: enableVirtualization
|
|
483
|
+
? virtualizer?.measureElement
|
|
484
|
+
: tableRowRef(row),
|
|
485
|
+
isDisabled: !!isRowDisabled?.(row.original),
|
|
486
|
+
},
|
|
487
|
+
subComponent(row),
|
|
488
|
+
);
|
|
464
489
|
},
|
|
465
490
|
[
|
|
466
491
|
page,
|
|
467
492
|
prepareRow,
|
|
468
493
|
rowProps,
|
|
494
|
+
onRowInViewportRef,
|
|
495
|
+
onBottomReachedRef,
|
|
469
496
|
intersectionMargin,
|
|
470
497
|
state,
|
|
471
498
|
onRowClickHandler,
|
|
@@ -477,8 +504,6 @@ const Table = (props) => {
|
|
|
477
504
|
enableVirtualization,
|
|
478
505
|
tableRowRef,
|
|
479
506
|
density,
|
|
480
|
-
onBottomReachedRef,
|
|
481
|
-
onRowInViewportRef,
|
|
482
507
|
],
|
|
483
508
|
);
|
|
484
509
|
let updateStickyState = () => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
3
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
|
4
|
+
type TableExpandableContentProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
virtualItem?: VirtualItem<Element>;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const TableExpandableContentMemoized: React.MemoExoticComponent<PolymorphicForwardRefComponent<"div", TableExpandableContentProps>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, 'TableExpandableContentMemoized', {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return TableExpandableContentMemoized;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_default = require('@swc/helpers/_/_interop_require_default');
|
|
12
|
+
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
13
|
+
const _classnames = _interop_require_default._(require('classnames'));
|
|
14
|
+
const _react = _interop_require_wildcard._(require('react'));
|
|
15
|
+
const _index = require('../../utils/index.js');
|
|
16
|
+
const TableExpandableContent = _react.forwardRef((props, ref) => {
|
|
17
|
+
let { children, className, style, isDisabled, virtualItem, ...rest } = props;
|
|
18
|
+
return _react.createElement(
|
|
19
|
+
_index.Box,
|
|
20
|
+
{
|
|
21
|
+
className: (0, _classnames.default)(
|
|
22
|
+
'iui-table-row',
|
|
23
|
+
'iui-table-expanded-content',
|
|
24
|
+
className,
|
|
25
|
+
),
|
|
26
|
+
style: {
|
|
27
|
+
flex: '0 0 auto',
|
|
28
|
+
minWidth: '100%',
|
|
29
|
+
...(null != virtualItem
|
|
30
|
+
? {
|
|
31
|
+
transform: `translateY(${virtualItem.start}px)`,
|
|
32
|
+
}
|
|
33
|
+
: {}),
|
|
34
|
+
...style,
|
|
35
|
+
},
|
|
36
|
+
'aria-disabled': isDisabled,
|
|
37
|
+
'data-iui-index': virtualItem?.index,
|
|
38
|
+
...(null != virtualItem && {
|
|
39
|
+
'data-iui-virtualizer': 'item',
|
|
40
|
+
}),
|
|
41
|
+
ref: ref,
|
|
42
|
+
...rest,
|
|
43
|
+
},
|
|
44
|
+
children,
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
const TableExpandableContentMemoized = _react.memo(TableExpandableContent);
|
|
@@ -122,24 +122,6 @@ const TableRow = (props) => {
|
|
|
122
122
|
}),
|
|
123
123
|
),
|
|
124
124
|
),
|
|
125
|
-
subComponent &&
|
|
126
|
-
_react.createElement(
|
|
127
|
-
_index.WithCSSTransition,
|
|
128
|
-
{
|
|
129
|
-
in: row.isExpanded,
|
|
130
|
-
},
|
|
131
|
-
_react.createElement(
|
|
132
|
-
_index.Box,
|
|
133
|
-
{
|
|
134
|
-
className: (0, _classnames.default)(
|
|
135
|
-
'iui-table-row',
|
|
136
|
-
'iui-table-expanded-content',
|
|
137
|
-
),
|
|
138
|
-
'aria-disabled': isDisabled,
|
|
139
|
-
},
|
|
140
|
-
subComponent(row),
|
|
141
|
-
),
|
|
142
|
-
),
|
|
143
125
|
);
|
|
144
126
|
};
|
|
145
127
|
const hasAnySelectedSubRow = (row, selectedRowIds) => {
|
|
@@ -10,6 +10,8 @@ Object.defineProperty(exports, 'useColumnDragAndDrop', {
|
|
|
10
10
|
});
|
|
11
11
|
const _reacttable = require('react-table');
|
|
12
12
|
const _styles = require('../../../styles.js');
|
|
13
|
+
const leftClassName = _styles.styles['iui-table-reorder-column-left'];
|
|
14
|
+
const rightClassName = _styles.styles['iui-table-reorder-column-right'];
|
|
13
15
|
const REORDER_ACTIONS = {
|
|
14
16
|
columnDragStart: 'columnDragStart',
|
|
15
17
|
columnDragEnd: 'columnDragEnd',
|
|
@@ -31,20 +33,16 @@ const defaultGetDragAndDropProps =
|
|
|
31
33
|
};
|
|
32
34
|
let setOnDragColumnStyle = (event, position) => {
|
|
33
35
|
let columnElement = event.currentTarget;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
columnElement.classList.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else if ('right' === position)
|
|
45
|
-
columnElement.classList.add(
|
|
46
|
-
_styles.styles['iui-table-reorder-column-right'],
|
|
47
|
-
);
|
|
36
|
+
if ('left' === position) {
|
|
37
|
+
columnElement.classList.remove(rightClassName);
|
|
38
|
+
columnElement.classList.add(leftClassName);
|
|
39
|
+
} else if ('right' === position) {
|
|
40
|
+
columnElement.classList.remove(leftClassName);
|
|
41
|
+
columnElement.classList.add(rightClassName);
|
|
42
|
+
} else {
|
|
43
|
+
columnElement.classList.remove(leftClassName);
|
|
44
|
+
columnElement.classList.remove(rightClassName);
|
|
45
|
+
}
|
|
48
46
|
};
|
|
49
47
|
let reorderColumns = (tableColumns, srcIndex, dstIndex) => {
|
|
50
48
|
let newTableColumns = [...tableColumns];
|
|
@@ -30,6 +30,7 @@ const ThemeProvider = _react.forwardRef((props, forwardedRef) => {
|
|
|
30
30
|
includeCss = 'inherit' === themeProp,
|
|
31
31
|
...rest
|
|
32
32
|
} = props;
|
|
33
|
+
useInertPolyfill();
|
|
33
34
|
let [rootElement, setRootElement] = _react.useState(null);
|
|
34
35
|
let parent = useParentThemeAndContext(rootElement);
|
|
35
36
|
let theme = 'inherit' === themeProp ? parent.theme || 'light' : themeProp;
|
|
@@ -267,3 +268,20 @@ const useIuiDebugRef = () => {
|
|
|
267
268
|
var version, version1;
|
|
268
269
|
_globalThis1.__iui.versions.add(JSON.stringify(_meta.meta));
|
|
269
270
|
};
|
|
271
|
+
const useInertPolyfill = () => {
|
|
272
|
+
let loaded = _react.useRef(false);
|
|
273
|
+
let modulePath =
|
|
274
|
+
'https://cdn.jsdelivr.net/npm/wicg-inert@3.1.2/dist/inert.min.js';
|
|
275
|
+
_react.useEffect(() => {
|
|
276
|
+
(async () => {
|
|
277
|
+
if (
|
|
278
|
+
!HTMLElement.prototype.hasOwnProperty('inert') &&
|
|
279
|
+
!loaded.current &&
|
|
280
|
+
!_index.isUnitTest
|
|
281
|
+
) {
|
|
282
|
+
await new Function('url', 'return import(url)')(modulePath);
|
|
283
|
+
loaded.current = true;
|
|
284
|
+
}
|
|
285
|
+
})();
|
|
286
|
+
}, []);
|
|
287
|
+
};
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -25,10 +25,6 @@ const _classnames = _interop_require_default._(require('classnames'));
|
|
|
25
25
|
const _index = require('../../utils/index.js');
|
|
26
26
|
const _IconButton = require('../Buttons/IconButton.js');
|
|
27
27
|
const _Toaster = require('./Toaster.js');
|
|
28
|
-
const isMotionOk = () =>
|
|
29
|
-
(0, _index.getWindow)()?.matchMedia?.(
|
|
30
|
-
'(prefers-reduced-motion: no-preference)',
|
|
31
|
-
)?.matches;
|
|
32
28
|
const Toast = (props) => {
|
|
33
29
|
let {
|
|
34
30
|
content,
|
|
@@ -52,6 +48,9 @@ const Toast = (props) => {
|
|
|
52
48
|
let [height, setHeight] = _react.useState(0);
|
|
53
49
|
let thisElement = _react.useRef(null);
|
|
54
50
|
let [margin, setMargin] = _react.useState(0);
|
|
51
|
+
let motionOk = (0, _index.useMediaQuery)(
|
|
52
|
+
'(prefers-reduced-motion: no-preference)',
|
|
53
|
+
);
|
|
55
54
|
let marginStyle = () => {
|
|
56
55
|
if ('top' === placementPosition)
|
|
57
56
|
return {
|
|
@@ -116,16 +115,16 @@ const Toast = (props) => {
|
|
|
116
115
|
appear: true,
|
|
117
116
|
unmountOnExit: true,
|
|
118
117
|
onEnter: (node) => {
|
|
119
|
-
if (
|
|
118
|
+
if (motionOk) {
|
|
120
119
|
node.style.transform = 'translateY(15%)';
|
|
121
120
|
node.style.transitionTimingFunction = 'ease';
|
|
122
121
|
}
|
|
123
122
|
},
|
|
124
123
|
onEntered: (node) => {
|
|
125
|
-
if (
|
|
124
|
+
if (motionOk) node.style.transform = 'translateY(0)';
|
|
126
125
|
},
|
|
127
126
|
onExiting: (node) => {
|
|
128
|
-
if (
|
|
127
|
+
if (motionOk) {
|
|
129
128
|
let { translateX, translateY } = calculateOutAnimation(node);
|
|
130
129
|
node.style.transform = animateOutTo
|
|
131
130
|
? `scale(0.9) translate(${translateX}px,${translateY}px)`
|
package/cjs/styles.js
CHANGED
|
@@ -61,6 +61,19 @@ function useShadowRoot(templateRef, { css = '' }) {
|
|
|
61
61
|
let styleSheet = _react.useRef();
|
|
62
62
|
let latestCss = (0, _index.useLatestRef)(css);
|
|
63
63
|
let latestShadowRoot = (0, _index.useLatestRef)(shadowRoot);
|
|
64
|
+
let createStyleSheet = _react.useCallback(
|
|
65
|
+
(shadow) => {
|
|
66
|
+
if (shadow && supportsAdoptedStylesheets) {
|
|
67
|
+
let currentWindow = shadow.ownerDocument.defaultView || globalThis;
|
|
68
|
+
if (styleSheet.current instanceof currentWindow.CSSStyleSheet) return;
|
|
69
|
+
styleSheet.current = new currentWindow.CSSStyleSheet();
|
|
70
|
+
shadow.adoptedStyleSheets.push(styleSheet.current);
|
|
71
|
+
if (latestCss.current)
|
|
72
|
+
styleSheet.current.replaceSync(latestCss.current);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[latestCss],
|
|
76
|
+
);
|
|
64
77
|
(0, _index.useLayoutEffect)(() => {
|
|
65
78
|
let parent = templateRef.current?.parentElement;
|
|
66
79
|
if (!parent) return;
|
|
@@ -72,22 +85,23 @@ function useShadowRoot(templateRef, { css = '' }) {
|
|
|
72
85
|
parent.attachShadow({
|
|
73
86
|
mode: 'open',
|
|
74
87
|
});
|
|
75
|
-
|
|
76
|
-
let currentWindow = shadow.ownerDocument.defaultView || globalThis;
|
|
77
|
-
styleSheet.current = new currentWindow.CSSStyleSheet();
|
|
78
|
-
shadow.adoptedStyleSheets = [styleSheet.current];
|
|
79
|
-
if (latestCss.current)
|
|
80
|
-
styleSheet.current.replaceSync(latestCss.current);
|
|
81
|
-
}
|
|
88
|
+
createStyleSheet(shadow);
|
|
82
89
|
_reactdom.flushSync(() => setShadowRoot(shadow));
|
|
83
90
|
};
|
|
84
91
|
queueMicrotask(() => {
|
|
85
92
|
setupOrReuseShadowRoot();
|
|
86
93
|
});
|
|
87
94
|
return () => void setShadowRoot(null);
|
|
88
|
-
}, [templateRef,
|
|
95
|
+
}, [templateRef, createStyleSheet, latestShadowRoot]);
|
|
89
96
|
(0, _index.useLayoutEffect)(() => {
|
|
90
97
|
if (css && supportsAdoptedStylesheets) styleSheet.current?.replaceSync(css);
|
|
91
98
|
}, [css]);
|
|
99
|
+
_react.useEffect(() => {
|
|
100
|
+
let listener = () => createStyleSheet(latestShadowRoot.current);
|
|
101
|
+
window.addEventListener('appui:reparent', listener);
|
|
102
|
+
return () => {
|
|
103
|
+
window.removeEventListener('appui:reparent', listener);
|
|
104
|
+
};
|
|
105
|
+
}, [createStyleSheet, latestShadowRoot]);
|
|
92
106
|
return shadowRoot;
|
|
93
107
|
}
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, 'useWarningLogger', {
|
|
|
11
11
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
12
12
|
const _react = _interop_require_wildcard._(require('react'));
|
|
13
13
|
const _dev = require('../functions/dev.js');
|
|
14
|
+
const _dom = require('../functions/dom.js');
|
|
14
15
|
const _React = _react;
|
|
15
16
|
const ReactInternals =
|
|
16
17
|
_React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -3,6 +3,7 @@ import type { ButtonProps } from './Button.js';
|
|
|
3
3
|
import { IconButton } from './IconButton.js';
|
|
4
4
|
import type { PolymorphicForwardRefComponent, PortalProps } from '../../utils/index.js';
|
|
5
5
|
import type { Placement } from '@floating-ui/react';
|
|
6
|
+
import type { usePopover } from '../Popover/Popover.js';
|
|
6
7
|
export type SplitButtonProps = ButtonProps & {
|
|
7
8
|
/**
|
|
8
9
|
* Items in the dropdown menu.
|
|
@@ -27,6 +28,10 @@ export type SplitButtonProps = ButtonProps & {
|
|
|
27
28
|
* Passes props to SplitButton menu button.
|
|
28
29
|
*/
|
|
29
30
|
menuButtonProps?: Omit<React.ComponentProps<typeof IconButton>, 'label' | 'size'>;
|
|
31
|
+
/**
|
|
32
|
+
* Props to customize menu behavior.
|
|
33
|
+
*/
|
|
34
|
+
dropdownMenuProps?: Pick<Parameters<typeof usePopover>[0], 'middleware'>;
|
|
30
35
|
} & Pick<PortalProps, 'portal'>;
|
|
31
36
|
/**
|
|
32
37
|
* Split button component with a DropdownMenu.
|
|
@@ -3,7 +3,7 @@ import cx from 'classnames';
|
|
|
3
3
|
import { CarouselContext } from './CarouselContext.js';
|
|
4
4
|
import {
|
|
5
5
|
getBoundedValue,
|
|
6
|
-
|
|
6
|
+
useMediaQuery,
|
|
7
7
|
useMergedRefs,
|
|
8
8
|
useResizeObserver,
|
|
9
9
|
Box,
|
|
@@ -96,18 +96,23 @@ export const CarouselDotsList = React.forwardRef((props, ref) => {
|
|
|
96
96
|
handleSlideChange,
|
|
97
97
|
],
|
|
98
98
|
);
|
|
99
|
+
let motionOk = useMediaQuery('(prefers-reduced-motion: no-preference)');
|
|
99
100
|
React.useEffect(() => {
|
|
100
101
|
let firstDot = listRef.current?.children[firstVisibleDotIndex];
|
|
101
102
|
if (!listRef.current || !firstDot) return;
|
|
102
|
-
let motionOk = getWindow()?.matchMedia(
|
|
103
|
-
'(prefers-reduced-motion: no-preference)',
|
|
104
|
-
)?.matches;
|
|
105
103
|
listRef.current.scrollTo({
|
|
106
104
|
left: firstDot.offsetLeft - listRef.current.offsetLeft,
|
|
107
105
|
behavior: motionOk && !justMounted.current ? 'smooth' : 'auto',
|
|
108
106
|
});
|
|
109
107
|
if (justMounted.current) justMounted.current = false;
|
|
110
|
-
}, [
|
|
108
|
+
}, [
|
|
109
|
+
currentIndex,
|
|
110
|
+
firstVisibleDotIndex,
|
|
111
|
+
motionOk,
|
|
112
|
+
slideCount,
|
|
113
|
+
visibleCount,
|
|
114
|
+
width,
|
|
115
|
+
]);
|
|
111
116
|
let handleKeyDown = (event) => {
|
|
112
117
|
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
113
118
|
return;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useMergedRefs,
|
|
7
7
|
useLayoutEffect,
|
|
8
8
|
Box,
|
|
9
|
+
useMediaQuery,
|
|
9
10
|
} from '../../utils/index.js';
|
|
10
11
|
export const CarouselSlider = React.forwardRef((props, ref) => {
|
|
11
12
|
let { children, className, ...rest } = props;
|
|
@@ -30,13 +31,11 @@ export const CarouselSlider = React.forwardRef((props, ref) => {
|
|
|
30
31
|
}, [items.length, setSlideCount]);
|
|
31
32
|
let sliderRef = React.useRef(null);
|
|
32
33
|
let refs = useMergedRefs(sliderRef, ref);
|
|
34
|
+
let motionOk = useMediaQuery('(prefers-reduced-motion: no-preference)');
|
|
33
35
|
scrollToSlide.current = (slideIndex, { instant } = {}) => {
|
|
34
36
|
isManuallyUpdating.current = true;
|
|
35
37
|
let slideToShow = sliderRef.current?.children.item(slideIndex);
|
|
36
38
|
if (!sliderRef.current || !slideToShow) return;
|
|
37
|
-
let motionOk = getWindow()?.matchMedia(
|
|
38
|
-
'(prefers-reduced-motion: no-preference)',
|
|
39
|
-
)?.matches;
|
|
40
39
|
sliderRef.current.scrollTo({
|
|
41
40
|
left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
|
|
42
41
|
behavior: instant || !motionOk ? 'instant' : 'smooth',
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
3
|
+
import { Slider } from '../Slider/Slider.js';
|
|
4
|
+
type ColorBuilderProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Passes props to the color field.
|
|
7
|
+
*/
|
|
8
|
+
colorFieldProps?: React.ComponentProps<'div'>;
|
|
9
|
+
/**
|
|
10
|
+
* Passes props to the color dot.
|
|
11
|
+
*/
|
|
12
|
+
colorDotProps?: React.ComponentProps<'div'>;
|
|
13
|
+
/**
|
|
14
|
+
* Passes props to the color opacity slider.
|
|
15
|
+
*/
|
|
16
|
+
opacitySliderProps?: React.ComponentProps<typeof Slider>;
|
|
17
|
+
/**
|
|
18
|
+
* Passes props to the color hue slider.
|
|
19
|
+
*/
|
|
20
|
+
hueSliderProps?: React.ComponentProps<typeof Slider>;
|
|
21
|
+
};
|
|
2
22
|
/**
|
|
3
23
|
* `ColorBuilder` consists of two parts:
|
|
4
24
|
* a color canvas to adjust saturation and lightness values,
|
|
5
25
|
* and a set of sliders to adjust hue and alpha values.
|
|
6
26
|
*/
|
|
7
|
-
export declare const ColorBuilder: PolymorphicForwardRefComponent<"div">;
|
|
27
|
+
export declare const ColorBuilder: PolymorphicForwardRefComponent<"div", ColorBuilderProps>;
|
|
28
|
+
export {};
|