@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 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
|
+
/// <reference types="react" />
|
|
8
|
+
type TriggerType = Element | Document | Window | React.RefObject<Element>;
|
|
9
|
+
interface ContextMenuProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
mode: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
18
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
19
|
+
*/
|
|
20
|
+
declare function useContextMenu(trigger?: TriggerType): ContextMenuProps;
|
|
21
|
+
export default useContextMenu;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { useState, useEffect } from 'react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @param {
|
|
12
|
-
* @returns {
|
|
11
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
12
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
13
13
|
*/
|
|
14
14
|
function useContextMenu() {
|
|
15
15
|
let trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
@@ -18,8 +18,8 @@ function useContextMenu() {
|
|
|
18
18
|
function openContextMenu(e) {
|
|
19
19
|
e.preventDefault();
|
|
20
20
|
const {
|
|
21
|
-
x,
|
|
22
|
-
y
|
|
21
|
+
clientX: x,
|
|
22
|
+
clientY: y
|
|
23
23
|
} = e;
|
|
24
24
|
setPosition([x, y]);
|
|
25
25
|
setOpen(true);
|
|
@@ -28,11 +28,12 @@ function useContextMenu() {
|
|
|
28
28
|
setOpen(false);
|
|
29
29
|
}
|
|
30
30
|
useEffect(() => {
|
|
31
|
-
const el = trigger
|
|
32
|
-
if (el
|
|
33
|
-
|
|
31
|
+
const el = trigger instanceof Element || trigger instanceof Document || trigger instanceof Window ? trigger : trigger.current;
|
|
32
|
+
if (el) {
|
|
33
|
+
const eventListener = e => openContextMenu(e);
|
|
34
|
+
el.addEventListener('contextmenu', eventListener);
|
|
34
35
|
return () => {
|
|
35
|
-
el.removeEventListener('contextmenu',
|
|
36
|
+
el.removeEventListener('contextmenu', eventListener);
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
}, [trigger]);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import type { MouseEvent } from 'react';
|
|
9
10
|
import type { DataTableSortState } from './state/sortStates';
|
|
10
11
|
import Table from './Table';
|
|
11
12
|
import TableActionList from './TableActionList';
|
|
@@ -131,13 +132,13 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
131
132
|
}) => {
|
|
132
133
|
ariaLabel: string;
|
|
133
134
|
'aria-label': string;
|
|
134
|
-
checked?: boolean;
|
|
135
|
+
checked?: boolean | undefined;
|
|
135
136
|
disabled?: boolean | undefined;
|
|
136
137
|
id: string;
|
|
137
138
|
indeterminate?: boolean;
|
|
138
139
|
name: string;
|
|
139
140
|
onSelect: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
140
|
-
radio?: boolean;
|
|
141
|
+
radio?: boolean | undefined;
|
|
141
142
|
[key: string]: unknown;
|
|
142
143
|
};
|
|
143
144
|
getToolbarProps: (getToolbarPropsArgs?: {
|
|
@@ -12,7 +12,7 @@ type ExcludedAttributes = 'id' | 'onChange';
|
|
|
12
12
|
export interface OnChangeData<ItemType> {
|
|
13
13
|
selectedItem: ItemType | null;
|
|
14
14
|
}
|
|
15
|
-
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey> {
|
|
15
|
+
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey>, React.RefAttributes<HTMLDivElement> {
|
|
16
16
|
/**
|
|
17
17
|
* Specify a label to be read by screen readers on the container node
|
|
18
18
|
* 'aria-label' of the ListBox component.
|
|
@@ -127,7 +127,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
127
127
|
* Provide the title text that will be read by a screen reader when
|
|
128
128
|
* visiting this control
|
|
129
129
|
*/
|
|
130
|
-
titleText
|
|
130
|
+
titleText: ReactNode;
|
|
131
131
|
/**
|
|
132
132
|
* The dropdown type, `default` or `inline`
|
|
133
133
|
*/
|
|
@@ -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
|
/**
|
|
@@ -29,7 +29,8 @@ function FeatureFlags(_ref) {
|
|
|
29
29
|
enableV12TileRadioIcons = false,
|
|
30
30
|
enableV12Overflowmenu = false,
|
|
31
31
|
enableTreeviewControllable = false,
|
|
32
|
-
enableExperimentalFocusWrapWithoutSentinels = false
|
|
32
|
+
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
33
|
+
enableV12DynamicFloatingStyles = false
|
|
33
34
|
} = _ref;
|
|
34
35
|
const parentScope = useContext(FeatureFlagContext);
|
|
35
36
|
const [prevParentScope, setPrevParentScope] = useState(parentScope);
|
|
@@ -39,6 +40,7 @@ function FeatureFlags(_ref) {
|
|
|
39
40
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
40
41
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
41
42
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
43
|
+
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
42
44
|
...flags
|
|
43
45
|
};
|
|
44
46
|
const [scope, updateScope] = useState(() => {
|
|
@@ -75,7 +77,8 @@ FeatureFlags.propTypes = {
|
|
|
75
77
|
enableV12TileRadioIcons: PropTypes.bool,
|
|
76
78
|
enableV12Overflowmenu: PropTypes.bool,
|
|
77
79
|
enableTreeviewControllable: PropTypes.bool,
|
|
78
|
-
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool
|
|
80
|
+
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
81
|
+
enableV12DynamicFloatingStyles: PropTypes.bool
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
/**
|
|
@@ -17,12 +17,12 @@ const FluidComboBoxSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
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;
|
|
@@ -17,13 +17,12 @@ const FluidDropdownSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
|
-
className: wrapperContainerClasses
|
|
24
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
25
22
|
className: wrapperClasses
|
|
26
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
27
26
|
className: `${prefix}--list-box__label`
|
|
28
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
28
|
className: `${prefix}--list-box__field`
|
|
@@ -35,6 +34,5 @@ FluidDropdownSkeleton.propTypes = {
|
|
|
35
34
|
*/
|
|
36
35
|
className: PropTypes.string
|
|
37
36
|
};
|
|
38
|
-
var FluidDropdownSkeleton$1 = FluidDropdownSkeleton;
|
|
39
37
|
|
|
40
|
-
export { FluidDropdownSkeleton
|
|
38
|
+
export { FluidDropdownSkeleton as default };
|
|
@@ -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';
|
|
@@ -17,12 +17,12 @@ const FluidMultiSelectSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
className: `${prefix}--list-box__field`
|
|
@@ -17,12 +17,12 @@ const FluidSelectSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
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;
|
|
@@ -5,14 +5,31 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
|
-
import 'react';
|
|
10
|
-
import 'classnames';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
11
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const FluidTextAreaSkeleton = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
...other
|
|
19
|
+
} = _ref;
|
|
20
|
+
const prefix = usePrefix();
|
|
21
|
+
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
isFluid: true
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
26
|
+
className: cx(`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
|
|
27
|
+
}, other), /*#__PURE__*/React__default.createElement("span", {
|
|
28
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
29
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
30
|
+
className: `${prefix}--skeleton ${prefix}--text-area`
|
|
31
|
+
})));
|
|
32
|
+
};
|
|
16
33
|
FluidTextAreaSkeleton.propTypes = {
|
|
17
34
|
/**
|
|
18
35
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
@@ -14,6 +14,7 @@ import { useGridSettings, GridSettings } from './GridContext.js';
|
|
|
14
14
|
|
|
15
15
|
function CSSGrid(_ref) {
|
|
16
16
|
let {
|
|
17
|
+
align,
|
|
17
18
|
as: BaseComponent = 'div',
|
|
18
19
|
children,
|
|
19
20
|
className: customClassName,
|
|
@@ -46,7 +47,9 @@ function CSSGrid(_ref) {
|
|
|
46
47
|
[`${prefix}--css-grid`]: true,
|
|
47
48
|
[`${prefix}--css-grid--condensed`]: mode === 'condensed',
|
|
48
49
|
[`${prefix}--css-grid--narrow`]: mode === 'narrow',
|
|
49
|
-
[`${prefix}--css-grid--full-width`]: fullWidth
|
|
50
|
+
[`${prefix}--css-grid--full-width`]: fullWidth,
|
|
51
|
+
[`${prefix}--css-grid--start`]: align === 'start',
|
|
52
|
+
[`${prefix}--css-grid--end`]: align === 'end'
|
|
50
53
|
});
|
|
51
54
|
|
|
52
55
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
@@ -59,6 +62,10 @@ function CSSGrid(_ref) {
|
|
|
59
62
|
}, rest), children));
|
|
60
63
|
}
|
|
61
64
|
CSSGrid.propTypes = {
|
|
65
|
+
/**
|
|
66
|
+
* Specify grid aligment. Default is center
|
|
67
|
+
*/
|
|
68
|
+
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
62
69
|
/**
|
|
63
70
|
* Provide a custom element to render instead of the default <div>
|
|
64
71
|
*/
|
|
@@ -19,6 +19,10 @@ function Grid(props) {
|
|
|
19
19
|
return /*#__PURE__*/React__default.createElement(FlexGridComponent, props);
|
|
20
20
|
}
|
|
21
21
|
Grid.propTypes = {
|
|
22
|
+
/**
|
|
23
|
+
* Specify grid aligment. Default is center
|
|
24
|
+
*/
|
|
25
|
+
align: PropTypes.oneOf(['start', 'center', 'end']),
|
|
22
26
|
/**
|
|
23
27
|
* Provide a custom element to render instead of the default <div>
|
|
24
28
|
*/
|
|
@@ -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
|
|
@@ -26,6 +26,7 @@ function ListBoxSelection(_ref) {
|
|
|
26
26
|
selectionCount,
|
|
27
27
|
translateWithId: t = defaultTranslateWithId,
|
|
28
28
|
disabled,
|
|
29
|
+
readOnly,
|
|
29
30
|
onClearSelection,
|
|
30
31
|
...rest
|
|
31
32
|
} = _ref;
|
|
@@ -40,7 +41,7 @@ function ListBoxSelection(_ref) {
|
|
|
40
41
|
});
|
|
41
42
|
function onClick(event) {
|
|
42
43
|
event.stopPropagation();
|
|
43
|
-
if (disabled) {
|
|
44
|
+
if (disabled || readOnly) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
clearSelection(event);
|
|
@@ -57,21 +58,23 @@ function ListBoxSelection(_ref) {
|
|
|
57
58
|
}, selectionCount), /*#__PURE__*/React__default.createElement("button", {
|
|
58
59
|
"aria-label": description,
|
|
59
60
|
className: `${prefix}--tag__close-icon`,
|
|
60
|
-
disabled: disabled,
|
|
61
|
+
disabled: disabled || readOnly,
|
|
61
62
|
onClick: onClick,
|
|
62
63
|
tabIndex: -1,
|
|
63
64
|
title: description,
|
|
64
|
-
type: "button"
|
|
65
|
+
type: "button",
|
|
66
|
+
"aria-disabled": readOnly ? true : undefined
|
|
65
67
|
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
|
|
66
68
|
}
|
|
67
69
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
|
|
68
70
|
"aria-label": description,
|
|
69
71
|
className: className,
|
|
70
|
-
disabled: disabled,
|
|
72
|
+
disabled: disabled || readOnly,
|
|
71
73
|
onClick: onClick,
|
|
72
74
|
tabIndex: -1,
|
|
73
75
|
title: description,
|
|
74
|
-
type: "button"
|
|
76
|
+
type: "button",
|
|
77
|
+
"aria-disabled": readOnly ? true : undefined
|
|
75
78
|
}), _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));
|
|
76
79
|
}
|
|
77
80
|
ListBoxSelection.propTypes = {
|
|
@@ -84,6 +87,10 @@ ListBoxSelection.propTypes = {
|
|
|
84
87
|
* Specify whether or not the clear selection element should be disabled
|
|
85
88
|
*/
|
|
86
89
|
disabled: PropTypes.bool,
|
|
90
|
+
/**
|
|
91
|
+
* Whether or not the listbox is readonly
|
|
92
|
+
*/
|
|
93
|
+
readOnly: PropTypes.bool,
|
|
87
94
|
/**
|
|
88
95
|
* Specify an optional `onClearSelection` handler that is called when the underlying
|
|
89
96
|
* 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
|