@carbon/react 1.102.0 → 1.103.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 +973 -973
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.Skeleton.js +2 -1
- package/es/components/Button/Button.d.ts +4 -4
- package/es/components/Button/Button.js +4 -4
- package/es/components/Button/index.js +1 -1
- package/es/components/ButtonSet/ButtonSet.js +1 -1
- package/es/components/Checkbox/index.js +1 -1
- package/es/components/ComboBox/ComboBox.js +2 -2
- package/es/components/ComposedModal/ComposedModal.js +0 -3
- package/es/components/ComposedModal/ComposedModalPresence.d.ts +9 -1
- package/es/components/ComposedModal/ComposedModalPresence.js +14 -1
- package/es/components/ComposedModal/index.d.ts +1 -1
- package/es/components/ContainedList/index.js +1 -1
- package/es/components/DataTable/TableHeader.js +1 -1
- package/es/components/DataTable/TableRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DatePicker/DatePicker.Skeleton.d.ts +8 -5
- package/es/components/DatePicker/DatePicker.Skeleton.js +2 -2
- package/es/components/DatePicker/index.js +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dialog/Dialog.js +1 -1
- package/es/components/Dropdown/index.js +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/es/components/FeatureFlags/index.d.ts +8 -18
- package/es/components/FeatureFlags/index.js +23 -103
- package/es/components/FileUploader/FileUploader.Skeleton.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +3 -7
- package/es/components/Icon/Icon.Skeleton.js +1 -1
- package/es/components/IconIndicator/index.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/Modal/ModalPresence.d.ts +9 -1
- package/es/components/Modal/ModalPresence.js +14 -1
- package/es/components/Modal/index.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +9 -10
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.js +15 -13
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +3 -5
- package/es/components/OverflowMenuV2/index.js +1 -1
- package/es/components/PageHeader/PageHeader.js +2 -23
- package/es/components/Pagination/Pagination.Skeleton.js +1 -1
- package/es/components/Pagination/Pagination.d.ts +4 -0
- package/es/components/Pagination/Pagination.js +6 -1
- package/es/components/Pagination/experimental/Pagination.js +12 -1
- package/es/components/Popover/index.js +1 -1
- package/es/components/RadioButton/RadioButton.Skeleton.js +1 -1
- package/es/components/Search/index.js +1 -1
- package/es/components/Select/index.js +1 -1
- package/es/components/ShapeIndicator/index.js +1 -1
- package/es/components/Slider/Slider.js +230 -249
- package/es/components/Slider/SliderHandles.js +65 -53
- package/es/components/Switch/IconSwitch.js +1 -1
- package/es/components/Tabs/Tabs.js +2 -6
- package/es/components/Tag/Tag.Skeleton.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextArea/index.js +1 -1
- package/es/components/TextInput/index.js +1 -1
- package/es/components/Tile/Tile.js +1 -1
- package/es/components/Toggle/Toggle.Skeleton.js +1 -1
- package/es/components/Toggletip/index.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/SideNav.d.ts +1 -4
- package/es/components/UIShell/SideNav.js +10 -25
- package/es/components/UIShell/SideNavContext.d.ts +17 -0
- package/es/components/UIShell/SideNavContext.js +24 -0
- package/es/components/UIShell/SideNavItems.d.ts +1 -1
- package/es/components/UIShell/SideNavItems.js +12 -16
- package/es/components/UIShell/SideNavLink.js +8 -4
- package/es/components/UIShell/SideNavMenu.js +7 -5
- package/es/index.js +30 -30
- package/es/internal/useNoInteractiveChildren.js +25 -30
- package/es/internal/usePresence.d.ts +1 -1
- package/es/internal/usePresence.js +14 -17
- package/lib/components/Button/Button.Skeleton.js +2 -1
- package/lib/components/Button/Button.d.ts +4 -4
- package/lib/components/Button/Button.js +4 -4
- package/lib/components/Button/index.js +1 -1
- package/lib/components/ButtonSet/ButtonSet.js +1 -1
- package/lib/components/Checkbox/index.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -2
- package/lib/components/ComposedModal/ComposedModal.js +0 -3
- package/lib/components/ComposedModal/ComposedModalPresence.d.ts +9 -1
- package/lib/components/ComposedModal/ComposedModalPresence.js +14 -0
- package/lib/components/ComposedModal/index.d.ts +1 -1
- package/lib/components/ContainedList/index.js +0 -3
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DatePicker/DatePicker.Skeleton.d.ts +8 -5
- package/lib/components/DatePicker/DatePicker.Skeleton.js +2 -2
- package/lib/components/DatePicker/index.js +1 -1
- package/lib/components/Dropdown/index.js +1 -1
- package/lib/components/FeatureFlags/index.d.ts +8 -18
- package/lib/components/FeatureFlags/index.js +21 -102
- package/lib/components/FileUploader/FileUploader.Skeleton.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +2 -6
- package/lib/components/Icon/Icon.Skeleton.js +0 -3
- package/lib/components/IconIndicator/index.js +0 -3
- package/lib/components/Modal/ModalPresence.d.ts +9 -1
- package/lib/components/Modal/ModalPresence.js +14 -0
- package/lib/components/Modal/index.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +8 -9
- package/lib/components/NumberInput/NumberInput.js +14 -12
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -7
- package/lib/components/OverflowMenuV2/index.js +1 -1
- package/lib/components/PageHeader/PageHeader.js +2 -23
- package/lib/components/Pagination/Pagination.Skeleton.js +0 -3
- package/lib/components/Pagination/Pagination.d.ts +4 -0
- package/lib/components/Pagination/Pagination.js +6 -1
- package/lib/components/Pagination/experimental/Pagination.js +12 -1
- package/lib/components/RadioButton/RadioButton.Skeleton.js +0 -3
- package/lib/components/Search/index.js +1 -1
- package/lib/components/Select/index.js +1 -1
- package/lib/components/ShapeIndicator/index.js +0 -3
- package/lib/components/Slider/Slider.js +229 -248
- package/lib/components/Slider/SliderHandles.js +64 -52
- package/lib/components/Tabs/Tabs.js +1 -5
- package/lib/components/Tag/Tag.Skeleton.js +0 -3
- package/lib/components/TextArea/index.js +1 -1
- package/lib/components/TextInput/index.js +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.js +0 -3
- package/lib/components/Toggletip/index.js +0 -3
- package/lib/components/UIShell/SideNav.d.ts +1 -4
- package/lib/components/UIShell/SideNav.js +8 -24
- package/lib/components/UIShell/SideNavContext.d.ts +17 -0
- package/lib/components/UIShell/SideNavContext.js +27 -0
- package/lib/components/UIShell/SideNavItems.d.ts +1 -1
- package/lib/components/UIShell/SideNavItems.js +11 -15
- package/lib/components/UIShell/SideNavLink.js +7 -3
- package/lib/components/UIShell/SideNavMenu.js +8 -6
- package/lib/index.js +102 -100
- package/lib/internal/useNoInteractiveChildren.js +25 -30
- package/lib/internal/usePresence.d.ts +1 -1
- package/lib/internal/usePresence.js +13 -16
- package/package.json +5 -5
- package/telemetry.yml +2 -1
- package/es/components/UIShell/_utils.d.ts +0 -7
- package/es/components/UIShell/_utils.js +0 -10
- package/lib/components/UIShell/_utils.d.ts +0 -7
- package/lib/components/UIShell/_utils.js +0 -12
|
@@ -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, {
|
|
10
|
+
import React, { cloneElement, forwardRef, isValidElement } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import Link from '../Link/Link.js';
|
|
13
13
|
import { OverflowMenuHorizontal } from '@carbon/icons-react';
|
|
@@ -27,7 +27,8 @@ const ButtonSkeleton = ({
|
|
|
27
27
|
[`${prefix}--btn--md`]: size === 'md',
|
|
28
28
|
[`${prefix}--btn--lg`]: size === 'lg',
|
|
29
29
|
[`${prefix}--btn--xl`]: size === 'xl',
|
|
30
|
-
[`${prefix}--btn--2xl`]: size === '2xl'
|
|
30
|
+
[`${prefix}--btn--2xl`]: size === '2xl',
|
|
31
|
+
[`${prefix}--layout--size-${size}`]: size
|
|
31
32
|
});
|
|
32
33
|
const commonProps = {
|
|
33
34
|
className: buttonClasses,
|
|
@@ -17,7 +17,7 @@ export declare const ButtonTooltipPositions: string[];
|
|
|
17
17
|
export type ButtonTooltipPosition = (typeof ButtonTooltipPositions)[number];
|
|
18
18
|
export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
19
|
/**
|
|
20
|
-
* Specify the message read by screen readers for the danger button
|
|
20
|
+
* Specify the message read by screen readers for the danger button variants
|
|
21
21
|
*/
|
|
22
22
|
dangerDescription?: string;
|
|
23
23
|
/**
|
|
@@ -38,7 +38,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
38
38
|
*/
|
|
39
39
|
isExpressive?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
* Specify whether the Button is currently selected. Only applies to the Ghost variant.
|
|
41
|
+
* Specify whether the Button is currently selected. Only applies to the icon only Ghost variant.
|
|
42
42
|
*/
|
|
43
43
|
isSelected?: boolean;
|
|
44
44
|
/**
|
|
@@ -63,7 +63,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
63
63
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
64
64
|
/**
|
|
65
65
|
* Specify the alignment of the tooltip to the icon-only button.
|
|
66
|
-
* Can be one of: start
|
|
66
|
+
* Can be one of: `start`, `center`, or `end`.
|
|
67
67
|
*/
|
|
68
68
|
tooltipAlignment?: ButtonTooltipAlignment;
|
|
69
69
|
/**
|
|
@@ -77,7 +77,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
77
77
|
tooltipHighContrast?: boolean;
|
|
78
78
|
/**
|
|
79
79
|
* Specify the direction of the tooltip for icon-only buttons.
|
|
80
|
-
* Can be either top
|
|
80
|
+
* Can be either `top`, `right`, `bottom`, or `left`.
|
|
81
81
|
*/
|
|
82
82
|
tooltipPosition?: ButtonTooltipPosition;
|
|
83
83
|
}
|
|
@@ -127,7 +127,7 @@ Button.propTypes = {
|
|
|
127
127
|
*/
|
|
128
128
|
className: PropTypes.string,
|
|
129
129
|
/**
|
|
130
|
-
* Specify the message read by screen readers for the danger button
|
|
130
|
+
* Specify the message read by screen readers for the danger button variants
|
|
131
131
|
*/
|
|
132
132
|
dangerDescription: PropTypes.string,
|
|
133
133
|
/**
|
|
@@ -157,7 +157,7 @@ Button.propTypes = {
|
|
|
157
157
|
*/
|
|
158
158
|
isExpressive: PropTypes.bool,
|
|
159
159
|
/**
|
|
160
|
-
* Specify whether the Button is currently selected. Only applies to the Ghost variant.
|
|
160
|
+
* Specify whether the Button is currently selected. Only applies to the icon only Ghost variant.
|
|
161
161
|
*/
|
|
162
162
|
isSelected: PropTypes.bool,
|
|
163
163
|
/**
|
|
@@ -227,7 +227,7 @@ Button.propTypes = {
|
|
|
227
227
|
target: PropTypes.string,
|
|
228
228
|
/**
|
|
229
229
|
* Specify the alignment of the tooltip to the icon-only button.
|
|
230
|
-
* Can be one of: start
|
|
230
|
+
* Can be one of: `start`, `center`, or `end`.
|
|
231
231
|
*/
|
|
232
232
|
tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
|
|
233
233
|
/**
|
|
@@ -241,7 +241,7 @@ Button.propTypes = {
|
|
|
241
241
|
tooltipHighContrast: PropTypes.bool,
|
|
242
242
|
/**
|
|
243
243
|
* Specify the direction of the tooltip for icon-only buttons.
|
|
244
|
-
* Can be either top
|
|
244
|
+
* Can be either `top`, `right`, `bottom`, or `left`.
|
|
245
245
|
*/
|
|
246
246
|
tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
247
247
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import Button from './Button.js';
|
|
9
9
|
export { ButtonKinds, ButtonSizes, ButtonTooltipAlignments, ButtonTooltipPositions } from './Button.js';
|
|
10
|
-
export {
|
|
10
|
+
export { ButtonSkeleton } from './Button.Skeleton.js';
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -62,7 +62,7 @@ const ButtonSet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
62
62
|
});
|
|
63
63
|
resizeObserver.observe(fluidInnerRef.current);
|
|
64
64
|
return () => resizeObserver.disconnect();
|
|
65
|
-
}, [
|
|
65
|
+
}, [fluid, stacked]);
|
|
66
66
|
useEffect(() => {
|
|
67
67
|
const newSortedChildren = React.Children.toArray(children);
|
|
68
68
|
newSortedChildren.sort((a, b) => {
|
|
@@ -283,8 +283,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
283
283
|
if (isMatchingSelection) {
|
|
284
284
|
return changes;
|
|
285
285
|
}
|
|
286
|
-
const nextSelectedItem = items.find(item => itemToString(item) === inputValue) ?? inputValue;
|
|
287
|
-
const isCustomSelection = typeof nextSelectedItem === 'string' && !items.some(item => isEqual(item, nextSelectedItem));
|
|
286
|
+
const nextSelectedItem = inputValue === '' ? null : items.find(item => itemToString(item) === inputValue) ?? inputValue;
|
|
287
|
+
const isCustomSelection = typeof nextSelectedItem === 'string' && nextSelectedItem !== '' && !items.some(item => isEqual(item, nextSelectedItem));
|
|
288
288
|
if (!isEqual(currentSelectedItem, nextSelectedItem) && onChange) {
|
|
289
289
|
onChange({
|
|
290
290
|
selectedItem: nextSelectedItem,
|
|
@@ -257,9 +257,6 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
257
257
|
const containerClass = cx(`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
|
|
258
258
|
|
|
259
259
|
// Generate aria-label based on Modal Header label if one is not provided (L253)
|
|
260
|
-
//
|
|
261
|
-
// TODO: Confirm whether `ModalHeader` `label` should allow `ReactNode`. If
|
|
262
|
-
// so, define how to derive a string for `aria-label`.
|
|
263
260
|
let generatedAriaLabel;
|
|
264
261
|
const childrenWithProps = React.Children.toArray(children).map(child => {
|
|
265
262
|
if (isComponentElement(child, ModalHeader)) {
|
|
@@ -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 PropsWithChildren } from 'react';
|
|
7
|
+
import React, { type ComponentType, type PropsWithChildren } from 'react';
|
|
8
8
|
import { type PresenceContext } from '../../internal/usePresenceContext';
|
|
9
9
|
import { useComposedModalState } from './useComposedModalState';
|
|
10
10
|
export interface ComposedModalPresenceProps {
|
|
@@ -31,4 +31,12 @@ export declare const ComposedModalPresenceContext: React.Context<ComposedModalPr
|
|
|
31
31
|
* Handles occurrences where only a single composed modal must consume a context.
|
|
32
32
|
*/
|
|
33
33
|
export declare const useExclusiveComposedModalPresenceContext: (id: string) => ComposedModalPresenceContextProps | undefined;
|
|
34
|
+
type WithComposedModalPresenceProps = Pick<ComposedModalPresenceProps, 'open'>;
|
|
35
|
+
/**
|
|
36
|
+
* Higher-order function that wraps a component with ComposedModalPresence
|
|
37
|
+
*/
|
|
38
|
+
export declare const withComposedModalPresence: <TProps extends object>(Component: ComponentType<TProps>) => {
|
|
39
|
+
({ open, ...componentProps }: TProps & WithComposedModalPresenceProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
34
42
|
export {};
|
|
@@ -38,5 +38,18 @@ const useExclusiveComposedModalPresenceContext = id => {
|
|
|
38
38
|
const ctx = useContext(ComposedModalPresenceContext);
|
|
39
39
|
return ctx?.isPresenceExclusive(id) ? ctx : undefined;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Higher-order function that wraps a component with ComposedModalPresence
|
|
43
|
+
*/
|
|
44
|
+
const withComposedModalPresence = Component => {
|
|
45
|
+
const WithComposedModalPresence = ({
|
|
46
|
+
open,
|
|
47
|
+
...componentProps
|
|
48
|
+
}) => /*#__PURE__*/React.createElement(ComposedModalPresence, {
|
|
49
|
+
open: open
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Component, componentProps));
|
|
51
|
+
WithComposedModalPresence.displayName = `withComposedModalPresence(${Component.displayName || Component.name || 'Component'})`;
|
|
52
|
+
return WithComposedModalPresence;
|
|
53
|
+
};
|
|
41
54
|
|
|
42
|
-
export { ComposedModalPresence, ComposedModalPresenceContext, useExclusiveComposedModalPresenceContext };
|
|
55
|
+
export { ComposedModalPresence, ComposedModalPresenceContext, useExclusiveComposedModalPresenceContext, withComposedModalPresence };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import ComposedModal from './ComposedModal';
|
|
8
8
|
export { default as ComposedModal, type ComposedModalProps, ModalBody, type ModalBodyProps, } from './ComposedModal';
|
|
9
|
-
export { ComposedModalPresence, type ComposedModalPresenceProps, } from './ComposedModalPresence';
|
|
9
|
+
export { ComposedModalPresence, withComposedModalPresence, type ComposedModalPresenceProps, } from './ComposedModalPresence';
|
|
10
10
|
export { ModalHeader, type ModalHeaderProps } from './ModalHeader';
|
|
11
11
|
export { ModalFooter, type ModalFooterProps } from './ModalFooter';
|
|
12
12
|
export default ComposedModal;
|
|
@@ -8,7 +8,7 @@
|
|
|
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, {
|
|
11
|
+
import React, { useRef, forwardRef, cloneElement } from 'react';
|
|
12
12
|
import { ArrowUp, ArrowsVertical } from '@carbon/icons-react';
|
|
13
13
|
import { useId } from '../../internal/useId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { Children, forwardRef } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -11,7 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
-
import OverflowMenu from '../OverflowMenu/index.js';
|
|
14
|
+
import { OverflowMenu } from '../OverflowMenu/index.js';
|
|
15
15
|
|
|
16
16
|
const defaultIconDescription = 'Settings';
|
|
17
17
|
const TableToolbarMenu = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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,11 +7,14 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { type HTMLAttributes } from 'react';
|
|
9
9
|
export interface DatePickerSkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
-
range?: boolean;
|
|
11
10
|
/**
|
|
12
|
-
* Specify whether the label
|
|
11
|
+
* Specify whether to hide the label.
|
|
13
12
|
*/
|
|
14
13
|
hideLabel?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether to render the range skeleton variant.
|
|
16
|
+
*/
|
|
17
|
+
range?: boolean;
|
|
15
18
|
}
|
|
16
19
|
declare const DatePickerSkeleton: {
|
|
17
20
|
({ range, id, hideLabel, className, ...rest }: DatePickerSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,7 +24,7 @@ declare const DatePickerSkeleton: {
|
|
|
21
24
|
*/
|
|
22
25
|
className: PropTypes.Requireable<string>;
|
|
23
26
|
/**
|
|
24
|
-
* Specify whether the label
|
|
27
|
+
* Specify whether to hide the label.
|
|
25
28
|
*/
|
|
26
29
|
hideLabel: PropTypes.Requireable<boolean>;
|
|
27
30
|
/**
|
|
@@ -29,7 +32,7 @@ declare const DatePickerSkeleton: {
|
|
|
29
32
|
*/
|
|
30
33
|
id: PropTypes.Requireable<string>;
|
|
31
34
|
/**
|
|
32
|
-
* Specify whether
|
|
35
|
+
* Specify whether to render the range skeleton variant.
|
|
33
36
|
*/
|
|
34
37
|
range: PropTypes.Requireable<boolean>;
|
|
35
38
|
};
|
|
@@ -46,7 +46,7 @@ DatePickerSkeleton.propTypes = {
|
|
|
46
46
|
*/
|
|
47
47
|
className: PropTypes.string,
|
|
48
48
|
/**
|
|
49
|
-
* Specify whether the label
|
|
49
|
+
* Specify whether to hide the label.
|
|
50
50
|
*/
|
|
51
51
|
hideLabel: PropTypes.bool,
|
|
52
52
|
/**
|
|
@@ -54,7 +54,7 @@ DatePickerSkeleton.propTypes = {
|
|
|
54
54
|
*/
|
|
55
55
|
id: PropTypes.string,
|
|
56
56
|
/**
|
|
57
|
-
* Specify whether
|
|
57
|
+
* Specify whether to render the range skeleton variant.
|
|
58
58
|
*/
|
|
59
59
|
range: PropTypes.bool
|
|
60
60
|
};
|
|
@@ -9,7 +9,7 @@ import { Calendar, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
|
9
9
|
import { warning } from '../../internal/warning.js';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useContext, forwardRef, cloneElement } from 'react';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import '../FluidForm/FluidForm.js';
|
|
15
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
@@ -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, { useRef, useEffect,
|
|
10
|
+
import React, { useRef, useEffect, useContext, useState, createContext } from 'react';
|
|
11
11
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import cx from 'classnames';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useState, useRef, useEffect, forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import Search from '../Search/Search.js';
|
|
12
12
|
import '../Search/Search.Skeleton.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2015,
|
|
2
|
+
* Copyright IBM Corp. 2015, 2026
|
|
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 PropTypes from 'prop-types';
|
|
8
|
-
import
|
|
8
|
+
import { type ReactNode } from 'react';
|
|
9
9
|
export interface FeatureFlagsProps {
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
flags?: Record<string, boolean>;
|
|
@@ -20,19 +20,14 @@ export interface FeatureFlagsProps {
|
|
|
20
20
|
enableEnhancedFileUploader?: boolean;
|
|
21
21
|
enablePresence?: boolean;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
25
|
-
* or disable feature flags in a given React tree
|
|
26
|
-
*/
|
|
27
|
-
declare const FeatureFlagContext: React.Context<any>;
|
|
28
23
|
/**
|
|
29
24
|
* Supports an object of feature flag values with the `flags` prop, merging them
|
|
30
25
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
31
26
|
* a feature flag is enabled or disabled in a given React tree
|
|
32
27
|
*/
|
|
33
|
-
declare
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
export declare const FeatureFlags: {
|
|
29
|
+
({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
propTypes: {
|
|
36
31
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
37
32
|
/**
|
|
38
33
|
* Provide the feature flags to enabled or disabled in the current Rea,ct tree
|
|
@@ -49,18 +44,13 @@ declare namespace FeatureFlags {
|
|
|
49
44
|
enableEnhancedFileUploader: PropTypes.Requireable<boolean>;
|
|
50
45
|
enablePresence: PropTypes.Requireable<boolean>;
|
|
51
46
|
};
|
|
52
|
-
}
|
|
47
|
+
};
|
|
53
48
|
/**
|
|
54
49
|
* Access whether a given flag is enabled or disabled in a given
|
|
55
50
|
* FeatureFlagContext
|
|
56
|
-
*
|
|
57
|
-
* @returns {boolean}
|
|
58
51
|
*/
|
|
59
|
-
declare
|
|
52
|
+
export declare const useFeatureFlag: (flag: string) => boolean;
|
|
60
53
|
/**
|
|
61
54
|
* Access all feature flag information for the given FeatureFlagContext
|
|
62
|
-
*
|
|
63
|
-
* @returns {FeatureFlagScope}
|
|
64
55
|
*/
|
|
65
|
-
declare
|
|
66
|
-
export { FeatureFlags, FeatureFlagContext, useFeatureFlags, useFeatureFlag };
|
|
56
|
+
export declare const useFeatureFlags: () => import("@carbon/feature-flags/types/FeatureFlagScope").FeatureFlagScope;
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import { FeatureFlags as FeatureFlags$1, createScope } from '@carbon/feature-flags';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useContext, createContext,
|
|
10
|
+
import React, { useContext, createContext, useMemo } from 'react';
|
|
11
11
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
12
12
|
|
|
13
|
-
// TODO: Can this variable be deleted now? It isn't used anywhere.
|
|
14
13
|
/**
|
|
15
14
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
16
15
|
* or disable feature flags in a given React tree
|
|
@@ -22,7 +21,7 @@ const FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags$1);
|
|
|
22
21
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
23
22
|
* a feature flag is enabled or disabled in a given React tree
|
|
24
23
|
*/
|
|
25
|
-
|
|
24
|
+
const FeatureFlags = ({
|
|
26
25
|
children,
|
|
27
26
|
flags = {},
|
|
28
27
|
enableV12TileDefaultIcons = false,
|
|
@@ -35,46 +34,30 @@ function FeatureFlags({
|
|
|
35
34
|
enableV12DynamicFloatingStyles = false,
|
|
36
35
|
enableEnhancedFileUploader = false,
|
|
37
36
|
enablePresence = false
|
|
38
|
-
}) {
|
|
37
|
+
}) => {
|
|
39
38
|
const parentScope = useContext(FeatureFlagContext);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const [scope, updateScope] = useState(() => {
|
|
39
|
+
const scope = useMemo(() => {
|
|
40
|
+
const combinedFlags = {
|
|
41
|
+
'enable-v12-tile-default-icons': enableV12TileDefaultIcons,
|
|
42
|
+
'enable-v12-tile-radio-icons': enableV12TileRadioIcons,
|
|
43
|
+
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
44
|
+
'enable-treeview-controllable': enableTreeviewControllable,
|
|
45
|
+
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
46
|
+
'enable-focus-wrap-without-sentinels': enableFocusWrapWithoutSentinels,
|
|
47
|
+
'enable-dialog-element': enableDialogElement,
|
|
48
|
+
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
49
|
+
'enable-enhanced-file-uploader': enableEnhancedFileUploader,
|
|
50
|
+
'enable-presence': enablePresence,
|
|
51
|
+
...flags
|
|
52
|
+
};
|
|
55
53
|
const scope = createScope(combinedFlags);
|
|
56
54
|
scope.mergeWithScope(parentScope);
|
|
57
55
|
return scope;
|
|
58
|
-
});
|
|
59
|
-
if (parentScope !== prevParentScope) {
|
|
60
|
-
const scope = createScope(combinedFlags);
|
|
61
|
-
scope.mergeWithScope(parentScope);
|
|
62
|
-
updateScope(scope);
|
|
63
|
-
setPrevParentScope(parentScope);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// We use a custom hook to detect if any of the keys or their values change
|
|
67
|
-
// for flags that are passed in. If they have changed, then we re-create the
|
|
68
|
-
// FeatureFlagScope using the new flags
|
|
69
|
-
useChangedValue(combinedFlags, isEqual, changedFlags => {
|
|
70
|
-
const scope = createScope(changedFlags);
|
|
71
|
-
scope.mergeWithScope(parentScope);
|
|
72
|
-
updateScope(scope);
|
|
73
|
-
});
|
|
56
|
+
}, [enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, flags, parentScope]);
|
|
74
57
|
return /*#__PURE__*/React.createElement(FeatureFlagContext.Provider, {
|
|
75
58
|
value: scope
|
|
76
59
|
}, children);
|
|
77
|
-
}
|
|
60
|
+
};
|
|
78
61
|
FeatureFlags.propTypes = {
|
|
79
62
|
children: PropTypes.node,
|
|
80
63
|
/**
|
|
@@ -93,81 +76,18 @@ FeatureFlags.propTypes = {
|
|
|
93
76
|
enablePresence: PropTypes.bool
|
|
94
77
|
};
|
|
95
78
|
|
|
96
|
-
/**
|
|
97
|
-
* This hook will store previous versions of the given `value` and compare the
|
|
98
|
-
* current value to the previous one using the `compare` function. If the
|
|
99
|
-
* compare function returns true, then the given `callback` is invoked in an
|
|
100
|
-
* effect.
|
|
101
|
-
*
|
|
102
|
-
* @param {any} value
|
|
103
|
-
* @param {Function} compare
|
|
104
|
-
* @param {Function} callback
|
|
105
|
-
*/
|
|
106
|
-
function useChangedValue(value, compare, callback) {
|
|
107
|
-
const initialRender = useRef(false);
|
|
108
|
-
const savedCallback = useRef(callback);
|
|
109
|
-
const [prevValue, setPrevValue] = useState(value);
|
|
110
|
-
if (!compare(prevValue, value)) {
|
|
111
|
-
setPrevValue(value);
|
|
112
|
-
}
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
savedCallback.current = callback;
|
|
115
|
-
});
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
// We only want the callback triggered after the first render
|
|
118
|
-
if (initialRender.current) {
|
|
119
|
-
savedCallback.current(prevValue);
|
|
120
|
-
}
|
|
121
|
-
}, [prevValue]);
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
initialRender.current = true;
|
|
124
|
-
}, []);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
79
|
/**
|
|
128
80
|
* Access whether a given flag is enabled or disabled in a given
|
|
129
81
|
* FeatureFlagContext
|
|
130
|
-
*
|
|
131
|
-
* @returns {boolean}
|
|
132
82
|
*/
|
|
133
|
-
|
|
83
|
+
const useFeatureFlag = flag => {
|
|
134
84
|
const scope = useContext(FeatureFlagContext);
|
|
135
85
|
return scope.enabled(flag);
|
|
136
|
-
}
|
|
86
|
+
};
|
|
137
87
|
|
|
138
88
|
/**
|
|
139
89
|
* Access all feature flag information for the given FeatureFlagContext
|
|
140
|
-
*
|
|
141
|
-
* @returns {FeatureFlagScope}
|
|
142
|
-
*/
|
|
143
|
-
function useFeatureFlags() {
|
|
144
|
-
return useContext(FeatureFlagContext);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Compare two objects and determine if they are equal. This is a shallow
|
|
149
|
-
* comparison since the objects we are comparing are objects with boolean flags
|
|
150
|
-
* from the flags prop in the `FeatureFlags` component
|
|
151
|
-
*
|
|
152
|
-
* @param {object} a
|
|
153
|
-
* @param {object} b
|
|
154
|
-
* @returns {boolean}
|
|
155
90
|
*/
|
|
156
|
-
|
|
157
|
-
if (a === b) {
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
for (const key of Object.keys(a)) {
|
|
161
|
-
if (a[key] !== b[key]) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
for (const key of Object.keys(b)) {
|
|
166
|
-
if (b[key] !== a[key]) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
91
|
+
const useFeatureFlags = () => useContext(FeatureFlagContext);
|
|
172
92
|
|
|
173
|
-
export {
|
|
93
|
+
export { FeatureFlags, useFeatureFlag, useFeatureFlags };
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import SkeletonText from '../SkeletonText/SkeletonText.js';
|
|
13
|
-
import ButtonSkeleton from '../Button/Button.Skeleton.js';
|
|
13
|
+
import { ButtonSkeleton } from '../Button/Button.Skeleton.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
16
|
var _SkeletonText, _ButtonSkeleton;
|
|
@@ -8,7 +8,7 @@
|
|
|
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, { useState, useRef } from 'react';
|
|
11
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
12
12
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
13
|
import { matches } from '../../internal/keyboard/match.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
@@ -35,7 +35,6 @@ function FileUploaderButton({
|
|
|
35
35
|
}) {
|
|
36
36
|
const prefix = usePrefix();
|
|
37
37
|
const [labelText, setLabelText] = useState(ownerLabelText);
|
|
38
|
-
const [prevOwnerLabelText, setPrevOwnerLabelText] = useState(ownerLabelText);
|
|
39
38
|
const generatedId = useId();
|
|
40
39
|
const {
|
|
41
40
|
current: inputId
|
|
@@ -49,12 +48,9 @@ function FileUploaderButton({
|
|
|
49
48
|
[`${prefix}--btn--sm`]: size === 'small' || size === 'sm',
|
|
50
49
|
[`${prefix}--layout--size-${size}`]: size
|
|
51
50
|
});
|
|
52
|
-
|
|
53
|
-
// Adjust label text state based on changes to the labelText prop
|
|
54
|
-
if (ownerLabelText !== prevOwnerLabelText) {
|
|
51
|
+
useEffect(() => {
|
|
55
52
|
setLabelText(ownerLabelText);
|
|
56
|
-
|
|
57
|
-
}
|
|
53
|
+
}, [ownerLabelText]);
|
|
58
54
|
function onClick(event) {
|
|
59
55
|
event.target.value = null;
|
|
60
56
|
if (inputNode.current) {
|