@carbon/ibm-products 2.30.0 → 2.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/css/index-full-carbon.css +248 -23
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +10 -4
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +248 -23
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +244 -19
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ComboButton/ComboButton.d.ts +38 -18
  18. package/es/components/ComboButton/ComboButton.js +25 -21
  19. package/es/components/ComboButton/ComboButtonItem/index.d.ts +22 -13
  20. package/es/components/CreateModal/CreateModal.d.ts +66 -2
  21. package/es/components/CreateModal/CreateModal.js +1 -1
  22. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  23. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +3 -1
  24. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  25. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +3 -15
  26. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +0 -7
  27. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +7 -0
  28. package/es/components/EditInPlace/EditInPlace.js +4 -5
  29. package/es/components/Nav/Nav.d.ts +3 -0
  30. package/es/components/Nav/Nav.js +154 -0
  31. package/es/components/Nav/NavItem.d.ts +35 -0
  32. package/es/components/Nav/NavItem.js +149 -0
  33. package/es/components/Nav/NavItemLink.d.ts +3 -0
  34. package/es/components/Nav/NavItemLink.js +30 -0
  35. package/es/components/Nav/NavList.d.ts +4 -0
  36. package/es/components/Nav/NavList.js +168 -0
  37. package/es/components/Nav/index.d.ts +3 -0
  38. package/es/components/Tearsheet/TearsheetShell.js +22 -7
  39. package/es/components/index.d.ts +1 -0
  40. package/es/global/js/package-settings.d.ts +1 -0
  41. package/es/global/js/package-settings.js +1 -0
  42. package/es/index.js +1 -0
  43. package/es/node_modules/@carbon/icon-helpers/es/index.js +140 -0
  44. package/es/node_modules/@carbon/icons-react/es/Icon.js +73 -0
  45. package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3091 -0
  46. package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3004 -0
  47. package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +14 -0
  48. package/es/settings.d.ts +1 -0
  49. package/lib/components/ComboButton/ComboButton.d.ts +38 -18
  50. package/lib/components/ComboButton/ComboButton.js +24 -20
  51. package/lib/components/ComboButton/ComboButtonItem/index.d.ts +22 -13
  52. package/lib/components/CreateModal/CreateModal.d.ts +66 -2
  53. package/lib/components/CreateModal/CreateModal.js +1 -1
  54. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  55. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +3 -1
  56. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  57. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +3 -15
  58. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +0 -7
  59. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +7 -0
  60. package/lib/components/EditInPlace/EditInPlace.js +4 -5
  61. package/lib/components/Nav/Nav.d.ts +3 -0
  62. package/lib/components/Nav/Nav.js +161 -0
  63. package/lib/components/Nav/NavItem.d.ts +35 -0
  64. package/lib/components/Nav/NavItem.js +160 -0
  65. package/lib/components/Nav/NavItemLink.d.ts +3 -0
  66. package/lib/components/Nav/NavItemLink.js +38 -0
  67. package/lib/components/Nav/NavList.d.ts +4 -0
  68. package/lib/components/Nav/NavList.js +179 -0
  69. package/lib/components/Nav/index.d.ts +3 -0
  70. package/lib/components/Tearsheet/TearsheetShell.js +22 -7
  71. package/lib/components/index.d.ts +1 -0
  72. package/lib/global/js/package-settings.d.ts +1 -0
  73. package/lib/global/js/package-settings.js +1 -0
  74. package/lib/index.js +5 -0
  75. package/lib/node_modules/@carbon/icon-helpers/es/index.js +145 -0
  76. package/lib/node_modules/@carbon/icons-react/es/Icon.js +81 -0
  77. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3223 -0
  78. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3136 -0
  79. package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +18 -0
  80. package/lib/settings.d.ts +1 -0
  81. package/package.json +3 -3
  82. package/scss/components/ComboButton/_combo-button.scss +19 -21
  83. package/scss/components/Datagrid/styles/_draggableElement.scss +5 -1
  84. package/scss/components/Nav/_carbon-imports.scss +9 -0
  85. package/scss/components/Nav/_index-with-carbon.scss +9 -0
  86. package/scss/components/Nav/_index.scss +8 -0
  87. package/scss/components/Nav/_nav.scss +259 -0
  88. package/scss/components/Tearsheet/_tearsheet.scss +24 -6
  89. package/scss/components/_index-with-carbon.scss +1 -0
  90. package/scss/components/_index.scss +1 -0
