@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
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -14,7 +14,7 @@ const index_js_3 = require('../Buttons/index.js');
|
|
|
14
14
|
const index_js_4 = require('../ProgressIndicators/index.js');
|
|
15
15
|
const TileContext = React.createContext(undefined);
|
|
16
16
|
TileContext.displayName = 'TileContext';
|
|
17
|
-
const
|
|
17
|
+
const TileWrapper = React.forwardRef((props, forwardedRef) => {
|
|
18
18
|
const {
|
|
19
19
|
className,
|
|
20
20
|
status,
|
|
@@ -60,7 +60,7 @@ const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
|
60
60
|
}),
|
|
61
61
|
);
|
|
62
62
|
});
|
|
63
|
-
|
|
63
|
+
TileWrapper.displayName = 'Tile.Wrapper';
|
|
64
64
|
// ----------------------------------------------------------------------------
|
|
65
65
|
// Tile.Action component
|
|
66
66
|
const TileAction = React.forwardRef((props, forwardedRef) => {
|
|
@@ -227,32 +227,31 @@ const TileMoreOptions = React.forwardRef((props, forwardedRef) => {
|
|
|
227
227
|
const { className, children = [], buttonProps, ...rest } = props;
|
|
228
228
|
const [isMenuVisible, setIsMenuVisible] = React.useState(false);
|
|
229
229
|
return React.createElement(
|
|
230
|
-
|
|
230
|
+
index_js_1.Box,
|
|
231
231
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}),
|
|
242
|
-
),
|
|
232
|
+
className: (0, classnames_1.default)(
|
|
233
|
+
'iui-tile-more-options',
|
|
234
|
+
{
|
|
235
|
+
'iui-visible': isMenuVisible,
|
|
236
|
+
},
|
|
237
|
+
className,
|
|
238
|
+
),
|
|
239
|
+
ref: forwardedRef,
|
|
240
|
+
...rest,
|
|
243
241
|
},
|
|
244
242
|
React.createElement(
|
|
245
|
-
|
|
243
|
+
index_js_2.DropdownMenu,
|
|
246
244
|
{
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
245
|
+
onVisibleChange: setIsMenuVisible,
|
|
246
|
+
menuItems: (close) =>
|
|
247
|
+
children?.map((option) =>
|
|
248
|
+
React.cloneElement(option, {
|
|
249
|
+
onClick: (value) => {
|
|
250
|
+
close();
|
|
251
|
+
option.props.onClick?.(value);
|
|
252
|
+
},
|
|
253
|
+
}),
|
|
254
|
+
),
|
|
256
255
|
},
|
|
257
256
|
React.createElement(
|
|
258
257
|
index_js_3.IconButton,
|
|
@@ -272,10 +271,84 @@ TileMoreOptions.displayName = 'Tile.MoreOptions';
|
|
|
272
271
|
// Tile.Buttons component
|
|
273
272
|
const TileButtons = (0, index_js_1.polymorphic)('iui-tile-buttons');
|
|
274
273
|
TileButtons.displayName = 'Tile.Buttons';
|
|
274
|
+
const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
275
|
+
const {
|
|
276
|
+
name,
|
|
277
|
+
description,
|
|
278
|
+
status,
|
|
279
|
+
isNew,
|
|
280
|
+
isLoading,
|
|
281
|
+
isSelected,
|
|
282
|
+
thumbnail,
|
|
283
|
+
badge,
|
|
284
|
+
leftIcon,
|
|
285
|
+
rightIcon,
|
|
286
|
+
buttons,
|
|
287
|
+
metadata,
|
|
288
|
+
moreOptions,
|
|
289
|
+
children,
|
|
290
|
+
isActionable,
|
|
291
|
+
isDisabled,
|
|
292
|
+
onClick,
|
|
293
|
+
...rest
|
|
294
|
+
} = props;
|
|
295
|
+
return React.createElement(
|
|
296
|
+
TileWrapper,
|
|
297
|
+
{
|
|
298
|
+
ref: forwardedRef,
|
|
299
|
+
isNew: isNew,
|
|
300
|
+
isSelected: isSelected,
|
|
301
|
+
isLoading: isLoading,
|
|
302
|
+
status: status,
|
|
303
|
+
isDisabled: isDisabled,
|
|
304
|
+
...rest,
|
|
305
|
+
},
|
|
306
|
+
React.createElement(
|
|
307
|
+
TileName,
|
|
308
|
+
null,
|
|
309
|
+
(status || isNew || isLoading || isSelected) &&
|
|
310
|
+
React.createElement(TileNameIcon, null),
|
|
311
|
+
React.createElement(
|
|
312
|
+
TileNameLabel,
|
|
313
|
+
null,
|
|
314
|
+
isActionable
|
|
315
|
+
? React.createElement(
|
|
316
|
+
TileAction,
|
|
317
|
+
{
|
|
318
|
+
onClick: !isDisabled ? onClick : undefined,
|
|
319
|
+
'aria-disabled': isDisabled,
|
|
320
|
+
},
|
|
321
|
+
name,
|
|
322
|
+
)
|
|
323
|
+
: name,
|
|
324
|
+
),
|
|
325
|
+
),
|
|
326
|
+
React.createElement(
|
|
327
|
+
TileThumbnailArea,
|
|
328
|
+
null,
|
|
329
|
+
typeof thumbnail !== 'string'
|
|
330
|
+
? React.createElement(TileThumbnailPicture, null, thumbnail)
|
|
331
|
+
: React.createElement(TileThumbnailPicture, { url: thumbnail }),
|
|
332
|
+
badge && React.createElement(TileBadgeContainer, null, badge),
|
|
333
|
+
leftIcon && React.createElement(TileTypeIndicator, null, leftIcon),
|
|
334
|
+
rightIcon && React.createElement(TileQuickAction, null, rightIcon),
|
|
335
|
+
),
|
|
336
|
+
React.createElement(
|
|
337
|
+
TileContentArea,
|
|
338
|
+
null,
|
|
339
|
+
description && React.createElement(TileDescription, null, description),
|
|
340
|
+
moreOptions && React.createElement(TileMoreOptions, null, moreOptions),
|
|
341
|
+
metadata && React.createElement(TileMetadata, null, metadata),
|
|
342
|
+
children,
|
|
343
|
+
),
|
|
344
|
+
buttons && React.createElement(TileButtons, null, buttons),
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
TileComponent.displayName = 'Tile';
|
|
275
348
|
/**
|
|
276
349
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
277
350
|
* @example
|
|
278
|
-
* <Tile>
|
|
351
|
+
* <Tile.Wrapper>
|
|
279
352
|
* <Tile.ThumbnailArea>
|
|
280
353
|
* <Tile.ThumbnailPicture/>
|
|
281
354
|
* <Tile.Badge/>
|
|
@@ -285,23 +358,40 @@ TileButtons.displayName = 'Tile.Buttons';
|
|
|
285
358
|
* <Tile.Name>
|
|
286
359
|
* <Tile.NameIcon/>
|
|
287
360
|
* <Tile.NameLabel/>
|
|
288
|
-
*
|
|
361
|
+
* </Tile.Name>
|
|
289
362
|
* <Tile.ContentArea>
|
|
290
363
|
* <Tile.Description />
|
|
291
364
|
* <Tile.Metadata/>
|
|
292
365
|
* <Tile.MoreOptions/>
|
|
293
366
|
* </Tile.ContentArea>
|
|
294
367
|
* <Tile.Buttons/>
|
|
295
|
-
* </Tile>
|
|
368
|
+
* </Tile.Wrapper>
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* <Tile
|
|
372
|
+
* name='Tile name'
|
|
373
|
+
* description='Tile description that takes upto 3 lines'
|
|
374
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
375
|
+
* thumbnail='/url/to/image.jpg'
|
|
376
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
377
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
378
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
379
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
380
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
381
|
+
* isSelected={true}
|
|
382
|
+
* isNew={false}
|
|
383
|
+
* />
|
|
296
384
|
*/
|
|
297
385
|
exports.Tile = Object.assign(TileComponent, {
|
|
386
|
+
/**
|
|
387
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
388
|
+
*/
|
|
389
|
+
Wrapper: TileWrapper,
|
|
298
390
|
/**
|
|
299
391
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
300
392
|
* @example
|
|
301
393
|
* <Tile.ThumbnailArea>
|
|
302
394
|
* <Tile.ThumbnailPicture/>
|
|
303
|
-
* // or
|
|
304
|
-
* <Tile.ThumbnailAvatar/>
|
|
305
395
|
* <Tile.QuickAction/>
|
|
306
396
|
* <Tile.TypeIndicator/>
|
|
307
397
|
* <Tile.BadgeContainer/>
|
|
@@ -311,14 +401,14 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
311
401
|
/**
|
|
312
402
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
313
403
|
* @example
|
|
314
|
-
* <Tile>
|
|
404
|
+
* <Tile.Wrapper>
|
|
315
405
|
* // ...
|
|
316
406
|
* <Tile.ThumbnailArea>
|
|
317
407
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
318
408
|
* </Tile.ThumbnailArea>
|
|
319
|
-
* </Tile>
|
|
409
|
+
* </Tile.Wrapper>
|
|
320
410
|
* or
|
|
321
|
-
* <Tile>
|
|
411
|
+
* <Tile.Wrapper>
|
|
322
412
|
* // ...
|
|
323
413
|
* <Tile.ThumbnailArea>
|
|
324
414
|
* <Tile.ThumbnailPicture>
|
|
@@ -355,21 +445,21 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
355
445
|
/**
|
|
356
446
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
357
447
|
* @example
|
|
358
|
-
* <Tile>
|
|
448
|
+
* <Tile.Wrapper>
|
|
359
449
|
* <Tile.Name>
|
|
360
450
|
* <Tile.NameIcon/>
|
|
361
451
|
* </Tile.Name>
|
|
362
|
-
*
|
|
452
|
+
* </Tile.Wrapper>
|
|
363
453
|
*/
|
|
364
454
|
NameIcon: TileNameIcon,
|
|
365
455
|
/*
|
|
366
456
|
* `NameLabel` of the tile
|
|
367
457
|
* @example
|
|
368
|
-
* <Tile>
|
|
458
|
+
* <Tile.Wrapper>
|
|
369
459
|
* <Tile.Name>
|
|
370
460
|
* <Tile.NameLabel> Tile Name <Tile.NameLabel/>
|
|
371
461
|
* </Tile.Name/>
|
|
372
|
-
*
|
|
462
|
+
* </Tile.Wrapper>
|
|
373
463
|
*/
|
|
374
464
|
NameLabel: TileNameLabel,
|
|
375
465
|
/**
|
|
@@ -386,13 +476,13 @@ exports.Tile = Object.assign(TileComponent, {
|
|
|
386
476
|
/**
|
|
387
477
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
388
478
|
* @example
|
|
389
|
-
* <Tile>
|
|
479
|
+
* <Tile.Wrapper>
|
|
390
480
|
* <Tile.ContentArea>
|
|
391
481
|
* <Tile.Description/>
|
|
392
482
|
* <Tile.Metadata/>
|
|
393
483
|
* <Tile.MoreOptions/>
|
|
394
484
|
* </Tile.ContentArea>
|
|
395
|
-
* </Tile>
|
|
485
|
+
* </Tile.Wrapper>
|
|
396
486
|
*/
|
|
397
487
|
ContentArea: TileContentArea,
|
|
398
488
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
3
|
export type ToastCategory = 'informational' | 'negative' | 'positive' | 'warning';
|
|
4
4
|
export type ToastProps = {
|
|
5
5
|
/**
|
|
@@ -10,6 +10,13 @@ export type ToastProps = {
|
|
|
10
10
|
* Content of the Toast message
|
|
11
11
|
*/
|
|
12
12
|
content: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Passes props to toast and content
|
|
15
|
+
*/
|
|
16
|
+
domProps?: {
|
|
17
|
+
toastProps?: React.ComponentProps<'div'>;
|
|
18
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
19
|
+
};
|
|
13
20
|
/**
|
|
14
21
|
* Category of the Toast, which controls the border color, as well as the category icon.
|
|
15
22
|
*/
|
|
@@ -60,12 +67,13 @@ export type ToastProps = {
|
|
|
60
67
|
* <Toast type='persisting' content='Job processing error.' category='negative' />
|
|
61
68
|
*/
|
|
62
69
|
export declare const Toast: (props: ToastProps) => React.JSX.Element;
|
|
63
|
-
export type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id' | 'isVisible' | 'onRemove'> & {
|
|
70
|
+
export type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id' | 'isVisible' | 'onRemove' | 'domProps'> & {
|
|
64
71
|
onClose?: () => void;
|
|
65
|
-
|
|
72
|
+
contentProps?: React.ComponentProps<'div'>;
|
|
73
|
+
};
|
|
66
74
|
/**
|
|
67
75
|
* The presentational part of a toast, without any animation or logic.
|
|
68
76
|
* @private
|
|
69
77
|
*/
|
|
70
|
-
export declare const ToastPresentation:
|
|
78
|
+
export declare const ToastPresentation: PolymorphicForwardRefComponent<"div", ToastPresentationProps>;
|
|
71
79
|
export default Toast;
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -35,6 +35,7 @@ const Toast = (props) => {
|
|
|
35
35
|
hasCloseButton,
|
|
36
36
|
onRemove,
|
|
37
37
|
animateOutTo,
|
|
38
|
+
domProps,
|
|
38
39
|
} = props;
|
|
39
40
|
const closeTimeout = React.useRef(0);
|
|
40
41
|
const { placement } = (0, index_js_1.useSafeContext)(
|
|
@@ -149,12 +150,15 @@ const Toast = (props) => {
|
|
|
149
150
|
'div',
|
|
150
151
|
{ ref: onRef },
|
|
151
152
|
React.createElement(exports.ToastPresentation, {
|
|
153
|
+
as: 'div',
|
|
152
154
|
category: category,
|
|
153
155
|
content: content,
|
|
154
156
|
link: link,
|
|
155
157
|
type: type,
|
|
156
158
|
hasCloseButton: hasCloseButton,
|
|
157
159
|
onClose: close,
|
|
160
|
+
...domProps?.toastProps,
|
|
161
|
+
contentProps: domProps?.contentProps,
|
|
158
162
|
}),
|
|
159
163
|
),
|
|
160
164
|
),
|
|
@@ -165,7 +169,7 @@ exports.Toast = Toast;
|
|
|
165
169
|
* The presentational part of a toast, without any animation or logic.
|
|
166
170
|
* @private
|
|
167
171
|
*/
|
|
168
|
-
|
|
172
|
+
exports.ToastPresentation = React.forwardRef((props, forwardedRef) => {
|
|
169
173
|
const {
|
|
170
174
|
content,
|
|
171
175
|
category,
|
|
@@ -174,6 +178,7 @@ const ToastPresentation = (props) => {
|
|
|
174
178
|
hasCloseButton,
|
|
175
179
|
onClose,
|
|
176
180
|
className,
|
|
181
|
+
contentProps,
|
|
177
182
|
...rest
|
|
178
183
|
} = props;
|
|
179
184
|
const StatusIcon = index_js_1.StatusIconMap[category];
|
|
@@ -184,6 +189,7 @@ const ToastPresentation = (props) => {
|
|
|
184
189
|
`iui-toast iui-${category}`,
|
|
185
190
|
className,
|
|
186
191
|
),
|
|
192
|
+
ref: forwardedRef,
|
|
187
193
|
...rest,
|
|
188
194
|
},
|
|
189
195
|
React.createElement(
|
|
@@ -191,7 +197,18 @@ const ToastPresentation = (props) => {
|
|
|
191
197
|
{ className: 'iui-status-area' },
|
|
192
198
|
React.createElement(StatusIcon, { className: 'iui-icon' }),
|
|
193
199
|
),
|
|
194
|
-
React.createElement(
|
|
200
|
+
React.createElement(
|
|
201
|
+
index_js_1.Box,
|
|
202
|
+
{
|
|
203
|
+
as: 'div',
|
|
204
|
+
...contentProps,
|
|
205
|
+
className: (0, classnames_1.default)(
|
|
206
|
+
'iui-message',
|
|
207
|
+
contentProps?.className,
|
|
208
|
+
),
|
|
209
|
+
},
|
|
210
|
+
content,
|
|
211
|
+
),
|
|
195
212
|
link &&
|
|
196
213
|
React.createElement(
|
|
197
214
|
index_js_1.ButtonBase,
|
|
@@ -210,6 +227,5 @@ const ToastPresentation = (props) => {
|
|
|
210
227
|
React.createElement(index_js_1.SvgCloseSmall, null),
|
|
211
228
|
),
|
|
212
229
|
);
|
|
213
|
-
};
|
|
214
|
-
exports.ToastPresentation = ToastPresentation;
|
|
230
|
+
});
|
|
215
231
|
exports.default = exports.Toast;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Placement } from '@floating-ui/react';
|
|
3
|
-
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
+
import type { PolymorphicForwardRefComponent, PortalProps } from '../utils/index.js';
|
|
4
4
|
type TooltipOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Placement of the Tooltip
|
|
@@ -11,6 +11,11 @@ type TooltipOptions = {
|
|
|
11
11
|
* Property for manual visibility control
|
|
12
12
|
*/
|
|
13
13
|
visible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback invoked every time the tooltip visibility changes as a result
|
|
16
|
+
* of internal logic. Should be used alongside `visible` prop.
|
|
17
|
+
*/
|
|
18
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
14
19
|
/**
|
|
15
20
|
* autoUpdate options that recalculates position
|
|
16
21
|
* to ensure the floating element remains anchored
|
|
@@ -42,34 +47,26 @@ type TooltipOptions = {
|
|
|
42
47
|
hide?: boolean;
|
|
43
48
|
inline?: boolean;
|
|
44
49
|
};
|
|
45
|
-
};
|
|
46
|
-
type TooltipOwnProps = {
|
|
47
|
-
/**
|
|
48
|
-
* Content of the tooltip.
|
|
49
|
-
*/
|
|
50
|
-
content: React.ReactNode;
|
|
51
|
-
/**
|
|
52
|
-
* Element to have tooltip on. Has to be a valid JSX element and needs to forward its ref.
|
|
53
|
-
* If not specified, the `reference` prop should be used instead.
|
|
54
|
-
*/
|
|
55
|
-
children?: React.ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* Element to portal tooltip to.
|
|
58
|
-
* Portals to ThemeProvider portalContainer by default.
|
|
59
|
-
* @default true;
|
|
60
|
-
*/
|
|
61
|
-
portal?: boolean | {
|
|
62
|
-
to: HTMLElement;
|
|
63
|
-
};
|
|
64
50
|
/**
|
|
65
51
|
* Sets reference point to user provided element.
|
|
66
52
|
* @example
|
|
67
|
-
* const
|
|
53
|
+
* const [trigger, setTrigger] = React.useState(null);
|
|
68
54
|
* ...
|
|
69
|
-
* <Button ref={
|
|
70
|
-
* <Tooltip content='tooltip text' reference={
|
|
55
|
+
* <Button ref={setTrigger} />
|
|
56
|
+
* <Tooltip content='tooltip text' reference={trigger} />
|
|
71
57
|
*/
|
|
72
|
-
reference?:
|
|
58
|
+
reference?: HTMLElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* By default, the tooltip will be associated with the reference element
|
|
61
|
+
* using `aria-describedby`.
|
|
62
|
+
*
|
|
63
|
+
* Pass "label" if you want to use `aria-labelledby` instead, or pass "none"
|
|
64
|
+
* if you don't want any association.
|
|
65
|
+
*
|
|
66
|
+
* @default 'description'
|
|
67
|
+
*/
|
|
68
|
+
ariaStrategy?: 'description' | 'label' | 'none';
|
|
69
|
+
id?: string;
|
|
73
70
|
};
|
|
74
71
|
/**
|
|
75
72
|
* Basic tooltip component to display informative content when an element is hovered or focused.
|
|
@@ -77,10 +74,20 @@ type TooltipOwnProps = {
|
|
|
77
74
|
* @example
|
|
78
75
|
* <Tooltip content='tooltip text' placement='top'>Hover here</Tooltip>
|
|
79
76
|
* @example
|
|
80
|
-
* const
|
|
77
|
+
* const [trigger, setTrigger] = React.useState(null);
|
|
81
78
|
* ...
|
|
82
|
-
* <Button ref={
|
|
83
|
-
* <Tooltip content='tooltip text' reference={
|
|
79
|
+
* <Button ref={setTrigger} />
|
|
80
|
+
* <Tooltip content='tooltip text' reference={trigger} />
|
|
84
81
|
*/
|
|
85
|
-
export declare const Tooltip: PolymorphicForwardRefComponent<"div",
|
|
82
|
+
export declare const Tooltip: PolymorphicForwardRefComponent<"div", {
|
|
83
|
+
/**
|
|
84
|
+
* Content of the tooltip.
|
|
85
|
+
*/
|
|
86
|
+
content: React.ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Element to have tooltip on. Has to be a valid JSX element and needs to forward its ref.
|
|
89
|
+
* If not specified, the `reference` prop should be used instead.
|
|
90
|
+
*/
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
} & PortalProps & TooltipOptions>;
|
|
86
93
|
export default Tooltip;
|