@carbon/ibm-products 2.17.1 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/css/index-full-carbon.css +17078 -15669
  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 +71 -9
  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 +5763 -6355
  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 +124 -9
  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/Carousel/Carousel.docs-page.js +11 -0
  18. package/es/components/Carousel/Carousel.js +322 -0
  19. package/es/components/Carousel/CarouselItem.js +53 -0
  20. package/es/components/Carousel/index.js +9 -0
  21. package/es/components/Carousel/utils.js +98 -0
  22. package/es/components/CreateSidePanel/CreateSidePanel.js +7 -1
  23. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -1
  24. package/es/components/Datagrid/Datagrid/DatagridRow.js +13 -3
  25. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +4 -3
  26. package/es/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +7 -1
  27. package/es/components/Datagrid/useExpandedRow.js +3 -6
  28. package/es/components/Datagrid/useFocusRowExpander.js +40 -0
  29. package/es/components/Datagrid/useNestedRowExpander.js +9 -0
  30. package/es/components/Datagrid/useNestedRows.js +1 -5
  31. package/es/components/Datagrid/useRowExpander.js +9 -0
  32. package/es/components/Datagrid/useSelectRows.js +9 -2
  33. package/es/components/Datagrid/utils/handleFilterTagLabelText.js +26 -0
  34. package/es/components/EditSidePanel/EditSidePanel.js +8 -2
  35. package/es/components/FilterSummary/FilterSummary.js +21 -7
  36. package/es/components/Guidebanner/Guidebanner.docs-page.js +15 -0
  37. package/es/components/Guidebanner/Guidebanner.js +221 -0
  38. package/es/components/Guidebanner/GuidebannerElement.js +72 -0
  39. package/es/components/Guidebanner/GuidebannerElementButton.js +80 -0
  40. package/es/components/Guidebanner/GuidebannerElementLink.js +57 -0
  41. package/es/components/Guidebanner/index.js +11 -0
  42. package/es/components/NonLinearReading/NonLinearReading.docs-page.js +15 -0
  43. package/es/components/NonLinearReading/NonLinearReading.js +89 -0
  44. package/es/components/NonLinearReading/index.js +8 -0
  45. package/es/components/SidePanel/SidePanel.js +48 -27
  46. package/es/components/TagSet/TagSet.js +22 -5
  47. package/es/components/WebTerminal/WebTerminal.js +5 -3
  48. package/es/global/js/hooks/useCreateComponentStepChange.js +1 -1
  49. package/es/global/js/package-settings.js +6 -3
  50. package/lib/components/Carousel/Carousel.docs-page.js +21 -0
  51. package/lib/components/Carousel/Carousel.js +329 -0
  52. package/lib/components/Carousel/CarouselItem.js +54 -0
  53. package/lib/components/Carousel/index.js +19 -0
  54. package/lib/components/Carousel/utils.js +105 -0
  55. package/lib/components/CreateSidePanel/CreateSidePanel.js +7 -1
  56. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -1
  57. package/lib/components/Datagrid/Datagrid/DatagridRow.js +13 -3
  58. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +4 -3
  59. package/lib/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +7 -1
  60. package/lib/components/Datagrid/useExpandedRow.js +2 -5
  61. package/lib/components/Datagrid/useFocusRowExpander.js +45 -0
  62. package/lib/components/Datagrid/useNestedRowExpander.js +9 -0
  63. package/lib/components/Datagrid/useNestedRows.js +1 -5
  64. package/lib/components/Datagrid/useRowExpander.js +9 -0
  65. package/lib/components/Datagrid/useSelectRows.js +9 -2
  66. package/lib/components/Datagrid/utils/handleFilterTagLabelText.js +32 -0
  67. package/lib/components/EditSidePanel/EditSidePanel.js +8 -2
  68. package/lib/components/FilterSummary/FilterSummary.js +24 -7
  69. package/lib/components/Guidebanner/Guidebanner.docs-page.js +25 -0
  70. package/lib/components/Guidebanner/Guidebanner.js +229 -0
  71. package/lib/components/Guidebanner/GuidebannerElement.js +77 -0
  72. package/lib/components/Guidebanner/GuidebannerElementButton.js +85 -0
  73. package/lib/components/Guidebanner/GuidebannerElementLink.js +62 -0
  74. package/lib/components/Guidebanner/index.js +33 -0
  75. package/lib/components/NonLinearReading/NonLinearReading.docs-page.js +25 -0
  76. package/lib/components/NonLinearReading/NonLinearReading.js +97 -0
  77. package/lib/components/NonLinearReading/index.js +12 -0
  78. package/lib/components/SidePanel/SidePanel.js +47 -26
  79. package/lib/components/TagSet/TagSet.js +22 -5
  80. package/lib/components/WebTerminal/WebTerminal.js +4 -2
  81. package/lib/global/js/hooks/useCreateComponentStepChange.js +1 -1
  82. package/lib/global/js/package-settings.js +6 -3
  83. package/package.json +5 -5
  84. package/scss/components/Carousel/_carbon-imports.scss +6 -0
  85. package/scss/components/Carousel/_carousel.scss +72 -0
  86. package/scss/components/Carousel/_index-with-carbon.scss +9 -0
  87. package/scss/components/Carousel/_index.scss +8 -0
  88. package/scss/components/Datagrid/styles/_useExpandedRow.scss +21 -0
  89. package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -0
  90. package/scss/components/FilterSummary/_filter-summary.scss +6 -1
  91. package/scss/components/Guidebanner/_carbon-imports.scss +6 -0
  92. package/scss/components/Guidebanner/_guidebanner.scss +248 -0
  93. package/scss/components/Guidebanner/_index-with-carbon.scss +9 -0
  94. package/scss/components/Guidebanner/_index.scss +8 -0
  95. package/scss/components/NonLinearReading/_carbon-imports.scss +6 -0
  96. package/scss/components/NonLinearReading/_index-with-carbon.scss +9 -0
  97. package/scss/components/NonLinearReading/_index.scss +8 -0
  98. package/scss/components/NonLinearReading/_non-linear-reading.scss +122 -0
  99. package/scss/components/SidePanel/_side-panel.scss +22 -6
  100. package/scss/components/WebTerminal/_web-terminal.scss +1 -2
  101. package/scss/components/_Canary/_canary.scss +1 -2
  102. package/scss/components/_Canary/_carbon-imports.scss +7 -0
  103. package/scss/components/_Canary/_index-with-carbon.scss +8 -0
  104. package/scss/components/_Canary/_index.scss +7 -0
  105. package/scss/components/_index-with-carbon.scss +1 -1
  106. package/scss/components/_index.scss +5 -2
  107. /package/es/components/Datagrid/{Extensions → Datagrid.stories}/ColumnAlignment/ColumnAlignment.docs-page.js +0 -0
  108. /package/lib/components/Datagrid/{Extensions → Datagrid.stories}/ColumnAlignment/ColumnAlignment.docs-page.js +0 -0
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.GuidebannerElement = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _devtools = require("../../global/js/utils/devtools");
14
+ var _settings = require("../../settings");
15
+ var _excluded = ["button", "className", "description", "title"];
16
+ /**
17
+ * Copyright IBM Corp. 2023, 2023
18
+ *
19
+ * This source code is licensed under the Apache-2.0 license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+ // Import portions of React that are needed.
23
+ // The block part of our conventional BEM class names (blockClass__E--M).
24
+ var blockClass = "".concat(_settings.pkg.prefix, "--guidebanner__element");
25
+ var componentName = 'GuidebannerElement';
26
+
27
+ /**
28
+ * The GuidebannerElement is a required child component of the Guidebanner,
29
+ * and acts as a container for a CarouselItem.
30
+ */
31
+ var GuidebannerElement = exports.GuidebannerElement = function GuidebannerElement(_ref) {
32
+ var button = _ref.button,
33
+ className = _ref.className,
34
+ description = _ref.description,
35
+ title = _ref.title,
36
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
38
+ className: (0, _classnames.default)(blockClass, className)
39
+ }, (0, _devtools.getDevtoolsProps)(componentName)), title && /*#__PURE__*/_react.default.createElement("h2", {
40
+ className: "".concat(blockClass, "-title")
41
+ }, title), description && /*#__PURE__*/_react.default.createElement("p", {
42
+ className: "".concat(blockClass, "-content")
43
+ }, description), button && /*#__PURE__*/_react.default.createElement("div", {
44
+ className: "".concat(blockClass, "-buttons")
45
+ }, button));
46
+ };
47
+
48
+ // Return a placeholder if not released and not enabled by feature flag
49
+ exports.GuidebannerElement = GuidebannerElement = _settings.pkg.checkComponentEnabled(GuidebannerElement, componentName);
50
+
51
+ // The display name of the component, used by React. Note that displayName
52
+ // is used in preference to relying on function.name.
53
+ GuidebannerElement.displayName = componentName;
54
+
55
+ // The types and DocGen commentary for the component props,
56
+ // in alphabetical order (for consistency).
57
+ // See https://www.npmjs.com/package/prop-types#usage.
58
+ GuidebannerElement.propTypes = {
59
+ /**
60
+ * An optional button can be rendered below the description.
61
+ * This can be a link, button, Coachmark button, etc.
62
+ */
63
+ button: _propTypes.default.node,
64
+ /**
65
+ * Provide an optional class to be applied to the containing node.
66
+ */
67
+ className: _propTypes.default.string,
68
+ /**
69
+ * The description of the element.
70
+ */
71
+
72
+ description: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired,
73
+ /**
74
+ * The title of the element.
75
+ */
76
+ title: _propTypes.default.string
77
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.GuidebannerElementButton = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _react2 = require("@carbon/react");
14
+ var _icons = require("@carbon/react/icons");
15
+ var _devtools = require("../../global/js/utils/devtools");
16
+ var _settings = require("../../settings");
17
+ var _excluded = ["children", "className", "type"];
18
+ /**
19
+ * Copyright IBM Corp. 2023, 2023
20
+ *
21
+ * This source code is licensed under the Apache-2.0 license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */
24
+ // Import portions of React that are needed.
25
+ // The block part of our conventional BEM class names (blockClass__E--M).
26
+ var blockClass = "".concat(_settings.pkg.prefix, "--guidebanner__element-button");
27
+ var componentName = 'GuidebannerElementButton';
28
+
29
+ /**
30
+ * One of two buttons styled specifically for the GuidebannerElement.
31
+ */
32
+ var GuidebannerElementButton = exports.GuidebannerElementButton = function GuidebannerElementButton(_ref) {
33
+ var children = _ref.children,
34
+ className = _ref.className,
35
+ type = _ref.type,
36
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
+ if (type === 'primary') {
38
+ return /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({}, rest, {
39
+ className: (0, _classnames.default)(blockClass, className),
40
+ iconDescription: 'Crossroads',
41
+ kind: "tertiary",
42
+ renderIcon: function renderIcon() {
43
+ return /*#__PURE__*/_react.default.createElement(_icons.Crossroads, {
44
+ size: 16
45
+ });
46
+ },
47
+ role: "button",
48
+ size: "md"
49
+ }, (0, _devtools.getDevtoolsProps)(componentName)), children);
50
+ }
51
+ return /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({}, rest, {
52
+ className: (0, _classnames.default)(blockClass, className),
53
+ kind: "ghost",
54
+ role: "button",
55
+ size: "md"
56
+ }, (0, _devtools.getDevtoolsProps)(componentName)), children);
57
+ };
58
+
59
+ // Return a placeholder if not released and not enabled by feature flag
60
+ exports.GuidebannerElementButton = GuidebannerElementButton = _settings.pkg.checkComponentEnabled(GuidebannerElementButton, componentName);
61
+
62
+ // The display name of the component, used by React. Note that displayName
63
+ // is used in preference to relying on function.name.
64
+ GuidebannerElementButton.displayName = componentName;
65
+
66
+ // The types and DocGen commentary for the component props,
67
+ // in alphabetical order (for consistency).
68
+ // See https://www.npmjs.com/package/prop-types#usage.
69
+ GuidebannerElementButton.propTypes = {
70
+ /**
71
+ * Provide the contents of the GuidebannerElementButton.
72
+ */
73
+ children: _propTypes.default.node.isRequired,
74
+ /**
75
+ * Provide an optional class to be applied to the containing node.
76
+ */
77
+ className: _propTypes.default.string,
78
+ /**
79
+ * If type is "primary", then return a tertiary button with the "crossroads" icon,
80
+ * else return a ghost button.
81
+ */
82
+ type: _propTypes.default.string
83
+
84
+ /* TODO: add types and DocGen for all props. */
85
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.GuidebannerElementLink = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _react2 = require("@carbon/react");
14
+ var _devtools = require("../../global/js/utils/devtools");
15
+ var _settings = require("../../settings");
16
+ var _excluded = ["children", "className"];
17
+ /**
18
+ * Copyright IBM Corp. 2023, 2023
19
+ *
20
+ * This source code is licensed under the Apache-2.0 license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */
23
+ // Import portions of React that are needed.
24
+ // The block part of our conventional BEM class names (blockClass__E--M).
25
+ var blockClass = "".concat(_settings.pkg.prefix, "--guidebanner__element-link");
26
+ var componentName = 'GuidebannerElementLink';
27
+
28
+ /**
29
+ * A link styled specifically for the GuidebannerElement.
30
+ */
31
+ var GuidebannerElementLink = exports.GuidebannerElementLink = function GuidebannerElementLink(_ref) {
32
+ var children = _ref.children,
33
+ className = _ref.className,
34
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
35
+ return /*#__PURE__*/_react.default.createElement(_react2.Link, (0, _extends2.default)({}, rest, {
36
+ className: (0, _classnames.default)(blockClass, className),
37
+ kind: "ghost",
38
+ role: "link",
39
+ size: "md"
40
+ }, (0, _devtools.getDevtoolsProps)(componentName)), children);
41
+ };
42
+
43
+ // Return a placeholder if not released and not enabled by feature flag
44
+ exports.GuidebannerElementLink = GuidebannerElementLink = _settings.pkg.checkComponentEnabled(GuidebannerElementLink, componentName);
45
+
46
+ // The display name of the component, used by React. Note that displayName
47
+ // is used in preference to relying on function.name.
48
+ GuidebannerElementLink.displayName = componentName;
49
+
50
+ // The types and DocGen commentary for the component props,
51
+ // in alphabetical order (for consistency).
52
+ // See https://www.npmjs.com/package/prop-types#usage.
53
+ GuidebannerElementLink.propTypes = {
54
+ /**
55
+ * Provide the contents of the GuidebannerElementLink.
56
+ */
57
+ children: _propTypes.default.node.isRequired,
58
+ /**
59
+ * Provide an optional class to be applied to the containing node.
60
+ */
61
+ className: _propTypes.default.string
62
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Guidebanner", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Guidebanner.Guidebanner;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "GuidebannerElement", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _GuidebannerElement.GuidebannerElement;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "GuidebannerElementButton", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _GuidebannerElementButton.GuidebannerElementButton;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "GuidebannerElementLink", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _GuidebannerElementLink.GuidebannerElementLink;
28
+ }
29
+ });
30
+ var _Guidebanner = require("./Guidebanner");
31
+ var _GuidebannerElement = require("./GuidebannerElement");
32
+ var _GuidebannerElementButton = require("./GuidebannerElementButton");
33
+ var _GuidebannerElementLink = require("./GuidebannerElementLink");
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var stories = _interopRequireWildcard(require("./NonLinearReading.stories"));
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ var DocsPage = function DocsPage() {
15
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
16
+ blocks: [{
17
+ story: stories.singleLevel
18
+ }, {
19
+ story: stories.multipleLevel
20
+ }, {
21
+ story: stories.withGradientBackground
22
+ }]
23
+ });
24
+ };
25
+ var _default = exports.default = DocsPage;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.NonLinearReading = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _icons = require("@carbon/react/icons");
16
+ var _devtools = require("../../global/js/utils/devtools");
17
+ var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
18
+ var _settings = require("../../settings");
19
+ var _excluded = ["children", "className", "definition", "theme"];
20
+ /**
21
+ * Copyright IBM Corp. 2023, 2023
22
+ *
23
+ * This source code is licensed under the Apache-2.0 license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
27
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
+ // The block part of our conventional BEM class names (blockClass__E--M).
29
+ var blockClass = "".concat(_settings.pkg.prefix, "--non-linear-reading");
30
+ var componentName = 'NonLinearReading';
31
+
32
+ // Default values for props
33
+ var defaults = {
34
+ theme: 'light'
35
+ };
36
+
37
+ /**
38
+ * Use non-linear reading when space is limited to share a
39
+ * brief, at-a-glance, summary of a concept that may require
40
+ * more explanation for some users.
41
+ */
42
+ var NonLinearReading = exports.NonLinearReading = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
43
+ var children = _ref.children,
44
+ className = _ref.className,
45
+ definition = _ref.definition,
46
+ _ref$theme = _ref.theme,
47
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
48
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
49
+ var _useState = (0, _react.useState)(false),
50
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
51
+ isOpen = _useState2[0],
52
+ setOpen = _useState2[1];
53
+ var contentId = (0, _react.useRef)((0, _uuidv.default)()).current;
54
+ var handleToggle = function handleToggle() {
55
+ setOpen(function (prevState) {
56
+ return !prevState;
57
+ });
58
+ };
59
+ return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, rest, {
60
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "__").concat(theme), className),
61
+ ref: ref
62
+ }, (0, _devtools.getDevtoolsProps)(componentName)), ' ', /*#__PURE__*/_react.default.createElement("button", {
63
+ type: "button",
64
+ "aria-controls": contentId,
65
+ "aria-expanded": isOpen,
66
+ className: (0, _classnames.default)("".concat(blockClass, "__keyword"), [isOpen ? ["".concat(blockClass, "__keyword-open")] : ["".concat(blockClass, "__keyword-closed")]]),
67
+ onClick: handleToggle
68
+ }, children, /*#__PURE__*/_react.default.createElement(_icons.ChevronDown, {
69
+ size: 16
70
+ })), ' ', /*#__PURE__*/_react.default.createElement("span", {
71
+ id: contentId,
72
+ className: "".concat(blockClass, "__body"),
73
+ hidden: !isOpen
74
+ }, isOpen && definition), ' ');
75
+ });
76
+
77
+ // Return a placeholder if not released and not enabled by feature flag
78
+ exports.NonLinearReading = NonLinearReading = _settings.pkg.checkComponentEnabled(NonLinearReading, componentName);
79
+ NonLinearReading.displayName = componentName;
80
+ NonLinearReading.propTypes = {
81
+ /**
82
+ * The keyword of the component appears as a pill.
83
+ */
84
+ children: _propTypes.default.node.isRequired,
85
+ /**
86
+ * Provide an optional class to be applied to the containing node.
87
+ */
88
+ className: _propTypes.default.string,
89
+ /**
90
+ * The content that appears when the keyword is toggled open.
91
+ */
92
+ definition: _propTypes.default.node.isRequired,
93
+ /**
94
+ * Determines the theme of the component.
95
+ */
96
+ theme: _propTypes.default.oneOf(['light', 'dark'])
97
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "NonLinearReading", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _NonLinearReading.NonLinearReading;
10
+ }
11
+ });
12
+ var _NonLinearReading = require("./NonLinearReading");
@@ -26,7 +26,7 @@ var _react2 = require("@carbon/react");
26
26
  var _icons = require("@carbon/react/icons");
