@itwin/itwinui-react 1.18.0 → 1.19.0

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 (124) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/cjs/core/Alert/Alert.js +2 -2
  3. package/cjs/core/Badge/Badge.js +4 -4
  4. package/cjs/core/Breadcrumbs/Breadcrumbs.js +5 -5
  5. package/cjs/core/ButtonGroup/ButtonGroup.js +3 -3
  6. package/cjs/core/Buttons/Button/Button.js +4 -4
  7. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -3
  8. package/cjs/core/Buttons/IconButton/IconButton.js +3 -3
  9. package/cjs/core/Buttons/IdeasButton/IdeasButton.js +1 -1
  10. package/cjs/core/Buttons/SplitButton/SplitButton.js +2 -2
  11. package/cjs/core/Checkbox/Checkbox.js +5 -5
  12. package/cjs/core/DatePicker/DatePicker.js +3 -3
  13. package/cjs/core/DropdownMenu/DropdownMenu.js +2 -2
  14. package/cjs/core/ErrorPage/ErrorPage.js +1 -1
  15. package/cjs/core/ExpandableBlock/ExpandableBlock.js +3 -3
  16. package/cjs/core/Fieldset/Fieldset.js +2 -2
  17. package/cjs/core/FileUpload/FileUpload.js +3 -3
  18. package/cjs/core/FileUpload/FileUploadTemplate.js +1 -1
  19. package/cjs/core/Footer/Footer.js +11 -7
  20. package/cjs/core/Header/Header.js +2 -2
  21. package/cjs/core/Header/HeaderBreadcrumbs.js +11 -7
  22. package/cjs/core/Header/HeaderButton.js +3 -3
  23. package/cjs/core/Header/HeaderLogo.js +3 -3
  24. package/cjs/core/Input/Input.js +3 -3
  25. package/cjs/core/InputGroup/InputGroup.js +5 -17
  26. package/cjs/core/LabeledInput/LabeledInput.d.ts +28 -4
  27. package/cjs/core/LabeledInput/LabeledInput.js +5 -17
  28. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +4 -8
  29. package/cjs/core/LabeledSelect/LabeledSelect.js +7 -17
  30. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +6 -25
  31. package/cjs/core/LabeledTextarea/LabeledTextarea.js +5 -17
  32. package/cjs/core/Menu/Menu.js +3 -3
  33. package/cjs/core/Menu/MenuItem.js +5 -5
  34. package/cjs/core/Modal/Modal.js +4 -4
  35. package/cjs/core/Modal/ModalButtonBar.js +1 -1
  36. package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +3 -3
  37. package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
  38. package/cjs/core/Radio/Radio.js +5 -5
  39. package/cjs/core/RadioTiles/RadioTile.js +3 -3
  40. package/cjs/core/RadioTiles/RadioTileGroup.js +1 -1
  41. package/cjs/core/Select/Select.js +5 -5
  42. package/cjs/core/SideNavigation/SideNavigation.js +2 -2
  43. package/cjs/core/SideNavigation/SidenavButton.js +2 -2
  44. package/cjs/core/Slider/Slider.js +19 -15
  45. package/cjs/core/Slider/Thumb.js +2 -2
  46. package/cjs/core/Slider/Track.js +10 -6
  47. package/cjs/core/Table/Table.js +8 -12
  48. package/cjs/core/Table/TableCell.js +2 -2
  49. package/cjs/core/Table/TableRowMemoized.js +3 -3
  50. package/cjs/core/Table/actionHandlers/selectHandler.js +1 -1
  51. package/cjs/core/Table/filters/BaseFilter.js +2 -2
  52. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +1 -1
  53. package/cjs/core/Table/filters/FilterButtonBar.js +2 -2
  54. package/cjs/core/Table/filters/FilterToggle.js +3 -3
  55. package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +1 -1
  56. package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -1
  57. package/cjs/core/Table/hooks/useExpanderCell.js +9 -5
  58. package/cjs/core/Table/hooks/useSelectionCell.js +9 -5
  59. package/cjs/core/Table/hooks/useSubRowFiltering.js +9 -5
  60. package/cjs/core/Tabs/Tab.js +2 -2
  61. package/cjs/core/Tabs/Tabs.js +10 -10
  62. package/cjs/core/Tag/Tag.js +2 -2
  63. package/cjs/core/Tag/TagContainer.js +2 -2
  64. package/cjs/core/Textarea/Textarea.js +3 -3
  65. package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
  66. package/cjs/core/Tile/Tile.js +7 -7
  67. package/cjs/core/TimePicker/TimePicker.js +3 -3
  68. package/cjs/core/Toast/Toast.d.ts +8 -0
  69. package/cjs/core/Toast/Toast.js +49 -10
  70. package/cjs/core/Toast/ToastWrapper.js +3 -2
  71. package/cjs/core/Toast/Toaster.js +12 -9
  72. package/cjs/core/ToggleSwitch/ToggleSwitch.js +4 -4
  73. package/cjs/core/Tooltip/Tooltip.js +2 -2
  74. package/cjs/core/Typography/Blockquote/Blockquote.js +2 -2
  75. package/cjs/core/Typography/Body/Body.js +2 -2
  76. package/cjs/core/Typography/Code/Code.js +2 -2
  77. package/cjs/core/Typography/Headline/Headline.js +2 -2
  78. package/cjs/core/Typography/Kbd/Kbd.js +2 -2
  79. package/cjs/core/Typography/Leading/Leading.js +2 -2
  80. package/cjs/core/Typography/Small/Small.js +2 -2
  81. package/cjs/core/Typography/Subheading/Subheading.js +2 -2
  82. package/cjs/core/Typography/Text/Text.js +2 -2
  83. package/cjs/core/Typography/Title/Title.js +2 -2
  84. package/cjs/core/UserIcon/UserIcon.js +3 -3
  85. package/cjs/core/UserIconGroup/UserIconGroup.js +3 -3
  86. package/cjs/core/Wizard/Step.js +1 -1
  87. package/cjs/core/Wizard/Wizard.js +2 -2
  88. package/cjs/core/utils/FocusTrap.js +2 -2
  89. package/cjs/core/utils/InputContainer.d.ts +17 -0
  90. package/cjs/core/utils/InputContainer.js +39 -0
  91. package/cjs/core/utils/Popover.js +10 -6
  92. package/cjs/core/utils/common.js +1 -1
  93. package/cjs/core/utils/hooks/useIntersection.js +1 -1
  94. package/cjs/core/utils/hooks/useMergedRefs.js +9 -5
  95. package/cjs/core/utils/hooks/useOverflow.js +2 -2
  96. package/cjs/core/utils/hooks/useResizeObserver.js +1 -1
  97. package/cjs/core/utils/hooks/useTheme.js +2 -2
  98. package/esm/core/Checkbox/Checkbox.js +1 -1
  99. package/esm/core/Footer/Footer.js +9 -5
  100. package/esm/core/Header/HeaderBreadcrumbs.js +10 -6
  101. package/esm/core/InputGroup/InputGroup.js +4 -16
  102. package/esm/core/LabeledInput/LabeledInput.d.ts +28 -4
  103. package/esm/core/LabeledInput/LabeledInput.js +4 -16
  104. package/esm/core/LabeledSelect/LabeledSelect.d.ts +4 -8
  105. package/esm/core/LabeledSelect/LabeledSelect.js +6 -16
  106. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +6 -25
  107. package/esm/core/LabeledTextarea/LabeledTextarea.js +4 -16
  108. package/esm/core/Radio/Radio.js +1 -1
  109. package/esm/core/Slider/Slider.js +11 -7
  110. package/esm/core/Slider/Thumb.js +1 -1
  111. package/esm/core/Slider/Track.js +10 -6
  112. package/esm/core/Table/Table.js +1 -5
  113. package/esm/core/Table/hooks/useExpanderCell.js +9 -5
  114. package/esm/core/Table/hooks/useSelectionCell.js +9 -5
  115. package/esm/core/Table/hooks/useSubRowFiltering.js +9 -5
  116. package/esm/core/Toast/Toast.d.ts +8 -0
  117. package/esm/core/Toast/Toast.js +45 -6
  118. package/esm/core/Toast/ToastWrapper.js +2 -1
  119. package/esm/core/Toast/Toaster.js +11 -8
  120. package/esm/core/utils/InputContainer.d.ts +17 -0
  121. package/esm/core/utils/InputContainer.js +32 -0
  122. package/esm/core/utils/Popover.js +9 -5
  123. package/esm/core/utils/hooks/useMergedRefs.js +9 -5
  124. package/package.json +14 -10
