@carbon/react 1.67.0 → 1.68.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 +881 -881
- package/es/components/ComboBox/ComboBox.js +12 -0
- package/es/components/ComposedModal/ModalHeader.js +1 -1
- package/es/components/Dropdown/Dropdown.js +3 -2
- package/es/components/FeatureFlags/index.d.ts +56 -0
- package/es/components/FeatureFlags/index.js +2 -2
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +144 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +15 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +1 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +149 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +5 -3
- package/es/components/FluidMultiSelect/index.d.ts +13 -0
- package/es/components/FluidNumberInput/index.d.ts +2 -2
- package/es/components/FluidSearch/index.d.ts +2 -2
- package/es/components/FluidSelect/index.d.ts +2 -2
- package/es/components/FluidTimePicker/index.d.ts +2 -2
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/es/components/Notification/Notification.d.ts +14 -9
- package/es/components/Notification/Notification.js +26 -7
- package/es/components/Notification/index.d.ts +1 -1
- package/es/components/Popover/index.js +1 -1
- package/es/components/Toggletip/index.d.ts +2 -15
- package/es/components/Toggletip/index.js +6 -3
- package/es/components/Tooltip/DefinitionTooltip.js +4 -2
- package/es/index.js +3 -3
- package/lib/components/ComboBox/ComboBox.js +12 -0
- package/lib/components/ComposedModal/ModalHeader.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +3 -2
- package/lib/components/FeatureFlags/index.d.ts +56 -0
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +144 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +15 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +1 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +149 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +5 -3
- package/lib/components/FluidMultiSelect/index.d.ts +13 -0
- package/lib/components/FluidNumberInput/index.d.ts +2 -2
- package/lib/components/FluidSearch/index.d.ts +2 -2
- package/lib/components/FluidSelect/index.d.ts +2 -2
- package/lib/components/FluidTimePicker/index.d.ts +2 -2
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/lib/components/Notification/Notification.d.ts +14 -9
- package/lib/components/Notification/Notification.js +26 -6
- package/lib/components/Notification/index.d.ts +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Toggletip/index.d.ts +2 -15
- package/lib/components/Toggletip/index.js +6 -3
- package/lib/components/Tooltip/DefinitionTooltip.js +4 -2
- package/lib/index.js +5 -4
- package/package.json +6 -6
|
@@ -21,6 +21,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
21
21
|
import { noopFn } from '../../internal/noopFn.js';
|
|
22
22
|
import wrapFocus, { wrapFocusWithoutSentinels } from '../../internal/wrapFocus.js';
|
|
23
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
|
+
import { warning } from '../../internal/warning.js';
|
|
24
25
|
import { Text } from '../Text/Text.js';
|
|
25
26
|
import { match, matches } from '../../internal/keyboard/match.js';
|
|
26
27
|
import { Tab, Escape } from '../../internal/keyboard/keys.js';
|
|
@@ -641,10 +642,9 @@ ActionableNotification.propTypes = {
|
|
|
641
642
|
*/
|
|
642
643
|
closeOnEscape: PropTypes.bool,
|
|
643
644
|
/**
|
|
644
|
-
* Deprecated, please use StaticNotification once it's available. Issue #15532
|
|
645
645
|
* Specify if focus should be moved to the component when the notification contains actions
|
|
646
646
|
*/
|
|
647
|
-
hasFocus: deprecate(PropTypes.bool),
|
|
647
|
+
hasFocus: deprecate(PropTypes.bool, 'hasFocus is deprecated. To conform to accessibility requirements hasFocus ' + 'should always be `true` for ActionableNotification. If you were ' + 'setting this prop to `false`, consider using the Callout component instead.'),
|
|
648
648
|
/**
|
|
649
649
|
* Specify the close button should be disabled, or not
|
|
650
650
|
*/
|
|
@@ -693,11 +693,11 @@ ActionableNotification.propTypes = {
|
|
|
693
693
|
};
|
|
694
694
|
|
|
695
695
|
/**
|
|
696
|
-
*
|
|
696
|
+
* Callout
|
|
697
697
|
* ==================
|
|
698
698
|
*/
|
|
699
699
|
|
|
700
|
-
function
|
|
700
|
+
function Callout(_ref8) {
|
|
701
701
|
let {
|
|
702
702
|
actionButtonLabel,
|
|
703
703
|
children,
|
|
@@ -747,7 +747,7 @@ function StaticNotification(_ref8) {
|
|
|
747
747
|
inline: true
|
|
748
748
|
}, actionButtonLabel)));
|
|
749
749
|
}
|
|
750
|
-
|
|
750
|
+
Callout.propTypes = {
|
|
751
751
|
/**
|
|
752
752
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
753
753
|
*/
|
|
@@ -765,7 +765,7 @@ StaticNotification.propTypes = {
|
|
|
765
765
|
*/
|
|
766
766
|
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
767
767
|
/**
|
|
768
|
-
* Specify whether you are using the low contrast variant of the
|
|
768
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
769
769
|
*/
|
|
770
770
|
lowContrast: PropTypes.bool,
|
|
771
771
|
/**
|
|
@@ -790,4 +790,23 @@ StaticNotification.propTypes = {
|
|
|
790
790
|
titleId: PropTypes.string
|
|
791
791
|
};
|
|
792
792
|
|
|
793
|
-
|
|
793
|
+
// In renaming StaticNotification to Callout, the legacy StaticNotification
|
|
794
|
+
// export and it's types should remain usable until Callout is moved to stable.
|
|
795
|
+
// The StaticNotification component below forwards props to Callout and inherits
|
|
796
|
+
// CalloutProps to ensure consumer usage is not impacted, while providing them
|
|
797
|
+
// a deprecation warning.
|
|
798
|
+
// TODO: remove this when Callout moves to stable OR in v12, whichever is first
|
|
799
|
+
/**
|
|
800
|
+
* @deprecated Use `CalloutProps` instead.
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
let didWarnAboutDeprecation = false;
|
|
804
|
+
const StaticNotification = props => {
|
|
805
|
+
if (process.env.NODE_ENV !== "production") {
|
|
806
|
+
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, '`StaticNotification` has been renamed to `Callout`.' + 'Run the following codemod to automatically update usages in your' + 'project: `npx @carbon/upgrade migrate refactor-to-callout --write`') : void 0;
|
|
807
|
+
didWarnAboutDeprecation = true;
|
|
808
|
+
}
|
|
809
|
+
return /*#__PURE__*/React__default.createElement(Callout, props);
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
export { ActionableNotification, Callout, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification };
|
|
@@ -4,4 +4,4 @@
|
|
|
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 { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, } from './Notification';
|
|
7
|
+
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, Callout, type CalloutProps, } from './Notification';
|
|
@@ -206,7 +206,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
206
206
|
*/
|
|
207
207
|
const isTriggerElement = item?.type === 'button';
|
|
208
208
|
const isTriggerComponent = autoAlign && displayName && ['ToggletipButton'].includes(displayName);
|
|
209
|
-
const isAllowedTriggerComponent = autoAlign &&
|
|
209
|
+
const isAllowedTriggerComponent = autoAlign && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
210
210
|
if ( /*#__PURE__*/React__default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
211
211
|
const className = item?.props?.className;
|
|
212
212
|
const ref = (item?.props).ref;
|
|
@@ -99,20 +99,8 @@ interface ToggletipContentProps {
|
|
|
99
99
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
100
100
|
* be rendered inside of the popover for this component.
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
export
|
|
104
|
-
var propTypes: {
|
|
105
|
-
/**
|
|
106
|
-
* Custom children to be rendered as the content of the label
|
|
107
|
-
*/
|
|
108
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
-
/**
|
|
110
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
111
|
-
* component
|
|
112
|
-
*/
|
|
113
|
-
className: PropTypes.Requireable<string>;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
102
|
+
declare const ToggletipContent: React.ForwardRefExoticComponent<ToggletipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
export { ToggletipContent };
|
|
116
104
|
interface ToggleTipActionsProps {
|
|
117
105
|
children?: ReactNode;
|
|
118
106
|
className?: string | undefined;
|
|
@@ -135,4 +123,3 @@ export declare namespace ToggletipActions {
|
|
|
135
123
|
className: PropTypes.Requireable<string>;
|
|
136
124
|
};
|
|
137
125
|
}
|
|
138
|
-
export {};
|
|
@@ -245,7 +245,7 @@ ToggletipButton.displayName = 'ToggletipButton';
|
|
|
245
245
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
246
246
|
* be rendered inside of the popover for this component.
|
|
247
247
|
*/
|
|
248
|
-
function ToggletipContent(_ref4) {
|
|
248
|
+
const ToggletipContent = /*#__PURE__*/React__default.forwardRef(function ToggletipContent(_ref4, ref) {
|
|
249
249
|
let {
|
|
250
250
|
children,
|
|
251
251
|
className: customClassName
|
|
@@ -254,10 +254,12 @@ function ToggletipContent(_ref4) {
|
|
|
254
254
|
const prefix = usePrefix();
|
|
255
255
|
return /*#__PURE__*/React__default.createElement(PopoverContent, _extends({
|
|
256
256
|
className: customClassName
|
|
257
|
-
}, toggletip?.contentProps
|
|
257
|
+
}, toggletip?.contentProps, {
|
|
258
|
+
ref: ref
|
|
259
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
258
260
|
className: `${prefix}--toggletip-content`
|
|
259
261
|
}, children));
|
|
260
|
-
}
|
|
262
|
+
});
|
|
261
263
|
ToggletipContent.propTypes = {
|
|
262
264
|
/**
|
|
263
265
|
* Custom children to be rendered as the content of the label
|
|
@@ -269,6 +271,7 @@ ToggletipContent.propTypes = {
|
|
|
269
271
|
*/
|
|
270
272
|
className: PropTypes.string
|
|
271
273
|
};
|
|
274
|
+
ToggletipContent.displayName = 'ToggletipContent';
|
|
272
275
|
/**
|
|
273
276
|
* `ToggletipActions` is a container for one or two actions present at the base
|
|
274
277
|
* of a toggletip. It is used for layout of these items.
|
|
@@ -60,8 +60,10 @@ const DefinitionTooltip = _ref => {
|
|
|
60
60
|
onBlur: () => {
|
|
61
61
|
setOpen(false);
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
onMouseDown: event => {
|
|
64
|
+
// We use onMouseDown rather than onClick to make sure this triggers
|
|
65
|
+
// before onFocus.
|
|
66
|
+
if (event.button === 0) setOpen(!isOpen);
|
|
65
67
|
},
|
|
66
68
|
onKeyDown: onKeyDown,
|
|
67
69
|
type: "button"
|
package/es/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export { MenuButton } from './components/MenuButton/index.js';
|
|
|
71
71
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
72
72
|
export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
|
|
73
73
|
import './components/MultiSelect/index.js';
|
|
74
|
-
export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
74
|
+
export { ActionableNotification, Callout, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
75
75
|
export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
|
|
76
76
|
export { NumberInput } from './components/NumberInput/NumberInput.js';
|
|
77
77
|
export { default as OrderedList } from './components/OrderedList/OrderedList.js';
|
|
@@ -159,6 +159,8 @@ export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem
|
|
|
159
159
|
export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
|
|
160
160
|
export { default as UnorderedList } from './components/UnorderedList/UnorderedList.js';
|
|
161
161
|
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
|
162
|
+
export { default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
|
|
163
|
+
export { default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
|
|
162
164
|
export { default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
|
|
163
165
|
export { default as unstable__FluidSelectSkeleton } from './components/FluidSelect/FluidSelect.Skeleton.js';
|
|
164
166
|
export { default as unstable__FluidSearch } from './components/FluidSearch/FluidSearch.js';
|
|
@@ -205,8 +207,6 @@ export { default as unstable__FluidDatePicker } from './components/FluidDatePick
|
|
|
205
207
|
export { default as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput/FluidDatePickerInput.js';
|
|
206
208
|
export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
|
|
207
209
|
export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
|
|
208
|
-
export { default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
|
|
209
|
-
export { default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
|
|
210
210
|
export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
|
|
211
211
|
export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
|
|
212
212
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
@@ -314,6 +314,12 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
314
314
|
if (onToggleClick) {
|
|
315
315
|
onToggleClick(event);
|
|
316
316
|
}
|
|
317
|
+
if (readOnly) {
|
|
318
|
+
// Prevent the list from opening if readOnly is true
|
|
319
|
+
event.preventDownshiftDefault = true;
|
|
320
|
+
event?.persist?.();
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
317
323
|
if (event.target === textInput.current && isOpen) {
|
|
318
324
|
event.preventDownshiftDefault = true;
|
|
319
325
|
event?.persist?.();
|
|
@@ -462,6 +468,12 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
462
468
|
if (evt.key !== 'Tab') {
|
|
463
469
|
evt.preventDefault();
|
|
464
470
|
}
|
|
471
|
+
},
|
|
472
|
+
onClick: evt => {
|
|
473
|
+
// Prevent the default behavior which would open the list
|
|
474
|
+
evt.preventDefault();
|
|
475
|
+
// Focus on the element as per readonly input behavior
|
|
476
|
+
evt.currentTarget.focus();
|
|
465
477
|
}
|
|
466
478
|
} : {};
|
|
467
479
|
|
|
@@ -54,7 +54,7 @@ const ModalHeader = /*#__PURE__*/React__default["default"].forwardRef(function M
|
|
|
54
54
|
ref: ref
|
|
55
55
|
}), label && /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
56
56
|
className: labelClass
|
|
57
|
-
}, label), title && /*#__PURE__*/React__default["default"].createElement("
|
|
57
|
+
}, label), title && /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
58
58
|
className: titleClass
|
|
59
59
|
}, title), children, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
60
60
|
className: `${prefix}--modal-close-button`
|
|
@@ -217,7 +217,9 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
217
217
|
|
|
218
218
|
// needs to be Capitalized for react to render it correctly
|
|
219
219
|
const ItemToElement = itemToElement;
|
|
220
|
-
const toggleButtonProps = getToggleButtonProps(
|
|
220
|
+
const toggleButtonProps = getToggleButtonProps({
|
|
221
|
+
'aria-label': ariaLabel || deprecatedAriaLabel
|
|
222
|
+
});
|
|
221
223
|
const helper = helperText && !isFluid ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
222
224
|
id: helperId,
|
|
223
225
|
className: helperClasses
|
|
@@ -292,7 +294,6 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
292
294
|
}, getLabelProps()), titleText), /*#__PURE__*/React__default["default"].createElement(index["default"], {
|
|
293
295
|
onFocus: handleFocus,
|
|
294
296
|
onBlur: handleFocus,
|
|
295
|
-
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
296
297
|
size: size,
|
|
297
298
|
className: className,
|
|
298
299
|
invalid: invalid,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2015, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
|
+
interface FeatureFlagsProps {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
flags?: Record<string, boolean>;
|
|
12
|
+
enableV12TileDefaultIcons?: boolean;
|
|
13
|
+
enableV12TileRadioIcons?: boolean;
|
|
14
|
+
enableV12Overflowmenu?: boolean;
|
|
15
|
+
enableTreeviewControllable?: boolean;
|
|
16
|
+
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
20
|
+
* or disable feature flags in a given React tree
|
|
21
|
+
*/
|
|
22
|
+
declare const FeatureFlagContext: React.Context<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Supports an object of feature flag values with the `flags` prop, merging them
|
|
25
|
+
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
26
|
+
* a feature flag is enabled or disabled in a given React tree
|
|
27
|
+
*/
|
|
28
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, }: FeatureFlagsProps): JSX.Element;
|
|
29
|
+
declare namespace FeatureFlags {
|
|
30
|
+
var propTypes: {
|
|
31
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
32
|
+
/**
|
|
33
|
+
* Provide the feature flags to enabled or disabled in the current Rea,ct tree
|
|
34
|
+
*/
|
|
35
|
+
flags: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
36
|
+
enableV12TileDefaultIcons: PropTypes.Requireable<boolean>;
|
|
37
|
+
enableV12TileRadioIcons: PropTypes.Requireable<boolean>;
|
|
38
|
+
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
39
|
+
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
40
|
+
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Access whether a given flag is enabled or disabled in a given
|
|
45
|
+
* FeatureFlagContext
|
|
46
|
+
*
|
|
47
|
+
* @returns {boolean}
|
|
48
|
+
*/
|
|
49
|
+
declare function useFeatureFlag(flag: any): any;
|
|
50
|
+
/**
|
|
51
|
+
* Access all feature flag information for the given FeatureFlagContext
|
|
52
|
+
*
|
|
53
|
+
* @returns {FeatureFlagScope}
|
|
54
|
+
*/
|
|
55
|
+
declare function useFeatureFlags(): any;
|
|
56
|
+
export { FeatureFlags, FeatureFlagContext, useFeatureFlags, useFeatureFlag };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { FunctionComponent } from 'react';
|
|
8
|
+
import { UseComboboxProps, UseMultipleSelectionProps } from 'downshift';
|
|
9
|
+
import { FilterableMultiSelectProps } from '../MultiSelect/FilterableMultiSelect';
|
|
10
|
+
interface OnChangeData<ItemType> {
|
|
11
|
+
selectedItems: ItemType[] | null;
|
|
12
|
+
}
|
|
13
|
+
export interface FluidFilterableMultiSelectProps<ItemType> extends FilterableMultiSelectProps<ItemType> {
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify the text that should be read for screen readers that describes total items selected
|
|
20
|
+
*/
|
|
21
|
+
clearSelectionDescription?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Specify the text that should be read for screen readers to clear selection.
|
|
24
|
+
*/
|
|
25
|
+
clearSelectionText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
28
|
+
*/
|
|
29
|
+
direction?: 'top' | 'bottom';
|
|
30
|
+
/**
|
|
31
|
+
* Specify whether the `<input>` should be disabled
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Additional props passed to Downshift.
|
|
36
|
+
*
|
|
37
|
+
* **Use with caution:** anything you define here overrides the components'
|
|
38
|
+
* internal handling of that prop. Downshift APIs and internals are subject to
|
|
39
|
+
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
40
|
+
* from potentially breaking changes.
|
|
41
|
+
*/
|
|
42
|
+
downshiftProps?: Partial<UseMultipleSelectionProps<ItemType>>;
|
|
43
|
+
/**
|
|
44
|
+
* Specify a custom `id` for the `<input>`
|
|
45
|
+
*/
|
|
46
|
+
id: string;
|
|
47
|
+
/**
|
|
48
|
+
* Allow users to pass in arbitrary items from their collection that are
|
|
49
|
+
* pre-selected
|
|
50
|
+
*/
|
|
51
|
+
initialSelectedItems?: ItemType[];
|
|
52
|
+
/**
|
|
53
|
+
* Specify if the currently selected value is invalid.
|
|
54
|
+
*/
|
|
55
|
+
invalid?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
58
|
+
*/
|
|
59
|
+
invalidText?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Specify if the `FluidMultiSelect` should render its menu items in condensed mode
|
|
62
|
+
*/
|
|
63
|
+
isCondensed?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Function to render items as custom components instead of strings.
|
|
66
|
+
* Defaults to null and is overridden by a getter
|
|
67
|
+
*/
|
|
68
|
+
itemToElement?: FunctionComponent<ItemType>;
|
|
69
|
+
/**
|
|
70
|
+
* Helper function passed to downshift that allows the library to render a
|
|
71
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
72
|
+
* from a given item to serve as the item label in the list. Consider
|
|
73
|
+
* declaring function with `useCallback` to prevent unnecessary re-renders.
|
|
74
|
+
*/
|
|
75
|
+
itemToString?(item: ItemType): string;
|
|
76
|
+
/**
|
|
77
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
78
|
+
* in a collection of whatever kind of data structure they prefer
|
|
79
|
+
*/
|
|
80
|
+
items: ItemType[];
|
|
81
|
+
/**
|
|
82
|
+
* Generic `label` that will be used as the textual representation of what
|
|
83
|
+
* this field is for
|
|
84
|
+
*/
|
|
85
|
+
label: NonNullable<React.ReactNode>;
|
|
86
|
+
/**
|
|
87
|
+
* Specify the locale of the control. Used for the default `compareItems`
|
|
88
|
+
* used for sorting the list of items in the control.
|
|
89
|
+
*/
|
|
90
|
+
locale?: string;
|
|
91
|
+
/**
|
|
92
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
93
|
+
* consuming component what kind of internal state changes are occurring.
|
|
94
|
+
*/
|
|
95
|
+
onChange?(data: OnChangeData<ItemType>): void;
|
|
96
|
+
/**
|
|
97
|
+
* **Filterable variant only** - `onInputValueChange` is a utility for this controlled component to communicate to
|
|
98
|
+
* the currently typed input.
|
|
99
|
+
*/
|
|
100
|
+
onInputValueChange?: UseComboboxProps<ItemType>['onInputValueChange'];
|
|
101
|
+
/**
|
|
102
|
+
* `onMenuChange` is a utility for this controlled component to communicate to a
|
|
103
|
+
* consuming component that the menu was open(`true`)/closed(`false`).
|
|
104
|
+
*/
|
|
105
|
+
onMenuChange?(open: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* Whether or not the Multiselect is readonly
|
|
108
|
+
*/
|
|
109
|
+
readOnly?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* For full control of the selected items
|
|
112
|
+
*/
|
|
113
|
+
selectedItems?: ItemType[];
|
|
114
|
+
/**
|
|
115
|
+
* Specify feedback (mode) of the selection.
|
|
116
|
+
* `top`: selected item jumps to top
|
|
117
|
+
* `fixed`: selected item stays at it's position
|
|
118
|
+
* `top-after-reopen`: selected item jump to top after reopen dropdown
|
|
119
|
+
*/
|
|
120
|
+
selectionFeedback?: 'top' | 'fixed' | 'top-after-reopen';
|
|
121
|
+
/**
|
|
122
|
+
* Provide the title text that will be read by a screen reader when
|
|
123
|
+
* visiting this control
|
|
124
|
+
*/
|
|
125
|
+
titleText?: React.ReactNode;
|
|
126
|
+
/**
|
|
127
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
128
|
+
*/
|
|
129
|
+
translateWithId?: (id: string) => string;
|
|
130
|
+
/**
|
|
131
|
+
* Specify title to show title on hover
|
|
132
|
+
*/
|
|
133
|
+
useTitleInItem?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Specify whether the control is currently in warning state
|
|
136
|
+
*/
|
|
137
|
+
warn?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Provide the text that is displayed when the control is in warning state
|
|
140
|
+
*/
|
|
141
|
+
warnText?: React.ReactNode;
|
|
142
|
+
}
|
|
143
|
+
declare const FluidMultiSelect: React.ForwardRefExoticComponent<Omit<FluidFilterableMultiSelectProps<unknown>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
144
|
+
export default FluidMultiSelect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface FluidMultiSelectSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const FluidMultiSelectSkeleton: React.FC<FluidMultiSelectSkeletonProps>;
|
|
15
|
+
export default FluidMultiSelectSkeleton;
|
|
@@ -44,6 +44,5 @@ FluidMultiSelectSkeleton.propTypes = {
|
|
|
44
44
|
*/
|
|
45
45
|
className: PropTypes__default["default"].string
|
|
46
46
|
};
|
|
47
|
-
var FluidMultiSelectSkeleton$1 = FluidMultiSelectSkeleton;
|
|
48
47
|
|
|
49
|
-
exports["default"] = FluidMultiSelectSkeleton
|
|
48
|
+
exports["default"] = FluidMultiSelectSkeleton;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { UseSelectProps } from 'downshift';
|
|
9
|
+
import { MultiSelectProps } from '../MultiSelect/MultiSelect';
|
|
10
|
+
interface OnChangeData<ItemType> {
|
|
11
|
+
selectedItems: ItemType[] | null;
|
|
12
|
+
}
|
|
13
|
+
export interface FluidMultiSelectProps<ItemType> extends MultiSelectProps<ItemType> {
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify the text that should be read for screen readers that describes total items selected
|
|
20
|
+
*/
|
|
21
|
+
clearSelectionDescription?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Specify the text that should be read for screen readers to clear selection.
|
|
24
|
+
*/
|
|
25
|
+
clearSelectionText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
28
|
+
*/
|
|
29
|
+
direction?: 'top' | 'bottom';
|
|
30
|
+
/**
|
|
31
|
+
* Specify whether the `<input>` should be disabled
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Additional props passed to Downshift.
|
|
36
|
+
*
|
|
37
|
+
* **Use with caution:** anything you define here overrides the components'
|
|
38
|
+
* internal handling of that prop. Downshift APIs and internals are subject to
|
|
39
|
+
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
40
|
+
* from potentially breaking changes.
|
|
41
|
+
*/
|
|
42
|
+
downshiftProps?: Partial<UseSelectProps<ItemType>>;
|
|
43
|
+
/**
|
|
44
|
+
* Specify a custom `id` for the `<input>`
|
|
45
|
+
*/
|
|
46
|
+
id: string;
|
|
47
|
+
/**
|
|
48
|
+
* Allow users to pass in arbitrary items from their collection that are
|
|
49
|
+
* pre-selected
|
|
50
|
+
*/
|
|
51
|
+
initialSelectedItems?: ItemType[];
|
|
52
|
+
/**
|
|
53
|
+
* Specify if the currently selected value is invalid.
|
|
54
|
+
*/
|
|
55
|
+
invalid?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
58
|
+
*/
|
|
59
|
+
invalidText?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Specify if the `FluidMultiSelect` should render its menu items in condensed mode
|
|
62
|
+
*/
|
|
63
|
+
isCondensed?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Specify if the `FluidMultiSelect` should render the `filterable` variant of `FluidMultiSelect`
|
|
66
|
+
* @deprecated This prop is deprecated in favor of new component called FluidFilterableMultiSelect and will be removed in the next major release
|
|
67
|
+
*/
|
|
68
|
+
isFilterable?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Function to render items as custom components instead of strings.
|
|
71
|
+
* Defaults to null and is overridden by a getter
|
|
72
|
+
*/
|
|
73
|
+
itemToElement?: React.JSXElementConstructor<ItemType>;
|
|
74
|
+
/**
|
|
75
|
+
* Helper function passed to downshift that allows the library to render a
|
|
76
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
77
|
+
* from a given item to serve as the item label in the list. Consider
|
|
78
|
+
* declaring function with `useCallback` to prevent unnecessary re-renders.
|
|
79
|
+
*/
|
|
80
|
+
itemToString?(item: ItemType): string;
|
|
81
|
+
/**
|
|
82
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
83
|
+
* in a collection of whatever kind of data structure they prefer
|
|
84
|
+
*/
|
|
85
|
+
items: ItemType[];
|
|
86
|
+
/**
|
|
87
|
+
* Generic `label` that will be used as the textual representation of what
|
|
88
|
+
* this field is for
|
|
89
|
+
*/
|
|
90
|
+
label: NonNullable<React.ReactNode>;
|
|
91
|
+
/**
|
|
92
|
+
* Specify the locale of the control. Used for the default `compareItems`
|
|
93
|
+
* used for sorting the list of items in the control.
|
|
94
|
+
*/
|
|
95
|
+
locale?: string;
|
|
96
|
+
/**
|
|
97
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
98
|
+
* consuming component what kind of internal state changes are occurring.
|
|
99
|
+
*/
|
|
100
|
+
onChange?(data: OnChangeData<ItemType>): void;
|
|
101
|
+
/**
|
|
102
|
+
* **Filterable variant only** - `onInputValueChange` is a utility for this controlled component to communicate to
|
|
103
|
+
* the currently typed input.
|
|
104
|
+
*/
|
|
105
|
+
onInputValueChange?: (inputValue: string) => void;
|
|
106
|
+
/**
|
|
107
|
+
* `onMenuChange` is a utility for this controlled component to communicate to a
|
|
108
|
+
* consuming component that the menu was open(`true`)/closed(`false`).
|
|
109
|
+
*/
|
|
110
|
+
onMenuChange?(open: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* Whether or not the Multiselect is readonly
|
|
113
|
+
*/
|
|
114
|
+
readOnly?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* For full control of the selected items
|
|
117
|
+
*/
|
|
118
|
+
selectedItems?: ItemType[];
|
|
119
|
+
/**
|
|
120
|
+
* Specify feedback (mode) of the selection.
|
|
121
|
+
* `top`: selected item jumps to top
|
|
122
|
+
* `fixed`: selected item stays at it's position
|
|
123
|
+
* `top-after-reopen`: selected item jump to top after reopen dropdown
|
|
124
|
+
*/
|
|
125
|
+
selectionFeedback?: 'top' | 'fixed' | 'top-after-reopen';
|
|
126
|
+
/**
|
|
127
|
+
* Provide the title text that will be read by a screen reader when
|
|
128
|
+
* visiting this control
|
|
129
|
+
*/
|
|
130
|
+
titleText?: React.ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
133
|
+
*/
|
|
134
|
+
translateWithId?: (id: string) => string;
|
|
135
|
+
/**
|
|
136
|
+
* Specify title to show title on hover
|
|
137
|
+
*/
|
|
138
|
+
useTitleInItem?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Specify whether the control is currently in warning state
|
|
141
|
+
*/
|
|
142
|
+
warn?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Provide the text that is displayed when the control is in warning state
|
|
145
|
+
*/
|
|
146
|
+
warnText?: React.ReactNode;
|
|
147
|
+
}
|
|
148
|
+
declare const FluidMultiSelect: React.ForwardRefExoticComponent<FluidMultiSelectProps<unknown> & React.RefAttributes<HTMLButtonElement>>;
|
|
149
|
+
export default FluidMultiSelect;
|
|
@@ -40,7 +40,10 @@ const FluidMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
|
40
40
|
value: {
|
|
41
41
|
isFluid: true
|
|
42
42
|
}
|
|
43
|
-
}, isFilterable ?
|
|
43
|
+
}, isFilterable ?
|
|
44
|
+
/*#__PURE__*/
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
React__default["default"].createElement(FilterableMultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
|
|
44
47
|
ref: ref,
|
|
45
48
|
className: classNames
|
|
46
49
|
}, other)) : /*#__PURE__*/React__default["default"].createElement(MultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
|
|
@@ -209,6 +212,5 @@ FluidMultiSelect.propTypes = {
|
|
|
209
212
|
*/
|
|
210
213
|
warnText: PropTypes__default["default"].node
|
|
211
214
|
};
|
|
212
|
-
var FluidMultiSelect$1 = FluidMultiSelect;
|
|
213
215
|
|
|
214
|
-
exports["default"] = FluidMultiSelect
|
|
216
|
+
exports["default"] = FluidMultiSelect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import FluidMultiSelect from './FluidMultiSelect';
|
|
8
|
+
import type { FluidMultiSelectProps } from './FluidMultiSelect';
|
|
9
|
+
import type { FluidMultiSelectSkeletonProps } from './FluidMultiSelect.Skeleton';
|
|
10
|
+
export type { FluidMultiSelectProps, FluidMultiSelectSkeletonProps };
|
|
11
|
+
export default FluidMultiSelect;
|
|
12
|
+
export { FluidMultiSelect };
|
|
13
|
+
export { default as FluidMultiSelectSkeleton } from './FluidMultiSelect.Skeleton';
|