@@ -1,21 +1,41 @@
1
1
  /**
2
- * The combo button consolidates similar actions, while exposing the most commonly used one.
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
3
6
  */
4
- export function ComboButton({ children, className, overflowMenu, ...rest }: {
5
- [x: string]: any;
6
- children: any;
7
- className: any;
8
- overflowMenu: any;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- export namespace ComboButton {
11
- namespace deprecated {
12
- let level: string;
13
- let details: string;
14
- }
15
- namespace propTypes {
16
- export let children: import("prop-types").Validator<NonNullable<import("prop-types").ReactNodeLike>>;
17
- export { string as className };
18
- export let overflowMenu: import("prop-types").Requireable<import("prop-types").InferProps<any>>;
19
- }
7
+ import React, { ComponentProps, ReactNode } from 'react';
8
+ interface ComboButtonProps extends ComponentProps<'div'> {
9
+ /** Provide the contents of the `ComboButton` */
10
+ children?: ReactNode;
11
+ /** Provide an optional class to be applied to the containing node */
12
+ className?: string;
13
+ /** Provide the [props of the `OverflowMenu`](https://react.carbondesignsystem.com/?path=/docs/overflowmenu) */
14
+ overflowMenu: {
15
+ /**
16
+ * The event handler for the `click` event.
17
+ */
18
+ onClick?(): void;
19
+ /**
20
+ * Function called when menu is closed
21
+ */
22
+ onClose?(): void;
23
+ /**
24
+ * The event handler for the `focus` event.
25
+ */
26
+ onFocus?(): void;
27
+ /**
28
+ * The event handler for the `keydown` event.
29
+ */
30
+ onKeyDown?(): void;
31
+ /**
32
+ * Function called when menu is opened
33
+ */
34
+ onOpen?(): void;
35
+ };
20
36
  }
21
- import { string } from 'prop-types';
37
+ /**
38
+ * The combo button consolidates similar actions, while exposing the most commonly used one.
39
+ */
40
+ declare const ComboButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<ComboButtonProps>, "ref"> & React.RefAttributes<HTMLDivElement>>;
41
+ export { ComboButton };
@@ -11,18 +11,17 @@ import { Button, OverflowMenu, OverflowMenuItem } from '@carbon/react';
11
11
  import cx from 'classnames';
12
12
  import { p as propTypesExports } from '../../node_modules/prop-types/index.js';
13
13
  import uuidv4 from '../../global/js/utils/uuidv4.js';
14
- import React__default, { useRef, useState, Children, createElement } from 'react';
14
+ import React__default, { forwardRef, useRef, useState, Children, createElement } from 'react';
15
+ import { pkg } from '../../settings.js';
15
16
 
16
17
  var _excluded = ["children", "className", "overflowMenu"],
17
- _excluded2 = ["children"],
18
- _excluded3 = ["children", "renderIcon"];
19
- var blockClass = 'security--combo-button';
18
+ _excluded2 = ["children", "renderIcon"];
19
+ var blockClass = "".concat(pkg.prefix, "--combo-button");
20
20
  var componentName = 'ComboButton';
21
-
22
21
  /**
23
22
  * The combo button consolidates similar actions, while exposing the most commonly used one.
24
23
  */
25
- var ComboButton = function ComboButton(_ref) {
24
+ var ComboButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
25
  var children = _ref.children,
27
26
  className = _ref.className,
28
27
  overflowMenu = _ref.overflowMenu,
@@ -33,21 +32,22 @@ var ComboButton = function ComboButton(_ref) {
33
32
  _useState2 = _slicedToArray(_useState, 2),
34
33
  isOpen = _useState2[0],
35
34
  setIsOpen = _useState2[1];
36
- var _Children$toArray$fil = Children.toArray(children).filter(Boolean).map(function (_ref2) {
37
- var _ref2$props = _ref2.props,
38
- children = _ref2$props.children,
39
- props = _objectWithoutProperties(_ref2$props, _excluded2);
40
- return _objectSpread2(_objectSpread2({}, props), {}, {
41
- children: /*#__PURE__*/React__default.createElement("span", {
42
- className: "".concat(blockClass, "__action"),
43
- title: children
44
- }, children)
45
- });
35
+ var _Children$toArray$fil = Children.toArray(children).filter(Boolean).map(function (child) {
36
+ if ( /*#__PURE__*/React__default.isValidElement(child)) {
37
+ var props = child.props;
38
+ return _objectSpread2(_objectSpread2({}, props), {}, {
39
+ children: /*#__PURE__*/React__default.createElement("span", {
40
+ className: "".concat(blockClass, "__action")
41
+ }, child)
42
+ });
43
+ }
44
+ return null;
46
45
  }),
47
46
  _Children$toArray$fil2 = _toArray(_Children$toArray$fil),
48
47
  primaryAction = _Children$toArray$fil2[0],
49
48
  restActions = _Children$toArray$fil2.slice(1);
50
49
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
50
+ ref: ref,
51
51
  className: cx(blockClass, className),
52
52
  "data-floating-menu-container": true
53
53
  }), /*#__PURE__*/React__default.createElement(Button, primaryAction), restActions.length > 0 && /*#__PURE__*/React__default.createElement(OverflowMenu, _extends({}, overflowMenu, {
@@ -73,10 +73,10 @@ var ComboButton = function ComboButton(_ref) {
73
73
  });
74
74
  },
75
75
  flipped: true
76
- }), restActions.map(function (_ref3, index) {
77
- var children = _ref3.children,
78
- Icon = _ref3.renderIcon,
79
- action = _objectWithoutProperties(_ref3, _excluded3);
76
+ }), restActions.map(function (_ref2, index) {
77
+ var children = _ref2.children,
78
+ Icon = _ref2.renderIcon,
79
+ action = _objectWithoutProperties(_ref2, _excluded2);
80
80
  return /*#__PURE__*/React__default.createElement(OverflowMenuItem, _extends({}, action, {
81
81
  key: "".concat(blockClass, "--").concat(instanceId, "__overflow-menu__item__").concat(index),
82
82
  className: "".concat(blockClass, "__overflow-menu__item"),
@@ -85,17 +85,21 @@ var ComboButton = function ComboButton(_ref) {
85
85
  }, /*#__PURE__*/React__default.createElement(Icon, null)))
86
86
  }));
87
87
  })));
