@carbon/ibm-products 1.61.1 → 1.62.1
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +172 -70
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1768 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +172 -70
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +172 -70
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Carousel/Carousel.js +194 -119
- package/es/components/Carousel/CarouselItem.js +8 -21
- package/es/components/Coachmark/Coachmark.js +17 -5
- package/es/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/es/components/Coachmark/CoachmarkHeader.js +2 -1
- package/es/components/Coachmark/CoachmarkOverlay.js +105 -9
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +26 -6
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +34 -10
- package/es/components/CoachmarkStack/CoachmarkStack.js +19 -4
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +45 -11
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +6 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -25
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +23 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +31 -12
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +93 -14
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +9 -9
- package/es/components/Datagrid/useDatagrid.js +13 -1
- package/es/components/Datagrid/useExpandedRow.js +3 -6
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useFocusRowExpander.js +40 -0
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useNestedRowExpander.js +9 -0
- package/es/components/Datagrid/useNestedRows.js +0 -4
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useParentDimensions.js +6 -6
- package/es/components/Datagrid/useResizeTable.js +7 -7
- package/es/components/Datagrid/useRowExpander.js +9 -0
- package/es/components/Datagrid/useSelectAllToggle.js +2 -2
- package/es/components/Datagrid/useSelectRows.js +52 -30
- package/es/components/Datagrid/useSkeletonRows.js +6 -6
- package/es/components/Datagrid/useSortableColumns.js +4 -5
- package/es/components/Datagrid/useStickyColumn.js +13 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/es/components/Guidebanner/Guidebanner.js +9 -12
- package/es/global/js/hooks/index.js +3 -2
- package/es/global/js/hooks/usePrefix.js +11 -0
- package/es/global/js/package-settings.js +1 -4
- package/lib/components/Carousel/Carousel.js +190 -114
- package/lib/components/Carousel/CarouselItem.js +9 -25
- package/lib/components/Coachmark/Coachmark.js +16 -4
- package/lib/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/lib/components/Coachmark/CoachmarkHeader.js +2 -1
- package/lib/components/Coachmark/CoachmarkOverlay.js +105 -8
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +25 -5
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +34 -10
- package/lib/components/CoachmarkStack/CoachmarkStack.js +18 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +44 -10
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -32
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +17 -4
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +25 -5
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +96 -15
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/lib/components/Datagrid/useActionsColumn.js +9 -12
- package/lib/components/Datagrid/useDatagrid.js +13 -1
- package/lib/components/Datagrid/useExpandedRow.js +2 -5
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useFocusRowExpander.js +46 -0
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- package/lib/components/Datagrid/useNestedRowExpander.js +9 -0
- package/lib/components/Datagrid/useNestedRows.js +0 -4
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useParentDimensions.js +5 -6
- package/lib/components/Datagrid/useResizeTable.js +6 -7
- package/lib/components/Datagrid/useRowExpander.js +9 -0
- package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
- package/lib/components/Datagrid/useSelectRows.js +46 -23
- package/lib/components/Datagrid/useSkeletonRows.js +6 -6
- package/lib/components/Datagrid/useSortableColumns.js +4 -5
- package/lib/components/Datagrid/useStickyColumn.js +8 -0
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/lib/components/Guidebanner/Guidebanner.js +9 -12
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/usePrefix.js +19 -0
- package/lib/global/js/package-settings.js +1 -4
- package/package.json +2 -2
- package/scss/components/Carousel/_carousel.scss +1 -2
- package/scss/components/Checklist/_checklist.scss +13 -25
- package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +1 -45
- package/scss/components/Coachmark/styles/_coachmark-header.scss +0 -33
- package/scss/components/Coachmark/styles/_coachmark-overlay.scss +113 -5
- package/scss/components/Coachmark/styles/_coachmark-tagline.scss +18 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +19 -1
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +2 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +3 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +21 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -0
- package/scss/components/_index-released-only.scss +1 -0
- package/es/components/Carousel/utils.js +0 -98
- package/lib/components/Carousel/utils.js +0 -108
@@ -7,22 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.Carousel = void 0;
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
11
|
var _react = _interopRequireWildcard(require("react"));
|
13
|
-
var _lodash = require("lodash");
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
13
|
var _CarouselItem = require("./CarouselItem");
|
16
|
-
var _utils = require("./utils");
|
17
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
18
15
|
var _devtools = require("../../global/js/utils/devtools");
|
19
16
|
var _settings = require("../../settings");
|
20
|
-
var _excluded = ["children", "className", "disableArrowScroll", "fadedEdgeColor", "
|
17
|
+
var _excluded = ["children", "className", "disableArrowScroll", "fadedEdgeColor", "onChangeIsScrollable", "onScroll"];
|
21
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
22
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23
|
-
// Carbon and package components we use.
|
24
|
-
/* TODO: @import(s) of carbon components and other package components. */
|
25
|
-
|
26
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
21
|
var blockClass = "".concat(_settings.pkg.prefix, "--carousel");
|
28
22
|
var componentName = 'Carousel';
|
@@ -30,13 +24,25 @@ var componentName = 'Carousel';
|
|
30
24
|
// Default values for props
|
31
25
|
var defaults = {
|
32
26
|
disableArrowScroll: false,
|
33
|
-
|
27
|
+
onScroll: function onScroll() {},
|
28
|
+
onChangeIsScrollable: function onChangeIsScrollable() {}
|
34
29
|
};
|
35
30
|
|
36
31
|
/**
|
37
32
|
* The Carousel acts as a scaffold for other Novice to Pro content.
|
38
33
|
*
|
39
34
|
* This component is not intended for general use.
|
35
|
+
*
|
36
|
+
* Expected scrolling behavior.
|
37
|
+
* 1. Scroll the maximum number of visible items at a time.
|
38
|
+
* 2. The left-most item should always be left-aligned in the viewport.
|
39
|
+
*
|
40
|
+
* Exception.
|
41
|
+
* 1. After scrolling to the last (right-most) item,
|
42
|
+
* if some of its content remains hidden,
|
43
|
+
* then nudge it to the right until it is right-aligned.
|
44
|
+
* 2. From the right-aligned position, when scrolling left,
|
45
|
+
* the left-most item should again be left-aligned.
|
40
46
|
*/
|
41
47
|
var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
42
48
|
var children = _ref.children,
|
@@ -44,93 +50,152 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
44
50
|
_ref$disableArrowScro = _ref.disableArrowScroll,
|
45
51
|
disableArrowScroll = _ref$disableArrowScro === void 0 ? defaults.disableArrowScroll : _ref$disableArrowScro,
|
46
52
|
fadedEdgeColor = _ref.fadedEdgeColor,
|
47
|
-
|
48
|
-
_ref$
|
49
|
-
|
53
|
+
_ref$onChangeIsScroll = _ref.onChangeIsScrollable,
|
54
|
+
onChangeIsScrollable = _ref$onChangeIsScroll === void 0 ? defaults.onChangeIsScrollable : _ref$onChangeIsScroll,
|
55
|
+
_ref$onScroll = _ref.onScroll,
|
56
|
+
onScroll = _ref$onScroll === void 0 ? defaults.onScroll : _ref$onScroll,
|
50
57
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
51
|
-
var
|
52
|
-
var
|
58
|
+
var carouselRef = (0, _react.useRef)();
|
59
|
+
var scrollRef = (0, _react.useRef)();
|
60
|
+
// Array of refs used to reference this component's children DOM elements
|
61
|
+
var childElementsRef = (0, _react.useRef)(Array(_react.default.Children.count(children)).fill((0, _react.useRef)(null)));
|
53
62
|
var leftFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.left) || fadedEdgeColor;
|
54
63
|
var rightFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.right) || fadedEdgeColor;
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
return scrollToView(currentViewID + 1);
|
72
|
-
}, [currentViewID, scrollToView]);
|
73
|
-
var scrollPrev = (0, _react.useCallback)(function () {
|
74
|
-
return scrollToView(currentViewID - 1);
|
75
|
-
}, [currentViewID, scrollToView]);
|
76
|
-
var scrollToView = (0, _react.useCallback)(function (viewID) {
|
77
|
-
if (!isScrolling && scrollRef.current && mountedRef.current) {
|
78
|
-
var _scrollRef$current;
|
79
|
-
var targetViewID = (0, _lodash.clamp)(viewID, 0, totalViews - 1);
|
80
|
-
setCurrentViewID(targetViewID);
|
81
|
-
setIsScrolling(true);
|
82
|
-
scrollRef.current.scrollLeft = ((_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.offsetWidth) * targetViewID + scrollTune;
|
83
|
-
return scrollPromise();
|
64
|
+
|
65
|
+
// Trigger callbacks to report state of the carousel
|
66
|
+
var handleOnScroll = (0, _react.useCallback)(function () {
|
67
|
+
// viewport's width
|
68
|
+
var clientWidth = scrollRef.current.clientWidth;
|
69
|
+
// scroll position
|
70
|
+
var scrollLeft = parseInt(scrollRef.current.scrollLeft, 10);
|
71
|
+
// scrollable width
|
72
|
+
var scrollWidth = scrollRef.current.scrollWidth;
|
73
|
+
|
74
|
+
// The maximum scrollLeft achievable is the scrollable width - the viewport width.
|
75
|
+
var scrollLeftMax = scrollWidth - clientWidth;
|
76
|
+
// if isNaN(scrollLeft / scrollLeftMax), then set to zero
|
77
|
+
var scrollPercent = parseFloat((scrollLeft / scrollLeftMax).toFixed(2)) || 0;
|
78
|
+
if (!scrollRef.current) {
|
79
|
+
return;
|
84
80
|
}
|
85
|
-
|
86
|
-
|
81
|
+
|
82
|
+
// Callback 1: Does the carousel have enough content to enable scrolling?
|
83
|
+
onChangeIsScrollable(scrollWidth > clientWidth);
|
84
|
+
|
85
|
+
// Callback 2: Return the percentage of current scroll, between 0 and 1.
|
86
|
+
onScroll(scrollPercent);
|
87
|
+
}, [onChangeIsScrollable, onScroll]);
|
88
|
+
|
89
|
+
// Check if an individual child element is visible in the container
|
90
|
+
var getElementInView = (0, _react.useCallback)(function (containerRect, elementRect) {
|
91
|
+
// Is the element's left greater than or equal to the containers left
|
92
|
+
var elementLeftIsRightOfContainerLeft = elementRect.left >= containerRect.left;
|
93
|
+
// Is the element's right less than or equal to the containers right
|
94
|
+
var elementRightIsLeftOfContainerRight = elementRect.right <= containerRect.right;
|
95
|
+
return elementLeftIsRightOfContainerLeft && elementRightIsLeftOfContainerRight;
|
96
|
+
}, []);
|
97
|
+
|
98
|
+
// Get all elements that are visible in the container.
|
99
|
+
var getElementsInView = (0, _react.useCallback)(function () {
|
100
|
+
var containerRect = scrollRef.current.getBoundingClientRect();
|
101
|
+
var inViewElements = childElementsRef.current.filter(function (el) {
|
102
|
+
return getElementInView(containerRect, el.getBoundingClientRect());
|
87
103
|
});
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
104
|
+
return inViewElements;
|
105
|
+
}, [getElementInView]);
|
106
|
+
|
107
|
+
// Return container's and children's rect data
|
108
|
+
var getContainerAndChildRectData = (0, _react.useCallback)(function () {
|
109
|
+
// Get the rect of the container
|
110
|
+
var containerRect = scrollRef.current.getBoundingClientRect();
|
111
|
+
// Get all child elements that are in view of the container, and return their bounding rects.
|
112
|
+
var elementRectsInView = getElementsInView().map(function (el) {
|
113
|
+
return el.getBoundingClientRect();
|
94
114
|
});
|
95
|
-
|
96
|
-
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
115
|
+
|
116
|
+
// What is the overall width of the visible elements in the container
|
117
|
+
// Note: may end up being 0 if the container's width is less than the child's width
|
118
|
+
var visibleWidth = elementRectsInView.reduce(function (accumulator, currentValue) {
|
119
|
+
return accumulator + currentValue.width;
|
120
|
+
}, 0);
|
121
|
+
return {
|
122
|
+
containerRect: containerRect,
|
123
|
+
elementRectsInView: elementRectsInView,
|
124
|
+
visibleWidth: visibleWidth
|
125
|
+
};
|
126
|
+
}, [getElementsInView]);
|
127
|
+
var handleScrollNext = (0, _react.useCallback)(function () {
|
128
|
+
var _getContainerAndChild = getContainerAndChildRectData(),
|
129
|
+
containerRect = _getContainerAndChild.containerRect,
|
130
|
+
visibleWidth = _getContainerAndChild.visibleWidth;
|
131
|
+
// Set the scrollValue to the visibleWidth, but if the visibleWidth value is 0, set it to the container's width
|
132
|
+
var scrollValue = visibleWidth > 0 ? visibleWidth : containerRect.width;
|
133
|
+
// Increment the scrollLeft of the container
|
134
|
+
scrollRef.current.scrollLeft += scrollValue;
|
135
|
+
}, [getContainerAndChildRectData]);
|
136
|
+
var handleScrollPrev = (0, _react.useCallback)(function () {
|
137
|
+
var _getContainerAndChild2 = getContainerAndChildRectData(),
|
138
|
+
containerRect = _getContainerAndChild2.containerRect,
|
139
|
+
elementRectsInView = _getContainerAndChild2.elementRectsInView,
|
140
|
+
visibleWidth = _getContainerAndChild2.visibleWidth;
|
141
|
+
// Set the scrollValue to the visibleWidth minus the first child's left value,
|
142
|
+
// but if the visibleWidth value is 0, set it to the container's width plus the container's left value
|
143
|
+
var scrollValue = visibleWidth > 0 ? visibleWidth - elementRectsInView[0].left : containerRect.width + containerRect.left;
|
144
|
+
|
145
|
+
// Decrement the scrollLeft of the container
|
146
|
+
scrollRef.current.scrollLeft -= scrollValue;
|
147
|
+
}, [getContainerAndChildRectData]);
|
148
|
+
var handleScrollReset = (0, _react.useCallback)(function () {
|
149
|
+
// This doesn't trigger "scrollend"...
|
150
|
+
scrollRef.current.scrollLeft = 0;
|
151
|
+
// ...so trigger a callback manually.
|
152
|
+
handleOnScroll();
|
153
|
+
}, [handleOnScroll]);
|
154
|
+
var handleScrollToView = (0, _react.useCallback)(function (itemNumber) {
|
155
|
+
childElementsRef.current[itemNumber].scrollIntoView();
|
102
156
|
}, []);
|
103
|
-
var scrollPosition = function scrollPosition() {
|
104
|
-
var _scrollRef$current2;
|
105
|
-
return (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollLeft;
|
106
|
-
};
|
107
|
-
var maxScroll = function maxScroll() {
|
108
|
-
var _scrollRef$current3, _scrollRef$current4;
|
109
|
-
return ((_scrollRef$current3 = scrollRef.current) === null || _scrollRef$current3 === void 0 ? void 0 : _scrollRef$current3.scrollWidth) - ((_scrollRef$current4 = scrollRef.current) === null || _scrollRef$current4 === void 0 ? void 0 : _scrollRef$current4.clientWidth);
|
110
|
-
};
|
111
|
-
var handleResize = (0, _lodash.debounce)(function () {
|
112
|
-
scrollToView(currentViewIDRef.current);
|
113
|
-
}, 200);
|
114
|
-
var setCurrentViewID = function setCurrentViewID(val) {
|
115
|
-
currentViewIDRef.current = val;
|
116
|
-
_setCurrentViewID(val);
|
117
|
-
};
|
118
|
-
var _useState3 = (0, _react.useState)(false),
|
119
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
120
|
-
isScrolling = _useState4[0],
|
121
|
-
setIsScrolling = _useState4[1];
|
122
|
-
|
123
|
-
// EFFECTS
|
124
|
-
(0, _utils.useWindowEvent)('resize', handleResize);
|
125
|
-
// SAVE POINT
|
126
157
|
|
158
|
+
// Trigger a callback after first render (and applied CSS).
|
127
159
|
(0, _react.useEffect)(function () {
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
160
|
+
// Normally, we can trigger a callback "immediately after first
|
161
|
+
// render", because we will be doing more "logical" work (update
|
162
|
+
// a state, show / hide a feature, etc.), and the final, applied
|
163
|
+
// CSS can "catch up" asynchronously without breaking anything.
|
164
|
+
setTimeout(function () {
|
165
|
+
// But, because we are making calculations based on the final,
|
166
|
+
// applied CSS, we must wait for one more "tick".
|
167
|
+
handleOnScroll();
|
168
|
+
}, 0);
|
169
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
170
|
+
}, []);
|
171
|
+
|
172
|
+
// On window.resize, reset carousel to zero.
|
132
173
|
(0, _react.useEffect)(function () {
|
133
|
-
function
|
174
|
+
var handleWindowResize = function handleWindowResize() {
|
175
|
+
scrollRef.current.scrollLeft = 0;
|
176
|
+
handleOnScroll();
|
177
|
+
};
|
178
|
+
window.addEventListener('resize', handleWindowResize);
|
179
|
+
return function () {
|
180
|
+
return window.removeEventListener('resize', handleWindowResize);
|
181
|
+
};
|
182
|
+
}, [handleOnScroll]);
|
183
|
+
|
184
|
+
// On scrollRef.scrollend, trigger a callback.
|
185
|
+
(0, _react.useEffect)(function () {
|
186
|
+
var handleScrollend = function handleScrollend() {
|
187
|
+
handleOnScroll();
|
188
|
+
};
|
189
|
+
var scrollDiv = scrollRef.current;
|
190
|
+
scrollDiv.addEventListener('scrollend', handleScrollend);
|
191
|
+
return function () {
|
192
|
+
return scrollDiv.removeEventListener('scrollend', handleScrollend);
|
193
|
+
};
|
194
|
+
}, [handleOnScroll]);
|
195
|
+
|
196
|
+
// Disable wheel scrolling
|
197
|
+
(0, _react.useEffect)(function () {
|
198
|
+
function handleWheel(event) {
|
134
199
|
// update the scroll position
|
135
200
|
event.stopPropagation();
|
136
201
|
event.preventDefault();
|
@@ -138,18 +203,20 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
138
203
|
}
|
139
204
|
var scrollDiv = scrollRef.current;
|
140
205
|
if (scrollDiv) {
|
141
|
-
scrollDiv.addEventListener('wheel',
|
206
|
+
scrollDiv.addEventListener('wheel', handleWheel, {
|
142
207
|
passive: false
|
143
208
|
});
|
144
209
|
return function () {
|
145
|
-
scrollDiv.removeEventListener('wheel',
|
210
|
+
scrollDiv.removeEventListener('wheel', handleWheel, {
|
146
211
|
passive: false
|
147
212
|
});
|
148
213
|
};
|
149
214
|
}
|
150
215
|
}, []);
|
216
|
+
|
217
|
+
// Enable arrow scrolling from within the carousel
|
151
218
|
(0, _react.useEffect)(function () {
|
152
|
-
function
|
219
|
+
function handleKeydown(event) {
|
153
220
|
var key = event.key;
|
154
221
|
if ((key === 'ArrowLeft' || key === 'ArrowRight') && disableArrowScroll) {
|
155
222
|
event.stopPropagation();
|
@@ -157,27 +224,32 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
157
224
|
event.cancelBubble = false;
|
158
225
|
}
|
159
226
|
}
|
160
|
-
var
|
161
|
-
if (
|
162
|
-
|
227
|
+
var carouselDiv = carouselRef.current;
|
228
|
+
if (carouselDiv) {
|
229
|
+
carouselDiv.addEventListener('keydown', handleKeydown);
|
163
230
|
return function () {
|
164
|
-
return
|
231
|
+
return carouselDiv.removeEventListener('keydown', handleKeydown);
|
165
232
|
};
|
166
233
|
}
|
167
234
|
}, [disableArrowScroll]);
|
168
|
-
|
169
|
-
|
170
|
-
mountedRef.current = false;
|
171
|
-
};
|
172
|
-
}, []);
|
235
|
+
|
236
|
+
// Enable external function calls
|
173
237
|
(0, _react.useImperativeHandle)(ref, function () {
|
174
238
|
return {
|
175
|
-
scrollNext: scrollNext
|
176
|
-
|
177
|
-
|
178
|
-
|
239
|
+
scrollNext: function scrollNext() {
|
240
|
+
handleScrollNext();
|
241
|
+
},
|
242
|
+
scrollPrev: function scrollPrev() {
|
243
|
+
handleScrollPrev();
|
244
|
+
},
|
245
|
+
scrollReset: function scrollReset() {
|
246
|
+
handleScrollReset();
|
247
|
+
},
|
248
|
+
scrollToView: function scrollToView(itemNumber) {
|
249
|
+
handleScrollToView(itemNumber);
|
250
|
+
}
|
179
251
|
};
|
180
|
-
}, [
|
252
|
+
}, [handleScrollNext, handleScrollPrev, handleScrollReset, handleScrollToView]);
|
181
253
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
182
254
|
tabIndex: -1,
|
183
255
|
className: (0, _classnames.default)(blockClass, className),
|
@@ -188,8 +260,13 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
188
260
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
189
261
|
className: "".concat(blockClass, "__elements"),
|
190
262
|
ref: scrollRef
|
191
|
-
}, _react.default.Children.map(children, function (child) {
|
192
|
-
return /*#__PURE__*/_react.default.createElement(_CarouselItem.CarouselItem,
|
263
|
+
}, _react.default.Children.map(children, function (child, index) {
|
264
|
+
return /*#__PURE__*/_react.default.createElement(_CarouselItem.CarouselItem, {
|
265
|
+
key: index,
|
266
|
+
ref: function ref(element) {
|
267
|
+
return childElementsRef.current[index] = element;
|
268
|
+
}
|
269
|
+
}, child);
|
193
270
|
})), leftFadedEdgeColor && /*#__PURE__*/_react.default.createElement("div", {
|
194
271
|
className: "".concat(blockClass, "__elements-container--scrolled"),
|
195
272
|
style: {
|
@@ -202,9 +279,6 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
202
279
|
}
|
203
280
|
})));
|
204
281
|
});
|
205
|
-
|
206
|
-
// The display name of the component, used by React. Note that displayName
|
207
|
-
// is used in preference to relying on function.name.
|
208
282
|
exports.Carousel = Carousel;
|
209
283
|
Carousel.displayName = componentName;
|
210
284
|
|
@@ -228,21 +302,23 @@ Carousel.propTypes = {
|
|
228
302
|
/**
|
229
303
|
* Enables the edges of the component to have faded styling.
|
230
304
|
*
|
231
|
-
* Pass a single string to specify the same color for left and right.
|
305
|
+
* Pass a single string (`$color`) to specify the same color for left and right.
|
232
306
|
*
|
233
|
-
*
|
307
|
+
* Or pass an object (`{ left: $color1, right: $color2 }`) to specify different colors.
|
234
308
|
*/
|
235
309
|
fadedEdgeColor: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
236
310
|
left: _propTypes.default.string,
|
237
311
|
right: _propTypes.default.string
|
238
312
|
})]),
|
239
313
|
/**
|
240
|
-
*
|
314
|
+
* An optional callback function that returns `true`
|
315
|
+
* when the carousel has enough content to be scrollable,
|
316
|
+
* and `false` when there is not enough content.
|
241
317
|
*/
|
242
|
-
|
318
|
+
onChangeIsScrollable: _propTypes.default.func,
|
243
319
|
/**
|
244
|
-
* An optional callback function that returns
|
245
|
-
*
|
320
|
+
* An optional callback function that returns the scroll position as
|
321
|
+
* a value between 0 and 1.
|
246
322
|
*/
|
247
|
-
|
323
|
+
onScroll: _propTypes.default.func
|
248
324
|
};
|
@@ -1,23 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.CarouselItem = void 0;
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
|
-
var _react =
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
13
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
15
|
-
var _utils = require("./utils");
|
16
13
|
var _devtools = require("../../global/js/utils/devtools");
|
17
14
|
var _settings = require("../../settings");
|
18
15
|
var _excluded = ["children", "className"];
|
19
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21
16
|
// Carbon and package components we use.
|
22
17
|
/* TODO: @import(s) of carbon components and other package components. */
|
23
18
|
|
@@ -28,32 +23,21 @@ var componentName = 'CarouselItem';
|
|
28
23
|
/**
|
29
24
|
* TODO: A description of the component.
|
30
25
|
*/
|
31
|
-
var CarouselItem = function
|
26
|
+
var CarouselItem = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
32
27
|
var children = _ref.children,
|
33
28
|
className = _ref.className,
|
34
29
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
35
|
-
var itemRef = (0, _react.useRef)();
|
36
|
-
var isInView = (0, _utils.useIntersection)(itemRef, 0.85);
|
37
|
-
(0, _react.useEffect)(function () {
|
38
|
-
var _itemRef$current;
|
39
|
-
var matches = (_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.querySelectorAll('a, button, [role="button"], [tabindex]');
|
40
|
-
if (matches) {
|
41
|
-
var ti = isInView ? 0 : -1;
|
42
|
-
(0, _toConsumableArray2.default)(matches).forEach(function (match) {
|
43
|
-
match.tabIndex = ti;
|
44
|
-
});
|
45
|
-
}
|
46
|
-
}, [isInView]);
|
47
30
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
48
|
-
className: (0, _classnames.default)(blockClass, className)
|
49
|
-
|
50
|
-
|
51
|
-
};
|
52
|
-
|
31
|
+
className: (0, _classnames.default)(blockClass, className)
|
32
|
+
}, (0, _devtools.getDevtoolsProps)(componentName), {
|
33
|
+
ref: ref
|
34
|
+
}), children);
|
35
|
+
});
|
36
|
+
exports.CarouselItem = CarouselItem;
|
37
|
+
CarouselItem.displayName = componentName;
|
53
38
|
// The types and DocGen commentary for the component props,
|
54
39
|
// in alphabetical order (for consistency).
|
55
40
|
// See https://www.npmjs.com/package/prop-types#usage.
|
56
|
-
exports.CarouselItem = CarouselItem;
|
57
41
|
CarouselItem.propTypes = {
|
58
42
|
/**
|
59
43
|
* Provide the contents of the CarouselItem.
|
@@ -25,6 +25,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
26
26
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark");
|
28
|
+
var overlayBlockClass = "".concat(blockClass, "-overlay");
|
28
29
|
var componentName = 'Coachmark';
|
29
30
|
var defaults = {
|
30
31
|
align: 'bottom',
|
@@ -86,7 +87,18 @@ var Coachmark = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
86
87
|
var closeOverlay = function closeOverlay() {
|
87
88
|
setIsOpen(false);
|
88
89
|
};
|
89
|
-
var
|
90
|
+
var escFunction = (0, _react.useCallback)(function (event) {
|
91
|
+
if (event.key === 'Escape') {
|
92
|
+
handleClose();
|
93
|
+
}
|
94
|
+
}, [handleClose]);
|
95
|
+
(0, _react.useEffect)(function () {
|
96
|
+
document.addEventListener('keydown', escFunction, false);
|
97
|
+
return function () {
|
98
|
+
document.removeEventListener('keydown', escFunction, false);
|
99
|
+
};
|
100
|
+
}, [escFunction]);
|
101
|
+
var handleClose = (0, _react.useCallback)(function () {
|
90
102
|
if (isStacked) {
|
91
103
|
// If stacked, do not unmount,
|
92
104
|
// only call its ("parent") onClose method.
|
@@ -95,7 +107,7 @@ var Coachmark = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
95
107
|
setIsOpen(false);
|
96
108
|
onClose();
|
97
109
|
}
|
98
|
-
};
|
110
|
+
}, [isStacked, onClose]);
|
99
111
|
var handleTargetClick = function handleTargetClick(e) {
|
100
112
|
setTargetRect(e.target.getBoundingClientRect());
|
101
113
|
setTargetOffset({
|
@@ -116,6 +128,7 @@ var Coachmark = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
116
128
|
var contextValue = {
|
117
129
|
buttonProps: {
|
118
130
|
'aria-expanded': isOpen,
|
131
|
+
tabIndex: 0,
|
119
132
|
onClick: handleTargetClick,
|
120
133
|
// Compensate for accidental open/close on double-click.
|
121
134
|
// Only open on double-click.
|
@@ -167,7 +180,7 @@ var Coachmark = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
167
180
|
kind: overlayKind,
|
168
181
|
onClose: handleClose,
|
169
182
|
theme: theme,
|
170
|
-
className: overlayClassName
|
183
|
+
className: (0, _classnames.default)(overlayClassName, "".concat(overlayBlockClass, "--is-visible"))
|
171
184
|
}, children), portalNode)));
|
172
185
|
});
|
173
186
|
|
@@ -189,7 +202,6 @@ Coachmark.propTypes = {
|
|
189
202
|
* @see COACHMARK_ALIGNMENT
|
190
203
|
*/
|
191
204
|
align: _propTypes.default.oneOf(['bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom', 'right', 'right-top', 'right-bottom', 'top', 'top-left', 'top-right']),
|
192
|
-
// TODO: UPDATE COMMENT HERE - UPDATE MDX TO HAVE DIRECTION TO USE ONLY OVERLAY ELEMENTS>...
|
193
205
|
/**
|
194
206
|
* Coachmark should use a single CoachmarkOverlayElements component as a child.
|
195
207
|
* @see CoachmarkOverlayElements
|
@@ -16,7 +16,7 @@ var _iconsReact = require("@carbon/icons-react");
|
|
16
16
|
var _carbonComponentsReact = require("carbon-components-react");
|
17
17
|
var _devtools = require("../../global/js/utils/devtools");
|
18
18
|
var _settings = require("../../settings");
|
19
|
-
var _excluded = ["closeIconDescription", "onClose", "onDrag", "showCloseButton", "theme"];
|
19
|
+
var _excluded = ["a11yKeyboardHandler", "closeIconDescription", "onClose", "onDrag", "showCloseButton", "theme"];
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
22
22
|
// Carbon and package components we use.
|
@@ -24,6 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
24
24
|
|
25
25
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
26
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-dragbar");
|
27
|
+
var overlayBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
|
27
28
|
var componentName = 'CoachmarkDragbar';
|
28
29
|
var defaults = {
|
29
30
|
closeIconDescription: 'Close',
|
@@ -38,7 +39,8 @@ var defaults = {
|
|
38
39
|
* of other Novice to Pro components.
|
39
40
|
*/
|
40
41
|
var CoachmarkDragbar = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
41
|
-
var
|
42
|
+
var a11yKeyboardHandler = _ref.a11yKeyboardHandler,
|
43
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
42
44
|
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
43
45
|
_ref$onClose = _ref.onClose,
|
44
46
|
onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
|
@@ -88,15 +90,16 @@ var CoachmarkDragbar = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
88
90
|
// role="main"
|
89
91
|
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("button", {
|
90
92
|
type: "button",
|
91
|
-
className: "".concat(
|
92
|
-
onMouseDown: handleDragStart
|
93
|
+
className: "".concat(overlayBlockClass, "__handle"),
|
94
|
+
onMouseDown: handleDragStart,
|
95
|
+
onKeyDown: a11yKeyboardHandler
|
93
96
|
}, /*#__PURE__*/_react.default.createElement(_iconsReact.Draggable16, null)), showCloseButton && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
94
97
|
kind: "ghost",
|
95
98
|
size: "sm",
|
96
99
|
renderIcon: _iconsReact.Close16,
|
97
100
|
iconDescription: closeIconDescription,
|
98
101
|
hasIconOnly: true,
|
99
|
-
className: "".concat(
|
102
|
+
className: "".concat(overlayBlockClass, "--close-btn"),
|
100
103
|
onClick: onClose
|
101
104
|
}));
|
102
105
|
});
|
@@ -113,6 +116,10 @@ CoachmarkDragbar.displayName = componentName;
|
|
113
116
|
// in alphabetical order (for consistency).
|
114
117
|
// See https://www.npmjs.com/package/prop-types#usage.
|
115
118
|
CoachmarkDragbar.propTypes = {
|
119
|
+
/**
|
120
|
+
* Handler to manage keyboard interactions with the dragbar.
|
121
|
+
*/
|
122
|
+
a11yKeyboardHandler: _propTypes.default.func.isRequired,
|
116
123
|
/**
|
117
124
|
* Tooltip text and aria label for the Close button icon.
|
118
125
|
*/
|
@@ -17,6 +17,7 @@ var _settings = require("../../settings");
|
|
17
17
|
var _excluded = ["closeIconDescription", "onClose", "showCloseButton", "theme"];
|
18
18
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
19
19
|
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-header");
|
20
|
+
var overlayBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
|
20
21
|
var componentName = 'CoachmarkHeader';
|
21
22
|
var defaults = {
|
22
23
|
closeIconDescription: 'Close',
|
@@ -49,7 +50,7 @@ var CoachmarkHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
49
50
|
renderIcon: _iconsReact.Close16,
|
50
51
|
iconDescription: closeIconDescription,
|
51
52
|
hasIconOnly: true,
|
52
|
-
className: "".concat(
|
53
|
+
className: "".concat(overlayBlockClass, "--close-btn"),
|
53
54
|
onClick: onClose
|
54
55
|
}));
|
55
56
|
});
|