@carbon/ibm-products 2.33.0 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +303 -11
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +303 -11
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +303 -11
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/es/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.js +304 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/es/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/es/components/EditSidePanel/EditSidePanel.js +8 -10
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +83 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +94 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +3 -1
- package/es/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +157 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +72 -0
- package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- package/es/components/FilterPanel/index.d.ts +4 -0
- package/es/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/es/components/OptionsTile/OptionsTile.js +9 -20
- package/es/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/es/components/RemoveModal/RemoveModal.js +1 -0
- package/es/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/es/components/ScrollGradient/ScrollGradient.js +156 -0
- package/es/components/ScrollGradient/constants.d.ts +15 -0
- package/es/components/ScrollGradient/constants.js +121 -0
- package/es/components/ScrollGradient/index.d.ts +1 -0
- package/es/components/SidePanel/SidePanel.d.ts +144 -2
- package/es/components/SidePanel/SidePanel.js +57 -48
- package/es/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/es/components/StatusIcon/StatusIcon.js +97 -95
- package/es/components/TruncatedList/TruncatedList.js +5 -3
- package/es/components/UserAvatar/UserAvatar.js +3 -2
- package/es/components/index.d.ts +2 -1
- package/es/global/js/package-settings.d.ts +5 -0
- package/es/global/js/package-settings.js +5 -0
- package/es/index.js +5 -0
- package/es/settings.d.ts +5 -0
- package/lib/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/lib/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.js +311 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/lib/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/lib/components/EditSidePanel/EditSidePanel.js +8 -10
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +90 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +101 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +3 -1
- package/lib/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +164 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +79 -0
- package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- package/lib/components/FilterPanel/index.d.ts +4 -0
- package/lib/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/lib/components/OptionsTile/OptionsTile.js +9 -20
- package/lib/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/lib/components/RemoveModal/RemoveModal.js +1 -0
- package/lib/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/lib/components/ScrollGradient/ScrollGradient.js +163 -0
- package/lib/components/ScrollGradient/constants.d.ts +15 -0
- package/lib/components/ScrollGradient/constants.js +128 -0
- package/lib/components/ScrollGradient/index.d.ts +1 -0
- package/lib/components/SidePanel/SidePanel.d.ts +144 -2
- package/lib/components/SidePanel/SidePanel.js +57 -48
- package/lib/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/lib/components/StatusIcon/StatusIcon.js +97 -95
- package/lib/components/TruncatedList/TruncatedList.js +5 -3
- package/lib/components/UserAvatar/UserAvatar.js +3 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/global/js/package-settings.d.ts +5 -0
- package/lib/global/js/package-settings.js +5 -0
- package/lib/index.js +25 -0
- package/lib/settings.d.ts +5 -0
- package/package.json +3 -3
- package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +56 -0
- package/scss/components/FilterPanel/_filter-panel-accordion.scss +6 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +62 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox.scss +25 -3
- package/scss/components/FilterPanel/_filter-panel-group.scss +39 -0
- package/scss/components/FilterPanel/_filter-panel-label.scss +0 -8
- package/scss/components/FilterPanel/_filter-panel.scss +2 -0
- package/scss/components/FilterPanel/_index-with-carbon.scss +4 -0
- package/scss/components/FilterPanel/_index.scss +4 -0
- package/scss/components/ScrollGradient/_carbon-imports.scss +9 -0
- package/scss/components/ScrollGradient/_index-with-carbon.scss +9 -0
- package/scss/components/ScrollGradient/_index.scss +8 -0
- package/scss/components/ScrollGradient/_scroll-gradient.scss +102 -0
- package/scss/components/UserAvatar/_user-avatar.scss +37 -4
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var index = require('../../node_modules/prop-types/index.js');
|
15
|
+
var cx = require('classnames');
|
16
|
+
var devtools = require('../../global/js/utils/devtools.js');
|
17
|
+
var settings = require('../../settings.js');
|
18
|
+
var lodash = require('lodash');
|
19
|
+
var constants = require('./constants.js');
|
20
|
+
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
|
+
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
24
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
25
|
+
|
26
|
+
var _excluded = ["children", "className", "color", "onScroll", "scrollElementClassName", "getScrollElementRef", "hideStartGradient"];
|
27
|
+
var blockClass = "".concat(settings.pkg.prefix, "--scroll-gradient");
|
28
|
+
var componentName = 'ScrollGradient';
|
29
|
+
|
30
|
+
// Default values for props
|
31
|
+
var defaults = {
|
32
|
+
color: "var(--".concat(settings.carbon.prefix, "-layer-01)"),
|
33
|
+
hideStartGradient: false,
|
34
|
+
onScroll: function onScroll() {},
|
35
|
+
getScrollElementRef: function getScrollElementRef() {}
|
36
|
+
};
|
37
|
+
|
38
|
+
/**
|
39
|
+
* TODO: A description of the component.
|
40
|
+
*/
|
41
|
+
exports.ScrollGradient = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
42
|
+
var children = _ref.children,
|
43
|
+
className = _ref.className,
|
44
|
+
_ref$color = _ref.color,
|
45
|
+
color = _ref$color === void 0 ? defaults.color : _ref$color,
|
46
|
+
_ref$onScroll = _ref.onScroll,
|
47
|
+
onScroll = _ref$onScroll === void 0 ? defaults.onScroll : _ref$onScroll,
|
48
|
+
scrollElementClassName = _ref.scrollElementClassName,
|
49
|
+
_ref$getScrollElement = _ref.getScrollElementRef,
|
50
|
+
getScrollElementRef = _ref$getScrollElement === void 0 ? defaults.getScrollElementRef : _ref$getScrollElement,
|
51
|
+
_ref$hideStartGradien = _ref.hideStartGradient,
|
52
|
+
hideStartGradient = _ref$hideStartGradien === void 0 ? defaults.hideStartGradient : _ref$hideStartGradien,
|
53
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
54
|
+
var _useState = React.useState(constants.ScrollStates.NONE),
|
55
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
56
|
+
verticalPosition = _useState2[0],
|
57
|
+
setVerticalPosition = _useState2[1];
|
58
|
+
var _useState3 = React.useState(constants.ScrollStates.NONE),
|
59
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
60
|
+
horizontalPosition = _useState4[0],
|
61
|
+
setHorizontalPosition = _useState4[1];
|
62
|
+
var scrollContainer = React.useRef();
|
63
|
+
var contentChildrenContainer = React.useRef();
|
64
|
+
var updateScrollState = lodash.throttle(function () {
|
65
|
+
var updatedVerticalVal = constants.getScrollState(scrollContainer.current, constants.ScrollDirection.Y);
|
66
|
+
var updatedHorizontalVal = constants.getScrollState(scrollContainer.current, constants.ScrollDirection.X);
|
67
|
+
setVerticalPosition(updatedVerticalVal);
|
68
|
+
setHorizontalPosition(updatedHorizontalVal);
|
69
|
+
}, 150);
|
70
|
+
var scrollHandler = React.useCallback(function (event) {
|
71
|
+
onScroll(event);
|
72
|
+
updateScrollState();
|
73
|
+
}, [onScroll, updateScrollState]);
|
74
|
+
var setRefs = function setRefs(element) {
|
75
|
+
scrollContainer.current = element;
|
76
|
+
getScrollElementRef(element);
|
77
|
+
};
|
78
|
+
React.useEffect(function () {
|
79
|
+
scrollHandler();
|
80
|
+
}, [scrollHandler]);
|
81
|
+
var _useIsOverflow = constants.useIsOverflow(scrollContainer),
|
82
|
+
xScrollable = _useIsOverflow.xScrollable,
|
83
|
+
yScrollable = _useIsOverflow.yScrollable;
|
84
|
+
var gradientRight = yScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetWidth - contentChildrenContainer.current.offsetWidth : 0;
|
85
|
+
var gradientBottom = xScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetHeight - contentChildrenContainer.current.offsetHeight : 0;
|
86
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
87
|
+
className: cx__default["default"](blockClass, "".concat(blockClass, "--x-").concat(horizontalPosition.toLowerCase()), "".concat(blockClass, "--y-").concat(verticalPosition.toLowerCase()), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--x-scrollable"), xScrollable), "".concat(blockClass, "--y-scrollable"), yScrollable), className),
|
88
|
+
ref: ref,
|
89
|
+
role: "presentation"
|
90
|
+
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("div", {
|
91
|
+
onScroll: scrollHandler,
|
92
|
+
ref: setRefs,
|
93
|
+
className: cx__default["default"]("".concat(blockClass, "__content"), scrollElementClassName)
|
94
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
95
|
+
ref: contentChildrenContainer,
|
96
|
+
className: "".concat(blockClass, "__content-children")
|
97
|
+
}, children)), !hideStartGradient && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
98
|
+
className: "".concat(blockClass, "__start-vertical"),
|
99
|
+
style: {
|
100
|
+
right: gradientRight,
|
101
|
+
backgroundImage: "linear-gradient(0deg, transparent, ".concat(color, " 90%)")
|
102
|
+
},
|
103
|
+
role: "presentation",
|
104
|
+
"aria-hidden": true
|
105
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
106
|
+
className: "".concat(blockClass, "__start-horizontal"),
|
107
|
+
style: {
|
108
|
+
backgroundImage: "linear-gradient(-90deg, transparent, ".concat(color, " 90%)"),
|
109
|
+
bottom: gradientBottom
|
110
|
+
},
|
111
|
+
role: "presentation",
|
112
|
+
"aria-hidden": true
|
113
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
114
|
+
className: "".concat(blockClass, "__end-vertical"),
|
115
|
+
style: {
|
116
|
+
right: gradientRight,
|
117
|
+
bottom: gradientBottom,
|
118
|
+
backgroundImage: "linear-gradient(0deg, ".concat(color, " 10%, transparent)")
|
119
|
+
},
|
120
|
+
role: "presentation",
|
121
|
+
"aria-hidden": true
|
122
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
123
|
+
className: "".concat(blockClass, "__end-horizontal"),
|
124
|
+
style: {
|
125
|
+
right: gradientRight,
|
126
|
+
bottom: gradientBottom,
|
127
|
+
backgroundImage: "linear-gradient(-90deg, ".concat(color, " 10%, transparent)")
|
128
|
+
},
|
129
|
+
role: "presentation",
|
130
|
+
"aria-hidden": true
|
131
|
+
}));
|
132
|
+
});
|
133
|
+
|
134
|
+
// Return a placeholder if not released and not enabled by feature flag
|
135
|
+
exports.ScrollGradient = settings.pkg.checkComponentEnabled(exports.ScrollGradient, componentName);
|
136
|
+
|
137
|
+
// The display name of the component, used by React. Note that displayName
|
138
|
+
// is used in preference to relying on function.name.
|
139
|
+
exports.ScrollGradient.displayName = componentName;
|
140
|
+
|
141
|
+
// The types and DocGen commentary for the component props,
|
142
|
+
// in alphabetical order (for consistency).
|
143
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
144
|
+
exports.ScrollGradient.propTypes = {
|
145
|
+
/**
|
146
|
+
* Provide the contents of the ScrollGradient.
|
147
|
+
*/
|
148
|
+
children: index["default"].oneOfType([index["default"].arrayOf(index["default"].node), index["default"].node]),
|
149
|
+
/**
|
150
|
+
* Provide an optional class to be applied to the containing node.
|
151
|
+
*/
|
152
|
+
className: index["default"].string,
|
153
|
+
/** @type {string} Fade out color. Any valid CSS color value works */
|
154
|
+
color: index["default"].string,
|
155
|
+
/** @type {(element: HTMLElement) => {}} Optional function to get reference to scrollable DOM element */
|
156
|
+
getScrollElementRef: index["default"].func,
|
157
|
+
/** @type {boolean} Set to true if you want to hide gradient on the start side (top or left) of scrollable element. */
|
158
|
+
hideStartGradient: index["default"].bool,
|
159
|
+
/** @type {Function} Optional scroll handler */
|
160
|
+
onScroll: index["default"].func,
|
161
|
+
/** @type {string} Optional classname for scroll element. */
|
162
|
+
scrollElementClassName: index["default"].string
|
163
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export namespace ScrollDirection {
|
2
|
+
let X: string;
|
3
|
+
let Y: string;
|
4
|
+
}
|
5
|
+
export namespace ScrollStates {
|
6
|
+
let NONE: string;
|
7
|
+
let INITIAL: string;
|
8
|
+
let STARTED: string;
|
9
|
+
let END: string;
|
10
|
+
}
|
11
|
+
export function getScrollState(element: any, scrollDirection: any): string;
|
12
|
+
export function useIsOverflow(ref: any): {
|
13
|
+
xScrollable: undefined;
|
14
|
+
yScrollable: undefined;
|
15
|
+
};
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
|
15
|
+
var ScrollDirection = {
|
16
|
+
X: 'X',
|
17
|
+
Y: 'Y'
|
18
|
+
};
|
19
|
+
var ScrollStates = {
|
20
|
+
// No scrolling required because content fits within container.
|
21
|
+
NONE: 'NONE',
|
22
|
+
// Scroll position is a the start of the scrollable content.
|
23
|
+
INITIAL: 'INITIAL',
|
24
|
+
// Scroll position is neither at start or end of scrollable content.
|
25
|
+
STARTED: 'STARTED',
|
26
|
+
// Scroll position is a the end of the scrollable content.
|
27
|
+
END: 'END'
|
28
|
+
};
|
29
|
+
|
30
|
+
// FUNCTIONS
|
31
|
+
|
32
|
+
var getScrollState = function getScrollState(element, scrollDirection) {
|
33
|
+
// console.log('getScrollState - element: ', element);
|
34
|
+
// console.log('getScrollState - scrollDirection: ', scrollDirection);
|
35
|
+
// console.log('-------------------------------------------------');
|
36
|
+
switch (scrollDirection) {
|
37
|
+
case ScrollDirection.X:
|
38
|
+
{
|
39
|
+
if (element.scrollWidth === element.clientWidth) {
|
40
|
+
return ScrollStates.NONE;
|
41
|
+
}
|
42
|
+
if (element.scrollLeft === 0) {
|
43
|
+
return ScrollStates.INITIAL;
|
44
|
+
}
|
45
|
+
if (element.scrollLeft + element.clientWidth === element.scrollWidth) {
|
46
|
+
return ScrollStates.END;
|
47
|
+
}
|
48
|
+
return ScrollStates.STARTED;
|
49
|
+
}
|
50
|
+
case ScrollDirection.Y:
|
51
|
+
default:
|
52
|
+
{
|
53
|
+
if (element.scrollHeight === element.clientHeight) {
|
54
|
+
return ScrollStates.NONE;
|
55
|
+
}
|
56
|
+
if (element.scrollTop === 0) {
|
57
|
+
return ScrollStates.INITIAL;
|
58
|
+
}
|
59
|
+
if (element.scrollTop + element.clientHeight === element.scrollHeight) {
|
60
|
+
return ScrollStates.END;
|
61
|
+
}
|
62
|
+
return ScrollStates.STARTED;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
var useIsOverflow = function useIsOverflow(ref) {
|
67
|
+
var _useState = React.useState(),
|
68
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
69
|
+
isHorizontallyScrollable = _useState2[0],
|
70
|
+
setIsHorizontallyScrollable = _useState2[1];
|
71
|
+
var _useState3 = React.useState(),
|
72
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
73
|
+
isVerticallyScrollable = _useState4[0],
|
74
|
+
setIsVerticallyScrollable = _useState4[1];
|
75
|
+
var _useState5 = React.useState(),
|
76
|
+
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
77
|
+
mutationObserver = _useState6[0],
|
78
|
+
setMutationObserver = _useState6[1];
|
79
|
+
var _useState7 = React.useState(),
|
80
|
+
_useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
|
81
|
+
resizeObserver = _useState8[0],
|
82
|
+
setResizeObserver = _useState8[1];
|
83
|
+
var checkOverflow = React.useCallback(function () {
|
84
|
+
if (!ref.current) {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
setIsHorizontallyScrollable(ref.current.scrollWidth > ref.current.clientWidth);
|
88
|
+
setIsVerticallyScrollable(ref.current.scrollHeight > ref.current.clientHeight);
|
89
|
+
}, [ref]);
|
90
|
+
React.useEffect(function () {
|
91
|
+
if (!mutationObserver) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
return function () {
|
95
|
+
if (mutationObserver) {
|
96
|
+
mutationObserver.disconnect();
|
97
|
+
}
|
98
|
+
if (resizeObserver) {
|
99
|
+
resizeObserver.disconnect();
|
100
|
+
}
|
101
|
+
};
|
102
|
+
});
|
103
|
+
React.useLayoutEffect(function () {
|
104
|
+
var current = ref.current;
|
105
|
+
if (current) {
|
106
|
+
if ('ResizeObserver' in window && !resizeObserver) {
|
107
|
+
setResizeObserver(new ResizeObserver(checkOverflow).observe(current));
|
108
|
+
}
|
109
|
+
if ('MutationObserver' in window && !mutationObserver) {
|
110
|
+
setMutationObserver(new MutationObserver(checkOverflow).observe(current, {
|
111
|
+
attributes: false,
|
112
|
+
childList: true,
|
113
|
+
subtree: false
|
114
|
+
}));
|
115
|
+
}
|
116
|
+
checkOverflow();
|
117
|
+
}
|
118
|
+
}, [ref, checkOverflow, mutationObserver, resizeObserver]);
|
119
|
+
return {
|
120
|
+
xScrollable: isHorizontallyScrollable,
|
121
|
+
yScrollable: isVerticallyScrollable
|
122
|
+
};
|
123
|
+
};
|
124
|
+
|
125
|
+
exports.ScrollDirection = ScrollDirection;
|
126
|
+
exports.ScrollStates = ScrollStates;
|
127
|
+
exports.getScrollState = getScrollState;
|
128
|
+
exports.useIsOverflow = useIsOverflow;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { ScrollGradient } from "./ScrollGradient";
|
@@ -1,5 +1,147 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
8
|
+
import React, { ReactNode } from 'react';
|
9
|
+
import { ButtonProps } from '@carbon/react';
|
10
|
+
type SidePanelBaseProps = {
|
11
|
+
/**
|
12
|
+
* Sets the action toolbar buttons
|
13
|
+
*/
|
14
|
+
actionToolbarButtons?: ButtonProps[];
|
15
|
+
/**
|
16
|
+
* The primary actions to be shown in the side panel. Each action is
|
17
|
+
* specified as an object that will render expressive Buttons. Any Button
|
18
|
+
* props can be passed in and any other fields in the object will be
|
19
|
+
* passed through to the button element as HTML attributes.
|
20
|
+
*
|
21
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
22
|
+
*/
|
23
|
+
actions?: ButtonProps[];
|
24
|
+
/**
|
25
|
+
* Determines if the title will animate on scroll
|
26
|
+
*/
|
27
|
+
animateTitle?: boolean;
|
28
|
+
/**
|
29
|
+
* Sets the body content of the side panel
|
30
|
+
*/
|
31
|
+
children: ReactNode;
|
32
|
+
/**
|
33
|
+
* Sets an optional className to be added to the side panel outermost element
|
34
|
+
*/
|
35
|
+
className?: string;
|
36
|
+
/**
|
37
|
+
* Sets the close button icon description
|
38
|
+
*/
|
39
|
+
closeIconDescription?: string;
|
40
|
+
/**
|
41
|
+
* Determines whether the side panel should render the condensed version (affects action buttons primarily)
|
42
|
+
*/
|
43
|
+
condensedActions?: boolean;
|
44
|
+
/**
|
45
|
+
* Sets the current step of the side panel
|
46
|
+
*/
|
47
|
+
currentStep?: number;
|
48
|
+
/**
|
49
|
+
* Unique identifier
|
50
|
+
*/
|
51
|
+
id?: string;
|
52
|
+
/**
|
53
|
+
* Determines whether the side panel should render with an overlay
|
54
|
+
*/
|
55
|
+
includeOverlay?: boolean;
|
56
|
+
/**
|
57
|
+
* Sets the label text which will display above the title text
|
58
|
+
*/
|
59
|
+
labelText?: string;
|
60
|
+
/**
|
61
|
+
* Sets the icon description for the navigation back icon button
|
62
|
+
*/
|
63
|
+
navigationBackIconDescription?: string;
|
64
|
+
/**
|
65
|
+
* Changes the current side panel page to the previous page
|
66
|
+
*/
|
67
|
+
onNavigationBack?(): void;
|
68
|
+
/**
|
69
|
+
* Specify a handler for closing the side panel.
|
70
|
+
* This handler closes the modal, e.g. changing `open` prop.
|
71
|
+
*/
|
72
|
+
onRequestClose?(): void;
|
73
|
+
/**
|
74
|
+
* Optional function called when the side panel exit animation is complete.
|
75
|
+
* This handler can be used for any state cleanup needed before the panel is removed from the DOM.
|
76
|
+
*/
|
77
|
+
onUnmount?(): void;
|
78
|
+
/**
|
79
|
+
* Determines whether the side panel should render or not
|
80
|
+
*/
|
81
|
+
open: boolean;
|
82
|
+
/**
|
83
|
+
* Determines if the side panel is on the right or left
|
84
|
+
*/
|
85
|
+
placement?: 'left' | 'right';
|
86
|
+
/**
|
87
|
+
* Prevent closing on click outside of the panel
|
88
|
+
*/
|
89
|
+
preventCloseOnClickOutside?: boolean;
|
90
|
+
/**
|
91
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
92
|
+
* This prop is required when using the `slideIn` variant of the side panel.
|
93
|
+
*/
|
94
|
+
selectorPageContent?: string;
|
95
|
+
/**
|
96
|
+
* Specify a CSS selector that matches the DOM element that should
|
97
|
+
* be focused when the side panel opens
|
98
|
+
*/
|
99
|
+
selectorPrimaryFocus?: string;
|
100
|
+
/**
|
101
|
+
* Sets the size of the side panel
|
102
|
+
*/
|
103
|
+
size: 'xs' | 'sm' | 'md' | 'lg' | '2xl';
|
104
|
+
/**
|
105
|
+
* Determines if this panel slides in
|
106
|
+
*/
|
107
|
+
slideIn?: boolean;
|
108
|
+
/**
|
109
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
110
|
+
*/
|
111
|
+
slug?: ReactNode;
|
112
|
+
/**
|
113
|
+
* Sets the subtitle text
|
114
|
+
*/
|
115
|
+
subtitle?: ReactNode;
|
116
|
+
/**
|
117
|
+
* Sets the title text
|
118
|
+
*/
|
119
|
+
title?: string;
|
120
|
+
};
|
121
|
+
type SidePanelSlideInProps = {
|
122
|
+
/**
|
123
|
+
* Determines if this panel slides in
|
124
|
+
*/
|
125
|
+
slideIn?: false;
|
126
|
+
/**
|
127
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
128
|
+
* This prop is required when using the `slideIn` variant of the side panel.
|
129
|
+
*/
|
130
|
+
selectorPageContent?: string;
|
131
|
+
} | {
|
132
|
+
/**
|
133
|
+
* Determines if this panel slides in
|
134
|
+
*/
|
135
|
+
slideIn: true;
|
136
|
+
/**
|
137
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
138
|
+
* This prop is required when using the `slideIn` variant of the side panel. Required for slideIn panels.
|
139
|
+
*/
|
140
|
+
selectorPageContent: string;
|
141
|
+
};
|
142
|
+
type SidePanelProps = SidePanelBaseProps & SidePanelSlideInProps;
|
1
143
|
/**
|
2
144
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
3
145
|
*/
|
4
|
-
export let SidePanel: React.ForwardRefExoticComponent<React.RefAttributes<
|
5
|
-
|
146
|
+
export declare let SidePanel: React.ForwardRefExoticComponent<SidePanelProps & React.RefAttributes<HTMLDivElement>>;
|
147
|
+
export {};
|