@carbon/react 1.81.0-rc.0 → 1.82.0-rc.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 +784 -784
- 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 +54 -32
- 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/TableCell.js +28 -4
- package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/es/components/DataTable/TableToolbarAction.js +5 -4
- package/es/components/DataTable/tools/cells.d.ts +13 -0
- package/es/components/DataTable/tools/cells.js +3 -6
- package/es/components/DataTable/tools/filter.d.ts +26 -0
- package/es/components/DataTable/tools/filter.js +8 -17
- 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 +19 -19
- 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 +13 -9
- 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/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
- 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 +9 -14
- package/es/components/Menu/MenuItem.js +15 -4
- 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 +7 -4
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +2 -21
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/OverflowMenu/index.js +2 -3
- 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 +160 -8
- package/es/components/PageHeader/PageHeader.js +155 -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 +53 -31
- 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/TableCell.js +28 -3
- package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/lib/components/DataTable/TableToolbarAction.js +4 -3
- package/lib/components/DataTable/tools/cells.d.ts +13 -0
- package/lib/components/DataTable/tools/cells.js +3 -6
- package/lib/components/DataTable/tools/filter.d.ts +26 -0
- package/lib/components/DataTable/tools/filter.js +8 -17
- 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 +19 -19
- 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 +12 -8
- 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/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
- 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 +9 -14
- package/lib/components/Menu/MenuItem.js +15 -4
- 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 +6 -3
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/OverflowMenu/index.js +2 -3
- 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 +160 -8
- package/lib/components/PageHeader/PageHeader.js +159 -19
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +6 -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 +9 -9
- package/telemetry.yml +3 -1
- package/es/tools/createPropAdapter.js +0 -40
- package/lib/tools/createPropAdapter.js +0 -44
|
@@ -6,19 +6,24 @@
|
|
|
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';
|
|
23
|
+
import { Tabs as Tabs$1 } from '../Tabs/Tabs.js';
|
|
19
24
|
import { Text } from '../Text/Text.js';
|
|
20
25
|
|
|
21
|
-
var _p, _p2
|
|
26
|
+
var _p, _p2;
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
29
|
* ----------
|
|
@@ -77,7 +82,6 @@ const PageHeaderContent = /*#__PURE__*/React__default.forwardRef(function PageHe
|
|
|
77
82
|
className,
|
|
78
83
|
children,
|
|
79
84
|
title,
|
|
80
|
-
subtitle,
|
|
81
85
|
renderIcon: IconElement,
|
|
82
86
|
contextualActions,
|
|
83
87
|
pageActions,
|
|
@@ -119,16 +123,7 @@ const PageHeaderContent = /*#__PURE__*/React__default.forwardRef(function PageHe
|
|
|
119
123
|
className: `${prefix}--page-header__content__title`
|
|
120
124
|
}, title)), contextualActions && /*#__PURE__*/React__default.createElement("div", {
|
|
121
125
|
className: `${prefix}--page-header__content__contextual-actions`
|
|
122
|
-
}, contextualActions)),
|
|
123
|
-
className: `${prefix}--page-header__content__end`
|
|
124
|
-
}, pageActions && /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
-
className: `${prefix}--page-header__content__page-actions`
|
|
126
|
-
}, pageActions))), subtitle && /*#__PURE__*/React__default.createElement(Text, {
|
|
127
|
-
as: "h3",
|
|
128
|
-
className: `${prefix}--page-header__content__subtitle`
|
|
129
|
-
}, subtitle), children && /*#__PURE__*/React__default.createElement("div", {
|
|
130
|
-
className: `${prefix}--page-header__content__body`
|
|
131
|
-
}, children));
|
|
126
|
+
}, contextualActions)), pageActions), children);
|
|
132
127
|
});
|
|
133
128
|
PageHeaderContent.displayName = 'PageHeaderContent';
|
|
134
129
|
PageHeaderContent.propTypes = {
|
|
@@ -143,7 +138,6 @@ PageHeaderContent.propTypes = {
|
|
|
143
138
|
/**
|
|
144
139
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
145
140
|
*/
|
|
146
|
-
|
|
147
141
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
148
142
|
/**
|
|
149
143
|
* The PageHeaderContent's title
|
|
@@ -165,17 +159,142 @@ PageHeaderContent.propTypes = {
|
|
|
165
159
|
|
|
166
160
|
/**
|
|
167
161
|
* ----------------
|
|
168
|
-
*
|
|
162
|
+
* PageHeaderContentPageActions
|
|
169
163
|
* ----------------
|
|
170
164
|
*/
|
|
171
165
|
|
|
172
|
-
const
|
|
166
|
+
const PageHeaderContentPageActions = _ref4 => {
|
|
173
167
|
let {
|
|
174
168
|
className,
|
|
175
169
|
children,
|
|
170
|
+
menuButtonLabel = 'Actions',
|
|
171
|
+
pageActions,
|
|
176
172
|
...other
|
|
177
173
|
} = _ref4;
|
|
178
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();
|
|
179
298
|
const classNames = cx({
|
|
180
299
|
[`${prefix}--page-header__hero-image`]: true
|
|
181
300
|
}, className);
|
|
@@ -186,7 +305,7 @@ const PageHeaderHeroImage = /*#__PURE__*/React__default.forwardRef(function Page
|
|
|
186
305
|
}, other, {
|
|
187
306
|
ratio: isLg ? '2x1' : '3x2'
|
|
188
307
|
}), children);
|
|
189
|
-
}
|
|
308
|
+
};
|
|
190
309
|
PageHeaderHeroImage.displayName = 'PageHeaderHeroImage';
|
|
191
310
|
PageHeaderHeroImage.propTypes = {
|
|
192
311
|
/**
|
|
@@ -205,12 +324,12 @@ PageHeaderHeroImage.propTypes = {
|
|
|
205
324
|
* ----------------
|
|
206
325
|
*/
|
|
207
326
|
|
|
208
|
-
const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabBar(
|
|
327
|
+
const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabBar(_ref7, ref) {
|
|
209
328
|
let {
|
|
210
329
|
className,
|
|
211
330
|
children,
|
|
212
331
|
...other
|
|
213
|
-
} =
|
|
332
|
+
} = _ref7;
|
|
214
333
|
const prefix = usePrefix();
|
|
215
334
|
const classNames = cx({
|
|
216
335
|
[`${prefix}--page-header__tab-bar`]: true
|
|
@@ -218,9 +337,18 @@ const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHea
|
|
|
218
337
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
219
338
|
className: classNames,
|
|
220
339
|
ref: ref
|
|
221
|
-
}, other),
|
|
340
|
+
}, other), children);
|
|
222
341
|
});
|
|
223
342
|
PageHeaderTabBar.displayName = 'PageHeaderTabBar';
|
|
343
|
+
const PageHeaderTabs = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabs(_ref8, ref) {
|
|
344
|
+
let {
|
|
345
|
+
className,
|
|
346
|
+
children,
|
|
347
|
+
...other
|
|
348
|
+
} = _ref8;
|
|
349
|
+
return /*#__PURE__*/React__default.createElement(Tabs$1, other, children);
|
|
350
|
+
});
|
|
351
|
+
PageHeaderTabs.displayName = 'PageHeaderTabs';
|
|
224
352
|
|
|
225
353
|
/**
|
|
226
354
|
* -------
|
|
@@ -233,9 +361,15 @@ const BreadcrumbBar = PageHeaderBreadcrumbBar;
|
|
|
233
361
|
BreadcrumbBar.displayName = 'PageHeaderBreadcrumbBar';
|
|
234
362
|
const Content = PageHeaderContent;
|
|
235
363
|
Content.displayName = 'PageHeaderContent';
|
|
364
|
+
const ContentPageActions = PageHeaderContentPageActions;
|
|
365
|
+
Content.displayName = 'PageHeaderContentPageActions';
|
|
366
|
+
const ContentText = PageHeaderContentText;
|
|
367
|
+
Content.displayName = 'PageHeaderContentText';
|
|
236
368
|
const HeroImage = PageHeaderHeroImage;
|
|
237
369
|
HeroImage.displayName = 'PageHeaderHeroImage';
|
|
238
370
|
const TabBar = PageHeaderTabBar;
|
|
239
371
|
TabBar.displayName = 'PageHeaderTabBar';
|
|
372
|
+
const Tabs = PageHeaderTabs;
|
|
373
|
+
Tabs.displayName = 'PageHeader.Tabs';
|
|
240
374
|
|
|
241
|
-
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, Root, TabBar };
|
|
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, Root, BreadcrumbBar, Content, TabBar, HeroImage, } from './PageHeader';
|
|
8
|
-
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, } 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, Root, TabBar } 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);
|