@itwin/itwinui-react 3.15.5 → 3.16.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 (135) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +2 -2
  3. package/DEV-cjs/core/Checkbox/Checkbox.js +4 -6
  4. package/DEV-cjs/core/ComboBox/ComboBox.js +10 -6
  5. package/DEV-cjs/core/DatePicker/DatePicker.js +9 -1
  6. package/DEV-cjs/core/Dialog/Dialog.js +1 -1
  7. package/DEV-cjs/core/Panels/Panels.js +319 -0
  8. package/DEV-cjs/core/Panels/helpers.js +62 -0
  9. package/DEV-cjs/core/Radio/Radio.js +4 -6
  10. package/DEV-cjs/core/RadioTiles/RadioTileGroup.js +9 -2
  11. package/DEV-cjs/core/Select/SelectTag.js +9 -11
  12. package/DEV-cjs/core/Select/SelectTagContainer.js +2 -2
  13. package/DEV-cjs/core/Stepper/Stepper.js +1 -0
  14. package/DEV-cjs/core/Stepper/StepperStep.js +2 -1
  15. package/DEV-cjs/core/Table/Table.js +3 -4
  16. package/DEV-cjs/core/Table/TablePaginator.js +15 -3
  17. package/DEV-cjs/core/Table/actionHandlers/selectHandler.js +10 -7
  18. package/DEV-cjs/core/Table/columns/selectionColumn.js +6 -1
  19. package/DEV-cjs/core/Tree/Tree.js +1 -0
  20. package/DEV-cjs/index.js +4 -0
  21. package/DEV-cjs/styles.js +1 -1
  22. package/DEV-cjs/utils/components/MiddleTextTruncation.js +22 -4
  23. package/DEV-cjs/utils/components/OverflowContainer.js +170 -27
  24. package/DEV-cjs/utils/hooks/index.js +1 -1
  25. package/DEV-cjs/utils/hooks/useInstance.js +38 -0
  26. package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
  27. package/DEV-esm/core/Checkbox/Checkbox.js +5 -10
  28. package/DEV-esm/core/ComboBox/ComboBox.js +10 -6
  29. package/DEV-esm/core/DatePicker/DatePicker.js +11 -1
  30. package/DEV-esm/core/Dialog/Dialog.js +1 -1
  31. package/DEV-esm/core/Panels/Panels.js +301 -0
  32. package/DEV-esm/core/Panels/helpers.js +42 -0
  33. package/DEV-esm/core/Radio/Radio.js +4 -9
  34. package/DEV-esm/core/RadioTiles/RadioTileGroup.js +8 -2
  35. package/DEV-esm/core/Select/SelectTag.js +9 -11
  36. package/DEV-esm/core/Select/SelectTagContainer.js +2 -2
  37. package/DEV-esm/core/Stepper/Stepper.js +1 -0
  38. package/DEV-esm/core/Stepper/StepperStep.js +2 -1
  39. package/DEV-esm/core/Table/Table.js +1 -5
  40. package/DEV-esm/core/Table/TablePaginator.js +16 -3
  41. package/DEV-esm/core/Table/actionHandlers/selectHandler.js +10 -7
  42. package/DEV-esm/core/Table/columns/selectionColumn.js +6 -1
  43. package/DEV-esm/core/Tree/Tree.js +1 -0
  44. package/DEV-esm/index.js +1 -0
  45. package/DEV-esm/styles.js +1 -1
  46. package/DEV-esm/utils/components/MiddleTextTruncation.js +22 -4
  47. package/DEV-esm/utils/components/OverflowContainer.js +143 -4
  48. package/DEV-esm/utils/hooks/index.js +1 -1
  49. package/DEV-esm/utils/hooks/useInstance.js +18 -0
  50. package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -2
  51. package/cjs/core/Checkbox/Checkbox.js +4 -6
  52. package/cjs/core/ComboBox/ComboBox.d.ts +13 -0
  53. package/cjs/core/ComboBox/ComboBox.js +10 -6
  54. package/cjs/core/DatePicker/DatePicker.d.ts +2 -2
  55. package/cjs/core/DatePicker/DatePicker.js +2 -1
  56. package/cjs/core/Dialog/Dialog.js +1 -1
  57. package/cjs/core/Dialog/DialogContext.d.ts +6 -2
  58. package/cjs/core/Panels/Panels.d.ts +174 -0
  59. package/cjs/core/Panels/Panels.js +312 -0
  60. package/cjs/core/Panels/helpers.d.ts +23 -0
  61. package/cjs/core/Panels/helpers.js +61 -0
  62. package/cjs/core/Radio/Radio.js +4 -6
  63. package/cjs/core/RadioTiles/RadioTileGroup.d.ts +3 -1
  64. package/cjs/core/RadioTiles/RadioTileGroup.js +9 -2
  65. package/cjs/core/Select/SelectTag.d.ts +3 -1
  66. package/cjs/core/Select/SelectTag.js +9 -11
  67. package/cjs/core/Select/SelectTagContainer.js +2 -2
  68. package/cjs/core/Stepper/Stepper.d.ts +4 -0
  69. package/cjs/core/Stepper/Stepper.js +1 -0
  70. package/cjs/core/Stepper/StepperStep.d.ts +4 -0
  71. package/cjs/core/Stepper/StepperStep.js +2 -1
  72. package/cjs/core/Table/Table.d.ts +1 -0
  73. package/cjs/core/Table/Table.js +3 -4
  74. package/cjs/core/Table/TablePaginator.js +15 -3
  75. package/cjs/core/Table/actionHandlers/selectHandler.js +10 -7
  76. package/cjs/core/Table/columns/selectionColumn.js +6 -1
  77. package/cjs/core/Tree/Tree.js +1 -0
  78. package/cjs/index.d.ts +1 -0
  79. package/cjs/index.js +4 -0
  80. package/cjs/styles.js +1 -1
  81. package/cjs/utils/components/MiddleTextTruncation.d.ts +5 -7
  82. package/cjs/utils/components/MiddleTextTruncation.js +22 -4
  83. package/cjs/utils/components/OverflowContainer.d.ts +1 -0
  84. package/cjs/utils/components/OverflowContainer.js +170 -27
  85. package/cjs/utils/hooks/index.d.ts +1 -1
  86. package/cjs/utils/hooks/index.js +1 -1
  87. package/cjs/utils/hooks/useInstance.d.ts +22 -0
  88. package/cjs/utils/hooks/useInstance.js +38 -0
  89. package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
  90. package/esm/core/Checkbox/Checkbox.js +5 -10
  91. package/esm/core/ComboBox/ComboBox.d.ts +13 -0
  92. package/esm/core/ComboBox/ComboBox.js +10 -6
  93. package/esm/core/DatePicker/DatePicker.d.ts +2 -2
  94. package/esm/core/DatePicker/DatePicker.js +4 -1
  95. package/esm/core/Dialog/Dialog.js +1 -1
  96. package/esm/core/Dialog/DialogContext.d.ts +6 -2
  97. package/esm/core/Panels/Panels.d.ts +174 -0
  98. package/esm/core/Panels/Panels.js +294 -0
  99. package/esm/core/Panels/helpers.d.ts +23 -0
  100. package/esm/core/Panels/helpers.js +41 -0
  101. package/esm/core/Radio/Radio.js +4 -9
  102. package/esm/core/RadioTiles/RadioTileGroup.d.ts +3 -1
  103. package/esm/core/RadioTiles/RadioTileGroup.js +8 -2
  104. package/esm/core/Select/SelectTag.d.ts +3 -1
  105. package/esm/core/Select/SelectTag.js +9 -11
  106. package/esm/core/Select/SelectTagContainer.js +2 -2
  107. package/esm/core/Stepper/Stepper.d.ts +4 -0
  108. package/esm/core/Stepper/Stepper.js +1 -0
  109. package/esm/core/Stepper/StepperStep.d.ts +4 -0
  110. package/esm/core/Stepper/StepperStep.js +2 -1
  111. package/esm/core/Table/Table.d.ts +1 -0
  112. package/esm/core/Table/Table.js +1 -5
  113. package/esm/core/Table/TablePaginator.js +16 -3
  114. package/esm/core/Table/actionHandlers/selectHandler.js +10 -7
  115. package/esm/core/Table/columns/selectionColumn.js +6 -1
  116. package/esm/core/Tree/Tree.js +1 -0
  117. package/esm/index.d.ts +1 -0
  118. package/esm/index.js +1 -0
  119. package/esm/styles.js +1 -1
  120. package/esm/utils/components/MiddleTextTruncation.d.ts +5 -7
  121. package/esm/utils/components/MiddleTextTruncation.js +22 -4
  122. package/esm/utils/components/OverflowContainer.d.ts +1 -0
  123. package/esm/utils/components/OverflowContainer.js +143 -4
  124. package/esm/utils/hooks/index.d.ts +1 -1
  125. package/esm/utils/hooks/index.js +1 -1
  126. package/esm/utils/hooks/useInstance.d.ts +22 -0
  127. package/esm/utils/hooks/useInstance.js +18 -0
  128. package/package.json +2 -2
  129. package/styles.css +8 -8
  130. package/DEV-cjs/utils/hooks/useOverflow.js +0 -76
  131. package/DEV-esm/utils/hooks/useOverflow.js +0 -63
  132. package/cjs/utils/hooks/useOverflow.d.ts +0 -23
  133. package/cjs/utils/hooks/useOverflow.js +0 -76
  134. package/esm/utils/hooks/useOverflow.d.ts +0 -23
  135. package/esm/utils/hooks/useOverflow.js +0 -63
