@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
|
@@ -139,20 +139,43 @@ exports.ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
139
139
|
applyHsvColorChange(color.toHsvColor(), true, color);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
const hexInputField = React.createElement(
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
const hexInputField = React.createElement(index_js_2.Input, {
|
|
143
|
+
size: 'small',
|
|
144
|
+
maxLength: showAlpha ? 9 : 7,
|
|
145
|
+
minLength: 1,
|
|
146
|
+
placeholder: 'HEX',
|
|
147
|
+
value: input[0],
|
|
148
|
+
onChange: (event) => {
|
|
149
|
+
const value = event.target.value.startsWith('#')
|
|
150
|
+
? event.target.value
|
|
151
|
+
: `#${event.target.value}`;
|
|
152
|
+
setInput([value]);
|
|
153
|
+
},
|
|
154
|
+
onKeyDown: (event) => {
|
|
155
|
+
if (event.key === 'Enter') {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
handleColorInputChange();
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
onBlur: (event) => {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
handleColorInputChange();
|
|
163
|
+
},
|
|
164
|
+
status: validHexInput ? undefined : 'negative',
|
|
165
|
+
});
|
|
166
|
+
const hslInputs = React.createElement(
|
|
167
|
+
React.Fragment,
|
|
168
|
+
null,
|
|
145
169
|
React.createElement(index_js_2.Input, {
|
|
146
170
|
size: 'small',
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
171
|
+
type: 'number',
|
|
172
|
+
min: '0',
|
|
173
|
+
max: '359',
|
|
174
|
+
step: '.1',
|
|
175
|
+
placeholder: 'H',
|
|
176
|
+
value: input[0] ?? '',
|
|
151
177
|
onChange: (event) => {
|
|
152
|
-
|
|
153
|
-
? event.target.value
|
|
154
|
-
: `#${event.target.value}`;
|
|
155
|
-
setInput([value]);
|
|
178
|
+
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
156
179
|
},
|
|
157
180
|
onKeyDown: (event) => {
|
|
158
181
|
if (event.key === 'Enter') {
|
|
@@ -162,97 +185,76 @@ exports.ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
162
185
|
},
|
|
163
186
|
onBlur: (event) => {
|
|
164
187
|
event.preventDefault();
|
|
165
|
-
|
|
188
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
189
|
+
handleColorInputChange();
|
|
190
|
+
}
|
|
166
191
|
},
|
|
192
|
+
status:
|
|
193
|
+
Number(input[0]) < 0 || Number(input[0]) > 360 ? 'negative' : undefined,
|
|
167
194
|
}),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
: undefined,
|
|
195
|
+
React.createElement(index_js_2.Input, {
|
|
196
|
+
size: 'small',
|
|
197
|
+
type: 'number',
|
|
198
|
+
min: '0',
|
|
199
|
+
max: '100',
|
|
200
|
+
step: '.1',
|
|
201
|
+
placeholder: 'S',
|
|
202
|
+
value: input[1] ?? '',
|
|
203
|
+
onChange: (event) => {
|
|
204
|
+
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
179
205
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
type: 'number',
|
|
183
|
-
min: '0',
|
|
184
|
-
max: '359',
|
|
185
|
-
step: '.1',
|
|
186
|
-
placeholder: 'H',
|
|
187
|
-
value: input[0] ?? '',
|
|
188
|
-
onChange: (event) => {
|
|
189
|
-
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
190
|
-
},
|
|
191
|
-
onKeyDown: (event) => {
|
|
192
|
-
if (event.key === 'Enter') {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
handleColorInputChange();
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
onBlur: (event) => {
|
|
206
|
+
onKeyDown: (event) => {
|
|
207
|
+
if (event.key === 'Enter') {
|
|
198
208
|
event.preventDefault();
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
}),
|
|
204
|
-
),
|
|
205
|
-
React.createElement(
|
|
206
|
-
index_js_3.InputContainer,
|
|
207
|
-
{
|
|
208
|
-
status:
|
|
209
|
-
Number(input[1]) < 0 || Number(input[1]) > 100
|
|
210
|
-
? 'negative'
|
|
211
|
-
: undefined,
|
|
209
|
+
handleColorInputChange();
|
|
210
|
+
}
|
|
212
211
|
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
212
|
+
onBlur: (event) => {
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
215
|
+
handleColorInputChange();
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
status:
|
|
219
|
+
Number(input[1]) < 0 || Number(input[1]) > 100 ? 'negative' : undefined,
|
|
220
|
+
}),
|
|
221
|
+
React.createElement(index_js_2.Input, {
|
|
222
|
+
size: 'small',
|
|
223
|
+
type: 'number',
|
|
224
|
+
min: '0',
|
|
225
|
+
max: '100',
|
|
226
|
+
step: '.1',
|
|
227
|
+
placeholder: 'L',
|
|
228
|
+
value: input[2] ?? '',
|
|
229
|
+
onChange: (event) => {
|
|
230
|
+
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
231
|
+
},
|
|
232
|
+
onKeyDown: (event) => {
|
|
233
|
+
if (event.key === 'Enter') {
|
|
231
234
|
event.preventDefault();
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
}),
|
|
237
|
-
),
|
|
238
|
-
React.createElement(
|
|
239
|
-
index_js_3.InputContainer,
|
|
240
|
-
{
|
|
241
|
-
status:
|
|
242
|
-
Number(input[2]) < 0 || Number(input[2]) > 100
|
|
243
|
-
? 'negative'
|
|
244
|
-
: undefined,
|
|
235
|
+
handleColorInputChange();
|
|
236
|
+
}
|
|
245
237
|
},
|
|
238
|
+
onBlur: (event) => {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
241
|
+
handleColorInputChange();
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
status:
|
|
245
|
+
Number(input[2]) < 0 || Number(input[2]) > 100 ? 'negative' : undefined,
|
|
246
|
+
}),
|
|
247
|
+
showAlpha &&
|
|
246
248
|
React.createElement(index_js_2.Input, {
|
|
247
249
|
size: 'small',
|
|
248
250
|
type: 'number',
|
|
249
251
|
min: '0',
|
|
250
|
-
max: '
|
|
251
|
-
step: '.
|
|
252
|
-
placeholder: '
|
|
253
|
-
value: input[
|
|
252
|
+
max: '1',
|
|
253
|
+
step: '.01',
|
|
254
|
+
placeholder: 'A',
|
|
255
|
+
value: input[3] ?? '',
|
|
254
256
|
onChange: (event) => {
|
|
255
|
-
setInput([input[0], input[1], event.target.value
|
|
257
|
+
setInput([input[0], input[1], input[2], event.target.value]);
|
|
256
258
|
},
|
|
257
259
|
onKeyDown: (event) => {
|
|
258
260
|
if (event.key === 'Enter') {
|
|
@@ -266,127 +268,99 @@ exports.ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
266
268
|
handleColorInputChange();
|
|
267
269
|
}
|
|
268
270
|
},
|
|
271
|
+
status:
|
|
272
|
+
Number(input[3]) < 0 || Number(input[3]) > 1 ? 'negative' : undefined,
|
|
269
273
|
}),
|
|
270
|
-
),
|
|
271
|
-
showAlpha &&
|
|
272
|
-
React.createElement(
|
|
273
|
-
index_js_3.InputContainer,
|
|
274
|
-
{
|
|
275
|
-
status:
|
|
276
|
-
Number(input[3]) < 0 || Number(input[3]) > 1
|
|
277
|
-
? 'negative'
|
|
278
|
-
: undefined,
|
|
279
|
-
},
|
|
280
|
-
React.createElement(index_js_2.Input, {
|
|
281
|
-
size: 'small',
|
|
282
|
-
type: 'number',
|
|
283
|
-
min: '0',
|
|
284
|
-
max: '1',
|
|
285
|
-
step: '.01',
|
|
286
|
-
placeholder: 'A',
|
|
287
|
-
value: input[3] ?? '',
|
|
288
|
-
onChange: (event) => {
|
|
289
|
-
setInput([input[0], input[1], input[2], event.target.value]);
|
|
290
|
-
},
|
|
291
|
-
onKeyDown: (event) => {
|
|
292
|
-
if (event.key === 'Enter') {
|
|
293
|
-
event.preventDefault();
|
|
294
|
-
handleColorInputChange();
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
onBlur: (event) => {
|
|
298
|
-
event.preventDefault();
|
|
299
|
-
if (!isFocusInside(event.relatedTarget)) {
|
|
300
|
-
handleColorInputChange();
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
}),
|
|
304
|
-
),
|
|
305
274
|
);
|
|
306
275
|
const rgbInputs = React.createElement(
|
|
307
276
|
React.Fragment,
|
|
308
277
|
null,
|
|
309
|
-
React.createElement(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
278
|
+
React.createElement(index_js_2.Input, {
|
|
279
|
+
size: 'small',
|
|
280
|
+
type: 'number',
|
|
281
|
+
min: '0',
|
|
282
|
+
max: '255',
|
|
283
|
+
placeholder: 'R',
|
|
284
|
+
value: input[0] ?? '',
|
|
285
|
+
onChange: (event) => {
|
|
286
|
+
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
316
287
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
type: 'number',
|
|
320
|
-
min: '0',
|
|
321
|
-
max: '255',
|
|
322
|
-
placeholder: 'R',
|
|
323
|
-
value: input[0] ?? '',
|
|
324
|
-
onChange: (event) => {
|
|
325
|
-
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
326
|
-
},
|
|
327
|
-
onKeyDown: (event) => {
|
|
328
|
-
if (event.key === 'Enter') {
|
|
329
|
-
event.preventDefault();
|
|
330
|
-
handleColorInputChange();
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
onBlur: (event) => {
|
|
288
|
+
onKeyDown: (event) => {
|
|
289
|
+
if (event.key === 'Enter') {
|
|
334
290
|
event.preventDefault();
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
}),
|
|
340
|
-
),
|
|
341
|
-
React.createElement(
|
|
342
|
-
index_js_3.InputContainer,
|
|
343
|
-
{
|
|
344
|
-
status:
|
|
345
|
-
Number(input[1]) < 0 || Number(input[1]) > 255
|
|
346
|
-
? 'negative'
|
|
347
|
-
: undefined,
|
|
291
|
+
handleColorInputChange();
|
|
292
|
+
}
|
|
348
293
|
},
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
294
|
+
onBlur: (event) => {
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
297
|
+
handleColorInputChange();
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
status:
|
|
301
|
+
Number(input[0]) < 0 || Number(input[0]) > 255 ? 'negative' : undefined,
|
|
302
|
+
}),
|
|
303
|
+
React.createElement(index_js_2.Input, {
|
|
304
|
+
size: 'small',
|
|
305
|
+
type: 'number',
|
|
306
|
+
min: '0',
|
|
307
|
+
max: '255',
|
|
308
|
+
placeholder: 'G',
|
|
309
|
+
value: input[1] ?? '',
|
|
310
|
+
onChange: (event) => {
|
|
311
|
+
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
312
|
+
},
|
|
313
|
+
onKeyDown: (event) => {
|
|
314
|
+
if (event.key === 'Enter') {
|
|
366
315
|
event.preventDefault();
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
{
|
|
376
|
-
status:
|
|
377
|
-
Number(input[2]) < 0 || Number(input[2]) > 255
|
|
378
|
-
? 'negative'
|
|
379
|
-
: undefined,
|
|
316
|
+
handleColorInputChange();
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
onBlur: (event) => {
|
|
320
|
+
event.preventDefault();
|
|
321
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
322
|
+
handleColorInputChange();
|
|
323
|
+
}
|
|
380
324
|
},
|
|
325
|
+
status:
|
|
326
|
+
Number(input[1]) < 0 || Number(input[1]) > 255 ? 'negative' : undefined,
|
|
327
|
+
}),
|
|
328
|
+
React.createElement(index_js_2.Input, {
|
|
329
|
+
size: 'small',
|
|
330
|
+
type: 'number',
|
|
331
|
+
min: '0',
|
|
332
|
+
max: '255',
|
|
333
|
+
placeholder: 'B',
|
|
334
|
+
value: input[2] ?? '',
|
|
335
|
+
onChange: (event) => {
|
|
336
|
+
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
337
|
+
},
|
|
338
|
+
onKeyDown: (event) => {
|
|
339
|
+
if (event.key === 'Enter') {
|
|
340
|
+
event.preventDefault();
|
|
341
|
+
handleColorInputChange();
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
onBlur: (event) => {
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
347
|
+
handleColorInputChange();
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
status:
|
|
351
|
+
Number(input[2]) < 0 || Number(input[2]) > 255 ? 'negative' : undefined,
|
|
352
|
+
}),
|
|
353
|
+
showAlpha &&
|
|
381
354
|
React.createElement(index_js_2.Input, {
|
|
382
355
|
size: 'small',
|
|
383
356
|
type: 'number',
|
|
384
357
|
min: '0',
|
|
385
|
-
max: '
|
|
386
|
-
|
|
387
|
-
|
|
358
|
+
max: '1',
|
|
359
|
+
step: '.01',
|
|
360
|
+
placeholder: 'A',
|
|
361
|
+
value: input[3] ?? '',
|
|
388
362
|
onChange: (event) => {
|
|
389
|
-
setInput([input[0], input[1], event.target.value
|
|
363
|
+
setInput([input[0], input[1], input[2], event.target.value]);
|
|
390
364
|
},
|
|
391
365
|
onKeyDown: (event) => {
|
|
392
366
|
if (event.key === 'Enter') {
|
|
@@ -400,42 +374,9 @@ exports.ColorInputPanel = React.forwardRef((props, ref) => {
|
|
|
400
374
|
handleColorInputChange();
|
|
401
375
|
}
|
|
402
376
|
},
|
|
377
|
+
status:
|
|
378
|
+
Number(input[3]) < 0 || Number(input[3]) > 1 ? 'negative' : undefined,
|
|
403
379
|
}),
|
|
404
|
-
),
|
|
405
|
-
showAlpha &&
|
|
406
|
-
React.createElement(
|
|
407
|
-
index_js_3.InputContainer,
|
|
408
|
-
{
|
|
409
|
-
status:
|
|
410
|
-
Number(input[3]) < 0 || Number(input[3]) > 1
|
|
411
|
-
? 'negative'
|
|
412
|
-
: undefined,
|
|
413
|
-
},
|
|
414
|
-
React.createElement(index_js_2.Input, {
|
|
415
|
-
size: 'small',
|
|
416
|
-
type: 'number',
|
|
417
|
-
min: '0',
|
|
418
|
-
max: '1',
|
|
419
|
-
step: '.01',
|
|
420
|
-
placeholder: 'A',
|
|
421
|
-
value: input[3] ?? '',
|
|
422
|
-
onChange: (event) => {
|
|
423
|
-
setInput([input[0], input[1], input[2], event.target.value]);
|
|
424
|
-
},
|
|
425
|
-
onKeyDown: (event) => {
|
|
426
|
-
if (event.key === 'Enter') {
|
|
427
|
-
event.preventDefault();
|
|
428
|
-
handleColorInputChange();
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
onBlur: (event) => {
|
|
432
|
-
event.preventDefault();
|
|
433
|
-
if (!isFocusInside(event.relatedTarget)) {
|
|
434
|
-
handleColorInputChange();
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
}),
|
|
438
|
-
),
|
|
439
380
|
);
|
|
440
381
|
return React.createElement(
|
|
441
382
|
index_js_3.Box,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { SelectOption } from '../Select/index.js';
|
|
3
3
|
import type { Input } from '../Input/Input.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { InputContainerProps, CommonProps } from '../utils/index.js';
|
|
5
5
|
type ActionType = 'added' | 'removed';
|
|
6
6
|
type MultipleOnChangeProps<T> = {
|
|
7
7
|
value: T;
|
|
@@ -48,7 +48,7 @@ export type ComboBoxProps<T> = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Props to customize dropdown menu behavior.
|
|
50
50
|
*/
|
|
51
|
-
dropdownMenuProps?:
|
|
51
|
+
dropdownMenuProps?: React.ComponentProps<'div'>;
|
|
52
52
|
/**
|
|
53
53
|
* Message shown when no options are available.
|
|
54
54
|
* If `JSX.Element` is provided, it will be rendered as is and won't be wrapped with `MenuExtraContent`.
|
|
@@ -14,7 +14,6 @@ const SelectTag_js_1 = tslib_1.__importDefault(
|
|
|
14
14
|
const index_js_2 = require('../Typography/index.js');
|
|
15
15
|
const index_js_3 = require('../utils/index.js');
|
|
16
16
|
const helpers_js_1 = require('./helpers.js');
|
|
17
|
-
const ComboBoxDropdown_js_1 = require('./ComboBoxDropdown.js');
|
|
18
17
|
const ComboBoxEndIcon_js_1 = require('./ComboBoxEndIcon.js');
|
|
19
18
|
const ComboBoxInput_js_1 = require('./ComboBoxInput.js');
|
|
20
19
|
const ComboBoxInputContainer_js_1 = require('./ComboBoxInputContainer.js');
|
|
@@ -57,8 +56,8 @@ const ComboBox = (props) => {
|
|
|
57
56
|
itemRenderer,
|
|
58
57
|
enableVirtualization = false,
|
|
59
58
|
multiple = false,
|
|
60
|
-
onShow,
|
|
61
|
-
onHide,
|
|
59
|
+
onShow: onShowProp,
|
|
60
|
+
onHide: onHideProp,
|
|
62
61
|
...rest
|
|
63
62
|
} = props;
|
|
64
63
|
// Generate a stateful random id if not specified
|
|
@@ -71,7 +70,6 @@ const ComboBox = (props) => {
|
|
|
71
70
|
// Refs get set in subcomponents
|
|
72
71
|
const inputRef = React.useRef(null);
|
|
73
72
|
const menuRef = React.useRef(null);
|
|
74
|
-
const toggleButtonRef = React.useRef(null);
|
|
75
73
|
const onChangeProp = (0, index_js_3.useLatestRef)(onChange);
|
|
76
74
|
const optionsRef = (0, index_js_3.useLatestRef)(options);
|
|
77
75
|
// Record to store all extra information (e.g. original indexes), where the key is the id of the option
|
|
@@ -117,6 +115,16 @@ const ComboBox = (props) => {
|
|
|
117
115
|
focusedIndex: -1,
|
|
118
116
|
},
|
|
119
117
|
);
|
|
118
|
+
const onShowRef = (0, index_js_3.useLatestRef)(onShowProp);
|
|
119
|
+
const onHideRef = (0, index_js_3.useLatestRef)(onHideProp);
|
|
120
|
+
const show = React.useCallback(() => {
|
|
121
|
+
dispatch({ type: 'open' });
|
|
122
|
+
onShowRef.current?.();
|
|
123
|
+
}, [onShowRef]);
|
|
124
|
+
const hide = React.useCallback(() => {
|
|
125
|
+
dispatch({ type: 'close' });
|
|
126
|
+
onHideRef.current?.();
|
|
127
|
+
}, [onHideRef]);
|
|
120
128
|
(0, index_js_3.useIsomorphicLayoutEffect)(() => {
|
|
121
129
|
// When the dropdown opens
|
|
122
130
|
if (isOpen) {
|
|
@@ -141,13 +149,6 @@ const ComboBox = (props) => {
|
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
151
|
}, [isOpen, multiple, optionsRef, selected]);
|
|
144
|
-
// Set min-width of menu to be same as input
|
|
145
|
-
const [minWidth, setMinWidth] = React.useState(0);
|
|
146
|
-
React.useEffect(() => {
|
|
147
|
-
if (inputRef.current) {
|
|
148
|
-
setMinWidth(inputRef.current.offsetWidth);
|
|
149
|
-
}
|
|
150
|
-
}, [isOpen]);
|
|
151
152
|
// Update filtered options to the latest value options according to input value
|
|
152
153
|
const [filteredOptions, setFilteredOptions] = React.useState(options);
|
|
153
154
|
React.useEffect(() => {
|
|
@@ -174,7 +175,7 @@ const ComboBox = (props) => {
|
|
|
174
175
|
(event) => {
|
|
175
176
|
const { value } = event.currentTarget;
|
|
176
177
|
setInputValue(value);
|
|
177
|
-
|
|
178
|
+
show(); // reopen when typing
|
|
178
179
|
setFilteredOptions(
|
|
179
180
|
filterFunction?.(optionsRef.current, value) ??
|
|
180
181
|
optionsRef.current.filter((option) =>
|
|
@@ -186,7 +187,7 @@ const ComboBox = (props) => {
|
|
|
186
187
|
}
|
|
187
188
|
inputProps?.onChange?.(event);
|
|
188
189
|
},
|
|
189
|
-
[filterFunction, focusedIndex, inputProps, optionsRef],
|
|
190
|
+
[filterFunction, focusedIndex, inputProps, optionsRef, show],
|
|
190
191
|
);
|
|
191
192
|
// When the value prop changes, update the selected index/indices
|
|
192
193
|
React.useEffect(() => {
|
|
@@ -276,7 +277,7 @@ const ComboBox = (props) => {
|
|
|
276
277
|
);
|
|
277
278
|
} else {
|
|
278
279
|
dispatch({ type: 'select', value: __originalIndex });
|
|
279
|
-
|
|
280
|
+
hide();
|
|
280
281
|
onChangeHandler(__originalIndex);
|
|
281
282
|
}
|
|
282
283
|
},
|
|
@@ -287,6 +288,7 @@ const ComboBox = (props) => {
|
|
|
287
288
|
onChangeHandler,
|
|
288
289
|
selected,
|
|
289
290
|
optionsRef,
|
|
291
|
+
hide,
|
|
290
292
|
],
|
|
291
293
|
);
|
|
292
294
|
const getMenuItem = React.useCallback(
|
|
@@ -366,9 +368,16 @@ const ComboBox = (props) => {
|
|
|
366
368
|
),
|
|
367
369
|
[emptyStateMessage],
|
|
368
370
|
);
|
|
371
|
+
const popover = (0, index_js_3.usePopover)({
|
|
372
|
+
visible: isOpen,
|
|
373
|
+
onVisibleChange: (open) => (open ? show() : hide()),
|
|
374
|
+
matchWidth: true,
|
|
375
|
+
closeOnOutsideClick: true,
|
|
376
|
+
trigger: { focus: true },
|
|
377
|
+
});
|
|
369
378
|
return React.createElement(
|
|
370
379
|
helpers_js_1.ComboBoxRefsContext.Provider,
|
|
371
|
-
{ value: { inputRef, menuRef,
|
|
380
|
+
{ value: { inputRef, menuRef, optionsExtraInfoRef } },
|
|
372
381
|
React.createElement(
|
|
373
382
|
helpers_js_1.ComboBoxActionContext.Provider,
|
|
374
383
|
{ value: dispatch },
|
|
@@ -377,7 +386,6 @@ const ComboBox = (props) => {
|
|
|
377
386
|
{
|
|
378
387
|
value: {
|
|
379
388
|
id,
|
|
380
|
-
minWidth,
|
|
381
389
|
isOpen,
|
|
382
390
|
focusedIndex,
|
|
383
391
|
onClickHandler,
|
|
@@ -385,6 +393,9 @@ const ComboBox = (props) => {
|
|
|
385
393
|
filteredOptions,
|
|
386
394
|
getMenuItem,
|
|
387
395
|
multiple,
|
|
396
|
+
popover,
|
|
397
|
+
show,
|
|
398
|
+
hide,
|
|
388
399
|
},
|
|
389
400
|
},
|
|
390
401
|
React.createElement(
|
|
@@ -395,6 +406,7 @@ const ComboBox = (props) => {
|
|
|
395
406
|
null,
|
|
396
407
|
React.createElement(ComboBoxInput_js_1.ComboBoxInput, {
|
|
397
408
|
value: inputValue,
|
|
409
|
+
disabled: inputProps?.disabled,
|
|
398
410
|
...inputProps,
|
|
399
411
|
onChange: handleOnInput,
|
|
400
412
|
selectTags: isMultipleEnabled(selected, multiple)
|
|
@@ -419,15 +431,11 @@ const ComboBox = (props) => {
|
|
|
419
431
|
: null,
|
|
420
432
|
),
|
|
421
433
|
React.createElement(
|
|
422
|
-
|
|
423
|
-
{
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
filteredOptions.length > 0 && !enableVirtualization
|
|
428
|
-
? filteredOptions.map(getMenuItem)
|
|
429
|
-
: emptyContent,
|
|
430
|
-
),
|
|
434
|
+
ComboBoxMenu_js_1.ComboBoxMenu,
|
|
435
|
+
{ as: 'div', ...dropdownMenuProps },
|
|
436
|
+
filteredOptions.length > 0 && !enableVirtualization
|
|
437
|
+
? filteredOptions.map(getMenuItem)
|
|
438
|
+
: emptyContent,
|
|
431
439
|
),
|
|
432
440
|
),
|
|
433
441
|
),
|
|
@@ -9,40 +9,21 @@ const tslib_1 = require('tslib');
|
|
|
9
9
|
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
10
10
|
const React = tslib_1.__importStar(require('react'));
|
|
11
11
|
const index_js_1 = require('../utils/index.js');
|
|
12
|
-
const helpers_js_1 = require('./helpers.js');
|
|
13
12
|
exports.ComboBoxEndIcon = React.forwardRef((props, forwardedRef) => {
|
|
14
|
-
const {
|
|
15
|
-
className,
|
|
16
|
-
children,
|
|
17
|
-
onClick: onClickProp,
|
|
18
|
-
disabled,
|
|
19
|
-
isOpen,
|
|
20
|
-
...rest
|
|
21
|
-
} = props;
|
|
22
|
-
const dispatch = (0, index_js_1.useSafeContext)(
|
|
23
|
-
helpers_js_1.ComboBoxActionContext,
|
|
24
|
-
);
|
|
25
|
-
const { toggleButtonRef } = (0, index_js_1.useSafeContext)(
|
|
26
|
-
helpers_js_1.ComboBoxRefsContext,
|
|
27
|
-
);
|
|
28
|
-
const refs = (0, index_js_1.useMergedRefs)(toggleButtonRef, forwardedRef);
|
|
13
|
+
const { className, children, disabled, isOpen, ...rest } = props;
|
|
29
14
|
return React.createElement(
|
|
30
|
-
index_js_1.
|
|
15
|
+
index_js_1.Icon,
|
|
31
16
|
{
|
|
32
17
|
as: 'span',
|
|
33
|
-
ref:
|
|
18
|
+
ref: forwardedRef,
|
|
34
19
|
className: (0, classnames_1.default)(
|
|
35
20
|
'iui-end-icon',
|
|
36
21
|
{
|
|
37
|
-
'iui-actionable': !disabled,
|
|
38
22
|
'iui-disabled': disabled,
|
|
39
23
|
'iui-open': isOpen,
|
|
40
24
|
},
|
|
41
25
|
className,
|
|
42
26
|
),
|
|
43
|
-
onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, () => {
|
|
44
|
-
dispatch({ type: isOpen ? 'close' : 'open' });
|
|
45
|
-
}),
|
|
46
27
|
...rest,
|
|
47
28
|
},
|
|
48
29
|
children ??
|