@carbon/react 1.69.0-rc.0 → 1.70.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 +864 -864
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/ContextMenu/index.d.ts +8 -0
- package/es/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/es/components/ContextMenu/useContextMenu.js +9 -8
- package/es/components/DataTable/DataTable.d.ts +3 -2
- package/es/components/Dropdown/Dropdown.d.ts +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +5 -2
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/es/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/es/components/FluidDropdown/FluidDropdown.js +1 -2
- package/es/components/FluidDropdown/index.d.ts +13 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +22 -5
- package/es/components/Grid/CSSGrid.js +8 -1
- package/es/components/Grid/Grid.js +4 -0
- package/es/components/ListBox/next/ListBoxSelection.d.ts +9 -1
- package/es/components/ListBox/next/ListBoxSelection.js +12 -5
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +4 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +32 -6
- package/es/components/Notification/Notification.js +2 -6
- package/es/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/es/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/es/components/Popover/index.js +2 -0
- package/es/components/Tabs/Tabs.js +47 -21
- package/es/components/Tag/SelectableTag.d.ts +17 -1
- package/es/components/Tag/SelectableTag.js +21 -13
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/feature-flags.js +2 -1
- package/es/index.js +3 -3
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/ContextMenu/index.d.ts +8 -0
- package/lib/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/lib/components/ContextMenu/useContextMenu.js +9 -8
- package/lib/components/DataTable/DataTable.d.ts +3 -2
- package/lib/components/Dropdown/Dropdown.d.ts +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +5 -2
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
- package/lib/components/FluidDropdown/index.d.ts +13 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +24 -5
- package/lib/components/Grid/CSSGrid.js +8 -1
- package/lib/components/Grid/Grid.js +4 -0
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +9 -1
- package/lib/components/ListBox/next/ListBoxSelection.js +12 -5
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +4 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +32 -6
- package/lib/components/Notification/Notification.js +2 -6
- package/lib/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/lib/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/lib/components/Popover/index.js +2 -0
- package/lib/components/Tabs/Tabs.js +47 -21
- package/lib/components/Tag/SelectableTag.d.ts +17 -1
- package/lib/components/Tag/SelectableTag.js +21 -13
- package/lib/components/UIShell/HeaderPanel.js +1 -1
- package/lib/feature-flags.js +2 -1
- package/lib/index.js +6 -6
- package/package.json +12 -10
- package/telemetry.yml +765 -710
|
@@ -14,6 +14,7 @@ interface FeatureFlagsProps {
|
|
|
14
14
|
enableV12Overflowmenu?: boolean;
|
|
15
15
|
enableTreeviewControllable?: boolean;
|
|
16
16
|
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
enableV12DynamicFloatingStyles?: boolean;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
@@ -25,7 +26,7 @@ declare const FeatureFlagContext: React.Context<any>;
|
|
|
25
26
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
26
27
|
* a feature flag is enabled or disabled in a given React tree
|
|
27
28
|
*/
|
|
28
|
-
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, }: FeatureFlagsProps): JSX.Element;
|
|
29
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
29
30
|
declare namespace FeatureFlags {
|
|
30
31
|
var propTypes: {
|
|
31
32
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -38,6 +39,7 @@ declare namespace FeatureFlags {
|
|
|
38
39
|
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
39
40
|
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
40
41
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
42
|
+
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
@@ -38,7 +38,8 @@ function FeatureFlags(_ref) {
|
|
|
38
38
|
enableV12TileRadioIcons = false,
|
|
39
39
|
enableV12Overflowmenu = false,
|
|
40
40
|
enableTreeviewControllable = false,
|
|
41
|
-
enableExperimentalFocusWrapWithoutSentinels = false
|
|
41
|
+
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
42
|
+
enableV12DynamicFloatingStyles = false
|
|
42
43
|
} = _ref;
|
|
43
44
|
const parentScope = React.useContext(FeatureFlagContext);
|
|
44
45
|
const [prevParentScope, setPrevParentScope] = React.useState(parentScope);
|
|
@@ -48,6 +49,7 @@ function FeatureFlags(_ref) {
|
|
|
48
49
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
49
50
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
50
51
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
52
|
+
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
51
53
|
...flags
|
|
52
54
|
};
|
|
53
55
|
const [scope, updateScope] = React.useState(() => {
|
|
@@ -84,7 +86,8 @@ FeatureFlags.propTypes = {
|
|
|
84
86
|
enableV12TileRadioIcons: PropTypes__default["default"].bool,
|
|
85
87
|
enableV12Overflowmenu: PropTypes__default["default"].bool,
|
|
86
88
|
enableTreeviewControllable: PropTypes__default["default"].bool,
|
|
87
|
-
enableExperimentalFocusWrapWithoutSentinels: PropTypes__default["default"].bool
|
|
89
|
+
enableExperimentalFocusWrapWithoutSentinels: PropTypes__default["default"].bool,
|
|
90
|
+
enableV12DynamicFloatingStyles: PropTypes__default["default"].bool
|
|
88
91
|
};
|
|
89
92
|
|
|
90
93
|
/**
|
|
@@ -27,12 +27,12 @@ const FluidComboBoxSkeleton = _ref => {
|
|
|
27
27
|
...rest
|
|
28
28
|
} = _ref;
|
|
29
29
|
const prefix = usePrefix.usePrefix();
|
|
30
|
-
const wrapperClasses = cx__default["default"](className, `${prefix}--
|
|
31
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
32
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
33
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
30
|
+
const wrapperClasses = cx__default["default"](className, `${prefix}--list-box__wrapper--fluid`);
|
|
31
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
34
32
|
className: wrapperClasses
|
|
35
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
33
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
36
36
|
className: `${prefix}--list-box__label`
|
|
37
37
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38
38
|
className: `${prefix}--list-box__field`
|
|
@@ -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 FluidDropdownSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const FluidDropdownSkeleton: React.FC<FluidDropdownSkeletonProps>;
|
|
15
|
+
export default FluidDropdownSkeleton;
|
|
@@ -27,13 +27,12 @@ const FluidDropdownSkeleton = _ref => {
|
|
|
27
27
|
...rest
|
|
28
28
|
} = _ref;
|
|
29
29
|
const prefix = usePrefix.usePrefix();
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
33
|
-
className: wrapperContainerClasses
|
|
34
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
30
|
+
const wrapperClasses = cx__default["default"](className, `${prefix}--list-box__wrapper--fluid`);
|
|
31
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
35
32
|
className: wrapperClasses
|
|
36
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
33
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
37
36
|
className: `${prefix}--list-box__label`
|
|
38
37
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
39
38
|
className: `${prefix}--list-box__field`
|
|
@@ -45,6 +44,5 @@ FluidDropdownSkeleton.propTypes = {
|
|
|
45
44
|
*/
|
|
46
45
|
className: PropTypes__default["default"].string
|
|
47
46
|
};
|
|
48
|
-
var FluidDropdownSkeleton$1 = FluidDropdownSkeleton;
|
|
49
47
|
|
|
50
|
-
exports["default"] = FluidDropdownSkeleton
|
|
48
|
+
exports["default"] = FluidDropdownSkeleton;
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { DropdownProps } from '../Dropdown';
|
|
9
|
+
export interface OnChangeData<ItemType> {
|
|
10
|
+
selectedItem: ItemType | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FluidDropdownProps<ItemType> extends DropdownProps<ItemType> {
|
|
13
|
+
/**
|
|
14
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
19
|
+
*/
|
|
20
|
+
direction?: 'top' | 'bottom';
|
|
21
|
+
/**
|
|
22
|
+
* Specify whether the `<input>` should be disabled
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specify a custom `id` for the `<input>`
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
31
|
+
* from their collection that are pre-selected
|
|
32
|
+
*/
|
|
33
|
+
initialSelectedItem?: ItemType;
|
|
34
|
+
/**
|
|
35
|
+
* Specify if the currently selected value is invalid.
|
|
36
|
+
*/
|
|
37
|
+
invalid?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
40
|
+
*/
|
|
41
|
+
invalidText?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Specify if the `FluidDropdown` should render its menu items in condensed mode
|
|
44
|
+
*/
|
|
45
|
+
isCondensed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Function to render items as custom components instead of strings.
|
|
48
|
+
* Defaults to null and is overridden by a getter
|
|
49
|
+
*/
|
|
50
|
+
itemToElement?: React.JSXElementConstructor<ItemType> | null;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function passed to downshift that allows the library to render a
|
|
53
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
54
|
+
* from a given item to serve as the item label in the list.
|
|
55
|
+
*/
|
|
56
|
+
itemToString?(item: ItemType | null): string;
|
|
57
|
+
/**
|
|
58
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
59
|
+
* in a collection of whatever kind of data structure they prefer
|
|
60
|
+
*/
|
|
61
|
+
items: ItemType[];
|
|
62
|
+
/**
|
|
63
|
+
* Generic `label` that will be used as the textual representation of what
|
|
64
|
+
* this field is for
|
|
65
|
+
*/
|
|
66
|
+
label: NonNullable<React.ReactNode>;
|
|
67
|
+
/**
|
|
68
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
69
|
+
* consuming component what kind of internal state changes are occurring.
|
|
70
|
+
*/
|
|
71
|
+
onChange?(data: OnChangeData<ItemType>): void;
|
|
72
|
+
/**
|
|
73
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
74
|
+
* as a string.
|
|
75
|
+
*/
|
|
76
|
+
renderSelectedItem?(item: ItemType): React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* In the case you want to control the dropdown selection entirely.
|
|
79
|
+
* This value is the selected item from the list of items
|
|
80
|
+
*/
|
|
81
|
+
selectedItem?: ItemType;
|
|
82
|
+
/**
|
|
83
|
+
* Provide the title text that will be read by a screen reader when
|
|
84
|
+
* visiting this control
|
|
85
|
+
*/
|
|
86
|
+
titleText: React.ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
89
|
+
*/
|
|
90
|
+
translateWithId?: (id: string) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Specify whether the control is currently in warning state
|
|
93
|
+
*/
|
|
94
|
+
warn?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Provide the text that is displayed when the control is in warning state
|
|
97
|
+
*/
|
|
98
|
+
warnText?: React.ReactNode;
|
|
99
|
+
}
|
|
100
|
+
declare const FluidDropdown: React.ForwardRefExoticComponent<Omit<FluidDropdownProps<unknown>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
101
|
+
export default FluidDropdown;
|
|
@@ -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 FluidDropdown from './FluidDropdown';
|
|
8
|
+
import { type FluidDropdownProps } from './FluidDropdown';
|
|
9
|
+
import { type FluidDropdownSkeletonProps } from './FluidDropdown.Skeleton';
|
|
10
|
+
export type { FluidDropdownProps, FluidDropdownSkeletonProps };
|
|
11
|
+
export default FluidDropdown;
|
|
12
|
+
export { FluidDropdown };
|
|
13
|
+
export { default as FluidDropdownSkeleton } from './FluidDropdown.Skeleton';
|
|
@@ -27,12 +27,12 @@ const FluidMultiSelectSkeleton = _ref => {
|
|
|
27
27
|
...rest
|
|
28
28
|
} = _ref;
|
|
29
29
|
const prefix = usePrefix.usePrefix();
|
|
30
|
-
const wrapperClasses = cx__default["default"](className, `${prefix}--
|
|
31
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
32
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
33
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
30
|
+
const wrapperClasses = cx__default["default"](className, `${prefix}--list-box__wrapper--fluid`);
|
|
31
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
34
32
|
className: wrapperClasses
|
|
35
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
33
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
36
36
|
className: `${prefix}--list-box__label`
|
|
37
37
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38
38
|
className: `${prefix}--list-box__field`
|
|
@@ -27,12 +27,12 @@ const FluidSelectSkeleton = _ref => {
|
|
|
27
27
|
...rest
|
|
28
28
|
} = _ref;
|
|
29
29
|
const prefix = usePrefix.usePrefix();
|
|
30
|
-
const wrapperClasses = cx__default["default"](className, `${prefix}--
|
|
31
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
32
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
33
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
30
|
+
const wrapperClasses = cx__default["default"](className, `${prefix}--list-box__wrapper--fluid`);
|
|
31
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
34
32
|
className: wrapperClasses
|
|
35
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
33
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
36
36
|
className: `${prefix}--list-box__label`
|
|
37
37
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38
38
|
className: `${prefix}--list-box__field`
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface FluidTextAreaSkeletonProps {
|
|
3
3
|
/**
|
|
4
4
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
8
|
-
declare
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
className: any;
|
|
11
|
-
}): void;
|
|
12
|
-
declare namespace FluidTextAreaSkeleton {
|
|
13
|
-
var propTypes: {
|
|
14
|
-
/**
|
|
15
|
-
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
16
|
-
*/
|
|
17
|
-
className: PropTypes.Requireable<string>;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
8
|
+
declare const FluidTextAreaSkeleton: React.FC<FluidTextAreaSkeletonProps>;
|
|
20
9
|
export default FluidTextAreaSkeleton;
|
|
@@ -9,18 +9,37 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
|
-
require('react');
|
|
14
|
-
require('classnames');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
15
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
16
18
|
|
|
17
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
20
|
|
|
19
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
const FluidTextAreaSkeleton = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
className,
|
|
28
|
+
...other
|
|
29
|
+
} = _ref;
|
|
30
|
+
const prefix = usePrefix.usePrefix();
|
|
31
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
32
|
+
value: {
|
|
33
|
+
isFluid: true
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
36
|
+
className: cx__default["default"](`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
|
|
37
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
38
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
39
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40
|
+
className: `${prefix}--skeleton ${prefix}--text-area`
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
24
43
|
FluidTextAreaSkeleton.propTypes = {
|
|
25
44
|
/**
|
|
26
45
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
@@ -24,6 +24,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
|
|
25
25
|
function CSSGrid(_ref) {
|
|
26
26
|
let {
|
|
27
|
+
align,
|
|
27
28
|
as: BaseComponent = 'div',
|
|
28
29
|
children,
|
|
29
30
|
className: customClassName,
|
|
@@ -56,7 +57,9 @@ function CSSGrid(_ref) {
|
|
|
56
57
|
[`${prefix}--css-grid`]: true,
|
|
57
58
|
[`${prefix}--css-grid--condensed`]: mode === 'condensed',
|
|
58
59
|
[`${prefix}--css-grid--narrow`]: mode === 'narrow',
|
|
59
|
-
[`${prefix}--css-grid--full-width`]: fullWidth
|
|
60
|
+
[`${prefix}--css-grid--full-width`]: fullWidth,
|
|
61
|
+
[`${prefix}--css-grid--start`]: align === 'start',
|
|
62
|
+
[`${prefix}--css-grid--end`]: align === 'end'
|
|
60
63
|
});
|
|
61
64
|
|
|
62
65
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
@@ -69,6 +72,10 @@ function CSSGrid(_ref) {
|
|
|
69
72
|
}, rest), children));
|
|
70
73
|
}
|
|
71
74
|
CSSGrid.propTypes = {
|
|
75
|
+
/**
|
|
76
|
+
* Specify grid aligment. Default is center
|
|
77
|
+
*/
|
|
78
|
+
align: PropTypes__default["default"].oneOf(['start', 'center', 'end']),
|
|
72
79
|
/**
|
|
73
80
|
* Provide a custom element to render instead of the default <div>
|
|
74
81
|
*/
|
|
@@ -28,6 +28,10 @@ function Grid(props) {
|
|
|
28
28
|
return /*#__PURE__*/React__default["default"].createElement(FlexGrid.FlexGrid, props);
|
|
29
29
|
}
|
|
30
30
|
Grid.propTypes = {
|
|
31
|
+
/**
|
|
32
|
+
* Specify grid aligment. Default is center
|
|
33
|
+
*/
|
|
34
|
+
align: PropTypes__default["default"].oneOf(['start', 'center', 'end']),
|
|
31
35
|
/**
|
|
32
36
|
* Provide a custom element to render instead of the default <div>
|
|
33
37
|
*/
|
|
@@ -37,6 +37,10 @@ export interface ListBoxSelectionProps {
|
|
|
37
37
|
* Specify whether or not the clear selection element should be disabled
|
|
38
38
|
*/
|
|
39
39
|
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether or not the listbox is readonly
|
|
42
|
+
*/
|
|
43
|
+
readOnly?: boolean;
|
|
40
44
|
/**
|
|
41
45
|
* Specify an optional `onClearSelection` handler that is called when the underlying
|
|
42
46
|
* element is cleared
|
|
@@ -58,7 +62,7 @@ export interface ListBoxSelectionProps {
|
|
|
58
62
|
*/
|
|
59
63
|
onMouseUp?: React.MouseEventHandler<HTMLButtonElement>;
|
|
60
64
|
}
|
|
61
|
-
declare function ListBoxSelection({ clearSelection, selectionCount, translateWithId: t, disabled, onClearSelection, ...rest }: ListBoxSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
declare function ListBoxSelection({ clearSelection, selectionCount, translateWithId: t, disabled, readOnly, onClearSelection, ...rest }: ListBoxSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
62
66
|
declare namespace ListBoxSelection {
|
|
63
67
|
var propTypes: {
|
|
64
68
|
/**
|
|
@@ -70,6 +74,10 @@ declare namespace ListBoxSelection {
|
|
|
70
74
|
* Specify whether or not the clear selection element should be disabled
|
|
71
75
|
*/
|
|
72
76
|
disabled: PropTypes.Requireable<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether or not the listbox is readonly
|
|
79
|
+
*/
|
|
80
|
+
readOnly: PropTypes.Requireable<boolean>;
|
|
73
81
|
/**
|
|
74
82
|
* Specify an optional `onClearSelection` handler that is called when the underlying
|
|
75
83
|
* element is cleared
|
|
@@ -36,6 +36,7 @@ function ListBoxSelection(_ref) {
|
|
|
36
36
|
selectionCount,
|
|
37
37
|
translateWithId: t = defaultTranslateWithId,
|
|
38
38
|
disabled,
|
|
39
|
+
readOnly,
|
|
39
40
|
onClearSelection,
|
|
40
41
|
...rest
|
|
41
42
|
} = _ref;
|
|
@@ -50,7 +51,7 @@ function ListBoxSelection(_ref) {
|
|
|
50
51
|
});
|
|
51
52
|
function onClick(event) {
|
|
52
53
|
event.stopPropagation();
|
|
53
|
-
if (disabled) {
|
|
54
|
+
if (disabled || readOnly) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
clearSelection(event);
|
|
@@ -67,21 +68,23 @@ function ListBoxSelection(_ref) {
|
|
|
67
68
|
}, selectionCount), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
68
69
|
"aria-label": description,
|
|
69
70
|
className: `${prefix}--tag__close-icon`,
|
|
70
|
-
disabled: disabled,
|
|
71
|
+
disabled: disabled || readOnly,
|
|
71
72
|
onClick: onClick,
|
|
72
73
|
tabIndex: -1,
|
|
73
74
|
title: description,
|
|
74
|
-
type: "button"
|
|
75
|
+
type: "button",
|
|
76
|
+
"aria-disabled": readOnly ? true : undefined
|
|
75
77
|
}, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null))));
|
|
76
78
|
}
|
|
77
79
|
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
78
80
|
"aria-label": description,
|
|
79
81
|
className: className,
|
|
80
|
-
disabled: disabled,
|
|
82
|
+
disabled: disabled || readOnly,
|
|
81
83
|
onClick: onClick,
|
|
82
84
|
tabIndex: -1,
|
|
83
85
|
title: description,
|
|
84
|
-
type: "button"
|
|
86
|
+
type: "button",
|
|
87
|
+
"aria-disabled": readOnly ? true : undefined
|
|
85
88
|
}), _Close2 || (_Close2 = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)));
|
|
86
89
|
}
|
|
87
90
|
ListBoxSelection.propTypes = {
|
|
@@ -94,6 +97,10 @@ ListBoxSelection.propTypes = {
|
|
|
94
97
|
* Specify whether or not the clear selection element should be disabled
|
|
95
98
|
*/
|
|
96
99
|
disabled: PropTypes__default["default"].bool,
|
|
100
|
+
/**
|
|
101
|
+
* Whether or not the listbox is readonly
|
|
102
|
+
*/
|
|
103
|
+
readOnly: PropTypes__default["default"].bool,
|
|
97
104
|
/**
|
|
98
105
|
* Specify an optional `onClearSelection` handler that is called when the underlying
|
|
99
106
|
* element is cleared
|
|
@@ -143,6 +143,10 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
|
|
|
143
143
|
* what this field is for
|
|
144
144
|
*/
|
|
145
145
|
placeholder?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Whether or not the filterable multiselect is readonly
|
|
148
|
+
*/
|
|
149
|
+
readOnly?: boolean;
|
|
146
150
|
/**
|
|
147
151
|
* Specify feedback (mode) of the selection.
|
|
148
152
|
* `top`: selected item jumps to top
|
|
@@ -102,6 +102,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
102
102
|
onChange,
|
|
103
103
|
onMenuChange,
|
|
104
104
|
placeholder,
|
|
105
|
+
readOnly,
|
|
105
106
|
titleText,
|
|
106
107
|
type,
|
|
107
108
|
selectionFeedback = 'top-after-reopen',
|
|
@@ -244,9 +245,11 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
244
245
|
}
|
|
245
246
|
};
|
|
246
247
|
function handleMenuChange(forceIsOpen) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
if (!readOnly) {
|
|
249
|
+
const nextIsOpen = forceIsOpen ?? !isOpen;
|
|
250
|
+
setIsOpen(nextIsOpen);
|
|
251
|
+
validateHighlightFocus();
|
|
252
|
+
}
|
|
250
253
|
}
|
|
251
254
|
React.useEffect(() => {
|
|
252
255
|
onMenuChange?.(isOpen);
|
|
@@ -435,7 +438,8 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
435
438
|
[`${prefix}--multi-select--open`]: isOpen,
|
|
436
439
|
[`${prefix}--multi-select--inline`]: inline,
|
|
437
440
|
[`${prefix}--multi-select--selected`]: controlledSelectedItems?.length > 0,
|
|
438
|
-
[`${prefix}--multi-select--filterable--input-focused`]: inputFocused
|
|
441
|
+
[`${prefix}--multi-select--filterable--input-focused`]: inputFocused,
|
|
442
|
+
[`${prefix}--multi-select--readonly`]: readOnly
|
|
439
443
|
});
|
|
440
444
|
const labelProps = getLabelProps();
|
|
441
445
|
const buttonProps = getToggleButtonProps({
|
|
@@ -522,6 +526,24 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
522
526
|
setIsFocused(evt?.type === 'focus' ? true : false);
|
|
523
527
|
}
|
|
524
528
|
};
|
|
529
|
+
const mergedRef = mergeRefs["default"](textInput, inputProps.ref);
|
|
530
|
+
const readOnlyEventHandlers = readOnly ? {
|
|
531
|
+
onClick: evt => {
|
|
532
|
+
// NOTE: does not prevent click
|
|
533
|
+
evt.preventDefault();
|
|
534
|
+
// focus on the element as per readonly input behavior
|
|
535
|
+
if (mergedRef.current !== undefined) {
|
|
536
|
+
mergedRef.current.focus();
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
onKeyDown: evt => {
|
|
540
|
+
const selectAccessKeys = ['ArrowDown', 'ArrowUp', ' ', 'Enter'];
|
|
541
|
+
// This prevents the select from opening for the above keys
|
|
542
|
+
if (selectAccessKeys.includes(evt.key)) {
|
|
543
|
+
evt.preventDefault();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
} : {};
|
|
525
547
|
const clearSelectionContent = controlledSelectedItems.length > 0 ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
526
548
|
className: `${prefix}--visually-hidden`
|
|
527
549
|
}, clearSelectionDescription, " ", controlledSelectedItems.length, ",", clearSelectionText) : /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -545,12 +567,13 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
545
567
|
invalidText: invalidText,
|
|
546
568
|
warn: warn,
|
|
547
569
|
warnText: warnText,
|
|
548
|
-
isOpen: isOpen,
|
|
570
|
+
isOpen: !readOnly && isOpen,
|
|
549
571
|
size: size
|
|
550
572
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
551
573
|
className: `${prefix}--list-box__field`,
|
|
552
574
|
ref: autoAlign ? refs.setReference : null
|
|
553
575
|
}, controlledSelectedItems.length > 0 && /*#__PURE__*/React__default["default"].createElement(ListBoxSelection["default"], {
|
|
576
|
+
readOnly: readOnly,
|
|
554
577
|
clearSelection: () => {
|
|
555
578
|
clearSelection();
|
|
556
579
|
if (textInput.current) {
|
|
@@ -563,7 +586,9 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
563
586
|
}), /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({
|
|
564
587
|
className: inputClasses
|
|
565
588
|
}, inputProps, {
|
|
566
|
-
ref:
|
|
589
|
+
ref: mergedRef
|
|
590
|
+
}, readOnlyEventHandlers, {
|
|
591
|
+
readOnly: readOnly
|
|
567
592
|
})), invalid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
568
593
|
className: `${prefix}--list-box__invalid-icon`
|
|
569
594
|
}), showWarning && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
@@ -572,6 +597,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
572
597
|
clearSelection: clearInputValue,
|
|
573
598
|
disabled: disabled,
|
|
574
599
|
translateWithId: translateWithId,
|
|
600
|
+
readOnly: readOnly,
|
|
575
601
|
onMouseUp: event => {
|
|
576
602
|
// If we do not stop this event from propagating,
|
|
577
603
|
// it seems like Downshift takes our event and
|
|
@@ -288,9 +288,7 @@ function ToastNotification(_ref4) {
|
|
|
288
288
|
}, caption), children), !hideCloseButton && /*#__PURE__*/React__default["default"].createElement(NotificationButton, {
|
|
289
289
|
notificationType: "toast",
|
|
290
290
|
onClick: handleCloseButtonClick,
|
|
291
|
-
"aria-
|
|
292
|
-
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
293
|
-
tabIndex: -1
|
|
291
|
+
"aria-label": deprecatedAriaLabel || ariaLabel
|
|
294
292
|
}));
|
|
295
293
|
}
|
|
296
294
|
ToastNotification.propTypes = {
|
|
@@ -425,9 +423,7 @@ function InlineNotification(_ref5) {
|
|
|
425
423
|
}, subtitle), children)), !hideCloseButton && /*#__PURE__*/React__default["default"].createElement(NotificationButton, {
|
|
426
424
|
notificationType: "inline",
|
|
427
425
|
onClick: handleCloseButtonClick,
|
|
428
|
-
"aria-
|
|
429
|
-
"aria-label": ariaLabel,
|
|
430
|
-
tabIndex: -1
|
|
426
|
+
"aria-label": ariaLabel
|
|
431
427
|
}));
|
|
432
428
|
}
|
|
433
429
|
InlineNotification.propTypes = {
|
|
@@ -15,8 +15,12 @@ export interface NumberInputSkeletonProps extends HTMLAttributes<HTMLDivElement>
|
|
|
15
15
|
* Specify whether the label should be hidden, or not
|
|
16
16
|
*/
|
|
17
17
|
hideLabel?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify the size of the Number Input.
|
|
20
|
+
*/
|
|
21
|
+
size?: 'sm' | 'md' | 'lg';
|
|
18
22
|
}
|
|
19
|
-
declare function NumberInputSkeleton({ hideLabel, className, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function NumberInputSkeleton({ hideLabel, className, size, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
declare namespace NumberInputSkeleton {
|
|
21
25
|
var propTypes: {
|
|
22
26
|
/**
|
|
@@ -27,6 +31,10 @@ declare namespace NumberInputSkeleton {
|
|
|
27
31
|
* Specify whether the label should be hidden, or not
|
|
28
32
|
*/
|
|
29
33
|
hideLabel: PropTypes.Requireable<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify the size of the Number Input.
|
|
36
|
+
*/
|
|
37
|
+
size: PropTypes.Requireable<string>;
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
40
|
export default NumberInputSkeleton;
|
|
@@ -25,6 +25,7 @@ function NumberInputSkeleton(_ref) {
|
|
|
25
25
|
let {
|
|
26
26
|
hideLabel,
|
|
27
27
|
className,
|
|
28
|
+
size = 'md',
|
|
28
29
|
...rest
|
|
29
30
|
} = _ref;
|
|
30
31
|
const prefix = usePrefix.usePrefix();
|
|
@@ -33,7 +34,7 @@ function NumberInputSkeleton(_ref) {
|
|
|
33
34
|
}, rest), !hideLabel && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
34
35
|
className: `${prefix}--label ${prefix}--skeleton`
|
|
35
36
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
36
|
-
className: `${prefix}--number ${prefix}--skeleton`
|
|
37
|
+
className: `${prefix}--number ${prefix}--skeleton ${prefix}--number--${size}`
|
|
37
38
|
}));
|
|
38
39
|
}
|
|
39
40
|
NumberInputSkeleton.propTypes = {
|
|
@@ -44,7 +45,11 @@ NumberInputSkeleton.propTypes = {
|
|
|
44
45
|
/**
|
|
45
46
|
* Specify whether the label should be hidden, or not
|
|
46
47
|
*/
|
|
47
|
-
hideLabel: PropTypes__default["default"].bool
|
|
48
|
+
hideLabel: PropTypes__default["default"].bool,
|
|
49
|
+
/**
|
|
50
|
+
* Specify the size of the Number Input.
|
|
51
|
+
*/
|
|
52
|
+
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
|
|
48
53
|
};
|
|
49
54
|
|
|
50
55
|
exports["default"] = NumberInputSkeleton;
|