@carbon/ibm-products 1.54.2 → 1.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/css/index-full-carbon.css +1312 -108
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +1200 -1
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +2 -2
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +1310 -106
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +3 -3
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/APIKeyModal/APIKeyModal.js +25 -21
  14. package/es/components/ActionBar/ActionBar.js +5 -5
  15. package/es/components/Carousel/Carousel.js +237 -0
  16. package/es/components/Carousel/CarouselItem.js +66 -0
  17. package/es/components/Carousel/index.js +9 -0
  18. package/es/components/Carousel/utils.js +98 -0
  19. package/es/components/CreateFullPage/CreateFullPage.js +4 -2
  20. package/es/components/CreateModal/CreateModal.js +2 -1
  21. package/es/components/CreateSidePanel/CreateSidePanel.js +6 -2
  22. package/es/components/CreateTearsheet/CreateTearsheet.js +3 -1
  23. package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
  24. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  25. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  26. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +2 -1
  27. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +13 -0
  28. package/es/components/Datagrid/index.js +2 -1
  29. package/es/components/Datagrid/useActionsColumn.js +13 -7
  30. package/es/components/Datagrid/useOnRowClick.js +20 -4
  31. package/es/components/Datagrid/useSortableColumns.js +27 -3
  32. package/es/components/Datagrid/utils/DatagridActions.js +6 -6
  33. package/es/components/Datagrid/utils/getArgTypes.js +4 -0
  34. package/es/components/EditSidePanel/EditSidePanel.js +7 -3
  35. package/es/components/FilterSummary/FilterSummary.js +7 -3
  36. package/es/components/Guidebanner/Guidebanner.js +229 -0
  37. package/es/components/Guidebanner/GuidebannerElement.js +71 -0
  38. package/es/components/Guidebanner/GuidebannerElementButton.js +76 -0
  39. package/es/components/Guidebanner/GuidebannerElementLink.js +56 -0
  40. package/es/components/Guidebanner/index.js +11 -0
  41. package/es/components/InlineTip/InlineTip.js +228 -0
  42. package/es/components/InlineTip/InlineTipButton.js +89 -0
  43. package/es/components/InlineTip/InlineTipLink.js +89 -0
  44. package/es/components/InlineTip/index.js +10 -0
  45. package/es/components/InlineTip/utils.js +36 -0
  46. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +164 -0
  47. package/es/components/SteppedAnimatedMedia/assets/index.js +4 -0
  48. package/es/components/SteppedAnimatedMedia/index.js +8 -0
  49. package/es/components/Tearsheet/TearsheetShell.js +2 -1
  50. package/es/components/index.js +4 -2
  51. package/es/global/js/hooks/useResizeObserver.js +1 -1
  52. package/es/global/js/package-settings.js +2 -0
  53. package/lib/components/APIKeyModal/APIKeyModal.js +25 -21
  54. package/lib/components/ActionBar/ActionBar.js +5 -5
  55. package/lib/components/Carousel/Carousel.js +238 -0
  56. package/lib/components/Carousel/CarouselItem.js +66 -0
  57. package/lib/components/Carousel/index.js +19 -0
  58. package/lib/components/Carousel/utils.js +108 -0
  59. package/lib/components/CreateFullPage/CreateFullPage.js +4 -2
  60. package/lib/components/CreateModal/CreateModal.js +2 -1
  61. package/lib/components/CreateSidePanel/CreateSidePanel.js +6 -2
  62. package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -1
  63. package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
  64. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  65. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  66. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +8 -1
  67. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +20 -0
  68. package/lib/components/Datagrid/index.js +8 -1
  69. package/lib/components/Datagrid/useActionsColumn.js +13 -7
  70. package/lib/components/Datagrid/useOnRowClick.js +20 -4
  71. package/lib/components/Datagrid/useSortableColumns.js +27 -3
  72. package/lib/components/Datagrid/utils/DatagridActions.js +6 -6
  73. package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
  74. package/lib/components/EditSidePanel/EditSidePanel.js +7 -3
  75. package/lib/components/FilterSummary/FilterSummary.js +7 -3
  76. package/lib/components/Guidebanner/Guidebanner.js +229 -0
  77. package/lib/components/Guidebanner/GuidebannerElement.js +67 -0
  78. package/lib/components/Guidebanner/GuidebannerElementButton.js +71 -0
  79. package/lib/components/Guidebanner/GuidebannerElementLink.js +52 -0
  80. package/lib/components/Guidebanner/index.js +33 -0
  81. package/lib/components/InlineTip/InlineTip.js +228 -0
  82. package/lib/components/InlineTip/InlineTipButton.js +86 -0
  83. package/lib/components/InlineTip/InlineTipLink.js +86 -0
  84. package/lib/components/InlineTip/index.js +26 -0
  85. package/lib/components/InlineTip/utils.js +44 -0
  86. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +165 -0
  87. package/lib/components/SteppedAnimatedMedia/assets/index.js +12 -0
  88. package/lib/components/SteppedAnimatedMedia/index.js +12 -0
  89. package/lib/components/Tearsheet/TearsheetShell.js +2 -1
  90. package/lib/components/index.js +21 -1
  91. package/lib/global/js/hooks/useResizeObserver.js +1 -1
  92. package/lib/global/js/package-settings.js +2 -0
  93. package/package.json +5 -5
  94. package/scss/components/Carousel/_carousel.scss +80 -0
  95. package/scss/components/Carousel/_index.scss +8 -0
  96. package/scss/components/Carousel/_storybook-styles.scss +10 -0
  97. package/scss/components/Datagrid/_storybook-styles.scss +5 -0
  98. package/scss/components/Datagrid/styles/_datagrid.scss +1 -1
  99. package/scss/components/Guidebanner/_guidebanner.scss +257 -0
  100. package/scss/components/Guidebanner/_index.scss +8 -0
  101. package/scss/components/Guidebanner/_storybook-styles.scss +20 -0
  102. package/scss/components/InlineTip/_index.scss +8 -0
  103. package/scss/components/InlineTip/_inline-tip.scss +231 -0
  104. package/scss/components/InlineTip/_storybook-styles.scss +21 -0
  105. package/scss/components/SteppedAnimatedMedia/_index.scss +8 -0
  106. package/scss/components/SteppedAnimatedMedia/_stepped-animated-media.scss +34 -0
  107. package/scss/components/SteppedAnimatedMedia/_storybook-styles.scss +12 -0
  108. package/scss/components/_index.scss +4 -0
