@itwin/itwinui-react 3.0.0-dev.7 → 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 +56 -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/IconButton/IconButton.js +27 -44
- package/cjs/core/Buttons/SplitButton/SplitButton.js +3 -0
- 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/ComboBoxMenu.d.ts +2 -2
- 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 +40 -5
- package/cjs/core/Dialog/Dialog.js +10 -16
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
- package/cjs/core/Header/HeaderSplitButton.js +1 -0
- 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/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +10 -9
- 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/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/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 +107 -16
- 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 +2 -0
- package/cjs/core/index.js +20 -4
- 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/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 -28
- 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/IconButton/IconButton.js +25 -40
- package/esm/core/Buttons/SplitButton/SplitButton.js +9 -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/ComboBoxMenu.d.ts +2 -2
- 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 +25 -5
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
- package/esm/core/Header/HeaderSplitButton.js +1 -0
- 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/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +10 -9
- 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/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/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 +107 -16
- 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 +2 -0
- package/esm/core/index.js +2 -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/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 -28
- package/package.json +3 -3
- package/styles.css +22 -19
- package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
- 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,
|
|
@@ -71,7 +71,6 @@ const ComboBox = (props) => {
|
|
|
71
71
|
// Refs get set in subcomponents
|
|
72
72
|
const inputRef = React.useRef(null);
|
|
73
73
|
const menuRef = React.useRef(null);
|
|
74
|
-
const toggleButtonRef = React.useRef(null);
|
|
75
74
|
const onChangeProp = (0, index_js_3.useLatestRef)(onChange);
|
|
76
75
|
const optionsRef = (0, index_js_3.useLatestRef)(options);
|
|
77
76
|
// Record to store all extra information (e.g. original indexes), where the key is the id of the option
|
|
@@ -368,7 +367,7 @@ const ComboBox = (props) => {
|
|
|
368
367
|
);
|
|
369
368
|
return React.createElement(
|
|
370
369
|
helpers_js_1.ComboBoxRefsContext.Provider,
|
|
371
|
-
{ value: { inputRef, menuRef,
|
|
370
|
+
{ value: { inputRef, menuRef, optionsExtraInfoRef } },
|
|
372
371
|
React.createElement(
|
|
373
372
|
helpers_js_1.ComboBoxActionContext.Provider,
|
|
374
373
|
{ value: dispatch },
|
|
@@ -389,12 +388,13 @@ const ComboBox = (props) => {
|
|
|
389
388
|
},
|
|
390
389
|
React.createElement(
|
|
391
390
|
ComboBoxInputContainer_js_1.ComboBoxInputContainer,
|
|
392
|
-
{
|
|
391
|
+
{ ...rest },
|
|
393
392
|
React.createElement(
|
|
394
393
|
React.Fragment,
|
|
395
394
|
null,
|
|
396
395
|
React.createElement(ComboBoxInput_js_1.ComboBoxInput, {
|
|
397
396
|
value: inputValue,
|
|
397
|
+
disabled: inputProps?.disabled,
|
|
398
398
|
...inputProps,
|
|
399
399
|
onChange: handleOnInput,
|
|
400
400
|
selectTags: isMultipleEnabled(selected, multiple)
|
|
@@ -17,7 +17,7 @@ exports.ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
17
17
|
const dispatch = (0, index_js_1.useSafeContext)(
|
|
18
18
|
helpers_js_1.ComboBoxActionContext,
|
|
19
19
|
);
|
|
20
|
-
const { inputRef
|
|
20
|
+
const { inputRef } = (0, index_js_1.useSafeContext)(
|
|
21
21
|
helpers_js_1.ComboBoxRefsContext,
|
|
22
22
|
);
|
|
23
23
|
// sync internal isOpen state with user's visible prop
|
|
@@ -29,14 +29,9 @@ exports.ComboBoxDropdown = React.forwardRef((props, forwardedRef) => {
|
|
|
29
29
|
return React.createElement(index_js_1.Popover, {
|
|
30
30
|
placement: 'bottom-start',
|
|
31
31
|
visible: isOpen,
|
|
32
|
-
onClickOutside: React.useCallback(
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
dispatch({ type: 'close' });
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
[dispatch, toggleButtonRef],
|
|
39
|
-
),
|
|
32
|
+
onClickOutside: React.useCallback(() => {
|
|
33
|
+
dispatch({ type: 'close' });
|
|
34
|
+
}, [dispatch]),
|
|
40
35
|
animation: 'shift-away',
|
|
41
36
|
duration: 200,
|
|
42
37
|
reference: inputRef,
|
|
@@ -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 ??
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -37,6 +37,7 @@ exports.ComboBoxMenuItem = React.memo(
|
|
|
37
37
|
return React.createElement(
|
|
38
38
|
ListItem_js_1.ListItem,
|
|
39
39
|
{
|
|
40
|
+
as: 'div',
|
|
40
41
|
actionable: true,
|
|
41
42
|
size: size,
|
|
42
43
|
active: isSelected,
|
|
@@ -68,12 +69,13 @@ exports.ComboBoxMenuItem = React.memo(
|
|
|
68
69
|
sublabel,
|
|
69
70
|
),
|
|
70
71
|
),
|
|
71
|
-
endIcon
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
endIcon ||
|
|
73
|
+
(isSelected &&
|
|
74
|
+
React.createElement(
|
|
75
|
+
ListItem_js_1.ListItem.Icon,
|
|
76
|
+
{ as: 'span', 'aria-hidden': true },
|
|
77
|
+
endIcon ?? React.createElement(index_js_1.SvgCheckmark, null),
|
|
78
|
+
)),
|
|
77
79
|
);
|
|
78
80
|
}),
|
|
79
81
|
);
|
|
@@ -25,8 +25,7 @@ export declare const comboBoxReducer: (state: {
|
|
|
25
25
|
};
|
|
26
26
|
export declare const ComboBoxRefsContext: React.Context<{
|
|
27
27
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
28
|
-
menuRef: React.RefObject<
|
|
29
|
-
toggleButtonRef: React.RefObject<HTMLSpanElement>;
|
|
28
|
+
menuRef: React.RefObject<HTMLElement>;
|
|
30
29
|
optionsExtraInfoRef: React.MutableRefObject<Record<string, {
|
|
31
30
|
__originalIndex: number;
|
|
32
31
|
}>>;
|