@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
@@ -18,7 +18,7 @@ export declare type DatePickerProps = {
18
18
  /**
19
19
  * Callback when date is changed.
20
20
  */
21
- onChange?: (date?: Date) => void;
21
+ onChange?: (date: Date) => void;
22
22
  /**
23
23
  * Pass localized week days (start from sunday) and months.
24
24
  * Use helper function `generateLocalizedStrings` to generate strings using `Intl.DateTimeFormat`.
@@ -35,7 +35,10 @@ export declare type InformationPanelProps = {
35
35
  * <Text variant='subheading'>InfoPanel heading</Text>
36
36
  * </InformationPanelHeader>
37
37
  * <InformationPanelBody>
38
- * <span>Info panel content</span>
38
+ * <Text>Metadata</Text>
39
+ * <InformationPanelContent ... />
40
+ * <Text>Attributes</Text>
41
+ * <InformationPanelContent ... />
39
42
  * </InformationPanelBody>
40
43
  * </InformationPanel>
41
44
  * </InformationPanelWrapper>
@@ -47,7 +47,10 @@ require("@itwin/itwinui-css/css/information-panel.css");
47
47
  * <Text variant='subheading'>InfoPanel heading</Text>
48
48
  * </InformationPanelHeader>
49
49
  * <InformationPanelBody>
50
- * <span>Info panel content</span>
50
+ * <Text>Metadata</Text>
51
+ * <InformationPanelContent ... />
52
+ * <Text>Attributes</Text>
53
+ * <InformationPanelContent ... />
51
54
  * </InformationPanelBody>
52
55
  * </InformationPanel>
53
56
  * </InformationPanelWrapper>
@@ -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,66 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.InformationPanelContent = void 0;
29
+ /*---------------------------------------------------------------------------------------------
30
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
31
+ * See LICENSE.md in the project root for license terms and full copyright notice.
32
+ *--------------------------------------------------------------------------------------------*/
33
+ var classnames_1 = __importDefault(require("classnames"));
34
+ var react_1 = __importDefault(require("react"));
35
+ var utils_1 = require("../utils");
36
+ require("@itwin/itwinui-css/css/information-panel.css");
37
+ /**
38
+ * The `InformationPanelContent` component should be used inside `InformationPanelBody`
39
+ * to style rows of key/value pairs, where the key is ideally represented by a `Label` component
40
+ * and the value can be any input element (including readonly inputs for non-modifiable fields).
41
+ *
42
+ * By default, the pairs are displayed of label and input are displayed in separate lines,
43
+ * but displayStyle can be set to 'inline' to show them in the same line with correct alignment.
44
+ *
45
+ * You can use multiple `InformationPanelContent` instances inside one `InformationPanelBody`; this is
46
+ * useful when you want to show other content, e.g. separate headings for different sections of key/value pairs.
47
+ *
48
+ * @example
49
+ * <InformationPanelContent displayStyle='inline'>
50
+ * <Label htmlFor='name-input'>File name</Label>
51
+ * <Input id='name-input' value='Alpha.mp3' />
52
+ *
53
+ * <Label htmlFor='year-input'>Year</Label>
54
+ * <Input id='year-input' value='2021' />
55
+ *
56
+ * <Label htmlFor='path-input'>Path</Label>
57
+ * <Input id='path-input' value='/Shared/Music/' />
58
+ * </InformationPanelContent>
59
+ */
60
+ var InformationPanelContent = function (props) {
61
+ var className = props.className, _a = props.displayStyle, displayStyle = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "displayStyle", "children"]);
62
+ (0, utils_1.useTheme)();
63
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-information-body-content', { 'iui-inline': displayStyle === 'inline' }, className) }, rest), children));
64
+ };
65
+ exports.InformationPanelContent = InformationPanelContent;
66
+ exports.default = exports.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';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = void 0;
3
+ exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = void 0;
4
4
  /*---------------------------------------------------------------------------------------------
5
5
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
6
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -14,3 +14,5 @@ var InformationPanelHeader_1 = require("./InformationPanelHeader");
14
14
  Object.defineProperty(exports, "InformationPanelHeader", { enumerable: true, get: function () { return InformationPanelHeader_1.InformationPanelHeader; } });
15
15
  var InformationPanelBody_1 = require("./InformationPanelBody");
16
16
  Object.defineProperty(exports, "InformationPanelBody", { enumerable: true, get: function () { return InformationPanelBody_1.InformationPanelBody; } });
17
+ var InformationPanelContent_1 = require("./InformationPanelContent");
18
+ Object.defineProperty(exports, "InformationPanelContent", { enumerable: true, get: function () { return InformationPanelContent_1.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,53 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Label = void 0;
29
+ /*---------------------------------------------------------------------------------------------
30
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
31
+ * See LICENSE.md in the project root for license terms and full copyright notice.
32
+ *--------------------------------------------------------------------------------------------*/
33
+ var react_1 = __importDefault(require("react"));
34
+ var classnames_1 = __importDefault(require("classnames"));
35
+ var utils_1 = require("../utils");
36
+ require("@itwin/itwinui-css/css/inputs.css");
37
+ /**
38
+ * A standalone label to be used with input components (using `htmlFor`).
39
+ * Can be rendered as any element, e.g. span, using the `as` prop.
40
+ * @example
41
+ * <Label htmlFor='name-input'>Name</Label>
42
+ * <Input id='name-input' />
43
+ */
44
+ var Label = function (props) {
45
+ 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"]);
46
+ (0, utils_1.useTheme)();
47
+ return (react_1.default.createElement(Element, __assign({ className: (0, classnames_1.default)('iui-input-label', {
48
+ 'iui-inline': displayStyle === 'inline',
49
+ 'iui-required': required,
50
+ }, className) }, rest), children));
51
+ };
52
+ exports.Label = Label;
53
+ exports.default = exports.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,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Label = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ var Label_1 = require("./Label");
9
+ Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return Label_1.Label; } });
10
+ exports.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;
@@ -144,12 +144,17 @@ var TablePaginator = function (props) {
144
144
  endPage = totalPagesCount;
145
145
  }
