@itwin/itwinui-react 1.34.2 → 1.37.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 (158) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/cjs/core/ButtonGroup/ButtonGroup.js +1 -0
  3. package/cjs/core/Carousel/Carousel.d.ts +68 -0
  4. package/cjs/core/Carousel/Carousel.js +130 -0
  5. package/cjs/core/Carousel/CarouselContext.d.ts +37 -0
  6. package/cjs/core/Carousel/CarouselContext.js +12 -0
  7. package/cjs/core/Carousel/CarouselDot.d.ts +13 -0
  8. package/cjs/core/Carousel/CarouselDot.js +46 -0
  9. package/cjs/core/Carousel/CarouselDotsList.d.ts +32 -0
  10. package/cjs/core/Carousel/CarouselDotsList.js +132 -0
  11. package/cjs/core/Carousel/CarouselNavigation.d.ts +15 -0
  12. package/cjs/core/Carousel/CarouselNavigation.js +88 -0
  13. package/cjs/core/Carousel/CarouselSlide.d.ts +14 -0
  14. package/cjs/core/Carousel/CarouselSlide.js +63 -0
  15. package/cjs/core/Carousel/CarouselSlider.d.ts +5 -0
  16. package/cjs/core/Carousel/CarouselSlider.js +94 -0
  17. package/cjs/core/Carousel/index.d.ts +4 -0
  18. package/cjs/core/Carousel/index.js +10 -0
  19. package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
  20. package/cjs/core/DatePicker/DatePicker.d.ts +5 -0
  21. package/cjs/core/DatePicker/DatePicker.js +38 -13
  22. package/cjs/core/Header/HeaderButton.js +1 -0
  23. package/cjs/core/Menu/Menu.js +8 -3
  24. package/cjs/core/Modal/Modal.d.ts +5 -0
  25. package/cjs/core/Modal/Modal.js +11 -9
  26. package/cjs/core/Modal/ModalContent.d.ts +14 -0
  27. package/cjs/core/Modal/ModalContent.js +46 -0
  28. package/cjs/core/Modal/index.d.ts +2 -0
  29. package/cjs/core/Modal/index.js +3 -1
  30. package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
  31. package/cjs/core/SkipToContentLink/SkipToContentLink.js +50 -0
  32. package/cjs/core/SkipToContentLink/index.d.ts +4 -0
  33. package/cjs/core/SkipToContentLink/index.js +10 -0
  34. package/cjs/core/Surface/Surface.d.ts +32 -0
  35. package/cjs/core/Surface/Surface.js +70 -0
  36. package/cjs/core/Surface/index.d.ts +4 -0
  37. package/cjs/core/Surface/index.js +10 -0
  38. package/cjs/core/Table/Table.d.ts +7 -0
  39. package/cjs/core/Table/Table.js +51 -27
  40. package/cjs/core/Table/TableCell.js +3 -3
  41. package/cjs/core/Table/TableRowMemoized.js +12 -7
  42. package/cjs/core/Table/actionHandlers/index.d.ts +2 -1
  43. package/cjs/core/Table/actionHandlers/index.js +5 -1
  44. package/cjs/core/Table/cells/DefaultCell.d.ts +1 -1
  45. package/cjs/core/Table/cells/DefaultCell.js +5 -2
  46. package/cjs/core/Table/columns/actionColumn.d.ts +35 -0
  47. package/cjs/core/Table/columns/actionColumn.js +91 -0
  48. package/cjs/core/Table/columns/expanderColumn.d.ts +47 -0
  49. package/cjs/core/Table/columns/expanderColumn.js +81 -0
  50. package/cjs/core/Table/columns/index.d.ts +3 -0
  51. package/cjs/core/Table/columns/index.js +15 -0
  52. package/cjs/core/Table/columns/selectionColumn.d.ts +35 -0
  53. package/cjs/core/Table/columns/selectionColumn.js +67 -0
  54. package/cjs/core/Table/hooks/index.d.ts +2 -2
  55. package/cjs/core/Table/hooks/index.js +1 -3
  56. package/cjs/core/Table/hooks/useExpanderCell.d.ts +0 -1
  57. package/cjs/core/Table/hooks/useExpanderCell.js +25 -39
  58. package/cjs/core/Table/hooks/useResizeColumns.js +8 -2
  59. package/cjs/core/Table/hooks/useSelectionCell.d.ts +1 -2
  60. package/cjs/core/Table/hooks/useSelectionCell.js +8 -53
  61. package/cjs/core/Table/index.d.ts +1 -0
  62. package/cjs/core/Table/index.js +5 -1
  63. package/cjs/core/Table/utils.js +1 -1
  64. package/cjs/core/Tag/Tag.js +6 -3
  65. package/cjs/core/Tile/Tile.d.ts +6 -2
  66. package/cjs/core/Tile/Tile.js +7 -2
  67. package/cjs/core/Toast/Toast.js +1 -1
  68. package/cjs/core/Typography/Anchor/Anchor.d.ts +1 -0
  69. package/cjs/core/Typography/Anchor/Anchor.js +1 -0
  70. package/cjs/core/index.d.ts +9 -3
  71. package/cjs/core/index.js +13 -2
  72. package/cjs/core/utils/components/Popover.js +13 -1
  73. package/cjs/core/utils/hooks/index.d.ts +1 -0
  74. package/cjs/core/utils/hooks/index.js +1 -0
  75. package/cjs/core/utils/hooks/useMediaQuery.d.ts +2 -0
  76. package/cjs/core/utils/hooks/useMediaQuery.js +46 -0
  77. package/cjs/core/utils/hooks/useTheme.d.ts +5 -0
  78. package/cjs/core/utils/hooks/useTheme.js +20 -14
  79. package/cjs/types/react-table-config.d.ts +18 -0
  80. package/esm/core/ButtonGroup/ButtonGroup.js +1 -0
  81. package/esm/core/Carousel/Carousel.d.ts +68 -0
  82. package/esm/core/Carousel/Carousel.js +124 -0
  83. package/esm/core/Carousel/CarouselContext.d.ts +37 -0
  84. package/esm/core/Carousel/CarouselContext.js +6 -0
  85. package/esm/core/Carousel/CarouselDot.d.ts +13 -0
  86. package/esm/core/Carousel/CarouselDot.js +40 -0
  87. package/esm/core/Carousel/CarouselDotsList.d.ts +32 -0
  88. package/esm/core/Carousel/CarouselDotsList.js +126 -0
  89. package/esm/core/Carousel/CarouselNavigation.d.ts +15 -0
  90. package/esm/core/Carousel/CarouselNavigation.js +82 -0
  91. package/esm/core/Carousel/CarouselSlide.d.ts +14 -0
  92. package/esm/core/Carousel/CarouselSlide.js +57 -0
  93. package/esm/core/Carousel/CarouselSlider.d.ts +5 -0
  94. package/esm/core/Carousel/CarouselSlider.js +88 -0
  95. package/esm/core/Carousel/index.d.ts +4 -0
  96. package/esm/core/Carousel/index.js +6 -0
  97. package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
  98. package/esm/core/DatePicker/DatePicker.d.ts +5 -0
  99. package/esm/core/DatePicker/DatePicker.js +38 -13
  100. package/esm/core/Header/HeaderButton.js +1 -0
  101. package/esm/core/Menu/Menu.js +8 -3
  102. package/esm/core/Modal/Modal.d.ts +5 -0
  103. package/esm/core/Modal/Modal.js +11 -9
  104. package/esm/core/Modal/ModalContent.d.ts +14 -0
  105. package/esm/core/Modal/ModalContent.js +39 -0
  106. package/esm/core/Modal/index.d.ts +2 -0
  107. package/esm/core/Modal/index.js +1 -0
  108. package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
  109. package/esm/core/SkipToContentLink/SkipToContentLink.js +44 -0
  110. package/esm/core/SkipToContentLink/index.d.ts +4 -0
  111. package/esm/core/SkipToContentLink/index.js +6 -0
  112. package/esm/core/Surface/Surface.d.ts +32 -0
  113. package/esm/core/Surface/Surface.js +64 -0
  114. package/esm/core/Surface/index.d.ts +4 -0
  115. package/esm/core/Surface/index.js +6 -0
  116. package/esm/core/Table/Table.d.ts +7 -0
  117. package/esm/core/Table/Table.js +47 -23
  118. package/esm/core/Table/TableCell.js +2 -2
  119. package/esm/core/Table/TableRowMemoized.js +12 -7
  120. package/esm/core/Table/actionHandlers/index.d.ts +2 -1
  121. package/esm/core/Table/actionHandlers/index.js +2 -1
  122. package/esm/core/Table/cells/DefaultCell.d.ts +1 -1
  123. package/esm/core/Table/cells/DefaultCell.js +5 -2
  124. package/esm/core/Table/columns/actionColumn.d.ts +35 -0
  125. package/esm/core/Table/columns/actionColumn.js +84 -0
  126. package/esm/core/Table/columns/expanderColumn.d.ts +47 -0
  127. package/esm/core/Table/columns/expanderColumn.js +74 -0
  128. package/esm/core/Table/columns/index.d.ts +3 -0
  129. package/esm/core/Table/columns/index.js +7 -0
  130. package/esm/core/Table/columns/selectionColumn.d.ts +35 -0
  131. package/esm/core/Table/columns/selectionColumn.js +60 -0
  132. package/esm/core/Table/hooks/index.d.ts +2 -2
  133. package/esm/core/Table/hooks/index.js +2 -2
  134. package/esm/core/Table/hooks/useExpanderCell.d.ts +0 -1
  135. package/esm/core/Table/hooks/useExpanderCell.js +24 -35
  136. package/esm/core/Table/hooks/useResizeColumns.js +8 -2
  137. package/esm/core/Table/hooks/useSelectionCell.d.ts +1 -2
  138. package/esm/core/Table/hooks/useSelectionCell.js +7 -49
  139. package/esm/core/Table/index.d.ts +1 -0
  140. package/esm/core/Table/index.js +1 -0
  141. package/esm/core/Table/utils.js +1 -1
  142. package/esm/core/Tag/Tag.js +6 -3
  143. package/esm/core/Tile/Tile.d.ts +6 -2
  144. package/esm/core/Tile/Tile.js +7 -2
  145. package/esm/core/Toast/Toast.js +1 -1
  146. package/esm/core/Typography/Anchor/Anchor.d.ts +1 -0
  147. package/esm/core/Typography/Anchor/Anchor.js +1 -0
  148. package/esm/core/index.d.ts +9 -3
  149. package/esm/core/index.js +5 -2
  150. package/esm/core/utils/components/Popover.js +13 -1
  151. package/esm/core/utils/hooks/index.d.ts +1 -0
  152. package/esm/core/utils/hooks/index.js +1 -0
  153. package/esm/core/utils/hooks/useMediaQuery.d.ts +2 -0
  154. package/esm/core/utils/hooks/useMediaQuery.js +39 -0
  155. package/esm/core/utils/hooks/useTheme.d.ts +5 -0
  156. package/esm/core/utils/hooks/useTheme.js +20 -14
  157. package/esm/types/react-table-config.d.ts +18 -0
  158. package/package.json +3 -2
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { CellProps, CellRendererProps, Row } from 'react-table';
3
+ export declare const EXPANDER_CELL_ID = "iui-table-expander";
4
+ /**
5
+ * Expander column that adds sub-content expander column to the Table.
6
+ * It is recommended to use it as the first column or after selection column.
7
+ * @example
8
+ * const subComponent = useCallback(
9
+ * (row: Row) => (
10
+ * <div style={{ padding: 16 }}>
11
+ * <Leading>Extra information</Leading>
12
+ * <pre>
13
+ * <code>{JSON.stringify({ values: row.values }, null, 2)}</code>
14
+ * </pre>
15
+ * </div>
16
+ * ),
17
+ * [],
18
+ * );
19
+ * const isExpanderDisabled = useCallback((rowData) => {
20
+ * return rowData.name === 'Name2';
21
+ * }, []);
22
+ * const columns = useMemo(() => [
23
+ * Header: 'Table',
24
+ * columns: [
25
+ * ExpanderColumn({ subComponent, isDisabled: isExpanderDisabled }),
26
+ * // Rest of your columns
27
+ * ],
28
+ * ], [isExpanderDisabled, subComponent]);
29
+ */
30
+ export declare const ExpanderColumn: <T extends Record<string, unknown>>(props?: {
31
+ /** Function that returns expanded content. If row doesn't have it, then should return `false`/`null`. */
32
+ subComponent?: ((row: Row<T>) => React.ReactNode) | undefined;
33
+ /** Function that returns whether expander is disabled */
34
+ isDisabled?: ((rowData: T) => boolean) | undefined;
35
+ }) => {
36
+ id: string;
37
+ disableResizing: boolean;
38
+ disableGroupBy: boolean;
39
+ disableReordering: boolean;
40
+ minWidth: number;
41
+ width: number;
42
+ maxWidth: number;
43
+ columnClassName: string;
44
+ cellClassName: string;
45
+ Cell: (props: CellProps<T, any>) => JSX.Element | null;
46
+ cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
47
+ };
@@ -0,0 +1,81 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ExpanderColumn = exports.EXPANDER_CELL_ID = void 0;
18
+ /*---------------------------------------------------------------------------------------------
19
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
20
+ * See LICENSE.md in the project root for license terms and full copyright notice.
21
+ *--------------------------------------------------------------------------------------------*/
22
+ var react_1 = __importDefault(require("react"));
23
+ var ChevronRight_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/ChevronRight"));
24
+ var Buttons_1 = require("../../Buttons");
25
+ var cells_1 = require("../cells");
26
+ exports.EXPANDER_CELL_ID = 'iui-table-expander';
27
+ /**
28
+ * Expander column that adds sub-content expander column to the Table.
29
+ * It is recommended to use it as the first column or after selection column.
30
+ * @example
31
+ * const subComponent = useCallback(
32
+ * (row: Row) => (
33
+ * <div style={{ padding: 16 }}>
34
+ * <Leading>Extra information</Leading>
35
+ * <pre>
36
+ * <code>{JSON.stringify({ values: row.values }, null, 2)}</code>
37
+ * </pre>
38
+ * </div>
39
+ * ),
40
+ * [],
41
+ * );
42
+ * const isExpanderDisabled = useCallback((rowData) => {
43
+ * return rowData.name === 'Name2';
44
+ * }, []);
45
+ * const columns = useMemo(() => [
46
+ * Header: 'Table',
47
+ * columns: [
48
+ * ExpanderColumn({ subComponent, isDisabled: isExpanderDisabled }),
49
+ * // Rest of your columns
50
+ * ],
51
+ * ], [isExpanderDisabled, subComponent]);
52
+ */
53
+ var ExpanderColumn = function (props) {
54
+ if (props === void 0) { props = {}; }
55
+ var subComponent = props.subComponent, isDisabled = props.isDisabled;
56
+ return {
57
+ id: exports.EXPANDER_CELL_ID,
58
+ disableResizing: true,
59
+ disableGroupBy: true,
60
+ disableReordering: true,
61
+ minWidth: 48,
62
+ width: 48,
63
+ maxWidth: 48,
64
+ columnClassName: 'iui-slot',
65
+ cellClassName: 'iui-slot',
66
+ Cell: function (props) {
67
+ var row = props.row;
68
+ if (!(subComponent === null || subComponent === void 0 ? void 0 : subComponent(row))) {
69
+ return null;
70
+ }
71
+ else {
72
+ return (react_1.default.createElement(Buttons_1.IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
73
+ e.stopPropagation();
74
+ row.toggleRowExpanded();
75
+ }, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, react_1.default.createElement(ChevronRight_1.default, null)));
76
+ }
77
+ },
78
+ cellRenderer: function (props) { return (react_1.default.createElement(cells_1.DefaultCell, __assign({}, props, { isDisabled: function (rowData) { return !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)); } }))); },
79
+ };
80
+ };
81
+ exports.ExpanderColumn = ExpanderColumn;
@@ -0,0 +1,3 @@
1
+ export { ActionColumn } from './actionColumn';
2
+ export { SELECTION_CELL_ID, SelectionColumn } from './selectionColumn';
3
+ export { EXPANDER_CELL_ID, ExpanderColumn } from './expanderColumn';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExpanderColumn = exports.EXPANDER_CELL_ID = exports.SelectionColumn = exports.SELECTION_CELL_ID = exports.ActionColumn = 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 actionColumn_1 = require("./actionColumn");
9
+ Object.defineProperty(exports, "ActionColumn", { enumerable: true, get: function () { return actionColumn_1.ActionColumn; } });
10
+ var selectionColumn_1 = require("./selectionColumn");
11
+ Object.defineProperty(exports, "SELECTION_CELL_ID", { enumerable: true, get: function () { return selectionColumn_1.SELECTION_CELL_ID; } });
12
+ Object.defineProperty(exports, "SelectionColumn", { enumerable: true, get: function () { return selectionColumn_1.SelectionColumn; } });
13
+ var expanderColumn_1 = require("./expanderColumn");
14
+ Object.defineProperty(exports, "EXPANDER_CELL_ID", { enumerable: true, get: function () { return expanderColumn_1.EXPANDER_CELL_ID; } });
15
+ Object.defineProperty(exports, "ExpanderColumn", { enumerable: true, get: function () { return expanderColumn_1.ExpanderColumn; } });
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { CellProps, CellRendererProps, HeaderProps } from 'react-table';
3
+ export declare const SELECTION_CELL_ID = "iui-table-checkbox-selector";
4
+ /**
5
+ * Selection column that adds selection checkbox column to the Table.
6
+ * It is recommended to use it as the first column.
7
+ * @example
8
+ * const isCheckboxDisabled = useCallback((rowData) => {
9
+ * return rowData.name === 'Name1';
10
+ * }, []);
11
+ * const columns = useMemo(() => [
12
+ * Header: 'Table',
13
+ * columns: [
14
+ * SelectionColumn({ isDisabled: isCheckboxDisabled }),
15
+ * // Rest of your columns
16
+ * ],
17
+ * ], [isCheckboxDisabled]);
18
+ */
19
+ export declare const SelectionColumn: <T extends Record<string, unknown>>(props?: {
20
+ /** Function that returns whether row checkbox should be disabled. */
21
+ isDisabled?: ((rowData: T) => boolean) | undefined;
22
+ }) => {
23
+ id: string;
24
+ disableResizing: boolean;
25
+ disableGroupBy: boolean;
26
+ disableReordering: boolean;
27
+ minWidth: number;
28
+ width: number;
29
+ maxWidth: number;
30
+ columnClassName: string;
31
+ cellClassName: string;
32
+ Header: ({ getToggleAllRowsSelectedProps, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
33
+ Cell: ({ row }: CellProps<T, any>) => JSX.Element;
34
+ cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
35
+ };
@@ -0,0 +1,67 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SelectionColumn = exports.SELECTION_CELL_ID = void 0;
18
+ /*---------------------------------------------------------------------------------------------
19
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
20
+ * See LICENSE.md in the project root for license terms and full copyright notice.
21
+ *--------------------------------------------------------------------------------------------*/
22
+ var react_1 = __importDefault(require("react"));
23
+ var Checkbox_1 = require("../../Checkbox");
24
+ var cells_1 = require("../cells");
25
+ exports.SELECTION_CELL_ID = 'iui-table-checkbox-selector';
26
+ /**
27
+ * Selection column that adds selection checkbox column to the Table.
28
+ * It is recommended to use it as the first column.
29
+ * @example
30
+ * const isCheckboxDisabled = useCallback((rowData) => {
31
+ * return rowData.name === 'Name1';
32
+ * }, []);
33
+ * const columns = useMemo(() => [
34
+ * Header: 'Table',
35
+ * columns: [
36
+ * SelectionColumn({ isDisabled: isCheckboxDisabled }),
37
+ * // Rest of your columns
38
+ * ],
39
+ * ], [isCheckboxDisabled]);
40
+ */
41
+ var SelectionColumn = function (props) {
42
+ if (props === void 0) { props = {}; }
43
+ var isDisabled = props.isDisabled;
44
+ return {
45
+ id: exports.SELECTION_CELL_ID,
46
+ disableResizing: true,
47
+ disableGroupBy: true,
48
+ disableReordering: true,
49
+ minWidth: 48,
50
+ width: 48,
51
+ maxWidth: 48,
52
+ columnClassName: 'iui-slot',
53
+ cellClassName: 'iui-slot',
54
+ Header: function (_a) {
55
+ var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
56
+ var disabled = rows.every(function (row) { return isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original); });
57
+ var checked = initialRows.every(function (row) { return state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)); });
58
+ return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { style: {}, checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
59
+ },
60
+ Cell: function (_a) {
61
+ var row = _a.row;
62
+ return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, row.getToggleRowSelectedProps(), { style: {}, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original), onClick: function (e) { return e.stopPropagation(); } })));
63
+ },
64
+ cellRenderer: function (props) { return (react_1.default.createElement(cells_1.DefaultCell, __assign({}, props, { isDisabled: function (rowData) { return !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)); } }))); },
65
+ };
66
+ };
67
+ exports.SelectionColumn = SelectionColumn;
@@ -1,5 +1,5 @@
1
- export { EXPANDER_CELL_ID, useExpanderCell } from './useExpanderCell';
2
- export { SELECTION_CELL_ID, useSelectionCell } from './useSelectionCell';
1
+ export { useExpanderCell } from './useExpanderCell';
2
+ export { useSelectionCell } from './useSelectionCell';
3
3
  export { useSubRowFiltering } from './useSubRowFiltering';
