@itwin/itwinui-react 3.18.3 → 3.19.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 (145) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/DEV-cjs/core/ComboBox/ComboBoxMenuItem.js +1 -1
  3. package/DEV-cjs/core/Menu/MenuItem.js +8 -7
  4. package/DEV-cjs/core/Select/Select.js +18 -10
  5. package/DEV-cjs/core/SideNavigation/SideNavigation.js +2 -2
  6. package/DEV-cjs/core/Table/ColumnHeader.js +7 -3
  7. package/DEV-cjs/core/Table/Table.js +65 -5
  8. package/DEV-cjs/core/Table/cells/DefaultCell.js +14 -9
  9. package/DEV-cjs/core/Table/columns/actionColumn.js +1 -0
  10. package/DEV-cjs/core/Table/columns/expanderColumn.js +25 -20
  11. package/DEV-cjs/core/Table/columns/selectionColumn.js +14 -8
  12. package/DEV-cjs/core/Table/hooks/useExpanderCell.js +10 -6
  13. package/DEV-cjs/core/Tag/Tag.js +8 -2
  14. package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +46 -46
  15. package/DEV-cjs/core/ToggleSwitch/ToggleSwitch.js +15 -4
  16. package/DEV-cjs/styles.js +1 -1
  17. package/DEV-cjs/utils/components/index.js +1 -1
  18. package/DEV-cjs/utils/components/lineClamp.js +23 -0
  19. package/DEV-cjs/utils/functions/react.js +18 -4
  20. package/DEV-cjs/utils/hooks/useControlledState.js +5 -1
  21. package/DEV-cjs/utils/providers/FutureFlagsProvider.js +48 -0
  22. package/DEV-cjs/utils/providers/index.js +1 -0
  23. package/DEV-esm/core/ComboBox/ComboBoxMenuItem.js +1 -1
  24. package/DEV-esm/core/Menu/MenuItem.js +8 -7
  25. package/DEV-esm/core/Select/Select.js +19 -10
  26. package/DEV-esm/core/SideNavigation/SideNavigation.js +2 -2
  27. package/DEV-esm/core/Table/ColumnHeader.js +8 -4
  28. package/DEV-esm/core/Table/Table.js +65 -5
  29. package/DEV-esm/core/Table/cells/DefaultCell.js +15 -10
  30. package/DEV-esm/core/Table/columns/actionColumn.js +1 -0
  31. package/DEV-esm/core/Table/columns/expanderColumn.js +25 -20
  32. package/DEV-esm/core/Table/columns/selectionColumn.js +14 -8
  33. package/DEV-esm/core/Table/hooks/useExpanderCell.js +10 -6
  34. package/DEV-esm/core/Tag/Tag.js +11 -3
  35. package/DEV-esm/core/ThemeProvider/ThemeProvider.js +48 -42
  36. package/DEV-esm/core/ToggleSwitch/ToggleSwitch.js +15 -5
  37. package/DEV-esm/styles.js +1 -1
  38. package/DEV-esm/utils/components/index.js +1 -1
  39. package/DEV-esm/utils/components/lineClamp.js +13 -0
  40. package/DEV-esm/utils/functions/react.js +6 -1
  41. package/DEV-esm/utils/hooks/useControlledState.js +5 -1
  42. package/DEV-esm/utils/providers/FutureFlagsProvider.js +28 -0
  43. package/DEV-esm/utils/providers/index.js +1 -0
  44. package/cjs/core/Buttons/DropdownButton.d.ts +1 -1
  45. package/cjs/core/Buttons/IconButton.d.ts +1 -1
  46. package/cjs/core/Carousel/Carousel.d.ts +4 -4
  47. package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -4
  48. package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +5 -16
  49. package/cjs/core/ComboBox/ComboBoxMenuItem.js +1 -1
  50. package/cjs/core/DropdownMenu/DropdownMenu.d.ts +1 -1
  51. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
  52. package/cjs/core/Menu/MenuItem.d.ts +7 -1
  53. package/cjs/core/Menu/MenuItem.js +8 -7
  54. package/cjs/core/Popover/Popover.d.ts +5 -3
  55. package/cjs/core/Select/Select.js +18 -10
  56. package/cjs/core/SideNavigation/SideNavigation.js +2 -2
  57. package/cjs/core/Table/ColumnHeader.js +7 -3
  58. package/cjs/core/Table/Table.d.ts +2 -2
  59. package/cjs/core/Table/Table.js +65 -5
  60. package/cjs/core/Table/cells/DefaultCell.js +14 -9
  61. package/cjs/core/Table/columns/actionColumn.d.ts +1 -0
  62. package/cjs/core/Table/columns/actionColumn.js +1 -0
  63. package/cjs/core/Table/columns/expanderColumn.d.ts +2 -2
  64. package/cjs/core/Table/columns/expanderColumn.js +25 -20
  65. package/cjs/core/Table/columns/selectionColumn.d.ts +2 -2
  66. package/cjs/core/Table/columns/selectionColumn.js +14 -8
  67. package/cjs/core/Table/hooks/useExpanderCell.js +10 -6
  68. package/cjs/core/Tabs/Tabs.d.ts +4 -1
  69. package/cjs/core/Tag/Tag.js +8 -2
  70. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -2
  71. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +8 -18
  72. package/cjs/core/ThemeProvider/ThemeProvider.js +46 -46
  73. package/cjs/core/Tile/Tile.d.ts +2 -2
  74. package/cjs/core/ToggleSwitch/ToggleSwitch.d.ts +21 -0
  75. package/cjs/core/ToggleSwitch/ToggleSwitch.js +15 -4
  76. package/cjs/core/TransferList/TransferList.d.ts +7 -5
  77. package/cjs/styles.js +1 -1
  78. package/cjs/utils/components/index.d.ts +1 -1
  79. package/cjs/utils/components/index.js +1 -1
  80. package/cjs/utils/components/lineClamp.d.ts +5 -0
  81. package/cjs/utils/components/lineClamp.js +23 -0
  82. package/cjs/utils/functions/react.d.ts +5 -0
  83. package/cjs/utils/functions/react.js +18 -4
  84. package/cjs/utils/hooks/useControlledState.d.ts +5 -2
  85. package/cjs/utils/hooks/useControlledState.js +5 -1
  86. package/cjs/utils/hooks/useGlobals.d.ts +0 -1
  87. package/cjs/utils/providers/FutureFlagsProvider.d.ts +37 -0
  88. package/cjs/utils/providers/FutureFlagsProvider.js +48 -0
  89. package/cjs/utils/providers/index.d.ts +1 -0
  90. package/cjs/utils/providers/index.js +1 -0
  91. package/esm/core/Buttons/DropdownButton.d.ts +1 -1
  92. package/esm/core/Buttons/IconButton.d.ts +1 -1
  93. package/esm/core/Carousel/Carousel.d.ts +4 -4
  94. package/esm/core/Carousel/CarouselNavigation.d.ts +4 -4
  95. package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +5 -16
  96. package/esm/core/ComboBox/ComboBoxMenuItem.js +1 -1
  97. package/esm/core/DropdownMenu/DropdownMenu.d.ts +1 -1
  98. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
  99. package/esm/core/Menu/MenuItem.d.ts +7 -1
  100. package/esm/core/Menu/MenuItem.js +8 -7
  101. package/esm/core/Popover/Popover.d.ts +5 -3
  102. package/esm/core/Select/Select.js +19 -10
  103. package/esm/core/SideNavigation/SideNavigation.js +2 -2
  104. package/esm/core/Table/ColumnHeader.js +8 -4
  105. package/esm/core/Table/Table.d.ts +2 -2
  106. package/esm/core/Table/Table.js +65 -5
  107. package/esm/core/Table/cells/DefaultCell.js +15 -10
  108. package/esm/core/Table/columns/actionColumn.d.ts +1 -0
  109. package/esm/core/Table/columns/actionColumn.js +1 -0
  110. package/esm/core/Table/columns/expanderColumn.d.ts +2 -2
  111. package/esm/core/Table/columns/expanderColumn.js +25 -20
  112. package/esm/core/Table/columns/selectionColumn.d.ts +2 -2
  113. package/esm/core/Table/columns/selectionColumn.js +14 -8
  114. package/esm/core/Table/hooks/useExpanderCell.js +10 -6
  115. package/esm/core/Tabs/Tabs.d.ts +4 -1
  116. package/esm/core/Tag/Tag.js +11 -3
  117. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -2
  118. package/esm/core/ThemeProvider/ThemeProvider.d.ts +8 -18
  119. package/esm/core/ThemeProvider/ThemeProvider.js +48 -42
  120. package/esm/core/Tile/Tile.d.ts +2 -2
  121. package/esm/core/ToggleSwitch/ToggleSwitch.d.ts +21 -0
  122. package/esm/core/ToggleSwitch/ToggleSwitch.js +15 -5
  123. package/esm/core/TransferList/TransferList.d.ts +7 -5
  124. package/esm/styles.js +1 -1
  125. package/esm/utils/components/index.d.ts +1 -1
  126. package/esm/utils/components/index.js +1 -1
  127. package/esm/utils/components/lineClamp.d.ts +5 -0
  128. package/esm/utils/components/lineClamp.js +13 -0
  129. package/esm/utils/functions/react.d.ts +5 -0
  130. package/esm/utils/functions/react.js +6 -1
  131. package/esm/utils/hooks/useControlledState.d.ts +5 -2
  132. package/esm/utils/hooks/useControlledState.js +5 -1
  133. package/esm/utils/hooks/useGlobals.d.ts +0 -1
  134. package/esm/utils/providers/FutureFlagsProvider.d.ts +37 -0
  135. package/esm/utils/providers/FutureFlagsProvider.js +28 -0
  136. package/esm/utils/providers/index.d.ts +1 -0
  137. package/esm/utils/providers/index.js +1 -0
  138. package/package.json +11 -5
  139. package/styles.css +10 -10
  140. package/DEV-cjs/utils/components/LineClamp.js +0 -50
  141. package/DEV-esm/utils/components/LineClamp.js +0 -36
  142. package/cjs/utils/components/LineClamp.d.ts +0 -5
  143. package/cjs/utils/components/LineClamp.js +0 -50
  144. package/esm/utils/components/LineClamp.d.ts +0 -5
  145. package/esm/utils/components/LineClamp.js +0 -36
