@carbon/ibm-products 2.17.2 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/css/index-full-carbon.css +13188 -12116
  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 +5 -2
  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 +5710 -6367
  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 +5 -2
  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/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +4 -3
  23. package/es/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +7 -1
  24. package/es/components/Datagrid/utils/handleFilterTagLabelText.js +26 -0
  25. package/es/components/FilterSummary/FilterSummary.js +21 -7
  26. package/es/components/Guidebanner/Guidebanner.docs-page.js +15 -0
  27. package/es/components/Guidebanner/Guidebanner.js +221 -0
  28. package/es/components/Guidebanner/GuidebannerElement.js +72 -0
  29. package/es/components/Guidebanner/GuidebannerElementButton.js +80 -0
  30. package/es/components/Guidebanner/GuidebannerElementLink.js +57 -0
  31. package/es/components/Guidebanner/index.js +11 -0
  32. package/es/components/NonLinearReading/NonLinearReading.docs-page.js +15 -0
  33. package/es/components/NonLinearReading/NonLinearReading.js +89 -0
  34. package/es/components/NonLinearReading/index.js +8 -0
  35. package/es/components/SidePanel/SidePanel.js +9 -8
  36. package/es/components/TagSet/TagSet.js +22 -5
  37. package/es/components/WebTerminal/WebTerminal.js +5 -3
  38. package/es/global/js/package-settings.js +6 -1
  39. package/lib/components/Carousel/Carousel.docs-page.js +21 -0
  40. package/lib/components/Carousel/Carousel.js +329 -0
  41. package/lib/components/Carousel/CarouselItem.js +54 -0
  42. package/lib/components/Carousel/index.js +19 -0
  43. package/lib/components/Carousel/utils.js +105 -0
  44. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +4 -3
  45. package/lib/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +7 -1
  46. package/lib/components/Datagrid/utils/handleFilterTagLabelText.js +32 -0
  47. package/lib/components/FilterSummary/FilterSummary.js +24 -7
  48. package/lib/components/Guidebanner/Guidebanner.docs-page.js +25 -0
  49. package/lib/components/Guidebanner/Guidebanner.js +229 -0
  50. package/lib/components/Guidebanner/GuidebannerElement.js +77 -0
  51. package/lib/components/Guidebanner/GuidebannerElementButton.js +85 -0
  52. package/lib/components/Guidebanner/GuidebannerElementLink.js +62 -0
  53. package/lib/components/Guidebanner/index.js +33 -0
  54. package/lib/components/NonLinearReading/NonLinearReading.docs-page.js +25 -0
  55. package/lib/components/NonLinearReading/NonLinearReading.js +97 -0
  56. package/lib/components/NonLinearReading/index.js +12 -0
  57. package/lib/components/SidePanel/SidePanel.js +9 -8
  58. package/lib/components/TagSet/TagSet.js +22 -5
  59. package/lib/components/WebTerminal/WebTerminal.js +4 -2
  60. package/lib/global/js/package-settings.js +6 -1
  61. package/package.json +3 -3
  62. package/scss/components/Carousel/_carbon-imports.scss +6 -0
  63. package/scss/components/Carousel/_carousel.scss +72 -0
  64. package/scss/components/Carousel/_index-with-carbon.scss +9 -0
  65. package/scss/components/Carousel/_index.scss +8 -0
  66. package/scss/components/FilterSummary/_filter-summary.scss +6 -1
  67. package/scss/components/Guidebanner/_carbon-imports.scss +6 -0
  68. package/scss/components/Guidebanner/_guidebanner.scss +248 -0
  69. package/scss/components/Guidebanner/_index-with-carbon.scss +9 -0
  70. package/scss/components/Guidebanner/_index.scss +8 -0
  71. package/scss/components/NonLinearReading/_carbon-imports.scss +6 -0
  72. package/scss/components/NonLinearReading/_index-with-carbon.scss +9 -0
  73. package/scss/components/NonLinearReading/_index.scss +8 -0
  74. package/scss/components/NonLinearReading/_non-linear-reading.scss +122 -0
  75. package/scss/components/WebTerminal/_web-terminal.scss +1 -2
  76. package/scss/components/_Canary/_canary.scss +1 -2
  77. package/scss/components/_Canary/_carbon-imports.scss +7 -0
  78. package/scss/components/_Canary/_index-with-carbon.scss +8 -0
  79. package/scss/components/_Canary/_index.scss +7 -0
  80. package/scss/components/_index-with-carbon.scss +1 -1
  81. package/scss/components/_index.scss +5 -2
  82. /package/es/components/Datagrid/{Extensions → Datagrid.stories}/ColumnAlignment/ColumnAlignment.docs-page.js +0 -0
  83. /package/lib/components/Datagrid/{Extensions → Datagrid.stories}/ColumnAlignment/ColumnAlignment.docs-page.js +0 -0
