@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/esm/core/Tile/Tile.js
CHANGED
|
@@ -20,7 +20,7 @@ import { IconButton } from '../Buttons/index.js';
|
|
|
20
20
|
import { ProgressRadial } from '../ProgressIndicators/index.js';
|
|
21
21
|
const TileContext = React.createContext(undefined);
|
|
22
22
|
TileContext.displayName = 'TileContext';
|
|
23
|
-
const
|
|
23
|
+
const TileWrapper = React.forwardRef((props, forwardedRef) => {
|
|
24
24
|
const {
|
|
25
25
|
className,
|
|
26
26
|
status,
|
|
@@ -66,7 +66,7 @@ const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
|
66
66
|
}),
|
|
67
67
|
);
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
TileWrapper.displayName = 'Tile.Wrapper';
|
|
70
70
|
// ----------------------------------------------------------------------------
|
|
71
71
|
// Tile.Action component
|
|
72
72
|
const TileAction = React.forwardRef((props, forwardedRef) => {
|
|
@@ -212,32 +212,31 @@ const TileMoreOptions = React.forwardRef((props, forwardedRef) => {
|
|
|
212
212
|
const { className, children = [], buttonProps, ...rest } = props;
|
|
213
213
|
const [isMenuVisible, setIsMenuVisible] = React.useState(false);
|
|
214
214
|
return React.createElement(
|
|
215
|
-
|
|
215
|
+
Box,
|
|
216
216
|
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}),
|
|
227
|
-
),
|
|
217
|
+
className: cx(
|
|
218
|
+
'iui-tile-more-options',
|
|
219
|
+
{
|
|
220
|
+
'iui-visible': isMenuVisible,
|
|
221
|
+
},
|
|
222
|
+
className,
|
|
223
|
+
),
|
|
224
|
+
ref: forwardedRef,
|
|
225
|
+
...rest,
|
|
228
226
|
},
|
|
229
227
|
React.createElement(
|
|
230
|
-
|
|
228
|
+
DropdownMenu,
|
|
231
229
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
onVisibleChange: setIsMenuVisible,
|
|
231
|
+
menuItems: (close) =>
|
|
232
|
+
children?.map((option) =>
|
|
233
|
+
React.cloneElement(option, {
|
|
234
|
+
onClick: (value) => {
|
|
235
|
+
close();
|
|
236
|
+
option.props.onClick?.(value);
|
|
237
|
+
},
|
|
238
|
+
}),
|
|
239
|
+
),
|
|
241
240
|
},
|
|
242
241
|
React.createElement(
|
|
243
242
|
IconButton,
|
|
@@ -257,10 +256,84 @@ TileMoreOptions.displayName = 'Tile.MoreOptions';
|
|
|
257
256
|
// Tile.Buttons component
|
|
258
257
|
const TileButtons = polymorphic('iui-tile-buttons');
|
|
259
258
|
TileButtons.displayName = 'Tile.Buttons';
|
|
259
|
+
const TileComponent = React.forwardRef((props, forwardedRef) => {
|
|
260
|
+
const {
|
|
261
|
+
name,
|
|
262
|
+
description,
|
|
263
|
+
status,
|
|
264
|
+
isNew,
|
|
265
|
+
isLoading,
|
|
266
|
+
isSelected,
|
|
267
|
+
thumbnail,
|
|
268
|
+
badge,
|
|
269
|
+
leftIcon,
|
|
270
|
+
rightIcon,
|
|
271
|
+
buttons,
|
|
272
|
+
metadata,
|
|
273
|
+
moreOptions,
|
|
274
|
+
children,
|
|
275
|
+
isActionable,
|
|
276
|
+
isDisabled,
|
|
277
|
+
onClick,
|
|
278
|
+
...rest
|
|
279
|
+
} = props;
|
|
280
|
+
return React.createElement(
|
|
281
|
+
TileWrapper,
|
|
282
|
+
{
|
|
283
|
+
ref: forwardedRef,
|
|
284
|
+
isNew: isNew,
|
|
285
|
+
isSelected: isSelected,
|
|
286
|
+
isLoading: isLoading,
|
|
287
|
+
status: status,
|
|
288
|
+
isDisabled: isDisabled,
|
|
289
|
+
...rest,
|
|
290
|
+
},
|
|
291
|
+
React.createElement(
|
|
292
|
+
TileName,
|
|
293
|
+
null,
|
|
294
|
+
(status || isNew || isLoading || isSelected) &&
|
|
295
|
+
React.createElement(TileNameIcon, null),
|
|
296
|
+
React.createElement(
|
|
297
|
+
TileNameLabel,
|
|
298
|
+
null,
|
|
299
|
+
isActionable
|
|
300
|
+
? React.createElement(
|
|
301
|
+
TileAction,
|
|
302
|
+
{
|
|
303
|
+
onClick: !isDisabled ? onClick : undefined,
|
|
304
|
+
'aria-disabled': isDisabled,
|
|
305
|
+
},
|
|
306
|
+
name,
|
|
307
|
+
)
|
|
308
|
+
: name,
|
|
309
|
+
),
|
|
310
|
+
),
|
|
311
|
+
React.createElement(
|
|
312
|
+
TileThumbnailArea,
|
|
313
|
+
null,
|
|
314
|
+
typeof thumbnail !== 'string'
|
|
315
|
+
? React.createElement(TileThumbnailPicture, null, thumbnail)
|
|
316
|
+
: React.createElement(TileThumbnailPicture, { url: thumbnail }),
|
|
317
|
+
badge && React.createElement(TileBadgeContainer, null, badge),
|
|
318
|
+
leftIcon && React.createElement(TileTypeIndicator, null, leftIcon),
|
|
319
|
+
rightIcon && React.createElement(TileQuickAction, null, rightIcon),
|
|
320
|
+
),
|
|
321
|
+
React.createElement(
|
|
322
|
+
TileContentArea,
|
|
323
|
+
null,
|
|
324
|
+
description && React.createElement(TileDescription, null, description),
|
|
325
|
+
moreOptions && React.createElement(TileMoreOptions, null, moreOptions),
|
|
326
|
+
metadata && React.createElement(TileMetadata, null, metadata),
|
|
327
|
+
children,
|
|
328
|
+
),
|
|
329
|
+
buttons && React.createElement(TileButtons, null, buttons),
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
TileComponent.displayName = 'Tile';
|
|
260
333
|
/**
|
|
261
334
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
262
335
|
* @example
|
|
263
|
-
* <Tile>
|
|
336
|
+
* <Tile.Wrapper>
|
|
264
337
|
* <Tile.ThumbnailArea>
|
|
265
338
|
* <Tile.ThumbnailPicture/>
|
|
266
339
|
* <Tile.Badge/>
|
|
@@ -270,23 +343,40 @@ TileButtons.displayName = 'Tile.Buttons';
|
|
|
270
343
|
* <Tile.Name>
|
|
271
344
|
* <Tile.NameIcon/>
|
|
272
345
|
* <Tile.NameLabel/>
|
|
273
|
-
*
|
|
346
|
+
* </Tile.Name>
|
|
274
347
|
* <Tile.ContentArea>
|
|
275
348
|
* <Tile.Description />
|
|
276
349
|
* <Tile.Metadata/>
|
|
277
350
|
* <Tile.MoreOptions/>
|
|
278
351
|
* </Tile.ContentArea>
|
|
279
352
|
* <Tile.Buttons/>
|
|
280
|
-
* </Tile>
|
|
353
|
+
* </Tile.Wrapper>
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* <Tile
|
|
357
|
+
* name='Tile name'
|
|
358
|
+
* description='Tile description that takes upto 3 lines'
|
|
359
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
360
|
+
* thumbnail='/url/to/image.jpg'
|
|
361
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
362
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
363
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
364
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
365
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
366
|
+
* isSelected={true}
|
|
367
|
+
* isNew={false}
|
|
368
|
+
* />
|
|
281
369
|
*/
|
|
282
370
|
export const Tile = Object.assign(TileComponent, {
|
|
371
|
+
/**
|
|
372
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
373
|
+
*/
|
|
374
|
+
Wrapper: TileWrapper,
|
|
283
375
|
/**
|
|
284
376
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
285
377
|
* @example
|
|
286
378
|
* <Tile.ThumbnailArea>
|
|
287
379
|
* <Tile.ThumbnailPicture/>
|
|
288
|
-
* // or
|
|
289
|
-
* <Tile.ThumbnailAvatar/>
|
|
290
380
|
* <Tile.QuickAction/>
|
|
291
381
|
* <Tile.TypeIndicator/>
|
|
292
382
|
* <Tile.BadgeContainer/>
|
|
@@ -296,14 +386,14 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
296
386
|
/**
|
|
297
387
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
298
388
|
* @example
|
|
299
|
-
* <Tile>
|
|
389
|
+
* <Tile.Wrapper>
|
|
300
390
|
* // ...
|
|
301
391
|
* <Tile.ThumbnailArea>
|
|
302
392
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
303
393
|
* </Tile.ThumbnailArea>
|
|
304
|
-
* </Tile>
|
|
394
|
+
* </Tile.Wrapper>
|
|
305
395
|
* or
|
|
306
|
-
* <Tile>
|
|
396
|
+
* <Tile.Wrapper>
|
|
307
397
|
* // ...
|
|
308
398
|
* <Tile.ThumbnailArea>
|
|
309
399
|
* <Tile.ThumbnailPicture>
|
|
@@ -340,21 +430,21 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
340
430
|
/**
|
|
341
431
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
342
432
|
* @example
|
|
343
|
-
* <Tile>
|
|
433
|
+
* <Tile.Wrapper>
|
|
344
434
|
* <Tile.Name>
|
|
345
435
|
* <Tile.NameIcon/>
|
|
346
436
|
* </Tile.Name>
|
|
347
|
-
*
|
|
437
|
+
* </Tile.Wrapper>
|
|
348
438
|
*/
|
|
349
439
|
NameIcon: TileNameIcon,
|
|
350
440
|
/*
|
|
351
441
|
* `NameLabel` of the tile
|
|
352
442
|
* @example
|
|
353
|
-
* <Tile>
|
|
443
|
+
* <Tile.Wrapper>
|
|
354
444
|
* <Tile.Name>
|
|
355
445
|
* <Tile.NameLabel> Tile Name <Tile.NameLabel/>
|
|
356
446
|
* </Tile.Name/>
|
|
357
|
-
*
|
|
447
|
+
* </Tile.Wrapper>
|
|
358
448
|
*/
|
|
359
449
|
NameLabel: TileNameLabel,
|
|
360
450
|
/**
|
|
@@ -371,13 +461,13 @@ export const Tile = Object.assign(TileComponent, {
|
|
|
371
461
|
/**
|
|
372
462
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
373
463
|
* @example
|
|
374
|
-
* <Tile>
|
|
464
|
+
* <Tile.Wrapper>
|
|
375
465
|
* <Tile.ContentArea>
|
|
376
466
|
* <Tile.Description/>
|
|
377
467
|
* <Tile.Metadata/>
|
|
378
468
|
* <Tile.MoreOptions/>
|
|
379
469
|
* </Tile.ContentArea>
|
|
380
|
-
* </Tile>
|
|
470
|
+
* </Tile.Wrapper>
|
|
381
471
|
*/
|
|
382
472
|
ContentArea: TileContentArea,
|
|
383
473
|
/**
|
|
@@ -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/esm/core/Toast/Toast.js
CHANGED
|
@@ -36,6 +36,7 @@ export const Toast = (props) => {
|
|
|
36
36
|
hasCloseButton,
|
|
37
37
|
onRemove,
|
|
38
38
|
animateOutTo,
|
|
39
|
+
domProps,
|
|
39
40
|
} = props;
|
|
40
41
|
const closeTimeout = React.useRef(0);
|
|
41
42
|
const { placement } = useSafeContext(ToasterStateContext).settings;
|
|
@@ -148,12 +149,15 @@ export const Toast = (props) => {
|
|
|
148
149
|
'div',
|
|
149
150
|
{ ref: onRef },
|
|
150
151
|
React.createElement(ToastPresentation, {
|
|
152
|
+
as: 'div',
|
|
151
153
|
category: category,
|
|
152
154
|
content: content,
|
|
153
155
|
link: link,
|
|
154
156
|
type: type,
|
|
155
157
|
hasCloseButton: hasCloseButton,
|
|
156
158
|
onClose: close,
|
|
159
|
+
...domProps?.toastProps,
|
|
160
|
+
contentProps: domProps?.contentProps,
|
|
157
161
|
}),
|
|
158
162
|
),
|
|
159
163
|
),
|
|
@@ -163,7 +167,7 @@ export const Toast = (props) => {
|
|
|
163
167
|
* The presentational part of a toast, without any animation or logic.
|
|
164
168
|
* @private
|
|
165
169
|
*/
|
|
166
|
-
export const ToastPresentation = (props) => {
|
|
170
|
+
export const ToastPresentation = React.forwardRef((props, forwardedRef) => {
|
|
167
171
|
const {
|
|
168
172
|
content,
|
|
169
173
|
category,
|
|
@@ -172,18 +176,31 @@ export const ToastPresentation = (props) => {
|
|
|
172
176
|
hasCloseButton,
|
|
173
177
|
onClose,
|
|
174
178
|
className,
|
|
179
|
+
contentProps,
|
|
175
180
|
...rest
|
|
176
181
|
} = props;
|
|
177
182
|
const StatusIcon = StatusIconMap[category];
|
|
178
183
|
return React.createElement(
|
|
179
184
|
Box,
|
|
180
|
-
{
|
|
185
|
+
{
|
|
186
|
+
className: cx(`iui-toast iui-${category}`, className),
|
|
187
|
+
ref: forwardedRef,
|
|
188
|
+
...rest,
|
|
189
|
+
},
|
|
181
190
|
React.createElement(
|
|
182
191
|
Box,
|
|
183
192
|
{ className: 'iui-status-area' },
|
|
184
193
|
React.createElement(StatusIcon, { className: 'iui-icon' }),
|
|
185
194
|
),
|
|
186
|
-
React.createElement(
|
|
195
|
+
React.createElement(
|
|
196
|
+
Box,
|
|
197
|
+
{
|
|
198
|
+
as: 'div',
|
|
199
|
+
...contentProps,
|
|
200
|
+
className: cx('iui-message', contentProps?.className),
|
|
201
|
+
},
|
|
202
|
+
content,
|
|
203
|
+
),
|
|
187
204
|
link &&
|
|
188
205
|
React.createElement(
|
|
189
206
|
ButtonBase,
|
|
@@ -202,5 +219,5 @@ export const ToastPresentation = (props) => {
|
|
|
202
219
|
React.createElement(SvgCloseSmall, null),
|
|
203
220
|
),
|
|
204
221
|
);
|
|
205
|
-
};
|
|
222
|
+
});
|
|
206
223
|
export default 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;
|