@@ -30,9 +30,9 @@ export const SideNavigation = React.forwardRef((props, forwardedRef) => {
30
30
  className: 'iui-sidenav-button iui-expand',
31
31
  size: 'small',
32
32
  onClick: React.useCallback(() => {
33
- setIsExpanded((expanded) => !expanded);
33
+ setIsExpanded(!isExpanded);
34
34
  onExpanderClick?.();
35
- }, [onExpanderClick, setIsExpanded]),
35
+ }, [isExpanded, onExpanderClick, setIsExpanded]),
36
36
  },
37
37
  React.createElement(SvgChevronRight, null),
38
38
  );
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import {
3
3
  Box,
4
4
  ShadowRoot,
5
- LineClamp,
5
+ lineClamp,
6
6
  SvgSortDown,
7
7
  SvgSortUp,
8
8
  useMergedRefs,
@@ -103,10 +103,14 @@ export const ColumnHeader = React.forwardRef((props, forwardedRef) => {
103
103
  'string' == typeof column.Header
104
104
  ? React.createElement(
105
105
  ShadowRoot,
106
- null,
106
+ {
107
+ css: lineClamp.css,
108
+ },
107
109
  React.createElement(
108
- LineClamp,
109
- null,
110
+ 'div',
111
+ {
112
+ className: lineClamp.className,
113
+ },
110
114
  React.createElement('slot', null),
111
115
  ),
112
116
  React.createElement('slot', {
@@ -206,8 +206,8 @@ export type TableProps<T extends Record<string, unknown> = Record<string, unknow
206
206
  /**
207
207
  * Passes props to the `role="table"` element within the wrapper.
208
208
  *
209
- * If `tableProps` or `role` is passed to `Table`, all ARIA attributes passed to `Table` will be passed to the wrapper.
210
- * Else, all ARIA attributes will be passed to the inner element with `role="table"`.
209
+ * - If `tableProps` or `role` is passed to `Table`, all ARIA attributes passed to `Table` will be passed to the wrapper.
210
+ * - Else, all ARIA attributes will be passed to the inner element with `role="table"`.
211
211
  */
212
212
  tableProps?: React.ComponentProps<'div'>;
213
213
  /**
@@ -113,6 +113,38 @@ export const Table = (props) => {
113
113
  caption = 'Table',
114
114
  role,
115
115
  scrollToRow,
116
+ useControlledState,
117
+ autoResetExpanded,
118
+ autoResetFilters,
119
+ autoResetGlobalFilter,
120
+ autoResetHiddenColumns,
121
+ autoResetPage,
122
+ autoResetResize,
123
+ autoResetSelectedRows,
124
+ autoResetSortBy,
125
+ defaultCanFilter,
126
+ defaultCanSort,
127
+ defaultColumn: defaultColumnProp,
128
+ disableFilters,
129
+ disableGlobalFilter,
130
+ disableMultiSort,
131
+ disableSortRemove,
132
+ disabledMultiRemove,
133
+ expandSubRows,
134
+ globalFilter,
135
+ initialState,
136
+ isMultiSortEvent,
137
+ manualExpandedKey,
138
+ manualFilters,
139
+ manualGlobalFilter,
140
+ manualRowSelectedKey,
141
+ manualSortBy,
142
+ maxMultiSortColCount,
143
+ orderByFn,
144
+ pageCount,
145
+ sortTypes,
146
+ manualPagination,
147
+ paginateExpandedRows,
116
148
  ..._rest
117
149
  } = props;
118
150
  let { ariaRestAttributes, nonAriaRestAttributes } = React.useMemo(
@@ -153,8 +185,9 @@ export const Table = (props) => {
153
185
  maxWidth: 0,
154
186
  minWidth: 0,
155
187
  width: 0,
188
+ ...defaultColumnProp,
156
189
  }),
157
- [],
190
+ [defaultColumnProp],
158
191
  );
159
192
  let rowHeight = React.useMemo(() => {
160
193
  if ('condensed' === density) return 50;
@@ -306,9 +339,36 @@ export const Table = (props) => {
306
339
  );
307
340
  let instance = useTable(
308
341
  {
309
- manualPagination: !paginatorRenderer,
310
- paginateExpandedRows: false,
311
- ...props,
342
+ manualPagination: manualPagination ?? !paginatorRenderer,
343
+ paginateExpandedRows: paginateExpandedRows ?? false,
344
+ useControlledState,
345
+ autoResetExpanded,
346
+ autoResetFilters,
347
+ autoResetGlobalFilter,
348
+ autoResetHiddenColumns,
349
+ autoResetPage,
350
+ autoResetResize,
351
+ autoResetSelectedRows,
352
+ autoResetSortBy,
353
+ defaultCanFilter,
354
+ defaultCanSort,
355
+ disableFilters,
356
+ disableGlobalFilter,
357
+ disableMultiSort,
358
+ disableSortRemove,
359
+ disabledMultiRemove,
360
+ expandSubRows,
361
+ globalFilter,
362
+ isMultiSortEvent,
363
+ manualExpandedKey,
364
+ manualFilters,
365
+ manualGlobalFilter,
366
+ manualRowSelectedKey,
367
+ manualSortBy,
368
+ maxMultiSortColCount,
369
+ orderByFn,
370
+ pageCount: pageCount ?? -1,
371
+ sortTypes,
312
372
  columns,
313
373
  defaultColumn,
314
374
  disableSortBy: !isSortable,
@@ -319,7 +379,7 @@ export const Table = (props) => {
319
379
  getSubRows: subComponent ? getSubRowsWithSubComponents : getSubRows,
320
380
  initialState: {
321
381
  pageSize,
322
- ...props.initialState,
382
+ ...initialState,
323
383
  },
324
384
  columnResizeMode,
325
385
  getRowId: subComponent ? getRowIdWithSubComponents : getRowId,
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { defaultColumn } from 'react-table';
3
3
  import cx from 'classnames';
4
- import { Box, LineClamp, ShadowRoot } from '../../../utils/index.js';
4
+ import { Box, lineClamp, ShadowRoot } from '../../../utils/index.js';
5
5
  import { TableInstanceContext } from '../utils.js';
6
6
  export const DefaultCellRendererPropsChildren = React.createContext(void 0);
7
7
  export const DefaultCell = (props) => {
@@ -14,6 +14,10 @@ export const DefaultCell = (props) => {
14
14
  );
15
15
  let isCellRendererChildrenCustom =
16
16
  React.useContext(DefaultCellRendererPropsChildren) !== props.children;
17
+ let isDefaultTextCell =
18
+ 'string' == typeof props.cellProps.value &&
19
+ !isCustomCell &&
20
+ !isCellRendererChildrenCustom;
17
21
  let {
18
22
  cellElementProps: {
19
23
  className: cellElementClassName,
@@ -28,9 +32,7 @@ export const DefaultCell = (props) => {
28
32
  className,
29
33
  style,
30
34
  status,
31
- clamp = 'string' == typeof cellProps.value &&
32
- !isCustomCell &&
33
- !isCellRendererChildrenCustom,
35
+ clamp = isDefaultTextCell,
34
36
  ...rest
35
37
  } = props;
36
38
  let { key: cellElementKey, ...cellElementPropsRest } = cellElementProps;
@@ -61,12 +63,14 @@ export const DefaultCell = (props) => {
61
63
  React.createElement(
62
64
  TableCellContent,
63
65
  {
64
- shouldRenderWrapper: isCellRendererChildrenCustom,
66
+ shouldRenderWrapper: isDefaultTextCell,
65
67
  },
66
68
  clamp
67
69
  ? React.createElement(
68
- LineClamp,
69
- null,
70
+ 'div',
71
+ {
72
+ className: lineClamp.className,
73
+ },
70
74
  React.createElement('slot', null),
71
75
  )
72
76
  : React.createElement('slot', null),
@@ -106,15 +110,15 @@ if ('development' === process.env.NODE_ENV)
106
110
  let TableCellContent = (props) => {
107
111
  let { children, shouldRenderWrapper } = props;
108
112
  return shouldRenderWrapper
109
- ? children
110
- : React.createElement(
113
+ ? React.createElement(
111
114
  'div',
112
115
  {
113
116
  className: '_iui-table-cell-default-content',
114
117
  onClick: (e) => e.stopPropagation(),
115
118
  },
116
119
  children,
117
- );
120
+ )
121
+ : children;
118
122
  };
119
123
  let css = `
120
124
  ._iui-table-cell-default-content {
@@ -128,4 +132,5 @@ let css = `
128
132
  inset: -6px;
129
133
  z-index: -1;
130
134
  }
135
+ ${lineClamp.css}
131
136
  `;
@@ -28,6 +28,7 @@ type ActionColumnProps = {
28
28
  export declare const ActionColumn: <T extends Record<string, unknown>>({ columnManager, }?: ActionColumnProps) => {
29
29
  id: string;
30
30
  disableResizing: boolean;
31
+ canResize: boolean;
31
32
  disableGroupBy: boolean;
32
33
  minWidth: number;
33
34
  width: number;
@@ -12,6 +12,7 @@ let ACTION_CELL_ID = 'iui-table-action';
12
12
  export const ActionColumn = ({ columnManager = false } = {}) => ({
13
13
  id: ACTION_CELL_ID,
14
14
  disableResizing: true,
15
+ canResize: false,
15
16
  disableGroupBy: true,
16
17
  minWidth: 48,
17
18
  width: 48,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { CellProps, CellRendererProps, Row } from '../../../react-table/react-table.js';
2
+ import type { CellRendererProps, Row } from '../../../react-table/react-table.js';
3
3
  export declare const EXPANDER_CELL_ID = "iui-table-expander";
4
4
  /**
5
5
  * Expander column that adds sub-content expander column to the Table.
@@ -39,6 +39,6 @@ export declare const ExpanderColumn: <T extends Record<string, unknown>>(props?:
39
39
  maxWidth: number;
40
40
  columnClassName: string;
41
41
  cellClassName: string;
42
- Cell: (props: CellProps<T>) => React.JSX.Element | null;
42
+ Cell: () => null;
43
43
  cellRenderer: (props: CellRendererProps<T>) => React.JSX.Element;
44
44
  };
@@ -15,30 +15,35 @@ export const ExpanderColumn = (props = {}) => {
15
15
  maxWidth: 48,
16
16
  columnClassName: 'iui-slot',
17
17
  cellClassName: 'iui-slot',
18
- Cell: (props) => {
19
- let { row } = props;
20
- if (!subComponent?.(row)) return null;
18
+ Cell: () => null,
19
+ cellRenderer: (props) => {
20
+ let { row } = props.cellProps;
21
+ let children = subComponent?.(row)
22
+ ? React.createElement(
23
+ IconButton,
24
+ {
25
+ 'aria-label': 'Toggle expandable content',
26
+ className: 'iui-table-row-expander',
27
+ styleType: 'borderless',
28
+ size: 'small',
29
+ onClick: (e) => {
30
+ e.stopPropagation();
31
+ row.toggleRowExpanded();
32
+ },
33
+ disabled: isDisabled?.(row.original),
34
+ 'aria-expanded': row.isExpanded,
35
+ },
36
+ React.createElement(SvgChevronRight, null),
37
+ )
38
+ : null;
21
39
  return React.createElement(
22
- IconButton,
40
+ DefaultCell,
23
41
  {
24
- 'aria-label': 'Toggle expandable content',
25
- className: 'iui-table-row-expander',
26
- styleType: 'borderless',
27
- size: 'small',
28
- onClick: (e) => {
29
- e.stopPropagation();
30
- row.toggleRowExpanded();
31
- },
32
- disabled: isDisabled?.(props.row.original),
33
- 'aria-expanded': row.isExpanded,
42
+ ...props,
43
+ isDisabled: (rowData) => !!isDisabled?.(rowData),
34
44
  },
35
- React.createElement(SvgChevronRight, null),
45
+ children,
36
46
  );
37
47
  },
38
- cellRenderer: (props) =>
39
- React.createElement(DefaultCell, {
40
- ...props,
41
- isDisabled: (rowData) => !!isDisabled?.(rowData),
42
- }),
43
48
  };
44
49
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { CellProps, CellRendererProps, HeaderProps } from '../../../react-table/react-table.js';
2
+ import type { CellRendererProps, HeaderProps } from '../../../react-table/react-table.js';
3
3
  export declare const SELECTION_CELL_ID = "iui-table-checkbox-selector";
4
4
  /**
5
5
  * Selection column that adds selection checkbox column to the Table.
@@ -28,6 +28,6 @@ export declare const SelectionColumn: <T extends Record<string, unknown>>(props?
28
28
  columnClassName: string;
29
29
  cellClassName: string;
30
30
  Header: ({ getToggleAllRowsSelectedProps, toggleAllRowsSelected, rows, preFilteredFlatRows, state, }: HeaderProps<T>) => React.JSX.Element;
31
- Cell: ({ row, selectSubRows }: CellProps<T>) => React.JSX.Element;
31
+ Cell: () => null;
32
32
  cellRenderer: (props: CellRendererProps<T>) => React.JSX.Element;
33
33
  };
@@ -44,8 +44,10 @@ export const SelectionColumn = (props = {}) => {
44
44
  onChange: () => toggleAllRowsSelected(nextToggleState),
45
45
  });
46
46
  },
47
- Cell: ({ row, selectSubRows = true }) =>
48
- React.createElement(Checkbox, {
47
+ Cell: () => null,
48
+ cellRenderer: (props) => {
49
+ let { row, selectSubRows = true } = props.cellProps;
50
+ let children = React.createElement(Checkbox, {
49
51
  ...row.getToggleRowSelectedProps(),
50
52
  style: {},
51
53
  title: '',
@@ -65,11 +67,15 @@ export const SelectionColumn = (props = {}) => {
65
67
  );
66
68
  else row.toggleRowSelected(!row.isSelected);
67
69
  },
68
- }),
69
- cellRenderer: (props) =>
70
- React.createElement(DefaultCell, {
71
- ...props,
72
- isDisabled: (rowData) => !!isDisabled?.(rowData),
73
- }),
70
+ });
71
+ return React.createElement(
72
+ DefaultCell,
73
+ {
74
+ ...props,
75
+ isDisabled: (rowData) => !!isDisabled?.(rowData),
76
+ },
77
+ children,
78
+ );
79
+ },
74
80
  };
75
81
  };
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ExpanderColumn, EXPANDER_CELL_ID } from '../columns/index.js';
3
+ import { DefaultCell } from '../cells/DefaultCell.js';
3
4
  export const useExpanderCell =
4
5
  (subComponent, expanderCell, isRowDisabled) => (hooks) => {
5
6
  if (!subComponent) return;
@@ -13,14 +14,17 @@ export const useExpanderCell =
13
14
  return [
14
15
  {
15
16
  ...expanderColumn,
16
- Cell: expanderCell
17
- ? (cellProps) =>
17
+ cellRenderer: expanderCell
18
+ ? (props) =>
18
19
  React.createElement(
19
- React.Fragment,
20
- null,
21
- expanderCell(cellProps),
20
+ DefaultCell,
21
+ {
22
+ ...props,
23
+ isDisabled: (rowData) => !!isRowDisabled?.(rowData),
24
+ },
25
+ expanderCell(props.cellProps),
22
26
  )
23
- : expanderColumn.Cell,
27
+ : expanderColumn.cellRenderer,
24
28
  },
25
29
  ...columns,
26
30
  ];
@@ -42,9 +42,12 @@ type TabsWrapperOwnProps = {
42
42
  */
43
43
  value?: string;
44
44
  /**
45
- * Function that gets called when active tab is changed.
45
+ * Function that gets called when active tab *changes* (uncontrolled mode) or should *change* (controlled mode).
46
46
  *
47
47
  * Should be used alongside `value` prop.
48
+ *
49
+ * If need to listen to each tab click, use `onClick` prop on `Tabs.Tab`.
50
+ * Similarly, for each focus, use `onFocus` prop on `Tabs.Tab`.
48
51
  */
49
52
  onValueChange?: (value: string) => void;
50
53
  /**
@@ -1,6 +1,11 @@
1
1
  import cx from 'classnames';
2
2
  import * as React from 'react';
3
- import { SvgCloseSmall, Box, ButtonBase } from '../../utils/index.js';
3
+ import {
4
+ SvgCloseSmall,
5
+ Box,
6
+ ButtonBase,
7
+ mergeEventHandlers,
8
+ } from '../../utils/index.js';
4
9
  import { IconButton } from '../Buttons/IconButton.js';
5
10
  import { LinkAction, LinkBox } from '../LinkAction/LinkAction.js';
6
11
  export const Tag = React.forwardRef((props, forwardedRef) => {
@@ -35,8 +40,11 @@ export const Tag = React.forwardRef((props, forwardedRef) => {
35
40
  Box,
36
41
  {
37
42
  as: shouldUseLinkAction ? LinkAction : 'span',
38
- onClick: shouldUseLinkAction ? onClick : void 0,
39
43
  ...labelProps,
44
+ onClick: mergeEventHandlers(
45
+ labelProps?.onClick,
46
+ shouldUseLinkAction ? onClick : void 0,
47
+ ),
40
48
  className: cx('iui-tag-label', labelProps?.className),
41
49
  },
42
50
  children,
@@ -48,9 +56,9 @@ export const Tag = React.forwardRef((props, forwardedRef) => {
48
56
  {
49
57
  styleType: 'borderless',
50
58
  size: 'small',
51
- onClick: onRemove,
52
59
  'aria-label': 'Delete tag',
53
60
  ...removeButtonProps,
61
+ onClick: mergeEventHandlers(removeButtonProps?.onClick, onRemove),
54
62
  className: cx('iui-tag-button', removeButtonProps?.className),
55
63
  },
56
64
  React.createElement(SvgCloseSmall, {
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
- import type { FutureOptions, ThemeOptions, ThemeType } from './ThemeProvider.js';
2
+ import type { ThemeOptions, ThemeType } from './ThemeProvider.js';
3
3
  export declare const ThemeContext: React.Context<{
4
4
  theme?: ThemeType;
5
5
  themeOptions?: ThemeOptions;
6
6
  portalContainer?: HTMLElement | null;
7
- future?: FutureOptions;
8
7
  } | undefined>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
2
+ import type { FutureOptions, PolymorphicForwardRefComponent } from '../../utils/index.js';
3
3
  export type ThemeOptions = {
4
4
  /**
5
5
  * Whether to apply high-contrast versions of light and dark themes.
@@ -7,18 +7,6 @@ export type ThemeOptions = {
7
7
  */
8
8
  highContrast?: boolean;
9
9
  };
10
- export type FutureOptions = {
11
- /**
12
- * @alpha
13
- *
14
- * If enabled, the theme resembles the future iTwinUI version's theme (including alphas) *whenever possible*.
15
- *
16
- * This is useful in making apps looks like future versions of iTwinUI to help with incremental adoption.
17
- *
18
- * **NOTE**: Since this is a theme bridge to *future* versions, the theme could have breaking changes.
19
- */
20
- themeBridge?: boolean;
21
- };
22
10
  export type ThemeType = 'light' | 'dark' | 'os';
23
11
  type RootProps = {
24
12
  /**
@@ -53,12 +41,8 @@ type RootProps = {
53
41
  */
54
42
  applyBackground?: boolean;
55
43
  };
56
- /**
57
- * Options to help with early adoption of features from future versions.
58
- */
59
- future?: FutureOptions;
60
44
  };
61
- type ThemeProviderOwnProps = Pick<RootProps, 'theme' | 'future'> & {
45
+ type ThemeProviderOwnProps = Pick<RootProps, 'theme'> & {
62
46
  themeOptions?: RootProps['themeOptions'];
63
47
  children: Required<React.ReactNode>;
64
48
  /**
@@ -89,6 +73,12 @@ type ThemeProviderOwnProps = Pick<RootProps, 'theme' | 'future'> & {
89
73
  * If true or false is passed, it will override the default behavior.
90
74
  */
91
75
  includeCss?: boolean;
76
+ /**
77
+ * Options to help with early adoption of features from future versions.
78
+ *
79
+ * All future options will be automatically inherited across nested ThemeProviders, unless explicitly overridden.
80
+ */
81
+ future?: true | FutureOptions;
92
82
  };
93
83
  /**
94
84
  * This component provides global state and applies theme to the entire tree
@@ -13,6 +13,8 @@ import {
13
13
  useHydration,
14
14
  PortalContainerContext,
15
15
  useId,
16
+ FutureFlagsProvider,
17
+ useFutureFlag,
16
18
  } from '../../utils/index.js';
17
19
  import { ThemeContext } from './ThemeContext.js';
18
20
  import { ToastProvider, Toaster } from '../Toast/Toaster.js';
@@ -20,14 +22,14 @@ import { meta } from '../../utils/meta.js';
20
22
  let versionWithoutDots = meta.version.replace(/\./g, '');
21
23
  let OwnerDocumentContext = React.createContext(void 0);
22
24
  export const ThemeProvider = React.forwardRef((props, forwardedRef) => {
23
- var _themeOptions, _themeOptions1, _future;
25
+ var _themeOptions, _themeOptions1;
24
26
  let {
25
27
  theme: themeProp = 'inherit',
26
28
  children,
27
29
  themeOptions = {},
28
30
  portalContainer: portalContainerProp,
29
31
  includeCss = 'inherit' === themeProp,
30
- future = {},
32
+ future: futureProp = {},
31
33
  ...rest
32
34
  } = props;
33
35
  useInertPolyfill();
@@ -39,62 +41,67 @@ export const ThemeProvider = React.forwardRef((props, forwardedRef) => {
39
41
  (_themeOptions1 = themeOptions).highContrast ??
40
42
  (_themeOptions1.highContrast =
41
43
  'inherit' === themeProp ? parent.highContrast : void 0);
42
- (_future = future).themeBridge ??
43
- (_future.themeBridge = parent.context?.future?.themeBridge);
44
44
  let portalContainerFromParent = React.useContext(PortalContainerContext);
45
- let contextValue = React.useMemo(
45
+ let themeContextValue = React.useMemo(
46
46
  () => ({
47
47
  theme,
48
48
  themeOptions,
49
- future,
50
49
  }),
51
- [theme, JSON.stringify(themeOptions), JSON.stringify(future)],
50
+ [theme, JSON.stringify(themeOptions)],
52
51
  );
53
52
  let [portalContainer, setPortalContainer] = React.useState(
54
53
  portalContainerProp || null,
55
54
  );
56
55
  return React.createElement(
57
- PortalContainerContext.Provider,
56
+ FutureFlagsProvider,
58
57
  {
59
- value: portalContainer,
58
+ value: futureProp,
60
59
  },
61
60
  React.createElement(
62
- HydrationProvider,
63
- null,
61
+ PortalContainerContext.Provider,
62
+ {
63
+ value: portalContainer,
64
+ },
64
65
  React.createElement(
65
- ThemeContext.Provider,
66
- {
67
- value: contextValue,
68
- },
66
+ HydrationProvider,
67
+ null,
69
68
  React.createElement(
70
- ToastProvider,
69
+ ThemeContext.Provider,
71
70
  {
72
- inherit: 'inherit' === themeProp && !portalContainerProp,
71
+ value: themeContextValue,
73
72
  },
74
- includeCss && rootElement
75
- ? React.createElement(FallbackStyles, {
76
- root: rootElement,
77
- })
78
- : null,
79
73
  React.createElement(
80
- MainRoot,
74
+ ToastProvider,
81
75
  {
82
- theme: theme,
83
- themeOptions: themeOptions,
84
- future: future,
85
- ref: useMergedRefs(forwardedRef, setRootElement, useIuiDebugRef),
86
- ...rest,
76
+ inherit: 'inherit' === themeProp && !portalContainerProp,
87
77
  },
88
- children,
89
- React.createElement(PortalContainer, {
90
- theme: theme,
91
- themeOptions: themeOptions,
92
- future: future,
93
- portalContainerProp: portalContainerProp,
94
- portalContainerFromParent: portalContainerFromParent,
95
- setPortalContainer: setPortalContainer,
96
- isInheritingTheme: 'inherit' === themeProp,
97
- }),
78
+ includeCss && rootElement
79
+ ? React.createElement(FallbackStyles, {
80
+ root: rootElement,
81
+ })
82
+ : null,
83
+ React.createElement(
84
+ MainRoot,
85
+ {
86
+ theme: theme,
87
+ themeOptions: themeOptions,
88
+ ref: useMergedRefs(
89
+ forwardedRef,
90
+ setRootElement,
91
+ useIuiDebugRef,
92
+ ),
93
+ ...rest,
94
+ },
95
+ children,
96
+ React.createElement(PortalContainer, {
97
+ theme: theme,
98
+ themeOptions: themeOptions,
99
+ portalContainerProp: portalContainerProp,
100
+ portalContainerFromParent: portalContainerFromParent,
101
+ setPortalContainer: setPortalContainer,
102
+ isInheritingTheme: 'inherit' === themeProp,
103
+ }),
104
+ ),
98
105
  ),
99
106
  ),
100
107
  ),
@@ -124,12 +131,13 @@ let MainRoot = React.forwardRef((props, forwardedRef) => {
124
131
  );
125
132
  });
126
133
  let Root = React.forwardRef((props, forwardedRef) => {
127
- let { theme, children, themeOptions, className, future, ...rest } = props;
134
+ let { theme, children, themeOptions, className, ...rest } = props;
128
135
  let prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
129
136
  let prefersHighContrast = useMediaQuery('(prefers-contrast: more)');
130
137
  let shouldApplyDark = 'dark' === theme || ('os' === theme && prefersDark);
131
138
  let shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
132
139
  let shouldApplyBackground = themeOptions?.applyBackground;
140
+ let themeBridge = useFutureFlag('themeBridge');
133
141
  return React.createElement(
134
142
  Box,
135
143
  {
@@ -142,7 +150,7 @@ let Root = React.forwardRef((props, forwardedRef) => {
142
150
  ),
143
151
  'data-iui-theme': shouldApplyDark ? 'dark' : 'light',
144
152
  'data-iui-contrast': shouldApplyHC ? 'high' : 'default',
145
- 'data-iui-bridge': future?.themeBridge ? true : void 0,
153
+ 'data-iui-bridge': themeBridge ? 'true' : void 0,
146
154
  ref: forwardedRef,
147
155
  ...rest,
148
156
  },
@@ -191,7 +199,6 @@ let PortalContainer = React.memo(
191
199
  isInheritingTheme,
192
200
  theme,
193
201
  themeOptions,
194
- future,
195
202
  }) => {
196
203
  let ownerDocument = React.useContext(OwnerDocumentContext);
197
204
  let shouldSetupPortalContainer =
@@ -223,7 +230,6 @@ let PortalContainer = React.memo(
223
230
  ...themeOptions,
224
231
  applyBackground: false,
225
232
  },
226
- future: future,
227
233
  'data-iui-portal': true,
228
234
  style: {
229
235
  display: 'contents',