@@ -0,0 +1,221 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["children", "className", "collapsible", "onClose", "closeIconDescription", "collapseButtonLabel", "expandButtonLabel", "nextIconDescription", "previousIconDescription", "title"];
5
+ /**
6
+ * Copyright IBM Corp. 2023, 2023
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+ // Import portions of React that are needed.
13
+ import React, { useRef, useState } from 'react';
14
+ import PropTypes from 'prop-types';
15
+ import cx from 'classnames';
16
+ import { blue90, purple70 } from '@carbon/colors';
17
+ import { CaretLeft, CaretRight, Close, Idea } from '@carbon/react/icons';
18
+ import { Button, IconButton } from '@carbon/react';
19
+ import { Carousel } from '../Carousel';
20
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
21
+ import { pkg } from '../../settings';
22
+
23
+ // The block part of our conventional BEM class names (blockClass__E--M).
24
+ var blockClass = "".concat(pkg.prefix, "--guidebanner");
25
+ var componentName = 'Guidebanner';
26
+ var defaults = {
27
+ collapsible: false,
28
+ // Labels
29
+ closeIconDescription: 'Close',
30
+ collapseButtonLabel: 'Read less',
31
+ expandButtonLabel: 'Read more',
32
+ nextIconDescription: 'Next',
33
+ previousIconDescription: 'Back'
34
+ };
35
+
36
+ /**
37
+ * The guide banner sits at the top of a page, or page-level tab,
38
+ * to introduce foundational concepts related to the page's content.
39
+ */
40
+ export var Guidebanner = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41
+ var children = _ref.children,
42
+ className = _ref.className,
43
+ _ref$collapsible = _ref.collapsible,
44
+ collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
45
+ onClose = _ref.onClose,
46
+ _ref$closeIconDescrip = _ref.closeIconDescription,
47
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
48
+ _ref$collapseButtonLa = _ref.collapseButtonLabel,
49
+ collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
50
+ _ref$expandButtonLabe = _ref.expandButtonLabel,
51
+ expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
52
+ _ref$nextIconDescript = _ref.nextIconDescription,
53
+ nextIconDescription = _ref$nextIconDescript === void 0 ? defaults.nextIconDescription : _ref$nextIconDescript,
54
+ _ref$previousIconDesc = _ref.previousIconDescription,
55
+ previousIconDescription = _ref$previousIconDesc === void 0 ? defaults.previousIconDescription : _ref$previousIconDesc,
56
+ title = _ref.title,
57
+ rest = _objectWithoutProperties(_ref, _excluded);
58
+ var scrollRef = useRef();
59
+ var toggleRef = useRef();
60
+ var _useState = useState(0),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ scrollPosition = _useState2[0],
63
+ setScrollPosition = _useState2[1];
64
+ var _useState3 = useState(false),
65
+ _useState4 = _slicedToArray(_useState3, 2),
66
+ showNavigation = _useState4[0],
67
+ setShowNavigation = _useState4[1];
68
+ var _useState5 = useState(collapsible ? true : false),
69
+ _useState6 = _slicedToArray(_useState5, 2),
70
+ isCollapsed = _useState6[0],
71
+ setIsCollapsed = _useState6[1];
72
+ var handleClickToggle = function handleClickToggle() {
73
+ setIsCollapsed(function (prevState) {
74
+ return !prevState;
75
+ });
76
+ };
77
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
78
+ "aria-expanded": !isCollapsed,
79
+ className: cx(blockClass, className, [collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null]),
80
+ ref: ref
81
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Idea, {
82
+ size: 20,
83
+ className: "".concat(blockClass, "__icon-idea")
84
+ }), /*#__PURE__*/React.createElement("div", {
85
+ className: "".concat(blockClass, "__title")
86
+ }, title), /*#__PURE__*/React.createElement(Carousel, {
87
+ className: "".concat(blockClass, "__carousel")
88
+ // These colors are to match the Carousel's faded edges
89
+ // against the Guidebanner's gradient background.
90
+ ,
91
+ fadedEdgeColor: {
92
+ left: blue90,
93
+ right: purple70
94
+ },
95
+ ref: scrollRef,
96
+ onChangeIsScrollable: function onChangeIsScrollable(value) {
97
+ setShowNavigation(value);
98
+ },
99
+ onScroll: function onScroll(scrollPercent) {
100
+ setScrollPosition(scrollPercent);
101
+ }
102
+ }, children), /*#__PURE__*/React.createElement("div", {
103
+ className: cx([collapsible || showNavigation ? "".concat(blockClass, "__navigation") : null])
104
+ }, collapsible && /*#__PURE__*/React.createElement(Button, {
105
+ kind: "ghost",
106
+ size: "md",
107
+ className: "".concat(blockClass, "__toggle-button"),
108
+ onClick: handleClickToggle,
109
+ ref: toggleRef
110
+ }, isCollapsed ? expandButtonLabel : collapseButtonLabel), showNavigation && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
111
+ className: cx("".concat(blockClass, "__back-button"), [scrollPosition === 0 ? "".concat(blockClass, "__back-button--disabled") : null])
112
+ }, /*#__PURE__*/React.createElement(IconButton, {
113
+ align: "top",
114
+ disabled: scrollPosition === 0,
115
+ kind: "ghost",
116
+ label: previousIconDescription,
117
+ onClick: function onClick() {
118
+ scrollRef.current.scrollPrev();
119
+ },
120
+ size: "md"
121
+ }, /*#__PURE__*/React.createElement(CaretLeft, {
122
+ size: 16
123
+ }))), /*#__PURE__*/React.createElement("span", {
124
+ className: cx("".concat(blockClass, "__next-button"), [scrollPosition === 1 ? "".concat(blockClass, "__next-button--disabled") : null])
125
+ }, /*#__PURE__*/React.createElement(IconButton, {
126
+ align: "top-right",
127
+ disabled: scrollPosition === 1,
128
+ kind: "ghost",
129
+ label: nextIconDescription,
130
+ onClick: function onClick() {
131
+ scrollRef.current.scrollNext();
132
+ },
133
+ size: "md"
134
+ }, /*#__PURE__*/React.createElement(CaretRight, {
135
+ size: 16
136
+ }))))), onClose && /*#__PURE__*/React.createElement("span", {
137
+ className: "".concat(blockClass, "__close-button")
138
+ }, /*#__PURE__*/React.createElement(IconButton, {
139
+ align: "bottom-right",
140
+ kind: "ghost",
141
+ label: closeIconDescription,
142
+ onClick: onClose,
143
+ size: "md"
144
+ }, /*#__PURE__*/React.createElement(Close, {
145
+ size: 16
146
+ }))));
147
+ });
148
+
149
+ // Return a placeholder if not released and not enabled by feature flag
150
+ Guidebanner = pkg.checkComponentEnabled(Guidebanner, componentName);
151
+
152
+ // The display name of the component, used by React. Note that displayName
153
+ // is used in preference to relying on function.name.
154
+ Guidebanner.displayName = componentName;
155
+
156
+ // The types and DocGen commentary for the component props,
157
+ // in alphabetical order (for consistency).
158
+ // See https://www.npmjs.com/package/prop-types#usage.
159
+ Guidebanner.propTypes = {
160
+ /**
161
+ * Provide the contents of the Guidebanner.
162
+ * One or more GuidebannerElement components are required.
163
+ */
164
+ children: function children(props, propName) {
165
+ var error;
166
+ var prop = props[propName];
167
+ if (!prop) {
168
+ error = new Error('`Guidebanner` requires one or more children of type `GuidebannerElement`.');
169
+ }
170
+ React.Children.forEach(prop, function (child) {
171
+ if (child.type.displayName !== 'GuidebannerElement') {
172
+ var _child$type, _child$type2;
173
+ // If not GuidebannerElement, then show:
174
+ // React component name(child.type?.name) or
175
+ // HTML element name(child.type).
176
+ error = new Error("`Guidebanner` only accepts children of type `GuidebannerElement`, found `".concat(((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) || ((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.name) || child.type, "` instead."));
177
+ }
178
+ });
179
+ return error;
180
+ },
181
+ /**
182
+ * Provide an optional class to be applied to the containing node.
183
+ */
184
+ className: PropTypes.string,
185
+ /**
186
+ * Tooltip text and aria label for the Close button icon.
187
+ */
188
+ closeIconDescription: PropTypes.string,
189
+ /**
190
+ * Text label for the Collapse button.
191
+ */
192
+ collapseButtonLabel: PropTypes.string,
193
+ /**
194
+ * When true, the Guidebanner will initialize in a collapsed state,
195
+ * showing the title and the Expand button.
196
+ *
197
+ * When expanded, it will show the GuidebannerElement child components and the Collapse button.
198
+ */
199
+ collapsible: PropTypes.bool,
200
+ /**
201
+ * Text label for the Expand button.
202
+ */
203
+ expandButtonLabel: PropTypes.string,
204
+ /**
205
+ * Tooltip text and aria label for the Next button icon.
206
+ */
207
+ nextIconDescription: PropTypes.string,
208
+ /**
209
+ * If defined, a Close button will render in the top-right corner and a
210
+ * callback function will be triggered when button is clicked.
211
+ */
212
+ onClose: PropTypes.func,
213
+ /**
214
+ * Tooltip text and aria label for the Back button icon.
215
+ */
216
+ previousIconDescription: PropTypes.string,
217
+ /**
218
+ * Title text.
219
+ */
220
+ title: PropTypes.string.isRequired
221
+ };
@@ -0,0 +1,72 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["button", "className", "description", "title"];
4
+ /**
5
+ * Copyright IBM Corp. 2023, 2023
6
+ *
7
+ * This source code is licensed under the Apache-2.0 license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ // Import portions of React that are needed.
12
+ import React from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import cx from 'classnames';
15
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
16
+ import { pkg } from '../../settings';
17
+
18
+ // The block part of our conventional BEM class names (blockClass__E--M).
19
+ var blockClass = "".concat(pkg.prefix, "--guidebanner__element");
20
+ var componentName = 'GuidebannerElement';
21
+
22
+ /**
23
+ * The GuidebannerElement is a required child component of the Guidebanner,
24
+ * and acts as a container for a CarouselItem.
25
+ */
26
+ export var GuidebannerElement = function GuidebannerElement(_ref) {
27
+ var button = _ref.button,
28
+ className = _ref.className,
29
+ description = _ref.description,
30
+ title = _ref.title,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
33
+ className: cx(blockClass, className)
34
+ }, getDevtoolsProps(componentName)), title && /*#__PURE__*/React.createElement("h2", {
35
+ className: "".concat(blockClass, "-title")
36
+ }, title), description && /*#__PURE__*/React.createElement("p", {
37
+ className: "".concat(blockClass, "-content")
38
+ }, description), button && /*#__PURE__*/React.createElement("div", {
39
+ className: "".concat(blockClass, "-buttons")
40
+ }, button));
41
+ };
42
+
43
+ // Return a placeholder if not released and not enabled by feature flag
44
+ GuidebannerElement = pkg.checkComponentEnabled(GuidebannerElement, 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
+ GuidebannerElement.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
+ GuidebannerElement.propTypes = {
54
+ /**
55
+ * An optional button can be rendered below the description.
56
+ * This can be a link, button, Coachmark button, etc.
57
+ */
58
+ button: PropTypes.node,
59
+ /**
60
+ * Provide an optional class to be applied to the containing node.
61
+ */
62
+ className: PropTypes.string,
63
+ /**
64
+ * The description of the element.
65
+ */
66
+
67
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
68
+ /**
69
+ * The title of the element.
70
+ */
71
+ title: PropTypes.string
72
+ };
@@ -0,0 +1,80 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "className", "type"];
4
+ /**
5
+ * Copyright IBM Corp. 2023, 2023
6
+ *
7
+ * This source code is licensed under the Apache-2.0 license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ // Import portions of React that are needed.
12
+ import React from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import cx from 'classnames';
15
+ import { Button } from '@carbon/react';
16
+ import { Crossroads } from '@carbon/react/icons';
17
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
18
+ import { pkg } from '../../settings';
19
+
20
+ // The block part of our conventional BEM class names (blockClass__E--M).
21
+ var blockClass = "".concat(pkg.prefix, "--guidebanner__element-button");
22
+ var componentName = 'GuidebannerElementButton';
23
+
24
+ /**
25
+ * One of two buttons styled specifically for the GuidebannerElement.
26
+ */
27
+ export var GuidebannerElementButton = function GuidebannerElementButton(_ref) {
28
+ var children = _ref.children,
29
+ className = _ref.className,
30
+ type = _ref.type,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+ if (type === 'primary') {
33
+ return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
34
+ className: cx(blockClass, className),
35
+ iconDescription: 'Crossroads',
36
+ kind: "tertiary",
37
+ renderIcon: function renderIcon() {
38
+ return /*#__PURE__*/React.createElement(Crossroads, {
39
+ size: 16
40
+ });
41
+ },
42
+ role: "button",
43
+ size: "md"
44
+ }, getDevtoolsProps(componentName)), children);
45
+ }
46
+ return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
47
+ className: cx(blockClass, className),
48
+ kind: "ghost",
49
+ role: "button",
50
+ size: "md"
51
+ }, getDevtoolsProps(componentName)), children);
52
+ };
53
+
54
+ // Return a placeholder if not released and not enabled by feature flag
55
+ GuidebannerElementButton = pkg.checkComponentEnabled(GuidebannerElementButton, componentName);
56
+
57
+ // The display name of the component, used by React. Note that displayName
58
+ // is used in preference to relying on function.name.
59
+ GuidebannerElementButton.displayName = componentName;
60
+
61
+ // The types and DocGen commentary for the component props,
62
+ // in alphabetical order (for consistency).
63
+ // See https://www.npmjs.com/package/prop-types#usage.
64
+ GuidebannerElementButton.propTypes = {
65
+ /**
66
+ * Provide the contents of the GuidebannerElementButton.
67
+ */
68
+ children: PropTypes.node.isRequired,
69
+ /**
70
+ * Provide an optional class to be applied to the containing node.
71
+ */
72
+ className: PropTypes.string,
73
+ /**
74
+ * If type is "primary", then return a tertiary button with the "crossroads" icon,
75
+ * else return a ghost button.
76
+ */
77
+ type: PropTypes.string
78
+
79
+ /* TODO: add types and DocGen for all props. */
80
+ };
@@ -0,0 +1,57 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "className"];
4
+ /**
5
+ * Copyright IBM Corp. 2023, 2023
6
+ *
7
+ * This source code is licensed under the Apache-2.0 license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ // Import portions of React that are needed.
12
+ import React from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import cx from 'classnames';
15
+ import { Link } from '@carbon/react';
16
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
17
+ import { pkg } from '../../settings';
18
+
19
+ // The block part of our conventional BEM class names (blockClass__E--M).
20
+ var blockClass = "".concat(pkg.prefix, "--guidebanner__element-link");
21
+ var componentName = 'GuidebannerElementLink';
22
+
23
+ /**
24
+ * A link styled specifically for the GuidebannerElement.
25
+ */
26
+ export var GuidebannerElementLink = function GuidebannerElementLink(_ref) {
27
+ var children = _ref.children,
28
+ className = _ref.className,
29
+ rest = _objectWithoutProperties(_ref, _excluded);
30
+ return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
31
+ className: cx(blockClass, className),
32
+ kind: "ghost",
33
+ role: "link",
34
+ size: "md"
35
+ }, getDevtoolsProps(componentName)), children);
36
+ };
37
+
38
+ // Return a placeholder if not released and not enabled by feature flag
39
+ GuidebannerElementLink = pkg.checkComponentEnabled(GuidebannerElementLink, componentName);
40
+
41
+ // The display name of the component, used by React. Note that displayName
42
+ // is used in preference to relying on function.name.
43
+ GuidebannerElementLink.displayName = componentName;
44
+
45
+ // The types and DocGen commentary for the component props,
46
+ // in alphabetical order (for consistency).
47
+ // See https://www.npmjs.com/package/prop-types#usage.
48
+ GuidebannerElementLink.propTypes = {
49
+ /**
50
+ * Provide the contents of the GuidebannerElementLink.
51
+ */
52
+ children: PropTypes.node.isRequired,
53
+ /**
54
+ * Provide an optional class to be applied to the containing node.
55
+ */
56
+ className: PropTypes.string
57
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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
+ export { Guidebanner } from './Guidebanner';
9
+ export { GuidebannerElement } from './GuidebannerElement';
10
+ export { GuidebannerElementButton } from './GuidebannerElementButton';
11
+ export { GuidebannerElementLink } from './GuidebannerElementLink';
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './NonLinearReading.stories';
4
+ var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ story: stories.singleLevel
8
+ }, {
9
+ story: stories.multipleLevel
10
+ }, {
11
+ story: stories.withGradientBackground
12
+ }]
13
+ });
14
+ };
15
+ export default DocsPage;
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["children", "className", "definition", "theme"];
5
+ /**
6
+ * Copyright IBM Corp. 2023, 2023
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+ import React, { useRef, useState } from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import cx from 'classnames';
15
+ import { ChevronDown } from '@carbon/react/icons';
16
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
17
+ import uuidv4 from '../../global/js/utils/uuidv4';
18
+ import { pkg } from '../../settings';
19
+
20
+ // The block part of our conventional BEM class names (blockClass__E--M).
21
+ var blockClass = "".concat(pkg.prefix, "--non-linear-reading");
22
+ var componentName = 'NonLinearReading';
23
+
24
+ // Default values for props
25
+ var defaults = {
26
+ theme: 'light'
27
+ };
28
+
29
+ /**
30
+ * Use non-linear reading when space is limited to share a
31
+ * brief, at-a-glance, summary of a concept that may require
32
+ * more explanation for some users.
33
+ */
34
+ export var NonLinearReading = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
35
+ var children = _ref.children,
36
+ className = _ref.className,
37
+ definition = _ref.definition,
38
+ _ref$theme = _ref.theme,
39
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
40
+ rest = _objectWithoutProperties(_ref, _excluded);
41
+ var _useState = useState(false),
42
+ _useState2 = _slicedToArray(_useState, 2),
43
+ isOpen = _useState2[0],
44
+ setOpen = _useState2[1];
45
+ var contentId = useRef(uuidv4()).current;
46
+ var handleToggle = function handleToggle() {
47
+ setOpen(function (prevState) {
48
+ return !prevState;
49
+ });
50
+ };
51
+ return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
52
+ className: cx(blockClass, "".concat(blockClass, "__").concat(theme), className),
53
+ ref: ref
54
+ }, getDevtoolsProps(componentName)), ' ', /*#__PURE__*/React.createElement("button", {
55
+ type: "button",
56
+ "aria-controls": contentId,
57
+ "aria-expanded": isOpen,
58
+ className: cx("".concat(blockClass, "__keyword"), [isOpen ? ["".concat(blockClass, "__keyword-open")] : ["".concat(blockClass, "__keyword-closed")]]),
59
+ onClick: handleToggle
60
+ }, children, /*#__PURE__*/React.createElement(ChevronDown, {
61
+ size: 16
62
+ })), ' ', /*#__PURE__*/React.createElement("span", {
63
+ id: contentId,
64
+ className: "".concat(blockClass, "__body"),
65
+ hidden: !isOpen
66
+ }, isOpen && definition), ' ');
67
+ });
68
+
69
+ // Return a placeholder if not released and not enabled by feature flag
70
+ NonLinearReading = pkg.checkComponentEnabled(NonLinearReading, componentName);
71
+ NonLinearReading.displayName = componentName;
72
+ NonLinearReading.propTypes = {
73
+ /**
74
+ * The keyword of the component appears as a pill.
75
+ */
76
+ children: PropTypes.node.isRequired,
77
+ /**
78
+ * Provide an optional class to be applied to the containing node.
79
+ */
80
+ className: PropTypes.string,
81
+ /**
82
+ * The content that appears when the keyword is toggled open.
83
+ */
84
+ definition: PropTypes.node.isRequired,
85
+ /**
86
+ * Determines the theme of the component.
87
+ */
88
+ theme: PropTypes.oneOf(['light', 'dark'])
89
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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
+ export { NonLinearReading } from './NonLinearReading';
@@ -329,9 +329,9 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
329
329
  if (!open && slideIn) {
330
330
  var pageContentElement = document.querySelector(selectorPageContent);
331
331
  if (placement && placement === 'right' && pageContentElement) {
332
- pageContentElement.style.marginRight = 0;
332
+ pageContentElement.style.marginInlineEnd = 0;
333
333
  } else if (pageContentElement) {
334
- pageContentElement.style.marginLeft = 0;
334
+ pageContentElement.style.marginInlineStart = 0;
335
335
  }
336
336
  }
337
337
  }, [open, placement, selectorPageContent, slideIn]);
@@ -345,14 +345,15 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
345
345
  useEffect(function () {
346
346
  if (open && slideIn) {
347
347
  var pageContentElement = document.querySelector(selectorPageContent);
348
+ pageContentElement.style.inlineSize = 'auto';
348
349
  if (placement && placement === 'right' && pageContentElement) {
349
- pageContentElement.style.marginRight = 0;
350
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-right ".concat(moderate02) : null;
351
- pageContentElement.style.marginRight = SIDE_PANEL_SIZES[size];
350
+ pageContentElement.style.marginInlineEnd = 0;
351
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(moderate02) : null;
352
+ pageContentElement.style.marginInlineEnd = SIDE_PANEL_SIZES[size];
352
353
  } else if (pageContentElement) {
353
- pageContentElement.style.marginLeft = 0;
354
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-left ".concat(moderate02) : null;
355
- pageContentElement.style.marginLeft = SIDE_PANEL_SIZES[size];
354
+ pageContentElement.style.marginInlineStart = 0;
355
+ pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(moderate02) : null;
356
+ pageContentElement.style.marginInlineStart = SIDE_PANEL_SIZES[size];
356
357
  }
357
358
  }
358
359
  }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]);