146
146
  var hasNoRows = totalPagesCount === 0;
147
+ var showPagesList = totalPagesCount > 1 || isLoading;
148
+ var showPageSizeList = pageSizeList && onPageSizeChange && !!totalRowsCount;
147
149
  var ellipsis = (react_1.default.createElement("span", { className: (0, classnames_1.default)('iui-ellipsis', { 'iui-small': size === 'small' }) }, "\u2026"));
148
150
  var noRowsContent = (react_1.default.createElement(react_1.default.Fragment, null, isLoading ? (react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true, size: 'small' })) : (react_1.default.createElement(Buttons_1.Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
151
+ if (!showPagesList && !showPageSizeList) {
152
+ return null;
153
+ }
149
154
  return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-paginator', className) }, rest),
150
155
  react_1.default.createElement("div", { className: 'iui-left' }),
151
- react_1.default.createElement("div", { className: 'iui-center', ref: overflowRef },
152
- react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', disabled: currentPage === 0 || hasNoRows, onClick: function () { return onPageChange(currentPage - 1); }, size: buttonSize, "aria-label": localization.previousPage },
156
+ showPagesList && (react_1.default.createElement("div", { className: 'iui-center', ref: overflowRef },
157
+ react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: function () { return onPageChange(currentPage - 1); }, size: buttonSize, "aria-label": localization.previousPage },
153
158
  react_1.default.createElement(ChevronLeft_1.default, null)),
154
159
  react_1.default.createElement(ButtonGroup_1.ButtonGroup, { onKeyDown: onKeyDown, ref: pageListRef }, (function () {
155
160
  if (hasNoRows) {
@@ -171,8 +176,8 @@ var TablePaginator = function (props) {
171
176
  react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true, size: 'small' })))));
172
177
  })()),
173
178
  react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', disabled: currentPage === totalPagesCount - 1 || hasNoRows, onClick: function () { return onPageChange(currentPage + 1); }, size: buttonSize, "aria-label": localization.nextPage },