@@ -20,10 +20,14 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
24
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
25
- to[j] = from[i];
26
- return to;
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
27
31
  };
28
32
  /*---------------------------------------------------------------------------------------------
29
33
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -66,7 +70,7 @@ export var Footer = function (props) {
66
70
  { title: titles.legalNotices, url: 'https://connect.bentley.com/Legal' },
67
71
  ];
68
72
  var elements = customElements
69
- ? __spreadArray(__spreadArray([], defaultElements), customElements) : defaultElements;
73
+ ? __spreadArray(__spreadArray([], defaultElements, true), customElements, true) : defaultElements;
70
74
  return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest),
71
75
  React.createElement("ul", null,
72
76
  React.createElement("li", null,
@@ -20,10 +20,14 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
24
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
25
- to[j] = from[i];
26
- return to;
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
27
31
  };
28
32
  /*---------------------------------------------------------------------------------------------
29
33
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -46,9 +50,9 @@ import '@itwin/itwinui-css/css/header.css';
46
50
  export var HeaderBreadcrumbs = function (props) {
47
51
  var items = props.items, rest = __rest(props, ["items"]);
48
52
  useTheme();
49
- return (React.createElement("nav", __assign({ "aria-label": 'breadcrumbs' }, rest), items.reduce(function (previous, current, index) { return __spreadArray(__spreadArray([], previous), [
53
+ return (React.createElement("nav", __assign({ "aria-label": 'breadcrumbs' }, rest), items.reduce(function (previous, current, index) { return __spreadArray(__spreadArray([], previous, true), [
50
54
  current,
51
55
  index !== items.length - 1 && (React.createElement(SvgChevronRight, { key: "chevron" + index, "aria-hidden": true, className: 'iui-chevron' })),
52
- ]); }, [])));
56
+ ], false); }, [])));
53
57
  };
54
58
  export default HeaderBreadcrumbs;
@@ -24,10 +24,10 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
- import cx from 'classnames';
28
27
  import React from 'react';
29
28
  import { StatusIconMap } from '../utils/common';
30
29
  import { useTheme } from '../utils/hooks/useTheme';
30
+ import { InputContainer } from '../utils/InputContainer';
31
31
  import '@itwin/itwinui-css/css/inputs.css';
32
32
  /**
33
33
  * Group Checkbox/Radio components together
@@ -45,22 +45,10 @@ import '@itwin/itwinui-css/css/inputs.css';
45
45
  * </InputGroup>
46
46
  */
