@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.
Files changed (189) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/cjs/core/Alert/Alert.d.ts +20 -9
  3. package/cjs/core/Alert/Alert.js +48 -10
  4. package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
  5. package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
  6. package/cjs/core/Buttons/SplitButton/SplitButton.js +3 -0
  7. package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
  8. package/cjs/core/ComboBox/ComboBox.js +3 -3
  9. package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
  10. package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
  11. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  12. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  13. package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
  14. package/cjs/core/ComboBox/helpers.d.ts +1 -2
  15. package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
  16. package/cjs/core/DatePicker/DatePicker.js +40 -5
  17. package/cjs/core/Dialog/Dialog.js +10 -16
  18. package/cjs/core/Dialog/DialogContext.d.ts +3 -4
  19. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  20. package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
  21. package/cjs/core/Header/HeaderSplitButton.js +1 -0
  22. package/cjs/core/Input/Input.d.ts +4 -0
  23. package/cjs/core/Input/Input.js +2 -1
  24. package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
  25. package/cjs/core/InputGrid/InputGrid.js +39 -0
  26. package/cjs/core/InputGrid/index.d.ts +3 -0
  27. package/cjs/core/InputGrid/index.js +15 -0
  28. package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
  29. package/cjs/core/InputGroup/InputGroup.js +35 -9
  30. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  31. package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
  32. package/cjs/core/InputWithDecorations/index.d.ts +3 -0
  33. package/cjs/core/InputWithDecorations/index.js +15 -0
  34. package/cjs/core/Label/Label.d.ts +5 -0
  35. package/cjs/core/Label/Label.js +2 -0
  36. package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
  37. package/cjs/core/LabeledInput/LabeledInput.js +52 -29
  38. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  39. package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
  40. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  41. package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
  42. package/cjs/core/Menu/Menu.d.ts +1 -1
  43. package/cjs/core/Menu/Menu.js +1 -1
  44. package/cjs/core/Menu/MenuDivider.d.ts +2 -1
  45. package/cjs/core/Menu/MenuDivider.js +1 -1
  46. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  47. package/cjs/core/Menu/MenuItem.js +1 -0
  48. package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
  49. package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
  50. package/cjs/core/SearchBox/SearchBox.js +1 -1
  51. package/cjs/core/Select/Select.d.ts +4 -0
  52. package/cjs/core/Select/Select.js +10 -9
  53. package/cjs/core/SideNavigation/SideNavigation.js +2 -0
  54. package/cjs/core/Slider/Thumb.js +1 -0
  55. package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
  56. package/cjs/core/StatusMessage/StatusMessage.js +23 -9
  57. package/cjs/core/Table/SubRowExpander.js +2 -0
  58. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  59. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
  60. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  61. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  62. package/cjs/core/Textarea/Textarea.d.ts +7 -1
  63. package/cjs/core/Textarea/Textarea.js +6 -11
  64. package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
  65. package/cjs/core/Tile/Tile.d.ts +139 -15
  66. package/cjs/core/Tile/Tile.js +107 -16
  67. package/cjs/core/Toast/Toast.d.ts +12 -4
  68. package/cjs/core/Toast/Toast.js +20 -4
  69. package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
  70. package/cjs/core/Tooltip/Tooltip.js +116 -117
  71. package/cjs/core/TransferList/TransferList.js +4 -12
  72. package/cjs/core/index.d.ts +2 -0
  73. package/cjs/core/index.js +20 -4
  74. package/cjs/core/utils/components/Icon.d.ts +5 -0
  75. package/cjs/core/utils/components/Icon.js +8 -1
  76. package/cjs/core/utils/components/InputContainer.d.ts +0 -1
  77. package/cjs/core/utils/components/InputContainer.js +14 -34
  78. package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
  79. package/cjs/core/utils/components/InputFlexContainer.js +3 -1
  80. package/cjs/core/utils/components/Portal.d.ts +27 -0
  81. package/cjs/core/utils/components/Portal.js +43 -0
  82. package/cjs/core/utils/components/index.d.ts +1 -0
  83. package/cjs/core/utils/components/index.js +1 -0
  84. package/cjs/core/utils/functions/index.d.ts +1 -0
  85. package/cjs/core/utils/functions/index.js +1 -0
  86. package/cjs/core/utils/functions/react.d.ts +8 -0
  87. package/cjs/core/utils/functions/react.js +40 -0
  88. package/cjs/core/utils/hooks/index.d.ts +1 -1
  89. package/cjs/core/utils/hooks/index.js +1 -1
  90. package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
  91. package/cjs/core/utils/hooks/useControlledState.js +39 -0
  92. package/cjs/styles.js +10 -28
  93. package/esm/core/Alert/Alert.d.ts +20 -9
  94. package/esm/core/Alert/Alert.js +49 -10
  95. package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
  96. package/esm/core/Buttons/IconButton/IconButton.js +25 -40
  97. package/esm/core/Buttons/SplitButton/SplitButton.js +9 -1
  98. package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
  99. package/esm/core/ComboBox/ComboBox.js +3 -3
  100. package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
  101. package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
  102. package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  103. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  104. package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
  105. package/esm/core/ComboBox/helpers.d.ts +1 -2
  106. package/esm/core/DatePicker/DatePicker.d.ts +30 -8
  107. package/esm/core/DatePicker/DatePicker.js +25 -5
  108. package/esm/core/Dialog/Dialog.js +11 -23
  109. package/esm/core/Dialog/DialogContext.d.ts +3 -4
  110. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  111. package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
  112. package/esm/core/Header/HeaderSplitButton.js +1 -0
  113. package/esm/core/Input/Input.d.ts +4 -0
  114. package/esm/core/Input/Input.js +2 -1
  115. package/esm/core/InputGrid/InputGrid.d.ts +25 -0
  116. package/esm/core/InputGrid/InputGrid.js +35 -0
  117. package/esm/core/InputGrid/index.d.ts +3 -0
  118. package/esm/core/InputGrid/index.js +6 -0
  119. package/esm/core/InputGroup/InputGroup.d.ts +13 -0
  120. package/esm/core/InputGroup/InputGroup.js +34 -10
  121. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  122. package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
  123. package/esm/core/InputWithDecorations/index.d.ts +3 -0
  124. package/esm/core/InputWithDecorations/index.js +6 -0
  125. package/esm/core/Label/Label.d.ts +5 -0
  126. package/esm/core/Label/Label.js +2 -0
  127. package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
  128. package/esm/core/LabeledInput/LabeledInput.js +53 -29
  129. package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  130. package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
  131. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  132. package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
  133. package/esm/core/Menu/Menu.d.ts +1 -1
  134. package/esm/core/Menu/Menu.js +1 -1
  135. package/esm/core/Menu/MenuDivider.d.ts +2 -1
  136. package/esm/core/Menu/MenuDivider.js +1 -1
  137. package/esm/core/Menu/MenuItem.d.ts +1 -1
  138. package/esm/core/Menu/MenuItem.js +1 -0
  139. package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
  140. package/esm/core/Menu/MenuItemSkeleton.js +0 -1
  141. package/esm/core/SearchBox/SearchBox.js +1 -1
  142. package/esm/core/Select/Select.d.ts +4 -0
  143. package/esm/core/Select/Select.js +10 -9
  144. package/esm/core/SideNavigation/SideNavigation.js +2 -0
  145. package/esm/core/Slider/Thumb.js +1 -0
  146. package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
  147. package/esm/core/StatusMessage/StatusMessage.js +23 -16
  148. package/esm/core/Table/SubRowExpander.js +2 -0
  149. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  150. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
  151. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  152. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  153. package/esm/core/Textarea/Textarea.d.ts +7 -1
  154. package/esm/core/Textarea/Textarea.js +6 -11
  155. package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
  156. package/esm/core/Tile/Tile.d.ts +139 -15
  157. package/esm/core/Tile/Tile.js +107 -16
  158. package/esm/core/Toast/Toast.d.ts +12 -4
  159. package/esm/core/Toast/Toast.js +21 -4
  160. package/esm/core/Tooltip/Tooltip.d.ts +35 -28
  161. package/esm/core/Tooltip/Tooltip.js +119 -116
  162. package/esm/core/TransferList/TransferList.js +4 -9
  163. package/esm/core/index.d.ts +2 -0
  164. package/esm/core/index.js +2 -0
  165. package/esm/core/utils/components/Icon.d.ts +5 -0
  166. package/esm/core/utils/components/Icon.js +8 -1
  167. package/esm/core/utils/components/InputContainer.d.ts +0 -1
  168. package/esm/core/utils/components/InputContainer.js +14 -30
  169. package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
  170. package/esm/core/utils/components/InputFlexContainer.js +3 -1
  171. package/esm/core/utils/components/Portal.d.ts +27 -0
  172. package/esm/core/utils/components/Portal.js +36 -0
  173. package/esm/core/utils/components/index.d.ts +1 -0
  174. package/esm/core/utils/components/index.js +1 -0
  175. package/esm/core/utils/functions/index.d.ts +1 -0
  176. package/esm/core/utils/functions/index.js +1 -0
  177. package/esm/core/utils/functions/react.d.ts +8 -0
  178. package/esm/core/utils/functions/react.js +35 -0
  179. package/esm/core/utils/hooks/index.d.ts +1 -1
  180. package/esm/core/utils/hooks/index.js +1 -1
  181. package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
  182. package/esm/core/utils/hooks/useControlledState.js +34 -0
  183. package/esm/styles.js +10 -28
  184. package/package.json +3 -3
  185. package/styles.css +22 -19
  186. package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  187. package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
  188. package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
  189. package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