174
- react_1.default.createElement(ChevronRight_1.default, null))),
175
- react_1.default.createElement("div", { className: 'iui-right' }, pageSizeList && onPageSizeChange && !!totalRowsCount && (react_1.default.createElement(Buttons_1.DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: function (close) {
179
+ react_1.default.createElement(ChevronRight_1.default, null)))),
180
+ react_1.default.createElement("div", { className: 'iui-right' }, showPageSizeList && (react_1.default.createElement(Buttons_1.DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: function (close) {
176
181
  return pageSizeList.map(function (size) { return (react_1.default.createElement(Menu_1.MenuItem, { key: size, isSelected: size === pageSize, onClick: function () {
177
182
  close();
178
183
  onPageSizeChange(size);
@@ -60,45 +60,38 @@ var Tab_1 = require("./Tab");
60
60
  * <Tabs labels={tabsWithIcons} type='pill' />
61
61
  */
62
62
  var Tabs = function (props) {
63
- 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"]);
63
+ var _a, _b, _c;
64
+ 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"]);
64
65
  (0, utils_1.useTheme)();
65
66
  var tablistRef = react_1.default.useRef(null);
66
- var _e = react_1.default.useState(function () { var _a; return (_a = tablistRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width; }), tabsWidth = _e[0], setTabsWidth = _e[1];
67
- var updateTabsWidth = react_1.default.useCallback(function (_a) {
68
- var width = _a.width;
69
- return setTabsWidth(width);
70
- }, []);
71
- var tablistSizeRef = (0, utils_1.useResizeObserver)(updateTabsWidth)[0];
67
+ var _h = (0, utils_1.useContainerWidth)(type !== 'default'), tablistSizeRef = _h[0], tabsWidth = _h[1];
72
68
  var refs = (0, utils_1.useMergedRefs)(tablistRef, tablistSizeRef);
73
- var _f = react_1.default.useState(function () {
69
+ var _j = react_1.default.useState(function () {
74
70
  return activeIndex != null
75
71
  ? (0, utils_1.getBoundedValue)(activeIndex, 0, labels.length - 1)
76
72
  : 0;
77
- }), currentActiveIndex = _f[0], setCurrentActiveIndex = _f[1];
73
+ }), currentActiveIndex = _j[0], setCurrentActiveIndex = _j[1];
78
74
  react_1.default.useLayoutEffect(function () {
79
75
  if (activeIndex != null && currentActiveIndex !== activeIndex) {
80
76
  setCurrentActiveIndex((0, utils_1.getBoundedValue)(activeIndex, 0, labels.length - 1));
81
77
  }
82
78
  }, [activeIndex, currentActiveIndex, labels.length]);
83
- var _g = react_1.default.useState({}), stripeStyle = _g[0], setStripeStyle = _g[1];
79
+ // CSS custom properties to place the active stripe
80
+ var _k = react_1.default.useState({}), stripeProperties = _k[0], setStripeProperties = _k[1];
84
81
  react_1.default.useLayoutEffect(function () {
85
- var _a;
86
- if (type !== 'default') {
87
- var activeTab = (_a = tablistRef.current) === null || _a === void 0 ? void 0 : _a.children[currentActiveIndex];
88
- var activeTabRect = activeTab === null || activeTab === void 0 ? void 0 : activeTab.getBoundingClientRect();
89
- setStripeStyle({
90
- width: orientation === 'horizontal' ? activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.width : undefined,
91
- height: orientation === 'vertical' ? activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.height : undefined,
92
- left: orientation === 'horizontal'
93
- ? activeTab === null || activeTab === void 0 ? void 0 : activeTab.offsetLeft
94
- : (activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.width) - 2,
95
- top: orientation === 'horizontal'
96
- ? (activeTabRect === null || activeTabRect === void 0 ? void 0 : activeTabRect.height) - 2
97
- : activeTab === null || activeTab === void 0 ? void 0 : activeTab.offsetTop,
98
- });
82
+ if (type !== 'default' && tablistRef.current != undefined) {
83
+ var activeTab = tablistRef.current.children[currentActiveIndex];
84
+ var activeTabRect = activeTab.getBoundingClientRect();
85
+ setStripeProperties(__assign(__assign({}, (orientation === 'horizontal' && {
86
+ '--stripe-width': activeTabRect.width + "px",
87
+ '--stripe-left': activeTab.offsetLeft + "px",
88
+ })), (orientation === 'vertical' && {
89
+ '--stripe-height': activeTabRect.height + "px",
90
+ '--stripe-top': activeTab.offsetTop + "px",
91
+ })));
99
92
  }
100
93
  }, [currentActiveIndex, type, orientation, tabsWidth]);
101
- var _h = react_1.default.useState(), focusedIndex = _h[0], setFocusedIndex = _h[1];
94
+ var _l = react_1.default.useState(), focusedIndex = _l[0], setFocusedIndex = _l[1];
102
95
  react_1.default.useEffect(function () {
103
96
  var _a;
104
97
  if (tablistRef.current && focusedIndex !== undefined) {
@@ -106,7 +99,7 @@ var Tabs = function (props) {
106
99
  (_a = tab) === null || _a === void 0 ? void 0 : _a.focus();
107
100
  }
108
101
  }, [focusedIndex]);
109
- var _j = react_1.default.useState(false), hasSublabel = _j[0], setHasSublabel = _j[1]; // used for setting size
102
+ var _m = react_1.default.useState(false), hasSublabel = _m[0], setHasSublabel = _m[1]; // used for setting size
110
103
  react_1.default.useLayoutEffect(function () {
111
104
  var _a;
112
105
  setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
@@ -179,10 +172,12 @@ var Tabs = function (props) {
179
172
  break;
180
173
  }
181
174
  };
182
- return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-" + orientation) },
175
+ var isIE = !((_c = (_b = (_a = (0, utils_1.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'));
176
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-" + orientation), style: stripeProperties },
183
177
  react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-" + type, {
184
178
  'iui-green': color === 'green',
185
- 'iui-animated': type !== 'default',
179
+ 'iui-animated': type !== 'default' && !isIE,
180
+ 'iui-not-animated': isIE,
186
181
  'iui-large': hasSublabel,
187
182
  }, tabsClassName), role: 'tablist', ref: refs, onKeyDown: onKeyDown }, rest), labels.map(function (label, index) {
188
183
  var onClick = function () {
@@ -204,7 +199,6 @@ var Tabs = function (props) {
204
199
  },
205
200
  }))));
206
201
  })),
207
- type !== 'default' && (react_1.default.createElement("div", { className: 'iui-tab-stripe', style: stripeStyle })),
208
202
  children && (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-content', contentClassName), role: 'tabpanel' }, children))));
209
203
  };
210
204
  exports.Tabs = Tabs;
@@ -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/cjs/core/index.js CHANGED
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ProgressRadial = exports.ProgressLinear = exports.ModalButtonBar = exports.Modal = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Input = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Alert = void 0;
7
- exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = void 0;
6
+ exports.ModalButtonBar = exports.Modal = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Alert = void 0;
7
+ exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = void 0;
8
8
  /*---------------------------------------------------------------------------------------------
9
9
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
10
10
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -64,8 +64,11 @@ Object.defineProperty(exports, "InformationPanel", { enumerable: true, get: func
64
64
  Object.defineProperty(exports, "InformationPanelWrapper", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelWrapper; } });
65
65
  Object.defineProperty(exports, "InformationPanelHeader", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelHeader; } });
66
66
  Object.defineProperty(exports, "InformationPanelBody", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelBody; } });
67
+ Object.defineProperty(exports, "InformationPanelContent", { enumerable: true, get: function () { return InformationPanel_1.InformationPanelContent; } });
67
68
  var Input_1 = require("./Input");
68
69
  Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });
70
+ var Label_1 = require("./Label");
71
+ Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return Label_1.Label; } });
69
72
  var LabeledInput_1 = require("./LabeledInput");
70
73
  Object.defineProperty(exports, "LabeledInput", { enumerable: true, get: function () { return LabeledInput_1.LabeledInput; } });
71
74
  var InputGroup_1 = require("./InputGroup");
@@ -145,3 +148,4 @@ var utils_1 = require("./utils");
145
148
  Object.defineProperty(exports, "getUserColor", { enumerable: true, get: function () { return utils_1.getUserColor; } });
146
149
  Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return utils_1.useTheme; } });
147
150
  Object.defineProperty(exports, "ColorValue", { enumerable: true, get: function () { return utils_1.ColorValue; } });
151
+ Object.defineProperty(exports, "MiddleTextTruncation", { enumerable: true, get: function () { return utils_1.MiddleTextTruncation; } });
@@ -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%). */