47
47
  export var InputGroup = function (props) {
48
- var _a;
49
- var children = props.children, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.displayStyle, displayStyle = _c === void 0 ? 'default' : _c, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, className = props.className, style = props.style, _d = props.required, required = _d === void 0 ? false : _d, rest = __rest(props, ["children", "disabled", "displayStyle", "label", "message", "status", "svgIcon", "className", "style", "required"]);
48
+ var children = props.children, _a = props.disabled, disabled = _a === void 0 ? false : _a, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, className = props.className, style = props.style, _c = props.required, required = _c === void 0 ? false : _c, rest = __rest(props, ["children", "disabled", "displayStyle", "label", "message", "status", "svgIcon", "className", "style", "required"]);
50
49
  useTheme();
51
50
  var icon = svgIcon !== null && svgIcon !== void 0 ? svgIcon : (status && StatusIconMap[status]());
52
- return (React.createElement("div", __assign({ className: cx('iui-input-container', (_a = {
53
- 'iui-disabled': disabled
54
- },
55
- _a["iui-" + status] = !!status,
56
- _a["iui-" + displayStyle] = displayStyle !== 'default',
57
- _a), className), style: style }, rest),
58
- label && (React.createElement("div", { className: cx('iui-label', {
59
- 'iui-required': required,
60
- }) }, label)),
61
- children,
62
- (message || icon) && (React.createElement("div", { className: 'iui-message' },
63
- icon,
64
- displayStyle === 'default' && message))));
51
+ return (React.createElement(InputContainer, __assign({ label: label, disabled: disabled, required: required, status: status, message: message, icon: icon ? React.cloneElement(icon, { 'aria-hidden': true }) : undefined, isLabelInline: displayStyle === 'inline', className: className, style: style }, rest),
52
+ React.createElement("div", { className: 'iui-input-group' }, children)));
65
53
  };
66
54
  export default InputGroup;
@@ -15,7 +15,7 @@ export declare type LabeledInputProps = {
15
15
  */
16
16
  status?: 'positive' | 'warning' | 'negative';
17
17
  /**
18
- * Custom svg icon. If input has status, default status icon is used instead.
18
+ * Custom svg icon. Will override status icon if specified.
19
19
  */
20
20
  svgIcon?: JSX.Element;
21
21
  /**
@@ -27,10 +27,22 @@ export declare type LabeledInputProps = {
27
27
  */
28
28
  inputStyle?: React.CSSProperties;
29
29
  /**
30
- * You can choose between default and inline.
30
+ * Set display style of label.
31
+ * Supported values:
32
+ * - 'default' - label appears above input.
33
+ * - 'inline' - appears in the same line as input.
31
34
  * @default 'default'
32
35
  */
33
36
  displayStyle?: 'default' | 'inline';
37
+ /**
38
+ * Set display style of icon.
39
+ * Supported values:
40
+ * - 'block' - icon appears below input.
41
+ * - 'inline' - icon appears inside input (at the end).
42
+ *
43
+ * Defaults to 'block' if `displayStyle` is `default`, else 'inline'.
44
+ */
45
+ iconDisplayStyle?: 'block' | 'inline';
34
46
  } & InputProps;
