@itwin/itwinui-react 1.23.2 → 1.26.1

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 (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/core/Buttons/Button/Button.d.ts +1 -1
  3. package/cjs/core/ColorPicker/ColorBuilder.js +40 -15
  4. package/cjs/core/ColorPicker/ColorInputPanel.js +125 -46
  5. package/cjs/core/ColorPicker/ColorPicker.d.ts +5 -0
  6. package/cjs/core/ColorPicker/ColorPicker.js +7 -6
  7. package/cjs/core/ColorPicker/ColorPickerContext.d.ts +4 -2
  8. package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
  9. package/cjs/core/ColorPicker/ColorSwatch.js +10 -4
  10. package/cjs/core/DatePicker/DatePicker.d.ts +1 -1
  11. package/cjs/core/InformationPanel/InformationPanel.d.ts +4 -1
  12. package/cjs/core/InformationPanel/InformationPanel.js +4 -1
  13. package/cjs/core/InformationPanel/InformationPanelContent.d.ts +42 -0
  14. package/cjs/core/InformationPanel/InformationPanelContent.js +66 -0
  15. package/cjs/core/InformationPanel/index.d.ts +2 -0
  16. package/cjs/core/InformationPanel/index.js +3 -1
  17. package/cjs/core/Label/Label.d.ts +31 -0
  18. package/cjs/core/Label/Label.js +53 -0
  19. package/cjs/core/Label/index.d.ts +4 -0
  20. package/cjs/core/Label/index.js +10 -0
  21. package/cjs/core/LabeledInput/LabeledInput.d.ts +2 -2
  22. package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
  23. package/cjs/core/Menu/MenuItem.d.ts +1 -1
  24. package/cjs/core/Table/TablePaginator.d.ts +1 -1
  25. package/cjs/core/Table/TablePaginator.js +9 -4
  26. package/cjs/core/Tabs/Tabs.js +23 -29
  27. package/cjs/core/index.d.ts +6 -4
  28. package/cjs/core/index.js +6 -2
  29. package/cjs/core/utils/color/ColorValue.d.ts +1 -0
  30. package/cjs/core/utils/color/ColorValue.js +101 -85
  31. package/cjs/core/utils/components/MiddleTextTruncation.d.ts +21 -0
  32. package/cjs/core/utils/components/MiddleTextTruncation.js +56 -0
  33. package/cjs/core/utils/components/index.d.ts +1 -0
  34. package/cjs/core/utils/components/index.js +1 -0
  35. package/cjs/core/utils/hooks/index.d.ts +1 -0
  36. package/cjs/core/utils/hooks/index.js +1 -0
  37. package/cjs/core/utils/hooks/useContainerWidth.d.ts +17 -0
  38. package/cjs/core/utils/hooks/useContainerWidth.js +50 -0
  39. package/cjs/core/utils/hooks/useOverflow.d.ts +1 -1
  40. package/cjs/core/utils/hooks/useOverflow.js +30 -17
  41. package/esm/core/Buttons/Button/Button.d.ts +1 -1
  42. package/esm/core/ColorPicker/ColorBuilder.js +40 -15
  43. package/esm/core/ColorPicker/ColorInputPanel.js +125 -46
  44. package/esm/core/ColorPicker/ColorPicker.d.ts +5 -0
  45. package/esm/core/ColorPicker/ColorPicker.js +7 -6
  46. package/esm/core/ColorPicker/ColorPickerContext.d.ts +4 -2
  47. package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
  48. package/esm/core/ColorPicker/ColorSwatch.js +10 -4
  49. package/esm/core/DatePicker/DatePicker.d.ts +1 -1
  50. package/esm/core/InformationPanel/InformationPanel.d.ts +4 -1
  51. package/esm/core/InformationPanel/InformationPanel.js +4 -1
  52. package/esm/core/InformationPanel/InformationPanelContent.d.ts +42 -0
  53. package/esm/core/InformationPanel/InformationPanelContent.js +59 -0
  54. package/esm/core/InformationPanel/index.d.ts +2 -0
  55. package/esm/core/InformationPanel/index.js +1 -0
  56. package/esm/core/Label/Label.d.ts +31 -0
  57. package/esm/core/Label/Label.js +46 -0
  58. package/esm/core/Label/index.d.ts +4 -0
  59. package/esm/core/Label/index.js +6 -0
  60. package/esm/core/LabeledInput/LabeledInput.d.ts +2 -2
  61. package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
  62. package/esm/core/Menu/MenuItem.d.ts +1 -1
  63. package/esm/core/Table/TablePaginator.d.ts +1 -1
  64. package/esm/core/Table/TablePaginator.js +9 -4
  65. package/esm/core/Tabs/Tabs.js +24 -30
  66. package/esm/core/index.d.ts +6 -4
  67. package/esm/core/index.js +3 -2
  68. package/esm/core/utils/color/ColorValue.d.ts +1 -0
  69. package/esm/core/utils/color/ColorValue.js +101 -85
  70. package/esm/core/utils/components/MiddleTextTruncation.d.ts +21 -0
  71. package/esm/core/utils/components/MiddleTextTruncation.js +49 -0
  72. package/esm/core/utils/components/index.d.ts +1 -0
  73. package/esm/core/utils/components/index.js +1 -0
  74. package/esm/core/utils/hooks/index.d.ts +1 -0
  75. package/esm/core/utils/hooks/index.js +1 -0
  76. package/esm/core/utils/hooks/useContainerWidth.d.ts +17 -0
  77. package/esm/core/utils/hooks/useContainerWidth.js +43 -0
  78. package/esm/core/utils/hooks/useOverflow.d.ts +1 -1
  79. package/esm/core/utils/hooks/useOverflow.js +30 -17
  80. package/package.json +2 -2
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { CommonProps } from '../utils';
3
+ import '@itwin/itwinui-css/css/information-panel.css';
4
+ export declare type InformationPanelContentProps = {
5
+ /**
6
+ * If set to 'inline', the label/input pairs will be shown on the same line.
7
+ * The component handles the spacing and alignment automatically.
8
+ *
9
+ * @default 'default'
10
+ */
11
+ displayStyle?: 'default' | 'inline';
12
+ /**
13
+ * Content of the component.
14
+ * Should ideally be pairs of `Label` and input components.
15
+ */
16
+ children: React.ReactNode;
17
+ } & Omit<CommonProps, 'title'>;
18
+ /**
19
+ * The `InformationPanelContent` component should be used inside `InformationPanelBody`
20
+ * to style rows of key/value pairs, where the key is ideally represented by a `Label` component
21
+ * and the value can be any input element (including readonly inputs for non-modifiable fields).
22
+ *
23
+ * By default, the pairs are displayed of label and input are displayed in separate lines,
24
+ * but displayStyle can be set to 'inline' to show them in the same line with correct alignment.
25
+ *
26
+ * You can use multiple `InformationPanelContent` instances inside one `InformationPanelBody`; this is
27
+ * useful when you want to show other content, e.g. separate headings for different sections of key/value pairs.
28
+ *
29
+ * @example
30
+ * <InformationPanelContent displayStyle='inline'>
31
+ * <Label htmlFor='name-input'>File name</Label>
32
+ * <Input id='name-input' value='Alpha.mp3' />
33
+ *
34
+ * <Label htmlFor='year-input'>Year</Label>
35
+ * <Input id='year-input' value='2021' />
36
+ *
37
+ * <Label htmlFor='path-input'>Path</Label>
38
+ * <Input id='path-input' value='/Shared/Music/' />
39
+ * </InformationPanelContent>
40
+ */
41
+ export declare const InformationPanelContent: (props: InformationPanelContentProps) => JSX.Element;
42
+ export default InformationPanelContent;
@@ -0,0 +1,59 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import cx from 'classnames';
28
+ import React from 'react';
29
+ import { useTheme } from '../utils';
30
+ import '@itwin/itwinui-css/css/information-panel.css';
31
+ /**
32
+ * The `InformationPanelContent` component should be used inside `InformationPanelBody`
33
+ * to style rows of key/value pairs, where the key is ideally represented by a `Label` component
34
+ * and the value can be any input element (including readonly inputs for non-modifiable fields).
35
+ *
36
+ * By default, the pairs are displayed of label and input are displayed in separate lines,
37
+ * but displayStyle can be set to 'inline' to show them in the same line with correct alignment.
38
+ *
39
+ * You can use multiple `InformationPanelContent` instances inside one `InformationPanelBody`; this is
40
+ * useful when you want to show other content, e.g. separate headings for different sections of key/value pairs.
41
+ *
42
+ * @example
43
+ * <InformationPanelContent displayStyle='inline'>
44
+ * <Label htmlFor='name-input'>File name</Label>
45
+ * <Input id='name-input' value='Alpha.mp3' />
46
+ *
47
+ * <Label htmlFor='year-input'>Year</Label>
48
+ * <Input id='year-input' value='2021' />
49
+ *
50
+ * <Label htmlFor='path-input'>Path</Label>
51
+ * <Input id='path-input' value='/Shared/Music/' />
52
+ * </InformationPanelContent>
53
+ */
54
+ export var InformationPanelContent = function (props) {
55
+ var className = props.className, _a = props.displayStyle, displayStyle = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "displayStyle", "children"]);
56
+ useTheme();
57
+ return (React.createElement("div", __assign({ className: cx('iui-information-body-content', { 'iui-inline': displayStyle === 'inline' }, className) }, rest), children));
58
+ };
59
+ export default InformationPanelContent;
@@ -8,3 +8,5 @@ export { InformationPanelHeader } from './InformationPanelHeader';
8
8
  export type { InformationPanelHeaderProps } from './InformationPanelHeader';