88
- };
88
+ });
89
+
90
+ /**@ts-ignore*/
89
91
  ComboButton.deprecated = {
90
92
  level: 'warn',
91
93
  details: "Please replace ".concat(componentName, " with Carbon's ComboButton")
92
94
  };
95
+ ComboButton.displayName = componentName;
93
96
  ComboButton.propTypes = {
94
97
  /** Provide the contents of the `ComboButton` */
95
98
  children: propTypesExports.node.isRequired,
96
99
  /** Provide an optional class to be applied to the containing node */
97
100
  className: propTypesExports.string,
98
101
  /** Provide the [props of the `OverflowMenu`](https://react.carbondesignsystem.com/?path=/docs/overflowmenu) */
102
+ /**@ts-ignore*/
99
103
  overflowMenu: propTypesExports.shape(OverflowMenu.propTypes)
100
104
  };
101
105
 
@@ -1,16 +1,25 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
1
7
  /**
2
8
  * The combo button item provides additional actions a user can take.
3
9
  */
4
- export function ComboButtonItem({ ...rest }: {
5
- [x: string]: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- export namespace ComboButtonItem {
8
- namespace propTypes {
9
- export let children: import("prop-types").Validator<NonNullable<import("prop-types").ReactNodeLike>>;
10
- export { bool as disabled };
11
- export { string as href };
12
- export let renderIcon: import("prop-types").Requireable<object>;
13
- }
14
- }
15
- import { bool } from 'prop-types';
16
- import { string } from 'prop-types';
10
+ declare const ComboButtonItem: {
11
+ ({ ...rest }: {
12
+ [x: string]: any;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ propTypes: {
15
+ /** Provide the contents of the `ComboButtonItem` */
16
+ children: import("prop-types").Validator<NonNullable<import("prop-types").ReactNodeLike>>;
17
+ /** Specify whether the `ComboButton` should be disabled, or not */
18
+ disabled: import("prop-types").Requireable<boolean>;
19
+ /** Provide an optional `href` for the `ComboButtonItem` to become an `a` element */
20
+ href: import("prop-types").Requireable<string>;
21
+ /** Provide an optional icon to render */
22
+ renderIcon: import("prop-types").Requireable<object>;
23
+ };
24
+ };
25
+ export { ComboButtonItem };
@@ -1,8 +1,72 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { ReactNode } from 'react';
9
+ import { ComposedModal } from '@carbon/react';
10
+ interface CreateModalProps extends React.ComponentProps<typeof ComposedModal> {
11
+ /**
12
+ * Specify an optional className to be applied to the modal root node
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Specifies an optional handler which is called when the CreateModal
17
+ * is closed.
18
+ */
19
+ onRequestClose?(): void;
20
+ /**
21
+ * Specifies an optional handler which is called when the CreateModal
22
+ * primary button is pressed.
23
+ */
24
+ onRequestSubmit?(): void;
25
+ /**
26
+ * Specifies whether the CreateModal is open or not.
27
+ */
28
+ open?: boolean;
29
+ /**
30
+ * The title of the CreateModal is usually the product or service name.
31
+ */
32
+ title: ReactNode;
33
+ /**
34
+ * The subtitle of the CreateModal is optional and serves to provide more information about the modal.
35
+ */
36
+ subtitle?: ReactNode;
37
+ /**
38
+ * The description of the CreateModal serves to provide more information about the modal.
39
+ */
40
+ description: ReactNode;
41
+ /**
42
+ * Specifies the secondary button's text in the modal.
43
+ */
44
+ secondaryButtonText: string;
45
+ /**
46
+ * The DOM node the tearsheet should be rendered within. Defaults to document.body.
47
+ */
48
+ portalTarget?: ReactNode;
49
+ /**
50
+ * Specifies the primary button's text in the modal.
51
+ */
52
+ primaryButtonText: string;
53
+ /**
54
+ * Specifies a boolean for disabling or enabling the primary button. This is important for form validation
55
+ * Returning `true` prevents the primary button from being clicked until required fields are completed.
56
+ */
57
+ disableSubmit?: boolean;
58
+ /**
59
+ * Specifies which DOM element in the form should be focused.
60
+ */
61
+ selectorPrimaryFocus: ReactNode;
62
+ }
1
63
  /**
2
64
  * The `CreateModal` component provides a way for a user to quickly generate a new
3
65
  resource. It is triggered by a user’s action, appears on top of the main page
4
66
  content, and is persistent until dismissed. The purpose of this modal should be
5
67
  immediately apparent to the user, with a clear and obvious path to completion.
6
68
  */
7
- export let CreateModal: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
- import React from 'react';
69
+ export declare let CreateModal: React.ForwardRefExoticComponent<CreateModalProps & {
70
+ children?: React.ReactNode;
71
+ } & React.RefAttributes<unknown>>;
72
+ export {};
@@ -28,7 +28,6 @@ var isValidChildren = function isValidChildren() {
28
28
  return;
29
29
  };
30
30
  };
31
-
32
31
  /**
33
32
  * The `CreateModal` component provides a way for a user to quickly generate a new
34
33
  resource. It is triggered by a user’s action, appears on top of the main page
@@ -93,6 +92,7 @@ CreateModal.propTypes = {
93
92
  /**
94
93
  * Children refers to all form items within a form inside of the modal's body.
95
94
  */
95
+ /**@ts-ignore*/
96
96
  children: isValidChildren(),
97
97
  /**
98
98
  * Specify an optional className to be applied to the modal root node
@@ -87,7 +87,7 @@ var DatagridContent = function DatagridContent(_ref) {
87
87
  var renderTable = function renderTable() {
88
88
  var _getTableProps;
89
89
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Table, _extends({}, getTableProps(), {
90
- className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
90
+ className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.isResizingColumn) === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
91
91
  role: withInlineEdit ? 'grid' : undefined,
92
92
  tabIndex: withInlineEdit ? 0 : -1,
93
93
  onKeyDown: /* istanbul ignore next */
@@ -1,5 +1,5 @@
1
1
  export default Columns;
2
- declare function Columns({ getVisibleColumnsCount, filterString, columns, setColumnsObject, onSelectColumn, assistiveTextInstructionsLabel, assistiveTextDisabledInstructionsLabel, selectAllLabel, }: {
2
+ declare function Columns({ getVisibleColumnsCount, filterString, columns, setColumnsObject, onSelectColumn, assistiveTextInstructionsLabel, assistiveTextDisabledInstructionsLabel, selectAllLabel, customizeTearsheetHeadingLabel }: {
3
3
  getVisibleColumnsCount: any;
4
4
  filterString: any;
5
5
  columns: any;
@@ -8,12 +8,14 @@ declare function Columns({ getVisibleColumnsCount, filterString, columns, setCol
8
8
  assistiveTextInstructionsLabel: any;
9
9
  assistiveTextDisabledInstructionsLabel: any;
10
10
  selectAllLabel: any;
11
+ customizeTearsheetHeadingLabel: any;
11
12
  }): import("react/jsx-runtime").JSX.Element;
12
13
  declare namespace Columns {
13
14
  namespace propTypes {
14
15
  let assistiveTextDisabledInstructionsLabel: PropTypes.Requireable<string>;
15
16
  let assistiveTextInstructionsLabel: PropTypes.Requireable<string>;
16
17
  let columns: PropTypes.Validator<any[]>;
18
+ let customizeTearsheetHeadingLabel: PropTypes.Requireable<string>;
17
19
  let disabledInstructionsLabel: PropTypes.Requireable<string>;
18
20
  let filterString: PropTypes.Validator<string>;
19
21
  let getVisibleColumnsCount: PropTypes.Validator<(...args: any[]) => any>;
@@ -24,7 +24,8 @@ var Columns = function Columns(_ref) {
24
24
  onSelectColumn = _ref.onSelectColumn,
25
25
  assistiveTextInstructionsLabel = _ref.assistiveTextInstructionsLabel,
26
26
  assistiveTextDisabledInstructionsLabel = _ref.assistiveTextDisabledInstructionsLabel,
27
- selectAllLabel = _ref.selectAllLabel;
27
+ selectAllLabel = _ref.selectAllLabel,
28
+ customizeTearsheetHeadingLabel = _ref.customizeTearsheetHeadingLabel;
28
29
  var listId = useRef(uuidv4()); // keep id between renders
29
30
  var listRef = useRef(null);
30
31
  var _React$useState = React__default.useState(''),
@@ -47,6 +48,7 @@ var Columns = function Columns(_ref) {
47
48
  }, /*#__PURE__*/React__default.createElement("ol", {
48
49
  className: "".concat(blockClass, "__customize-columns-column-list--focus"),
49
50
  role: "listbox",
51
+ "aria-label": customizeTearsheetHeadingLabel,
50
52
  "aria-describedby": "".concat(blockClass, "__customize-columns--instructions"),
51
53
  tabIndex: 0
52
54
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -81,6 +83,7 @@ Columns.propTypes = {
81
83
  assistiveTextDisabledInstructionsLabel: PropTypes.string,
82
84
  assistiveTextInstructionsLabel: PropTypes.string,
83
85
  columns: PropTypes.array.isRequired,
86
+ customizeTearsheetHeadingLabel: PropTypes.string,
84
87
  disabledInstructionsLabel: PropTypes.string,
85
88
  filterString: PropTypes.string.isRequired,
86
89
  getVisibleColumnsCount: PropTypes.func.isRequired,
@@ -8,7 +8,6 @@
8
8
  import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, useCallback, useEffect } from 'react';
10
10
  import PropTypes from '../../../../../node_modules/prop-types/index.js';
11
- import { isColumnVisible } from './common.js';
12
11
  import Columns from './Columns.js';
13
12
  import Actions from './Actions.js';
14
13
  import { pkg } from '../../../../../settings.js';
@@ -51,19 +50,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
51
50
  _useState6 = _slicedToArray(_useState5, 2),
52
51
  searchText = _useState6[0],
53
52
  setSearchText = _useState6[1];
54
- var _useState7 = useState(columnDefinitions
55
- // only sort the hidden column to the end when modal reopen
56
- .sort(function (defA, defB) {
57
- var isVisibleA = isColumnVisible(defA);
58
- var isVisibleB = isColumnVisible(defB);
59
- if (isVisibleA && !isVisibleB) {
60
- return -1;
61
- }
62
- if (!isVisibleA && isVisibleB) {
63
- return 1;
64
- }
65
- return 0;
66
- })),
53
+ var _useState7 = useState(columnDefinitions),
67
54
  _useState8 = _slicedToArray(_useState7, 2),
68
55
  columnObjects = _useState8[0],
69
56
  setColumnObjects = _useState8[1];
@@ -149,7 +136,8 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
149
136
  setColumnObjects(cols);
150
137
  setDirty();
151
138
  },
152
- selectAllLabel: selectAllLabel
139
+ selectAllLabel: selectAllLabel,
140
+ customizeTearsheetHeadingLabel: customizeTearsheetHeadingLabel
153
141
  }));
154
142
  };
155
143
  CustomizeColumnsTearsheet.propTypes = {
@@ -7,13 +7,6 @@
7
7
 
8
8
  import isBoolean from 'lodash/isBoolean';
9
9
 
10
- /*
11
- * Licensed Materials - Property of IBM
12
- * 5724-Q36
13
- * (c) Copyright IBM Corp. 2021
14
- * US Government Users Restricted Rights - Use, duplication or disclosure
15
- * restricted by GSA ADP Schedule Contract with IBM Corp.
16
- */
17
10
  var isColumnVisible = function isColumnVisible(colDef) {
18
11
  return isBoolean(colDef.isVisible) ? colDef.isVisible : true;
19
12
  };
@@ -86,12 +86,19 @@ var stateReducer = function stateReducer(newState, action) {
86
86
  getRowId = _ref3.getRowId,
87
87
  indeterminate = _ref3.indeterminate,
88
88
  isChecked = _ref3.isChecked;
89
+ var newSelectedRowIds = {};
89
90
  if (rows) {
90
91
  var newSelectedRowData = {};
91
92
  rows.forEach(function (row) {
93
+ var props = row.getRowProps();
94
+ if (props && props.disabled) {
95
+ return;
96
+ }
97
+ newSelectedRowIds[getRowId(row.original, row.index)] = true;
92
98
  newSelectedRowData[getRowId(row.original, row.index)] = row.original;
93
99
  });
94
100
  return _objectSpread2(_objectSpread2({}, newState), {}, {
101
+ selectedRowIds: newSelectedRowIds,
95
102
  selectedRowData: indeterminate || !isChecked ? {} : newSelectedRowData
96
103
  });
97
104
  }
@@ -142,10 +142,7 @@ var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
142
142
  className: cx(blockClass, "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--focused"), focused), "".concat(blockClass, "--invalid"), invalid), "".concat(blockClass, "--inherit-type"), inheritTypography), "".concat(blockClass, "--overflows"), inputRef.current && inputRef.current.scrollWidth > inputRef.current.offsetWidth)),
143
143
  onFocus: onFocusHandler,
144
144
  onBlur: onBlurHandler
145
- }, /*#__PURE__*/React__default.createElement("label", {
146
- className: "".concat(blockClass, "__text-input-label"),
147
- htmlFor: id
148
- }, labelText), /*#__PURE__*/React__default.createElement("input", {
145
+ }, /*#__PURE__*/React__default.createElement("input", {
149
146
  id: id,
150
147
  className: cx("".concat(blockClass, "__text-input"), "".concat(carbon.prefix, "--text-input"), "".concat(carbon.prefix, "--text-input--").concat(size)),
151
148
  type: "text",
@@ -154,7 +151,9 @@ var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
154
151
  ref: inputRef
155
152
  // readOnly={readOnly}
156
153
  ,
157
- onKeyDown: onKeyHandler
154
+ onKeyDown: onKeyHandler,
155
+ "aria-label": labelText,
156
+ "aria-invalid": invalid
158
157
  }), /*#__PURE__*/React__default.createElement("div", {
159
158
  className: "".concat(blockClass, "__ellipsis"),
160
159
  "aria-hidden": !focused
@@ -0,0 +1,3 @@
1
+ export let Nav: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ export default Nav;
3
+ import React from 'react';
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useState, useRef, useEffect } from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import NavList, { blockClass as blockClass$2 } from './NavList.js';
13
+ import NavItem, { blockClass as blockClass$1 } from './NavItem.js';
14
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
15
+ import { pkg } from '../../settings.js';
16
+
17
+ var _excluded = ["activeHref", "className", "children", "heading", "label"];
18
+ var componentName = 'Nav';
19
+ var blockClass = "".concat(pkg.prefix, "--nav");
20
+ var Nav = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
21
+ var activeHref = _ref.activeHref,
22
+ className = _ref.className,
23
+ children = _ref.children,
24
+ heading = _ref.heading,
25
+ label = _ref.label,
26
+ rest = _objectWithoutProperties(_ref, _excluded);
27
+ var _useState = useState(activeHref),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ _activeHref = _useState2[0],
30
+ setActiveHref = _useState2[1];
31
+ var navigationLists = useRef({});
32
+ useEffect(function () {
33
+ if (!_activeHref && window.location) {
34
+ var _window$location = window.location,
35
+ hash = _window$location.hash,
36
+ pathname = _window$location.pathname;
37
+ setActiveHref(pathname + hash);
38
+ }
39
+ }, [_activeHref]);
40
+
41
+ /**
42
+ * Creates a new child list item.
43
+ * @param {NavItem} child The child list item to create.
44
+ * @param {number} index The index of the child list item.
45
+ * @returns {NavItem} The new child list item.
46
+ */
47
+ var buildNewItemChild = function buildNewItemChild(child, index) {
48
+ var key = "".concat(blockClass$1, "--").concat(index);
49
+ return /*#__PURE__*/React__default.createElement(NavItem, _extends({}, child.props, {
50
+ activeHref: _activeHref,
51
+ key: key,
52
+ onClick: function onClick(event, href) {
53
+ return handleItemClick(event, href, child.props.onClick);
54
+ }
55
+ }));
56
+ };
57
+
58
+ /**
59
+ * Creates a new child list.
60
+ * @param {NavList} child The child list to create.
61
+ * @param {number} index The index of the child list.
62
+ * @returns {NavList} The new child list.
63
+ */
64
+ var buildNewListChild = function buildNewListChild(child, index) {
65
+ var key = "".concat(blockClass$2, "--").concat(index);
66
+ return /*#__PURE__*/React__default.createElement(NavList, _extends({}, child.props, {
67
+ activeHref: _activeHref,
68
+ id: key,
69
+ key: key,
70
+ onListClick: handleListClick,
71
+ onItemClick: handleItemClick,
72
+ ref: function ref(el) {
73
+ return navigationLists.current[key] = el;
74
+ }
75
+ }));
76
+ };
77
+
78
+ /**
79
+ * Handles toggling the list item.
80
+ * @param {SyntheticEvent} event The event fired when the list item is toggled.
81
+ * @param {string} href The URL of the list item.
82
+ */
83
+ var handleItemClick = function handleItemClick(event, href, onClick) {
84
+ event.stopPropagation();
85
+ var type = event.type,
86
+ which = event.which;
87
+
88
+ // Enter (13) and spacebar (32).
89
+ var acceptableEvent = which === 13 || which === 32 || type === 'click';
90
+ var diffHref = href !== _activeHref;
91
+ if (acceptableEvent && diffHref) {
92
+ setActiveHref(href);
93
+ }
94
+ if (onClick) {
95
+ onClick(event);
96
+ }
97
+ };
98
+
99
+ /**
100
+ * Handles when a list has been selected.
101
+ * @param {number} id The index of the list.
102
+ */
103
+ var handleListClick = function handleListClick(id) {
104
+ Object.keys(navigationLists.current).forEach(function (key) {
105
+ if (key !== id && !navigationLists.current[key].isExpandedOnPageload) {
106
+ navigationLists.current[key].close();
107
+ }
108
+ });
109
+ };
110
+ return /*#__PURE__*/React__default.createElement("nav", _extends({
111
+ className: cx(blockClass, className),
112
+ "aria-label": label,
113
+ ref: ref
114
+ }, getDevtoolsProps(componentName), rest), heading && /*#__PURE__*/React__default.createElement("h1", {
115
+ className: "".concat(blockClass, "__heading")
116
+ }, heading), /*#__PURE__*/React__default.createElement("ul", {
117
+ className: "".concat(blockClass, "__wrapper"),
118
+ role: "menubar"
119
+ }, React__default.Children.map(children, function (child, index) {
120
+ var _child$type;
121
+ return (child === null || child === void 0 || (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === NavList.displayName ? buildNewListChild(child, index) : buildNewItemChild(child, index);
122
+ })));
123
+ });
124
+ Nav.propTypes = {
125
+ /**
126
+ * Hypertext reference for active page.
127
+ */
128
+ activeHref: PropTypes.string,
129
+ /**
130
+ * Child elements.
131
+ */
132
+ children: PropTypes.node,
133
+ /**
134
+ * Extra classes to add.
135
+ */
136
+ className: PropTypes.string,
137
+ /**
138
+ * Heading.
139
+ */
140
+ heading: PropTypes.string,
141
+ /**
142
+ * Aria-label on the rendered `nav` element.
143
+ */
144
+ label: PropTypes.string.isRequired
145
+ };
146
+
147
+ // Return a placeholder if not released and not enabled by feature flag
148
+ Nav = pkg.checkComponentEnabled(Nav, componentName);
149
+
150
+ // The display name of the component, used by React. Note that displayName
151
+ // is used in preference to relying on function.name.
152
+ Nav.displayName = componentName;
153
+
154
+ export { Nav };
@@ -0,0 +1,35 @@
1
+ export const blockClass: string;
2
+ export function NavItem({ activeHref, children, className, current, disabled, element, href, id, label, onClick, tabIndex, ...rest }: {
3
+ [x: string]: any;
4
+ activeHref?: string | undefined;
5
+ children?: any;
6
+ className: any;
7
+ current: any;
8
+ disabled?: boolean | undefined;
9
+ element?: string | undefined;
10
+ href: any;
11
+ id: any;
12
+ label: any;
13
+ onClick?: (() => void) | undefined;
14
+ tabIndex?: number | undefined;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
+ export namespace NavItem {
17
+ export { componentName as displayName };
18
+ export namespace propTypes {
19
+ let activeHref: PropTypes.Requireable<string>;
20
+ let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
21
+ let className: PropTypes.Requireable<string>;
22
+ let current: PropTypes.Requireable<string>;
23
+ let disabled: PropTypes.Requireable<boolean>;
24
+ let element: PropTypes.Requireable<PropTypes.ReactComponentLike>;
25
+ let href: PropTypes.Requireable<string>;
26
+ let id: PropTypes.Requireable<string>;
27
+ let label: PropTypes.Requireable<string>;
28
+ let link: PropTypes.Requireable<boolean>;
29
+ let onClick: PropTypes.Requireable<(...args: any[]) => any>;
30
+ let tabIndex: PropTypes.Requireable<number>;
31
+ }
32
+ }
33
+ export default NavItem;
34
+ declare const componentName: "NavItem";
35
+ import PropTypes from 'prop-types';