35
47
  /**
36
48
  * Basic labeled input component
@@ -54,7 +66,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
54
66
  */
55
67
  status?: "positive" | "warning" | "negative" | undefined;
56
68
  /**
57
- * Custom svg icon. If input has status, default status icon is used instead.
69
+ * Custom svg icon. Will override status icon if specified.
58
70
  */
59
71
  svgIcon?: JSX.Element | undefined;
60
72
  /**
@@ -66,10 +78,22 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
66
78
  */
67
79
  inputStyle?: React.CSSProperties | undefined;
68
80
  /**
69
- * You can choose between default and inline.
81
+ * Set display style of label.
82
+ * Supported values:
83
+ * - 'default' - label appears above input.
84
+ * - 'inline' - appears in the same line as input.
70
85
  * @default 'default'
71
86
  */
72
87
  displayStyle?: "default" | "inline" | undefined;
88
+ /**
89
+ * Set display style of icon.
90
+ * Supported values:
91
+ * - 'block' - icon appears below input.
92
+ * - 'inline' - icon appears inside input (at the end).
93
+ *
94
+ * Defaults to 'block' if `displayStyle` is `default`, else 'inline'.
95
+ */
96
+ iconDisplayStyle?: "inline" | "block" | undefined;
73
97
  } & {
74
98
  setFocus?: boolean | undefined;
75
99
  size?: "small" | "large" | undefined;
@@ -24,11 +24,11 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
- import cx from 'classnames';
28
27
  import React from 'react';
29
28
  import { Input } from '../Input/Input';
30
29
  import { StatusIconMap } from '../utils/common';
31
30
  import { useTheme } from '../utils/hooks/useTheme';
31
+ import { InputContainer } from '../utils/InputContainer';
32
32
  import '@itwin/itwinui-css/css/inputs.css';
33
33
  /**
34
34
  * Basic labeled input component
@@ -39,22 +39,10 @@ import '@itwin/itwinui-css/css/inputs.css';
39
39
  * <LabeledInput status='negative' label='Negative' setFocus />
40
40
  */
41
41
  export var LabeledInput = React.forwardRef(function (props, ref) {
42
- var _a;
43
- var className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, style = props.style, inputClassName = props.inputClassName, inputStyle = props.inputStyle, _c = props.displayStyle, displayStyle = _c === void 0 ? 'default' : _c, _d = props.required, required = _d === void 0 ? false : _d, rest = __rest(props, ["className", "disabled", "label", "message", "status", "svgIcon", "style", "inputClassName", "inputStyle", "displayStyle", "required"]);
42
+ var className = props.className, _a = props.disabled, disabled = _a === void 0 ? false : _a, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, style = props.style, inputClassName = props.inputClassName, inputStyle = props.inputStyle, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, _c = props.iconDisplayStyle, iconDisplayStyle = _c === void 0 ? displayStyle === 'default' ? 'block' : 'inline' : _c, _d = props.required, required = _d === void 0 ? false : _d, rest = __rest(props, ["className", "disabled", "label", "message", "status", "svgIcon", "style", "inputClassName", "inputStyle", "displayStyle", "iconDisplayStyle", "required"]);
44
43
  useTheme();
45
44
  var icon = svgIcon !== null && svgIcon !== void 0 ? svgIcon : (status && StatusIconMap[status]());
46
- return (React.createElement("label", { className: cx('iui-input-container', (_a = {
47
- 'iui-disabled': disabled
48
- },
49
- _a["iui-" + status] = !!status,
50
- _a["iui-" + displayStyle] = displayStyle !== 'default',
51
- _a), className), style: style },
52
- label && (React.createElement("div", { className: cx('iui-label', {
53
- 'iui-required': required,
54
- }) }, label)),
55
- React.createElement(Input, __assign({ disabled: disabled, className: inputClassName, style: inputStyle, required: required, ref: ref }, rest)),
56
- (message || icon) && (React.createElement("div", { className: 'iui-message' },
57
- icon,
58
- displayStyle === 'default' && message))));
45
+ return (React.createElement(InputContainer, { as: 'label', label: label, disabled: disabled, required: required, status: status, message: message, icon: icon, isLabelInline: displayStyle === 'inline', isIconInline: iconDisplayStyle === 'inline', className: className, style: style },
46
+ React.createElement(Input, __assign({ disabled: disabled, className: inputClassName, style: inputStyle, required: required, ref: ref }, rest))));
59
47
  });
60
48
  export default LabeledInput;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SelectProps } from '../Select/Select';
