@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.
- package/CHANGELOG.md +23 -0
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/DEV-cjs/core/Checkbox/Checkbox.js +4 -6
- package/DEV-cjs/core/ComboBox/ComboBox.js +10 -6
- package/DEV-cjs/core/DatePicker/DatePicker.js +9 -1
- package/DEV-cjs/core/Dialog/Dialog.js +1 -1
- package/DEV-cjs/core/Panels/Panels.js +319 -0
- package/DEV-cjs/core/Panels/helpers.js +62 -0
- package/DEV-cjs/core/Radio/Radio.js +4 -6
- package/DEV-cjs/core/RadioTiles/RadioTileGroup.js +9 -2
- package/DEV-cjs/core/Select/SelectTag.js +9 -11
- package/DEV-cjs/core/Select/SelectTagContainer.js +2 -2
- package/DEV-cjs/core/Stepper/Stepper.js +1 -0
- package/DEV-cjs/core/Stepper/StepperStep.js +2 -1
- package/DEV-cjs/core/Table/Table.js +3 -4
- package/DEV-cjs/core/Table/TablePaginator.js +15 -3
- package/DEV-cjs/core/Table/actionHandlers/selectHandler.js +10 -7
- package/DEV-cjs/core/Table/columns/selectionColumn.js +6 -1
- package/DEV-cjs/core/Tree/Tree.js +1 -0
- package/DEV-cjs/index.js +4 -0
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/components/MiddleTextTruncation.js +22 -4
- package/DEV-cjs/utils/components/OverflowContainer.js +170 -27
- package/DEV-cjs/utils/hooks/index.js +1 -1
- package/DEV-cjs/utils/hooks/useInstance.js +38 -0
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/DEV-esm/core/Checkbox/Checkbox.js +5 -10
- package/DEV-esm/core/ComboBox/ComboBox.js +10 -6
- package/DEV-esm/core/DatePicker/DatePicker.js +11 -1
- package/DEV-esm/core/Dialog/Dialog.js +1 -1
- package/DEV-esm/core/Panels/Panels.js +301 -0
- package/DEV-esm/core/Panels/helpers.js +42 -0
- package/DEV-esm/core/Radio/Radio.js +4 -9
- package/DEV-esm/core/RadioTiles/RadioTileGroup.js +8 -2
- package/DEV-esm/core/Select/SelectTag.js +9 -11
- package/DEV-esm/core/Select/SelectTagContainer.js +2 -2
- package/DEV-esm/core/Stepper/Stepper.js +1 -0
- package/DEV-esm/core/Stepper/StepperStep.js +2 -1
- package/DEV-esm/core/Table/Table.js +1 -5
- package/DEV-esm/core/Table/TablePaginator.js +16 -3
- package/DEV-esm/core/Table/actionHandlers/selectHandler.js +10 -7
- package/DEV-esm/core/Table/columns/selectionColumn.js +6 -1
- package/DEV-esm/core/Tree/Tree.js +1 -0
- package/DEV-esm/index.js +1 -0
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/components/MiddleTextTruncation.js +22 -4
- package/DEV-esm/utils/components/OverflowContainer.js +143 -4
- package/DEV-esm/utils/hooks/index.js +1 -1
- package/DEV-esm/utils/hooks/useInstance.js +18 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/cjs/core/Checkbox/Checkbox.js +4 -6
- package/cjs/core/ComboBox/ComboBox.d.ts +13 -0
- package/cjs/core/ComboBox/ComboBox.js +10 -6
- package/cjs/core/DatePicker/DatePicker.d.ts +2 -2
- package/cjs/core/DatePicker/DatePicker.js +2 -1
- package/cjs/core/Dialog/Dialog.js +1 -1
- package/cjs/core/Dialog/DialogContext.d.ts +6 -2
- package/cjs/core/Panels/Panels.d.ts +174 -0
- package/cjs/core/Panels/Panels.js +312 -0
- package/cjs/core/Panels/helpers.d.ts +23 -0
- package/cjs/core/Panels/helpers.js +61 -0
- package/cjs/core/Radio/Radio.js +4 -6
- package/cjs/core/RadioTiles/RadioTileGroup.d.ts +3 -1
- package/cjs/core/RadioTiles/RadioTileGroup.js +9 -2
- package/cjs/core/Select/SelectTag.d.ts +3 -1
- package/cjs/core/Select/SelectTag.js +9 -11
- package/cjs/core/Select/SelectTagContainer.js +2 -2
- package/cjs/core/Stepper/Stepper.d.ts +4 -0
- package/cjs/core/Stepper/Stepper.js +1 -0
- package/cjs/core/Stepper/StepperStep.d.ts +4 -0
- package/cjs/core/Stepper/StepperStep.js +2 -1
- package/cjs/core/Table/Table.d.ts +1 -0
- package/cjs/core/Table/Table.js +3 -4
- package/cjs/core/Table/TablePaginator.js +15 -3
- package/cjs/core/Table/actionHandlers/selectHandler.js +10 -7
- package/cjs/core/Table/columns/selectionColumn.js +6 -1
- package/cjs/core/Tree/Tree.js +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +4 -0
- package/cjs/styles.js +1 -1
- package/cjs/utils/components/MiddleTextTruncation.d.ts +5 -7
- package/cjs/utils/components/MiddleTextTruncation.js +22 -4
- package/cjs/utils/components/OverflowContainer.d.ts +1 -0
- package/cjs/utils/components/OverflowContainer.js +170 -27
- package/cjs/utils/hooks/index.d.ts +1 -1
- package/cjs/utils/hooks/index.js +1 -1
- package/cjs/utils/hooks/useInstance.d.ts +22 -0
- package/cjs/utils/hooks/useInstance.js +38 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/esm/core/Checkbox/Checkbox.js +5 -10
- package/esm/core/ComboBox/ComboBox.d.ts +13 -0
- package/esm/core/ComboBox/ComboBox.js +10 -6
- package/esm/core/DatePicker/DatePicker.d.ts +2 -2
- package/esm/core/DatePicker/DatePicker.js +4 -1
- package/esm/core/Dialog/Dialog.js +1 -1
- package/esm/core/Dialog/DialogContext.d.ts +6 -2
- package/esm/core/Panels/Panels.d.ts +174 -0
- package/esm/core/Panels/Panels.js +294 -0
- package/esm/core/Panels/helpers.d.ts +23 -0
- package/esm/core/Panels/helpers.js +41 -0
- package/esm/core/Radio/Radio.js +4 -9
- package/esm/core/RadioTiles/RadioTileGroup.d.ts +3 -1
- package/esm/core/RadioTiles/RadioTileGroup.js +8 -2
- package/esm/core/Select/SelectTag.d.ts +3 -1
- package/esm/core/Select/SelectTag.js +9 -11
- package/esm/core/Select/SelectTagContainer.js +2 -2
- package/esm/core/Stepper/Stepper.d.ts +4 -0
- package/esm/core/Stepper/Stepper.js +1 -0
- package/esm/core/Stepper/StepperStep.d.ts +4 -0
- package/esm/core/Stepper/StepperStep.js +2 -1
- package/esm/core/Table/Table.d.ts +1 -0
- package/esm/core/Table/Table.js +1 -5
- package/esm/core/Table/TablePaginator.js +16 -3
- package/esm/core/Table/actionHandlers/selectHandler.js +10 -7
- package/esm/core/Table/columns/selectionColumn.js +6 -1
- package/esm/core/Tree/Tree.js +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/styles.js +1 -1
- package/esm/utils/components/MiddleTextTruncation.d.ts +5 -7
- package/esm/utils/components/MiddleTextTruncation.js +22 -4
- package/esm/utils/components/OverflowContainer.d.ts +1 -0
- package/esm/utils/components/OverflowContainer.js +143 -4
- package/esm/utils/hooks/index.d.ts +1 -1
- package/esm/utils/hooks/index.js +1 -1
- package/esm/utils/hooks/useInstance.d.ts +22 -0
- package/esm/utils/hooks/useInstance.js +18 -0
- package/package.json +2 -2
- package/styles.css +8 -8
- package/DEV-cjs/utils/hooks/useOverflow.js +0 -76
- package/DEV-esm/utils/hooks/useOverflow.js +0 -63
- package/cjs/utils/hooks/useOverflow.d.ts +0 -23
- package/cjs/utils/hooks/useOverflow.js +0 -76
- package/esm/utils/hooks/useOverflow.d.ts +0 -23
- package/esm/utils/hooks/useOverflow.js +0 -63
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
Panels: function () {
|
|
14
|
+
return Panels;
|
|
15
|
+
},
|
|
16
|
+
PanelsWrapper: function () {
|
|
17
|
+
return PanelsWrapper;
|
|
18
|
+
},
|
|
19
|
+
PanelsWrapperContext: function () {
|
|
20
|
+
return PanelsWrapperContext;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const _interop_require_default = require('@swc/helpers/_/_interop_require_default');
|
|
24
|
+
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
25
|
+
const _react = _interop_require_wildcard._(require('react'));
|
|
26
|
+
const _reactdom = _interop_require_wildcard._(require('react-dom'));
|
|
27
|
+
const _index = require('../../utils/index.js');
|
|
28
|
+
const _IconButton = require('../Buttons/IconButton.js');
|
|
29
|
+
const _Flex = require('../Flex/Flex.js');
|
|
30
|
+
const _Text = require('../Typography/Text.js');
|
|
31
|
+
const _classnames = _interop_require_default._(require('classnames'));
|
|
32
|
+
const _helpers = require('./helpers.js');
|
|
33
|
+
const PanelsWrapper = _react.forwardRef((props, forwardedRef) => {
|
|
34
|
+
let {
|
|
35
|
+
children,
|
|
36
|
+
className,
|
|
37
|
+
onActiveIdChange: onActiveIdChangeProp,
|
|
38
|
+
instance,
|
|
39
|
+
...rest
|
|
40
|
+
} = props;
|
|
41
|
+
let onActiveIdChange = (0, _index.useLatestRef)(onActiveIdChangeProp);
|
|
42
|
+
let ref = _react.useRef(null);
|
|
43
|
+
let [activePanelId, setActivePanelId] = _react.useState(void 0);
|
|
44
|
+
let [triggers, setTriggers] = _react.useState({});
|
|
45
|
+
let panels = _react.useRef(new Set());
|
|
46
|
+
let [shouldFocus, setShouldFocus] = _react.useState(void 0);
|
|
47
|
+
let motionOk = (0, _index.useMediaQuery)(
|
|
48
|
+
'(prefers-reduced-motion: no-preference)',
|
|
49
|
+
);
|
|
50
|
+
let changeActivePanel = _react.useCallback(
|
|
51
|
+
(newActiveId) => {
|
|
52
|
+
if (!panels.current.has(newActiveId) || newActiveId === activePanelId)
|
|
53
|
+
return;
|
|
54
|
+
_reactdom.flushSync(() => setActivePanelId(newActiveId));
|
|
55
|
+
onActiveIdChange.current?.(newActiveId);
|
|
56
|
+
ref.current?.ownerDocument.getElementById(newActiveId)?.scrollIntoView({
|
|
57
|
+
block: 'nearest',
|
|
58
|
+
inline: 'center',
|
|
59
|
+
behavior: motionOk ? 'smooth' : 'instant',
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
[activePanelId, motionOk, onActiveIdChange],
|
|
63
|
+
);
|
|
64
|
+
return _react.createElement(
|
|
65
|
+
PanelsWrapperContext.Provider,
|
|
66
|
+
{
|
|
67
|
+
value: _react.useMemo(
|
|
68
|
+
() => ({
|
|
69
|
+
activePanelId,
|
|
70
|
+
setActivePanelId,
|
|
71
|
+
changeActivePanel,
|
|
72
|
+
triggers,
|
|
73
|
+
setTriggers,
|
|
74
|
+
shouldFocus,
|
|
75
|
+
setShouldFocus,
|
|
76
|
+
panels,
|
|
77
|
+
}),
|
|
78
|
+
[
|
|
79
|
+
activePanelId,
|
|
80
|
+
changeActivePanel,
|
|
81
|
+
setActivePanelId,
|
|
82
|
+
setTriggers,
|
|
83
|
+
shouldFocus,
|
|
84
|
+
triggers,
|
|
85
|
+
],
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
_react.createElement(
|
|
89
|
+
_helpers.PanelsInstanceProvider,
|
|
90
|
+
{
|
|
91
|
+
instance: instance,
|
|
92
|
+
},
|
|
93
|
+
_react.createElement(
|
|
94
|
+
_index.Box,
|
|
95
|
+
{
|
|
96
|
+
ref: (0, _index.useMergedRefs)(ref, forwardedRef),
|
|
97
|
+
...rest,
|
|
98
|
+
className: (0, _classnames.default)('iui-panel-wrapper', className),
|
|
99
|
+
},
|
|
100
|
+
children,
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
const PanelsWrapperContext = _react.createContext(void 0);
|
|
106
|
+
const Panel = _react.forwardRef((props, forwardedRef) => {
|
|
107
|
+
let { id, children, className, ...rest } = props;
|
|
108
|
+
let { activePanelId, triggers, panels, setActivePanelId } = (0,
|
|
109
|
+
_index.useSafeContext)(PanelsWrapperContext);
|
|
110
|
+
let associatedTrigger = _react.useMemo(() => triggers[id], [id, triggers]);
|
|
111
|
+
let previousActivePanelId = useDelayed(activePanelId) || activePanelId;
|
|
112
|
+
let isMounted = [activePanelId, previousActivePanelId].includes(id);
|
|
113
|
+
let isTransitioning =
|
|
114
|
+
activePanelId === id && activePanelId !== previousActivePanelId;
|
|
115
|
+
let isInert = previousActivePanelId === id && activePanelId !== id;
|
|
116
|
+
(0, _index.useLayoutEffect)(() => {
|
|
117
|
+
let isFirstPanel = null == activePanelId && 0 === panels.current.size;
|
|
118
|
+
if (isFirstPanel) setActivePanelId(id);
|
|
119
|
+
let panelsCurrent = panels.current;
|
|
120
|
+
if (!panelsCurrent.has(id)) panelsCurrent.add(id);
|
|
121
|
+
return () => {
|
|
122
|
+
panelsCurrent.delete(id);
|
|
123
|
+
};
|
|
124
|
+
}, [activePanelId, id, panels, setActivePanelId]);
|
|
125
|
+
return _react.createElement(
|
|
126
|
+
PanelContext.Provider,
|
|
127
|
+
{
|
|
128
|
+
value: _react.useMemo(
|
|
129
|
+
() => ({
|
|
130
|
+
id,
|
|
131
|
+
associatedTrigger,
|
|
132
|
+
}),
|
|
133
|
+
[associatedTrigger, id],
|
|
134
|
+
),
|
|
135
|
+
},
|
|
136
|
+
isMounted &&
|
|
137
|
+
_react.createElement(
|
|
138
|
+
_index.Box,
|
|
139
|
+
{
|
|
140
|
+
ref: forwardedRef,
|
|
141
|
+
id: id,
|
|
142
|
+
className: (0, _classnames.default)('iui-panel', className),
|
|
143
|
+
'aria-labelledby': `${id}-header-title`,
|
|
144
|
+
role: 'group',
|
|
145
|
+
inert: isInert ? '' : void 0,
|
|
146
|
+
'data-iui-transitioning': isTransitioning ? 'true' : void 0,
|
|
147
|
+
...rest,
|
|
148
|
+
},
|
|
149
|
+
children,
|
|
150
|
+
),
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
const PanelContext = _react.createContext(void 0);
|
|
154
|
+
const PanelTrigger = (props) => {
|
|
155
|
+
let { children, for: forProp } = props;
|
|
156
|
+
let {
|
|
157
|
+
changeActivePanel,
|
|
158
|
+
triggers,
|
|
159
|
+
setTriggers,
|
|
160
|
+
activePanelId: activePanel,
|
|
161
|
+
shouldFocus,
|
|
162
|
+
setShouldFocus,
|
|
163
|
+
panels,
|
|
164
|
+
} = (0, _index.useSafeContext)(PanelsWrapperContext);
|
|
165
|
+
let { id: panelId } = (0, _index.useSafeContext)(PanelContext);
|
|
166
|
+
let fallbackId = _react.useId();
|
|
167
|
+
let triggerId = children.props.id || fallbackId;
|
|
168
|
+
let onClick = _react.useCallback(() => {
|
|
169
|
+
if (null == activePanel) return;
|
|
170
|
+
setShouldFocus({
|
|
171
|
+
fromPanelId: activePanel,
|
|
172
|
+
toPanelId: forProp,
|
|
173
|
+
direction: 'forward',
|
|
174
|
+
});
|
|
175
|
+
changeActivePanel?.(forProp);
|
|
176
|
+
}, [activePanel, changeActivePanel, forProp, setShouldFocus]);
|
|
177
|
+
let focusRef = _react.useCallback(
|
|
178
|
+
(el) => {
|
|
179
|
+
if (
|
|
180
|
+
shouldFocus?.direction === 'backward' &&
|
|
181
|
+
shouldFocus?.toPanelId === panelId &&
|
|
182
|
+
shouldFocus?.fromPanelId === forProp
|
|
183
|
+
) {
|
|
184
|
+
el?.focus({
|
|
185
|
+
preventScroll: true,
|
|
186
|
+
});
|
|
187
|
+
setShouldFocus(void 0);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
[forProp, panelId, setShouldFocus, shouldFocus],
|
|
191
|
+
);
|
|
192
|
+
let logWarning = (0, _index.useWarningLogger)();
|
|
193
|
+
_react.useEffect(() => {
|
|
194
|
+
if (!panels.current.has(forProp))
|
|
195
|
+
logWarning(
|
|
196
|
+
`Panels.Trigger's \`for\` prop ("${forProp}") corresponds to no Panel.`,
|
|
197
|
+
);
|
|
198
|
+
}, [forProp, logWarning, panels, triggers]);
|
|
199
|
+
_react.useEffect(() => {
|
|
200
|
+
setTriggers((oldTriggers) => {
|
|
201
|
+
let triggersMatch = oldTriggers[forProp];
|
|
202
|
+
if (
|
|
203
|
+
null == triggersMatch ||
|
|
204
|
+
panelId !== triggersMatch.panelId ||
|
|
205
|
+
triggerId !== triggersMatch.triggerId
|
|
206
|
+
)
|
|
207
|
+
return {
|
|
208
|
+
...oldTriggers,
|
|
209
|
+
[forProp]: {
|
|
210
|
+
panelId,
|
|
211
|
+
triggerId,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
return oldTriggers;
|
|
215
|
+
});
|
|
216
|
+
}, [forProp, panelId, setTriggers, triggerId]);
|
|
217
|
+
return (0, _index.cloneElementWithRef)(children, (children) => ({
|
|
218
|
+
...children.props,
|
|
219
|
+
id: triggerId,
|
|
220
|
+
ref: focusRef,
|
|
221
|
+
onClick: (0, _index.mergeEventHandlers)(children.props.onClick, onClick),
|
|
222
|
+
'aria-expanded': activePanel === forProp,
|
|
223
|
+
'aria-controls': forProp,
|
|
224
|
+
}));
|
|
225
|
+
};
|
|
226
|
+
const PanelHeader = _react.forwardRef((props, forwardedRef) => {
|
|
227
|
+
let { titleProps, children, ...rest } = props;
|
|
228
|
+
let { shouldFocus, setShouldFocus } = (0, _index.useSafeContext)(
|
|
229
|
+
PanelsWrapperContext,
|
|
230
|
+
);
|
|
231
|
+
let { id: panelId, associatedTrigger: panelAssociatedTrigger } = (0,
|
|
232
|
+
_index.useSafeContext)(PanelContext);
|
|
233
|
+
let focusRef = _react.useCallback(
|
|
234
|
+
(el) => {
|
|
235
|
+
if (
|
|
236
|
+
shouldFocus?.direction === 'forward' &&
|
|
237
|
+
shouldFocus.toPanelId === panelId
|
|
238
|
+
) {
|
|
239
|
+
el?.focus({
|
|
240
|
+
preventScroll: true,
|
|
241
|
+
});
|
|
242
|
+
setShouldFocus(void 0);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
[panelId, setShouldFocus, shouldFocus?.direction, shouldFocus?.toPanelId],
|
|
246
|
+
);
|
|
247
|
+
return _react.createElement(
|
|
248
|
+
_Flex.Flex,
|
|
249
|
+
{
|
|
250
|
+
ref: forwardedRef,
|
|
251
|
+
...rest,
|
|
252
|
+
},
|
|
253
|
+
panelAssociatedTrigger && _react.createElement(PanelBackButton, null),
|
|
254
|
+
_react.createElement(
|
|
255
|
+
_Text.Text,
|
|
256
|
+
{
|
|
257
|
+
id: `${panelId}-header-title`,
|
|
258
|
+
as: 'h2',
|
|
259
|
+
tabIndex: -1,
|
|
260
|
+
ref: focusRef,
|
|
261
|
+
...titleProps,
|
|
262
|
+
},
|
|
263
|
+
children,
|
|
264
|
+
),
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
const PanelBackButton = _react.forwardRef((props, forwardedRef) => {
|
|
268
|
+
let { children, onClick, ...rest } = props;
|
|
269
|
+
let { instance: panelInstance } = (0, _index.useSafeContext)(
|
|
270
|
+
_helpers.PanelsInstanceContext,
|
|
271
|
+
);
|
|
272
|
+
return _react.createElement(
|
|
273
|
+
_IconButton.IconButton,
|
|
274
|
+
{
|
|
275
|
+
ref: forwardedRef,
|
|
276
|
+
'aria-label': 'Previous panel',
|
|
277
|
+
styleType: 'borderless',
|
|
278
|
+
size: 'small',
|
|
279
|
+
'data-iui-shift': 'left',
|
|
280
|
+
...rest,
|
|
281
|
+
onClick: (0, _index.mergeEventHandlers)(
|
|
282
|
+
_react.useCallback(() => panelInstance?.goBack(), [panelInstance]),
|
|
283
|
+
onClick,
|
|
284
|
+
),
|
|
285
|
+
},
|
|
286
|
+
children || _react.createElement(_index.SvgChevronLeft, null),
|
|
287
|
+
);
|
|
288
|
+
});
|
|
289
|
+
const Panels = {
|
|
290
|
+
Wrapper: PanelsWrapper,
|
|
291
|
+
Panel,
|
|
292
|
+
Trigger: PanelTrigger,
|
|
293
|
+
Header: PanelHeader,
|
|
294
|
+
useInstance: _index.useInstance,
|
|
295
|
+
};
|
|
296
|
+
function useDelayed(
|
|
297
|
+
value,
|
|
298
|
+
{ delay } = {
|
|
299
|
+
delay: 500,
|
|
300
|
+
},
|
|
301
|
+
) {
|
|
302
|
+
let [delayed, setDelayed] = _react.useState(void 0);
|
|
303
|
+
let timeout = _react.useRef(void 0);
|
|
304
|
+
_react.useEffect(() => {
|
|
305
|
+
if (0 === delay) setDelayed(value);
|
|
306
|
+
else timeout.current = setTimeout(() => setDelayed(value), delay);
|
|
307
|
+
return () => {
|
|
308
|
+
clearTimeout(timeout.current);
|
|
309
|
+
};
|
|
310
|
+
}, [value, delay]);
|
|
311
|
+
return delayed;
|
|
312
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type PanelsInstance = {
|
|
3
|
+
/** Go back to the panel that has a trigger that points to the current panel. */
|
|
4
|
+
goBack: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type TriggerMapEntry = {
|
|
7
|
+
triggerId: string;
|
|
8
|
+
panelId: string;
|
|
9
|
+
};
|
|
10
|
+
export type FocusEntry = {
|
|
11
|
+
fromPanelId: string;
|
|
12
|
+
toPanelId: string;
|
|
13
|
+
direction: 'forward' | 'backward';
|
|
14
|
+
} | undefined;
|
|
15
|
+
export declare const PanelsInstanceContext: React.Context<{
|
|
16
|
+
instance: PanelsInstance;
|
|
17
|
+
} | undefined>;
|
|
18
|
+
type PanelInstanceProviderProps = {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
instance: PanelsInstance | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare const PanelsInstanceProvider: (props: PanelInstanceProviderProps) => React.JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
PanelsInstanceContext: function () {
|
|
14
|
+
return PanelsInstanceContext;
|
|
15
|
+
},
|
|
16
|
+
PanelsInstanceProvider: function () {
|
|
17
|
+
return PanelsInstanceProvider;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
21
|
+
const _react = _interop_require_wildcard._(require('react'));
|
|
22
|
+
const _index = require('../../utils/index.js');
|
|
23
|
+
const _Panels = require('./Panels.js');
|
|
24
|
+
const PanelsInstanceContext = _react.createContext(void 0);
|
|
25
|
+
const PanelsInstanceProvider = (props) => {
|
|
26
|
+
let { children, instance: instanceProp } = props;
|
|
27
|
+
let instanceBackup = _Panels.Panels.useInstance();
|
|
28
|
+
let instance = instanceProp || instanceBackup;
|
|
29
|
+
let { activePanelId, changeActivePanel, triggers, setShouldFocus } = (0,
|
|
30
|
+
_index.useSafeContext)(_Panels.PanelsWrapperContext);
|
|
31
|
+
let goBack = _react.useCallback(async () => {
|
|
32
|
+
if (null == activePanelId) return;
|
|
33
|
+
let trigger = triggers[activePanelId];
|
|
34
|
+
if (null != trigger.triggerId) {
|
|
35
|
+
setShouldFocus({
|
|
36
|
+
fromPanelId: activePanelId,
|
|
37
|
+
toPanelId: trigger.panelId,
|
|
38
|
+
direction: 'backward',
|
|
39
|
+
});
|
|
40
|
+
changeActivePanel(trigger.panelId);
|
|
41
|
+
}
|
|
42
|
+
}, [activePanelId, changeActivePanel, setShouldFocus, triggers]);
|
|
43
|
+
(0, _index.useSynchronizeInstance)(
|
|
44
|
+
instance,
|
|
45
|
+
_react.useMemo(
|
|
46
|
+
() => ({
|
|
47
|
+
goBack,
|
|
48
|
+
}),
|
|
49
|
+
[goBack],
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
return _react.createElement(
|
|
53
|
+
PanelsInstanceContext.Provider,
|
|
54
|
+
{
|
|
55
|
+
value: {
|
|
56
|
+
instance,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
children,
|
|
60
|
+
);
|
|
61
|
+
};
|
package/cjs/core/Radio/Radio.js
CHANGED
|
@@ -28,7 +28,7 @@ const Radio = _react.forwardRef((props, ref) => {
|
|
|
28
28
|
let refs = (0, _index.useMergedRefs)(inputElementRef, ref);
|
|
29
29
|
let radio = _react.createElement(_index.Box, {
|
|
30
30
|
as: 'input',
|
|
31
|
-
className: (0, _classnames.default)('iui-radio', className),
|
|
31
|
+
className: (0, _classnames.default)('iui-checkbox', 'iui-radio', className),
|
|
32
32
|
style: style,
|
|
33
33
|
disabled: disabled,
|
|
34
34
|
type: 'radio',
|
|
@@ -42,13 +42,11 @@ const Radio = _react.forwardRef((props, ref) => {
|
|
|
42
42
|
as: 'label',
|
|
43
43
|
...wrapperProps,
|
|
44
44
|
className: (0, _classnames.default)(
|
|
45
|
-
'iui-
|
|
46
|
-
{
|
|
47
|
-
'iui-disabled': disabled,
|
|
48
|
-
[`iui-${status}`]: !!status,
|
|
49
|
-
},
|
|
45
|
+
'iui-checkbox-wrapper',
|
|
50
46
|
wrapperProps?.className,
|
|
51
47
|
),
|
|
48
|
+
'data-iui-status': status,
|
|
49
|
+
'data-iui-disabled': disabled ? 'true' : void 0,
|
|
52
50
|
},
|
|
53
51
|
radio,
|
|
54
52
|
label &&
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InputGroup } from '../InputGroup/InputGroup.js';
|
|
3
3
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
4
|
-
type RadioTileGroupProps =
|
|
4
|
+
type RadioTileGroupProps = {
|
|
5
|
+
tileContainerProps?: React.ComponentProps<'div'>;
|
|
6
|
+
} & Omit<React.ComponentProps<typeof InputGroup>, 'displayStyle' | 'disabled'>;
|
|
5
7
|
/**
|
|
6
8
|
* RadioTileGroup component to group RadioTile components together
|
|
7
9
|
* @example
|
|
@@ -8,12 +8,14 @@ Object.defineProperty(exports, 'RadioTileGroup', {
|
|
|
8
8
|
return RadioTileGroup;
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
+
const _interop_require_default = require('@swc/helpers/_/_interop_require_default');
|
|
11
12
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
12
13
|
const _react = _interop_require_wildcard._(require('react'));
|
|
13
14
|
const _InputGroup = require('../InputGroup/InputGroup.js');
|
|
14
15
|
const _index = require('../../utils/index.js');
|
|
16
|
+
const _classnames = _interop_require_default._(require('classnames'));
|
|
15
17
|
const RadioTileGroup = _react.forwardRef((props, forwardedRef) => {
|
|
16
|
-
let { children, label, ...rest } = props;
|
|
18
|
+
let { children, label, tileContainerProps, ...rest } = props;
|
|
17
19
|
return _react.createElement(
|
|
18
20
|
_InputGroup.InputGroup,
|
|
19
21
|
{
|
|
@@ -24,7 +26,12 @@ const RadioTileGroup = _react.forwardRef((props, forwardedRef) => {
|
|
|
24
26
|
_react.createElement(
|
|
25
27
|
_index.Box,
|
|
26
28
|
{
|
|
27
|
-
|
|
29
|
+
as: 'div',
|
|
30
|
+
...tileContainerProps,
|
|
31
|
+
className: (0, _classnames.default)(
|
|
32
|
+
'iui-radio-tile-container',
|
|
33
|
+
tileContainerProps?.className,
|
|
34
|
+
),
|
|
28
35
|
},
|
|
29
36
|
children,
|
|
30
37
|
),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Tag } from '../Tag/Tag.js';
|
|
1
3
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
2
4
|
type SelectTagProps = {
|
|
3
5
|
/**
|
|
4
6
|
* Text inside the tag.
|
|
5
7
|
*/
|
|
6
8
|
label: string;
|
|
7
|
-
}
|
|
9
|
+
} & Pick<React.ComponentProps<typeof Tag>, 'onClick' | 'onRemove'>;
|
|
8
10
|
/**
|
|
9
11
|
* Tag for showing selected value in `Select`.
|
|
10
12
|
* @private
|
|
@@ -12,24 +12,22 @@ const _interop_require_default = require('@swc/helpers/_/_interop_require_defaul
|
|
|
12
12
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
13
13
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
14
14
|
const _react = _interop_require_wildcard._(require('react'));
|
|
15
|
-
const
|
|
15
|
+
const _Tag = require('../Tag/Tag.js');
|
|
16
16
|
const SelectTag = _react.forwardRef((props, forwardedRef) => {
|
|
17
17
|
let { className, label, ...rest } = props;
|
|
18
18
|
return _react.createElement(
|
|
19
|
-
|
|
19
|
+
_Tag.Tag,
|
|
20
20
|
{
|
|
21
|
-
as: 'span',
|
|
22
21
|
className: (0, _classnames.default)('iui-select-tag', className),
|
|
22
|
+
labelProps: {
|
|
23
|
+
className: 'iui-select-tag-label',
|
|
24
|
+
},
|
|
25
|
+
removeButtonProps: {
|
|
26
|
+
className: 'iui-select-tag-button',
|
|
27
|
+
},
|
|
23
28
|
ref: forwardedRef,
|
|
24
29
|
...rest,
|
|
25
30
|
},
|
|
26
|
-
|
|
27
|
-
_index.Box,
|
|
28
|
-
{
|
|
29
|
-
as: 'span',
|
|
30
|
-
className: 'iui-select-tag-label',
|
|
31
|
-
},
|
|
32
|
-
label,
|
|
33
|
-
),
|
|
31
|
+
label,
|
|
34
32
|
);
|
|
35
33
|
});
|
|
@@ -14,7 +14,7 @@ const _react = _interop_require_wildcard._(require('react'));
|
|
|
14
14
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
15
15
|
const _SelectTag = require('./SelectTag.js');
|
|
16
16
|
const _index = require('../../utils/index.js');
|
|
17
|
-
const SelectTagContainer = _react.forwardRef((props,
|
|
17
|
+
const SelectTagContainer = _react.forwardRef((props, forwardedRef) => {
|
|
18
18
|
let { tags: tagsProp, className, ...rest } = props;
|
|
19
19
|
let tags = _react.useMemo(
|
|
20
20
|
() => _react.Children.toArray(tagsProp),
|
|
@@ -28,7 +28,7 @@ const SelectTagContainer = _react.forwardRef((props, ref) => {
|
|
|
28
28
|
'iui-select-tag-container',
|
|
29
29
|
className,
|
|
30
30
|
),
|
|
31
|
-
ref:
|
|
31
|
+
ref: forwardedRef,
|
|
32
32
|
...rest,
|
|
33
33
|
},
|
|
34
34
|
_react.createElement(SelectTagContainerContent, {
|
|
@@ -12,6 +12,10 @@ export type StepProperties = {
|
|
|
12
12
|
* A tooltip giving detailed description to this step.
|
|
13
13
|
*/
|
|
14
14
|
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom content displayed in the step's circle.
|
|
17
|
+
*/
|
|
18
|
+
stepContent?: () => React.ReactNode;
|
|
15
19
|
} & React.ComponentProps<'li'>;
|
|
16
20
|
export type StepperProps = {
|
|
17
21
|
/**
|
|
@@ -29,6 +29,10 @@ export type StepperStepProps = {
|
|
|
29
29
|
* A tooltip giving detailed description to this step.
|
|
30
30
|
*/
|
|
31
31
|
description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom content displayed in the step's circle.
|
|
34
|
+
*/
|
|
35
|
+
stepContent?: () => React.ReactNode;
|
|
32
36
|
/**
|
|
33
37
|
* Allows props to be passed for stepper step.
|
|
34
38
|
*/
|
|
@@ -29,6 +29,7 @@ const StepperStep = _react.forwardRef((props, forwardedRef) => {
|
|
|
29
29
|
trackContentProps,
|
|
30
30
|
circleProps,
|
|
31
31
|
nameProps,
|
|
32
|
+
stepContent,
|
|
32
33
|
...rest
|
|
33
34
|
} = props;
|
|
34
35
|
let isPast = currentStepNumber > index;
|
|
@@ -89,7 +90,7 @@ const StepperStep = _react.forwardRef((props, forwardedRef) => {
|
|
|
89
90
|
circleProps?.className,
|
|
90
91
|
),
|
|
91
92
|
},
|
|
92
|
-
index + 1,
|
|
93
|
+
stepContent ? stepContent() : index + 1,
|
|
93
94
|
),
|
|
94
95
|
),
|
|
95
96
|
'default' === type &&
|
|
@@ -3,6 +3,7 @@ import type { CellProps, TableOptions, Row, TableState } from '../../react-table
|
|
|
3
3
|
import type { CommonProps } from '../../utils/index.js';
|
|
4
4
|
import type { TableFilterValue } from './filters/index.js';
|
|
5
5
|
export declare const tableResizeStartAction = "tableResizeStart";
|
|
6
|
+
export declare const iuiId: unique symbol;
|
|
6
7
|
export type TablePaginatorRendererProps = {
|
|
7
8
|
/**
|
|
8
9
|
* The zero-based index of the current page.
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -13,6 +13,9 @@ _export(exports, {
|
|
|
13
13
|
Table: function () {
|
|
14
14
|
return Table;
|
|
15
15
|
},
|
|
16
|
+
iuiId: function () {
|
|
17
|
+
return iuiId;
|
|
18
|
+
},
|
|
16
19
|
tableResizeStartAction: function () {
|
|
17
20
|
return tableResizeStartAction;
|
|
18
21
|
},
|
|
@@ -650,11 +653,7 @@ const Table = (props) => {
|
|
|
650
653
|
},
|
|
651
654
|
bodyProps?.className,
|
|
652
655
|
),
|
|
653
|
-
style: {
|
|
654
|
-
outline: 0,
|
|
655
|
-
},
|
|
656
656
|
}),
|
|
657
|
-
tabIndex: -1,
|
|
658
657
|
'aria-multiselectable':
|
|
659
658
|
(isSelectable && 'multi' === selectionMode) || void 0,
|
|
660
659
|
},
|
|
@@ -60,7 +60,7 @@ const TablePaginator = (props) => {
|
|
|
60
60
|
);
|
|
61
61
|
let pageListRef = _react.useRef(null);
|
|
62
62
|
let [focusedIndex, setFocusedIndex] = _react.useState(currentPage);
|
|
63
|
-
|
|
63
|
+
(0, _index.useLayoutEffect)(() => {
|
|
64
64
|
setFocusedIndex(currentPage);
|
|
65
65
|
}, [currentPage]);
|
|
66
66
|
let needFocus = _react.useRef(false);
|
|
@@ -182,6 +182,7 @@ const TablePaginator = (props) => {
|
|
|
182
182
|
: _react.createElement(TablePaginatorPageButtons, {
|
|
183
183
|
size: size,
|
|
184
184
|
focusedIndex: focusedIndex,
|
|
185
|
+
setFocusedIndex: setFocusedIndex,
|
|
185
186
|
totalPagesCount: totalPagesCount,
|
|
186
187
|
onPageChange: onPageChange,
|
|
187
188
|
currentPage: currentPage,
|
|
@@ -255,6 +256,7 @@ const TablePaginator = (props) => {
|
|
|
255
256
|
const TablePaginatorPageButtons = (props) => {
|
|
256
257
|
let {
|
|
257
258
|
focusedIndex,
|
|
259
|
+
setFocusedIndex,
|
|
258
260
|
totalPagesCount,
|
|
259
261
|
onPageChange,
|
|
260
262
|
currentPage,
|
|
@@ -274,14 +276,24 @@ const TablePaginatorPageButtons = (props) => {
|
|
|
274
276
|
styleType: 'borderless',
|
|
275
277
|
size: buttonSize,
|
|
276
278
|
'data-iui-active': index === currentPage,
|
|
277
|
-
onClick: () =>
|
|
279
|
+
onClick: () => {
|
|
280
|
+
setFocusedIndex(index);
|
|
281
|
+
onPageChange(index);
|
|
282
|
+
},
|
|
278
283
|
'aria-current': index === currentPage,
|
|
279
284
|
'aria-label': localization.goToPageLabel?.(index + 1),
|
|
280
285
|
tabIndex: tabIndex,
|
|
281
286
|
},
|
|
282
287
|
index + 1,
|
|
283
288
|
),
|
|
284
|
-
[
|
|
289
|
+
[
|
|
290
|
+
focusedIndex,
|
|
291
|
+
buttonSize,
|
|
292
|
+
currentPage,
|
|
293
|
+
localization,
|
|
294
|
+
setFocusedIndex,
|
|
295
|
+
onPageChange,
|
|
296
|
+
],
|
|
285
297
|
);
|
|
286
298
|
let pageList = _react.useMemo(
|
|
287
299
|
() =>
|