@itwin/itwinui-react 3.0.0-dev.6 → 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 (283) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/cjs/core/Alert/Alert.d.ts +20 -9
  3. package/cjs/core/Alert/Alert.js +48 -10
  4. package/cjs/core/Avatar/Avatar.d.ts +3 -2
  5. package/cjs/core/Avatar/Avatar.js +21 -19
  6. package/cjs/core/AvatarGroup/AvatarGroup.js +3 -8
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
  8. package/cjs/core/Buttons/Button/Button.d.ts +15 -2
  9. package/cjs/core/Buttons/Button/Button.js +23 -9
  10. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  11. package/cjs/core/Buttons/IconButton/IconButton.d.ts +5 -1
  12. package/cjs/core/Buttons/IconButton/IconButton.js +27 -38
  13. package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  14. package/cjs/core/Buttons/SplitButton/SplitButton.js +25 -13
  15. package/cjs/core/Carousel/Carousel.d.ts +6 -4
  16. package/cjs/core/Carousel/Carousel.js +2 -2
  17. package/cjs/core/Carousel/CarouselDot.js +1 -3
  18. package/cjs/core/Carousel/CarouselNavigation.d.ts +6 -4
  19. package/cjs/core/ColorPicker/ColorBuilder.js +2 -1
  20. package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
  21. package/cjs/core/ComboBox/ComboBox.js +3 -3
  22. package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
  23. package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
  24. package/cjs/core/ComboBox/ComboBoxInput.js +1 -1
  25. package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  26. package/cjs/core/ComboBox/ComboBoxMenu.js +5 -5
  27. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  28. package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
  29. package/cjs/core/ComboBox/helpers.d.ts +1 -2
  30. package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
  31. package/cjs/core/DatePicker/DatePicker.js +47 -6
  32. package/cjs/core/Dialog/Dialog.js +10 -17
  33. package/cjs/core/Dialog/DialogContext.d.ts +3 -4
  34. package/cjs/core/Dialog/DialogMain.js +5 -5
  35. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  36. package/cjs/core/ExpandableBlock/ExpandableBlock.js +39 -18
  37. package/cjs/core/FileUpload/FileUpload.d.ts +4 -0
  38. package/cjs/core/FileUpload/FileUpload.js +24 -3
  39. package/cjs/core/Header/HeaderBasicButton.js +3 -16
  40. package/cjs/core/Header/HeaderDropdownButton.js +1 -1
  41. package/cjs/core/Header/HeaderSplitButton.js +3 -4
  42. package/cjs/core/Input/Input.d.ts +4 -0
  43. package/cjs/core/Input/Input.js +2 -1
  44. package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
  45. package/cjs/core/InputGrid/InputGrid.js +39 -0
  46. package/cjs/core/InputGrid/index.d.ts +3 -0
  47. package/cjs/core/InputGrid/index.js +15 -0
  48. package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
  49. package/cjs/core/InputGroup/InputGroup.js +35 -9
  50. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  51. package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
  52. package/cjs/core/InputWithDecorations/index.d.ts +3 -0
  53. package/cjs/core/InputWithDecorations/index.js +15 -0
  54. package/cjs/core/Label/Label.d.ts +5 -0
  55. package/cjs/core/Label/Label.js +2 -0
  56. package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
  57. package/cjs/core/LabeledInput/LabeledInput.js +52 -29
  58. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  59. package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
  60. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  61. package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
  62. package/cjs/core/Menu/Menu.d.ts +1 -1
  63. package/cjs/core/Menu/Menu.js +1 -1
  64. package/cjs/core/Menu/MenuDivider.d.ts +2 -1
  65. package/cjs/core/Menu/MenuDivider.js +1 -1
  66. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  67. package/cjs/core/Menu/MenuItem.js +1 -0
  68. package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
  69. package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
  70. package/cjs/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  71. package/cjs/core/ProgressIndicators/ProgressLinear.js +9 -1
  72. package/cjs/core/SearchBox/SearchBox.js +1 -1
  73. package/cjs/core/Select/Select.d.ts +4 -0
  74. package/cjs/core/Select/Select.js +12 -11
  75. package/cjs/core/SideNavigation/SideNavigation.d.ts +16 -0
  76. package/cjs/core/SideNavigation/SideNavigation.js +42 -9
  77. package/cjs/core/Slider/Slider.d.ts +24 -0
  78. package/cjs/core/Slider/Slider.js +58 -10
  79. package/cjs/core/Slider/Thumb.js +3 -2
  80. package/cjs/core/Slider/Track.d.ts +1 -1
  81. package/cjs/core/Slider/Track.js +17 -6
  82. package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
  83. package/cjs/core/StatusMessage/StatusMessage.js +23 -9
  84. package/cjs/core/Stepper/Stepper.d.ts +26 -1
  85. package/cjs/core/Stepper/Stepper.js +35 -6
  86. package/cjs/core/Stepper/StepperStep.d.ts +17 -0
  87. package/cjs/core/Stepper/StepperStep.js +33 -8
  88. package/cjs/core/Stepper/WorkflowDiagram.d.ts +11 -1
  89. package/cjs/core/Stepper/WorkflowDiagram.js +23 -10
  90. package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  91. package/cjs/core/Stepper/WorkflowDiagramStep.js +9 -2
  92. package/cjs/core/Table/SubRowExpander.js +3 -1
  93. package/cjs/core/Table/Table.js +0 -1
  94. package/cjs/core/Table/TableCell.js +1 -1
  95. package/cjs/core/Table/TablePaginator.js +1 -3
  96. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  97. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
  98. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  99. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  100. package/cjs/core/Tabs/Tab.js +1 -2
  101. package/cjs/core/Textarea/Textarea.d.ts +7 -1
  102. package/cjs/core/Textarea/Textarea.js +6 -11
  103. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  104. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  105. package/cjs/core/ThemeProvider/ThemeProvider.js +56 -23
  106. package/cjs/core/Tile/Tile.d.ts +142 -17
  107. package/cjs/core/Tile/Tile.js +107 -16
  108. package/cjs/core/Toast/Toast.d.ts +12 -4
  109. package/cjs/core/Toast/Toast.js +24 -13
  110. package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
  111. package/cjs/core/Tooltip/Tooltip.js +116 -118
  112. package/cjs/core/TransferList/TransferList.js +4 -12
  113. package/cjs/core/Tree/TreeNode.js +1 -1
  114. package/cjs/core/index.d.ts +2 -0
  115. package/cjs/core/index.js +20 -4
  116. package/cjs/core/utils/components/ButtonBase.d.ts +14 -0
  117. package/cjs/core/utils/components/ButtonBase.js +46 -0
  118. package/cjs/core/utils/components/Icon.d.ts +5 -0
  119. package/cjs/core/utils/components/Icon.js +8 -1
  120. package/cjs/core/utils/components/InputContainer.d.ts +0 -1
  121. package/cjs/core/utils/components/InputContainer.js +14 -34
  122. package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
  123. package/cjs/core/utils/components/InputFlexContainer.js +3 -1
  124. package/cjs/core/utils/components/Popover.js +5 -3
  125. package/cjs/core/utils/components/Portal.d.ts +27 -0
  126. package/cjs/core/utils/components/Portal.js +43 -0
  127. package/cjs/core/utils/components/VirtualScroll.js +4 -4
  128. package/cjs/core/utils/components/index.d.ts +2 -0
  129. package/cjs/core/utils/components/index.js +2 -0
  130. package/cjs/core/utils/functions/colors.d.ts +1 -1
  131. package/cjs/core/utils/functions/colors.js +1 -13
  132. package/cjs/core/utils/functions/index.d.ts +1 -0
  133. package/cjs/core/utils/functions/index.js +1 -0
  134. package/cjs/core/utils/functions/react.d.ts +8 -0
  135. package/cjs/core/utils/functions/react.js +40 -0
  136. package/cjs/core/utils/hooks/index.d.ts +1 -0
  137. package/cjs/core/utils/hooks/index.js +1 -0
  138. package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
  139. package/cjs/core/utils/hooks/useControlledState.js +39 -0
  140. package/cjs/core/utils/hooks/useGlobals.d.ts +1 -1
  141. package/cjs/styles.js +11 -35
  142. package/esm/core/Alert/Alert.d.ts +20 -9
  143. package/esm/core/Alert/Alert.js +49 -10
  144. package/esm/core/Avatar/Avatar.d.ts +3 -2
  145. package/esm/core/Avatar/Avatar.js +21 -17
  146. package/esm/core/AvatarGroup/AvatarGroup.js +3 -8
  147. package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
  148. package/esm/core/Buttons/Button/Button.d.ts +15 -2
  149. package/esm/core/Buttons/Button/Button.js +18 -10
  150. package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
  151. package/esm/core/Buttons/IconButton/IconButton.d.ts +5 -1
  152. package/esm/core/Buttons/IconButton/IconButton.js +25 -37
  153. package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -0
  154. package/esm/core/Buttons/SplitButton/SplitButton.js +31 -14
  155. package/esm/core/Carousel/Carousel.d.ts +6 -4
  156. package/esm/core/Carousel/Carousel.js +8 -3
  157. package/esm/core/Carousel/CarouselDot.js +2 -4
  158. package/esm/core/Carousel/CarouselNavigation.d.ts +6 -4
  159. package/esm/core/ColorPicker/ColorBuilder.js +2 -1
  160. package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
  161. package/esm/core/ComboBox/ComboBox.js +3 -3
  162. package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
  163. package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
  164. package/esm/core/ComboBox/ComboBoxInput.js +1 -1
  165. package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
  166. package/esm/core/ComboBox/ComboBoxMenu.js +5 -5
  167. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
  168. package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
  169. package/esm/core/ComboBox/helpers.d.ts +1 -2
  170. package/esm/core/DatePicker/DatePicker.d.ts +30 -8
  171. package/esm/core/DatePicker/DatePicker.js +33 -6
  172. package/esm/core/Dialog/Dialog.js +11 -23
  173. package/esm/core/Dialog/DialogContext.d.ts +3 -4
  174. package/esm/core/Dialog/DialogMain.js +5 -5
  175. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
  176. package/esm/core/ExpandableBlock/ExpandableBlock.js +41 -20
  177. package/esm/core/FileUpload/FileUpload.d.ts +4 -0
  178. package/esm/core/FileUpload/FileUpload.js +26 -3
  179. package/esm/core/Header/HeaderBasicButton.js +4 -17
  180. package/esm/core/Header/HeaderDropdownButton.js +1 -1
  181. package/esm/core/Header/HeaderSplitButton.js +9 -5
  182. package/esm/core/Input/Input.d.ts +4 -0
  183. package/esm/core/Input/Input.js +2 -1
  184. package/esm/core/InputGrid/InputGrid.d.ts +25 -0
  185. package/esm/core/InputGrid/InputGrid.js +35 -0
  186. package/esm/core/InputGrid/index.d.ts +3 -0
  187. package/esm/core/InputGrid/index.js +6 -0
  188. package/esm/core/InputGroup/InputGroup.d.ts +13 -0
  189. package/esm/core/InputGroup/InputGroup.js +34 -10
  190. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
  191. package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
  192. package/esm/core/InputWithDecorations/index.d.ts +3 -0
  193. package/esm/core/InputWithDecorations/index.js +6 -0
  194. package/esm/core/Label/Label.d.ts +5 -0
  195. package/esm/core/Label/Label.js +2 -0
  196. package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
  197. package/esm/core/LabeledInput/LabeledInput.js +53 -29
  198. package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
  199. package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
  200. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
  201. package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
  202. package/esm/core/Menu/Menu.d.ts +1 -1
  203. package/esm/core/Menu/Menu.js +1 -1
  204. package/esm/core/Menu/MenuDivider.d.ts +2 -1
  205. package/esm/core/Menu/MenuDivider.js +1 -1
  206. package/esm/core/Menu/MenuItem.d.ts +1 -1
  207. package/esm/core/Menu/MenuItem.js +1 -0
  208. package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
  209. package/esm/core/Menu/MenuItemSkeleton.js +0 -1
  210. package/esm/core/ProgressIndicators/ProgressLinear.d.ts +4 -0
  211. package/esm/core/ProgressIndicators/ProgressLinear.js +9 -1
  212. package/esm/core/SearchBox/SearchBox.js +1 -1
  213. package/esm/core/Select/Select.d.ts +4 -0
  214. package/esm/core/Select/Select.js +12 -11
  215. package/esm/core/SideNavigation/SideNavigation.d.ts +16 -0
  216. package/esm/core/SideNavigation/SideNavigation.js +33 -9
  217. package/esm/core/Slider/Slider.d.ts +24 -0
  218. package/esm/core/Slider/Slider.js +43 -10
  219. package/esm/core/Slider/Thumb.js +3 -2
  220. package/esm/core/Slider/Track.d.ts +1 -1
  221. package/esm/core/Slider/Track.js +14 -6
  222. package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
  223. package/esm/core/StatusMessage/StatusMessage.js +23 -16
  224. package/esm/core/Stepper/Stepper.d.ts +26 -1
  225. package/esm/core/Stepper/Stepper.js +32 -6
  226. package/esm/core/Stepper/StepperStep.d.ts +17 -0
  227. package/esm/core/Stepper/StepperStep.js +27 -8
  228. package/esm/core/Stepper/WorkflowDiagram.d.ts +11 -1
  229. package/esm/core/Stepper/WorkflowDiagram.js +10 -7
  230. package/esm/core/Stepper/WorkflowDiagramStep.d.ts +6 -1
  231. package/esm/core/Stepper/WorkflowDiagramStep.js +6 -2
  232. package/esm/core/Table/SubRowExpander.js +3 -1
  233. package/esm/core/Table/Table.js +0 -1
  234. package/esm/core/Table/TableCell.js +1 -1
  235. package/esm/core/Table/TablePaginator.js +2 -3
  236. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
  237. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
  238. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
  239. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
  240. package/esm/core/Tabs/Tab.js +2 -3
  241. package/esm/core/Textarea/Textarea.d.ts +7 -1
  242. package/esm/core/Textarea/Textarea.js +6 -11
  243. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  244. package/esm/core/ThemeProvider/ThemeProvider.d.ts +23 -3
  245. package/esm/core/ThemeProvider/ThemeProvider.js +65 -24
  246. package/esm/core/Tile/Tile.d.ts +142 -17
  247. package/esm/core/Tile/Tile.js +107 -16
  248. package/esm/core/Toast/Toast.d.ts +12 -4
  249. package/esm/core/Toast/Toast.js +26 -13
  250. package/esm/core/Tooltip/Tooltip.d.ts +35 -28
  251. package/esm/core/Tooltip/Tooltip.js +119 -116
  252. package/esm/core/TransferList/TransferList.js +4 -9
  253. package/esm/core/Tree/TreeNode.js +1 -1
  254. package/esm/core/index.d.ts +2 -0
  255. package/esm/core/index.js +2 -0
  256. package/esm/core/utils/components/ButtonBase.d.ts +14 -0
  257. package/esm/core/utils/components/ButtonBase.js +42 -0
  258. package/esm/core/utils/components/Icon.d.ts +5 -0
  259. package/esm/core/utils/components/Icon.js +8 -1
  260. package/esm/core/utils/components/InputContainer.d.ts +0 -1
  261. package/esm/core/utils/components/InputContainer.js +14 -30
  262. package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
  263. package/esm/core/utils/components/InputFlexContainer.js +3 -1
  264. package/esm/core/utils/components/Popover.js +5 -3
  265. package/esm/core/utils/components/Portal.d.ts +27 -0
  266. package/esm/core/utils/components/Portal.js +36 -0
  267. package/esm/core/utils/components/VirtualScroll.js +4 -4
  268. package/esm/core/utils/components/index.d.ts +2 -0
  269. package/esm/core/utils/components/index.js +2 -0
  270. package/esm/core/utils/functions/colors.d.ts +1 -1
  271. package/esm/core/utils/functions/colors.js +1 -13
  272. package/esm/core/utils/functions/index.d.ts +1 -0
  273. package/esm/core/utils/functions/index.js +1 -0
  274. package/esm/core/utils/functions/react.d.ts +8 -0
  275. package/esm/core/utils/functions/react.js +35 -0
  276. package/esm/core/utils/hooks/index.d.ts +1 -0
  277. package/esm/core/utils/hooks/index.js +1 -0
  278. package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
  279. package/esm/core/utils/hooks/useControlledState.js +34 -0
  280. package/esm/core/utils/hooks/useGlobals.d.ts +1 -1
  281. package/esm/styles.js +11 -35
  282. package/package.json +3 -3
  283. package/styles.css +49 -46