3
+ import { LabeledInputProps } from '../LabeledInput';
3
4
  import '@itwin/itwinui-css/css/inputs.css';
4
5
  export declare type LabeledSelectProps<T> = {
5
6
  /**
@@ -7,7 +8,7 @@ export declare type LabeledSelectProps<T> = {
7
8
  */
8
9
  label?: React.ReactNode;
9
10
  /**
10
- * Message below the select.
11
+ * Message below the select. Does not apply to 'inline' select.
11
12
  */
12
13
  message?: React.ReactNode;
13
14
  /**
@@ -16,7 +17,7 @@ export declare type LabeledSelectProps<T> = {
16
17
  */
17
18
  status?: 'positive' | 'warning' | 'negative';
18
19
  /**
19
- * Custom svg icon. If select has status, default status icon is used instead.
20
+ * Custom svg icon. Will override status icon if specified.
20
21
  */
21
22
  svgIcon?: JSX.Element;
22
23
  /**
@@ -27,17 +28,12 @@ export declare type LabeledSelectProps<T> = {
27
28
  * Custom CSS Style for the select element.
28
29
  */
29
30
  selectStyle?: React.CSSProperties;
30
- /**
31
- * You can choose between default and inline.
32
- * @default 'default'
33
- */
34
- displayStyle?: 'default' | 'inline';
35
31
  /**
36
32
  * If true, shows a red asterisk but does not prevent form submission.
37
33
  * @default false
38
34
  */
39
35
  required?: boolean;
40
- } & SelectProps<T>;
36
+ } & Pick<LabeledInputProps, 'displayStyle'> & SelectProps<T>;
41
37
  /**
42
38
  * Labeled select component to select value from options.
43
39
  * @example
@@ -25,10 +25,10 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
27
  import React from 'react';
28
- import cx from 'classnames';
29
28
  import { Select } from '../Select';
30
29
  import { StatusIconMap } from '../utils/common';
31
30
  import { useTheme } from '../utils/hooks/useTheme';
31
+ import { InputContainer } from '../utils/InputContainer';
32
32
  import '@itwin/itwinui-css/css/inputs.css';
33
33
  /**
34
34
  * Labeled select component to select value from options.
@@ -64,22 +64,12 @@ import '@itwin/itwinui-css/css/inputs.css';
64
64
  * />
65
65
  */
66
66
  export var LabeledSelect = function (props) {
67
- var _a;
68
- var className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, _c = props.displayStyle, displayStyle = _c === void 0 ? 'default' : _c, style = props.style, selectClassName = props.selectClassName, selectStyle = props.selectStyle, _d = props.required, required = _d === void 0 ? false : _d, rest = __rest(props, ["className", "disabled", "label", "message", "status", "svgIcon", "displayStyle", "style", "selectClassName", "selectStyle", "required"]);
67
+ var className = props.className, _a = props.disabled, disabled = _a === void 0 ? false : _a, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, style = props.style, selectClassName = props.selectClassName, selectStyle = props.selectStyle, _c = props.required, required = _c === void 0 ? false : _c, rest = __rest(props, ["className", "disabled", "label", "message", "status", "svgIcon", "displayStyle", "style", "selectClassName", "selectStyle", "required"]);
69
68
  useTheme();
70
69
  var icon = svgIcon !== null && svgIcon !== void 0 ? svgIcon : (status && StatusIconMap[status]());
71
- return (React.createElement("div", { className: cx('iui-input-container', (_a = {
72
- 'iui-disabled': disabled
73
- },
74
- _a["iui-" + status] = !!status,
75
- _a["iui-" + displayStyle] = displayStyle !== 'default',
76
- _a), className), style: style },
77
- label && (React.createElement("div", { className: cx('iui-label', {
78
- 'iui-required': required,
79
- }) }, label)),
80
- React.createElement(Select, __assign({ disabled: disabled, className: selectClassName, style: selectStyle }, rest)),
81
- displayStyle === 'default' && (message || icon) && (React.createElement("div", { className: 'iui-message' },
82
- icon,
83
- message))));
70
+ return (React.createElement(InputContainer, { label: label, disabled: disabled, required: required, status: status, message: message, icon: displayStyle === 'default' && icon
71
+ ? React.cloneElement(icon, { 'aria-hidden': true })
72
+ : undefined, isLabelInline: displayStyle === 'inline', className: className, style: style },
73
+ React.createElement(Select, __assign({ disabled: disabled, className: selectClassName, style: selectStyle }, rest))));
84
74
  };