4
4
  export { useSubRowSelection } from './useSubRowSelection';
5
5
  export { useResizeColumns } from './useResizeColumns';
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.SELECTION_CELL_ID = exports.useExpanderCell = exports.EXPANDER_CELL_ID = void 0;
3
+ exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.useExpanderCell = 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.
7
7
  *--------------------------------------------------------------------------------------------*/
8
8
  var useExpanderCell_1 = require("./useExpanderCell");
9
- Object.defineProperty(exports, "EXPANDER_CELL_ID", { enumerable: true, get: function () { return useExpanderCell_1.EXPANDER_CELL_ID; } });
10
9
  Object.defineProperty(exports, "useExpanderCell", { enumerable: true, get: function () { return useExpanderCell_1.useExpanderCell; } });
11
10
  var useSelectionCell_1 = require("./useSelectionCell");
12
- Object.defineProperty(exports, "SELECTION_CELL_ID", { enumerable: true, get: function () { return useSelectionCell_1.SELECTION_CELL_ID; } });
13
11
  Object.defineProperty(exports, "useSelectionCell", { enumerable: true, get: function () { return useSelectionCell_1.useSelectionCell; } });
14
12
  var useSubRowFiltering_1 = require("./useSubRowFiltering");
15
13
  Object.defineProperty(exports, "useSubRowFiltering", { enumerable: true, get: function () { return useSubRowFiltering_1.useSubRowFiltering; } });
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
2
  import { CellProps, Hooks, Row } from 'react-table';