@@ -5,6 +5,8 @@
5
5
  import * as React from 'react';
6
6
  import cx from 'classnames';
7
7
  import { Box } from './Box.js';
8
+ import { Label } from '../../Label/index.js';
9
+ import { StatusMessage } from '../../StatusMessage/index.js';
8
10
  /**
9
11
  * Input container to wrap inputs with label, and add optional message and icon.
10
12
  * @private
@@ -18,7 +20,6 @@ export const InputContainer = (props) => {
18
20
  message,
19
21
  icon,
20
22
  isLabelInline,
21
- isIconInline,
22
23
  children,
23
24
  className,
24
25
  style,
@@ -30,29 +31,19 @@ export const InputContainer = (props) => {
30
31
  return React.createElement(
31
32
  Box,
32
33
  {
33
- className: cx(
34
- 'iui-input-container',
35
- {
36
- 'iui-disabled': disabled,
37
- [`iui-${status}`]: !!status,
38
- 'iui-inline-label': isLabelInline,
39
- 'iui-inline-icon': isIconInline,
40
- 'iui-with-message':
41
- (!!message || !!icon || !!statusMessage) && !isLabelInline,
42
- },
43
- className,
44
- ),
34
+ className: cx('iui-input-grid', className),
35
+ 'data-iui-status': status,
36
+ 'data-iui-label-placement': isLabelInline ? 'inline' : undefined,
45
37
  style: style,
46
38
  ...rest,
47
39
  },
48
40
  label &&
49
41
  React.createElement(
50
- Box,
42
+ Label,
51
43
  {
52
44
  as: inputId && props.as !== 'label' ? 'label' : 'div',
53
- className: cx('iui-label', {
54
- 'iui-required': required,
55
- }),
45
+ required: required,
46
+ disabled: disabled,
56
47
  htmlFor: inputId,
57
48
  id: labelId,
58
49
  },
@@ -61,18 +52,11 @@ export const InputContainer = (props) => {
61
52
  children,
62
53
  statusMessage
63
54
  ? statusMessage
64
- : React.createElement(
65
- React.Fragment,
66
- null,
67
- icon &&
68
- React.createElement(
69
- Box,
70
- { as: 'span', className: 'iui-input-icon', 'aria-hidden': true },
71
- icon,
72
- ),
73
- message &&
74
- !isLabelInline &&
75
- React.createElement(Box, { className: 'iui-message' }, message),
76
- ),
55
+ : message &&
56
+ React.createElement(
57
+ StatusMessage,
58
+ { startIcon: icon, status: status },
59
+ message,
60
+ ),
77
61
  );
78
62
  };
@@ -2,6 +2,7 @@ import type { PolymorphicForwardRefComponent } from '../props.js';
2
2
  export type InputFlexContainerProps = {
3
3
  isDisabled?: boolean;
4
4
  status?: 'positive' | 'warning' | 'negative';
5
+ size?: 'small' | 'large';
5
6
  };
6
7
  /**
7
8
  * Utility component for input container with display flex abilities.
@@ -10,12 +10,14 @@ import { Box } from './Box.js';
10
10
  * @private
11
11
  */