85
75
  export default LabeledSelect;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TextareaProps } from '../Textarea/Textarea';
3
+ import { LabeledInputProps } from '../LabeledInput';
3
4
  import '@itwin/itwinui-css/css/inputs.css';
4
5
  export declare type LabeledTextareaProps = {
5
6
  /**
@@ -7,7 +8,7 @@ export declare type LabeledTextareaProps = {
7
8
  */
8
9
  label: React.ReactNode;
9
10
  /**
10
- * Message below the textarea.
11
+ * Message below the textarea. Does not apply to 'inline' textarea.
11
12
  */
12
13
  message?: React.ReactNode;
13
14
  /**
@@ -22,16 +23,7 @@ export declare type LabeledTextareaProps = {
22
23
  * Custom style for textarea.
23
24
  */
24
25
  textareaStyle?: React.CSSProperties;
25
- /**
26
- * You can choose between default and inline.
27
- * @default 'default'
28
- */
29
- displayStyle?: 'default' | 'inline';
30
- /**
31
- * Custom icon. If textarea has status, default status icon is used instead.
32
- */
33
- svgIcon?: JSX.Element;
34
- } & TextareaProps;
26
+ } & Pick<LabeledInputProps, 'svgIcon' | 'displayStyle' | 'iconDisplayStyle'> & TextareaProps;
35
27
  /**
36
28
  * Textarea wrapper that allows for additional styling and labelling
37
29
  * @example
@@ -59,7 +51,7 @@ export declare const LabeledTextarea: React.ForwardRefExoticComponent<{
59
51
  */
60
52
  label: React.ReactNode;
61
53
  /**
62
- * Message below the textarea.
54
+ * Message below the textarea. Does not apply to 'inline' textarea.
63
55
  */
64
56
  message?: React.ReactNode;
65
57
  /**
@@ -74,18 +66,7 @@ export declare const LabeledTextarea: React.ForwardRefExoticComponent<{
74
66
  * Custom style for textarea.
75
67
  */
76
68
  textareaStyle?: React.CSSProperties | undefined;
77
- /**
78
- * You can choose between default and inline.
79
- * @default 'default'
80
- */
81
- displayStyle?: "default" | "inline" | undefined;
82
- /**
83
- * Custom icon. If textarea has status, default status icon is used instead.
84
- */
85
- svgIcon?: JSX.Element | undefined;
86
- } & {
87
- setFocus?: boolean | undefined; /**
88
- * Label for the textarea.
89
- */
69
+ } & Pick<LabeledInputProps, "svgIcon" | "displayStyle" | "iconDisplayStyle"> & {
70
+ setFocus?: boolean | undefined;
90
71
  } & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
91
72
  export default LabeledTextarea;
@@ -24,11 +24,11 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
- import cx from 'classnames';
28
27
  import React from 'react';
29
28
  import { StatusIconMap } from '../utils/common';
30
29
  import { Textarea } from '../Textarea';
31
30
  import { useTheme } from '../utils/hooks/useTheme';
31
+ import { InputContainer } from '../utils/InputContainer';
32
32
  import '@itwin/itwinui-css/css/inputs.css';
33
33
  /**
34
34
  * Textarea wrapper that allows for additional styling and labelling
@@ -52,22 +52,10 @@ import '@itwin/itwinui-css/css/inputs.css';
52
52
  * />
53
53
  */
54
54
  export var LabeledTextarea = React.forwardRef(function (props, ref) {
55
- var _a;
56
- var className = props.className, style = props.style, _b = props.disabled, disabled = _b === void 0 ? false : _b, label = props.label, message = props.message, status = props.status, textareaClassName = props.textareaClassName, textareaStyle = props.textareaStyle, _c = props.displayStyle, displayStyle = _c === void 0 ? 'default' : _c, svgIcon = props.svgIcon, _d = props.required, required = _d === void 0 ? false : _d, textareaProps = __rest(props, ["className", "style", "disabled", "label", "message", "status", "textareaClassName", "textareaStyle", "displayStyle", "svgIcon", "required"]);
55
+ var className = props.className, style = props.style, _a = props.disabled, disabled = _a === void 0 ? false : _a, label = props.label, message = props.message, status = props.status, textareaClassName = props.textareaClassName, textareaStyle = props.textareaStyle, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, _c = props.iconDisplayStyle, iconDisplayStyle = _c === void 0 ? displayStyle === 'default' ? 'block' : 'inline' : _c, svgIcon = props.svgIcon, _d = props.required, required = _d === void 0 ? false : _d, textareaProps = __rest(props, ["className", "style", "disabled", "label", "message", "status", "textareaClassName", "textareaStyle", "displayStyle", "iconDisplayStyle", "svgIcon", "required"]);
57
56
  useTheme();
58
57
  var icon = svgIcon !== null && svgIcon !== void 0 ? svgIcon : (status && StatusIconMap[status]());
59
- return (React.createElement("label", { className: cx('iui-input-container', (_a = {
60
- 'iui-disabled': disabled
61
- },
62
- _a["iui-" + status] = !!status,
63
- _a["iui-" + displayStyle] = displayStyle !== 'default',
64
- _a), className), style: style },
65
- label && (React.createElement("div", { className: cx('iui-label', {
66
- 'iui-required': required,
67
- }) }, label)),
68
- React.createElement(Textarea, __assign({ disabled: disabled, className: textareaClassName, style: textareaStyle, required: required }, textareaProps, { ref: ref })),
69
- (message || icon) && (React.createElement("div", { className: 'iui-message' },
70
- icon,
71
- displayStyle === 'default' && message))));
58
+ return (React.createElement(InputContainer, { as: 'label', label: label, disabled: disabled, required: required, status: status, message: message, icon: icon, isLabelInline: displayStyle === 'inline', isIconInline: iconDisplayStyle === 'inline', className: className, style: style },
59
+ React.createElement(Textarea, __assign({ disabled: disabled, className: textareaClassName, style: textareaStyle, required: required }, textareaProps, { ref: ref }))));
72
60
  });