9
9
  export { InformationPanelBody } from './InformationPanelBody';
10
10
  export type { InformationPanelBodyProps } from './InformationPanelBody';
11
+ export { InformationPanelContent } from './InformationPanelContent';
12
+ export type { InformationPanelContentProps } from './InformationPanelContent';
@@ -7,3 +7,4 @@ export default './InformationPanel';
7
7
  export { InformationPanelWrapper } from './InformationPanelWrapper';
8
8
  export { InformationPanelHeader } from './InformationPanelHeader';
9
9
  export { InformationPanelBody } from './InformationPanelBody';
10
+ export { InformationPanelContent } from './InformationPanelContent';
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/inputs.css';
3
+ declare type LabelOwnProps<T extends React.ElementType = 'label'> = {
4
+ /**
5
+ * What element should the label be rendered as?
6
+ * @default 'label'
7
+ */
8
+ as?: T;
9
+ /**
10
+ * Set the display style of the label.
11
+ * - 'block' - default, no extra spacing (label and input will be on separate lines)
12
+ * - 'inline' - label gets a right margin so it can be placed inline
13
+ * @default 'block'
14
+ */
15
+ displayStyle?: 'block' | 'inline';
16
+ /**
17
+ * Set to true if the label's associated input is required.
18
+ * This adds an asterisk next to the label text.
19
+ */
20
+ required?: boolean;
21
+ };
22
+ export declare type LabelProps<T extends React.ElementType = 'label'> = LabelOwnProps<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof LabelOwnProps<T>>;
23
+ /**
24
+ * A standalone label to be used with input components (using `htmlFor`).
25
+ * Can be rendered as any element, e.g. span, using the `as` prop.
26
+ * @example
27
+ * <Label htmlFor='name-input'>Name</Label>
28
+ * <Input id='name-input' />
29
+ */
30
+ export declare const Label: <T extends React.ElementType<any> = "label">(props: LabelProps<T>) => JSX.Element;
31
+ export default Label;
@@ -0,0 +1,46 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import cx from 'classnames';
29
+ import { useTheme } from '../utils';
30
+ import '@itwin/itwinui-css/css/inputs.css';
31
+ /**
32
+ * A standalone label to be used with input components (using `htmlFor`).
33
+ * Can be rendered as any element, e.g. span, using the `as` prop.
34
+ * @example
35
+ * <Label htmlFor='name-input'>Name</Label>
36
+ * <Input id='name-input' />
37
+ */
38
+ export var Label = function (props) {
39
+ var _a = props.as, Element = _a === void 0 ? 'label' : _a, _b = props.displayStyle, displayStyle = _b === void 0 ? 'block' : _b, required = props.required, className = props.className, children = props.children, rest = __rest(props, ["as", "displayStyle", "required", "className", "children"]);
40
+ useTheme();
41
+ return (React.createElement(Element, __assign({ className: cx('iui-input-label', {
42
+ 'iui-inline': displayStyle === 'inline',
43
+ 'iui-required': required,
44
+ }, className) }, rest), children));
45
+ };
46
+ export default Label;
@@ -0,0 +1,4 @@
1
+ export { Label } from './Label';
2
+ export type { LabelProps } from './Label';
3
+ declare const _default: "./Label";
4
+ export default _default;
@@ -0,0 +1,6 @@
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
+ export { Label } from './Label';
6
+ export default './Label';
@@ -84,7 +84,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
84
84
  * - 'inline' - appears in the same line as input.
