@itwin/itwinui-react 3.0.0-dev.6 → 3.0.0-dev.8
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 +101 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/Avatar/Avatar.d.ts +3 -2
- package/cjs/core/Avatar/Avatar.js +21 -19
- package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/Button/Button.d.ts +15 -2
- package/cjs/core/Buttons/Button/Button.js +23 -9
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
- package/cjs/core/Carousel/Carousel.d.ts +6 -4
- package/cjs/core/Carousel/Carousel.js +2 -2
- package/cjs/core/Carousel/CarouselDot.js +1 -3
- package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.js +3 -3
- package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +1 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +47 -6
- package/cjs/core/Dialog/Dialog.js +10 -17
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/Dialog/DialogMain.js +5 -5
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
- package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
- package/cjs/core/FileUpload/FileUpload.js +24 -3
- package/cjs/core/Header/HeaderBasicButton.js +3 -16
- package/cjs/core/Header/HeaderDropdownButton.js +1 -1
- package/cjs/core/Header/HeaderSplitButton.js +3 -4
- 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 +1 -1
- 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 +1 -0
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +12 -11
- package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/cjs/core/SideNavigation/SideNavigation.js +42 -9
- package/cjs/core/Slider/Slider.d.ts +24 -0
- package/cjs/core/Slider/Slider.js +58 -10
- package/cjs/core/Slider/Thumb.js +3 -2
- package/cjs/core/Slider/Track.d.ts +1 -1
- package/cjs/core/Slider/Track.js +17 -6
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Stepper/Stepper.d.ts +26 -1
- package/cjs/core/Stepper/Stepper.js +35 -6
- package/cjs/core/Stepper/StepperStep.d.ts +17 -0
- package/cjs/core/Stepper/StepperStep.js +33 -8
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
- package/cjs/core/Table/SubRowExpander.js +3 -1
- package/cjs/core/Table/Table.js +0 -1
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.js +1 -3
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Tabs/Tab.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
- package/cjs/core/Tile/Tile.d.ts +142 -17
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +24 -13
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -118
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/Tree/TreeNode.js +1 -1
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
- package/cjs/core/utils/components/ButtonBase.js +46 -0
- 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 +0 -1
- package/cjs/core/utils/components/InputContainer.js +14 -34
- 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.js +5 -3
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/VirtualScroll.js +4 -4
- package/cjs/core/utils/components/index.d.ts +2 -0
- package/cjs/core/utils/components/index.js +2 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -13
- 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 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
- package/cjs/styles.js +11 -35
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/Avatar/Avatar.d.ts +3 -2
- package/esm/core/Avatar/Avatar.js +21 -17
- package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/Button/Button.d.ts +15 -2
- package/esm/core/Buttons/Button/Button.js +18 -10
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
- package/esm/core/Buttons/IconButton/IconButton.js +25 -37
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
- package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
- package/esm/core/Carousel/Carousel.d.ts +6 -4
- package/esm/core/Carousel/Carousel.js +8 -3
- package/esm/core/Carousel/CarouselDot.js +2 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
- package/esm/core/ColorPicker/ColorBuilder.js +2 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.js +3 -3
- package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxInput.js +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +1 -2
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +33 -6
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/Dialog/DialogMain.js +5 -5
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
- package/esm/core/FileUpload/FileUpload.d.ts +4 -0
- package/esm/core/FileUpload/FileUpload.js +26 -3
- package/esm/core/Header/HeaderBasicButton.js +4 -17
- package/esm/core/Header/HeaderDropdownButton.js +1 -1
- package/esm/core/Header/HeaderSplitButton.js +9 -5
- 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 +1 -1
- 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 +1 -0
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
- package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +12 -11
- package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
- package/esm/core/SideNavigation/SideNavigation.js +33 -9
- package/esm/core/Slider/Slider.d.ts +24 -0
- package/esm/core/Slider/Slider.js +43 -10
- package/esm/core/Slider/Thumb.js +3 -2
- package/esm/core/Slider/Track.d.ts +1 -1
- package/esm/core/Slider/Track.js +14 -6
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Stepper/Stepper.d.ts +26 -1
- package/esm/core/Stepper/Stepper.js +32 -6
- package/esm/core/Stepper/StepperStep.d.ts +17 -0
- package/esm/core/Stepper/StepperStep.js +27 -8
- package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
- package/esm/core/Stepper/WorkflowDiagram.js +10 -7
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
- package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
- package/esm/core/Table/SubRowExpander.js +3 -1
- package/esm/core/Table/Table.js +0 -1
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Tabs/Tab.js +2 -3
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
- package/esm/core/Tile/Tile.d.ts +142 -17
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +26 -13
- 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/Tree/TreeNode.js +1 -1
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/ButtonBase.d.ts +14 -0
- package/esm/core/utils/components/ButtonBase.js +42 -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 +0 -1
- package/esm/core/utils/components/InputContainer.js +14 -30
- 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.js +5 -3
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/VirtualScroll.js +4 -4
- package/esm/core/utils/components/index.d.ts +2 -0
- package/esm/core/utils/components/index.js +2 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -13
- 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 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
- package/esm/styles.js +11 -35
- package/package.json +3 -3
- package/styles.css +49 -46
|
@@ -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,79 +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?.portalContainerRef?.current ??
|
|
128
|
-
(0, index_js_1.getDocument)()?.body
|
|
129
|
-
: null;
|
|
130
|
-
const contentBox = React.createElement(
|
|
131
|
-
index_js_1.Box,
|
|
132
|
-
{
|
|
133
|
-
className: (0, classnames_1.default)('iui-tooltip', className),
|
|
134
|
-
ref: (0, index_js_1.useMergedRefs)(tooltip.refs.setFloating, forwardRef),
|
|
135
|
-
style: { ...tooltip.floatingStyles, ...style },
|
|
136
|
-
...tooltip.getFloatingProps(),
|
|
137
|
-
...rest,
|
|
138
|
-
},
|
|
139
|
-
content,
|
|
140
|
-
);
|
|
141
|
-
const childrenRef =
|
|
142
|
-
React.isValidElement(children) &&
|
|
143
|
-
(0, index_js_1.mergeRefs)(
|
|
144
|
-
tooltip.refs.setReference,
|
|
145
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
-
children.ref,
|
|
147
|
-
);
|
|
136
|
+
exports.Tooltip = React.forwardRef((props, forwardedRef) => {
|
|
137
|
+
const { content, children, portal = true, className, style, ...rest } = props;
|
|
138
|
+
const tooltip = useTooltip(rest);
|
|
148
139
|
return React.createElement(
|
|
149
140
|
React.Fragment,
|
|
150
141
|
null,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
+
),
|
|
165
163
|
);
|
|
166
164
|
});
|
|
167
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';
|
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,6 +99,8 @@ 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
105
|
exports.Divider =
|
|
106
106
|
exports.VisuallyHidden =
|
|
@@ -120,6 +120,8 @@ exports.Divider =
|
|
|
120
120
|
exports.Code =
|
|
121
121
|
exports.Blockquote =
|
|
122
122
|
exports.Anchor =
|
|
123
|
+
exports.TreeNodeExpander =
|
|
124
|
+
exports.TreeNode =
|
|
123
125
|
void 0;
|
|
124
126
|
/*---------------------------------------------------------------------------------------------
|
|
125
127
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
@@ -445,6 +447,20 @@ Object.defineProperty(exports, 'Input', {
|
|
|
445
447
|
return index_js_26.Input;
|
|
446
448
|
},
|
|
447
449
|
});
|
|
450
|
+
var InputWithDecorations_js_1 = require('./InputWithDecorations/InputWithDecorations.js');
|
|
451
|
+
Object.defineProperty(exports, 'InputWithDecorations', {
|
|
452
|
+
enumerable: true,
|
|
453
|
+
get: function () {
|
|
454
|
+
return InputWithDecorations_js_1.InputWithDecorations;
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
var InputGrid_js_1 = require('./InputGrid/InputGrid.js');
|
|
458
|
+
Object.defineProperty(exports, 'InputGrid', {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get: function () {
|
|
461
|
+
return InputGrid_js_1.InputGrid;
|
|
462
|
+
},
|
|
463
|
+
});
|
|
448
464
|
var index_js_27 = require('./Label/index.js');
|
|
449
465
|
Object.defineProperty(exports, 'Label', {
|
|
450
466
|
enumerable: true,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PolymorphicForwardRefComponent } from '../props.js';
|
|
2
|
+
export declare const ButtonBase: PolymorphicForwardRefComponent<"button", ButtonBaseProps>;
|
|
3
|
+
type ButtonBaseProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Custom `disabled` prop that keeps the button focusable, prevents
|
|
6
|
+
* clicks, applied disabled styling, and adds `aria-disabled`.
|
|
7
|
+
*/
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Built-in html `disabled` attribute
|
|
11
|
+
*/
|
|
12
|
+
htmlDisabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.ButtonBase = void 0;
|
|
4
|
+
const tslib_1 = require('tslib');
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const React = tslib_1.__importStar(require('react'));
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
11
|
+
const Box_js_1 = require('./Box.js');
|
|
12
|
+
const useIsClient_js_1 = require('../hooks/useIsClient.js');
|
|
13
|
+
exports.ButtonBase = React.forwardRef((props, forwardedRef) => {
|
|
14
|
+
const {
|
|
15
|
+
as: asProp = 'button',
|
|
16
|
+
disabled: disabledProp,
|
|
17
|
+
htmlDisabled,
|
|
18
|
+
...rest
|
|
19
|
+
} = props;
|
|
20
|
+
const isClient = (0, useIsClient_js_1.useIsClient)();
|
|
21
|
+
const ariaDisabled =
|
|
22
|
+
disabledProp &&
|
|
23
|
+
!htmlDisabled && // htmlDisabled prop takes preference
|
|
24
|
+
isClient && // progressively enhance after first render
|
|
25
|
+
asProp === 'button'; // ignore if not button, e.g. links
|
|
26
|
+
const handleIfEnabled = (handler) => (e) => {
|
|
27
|
+
if (disabledProp) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
handler?.(e);
|
|
31
|
+
};
|
|
32
|
+
return React.createElement(Box_js_1.Box, {
|
|
33
|
+
as: asProp,
|
|
34
|
+
type: asProp === 'button' ? 'button' : undefined,
|
|
35
|
+
ref: forwardedRef,
|
|
36
|
+
'aria-disabled': ariaDisabled ? 'true' : undefined,
|
|
37
|
+
'data-iui-disabled': disabledProp ? 'true' : undefined,
|
|
38
|
+
disabled: htmlDisabled ?? (!isClient && disabledProp) ? true : undefined,
|
|
39
|
+
...rest,
|
|
40
|
+
className: (0, classnames_1.default)('iui-button-base', props.className),
|
|
41
|
+
onClick: handleIfEnabled(props.onClick),
|
|
42
|
+
onPointerDown: handleIfEnabled(props.onPointerDown),
|
|
43
|
+
onPointerUp: handleIfEnabled(props.onPointerUp),
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
exports.ButtonBase.displayName = 'ButtonBase';
|
|
@@ -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
|
});
|
|
@@ -9,6 +9,8 @@ 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
|
|
@@ -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,19 @@ 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,
|
|
50
42
|
...rest,
|
|
51
43
|
},
|
|
52
44
|
label &&
|
|
53
45
|
React.createElement(
|
|
54
|
-
|
|
46
|
+
index_js_1.Label,
|
|
55
47
|
{
|
|
56
48
|
as: inputId && props.as !== 'label' ? 'label' : 'div',
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}),
|
|
49
|
+
required: required,
|
|
50
|
+
disabled: disabled,
|
|
60
51
|
htmlFor: inputId,
|
|
61
52
|
id: labelId,
|
|
62
53
|
},
|
|
@@ -65,23 +56,12 @@ const InputContainer = (props) => {
|
|
|
65
56
|
children,
|
|
66
57
|
statusMessage
|
|
67
58
|
? 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
|
-
),
|
|
59
|
+
: message &&
|
|
60
|
+
React.createElement(
|
|
61
|
+
index_js_2.StatusMessage,
|
|
62
|
+
{ startIcon: icon, status: status },
|
|
63
|
+
message,
|
|
64
|
+
),
|
|
85
65
|
);
|
|
86
66
|
};
|
|
87
67
|
exports.InputContainer = InputContainer;
|
|
@@ -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,
|
|
@@ -40,8 +40,7 @@ exports.Popover = React.forwardRef((props, ref) => {
|
|
|
40
40
|
const computedProps = {
|
|
41
41
|
allowHTML: true,
|
|
42
42
|
animation: false,
|
|
43
|
-
appendTo: (el) =>
|
|
44
|
-
themeInfo?.portalContainerRef?.current || el.ownerDocument.body,
|
|
43
|
+
appendTo: (el) => themeInfo?.portalContainer || el.ownerDocument.body,
|
|
45
44
|
arrow: false,
|
|
46
45
|
duration: 0,
|
|
47
46
|
interactive: true,
|
|
@@ -66,7 +65,10 @@ exports.Popover = React.forwardRef((props, ref) => {
|
|
|
66
65
|
...props.popperOptions,
|
|
67
66
|
modifiers: [
|
|
68
67
|
{ name: 'flip' },
|
|
69
|
-
{
|
|
68
|
+
{
|
|
69
|
+
name: 'preventOverflow',
|
|
70
|
+
options: { padding: 0 },
|
|
71
|
+
},
|
|
70
72
|
...(props.popperOptions?.modifiers || []),
|
|
71
73
|
],
|
|
72
74
|
},
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type PortalProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Where should the element be portaled to?
|
|
5
|
+
*
|
|
6
|
+
* If true, it will portal into nearest ThemeContext.portalContainer.
|
|
7
|
+
*
|
|
8
|
+
* If false, it will not be portaled.
|
|
9
|
+
*
|
|
10
|
+
* Otherwise, it will portal to the element passed to `to`.
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
portal?: boolean | {
|
|
15
|
+
to: HTMLElement | (() => HTMLElement);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Helper component that portals children according to the following conditions:
|
|
20
|
+
* - renders null on server
|
|
21
|
+
* - if `portal` is set to true, renders into nearest ThemeContext.portalContainer
|
|
22
|
+
* - if `portal` is set to false, renders as-is without portal
|
|
23
|
+
* - otherwise renders into `portal.to` (can be an element or a function)
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
export declare const Portal: (props: React.PropsWithChildren<PortalProps>) => React.ReactNode;
|