73
61
  export default LabeledTextarea;
@@ -54,6 +54,6 @@ export var Radio = React.forwardRef(function (props, ref) {
54
54
  React.createElement("span", { className: cx('iui-radio-dot', checkmarkClassName), style: checkmarkStyle },
55
55
  React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
56
56
  React.createElement("circle", { cx: '8', cy: '8', r: '6' }))),
57
- label && React.createElement("div", { className: 'iui-label' }, label)));
57
+ label && React.createElement("span", { className: 'iui-label' }, label)));
58
58
  });
59
59
  export default Radio;
@@ -20,10 +20,14 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
24
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
25
- to[j] = from[i];
26
- return to;
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
27
31
  };
28
32
  /*---------------------------------------------------------------------------------------------
29
33
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -134,7 +138,7 @@ export var Slider = React.forwardRef(function (props, ref) {
134
138
  var _a = getAllowableThumbRange(activeThumbIndex), minVal = _a[0], maxVal = _a[1];
135
139
  pointerValue = getBoundedValue(pointerValue, minVal, maxVal);
136
140
  if (pointerValue !== currentValues[activeThumbIndex]) {
137
- var newValues = __spreadArray([], currentValues);
141
+ var newValues = __spreadArray([], currentValues, true);
138
142
  newValues[activeThumbIndex] = pointerValue;
139
143
  setCurrentValues(newValues);
140
144
  'onChange' === callbackType
@@ -165,7 +169,7 @@ export var Slider = React.forwardRef(function (props, ref) {
165
169
  if (currentValues[index] === value) {
166
170
  return;
167
171
  }
168
- var newValues = __spreadArray([], currentValues);
172
+ var newValues = __spreadArray([], currentValues, true);
169
173
  newValues[index] = value;
170
174
  setCurrentValues(newValues);
171
175
  onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
@@ -190,7 +194,7 @@ export var Slider = React.forwardRef(function (props, ref) {
190
194
  if (pointerValue === currentValues[closestValueIndex]) {
191
195
  return;
192
196
  }
193
- var newValues = __spreadArray([], currentValues);
197
+ var newValues = __spreadArray([], currentValues, true);
194
198
  newValues[closestValueIndex] = pointerValue;
195
199
  setCurrentValues(newValues);
196
200
  onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
@@ -66,6 +66,6 @@ export var Thumb = function (props) {
66
66
  var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
67
67
  var leftPercent = (100.0 * (value - sliderMin)) / (sliderMax - sliderMin);
68
68
  var _c = thumbProps || {}, style = _c.style, className = _c.className, rest = __rest(_c, ["style", "className"]);
69
- return (React.createElement(Tooltip, __assign({ visible: isActive || hasFocus || isHovered, content: tooltipProps.content, placement: 'top' }, tooltipProps),
69
+ return (React.createElement(Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
70
70
  React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: leftPercent + "%" }), className: cx('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
71
71
  };
@@ -1,7 +1,11 @@
1
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
2
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
3
- to[j] = from[i];
4
- return to;
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
5
9
  };
6
10
  /*---------------------------------------------------------------------------------------------
7
11
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -33,9 +37,9 @@ function generateSegments(values, min, max) {
33
37
  */