@@ -0,0 +1,301 @@
1
+ import * as React from 'react';
2
+ import * as ReactDOM from 'react-dom';
3
+ import {
4
+ Box,
5
+ cloneElementWithRef,
6
+ mergeEventHandlers,
7
+ SvgChevronLeft,
8
+ useInstance,
9
+ useMergedRefs,
10
+ useSafeContext,
11
+ useMediaQuery,
12
+ useWarningLogger,
13
+ useLayoutEffect,
14
+ useLatestRef,
15
+ } from '../../utils/index.js';
16
+ import { IconButton } from '../Buttons/IconButton.js';
17
+ import { Flex } from '../Flex/Flex.js';
18
+ import { Text } from '../Typography/Text.js';
19
+ import cx from 'classnames';
20
+ import { PanelsInstanceContext, PanelsInstanceProvider } from './helpers.js';
21
+ export const PanelsWrapper = React.forwardRef((props, forwardedRef) => {
22
+ let {
23
+ children,
24
+ className,
25
+ onActiveIdChange: onActiveIdChangeProp,
26
+ instance,
27
+ ...rest
28
+ } = props;
29
+ let onActiveIdChange = useLatestRef(onActiveIdChangeProp);
30
+ let ref = React.useRef(null);
31
+ let [activePanelId, setActivePanelId] = React.useState(void 0);
32
+ let [triggers, setTriggers] = React.useState({});
33
+ let panels = React.useRef(new Set());
34
+ let [shouldFocus, setShouldFocus] = React.useState(void 0);
35
+ let motionOk = useMediaQuery('(prefers-reduced-motion: no-preference)');
36
+ let changeActivePanel = React.useCallback(
37
+ (newActiveId) => {
38
+ if (!panels.current.has(newActiveId) || newActiveId === activePanelId)
39
+ return;
40
+ ReactDOM.flushSync(() => setActivePanelId(newActiveId));
41
+ onActiveIdChange.current?.(newActiveId);
42
+ ref.current?.ownerDocument.getElementById(newActiveId)?.scrollIntoView({
43
+ block: 'nearest',
44
+ inline: 'center',
45
+ behavior: motionOk ? 'smooth' : 'instant',
46
+ });
47
+ },
48
+ [activePanelId, motionOk, onActiveIdChange],
49
+ );
50
+ return React.createElement(
51
+ PanelsWrapperContext.Provider,
52
+ {
53
+ value: React.useMemo(
54
+ () => ({
55
+ activePanelId,
56
+ setActivePanelId,
57
+ changeActivePanel,
58
+ triggers,
59
+ setTriggers,
60
+ shouldFocus,
61
+ setShouldFocus,
62
+ panels,
63
+ }),
64
+ [
65
+ activePanelId,
66
+ changeActivePanel,
67
+ setActivePanelId,
68
+ setTriggers,
69
+ shouldFocus,
70
+ triggers,
71
+ ],
72
+ ),
73
+ },
74
+ React.createElement(
75
+ PanelsInstanceProvider,
76
+ {
77
+ instance: instance,
78
+ },
79
+ React.createElement(
80
+ Box,
81
+ {
82
+ ref: useMergedRefs(ref, forwardedRef),
83
+ ...rest,
84
+ className: cx('iui-panel-wrapper', className),
85
+ },
86
+ children,
87
+ ),
88
+ ),
89
+ );
90
+ });
91
+ PanelsWrapper.displayName = 'Panels.Wrapper';
92
+ export const PanelsWrapperContext = React.createContext(void 0);
93
+ PanelsWrapperContext.displayName = 'PanelsWrapperContext';
94
+ let Panel = React.forwardRef((props, forwardedRef) => {
95
+ let { id, children, className, ...rest } = props;
96
+ let { activePanelId, triggers, panels, setActivePanelId } =
97
+ useSafeContext(PanelsWrapperContext);
98
+ let associatedTrigger = React.useMemo(() => triggers[id], [id, triggers]);
99
+ let previousActivePanelId = useDelayed(activePanelId) || activePanelId;
100
+ let isMounted = [activePanelId, previousActivePanelId].includes(id);
101
+ let isTransitioning =
102
+ activePanelId === id && activePanelId !== previousActivePanelId;
103
+ let isInert = previousActivePanelId === id && activePanelId !== id;
104
+ useLayoutEffect(() => {
105
+ let isFirstPanel = null == activePanelId && 0 === panels.current.size;
106
+ if (isFirstPanel) setActivePanelId(id);
107
+ let panelsCurrent = panels.current;
108
+ if (!panelsCurrent.has(id)) panelsCurrent.add(id);
109
+ return () => {
110
+ panelsCurrent.delete(id);
111
+ };
112
+ }, [activePanelId, id, panels, setActivePanelId]);
113
+ return React.createElement(
114
+ PanelContext.Provider,
115
+ {
116
+ value: React.useMemo(
117
+ () => ({
118
+ id,
119
+ associatedTrigger,
120
+ }),
121
+ [associatedTrigger, id],
122
+ ),
123
+ },
124
+ isMounted &&
125
+ React.createElement(
126
+ Box,
127
+ {
128
+ ref: forwardedRef,
129
+ id: id,
130
+ className: cx('iui-panel', className),
131
+ 'aria-labelledby': `${id}-header-title`,
132
+ role: 'group',
133
+ inert: isInert ? '' : void 0,
134
+ 'data-iui-transitioning': isTransitioning ? 'true' : void 0,
135
+ ...rest,
136
+ },
137
+ children,
138
+ ),
139
+ );
140
+ });
141
+ Panel.displayName = 'Panels.Panel';
142
+ let PanelContext = React.createContext(void 0);
143
+ PanelContext.displayName = 'PanelContext';
144
+ let PanelTrigger = (props) => {
145
+ let { children, for: forProp } = props;
146
+ let {
147
+ changeActivePanel,
148
+ triggers,
149
+ setTriggers,
150
+ activePanelId: activePanel,
151
+ shouldFocus,
152
+ setShouldFocus,
153
+ panels,
154
+ } = useSafeContext(PanelsWrapperContext);
155
+ let { id: panelId } = useSafeContext(PanelContext);
156
+ let fallbackId = React.useId();
157
+ let triggerId = children.props.id || fallbackId;
158
+ let onClick = React.useCallback(() => {
159
+ if (null == activePanel) return;
160
+ setShouldFocus({
161
+ fromPanelId: activePanel,
162
+ toPanelId: forProp,
163
+ direction: 'forward',
164
+ });
165
+ changeActivePanel?.(forProp);
166
+ }, [activePanel, changeActivePanel, forProp, setShouldFocus]);
167
+ let focusRef = React.useCallback(
168
+ (el) => {
169
+ if (
170
+ shouldFocus?.direction === 'backward' &&
171
+ shouldFocus?.toPanelId === panelId &&
172
+ shouldFocus?.fromPanelId === forProp
173
+ ) {
174
+ el?.focus({
175
+ preventScroll: true,
176
+ });
177
+ setShouldFocus(void 0);
178
+ }
179
+ },
180
+ [forProp, panelId, setShouldFocus, shouldFocus],
181
+ );
182
+ let logWarning = useWarningLogger();
183
+ React.useEffect(() => {
184
+ if (!panels.current.has(forProp))
185
+ logWarning(
186
+ `Panels.Trigger's \`for\` prop ("${forProp}") corresponds to no Panel.`,
187
+ );
188
+ }, [forProp, logWarning, panels, triggers]);
189
+ React.useEffect(() => {
190
+ setTriggers((oldTriggers) => {
191
+ let triggersMatch = oldTriggers[forProp];
192
+ if (
193
+ null == triggersMatch ||
194
+ panelId !== triggersMatch.panelId ||
195
+ triggerId !== triggersMatch.triggerId
196
+ )
197
+ return {
198
+ ...oldTriggers,
199
+ [forProp]: {
200
+ panelId,
201
+ triggerId,
202
+ },
203
+ };
204
+ return oldTriggers;
205
+ });
206
+ }, [forProp, panelId, setTriggers, triggerId]);
207
+ return cloneElementWithRef(children, (children) => ({
208
+ ...children.props,
209
+ id: triggerId,
210
+ ref: focusRef,
211
+ onClick: mergeEventHandlers(children.props.onClick, onClick),
212
+ 'aria-expanded': activePanel === forProp,
213
+ 'aria-controls': forProp,
214
+ }));
215
+ };
216
+ PanelTrigger.displayName = 'Panels.Trigger';
217
+ let PanelHeader = React.forwardRef((props, forwardedRef) => {
218
+ let { titleProps, children, ...rest } = props;
219
+ let { shouldFocus, setShouldFocus } = useSafeContext(PanelsWrapperContext);
220
+ let { id: panelId, associatedTrigger: panelAssociatedTrigger } =
221
+ useSafeContext(PanelContext);
222
+ let focusRef = React.useCallback(
223
+ (el) => {
224
+ if (
225
+ shouldFocus?.direction === 'forward' &&
226
+ shouldFocus.toPanelId === panelId
227
+ ) {
228
+ el?.focus({
229
+ preventScroll: true,
230
+ });
231
+ setShouldFocus(void 0);
232
+ }
233
+ },
234
+ [panelId, setShouldFocus, shouldFocus?.direction, shouldFocus?.toPanelId],
235
+ );
236
+ return React.createElement(
237
+ Flex,
238
+ {
239
+ ref: forwardedRef,
240
+ ...rest,
241
+ },
242
+ panelAssociatedTrigger && React.createElement(PanelBackButton, null),
243
+ React.createElement(
244
+ Text,
245
+ {
246
+ id: `${panelId}-header-title`,
247
+ as: 'h2',
248
+ tabIndex: -1,
249
+ ref: focusRef,
250
+ ...titleProps,
251
+ },
252
+ children,
253
+ ),
254
+ );
255
+ });
256
+ PanelHeader.displayName = 'Panels.Header';
257
+ let PanelBackButton = React.forwardRef((props, forwardedRef) => {
258
+ let { children, onClick, ...rest } = props;
259
+ let { instance: panelInstance } = useSafeContext(PanelsInstanceContext);
260
+ return React.createElement(
261
+ IconButton,
262
+ {
263
+ ref: forwardedRef,
264
+ 'aria-label': 'Previous panel',
265
+ styleType: 'borderless',
266
+ size: 'small',
267
+ 'data-iui-shift': 'left',
268
+ ...rest,
269
+ onClick: mergeEventHandlers(
270
+ React.useCallback(() => panelInstance?.goBack(), [panelInstance]),
271
+ onClick,
272
+ ),
273
+ },
274
+ children || React.createElement(SvgChevronLeft, null),
275
+ );
276
+ });
277
+ PanelBackButton.displayName = 'Panels.BackButton';
278
+ export const Panels = {
279
+ Wrapper: PanelsWrapper,
280
+ Panel,
281
+ Trigger: PanelTrigger,
282
+ Header: PanelHeader,
283
+ useInstance: useInstance,
284
+ };
285
+ function useDelayed(
286
+ value,
287
+ { delay } = {
288
+ delay: 500,
289
+ },
290
+ ) {
291
+ let [delayed, setDelayed] = React.useState(void 0);
292
+ let timeout = React.useRef(void 0);
293
+ React.useEffect(() => {
294
+ if (0 === delay) setDelayed(value);
295
+ else timeout.current = setTimeout(() => setDelayed(value), delay);
296
+ return () => {
297
+ clearTimeout(timeout.current);
298
+ };
299
+ }, [value, delay]);
300
+ return delayed;
301
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { useSafeContext, useSynchronizeInstance } from '../../utils/index.js';
3
+ import { Panels, PanelsWrapperContext } from './Panels.js';
4
+ export const PanelsInstanceContext = React.createContext(void 0);
5
+ PanelsInstanceContext.displayName = 'PanelsInstanceContext';
6
+ export const PanelsInstanceProvider = (props) => {
7
+ let { children, instance: instanceProp } = props;
8
+ let instanceBackup = Panels.useInstance();
9
+ let instance = instanceProp || instanceBackup;
10
+ let { activePanelId, changeActivePanel, triggers, setShouldFocus } =
11
+ useSafeContext(PanelsWrapperContext);
12
+ let goBack = React.useCallback(async () => {
13
+ if (null == activePanelId) return;
14
+ let trigger = triggers[activePanelId];
15
+ if (null != trigger.triggerId) {
16
+ setShouldFocus({
17
+ fromPanelId: activePanelId,
18
+ toPanelId: trigger.panelId,
19
+ direction: 'backward',
20
+ });
21
+ changeActivePanel(trigger.panelId);
22
+ }
23
+ }, [activePanelId, changeActivePanel, setShouldFocus, triggers]);
24
+ useSynchronizeInstance(
25
+ instance,
26
+ React.useMemo(
27
+ () => ({
28
+ goBack,
29
+ }),
30
+ [goBack],
31
+ ),
32
+ );
33
+ return React.createElement(
34
+ PanelsInstanceContext.Provider,
35
+ {
36
+ value: {
37
+ instance,
38
+ },
39
+ },
40
+ children,
41
+ );
42
+ };
@@ -16,7 +16,7 @@ export const Radio = React.forwardRef((props, ref) => {
16
16
  let refs = useMergedRefs(inputElementRef, ref);
17
17
  let radio = React.createElement(Box, {
18
18
  as: 'input',
19
- className: cx('iui-radio', className),
19
+ className: cx('iui-checkbox', 'iui-radio', className),
20
20
  style: style,
21
21
  disabled: disabled,
22
22
  type: 'radio',
@@ -29,14 +29,9 @@ export const Radio = React.forwardRef((props, ref) => {
29
29
  {
30
30
  as: 'label',
31
31
  ...wrapperProps,
32
- className: cx(
33
- 'iui-radio-wrapper',
34
- {
35
- 'iui-disabled': disabled,
36
- [`iui-${status}`]: !!status,
37
- },
38
- wrapperProps?.className,
39
- ),
32
+ className: cx('iui-checkbox-wrapper', wrapperProps?.className),
33
+ 'data-iui-status': status,
34
+ 'data-iui-disabled': disabled ? 'true' : void 0,
40
35
  },
41
36
  radio,
42
37
  label &&
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { InputGroup } from '../InputGroup/InputGroup.js';
3
3
  import { Box } from '../../utils/index.js';
4
+ import cx from 'classnames';
4
5
  export const RadioTileGroup = React.forwardRef((props, forwardedRef) => {
5
- let { children, label, ...rest } = props;
6
+ let { children, label, tileContainerProps, ...rest } = props;
6
7
  return React.createElement(
7
8
  InputGroup,
8
9
  {
@@ -13,7 +14,12 @@ export const RadioTileGroup = React.forwardRef((props, forwardedRef) => {
13
14
  React.createElement(
14
15
  Box,
15
16
  {
16
- className: 'iui-radio-tile-container',
17
+ as: 'div',
18
+ ...tileContainerProps,
19
+ className: cx(
20
+ 'iui-radio-tile-container',
21
+ tileContainerProps?.className,
22
+ ),
17
23
  },
18
24
  children,
19
25
  ),
@@ -1,23 +1,21 @@
1
1
  import cx from 'classnames';
2
2
  import * as React from 'react';
3
- import { Box } from '../../utils/index.js';
3
+ import { Tag } from '../Tag/Tag.js';
4
4
  export const SelectTag = React.forwardRef((props, forwardedRef) => {
5
5
  let { className, label, ...rest } = props;
6
6
  return React.createElement(
7
- Box,
7
+ Tag,
8
8
  {
9
- as: 'span',
10
9
  className: cx('iui-select-tag', className),
10
+ labelProps: {
11
+ className: 'iui-select-tag-label',
12
+ },
13
+ removeButtonProps: {
14
+ className: 'iui-select-tag-button',
15
+ },
11
16
  ref: forwardedRef,
12
17
  ...rest,
13
18
  },
14
- React.createElement(
15
- Box,
16
- {
17
- as: 'span',
18
- className: 'iui-select-tag-label',
19
- },
20
- label,
21
- ),
19
+ label,
22
20
  );
23
21
  });
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { SelectTag } from './SelectTag.js';
4
4
  import { OverflowContainer } from '../../utils/index.js';
5
- export const SelectTagContainer = React.forwardRef((props, ref) => {
5
+ export const SelectTagContainer = React.forwardRef((props, forwardedRef) => {
6
6
  let { tags: tagsProp, className, ...rest } = props;
7
7
  let tags = React.useMemo(() => React.Children.toArray(tagsProp), [tagsProp]);
8
8
  return React.createElement(
@@ -10,7 +10,7 @@ export const SelectTagContainer = React.forwardRef((props, ref) => {
10
10
  {
11
11
  itemsCount: tags.length,
12
12
  className: cx('iui-select-tag-container', className),
13
- ref: ref,
13
+ ref: forwardedRef,
14
14
  ...rest,
15
15
  },
16
16
  React.createElement(SelectTagContainerContent, {
@@ -53,6 +53,7 @@ export const Stepper = React.forwardRef((props, ref) => {
53
53
  type: type,
54
54
  onClick: onStepClick,
55
55
  description: s.description,
56
+ stepContent: s.stepContent,
56
57
  });
57
58
  }),
58
59
  ),
@@ -17,6 +17,7 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
17
17
  trackContentProps,
18
18
  circleProps,
19
19
  nameProps,
20
+ stepContent,
20
21
  ...rest
21
22
  } = props;
22
23
  let isPast = currentStepNumber > index;
@@ -74,7 +75,7 @@ export const StepperStep = React.forwardRef((props, forwardedRef) => {
74
75
  ...circleProps,
75
76
  className: cx('iui-stepper-circle', circleProps?.className),
76
77
  },
77
- index + 1,
78
+ stepContent ? stepContent() : index + 1,
78
79
  ),
79
80
  ),
80
81
  'default' === type &&
@@ -53,7 +53,7 @@ let singleRowSelectedAction = 'singleRowSelected';
53
53
  let shiftRowSelectedAction = 'shiftRowSelected';
54
54
  export const tableResizeStartAction = 'tableResizeStart';
55
55
  let tableResizeEndAction = 'tableResizeEnd';
56
- let iuiId = Symbol('iui-id');
56
+ export const iuiId = Symbol('iui-id');
57
57
  let flattenColumns = (columns) => {
58
58
  let flatColumns = [];
59
59
  columns.forEach((column) => {
@@ -665,11 +665,7 @@ export const Table = (props) => {
665
665
  },
666
666
  bodyProps?.className,
667
667
  ),
668
- style: {
669
- outline: 0,
670
- },
671
668
  }),
672
- tabIndex: -1,
673
669
  'aria-multiselectable':
674
670
  (isSelectable && 'multi' === selectionMode) || void 0,
675
671
  },
@@ -13,6 +13,7 @@ import {
13
13
  SvgChevronRight,
14
14
  Box,
15
15
  OverflowContainer,
16
+ useLayoutEffect,
16
17
  } from '../../utils/index.js';
17
18
  import { styles } from '../../styles.js';
18
19
  let defaultLocalization = {
@@ -56,7 +57,7 @@ export const TablePaginator = (props) => {
56
57
  );
57
58
  let pageListRef = React.useRef(null);
58
59
  let [focusedIndex, setFocusedIndex] = React.useState(currentPage);
59
- React.useLayoutEffect(() => {
60
+ useLayoutEffect(() => {
60
61
  setFocusedIndex(currentPage);
61
62
  }, [currentPage]);
62
63
  let needFocus = React.useRef(false);
@@ -178,6 +179,7 @@ export const TablePaginator = (props) => {
178
179
  : React.createElement(TablePaginatorPageButtons, {
179
180
  size: size,
180
181
  focusedIndex: focusedIndex,
182
+ setFocusedIndex: setFocusedIndex,
181
183
  totalPagesCount: totalPagesCount,
182
184
  onPageChange: onPageChange,
183
185
  currentPage: currentPage,
@@ -251,6 +253,7 @@ export const TablePaginator = (props) => {
251
253
  let TablePaginatorPageButtons = (props) => {
252
254
  let {
253
255
  focusedIndex,
256
+ setFocusedIndex,
254
257
  totalPagesCount,
255
258
  onPageChange,
256
259
  currentPage,
@@ -270,14 +273,24 @@ let TablePaginatorPageButtons = (props) => {
270
273
  styleType: 'borderless',
271
274
  size: buttonSize,
272
275
  'data-iui-active': index === currentPage,
273
- onClick: () => onPageChange(index),
276
+ onClick: () => {
277
+ setFocusedIndex(index);
278
+ onPageChange(index);
279
+ },
274
280
  'aria-current': index === currentPage,
275
281
  'aria-label': localization.goToPageLabel?.(index + 1),
276
282
  tabIndex: tabIndex,
277
283
  },
278
284
  index + 1,
279
285
  ),
280
- [focusedIndex, currentPage, localization, buttonSize, onPageChange],
286
+ [
287
+ focusedIndex,
288
+ buttonSize,
289
+ currentPage,
290
+ localization,
291
+ setFocusedIndex,
292
+ onPageChange,
293
+ ],
281
294
  );
282
295
  let pageList = React.useMemo(
283
296
  () =>
@@ -1,3 +1,4 @@
1
+ import { iuiId } from '../Table.js';
1
2
  let onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
2
3
  if (!instance?.rows.length) {
3
4
  onSelect?.([], newState);
@@ -7,14 +8,16 @@ let onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
7
8
  let handleRow = (row) => {
8
9
  if (isRowDisabled?.(row.original)) return false;
9
10
  let isAllSubSelected = true;
10
- row.initialSubRows.forEach((subRow) => {
11
- let result = handleRow(subRow);
12
- if (!result) isAllSubSelected = false;
13
- });
11
+ if (row.initialSubRows[0]?.original[iuiId] === void 0)
12
+ row.initialSubRows.forEach((subRow) => {
13
+ let result = handleRow(subRow);
14
+ if (!result) isAllSubSelected = false;
15
+ });
14
16
  if (
15
- (!instance.selectSubRows && newState.selectedRowIds[row.id]) ||
16
- (!row.initialSubRows.length && newState.selectedRowIds[row.id]) ||
17
- (row.initialSubRows.length && isAllSubSelected)
17
+ newState.selectedRowIds[row.id] &&
18
+ (!instance.selectSubRows ||
19
+ !row.initialSubRows.length ||
20
+ isAllSubSelected)
18
21
  )
19
22
  newSelectedRowIds[row.id] = true;
20
23
  return !!newSelectedRowIds[row.id];
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Checkbox } from '../../Checkbox/Checkbox.js';
3
3
  import { DefaultCell } from '../cells/index.js';
4
+ import { iuiId } from '../Table.js';
4
5
  export const SELECTION_CELL_ID = 'iui-table-checkbox-selector';
5
6
  export const SelectionColumn = (props = {}) => {
6
7
  let { isDisabled, density } = props;
@@ -50,7 +51,11 @@ export const SelectionColumn = (props = {}) => {
50
51
  disabled: isDisabled?.(row.original),
51
52
  onClick: (e) => e.stopPropagation(),
52
53
  onChange: () => {
53
- if (row.subRows.length > 0 && selectSubRows)
54
+ if (
55
+ row.subRows.length > 0 &&
56
+ selectSubRows &&
57
+ void 0 === row.initialSubRows[0].original[iuiId]
58
+ )
54
59
  row.toggleRowSelected(
55
60
  !row.subRows.every(
56
61
  (subRow) => subRow.isSelected || isDisabled?.(subRow.original),
@@ -164,6 +164,7 @@ export const Tree = (props) => {
164
164
  onKeyDown: handleKeyDown,
165
165
  ref: treeRef,
166
166
  className: className,
167
+ 'data-iui-size': 'small' === size ? 'small' : void 0,
167
168
  style: style,
168
169
  ...rest,
169
170
  })
package/DEV-esm/index.js CHANGED
@@ -64,6 +64,7 @@ export { ModalContent } from './core/Modal/ModalContent.js';
64
64
  export { ModalButtonBar } from './core/Modal/ModalButtonBar.js';
65
65
  export { NotificationMarker } from './core/NotificationMarker/NotificationMarker.js';
66
66
  export { Overlay } from './core/Overlay/Overlay.js';
67
+ export { Panels as unstable_Panels } from './core/Panels/Panels.js';
67
68
  export { ProgressLinear } from './core/ProgressIndicators/ProgressLinear.js';
68
69
  export { ProgressRadial } from './core/ProgressIndicators/ProgressRadial.js';
69
70
  export { Radio } from './core/Radio/Radio.js';
package/DEV-esm/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = '3.15.5';
1
+ const t = '3.16.0';
2
2
  const u = new Proxy(
3
3
  {},
4
4
  {
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { OverflowContainer } from './OverflowContainer.js';
3
+ import { VisuallyHidden } from '../../core/VisuallyHidden/VisuallyHidden.js';
4
+ import { ShadowRoot } from './ShadowRoot.js';
3
5
  let ELLIPSIS_CHAR = '…';
4
- export const MiddleTextTruncation = (props) => {
5
- let { text, style, ...rest } = props;
6
+ export const MiddleTextTruncation = React.forwardRef((props, forwardedRef) => {
7
+ let { text, endCharsCount, textRenderer, style, ...rest } = props;
6
8
  return React.createElement(
7
9
  OverflowContainer,
8
10
  {
@@ -16,10 +18,26 @@ export const MiddleTextTruncation = (props) => {
16
18
  },
17
19
  itemsCount: text.length,
18
20
  ...rest,
21
+ ref: forwardedRef,
19
22
  },
20
- React.createElement(MiddleTextTruncationContent, props),
23
+ React.createElement(
24
+ ShadowRoot,
25
+ null,
26
+ React.createElement(VisuallyHidden, null, text),
27
+ React.createElement('slot', {
28
+ 'aria-hidden': true,
29
+ style: {
30
+ pointerEvents: 'none',
31
+ },
32
+ }),
33
+ ),
34
+ React.createElement(MiddleTextTruncationContent, {
35
+ text: text,
36
+ endCharsCount: endCharsCount,
37
+ textRenderer: textRenderer,
38
+ }),
21
39
  );
22
- };
40
+ });
23
41
  MiddleTextTruncation.displayName = 'MiddleTextTruncation';
24
42
  let MiddleTextTruncationContent = (props) => {
25
43
  let { text, endCharsCount = 6, textRenderer } = props;