@carbon/react 1.81.0 → 1.82.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +902 -902
- package/es/components/AILabel/index.d.ts +1 -1
- package/es/components/AILabel/index.js +2 -9
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/es/components/Breadcrumb/Breadcrumb.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
- package/es/components/Button/Button.js +2 -10
- package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/es/components/ButtonSet/ButtonSet.js +4 -4
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +3 -19
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +2 -2
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComboButton/index.js +2 -18
- package/es/components/ComposedModal/ComposedModal.js +5 -3
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +2 -18
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +2 -18
- package/es/components/DataTable/DataTable.d.ts +7 -12
- package/es/components/DataTable/DataTable.js +0 -5
- package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/es/components/DataTable/TableToolbarAction.js +5 -4
- package/es/components/DataTable/tools/sorting.d.ts +42 -0
- package/es/components/DataTable/tools/sorting.js +24 -53
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +18 -18
- package/es/components/Dialog/index.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +7 -6
- package/es/components/Dropdown/Dropdown.js +7 -3
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -18
- package/es/components/ListBox/ListBox.d.ts +4 -5
- package/es/components/ListBox/ListBox.js +8 -7
- package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/es/components/ListBox/ListBoxMenu.js +4 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/es/components/ListBox/ListBoxPropTypes.js +3 -3
- package/es/components/ListBox/index.d.ts +7 -5
- package/es/components/ListBox/index.js +1 -1
- package/es/components/Menu/Menu.js +5 -0
- package/es/components/Modal/Modal.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/es/components/MultiSelect/MultiSelect.js +3 -3
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +2 -21
- package/es/components/OverflowMenu/next/index.js +2 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
- package/es/components/PageHeader/PageHeader.d.ts +153 -8
- package/es/components/PageHeader/PageHeader.js +143 -21
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Popover/index.js +4 -21
- package/es/components/Search/Search.d.ts +2 -5
- package/es/components/Search/Search.js +24 -8
- package/es/components/Stack/HStack.d.ts +2 -3
- package/es/components/Stack/HStack.js +4 -7
- package/es/components/Stack/Stack.d.ts +3 -4
- package/es/components/Stack/Stack.js +3 -6
- package/es/components/Stack/VStack.d.ts +2 -3
- package/es/components/Stack/VStack.js +3 -2
- package/es/components/Stack/index.d.ts +4 -4
- package/es/components/TextArea/TextArea.js +3 -5
- package/es/components/TimePicker/TimePicker.d.ts +3 -4
- package/es/components/TimePicker/TimePicker.js +5 -4
- package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
- package/es/components/TreeView/TreeNode.js +13 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.js +9 -5
- package/es/internal/environment.js +7 -0
- package/es/internal/keyboard/navigation.d.ts +0 -10
- package/es/internal/keyboard/navigation.js +1 -13
- package/es/internal/useId.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +7 -0
- package/es/internal/useOutsideClick.js +3 -0
- package/es/internal/wrapFocus.d.ts +49 -0
- package/es/internal/wrapFocus.js +64 -51
- package/es/tools/events.d.ts +17 -0
- package/es/tools/events.js +10 -13
- package/es/tools/mapPopoverAlign.d.ts +15 -0
- package/es/tools/mapPopoverAlign.js +28 -0
- package/es/tools/uniqueId.d.ts +7 -0
- package/es/tools/uniqueId.js +3 -3
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.d.ts +1 -1
- package/lib/components/AILabel/index.js +2 -9
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
- package/lib/components/Button/Button.js +1 -9
- package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/lib/components/ButtonSet/ButtonSet.js +3 -3
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComboButton/index.js +2 -18
- package/lib/components/ComposedModal/ComposedModal.js +5 -3
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +2 -18
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +2 -18
- package/lib/components/DataTable/DataTable.d.ts +7 -12
- package/lib/components/DataTable/DataTable.js +0 -5
- package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/lib/components/DataTable/TableToolbarAction.js +4 -3
- package/lib/components/DataTable/tools/sorting.d.ts +42 -0
- package/lib/components/DataTable/tools/sorting.js +23 -53
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +18 -18
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +7 -6
- package/lib/components/Dropdown/Dropdown.js +6 -2
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +2 -18
- package/lib/components/ListBox/ListBox.d.ts +4 -5
- package/lib/components/ListBox/ListBox.js +7 -6
- package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/lib/components/ListBox/ListBoxMenu.js +3 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/index.d.ts +7 -5
- package/lib/components/ListBox/index.js +2 -2
- package/lib/components/Menu/Menu.js +5 -0
- package/lib/components/Modal/Modal.js +9 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
- package/lib/components/OverflowMenu/next/index.js +2 -18
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
- package/lib/components/PageHeader/PageHeader.d.ts +153 -8
- package/lib/components/PageHeader/PageHeader.js +145 -19
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +4 -0
- package/lib/components/Popover/index.js +4 -21
- package/lib/components/Search/Search.d.ts +2 -5
- package/lib/components/Search/Search.js +24 -8
- package/lib/components/Stack/HStack.d.ts +2 -3
- package/lib/components/Stack/HStack.js +3 -6
- package/lib/components/Stack/Stack.d.ts +3 -4
- package/lib/components/Stack/Stack.js +2 -5
- package/lib/components/Stack/VStack.d.ts +2 -3
- package/lib/components/Stack/VStack.js +2 -1
- package/lib/components/Stack/index.d.ts +4 -4
- package/lib/components/TextArea/TextArea.js +2 -4
- package/lib/components/TimePicker/TimePicker.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.js +4 -3
- package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
- package/lib/components/TreeView/TreeNode.js +13 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.js +9 -5
- package/lib/internal/environment.js +7 -0
- package/lib/internal/keyboard/navigation.d.ts +0 -10
- package/lib/internal/keyboard/navigation.js +0 -14
- package/lib/internal/useNoInteractiveChildren.js +7 -0
- package/lib/internal/useOutsideClick.js +3 -0
- package/lib/internal/wrapFocus.d.ts +49 -0
- package/lib/internal/wrapFocus.js +66 -53
- package/lib/tools/events.d.ts +17 -0
- package/lib/tools/events.js +10 -13
- package/lib/tools/mapPopoverAlign.d.ts +15 -0
- package/lib/tools/mapPopoverAlign.js +32 -0
- package/lib/tools/uniqueId.d.ts +7 -0
- package/lib/tools/uniqueId.js +3 -3
- package/lib/types/common.d.ts +0 -2
- package/package.json +7 -7
- package/telemetry.yml +3 -1
- package/es/tools/createPropAdapter.js +0 -40
- package/lib/tools/createPropAdapter.js +0 -44
|
@@ -6,16 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
9
|
+
import React__default, { useRef, useState, useLayoutEffect, useEffect } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { breakpoints } from '@carbon/layout';
|
|
14
14
|
import { useMatchMedia } from '../../internal/useMatchMedia.js';
|
|
15
15
|
import '../Text/index.js';
|
|
16
|
+
import { MenuButton } from '../MenuButton/index.js';
|
|
17
|
+
import '../Menu/Menu.js';
|
|
18
|
+
import { MenuItem } from '../Menu/MenuItem.js';
|
|
16
19
|
import { DefinitionTooltip } from '../Tooltip/DefinitionTooltip.js';
|
|
17
20
|
import '../Tooltip/Tooltip.js';
|
|
18
21
|
import AspectRatio from '../AspectRatio/AspectRatio.js';
|
|
22
|
+
import { createOverflowHandler } from '@carbon/utilities';
|
|
19
23
|
import { Tabs as Tabs$1 } from '../Tabs/Tabs.js';
|
|
20
24
|
import { Text } from '../Text/Text.js';
|
|
21
25
|
|
|
@@ -78,7 +82,6 @@ const PageHeaderContent = /*#__PURE__*/React__default.forwardRef(function PageHe
|
|
|
78
82
|
className,
|
|
79
83
|
children,
|
|
80
84
|
title,
|
|
81
|
-
subtitle,
|
|
82
85
|
renderIcon: IconElement,
|
|
83
86
|
contextualActions,
|
|
84
87
|
pageActions,
|
|
@@ -120,16 +123,7 @@ const PageHeaderContent = /*#__PURE__*/React__default.forwardRef(function PageHe
|
|
|
120
123
|
className: `${prefix}--page-header__content__title`
|
|
121
124
|
}, title)), contextualActions && /*#__PURE__*/React__default.createElement("div", {
|
|
122
125
|
className: `${prefix}--page-header__content__contextual-actions`
|
|
123
|
-
}, contextualActions)),
|
|
124
|
-
className: `${prefix}--page-header__content__end`
|
|
125
|
-
}, pageActions && /*#__PURE__*/React__default.createElement("div", {
|
|
126
|
-
className: `${prefix}--page-header__content__page-actions`
|
|
127
|
-
}, pageActions))), subtitle && /*#__PURE__*/React__default.createElement(Text, {
|
|
128
|
-
as: "h3",
|
|
129
|
-
className: `${prefix}--page-header__content__subtitle`
|
|
130
|
-
}, subtitle), children && /*#__PURE__*/React__default.createElement("div", {
|
|
131
|
-
className: `${prefix}--page-header__content__body`
|
|
132
|
-
}, children));
|
|
126
|
+
}, contextualActions)), pageActions), children);
|
|
133
127
|
});
|
|
134
128
|
PageHeaderContent.displayName = 'PageHeaderContent';
|
|
135
129
|
PageHeaderContent.propTypes = {
|
|
@@ -144,7 +138,6 @@ PageHeaderContent.propTypes = {
|
|
|
144
138
|
/**
|
|
145
139
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
146
140
|
*/
|
|
147
|
-
|
|
148
141
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
149
142
|
/**
|
|
150
143
|
* The PageHeaderContent's title
|
|
@@ -166,17 +159,142 @@ PageHeaderContent.propTypes = {
|
|
|
166
159
|
|
|
167
160
|
/**
|
|
168
161
|
* ----------------
|
|
169
|
-
*
|
|
162
|
+
* PageHeaderContentPageActions
|
|
170
163
|
* ----------------
|
|
171
164
|
*/
|
|
172
165
|
|
|
173
|
-
const
|
|
166
|
+
const PageHeaderContentPageActions = _ref4 => {
|
|
174
167
|
let {
|
|
175
168
|
className,
|
|
176
169
|
children,
|
|
170
|
+
menuButtonLabel = 'Actions',
|
|
171
|
+
pageActions,
|
|
177
172
|
...other
|
|
178
173
|
} = _ref4;
|
|
179
174
|
const prefix = usePrefix();
|
|
175
|
+
const classNames = cx({
|
|
176
|
+
[`${prefix}--page-header__content__page-actions`]: true
|
|
177
|
+
}, className);
|
|
178
|
+
const containerRef = useRef(null);
|
|
179
|
+
const offsetRef = useRef(null);
|
|
180
|
+
const [menuButtonVisibility, setMenuButtonVisibility] = useState(false);
|
|
181
|
+
const [hiddenItems, setHiddenItems] = useState([]);
|
|
182
|
+
|
|
183
|
+
// need to set the grid columns width based on the menu button's width
|
|
184
|
+
// to avoid overlapping when resizing
|
|
185
|
+
useLayoutEffect(() => {
|
|
186
|
+
if (menuButtonVisibility && offsetRef.current) {
|
|
187
|
+
const width = offsetRef.current.offsetWidth;
|
|
188
|
+
document.documentElement.style.setProperty('--pageheader-title-grid-width', `${width}px`);
|
|
189
|
+
}
|
|
190
|
+
}, [menuButtonVisibility]);
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (!containerRef.current || !Array.isArray(pageActions)) return;
|
|
193
|
+
createOverflowHandler({
|
|
194
|
+
container: containerRef.current,
|
|
195
|
+
// exclude the hidden menu button from children
|
|
196
|
+
maxVisibleItems: containerRef.current.children.length - 1,
|
|
197
|
+
onChange: (visible, hidden) => {
|
|
198
|
+
setHiddenItems(pageActions?.slice(visible.length));
|
|
199
|
+
if (hidden.length > 0) {
|
|
200
|
+
setMenuButtonVisibility(true);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}, []);
|
|
205
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
206
|
+
className: classNames,
|
|
207
|
+
ref: containerRef
|
|
208
|
+
}, other), pageActions && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Array.isArray(pageActions) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, pageActions.map(action => /*#__PURE__*/React__default.createElement("div", {
|
|
209
|
+
key: action.id,
|
|
210
|
+
className: "action"
|
|
211
|
+
}, action.body)), /*#__PURE__*/React__default.createElement("span", {
|
|
212
|
+
"data-offset": true,
|
|
213
|
+
"data-hidden": true,
|
|
214
|
+
ref: offsetRef
|
|
215
|
+
}, /*#__PURE__*/React__default.createElement(MenuButton, {
|
|
216
|
+
menuAlignment: "bottom-end",
|
|
217
|
+
label: menuButtonLabel,
|
|
218
|
+
size: "md"
|
|
219
|
+
}, [...hiddenItems].reverse().map(item => /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
220
|
+
key: item.id,
|
|
221
|
+
label: item.label,
|
|
222
|
+
onClick: item.onClick
|
|
223
|
+
})))))));
|
|
224
|
+
};
|
|
225
|
+
PageHeaderContentPageActions.displayName = 'PageHeaderContentPageActions';
|
|
226
|
+
PageHeaderContentPageActions.propTypes = {
|
|
227
|
+
/**
|
|
228
|
+
* Provide child elements to be rendered inside PageHeaderContentPageActions.
|
|
229
|
+
*/
|
|
230
|
+
children: PropTypes.node,
|
|
231
|
+
/**
|
|
232
|
+
* Specify an optional className to be added to your PageHeaderContentPageActions
|
|
233
|
+
*/
|
|
234
|
+
className: PropTypes.string,
|
|
235
|
+
/**
|
|
236
|
+
* The PageHeaderContent's collapsible Menu button label
|
|
237
|
+
*/
|
|
238
|
+
menuButtonLabel: PropTypes.string,
|
|
239
|
+
/**
|
|
240
|
+
* The PageHeaderContent's page actions
|
|
241
|
+
*/
|
|
242
|
+
pageActions: PropTypes.oneOfType([PropTypes.node, PropTypes.array])
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* ----------------
|
|
247
|
+
* PageHeaderContentText
|
|
248
|
+
* ----------------
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
const PageHeaderContentText = _ref5 => {
|
|
252
|
+
let {
|
|
253
|
+
className,
|
|
254
|
+
children,
|
|
255
|
+
subtitle,
|
|
256
|
+
...other
|
|
257
|
+
} = _ref5;
|
|
258
|
+
const prefix = usePrefix();
|
|
259
|
+
const classNames = cx({
|
|
260
|
+
[`${prefix}--page-header__content__body`]: true
|
|
261
|
+
}, className);
|
|
262
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
263
|
+
className: classNames
|
|
264
|
+
}, other), subtitle && /*#__PURE__*/React__default.createElement(Text, {
|
|
265
|
+
as: "h3",
|
|
266
|
+
className: `${prefix}--page-header__content__subtitle`
|
|
267
|
+
}, subtitle), children);
|
|
268
|
+
};
|
|
269
|
+
PageHeaderContentText.displayName = 'PageHeaderContentText';
|
|
270
|
+
PageHeaderContentText.propTypes = {
|
|
271
|
+
/**
|
|
272
|
+
* Provide child elements to be rendered inside PageHeaderContentText.
|
|
273
|
+
*/
|
|
274
|
+
children: PropTypes.node,
|
|
275
|
+
/**
|
|
276
|
+
* Specify an optional className to be added to your PageHeaderContentText
|
|
277
|
+
*/
|
|
278
|
+
className: PropTypes.string,
|
|
279
|
+
/**
|
|
280
|
+
* The PageHeaderContent's subtitle
|
|
281
|
+
*/
|
|
282
|
+
subtitle: PropTypes.string
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* ----------------
|
|
287
|
+
* PageHeaderHeroImage
|
|
288
|
+
* ----------------
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
const PageHeaderHeroImage = _ref6 => {
|
|
292
|
+
let {
|
|
293
|
+
className,
|
|
294
|
+
children,
|
|
295
|
+
...other
|
|
296
|
+
} = _ref6;
|
|
297
|
+
const prefix = usePrefix();
|
|
180
298
|
const classNames = cx({
|
|
181
299
|
[`${prefix}--page-header__hero-image`]: true
|
|
182
300
|
}, className);
|
|
@@ -187,7 +305,7 @@ const PageHeaderHeroImage = /*#__PURE__*/React__default.forwardRef(function Page
|
|
|
187
305
|
}, other, {
|
|
188
306
|
ratio: isLg ? '2x1' : '3x2'
|
|
189
307
|
}), children);
|
|
190
|
-
}
|
|
308
|
+
};
|
|
191
309
|
PageHeaderHeroImage.displayName = 'PageHeaderHeroImage';
|
|
192
310
|
PageHeaderHeroImage.propTypes = {
|
|
193
311
|
/**
|
|
@@ -206,12 +324,12 @@ PageHeaderHeroImage.propTypes = {
|
|
|
206
324
|
* ----------------
|
|
207
325
|
*/
|
|
208
326
|
|
|
209
|
-
const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabBar(
|
|
327
|
+
const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabBar(_ref7, ref) {
|
|
210
328
|
let {
|
|
211
329
|
className,
|
|
212
330
|
children,
|
|
213
331
|
...other
|
|
214
|
-
} =
|
|
332
|
+
} = _ref7;
|
|
215
333
|
const prefix = usePrefix();
|
|
216
334
|
const classNames = cx({
|
|
217
335
|
[`${prefix}--page-header__tab-bar`]: true
|
|
@@ -222,12 +340,12 @@ const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHea
|
|
|
222
340
|
}, other), children);
|
|
223
341
|
});
|
|
224
342
|
PageHeaderTabBar.displayName = 'PageHeaderTabBar';
|
|
225
|
-
const PageHeaderTabs = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabs(
|
|
343
|
+
const PageHeaderTabs = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabs(_ref8, ref) {
|
|
226
344
|
let {
|
|
227
345
|
className,
|
|
228
346
|
children,
|
|
229
347
|
...other
|
|
230
|
-
} =
|
|
348
|
+
} = _ref8;
|
|
231
349
|
return /*#__PURE__*/React__default.createElement(Tabs$1, other, children);
|
|
232
350
|
});
|
|
233
351
|
PageHeaderTabs.displayName = 'PageHeaderTabs';
|
|
@@ -243,6 +361,10 @@ const BreadcrumbBar = PageHeaderBreadcrumbBar;
|
|
|
243
361
|
BreadcrumbBar.displayName = 'PageHeaderBreadcrumbBar';
|
|
244
362
|
const Content = PageHeaderContent;
|
|
245
363
|
Content.displayName = 'PageHeaderContent';
|
|
364
|
+
const ContentPageActions = PageHeaderContentPageActions;
|
|
365
|
+
Content.displayName = 'PageHeaderContentPageActions';
|
|
366
|
+
const ContentText = PageHeaderContentText;
|
|
367
|
+
Content.displayName = 'PageHeaderContentText';
|
|
246
368
|
const HeroImage = PageHeaderHeroImage;
|
|
247
369
|
HeroImage.displayName = 'PageHeaderHeroImage';
|
|
248
370
|
const TabBar = PageHeaderTabBar;
|
|
@@ -250,4 +372,4 @@ TabBar.displayName = 'PageHeaderTabBar';
|
|
|
250
372
|
const Tabs = PageHeaderTabs;
|
|
251
373
|
Tabs.displayName = 'PageHeader.Tabs';
|
|
252
374
|
|
|
253
|
-
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs };
|
|
375
|
+
export { BreadcrumbBar, Content, ContentPageActions, ContentText, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderContentPageActions, PageHeaderContentText, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs };
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderTabBar, PageHeaderHeroImage, PageHeaderTabs, Root, BreadcrumbBar, Content, TabBar, HeroImage, Tabs, } from './PageHeader';
|
|
8
|
-
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, PageHeaderTabsProps, } from './PageHeader';
|
|
7
|
+
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderContentPageActions, PageHeaderContentText, PageHeaderTabBar, PageHeaderHeroImage, PageHeaderTabs, Root, BreadcrumbBar, Content, ContentPageActions, ContentText, TabBar, HeroImage, Tabs, } from './PageHeader';
|
|
8
|
+
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderContentPageActionsProps, PageHeaderContentTextProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, PageHeaderTabsProps, } from './PageHeader';
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs } from './PageHeader.js';
|
|
8
|
+
export { BreadcrumbBar, Content, ContentPageActions, ContentText, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderContentPageActions, PageHeaderContentText, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs } from './PageHeader.js';
|
|
@@ -14,7 +14,7 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
|
14
14
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { useWindowEvent } from '../../internal/useEvent.js';
|
|
17
|
-
import {
|
|
17
|
+
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
18
18
|
import { useFloating, offset, flip, arrow, hide, autoUpdate } from '@floating-ui/react';
|
|
19
19
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
20
20
|
|
|
@@ -33,19 +33,6 @@ const PopoverContext = /*#__PURE__*/React__default.createContext({
|
|
|
33
33
|
* @deprecated Use NewPopoverAlignment instead.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
const propMappingFunction = deprecatedValue => {
|
|
37
|
-
const mapping = {
|
|
38
|
-
'top-left': 'top-start',
|
|
39
|
-
'top-right': 'top-end',
|
|
40
|
-
'bottom-left': 'bottom-start',
|
|
41
|
-
'bottom-right': 'bottom-end',
|
|
42
|
-
'left-bottom': 'left-end',
|
|
43
|
-
'left-top': 'left-start',
|
|
44
|
-
'right-bottom': 'right-end',
|
|
45
|
-
'right-top': 'right-start'
|
|
46
|
-
};
|
|
47
|
-
return mapping[deprecatedValue];
|
|
48
|
-
};
|
|
49
36
|
const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref,
|
|
50
37
|
//this is a workaround, have to come back and fix this.
|
|
51
38
|
forwardRef) {
|
|
@@ -70,7 +57,7 @@ forwardRef) {
|
|
|
70
57
|
const caretRef = useRef(null);
|
|
71
58
|
const popover = useRef(null);
|
|
72
59
|
const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
|
|
73
|
-
let align =
|
|
60
|
+
let align = mapPopoverAlign(initialAlign);
|
|
74
61
|
|
|
75
62
|
// If the `Popover` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
|
|
76
63
|
useWindowEvent('blur', () => {
|
|
@@ -137,7 +124,7 @@ forwardRef) {
|
|
|
137
124
|
alignmentAxis: alignmentAxisOffset,
|
|
138
125
|
mainAxis: popoverDimensions?.current?.offset
|
|
139
126
|
} : 0), autoAlign && flip({
|
|
140
|
-
fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
127
|
+
fallbackPlacements: isTabTip ? align.includes('bottom') ? ['bottom-start', 'bottom-end', 'top-start', 'top-end'] : ['top-start', 'top-end', 'bottom-start', 'bottom-end'] : align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
141
128
|
fallbackStrategy: 'initialPlacement',
|
|
142
129
|
fallbackAxisSideDirection: 'start',
|
|
143
130
|
boundary: autoAlignBoundary
|
|
@@ -297,11 +284,7 @@ Popover.propTypes = {
|
|
|
297
284
|
// deprecated use right-start instead
|
|
298
285
|
|
|
299
286
|
// new values to match floating-ui
|
|
300
|
-
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
301
|
-
//allowed prop values
|
|
302
|
-
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
303
|
-
//optional mapper function
|
|
304
|
-
propMappingFunction),
|
|
287
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign),
|
|
305
288
|
/**
|
|
306
289
|
* Provide a custom element or component to render the top-level node for the
|
|
307
290
|
* component.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type
|
|
7
|
+
import React, { type ChangeEvent, type ComponentType, type FunctionComponent, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
type InputPropsBase = Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
|
|
9
9
|
export interface SearchProps extends InputPropsBase {
|
|
10
10
|
/**
|
|
@@ -43,10 +43,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
43
43
|
/**
|
|
44
44
|
* Optional callback called when the search value changes.
|
|
45
45
|
*/
|
|
46
|
-
onChange
|
|
47
|
-
target: HTMLInputElement;
|
|
48
|
-
type: 'change';
|
|
49
|
-
}): void;
|
|
46
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
50
47
|
/**
|
|
51
48
|
* Optional callback called when the search value is cleared.
|
|
52
49
|
*/
|
|
@@ -19,6 +19,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
19
19
|
import deprecate from '../../prop-types/deprecate.js';
|
|
20
20
|
import '../FluidForm/FluidForm.js';
|
|
21
21
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
22
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
22
23
|
|
|
23
24
|
var _Close;
|
|
24
25
|
const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwardRef) {
|
|
@@ -79,14 +80,29 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
|
|
|
79
80
|
if (!value && inputRef.current) {
|
|
80
81
|
inputRef.current.value = '';
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
if (inputRef.current) {
|
|
84
|
+
const inputTarget = Object.assign({}, inputRef.current, {
|
|
85
|
+
value: ''
|
|
86
|
+
});
|
|
87
|
+
const syntheticEvent = {
|
|
88
|
+
bubbles: false,
|
|
89
|
+
cancelable: false,
|
|
90
|
+
currentTarget: inputRef.current,
|
|
91
|
+
defaultPrevented: false,
|
|
92
|
+
eventPhase: 0,
|
|
93
|
+
isDefaultPrevented: () => false,
|
|
94
|
+
isPropagationStopped: () => false,
|
|
95
|
+
isTrusted: false,
|
|
96
|
+
nativeEvent: new Event('change'),
|
|
97
|
+
persist: noopFn,
|
|
98
|
+
preventDefault: noopFn,
|
|
99
|
+
stopPropagation: noopFn,
|
|
100
|
+
target: inputTarget,
|
|
101
|
+
timeStamp: 0,
|
|
102
|
+
type: 'change'
|
|
103
|
+
};
|
|
104
|
+
onChange(syntheticEvent);
|
|
105
|
+
}
|
|
90
106
|
onClear();
|
|
91
107
|
setHasContent(false);
|
|
92
108
|
inputRef.current?.focus();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { StackProps } from './Stack';
|
|
9
|
-
declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
10
|
-
export { HStack };
|
|
9
|
+
export declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import { Stack } from './Stack.js';
|
|
11
11
|
|
|
12
|
-
const HStack = /*#__PURE__*/
|
|
13
|
-
let {
|
|
14
|
-
children,
|
|
15
|
-
...props
|
|
16
|
-
} = _ref;
|
|
12
|
+
const HStack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
13
|
return /*#__PURE__*/React__default.createElement(Stack, _extends({}, props, {
|
|
18
14
|
ref: ref,
|
|
19
15
|
orientation: "horizontal"
|
|
20
|
-
})
|
|
16
|
+
}));
|
|
21
17
|
});
|
|
18
|
+
HStack.propTypes = Stack.propTypes;
|
|
22
19
|
|
|
23
20
|
export { HStack };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
9
|
* The steps in the spacing scale
|
|
10
|
-
* @type {Array<number>}
|
|
11
10
|
*/
|
|
12
11
|
declare const SPACING_STEPS: number[];
|
|
13
12
|
export interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
@@ -54,5 +53,5 @@ export interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
54
53
|
* - https://paste.twilio.design/layout/stack/
|
|
55
54
|
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
|
|
56
55
|
*/
|
|
57
|
-
declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
58
|
-
export {
|
|
56
|
+
export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
57
|
+
export {};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { spacing } from '@carbon/layout';
|
|
@@ -14,13 +14,10 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The steps in the spacing scale
|
|
17
|
-
* @type {Array<number>}
|
|
18
17
|
*/
|
|
19
18
|
const SPACING_STEPS = Array.from({
|
|
20
19
|
length: spacing.length - 1
|
|
21
|
-
}
|
|
22
|
-
return step + 1;
|
|
23
|
-
});
|
|
20
|
+
}, (_, step) => step + 1);
|
|
24
21
|
/**
|
|
25
22
|
* The Stack component is a useful layout utility in a component-based model.
|
|
26
23
|
* This allows components to not use margin and instead delegate the
|
|
@@ -38,7 +35,7 @@ const SPACING_STEPS = Array.from({
|
|
|
38
35
|
* - https://paste.twilio.design/layout/stack/
|
|
39
36
|
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
|
|
40
37
|
*/
|
|
41
|
-
const Stack = /*#__PURE__*/
|
|
38
|
+
const Stack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
42
39
|
const {
|
|
43
40
|
as: BaseComponent = 'div',
|
|
44
41
|
children,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { StackProps } from './Stack';
|
|
9
|
-
declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
10
|
-
export { VStack };
|
|
9
|
+
export declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import { Stack } from './Stack.js';
|
|
11
11
|
|
|
12
|
-
const VStack = /*#__PURE__*/
|
|
12
|
+
const VStack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
13
13
|
return /*#__PURE__*/React__default.createElement(Stack, _extends({}, props, {
|
|
14
14
|
ref: ref,
|
|
15
15
|
orientation: "vertical"
|
|
16
16
|
}));
|
|
17
17
|
});
|
|
18
|
+
VStack.propTypes = Stack.propTypes;
|
|
18
19
|
|
|
19
20
|
export { VStack };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export * from './HStack';
|
|
8
|
+
export * from './Stack';
|
|
9
|
+
export * from './VStack';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, {
|
|
10
|
+
import React__default, { useContext, useRef, useState, useEffect, forwardRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import deprecate from '../../prop-types/deprecate.js';
|
|
13
13
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
@@ -22,10 +22,8 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
22
22
|
import '../Text/index.js';
|
|
23
23
|
import { Text } from '../Text/Text.js';
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const TextArea = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
25
|
+
const frFn = forwardRef;
|
|
26
|
+
const TextArea = frFn((props, forwardRef) => {
|
|
29
27
|
const {
|
|
30
28
|
className,
|
|
31
29
|
decorator,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { ReactAttr } from '../../types/common';
|
|
9
9
|
type ExcludedAttributes = 'id' | 'value';
|
|
10
10
|
export interface TimePickerProps extends Omit<ReactAttr<HTMLInputElement>, ExcludedAttributes> {
|
|
11
11
|
/**
|
|
@@ -99,6 +99,5 @@ export interface TimePickerProps extends Omit<ReactAttr<HTMLInputElement>, Exclu
|
|
|
99
99
|
*/
|
|
100
100
|
value?: string;
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
declare const TimePicker: TimePickerComponent;
|
|
102
|
+
declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
104
103
|
export default TimePicker;
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default from 'react';
|
|
11
|
+
import React__default, { forwardRef } from 'react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import deprecate from '../../prop-types/deprecate.js';
|
|
14
14
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const frFn = forwardRef;
|
|
17
|
+
const TimePicker = frFn((props, ref) => {
|
|
18
|
+
const {
|
|
18
19
|
children,
|
|
19
20
|
className,
|
|
20
21
|
disabled = false,
|
|
@@ -37,7 +38,7 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef(function TimePicker(_r
|
|
|
37
38
|
type = 'text',
|
|
38
39
|
value,
|
|
39
40
|
...rest
|
|
40
|
-
} =
|
|
41
|
+
} = props;
|
|
41
42
|
const prefix = usePrefix();
|
|
42
43
|
const [isValue, setValue] = React__default.useState(value);
|
|
43
44
|
const [prevValue, setPrevValue] = React__default.useState(value);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { ForwardRefReturn } from '../../types/common';
|
|
9
8
|
export type TimePickerSelectProps = {
|
|
10
9
|
/**
|
|
11
10
|
* Provide the contents of your TimePickerSelect
|
|
@@ -28,6 +27,26 @@ export type TimePickerSelectProps = {
|
|
|
28
27
|
*/
|
|
29
28
|
id: string;
|
|
30
29
|
} & React.SelectHTMLAttributes<HTMLSelectElement> & React.InputHTMLAttributes<HTMLSelectElement>;
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
declare const TimePickerSelect: React.ForwardRefExoticComponent<{
|
|
31
|
+
/**
|
|
32
|
+
* Provide the contents of your TimePickerSelect
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optionally provide the default value of the `<select>`
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: any;
|
|
43
|
+
/**
|
|
44
|
+
* Specify whether the control is disabled
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Specify a custom `id` for the `<select>`
|
|
49
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
} & React.SelectHTMLAttributes<HTMLSelectElement> & React.InputHTMLAttributes<HTMLSelectElement> & React.RefAttributes<HTMLSelectElement>>;
|
|
33
52
|
export default TimePickerSelect;
|