34
38
  export var Track = function (props) {
35
39
  var trackDisplayMode = props.trackDisplayMode, sliderMin = props.sliderMin, sliderMax = props.sliderMax, values = props.values;
36
- var _a = React.useState(__spreadArray([], values).sort(function (a, b) { return a - b; })), currentValues = _a[0], setCurrentValues = _a[1];
40
+ var _a = React.useState(__spreadArray([], values, true).sort(function (a, b) { return a - b; })), currentValues = _a[0], setCurrentValues = _a[1];
37
41
  React.useEffect(function () {
38
- var newValues = __spreadArray([], values);
42
+ var newValues = __spreadArray([], values, true);
39
43
  newValues.sort(function (a, b) { return a - b; });
40
44
  setCurrentValues(newValues);
41
45
  }, [values]);
@@ -134,11 +134,7 @@ export var Table = function (props) {
134
134
  return getSubRows ? getSubRows(item, index) : item.subRows;
135
135
  });
136
136
  }, [data, getSubRows]);
137
- var instance = useTable(__assign(__assign({}, props), { columns: columns,
138
- defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes,
139
- selectSubRows: selectSubRows,
140
- data: data,
141
- getSubRows: getSubRows }), useFlexLayout, useFilters, useSubRowFiltering(hasAnySubRows), useSortBy, useExpanded, useRowSelect, useSubRowSelection, useExpanderCell(subComponent, expanderCell, isRowDisabled), useSelectionCell(isSelectable, isRowDisabled));
137
+ var instance = useTable(__assign(__assign({}, props), { columns: columns, defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes, selectSubRows: selectSubRows, data: data, getSubRows: getSubRows }), useFlexLayout, useFilters, useSubRowFiltering(hasAnySubRows), useSortBy, useExpanded, useRowSelect, useSubRowSelection, useExpanderCell(subComponent, expanderCell, isRowDisabled), useSelectionCell(isSelectable, isRowDisabled));
142
138
  var getTableProps = instance.getTableProps, rows = instance.rows, headerGroups = instance.headerGroups, getTableBodyProps = instance.getTableBodyProps, prepareRow = instance.prepareRow, state = instance.state, allColumns = instance.allColumns, filteredFlatRows = instance.filteredFlatRows, dispatch = instance.dispatch;
143
139
  var ariaDataAttributes = Object.entries(rest).reduce(function (result, _a) {
144
140
  var key = _a[0], value = _a[1];
@@ -1,7 +1,11 @@
1
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
2
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
3
- to[j] = from[i];
4
- return to;
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
5
9
  };
6
10
  /*---------------------------------------------------------------------------------------------
7
11
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -41,5 +45,5 @@ export var useExpanderCell = function (subComponent, expanderCell, isRowDisabled
41
45
  }
42
46
  },
43
47
  }
44
- ], columns); });
48
+ ], columns, true); });
45
49
  }; };
@@ -9,10 +9,14 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
13
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
14
- to[j] = from[i];
15
- return to;
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
16
20
  };
17
21
  /*---------------------------------------------------------------------------------------------
18
22
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -49,7 +53,7 @@ export var useSelectionCell = function (isSelectable, isRowDisabled) { return fu
49
53
  React.createElement(Checkbox, __assign({}, row.getToggleRowSelectedProps(), { disabled: isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original) }))));
50
54
  },
51
55
  }
52
- ], columns); });
56
+ ], columns, true); });
53
57
  hooks.useInstanceBeforeDimensions.push(function (_a) {
54
58
  var headerGroups = _a.headerGroups;
55
59
  // Fix the parent group of the selection button to not be resizable
@@ -9,10 +9,14 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
13
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
14
- to[j] = from[i];
15
- return to;
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
16
20
  };
17
21
  /*---------------------------------------------------------------------------------------------
18
22
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -49,7 +53,7 @@ var useInstance = function (hasAnySubRows, instance) {
49
53
  });
50
54
  };
51
55
  setSubRows(instance.initialRows);
52
- var currentlyFilteredRows = __spreadArray([], instance.initialRows);
56
+ var currentlyFilteredRows = __spreadArray([], instance.initialRows, true);
53
57
  instance.state.filters.forEach(function (_a) {
54
58
  var _b;
55
59
  var columnId = _a.id, filterValue = _a.value;
@@ -48,6 +48,14 @@ export declare type ToastProps = {
48
48
  * Function called when the toast is all the way closed.
49
49
  */
50
50
  onRemove?: () => void;
51
+ /**
52
+ * Element to which the toast will animate out to.
53
+ */
54
+ animateOutTo?: HTMLElement | null;
55
+ /**
56
+ * Parent toaster placement position for smoother animation.
57
+ */
58
+ placementPosition?: 'top' | 'bottom';
51
59
  };
52
60
  /**
53
61
  * Generic Toast Notification Component