@@ -93,6 +93,10 @@ export type SelectProps<T> = {
93
93
  * Modify size of select.
94
94
  */
95
95
  size?: 'small' | 'large';
96
+ /**
97
+ * Status of select.
98
+ */
99
+ status?: 'positive' | 'warning' | 'negative';
96
100
  /**
97
101
  * Custom renderer for an item in the dropdown list. `MenuItem` item props are going to be populated if not provided.
98
102
  */
@@ -11,6 +11,8 @@ import {
11
11
  useId,
12
12
  AutoclearingHiddenLiveRegion,
13
13
  Box,
14
+ SvgCheckmark,
15
+ Icon,
14
16
  } from '../utils/index.js';
15
17
  import SelectTag from './SelectTag.js';
16
18
  import SelectTagContainer from './SelectTagContainer.js';
@@ -90,6 +92,7 @@ export const Select = (props) => {
90
92
  popoverProps,
91
93
  multiple = false,
92
94
  triggerProps,
95
+ status,
93
96
  ...rest
94
97
  } = props;
95
98
  const [isOpenState, setIsOpen] = React.useState(false);
@@ -97,7 +100,6 @@ export const Select = (props) => {
97
100
  const [minWidth, setMinWidth] = React.useState(0);
98
101
  const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
99
102
  const selectRef = React.useRef(null);
100
- const toggleButtonRef = React.useRef(null);
101
103
  const onShowHandler = React.useCallback(
102
104
  (instance) => {
103
105
  setIsOpen(true);
@@ -148,6 +150,9 @@ export const Select = (props) => {
148
150
  key: `${label}-${index}`,
149
151
  isSelected,
150
152
  startIcon: startIcon,
153
+ endIcon: isSelected
154
+ ? React.createElement(SvgCheckmark, { 'aria-hidden': true })
155
+ : null,
151
156
  onClick: () => {
152
157
  if (option.disabled) {
153
158
  return;
@@ -225,10 +230,8 @@ export const Select = (props) => {
225
230
  onHide: onHideHandler,
226
231
  ...popoverProps,
227
232
  visible: isOpen,
228
- onClickOutside: (_, { target }) => {
229
- if (!toggleButtonRef.current?.contains(target)) {
230
- setIsOpen(false);
231
- }
233
+ onClickOutside: () => {
234
+ setIsOpen(false);
232
235
  },
233
236
  },
234
237
  React.createElement(
@@ -238,6 +241,7 @@ export const Select = (props) => {
238
241
  role: 'combobox',
239
242
  ref: selectRef,
240
243
  'data-iui-size': size,
244
+ 'data-iui-status': status,
241
245
  onClick: () => !disabled && setIsOpen((o) => !o),
242
246
  onKeyDown: (e) => !disabled && onKeyDown(e),
243
247
  'aria-disabled': disabled,
@@ -275,17 +279,14 @@ export const Select = (props) => {
275
279
  ),
276
280
  ),
277
281
  React.createElement(
278
- Box,
282
+ Icon,
279
283
  {
280
284
  as: 'span',
281
285
  'aria-hidden': true,
282
- ref: toggleButtonRef,
283
286
  className: cx('iui-end-icon', {
284
- 'iui-actionable': !disabled,
285
287
  'iui-disabled': disabled,
286
288
  'iui-open': isOpen,
287
289
  }),
288
- onClick: () => !disabled && setIsOpen((o) => !o),
289
290
  },
290
291
  React.createElement(SvgCaretDownSmall, null),
291
292
  ),
@@ -44,6 +44,8 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
44
44
  const ExpandButton = React.createElement(
45
45
  IconButton,
46
46
  {
47
+ label: 'Toggle icon labels',
48
+ 'aria-expanded': _isExpanded,
47
49
  className: 'iui-sidenav-button iui-expand',
48
50
  onClick: React.useCallback(() => {
49
51
  _setIsExpanded((expanded) => !expanded);
@@ -88,6 +88,7 @@ export const Thumb = (props) => {
88
88
  {
89
89
  placement: 'top',
90
90
  autoUpdateOptions: { animationFrame: true },
91
+ ariaStrategy: 'none',
91
92
  ...tooltipProps,
92
93
  },
93
94
  React.createElement(Box, {
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { Icon } from '../utils/index.js';
3
+ import type { PolymorphicForwardRefComponent } from '../utils/index.js';
2
4
  type StatusMessageProps = {
3
5
  /**
4
6
  * Custom icon to be displayed at the beginning.
@@ -13,12 +15,20 @@ type StatusMessageProps = {
13
15
  * Status of the message.
14
16
  */
15
17
  status?: 'positive' | 'warning' | 'negative';
18
+ /**
19
+ * Passes props to icon
20
+ */
21
+ iconProps?: React.ComponentProps<typeof Icon>;
22
+ /**
23
+ * Passes props to content
24
+ */
25
+ contentProps?: React.ComponentPropsWithRef<'div'>;
16
26
  };
17
27
  /**
18
- * Component to display icon and text below the `Combobox` component.
28
+ * Component to display icon and text below the form field.
19
29
  * @example
20
30
  * <StatusMessage>This is the text</StatusMessage>
21
31
  * <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
22
32
  */
23
- export declare const StatusMessage: ({ startIcon: userStartIcon, children, status, }: StatusMessageProps) => React.JSX.Element;
33
+ export declare const StatusMessage: PolymorphicForwardRefComponent<"div", StatusMessageProps>;
24
34
  export default StatusMessage;
@@ -3,30 +3,37 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
- import { Box, StatusIconMap } from '../utils/index.js';
6
+ import { Box, StatusIconMap, Icon } from '../utils/index.js';
7
+ import cx from 'classnames';
7
8
  /**
8
- * Component to display icon and text below the `Combobox` component.
9
+ * Component to display icon and text below the form field.
9
10
  * @example
10
11
  * <StatusMessage>This is the text</StatusMessage>
11
12
  * <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
12
13
  */
13
- export const StatusMessage = ({
14
- startIcon: userStartIcon,
15
- children,
16
- status,
17
- }) => {
14
+ export const StatusMessage = React.forwardRef((props, ref) => {
15
+ const {
16
+ children,
17
+ startIcon: userStartIcon,
18
+ status,
19
+ className,
20
+ iconProps,
21
+ contentProps,
22
+ ...rest
23
+ } = props;
18
24
  const icon = userStartIcon ?? (status && StatusIconMap[status]());
19
25
  return React.createElement(
20
- React.Fragment,
21
- null,
26
+ Box,
27
+ {
28
+ className: cx('iui-status-message', className),
29
+ 'data-iui-status': status,
30
+ ref: ref,
31
+ ...rest,
32
+ },
22
33
  !!icon
23
- ? React.createElement(
24
- Box,
25
- { as: 'span', className: 'iui-input-icon', 'aria-hidden': true },
26
- icon,
27
- )
34
+ ? React.createElement(Icon, { 'aria-hidden': true, ...iconProps }, icon)
28
35
  : null,
29
- React.createElement(Box, { className: 'iui-message' }, children),
36
+ React.createElement(Box, { ...contentProps }, children),
30
37
  );
31
- };
38
+ });
32
39
  export default StatusMessage;
@@ -15,6 +15,8 @@ export const SubRowExpander = (props) => {
15
15
  : React.createElement(
16
16
  IconButton,
17
17
  {
18
+ 'aria-label': 'Toggle sub row',
19
+ 'aria-expanded': cell.row.isExpanded ? 'true' : 'false',
18
20
  style: {
19
21
  marginInlineEnd:
20
22
  density === 'default' || density === undefined ? 8 : 4,
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import type { LabeledInput } from '../../../LabeledInput/index.js';
2
3
  import type { PolymorphicForwardRefComponent } from '../../../utils/index.js';
3
- import { LabeledInput } from '../../../LabeledInput/index.js';
4
+ import type { DatePickerLocalizedNames } from '../../../DatePicker/DatePicker.js';
4
5
  export type DatePickerInputProps = {
5
6
  date?: Date;
6
7
  onChange: (date?: Date) => void;
@@ -14,6 +15,10 @@ export type DatePickerInputProps = {
14
15
  * The 'to' date for the 'from' DatePickerInput or the 'from' date for the 'to' DatePickerInput
15
16
  */
16
17
  selectedDate?: Date;
18
+ /**
19
+ * Months, short days and days localized names for DatePicker
20
+ */
21
+ localizedNames?: DatePickerLocalizedNames;
17
22
  } & Omit<React.ComponentProps<typeof LabeledInput>, 'value' | 'onChange' | 'svgIcon' | 'displayStyle'>;
18
23
  declare const DatePickerInput: PolymorphicForwardRefComponent<"input", DatePickerInputProps>;
19
24
  export default DatePickerInput;
@@ -3,18 +3,28 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
- import { Popover, SvgCalendar, isBefore } from '../../../utils/index.js';
7
- import { LabeledInput } from '../../../LabeledInput/index.js';
6
+ import { Popover, SvgCalendar, isBefore, useId } from '../../../utils/index.js';
8
7
  import { DatePicker } from '../../../DatePicker/index.js';
9
- import { IconButton } from '../../../Buttons/index.js';
8
+ import { InputGrid } from '../../../InputGrid/index.js';
9
+ import { Label } from '../../../Label/index.js';
10
+ import { InputWithDecorations } from '../../../InputWithDecorations/index.js';
10
11
  const DatePickerInput = React.forwardRef((props, forwardedRef) => {
12
+ const uid = useId();
11
13
  const {
12
14
  onChange,
13
15
  date,
14
16
  parseInput,
15
17
  formatDate,
18
+ label,
19
+ required,
20
+ disabled,
16
21
  isFromOrTo,
17
22
  selectedDate,
23
+ wrapperProps,
24
+ labelProps,
25
+ inputWrapperProps,
26
+ id = uid,
27
+ localizedNames,
18
28
  ...rest
19
29
  } = props;
20
30
  const isDateDisabled = (date) => {
@@ -63,6 +73,7 @@ const DatePickerInput = React.forwardRef((props, forwardedRef) => {
63
73
  onChange: onDateSelected,
64
74
  setFocus: true,
65
75
  isDateDisabled: isDateDisabled,
76
+ localizedNames: localizedNames,
66
77
  }),
67
78
  placement: 'bottom',
68
79
  visible: isVisible,
@@ -73,23 +84,40 @@ const DatePickerInput = React.forwardRef((props, forwardedRef) => {
73
84
  },
74
85
  appendTo: 'parent',
75
86
  },
76
- React.createElement(LabeledInput, {
77
- ref: forwardedRef,
78
- displayStyle: 'inline',
79
- value: inputValue,
80
- onChange: onInputChange,
81
- onClick: close,
82
- svgIcon: React.createElement(
83
- IconButton,
87
+ React.createElement(
88
+ InputGrid,
89
+ { labelPlacement: 'inline', ...wrapperProps },
90
+ React.createElement(
91
+ Label,
84
92
  {
85
- styleType: 'borderless',
86
- onClick: () => setIsVisible((v) => !v),
87
- ref: buttonRef,
93
+ as: 'label',
94
+ required: required,
95
+ disabled: disabled,
96
+ htmlFor: id,
97
+ ...labelProps,
88
98
  },
89
- React.createElement(SvgCalendar, null),
99
+ label,
90
100
  ),
91
- ...rest,
92
- }),
101
+ React.createElement(
102
+ InputWithDecorations,
103
+ { ...inputWrapperProps },
104
+ React.createElement(InputWithDecorations.Input, {
105
+ id: id,
106
+ value: inputValue,
107
+ onChange: onInputChange,
108
+ onClick: close,
109
+ required: required,
110
+ disabled: disabled,
111
+ ref: forwardedRef,
112
+ ...rest,
113
+ }),
114
+ React.createElement(
115
+ InputWithDecorations.Button,
116
+ { onClick: () => setIsVisible((v) => !v), ref: buttonRef },
117
+ React.createElement(SvgCalendar, null),
118
+ ),
119
+ ),
120
+ ),
93
121
  );
94
122
  });
95
123
  export 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;
@@ -104,6 +104,7 @@ export const DateRangeFilter = (props) => {
104
104
  placeholder: placeholder,
105
105
  selectedDate: to,
106
106
  isFromOrTo: 'from',
107
+ localizedNames: translatedStrings.datePicker,
107
108
  }),
108
109
  React.createElement(DatePickerInput, {
109
110
  label: translatedStrings.to,
@@ -115,6 +116,7 @@ export const DateRangeFilter = (props) => {
115
116
  placeholder: placeholder,
116
117
  selectedDate: from,
117
118
  isFromOrTo: 'to',
119
+ localizedNames: translatedStrings.datePicker,
118
120
  }),
119
121
  React.createElement(FilterButtonBar, {
120
122
  setFilter: () => setFilter([from, to]),
@@ -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;
@@ -2,25 +2,20 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import cx from 'classnames';
6
5
  import * as React from 'react';
7
- import { useMergedRefs, Box } from '../utils/index.js';
6
+ import { Input } from '../Input/index.js';
8
7
  /**
9
8
  * Basic textarea component
10
9
  * @example
11
10
  * <Textarea placeholder='This is a textarea' />
12
11
  * <Textarea disabled={true} placeholder='This is a disabled textarea' />
13
12
  */
14
- export const Textarea = React.forwardRef((props, ref) => {
15
- const { className, rows = 3, ...rest } = props;
16
- const textAreaRef = React.useRef(null);
17
- const refs = useMergedRefs(ref, textAreaRef);
18
- return React.createElement(Box, {
13
+ export const Textarea = React.forwardRef((props, forwardedRef) => {
14
+ return React.createElement(Input, {
19
15
  as: 'textarea',
20
- className: cx('iui-input', className),
21
- rows: rows,
22
- ref: refs,
23
- ...rest,
16
+ rows: 3,
17
+ ref: forwardedRef,
18
+ ...props,
24
19
  });
25
20
  });
26
21
  export default Textarea;
@@ -10,7 +10,7 @@ import {
10
10
  useMergedRefs,
11
11
  Box,
12
12
  useIsomorphicLayoutEffect,
13
- useUncontrolledState,
13
+ useControlledState,
14
14
  } from '../utils/index.js';
15
15
  import { ThemeContext } from './ThemeContext.js';
16
16
  import { ToastProvider, Toaster } from '../Toast/Toaster.js';
@@ -50,8 +50,9 @@ export const ThemeProvider = React.forwardRef((props, forwardedRef) => {
50
50
  portalContainer: portalContainerProp,
51
51
  ...rest
52
52
  } = props;
53
- const [portalContainer, setPortalContainer] = useUncontrolledState(
54
- portalContainerProp || null,
53
+ const [portalContainer, setPortalContainer] = useControlledState(
54
+ null,
55
+ portalContainerProp,
55
56
  );
56
57
  const [parentTheme, rootRef] = useParentTheme();
57
58
  const theme = themeProp === 'inherit' ? parentTheme || 'light' : themeProp;
@@ -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 TileOwnProps = {
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.ReactElement[];
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
- * <Tile.Name/>
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", TileOwnProps> & {
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
- * <Tile/>
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
  /**