@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
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { IconButton } from '../Buttons/index.js';
|
|
8
8
|
import { Input } from '../Input/index.js';
|
|
9
|
-
import { ColorValue,
|
|
9
|
+
import { ColorValue, SvgSwap, Box } from '../utils/index.js';
|
|
10
10
|
import { useColorPickerContext } from './ColorPickerContext.js';
|
|
11
11
|
/**
|
|
12
12
|
* `ColorInputPanel` shows input fields to enter precise color values in the specified format.
|
|
@@ -135,20 +135,43 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
135
135
|
applyHsvColorChange(color.toHsvColor(), true, color);
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
const hexInputField = React.createElement(
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
const hexInputField = React.createElement(Input, {
|
|
139
|
+
size: 'small',
|
|
140
|
+
maxLength: showAlpha ? 9 : 7,
|
|
141
|
+
minLength: 1,
|
|
142
|
+
placeholder: 'HEX',
|
|
143
|
+
value: input[0],
|
|
144
|
+
onChange: (event) => {
|
|
145
|
+
const value = event.target.value.startsWith('#')
|
|
146
|
+
? event.target.value
|
|
147
|
+
: `#${event.target.value}`;
|
|
148
|
+
setInput([value]);
|
|
149
|
+
},
|
|
150
|
+
onKeyDown: (event) => {
|
|
151
|
+
if (event.key === 'Enter') {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
handleColorInputChange();
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
onBlur: (event) => {
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
handleColorInputChange();
|
|
159
|
+
},
|
|
160
|
+
status: validHexInput ? undefined : 'negative',
|
|
161
|
+
});
|
|
162
|
+
const hslInputs = React.createElement(
|
|
163
|
+
React.Fragment,
|
|
164
|
+
null,
|
|
141
165
|
React.createElement(Input, {
|
|
142
166
|
size: 'small',
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
type: 'number',
|
|
168
|
+
min: '0',
|
|
169
|
+
max: '359',
|
|
170
|
+
step: '.1',
|
|
171
|
+
placeholder: 'H',
|
|
172
|
+
value: input[0] ?? '',
|
|
147
173
|
onChange: (event) => {
|
|
148
|
-
|
|
149
|
-
? event.target.value
|
|
150
|
-
: `#${event.target.value}`;
|
|
151
|
-
setInput([value]);
|
|
174
|
+
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
152
175
|
},
|
|
153
176
|
onKeyDown: (event) => {
|
|
154
177
|
if (event.key === 'Enter') {
|
|
@@ -158,97 +181,76 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
158
181
|
},
|
|
159
182
|
onBlur: (event) => {
|
|
160
183
|
event.preventDefault();
|
|
161
|
-
|
|
184
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
185
|
+
handleColorInputChange();
|
|
186
|
+
}
|
|
162
187
|
},
|
|
188
|
+
status:
|
|
189
|
+
Number(input[0]) < 0 || Number(input[0]) > 360 ? 'negative' : undefined,
|
|
163
190
|
}),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
: undefined,
|
|
191
|
+
React.createElement(Input, {
|
|
192
|
+
size: 'small',
|
|
193
|
+
type: 'number',
|
|
194
|
+
min: '0',
|
|
195
|
+
max: '100',
|
|
196
|
+
step: '.1',
|
|
197
|
+
placeholder: 'S',
|
|
198
|
+
value: input[1] ?? '',
|
|
199
|
+
onChange: (event) => {
|
|
200
|
+
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
175
201
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
type: 'number',
|
|
179
|
-
min: '0',
|
|
180
|
-
max: '359',
|
|
181
|
-
step: '.1',
|
|
182
|
-
placeholder: 'H',
|
|
183
|
-
value: input[0] ?? '',
|
|
184
|
-
onChange: (event) => {
|
|
185
|
-
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
186
|
-
},
|
|
187
|
-
onKeyDown: (event) => {
|
|
188
|
-
if (event.key === 'Enter') {
|
|
189
|
-
event.preventDefault();
|
|
190
|
-
handleColorInputChange();
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
onBlur: (event) => {
|
|
202
|
+
onKeyDown: (event) => {
|
|
203
|
+
if (event.key === 'Enter') {
|
|
194
204
|
event.preventDefault();
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
}),
|
|
200
|
-
),
|
|
201
|
-
React.createElement(
|
|
202
|
-
InputContainer,
|
|
203
|
-
{
|
|
204
|
-
status:
|
|
205
|
-
Number(input[1]) < 0 || Number(input[1]) > 100
|
|
206
|
-
? 'negative'
|
|
207
|
-
: undefined,
|
|
205
|
+
handleColorInputChange();
|
|
206
|
+
}
|
|
208
207
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
208
|
+
onBlur: (event) => {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
211
|
+
handleColorInputChange();
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
status:
|
|
215
|
+
Number(input[1]) < 0 || Number(input[1]) > 100 ? 'negative' : undefined,
|
|
216
|
+
}),
|
|
217
|
+
React.createElement(Input, {
|
|
218
|
+
size: 'small',
|
|
219
|
+
type: 'number',
|
|
220
|
+
min: '0',
|
|
221
|
+
max: '100',
|
|
222
|
+
step: '.1',
|
|
223
|
+
placeholder: 'L',
|
|
224
|
+
value: input[2] ?? '',
|
|
225
|
+
onChange: (event) => {
|
|
226
|
+
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
227
|
+
},
|
|
228
|
+
onKeyDown: (event) => {
|
|
229
|
+
if (event.key === 'Enter') {
|
|
227
230
|
event.preventDefault();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
{
|
|
237
|
-
status:
|
|
238
|
-
Number(input[2]) < 0 || Number(input[2]) > 100
|
|
239
|
-
? 'negative'
|
|
240
|
-
: undefined,
|
|
231
|
+
handleColorInputChange();
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
onBlur: (event) => {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
237
|
+
handleColorInputChange();
|
|
238
|
+
}
|
|
241
239
|
},
|
|
240
|
+
status:
|
|
241
|
+
Number(input[2]) < 0 || Number(input[2]) > 100 ? 'negative' : undefined,
|
|
242
|
+
}),
|
|
243
|
+
showAlpha &&
|
|
242
244
|
React.createElement(Input, {
|
|
243
245
|
size: 'small',
|
|
244
246
|
type: 'number',
|
|
245
247
|
min: '0',
|
|
246
|
-
max: '
|
|
247
|
-
step: '.
|
|
248
|
-
placeholder: '
|
|
249
|
-
value: input[
|
|
248
|
+
max: '1',
|
|
249
|
+
step: '.01',
|
|
250
|
+
placeholder: 'A',
|
|
251
|
+
value: input[3] ?? '',
|
|
250
252
|
onChange: (event) => {
|
|
251
|
-
setInput([input[0], input[1], event.target.value
|
|
253
|
+
setInput([input[0], input[1], input[2], event.target.value]);
|
|
252
254
|
},
|
|
253
255
|
onKeyDown: (event) => {
|
|
254
256
|
if (event.key === 'Enter') {
|
|
@@ -262,127 +264,99 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
262
264
|
handleColorInputChange();
|
|
263
265
|
}
|
|
264
266
|
},
|
|
267
|
+
status:
|
|
268
|
+
Number(input[3]) < 0 || Number(input[3]) > 1 ? 'negative' : undefined,
|
|
265
269
|
}),
|
|
266
|
-
),
|
|
267
|
-
showAlpha &&
|
|
268
|
-
React.createElement(
|
|
269
|
-
InputContainer,
|
|
270
|
-
{
|
|
271
|
-
status:
|
|
272
|
-
Number(input[3]) < 0 || Number(input[3]) > 1
|
|
273
|
-
? 'negative'
|
|
274
|
-
: undefined,
|
|
275
|
-
},
|
|
276
|
-
React.createElement(Input, {
|
|
277
|
-
size: 'small',
|
|
278
|
-
type: 'number',
|
|
279
|
-
min: '0',
|
|
280
|
-
max: '1',
|
|
281
|
-
step: '.01',
|
|
282
|
-
placeholder: 'A',
|
|
283
|
-
value: input[3] ?? '',
|
|
284
|
-
onChange: (event) => {
|
|
285
|
-
setInput([input[0], input[1], input[2], event.target.value]);
|
|
286
|
-
},
|
|
287
|
-
onKeyDown: (event) => {
|
|
288
|
-
if (event.key === 'Enter') {
|
|
289
|
-
event.preventDefault();
|
|
290
|
-
handleColorInputChange();
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
onBlur: (event) => {
|
|
294
|
-
event.preventDefault();
|
|
295
|
-
if (!isFocusInside(event.relatedTarget)) {
|
|
296
|
-
handleColorInputChange();
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
}),
|
|
300
|
-
),
|
|
301
270
|
);
|
|
302
271
|
const rgbInputs = React.createElement(
|
|
303
272
|
React.Fragment,
|
|
304
273
|
null,
|
|
305
|
-
React.createElement(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
274
|
+
React.createElement(Input, {
|
|
275
|
+
size: 'small',
|
|
276
|
+
type: 'number',
|
|
277
|
+
min: '0',
|
|
278
|
+
max: '255',
|
|
279
|
+
placeholder: 'R',
|
|
280
|
+
value: input[0] ?? '',
|
|
281
|
+
onChange: (event) => {
|
|
282
|
+
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
312
283
|
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
type: 'number',
|
|
316
|
-
min: '0',
|
|
317
|
-
max: '255',
|
|
318
|
-
placeholder: 'R',
|
|
319
|
-
value: input[0] ?? '',
|
|
320
|
-
onChange: (event) => {
|
|
321
|
-
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
322
|
-
},
|
|
323
|
-
onKeyDown: (event) => {
|
|
324
|
-
if (event.key === 'Enter') {
|
|
325
|
-
event.preventDefault();
|
|
326
|
-
handleColorInputChange();
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
onBlur: (event) => {
|
|
284
|
+
onKeyDown: (event) => {
|
|
285
|
+
if (event.key === 'Enter') {
|
|
330
286
|
event.preventDefault();
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
}),
|
|
336
|
-
),
|
|
337
|
-
React.createElement(
|
|
338
|
-
InputContainer,
|
|
339
|
-
{
|
|
340
|
-
status:
|
|
341
|
-
Number(input[1]) < 0 || Number(input[1]) > 255
|
|
342
|
-
? 'negative'
|
|
343
|
-
: undefined,
|
|
287
|
+
handleColorInputChange();
|
|
288
|
+
}
|
|
344
289
|
},
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
290
|
+
onBlur: (event) => {
|
|
291
|
+
event.preventDefault();
|
|
292
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
293
|
+
handleColorInputChange();
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
status:
|
|
297
|
+
Number(input[0]) < 0 || Number(input[0]) > 255 ? 'negative' : undefined,
|
|
298
|
+
}),
|
|
299
|
+
React.createElement(Input, {
|
|
300
|
+
size: 'small',
|
|
301
|
+
type: 'number',
|
|
302
|
+
min: '0',
|
|
303
|
+
max: '255',
|
|
304
|
+
placeholder: 'G',
|
|
305
|
+
value: input[1] ?? '',
|
|
306
|
+
onChange: (event) => {
|
|
307
|
+
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
308
|
+
},
|
|
309
|
+
onKeyDown: (event) => {
|
|
310
|
+
if (event.key === 'Enter') {
|
|
362
311
|
event.preventDefault();
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
312
|
+
handleColorInputChange();
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
onBlur: (event) => {
|
|
316
|
+
event.preventDefault();
|
|
317
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
318
|
+
handleColorInputChange();
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
status:
|
|
322
|
+
Number(input[1]) < 0 || Number(input[1]) > 255 ? 'negative' : undefined,
|
|
323
|
+
}),
|
|
324
|
+
React.createElement(Input, {
|
|
325
|
+
size: 'small',
|
|
326
|
+
type: 'number',
|
|
327
|
+
min: '0',
|
|
328
|
+
max: '255',
|
|
329
|
+
placeholder: 'B',
|
|
330
|
+
value: input[2] ?? '',
|
|
331
|
+
onChange: (event) => {
|
|
332
|
+
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
333
|
+
},
|
|
334
|
+
onKeyDown: (event) => {
|
|
335
|
+
if (event.key === 'Enter') {
|
|
336
|
+
event.preventDefault();
|
|
337
|
+
handleColorInputChange();
|
|
338
|
+
}
|
|
376
339
|
},
|
|
340
|
+
onBlur: (event) => {
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
343
|
+
handleColorInputChange();
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
status:
|
|
347
|
+
Number(input[2]) < 0 || Number(input[2]) > 255 ? 'negative' : undefined,
|
|
348
|
+
}),
|
|
349
|
+
showAlpha &&
|
|
377
350
|
React.createElement(Input, {
|
|
378
351
|
size: 'small',
|
|
379
352
|
type: 'number',
|
|
380
353
|
min: '0',
|
|
381
|
-
max: '
|
|
382
|
-
|
|
383
|
-
|
|
354
|
+
max: '1',
|
|
355
|
+
step: '.01',
|
|
356
|
+
placeholder: 'A',
|
|
357
|
+
value: input[3] ?? '',
|
|
384
358
|
onChange: (event) => {
|
|
385
|
-
setInput([input[0], input[1], event.target.value
|
|
359
|
+
setInput([input[0], input[1], input[2], event.target.value]);
|
|
386
360
|
},
|
|
387
361
|
onKeyDown: (event) => {
|
|
388
362
|
if (event.key === 'Enter') {
|
|
@@ -396,42 +370,9 @@ export const ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
396
370
|
handleColorInputChange();
|
|
397
371
|
}
|
|
398
372
|
},
|
|
373
|
+
status:
|
|
374
|
+
Number(input[3]) < 0 || Number(input[3]) > 1 ? 'negative' : undefined,
|
|
399
375
|
}),
|
|
400
|
-
),
|
|
401
|
-
showAlpha &&
|
|
402
|
-
React.createElement(
|
|
403
|
-
InputContainer,
|
|
404
|
-
{
|
|
405
|
-
status:
|
|
406
|
-
Number(input[3]) < 0 || Number(input[3]) > 1
|
|
407
|
-
? 'negative'
|
|
408
|
-
: undefined,
|
|
409
|
-
},
|
|
410
|
-
React.createElement(Input, {
|
|
411
|
-
size: 'small',
|
|
412
|
-
type: 'number',
|
|
413
|
-
min: '0',
|
|
414
|
-
max: '1',
|
|
415
|
-
step: '.01',
|
|
416
|
-
placeholder: 'A',
|
|
417
|
-
value: input[3] ?? '',
|
|
418
|
-
onChange: (event) => {
|
|
419
|
-
setInput([input[0], input[1], input[2], event.target.value]);
|
|
420
|
-
},
|
|
421
|
-
onKeyDown: (event) => {
|
|
422
|
-
if (event.key === 'Enter') {
|
|
423
|
-
event.preventDefault();
|
|
424
|
-
handleColorInputChange();
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
onBlur: (event) => {
|
|
428
|
-
event.preventDefault();
|
|
429
|
-
if (!isFocusInside(event.relatedTarget)) {
|
|
430
|
-
handleColorInputChange();
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
}),
|
|
434
|
-
),
|
|
435
376
|
);
|
|
436
377
|
return React.createElement(
|
|
437
378
|
Box,
|
|
@@ -76,7 +76,6 @@ export const ComboBox = (props) => {
|
|
|
76
76
|
// Refs get set in subcomponents
|
|
77
77
|
const inputRef = React.useRef(null);
|
|
78
78
|
const menuRef = React.useRef(null);
|
|
79
|
-
const toggleButtonRef = React.useRef(null);
|
|
80
79
|
const onChangeProp = useLatestRef(onChange);
|
|
81
80
|
const optionsRef = useLatestRef(options);
|
|
82
81
|
// Record to store all extra information (e.g. original indexes), where the key is the id of the option
|
|
@@ -369,7 +368,7 @@ export const ComboBox = (props) => {
|
|
|
369
368
|
);
|
|
370
369
|
return React.createElement(
|
|
371
370
|
ComboBoxRefsContext.Provider,
|
|
372
|
-
{ value: { inputRef, menuRef,
|
|
371
|
+
{ value: { inputRef, menuRef, optionsExtraInfoRef } },
|
|
373
372
|
React.createElement(
|
|
374
373
|
ComboBoxActionContext.Provider,
|
|
375
374
|
{ value: dispatch },
|
|
@@ -390,12 +389,13 @@ export const ComboBox = (props) => {
|
|
|
390
389
|
},
|
|
391
390
|
React.createElement(
|
|
392
391
|
ComboBoxInputContainer,
|
|
393
|
-
{
|
|
392
|
+
{ ...rest },
|
|
394
393
|
React.createElement(
|
|
395
394
|
React.Fragment,
|
|
396
395
|
null,
|
|
397
396
|
React.createElement(ComboBoxInput, {
|
|
398
397
|
value: inputValue,
|
|
398
|
+
disabled: inputProps?.disabled,
|
|
399
399
|
...inputProps,
|
|
400
400
|
onChange: handleOnInput,
|
|
401
401
|
selectTags: isMultipleEnabled(selected, multiple)
|
|
@@ -13,7 +13,7 @@ export const ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
13
13
|
const { children, ...rest } = props;
|
|
14
14
|
const { isOpen } = useSafeContext(ComboBoxStateContext);
|
|
15
15
|
const dispatch = useSafeContext(ComboBoxActionContext);
|
|
16
|
-
const { inputRef
|
|
16
|
+
const { inputRef } = useSafeContext(ComboBoxRefsContext);
|
|
17
17
|
// sync internal isOpen state with user's visible prop
|
|
18
18
|
React.useEffect(() => {
|
|
19
19
|
if (props.visible != undefined) {
|
|
@@ -23,14 +23,9 @@ export const ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
23
23
|
return React.createElement(Popover, {
|
|
24
24
|
placement: 'bottom-start',
|
|
25
25
|
visible: isOpen,
|
|
26
|
-
onClickOutside: React.useCallback(
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
dispatch({ type: 'close' });
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
[dispatch, toggleButtonRef],
|
|
33
|
-
),
|
|
26
|
+
onClickOutside: React.useCallback(() => {
|
|
27
|
+
dispatch({ type: 'close' });
|
|
28
|
+
}, [dispatch]),
|
|
34
29
|
animation: 'shift-away',
|
|
35
30
|
duration: 200,
|
|
36
31
|
reference: inputRef,
|
|
@@ -4,43 +4,22 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import {
|
|
8
|
-
useSafeContext,
|
|
9
|
-
useMergedRefs,
|
|
10
|
-
SvgCaretDownSmall,
|
|
11
|
-
mergeEventHandlers,
|
|
12
|
-
Box,
|
|
13
|
-
} from '../utils/index.js';
|
|
14
|
-
import { ComboBoxActionContext, ComboBoxRefsContext } from './helpers.js';
|
|
7
|
+
import { SvgCaretDownSmall, Icon } from '../utils/index.js';
|
|
15
8
|
export const ComboBoxEndIcon = React.forwardRef((props, forwardedRef) => {
|
|
16
|
-
const {
|
|
17
|
-
className,
|
|
18
|
-
children,
|
|
19
|
-
onClick: onClickProp,
|
|
20
|
-
disabled,
|
|
21
|
-
isOpen,
|
|
22
|
-
...rest
|
|
23
|
-
} = props;
|
|
24
|
-
const dispatch = useSafeContext(ComboBoxActionContext);
|
|
25
|
-
const { toggleButtonRef } = useSafeContext(ComboBoxRefsContext);
|
|
26
|
-
const refs = useMergedRefs(toggleButtonRef, forwardedRef);
|
|
9
|
+
const { className, children, disabled, isOpen, ...rest } = props;
|
|
27
10
|
return React.createElement(
|
|
28
|
-
|
|
11
|
+
Icon,
|
|
29
12
|
{
|
|
30
13
|
as: 'span',
|
|
31
|
-
ref:
|
|
14
|
+
ref: forwardedRef,
|
|
32
15
|
className: cx(
|
|
33
16
|
'iui-end-icon',
|
|
34
17
|
{
|
|
35
|
-
'iui-actionable': !disabled,
|
|
36
18
|
'iui-disabled': disabled,
|
|
37
19
|
'iui-open': isOpen,
|
|
38
20
|
},
|
|
39
21
|
className,
|
|
40
22
|
),
|
|
41
|
-
onClick: mergeEventHandlers(onClickProp, () => {
|
|
42
|
-
dispatch({ type: isOpen ? 'close' : 'open' });
|
|
43
|
-
}),
|
|
44
23
|
...rest,
|
|
45
24
|
},
|
|
46
25
|
children ?? React.createElement(SvgCaretDownSmall, { 'aria-hidden': true }),
|
|
@@ -197,7 +197,7 @@ export const ComboBoxInput = React.forwardRef((props, forwardedRef) => {
|
|
|
197
197
|
spellCheck: false,
|
|
198
198
|
autoCapitalize: 'none',
|
|
199
199
|
autoCorrect: 'off',
|
|
200
|
-
style: multiple ? {
|
|
200
|
+
style: multiple ? { paddingInlineStart: tagContainerWidth + 18 } : {},
|
|
201
201
|
'aria-describedby': multiple ? `${id}-selected-live` : undefined,
|
|
202
202
|
...rest,
|
|
203
203
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Menu } from '../Menu/index.js';
|
|
3
3
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
4
|
-
type ComboBoxMenuProps = Omit<React.ComponentPropsWithoutRef<typeof Menu>, 'onClick'> & React.ComponentPropsWithoutRef<'
|
|
5
|
-
export declare const ComboBoxMenu: PolymorphicForwardRefComponent<"
|
|
4
|
+
type ComboBoxMenuProps = Omit<React.ComponentPropsWithoutRef<typeof Menu>, 'onClick'> & React.ComponentPropsWithoutRef<'div'>;
|
|
5
|
+
export declare const ComboBoxMenu: PolymorphicForwardRefComponent<"div", ComboBoxMenuProps>;
|
|
6
6
|
export {};
|
|
@@ -47,11 +47,11 @@ const VirtualizedComboBoxMenu = React.forwardRef(
|
|
|
47
47
|
scrollToIndex: focusedVisibleIndex,
|
|
48
48
|
});
|
|
49
49
|
const surfaceStyles = {
|
|
50
|
-
minWidth,
|
|
50
|
+
minInlineSize: minWidth,
|
|
51
51
|
// set as constant because we don't want it shifting when items are unmounted
|
|
52
|
-
|
|
52
|
+
maxInlineSize: minWidth,
|
|
53
53
|
// max-height must be on the outermost element for virtual scroll
|
|
54
|
-
|
|
54
|
+
maxBlockSize: 'calc((var(--iui-component-height) - 1px) * 8.5)',
|
|
55
55
|
overflowY: isOverflowOverlaySupported() ? 'overlay' : 'auto',
|
|
56
56
|
...style,
|
|
57
57
|
};
|
|
@@ -86,8 +86,8 @@ export const ComboBoxMenu = React.forwardRef((props, forwardedRef) => {
|
|
|
86
86
|
const refs = useMergedRefs(menuRef, forwardedRef);
|
|
87
87
|
const styles = React.useMemo(
|
|
88
88
|
() => ({
|
|
89
|
-
minWidth,
|
|
90
|
-
|
|
89
|
+
minInlineSize: minWidth,
|
|
90
|
+
maxInlineSize: `min(${minWidth * 2}px, 90vw)`,
|
|
91
91
|
}),
|
|
92
92
|
[minWidth],
|
|
93
93
|
);
|
|
@@ -4,5 +4,5 @@ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
|
4
4
|
type ComboBoxMenuItemProps = MenuItemProps & {
|
|
5
5
|
index: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const ComboBoxMenuItem: React.MemoExoticComponent<PolymorphicForwardRefComponent<"
|
|
7
|
+
export declare const ComboBoxMenuItem: React.MemoExoticComponent<PolymorphicForwardRefComponent<"div", ComboBoxMenuItemProps>>;
|
|
8
8
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { useSafeContext, useMergedRefs } from '../utils/index.js';
|
|
6
|
+
import { useSafeContext, useMergedRefs, SvgCheckmark } from '../utils/index.js';
|
|
7
7
|
import { ComboBoxStateContext } from './helpers.js';
|
|
8
8
|
import { ListItem } from '../List/ListItem.js';
|
|
9
9
|
export const ComboBoxMenuItem = React.memo(
|
|
@@ -33,6 +33,7 @@ export const ComboBoxMenuItem = React.memo(
|
|
|
33
33
|
return React.createElement(
|
|
34
34
|
ListItem,
|
|
35
35
|
{
|
|
36
|
+
as: 'div',
|
|
36
37
|
actionable: true,
|
|
37
38
|
size: size,
|
|
38
39
|
active: isSelected,
|
|
@@ -59,12 +60,13 @@ export const ComboBoxMenuItem = React.memo(
|
|
|
59
60
|
children,
|
|
60
61
|
sublabel && React.createElement(ListItem.Description, null, sublabel),
|
|
61
62
|
),
|
|
62
|
-
endIcon
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
endIcon ||
|
|
64
|
+
(isSelected &&
|
|
65
|
+
React.createElement(
|
|
66
|
+
ListItem.Icon,
|
|
67
|
+
{ as: 'span', 'aria-hidden': true },
|
|
68
|
+
endIcon ?? React.createElement(SvgCheckmark, null),
|
|
69
|
+
)),
|
|
68
70
|
);
|
|
69
71
|
}),
|
|
70
72
|
);
|