@carbon/ibm-products 1.72.1 → 1.72.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,6 +37,7 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
37
37
  return /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps({
38
38
  role: undefined
39
39
  }), {
40
+ "aria-live": null,
40
41
  className: "".concat(blockClass, "__empty-state-body")
41
42
  }), /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
42
43
  colSpan: headers.length
@@ -22,6 +22,7 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
22
22
  return /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps({
23
23
  role: undefined
24
24
  }), {
25
+ "aria-live": null,
25
26
  className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
26
27
  }), rows.map(function (row) {
27
28
  prepareRow(row);
@@ -75,6 +75,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
75
75
  }, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps({
76
76
  role: undefined
77
77
  }), {
78
+ "aria-live": null,
78
79
  onScroll: syncScroll
79
80
  }), /*#__PURE__*/React.createElement(VariableSizeList, {
80
81
  height: virtualHeight || tableHeight,
@@ -11,7 +11,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
 
12
12
  import React, { useEffect, useState } from 'react';
13
13
  import PropTypes from 'prop-types';
14
- import { isColumnVisible } from './common';
15
14
  import Columns from './Columns';
16
15
  import Actions from './Actions';
17
16
  import { pkg } from '../../../../../settings';
@@ -54,19 +53,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
54
53
  _useState6 = _slicedToArray(_useState5, 2),
55
54
  searchText = _useState6[0],
56
55
  setSearchText = _useState6[1];
57
- var _useState7 = useState(columnDefinitions
58
- // only sort the hidden column to the end when modal reopen
59
- .sort(function (defA, defB) {
60
- var isVisibleA = isColumnVisible(defA);
61
- var isVisibleB = isColumnVisible(defB);
62
- if (isVisibleA && !isVisibleB) {
63
- return -1;
64
- }
65
- if (!isVisibleA && isVisibleB) {
66
- return 1;
67
- }
68
- return 0;
69
- })),
56
+ var _useState7 = useState(columnDefinitions),
70
57
  _useState8 = _slicedToArray(_useState7, 2),
71
58
  columnObjects = _useState8[0],
72
59
  setColumnObjects = _useState8[1];
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
5
+ var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputProps", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
  //
@@ -36,6 +36,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
36
  filename = _ref.filename,
37
37
  hidePasswordLabel = _ref.hidePasswordLabel,
38
38
  inputLabel = _ref.inputLabel,
39
+ inputProps = _ref.inputProps,
39
40
  _ref$inputType = _ref.inputType,
40
41
  inputType = _ref$inputType === void 0 ? defaults.inputType : _ref$inputType,
41
42
  invalidInputText = _ref.invalidInputText,
@@ -75,13 +76,17 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
75
76
  setExtension(preformattedExtensions === null || preformattedExtensions === void 0 ? void 0 : (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
76
77
  }, [filename, preformattedExtensions, open]);
77
78
  var onNameChangeHandler = function onNameChangeHandler(evt) {
79
+ var _inputProps$onChange;
78
80
  setName(evt.target.value);
81
+ inputProps === null || inputProps === void 0 ? void 0 : (_inputProps$onChange = inputProps.onChange) === null || _inputProps$onChange === void 0 ? void 0 : _inputProps$onChange.call(inputProps, evt);
79
82
  };
80
83
  var onExtensionChangeHandler = function onExtensionChangeHandler(value) {
81
84
  setExtension(value);
82
85
  };
83
- var onBlurHandler = function onBlurHandler() {
86
+ var onBlurHandler = function onBlurHandler(evt) {
87
+ var _inputProps$onBlur;
84
88
  setDirtyInput(true);
89
+ inputProps === null || inputProps === void 0 ? void 0 : (_inputProps$onBlur = inputProps.onBlur) === null || _inputProps$onBlur === void 0 ? void 0 : _inputProps$onBlur.call(inputProps, evt);
85
90
  };
86
91
  var onSubmitHandler = function onSubmitHandler() {
87
92
  var returnName = extension ? "".concat(filename, ".").concat(extension.toLocaleLowerCase()) : name;
@@ -102,17 +107,17 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
102
107
  };
103
108
  var blockClass = "".concat(pkg.prefix, "--export-modal");
104
109
  var internalId = useRef(uuidv4());
105
- var primaryButtonDisabled = loading || !name || hasInvalidExtension();
110
+ var primaryButtonDisabled = loading || !(name !== null && name !== void 0 && name.trim()) || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalid) || hasInvalidExtension();
106
111
  var submitted = loading || error || successful;
107
- var commonInputProps = _defineProperty({
108
- id: "text-input--".concat(internalId.current),
112
+ var commonInputProps = _objectSpread(_objectSpread({}, inputProps || {}), {}, _defineProperty({
113
+ id: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.id) || "text-input--".concat(internalId.current),
109
114
  value: name,
110
115
  onChange: onNameChangeHandler,
111
- labelText: inputLabel,
112
- invalid: hasInvalidExtension(),
113
- invalidText: invalidInputText,
116
+ labelText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.labelText) || inputLabel,
117
+ invalid: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalid) || hasInvalidExtension(),
118
+ invalidText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalidText) || invalidInputText,
114
119
  onBlur: onBlurHandler
115
- }, 'data-modal-primary-focus', true);
120
+ }, 'data-modal-primary-focus', true));
116
121
  return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
