@itwin/itwinui-react 3.9.1 → 3.10.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 +23 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/cjs/core/Buttons/Button.js +1 -1
- package/cjs/core/Buttons/IconButton.js +1 -1
- package/cjs/core/Buttons/IdeasButton.js +6 -2
- package/cjs/core/ComboBox/ComboBox.js +1 -1
- package/cjs/core/DropdownMenu/DropdownMenu.js +36 -13
- package/cjs/core/Input/Input.js +1 -1
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +26 -4
- package/cjs/core/Menu/Menu.js +9 -0
- package/cjs/core/Menu/MenuItem.d.ts +12 -0
- package/cjs/core/Menu/MenuItem.js +105 -66
- package/cjs/core/NotificationMarker/NotificationMarker.d.ts +7 -6
- package/cjs/core/Popover/Popover.d.ts +32 -9
- package/cjs/core/Popover/Popover.js +65 -17
- package/cjs/core/Select/Select.js +2 -3
- package/cjs/core/SideNavigation/SideNavigation.js +1 -1
- package/cjs/core/Table/TablePaginator.js +1 -3
- package/cjs/core/Table/columns/selectionColumn.js +10 -1
- package/cjs/core/Table/hooks/useSubRowSelection.js +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.js +53 -17
- package/cjs/core/TimePicker/TimePicker.js +12 -12
- package/cjs/core/ToggleSwitch/ToggleSwitch.d.ts +4 -0
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +2 -2
- package/cjs/utils/components/Portal.d.ts +6 -2
- package/cjs/utils/components/Portal.js +11 -14
- package/cjs/utils/providers/ScopeProvider.d.ts +26 -0
- package/cjs/utils/providers/ScopeProvider.js +77 -0
- package/cjs/utils/providers/index.d.ts +1 -0
- package/cjs/utils/providers/index.js +1 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/esm/core/Buttons/Button.js +1 -1
- package/esm/core/Buttons/IconButton.js +1 -1
- package/esm/core/Buttons/IdeasButton.js +3 -2
- package/esm/core/ComboBox/ComboBox.js +1 -1
- package/esm/core/DropdownMenu/DropdownMenu.js +36 -13
- package/esm/core/Input/Input.js +1 -1
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +26 -4
- package/esm/core/Menu/Menu.js +9 -0
- package/esm/core/Menu/MenuItem.d.ts +12 -0
- package/esm/core/Menu/MenuItem.js +105 -66
- package/esm/core/NotificationMarker/NotificationMarker.d.ts +7 -6
- package/esm/core/Popover/Popover.d.ts +32 -9
- package/esm/core/Popover/Popover.js +68 -20
- package/esm/core/Select/Select.js +2 -3
- package/esm/core/SideNavigation/SideNavigation.js +1 -1
- package/esm/core/Table/TablePaginator.js +2 -4
- package/esm/core/Table/columns/selectionColumn.js +10 -1
- package/esm/core/Table/hooks/useSubRowSelection.js +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.js +54 -18
- package/esm/core/TimePicker/TimePicker.js +12 -12
- package/esm/core/ToggleSwitch/ToggleSwitch.d.ts +4 -0
- package/esm/core/ToggleSwitch/ToggleSwitch.js +2 -2
- package/esm/utils/components/Portal.d.ts +6 -2
- package/esm/utils/components/Portal.js +9 -8
- package/esm/utils/providers/ScopeProvider.d.ts +26 -0
- package/esm/utils/providers/ScopeProvider.js +48 -0
- package/esm/utils/providers/index.d.ts +1 -0
- package/esm/utils/providers/index.js +1 -0
- package/package.json +2 -1
- package/styles.css +1 -1
|
@@ -39,15 +39,29 @@ const Portal_js_1 = require("../../utils/components/Portal.js");
|
|
|
39
39
|
const ThemeProvider_js_1 = require("../ThemeProvider/ThemeProvider.js");
|
|
40
40
|
// ----------------------------------------------------------------------------
|
|
41
41
|
const usePopover = (options) => {
|
|
42
|
-
const { placement = 'bottom-start', visible, onVisibleChange, closeOnOutsideClick, autoUpdateOptions, matchWidth,
|
|
43
|
-
const
|
|
42
|
+
const { placement = 'bottom-start', visible, onVisibleChange, closeOnOutsideClick, autoUpdateOptions, matchWidth, interactions: interactionsProp, role, ...rest } = options;
|
|
43
|
+
const mergedInteractions = {
|
|
44
|
+
...{
|
|
45
|
+
click: true,
|
|
46
|
+
dismiss: true,
|
|
47
|
+
hover: false,
|
|
48
|
+
focus: false,
|
|
49
|
+
listNavigation: undefined,
|
|
50
|
+
},
|
|
51
|
+
...interactionsProp,
|
|
52
|
+
};
|
|
53
|
+
const tree = (0, react_1.useFloatingTree)();
|
|
54
|
+
const middleware = React.useMemo(() => ({ flip: true, shift: true, ...options.middleware }), [options.middleware]);
|
|
44
55
|
const [open, onOpenChange] = (0, index_js_1.useControlledState)(false, visible, onVisibleChange);
|
|
45
56
|
const floating = (0, react_1.useFloating)({
|
|
46
57
|
placement,
|
|
47
58
|
open,
|
|
48
59
|
onOpenChange,
|
|
49
|
-
whileElementsMounted: (
|
|
50
|
-
|
|
60
|
+
whileElementsMounted: React.useMemo(() =>
|
|
61
|
+
// autoUpdate is expensive and should only be called when the popover is open
|
|
62
|
+
open ? (...args) => (0, react_1.autoUpdate)(...args, autoUpdateOptions) : undefined, [autoUpdateOptions, open]),
|
|
63
|
+
...rest,
|
|
64
|
+
middleware: React.useMemo(() => [
|
|
51
65
|
middleware.offset !== undefined && (0, react_1.offset)(middleware.offset),
|
|
52
66
|
middleware.flip && (0, react_1.flip)(),
|
|
53
67
|
middleware.shift && (0, react_1.shift)(),
|
|
@@ -60,18 +74,35 @@ const usePopover = (options) => {
|
|
|
60
74
|
middleware.autoPlacement && (0, react_1.autoPlacement)(),
|
|
61
75
|
middleware.inline && (0, react_1.inline)(),
|
|
62
76
|
middleware.hide && (0, react_1.hide)(),
|
|
63
|
-
].filter(Boolean),
|
|
77
|
+
].filter(Boolean), [matchWidth, middleware]),
|
|
64
78
|
});
|
|
65
79
|
const interactions = (0, react_1.useInteractions)([
|
|
66
|
-
(0, react_1.useClick)(floating.context, {
|
|
67
|
-
|
|
80
|
+
(0, react_1.useClick)(floating.context, {
|
|
81
|
+
enabled: !!mergedInteractions.click,
|
|
82
|
+
...mergedInteractions.click,
|
|
83
|
+
}),
|
|
84
|
+
(0, react_1.useDismiss)(floating.context, {
|
|
85
|
+
enabled: !!mergedInteractions.dismiss,
|
|
86
|
+
outsidePress: closeOnOutsideClick,
|
|
87
|
+
bubbles: tree != null,
|
|
88
|
+
...mergedInteractions.dismiss,
|
|
89
|
+
}),
|
|
68
90
|
(0, react_1.useHover)(floating.context, {
|
|
69
|
-
enabled: !!
|
|
91
|
+
enabled: !!mergedInteractions.hover,
|
|
70
92
|
delay: 100,
|
|
71
|
-
handleClose: (0, react_1.safePolygon)({ buffer: 1 }),
|
|
93
|
+
handleClose: (0, react_1.safePolygon)({ buffer: 1, requireIntent: false }),
|
|
94
|
+
move: false,
|
|
95
|
+
...mergedInteractions.hover,
|
|
96
|
+
}),
|
|
97
|
+
(0, react_1.useFocus)(floating.context, {
|
|
98
|
+
enabled: !!mergedInteractions.focus,
|
|
99
|
+
...mergedInteractions.focus,
|
|
72
100
|
}),
|
|
73
|
-
(0, react_1.useFocus)(floating.context, { enabled: !!trigger.focus }),
|
|
74
101
|
(0, react_1.useRole)(floating.context, { role: 'dialog', enabled: !!role }),
|
|
102
|
+
(0, react_1.useListNavigation)(floating.context, {
|
|
103
|
+
enabled: !!mergedInteractions.listNavigation,
|
|
104
|
+
...mergedInteractions.listNavigation,
|
|
105
|
+
}),
|
|
75
106
|
]);
|
|
76
107
|
const [referenceWidth, setReferenceWidth] = React.useState();
|
|
77
108
|
const getFloatingProps = React.useCallback((userProps) => interactions.getFloatingProps({
|
|
@@ -144,11 +175,28 @@ exports.Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
144
175
|
...popover.getReferenceProps(children.props),
|
|
145
176
|
ref: popover.refs.setReference,
|
|
146
177
|
})),
|
|
147
|
-
popover.open ? (React.createElement(
|
|
148
|
-
React.createElement(
|
|
149
|
-
React.createElement(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
178
|
+
popover.open ? (React.createElement(PopoverPortal, { portal: portal },
|
|
179
|
+
React.createElement(ThemeProvider_js_1.ThemeProvider, { portalContainer: popoverElement },
|
|
180
|
+
React.createElement(DisplayContents, null),
|
|
181
|
+
React.createElement(react_1.FloatingFocusManager, { context: popover.context, modal: false, initialFocus: popover.refs.floating },
|
|
182
|
+
React.createElement(index_js_1.Box, { className: (0, classnames_1.default)({ 'iui-popover-surface': applyBackground }, className), "aria-labelledby": !hasAriaLabel
|
|
183
|
+
? popover.refs.domReference.current?.id
|
|
184
|
+
: undefined, ...popover.getFloatingProps(rest), ref: popoverRef }, content))))) : null));
|
|
185
|
+
});
|
|
186
|
+
// ----------------------------------------------------------------------------
|
|
187
|
+
const PopoverPortal = ({ children, portal = true, }) => {
|
|
188
|
+
const portalTo = (0, Portal_js_1.usePortalTo)(portal);
|
|
189
|
+
return (React.createElement(react_1.FloatingPortal, { root: portalTo },
|
|
190
|
+
React.createElement(DisplayContents, null),
|
|
191
|
+
children));
|
|
192
|
+
};
|
|
193
|
+
// ----------------------------------------------------------------------------
|
|
194
|
+
/** Applies `display: contents` to the parent div. */
|
|
195
|
+
const DisplayContents = React.memo(() => {
|
|
196
|
+
return (React.createElement(index_js_1.ShadowRoot, { css: `
|
|
197
|
+
:host {
|
|
198
|
+
display: contents;
|
|
199
|
+
}
|
|
200
|
+
` },
|
|
201
|
+
React.createElement("slot", null)));
|
|
154
202
|
});
|
|
@@ -228,9 +228,8 @@ const CustomSelect = React.forwardRef((props, forwardedRef) => {
|
|
|
228
228
|
});
|
|
229
229
|
return (React.createElement(React.Fragment, null,
|
|
230
230
|
React.createElement(index_js_1.InputWithIcon, { ...rest, ref: (0, index_js_1.useMergedRefs)(popover.refs.setPositionReference, forwardedRef) },
|
|
231
|
-
React.createElement(SelectButton, { ...popover.getReferenceProps(), tabIndex: 0, role: 'combobox', size: size, status: status, "aria-disabled": disabled ? 'true' : undefined, "aria-autocomplete": 'none', "aria-expanded": isOpen, "aria-haspopup": 'listbox', "aria-controls": `${uid}-menu`, styleType: styleType, ...triggerProps, ref: (0, index_js_1.useMergedRefs)(selectRef, triggerProps?.ref, popover.refs.setReference), className: (0, classnames_1.default)({
|
|
231
|
+
React.createElement(SelectButton, { ...popover.getReferenceProps(), tabIndex: 0, role: 'combobox', size: size, status: status, "aria-disabled": disabled ? 'true' : undefined, "data-iui-disabled": disabled ? 'true' : undefined, "aria-autocomplete": 'none', "aria-expanded": isOpen, "aria-haspopup": 'listbox', "aria-controls": `${uid}-menu`, styleType: styleType, ...triggerProps, ref: (0, index_js_1.useMergedRefs)(selectRef, triggerProps?.ref, popover.refs.setReference), className: (0, classnames_1.default)({
|
|
232
232
|
'iui-placeholder': (!selectedItems || selectedItems.length === 0) && !!placeholder,
|
|
233
|
-
'iui-disabled': disabled,
|
|
234
233
|
}, triggerProps?.className) },
|
|
235
234
|
(!selectedItems || selectedItems.length === 0) && (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-content' }, placeholder)),
|
|
236
235
|
isMultipleEnabled(selectedItems, multiple) ? (React.createElement(MultipleSelectButton, { selectedItems: selectedItems, selectedItemsRenderer: selectedItemRenderer, tagRenderer: tagRenderer })) : (React.createElement(SingleSelectButton, { selectedItem: selectedItems, selectedItemRenderer: selectedItemRenderer }))),
|
|
@@ -258,7 +257,7 @@ const isSingleOnChange = (onChange, multiple) => {
|
|
|
258
257
|
// ----------------------------------------------------------------------------
|
|
259
258
|
const SelectButton = React.forwardRef((props, forwardedRef) => {
|
|
260
259
|
const { size, status, styleType = 'default', ...rest } = props;
|
|
261
|
-
return (React.createElement(index_js_1.Box, { "data-iui-size": size, "data-iui-status": status, "data-iui-variant": styleType !== 'default' ? styleType : undefined, ...rest, ref: forwardedRef, className: (0, classnames_1.default)('iui-select-button', props.className) }));
|
|
260
|
+
return (React.createElement(index_js_1.Box, { "data-iui-size": size, "data-iui-status": status, "data-iui-variant": styleType !== 'default' ? styleType : undefined, ...rest, ref: forwardedRef, className: (0, classnames_1.default)('iui-select-button', 'iui-field', props.className) }));
|
|
262
261
|
});
|
|
263
262
|
// ----------------------------------------------------------------------------
|
|
264
263
|
const SelectEndIcon = React.forwardRef((props, forwardedRef) => {
|
|
@@ -56,7 +56,7 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
56
56
|
React.useEffect(() => {
|
|
57
57
|
_setIsExpanded(isExpanded);
|
|
58
58
|
}, [isExpanded]);
|
|
59
|
-
const ExpandButton = (React.createElement(IconButton_js_1.IconButton, { label: 'Toggle icon labels', "aria-expanded": _isExpanded, className: 'iui-sidenav-button iui-expand', onClick: React.useCallback(() => {
|
|
59
|
+
const ExpandButton = (React.createElement(IconButton_js_1.IconButton, { label: 'Toggle icon labels', "aria-expanded": _isExpanded, className: 'iui-sidenav-button iui-expand', size: 'small', onClick: React.useCallback(() => {
|
|
60
60
|
_setIsExpanded((expanded) => !expanded);
|
|
61
61
|
onExpanderClick?.();
|
|
62
62
|
}, [onExpanderClick]) },
|
|
@@ -81,9 +81,7 @@ const TablePaginator = (props) => {
|
|
|
81
81
|
isMounted.current = true;
|
|
82
82
|
}, [focusedIndex]);
|
|
83
83
|
const buttonSize = size != 'default' ? 'small' : undefined;
|
|
84
|
-
const pageButton = React.useCallback((index, tabIndex = index === focusedIndex ? 0 : -1) => (React.createElement(
|
|
85
|
-
'iui-table-paginator-page-button-small': buttonSize === 'small',
|
|
86
|
-
}), "data-iui-active": index === currentPage, onClick: () => onPageChange(index), "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)), [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
84
|
+
const pageButton = React.useCallback((index, tabIndex = index === focusedIndex ? 0 : -1) => (React.createElement(Button_js_1.Button, { key: index, className: 'iui-table-paginator-page-button', styleType: 'borderless', size: buttonSize, "data-iui-active": index === currentPage, onClick: () => onPageChange(index), "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)), [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
87
85
|
const totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
88
86
|
const pageList = React.useMemo(() => new Array(totalPagesCount)
|
|
89
87
|
.fill(null)
|
|
@@ -65,7 +65,16 @@ const SelectionColumn = (props = {}) => {
|
|
|
65
65
|
, checked: checked && !disabled, indeterminate: indeterminate, disabled: disabled, onChange: () => toggleAllRowsSelected(!rows.some((row) => row.isSelected)) }));
|
|
66
66
|
},
|
|
67
67
|
Cell: ({ row }) => (React.createElement(Checkbox_js_1.Checkbox, { ...row.getToggleRowSelectedProps(), style: {}, title: '' // Removes default title that comes from react-table
|
|
68
|
-
, disabled: isDisabled?.(row.original), onClick: (e) => e.stopPropagation()
|
|
68
|
+
, disabled: isDisabled?.(row.original), onClick: (e) => e.stopPropagation(), onChange: () => {
|
|
69
|
+
if (row.subRows.length > 0) {
|
|
70
|
+
//This code ignores any sub-rows that are not currently available(i.e disabled or filtered out).
|
|
71
|
+
//If all available sub-rows are selected, then it deselects them all, otherwise it selects them all.
|
|
72
|
+
row.toggleRowSelected(!row.subRows.every((subRow) => subRow.isSelected || isDisabled?.(subRow.original)));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
row.toggleRowSelected();
|
|
76
|
+
}
|
|
77
|
+
} })),
|
|
69
78
|
cellRenderer: (props) => (React.createElement(index_js_1.DefaultCell, { ...props, isDisabled: (rowData) => !!isDisabled?.(rowData) })),
|
|
70
79
|
};
|
|
71
80
|
};
|
|
@@ -38,7 +38,7 @@ const useInstance = (instance) => {
|
|
|
38
38
|
const selectedFlatRows = [];
|
|
39
39
|
const setSelectionState = (row, selectedRowIds) => {
|
|
40
40
|
let isSomeSubRowsSelected = false;
|
|
41
|
-
row.
|
|
41
|
+
row.initialSubRows.forEach((subRow) => {
|
|
42
42
|
setSelectionState(subRow, selectedRowIds);
|
|
43
43
|
if (subRow.isSelected || subRow.isSomeSelected) {
|
|
44
44
|
isSomeSubRowsSelected = true;
|
|
@@ -37,6 +37,10 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
37
37
|
const index_js_1 = require("../../utils/index.js");
|
|
38
38
|
const ThemeContext_js_1 = require("./ThemeContext.js");
|
|
39
39
|
const Toaster_js_1 = require("../Toast/Toaster.js");
|
|
40
|
+
const jotai_1 = require("jotai");
|
|
41
|
+
// ----------------------------------------------------------------------------
|
|
42
|
+
const ownerDocumentAtom = (0, jotai_1.atom)(undefined);
|
|
43
|
+
// ----------------------------------------------------------------------------
|
|
40
44
|
/**
|
|
41
45
|
* This component provides global state and applies theme to the entire tree
|
|
42
46
|
* that it is wrapping around.
|
|
@@ -74,26 +78,21 @@ exports.ThemeProvider = React.forwardRef((props, forwardedRef) => {
|
|
|
74
78
|
themeOptions.applyBackground ?? (themeOptions.applyBackground = !parent.theme);
|
|
75
79
|
// default inherit highContrast option from parent if also inheriting base theme
|
|
76
80
|
themeOptions.highContrast ?? (themeOptions.highContrast = themeProp === 'inherit' ? parent.highContrast : undefined);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* or inherit `portalContainer` from context (if also inheriting theme).
|
|
80
|
-
*/
|
|
81
|
-
const portaledPortalContainer = portalContainerProp ||
|
|
82
|
-
(themeProp === 'inherit' ? parent.context?.portalContainer : undefined);
|
|
83
|
-
const [portalContainer, setPortalContainer] = (0, index_js_1.useControlledState)(null, portaledPortalContainer);
|
|
84
|
-
const contextValue = React.useMemo(() => ({ theme, themeOptions, portalContainer }),
|
|
81
|
+
const [portalContainerFromParent] = (0, index_js_1.useScopedAtom)(index_js_1.portalContainerAtom);
|
|
82
|
+
const contextValue = React.useMemo(() => ({ theme, themeOptions }),
|
|
85
83
|
// we do include all dependencies below, but we want to stringify the objects as they could be different on each render
|
|
86
84
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
|
-
[theme, JSON.stringify(themeOptions)
|
|
88
|
-
return (React.createElement(index_js_1.
|
|
89
|
-
React.createElement(
|
|
90
|
-
|
|
91
|
-
React.createElement(Root, { theme: theme, themeOptions: themeOptions, ref: (0, index_js_1.useMergedRefs)(forwardedRef, setRootElement), ...rest },
|
|
85
|
+
[theme, JSON.stringify(themeOptions)]);
|
|
86
|
+
return (React.createElement(index_js_1.ScopeProvider, null,
|
|
87
|
+
React.createElement(index_js_1.HydrationProvider, null,
|
|
88
|
+
React.createElement(ThemeContext_js_1.ThemeContext.Provider, { value: contextValue },
|
|
92
89
|
React.createElement(Toaster_js_1.ToastProvider, null,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
includeCss && rootElement ? (React.createElement(FallbackStyles, { root: rootElement })) : null,
|
|
91
|
+
React.createElement(Root, { theme: theme, themeOptions: themeOptions, ref: (0, index_js_1.useMergedRefs)(forwardedRef, setRootElement), ...rest },
|
|
92
|
+
children,
|
|
93
|
+
React.createElement(PortalContainer, { portalContainerProp: portalContainerProp, portalContainerFromParent: portalContainerFromParent, isInheritingTheme: themeProp === 'inherit' })))))));
|
|
96
94
|
});
|
|
95
|
+
exports.ThemeProvider.displayName = 'ThemeProvider';
|
|
97
96
|
// ----------------------------------------------------------------------------
|
|
98
97
|
const Root = React.forwardRef((props, forwardedRef) => {
|
|
99
98
|
const { theme, children, themeOptions, className, ...rest } = props;
|
|
@@ -102,7 +101,10 @@ const Root = React.forwardRef((props, forwardedRef) => {
|
|
|
102
101
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
103
102
|
const shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
|
|
104
103
|
const shouldApplyBackground = themeOptions?.applyBackground;
|
|
105
|
-
|
|
104
|
+
const setOwnerDocument = (0, index_js_1.useScopedSetAtom)(ownerDocumentAtom);
|
|
105
|
+
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-root', { 'iui-root-background': shouldApplyBackground }, className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: (0, index_js_1.useMergedRefs)(forwardedRef, (el) => {
|
|
106
|
+
setOwnerDocument(el?.ownerDocument);
|
|
107
|
+
}), ...rest }, children));
|
|
106
108
|
});
|
|
107
109
|
// ----------------------------------------------------------------------------
|
|
108
110
|
/**
|
|
@@ -150,6 +152,40 @@ const useParentThemeAndContext = (rootElement) => {
|
|
|
150
152
|
};
|
|
151
153
|
};
|
|
152
154
|
// ----------------------------------------------------------------------------
|
|
155
|
+
/**
|
|
156
|
+
* Creates a new portal container if necessary, or reuses the parent portal container.
|
|
157
|
+
*
|
|
158
|
+
* Updates `portalContainerAtom` with the correct portal container.
|
|
159
|
+
*/
|
|
160
|
+
const PortalContainer = React.memo(({ portalContainerProp, portalContainerFromParent, isInheritingTheme, }) => {
|
|
161
|
+
const [ownerDocument] = (0, index_js_1.useScopedAtom)(ownerDocumentAtom);
|
|
162
|
+
const [portalContainer, setPortalContainer] = (0, index_js_1.useScopedAtom)(index_js_1.portalContainerAtom);
|
|
163
|
+
// bail if not hydrated, because portals don't work on server
|
|
164
|
+
const isHydrated = (0, index_js_1.useHydration)() === 'hydrated';
|
|
165
|
+
if (!isHydrated) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
// Create a new portal container only if necessary:
|
|
169
|
+
// - not inheriting theme
|
|
170
|
+
// - no parent portal container to portal into
|
|
171
|
+
// - parent portal container is in a different window (#2006)
|
|
172
|
+
if (!portalContainerProp && // bail if portalContainerProp is set, because it takes precedence
|
|
173
|
+
(!isInheritingTheme ||
|
|
174
|
+
!portalContainerFromParent ||
|
|
175
|
+
portalContainerFromParent.ownerDocument !== ownerDocument)) {
|
|
176
|
+
return (React.createElement("div", { style: { display: 'contents' }, ref: setPortalContainer },
|
|
177
|
+
React.createElement(Toaster_js_1.Toaster, null)));
|
|
178
|
+
}
|
|
179
|
+
const portalTarget = portalContainerProp || portalContainerFromParent;
|
|
180
|
+
// Synchronize atom with the correct portal container if necessary.
|
|
181
|
+
if (portalTarget && portalTarget !== portalContainer) {
|
|
182
|
+
setPortalContainer(portalTarget);
|
|
183
|
+
}
|
|
184
|
+
return portalTarget
|
|
185
|
+
? ReactDOM.createPortal(React.createElement(Toaster_js_1.Toaster, null), portalTarget)
|
|
186
|
+
: null;
|
|
187
|
+
});
|
|
188
|
+
// ----------------------------------------------------------------------------
|
|
153
189
|
/**
|
|
154
190
|
* When `@itwin/itwinui-react/styles.css` is not imported, we will attempt to
|
|
155
191
|
* dynamically import it (if possible) and fallback to loading it from a CDN.
|
|
@@ -236,16 +236,6 @@ exports.TimePicker = React.forwardRef((props, forwardedRef) => {
|
|
|
236
236
|
const TimePickerColumn = (props) => {
|
|
237
237
|
const { data, onFocusChange, onSelectChange, isSameFocused, isSameSelected, setFocus = false, valueRenderer, precision = 'minutes', className = 'iui-time', } = props;
|
|
238
238
|
const needFocus = React.useRef(setFocus);
|
|
239
|
-
// Used to focus row only when changed (keyboard navigation)
|
|
240
|
-
// e.g. without this on every rerender it would be focused
|
|
241
|
-
React.useEffect(() => {
|
|
242
|
-
if (needFocus.current) {
|
|
243
|
-
needFocus.current = false;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
const scrollIntoView = (ref, isSame) => {
|
|
247
|
-
isSame && ref?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
248
|
-
};
|
|
249
239
|
const handleTimeKeyDown = (event, maxValue, onFocus, onSelect, currentValue) => {
|
|
250
240
|
if (event.altKey) {
|
|
251
241
|
return;
|
|
@@ -283,8 +273,18 @@ const TimePickerColumn = (props) => {
|
|
|
283
273
|
}, className: (0, classnames_1.default)({
|
|
284
274
|
'iui-selected': isSameSelected(value),
|
|
285
275
|
}), key: index, tabIndex: isSameFocus ? 0 : undefined, ref: (ref) => {
|
|
286
|
-
|
|
287
|
-
|
|
276
|
+
if (!ref || !isSameFocus) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
// Move focus/scroll in the next task, after the DOM has stabilized.
|
|
280
|
+
// This gives it priority over other conflicting logic (e.g. from floating-ui/Popover).
|
|
281
|
+
setTimeout(() => {
|
|
282
|
+
ref.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
283
|
+
if (needFocus.current) {
|
|
284
|
+
ref.focus();
|
|
285
|
+
needFocus.current = false;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
288
|
}, onClick: () => {
|
|
289
289
|
onSelectChange(value);
|
|
290
290
|
} }, valueRenderer(value, precision)));
|
|
@@ -53,7 +53,7 @@ const index_js_1 = require("../../utils/index.js");
|
|
|
53
53
|
* <ToggleSwitch label='With icon toggle' icon={<svg viewBox='0 0 16 16'><path d='M1 1v14h14V1H1zm13 1.7v10.6L8.7 8 14 2.7zM8 7.3L2.7 2h10.6L8 7.3zm-.7.7L2 13.3V2.7L7.3 8zm.7.7l5.3 5.3H2.7L8 8.7z' /></svg>} />
|
|
54
54
|
*/
|
|
55
55
|
exports.ToggleSwitch = React.forwardRef((props, ref) => {
|
|
56
|
-
const { disabled = false, labelPosition = 'right', label, className, style, size = 'default', icon: iconProp, ...rest } = props;
|
|
56
|
+
const { disabled = false, labelPosition = 'right', label, className, style, size = 'default', labelProps = {}, icon: iconProp, ...rest } = props;
|
|
57
57
|
// Disallow custom icon for small size, but keep the default checkmark when prop is not passed.
|
|
58
58
|
const shouldShowIcon = iconProp === undefined || (iconProp !== null && size !== 'small');
|
|
59
59
|
return (React.createElement(index_js_1.Box, { as: label ? 'label' : 'div', className: (0, classnames_1.default)('iui-toggle-switch-wrapper', {
|
|
@@ -63,5 +63,5 @@ exports.ToggleSwitch = React.forwardRef((props, ref) => {
|
|
|
63
63
|
}, className), "data-iui-size": size, style: style },
|
|
64
64
|
React.createElement(index_js_1.Box, { as: 'input', className: 'iui-toggle-switch', type: 'checkbox', role: 'switch', disabled: disabled, ref: ref, ...rest }),
|
|
65
65
|
shouldShowIcon && (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-toggle-switch-icon', "aria-hidden": true }, iconProp || React.createElement(index_js_1.SvgCheckmark, null))),
|
|
66
|
-
label && (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-toggle-switch-label' }, label))));
|
|
66
|
+
label && (React.createElement(index_js_1.Box, { as: 'span', ...labelProps, className: (0, classnames_1.default)('iui-toggle-switch-label', labelProps?.className) }, label))));
|
|
67
67
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
export declare const portalContainerAtom: import("jotai").PrimitiveAtom<HTMLElement | undefined> & {
|
|
3
|
+
init: HTMLElement | undefined;
|
|
4
|
+
};
|
|
2
5
|
export type PortalProps = {
|
|
3
6
|
/**
|
|
4
7
|
* Where should the element be portaled to?
|
|
5
8
|
*
|
|
6
|
-
* If true, it will portal into nearest
|
|
9
|
+
* If true, it will portal into nearest ThemeProvider's portalContainer.
|
|
7
10
|
*
|
|
8
11
|
* If false, it will not be portaled.
|
|
9
12
|
*
|
|
@@ -20,7 +23,7 @@ export type PortalProps = {
|
|
|
20
23
|
/**
|
|
21
24
|
* Helper component that portals children according to the following conditions:
|
|
22
25
|
* - renders null on server
|
|
23
|
-
* - if `portal` is set to true, renders into nearest
|
|
26
|
+
* - if `portal` is set to true, renders into nearest ThemeProvider's portalContainer
|
|
24
27
|
* - if `portal` is set to false, renders as-is without portal
|
|
25
28
|
* - otherwise renders into `portal.to` (can be an element or a function)
|
|
26
29
|
* - If `to`/`to()` === `null`/`undefined`, the default behavior will be used (i.e. as if `portal` is not passed).
|
|
@@ -29,3 +32,4 @@ export type PortalProps = {
|
|
|
29
32
|
* @private
|
|
30
33
|
*/
|
|
31
34
|
export declare const Portal: (props: React.PropsWithChildren<PortalProps>) => React.ReactNode;
|
|
35
|
+
export declare const usePortalTo: (portal: NonNullable<PortalProps['portal']>) => HTMLElement | null | undefined;
|
|
@@ -23,21 +23,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Portal = void 0;
|
|
27
|
-
/*---------------------------------------------------------------------------------------------
|
|
28
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
-
*--------------------------------------------------------------------------------------------*/
|
|
31
|
-
const React = __importStar(require("react"));
|
|
26
|
+
exports.usePortalTo = exports.Portal = exports.portalContainerAtom = void 0;
|
|
32
27
|
const ReactDOM = __importStar(require("react-dom"));
|
|
33
|
-
const ThemeContext_js_1 = require("../../core/ThemeProvider/ThemeContext.js");
|
|
34
|
-
const dom_js_1 = require("../functions/dom.js");
|
|
35
28
|
const useIsClient_js_1 = require("../hooks/useIsClient.js");
|
|
29
|
+
const jotai_1 = require("jotai");
|
|
30
|
+
const ScopeProvider_js_1 = require("../providers/ScopeProvider.js");
|
|
31
|
+
// ----------------------------------------------------------------------------
|
|
32
|
+
exports.portalContainerAtom = (0, jotai_1.atom)(undefined);
|
|
36
33
|
// ----------------------------------------------------------------------------
|
|
37
34
|
/**
|
|
38
35
|
* Helper component that portals children according to the following conditions:
|
|
39
36
|
* - renders null on server
|
|
40
|
-
* - if `portal` is set to true, renders into nearest
|
|
37
|
+
* - if `portal` is set to true, renders into nearest ThemeProvider's portalContainer
|
|
41
38
|
* - if `portal` is set to false, renders as-is without portal
|
|
42
39
|
* - otherwise renders into `portal.to` (can be an element or a function)
|
|
43
40
|
* - If `to`/`to()` === `null`/`undefined`, the default behavior will be used (i.e. as if `portal` is not passed).
|
|
@@ -48,7 +45,7 @@ const useIsClient_js_1 = require("../hooks/useIsClient.js");
|
|
|
48
45
|
const Portal = (props) => {
|
|
49
46
|
const { portal = true, children } = props;
|
|
50
47
|
const isClient = (0, useIsClient_js_1.useIsClient)();
|
|
51
|
-
const portalTo = usePortalTo(portal);
|
|
48
|
+
const portalTo = (0, exports.usePortalTo)(portal);
|
|
52
49
|
if (!isClient) {
|
|
53
50
|
return null;
|
|
54
51
|
}
|
|
@@ -57,11 +54,11 @@ const Portal = (props) => {
|
|
|
57
54
|
exports.Portal = Portal;
|
|
58
55
|
// ----------------------------------------------------------------------------
|
|
59
56
|
const usePortalTo = (portal) => {
|
|
60
|
-
const
|
|
61
|
-
const defaultPortalTo = themeInfo?.portalContainer ?? (0, dom_js_1.getDocument)()?.body;
|
|
57
|
+
const [portalContainer] = (0, ScopeProvider_js_1.useScopedAtom)(exports.portalContainerAtom);
|
|
62
58
|
if (typeof portal === 'boolean') {
|
|
63
|
-
return portal ?
|
|
59
|
+
return portal ? portalContainer : null;
|
|
64
60
|
}
|
|
65
61
|
const portalTo = typeof portal.to === 'function' ? portal.to() : portal.to;
|
|
66
|
-
return portalTo ??
|
|
62
|
+
return portalTo ?? portalContainer;
|
|
67
63
|
};
|
|
64
|
+
exports.usePortalTo = usePortalTo;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Atom, WritableAtom } from 'jotai';
|
|
3
|
+
/**
|
|
4
|
+
* Provider that creates a fresh, isolated jotai store for its children.
|
|
5
|
+
*
|
|
6
|
+
* Should be used with `useScopedAtom` and/or `useScopedSetAtom`.
|
|
7
|
+
*
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export declare const ScopeProvider: ({ children }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Wrapper over `useAtom` that uses the store from the nearest `ScopeProvider`.
|
|
15
|
+
*
|
|
16
|
+
* If the atom is not set in the current store, it will recursively look in the parent store(s).
|
|
17
|
+
* This is only useful for initial values. Future updates to the parent will not be reflected.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export declare const useScopedAtom: <T>(atom: Atom<T>) => readonly [Awaited<T>, (...args: unknown[]) => unknown];
|
|
22
|
+
/**
|
|
23
|
+
* Wrapper over `useSetAtom` that uses the store from the nearest `ScopeProvider`.
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export declare const useScopedSetAtom: <T>(atom: WritableAtom<T, unknown[], unknown>) => (...args: unknown[]) => unknown;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useScopedSetAtom = exports.useScopedAtom = exports.ScopeProvider = void 0;
|
|
27
|
+
/*---------------------------------------------------------------------------------------------
|
|
28
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
+
*--------------------------------------------------------------------------------------------*/
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
const jotai_1 = require("jotai");
|
|
33
|
+
const ScopeContext = React.createContext({
|
|
34
|
+
store: (0, jotai_1.createStore)(),
|
|
35
|
+
parentStore: null,
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Provider that creates a fresh, isolated jotai store for its children.
|
|
39
|
+
*
|
|
40
|
+
* Should be used with `useScopedAtom` and/or `useScopedSetAtom`.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
const ScopeProvider = ({ children }) => {
|
|
45
|
+
const store = React.useMemo(() => (0, jotai_1.createStore)(), []);
|
|
46
|
+
const parentStore = React.useContext(ScopeContext).store;
|
|
47
|
+
return (React.createElement(ScopeContext.Provider, { value: React.useMemo(() => ({ store, parentStore }), [store, parentStore]) }, children));
|
|
48
|
+
};
|
|
49
|
+
exports.ScopeProvider = ScopeProvider;
|
|
50
|
+
/**
|
|
51
|
+
* Wrapper over `useAtom` that uses the store from the nearest `ScopeProvider`.
|
|
52
|
+
*
|
|
53
|
+
* If the atom is not set in the current store, it will recursively look in the parent store(s).
|
|
54
|
+
* This is only useful for initial values. Future updates to the parent will not be reflected.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
const useScopedAtom = (atom) => {
|
|
59
|
+
const { store, parentStore } = React.useContext(ScopeContext);
|
|
60
|
+
const setAtom = (0, exports.useScopedSetAtom)(atom);
|
|
61
|
+
const value = (0, jotai_1.useAtomValue)(atom, { store });
|
|
62
|
+
const inheritedValue = (0, jotai_1.useAtomValue)(atom, { store: parentStore || store });
|
|
63
|
+
if (value == undefined && inheritedValue != undefined) {
|
|
64
|
+
setAtom(inheritedValue);
|
|
65
|
+
}
|
|
66
|
+
return [value, setAtom];
|
|
67
|
+
};
|
|
68
|
+
exports.useScopedAtom = useScopedAtom;
|
|
69
|
+
/**
|
|
70
|
+
* Wrapper over `useSetAtom` that uses the store from the nearest `ScopeProvider`.
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
const useScopedSetAtom = (atom) => {
|
|
74
|
+
const { store } = React.useContext(ScopeContext);
|
|
75
|
+
return (0, jotai_1.useSetAtom)(atom, { store });
|
|
76
|
+
};
|
|
77
|
+
exports.useScopedSetAtom = useScopedSetAtom;
|
|
@@ -19,3 +19,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
20
20
|
*--------------------------------------------------------------------------------------------*/
|
|
21
21
|
__exportStar(require("./HydrationProvider.js"), exports);
|
|
22
|
+
__exportStar(require("./ScopeProvider.js"), exports);
|
|
@@ -73,10 +73,9 @@ const ListItem = ({ item, isActive, }) => {
|
|
|
73
73
|
const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(SvgChevronRight, null)));
|
|
74
74
|
// ----------------------------------------------------------------------------
|
|
75
75
|
const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
|
|
76
|
-
const { children
|
|
76
|
+
const { children, className, ...rest } = props;
|
|
77
77
|
const defaultAs = !!props.href ? Anchor : !!props.onClick ? 'button' : 'span';
|
|
78
|
-
|
|
79
|
-
return (React.createElement(Box, { as: defaultAs, className: cx('iui-breadcrumbs-content', className), ref: forwardedRef, ...rest }, children));
|
|
78
|
+
return (React.createElement(Button, { as: defaultAs, className: cx('iui-breadcrumbs-content', className), styleType: 'borderless', ref: forwardedRef, ...rest }, children));
|
|
80
79
|
});
|
|
81
80
|
BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
|
|
82
81
|
// ----------------------------------------------------------------------------
|
|
@@ -16,7 +16,7 @@ import { Box, ButtonBase } from '../../utils/index.js';
|
|
|
16
16
|
*/
|
|
17
17
|
export const Button = React.forwardRef((props, ref) => {
|
|
18
18
|
const { children, className, size, styleType = 'default', startIcon, endIcon, labelProps, startIconProps, endIconProps, stretched, ...rest } = props;
|
|
19
|
-
return (React.createElement(ButtonBase, { ref: ref, className: cx('iui-button', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, ...rest, style: {
|
|
19
|
+
return (React.createElement(ButtonBase, { ref: ref, className: cx('iui-button', 'iui-field', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, ...rest, style: {
|
|
20
20
|
'--_iui-width': stretched ? '100%' : undefined,
|
|
21
21
|
...props.style,
|
|
22
22
|
} },
|
|
@@ -18,7 +18,7 @@ import { ButtonGroupContext } from '../ButtonGroup/ButtonGroup.js';
|
|
|
18
18
|
export const IconButton = React.forwardRef((props, ref) => {
|
|
19
19
|
const { isActive, children, styleType = 'default', size, className, label, iconProps, labelProps, ...rest } = props;
|
|
20
20
|
const buttonGroupOrientation = React.useContext(ButtonGroupContext);
|
|
21
|
-
const button = (React.createElement(ButtonBase, { ref: ref, className: cx('iui-button', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, "data-iui-active": isActive, "aria-pressed": isActive, ...rest },
|
|
21
|
+
const button = (React.createElement(ButtonBase, { ref: ref, className: cx('iui-button', 'iui-field', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, "data-iui-active": isActive, "aria-pressed": isActive, ...rest },
|
|
22
22
|
React.createElement(Box, { as: 'span', "aria-hidden": true, ...iconProps, className: cx('iui-button-icon', iconProps?.className) }, children),
|
|
23
23
|
label ? React.createElement(VisuallyHidden, null, label) : null));
|
|
24
24
|
return label ? (React.createElement(Tooltip, { placement: buttonGroupOrientation === 'vertical' ? 'right' : 'top', ...labelProps, content: label, ariaStrategy: 'none' }, button)) : (button);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import cx from 'classnames';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { SvgSmileyHappy } from '../../utils/index.js';
|
|
7
8
|
import { Button } from './Button.js';
|
|
@@ -11,6 +12,6 @@ import { Button } from './Button.js';
|
|
|
11
12
|
* <IdeasButton />
|
|
12
13
|
*/
|
|
13
14
|
export const IdeasButton = React.forwardRef((props, ref) => {
|
|
14
|
-
const { feedbackLabel = 'Feedback', onClick, ...rest } = props;
|
|
15
|
-
return (React.createElement(Button, { ref: ref, "data-iui-variant": '
|
|
15
|
+
const { feedbackLabel = 'Feedback', className, onClick, ...rest } = props;
|
|
16
|
+
return (React.createElement(Button, { ref: ref, className: cx('iui-button-idea', className), "data-iui-variant": 'high-visibility', onClick: onClick, startIcon: React.createElement(SvgSmileyHappy, { "aria-hidden": true }), ...rest }, feedbackLabel));
|
|
16
17
|
});
|
|
@@ -282,7 +282,7 @@ export const ComboBox = React.forwardRef((props, forwardedRef) => {
|
|
|
282
282
|
onVisibleChange: (open) => (open ? show() : hide()),
|
|
283
283
|
matchWidth: true,
|
|
284
284
|
closeOnOutsideClick: true,
|
|
285
|
-
|
|
285
|
+
interactions: { click: false, focus: true },
|
|
286
286
|
});
|
|
287
287
|
return (React.createElement(ComboBoxRefsContext.Provider, { value: { inputRef, menuRef, optionsExtraInfoRef } },
|
|
288
288
|
React.createElement(ComboBoxActionContext.Provider, { value: dispatch },
|