@patternfly/react-core 3.144.1 → 3.146.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/CHANGELOG.md +46 -0
- package/dist/esm/components/DataToolbar/DataToolbarFilter.js +16 -5
- package/dist/esm/components/Drawer/Drawer.js +26 -36
- package/dist/esm/components/Drawer/DrawerActions.js +28 -0
- package/dist/esm/components/Drawer/DrawerCloseButton.js +36 -0
- package/dist/esm/components/Drawer/DrawerContent.js +9 -6
- package/dist/esm/components/Drawer/DrawerContentBody.js +30 -0
- package/dist/esm/components/Drawer/DrawerHead.js +33 -0
- package/dist/esm/components/Drawer/DrawerMain.js +28 -0
- package/dist/esm/components/Drawer/DrawerPanelBody.js +30 -0
- package/dist/esm/components/Drawer/DrawerPanelContent.js +12 -8
- package/dist/esm/components/Drawer/DrawerSection.js +28 -0
- package/dist/esm/components/Drawer/index.js +7 -1
- package/dist/esm/components/Dropdown/Toggle.js +3 -1
- package/dist/esm/components/FileUpload/FileUpload.js +123 -0
- package/dist/esm/components/FileUpload/FileUploadField.js +123 -0
- package/dist/esm/components/FileUpload/index.js +3 -0
- package/dist/esm/components/Modal/ModalBoxDescription.js +30 -0
- package/dist/esm/components/Modal/ModalContent.js +2 -3
- package/dist/esm/components/Select/Select.js +70 -36
- package/dist/esm/components/Select/SelectMenu.js +34 -25
- package/dist/esm/components/Select/SelectOption.js +15 -5
- package/dist/esm/components/Select/SelectToggle.js +6 -3
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/helpers/fileUtils.js +32 -0
- package/dist/esm/helpers/util.js +1 -1
- package/dist/js/components/DataToolbar/DataToolbarFilter.d.ts +8 -2
- package/dist/js/components/DataToolbar/DataToolbarFilter.js +21 -12
- package/dist/js/components/Drawer/Drawer.d.ts +7 -6
- package/dist/js/components/Drawer/Drawer.js +32 -67
- package/dist/js/components/Drawer/DrawerActions.d.ts +8 -0
- package/dist/js/components/Drawer/DrawerActions.js +44 -0
- package/dist/js/components/Drawer/DrawerCloseButton.d.ts +10 -0
- package/dist/js/components/Drawer/DrawerCloseButton.js +58 -0
- package/dist/js/components/Drawer/DrawerContent.d.ts +3 -1
- package/dist/js/components/Drawer/DrawerContent.js +9 -5
- package/dist/js/components/Drawer/DrawerContentBody.d.ts +10 -0
- package/dist/js/components/Drawer/DrawerContentBody.js +47 -0
- package/dist/js/components/Drawer/DrawerHead.d.ts +10 -0
- package/dist/js/components/Drawer/DrawerHead.js +51 -0
- package/dist/js/components/Drawer/DrawerMain.d.ts +8 -0
- package/dist/js/components/Drawer/DrawerMain.js +44 -0
- package/dist/js/components/Drawer/DrawerPanelBody.d.ts +10 -0
- package/dist/js/components/Drawer/DrawerPanelBody.js +47 -0
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts +3 -4
- package/dist/js/components/Drawer/DrawerPanelContent.js +16 -10
- package/dist/js/components/Drawer/DrawerSection.d.ts +8 -0
- package/dist/js/components/Drawer/DrawerSection.js +44 -0
- package/dist/js/components/Drawer/index.d.ts +7 -1
- package/dist/js/components/Drawer/index.js +75 -3
- package/dist/js/components/Dropdown/Toggle.js +2 -1
- package/dist/js/components/FileUpload/FileUpload.d.ts +57 -0
- package/dist/js/components/FileUpload/FileUpload.js +151 -0
- package/dist/js/components/FileUpload/FileUploadField.d.ts +57 -0
- package/dist/js/components/FileUpload/FileUploadField.js +167 -0
- package/dist/js/components/FileUpload/index.d.ts +2 -0
- package/dist/js/components/FileUpload/index.js +30 -0
- package/dist/js/components/Modal/ModalBoxDescription.d.ts +10 -0
- package/dist/js/components/Modal/ModalBoxDescription.js +49 -0
- package/dist/js/components/Modal/ModalContent.js +3 -4
- package/dist/js/components/Select/Select.d.ts +2 -0
- package/dist/js/components/Select/Select.js +79 -35
- package/dist/js/components/Select/SelectMenu.d.ts +3 -1
- package/dist/js/components/Select/SelectMenu.js +30 -14
- package/dist/js/components/Select/SelectOption.d.ts +2 -0
- package/dist/js/components/Select/SelectOption.js +15 -5
- package/dist/js/components/Select/SelectToggle.d.ts +2 -0
- package/dist/js/components/Select/SelectToggle.js +6 -3
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.js +12 -0
- package/dist/js/helpers/fileUtils.d.ts +12 -0
- package/dist/js/helpers/fileUtils.js +45 -0
- package/dist/js/helpers/util.js +3 -1
- package/dist/umd/components/DataToolbar/DataToolbarFilter.js +16 -5
- package/dist/umd/components/Drawer/Drawer.js +27 -50
- package/dist/umd/components/Drawer/DrawerActions.js +154 -0
- package/dist/umd/components/Drawer/DrawerCloseButton.js +162 -0
- package/dist/umd/components/Drawer/DrawerContent.js +12 -10
- package/dist/umd/components/Drawer/DrawerContentBody.js +156 -0
- package/dist/umd/components/Drawer/DrawerHead.js +158 -0
- package/dist/umd/components/Drawer/DrawerMain.js +154 -0
- package/dist/umd/components/Drawer/DrawerPanelBody.js +156 -0
- package/dist/umd/components/Drawer/DrawerPanelContent.js +16 -13
- package/dist/umd/components/Drawer/DrawerSection.js +154 -0
- package/dist/umd/components/Drawer/index.js +60 -6
- package/dist/umd/components/Dropdown/Toggle.js +3 -1
- package/dist/umd/components/FileUpload/FileUpload.js +291 -0
- package/dist/umd/components/FileUpload/FileUploadField.js +243 -0
- package/dist/umd/components/FileUpload/index.js +38 -0
- package/dist/umd/components/Modal/ModalBoxDescription.js +156 -0
- package/dist/umd/components/Modal/ModalContent.js +5 -8
- package/dist/umd/components/Select/Select.js +71 -38
- package/dist/umd/components/Select/SelectMenu.js +37 -29
- package/dist/umd/components/Select/SelectOption.js +15 -5
- package/dist/umd/components/Select/SelectToggle.js +6 -3
- package/dist/umd/components/index.js +13 -4
- package/dist/umd/helpers/fileUtils.js +52 -0
- package/dist/umd/helpers/util.js +1 -1
- package/package.json +7 -6
- package/src/components/ApplicationLauncher/__tests__/__snapshots__/ApplicationLauncher.test.tsx.snap +0 -6
- package/src/components/DataToolbar/DataToolbarFilter.tsx +18 -6
- package/src/components/DataToolbar/__tests__/__snapshots__/DataToolbar.test.tsx.snap +16 -0
- package/src/components/Drawer/Drawer.tsx +36 -31
- package/src/components/Drawer/DrawerActions.tsx +21 -0
- package/src/components/Drawer/DrawerCloseButton.tsx +28 -0
- package/src/components/Drawer/DrawerContent.tsx +11 -4
- package/src/components/Drawer/DrawerContentBody.tsx +24 -0
- package/src/components/Drawer/DrawerHead.tsx +27 -0
- package/src/components/Drawer/DrawerMain.tsx +21 -0
- package/src/components/Drawer/DrawerPanelBody.tsx +24 -0
- package/src/components/Drawer/DrawerPanelContent.tsx +19 -8
- package/src/components/Drawer/DrawerSection.tsx +21 -0
- package/src/components/Drawer/__tests__/Drawer.test.tsx +24 -13
- package/src/components/Drawer/__tests__/Generated/__snapshots__/Drawer.test.tsx.snap +13 -5
- package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerContent.test.tsx.snap +8 -6
- package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerPanelContent.test.tsx.snap +3 -11
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap +764 -69
- package/src/components/Drawer/examples/Drawer.md +434 -11
- package/src/components/Drawer/index.ts +7 -1
- package/src/components/Dropdown/Toggle.tsx +2 -0
- package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +0 -14
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +0 -5
- package/src/components/Dropdown/__tests__/__snapshots__/Toggle.test.tsx.snap +0 -2
- package/src/components/FileUpload/FileUpload.tsx +150 -0
- package/src/components/FileUpload/FileUploadField.tsx +176 -0
- package/src/components/FileUpload/__tests__/FileUpload.test.tsx +22 -0
- package/src/components/FileUpload/__tests__/FileUploadField.test.tsx +27 -0
- package/src/components/FileUpload/__tests__/__snapshots__/FileUpload.test.tsx.snap +16 -0
- package/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap +60 -0
- package/src/components/FileUpload/examples/FileUpload.md +283 -0
- package/src/components/FileUpload/index.ts +2 -0
- package/src/components/Modal/ModalBoxDescription.tsx +23 -0
- package/src/components/Modal/ModalContent.tsx +2 -6
- package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +2 -3
- package/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap +0 -7
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +0 -13
- package/src/components/Select/Select.tsx +74 -33
- package/src/components/Select/SelectMenu.tsx +28 -23
- package/src/components/Select/SelectOption.tsx +28 -3
- package/src/components/Select/SelectToggle.tsx +6 -1
- package/src/components/Select/__tests__/Select.test.tsx +16 -0
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +911 -174
- package/src/components/Select/__tests__/__snapshots__/SelectOption.test.tsx.snap +7 -7
- package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -0
- package/src/components/Select/examples/Select.md +109 -6
- package/src/components/index.ts +1 -0
- package/src/helpers/__tests__/fileUtils.test.ts +17 -0
- package/src/helpers/fileUtils.ts +26 -0
- package/src/helpers/util.ts +1 -1
- package/src/components/Drawer/Drawer.test.tsx +0 -22
- package/src/components/Drawer/__snapshots__/Drawer.test.tsx.snap +0 -121
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,52 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.146.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.145.3...@patternfly/react-core@3.146.0) (2020-03-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **Modal:** move description to separate component ([#3897](https://github.com/patternfly/patternfly-react/issues/3897)) ([97eb9d8](https://github.com/patternfly/patternfly-react/commit/97eb9d8766febf5dd97424c4c7868f80441b8386))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.145.3](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.145.2...@patternfly/react-core@3.145.3) (2020-03-09)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [3.145.2](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.145.1...@patternfly/react-core@3.145.2) (2020-03-09)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [3.145.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.145.0...@patternfly/react-core@3.145.1) (2020-03-09)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [3.145.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.144.1...@patternfly/react-core@3.145.0) (2020-03-09)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **Select:** add inline filtering to checkbox select ([#3843](https://github.com/patternfly/patternfly-react/issues/3843)) ([2263de8](https://github.com/patternfly/patternfly-react/commit/2263de8361b196f4421a3adcbb01b4b2dd410d4a))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
6
52
|
## [3.144.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.144.0...@patternfly/react-core@3.144.1) (2020-03-06)
|
|
7
53
|
|
|
8
54
|
**Note:** Version bump only for package @patternfly/react-core
|
|
@@ -20,14 +20,22 @@ export class DataToolbarFilter extends React.Component {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
componentDidMount() {
|
|
23
|
-
|
|
23
|
+
const {
|
|
24
|
+
categoryName,
|
|
25
|
+
chips
|
|
26
|
+
} = this.props;
|
|
27
|
+
this.context.updateNumberFilters(typeof categoryName === 'string' ? categoryName : categoryName.name, chips.length);
|
|
24
28
|
this.setState({
|
|
25
29
|
isMounted: true
|
|
26
30
|
});
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
componentDidUpdate() {
|
|
30
|
-
|
|
34
|
+
const {
|
|
35
|
+
categoryName,
|
|
36
|
+
chips
|
|
37
|
+
} = this.props;
|
|
38
|
+
this.context.updateNumberFilters(typeof categoryName === 'string' ? categoryName : categoryName.name, chips.length);
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
render() {
|
|
@@ -50,8 +58,8 @@ export class DataToolbarFilter extends React.Component {
|
|
|
50
58
|
}, React.createElement(ChipGroup, {
|
|
51
59
|
withToolbar: true
|
|
52
60
|
}, React.createElement(ChipGroupToolbarItem, {
|
|
53
|
-
key: categoryName,
|
|
54
|
-
categoryName: categoryName
|
|
61
|
+
key: typeof categoryName === 'string' ? categoryName : categoryName.key,
|
|
62
|
+
categoryName: typeof categoryName === 'string' ? categoryName : categoryName.name
|
|
55
63
|
}, chips.map(chip => typeof chip === 'string' ? React.createElement(Chip, {
|
|
56
64
|
key: chip,
|
|
57
65
|
onClick: () => deleteChip(categoryName, chip)
|
|
@@ -78,7 +86,10 @@ _defineProperty(DataToolbarFilter, "propTypes", {
|
|
|
78
86
|
})])),
|
|
79
87
|
deleteChip: _pt.func,
|
|
80
88
|
children: _pt.node.isRequired,
|
|
81
|
-
categoryName: _pt.string.
|
|
89
|
+
categoryName: _pt.oneOfType([_pt.string, _pt.shape({
|
|
90
|
+
key: _pt.string.isRequired,
|
|
91
|
+
name: _pt.string.isRequired
|
|
92
|
+
})]).isRequired,
|
|
82
93
|
showToolbarItem: _pt.bool
|
|
83
94
|
});
|
|
84
95
|
|
|
@@ -6,47 +6,37 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
6
6
|
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
8
|
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
-
|
|
11
9
|
import * as React from 'react';
|
|
12
10
|
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
13
11
|
import { css } from '@patternfly/react-styles';
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
export const DrawerContext = React.createContext({
|
|
13
|
+
isExpanded: false
|
|
14
|
+
});
|
|
15
|
+
export const Drawer = (_ref) => {
|
|
16
|
+
let {
|
|
17
|
+
className = '',
|
|
18
|
+
children,
|
|
19
|
+
isExpanded = false,
|
|
20
|
+
isInline = false,
|
|
21
|
+
isStatic = false,
|
|
22
|
+
position = 'right'
|
|
23
|
+
} = _ref,
|
|
24
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "isExpanded", "isInline", "isStatic", "position"]);
|
|
25
|
+
|
|
26
|
+
return React.createElement(DrawerContext.Provider, {
|
|
27
|
+
value: {
|
|
28
|
+
isExpanded
|
|
24
29
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className = '',
|
|
31
|
-
children,
|
|
32
|
-
isExpanded = false,
|
|
33
|
-
isInline = false
|
|
34
|
-
} = _this$props,
|
|
35
|
-
props = _objectWithoutProperties(_this$props, ["className", "children", "isExpanded", "isInline"]);
|
|
36
|
-
|
|
37
|
-
return React.createElement("div", _extends({}, props, {
|
|
38
|
-
className: css(styles.drawer, isExpanded && styles.modifiers.expanded, isInline && styles.modifiers.inline, className)
|
|
39
|
-
}), children);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_defineProperty(Drawer, "propTypes", {
|
|
30
|
+
}, React.createElement("div", _extends({
|
|
31
|
+
className: css(styles.drawer, isExpanded && styles.modifiers.expanded, isInline && styles.modifiers.inline, isStatic && styles.modifiers.static, position === 'left' && styles.modifiers.panelLeft, className)
|
|
32
|
+
}, props), children));
|
|
33
|
+
};
|
|
34
|
+
Drawer.propTypes = {
|
|
45
35
|
className: _pt.string,
|
|
46
36
|
children: _pt.node,
|
|
47
37
|
isExpanded: _pt.bool,
|
|
48
|
-
isInline: _pt.bool
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
isInline: _pt.bool,
|
|
39
|
+
isStatic: _pt.bool,
|
|
40
|
+
position: _pt.oneOf(['left', 'right'])
|
|
41
|
+
};
|
|
52
42
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
export const DrawerActions = (_ref) => {
|
|
13
|
+
let {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
className = '',
|
|
16
|
+
children
|
|
17
|
+
} = _ref,
|
|
18
|
+
props = _objectWithoutProperties(_ref, ["className", "children"]);
|
|
19
|
+
|
|
20
|
+
return React.createElement("div", _extends({
|
|
21
|
+
className: css(styles.drawerActions, className)
|
|
22
|
+
}, props), children);
|
|
23
|
+
};
|
|
24
|
+
DrawerActions.propTypes = {
|
|
25
|
+
className: _pt.string,
|
|
26
|
+
children: _pt.node
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=DrawerActions.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
import { Button } from '../Button';
|
|
13
|
+
import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
|
|
14
|
+
export const DrawerCloseButton = (_ref) => {
|
|
15
|
+
let {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
+
className = '',
|
|
18
|
+
onClose = () => undefined,
|
|
19
|
+
'aria-label': ariaLabel = 'Close drawer panel'
|
|
20
|
+
} = _ref,
|
|
21
|
+
props = _objectWithoutProperties(_ref, ["className", "onClose", "aria-label"]);
|
|
22
|
+
|
|
23
|
+
return React.createElement("div", _extends({
|
|
24
|
+
className: css(styles.drawerClose, className)
|
|
25
|
+
}, props), React.createElement(Button, {
|
|
26
|
+
variant: "plain",
|
|
27
|
+
onClick: onClose,
|
|
28
|
+
"aria-label": ariaLabel
|
|
29
|
+
}, React.createElement(TimesIcon, null)));
|
|
30
|
+
};
|
|
31
|
+
DrawerCloseButton.propTypes = {
|
|
32
|
+
className: _pt.string,
|
|
33
|
+
onClose: _pt.func,
|
|
34
|
+
'aria-label': _pt.string
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=DrawerCloseButton.js.map
|
|
@@ -9,20 +9,23 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
11
|
import { css } from '@patternfly/react-styles';
|
|
12
|
+
import { DrawerMain } from './DrawerMain';
|
|
12
13
|
export const DrawerContent = (_ref) => {
|
|
13
14
|
let {
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
16
|
className = '',
|
|
16
|
-
children
|
|
17
|
+
children,
|
|
18
|
+
panelContent
|
|
17
19
|
} = _ref,
|
|
18
|
-
props = _objectWithoutProperties(_ref, ["className", "children"]);
|
|
20
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "panelContent"]);
|
|
19
21
|
|
|
20
|
-
return React.createElement("div", _extends({
|
|
21
|
-
className: css(styles.drawerContent)
|
|
22
|
-
}, props), children);
|
|
22
|
+
return React.createElement(DrawerMain, null, React.createElement("div", _extends({
|
|
23
|
+
className: css(styles.drawerContent, className)
|
|
24
|
+
}, props), children), panelContent);
|
|
23
25
|
};
|
|
24
26
|
DrawerContent.propTypes = {
|
|
25
27
|
className: _pt.string,
|
|
26
|
-
children: _pt.node
|
|
28
|
+
children: _pt.node,
|
|
29
|
+
panelContent: _pt.node.isRequired
|
|
27
30
|
};
|
|
28
31
|
//# sourceMappingURL=DrawerContent.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
export const DrawerContentBody = (_ref) => {
|
|
13
|
+
let {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
className = '',
|
|
16
|
+
children,
|
|
17
|
+
hasPadding = false
|
|
18
|
+
} = _ref,
|
|
19
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "hasPadding"]);
|
|
20
|
+
|
|
21
|
+
return React.createElement("div", _extends({
|
|
22
|
+
className: css(styles.drawerBody, hasPadding && styles.modifiers.padding, className)
|
|
23
|
+
}, props), children);
|
|
24
|
+
};
|
|
25
|
+
DrawerContentBody.propTypes = {
|
|
26
|
+
className: _pt.string,
|
|
27
|
+
children: _pt.node,
|
|
28
|
+
hasPadding: _pt.bool
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=DrawerContentBody.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
import { DrawerPanelBody } from './DrawerPanelBody';
|
|
13
|
+
export const DrawerHead = (_ref) => {
|
|
14
|
+
let {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
className = '',
|
|
17
|
+
children,
|
|
18
|
+
noPadding = false
|
|
19
|
+
} = _ref,
|
|
20
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "noPadding"]);
|
|
21
|
+
|
|
22
|
+
return React.createElement(DrawerPanelBody, {
|
|
23
|
+
noPadding: noPadding
|
|
24
|
+
}, React.createElement("div", _extends({
|
|
25
|
+
className: css(styles.drawerHead, className)
|
|
26
|
+
}, props), children));
|
|
27
|
+
};
|
|
28
|
+
DrawerHead.propTypes = {
|
|
29
|
+
className: _pt.string,
|
|
30
|
+
children: _pt.node,
|
|
31
|
+
noPadding: _pt.bool
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=DrawerHead.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
export const DrawerMain = (_ref) => {
|
|
13
|
+
let {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
className = '',
|
|
16
|
+
children
|
|
17
|
+
} = _ref,
|
|
18
|
+
props = _objectWithoutProperties(_ref, ["className", "children"]);
|
|
19
|
+
|
|
20
|
+
return React.createElement("div", _extends({
|
|
21
|
+
className: css(styles.drawerMain, className)
|
|
22
|
+
}, props), children);
|
|
23
|
+
};
|
|
24
|
+
DrawerMain.propTypes = {
|
|
25
|
+
className: _pt.string,
|
|
26
|
+
children: _pt.node
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=DrawerMain.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
export const DrawerPanelBody = (_ref) => {
|
|
13
|
+
let {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
className = '',
|
|
16
|
+
children,
|
|
17
|
+
noPadding = false
|
|
18
|
+
} = _ref,
|
|
19
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "noPadding"]);
|
|
20
|
+
|
|
21
|
+
return React.createElement("div", _extends({
|
|
22
|
+
className: css(styles.drawerBody, noPadding && styles.modifiers.noPadding, className)
|
|
23
|
+
}, props), children);
|
|
24
|
+
};
|
|
25
|
+
DrawerPanelBody.propTypes = {
|
|
26
|
+
className: _pt.string,
|
|
27
|
+
children: _pt.node,
|
|
28
|
+
noPadding: _pt.bool
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=DrawerPanelBody.js.map
|
|
@@ -9,23 +9,27 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
11
|
import { css } from '@patternfly/react-styles';
|
|
12
|
+
import { DrawerContext } from './Drawer';
|
|
12
13
|
export const DrawerPanelContent = (_ref) => {
|
|
13
14
|
let {
|
|
14
15
|
className = '',
|
|
15
16
|
children,
|
|
16
|
-
|
|
17
|
+
hasBorder = false
|
|
17
18
|
} = _ref,
|
|
18
|
-
props = _objectWithoutProperties(_ref, ["className", "children", "
|
|
19
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "hasBorder"]);
|
|
19
20
|
|
|
20
|
-
return React.createElement(
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
className: css(styles.
|
|
24
|
-
|
|
21
|
+
return React.createElement(DrawerContext.Consumer, null, ({
|
|
22
|
+
isExpanded
|
|
23
|
+
}) => React.createElement("div", _extends({
|
|
24
|
+
className: css(styles.drawerPanel, hasBorder && styles.modifiers.border, className),
|
|
25
|
+
hidden: !isExpanded,
|
|
26
|
+
"aria-hidden": !isExpanded,
|
|
27
|
+
"aria-expanded": isExpanded
|
|
28
|
+
}, props), children));
|
|
25
29
|
};
|
|
26
30
|
DrawerPanelContent.propTypes = {
|
|
27
31
|
className: _pt.string,
|
|
28
32
|
children: _pt.node,
|
|
29
|
-
|
|
33
|
+
hasBorder: _pt.bool
|
|
30
34
|
};
|
|
31
35
|
//# sourceMappingURL=DrawerPanelContent.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
export const DrawerSection = (_ref) => {
|
|
13
|
+
let {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
className = '',
|
|
16
|
+
children
|
|
17
|
+
} = _ref,
|
|
18
|
+
props = _objectWithoutProperties(_ref, ["className", "children"]);
|
|
19
|
+
|
|
20
|
+
return React.createElement("div", _extends({
|
|
21
|
+
className: css(styles.drawerSection, className)
|
|
22
|
+
}, props), children);
|
|
23
|
+
};
|
|
24
|
+
DrawerSection.propTypes = {
|
|
25
|
+
className: _pt.string,
|
|
26
|
+
children: _pt.node
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=DrawerSection.js.map
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export * from './Drawer';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './DrawerActions';
|
|
3
|
+
export * from './DrawerCloseButton';
|
|
3
4
|
export * from './DrawerContent';
|
|
5
|
+
export * from './DrawerContentBody';
|
|
6
|
+
export * from './DrawerHead';
|
|
7
|
+
export * from './DrawerPanelBody';
|
|
8
|
+
export * from './DrawerPanelContent';
|
|
9
|
+
export * from './DrawerSection';
|
|
4
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -84,6 +84,8 @@ export class Toggle extends React.Component {
|
|
|
84
84
|
isPrimary,
|
|
85
85
|
isSplitButton,
|
|
86
86
|
ariaHasPopup,
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88
|
+
bubbleEvent,
|
|
87
89
|
onToggle,
|
|
88
90
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
91
|
onEnter,
|
|
@@ -92,7 +94,7 @@ export class Toggle extends React.Component {
|
|
|
92
94
|
id,
|
|
93
95
|
type
|
|
94
96
|
} = _this$props,
|
|
95
|
-
props = _objectWithoutProperties(_this$props, ["className", "children", "isOpen", "isFocused", "isActive", "isHovered", "isDisabled", "isPlain", "isPrimary", "isSplitButton", "ariaHasPopup", "onToggle", "onEnter", "parentRef", "id", "type"]);
|
|
97
|
+
props = _objectWithoutProperties(_this$props, ["className", "children", "isOpen", "isFocused", "isActive", "isHovered", "isDisabled", "isPlain", "isPrimary", "isSplitButton", "ariaHasPopup", "bubbleEvent", "onToggle", "onEnter", "parentRef", "id", "type"]);
|
|
96
98
|
|
|
97
99
|
return React.createElement(DropdownContext.Consumer, null, ({
|
|
98
100
|
toggleClass
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
|
|
11
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
12
|
+
|
|
13
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
|
+
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import Dropzone from 'react-dropzone';
|
|
17
|
+
import { FileUploadField } from './FileUploadField';
|
|
18
|
+
import { readFile, fileReaderType } from '../../helpers/fileUtils';
|
|
19
|
+
export const FileUpload = (_ref) => {
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
type,
|
|
23
|
+
value = type === fileReaderType.text || type === fileReaderType.dataURL ? '' : null,
|
|
24
|
+
filename = '',
|
|
25
|
+
children = null,
|
|
26
|
+
onChange = () => {},
|
|
27
|
+
onReadStarted = () => {},
|
|
28
|
+
onReadFinished = () => {},
|
|
29
|
+
onReadFailed = () => {},
|
|
30
|
+
dropzoneProps = {}
|
|
31
|
+
} = _ref,
|
|
32
|
+
props = _objectWithoutProperties(_ref, ["id", "type", "value", "filename", "children", "onChange", "onReadStarted", "onReadFinished", "onReadFailed", "dropzoneProps"]);
|
|
33
|
+
|
|
34
|
+
const onDropAccepted = (acceptedFiles, event) => {
|
|
35
|
+
if (acceptedFiles.length > 0) {
|
|
36
|
+
const fileHandle = acceptedFiles[0];
|
|
37
|
+
|
|
38
|
+
if (type === fileReaderType.text || type === fileReaderType.dataURL) {
|
|
39
|
+
onChange('', fileHandle.name, event); // Show the filename while reading
|
|
40
|
+
|
|
41
|
+
onReadStarted(fileHandle);
|
|
42
|
+
readFile(fileHandle, type).then(data => {
|
|
43
|
+
onReadFinished(fileHandle);
|
|
44
|
+
onChange(data, fileHandle.name, event);
|
|
45
|
+
}).catch(error => {
|
|
46
|
+
onReadFailed(error, fileHandle);
|
|
47
|
+
onReadFinished(fileHandle);
|
|
48
|
+
onChange('', '', event); // Clear the filename field on a failure
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
onChange(fileHandle, fileHandle.name, event);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dropzoneProps.onDropAccepted && dropzoneProps.onDropAccepted(acceptedFiles, event);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onDropRejected = (rejectedFiles, event) => {
|
|
59
|
+
if (rejectedFiles.length > 0) {
|
|
60
|
+
onChange('', rejectedFiles[0].name, event);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
dropzoneProps.onDropRejected && dropzoneProps.onDropRejected(rejectedFiles, event);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onClearButtonClick = event => {
|
|
67
|
+
onChange('', '', event);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return React.createElement(Dropzone, _extends({
|
|
71
|
+
multiple: false
|
|
72
|
+
}, dropzoneProps, {
|
|
73
|
+
onDropAccepted: onDropAccepted,
|
|
74
|
+
onDropRejected: onDropRejected
|
|
75
|
+
}), ({
|
|
76
|
+
getRootProps,
|
|
77
|
+
getInputProps,
|
|
78
|
+
isDragActive,
|
|
79
|
+
open
|
|
80
|
+
}) => React.createElement(FileUploadField, _extends({}, getRootProps(_objectSpread({}, props, {
|
|
81
|
+
refKey: 'containerRef',
|
|
82
|
+
onClick: event => event.preventDefault() // Prevents clicking TextArea from opening file dialog
|
|
83
|
+
|
|
84
|
+
})), {
|
|
85
|
+
tabIndex: null // Omit the unwanted tabIndex from react-dropzone's getRootProps
|
|
86
|
+
,
|
|
87
|
+
id: id,
|
|
88
|
+
type: type,
|
|
89
|
+
filename: filename,
|
|
90
|
+
value: value,
|
|
91
|
+
onChange: onChange,
|
|
92
|
+
isDragActive: isDragActive,
|
|
93
|
+
onBrowseButtonClick: open,
|
|
94
|
+
onClearButtonClick: onClearButtonClick
|
|
95
|
+
}), React.createElement("input", getInputProps()), children));
|
|
96
|
+
};
|
|
97
|
+
FileUpload.propTypes = {
|
|
98
|
+
id: _pt.string.isRequired,
|
|
99
|
+
type: _pt.oneOf(['text', 'dataURL']),
|
|
100
|
+
value: _pt.oneOfType([_pt.string, _pt.any]),
|
|
101
|
+
filename: _pt.string,
|
|
102
|
+
onChange: _pt.func,
|
|
103
|
+
className: _pt.string,
|
|
104
|
+
isDisabled: _pt.bool,
|
|
105
|
+
isReadOnly: _pt.bool,
|
|
106
|
+
isLoading: _pt.bool,
|
|
107
|
+
spinnerAriaValueText: _pt.string,
|
|
108
|
+
isRequired: _pt.bool,
|
|
109
|
+
validated: _pt.oneOf(['success', 'error', 'default']),
|
|
110
|
+
'aria-label': _pt.string,
|
|
111
|
+
filenamePlaceholder: _pt.string,
|
|
112
|
+
filenameAriaLabel: _pt.string,
|
|
113
|
+
browseButtonText: _pt.string,
|
|
114
|
+
clearButtonText: _pt.string,
|
|
115
|
+
hideDefaultPreview: _pt.bool,
|
|
116
|
+
allowEditingUploadedText: _pt.bool,
|
|
117
|
+
children: _pt.node,
|
|
118
|
+
onReadStarted: _pt.func,
|
|
119
|
+
onReadFinished: _pt.func,
|
|
120
|
+
onReadFailed: _pt.func,
|
|
121
|
+
dropzoneProps: _pt.any
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=FileUpload.js.map
|