@itwin/itwinui-react 3.0.0-dev.7 → 3.0.0-dev.9
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 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +7 -19
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
- package/cjs/core/Buttons/SplitButton/SplitButton.js +54 -29
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBox.js +33 -25
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxInput.js +29 -21
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenu.js +73 -93
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +5 -3
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +40 -5
- package/cjs/core/Dialog/Dialog.js +10 -16
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/DropdownMenu/DropdownMenu.d.ts +6 -5
- package/cjs/core/DropdownMenu/DropdownMenu.js +59 -55
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
- package/cjs/core/Header/HeaderDropdownButton.js +1 -2
- package/cjs/core/Header/HeaderSplitButton.js +2 -2
- package/cjs/core/Input/Input.d.ts +4 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
- package/cjs/core/InputGrid/InputGrid.js +39 -0
- package/cjs/core/InputGrid/index.d.ts +3 -0
- package/cjs/core/InputGrid/index.js +15 -0
- package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
- package/cjs/core/InputGroup/InputGroup.js +35 -9
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
- package/cjs/core/InputWithDecorations/index.d.ts +3 -0
- package/cjs/core/InputWithDecorations/index.js +15 -0
- package/cjs/core/Label/Label.d.ts +5 -0
- package/cjs/core/Label/Label.js +2 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/cjs/core/LabeledInput/LabeledInput.js +52 -29
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
- package/cjs/core/Menu/Menu.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +2 -2
- package/cjs/core/Menu/MenuDivider.d.ts +2 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.js +78 -55
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +9 -5
- package/cjs/core/Select/Select.js +81 -99
- package/cjs/core/SideNavigation/SideNavigation.js +2 -0
- package/cjs/core/Slider/Thumb.js +1 -0
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Table/SubRowExpander.js +2 -0
- package/cjs/core/Table/columns/actionColumn.js +3 -7
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +56 -33
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Table/filters/FilterToggle.js +3 -2
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +139 -15
- package/cjs/core/Tile/Tile.js +128 -38
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +20 -4
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -117
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/index.d.ts +3 -1
- package/cjs/core/index.js +28 -5
- package/cjs/core/utils/components/Icon.d.ts +5 -0
- package/cjs/core/utils/components/Icon.js +8 -1
- package/cjs/core/utils/components/InputContainer.d.ts +4 -5
- package/cjs/core/utils/components/InputContainer.js +21 -37
- package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputFlexContainer.js +3 -1
- package/cjs/core/utils/components/Popover.d.ts +113 -27
- package/cjs/core/utils/components/Popover.js +156 -118
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/react.d.ts +8 -0
- package/cjs/core/utils/functions/react.js +40 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -1
- package/cjs/core/utils/hooks/index.js +1 -1
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/styles.js +10 -31
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +8 -24
- package/esm/core/Buttons/IconButton/IconButton.js +25 -40
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
- package/esm/core/Buttons/SplitButton/SplitButton.js +61 -28
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.d.ts +2 -2
- package/esm/core/ComboBox/ComboBox.js +34 -25
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxInput.js +22 -21
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenu.js +67 -87
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +5 -3
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +25 -5
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/DropdownMenu/DropdownMenu.d.ts +6 -5
- package/esm/core/DropdownMenu/DropdownMenu.js +64 -56
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
- package/esm/core/Header/HeaderDropdownButton.js +1 -2
- package/esm/core/Header/HeaderSplitButton.js +2 -2
- package/esm/core/Input/Input.d.ts +4 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/InputGrid/InputGrid.d.ts +25 -0
- package/esm/core/InputGrid/InputGrid.js +35 -0
- package/esm/core/InputGrid/index.d.ts +3 -0
- package/esm/core/InputGrid/index.js +6 -0
- package/esm/core/InputGroup/InputGroup.d.ts +13 -0
- package/esm/core/InputGroup/InputGroup.js +34 -10
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
- package/esm/core/InputWithDecorations/index.d.ts +3 -0
- package/esm/core/InputWithDecorations/index.js +6 -0
- package/esm/core/Label/Label.d.ts +5 -0
- package/esm/core/Label/Label.js +2 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/esm/core/LabeledInput/LabeledInput.js +53 -29
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
- package/esm/core/Menu/Menu.d.ts +1 -1
- package/esm/core/Menu/Menu.js +8 -3
- package/esm/core/Menu/MenuDivider.d.ts +2 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Menu/MenuItem.js +85 -52
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +9 -5
- package/esm/core/Select/Select.js +81 -96
- package/esm/core/SideNavigation/SideNavigation.js +2 -0
- package/esm/core/Slider/Thumb.js +1 -0
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Table/SubRowExpander.js +2 -0
- package/esm/core/Table/columns/actionColumn.js +3 -7
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +56 -33
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Table/filters/FilterToggle.js +3 -2
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
- package/esm/core/Tile/Tile.d.ts +139 -15
- package/esm/core/Tile/Tile.js +128 -38
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +21 -4
- package/esm/core/Tooltip/Tooltip.d.ts +35 -28
- package/esm/core/Tooltip/Tooltip.js +119 -116
- package/esm/core/TransferList/TransferList.js +4 -9
- package/esm/core/index.d.ts +3 -1
- package/esm/core/index.js +3 -0
- package/esm/core/utils/components/Icon.d.ts +5 -0
- package/esm/core/utils/components/Icon.js +8 -1
- package/esm/core/utils/components/InputContainer.d.ts +4 -5
- package/esm/core/utils/components/InputContainer.js +21 -32
- package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/esm/core/utils/components/InputFlexContainer.js +3 -1
- package/esm/core/utils/components/Popover.d.ts +113 -27
- package/esm/core/utils/components/Popover.js +175 -118
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/react.d.ts +8 -0
- package/esm/core/utils/functions/react.js +35 -0
- package/esm/core/utils/hooks/index.d.ts +1 -1
- package/esm/core/utils/hooks/index.js +1 -1
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/styles.js +10 -31
- package/package.json +3 -5
- package/styles.css +23 -20
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
- package/cjs/core/ComboBox/ComboBoxDropdown.js +0 -48
- package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
- package/esm/core/ComboBox/ComboBoxDropdown.js +0 -42
- package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
|
@@ -10,31 +10,30 @@ const React = tslib_1.__importStar(require('react'));
|
|
|
10
10
|
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
11
11
|
const react_1 = require('@floating-ui/react');
|
|
12
12
|
const index_js_1 = require('../utils/index.js');
|
|
13
|
-
const react_dom_1 = tslib_1.__importDefault(require('react-dom'));
|
|
14
13
|
const useTooltip = (options = {}) => {
|
|
14
|
+
const uniqueId = (0, index_js_1.useId)();
|
|
15
15
|
const {
|
|
16
|
-
placement,
|
|
17
|
-
visible
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
shift: true,
|
|
21
|
-
},
|
|
16
|
+
placement = 'top',
|
|
17
|
+
visible,
|
|
18
|
+
onVisibleChange,
|
|
19
|
+
middleware = { flip: true, shift: true },
|
|
22
20
|
autoUpdateOptions = {},
|
|
21
|
+
reference,
|
|
22
|
+
ariaStrategy = 'description',
|
|
23
|
+
id = uniqueId,
|
|
24
|
+
...props
|
|
23
25
|
} = options;
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const [open, onOpenChange] = (0, index_js_1.useControlledState)(
|
|
27
|
+
false,
|
|
28
|
+
visible,
|
|
29
|
+
onVisibleChange,
|
|
30
|
+
);
|
|
31
|
+
const floating = (0, react_1.useFloating)({
|
|
27
32
|
placement,
|
|
28
33
|
open,
|
|
29
|
-
onOpenChange
|
|
30
|
-
whileElementsMounted: (
|
|
31
|
-
(0, react_1.autoUpdate)(
|
|
32
|
-
animationFrame: autoUpdateOptions.animationFrame,
|
|
33
|
-
ancestorScroll: autoUpdateOptions.ancestorScroll,
|
|
34
|
-
ancestorResize: autoUpdateOptions.ancestorResize,
|
|
35
|
-
elementResize: autoUpdateOptions.elementResize,
|
|
36
|
-
layoutShift: autoUpdateOptions.layoutShift,
|
|
37
|
-
}),
|
|
34
|
+
onOpenChange,
|
|
35
|
+
whileElementsMounted: (...args) =>
|
|
36
|
+
(0, react_1.autoUpdate)(...args, autoUpdateOptions),
|
|
38
37
|
middleware: [
|
|
39
38
|
middleware.offset !== undefined
|
|
40
39
|
? (0, react_1.offset)(middleware.offset)
|
|
@@ -46,41 +45,81 @@ const useTooltip = (options = {}) => {
|
|
|
46
45
|
middleware.inline && (0, react_1.inline)(),
|
|
47
46
|
middleware.hide && (0, react_1.hide)(),
|
|
48
47
|
].filter(Boolean),
|
|
48
|
+
...(reference && { elements: { reference } }),
|
|
49
49
|
});
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
const click = (0, react_1.useClick)(context, {
|
|
63
|
-
enabled: controlledOpen == null,
|
|
64
|
-
});
|
|
65
|
-
const dismiss = (0, react_1.useDismiss)(context, {
|
|
66
|
-
enabled: controlledOpen == null,
|
|
67
|
-
});
|
|
68
|
-
const role = (0, react_1.useRole)(context, { role: 'tooltip' });
|
|
50
|
+
const ariaProps = React.useMemo(
|
|
51
|
+
() =>
|
|
52
|
+
ariaStrategy === 'description'
|
|
53
|
+
? { 'aria-describedby': id }
|
|
54
|
+
: ariaStrategy === 'label'
|
|
55
|
+
? { 'aria-labelledby': id }
|
|
56
|
+
: {},
|
|
57
|
+
[ariaStrategy, id],
|
|
58
|
+
);
|
|
59
|
+
const { delay } = (0, react_1.useDelayGroupContext)();
|
|
60
|
+
(0, react_1.useDelayGroup)(floating.context, { id: (0, index_js_1.useId)() });
|
|
69
61
|
const interactions = (0, react_1.useInteractions)([
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
(0, react_1.useHover)(floating.context, {
|
|
63
|
+
delay: delay ?? { open: 50, close: 250 },
|
|
64
|
+
handleClose: (0, react_1.safePolygon)({ buffer: -Infinity }),
|
|
65
|
+
}),
|
|
66
|
+
(0, react_1.useFocus)(floating.context),
|
|
67
|
+
(0, react_1.useClick)(floating.context),
|
|
68
|
+
(0, react_1.useDismiss)(floating.context),
|
|
75
69
|
]);
|
|
70
|
+
// Manually add attributes and event handlers to external reference element,
|
|
71
|
+
// because we cannot spread getReferenceProps onto it.
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (!reference) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
/** e.g. onPointerDown --> pointerdown */
|
|
77
|
+
const domEventName = (e) => e.toLowerCase().substring(2);
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
const cleanupValues = {};
|
|
80
|
+
Object.entries({
|
|
81
|
+
...ariaProps,
|
|
82
|
+
...interactions.getReferenceProps(),
|
|
83
|
+
}).forEach(([key, value]) => {
|
|
84
|
+
if (typeof value === 'function') {
|
|
85
|
+
reference.addEventListener(domEventName(key), value);
|
|
86
|
+
cleanupValues[key] = value;
|
|
87
|
+
} else if (value) {
|
|
88
|
+
cleanupValues[key] = reference.getAttribute(key);
|
|
89
|
+
reference.setAttribute(key, value);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return () => {
|
|
93
|
+
Object.entries(cleanupValues).forEach(([key, value]) => {
|
|
94
|
+
if (typeof value === 'function') {
|
|
95
|
+
reference.removeEventListener(domEventName(key), value);
|
|
96
|
+
} else if (value) {
|
|
97
|
+
reference.setAttribute(key, value);
|
|
98
|
+
} else {
|
|
99
|
+
reference.removeAttribute(key);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
}, [ariaProps, reference, interactions]);
|
|
104
|
+
const getReferenceProps = React.useCallback(
|
|
105
|
+
(userProps) => {
|
|
106
|
+
return interactions.getReferenceProps({ ...userProps, ...ariaProps });
|
|
107
|
+
},
|
|
108
|
+
[interactions, ariaProps],
|
|
109
|
+
);
|
|
110
|
+
const floatingProps = React.useMemo(
|
|
111
|
+
() =>
|
|
112
|
+
interactions.getFloatingProps({
|
|
113
|
+
hidden: !open,
|
|
114
|
+
'aria-hidden': 'true',
|
|
115
|
+
...props,
|
|
116
|
+
id,
|
|
117
|
+
}),
|
|
118
|
+
[interactions, props, id, open],
|
|
119
|
+
);
|
|
76
120
|
return React.useMemo(
|
|
77
|
-
() => ({
|
|
78
|
-
|
|
79
|
-
setUncontrolledOpen,
|
|
80
|
-
...interactions,
|
|
81
|
-
...data,
|
|
82
|
-
}),
|
|
83
|
-
[open, interactions, data],
|
|
121
|
+
() => ({ getReferenceProps, floatingProps, ...floating }),
|
|
122
|
+
[getReferenceProps, floatingProps, floating],
|
|
84
123
|
);
|
|
85
124
|
};
|
|
86
125
|
/**
|
|
@@ -89,78 +128,38 @@ const useTooltip = (options = {}) => {
|
|
|
89
128
|
* @example
|
|
90
129
|
* <Tooltip content='tooltip text' placement='top'>Hover here</Tooltip>
|
|
91
130
|
* @example
|
|
92
|
-
* const
|
|
131
|
+
* const [trigger, setTrigger] = React.useState(null);
|
|
93
132
|
* ...
|
|
94
|
-
* <Button ref={
|
|
95
|
-
* <Tooltip content='tooltip text' reference={
|
|
133
|
+
* <Button ref={setTrigger} />
|
|
134
|
+
* <Tooltip content='tooltip text' reference={trigger} />
|
|
96
135
|
*/
|
|
97
|
-
exports.Tooltip = React.forwardRef((props,
|
|
98
|
-
const {
|
|
99
|
-
|
|
100
|
-
children,
|
|
101
|
-
portal = true,
|
|
102
|
-
placement = 'top',
|
|
103
|
-
autoUpdateOptions,
|
|
104
|
-
middleware,
|
|
105
|
-
style,
|
|
106
|
-
className,
|
|
107
|
-
visible,
|
|
108
|
-
reference,
|
|
109
|
-
...rest
|
|
110
|
-
} = props;
|
|
111
|
-
const tooltip = useTooltip({
|
|
112
|
-
placement,
|
|
113
|
-
visible,
|
|
114
|
-
autoUpdateOptions,
|
|
115
|
-
middleware,
|
|
116
|
-
});
|
|
117
|
-
const context = (0, index_js_1.useGlobals)();
|
|
118
|
-
React.useEffect(() => {
|
|
119
|
-
if (reference) {
|
|
120
|
-
tooltip.refs.setReference(reference.current);
|
|
121
|
-
}
|
|
122
|
-
}, [reference, tooltip.refs]);
|
|
123
|
-
const portalTo =
|
|
124
|
-
typeof portal !== 'boolean'
|
|
125
|
-
? portal.to
|
|
126
|
-
: portal
|
|
127
|
-
? context?.portalContainer || (0, index_js_1.getDocument)()?.body
|
|
128
|
-
: null;
|
|
129
|
-
const contentBox = React.createElement(
|
|
130
|
-
index_js_1.Box,
|
|
131
|
-
{
|
|
132
|
-
className: (0, classnames_1.default)('iui-tooltip', className),
|
|
133
|
-
ref: (0, index_js_1.useMergedRefs)(tooltip.refs.setFloating, forwardRef),
|
|
134
|
-
style: { ...tooltip.floatingStyles, ...style },
|
|
135
|
-
...tooltip.getFloatingProps(),
|
|
136
|
-
...rest,
|
|
137
|
-
},
|
|
138
|
-
content,
|
|
139
|
-
);
|
|
140
|
-
const childrenRef =
|
|
141
|
-
React.isValidElement(children) &&
|
|
142
|
-
(0, index_js_1.mergeRefs)(
|
|
143
|
-
tooltip.refs.setReference,
|
|
144
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
-
children.ref,
|
|
146
|
-
);
|
|
136
|
+
exports.Tooltip = React.forwardRef((props, forwardedRef) => {
|
|
137
|
+
const { content, children, portal = true, className, style, ...rest } = props;
|
|
138
|
+
const tooltip = useTooltip(rest);
|
|
147
139
|
return React.createElement(
|
|
148
140
|
React.Fragment,
|
|
149
141
|
null,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
142
|
+
(0, index_js_1.cloneElementWithRef)(children, (children) => ({
|
|
143
|
+
...tooltip.getReferenceProps(children.props),
|
|
144
|
+
ref: tooltip.refs.setReference,
|
|
145
|
+
})),
|
|
146
|
+
React.createElement(
|
|
147
|
+
index_js_1.Portal,
|
|
148
|
+
{ portal: portal },
|
|
149
|
+
React.createElement(
|
|
150
|
+
index_js_1.Box,
|
|
151
|
+
{
|
|
152
|
+
className: (0, classnames_1.default)('iui-tooltip', className),
|
|
153
|
+
ref: (0, index_js_1.useMergedRefs)(
|
|
154
|
+
tooltip.refs.setFloating,
|
|
155
|
+
forwardedRef,
|
|
156
|
+
),
|
|
157
|
+
style: { ...tooltip.floatingStyles, ...style },
|
|
158
|
+
...tooltip.floatingProps,
|
|
159
|
+
},
|
|
160
|
+
content,
|
|
161
|
+
),
|
|
162
|
+
),
|
|
164
163
|
);
|
|
165
164
|
});
|
|
166
165
|
exports.default = exports.Tooltip;
|
|
@@ -10,6 +10,7 @@ const react_1 = tslib_1.__importDefault(require('react'));
|
|
|
10
10
|
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
11
11
|
const index_js_1 = require('../utils/index.js');
|
|
12
12
|
const index_js_2 = require('../List/index.js');
|
|
13
|
+
const index_js_3 = require('../Label/index.js');
|
|
13
14
|
// ----------------------------------------------------------------------------
|
|
14
15
|
// TransferListComponent
|
|
15
16
|
const TransferListComponent = (0, index_js_1.polymorphic)(
|
|
@@ -152,7 +153,7 @@ const TransferListItem = react_1.default.forwardRef((props, ref) => {
|
|
|
152
153
|
});
|
|
153
154
|
TransferListItem.displayName = 'TransferList.Item';
|
|
154
155
|
const TransferListListboxLabel = react_1.default.forwardRef((props, ref) => {
|
|
155
|
-
const { children,
|
|
156
|
+
const { children, id, ...rest } = props;
|
|
156
157
|
const { labelId, setLabelId } = (0, index_js_1.useSafeContext)(
|
|
157
158
|
exports.TransferListContext,
|
|
158
159
|
);
|
|
@@ -162,17 +163,8 @@ const TransferListListboxLabel = react_1.default.forwardRef((props, ref) => {
|
|
|
162
163
|
}
|
|
163
164
|
}, [id, labelId, setLabelId]);
|
|
164
165
|
return react_1.default.createElement(
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
as: 'div',
|
|
168
|
-
className: (0, classnames_1.default)(
|
|
169
|
-
'iui-transfer-list-listbox-label',
|
|
170
|
-
className,
|
|
171
|
-
),
|
|
172
|
-
id: labelId,
|
|
173
|
-
ref: ref,
|
|
174
|
-
...rest,
|
|
175
|
-
},
|
|
166
|
+
index_js_3.Label,
|
|
167
|
+
{ as: 'div', id: labelId, ref: ref, ...rest },
|
|
176
168
|
children,
|
|
177
169
|
);
|
|
178
170
|
});
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export { TransferList } from './TransferList/index.js';
|
|
|
26
26
|
export { Tabs, Tab } from './Tabs/index.js';
|
|
27
27
|
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel/index.js';
|
|
28
28
|
export { Input } from './Input/index.js';
|
|
29
|
+
export { InputWithDecorations } from './InputWithDecorations/InputWithDecorations.js';
|
|
30
|
+
export { InputGrid } from './InputGrid/InputGrid.js';
|
|
29
31
|
export { Label } from './Label/index.js';
|
|
30
32
|
export { LabeledInput } from './LabeledInput/index.js';
|
|
31
33
|
export { InputGroup } from './InputGroup/index.js';
|
|
@@ -63,4 +65,4 @@ export { Anchor, Blockquote, Code, Kbd, KbdKeys, Text, } from './Typography/inde
|
|
|
63
65
|
export { Stepper, WorkflowDiagram } from './Stepper/index.js';
|
|
64
66
|
export type { StepProperties, StepperLocalization } from './Stepper/index.js';
|
|
65
67
|
export { SearchBox } from './SearchBox/index.js';
|
|
66
|
-
export { getUserColor, ColorValue, MiddleTextTruncation, LinkBox, LinkAction, Icon, Flex, VisuallyHidden, Divider, } from './utils/index.js';
|
|
68
|
+
export { getUserColor, ColorValue, MiddleTextTruncation, LinkBox, LinkAction, Icon, Flex, VisuallyHidden, Divider, Popover, } from './utils/index.js';
|
package/cjs/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InputWithDecorations =
|
|
4
4
|
exports.Input =
|
|
5
5
|
exports.InformationPanelContent =
|
|
6
6
|
exports.InformationPanelBody =
|
|
@@ -51,9 +51,7 @@ exports.Label =
|
|
|
51
51
|
exports.Avatar =
|
|
52
52
|
exports.Alert =
|
|
53
53
|
void 0;
|
|
54
|
-
exports.
|
|
55
|
-
exports.TreeNode =
|
|
56
|
-
exports.Tree =
|
|
54
|
+
exports.Tree =
|
|
57
55
|
exports.Tooltip =
|
|
58
56
|
exports.ToggleSwitch =
|
|
59
57
|
exports.ThemeProvider =
|
|
@@ -101,8 +99,11 @@ exports.TreeNodeExpander =
|
|
|
101
99
|
exports.LabeledSelect =
|
|
102
100
|
exports.InputGroup =
|
|
103
101
|
exports.LabeledInput =
|
|
102
|
+
exports.Label =
|
|
103
|
+
exports.InputGrid =
|
|
104
104
|
void 0;
|
|
105
|
-
exports.
|
|
105
|
+
exports.Popover =
|
|
106
|
+
exports.Divider =
|
|
106
107
|
exports.VisuallyHidden =
|
|
107
108
|
exports.Flex =
|
|
108
109
|
exports.Icon =
|
|
@@ -120,6 +121,8 @@ exports.Divider =
|
|
|
120
121
|
exports.Code =
|
|
121
122
|
exports.Blockquote =
|
|
122
123
|
exports.Anchor =
|
|
124
|
+
exports.TreeNodeExpander =
|
|
125
|
+
exports.TreeNode =
|
|
123
126
|
void 0;
|
|
124
127
|
/*---------------------------------------------------------------------------------------------
|
|
125
128
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
@@ -445,6 +448,20 @@ Object.defineProperty(exports, 'Input', {
|
|
|
445
448
|
return index_js_26.Input;
|
|
446
449
|
},
|
|
447
450
|
});
|
|
451
|
+
var InputWithDecorations_js_1 = require('./InputWithDecorations/InputWithDecorations.js');
|
|
452
|
+
Object.defineProperty(exports, 'InputWithDecorations', {
|
|
453
|
+
enumerable: true,
|
|
454
|
+
get: function () {
|
|
455
|
+
return InputWithDecorations_js_1.InputWithDecorations;
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
var InputGrid_js_1 = require('./InputGrid/InputGrid.js');
|
|
459
|
+
Object.defineProperty(exports, 'InputGrid', {
|
|
460
|
+
enumerable: true,
|
|
461
|
+
get: function () {
|
|
462
|
+
return InputGrid_js_1.InputGrid;
|
|
463
|
+
},
|
|
464
|
+
});
|
|
448
465
|
var index_js_27 = require('./Label/index.js');
|
|
449
466
|
Object.defineProperty(exports, 'Label', {
|
|
450
467
|
enumerable: true,
|
|
@@ -891,3 +908,9 @@ Object.defineProperty(exports, 'Divider', {
|
|
|
891
908
|
return index_js_58.Divider;
|
|
892
909
|
},
|
|
893
910
|
});
|
|
911
|
+
Object.defineProperty(exports, 'Popover', {
|
|
912
|
+
enumerable: true,
|
|
913
|
+
get: function () {
|
|
914
|
+
return index_js_58.Popover;
|
|
915
|
+
},
|
|
916
|
+
});
|
|
@@ -24,6 +24,11 @@ export type IconProps = {
|
|
|
24
24
|
* @default 'default'
|
|
25
25
|
*/
|
|
26
26
|
fill?: 'default' | 'positive' | 'informational' | 'negative' | 'warning' | AnyString;
|
|
27
|
+
/**
|
|
28
|
+
* Option to add padding to the icon.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
padded?: boolean;
|
|
27
32
|
} & React.ComponentPropsWithoutRef<'span'>;
|
|
28
33
|
/**
|
|
29
34
|
* A utility component to provide size and fill to svgs.
|
|
@@ -36,12 +36,19 @@ const getSizeValue = (size) => {
|
|
|
36
36
|
* </Icon>
|
|
37
37
|
*/
|
|
38
38
|
exports.Icon = React.forwardRef((props, ref) => {
|
|
39
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
size = 'medium',
|
|
41
|
+
fill = 'default',
|
|
42
|
+
className,
|
|
43
|
+
padded = false,
|
|
44
|
+
...rest
|
|
45
|
+
} = props;
|
|
40
46
|
return React.createElement(Box_js_1.Box, {
|
|
41
47
|
as: 'span',
|
|
42
48
|
className: (0, classnames_1.default)('iui-svg-icon', className),
|
|
43
49
|
'data-iui-icon-size': getSizeValue(size),
|
|
44
50
|
'data-iui-icon-color': fill,
|
|
51
|
+
'data-iui-padded': padded ? 'true' : undefined,
|
|
45
52
|
ref: ref,
|
|
46
53
|
...rest,
|
|
47
54
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../props.js';
|
|
3
|
+
export type InputContainerProps = {
|
|
4
4
|
label?: React.ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
required?: boolean;
|
|
@@ -8,13 +8,12 @@ export type InputContainerProps<T extends React.ElementType = 'div'> = {
|
|
|
8
8
|
message?: React.ReactNode;
|
|
9
9
|
icon?: JSX.Element;
|
|
10
10
|
isLabelInline?: boolean;
|
|
11
|
-
isIconInline?: boolean;
|
|
12
11
|
statusMessage?: React.ReactNode;
|
|
13
12
|
inputId?: string;
|
|
14
13
|
labelId?: string;
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
/**
|
|
17
16
|
* Input container to wrap inputs with label, and add optional message and icon.
|
|
18
17
|
* @private
|
|
19
18
|
*/
|
|
20
|
-
export declare const InputContainer: <
|
|
19
|
+
export declare const InputContainer: PolymorphicForwardRefComponent<"div", InputContainerProps>;
|
|
@@ -9,11 +9,13 @@ const tslib_1 = require('tslib');
|
|
|
9
9
|
const React = tslib_1.__importStar(require('react'));
|
|
10
10
|
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
11
11
|
const Box_js_1 = require('./Box.js');
|
|
12
|
+
const index_js_1 = require('../../Label/index.js');
|
|
13
|
+
const index_js_2 = require('../../StatusMessage/index.js');
|
|
12
14
|
/**
|
|
13
15
|
* Input container to wrap inputs with label, and add optional message and icon.
|
|
14
16
|
* @private
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
exports.InputContainer = React.forwardRef((props, forwardedRef) => {
|
|
17
19
|
const {
|
|
18
20
|
label,
|
|
19
21
|
disabled,
|
|
@@ -22,7 +24,6 @@ const InputContainer = (props) => {
|
|
|
22
24
|
message,
|
|
23
25
|
icon,
|
|
24
26
|
isLabelInline,
|
|
25
|
-
isIconInline,
|
|
26
27
|
children,
|
|
27
28
|
className,
|
|
28
29
|
style,
|
|
@@ -34,29 +35,24 @@ const InputContainer = (props) => {
|
|
|
34
35
|
return React.createElement(
|
|
35
36
|
Box_js_1.Box,
|
|
36
37
|
{
|
|
37
|
-
className: (0, classnames_1.default)(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
'iui-disabled': disabled,
|
|
41
|
-
[`iui-${status}`]: !!status,
|
|
42
|
-
'iui-inline-label': isLabelInline,
|
|
43
|
-
'iui-inline-icon': isIconInline,
|
|
44
|
-
'iui-with-message':
|
|
45
|
-
(!!message || !!icon || !!statusMessage) && !isLabelInline,
|
|
46
|
-
},
|
|
47
|
-
className,
|
|
48
|
-
),
|
|
38
|
+
className: (0, classnames_1.default)('iui-input-grid', className),
|
|
39
|
+
'data-iui-status': status,
|
|
40
|
+
'data-iui-label-placement': isLabelInline ? 'inline' : undefined,
|
|
49
41
|
style: style,
|
|
42
|
+
ref: forwardedRef,
|
|
50
43
|
...rest,
|
|
51
44
|
},
|
|
52
45
|
label &&
|
|
53
46
|
React.createElement(
|
|
54
|
-
|
|
47
|
+
index_js_1.Label,
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
+
// @ts-ignore
|
|
55
50
|
{
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
+
// @ts-ignore
|
|
56
53
|
as: inputId && props.as !== 'label' ? 'label' : 'div',
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}),
|
|
54
|
+
required: required,
|
|
55
|
+
disabled: disabled,
|
|
60
56
|
htmlFor: inputId,
|
|
61
57
|
id: labelId,
|
|
62
58
|
},
|
|
@@ -65,23 +61,11 @@ const InputContainer = (props) => {
|
|
|
65
61
|
children,
|
|
66
62
|
statusMessage
|
|
67
63
|
? statusMessage
|
|
68
|
-
:
|
|
69
|
-
React.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{ as: 'span', className: 'iui-input-icon', 'aria-hidden': true },
|
|
75
|
-
icon,
|
|
76
|
-
),
|
|
77
|
-
message &&
|
|
78
|
-
!isLabelInline &&
|
|
79
|
-
React.createElement(
|
|
80
|
-
Box_js_1.Box,
|
|
81
|
-
{ className: 'iui-message' },
|
|
82
|
-
message,
|
|
83
|
-
),
|
|
84
|
-
),
|
|
64
|
+
: message &&
|
|
65
|
+
React.createElement(
|
|
66
|
+
index_js_2.StatusMessage,
|
|
67
|
+
{ startIcon: icon, status: status },
|
|
68
|
+
message,
|
|
69
|
+
),
|
|
85
70
|
);
|
|
86
|
-
};
|
|
87
|
-
exports.InputContainer = InputContainer;
|
|
71
|
+
});
|
|
@@ -2,6 +2,7 @@ import type { PolymorphicForwardRefComponent } from '../props.js';
|
|
|
2
2
|
export type InputFlexContainerProps = {
|
|
3
3
|
isDisabled?: boolean;
|
|
4
4
|
status?: 'positive' | 'warning' | 'negative';
|
|
5
|
+
size?: 'small' | 'large';
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* Utility component for input container with display flex abilities.
|
|
@@ -14,7 +14,8 @@ const Box_js_1 = require('./Box.js');
|
|
|
14
14
|
* @private
|
|
15
15
|
*/
|
|
16
16
|
exports.InputFlexContainer = react_1.default.forwardRef((props, ref) => {
|
|
17
|
-
const { isDisabled, status, children, className, style, ...rest } =
|
|
17
|
+
const { isDisabled, status, children, className, size, style, ...rest } =
|
|
18
|
+
props;
|
|
18
19
|
return react_1.default.createElement(
|
|
19
20
|
Box_js_1.Box,
|
|
20
21
|
{
|
|
@@ -23,6 +24,7 @@ exports.InputFlexContainer = react_1.default.forwardRef((props, ref) => {
|
|
|
23
24
|
className,
|
|
24
25
|
),
|
|
25
26
|
'data-iui-status': status,
|
|
27
|
+
'data-iui-size': size,
|
|
26
28
|
'data-iui-disabled': isDisabled ? 'true' : undefined,
|
|
27
29
|
ref: ref,
|
|
28
30
|
style: style,
|