27
27
  var _ActionSet = require("../ActionSet");
28
28
  var _variants = require("./motion/variants");
29
- var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "subtitle", "title"],
29
+ var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title"],
30
30
  _excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
31
31
  /**
32
32
  * Copyright IBM Corp. 2020, 2023
@@ -72,6 +72,8 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
72
72
  condensedActions = _ref.condensedActions,
73
73
  _ref$currentStep = _ref.currentStep,
74
74
  currentStep = _ref$currentStep === void 0 ? defaults.currentStep : _ref$currentStep,
75
+ _ref$id = _ref.id,
76
+ id = _ref$id === void 0 ? blockClass : _ref$id,
75
77
  includeOverlay = _ref.includeOverlay,
76
78
  labelText = _ref.labelText,
77
79
  _ref$navigationBackIc = _ref.navigationBackIconDescription,
@@ -88,6 +90,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
88
90
  _ref$size = _ref.size,
89
91
  size = _ref$size === void 0 ? defaults.size : _ref$size,
90
92
  slideIn = _ref.slideIn,
93
+ slug = _ref.slug,
91
94
  subtitle = _ref.subtitle,
92
95
  title = _ref.title,
93
96
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -112,6 +115,10 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
112
115
  var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
113
116
  matches: true
114
117
  };
118
+ var getActionsContainerElement = (0, _react.useCallback)(function () {
119
+ var sidePanelOuter = document.querySelector("#".concat(id));
120
+ return sidePanelOuter && sidePanelOuter.querySelector(".".concat(blockClass, "__actions-container"));
121
+ }, [id]);
115
122
 
116
123
  // scroll panel to top going between steps
117
124
  (0, _react.useEffect)(function () {
@@ -119,7 +126,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
119
126
  if (panelRef && panelRef.current) {
120
127
  var _document$querySelect;
121
128
  var scrollableSection = panelRef.current.querySelector(".".concat(blockClass, "__inner-content"));
122
- var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
129
+ var sidePanelOuter = document.querySelector("#".concat(id));
123
130
  var initialTitleHeight = (_document$querySelect = document.querySelector(".".concat(blockClass, "__title-container"))) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.offsetHeight;
124
131
  scrollableSection.scrollTop = 0;
125
132
  // The size of the panel has changed while it is still opened
@@ -131,7 +138,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
131
138
  sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 || _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
132
139
  }
133
140
  }
134
- }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]);
141
+ }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size, id]);
135
142
 
136
143
  // set initial focus when side panel opens
137
144
  (0, _react.useEffect)(function () {
@@ -155,13 +162,13 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
155
162
  (0, _react.useEffect)(function () {
156
163
  if (open && actions && actions.length && animationComplete) {
157
164
  var _sidePanelOuter$style2;
158
- var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
165
+ var sidePanelOuter = document.querySelector("#".concat(id));
159
166
  var actionsContainer = getActionsContainerElement();
160
167
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
161
168
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
162
169
  sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 || _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
163
170
  }
164
- }, [actions, condensedActions, open, animationComplete]);
171
+ }, [actions, condensedActions, open, animationComplete, id, getActionsContainerElement]);
165
172
 
166
173
  // Add console warning if labelText is provided without a title.
167
174
  // This combination is not allowed.
@@ -176,23 +183,19 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
176
183
  var _sidePanelOuter$style3;
177
184
  var height = _ref2.height;
178
185
  setPanelHeight(height);
179
- var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
186
+ var sidePanelOuter = document.querySelector("#".concat(id));
180
187
  var actionsContainer = getActionsContainerElement();
181
188
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
182
189
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
183
190
  sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 || _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
184
191
  };
185
- var getActionsContainerElement = function getActionsContainerElement() {
186
- var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
187
- return sidePanelOuter && sidePanelOuter.querySelector(".".concat(blockClass, "__actions-container"));
188
- };
189
192
 
190
193
  // Title and subtitle scroll animation
191
194
  (0, _react.useEffect)(function () {
192
195
  if (open && animateTitle && animationComplete && title && title.length && !reducedMotion.matches) {
193
196
  var _document$querySelect2, _document$querySelect3, _document$querySelect4;
194
- var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
195
- var sidePanelScrollArea = document.querySelector("#".concat(blockClass, "-outer .").concat(blockClass, "__inner-content"));
197
+ var sidePanelOuter = document.querySelector("#".concat(id));
198
+ var sidePanelScrollArea = document.querySelector("#".concat(id, " .").concat(blockClass, "__inner-content"));
196
199
  var sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-text"));
197
200
  var sidePanelCollapsedTitleElement = document.querySelector(".".concat(blockClass, "__collapsed-title-text"));
198
201
  var sidePanelSubtitleElement = document.querySelector(".".concat("".concat(blockClass, "__subtitle-text")));
@@ -267,7 +270,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
267
270
  });
268
271
  }
269
272
  if (open && !animateTitle) {
270
- var _sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
273
+ var _sidePanelOuter = document.querySelector("#".concat(id));
271
274
  var _sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-container .").concat(blockClass, "__title-text"));
272
275
  var _sidePanelSubtitleElement = document.querySelector(".".concat(blockClass, "__subtitle-text"));
273
276
  var actionToolbarElement = document.querySelector(".".concat(blockClass, "__action-toolbar"));
@@ -281,7 +284,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
281
284
  _sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
282
285
  _sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "".concat(labelHeight, "px"));
283
286
  }
284
- }, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches]);
287
+ }, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches, id]);
285
288
 
286
289
  // click outside functionality if `includeOverlay` prop is set
287
290
  (0, _react.useEffect)(function () {
@@ -333,9 +336,9 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
333
336
  if (!open && slideIn) {
334
337
  var pageContentElement = document.querySelector(selectorPageContent);
335
338
  if (placement && placement === 'right' && pageContentElement) {
336
- pageContentElement.style.marginRight = 0;
339
+ pageContentElement.style.marginInlineEnd = 0;
337
340
  } else if (pageContentElement) {
338
- pageContentElement.style.marginLeft = 0;
341
+ pageContentElement.style.marginInlineStart = 0;
339
342
  }
340
343
  }
341
344
  }, [open, placement, selectorPageContent, slideIn]);
@@ -349,14 +352,15 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
349
352
  (0, _react.useEffect)(function () {
350
353
  if (open && slideIn) {
351
354
  var pageContentElement = document.querySelector(selectorPageContent);
355
+ pageContentElement.style.inlineSize = 'auto';
352
356
  if (placement && placement === 'right' && pageContentElement) {
353
- pageContentElement.style.marginRight = 0;
354
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-right ".concat(_motion.moderate02) : null;
355
- pageContentElement.style.marginRight = _constants.SIDE_PANEL_SIZES[size];
357
+ pageContentElement.style.marginInlineEnd = 0;
358
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(_motion.moderate02) : null;
359
+ pageContentElement.style.marginInlineEnd = _constants.SIDE_PANEL_SIZES[size];
356
360
  } else if (pageContentElement) {
357
- pageContentElement.style.marginLeft = 0;
358
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-left ".concat(_motion.moderate02) : null;
359
- pageContentElement.style.marginLeft = _constants.SIDE_PANEL_SIZES[size];
361
+ pageContentElement.style.marginInlineStart = 0;
362
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(_motion.moderate02) : null;
363
+ pageContentElement.style.marginInlineStart = _constants.SIDE_PANEL_SIZES[size];
360
364
  }
361
365
  }
362
366
  }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]);
@@ -378,9 +382,16 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
378
382
  }
379
383
  };
380
384
  var primaryActionContainerClassNames = (0, _classnames.default)(["".concat(blockClass, "__actions-container"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-container-condensed"), condensedActions)]);
381
- var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref5)]);
385
+ var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), (0, _defineProperty2.default)(_ref5, "".concat(blockClass, "__container--has-slug"), slug), _ref5)]);
382
386
  var renderHeader = function renderHeader() {
383
387
  var _cx, _cx2;
388
+ var normalizedSlug;
389
+ if (slug) {
390
+ normalizedSlug = /*#__PURE__*/_react.default.cloneElement(slug, {
391
+ // slug size is sm unless actions and size > md
392
+ size: actions.length && /l/.test(size) ? 'md' : 'sm'
393
+ });
394
+ }
384
395
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
385
396
  className: (0, _classnames.default)("".concat(blockClass, "__title-container"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container-without-title"), !title), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__title-container--reduced-motion"), reducedMotion.matches), _cx))