3
- export declare const EXPANDER_CELL_ID = "iui-table-expander";
4
3
  export declare const useExpanderCell: <T extends Record<string, unknown>>(subComponent?: ((row: Row<T>) => React.ReactNode) | undefined, expanderCell?: ((cellProps: CellProps<T, any>) => React.ReactNode) | undefined, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
@@ -1,4 +1,15 @@
1
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
+ };
2
13
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
14
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
15
  if (ar || !(i in from)) {
@@ -8,50 +19,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
19
  }
9
20
  return to.concat(ar || Array.prototype.slice.call(from));
10
21
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
22
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useExpanderCell = exports.EXPANDER_CELL_ID = void 0;
16
- /*---------------------------------------------------------------------------------------------
17
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
18
- * See LICENSE.md in the project root for license terms and full copyright notice.
19
- *--------------------------------------------------------------------------------------------*/
20
- var ChevronRight_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/ChevronRight"));
21
- var react_1 = __importDefault(require("react"));
22
- var Buttons_1 = require("../../Buttons");
23
- exports.EXPANDER_CELL_ID = 'iui-table-expander';
23
+ exports.useExpanderCell = void 0;
24
+ var columns_1 = require("../columns");
24
25
  var useExpanderCell = function (subComponent, expanderCell, isRowDisabled) { return function (hooks) {
25
26
  if (!subComponent) {
26
27
  return;
27
28
  }
28
- hooks.allColumns.push(function (columns) { return __spreadArray([
29
- {
30
- id: exports.EXPANDER_CELL_ID,
31
- disableResizing: true,
32
- disableGroupBy: true,
33
- minWidth: 48,
34
- width: 48,
35
- maxWidth: 48,
36
- columnClassName: 'iui-slot',
37
- cellClassName: 'iui-slot',
38
- disableReordering: true,
39
- Cell: function (props) {
40
- var row = props.row;
41
- if (!subComponent(row)) {
42
- return null;
43
- }
44
- else if (expanderCell) {
45
- return expanderCell(props);
46
- }
47
- else {
48
- return (react_1.default.createElement(Buttons_1.IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
49
- e.stopPropagation();
50
- row.toggleRowExpanded();
51
- }, disabled: isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(props.row.original) }, react_1.default.createElement(ChevronRight_1.default, null)));
52
- }
53
- },
29
+ hooks.allColumns.push(function (columns) {
30
+ var hasExpanderColumn = columns.find(function (c) { return c.id === columns_1.EXPANDER_CELL_ID; });
31
+ if (hasExpanderColumn) {
32
+ return columns;
54
33
  }
55
- ], columns, true); });
34
+ var expanderColumn = (0, columns_1.ExpanderColumn)({
35
+ subComponent: subComponent,
36
+ isDisabled: isRowDisabled,
37
+ });
38
+ return __spreadArray([
39
+ __assign(__assign({}, expanderColumn), { Cell: expanderCell !== null && expanderCell !== void 0 ? expanderCell : expanderColumn.Cell })
40
+ ], columns, true);
41
+ });
56
42
  }; };