12
12
  export const InputFlexContainer = React.forwardRef((props, ref) => {
13
- const { isDisabled, status, children, className, style, ...rest } = props;
13
+ const { isDisabled, status, children, className, size, style, ...rest } =
14
+ props;
14
15
  return React.createElement(
15
16
  Box,
16
17
  {
17
18
  className: cx('iui-input-flex-container', className),
18
19
  'data-iui-status': status,
20
+ 'data-iui-size': size,
19
21
  'data-iui-disabled': isDisabled ? 'true' : undefined,
20
22
  ref: ref,
21
23
  style: style,
@@ -36,8 +36,7 @@ export const Popover = React.forwardRef((props, ref) => {
36
36
  const computedProps = {
37
37
  allowHTML: true,
38
38
  animation: false,
39
- appendTo: (el) =>
40
- themeInfo?.portalContainerRef?.current || el.ownerDocument.body,
39
+ appendTo: (el) => themeInfo?.portalContainer || el.ownerDocument.body,
41
40
  arrow: false,
42
41
  duration: 0,
43
42
  interactive: true,
@@ -62,7 +61,10 @@ export const Popover = React.forwardRef((props, ref) => {
62
61
  ...props.popperOptions,
63
62
  modifiers: [
64
63
  { name: 'flip' },
65
- { name: 'preventOverflow', options: { padding: 0 } },
64
+ {
65
+ name: 'preventOverflow',
66
+ options: { padding: 0 },
67
+ },
66
68
  ...(props.popperOptions?.modifiers || []),
67
69
  ],
68
70
  },
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ export type PortalProps = {
3
+ /**
4
+ * Where should the element be portaled to?
5
+ *
6
+ * If true, it will portal into nearest ThemeContext.portalContainer.
7
+ *
8
+ * If false, it will not be portaled.
9
+ *
10
+ * Otherwise, it will portal to the element passed to `to`.
11
+ *
12
+ * @default true
13
+ */
14
+ portal?: boolean | {
15
+ to: HTMLElement | (() => HTMLElement);
16
+ };
17
+ };
18
+ /**
19
+ * Helper component that portals children according to the following conditions:
20
+ * - renders null on server
21
+ * - if `portal` is set to true, renders into nearest ThemeContext.portalContainer
22
+ * - if `portal` is set to false, renders as-is without portal
23
+ * - otherwise renders into `portal.to` (can be an element or a function)
24
+ *
25
+ * @private
26
+ */
27
+ export declare const Portal: (props: React.PropsWithChildren<PortalProps>) => React.ReactNode;
@@ -0,0 +1,36 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as React from 'react';
6
+ import * as ReactDOM from 'react-dom';
7
+ import { ThemeContext } from '../../ThemeProvider/ThemeContext.js';
8
+ import { getDocument } from '../functions/dom.js';
9
+ import { useIsClient } from '../hooks/useIsClient.js';
10
+ // ----------------------------------------------------------------------------
11
+ /**
12
+ * Helper component that portals children according to the following conditions:
13
+ * - renders null on server
14
+ * - if `portal` is set to true, renders into nearest ThemeContext.portalContainer
15
+ * - if `portal` is set to false, renders as-is without portal
16
+ * - otherwise renders into `portal.to` (can be an element or a function)
17
+ *
18
+ * @private
19
+ */
20
+ export const Portal = (props) => {
21
+ const { portal = true, children } = props;
22
+ const isClient = useIsClient();
23
+ const portalTo = usePortalTo(portal);
24
+ if (!isClient) {
25
+ return null;
26
+ }
27
+ return portalTo ? ReactDOM.createPortal(children, portalTo) : children;
28
+ };
29
+ // ----------------------------------------------------------------------------
30
+ const usePortalTo = (portal) => {
31
+ const themeInfo = React.useContext(ThemeContext);
32
+ if (typeof portal === 'boolean') {
33
+ return portal ? themeInfo?.portalContainer ?? getDocument()?.body : null;
34
+ }
35
+ return typeof portal.to === 'function' ? portal.to() : portal.to;
36
+ };
@@ -36,8 +36,8 @@ const getElementHeightWithMargins = (element) => {
36
36
  return undefined;
37
37
  }
38
38
  const margin =
39
- parseFloat(getElementStyle(element, 'margin-top')) +
40
- parseFloat(getElementStyle(element, 'margin-bottom'));
39
+ parseFloat(getElementStyle(element, 'margin-block-start')) +
40
+ parseFloat(getElementStyle(element, 'margin-block-end'));
41
41
  return getElementHeight(element) + (isNaN(margin) ? 0 : margin);
42
42
  };
43
43
  const getNumberOfNodesInHeight = (childHeight, totalHeight) => {
@@ -344,13 +344,13 @@ export const useVirtualization = (props) => {
344
344
  return {
345
345
  outerProps: {
346
346
  style: {
347
- minHeight:
347
+ minBlockSize:
348
348
  itemsLength > 1
349
349
  ? Math.max(itemsLength - 2, 0) * childHeight.current.middle +
350
350
  childHeight.current.first +
351
351
  childHeight.current.last
352
352
  : childHeight.current.middle,
353
- minWidth: '100%',
353
+ minInlineSize: '100%',
354
354
  ...style,
355
355
  },
356
356
  ...rest,
@@ -13,3 +13,5 @@ export * from './Divider.js';
13
13
  export * from './LinkAction.js';
14
14
  export * from './AutoclearingHiddenLiveRegion.js';
15
15
  export * from './Box.js';
16
+ export * from './ButtonBase.js';
17
+ export * from './Portal.js';
@@ -17,3 +17,5 @@ export * from './Divider.js';
17
17
  export * from './LinkAction.js';
18
18
  export * from './AutoclearingHiddenLiveRegion.js';
19
19
  export * from './Box.js';
20
+ export * from './ButtonBase.js';
21
+ export * from './Portal.js';
@@ -17,4 +17,4 @@ export declare const isSoftBackground: (value: string) => value is "skyblue" | "
17
17
  * Generate color from user name or email.
18
18
  * Recommended to use for `backgroundColor` in `Avatar` component.
19
19
  */
20
- export declare const getUserColor: (emailOrName: string) => string;
20
+ export declare const getUserColor: (emailOrName: string) => "var(--iui-color-background-skyblue)" | "var(--iui-color-background-celery)" | "var(--iui-color-background-froly)" | "var(--iui-color-background-steelblue)" | "var(--iui-color-background-sunglow)" | "var(--iui-color-background-seabuckthorn)" | "var(--iui-color-background-montecarlo)" | "var(--iui-color-background-poloblue)" | "var(--iui-color-background-bouquet)" | "var(--iui-color-background-ash)" | "var(--iui-color-background-oak)";
@@ -19,19 +19,7 @@ export const SoftBackgrounds = {
19
19
  export const isSoftBackground = (value) => {
20
20
  return Object.keys(SoftBackgrounds).includes(value);
21
21
  };
22
- const USER_COLORS = [
23
- '#6AB9EC',
24
- '#B1C854',
25
- '#F7706C',
26
- '#4585A5',
27
- '#FFC335',
28
- '#F7963E',
29
- '#73C7C1',
30
- '#85A9CF',
31
- '#A3779F',
32
- '#C8C2B4',
33
- '#A47854',
34
- ];
22
+ const USER_COLORS = Object.values(SoftBackgrounds);
35
23
  /**
36
24
  * Generate color from user name or email.
37
25
  * Recommended to use for `backgroundColor` in `Avatar` component.
@@ -6,3 +6,4 @@ export * from './focusable.js';
6
6
  export * from './supports.js';
7
7
  export * from './polymorphic.js';
8
8
  export * from './import.js';
9
+ export * from './react.js';
@@ -10,3 +10,4 @@ export * from './focusable.js';
10
10
  export * from './supports.js';
11
11
  export * from './polymorphic.js';
12
12
  export * from './import.js';
13
+ export * from './react.js';
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Wrapper over `cloneElement` that automatically checks for `isValidElement`
4
+ * and automatically merges `children.ref` with the ref passed in props.
5
+ *
6
+ * @private
7
+ */
8
+ export declare const cloneElementWithRef: (children: React.ReactNode, getProps: (children: JSX.Element) => Record<string, unknown>) => string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null;
@@ -0,0 +1,35 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as React from 'react';
6
+ import { mergeRefs } from '../hooks/useMergedRefs.js';
7
+ /**
8
+ * Wrapper over `cloneElement` that automatically checks for `isValidElement`
9
+ * and automatically merges `children.ref` with the ref passed in props.
10
+ *
11
+ * @private
12
+ */
13
+ export const cloneElementWithRef = (children, getProps) => {
14
+ if (!children) {
15
+ return null;
16
+ }
17
+ if (!React.isValidElement(children)) {
18
+ return children;
19
+ }
20
+ const props = getProps(children);
21
+ const ref = mergeRefs(
22
+ ...[
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ 'ref' in children ? children.ref : null,
25
+ 'ref' in props ? props.ref : null,
26
+ ].filter(Boolean),
27
+ );
28
+ return React.cloneElement(children, {
29
+ ...props,
30
+ // we already checked ref above and handled null, so ts-ignore is ok
31
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
32
+ // @ts-ignore
33
+ ref,
34
+ });
35
+ };
@@ -11,3 +11,4 @@ export * from './useLatestRef.js';
11
11
  export * from './useIsomorphicLayoutEffect.js';
12
12
  export * from './useIsClient.js';
13
13
  export * from './useId.js';
14
+ export * from './useControlledState.js';
@@ -15,3 +15,4 @@ export * from './useLatestRef.js';
15
15
  export * from './useIsomorphicLayoutEffect.js';
16
16
  export * from './useIsClient.js';
17
17
  export * from './useId.js';
18
+ export * from './useControlledState.js';
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Wrapper over `useState` that always gives preference to the
4
+ * controlled state (which often comes from a prop).
5
+ *
6
+ * This is helpful when a component needs to support both uncontrolled
7
+ * and controlled states. If controlled value/setter is not passed,
8
+ * then it will work just like a regular `useState`.
9
+ *
10
+ * @example
11
+ * const [state, setState] = useControlledState(null, props.value, props.onChange);
12
+ */
13
+ export declare const useControlledState: <T>(initialValue: T, controlledState: T, setControlledState?: React.Dispatch<React.SetStateAction<T>> | undefined) => readonly [T, React.Dispatch<React.SetStateAction<T>>];
@@ -0,0 +1,34 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as React from 'react';
6
+ /**
7
+ * Wrapper over `useState` that always gives preference to the
8
+ * controlled state (which often comes from a prop).
9
+ *
10
+ * This is helpful when a component needs to support both uncontrolled
11
+ * and controlled states. If controlled value/setter is not passed,
12
+ * then it will work just like a regular `useState`.
13
+ *
14
+ * @example
15
+ * const [state, setState] = useControlledState(null, props.value, props.onChange);
16
+ */
17
+ export const useControlledState = (
18
+ initialValue,
19
+ controlledState,
20
+ setControlledState,
21
+ ) => {
22
+ const [uncontrolledState, setUncontrolledState] =
23
+ React.useState(initialValue);
24
+ const state =
25
+ controlledState !== undefined ? controlledState : uncontrolledState;
26
+ const setState = React.useCallback(
27
+ (value) => {
28
+ setUncontrolledState(value);
29
+ setControlledState?.(value);
30
+ },
31
+ [setControlledState, setUncontrolledState],
32
+ );
33
+ return [state, setState];
34
+ };
@@ -9,7 +9,7 @@ import { ThemeContext } from '../../ThemeProvider/ThemeContext.js';
9
9
  export declare const useGlobals: () => {
10
10
  theme?: import("../../index.js").ThemeType | undefined;
11
11
  themeOptions?: import("../../ThemeProvider/ThemeProvider.js").ThemeOptions | undefined;
12
- portalContainerRef?: React.RefObject<HTMLElement> | undefined;
12
+ portalContainer?: HTMLElement | null | undefined;
13
13
  } | undefined;
14
14
  /** Shows console error if ThemeProvider is not used */
15
15
  export declare const useThemeProviderWarning: (themeContext: React.ContextType<typeof ThemeContext>) => void;
package/esm/styles.js CHANGED
@@ -10,13 +10,6 @@ const styles = {
10
10
  'iui-anchor': '_iui3-anchor',
11
11
  'iui-anchor-external': '_iui3-anchor-external',
12
12
  'iui-avatar': '_iui3-avatar',
13
- 'iui-stroke': '_iui3-stroke',
14
- 'iui-initials': '_iui3-initials',
15
- 'iui-status': '_iui3-status',
16
- 'iui-online': '_iui3-online',
17
- 'iui-away': '_iui3-away',
18
- 'iui-busy': '_iui3-busy',
19
- 'iui-offline': '_iui3-offline',
20
13
  'iui-avatar-count': '_iui3-avatar-count',
21
14
  'iui-small': '_iui3-small',
22
15
  'iui-large': '_iui3-large',
@@ -40,8 +33,9 @@ const styles = {
40
33
  'iui-button-dropdown': '_iui3-button-dropdown',
41
34
  'iui-button-split': '_iui3-button-split',
42
35
  'iui-button-group': '_iui3-button-group',
43
- 'iui-input-container': '_iui3-input-container',
36
+ 'iui-input-flex-container': '_iui3-input-flex-container',
44
37
  'iui-input': '_iui3-input',
38
+ 'iui-input-grid': '_iui3-input-grid',
45
39
  'iui-disabled': '_iui3-disabled',
46
40
  'iui-button-group-vertical': '_iui3-button-group-vertical',
47
41
  'iui-button-group-overflow-x': '_iui3-button-group-overflow-x',
@@ -184,36 +178,18 @@ const styles = {
184
178
  'iui-information-body-content': '_iui3-information-body-content',
185
179
  'iui-input-label': '_iui3-input-label',
186
180
  'iui-inline': '_iui3-inline',
187
- 'iui-required': '_iui3-required',
188
181
  'iui-input-with-icon': '_iui3-input-with-icon',
189
182
  'iui-select-tag-container': '_iui3-select-tag-container',
190
183
  'iui-end-icon': '_iui3-end-icon',
191
- 'iui-actionable': '_iui3-actionable',
192
184
  'iui-open': '_iui3-open',
193
- 'iui-inline-icon': '_iui3-inline-icon',
194
- 'iui-with-message': '_iui3-with-message',
195
- 'iui-input-icon': '_iui3-input-icon',
185
+ 'iui-required': '_iui3-required',
196
186
  'iui-input-group': '_iui3-input-group',
187
+ 'iui-status-message': '_iui3-status-message',
188
+ 'iui-select-button': '_iui3-select-button',
189
+ 'iui-input-group-wrapper': '_iui3-input-group-wrapper',
197
190
  'iui-toggle-switch-wrapper': '_iui3-toggle-switch-wrapper',
198
191
  'iui-radio-wrapper': '_iui3-radio-wrapper',
199
- 'iui-inline-label': '_iui3-inline-label',
200
- 'iui-label': '_iui3-label',
201
- 'iui-message': '_iui3-message',
202
- 'iui-select-button': '_iui3-select-button',
203
- 'iui-input-flex-container': '_iui3-input-flex-container',
204
192
  'iui-keyboard': '_iui3-keyboard',
205
- 'iui-location-marker': '_iui3-location-marker',
206
- 'iui-location-marker-default': '_iui3-location-marker-default',
207
- 'iui-location-marker-default-pin': '_iui3-location-marker-default-pin',
208
- 'iui-location-marker-default-pin-dot':
209
- '_iui3-location-marker-default-pin-dot',
210
- 'iui-location-marker-data-rich': '_iui3-location-marker-data-rich',
211
- 'iui-location-marker-data-rich-body': '_iui3-location-marker-data-rich-body',
212
- 'iui-location-marker-data-rich-icon': '_iui3-location-marker-data-rich-icon',
213
- 'iui-location-marker-data-rich-icon-monochrome':
214
- '_iui3-location-marker-data-rich-icon-monochrome',
215
- 'iui-location-marker-me': '_iui3-location-marker-me',
216
- 'iui-location-marker-me-dot': '_iui3-location-marker-me-dot',
217
193
  'iui-list': '_iui3-list',
218
194
  'iui-menu': '_iui3-menu',
219
195
  'iui-header-menu-icon': '_iui3-header-menu-icon',
@@ -242,10 +218,10 @@ const styles = {
242
218
  'iui-overlay-exiting': '_iui3-overlay-exiting',
243
219
  closeAnimation,
244
220
  'iui-progress-indicator-radial': '_iui3-progress-indicator-radial',
245
- 'iui-ux8sxma': '_iui3-ux8sxma',
221
+ 'iui-ubn95wp': '_iui3-ubn95wp',
246
222
  'iui-progress-indicator-linear-label':
247
223
  '_iui3-progress-indicator-linear-label',
248
- 'iui-ux8sxmt': '_iui3-ux8sxmt',
224
+ 'iui-ubn95xj': '_iui3-ubn95xj',
249
225
  'iui-radio': '_iui3-radio',
250
226
  'iui-radio-tile': '_iui3-radio-tile',
251
227
  'iui-radio-tile-icon': '_iui3-radio-tile-icon',
@@ -312,6 +288,7 @@ const styles = {
312
288
  'iui-table-body': '_iui3-table-body',
313
289
  'iui-table-header-wrapper': '_iui3-table-header-wrapper',
314
290
  'iui-slot': '_iui3-slot',
291
+ 'iui-actionable': '_iui3-actionable',
315
292
  'iui-table-filter-button': '_iui3-table-filter-button',
316
293
  'iui-table-resizer': '_iui3-table-resizer',
317
294
  'iui-table-resizer-bar': '_iui3-table-resizer-bar',
@@ -408,6 +385,7 @@ const styles = {
408
385
  'iui-placement-bottom-start': '_iui3-placement-bottom-start',
409
386
  'iui-placement-bottom-end': '_iui3-placement-bottom-end',
410
387
  'iui-status-area': '_iui3-status-area',
388
+ 'iui-message': '_iui3-message',
411
389
  'iui-toast-anchor': '_iui3-toast-anchor',
412
390
  'iui-informational': '_iui3-informational',
413
391
  'iui-label-on-left': '_iui3-label-on-left',
@@ -415,11 +393,8 @@ const styles = {
415
393
  'iui-toggle-switch-icon': '_iui3-toggle-switch-icon',
416
394
  'iui-toggle-switch': '_iui3-toggle-switch',
417
395
  'iui-toggle-switch-label': '_iui3-toggle-switch-label',
418
- 'iui-tooltip-container': '_iui3-tooltip-container',
419
396
  'iui-tooltip': '_iui3-tooltip',
420
- 'iui-tooltip-visible': '_iui3-tooltip-visible',
421
397
  'iui-transfer-list-wrapper': '_iui3-transfer-list-wrapper',
422
- 'iui-transfer-list-listbox-label': '_iui3-transfer-list-listbox-label',
423
398
  'iui-transfer-list-listbox-wrapper': '_iui3-transfer-list-listbox-wrapper',
424
399
  'iui-transfer-list-listbox': '_iui3-transfer-list-listbox',
425
400
  'iui-transfer-list-toolbar': '_iui3-transfer-list-toolbar',
@@ -437,6 +412,7 @@ const styles = {
437
412
  'iui-tree-node-content-label': '_iui3-tree-node-content-label',
438
413
  'iui-tree-node-content-title': '_iui3-tree-node-content-title',
439
414
  'iui-tree-node-content-caption': '_iui3-tree-node-content-caption',
415
+ 'iui-button-base': '_iui3-button-base',
440
416
  'iui-svg-icon': '_iui3-svg-icon',
441
417
  'iui-notification-marker': '_iui3-notification-marker',
442
418
  pulse,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/itwinui-react",
3
- "version": "3.0.0-dev.6",
3
+ "version": "3.0.0-dev.8",
4
4
  "author": "Bentley Systems",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "dev:styles": "yarn build:styles --watch"
74
74
  },
75
75
  "dependencies": {
76
- "@floating-ui/react": "^0.24.3",
76
+ "@floating-ui/react": "^0.25.2",
77
77
  "@tippyjs/react": "^4.2.6",
78
78
  "@types/react-table": "^7.0.18",
79
79
  "classnames": "^2.2.6",
@@ -83,7 +83,7 @@
83
83
  "tslib": "^2.6.0"
84
84
  },
85
85
  "devDependencies": {
86
- "@itwin/itwinui-css": "^2.0.0-dev.6",
86
+ "@itwin/itwinui-css": "^2.0.0-dev.8",
87
87
  "@itwin/itwinui-illustrations-react": "^2.1.0",
88
88
  "@itwin/itwinui-variables": "3.0.0-dev.1",
89
89
  "@swc/cli": "^0.1.62",