@@ -6,6 +6,7 @@
6
6
  * restricted by GSA ADP Schedule Contract with IBM Corp.
7
7
  */
8
8
 
9
+ import { pkg, carbon } from '../../settings';
9
10
  var useOnRowClick = function useOnRowClick(hooks) {
10
11
  var useInstance = function useInstance(rowInstance) {
11
12
  var onRowClick = rowInstance.onRowClick;
@@ -15,13 +16,28 @@ var useOnRowClick = function useOnRowClick(hooks) {
15
16
  instance = datagridState.instance;
16
17
  var id = row.id,
17
18
  toggleRowSelected = row.toggleRowSelected;
19
+ var withSelectRows = instance.withSelectRows,
20
+ tableId = instance.tableId;
18
21
  var onClick = function onClick(event) {
19
22
  if (!isFetching && onRowClick) {
20
23
  onRowClick(row, event);
21
- instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
22
- return toggleRow.toggleRowSelected(false);
23
- });
24
- toggleRowSelected(id, true);
24
+ // We do not want to change the list of selected rows if using the useSelectedRows hook, otherwise clicking on an entire row will mark the row as checked
25
+
26
+ // Remove selected class from all other clickable rows as only one clickable row can be selected at a time
27
+ var clickableSelectedRows = document.querySelectorAll("#".concat(tableId, ".").concat(pkg.prefix, "--datagrid .").concat(carbon.prefix, "--data-table--selected:not(.").concat(pkg.prefix, "--datagrid__active-row)"));
28
+ if (clickableSelectedRows.length) {
29
+ Array.from(clickableSelectedRows).forEach(function (row) {
30
+ row.classList.remove("".concat(carbon.prefix, "--data-table--selected"));
31
+ });
32
+ }
33
+ var closestRow = event.target.closest(".".concat(pkg.prefix, "--datagrid__carbon-row"));
34
+ closestRow.classList.add("".concat(carbon.prefix, "--data-table--selected"));
35
+ if (!withSelectRows) {
36
+ instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
37
+ return toggleRow.toggleRowSelected(false);
38
+ });
39
+ toggleRowSelected(id, true);
40
+ }
25
41
  }
