@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
@@ -37,8 +37,8 @@ var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children",
|
|
37
37
|
_excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
38
38
|
var blockClass = "".concat(settings.pkg.prefix, "--side-panel");
|
39
39
|
var componentName = 'SidePanel';
|
40
|
-
|
41
|
-
|
40
|
+
// `any` is a work around until ActionSet is migrated to TS
|
41
|
+
var MotionActionSet = framerMotion.motion(ActionSet.ActionSet);
|
42
42
|
|
43
43
|
// Default values for props
|
44
44
|
var defaults = {
|
@@ -49,7 +49,6 @@ var defaults = {
|
|
49
49
|
placement: 'right',
|
50
50
|
size: 'md'
|
51
51
|
};
|
52
|
-
var MotionActionSet = framerMotion.motion(ActionSet.ActionSet);
|
53
52
|
|
54
53
|
/**
|
55
54
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
@@ -93,16 +92,16 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
93
92
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
94
93
|
animationComplete = _useState2[0],
|
95
94
|
setAnimationComplete = _useState2[1];
|
96
|
-
var localRef = React.useRef();
|
95
|
+
var localRef = React.useRef(null);
|
97
96
|
var sidePanelRef = ref || localRef;
|
98
|
-
var overlayRef = React.useRef();
|
99
|
-
var innerContentRef = React.useRef();
|
100
|
-
var closeRef = React.useRef();
|
101
|
-
var animatedScrollRef = React.useRef();
|
102
|
-
var headerRef = React.useRef();
|
103
|
-
var titleRef = React.useRef();
|
104
|
-
var labelTextRef = React.useRef();
|
105
|
-
var subtitleRef = React.useRef();
|
97
|
+
var overlayRef = React.useRef(null);
|
98
|
+
var innerContentRef = React.useRef(null);
|
99
|
+
var closeRef = React.useRef(null);
|
100
|
+
var animatedScrollRef = React.useRef(null);
|
101
|
+
var headerRef = React.useRef(null);
|
102
|
+
var titleRef = React.useRef(null);
|
103
|
+
var labelTextRef = React.useRef(null);
|
104
|
+
var subtitleRef = React.useRef(null);
|
106
105
|
var previousState = usePreviousValue.usePreviousValue({
|
107
106
|
size: size,
|
108
107
|
open: open
|
@@ -118,32 +117,36 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
118
117
|
var _useFocus = useFocus.useFocus(sidePanelRef),
|
119
118
|
firstElement = _useFocus.firstElement,
|
120
119
|
keyDownListener = _useFocus.keyDownListener;
|
120
|
+
var panelRefValue = sidePanelRef.current;
|
121
121
|
var shouldReduceMotion = framerMotion.useReducedMotion();
|
122
122
|
React.useEffect(function () {
|
123
123
|
setDoAnimateTitle(animateTitle);
|
124
124
|
}, [animateTitle]);
|
125
125
|
var handleScroll = React.useCallback(function () {
|
126
|
-
var
|
127
|
-
|
128
|
-
|
126
|
+
var _animatedScrollRef$cu;
|
127
|
+
var scrollTop = animatedScrollRef === null || animatedScrollRef === void 0 || (_animatedScrollRef$cu = animatedScrollRef.current) === null || _animatedScrollRef$cu === void 0 ? void 0 : _animatedScrollRef$cu.scrollTop;
|
128
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), (Math.min(Number(scrollTop), scrollAnimationDistance) / scrollAnimationDistance).toString());
|
129
|
+
}, [scrollAnimationDistance, panelRefValue]);
|
129
130
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
130
131
|
matches: true
|
131
132
|
};
|
132
133
|
|
133
134
|
// scroll panel to top going between steps
|
134
135
|
React.useEffect(function () {
|
135
|
-
if (sidePanelRef &&
|
136
|
-
var _animatedScrollRef$
|
137
|
-
var scrollableSection = (_animatedScrollRef$
|
138
|
-
scrollableSection
|
136
|
+
if (sidePanelRef && panelRefValue) {
|
137
|
+
var _animatedScrollRef$cu2;
|
138
|
+
var scrollableSection = (_animatedScrollRef$cu2 = animatedScrollRef.current) !== null && _animatedScrollRef$cu2 !== void 0 ? _animatedScrollRef$cu2 : innerContentRef.current;
|
139
|
+
if (scrollableSection) {
|
140
|
+
scrollableSection.scrollTop = 0;
|
141
|
+
}
|
139
142
|
// The size of the panel has changed while it is still opened
|
140
143
|
// so we need to scroll it to the top and reset the header
|
141
144
|
// height css custom property
|
142
|
-
if (
|
145
|
+
if (previousState && previousState['size'] !== size && scrollableSection) {
|
143
146
|
scrollableSection.scrollTop = 0;
|
144
147
|
}
|
145
148
|
}
|
146
|
-
}, [currentStep, sidePanelRef, size, previousState
|
149
|
+
}, [currentStep, sidePanelRef, size, previousState, id, panelRefValue]);
|
147
150
|
|
148
151
|
// Add console warning if labelText is provided without a title.
|
149
152
|
// This combination is not allowed.
|
@@ -154,7 +157,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
154
157
|
}, [labelText, title]);
|
155
158
|
var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
|
156
159
|
var canDoAnimateTitle = false;
|
157
|
-
if (
|
160
|
+
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
158
161
|
var _labelTextRef$current, _labelTextRef$current2, _subtitleRef$current$, _subtitleRef$current;
|
159
162
|
var titleEl = titleRef.current;
|
160
163
|
var labelHeight = (_labelTextRef$current = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.offsetHeight) !== null && _labelTextRef$current !== void 0 ? _labelTextRef$current : 0;
|
@@ -167,7 +170,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
167
170
|
setScrollAnimationDistance(_scrollAnimationDistance);
|
168
171
|
|
169
172
|
// used to calculate the header moves
|
170
|
-
|
173
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
|
171
174
|
var scrollEl = animatedScrollRef.current;
|
172
175
|
if (!scrollEl && animateTitle && !doAnimateTitle) {
|
173
176
|
// may be switching back based on resize
|
@@ -192,9 +195,9 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
192
195
|
animatedScrollRef.current.addEventListener('scroll', handleScroll);
|
193
196
|
}
|
194
197
|
if (!doAnimateTitle && sidePanelRef.current) {
|
195
|
-
|
198
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), '0');
|
196
199
|
}
|
197
|
-
}, [animatedScrollRef, doAnimateTitle, handleScroll, sidePanelRef]);
|
200
|
+
}, [animatedScrollRef, doAnimateTitle, handleScroll, sidePanelRef, panelRefValue]);
|
198
201
|
|
199
202
|
/* istanbul ignore next */
|
200
203
|
var handleResize = function handleResize() {
|
@@ -203,7 +206,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
203
206
|
|
204
207
|
// Calculate scroll distances
|
205
208
|
React.useEffect(function () {
|
206
|
-
if (
|
209
|
+
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
207
210
|
checkSetDoAnimateTitle();
|
208
211
|
}
|
209
212
|
|
@@ -213,7 +216,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
213
216
|
// click outside functionality if `includeOverlay` prop is set
|
214
217
|
React.useEffect(function () {
|
215
218
|
var handleOutsideClick = function handleOutsideClick(event) {
|
216
|
-
if (
|
219
|
+
if (panelRefValue && overlayRef.current && overlayRef.current.contains(event.target) && onRequestClose) {
|
217
220
|
onRequestClose();
|
218
221
|
}
|
219
222
|
};
|
@@ -231,7 +234,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
231
234
|
bodyElement.style.overflow = '';
|
232
235
|
document.removeEventListener('click', handleOutsideClick);
|
233
236
|
};
|
234
|
-
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, onUnmount, sidePanelRef]);
|
237
|
+
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, onUnmount, sidePanelRef, panelRefValue]);
|
235
238
|
|
236
239
|
// initializes the side panel to close
|
237
240
|
var onAnimationEnd = function onAnimationEnd() {
|
@@ -250,43 +253,43 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
250
253
|
}, [reducedMotion.matches]);
|
251
254
|
|
252
255
|
// initializes the side panel to open
|
253
|
-
var
|
256
|
+
var onAnimationStart = function onAnimationStart() {
|
254
257
|
setAnimationComplete(false);
|
255
258
|
};
|
256
259
|
|
257
260
|
// used to reset margins of the slide in panel when closed/closing
|
258
261
|
React.useEffect(function () {
|
259
262
|
if (!open && slideIn) {
|
260
|
-
var pageContentElement = document.querySelector(selectorPageContent);
|
263
|
+
var pageContentElement = selectorPageContent ? document.querySelector(selectorPageContent) : null;
|
261
264
|
if (placement && placement === 'right' && pageContentElement) {
|
262
|
-
pageContentElement.style.marginInlineEnd = 0;
|
265
|
+
pageContentElement.style.marginInlineEnd = '0';
|
263
266
|
} else if (pageContentElement) {
|
264
|
-
pageContentElement.style.marginInlineStart = 0;
|
267
|
+
pageContentElement.style.marginInlineStart = '0';
|
265
268
|
}
|
266
269
|
}
|
267
270
|
}, [open, placement, selectorPageContent, slideIn]);
|
268
271
|
React.useEffect(function () {
|
269
|
-
if (!open && previousState
|
272
|
+
if (!open && previousState && previousState['open'] && reducedMotion.matches) {
|
270
273
|
onUnmount === null || onUnmount === void 0 || onUnmount();
|
271
274
|
}
|
272
|
-
}, [open, onUnmount, reducedMotion.matches, previousState
|
275
|
+
}, [open, onUnmount, reducedMotion.matches, previousState]);
|
273
276
|
|
274
277
|
// used to set margins of content for slide in panel version
|
275
278
|
React.useEffect(function () {
|
276
279
|
if (open && slideIn) {
|
277
|
-
var pageContentElement = document.querySelector(selectorPageContent);
|
280
|
+
var pageContentElement = selectorPageContent ? document.querySelector(selectorPageContent) : null;
|
278
281
|
if (pageContentElement) {
|
279
282
|
pageContentElement.style.inlineSize = 'auto';
|
280
283
|
} else {
|
281
284
|
pconsole["default"].warn('SidePanel prop `selectorPageContent` was not provided a selector that matches any element on your page. If an element is not found, the panel will render as a slide over.');
|
282
285
|
}
|
283
286
|
if (placement && placement === 'right' && pageContentElement) {
|
284
|
-
pageContentElement.style.marginInlineEnd = 0;
|
285
|
-
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(carbonMotion.moderate02) :
|
287
|
+
pageContentElement.style.marginInlineEnd = '0';
|
288
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(carbonMotion.moderate02) : '';
|
286
289
|
pageContentElement.style.marginInlineEnd = constants.SIDE_PANEL_SIZES[size];
|
287
290
|
} else if (pageContentElement) {
|
288
|
-
pageContentElement.style.marginInlineStart = 0;
|
289
|
-
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(carbonMotion.moderate02) :
|
291
|
+
pageContentElement.style.marginInlineStart = '0';
|
292
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(carbonMotion.moderate02) : '';
|
290
293
|
pageContentElement.style.marginInlineStart = constants.SIDE_PANEL_SIZES[size];
|
291
294
|
}
|
292
295
|
}
|
@@ -294,10 +297,12 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
294
297
|
React.useEffect(function () {
|
295
298
|
if (open) {
|
296
299
|
setTimeout(function () {
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
primeFocusEl
|
300
|
+
if (selectorPrimaryFocus) {
|
301
|
+
var _document;
|
302
|
+
var primeFocusEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(selectorPrimaryFocus);
|
303
|
+
if (primeFocusEl) {
|
304
|
+
primeFocusEl === null || primeFocusEl === void 0 || primeFocusEl.focus();
|
305
|
+
}
|
301
306
|
} else {
|
302
307
|
firstElement === null || firstElement === void 0 || firstElement.focus();
|
303
308
|
}
|
@@ -324,7 +329,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
324
329
|
var _slug$type;
|
325
330
|
var slugCloseSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
|
326
331
|
var normalizedSlug;
|
327
|
-
if (slug && (
|
332
|
+
if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === 'Slug') {
|
328
333
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
329
334
|
// slug size is sm unless actions and size > md
|
330
335
|
size: slugCloseSize
|
@@ -409,9 +414,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
409
414
|
role: "complementary",
|
410
415
|
"aria-label": title,
|
411
416
|
onAnimationComplete: onAnimationEnd,
|
412
|
-
onAnimationStart:
|
413
|
-
return _onAnimationStart();
|
414
|
-
},
|
417
|
+
onAnimationStart: onAnimationStart,
|
415
418
|
variants: variants.panelVariants,
|
416
419
|
initial: "hidden",
|
417
420
|
animate: "visible",
|
@@ -471,7 +474,8 @@ exports.SidePanel.propTypes = {
|
|
471
474
|
*
|
472
475
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
473
476
|
*/
|
474
|
-
actions: propsHelper.allPropTypes([
|
477
|
+
actions: propsHelper.allPropTypes([/**@ts-ignore*/
|
478
|
+
ActionSet.ActionSet.validateActions(), index["default"].arrayOf(index["default"].shape(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, react.Button.propTypes), {}, {
|
475
479
|
kind: index["default"].oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
476
480
|
tooltipPosition: index["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
477
481
|
tooltipAlignment: index["default"].oneOf(['start', 'center', 'end']),
|
@@ -550,6 +554,7 @@ exports.SidePanel.propTypes = {
|
|
550
554
|
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
551
555
|
* This prop is required when using the `slideIn` variant of the side panel.
|
552
556
|
*/
|
557
|
+
/**@ts-ignore*/
|
553
558
|
selectorPageContent: index["default"].string.isRequired.if(function (_ref6) {
|
554
559
|
var slideIn = _ref6.slideIn;
|
555
560
|
return slideIn;
|
@@ -558,14 +563,17 @@ exports.SidePanel.propTypes = {
|
|
558
563
|
* Specify a CSS selector that matches the DOM element that should
|
559
564
|
* be focused when the side panel opens
|
560
565
|
*/
|
566
|
+
/**@ts-ignore*/
|
561
567
|
selectorPrimaryFocus: index["default"].string,
|
562
568
|
/**
|
563
569
|
* Sets the size of the side panel
|
564
570
|
*/
|
571
|
+
/**@ts-ignore*/
|
565
572
|
size: index["default"].oneOf(['xs', 'sm', 'md', 'lg', '2xl']),
|
566
573
|
/**
|
567
574
|
* Determines if this panel slides in
|
568
575
|
*/
|
576
|
+
/**@ts-ignore*/
|
569
577
|
slideIn: index["default"].bool,
|
570
578
|
/**
|
571
579
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
@@ -578,6 +586,7 @@ exports.SidePanel.propTypes = {
|
|
578
586
|
/**
|
579
587
|
* Sets the title text
|
580
588
|
*/
|
589
|
+
/**@ts-ignore*/
|
581
590
|
title: index["default"].string.isRequired.if(function (_ref7) {
|
582
591
|
var labelText = _ref7.labelText;
|
583
592
|
return labelText;
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2022
|
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
|
+
import React, { PropsWithChildren } from 'react';
|
1
8
|
/**
|
2
9
|
The `StatusIcon` component follows the Carbon guidelines for status icons with
|
3
10
|
some added specifications around illustration usage. For additional usage
|
@@ -7,5 +14,30 @@ _Status icons_ are an important method of communicating severity level
|
|
7
14
|
information to users. The shapes and colors, communicate severity that enable
|
8
15
|
users to quickly assess and identify status and respond accordingly.
|
9
16
|
*/
|
10
|
-
|
11
|
-
|
17
|
+
type Size = 'sm' | 'md' | 'lg' | 'xl';
|
18
|
+
type Theme = 'light' | 'dark';
|
19
|
+
type Kind = 'fatal' | 'critical' | 'major-warning' | 'minor-warning' | 'undefined' | 'unknown' | 'normal' | 'info' | 'in-progress' | 'running' | 'pending';
|
20
|
+
interface StatusIconProps extends PropsWithChildren {
|
21
|
+
/**
|
22
|
+
* Provide an optional class to be applied to the modal root node.
|
23
|
+
*/
|
24
|
+
className?: string;
|
25
|
+
/**
|
26
|
+
* A required prop that provides a title element and tooltip for the icon for accessibility purposes
|
27
|
+
*/
|
28
|
+
iconDescription: string;
|
29
|
+
/**
|
30
|
+
* A required prop that displays the respective icon associated with the status
|
31
|
+
*/
|
32
|
+
kind: Kind;
|
33
|
+
/**
|
34
|
+
* A required prop that displays the size of the icon associate with the status
|
35
|
+
*/
|
36
|
+
size: Size;
|
37
|
+
/**
|
38
|
+
* A required prop that displays the theme of the icon associated with the status
|
39
|
+
*/
|
40
|
+
theme: Theme;
|
41
|
+
}
|
42
|
+
export declare let StatusIcon: React.ForwardRefExoticComponent<StatusIconProps & React.RefAttributes<React.ReactSVGElement | null>>;
|
43
|
+
export {};
|