117
122
  className: cx(blockClass, className),
118
123
  "aria-label": title,
@@ -204,6 +209,10 @@ ExportModal.propTypes = {
204
209
  * label for the text input
205
210
  */
206
211
  inputLabel: PropTypes.string,
212
+ /**
213
+ * Other input properties
214
+ */
215
+ inputProps: PropTypes.object,
207
216
  /**
208
217
  * specify the type of text input
209
218
  */
@@ -44,6 +44,7 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
44
44
  return /*#__PURE__*/_react.default.createElement(TableBody, (0, _extends2.default)({}, getTableBodyProps({
45
45
  role: undefined
46
46
  }), {
47
+ "aria-live": null,
47
48
  className: "".concat(blockClass, "__empty-state-body")
48
49
  }), /*#__PURE__*/_react.default.createElement(TableRow, null, /*#__PURE__*/_react.default.createElement(TableCell, {
49
50
  colSpan: headers.length
@@ -22,6 +22,7 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
22
22
  return /*#__PURE__*/_react.default.createElement(TableBody, (0, _extends2.default)({}, getTableBodyProps({
23
23
  role: undefined
24
24
  }), {
25
+ "aria-live": null,
25
26
  className: (0, _classnames.default)("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
26
27
  }), rows.map(function (row) {
27
28
  prepareRow(row);
@@ -78,6 +78,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
78
78
  }, /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState)), /*#__PURE__*/_react.default.createElement(TableBody, (0, _extends2.default)({}, getTableBodyProps({
79
79
  role: undefined
80
80
  }), {
81
+ "aria-live": null,
81
82
  onScroll: syncScroll
82
83
  }), /*#__PURE__*/_react.default.createElement(_reactWindow.VariableSizeList, {
83
84
  height: virtualHeight || tableHeight,
@@ -10,7 +10,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _common = require("./common");
14
13
  var _Columns = _interopRequireDefault(require("./Columns"));
15
14
  var _Actions = _interopRequireDefault(require("./Actions"));
16
15
  var _settings = require("../../../../../settings");
@@ -56,19 +55,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
56
55
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
57
56
  searchText = _useState6[0],
58
57
  setSearchText = _useState6[1];
59
- var _useState7 = (0, _react.useState)(columnDefinitions
60
- // only sort the hidden column to the end when modal reopen
61
- .sort(function (defA, defB) {
62
- var isVisibleA = (0, _common.isColumnVisible)(defA);
63
- var isVisibleB = (0, _common.isColumnVisible)(defB);
64
- if (isVisibleA && !isVisibleB) {
65
- return -1;
66
- }
67
- if (!isVisibleA && isVisibleB) {
68
- return 1;
69
- }
70
- return 0;
71
- })),
58
+ var _useState7 = (0, _react.useState)(columnDefinitions),
72
59
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
73
60
  columnObjects = _useState8[0],
74
61
  setColumnObjects = _useState8[1];
@@ -18,7 +18,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
18
18
  var _devtools = require("../../global/js/utils/devtools");
19
19
  var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
20
20
  var _settings = require("../../settings");
21
- var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
21
+ var _excluded = ["body", "className", "error", "errorMessage", "filename", "hidePasswordLabel", "inputLabel", "inputProps", "inputType", "invalidInputText", "loading", "loadingMessage", "onClose", "onRequestSubmit", "open", "preformattedExtensions", "preformattedExtensionsLabel", "primaryButtonText", "secondaryButtonText", "showPasswordLabel", "successMessage", "successful", "title", "validExtensions"];
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -39,6 +39,7 @@ var ExportModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
39
39
  filename = _ref.filename,
40
40
  hidePasswordLabel = _ref.hidePasswordLabel,
41
41
  inputLabel = _ref.inputLabel,
42
+ inputProps = _ref.inputProps,
42
43
  _ref$inputType = _ref.inputType,
43
44
  inputType = _ref$inputType === void 0 ? defaults.inputType : _ref$inputType,
44
45
  invalidInputText = _ref.invalidInputText,
@@ -78,13 +79,17 @@ var ExportModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
78
79
  setExtension(preformattedExtensions === null || preformattedExtensions === void 0 ? void 0 : (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
79
80
  }, [filename, preformattedExtensions, open]);
80
81
  var onNameChangeHandler = function onNameChangeHandler(evt) {
82
+ var _inputProps$onChange;
81
83
  setName(evt.target.value);
84
+ inputProps === null || inputProps === void 0 ? void 0 : (_inputProps$onChange = inputProps.onChange) === null || _inputProps$onChange === void 0 ? void 0 : _inputProps$onChange.call(inputProps, evt);
82
85
  };
83
86
  var onExtensionChangeHandler = function onExtensionChangeHandler(value) {
84
87
  setExtension(value);
85
88
  };
86
- var onBlurHandler = function onBlurHandler() {
89
+ var onBlurHandler = function onBlurHandler(evt) {
90
+ var _inputProps$onBlur;
87
91
  setDirtyInput(true);
92
+ inputProps === null || inputProps === void 0 ? void 0 : (_inputProps$onBlur = inputProps.onBlur) === null || _inputProps$onBlur === void 0 ? void 0 : _inputProps$onBlur.call(inputProps, evt);
88
93
  };
89
94
  var onSubmitHandler = function onSubmitHandler() {
90
95
  var returnName = extension ? "".concat(filename, ".").concat(extension.toLocaleLowerCase()) : name;
@@ -105,17 +110,17 @@ var ExportModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
105
110
  };
106
111
  var blockClass = "".concat(_settings.pkg.prefix, "--export-modal");
107
112
  var internalId = (0, _react.useRef)((0, _uuidv.default)());
108
- var primaryButtonDisabled = loading || !name || hasInvalidExtension();
113
+ var primaryButtonDisabled = loading || !(name !== null && name !== void 0 && name.trim()) || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalid) || hasInvalidExtension();
109
114
  var submitted = loading || error || successful;
110
- var commonInputProps = (0, _defineProperty2.default)({
111
- id: "text-input--".concat(internalId.current),
115
+ var commonInputProps = _objectSpread(_objectSpread({}, inputProps || {}), {}, (0, _defineProperty2.default)({
116
+ id: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.id) || "text-input--".concat(internalId.current),
112
117
  value: name,
113
118
  onChange: onNameChangeHandler,
114
- labelText: inputLabel,
115
- invalid: hasInvalidExtension(),
116
- invalidText: invalidInputText,
119
+ labelText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.labelText) || inputLabel,
120
+ invalid: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalid) || hasInvalidExtension(),
121
+ invalidText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalidText) || invalidInputText,
117
122
  onBlur: onBlurHandler
118
- }, 'data-modal-primary-focus', true);
123
+ }, 'data-modal-primary-focus', true));
119
124
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.ComposedModal, (0, _extends2.default)({}, rest, {
120
125
  className: (0, _classnames.default)(blockClass, className),
121
126
  "aria-label": title,
@@ -208,6 +213,10 @@ ExportModal.propTypes = {
208
213
  * label for the text input
209
214
  */
210
215
  inputLabel: _propTypes.default.string,
216
+ /**
217
+ * Other input properties
218
+ */
219
+ inputProps: _propTypes.default.object,
211
220
  /**
212
221
  * specify the type of text input
213
222
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.72.1",
4
+ "version": "1.72.3",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -98,5 +98,5 @@
98
98
  "react": "^16.8.6 || ^17.0.1",
99
99
  "react-dom": "^16.8.6 || ^17.0.1"
100
100
  },
101
- "gitHead": "4a4bf2a1dd6f15a09871cf84f634cd5cff095194"
101
+ "gitHead": "b01a25543f9d0a3a425366269774fddefa5e35d1"
102
102
  }