26
42
  };
27
43
  var onKeyDown = function onKeyDown(event) {
@@ -20,11 +20,30 @@ var ordering = {
20
20
  DESC: 'DESC',
21
21
  NONE: 'NONE'
22
22
  };
23
+ var getAriaSortValue = function getAriaSortValue(col, _ref) {
24
+ var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
25
+ descendingSortableLabelText = _ref.descendingSortableLabelText,
26
+ defaultSortableLabelText = _ref.defaultSortableLabelText;
27
+ var isSorted = col.isSorted,
28
+ isSortedDesc = col.isSortedDesc;
29
+ if (!isSorted) {
30
+ return defaultSortableLabelText || 'none';
31
+ }
32
+ if (isSorted && !isSortedDesc) {
33
+ return ascendingSortableLabelText || 'ascending';
34
+ }
35
+ if (isSorted && isSortedDesc) {
36
+ return descendingSortableLabelText || 'descending';
37
+ }
38
+ };
23
39
  var useSortableColumns = function useSortableColumns(hooks) {
24
- var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
40
+ var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref2) {
25
41
  var _instance$customizeCo;
26
- var instance = _ref.instance;
27
- var onSort = instance.onSort;
42
+ var instance = _ref2.instance;
43
+ var onSort = instance.onSort,
44
+ ascendingSortableLabelText = instance.ascendingSortableLabelText,
45
+ descendingSortableLabelText = instance.descendingSortableLabelText,
46
+ defaultSortableLabelText = instance.defaultSortableLabelText;
28
47
  var onSortClick = function onSortClick(column) {
29
48
  var key = column.id;
30
49
  var sortDesc = column.isSortedDesc;
@@ -69,6 +88,11 @@ var useSortableColumns = function useSortableColumns(hooks) {
69
88
  var Header = function Header(headerProp) {
70
89
  var _cx;
71
90
  return column.disableSortBy === true ? column.Header : /*#__PURE__*/React.createElement(Button, {
91
+ "aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
92
+ ascendingSortableLabelText: ascendingSortableLabelText,
93
+ descendingSortableLabelText: descendingSortableLabelText,
94
+ defaultSortableLabelText: defaultSortableLabelText
95
+ }),
72
96
  onClick: function onClick() {
73
97
  return onSortClick(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column);
74
98
  },
@@ -6,17 +6,17 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
 
9
- import React, { useLayoutEffect, useMemo, useContext, useState } from 'react';
10
- import { Button, DataTable, OverflowMenu, OverflowMenuItem, ComposedModal, ModalBody, ModalFooter, ModalHeader, Dropdown } from 'carbon-components-react';
11
9
  import { Add16, ChevronDown16, Download16, Filter16, Restart16 } from '@carbon/icons-react';
10
+ import { Button, ComposedModal, DataTable, Dropdown, ModalBody, ModalFooter, ModalHeader, OverflowMenu, OverflowMenuItem } from 'carbon-components-react';
11
+ import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
12
+ import React, { useLayoutEffect, useMemo, useState } from 'react';
12
13
  import { action } from '@storybook/addon-actions';
13
14
  import { pkg } from '../../../settings';
14
- import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
15
- import { FilterContext } from '../Datagrid/addons/Filtering';
15
+ import { useFilterContext } from '../Datagrid/addons/Filtering/hooks';
16
16
  var blockClass = "".concat(pkg.prefix, "--datagrid");
17
17
  export var DatagridActions = function DatagridActions(datagridState) {
18
- var _useContext = useContext(FilterContext),
19
- setPanelOpen = _useContext.setPanelOpen;
18
+ var _useFilterContext = useFilterContext(),
19
+ setPanelOpen = _useFilterContext.setPanelOpen;
20
20
  var selectedFlatRows = datagridState.selectedFlatRows,
21
21
  setGlobalFilter = datagridState.setGlobalFilter,
22
22
  CustomizeColumnsButton = datagridState.CustomizeColumnsButton,
@@ -50,6 +50,10 @@ export var ARG_TYPES = {
50
50
  control: 'select',
51
51
  options: ['error', 'noData']
52
52
  },
53
+ isFetching: {
54
+ control: 'radio',
55
+ options: [true, false]
56
+ },
53
57
  useDenseHeader: {
54
58
  control: {
55
59
  type: 'radio'
@@ -24,6 +24,7 @@ import { pkg /*, carbon */ } from '../../settings';
24
24
  import { Form } from 'carbon-components-react';
25
25
  import { SidePanel } from '../SidePanel';
26
26
  import '../../global/js/utils/props-helper';
27
+ import uuidv4 from '../../global/js/utils/uuidv4';
27
28
 
28
29
  // The block part of our conventional BEM class names (blockClass__E--M).
29
30
  var blockClass = "".concat(pkg.prefix, "--edit-side-panel");
@@ -75,6 +76,7 @@ export var EditSidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
75
76
  onClick: onRequestClose,
76
77
  kind: 'secondary'
77
78
  }];
79
+ var formTitleId = uuidv4();
78
80
  return /*#__PURE__*/React.createElement(SidePanel, _extends({}, rest, _objectSpread({
79
81
  open: open,
80
82
  ref: ref,
@@ -92,11 +94,13 @@ export var EditSidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
92
94
  preventCloseOnClickOutside: true,
93
95
  actions: actions
94
96
  }), formTitle && /*#__PURE__*/React.createElement("h3", {
95
- className: "".concat(blockClass, "__form-title-text ").concat(blockClass, "__content-text")
97
+ className: "".concat(blockClass, "__form-title-text ").concat(blockClass, "__content-text"),
98
+ id: formTitleId
96
99
  }, formTitle), formDescription && /*#__PURE__*/React.createElement("p", {
97
100
  className: "".concat(blockClass, "__form-description-text ").concat(blockClass, "__content-text")
98
101
  }, formDescription), /*#__PURE__*/React.createElement(Form, {
99
- className: "".concat(blockClass, "__form")
102
+ className: "".concat(blockClass, "__form"),
103
+ "aria-labelledby": formTitleId
100
104
  }, children));
101
105
  });
102
106
 
@@ -131,7 +135,7 @@ EditSidePanel.propTypes = {
131
135
  /**
132
136
  * Specifies a required field that provides a title for a form
133
137
  */
134
- formTitle: PropTypes.node,
138
+ formTitle: PropTypes.node.isRequired,
135
139
  /**
136
140
  * Specifies an optional handler which is called when the CreateSidePanel
137
141
  * is closed.
@@ -19,13 +19,16 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
19
19
  _ref$clearFilters = _ref.clearFilters,
20
20
  clearFilters = _ref$clearFilters === void 0 ? function () {} : _ref$clearFilters,
21
21
  _ref$filters = _ref.filters,
22
- filters = _ref$filters === void 0 ? [] : _ref$filters;
22
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
23
+ _ref$renderLabel = _ref.renderLabel,
24
+ renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel;
23
25
  var tagFilters = filters.map(function (_ref2) {
26
+ var _renderLabel;
24
27
  var key = _ref2.key,
25
28
  value = _ref2.value;
26
29
  return {
27
30
  type: 'gray',
28
- label: "".concat(key, ": ").concat(value)
31
+ label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
29
32
  };
30
33
  });
31
34
  return /*#__PURE__*/React.createElement("div", {
@@ -49,6 +52,7 @@ FilterSummary.propTypes = {
49
52
  className: PropTypes.string,
50
53
  clearFilters: PropTypes.func.isRequired,
51
54
  clearFiltersText: PropTypes.string,
52
- filters: PropTypes.arrayOf(PropTypes.object).isRequired
55
+ filters: PropTypes.arrayOf(PropTypes.object).isRequired,
56
+ renderLabel: PropTypes.func
53
57
  };
54
58
  export default FilterSummary;
@@ -0,0 +1,229 @@
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
+
15
+ // Other standard imports.
16
+ import PropTypes from 'prop-types';
17
+ import cx from 'classnames';
18
+ import { blue90, purple70 } from '@carbon/colors';
19
+ import { CaretLeft16, CaretRight16, Close20, Idea20 } from '@carbon/icons-react';
20
+ import { Button } from 'carbon-components-react';
21
+ import { Carousel } from '../Carousel';
22
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
23
+ import { pkg } from '../../settings';
24
+
25
+ // Carbon and package components we use.
26
+ /* TODO: @import(s) of carbon components and other package components. */
27
+
28
+ // The block part of our conventional BEM class names (blockClass__E--M).
29
+ var blockClass = "".concat(pkg.prefix, "--guidebanner");
30
+ var componentName = 'Guidebanner';
31
+ var defaults = {
32
+ collapsible: false,
33
+ // Labels
34
+ closeIconDescription: 'Close',
35
+ collapseButtonLabel: 'Read less',
36
+ expandButtonLabel: 'Read more',
37
+ nextIconDescription: 'Next',
38
+ previousIconDescription: 'Back'
39
+ };
40
+
41
+ /**
42
+ * The guide banner sits at the top of a page, or page-level tab,
43
+ * to introduce foundational concepts related to the page's content.
44
+ */
45
+ export var Guidebanner = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
46
+ var children = _ref.children,
47
+ className = _ref.className,
48
+ _ref$collapsible = _ref.collapsible,
49
+ collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
50
+ onClose = _ref.onClose,
51
+ _ref$closeIconDescrip = _ref.closeIconDescription,
52
+ closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
53
+ _ref$collapseButtonLa = _ref.collapseButtonLabel,
54
+ collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
55
+ _ref$expandButtonLabe = _ref.expandButtonLabel,
56
+ expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
57
+ _ref$nextIconDescript = _ref.nextIconDescription,
58
+ nextIconDescription = _ref$nextIconDescript === void 0 ? defaults.nextIconDescription : _ref$nextIconDescript,
59
+ _ref$previousIconDesc = _ref.previousIconDescription,
60
+ previousIconDescription = _ref$previousIconDesc === void 0 ? defaults.previousIconDescription : _ref$previousIconDesc,
61
+ title = _ref.title,
62
+ rest = _objectWithoutProperties(_ref, _excluded);
63
+ var scrollRef = useRef();
64
+ var toggleRef = useRef();
65
+ var _useState = useState(0),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ scrollPosition = _useState2[0],
68
+ setScrollPosition = _useState2[1];
69
+ var _useState3 = useState(false),
70
+ _useState4 = _slicedToArray(_useState3, 2),
71
+ showNavigation = _useState4[0],
72
+ setShowNavigation = _useState4[1];
73
+ var _useState5 = useState(collapsible ? true : false),
74
+ _useState6 = _slicedToArray(_useState5, 2),
75
+ isCollapsed = _useState6[0],
76
+ setIsCollapsed = _useState6[1];
77
+ var handleScrollableChange = function handleScrollableChange(value) {
78
+ setShowNavigation(value);
79
+ };
80
+ var handleClickToggle = function handleClickToggle() {
81
+ setScrollPosition(0);
82
+ scrollRef.current.scrollToView(0);
83
+ setIsCollapsed(function (prevState) {
84
+ return !prevState;
85
+ });
86
+ };
87
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
88
+ "aria-expanded": !isCollapsed,
89
+ className: cx(blockClass, className, [collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null]),
90
+ ref: ref
91
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Idea20, {
92
+ className: "".concat(blockClass, "__icon-idea")
93
+ }), /*#__PURE__*/React.createElement("div", {
94
+ className: "".concat(blockClass, "__title")
95
+ }, title), /*#__PURE__*/React.createElement(Carousel, {
96
+ className: "".concat(blockClass, "__carousel")
97
+ // These colors are to match the Carousel's faded edges
98
+ // against the Guidebanner's gradient background.
99
+ ,
100
+ fadedEdgeColor: {
101
+ left: blue90,
102
+ right: purple70
103
+ },
104
+ ref: scrollRef,
105
+ scrollableChange: handleScrollableChange,
106
+ scrollTune: -450
107
+ }, children), /*#__PURE__*/React.createElement("div", {
108
+ className: cx([collapsible || showNavigation ? "".concat(blockClass, "__navigation") : null])
109
+ }, collapsible && /*#__PURE__*/React.createElement(Button, {
110
+ kind: "ghost",
111
+ size: "md",
112
+ className: "".concat(blockClass, "__toggle-button"),
113
+ onClick: handleClickToggle,
114
+ ref: toggleRef
115
+ }, isCollapsed ? expandButtonLabel : collapseButtonLabel), showNavigation && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
116
+ kind: "ghost",
117
+ size: "md",
118
+ hasIconOnly: true,
119
+ disabled: scrollPosition === 0,
120
+ renderIcon: CaretLeft16,
121
+ className: cx("".concat(blockClass, "__back-button"), [scrollPosition === 0 ? "".concat(blockClass, "__back-button--disabled") : null]),
122
+ tooltipPosition: "top",
123
+ iconDescription: previousIconDescription,
124
+ onClick: function onClick() {
125
+ scrollRef.current.scrollPrev().then(function (scrollPercentage) {
126
+ return setScrollPosition(scrollPercentage);
127
+ });
128
+ }
129
+ }), /*#__PURE__*/React.createElement(Button, {
130
+ kind: "ghost",
131
+ size: "md",
132
+ hasIconOnly: true,
133
+ disabled: scrollPosition === 1,
134
+ renderIcon: CaretRight16,
135
+ className: cx("".concat(blockClass, "__next-button"), [scrollPosition === 1 ? "".concat(blockClass, "__next-button--disabled") : null]),
136
+ tooltipPosition: "top",
137
+ tooltipAlignment: "end",
138
+ iconDescription: nextIconDescription,
139
+ onClick: function onClick() {
140
+ scrollRef.current.scrollNext().then(function (scrollPercentage) {
141
+ return setScrollPosition(scrollPercentage);
142
+ });
143
+ }
144
+ }))), onClose && /*#__PURE__*/React.createElement(Button, {
145
+ className: "".concat(blockClass, "__close-button"),
146
+ hasIconOnly: true,
147
+ iconDescription: closeIconDescription,
148
+ kind: "ghost",
149
+ onClick: onClose,
150
+ renderIcon: Close20,
151
+ size: "md",
152
+ tooltipPosition: "bottom",
153
+ tooltipAlignment: "end"
154
+ }));
155
+ });
156
+
157
+ // Return a placeholder if not released and not enabled by feature flag
158
+ Guidebanner = pkg.checkComponentEnabled(Guidebanner, componentName);
159
+
160
+ // The display name of the component, used by React. Note that displayName
161
+ // is used in preference to relying on function.name.
162
+ Guidebanner.displayName = componentName;
163
+
164
+ // The types and DocGen commentary for the component props,
165
+ // in alphabetical order (for consistency).
166
+ // See https://www.npmjs.com/package/prop-types#usage.
167
+ Guidebanner.propTypes = {
168
+ /**
169
+ * Provide the contents of the Guidebanner.
170
+ * One or more GuidebannerElement components are required.
171
+ */
172
+ children: function children(props, propName) {
173
+ var error;
174
+ var prop = props[propName];
175
+ if (!prop) {
176
+ error = new Error('`Guidebanner` requires one or more children of type `GuidebannerElement`.');
177
+ }
178
+ React.Children.forEach(prop, function (child) {
179
+ if (child.type.name !== 'GuidebannerElement') {
180
+ var _child$type;
181
+ // If not GuidebannerElement, then show:
182
+ // React component name(child.type?.name) or
183
+ // HTML element name(child.type).
184
+ 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.name) || child.type, "` instead."));
185
+ }
186
+ });
187
+ return error;
188
+ },
189
+ /**
190
+ * Provide an optional class to be applied to the containing node.
191
+ */
192
+ className: PropTypes.string,
193
+ /**
194
+ * Tooltip text and aria label for the Close button icon.
195
+ */
196
+ closeIconDescription: PropTypes.string,
197
+ /**
198
+ * Text label for the Collapse button.
199
+ */
200
+ collapseButtonLabel: PropTypes.string,
201
+ /**
202
+ * When true, the Guidebanner will initialize in a collapsed state,
203
+ * showing the title and the Expand button.
204
+ *
205
+ * When expanded, it will show the GuidebannerElement child components and the Collapse button.
206
+ */
207
+ collapsible: PropTypes.bool,
208
+ /**
209
+ * Text label for the Expand button.
210
+ */
211
+ expandButtonLabel: PropTypes.string,
212
+ /**
213
+ * Tooltip text and aria label for the Next button icon.
214
+ */
215
+ nextIconDescription: PropTypes.string,
216
+ /**
217
+ * If defined, a Close button will render in the top-right corner and a
218
+ * callback function will be triggered when button is clicked.
219
+ */
220
+ onClose: PropTypes.func,
221
+ /**
222
+ * Tooltip text and aria label for the Back button icon.
223
+ */
224
+ previousIconDescription: PropTypes.string,
225
+ /**
226
+ * Title text.
227
+ */
228
+ title: PropTypes.string.isRequired
229
+ };
@@ -0,0 +1,71 @@
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
+
14
+ // Other standard imports.
15
+ import PropTypes from 'prop-types';
16
+ import cx from 'classnames';
17
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
18
+ import { pkg } from '../../settings';
19
+
20
+ // Carbon and package components we use.
21
+ /* TODO: @import(s) of carbon components and other package components. */
22
+
23
+ // The block part of our conventional BEM class names (blockClass__E--M).
24
+ var blockClass = "".concat(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 = function GuidebannerElement(_ref) {
32
+ var button = _ref.button,
33
+ className = _ref.className,
34
+ description = _ref.description,
35
+ title = _ref.title,
36
+ rest = _objectWithoutProperties(_ref, _excluded);
37
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
38
+ className: cx(blockClass, className)
39
+ }, getDevtoolsProps(componentName)), title && /*#__PURE__*/React.createElement("h2", {
40
+ className: "".concat(blockClass, "-title")
41
+ }, title), description && /*#__PURE__*/React.createElement("p", {
42
+ className: "".concat(blockClass, "-content")
43
+ }, description), button && /*#__PURE__*/React.createElement("div", {
44
+ className: "".concat(blockClass, "-buttons")
45
+ }, button));
46
+ };
47
+
48
+ // The types and DocGen commentary for the component props,
49
+ // in alphabetical order (for consistency).
50
+ // See https://www.npmjs.com/package/prop-types#usage.
51
+ GuidebannerElement.propTypes = {
52
+ /**
53
+ * An optional button can be rendered below the description.
54
+ * This can be a link, button, Coachmark button, etc.
55
+ */
56
+ button: PropTypes.node,
57
+ /**
58
+ * Provide an optional class to be applied to the containing node.
59
+ */
60
+ className: PropTypes.string,
61
+ /**
62
+ * The description of the element.
63
+ */
64
+
65
+ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
66
+ /**
67
+ * The title of the element.
68
+ */
69
+ title: PropTypes.string
70
+ };
71
+ export { GuidebannerElement };
@@ -0,0 +1,76 @@
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
+
14
+ // Other standard imports.
15
+ import PropTypes from 'prop-types';
16
+ import cx from 'classnames';
17
+ import { Button } from 'carbon-components-react';
18
+ import { Crossroads16 } from '@carbon/icons-react';
19
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
20
+ import { pkg } from '../../settings';
21
+
22
+ // Carbon and package components we use.
23
+ /* TODO: @import(s) of carbon components and other package components. */
24
+
25
+ // The block part of our conventional BEM class names (blockClass__E--M).
26
+ var blockClass = "".concat(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 = function GuidebannerElementButton(_ref) {
33
+ var children = _ref.children,
34
+ className = _ref.className,
35
+ type = _ref.type,
36
+ rest = _objectWithoutProperties(_ref, _excluded);
37
+ if (type === 'primary') {
38
+ return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
39
+ className: cx(blockClass, className),
40
+ iconDescription: 'Crossroads',
41
+ kind: "tertiary",
42
+ renderIcon: Crossroads16,
43
+ role: "button",
44
+ size: "md"
45
+ }, getDevtoolsProps(componentName)), children);
46
+ }
47
+ return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
48
+ className: cx(blockClass, className),
49
+ kind: "ghost",
50
+ role: "button",
51
+ size: "md"
52
+ }, getDevtoolsProps(componentName)), children);
53
+ };
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
+ GuidebannerElementButton.propTypes = {
59
+ /**
60
+ * Provide the contents of the GuidebannerElementButton.
61
+ */
62
+ children: PropTypes.node.isRequired,
63
+ /**
64
+ * Provide an optional class to be applied to the containing node.
65
+ */
66
+ className: PropTypes.string,
67
+ /**
68
+ * If type is "primary", then return a tertiary button with the "crossroads" icon,
69
+ * else return a ghost button.
70
+ */
71
+ type: PropTypes.string
72
+
73
+ /* TODO: add types and DocGen for all props. */
74
+ };
75
+
76
+ export { GuidebannerElementButton };
@@ -0,0 +1,56 @@
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
+
14
+ // Other standard imports.
15
+ import PropTypes from 'prop-types';
16
+ import cx from 'classnames';
17
+ import { Link } from 'carbon-components-react';
18
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
19
+ import { pkg } from '../../settings';
20
+
21
+ // Carbon and package components we use.
22
+ /* TODO: @import(s) of carbon components and other package components. */
23
+
24
+ // The block part of our conventional BEM class names (blockClass__E--M).
25
+ var blockClass = "".concat(pkg.prefix, "--guidebanner__element-link");
26
+ var componentName = 'GuidebannerElementLink';
27
+
28
+ /**
29
+ * A link styled specifically for the GuidebannerElement.
30
+ */
31
+ var GuidebannerElementLink = function GuidebannerElementLink(_ref) {
32
+ var children = _ref.children,
33
+ className = _ref.className,
34
+ rest = _objectWithoutProperties(_ref, _excluded);
35
+ return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
36
+ className: cx(blockClass, className),
37
+ kind: "ghost",
38
+ role: "link",
39
+ size: "md"
40
+ }, getDevtoolsProps(componentName)), children);
41
+ };
42
+
43
+ // The types and DocGen commentary for the component props,
44
+ // in alphabetical order (for consistency).
45
+ // See https://www.npmjs.com/package/prop-types#usage.
46
+ GuidebannerElementLink.propTypes = {
47
+ /**
48
+ * Provide the contents of the GuidebannerElementLink.
49
+ */
50
+ children: PropTypes.node.isRequired,
51
+ /**
52
+ * Provide an optional class to be applied to the containing node.
53
+ */
54
+ className: PropTypes.string
55
+ };
56
+ export { GuidebannerElementLink };
@@ -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';