@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
|
@@ -15,6 +15,8 @@ var _form = _interopRequireDefault(require("@patternfly/react-styles/css/compone
|
|
|
15
15
|
|
|
16
16
|
var _reactStyles = require("@patternfly/react-styles");
|
|
17
17
|
|
|
18
|
+
var _SelectOption = require("./SelectOption");
|
|
19
|
+
|
|
18
20
|
var _selectConstants = require("./selectConstants");
|
|
19
21
|
|
|
20
22
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -25,6 +27,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
25
27
|
|
|
26
28
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
27
29
|
|
|
30
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
31
|
+
|
|
32
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
33
|
+
|
|
34
|
+
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
35
|
+
|
|
36
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
37
|
+
|
|
28
38
|
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); }
|
|
29
39
|
|
|
30
40
|
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; }
|
|
@@ -107,18 +117,21 @@ function (_React$Component) {
|
|
|
107
117
|
}
|
|
108
118
|
}, {
|
|
109
119
|
key: "extendCheckboxChildren",
|
|
110
|
-
value: function extendCheckboxChildren() {
|
|
120
|
+
value: function extendCheckboxChildren(children) {
|
|
111
121
|
var _this$props3 = this.props,
|
|
112
|
-
children = _this$props3.children,
|
|
113
122
|
isGrouped = _this$props3.isGrouped,
|
|
114
123
|
checked = _this$props3.checked,
|
|
115
124
|
sendRef = _this$props3.sendRef,
|
|
116
|
-
keyHandler = _this$props3.keyHandler
|
|
117
|
-
|
|
125
|
+
keyHandler = _this$props3.keyHandler,
|
|
126
|
+
hasInlineFilter = _this$props3.hasInlineFilter;
|
|
127
|
+
var index = hasInlineFilter ? 1 : 0;
|
|
118
128
|
|
|
119
129
|
if (isGrouped) {
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
return React.Children.map(children, function (group) {
|
|
131
|
+
if (group.type === _SelectOption.SelectOption) {
|
|
132
|
+
return group;
|
|
133
|
+
}
|
|
134
|
+
|
|
122
135
|
return React.cloneElement(group, {
|
|
123
136
|
titleId: group.props.label.replace(/\W/g, '-'),
|
|
124
137
|
children: React.createElement("fieldset", {
|
|
@@ -129,21 +142,21 @@ function (_React$Component) {
|
|
|
129
142
|
isChecked: checked && checked.includes(option.props.value),
|
|
130
143
|
sendRef: sendRef,
|
|
131
144
|
keyHandler: keyHandler,
|
|
132
|
-
index:
|
|
145
|
+
index: index++
|
|
133
146
|
});
|
|
134
147
|
}))
|
|
135
148
|
});
|
|
136
149
|
});
|
|
137
150
|
}
|
|
138
151
|
|
|
139
|
-
return React.
|
|
152
|
+
return React.Children.map(children, function (child) {
|
|
140
153
|
return React.cloneElement(child, {
|
|
141
154
|
isChecked: checked && checked.includes(child.props.value),
|
|
142
155
|
sendRef: sendRef,
|
|
143
156
|
keyHandler: keyHandler,
|
|
144
|
-
index: index
|
|
157
|
+
index: index++
|
|
145
158
|
});
|
|
146
|
-
})
|
|
159
|
+
});
|
|
147
160
|
}
|
|
148
161
|
}, {
|
|
149
162
|
key: "render",
|
|
@@ -167,7 +180,8 @@ function (_React$Component) {
|
|
|
167
180
|
createText = _this$props4.createText,
|
|
168
181
|
ariaLabel = _this$props4['aria-label'],
|
|
169
182
|
ariaLabelledBy = _this$props4['aria-labelledby'],
|
|
170
|
-
|
|
183
|
+
hasInlineFilter = _this$props4.hasInlineFilter,
|
|
184
|
+
props = _objectWithoutProperties(_this$props4, ["children", "isCustomContent", "className", "isExpanded", "openedOnEnter", "selected", "checked", "isGrouped", "sendRef", "keyHandler", "maxHeight", "noResultsFoundText", "createText", "aria-label", "aria-labelledby", "hasInlineFilter"]);
|
|
171
185
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
172
186
|
|
|
173
187
|
|
|
@@ -203,7 +217,7 @@ function (_React$Component) {
|
|
|
203
217
|
"aria-label": ariaLabel,
|
|
204
218
|
"aria-labelledby": !ariaLabel && ariaLabelledBy || null,
|
|
205
219
|
className: (0, _reactStyles.css)(_form["default"].formFieldset)
|
|
206
|
-
}), _this2.extendCheckboxChildren()))), variant === _selectConstants.SelectVariant.checkbox && !isCustomContent && React.Children.count(children) === 0 && React.createElement("div", _extends({
|
|
220
|
+
}), hasInlineFilter && [children.shift()].concat(_toConsumableArray(_this2.extendCheckboxChildren(children))), !hasInlineFilter && _this2.extendCheckboxChildren(children)))), variant === _selectConstants.SelectVariant.checkbox && !isCustomContent && React.Children.count(children) === 0 && React.createElement("div", _extends({
|
|
207
221
|
className: (0, _reactStyles.css)(_select["default"].selectMenu, className)
|
|
208
222
|
}, maxHeight && {
|
|
209
223
|
style: {
|
|
@@ -235,7 +249,8 @@ _defineProperty(SelectMenu, "propTypes", {
|
|
|
235
249
|
noResultsFoundText: _propTypes["default"].string,
|
|
236
250
|
createText: _propTypes["default"].string,
|
|
237
251
|
sendRef: _propTypes["default"].func,
|
|
238
|
-
keyHandler: _propTypes["default"].func
|
|
252
|
+
keyHandler: _propTypes["default"].func,
|
|
253
|
+
hasInlineFilter: _propTypes["default"].bool
|
|
239
254
|
});
|
|
240
255
|
|
|
241
256
|
_defineProperty(SelectMenu, "defaultProps", {
|
|
@@ -247,6 +262,7 @@ _defineProperty(SelectMenu, "defaultProps", {
|
|
|
247
262
|
maxHeight: '',
|
|
248
263
|
sendRef: function sendRef() {},
|
|
249
264
|
keyHandler: function keyHandler() {},
|
|
250
|
-
isCustomContent: false
|
|
265
|
+
isCustomContent: false,
|
|
266
|
+
hasInlineFilter: false
|
|
251
267
|
});
|
|
252
268
|
//# sourceMappingURL=SelectMenu.js.map
|
|
@@ -21,6 +21,8 @@ export interface SelectOptionProps extends Omit<React.HTMLProps<HTMLElement>, 't
|
|
|
21
21
|
isDisabled?: boolean;
|
|
22
22
|
/** Flag indicating if the option acts as a placeholder */
|
|
23
23
|
isPlaceholder?: boolean;
|
|
24
|
+
/** Flad indicating if the option acts as a "no results" indicator */
|
|
25
|
+
isNoResultsOption?: boolean;
|
|
24
26
|
/** Internal flag indicating if the option is selected */
|
|
25
27
|
isSelected?: boolean;
|
|
26
28
|
/** Internal flag indicating if the option is checked */
|
|
@@ -97,12 +97,12 @@ function (_React$Component) {
|
|
|
97
97
|
_createClass(SelectOption, [{
|
|
98
98
|
key: "componentDidMount",
|
|
99
99
|
value: function componentDidMount() {
|
|
100
|
-
this.props.sendRef(this.ref.current, this.props.index);
|
|
100
|
+
this.props.sendRef(this.props.isDisabled ? null : this.ref.current, this.props.index);
|
|
101
101
|
}
|
|
102
102
|
}, {
|
|
103
103
|
key: "componentDidUpdate",
|
|
104
104
|
value: function componentDidUpdate() {
|
|
105
|
-
this.props.sendRef(this.ref.current, this.props.index);
|
|
105
|
+
this.props.sendRef(this.props.isDisabled ? null : this.ref.current, this.props.index);
|
|
106
106
|
}
|
|
107
107
|
}, {
|
|
108
108
|
key: "render",
|
|
@@ -117,6 +117,7 @@ function (_React$Component) {
|
|
|
117
117
|
_onClick = _this$props.onClick,
|
|
118
118
|
isDisabled = _this$props.isDisabled,
|
|
119
119
|
isPlaceholder = _this$props.isPlaceholder,
|
|
120
|
+
isNoResultsOption = _this$props.isNoResultsOption,
|
|
120
121
|
isSelected = _this$props.isSelected,
|
|
121
122
|
isChecked = _this$props.isChecked,
|
|
122
123
|
isFocused = _this$props.isFocused,
|
|
@@ -124,7 +125,7 @@ function (_React$Component) {
|
|
|
124
125
|
keyHandler = _this$props.keyHandler,
|
|
125
126
|
index = _this$props.index,
|
|
126
127
|
component = _this$props.component,
|
|
127
|
-
props = _objectWithoutProperties(_this$props, ["children", "className", "value", "onClick", "isDisabled", "isPlaceholder", "isSelected", "isChecked", "isFocused", "sendRef", "keyHandler", "index", "component"]);
|
|
128
|
+
props = _objectWithoutProperties(_this$props, ["children", "className", "value", "onClick", "isDisabled", "isPlaceholder", "isNoResultsOption", "isSelected", "isChecked", "isFocused", "sendRef", "keyHandler", "index", "component"]);
|
|
128
129
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
129
130
|
|
|
130
131
|
|
|
@@ -153,7 +154,7 @@ function (_React$Component) {
|
|
|
153
154
|
}), children || value.toString(), isSelected && React.createElement(_checkIcon["default"], {
|
|
154
155
|
className: (0, _reactStyles.css)(_select["default"].selectMenuItemIcon),
|
|
155
156
|
"aria-hidden": true
|
|
156
|
-
}))), variant === _selectConstants.SelectVariant.checkbox && React.createElement("label", _extends({}, props, {
|
|
157
|
+
}))), variant === _selectConstants.SelectVariant.checkbox && !isNoResultsOption && React.createElement("label", _extends({}, props, {
|
|
157
158
|
className: (0, _reactStyles.css)(_check["default"].check, _select["default"].selectMenuItem, isDisabled && _select["default"].modifiers.disabled, className),
|
|
158
159
|
onKeyDown: _this2.onKeyDown
|
|
159
160
|
}), React.createElement("input", {
|
|
@@ -172,7 +173,14 @@ function (_React$Component) {
|
|
|
172
173
|
disabled: isDisabled
|
|
173
174
|
}), React.createElement("span", {
|
|
174
175
|
className: (0, _reactStyles.css)(_check["default"].checkLabel, isDisabled && _select["default"].modifiers.disabled)
|
|
175
|
-
}, children || value.toString()))
|
|
176
|
+
}, children || value.toString())), variant === _selectConstants.SelectVariant.checkbox && isNoResultsOption && React.createElement("div", null, React.createElement(Component, _extends({}, props, {
|
|
177
|
+
className: (0, _reactStyles.css)(_select["default"].selectMenuItem, isSelected && _select["default"].modifiers.selected, isDisabled && _select["default"].modifiers.disabled, isFocused && _select["default"].modifiers.focus, className),
|
|
178
|
+
role: "option",
|
|
179
|
+
"aria-selected": isSelected || null,
|
|
180
|
+
ref: _this2.ref,
|
|
181
|
+
onKeyDown: _this2.onKeyDown,
|
|
182
|
+
type: "button"
|
|
183
|
+
}), children || value.toString())));
|
|
176
184
|
});
|
|
177
185
|
}
|
|
178
186
|
}]);
|
|
@@ -190,6 +198,7 @@ _defineProperty(SelectOption, "propTypes", {
|
|
|
190
198
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({})]),
|
|
191
199
|
isDisabled: _propTypes["default"].bool,
|
|
192
200
|
isPlaceholder: _propTypes["default"].bool,
|
|
201
|
+
isNoResultsOption: _propTypes["default"].bool,
|
|
193
202
|
isSelected: _propTypes["default"].bool,
|
|
194
203
|
isChecked: _propTypes["default"].bool,
|
|
195
204
|
isFocused: _propTypes["default"].bool,
|
|
@@ -207,6 +216,7 @@ _defineProperty(SelectOption, "defaultProps", {
|
|
|
207
216
|
isSelected: false,
|
|
208
217
|
isChecked: false,
|
|
209
218
|
isFocused: false,
|
|
219
|
+
isNoResultsOption: false,
|
|
210
220
|
component: 'button',
|
|
211
221
|
onClick: function onClick() {},
|
|
212
222
|
sendRef: function sendRef() {},
|
|
@@ -37,6 +37,8 @@ export interface SelectToggleProps extends React.HTMLProps<HTMLElement> {
|
|
|
37
37
|
ariaLabelToggle?: string;
|
|
38
38
|
/** Flag for variant, determines toggle rules and interaction */
|
|
39
39
|
variant?: 'single' | 'checkbox' | 'typeahead' | 'typeaheadmulti';
|
|
40
|
+
/** Flag indicating if select toggle has an clear button */
|
|
41
|
+
hasClearButton?: boolean;
|
|
40
42
|
}
|
|
41
43
|
export declare class SelectToggle extends React.Component<SelectToggleProps> {
|
|
42
44
|
private toggle;
|
|
@@ -177,13 +177,14 @@ function (_React$Component) {
|
|
|
177
177
|
parentRef = _this$props4.parentRef,
|
|
178
178
|
id = _this$props4.id,
|
|
179
179
|
type = _this$props4.type,
|
|
180
|
+
hasClearButton = _this$props4.hasClearButton,
|
|
180
181
|
ariaLabelledBy = _this$props4.ariaLabelledBy,
|
|
181
182
|
ariaLabelToggle = _this$props4.ariaLabelToggle,
|
|
182
|
-
props = _objectWithoutProperties(_this$props4, ["className", "children", "isExpanded", "isFocused", "isActive", "isHovered", "isPlain", "isDisabled", "variant", "onToggle", "onEnter", "onClose", "handleTypeaheadKeys", "parentRef", "id", "type", "ariaLabelledBy", "ariaLabelToggle"]);
|
|
183
|
+
props = _objectWithoutProperties(_this$props4, ["className", "children", "isExpanded", "isFocused", "isActive", "isHovered", "isPlain", "isDisabled", "variant", "onToggle", "onEnter", "onClose", "handleTypeaheadKeys", "parentRef", "id", "type", "hasClearButton", "ariaLabelledBy", "ariaLabelToggle"]);
|
|
183
184
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
184
185
|
|
|
185
186
|
|
|
186
|
-
var isTypeahead = variant === _selectConstants.SelectVariant.typeahead || variant === _selectConstants.SelectVariant.typeaheadMulti;
|
|
187
|
+
var isTypeahead = variant === _selectConstants.SelectVariant.typeahead || variant === _selectConstants.SelectVariant.typeaheadMulti || hasClearButton;
|
|
187
188
|
var toggleProps = {
|
|
188
189
|
id: id,
|
|
189
190
|
'aria-labelledby': ariaLabelledBy,
|
|
@@ -259,7 +260,8 @@ _defineProperty(SelectToggle, "propTypes", {
|
|
|
259
260
|
type: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['reset']), _propTypes["default"].oneOf(['button']), _propTypes["default"].oneOf(['submit'])]),
|
|
260
261
|
ariaLabelledBy: _propTypes["default"].string,
|
|
261
262
|
ariaLabelToggle: _propTypes["default"].string,
|
|
262
|
-
variant: _propTypes["default"].oneOf(['single', 'checkbox', 'typeahead', 'typeaheadmulti'])
|
|
263
|
+
variant: _propTypes["default"].oneOf(['single', 'checkbox', 'typeahead', 'typeaheadmulti']),
|
|
264
|
+
hasClearButton: _propTypes["default"].bool
|
|
263
265
|
});
|
|
264
266
|
|
|
265
267
|
_defineProperty(SelectToggle, "defaultProps", {
|
|
@@ -270,6 +272,7 @@ _defineProperty(SelectToggle, "defaultProps", {
|
|
|
270
272
|
isActive: false,
|
|
271
273
|
isPlain: false,
|
|
272
274
|
isDisabled: false,
|
|
275
|
+
hasClearButton: false,
|
|
273
276
|
variant: 'single',
|
|
274
277
|
ariaLabelledBy: '',
|
|
275
278
|
ariaLabelToggle: '',
|
|
@@ -256,6 +256,18 @@ Object.keys(_Expandable).forEach(function (key) {
|
|
|
256
256
|
});
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
+
var _FileUpload = require("./FileUpload");
|
|
260
|
+
|
|
261
|
+
Object.keys(_FileUpload).forEach(function (key) {
|
|
262
|
+
if (key === "default" || key === "__esModule") return;
|
|
263
|
+
Object.defineProperty(exports, key, {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function get() {
|
|
266
|
+
return _FileUpload[key];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
259
271
|
var _Form = require("./Form");
|
|
260
272
|
|
|
261
273
|
Object.keys(_Form).forEach(function (key) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum fileReaderType {
|
|
2
|
+
text = "text",
|
|
3
|
+
dataURL = "dataURL"
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Read a file using the FileReader API, either as a plain text string or as a DataURL string.
|
|
7
|
+
* Returns a promise which will resolve with the file contents as a string or reject with a DOMException.
|
|
8
|
+
*
|
|
9
|
+
* @param {File} fileHandle - File object to read
|
|
10
|
+
* @param {fileReaderType} type - How to read it
|
|
11
|
+
*/
|
|
12
|
+
export declare function readFile(fileHandle: File, type: fileReaderType): Promise<{}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readFile = readFile;
|
|
7
|
+
exports.fileReaderType = void 0;
|
|
8
|
+
var fileReaderType;
|
|
9
|
+
/**
|
|
10
|
+
* Read a file using the FileReader API, either as a plain text string or as a DataURL string.
|
|
11
|
+
* Returns a promise which will resolve with the file contents as a string or reject with a DOMException.
|
|
12
|
+
*
|
|
13
|
+
* @param {File} fileHandle - File object to read
|
|
14
|
+
* @param {fileReaderType} type - How to read it
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
exports.fileReaderType = fileReaderType;
|
|
18
|
+
|
|
19
|
+
(function (fileReaderType) {
|
|
20
|
+
fileReaderType["text"] = "text";
|
|
21
|
+
fileReaderType["dataURL"] = "dataURL";
|
|
22
|
+
})(fileReaderType || (exports.fileReaderType = fileReaderType = {}));
|
|
23
|
+
|
|
24
|
+
function readFile(fileHandle, type) {
|
|
25
|
+
return new Promise(function (resolve, reject) {
|
|
26
|
+
var reader = new FileReader();
|
|
27
|
+
|
|
28
|
+
reader.onload = function () {
|
|
29
|
+
return resolve(reader.result);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
reader.onerror = function () {
|
|
33
|
+
return reject(reader.error);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (type === fileReaderType.text) {
|
|
37
|
+
reader.readAsText(fileHandle);
|
|
38
|
+
} else if (type === fileReaderType.dataURL) {
|
|
39
|
+
reader.readAsDataURL(fileHandle);
|
|
40
|
+
} else {
|
|
41
|
+
reject('unknown type');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=fileUtils.js.map
|
package/dist/js/helpers/util.js
CHANGED
|
@@ -174,7 +174,9 @@ function keyHandler(index, innerIndex, position, refsCollection, kids) {
|
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
var isMultiDimensional = refsCollection
|
|
177
|
+
var isMultiDimensional = refsCollection.filter(function (ref) {
|
|
178
|
+
return ref;
|
|
179
|
+
})[0].constructor === Array;
|
|
178
180
|
var nextIndex = index;
|
|
179
181
|
var nextInnerIndex = innerIndex;
|
|
180
182
|
|
|
@@ -139,14 +139,22 @@
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
componentDidMount() {
|
|
142
|
-
|
|
142
|
+
const {
|
|
143
|
+
categoryName,
|
|
144
|
+
chips
|
|
145
|
+
} = this.props;
|
|
146
|
+
this.context.updateNumberFilters(typeof categoryName === 'string' ? categoryName : categoryName.name, chips.length);
|
|
143
147
|
this.setState({
|
|
144
148
|
isMounted: true
|
|
145
149
|
});
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
componentDidUpdate() {
|
|
149
|
-
|
|
153
|
+
const {
|
|
154
|
+
categoryName,
|
|
155
|
+
chips
|
|
156
|
+
} = this.props;
|
|
157
|
+
this.context.updateNumberFilters(typeof categoryName === 'string' ? categoryName : categoryName.name, chips.length);
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
render() {
|
|
@@ -169,8 +177,8 @@
|
|
|
169
177
|
}, React.createElement(_ChipGroup.ChipGroup, {
|
|
170
178
|
withToolbar: true
|
|
171
179
|
}, React.createElement(_ChipGroup.ChipGroupToolbarItem, {
|
|
172
|
-
key: categoryName,
|
|
173
|
-
categoryName: categoryName
|
|
180
|
+
key: typeof categoryName === 'string' ? categoryName : categoryName.key,
|
|
181
|
+
categoryName: typeof categoryName === 'string' ? categoryName : categoryName.name
|
|
174
182
|
}, chips.map(chip => typeof chip === 'string' ? React.createElement(_ChipGroup.Chip, {
|
|
175
183
|
key: chip,
|
|
176
184
|
onClick: () => deleteChip(categoryName, chip)
|
|
@@ -199,7 +207,10 @@
|
|
|
199
207
|
})])),
|
|
200
208
|
deleteChip: _propTypes2.default.func,
|
|
201
209
|
children: _propTypes2.default.node.isRequired,
|
|
202
|
-
categoryName: _propTypes2.default.string.
|
|
210
|
+
categoryName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
|
|
211
|
+
key: _propTypes2.default.string.isRequired,
|
|
212
|
+
name: _propTypes2.default.string.isRequired
|
|
213
|
+
})]).isRequired,
|
|
203
214
|
showToolbarItem: _propTypes2.default.bool
|
|
204
215
|
});
|
|
205
216
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
|
-
exports.Drawer = undefined;
|
|
19
|
+
exports.Drawer = exports.DrawerContext = undefined;
|
|
20
20
|
|
|
21
21
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
22
22
|
|
|
@@ -133,60 +133,37 @@
|
|
|
133
133
|
return target;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
value: value,
|
|
140
|
-
enumerable: true,
|
|
141
|
-
configurable: true,
|
|
142
|
-
writable: true
|
|
143
|
-
});
|
|
144
|
-
} else {
|
|
145
|
-
obj[key] = value;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return obj;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
class Drawer extends React.Component {
|
|
152
|
-
constructor(props) {
|
|
153
|
-
super(props);
|
|
154
|
-
}
|
|
136
|
+
const DrawerContext = exports.DrawerContext = React.createContext({
|
|
137
|
+
isExpanded: false
|
|
138
|
+
});
|
|
155
139
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
140
|
+
const Drawer = exports.Drawer = _ref => {
|
|
141
|
+
let {
|
|
142
|
+
className = '',
|
|
143
|
+
children,
|
|
144
|
+
isExpanded = false,
|
|
145
|
+
isInline = false,
|
|
146
|
+
isStatic = false,
|
|
147
|
+
position = 'right'
|
|
148
|
+
} = _ref,
|
|
149
|
+
props = _objectWithoutProperties(_ref, ["className", "children", "isExpanded", "isInline", "isStatic", "position"]);
|
|
150
|
+
|
|
151
|
+
return React.createElement(DrawerContext.Provider, {
|
|
152
|
+
value: {
|
|
153
|
+
isExpanded
|
|
161
154
|
}
|
|
162
|
-
}
|
|
155
|
+
}, React.createElement("div", _extends({
|
|
156
|
+
className: (0, _reactStyles.css)(_drawer2.default.drawer, isExpanded && _drawer2.default.modifiers.expanded, isInline && _drawer2.default.modifiers.inline, isStatic && _drawer2.default.modifiers.static, position === 'left' && _drawer2.default.modifiers.panelLeft, className)
|
|
157
|
+
}, props), children));
|
|
158
|
+
};
|
|
163
159
|
|
|
164
|
-
|
|
165
|
-
const _this$props = this.props,
|
|
166
|
-
{
|
|
167
|
-
className = '',
|
|
168
|
-
children,
|
|
169
|
-
isExpanded = false,
|
|
170
|
-
isInline = false
|
|
171
|
-
} = _this$props,
|
|
172
|
-
props = _objectWithoutProperties(_this$props, ["className", "children", "isExpanded", "isInline"]);
|
|
173
|
-
|
|
174
|
-
return React.createElement("div", _extends({}, props, {
|
|
175
|
-
className: (0, _reactStyles.css)(_drawer2.default.drawer, isExpanded && _drawer2.default.modifiers.expanded, isInline && _drawer2.default.modifiers.inline, className)
|
|
176
|
-
}), children);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
exports.Drawer = Drawer;
|
|
182
|
-
|
|
183
|
-
_defineProperty(Drawer, "propTypes", {
|
|
160
|
+
Drawer.propTypes = {
|
|
184
161
|
className: _propTypes2.default.string,
|
|
185
162
|
children: _propTypes2.default.node,
|
|
186
163
|
isExpanded: _propTypes2.default.bool,
|
|
187
|
-
isInline: _propTypes2.default.bool
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
164
|
+
isInline: _propTypes2.default.bool,
|
|
165
|
+
isStatic: _propTypes2.default.bool,
|
|
166
|
+
position: _propTypes2.default.oneOf(['left', 'right'])
|
|
167
|
+
};
|
|
191
168
|
});
|
|
192
169
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
if (typeof define === "function" && define.amd) {
|
|
3
|
+
define(["exports", "prop-types", "react", "@patternfly/react-styles/css/components/Drawer/drawer", "@patternfly/react-styles"], factory);
|
|
4
|
+
} else if (typeof exports !== "undefined") {
|
|
5
|
+
factory(exports, require("prop-types"), require("react"), require("@patternfly/react-styles/css/components/Drawer/drawer"), require("@patternfly/react-styles"));
|
|
6
|
+
} else {
|
|
7
|
+
var mod = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
factory(mod.exports, global.propTypes, global.react, global.drawer, global.reactStyles);
|
|
11
|
+
global.undefined = mod.exports;
|
|
12
|
+
}
|
|
13
|
+
})(this, function (exports, _propTypes, _react, _drawer, _reactStyles) {
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.DrawerActions = undefined;
|
|
20
|
+
|
|
21
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
22
|
+
|
|
23
|
+
var React = _interopRequireWildcard(_react);
|
|
24
|
+
|
|
25
|
+
var _drawer2 = _interopRequireDefault(_drawer);
|
|
26
|
+
|
|
27
|
+
function _getRequireWildcardCache() {
|
|
28
|
+
if (typeof WeakMap !== "function") return null;
|
|
29
|
+
var cache = new WeakMap();
|
|
30
|
+
|
|
31
|
+
_getRequireWildcardCache = function () {
|
|
32
|
+
return cache;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return cache;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj) {
|
|
39
|
+
if (obj && obj.__esModule) {
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var cache = _getRequireWildcardCache();
|
|
44
|
+
|
|
45
|
+
if (cache && cache.has(obj)) {
|
|
46
|
+
return cache.get(obj);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var newObj = {};
|
|
50
|
+
|
|
51
|
+
if (obj != null) {
|
|
52
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
|
+
|
|
54
|
+
for (var key in obj) {
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
56
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
57
|
+
|
|
58
|
+
if (desc && (desc.get || desc.set)) {
|
|
59
|
+
Object.defineProperty(newObj, key, desc);
|
|
60
|
+
} else {
|
|
61
|
+
newObj[key] = obj[key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
newObj.default = obj;
|
|
68
|
+
|
|
69
|
+
if (cache) {
|
|
70
|
+
cache.set(obj, newObj);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return newObj;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function _interopRequireDefault(obj) {
|
|
77
|
+
return obj && obj.__esModule ? obj : {
|
|
78
|
+
default: obj
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function _extends() {
|
|
83
|
+
_extends = Object.assign || function (target) {
|
|
84
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
85
|
+
var source = arguments[i];
|
|
86
|
+
|
|
87
|
+
for (var key in source) {
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
89
|
+
target[key] = source[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return target;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return _extends.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function _objectWithoutProperties(source, excluded) {
|
|
101
|
+
if (source == null) return {};
|
|
102
|
+
|
|
103
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
104
|
+
|
|
105
|
+
var key, i;
|
|
106
|
+
|
|
107
|
+
if (Object.getOwnPropertySymbols) {
|
|
108
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
109
|
+
|
|
110
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
111
|
+
key = sourceSymbolKeys[i];
|
|
112
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
113
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
114
|
+
target[key] = source[key];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return target;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
122
|
+
if (source == null) return {};
|
|
123
|
+
var target = {};
|
|
124
|
+
var sourceKeys = Object.keys(source);
|
|
125
|
+
var key, i;
|
|
126
|
+
|
|
127
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
128
|
+
key = sourceKeys[i];
|
|
129
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
130
|
+
target[key] = source[key];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return target;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const DrawerActions = exports.DrawerActions = _ref => {
|
|
137
|
+
let {
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
|
+
className = '',
|
|
140
|
+
children
|
|
141
|
+
} = _ref,
|
|
142
|
+
props = _objectWithoutProperties(_ref, ["className", "children"]);
|
|
143
|
+
|
|
144
|
+
return React.createElement("div", _extends({
|
|
145
|
+
className: (0, _reactStyles.css)(_drawer2.default.drawerActions, className)
|
|
146
|
+
}, props), children);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
DrawerActions.propTypes = {
|
|
150
|
+
className: _propTypes2.default.string,
|
|
151
|
+
children: _propTypes2.default.node
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=DrawerActions.js.map
|