@carbon/react 1.68.0-rc.0 → 1.69.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 +743 -743
- package/README.md +3 -3
- package/es/components/Accordion/AccordionItem.js +0 -1
- package/es/components/Button/Button.js +6 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -2
- package/es/components/CheckboxGroup/index.d.ts +10 -0
- package/es/components/ComboBox/ComboBox.d.ts +5 -0
- package/es/components/ComboBox/ComboBox.js +139 -54
- package/es/components/ComboButton/index.js +10 -3
- package/es/components/DataTable/TableCell.d.ts +1 -4
- package/es/components/DataTable/TableCell.js +3 -2
- package/es/components/DatePicker/DatePicker.js +10 -6
- package/es/components/Disclosure/index.d.ts +18 -0
- package/es/components/Dropdown/Dropdown.js +11 -9
- package/es/components/FileUploader/FileUploader.d.ts +8 -92
- package/es/components/FileUploader/FileUploader.js +116 -137
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +15 -0
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +1 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +102 -0
- package/es/components/FluidComboBox/FluidComboBox.js +2 -3
- package/es/components/FluidComboBox/index.d.ts +13 -0
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +19 -0
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +2 -2
- package/es/components/FluidDatePicker/FluidDatePicker.d.ts +39 -0
- package/es/components/FluidDatePicker/FluidDatePicker.js +2 -3
- package/es/components/FluidDatePicker/index.d.ts +13 -0
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +10 -0
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +1 -2
- package/es/components/FluidDatePickerInput/index.d.ts +9 -0
- package/es/components/IdPrefix/index.d.ts +26 -0
- package/es/components/Menu/MenuItem.js +1 -4
- package/es/components/MenuButton/index.d.ts +4 -0
- package/es/components/MenuButton/index.js +19 -5
- package/es/components/MultiSelect/MultiSelect.js +11 -9
- package/es/components/OverflowMenu/next/index.d.ts +4 -0
- package/es/components/OverflowMenu/next/index.js +19 -9
- package/es/components/PaginationNav/PaginationNav.js +1 -1
- package/es/components/Popover/index.js +18 -14
- package/es/components/Portal/index.d.ts +25 -0
- package/es/components/Slider/Slider.js +2 -2
- package/es/components/Tabs/usePressable.js +2 -0
- package/es/components/Tag/DismissibleTag.js +2 -2
- package/es/components/Tag/OperationalTag.d.ts +2 -10
- package/es/components/Tag/OperationalTag.js +2 -14
- package/es/components/Tag/SelectableTag.d.ts +2 -10
- package/es/components/Tag/SelectableTag.js +2 -16
- package/es/components/Toggle/Toggle.js +2 -0
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +49 -0
- package/es/components/ToggleSmall/index.d.ts +7 -0
- package/es/components/TreeView/TreeNode.js +4 -2
- package/es/components/TreeView/TreeView.js +4 -4
- package/es/components/UIShell/SideNavMenuItem.d.ts +4 -3
- package/es/components/UIShell/SideNavMenuItem.js +1 -4
- package/es/index.js +6 -6
- package/es/internal/useIdPrefix.d.ts +9 -0
- package/lib/components/Accordion/AccordionItem.js +0 -1
- package/lib/components/Button/Button.js +6 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -2
- package/lib/components/CheckboxGroup/index.d.ts +10 -0
- package/lib/components/ComboBox/ComboBox.d.ts +5 -0
- package/lib/components/ComboBox/ComboBox.js +144 -59
- package/lib/components/ComboButton/index.js +12 -5
- package/lib/components/DataTable/TableCell.d.ts +1 -4
- package/lib/components/DataTable/TableCell.js +3 -2
- package/lib/components/DatePicker/DatePicker.js +9 -5
- package/lib/components/Disclosure/index.d.ts +18 -0
- package/lib/components/Dropdown/Dropdown.js +18 -16
- package/lib/components/FileUploader/FileUploader.d.ts +8 -92
- package/lib/components/FileUploader/FileUploader.js +113 -134
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +15 -0
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +1 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +102 -0
- package/lib/components/FluidComboBox/FluidComboBox.js +2 -3
- package/lib/components/FluidComboBox/index.d.ts +13 -0
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +19 -0
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +2 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.d.ts +39 -0
- package/lib/components/FluidDatePicker/FluidDatePicker.js +3 -4
- package/lib/components/FluidDatePicker/index.d.ts +13 -0
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +10 -0
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +1 -2
- package/lib/components/FluidDatePickerInput/index.d.ts +9 -0
- package/lib/components/IdPrefix/index.d.ts +26 -0
- package/lib/components/Menu/MenuItem.js +1 -4
- package/lib/components/MenuButton/index.d.ts +4 -0
- package/lib/components/MenuButton/index.js +19 -5
- package/lib/components/MultiSelect/MultiSelect.js +18 -16
- package/lib/components/OverflowMenu/next/index.d.ts +4 -0
- package/lib/components/OverflowMenu/next/index.js +21 -11
- package/lib/components/PaginationNav/PaginationNav.js +1 -1
- package/lib/components/Popover/index.js +18 -14
- package/lib/components/Portal/index.d.ts +25 -0
- package/lib/components/Slider/Slider.js +2 -2
- package/lib/components/Tabs/usePressable.js +2 -0
- package/lib/components/Tag/DismissibleTag.js +2 -2
- package/lib/components/Tag/OperationalTag.d.ts +2 -10
- package/lib/components/Tag/OperationalTag.js +2 -14
- package/lib/components/Tag/SelectableTag.d.ts +2 -10
- package/lib/components/Tag/SelectableTag.js +2 -16
- package/lib/components/Toggle/Toggle.js +2 -0
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +49 -0
- package/lib/components/ToggleSmall/index.d.ts +7 -0
- package/lib/components/TreeView/TreeNode.js +4 -2
- package/lib/components/TreeView/TreeView.js +4 -4
- package/lib/components/UIShell/SideNavMenuItem.d.ts +4 -3
- package/lib/components/UIShell/SideNavMenuItem.js +1 -4
- package/lib/index.js +12 -12
- package/lib/internal/useIdPrefix.d.ts +9 -0
- package/package.json +7 -7
- package/telemetry.yml +809 -809
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import { ReactElement } from 'react';
|
|
9
8
|
import { ReactAttr } from '../../types/common';
|
|
10
9
|
export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
|
|
11
10
|
/**
|
|
@@ -74,93 +73,10 @@ export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
|
|
|
74
73
|
*/
|
|
75
74
|
size?: 'sm' | 'small' | 'md' | 'field' | 'lg';
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
accept: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
85
|
-
/**
|
|
86
|
-
* Specify the type of the `<FileUploaderButton>`
|
|
87
|
-
*/
|
|
88
|
-
buttonKind: PropTypes.Requireable<string>;
|
|
89
|
-
/**
|
|
90
|
-
* Provide the label text to be read by screen readers when interacting with
|
|
91
|
-
* the `<FileUploaderButton>`
|
|
92
|
-
*/
|
|
93
|
-
buttonLabel: PropTypes.Requireable<string>;
|
|
94
|
-
/**
|
|
95
|
-
* Provide a custom className to be applied to the container node
|
|
96
|
-
*/
|
|
97
|
-
className: PropTypes.Requireable<string>;
|
|
98
|
-
/**
|
|
99
|
-
* Specify whether file input is disabled
|
|
100
|
-
*/
|
|
101
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* Specify the status of the File Upload
|
|
104
|
-
*/
|
|
105
|
-
filenameStatus: PropTypes.Validator<string>;
|
|
106
|
-
/**
|
|
107
|
-
* Provide a description for the complete/close icon that can be read by screen readers
|
|
108
|
-
*/
|
|
109
|
-
iconDescription: PropTypes.Requireable<string>;
|
|
110
|
-
/**
|
|
111
|
-
* Specify the description text of this `<FileUploader>`
|
|
112
|
-
*/
|
|
113
|
-
labelDescription: PropTypes.Requireable<string>;
|
|
114
|
-
/**
|
|
115
|
-
* Specify the title text of this `<FileUploader>`
|
|
116
|
-
*/
|
|
117
|
-
labelTitle: PropTypes.Requireable<string>;
|
|
118
|
-
/**
|
|
119
|
-
* Specify if the component should accept multiple files to upload
|
|
120
|
-
*/
|
|
121
|
-
multiple: PropTypes.Requireable<boolean>;
|
|
122
|
-
/**
|
|
123
|
-
* Provide a name for the underlying `<input>` node
|
|
124
|
-
*/
|
|
125
|
-
name: PropTypes.Requireable<string>;
|
|
126
|
-
/**
|
|
127
|
-
* Provide an optional `onChange` hook that is called each time the input is
|
|
128
|
-
* changed
|
|
129
|
-
*/
|
|
130
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
131
|
-
/**
|
|
132
|
-
* Provide an optional `onClick` hook that is called each time the
|
|
133
|
-
* FileUploader is clicked
|
|
134
|
-
*/
|
|
135
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
136
|
-
/**
|
|
137
|
-
* Provide an optional `onDelete` hook that is called when an uploaded item
|
|
138
|
-
* is removed
|
|
139
|
-
*/
|
|
140
|
-
onDelete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
141
|
-
/**
|
|
142
|
-
* Specify the size of the FileUploaderButton, from a list of available
|
|
143
|
-
* sizes.
|
|
144
|
-
*/
|
|
145
|
-
size: PropTypes.Requireable<string>;
|
|
146
|
-
};
|
|
147
|
-
static contextType: React.Context<string>;
|
|
148
|
-
state: {
|
|
149
|
-
filenames: string[];
|
|
150
|
-
};
|
|
151
|
-
nodes: HTMLElement[];
|
|
152
|
-
uploaderButton: React.RefObject<HTMLLabelElement>;
|
|
153
|
-
static getDerivedStateFromProps({ filenameStatus }: {
|
|
154
|
-
filenameStatus: any;
|
|
155
|
-
}, state: any): {
|
|
156
|
-
filenameStatus: any;
|
|
157
|
-
prevFilenameStatus: any;
|
|
158
|
-
} | null;
|
|
159
|
-
handleChange: (evt: any) => void;
|
|
160
|
-
handleClick: (evt: any, { index, filenameStatus }: {
|
|
161
|
-
index: any;
|
|
162
|
-
filenameStatus: any;
|
|
163
|
-
}) => void;
|
|
164
|
-
clearFiles: () => void;
|
|
165
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
166
|
-
}
|
|
76
|
+
declare const FileUploader: {
|
|
77
|
+
<ItemType>(props: FileUploaderProps): ReactElement;
|
|
78
|
+
propTypes?: any;
|
|
79
|
+
contextTypes?: any;
|
|
80
|
+
defaultProps?: any;
|
|
81
|
+
};
|
|
82
|
+
export default FileUploader;
|
|
@@ -5,157 +5,137 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default from 'react';
|
|
11
|
+
import React__default, { useState } from 'react';
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
13
|
import FileUploaderButton from './FileUploaderButton.js';
|
|
14
14
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
15
|
-
import {
|
|
15
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import '../Text/index.js';
|
|
17
|
+
import { useId } from '../../internal/useId.js';
|
|
17
18
|
import { Text } from '../Text/Text.js';
|
|
18
19
|
import { matches } from '../../internal/keyboard/match.js';
|
|
19
20
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const FileUploader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
23
|
+
let {
|
|
24
|
+
accept,
|
|
25
|
+
buttonKind,
|
|
26
|
+
buttonLabel,
|
|
27
|
+
className,
|
|
28
|
+
disabled,
|
|
29
|
+
filenameStatus,
|
|
30
|
+
iconDescription,
|
|
31
|
+
labelDescription,
|
|
32
|
+
labelTitle,
|
|
33
|
+
multiple,
|
|
34
|
+
name,
|
|
35
|
+
onChange,
|
|
36
|
+
onClick,
|
|
37
|
+
onDelete,
|
|
38
|
+
size,
|
|
39
|
+
...other
|
|
40
|
+
} = _ref;
|
|
41
|
+
const fileUploaderInstanceId = useId('file-uploader');
|
|
42
|
+
const [state, updateState] = useState({
|
|
43
|
+
fileNames: []
|
|
44
|
+
});
|
|
45
|
+
const nodes = [];
|
|
46
|
+
const prefix = usePrefix();
|
|
47
|
+
const handleChange = evt => {
|
|
48
|
+
evt.stopPropagation();
|
|
49
|
+
const filenames = Array.prototype.map.call(evt.target.files, file => file.name);
|
|
50
|
+
updateState(prevState => ({
|
|
51
|
+
fileNames: multiple ? [...new Set([...prevState.fileNames, ...filenames])] : filenames
|
|
52
|
+
}));
|
|
53
|
+
if (onChange) {
|
|
54
|
+
onChange(evt);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleClick = (evt, _ref2) => {
|
|
58
|
+
let {
|
|
59
|
+
index,
|
|
60
|
+
filenameStatus
|
|
61
|
+
} = _ref2;
|
|
62
|
+
if (filenameStatus === 'edit') {
|
|
30
63
|
evt.stopPropagation();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
64
|
+
const filteredArray = state.fileNames.filter(filename => filename !== nodes[index]?.innerText?.trim());
|
|
65
|
+
updateState({
|
|
66
|
+
fileNames: filteredArray
|
|
34
67
|
});
|
|
35
|
-
if (
|
|
36
|
-
|
|
68
|
+
if (onDelete) {
|
|
69
|
+
onDelete(evt);
|
|
70
|
+
uploaderButton.current?.focus?.();
|
|
37
71
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
onClick?.(evt);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const uploaderButton = /*#__PURE__*/React__default.createRef();
|
|
76
|
+
const classes = cx({
|
|
77
|
+
[`${prefix}--form-item`]: true,
|
|
78
|
+
[className]: className
|
|
79
|
+
});
|
|
80
|
+
const getHelperLabelClasses = baseClass => cx(baseClass, {
|
|
81
|
+
[`${prefix}--label-description--disabled`]: disabled
|
|
82
|
+
});
|
|
83
|
+
const selectedFileClasses = cx(`${prefix}--file__selected-file`, {
|
|
84
|
+
[`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md',
|
|
85
|
+
[`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm'
|
|
86
|
+
});
|
|
87
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
88
|
+
className: classes
|
|
89
|
+
}, other), !labelTitle ? null : /*#__PURE__*/React__default.createElement(Text, {
|
|
90
|
+
as: "h3",
|
|
91
|
+
className: getHelperLabelClasses(`${prefix}--file--label`)
|
|
92
|
+
}, labelTitle), /*#__PURE__*/React__default.createElement(Text, {
|
|
93
|
+
as: "p",
|
|
94
|
+
className: getHelperLabelClasses(`${prefix}--label-description`),
|
|
95
|
+
id: fileUploaderInstanceId
|
|
96
|
+
}, labelDescription), /*#__PURE__*/React__default.createElement(FileUploaderButton, {
|
|
97
|
+
innerRef: uploaderButton,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
labelText: buttonLabel,
|
|
100
|
+
multiple: multiple,
|
|
101
|
+
buttonKind: buttonKind,
|
|
102
|
+
onChange: handleChange,
|
|
103
|
+
disableLabelChanges: true,
|
|
104
|
+
accept: accept,
|
|
105
|
+
name: name,
|
|
106
|
+
size: size,
|
|
107
|
+
"aria-describedby": fileUploaderInstanceId
|
|
108
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
109
|
+
className: `${prefix}--file-container`
|
|
110
|
+
}, state.fileNames.length === 0 ? null : state.fileNames.map((name, index) => /*#__PURE__*/React__default.createElement("span", _extends({
|
|
111
|
+
key: index,
|
|
112
|
+
className: selectedFileClasses,
|
|
113
|
+
ref: node => nodes[index] = node // eslint-disable-line
|
|
114
|
+
}, other), /*#__PURE__*/React__default.createElement(Text, {
|
|
115
|
+
as: "p",
|
|
116
|
+
className: `${prefix}--file-filename`,
|
|
117
|
+
id: name
|
|
118
|
+
}, name), /*#__PURE__*/React__default.createElement("span", {
|
|
119
|
+
className: `${prefix}--file__state-container`
|
|
120
|
+
}, /*#__PURE__*/React__default.createElement(Filename, {
|
|
121
|
+
name: name,
|
|
122
|
+
iconDescription: iconDescription,
|
|
123
|
+
status: filenameStatus,
|
|
124
|
+
onKeyDown: evt => {
|
|
125
|
+
if (matches(evt, [Enter, Space])) {
|
|
126
|
+
handleClick(evt, {
|
|
127
|
+
index,
|
|
128
|
+
filenameStatus
|
|
49
129
|
});
|
|
50
|
-
if (this.props.onDelete) {
|
|
51
|
-
this.props.onDelete(evt);
|
|
52
|
-
this.uploaderButton.current?.focus?.();
|
|
53
|
-
}
|
|
54
|
-
this.props.onClick?.(evt);
|
|
55
130
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.setState({
|
|
60
|
-
filenames: []
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
static getDerivedStateFromProps(_ref2, state) {
|
|
65
|
-
let {
|
|
131
|
+
},
|
|
132
|
+
onClick: evt => handleClick(evt, {
|
|
133
|
+
index,
|
|
66
134
|
filenameStatus
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return prevFilenameStatus === filenameStatus ? null : {
|
|
72
|
-
filenameStatus,
|
|
73
|
-
prevFilenameStatus: filenameStatus
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
render() {
|
|
77
|
-
const {
|
|
78
|
-
iconDescription,
|
|
79
|
-
buttonLabel = '',
|
|
80
|
-
buttonKind = 'primary',
|
|
81
|
-
disabled = false,
|
|
82
|
-
filenameStatus = 'uploading',
|
|
83
|
-
labelDescription,
|
|
84
|
-
labelTitle,
|
|
85
|
-
className,
|
|
86
|
-
multiple = false,
|
|
87
|
-
accept = [],
|
|
88
|
-
name,
|
|
89
|
-
size = 'md',
|
|
90
|
-
onDelete,
|
|
91
|
-
// eslint-disable-line
|
|
92
|
-
...other
|
|
93
|
-
} = this.props;
|
|
94
|
-
const prefix = this.context;
|
|
95
|
-
const classes = cx({
|
|
96
|
-
[`${prefix}--form-item`]: true,
|
|
97
|
-
[className]: className
|
|
98
|
-
});
|
|
99
|
-
const getHelperLabelClasses = baseClass => cx(baseClass, {
|
|
100
|
-
[`${prefix}--label-description--disabled`]: disabled
|
|
101
|
-
});
|
|
102
|
-
const selectedFileClasses = cx(`${prefix}--file__selected-file`, {
|
|
103
|
-
[`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md',
|
|
104
|
-
[`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm'
|
|
105
|
-
});
|
|
106
|
-
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
107
|
-
className: classes
|
|
108
|
-
}, other), !labelTitle ? null : /*#__PURE__*/React__default.createElement(Text, {
|
|
109
|
-
as: "h3",
|
|
110
|
-
className: getHelperLabelClasses(`${prefix}--file--label`)
|
|
111
|
-
}, labelTitle), /*#__PURE__*/React__default.createElement(Text, {
|
|
112
|
-
as: "p",
|
|
113
|
-
className: getHelperLabelClasses(`${prefix}--label-description`),
|
|
114
|
-
id: "description"
|
|
115
|
-
}, labelDescription), /*#__PURE__*/React__default.createElement(FileUploaderButton, {
|
|
116
|
-
innerRef: this.uploaderButton,
|
|
117
|
-
disabled: disabled,
|
|
118
|
-
labelText: buttonLabel,
|
|
119
|
-
multiple: multiple,
|
|
120
|
-
buttonKind: buttonKind,
|
|
121
|
-
onChange: this.handleChange,
|
|
122
|
-
disableLabelChanges: true,
|
|
123
|
-
accept: accept,
|
|
124
|
-
name: name,
|
|
125
|
-
size: size,
|
|
126
|
-
"aria-describedby": "description"
|
|
127
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
128
|
-
className: `${prefix}--file-container`
|
|
129
|
-
}, this.state.filenames.length === 0 ? null : this.state.filenames.map((name, index) => /*#__PURE__*/React__default.createElement("span", _extends({
|
|
130
|
-
key: index,
|
|
131
|
-
className: selectedFileClasses,
|
|
132
|
-
ref: node => this.nodes[index] = node // eslint-disable-line
|
|
133
|
-
}, other), /*#__PURE__*/React__default.createElement(Text, {
|
|
134
|
-
as: "p",
|
|
135
|
-
className: `${prefix}--file-filename`,
|
|
136
|
-
id: name
|
|
137
|
-
}, name), /*#__PURE__*/React__default.createElement("span", {
|
|
138
|
-
className: `${prefix}--file__state-container`
|
|
139
|
-
}, /*#__PURE__*/React__default.createElement(Filename, {
|
|
140
|
-
name: name,
|
|
141
|
-
iconDescription: iconDescription,
|
|
142
|
-
status: filenameStatus,
|
|
143
|
-
onKeyDown: evt => {
|
|
144
|
-
if (matches(evt, [Enter, Space])) {
|
|
145
|
-
this.handleClick(evt, {
|
|
146
|
-
index,
|
|
147
|
-
filenameStatus
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
onClick: evt => this.handleClick(evt, {
|
|
152
|
-
index,
|
|
153
|
-
filenameStatus
|
|
154
|
-
})
|
|
155
|
-
}))))));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
_defineProperty(FileUploader, "propTypes", {
|
|
135
|
+
})
|
|
136
|
+
}))))));
|
|
137
|
+
});
|
|
138
|
+
FileUploader.propTypes = {
|
|
159
139
|
/**
|
|
160
140
|
* Specify the types of files that this input should be able to receive
|
|
161
141
|
*/
|
|
@@ -221,7 +201,6 @@ _defineProperty(FileUploader, "propTypes", {
|
|
|
221
201
|
* sizes.
|
|
222
202
|
*/
|
|
223
203
|
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
224
|
-
}
|
|
225
|
-
_defineProperty(FileUploader, "contextType", PrefixContext);
|
|
204
|
+
};
|
|
226
205
|
|
|
227
206
|
export { FileUploader as default };
|
|
@@ -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 FluidComboBoxSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const FluidComboBoxSkeleton: React.FC<FluidComboBoxSkeletonProps>;
|
|
15
|
+
export default FluidComboBoxSkeleton;
|
|
@@ -0,0 +1,102 @@
|
|
|
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, { ComponentType } from 'react';
|
|
8
|
+
import { ComboBoxProps } from '../ComboBox/ComboBox';
|
|
9
|
+
type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
|
|
10
|
+
interface OnChangeData<ItemType> {
|
|
11
|
+
selectedItem: ItemType | null | undefined;
|
|
12
|
+
inputValue?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface FluidComboBoxProps<ItemType> extends ComboBoxProps<ItemType> {
|
|
15
|
+
/**
|
|
16
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
21
|
+
*/
|
|
22
|
+
direction?: 'top' | 'bottom';
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the `<input>` should be disabled
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Specify a custom `id` for the `<input>`
|
|
29
|
+
*/
|
|
30
|
+
id: string;
|
|
31
|
+
/**
|
|
32
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
33
|
+
* from their collection that are pre-selected
|
|
34
|
+
*/
|
|
35
|
+
initialSelectedItem?: ItemType;
|
|
36
|
+
/**
|
|
37
|
+
* Specify if the currently selected value is invalid.
|
|
38
|
+
*/
|
|
39
|
+
invalid?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
42
|
+
*/
|
|
43
|
+
invalidText?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Specify if the `FluidComboBox` should render its menu items in condensed mode
|
|
46
|
+
*/
|
|
47
|
+
isCondensed?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Function to render items as custom components instead of strings.
|
|
50
|
+
* Defaults to null and is overridden by a getter
|
|
51
|
+
*/
|
|
52
|
+
itemToElement?: ComponentType<ItemType> | null;
|
|
53
|
+
/**
|
|
54
|
+
* Helper function passed to downshift that allows the library to render a
|
|
55
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
56
|
+
* from a given item to serve as the item label in the list.
|
|
57
|
+
*/
|
|
58
|
+
itemToString?: ItemToStringHandler<ItemType>;
|
|
59
|
+
/**
|
|
60
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
61
|
+
* in a collection of whatever kind of data structure they prefer
|
|
62
|
+
*/
|
|
63
|
+
items: ItemType[];
|
|
64
|
+
/**
|
|
65
|
+
* Generic `label` that will be used as the textual representation of what
|
|
66
|
+
* this field is for
|
|
67
|
+
*/
|
|
68
|
+
label: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
71
|
+
* consuming component what kind of internal state changes are occurring.
|
|
72
|
+
*/
|
|
73
|
+
onChange: (data: OnChangeData<ItemType>) => void;
|
|
74
|
+
/**
|
|
75
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
76
|
+
* as a string.
|
|
77
|
+
*/
|
|
78
|
+
renderSelectedItem?: (selectedItem: ItemType) => React.ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* In the case you want to control the dropdown selection entirely.
|
|
81
|
+
* */
|
|
82
|
+
selectedItem?: ItemType | null;
|
|
83
|
+
/**
|
|
84
|
+
* Provide the title text that will be read by a screen reader when
|
|
85
|
+
* visiting this control
|
|
86
|
+
*/
|
|
87
|
+
titleText?: React.ReactNode;
|
|
88
|
+
/**
|
|
89
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
90
|
+
*/
|
|
91
|
+
translateWithId?: (id: string) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Specify whether the control is currently in warning state
|
|
94
|
+
*/
|
|
95
|
+
warn?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Provide the text that is displayed when the control is in warning state
|
|
98
|
+
*/
|
|
99
|
+
warnText?: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
declare const FluidComboBox: React.ForwardRefExoticComponent<FluidComboBoxProps<unknown> & React.RefAttributes<HTMLInputElement>>;
|
|
102
|
+
export default FluidComboBox;
|
|
@@ -91,7 +91,7 @@ FluidComboBox.propTypes = {
|
|
|
91
91
|
* `onChange` is a utility for this controlled component to communicate to a
|
|
92
92
|
* consuming component what kind of internal state changes are occurring.
|
|
93
93
|
*/
|
|
94
|
-
onChange: PropTypes.func,
|
|
94
|
+
onChange: PropTypes.func.isRequired,
|
|
95
95
|
/**
|
|
96
96
|
* An optional callback to render the currently selected item as a react element instead of only
|
|
97
97
|
* as a string.
|
|
@@ -119,6 +119,5 @@ FluidComboBox.propTypes = {
|
|
|
119
119
|
*/
|
|
120
120
|
warnText: PropTypes.node
|
|
121
121
|
};
|
|
122
|
-
var FluidComboBox$1 = FluidComboBox;
|
|
123
122
|
|
|
124
|
-
export { FluidComboBox
|
|
123
|
+
export { FluidComboBox as default };
|
|
@@ -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 FluidComboBox from './FluidComboBox';
|
|
8
|
+
import type { FluidComboBoxProps } from './FluidComboBox';
|
|
9
|
+
import type { FluidComboBoxSkeletonProps } from './FluidComboBox.Skeleton';
|
|
10
|
+
export type { FluidComboBoxProps, FluidComboBoxSkeletonProps };
|
|
11
|
+
export default FluidComboBox;
|
|
12
|
+
export { FluidComboBox };
|
|
13
|
+
export { default as FluidComboBoxSkeleton } from './FluidComboBox.Skeleton';
|
|
@@ -0,0 +1,19 @@
|
|
|
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 FluidDatePickerSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specify which variant of the DatePicker the skeleton should mimic
|
|
15
|
+
*/
|
|
16
|
+
datePickerType?: 'simple' | 'single' | 'range';
|
|
17
|
+
}
|
|
18
|
+
declare const FluidDatePickerSkeleton: React.FC<FluidDatePickerSkeletonProps>;
|
|
19
|
+
export default FluidDatePickerSkeleton;
|
|
@@ -13,7 +13,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
13
13
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
14
14
|
import { Calendar } from '@carbon/icons-react';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const FluidDatePickerSkeleton = _ref => {
|
|
17
17
|
let {
|
|
18
18
|
className,
|
|
19
19
|
datePickerType = 'single',
|
|
@@ -50,7 +50,7 @@ function FluidDatePickerSkeleton(_ref) {
|
|
|
50
50
|
role: "img",
|
|
51
51
|
"aria-hidden": "true"
|
|
52
52
|
}))));
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
FluidDatePickerSkeleton.propTypes = {
|
|
55
55
|
/**
|
|
56
56
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export interface FluidDatePickerProps {
|
|
9
|
+
/**
|
|
10
|
+
* The child node(s)
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specify whether or not the control is invalid
|
|
19
|
+
*/
|
|
20
|
+
invalid?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Provide the text that is displayed when the control is in error state
|
|
23
|
+
*/
|
|
24
|
+
invalidText?: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the input should be read-only
|
|
27
|
+
*/
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Specify whether the control is currently in warning state
|
|
31
|
+
*/
|
|
32
|
+
warn?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Provide the text that is displayed when the control is in warning state
|
|
35
|
+
*/
|
|
36
|
+
warnText?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
declare const FluidDatePicker: React.FC<FluidDatePickerProps>;
|
|
39
|
+
export default FluidDatePicker;
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
11
10
|
import cx from 'classnames';
|
|
12
11
|
import DatePicker from '../DatePicker/DatePicker.js';
|
|
13
12
|
import '../DatePicker/DatePicker.Skeleton.js';
|
|
14
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
14
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
|
+
import React__default from 'react';
|
|
16
16
|
|
|
17
17
|
const FluidDatePicker = /*#__PURE__*/React__default.forwardRef(function FluidDatePicker(_ref, ref) {
|
|
18
18
|
let {
|
|
@@ -76,6 +76,5 @@ FluidDatePicker.propTypes = {
|
|
|
76
76
|
*/
|
|
77
77
|
warnText: PropTypes.node
|
|
78
78
|
};
|
|
79
|
-
var FluidDatePicker$1 = FluidDatePicker;
|
|
80
79
|
|
|
81
|
-
export { FluidDatePicker
|
|
80
|
+
export { FluidDatePicker as default };
|
|
@@ -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 FluidDatePicker from './FluidDatePicker';
|
|
8
|
+
import type { FluidDatePickerProps } from './FluidDatePicker';
|
|
9
|
+
import { FluidDatePickerSkeletonProps } from './FluidDatePicker.Skeleton';
|
|
10
|
+
export type { FluidDatePickerProps, FluidDatePickerSkeletonProps };
|
|
11
|
+
export { default as FluidDatePickerSkeleton } from './FluidDatePicker.Skeleton';
|
|
12
|
+
export default FluidDatePicker;
|
|
13
|
+
export { FluidDatePicker };
|