57
43
  exports.useExpanderCell = useExpanderCell;
@@ -229,7 +229,10 @@ var useInstanceBeforeDimensions = function (instance) {
229
229
  };
230
230
  var getPreviousResizableHeader = function (headerColumn, instance) {
231
231
  var _a;
232
- var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
232
+ var headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(function (_a) {
233
+ var isVisible = _a.isVisible;
234
+ return isVisible;
235
+ });
233
236
  var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
234
237
  return __spreadArray([], headersList, true).slice(0, headerIndex)
235
238
  .reverse()
@@ -237,7 +240,10 @@ var getPreviousResizableHeader = function (headerColumn, instance) {
237
240
  };
238
241
  var getNextResizableHeader = function (headerColumn, instance) {
239
242
  var _a;
240
- var headersList = ((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders;
243
+ var headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(function (_a) {
244
+ var isVisible = _a.isVisible;
245
+ return isVisible;
246
+ });
241
247
  var headerIndex = headersList.findIndex(function (h) { return h.id === headerColumn.id; });
242
248
  return __spreadArray([], headersList, true).slice(headerIndex + 1)
243
249
  .find(function (h) { return !h.disableResizing; });
@@ -1,3 +1,2 @@
1
1
  import { Hooks } from 'react-table';
2
- export declare const SELECTION_CELL_ID = "iui-table-checkbox-selector";
3
- export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
2
+ export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, selectionMode: 'multi' | 'single', isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
@@ -1,15 +1,4 @@
1
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
2
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
3
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
4
  if (ar || !(i in from)) {
@@ -19,52 +8,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
8
  }
20
9
  return to.concat(ar || Array.prototype.slice.call(from));
21
10
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
11
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useSelectionCell = exports.SELECTION_CELL_ID = void 0;
27
- /*---------------------------------------------------------------------------------------------
28
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
- * See LICENSE.md in the project root for license terms and full copyright notice.
30
- *--------------------------------------------------------------------------------------------*/
31
- var react_1 = __importDefault(require("react"));
32
- var Checkbox_1 = require("../../Checkbox");
33
- exports.SELECTION_CELL_ID = 'iui-table-checkbox-selector';
34
- var useSelectionCell = function (isSelectable, isRowDisabled) { return function (hooks) {
12
+ exports.useSelectionCell = void 0;
13
+ var columns_1 = require("../columns");
14
+ var useSelectionCell = function (isSelectable, selectionMode, isRowDisabled) { return function (hooks) {
35
15
  if (!isSelectable) {
36
16
  return;
37
17
  }
38
- hooks.allColumns.push(function (columns) { return __spreadArray([
39
- {
40
- id: exports.SELECTION_CELL_ID,
41
- disableResizing: true,
42
- disableGroupBy: true,
43
- minWidth: 48,
44
- width: 48,
45
- maxWidth: 48,
46
- columnClassName: 'iui-slot',
47
- cellClassName: 'iui-slot',
48
- disableReordering: true,
49
- Header: function (_a) {
50
- var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
51
- var disabled = rows.every(function (row) { return isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original); });
52
- var checked = initialRows.every(function (row) {
53
- return state.selectedRowIds[row.id] || (isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original));
54
- });
55
- return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
56
- },
57
- Cell: function (_a) {
58
- var row = _a.row;
59
- return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, row.getToggleRowSelectedProps(), { disabled: isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original), onClick: function (e) { return e.stopPropagation(); } })));
60
- },
61
- }
62
- ], columns, true); });
63
- hooks.useInstanceBeforeDimensions.push(function (_a) {
64
- var headerGroups = _a.headerGroups;
65
- // Fix the parent group of the selection button to not be resizable
66
- var selectionGroupHeader = headerGroups[0].headers[0];
67
- selectionGroupHeader.canResize = false;
18
+ hooks.allColumns.push(function (columns) {
19
+ return selectionMode === 'single' ||
20
+ columns.find(function (c) { return c.id === columns_1.SELECTION_CELL_ID; })
21
+ ? columns
22
+ : __spreadArray([(0, columns_1.SelectionColumn)({ isDisabled: isRowDisabled })], columns, true);
68
23
  });
69
24
  }; };
70
25
  exports.useSelectionCell = useSelectionCell;
@@ -6,5 +6,6 @@ export { DefaultCell, EditableCell } from './cells';
6
6
  export type { DefaultCellProps, EditableCellProps } from './cells';
7
7
  export { TablePaginator } from './TablePaginator';
8
8
  export type { TablePaginatorProps } from './TablePaginator';
9
+ export { ActionColumn, ExpanderColumn, SelectionColumn } from './columns';
9
10
  declare const _default: "./Table";
10
11
  export default _default;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.tableFilters = exports.FilterButtonBar = exports.BaseFilter = exports.Table = void 0;
3
+ exports.SelectionColumn = exports.ExpanderColumn = exports.ActionColumn = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.tableFilters = exports.FilterButtonBar = exports.BaseFilter = exports.Table = 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.
@@ -16,4 +16,8 @@ Object.defineProperty(exports, "DefaultCell", { enumerable: true, get: function
16
16
  Object.defineProperty(exports, "EditableCell", { enumerable: true, get: function () { return cells_1.EditableCell; } });
17
17
  var TablePaginator_1 = require("./TablePaginator");
18
18
  Object.defineProperty(exports, "TablePaginator", { enumerable: true, get: function () { return TablePaginator_1.TablePaginator; } });
19
+ var columns_1 = require("./columns");
20
+ Object.defineProperty(exports, "ActionColumn", { enumerable: true, get: function () { return columns_1.ActionColumn; } });
21
+ Object.defineProperty(exports, "ExpanderColumn", { enumerable: true, get: function () { return columns_1.ExpanderColumn; } });
22
+ Object.defineProperty(exports, "SelectionColumn", { enumerable: true, get: function () { return columns_1.SelectionColumn; } });
19
23
  exports.default = './Table';
@@ -9,7 +9,7 @@ var getCellStyle = function (column, isTableResizing) {
9
9
  style.width = width;
10
10
  // This allows flexbox to handle the width of the column on table resize
11
11
  if (isTableResizing && column.canResize) {
12
- style.flex = Number(column.width) + " 1 " + width;
12
+ style.flex = Number(column.width) + " " + Number(column.width) + " " + width;
13
13
  }
14
14
  else {
15
15
  style.flex = "0 0 " + width;
@@ -45,9 +45,12 @@ var Buttons_1 = require("../Buttons");
45
45
  var Tag = function (props) {
46
46
  var className = props.className, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, onRemove = props.onRemove, rest = __rest(props, ["className", "variant", "children", "onRemove"]);
47
47
  (0, utils_1.useTheme)();
48
- return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)('iui-tag', { 'iui-basic': variant === 'basic' }, className) }, rest),
49
- react_1.default.createElement("span", { className: 'iui-label' }, children),
50
- onRemove && (react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', onClick: onRemove, "aria-label": 'Delete tag' },
48
+ return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)({
49
+ 'iui-tag-basic': variant === 'basic',
50
+ 'iui-tag': variant === 'default',
51
+ }, className) }, rest),
52
+ variant === 'default' ? (react_1.default.createElement("span", { className: 'iui-tag-label' }, children)) : (children),
53
+ onRemove && (react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', onClick: onRemove, "aria-label": 'Delete tag', className: 'iui-tag-button' },
51
54
  react_1.default.createElement(CloseSmall_1.default, { "aria-hidden": true })))));