386
397
  }, currentStep > 0 && /*#__PURE__*/_react.default.createElement(_react2.Button, {
@@ -398,7 +409,9 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
398
409
  onClick: onNavigationBack
399
410
  }), title && title.length && labelText && labelText.length && /*#__PURE__*/_react.default.createElement("p", {
400
411
  className: "".concat(blockClass, "__label-text")
401
- }, labelText), title && title.length && renderTitle()), /*#__PURE__*/_react.default.createElement(_react2.Button, {
412
+ }, labelText), title && title.length && renderTitle()), /*#__PURE__*/_react.default.createElement("div", {
413
+ className: "".concat(blockClass, "__slug-and-close")
414
+ }, normalizedSlug, /*#__PURE__*/_react.default.createElement(_react2.Button, {
402
415
  "aria-label": closeIconDescription,
403
416
  kind: "ghost",
404
417
  size: "sm",
@@ -411,7 +424,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
411
424
  className: "".concat(blockClass, "__close-button"),
412
425
  onClick: onRequestClose,
413
426
  ref: sidePanelCloseRef
414
- }), subtitle && /*#__PURE__*/_react.default.createElement("p", {
427
+ })), subtitle && /*#__PURE__*/_react.default.createElement("p", {
415
428
  className: (0, _classnames.default)("".concat(blockClass, "__subtitle-text"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-no-animation"), !animateTitle), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !animateTitle && (!actionToolbarButtons || !actionToolbarButtons.length)), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-text-is-animating"), !animationComplete && animateTitle), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__subtitle-without-title"), !title), _cx2))
416
429
  }, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/_react.default.createElement("div", {
417
430
  className: (0, _classnames.default)("".concat(blockClass, "__action-toolbar"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
@@ -455,7 +468,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
455
468
  var contentRef = ref || sidePanelRef;
456
469
  (0, _useResizeObserver.useResizeObserver)(contentRef, handleResize);
457
470
  return /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, open && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, (0, _extends2.default)({}, (0, _devtools.getDevtoolsProps)(componentName), rest, {
458
- id: "".concat(blockClass, "-outer"),
471
+ id: id,
459
472
  className: mainPanelClassNames,
460
473
  onBlur: handleBlur,
461
474
  ref: contentRef,
@@ -563,6 +576,10 @@ SidePanel.propTypes = {
563
576
  * Sets the current step of the side panel
564
577
  */
565
578
  currentStep: _propTypes.default.number,
579
+ /**
580
+ * Unique identifier
581
+ */
582
+ id: _propTypes.default.string,
566
583
  /**
567
584
  * Determines whether the side panel should render with an overlay
568
585
  */
@@ -622,6 +639,10 @@ SidePanel.propTypes = {
622
639
  * Determines if this panel slides in
623
640
  */
624
641
  slideIn: _propTypes.default.bool,
642
+ /**
643
+ * Provide a `Slug` component to be rendered inside the `SidePanel` component
644
+ */
645
+ slug: _propTypes.default.node,
625
646
  /**
626
647
  * Sets the subtitle text
627
648
  */