85
85
  * @default 'default'
86
86
  */
87
- displayStyle?: "default" | "inline" | undefined;
87
+ displayStyle?: "inline" | "default" | undefined;
88
88
  /**
89
89
  * Set display style of icon.
90
90
  * Supported values:
@@ -93,7 +93,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
93
93
  *
94
94
  * Defaults to 'block' if `displayStyle` is `default`, else 'inline'.
95
95
  */
96
- iconDisplayStyle?: "inline" | "block" | undefined;
96
+ iconDisplayStyle?: "block" | "inline" | undefined;
97
97
  } & {
98
98
  setFocus?: boolean | undefined;
99
99
  size?: "small" | "large" | undefined;
@@ -66,7 +66,7 @@ export declare const LabeledTextarea: React.ForwardRefExoticComponent<{
66
66
  * Custom style for textarea.
67
67
  */
68
68
  textareaStyle?: React.CSSProperties | undefined;
69
- } & Pick<LabeledInputProps, "svgIcon" | "displayStyle" | "iconDisplayStyle"> & {
69
+ } & Pick<LabeledInputProps, "displayStyle" | "svgIcon" | "iconDisplayStyle"> & {
70
70
  setFocus?: boolean | undefined;
71
71
  } & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
72
72
  export default LabeledTextarea;
@@ -77,7 +77,7 @@ export declare const MenuItem: React.ForwardRefExoticComponent<{
77
77
  *
78
78
  * Defaults to 'large' if `sublabel` provided, otherwise 'default'.
79
79
  */
80
- size?: "large" | "default" | undefined;
80
+ size?: "default" | "large" | undefined;
81
81
  /**
82
82
  * Sub label shown below the main content of the item.
83
83
  */
@@ -67,5 +67,5 @@ export declare type TablePaginatorProps = {
67
67
  * paginatorRenderer={(props) => <TablePaginator {...props} />}
68
68
  * />
69
69
  */
70
- export declare const TablePaginator: (props: TablePaginatorProps) => JSX.Element;
70
+ export declare const TablePaginator: (props: TablePaginatorProps) => JSX.Element | null;
71
71
  export default TablePaginator;
@@ -138,12 +138,17 @@ export var TablePaginator = function (props) {
138
138
  endPage = totalPagesCount;
139
139
  }
140
140
  var hasNoRows = totalPagesCount === 0;
141
+ var showPagesList = totalPagesCount > 1 || isLoading;
142
+ var showPageSizeList = pageSizeList && onPageSizeChange && !!totalRowsCount;
141
143
  var ellipsis = (React.createElement("span", { className: cx('iui-ellipsis', { 'iui-small': size === 'small' }) }, "\u2026"));
142
144
  var noRowsContent = (React.createElement(React.Fragment, null, isLoading ? (React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })) : (React.createElement(Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
145
+ if (!showPagesList && !showPageSizeList) {
146
+ return null;
147
+ }
143
148
  return (React.createElement("div", __assign({ className: cx('iui-paginator', className) }, rest),
144
149
  React.createElement("div", { className: 'iui-left' }),
145
- React.createElement("div", { className: 'iui-center', ref: overflowRef },
146
- React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0 || hasNoRows, onClick: function () { return onPageChange(currentPage - 1); }, size: buttonSize, "aria-label": localization.previousPage },
150
+ showPagesList && (React.createElement("div", { className: 'iui-center', ref: overflowRef },
151
+ React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: function () { return onPageChange(currentPage - 1); }, size: buttonSize, "aria-label": localization.previousPage },
147
152
  React.createElement(SvgChevronLeft, null)),
148
153
  React.createElement(ButtonGroup, { onKeyDown: onKeyDown, ref: pageListRef }, (function () {
149
154
  if (hasNoRows) {
@@ -165,8 +170,8 @@ export var TablePaginator = function (props) {
165
170
  React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })))));
166
171
  })()),
167
172
  React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === totalPagesCount - 1 || hasNoRows, onClick: function () { return onPageChange(currentPage + 1); }, size: buttonSize, "aria-label": localization.nextPage },
168
- React.createElement(SvgChevronRight, null))),
169
- React.createElement("div", { className: 'iui-right' }, pageSizeList && onPageSizeChange && !!totalRowsCount && (React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: function (close) {
173
+ React.createElement(SvgChevronRight, null)))),
174
+ React.createElement("div", { className: 'iui-right' }, showPageSizeList && (React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: function (close) {
170
175
  return pageSizeList.map(function (size) { return (React.createElement(MenuItem, { key: size, isSelected: size === pageSize, onClick: function () {
171
176
  close();
172
177
  onPageSizeChange(size);
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  *--------------------------------------------------------------------------------------------*/
27
27
  import cx from 'classnames';
28
28
  import React from 'react';
29
- import { useTheme, useResizeObserver, useMergedRefs, getBoundedValue, } from '../utils';
29
+ import { useTheme, useMergedRefs, getBoundedValue, getWindow, useContainerWidth, } from '../utils';
30
30
  import '@itwin/itwinui-css/css/tabs.css';
31
31
  import { Tab } from './Tab';
32
32
  /**
@@ -54,45 +54,38 @@ import { Tab } from './Tab';
54
54
  * <Tabs labels={tabsWithIcons} type='pill' />
55
55
  */
56
56
  export var Tabs = function (props) {
57
- var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _a = props.focusActivationMode, focusActivationMode = _a === void 0 ? 'auto' : _a, _b = props.type, type = _b === void 0 ? 'default' : _b, _c = props.color, color = _c === void 0 ? 'blue' : _c, _d = props.orientation, orientation = _d === void 0 ? 'horizontal' : _d, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "children"]);
57
+ var _a, _b, _c;
58
+ var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _d = props.focusActivationMode, focusActivationMode = _d === void 0 ? 'auto' : _d, _e = props.type, type = _e === void 0 ? 'default' : _e, _f = props.color, color = _f === void 0 ? 'blue' : _f, _g = props.orientation, orientation = _g === void 0 ? 'horizontal' : _g, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "children"]);
58
59
  useTheme();
59
60
  var tablistRef = React.useRef(null);
60
- var _e = React.useState(function () { var _a; return (_a = tablistRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width; }), tabsWidth = _e[0], setTabsWidth = _e[1];
61
- var updateTabsWidth = React.useCallback(function (_a) {
62
- var width = _a.width;
63
- return setTabsWidth(width);
64
- }, []);
65
- var tablistSizeRef = useResizeObserver(updateTabsWidth)[0];
61
+ var _h = useContainerWidth(type !== 'default'), tablistSizeRef = _h[0], tabsWidth = _h[1];
66
62
  var refs = useMergedRefs(tablistRef, tablistSizeRef);
67
- var _f = React.useState(function () {
63
+ var _j = React.useState(function () {
68
64
  return activeIndex != null
69
65
  ? getBoundedValue(activeIndex, 0, labels.length - 1)
70
66
  : 0;
71
- }), currentActiveIndex = _f[0], setCurrentActiveIndex = _f[1];
67
+ }), currentActiveIndex = _j[0], setCurrentActiveIndex = _j[1];
72
68
  React.useLayoutEffect(function () {
73
69
  if (activeIndex != null && currentActiveIndex !== activeIndex) {
74
70
  setCurrentActiveIndex(getBoundedValue(activeIndex, 0, labels.length - 1));
75
71
  }
76
72
  }, [activeIndex, currentActiveIndex, labels.length]);
77
- var _g = React.useState({}), stripeStyle = _g[0], setStripeStyle = _g[1];
73
+ // CSS custom properties to place the active stripe
74
+ var _k = React.useState({}), stripeProperties = _k[0], setStripeProperties = _k[1];
78
75
  React.useLayoutEffect(function () {
79
- var _a;
80
- if (type !== 'default') {
81
- var activeTab = (_a = tablistRef.current) === null || _a === void 0 ? void 0 : _a.children[currentActiveIndex];
82
- var activeTabRect = activeTab === null || activeTab === void 0 ? void 0 : activeTab.getBoundingClientRect();
83
- setStripeStyle({
84
- width: orientation === 'horizontal' ? activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.width : undefined,
85
- height: orientation === 'vertical' ? activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.height : undefined,
86
- left: orientation === 'horizontal'
87
- ? activeTab === null || activeTab === void 0 ? void 0 : activeTab.offsetLeft
88
- : (activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.width) - 2,
89
- top: orientation === 'horizontal'
90
- ? (activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.height) - 2
91
- : activeTab === null || activeTab === void 0 ? void 0 : activeTab.offsetTop,
92
- });
76
+ if (type !== 'default' && tablistRef.current != undefined) {
77
+ var activeTab = tablistRef.current.children[currentActiveIndex];
78
+ var activeTabRect = activeTab.getBoundingClientRect();
79
+ setStripeProperties(__assign(__assign({}, (orientation === 'horizontal' && {
80
+ '--stripe-width': activeTabRect.width + "px",
81
+ '--stripe-left': activeTab.offsetLeft + "px",
82
+ })), (orientation === 'vertical' && {
83
+ '--stripe-height': activeTabRect.height + "px",
84
+ '--stripe-top': activeTab.offsetTop + "px",
85
+ })));
93
86
  }
94
87
  }, [currentActiveIndex, type, orientation, tabsWidth]);
95
- var _h = React.useState(), focusedIndex = _h[0], setFocusedIndex = _h[1];
88
+ var _l = React.useState(), focusedIndex = _l[0], setFocusedIndex = _l[1];
96
89
  React.useEffect(function () {
97
90
  var _a;
98
91
  if (tablistRef.current && focusedIndex !== undefined) {
@@ -100,7 +93,7 @@ export var Tabs = function (props) {
100
93
  (_a = tab) === null || _a === void 0 ? void 0 : _a.focus();
101
94
  }
102
95
  }, [focusedIndex]);
103
- var _j = React.useState(false), hasSublabel = _j[0], setHasSublabel = _j[1]; // used for setting size
96
+ var _m = React.useState(false), hasSublabel = _m[0], setHasSublabel = _m[1]; // used for setting size
104
97
  React.useLayoutEffect(function () {
105
98
  var _a;
106
99
  setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
@@ -173,10 +166,12 @@ export var Tabs = function (props) {
173
166
  break;
174
167
  }
175
168
  };
176
- return (React.createElement("div", { className: cx('iui-tabs-wrapper', "iui-" + orientation) },
169
+ var isIE = !((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, '--stripe-width', '100px'));
170
+ return (React.createElement("div", { className: cx('iui-tabs-wrapper', "iui-" + orientation), style: stripeProperties },
177
171
  React.createElement("ul", __assign({ className: cx('iui-tabs', "iui-" + type, {
178
172
  'iui-green': color === 'green',
179
- 'iui-animated': type !== 'default',
173
+ 'iui-animated': type !== 'default' && !isIE,
174
+ 'iui-not-animated': isIE,
180
175
  'iui-large': hasSublabel,
181
176
  }, tabsClassName), role: 'tablist', ref: refs, onKeyDown: onKeyDown }, rest), labels.map(function (label, index) {
182
177
  var onClick = function () {
@@ -198,7 +193,6 @@ export var Tabs = function (props) {
198
193
  },
199
194
  }))));
200
195
  })),
201
- type !== 'default' && (React.createElement("div", { className: 'iui-tab-stripe', style: stripeStyle })),
202
196
  children && (React.createElement("div", { className: cx('iui-tabs-content', contentClassName), role: 'tabpanel' }, children))));
203
197
  };
204
198
  /**
@@ -32,10 +32,12 @@ export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
32
32
  export type { HeaderProps, HeaderBreadcrumbsProps, HeaderButtonProps, HeaderLogoProps, } from './Header';
33
33
  export { VerticalTabs, Tab, HorizontalTabs, HorizontalTab } from './Tabs';
34
34
  export type { VerticalTabsProps, TabProps, HorizontalTabsProps, HorizontalTabProps, } from './Tabs';
35
- export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, } from './InformationPanel';
36
- export type { InformationPanelProps, InformationPanelWrapperProps, InformationPanelHeaderProps, InformationPanelBodyProps, } from './InformationPanel';
35
+ export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
36
+ export type { InformationPanelProps, InformationPanelWrapperProps, InformationPanelHeaderProps, InformationPanelBodyProps, InformationPanelContentProps, } from './InformationPanel';
37
37
  export { Input } from './Input';
38
38
  export type { InputProps } from './Input';
39
+ export { Label } from './Label';
40
+ export type { LabelProps } from './Label';
39
41
  export { LabeledInput } from './LabeledInput';
40
42
  export type { LabeledInputProps } from './LabeledInput';
41
43
  export { InputGroup } from './InputGroup';
@@ -86,5 +88,5 @@ export { UserIconGroup } from './UserIconGroup';
86
88
  export type { UserIconGroupProps } from './UserIconGroup';
87
89
  export { Wizard } from './Wizard';
88
90
  export type { WizardProps, StepProperties, WizardType, WizardLocalization, } from './Wizard';
89
- export { getUserColor, useTheme, ColorValue } from './utils';
90
- export type { ThemeType } from './utils';
91
+ export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, } from './utils';
92
+ export type { ThemeType, MiddleTextTruncationProps } from './utils';
package/esm/core/index.js CHANGED
@@ -19,8 +19,9 @@ export { FileUpload, FileUploadTemplate } from './FileUpload';
19
19
  export { Footer } from './Footer';
20
20
  export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
21
21
  export { VerticalTabs, Tab, HorizontalTabs, HorizontalTab } from './Tabs';
22
- export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, } from './InformationPanel';
22
+ export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
23
23
  export { Input } from './Input';
24
+ export { Label } from './Label';
24
25
  export { LabeledInput } from './LabeledInput';
25
26
  export { InputGroup } from './InputGroup';
26
27
  export { LabeledSelect } from './LabeledSelect';
@@ -46,4 +47,4 @@ export { Body, Headline, Leading, Small, Subheading, Title, Blockquote, Code, Kb
46
47
  export { UserIcon } from './UserIcon';
47
48
  export { UserIconGroup } from './UserIconGroup';
48
49
  export { Wizard } from './Wizard';
49
- export { getUserColor, useTheme, ColorValue } from './utils';
50
+ export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, } from './utils';
@@ -170,6 +170,7 @@ export declare class ColorValue {
170
170
  private static toHsv;
171
171
  /** True if the value of this ColorValue is the same as another ColorValue. */
172
172
  equals(other: ColorValue): boolean;
173
+ static getFormattedColorNumber(value: number, precision?: number): string;
173
174
  /** Convert the 0xTTBBGGRR color to a string of the form "rgba(r,g,b,a)" where the color components are specified in decimal and the alpha component is a fraction. */
174
175
  toRgbString(includeAlpha?: boolean): string;
175
176
  /** Convert this ColorValue to a string in the form "hsl(h,s,l) or hsla(h,s,l,a)" - i.e hsl(120,50%,50%). */