52
55
  };
53
56
  exports.Tag = Tag;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { CommonProps } from '../utils';
3
2
  import '@itwin/itwinui-css/css/tile.css';
4
3
  export declare type TileProps = {
5
4
  /**
@@ -80,7 +79,12 @@ export declare type TileProps = {
80
79
  * Any custom nodes that will be appended to the tile's main content.
81
80
  */
82
81
  children?: React.ReactNode;
83
- } & Omit<CommonProps, 'title'>;
82
+ /**
83
+ * Whether the tile is expected to be interactable (i.e. `onClick`).
84
+ * It becomes focusable and gets on hover styling.
85
+ */
86
+ isActionable?: boolean;
87
+ } & React.ComponentPropsWithoutRef<'div'>;
84
88
  /**
85
89
  * Tile component that displays content and actions in a card-like format.
86
90
  * @example
@@ -57,12 +57,17 @@ var Buttons_1 = require("../Buttons");
57
57
  * />
58
58
  */
59
59
  var Tile = function (props) {
60
- var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children"]);
60
+ var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, isActionable = props.isActionable, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children", "isActionable"]);
61
61
  (0, utils_1.useTheme)();
62
62
  var _b = react_1.default.useState(false), isMenuVisible = _b[0], setIsMenuVisible = _b[1];
63
63
  var showMenu = react_1.default.useCallback(function () { return setIsMenuVisible(true); }, []);
64
64
  var hideMenu = react_1.default.useCallback(function () { return setIsMenuVisible(false); }, []);
65
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tile', { 'iui-folder': variant === 'folder' }, { 'iui-new': isNew }, { 'iui-selected': isSelected }, className) }, rest),
65
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tile', {
66
+ 'iui-folder': variant === 'folder',
67
+ 'iui-new': isNew,
68
+ 'iui-selected': isSelected,
69
+ 'iui-actionable': isActionable,
70
+ }, className), tabIndex: isActionable ? 0 : undefined }, rest),
66
71
  thumbnail && (react_1.default.createElement("div", { className: 'iui-tile-thumbnail' },
67
72
  typeof thumbnail === 'string' ? (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: "url(" + thumbnail + ")" } })) : thumbnail && thumbnail.type === 'img' ? (react_1.default.cloneElement(thumbnail, {
68
73
  className: 'iui-tile-thumbnail-picture',
@@ -143,7 +143,7 @@ var ToastPresentation = function (props) {
143
143
  return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("iui-toast iui-" + category, className) }, rest),
144
144
  react_1.default.createElement("div", { className: 'iui-status-area' }, react_1.default.createElement(StatusIcon, { className: 'iui-icon' })),
145
145
  react_1.default.createElement("div", { className: 'iui-message' }, content),
146
- link && (react_1.default.createElement("a", { className: 'iui-anchor', onClick: link.onClick }, link.title)),
146
+ link && (react_1.default.createElement("a", { className: 'iui-toast-anchor', onClick: link.onClick }, link.title)),
147
147
  (type === 'persisting' || hasCloseButton) && (react_1.default.createElement(Buttons_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
148
148
  react_1.default.createElement(CloseSmall_1.default, null)))));
149
149
  };
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
+ import '@itwin/itwinui-css/css/anchor.css';
2
3
  export declare const Anchor: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & React.RefAttributes<HTMLAnchorElement>>;
3
4
  export default Anchor;
@@ -33,6 +33,7 @@ exports.Anchor = void 0;
33
33
  var react_1 = __importDefault(require("react"));
34
34
  var classnames_1 = __importDefault(require("classnames"));
35
35
  var utils_1 = require("../../utils");
36
+ require("@itwin/itwinui-css/css/anchor.css");
36
37
  exports.Anchor = react_1.default.forwardRef(function (_a, ref) {
37
38
  var className = _a.className, rest = __rest(_a, ["className"]);
38
39
  (0, utils_1.useTheme)();