@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
|
@@ -7,17 +7,27 @@ const tslib_1 = require('tslib');
|
|
|
7
7
|
*--------------------------------------------------------------------------------------------*/
|
|
8
8
|
const React = tslib_1.__importStar(require('react'));
|
|
9
9
|
const index_js_1 = require('../../../utils/index.js');
|
|
10
|
-
const index_js_2 = require('../../../
|
|
11
|
-
const index_js_3 = require('../../../
|
|
12
|
-
const index_js_4 = require('../../../
|
|
10
|
+
const index_js_2 = require('../../../DatePicker/index.js');
|
|
11
|
+
const index_js_3 = require('../../../InputGrid/index.js');
|
|
12
|
+
const index_js_4 = require('../../../Label/index.js');
|
|
13
|
+
const index_js_5 = require('../../../InputWithDecorations/index.js');
|
|
13
14
|
const DatePickerInput = React.forwardRef((props, forwardedRef) => {
|
|
15
|
+
const uid = (0, index_js_1.useId)();
|
|
14
16
|
const {
|
|
15
17
|
onChange,
|
|
16
18
|
date,
|
|
17
19
|
parseInput,
|
|
18
20
|
formatDate,
|
|
21
|
+
label,
|
|
22
|
+
required,
|
|
23
|
+
disabled,
|
|
19
24
|
isFromOrTo,
|
|
20
25
|
selectedDate,
|
|
26
|
+
wrapperProps,
|
|
27
|
+
labelProps,
|
|
28
|
+
inputWrapperProps,
|
|
29
|
+
id = uid,
|
|
30
|
+
localizedNames,
|
|
21
31
|
...rest
|
|
22
32
|
} = props;
|
|
23
33
|
const isDateDisabled = (date) => {
|
|
@@ -59,40 +69,53 @@ const DatePickerInput = React.forwardRef((props, forwardedRef) => {
|
|
|
59
69
|
[onChange, parseInput],
|
|
60
70
|
);
|
|
61
71
|
return React.createElement(
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onClickOutside: (_, e) => {
|
|
73
|
-
if (!buttonRef.current?.contains(e.target)) {
|
|
74
|
-
close();
|
|
75
|
-
}
|
|
72
|
+
index_js_3.InputGrid,
|
|
73
|
+
{ labelPlacement: 'inline', ...wrapperProps },
|
|
74
|
+
React.createElement(
|
|
75
|
+
index_js_4.Label,
|
|
76
|
+
{
|
|
77
|
+
as: 'label',
|
|
78
|
+
required: required,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
htmlFor: id,
|
|
81
|
+
...labelProps,
|
|
76
82
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
React.createElement(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
label,
|
|
84
|
+
),
|
|
85
|
+
React.createElement(
|
|
86
|
+
index_js_5.InputWithDecorations,
|
|
87
|
+
{ ...inputWrapperProps },
|
|
88
|
+
React.createElement(index_js_5.InputWithDecorations.Input, {
|
|
89
|
+
id: id,
|
|
90
|
+
value: inputValue,
|
|
91
|
+
onChange: onInputChange,
|
|
92
|
+
required: required,
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
ref: forwardedRef,
|
|
95
|
+
...rest,
|
|
96
|
+
}),
|
|
97
|
+
React.createElement(
|
|
98
|
+
index_js_1.Popover,
|
|
87
99
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
content: React.createElement(index_js_2.DatePicker, {
|
|
101
|
+
date: date,
|
|
102
|
+
onChange: onDateSelected,
|
|
103
|
+
setFocus: true,
|
|
104
|
+
isDateDisabled: isDateDisabled,
|
|
105
|
+
localizedNames: localizedNames,
|
|
106
|
+
}),
|
|
107
|
+
placement: 'bottom-end',
|
|
108
|
+
visible: isVisible,
|
|
109
|
+
onVisibleChange: setIsVisible,
|
|
110
|
+
closeOnOutsideClick: true,
|
|
91
111
|
},
|
|
92
|
-
React.createElement(
|
|
112
|
+
React.createElement(
|
|
113
|
+
index_js_5.InputWithDecorations.Button,
|
|
114
|
+
{ 'aria-label': 'Date picker', ref: buttonRef },
|
|
115
|
+
React.createElement(index_js_1.SvgCalendar, null),
|
|
116
|
+
),
|
|
93
117
|
),
|
|
94
|
-
|
|
95
|
-
}),
|
|
118
|
+
),
|
|
96
119
|
);
|
|
97
120
|
});
|
|
98
121
|
exports.default = DatePickerInput;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { FilterButtonBarTranslation } from '../FilterButtonBar.js';
|
|
3
3
|
import type { TableFilterProps } from '../types.js';
|
|
4
|
+
import type { DatePickerLocalizedNames } from '../../../DatePicker/DatePicker.js';
|
|
4
5
|
export type DateRangeTranslation = {
|
|
5
6
|
from: string;
|
|
6
7
|
to: string;
|
|
8
|
+
datePicker?: DatePickerLocalizedNames;
|
|
7
9
|
};
|
|
8
10
|
export type DateRangeFilterProps<T extends Record<string, unknown>> = TableFilterProps<T> & {
|
|
9
11
|
formatDate?: (date: Date) => string;
|
|
@@ -110,6 +110,7 @@ const DateRangeFilter = (props) => {
|
|
|
110
110
|
placeholder: placeholder,
|
|
111
111
|
selectedDate: to,
|
|
112
112
|
isFromOrTo: 'from',
|
|
113
|
+
localizedNames: translatedStrings.datePicker,
|
|
113
114
|
}),
|
|
114
115
|
React.createElement(DatePickerInput_js_1.default, {
|
|
115
116
|
label: translatedStrings.to,
|
|
@@ -121,6 +122,7 @@ const DateRangeFilter = (props) => {
|
|
|
121
122
|
placeholder: placeholder,
|
|
122
123
|
selectedDate: from,
|
|
123
124
|
isFromOrTo: 'to',
|
|
125
|
+
localizedNames: translatedStrings.datePicker,
|
|
124
126
|
}),
|
|
125
127
|
React.createElement(FilterButtonBar_js_1.FilterButtonBar, {
|
|
126
128
|
setFilter: () => setFilter([from, to]),
|
|
@@ -42,7 +42,8 @@ const FilterToggle = (props) => {
|
|
|
42
42
|
content: column.render('Filter', { close, setFilter, clearFilter }),
|
|
43
43
|
placement: 'bottom-start',
|
|
44
44
|
visible: isVisible,
|
|
45
|
-
|
|
45
|
+
onVisibleChange: setIsVisible,
|
|
46
|
+
closeOnOutsideClick: true,
|
|
46
47
|
},
|
|
47
48
|
React.createElement(
|
|
48
49
|
index_js_2.IconButton,
|
|
@@ -53,8 +54,8 @@ const FilterToggle = (props) => {
|
|
|
53
54
|
'iui-table-filter-button',
|
|
54
55
|
className,
|
|
55
56
|
),
|
|
57
|
+
'aria-label': 'Filter',
|
|
56
58
|
onClick: (e) => {
|
|
57
|
-
setIsVisible((v) => !v);
|
|
58
59
|
// Prevents from triggering sort
|
|
59
60
|
e.stopPropagation();
|
|
60
61
|
},
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
2
|
+
export type TextareaProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Status of textarea.
|
|
5
|
+
*/
|
|
6
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Basic textarea component
|
|
4
10
|
* @example
|
|
5
11
|
* <Textarea placeholder='This is a textarea' />
|
|
6
12
|
* <Textarea disabled={true} placeholder='This is a disabled textarea' />
|
|
7
13
|
*/
|
|
8
|
-
export declare const Textarea: PolymorphicForwardRefComponent<"textarea",
|
|
14
|
+
export declare const Textarea: PolymorphicForwardRefComponent<"textarea", TextareaProps>;
|
|
9
15
|
export default Textarea;
|
|
@@ -6,25 +6,20 @@ const tslib_1 = require('tslib');
|
|
|
6
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
const classnames_1 = tslib_1.__importDefault(require('classnames'));
|
|
10
9
|
const React = tslib_1.__importStar(require('react'));
|
|
11
|
-
const index_js_1 = require('../
|
|
10
|
+
const index_js_1 = require('../Input/index.js');
|
|
12
11
|
/**
|
|
13
12
|
* Basic textarea component
|
|
14
13
|
* @example
|
|
15
14
|
* <Textarea placeholder='This is a textarea' />
|
|
16
15
|
* <Textarea disabled={true} placeholder='This is a disabled textarea' />
|
|
17
16
|
*/
|
|
18
|
-
exports.Textarea = React.forwardRef((props,
|
|
19
|
-
|
|
20
|
-
const textAreaRef = React.useRef(null);
|
|
21
|
-
const refs = (0, index_js_1.useMergedRefs)(ref, textAreaRef);
|
|
22
|
-
return React.createElement(index_js_1.Box, {
|
|
17
|
+
exports.Textarea = React.forwardRef((props, forwardedRef) => {
|
|
18
|
+
return React.createElement(index_js_1.Input, {
|
|
23
19
|
as: 'textarea',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...rest,
|
|
20
|
+
rows: 3,
|
|
21
|
+
ref: forwardedRef,
|
|
22
|
+
...props,
|
|
28
23
|
});
|
|
29
24
|
});
|
|
30
25
|
exports.default = exports.Textarea;
|
|
@@ -49,7 +49,7 @@ exports.ThemeProvider = React.forwardRef((props, forwardedRef) => {
|
|
|
49
49
|
...rest
|
|
50
50
|
} = props;
|
|
51
51
|
const [portalContainer, setPortalContainer] = (0,
|
|
52
|
-
index_js_1.
|
|
52
|
+
index_js_1.useControlledState)(null, portalContainerProp);
|
|
53
53
|
const [parentTheme, rootRef] = useParentTheme();
|
|
54
54
|
const theme = themeProp === 'inherit' ? parentTheme || 'light' : themeProp;
|
|
55
55
|
const shouldApplyBackground = themeOptions?.applyBackground ?? !parentTheme;
|
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
3
|
import { IconButton } from '../Buttons/index.js';
|
|
4
|
-
type
|
|
4
|
+
type TileWrapperOwnProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Status of the tile.
|
|
7
7
|
*/
|
|
@@ -46,12 +46,119 @@ type TileNameOwnProps = {
|
|
|
46
46
|
};
|
|
47
47
|
type TileMoreOptionsOwnProps = {
|
|
48
48
|
buttonProps?: React.ComponentPropsWithoutRef<typeof IconButton>;
|
|
49
|
-
children?: React.
|
|
49
|
+
children?: React.ReactNode[];
|
|
50
|
+
};
|
|
51
|
+
type TileLegacyProps = {
|
|
52
|
+
/**
|
|
53
|
+
* Name or title of the tile.
|
|
54
|
+
*/
|
|
55
|
+
name: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Description text of the tile.
|
|
58
|
+
* Gets truncated if it can't fit in the tile.
|
|
59
|
+
*/
|
|
60
|
+
description?: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Metadata section located below description.
|
|
63
|
+
* @example
|
|
64
|
+
* <Tile
|
|
65
|
+
* // ...
|
|
66
|
+
* metadata='basic metadata'
|
|
67
|
+
* // or
|
|
68
|
+
* metadata={<span><SvgClock /> 2021-01-01, 04:30 AM</span>}
|
|
69
|
+
* // or
|
|
70
|
+
* metadata={<>
|
|
71
|
+
* <SvgTag2 />
|
|
72
|
+
* <TagContainer><Tag variant='basic'>Tag 1</Tag><Tag variant='basic'>Tag 2</Tag></TagContainer>
|
|
73
|
+
* </>}
|
|
74
|
+
* />
|
|
75
|
+
*/
|
|
76
|
+
metadata?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Thumbnail image url, a custom component or an svg.
|
|
79
|
+
* @example
|
|
80
|
+
* <Tile
|
|
81
|
+
* // ...
|
|
82
|
+
* thumbnail='/url/to/image.jpg'
|
|
83
|
+
* // or
|
|
84
|
+
* thumbnail={<Avatar image={<img src='icon.png' />} />}
|
|
85
|
+
* // or
|
|
86
|
+
* thumbnail={<SvgImodelHollow />}
|
|
87
|
+
* />
|
|
88
|
+
*/
|
|
89
|
+
thumbnail?: string | React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* `Badge` shown on the bottom right of thumbnail.
|
|
92
|
+
*/
|
|
93
|
+
badge?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Icon shown on top left of the tile. Also known as "type indicator".
|
|
96
|
+
* Recommended to use an invisible `IconButton`.
|
|
97
|
+
*/
|
|
98
|
+
leftIcon?: React.ReactNode;
|
|
99
|
+
/**
|
|
100
|
+
* Icon shown on top right of the tile. Also known as "quick action".
|
|
101
|
+
* Recommended to use an invisible `IconButton`.
|
|
102
|
+
*/
|
|
103
|
+
rightIcon?: React.ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* Upto two buttons shown at the bottom of the tile.
|
|
106
|
+
*/
|
|
107
|
+
buttons?: [React.ReactNode?, React.ReactNode?];
|
|
108
|
+
/**
|
|
109
|
+
* Dropdown menu containing `MenuItem`s.
|
|
110
|
+
*/
|
|
111
|
+
moreOptions?: React.ReactNode[];
|
|
112
|
+
/**
|
|
113
|
+
* Status of the tile.
|
|
114
|
+
*/
|
|
115
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
116
|
+
/**
|
|
117
|
+
* Whether the tile is selected or in "active" state.
|
|
118
|
+
* Gets highlighted and shows a checkmark icon near tile name.
|
|
119
|
+
*/
|
|
120
|
+
isSelected?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the tile is "new". Tile name becomes bold and gets a new status icon.
|
|
123
|
+
*/
|
|
124
|
+
isNew?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Default tile variant or the folder layout.
|
|
127
|
+
* @default 'default'
|
|
128
|
+
*/
|
|
129
|
+
variant?: 'default' | 'folder';
|
|
130
|
+
/**
|
|
131
|
+
* Any custom nodes that will be appended to the tile's main content.
|
|
132
|
+
*/
|
|
133
|
+
children?: React.ReactNode;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the tile is expected to be interactable (i.e. `onClick`).
|
|
136
|
+
* It becomes focusable and gets on hover styling.
|
|
137
|
+
*/
|
|
138
|
+
isActionable?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Display a loading state.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
isLoading?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Flag whether the tile is disabled.
|
|
146
|
+
*
|
|
147
|
+
* Note: This only affects the tile. You need to manually disable
|
|
148
|
+
* the buttons and other interactive elements inside the tile.
|
|
149
|
+
*
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
isDisabled?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Adds onClick to the TileAction component.
|
|
155
|
+
*/
|
|
156
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
50
157
|
};
|
|
51
158
|
/**
|
|
52
159
|
* Tile with customizable Thumbnail, Name, Content and Buttons subcomponents
|
|
53
160
|
* @example
|
|
54
|
-
* <Tile>
|
|
161
|
+
* <Tile.Wrapper>
|
|
55
162
|
* <Tile.ThumbnailArea>
|
|
56
163
|
* <Tile.ThumbnailPicture/>
|
|
57
164
|
* <Tile.Badge/>
|
|
@@ -61,23 +168,40 @@ type TileMoreOptionsOwnProps = {
|
|
|
61
168
|
* <Tile.Name>
|
|
62
169
|
* <Tile.NameIcon/>
|
|
63
170
|
* <Tile.NameLabel/>
|
|
64
|
-
*
|
|
171
|
+
* </Tile.Name>
|
|
65
172
|
* <Tile.ContentArea>
|
|
66
173
|
* <Tile.Description />
|
|
67
174
|
* <Tile.Metadata/>
|
|
68
175
|
* <Tile.MoreOptions/>
|
|
69
176
|
* </Tile.ContentArea>
|
|
70
177
|
* <Tile.Buttons/>
|
|
71
|
-
* </Tile>
|
|
178
|
+
* </Tile.Wrapper>
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* <Tile
|
|
182
|
+
* name='Tile name'
|
|
183
|
+
* description='Tile description that takes upto 3 lines'
|
|
184
|
+
* metadata={<TagContainer><Tag variant='basic'>Tag 1</Tag></TagContainer>}
|
|
185
|
+
* thumbnail='/url/to/image.jpg'
|
|
186
|
+
* badge={<Badge backgroundColor='blue'>Badge label</Badge>}
|
|
187
|
+
* buttons={[<Button>Button 1</Button>, <Button>Button 2</Button>]}
|
|
188
|
+
* moreOptions={[<MenuItem>Item 1</MenuItem>, <MenuItem>Item 2</MenuItem>]}
|
|
189
|
+
* leftIcon={<IconButton><SvgInfo /></IconButton>}
|
|
190
|
+
* rightIcon={<IconButton><SvgStar /></IconButton>}
|
|
191
|
+
* isSelected={true}
|
|
192
|
+
* isNew={false}
|
|
193
|
+
* />
|
|
72
194
|
*/
|
|
73
|
-
export declare const Tile: PolymorphicForwardRefComponent<"div",
|
|
195
|
+
export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps> & {
|
|
196
|
+
/**
|
|
197
|
+
* Wrapper subcomponent for fully customisable Tile.
|
|
198
|
+
*/
|
|
199
|
+
Wrapper: PolymorphicForwardRefComponent<"div", TileWrapperOwnProps>;
|
|
74
200
|
/**
|
|
75
201
|
* ThumbnailArea subcomponent that contains `ThumbnailPicture`, `QuickAction`, `TypeIndicator` or `BadgeContainer`
|
|
76
202
|
* @example
|
|
77
203
|
* <Tile.ThumbnailArea>
|
|
78
204
|
* <Tile.ThumbnailPicture/>
|
|
79
|
-
* // or
|
|
80
|
-
* <Tile.ThumbnailAvatar/>
|
|
81
205
|
* <Tile.QuickAction/>
|
|
82
206
|
* <Tile.TypeIndicator/>
|
|
83
207
|
* <Tile.BadgeContainer/>
|
|
@@ -87,14 +211,14 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
87
211
|
/**
|
|
88
212
|
* Thumbnail image url, a custom component or an svg for thumbnail avatar.
|
|
89
213
|
* @example
|
|
90
|
-
* <Tile>
|
|
214
|
+
* <Tile.Wrapper>
|
|
91
215
|
* // ...
|
|
92
216
|
* <Tile.ThumbnailArea>
|
|
93
217
|
* <Tile.ThumbnailPicture url = '/url/to/image.jpg'/>
|
|
94
218
|
* </Tile.ThumbnailArea>
|
|
95
|
-
* </Tile>
|
|
219
|
+
* </Tile.Wrapper>
|
|
96
220
|
* or
|
|
97
|
-
* <Tile>
|
|
221
|
+
* <Tile.Wrapper>
|
|
98
222
|
* // ...
|
|
99
223
|
* <Tile.ThumbnailArea>
|
|
100
224
|
* <Tile.ThumbnailPicture>
|
|
@@ -139,11 +263,11 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
139
263
|
/**
|
|
140
264
|
* `NameIcon` next to name of the tile. Goes under <Tile.Name>
|
|
141
265
|
* @example
|
|
142
|
-
* <Tile>
|
|
266
|
+
* <Tile.Wrapper>
|
|
143
267
|
* <Tile.Name>
|
|
144
268
|
* <Tile.NameIcon/>
|
|
145
269
|
* </Tile.Name>
|
|
146
|
-
*
|
|
270
|
+
* </Tile.Wrapper>
|
|
147
271
|
*/
|
|
148
272
|
NameIcon: PolymorphicForwardRefComponent<"div", {}>;
|
|
149
273
|
NameLabel: PolymorphicForwardRefComponent<"span", {}>;
|
|
@@ -161,13 +285,13 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileOwnProps> &
|
|
|
161
285
|
/**
|
|
162
286
|
* Tile content area that contains `Description`, `Metadata` and `MoreOptions` Tile subcomponents
|
|
163
287
|
* @example
|
|
164
|
-
* <Tile>
|
|
288
|
+
* <Tile.Wrapper>
|
|
165
289
|
* <Tile.ContentArea>
|
|
166
290
|
* <Tile.Description/>
|
|
167
291
|
* <Tile.Metadata/>
|
|
168
292
|
* <Tile.MoreOptions/>
|
|
169
293
|
* </Tile.ContentArea>
|
|
170
|
-
* </Tile>
|
|
294
|
+
* </Tile.Wrapper>
|
|
171
295
|
*/
|
|
172
296
|
ContentArea: PolymorphicForwardRefComponent<NonNullable<keyof JSX.IntrinsicElements>, {}>;
|
|
173
297
|
/**
|