@carbon/ibm-products 2.68.0 → 2.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/carbon.css +382 -74
- package/css/carbon.css.map +1 -1
- package/css/index-full-carbon.css +524 -116
- 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-released-only.css +126 -42
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +142 -42
- 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 +185 -50
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_commonjsHelpers.js +3 -1
- package/es/_virtual/index2.js +6 -2
- package/es/_virtual/index3.js +10 -0
- package/es/components/AddSelect/AddSelectColumn.js +41 -18
- package/es/components/AddSelect/AddSelectSort.js +15 -16
- package/es/components/AddSelect/types/index.d.ts +1 -1
- package/es/components/Card/Card.d.ts +2 -2
- package/es/components/Card/Card.js +7 -4
- package/es/components/Coachmark/Coachmark.d.ts +43 -0
- package/es/components/Coachmark/Coachmark.js +49 -33
- package/es/components/Coachmark/CoachmarkOverlay.js +6 -0
- package/es/components/Coachmark/index.d.ts +1 -0
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +11 -0
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +19 -11
- package/es/components/CoachmarkButton/CoachmarkButton.js +7 -0
- package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +6 -0
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +7 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +7 -5
- package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -3
- package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -7
- 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/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +4 -3
- package/es/components/Datagrid/useNestedRowExpander.js +4 -2
- package/es/components/Datagrid/useOnRowClick.d.ts +1 -1
- package/es/components/Datagrid/useOnRowClick.js +6 -4
- package/es/components/Datagrid/useRowExpander.js +4 -2
- package/es/components/Datagrid/useSelectRows.d.ts +1 -1
- package/es/components/Datagrid/useSelectRows.js +4 -3
- package/es/components/Datagrid/useSortableColumns.d.ts +1 -1
- package/es/components/Datagrid/useSortableColumns.js +6 -5
- package/es/components/EditInPlace/EditInPlace.d.ts +1 -1
- package/es/components/EditInPlace/EditInPlace.js +4 -3
- package/es/components/EmptyStates/EmptyStateContent.d.ts +30 -1
- package/es/components/EmptyStates/EmptyStateContent.js +2 -2
- package/es/components/ExportModal/ExportModal.js +7 -5
- package/es/components/FeatureFlags/index.d.ts +31 -12
- package/es/components/FeatureFlags/index.js +46 -15
- package/es/components/InterstitialScreen/InterstitialScreenBody.js +3 -2
- package/es/components/InterstitialScreen/InterstitialScreenFooter.js +5 -2
- package/es/components/InterstitialScreen/InterstitialScreenHeader.js +3 -1
- package/es/components/ProductiveCard/ProductiveCard.d.ts +1 -1
- package/es/components/ScrollGradient/ScrollGradient.js +9 -7
- package/es/components/SidePanel/SidePanel.js +74 -0
- package/es/components/SidePanel/constants.d.ts +14 -8
- package/es/components/SidePanel/constants.js +1 -1
- package/es/components/SidePanel/resizer/Resizer.d.ts +21 -0
- package/es/components/SidePanel/resizer/Resizer.js +271 -0
- package/es/components/TruncatedList/TruncatedList.d.ts +1 -1
- package/es/components/TruncatedList/TruncatedList.js +4 -3
- package/es/feature-flags.js +5 -1
- package/es/index.js +1 -0
- package/es/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +3 -3
- package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +816 -808
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +615 -637
- package/es/node_modules/lodash.debounce/index.js +367 -0
- package/es/node_modules/prop-types/index.js +1 -1
- package/es/settings.js +1 -4
- package/lib/_virtual/_commonjsHelpers.js +3 -0
- package/lib/_virtual/index2.js +8 -2
- package/lib/_virtual/index3.js +12 -0
- package/lib/components/AddSelect/AddSelectColumn.js +40 -17
- package/lib/components/AddSelect/AddSelectSort.js +13 -14
- package/lib/components/AddSelect/types/index.d.ts +1 -1
- package/lib/components/Card/Card.d.ts +2 -2
- package/lib/components/Card/Card.js +7 -4
- package/lib/components/Coachmark/Coachmark.d.ts +43 -0
- package/lib/components/Coachmark/Coachmark.js +50 -32
- package/lib/components/Coachmark/CoachmarkOverlay.js +6 -0
- package/lib/components/Coachmark/index.d.ts +1 -0
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +11 -0
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +19 -11
- package/lib/components/CoachmarkButton/CoachmarkButton.js +7 -0
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +6 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +7 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +5 -3
- package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +6 -5
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +2 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +3 -1
- package/lib/components/Datagrid/useOnRowClick.d.ts +1 -1
- package/lib/components/Datagrid/useOnRowClick.js +5 -3
- package/lib/components/Datagrid/useRowExpander.js +3 -1
- package/lib/components/Datagrid/useSelectRows.d.ts +1 -1
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useSortableColumns.d.ts +1 -1
- package/lib/components/Datagrid/useSortableColumns.js +4 -3
- package/lib/components/EditInPlace/EditInPlace.d.ts +1 -1
- package/lib/components/EditInPlace/EditInPlace.js +2 -1
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +30 -1
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
- package/lib/components/ExportModal/ExportModal.js +5 -3
- package/lib/components/FeatureFlags/index.d.ts +31 -12
- package/lib/components/FeatureFlags/index.js +46 -15
- package/lib/components/InterstitialScreen/InterstitialScreenBody.js +3 -2
- package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +5 -2
- package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +3 -1
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +1 -1
- package/lib/components/ScrollGradient/ScrollGradient.js +8 -6
- package/lib/components/SidePanel/SidePanel.js +74 -0
- package/lib/components/SidePanel/constants.d.ts +14 -8
- package/lib/components/SidePanel/constants.js +1 -1
- package/lib/components/SidePanel/resizer/Resizer.d.ts +21 -0
- package/lib/components/SidePanel/resizer/Resizer.js +277 -0
- package/lib/components/TruncatedList/TruncatedList.d.ts +1 -1
- package/lib/components/TruncatedList/TruncatedList.js +2 -1
- package/lib/feature-flags.js +5 -1
- package/lib/index.js +1 -0
- package/lib/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +3 -3
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +839 -831
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +621 -643
- package/lib/node_modules/lodash.debounce/index.js +369 -0
- package/lib/node_modules/prop-types/index.js +1 -1
- package/lib/settings.js +0 -4
- package/package.json +15 -15
- package/scss/components/AddSelect/_add-select.scss +12 -13
- package/scss/components/SidePanel/_side-panel-variables.scss +1 -5
- package/scss/components/SidePanel/_side-panel.scss +129 -12
- package/scss/global/decorators/_side-panel-decorator.scss +36 -8
- package/telemetry.yml +17 -0
@@ -56,6 +56,7 @@ const getAriaPressedValue = col => {
|
|
56
56
|
return 'false';
|
57
57
|
};
|
58
58
|
const useSortableColumns = hooks => {
|
59
|
+
const carbonPrefix = react.usePrefix();
|
59
60
|
const sortableVisibleColumns = (visibleColumns, _ref) => {
|
60
61
|
let {
|
61
62
|
instance
|
@@ -64,7 +65,7 @@ const useSortableColumns = hooks => {
|
|
64
65
|
onSort
|
65
66
|
} = instance;
|
66
67
|
const onSortClick = (event, column) => {
|
67
|
-
const aiLabel = event.target.classList.contains(`${
|
68
|
+
const aiLabel = event.target.classList.contains(`${carbonPrefix}--slug`) || event.target.closest(`.${carbonPrefix}--slug`);
|
68
69
|
// Do not continue with sorting if we find a slug
|
69
70
|
if (aiLabel) {
|
70
71
|
event.stopPropagation();
|
@@ -86,7 +87,7 @@ const useSortableColumns = hooks => {
|
|
86
87
|
const iconProps = {
|
87
88
|
size: 16,
|
88
89
|
...props,
|
89
|
-
className: `${blockClass}__sortable-icon ${
|
90
|
+
className: `${blockClass}__sortable-icon ${carbonPrefix}--btn__icon`
|
90
91
|
};
|
91
92
|
if (col?.isSorted) {
|
92
93
|
switch (col.isSortedDesc) {
|
@@ -118,7 +119,7 @@ const useSortableColumns = hooks => {
|
|
118
119
|
}), icon(headerProp?.column, props));
|
119
120
|
},
|
120
121
|
id: column?.id,
|
121
|
-
className: cx(`${
|
122
|
+
className: cx(`${carbonPrefix}--table-sort ${blockClass}--table-sort`, {
|
122
123
|
[`${blockClass}--table-sort--desc`]: headerProp?.column.isSortedDesc,
|
123
124
|
[`${blockClass}--table-sort--asc`]: headerProp?.column.isSortedDesc === false
|
124
125
|
}),
|
@@ -51,6 +51,7 @@ exports.EditInPlace = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
51
51
|
const inputRef = React.useRef(null);
|
52
52
|
const canSave = value !== initialValue && !invalid;
|
53
53
|
const escaping = React.useRef(false);
|
54
|
+
const carbonPrefix = react.usePrefix();
|
54
55
|
const tipAlignIsObject = typeof tooltipAlignment === 'object';
|
55
56
|
const tipAlignments = ['edit', 'save', 'cancel'].reduce((acc, tips) => {
|
56
57
|
acc[tips] = (tipAlignIsObject ? tooltipAlignment[tips] : tooltipAlignment) ?? defaults.tooltipAlignment;
|
@@ -158,7 +159,7 @@ exports.EditInPlace = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
158
159
|
onBlur: onBlurHandler
|
159
160
|
}, /*#__PURE__*/React.createElement("input", {
|
160
161
|
id: id,
|
161
|
-
className: cx(`${blockClass}__text-input`, `${
|
162
|
+
className: cx(`${blockClass}__text-input`, `${carbonPrefix}--text-input`, `${carbonPrefix}--text-input--${size}`),
|
162
163
|
type: "text",
|
163
164
|
placeholder: placeholder,
|
164
165
|
value: value,
|
@@ -32,5 +32,34 @@ interface EmptyStateProps {
|
|
32
32
|
*/
|
33
33
|
title: string | ReactNode;
|
34
34
|
}
|
35
|
-
export declare const EmptyStateContent:
|
35
|
+
export declare const EmptyStateContent: {
|
36
|
+
(props: EmptyStateProps): React.JSX.Element;
|
37
|
+
displayName: string;
|
38
|
+
propTypes: {
|
39
|
+
/**
|
40
|
+
* Empty state action button
|
41
|
+
*/
|
42
|
+
action: any;
|
43
|
+
/**
|
44
|
+
* Empty state headingAs allows you to customize the type of heading element
|
45
|
+
*/
|
46
|
+
headingAs: any;
|
47
|
+
/**
|
48
|
+
* Empty state link object
|
49
|
+
*/
|
50
|
+
link: any;
|
51
|
+
/**
|
52
|
+
* Empty state size
|
53
|
+
*/
|
54
|
+
size: any;
|
55
|
+
/**
|
56
|
+
* Empty state subtitle
|
57
|
+
*/
|
58
|
+
subtitle: any;
|
59
|
+
/**
|
60
|
+
* Empty state title
|
61
|
+
*/
|
62
|
+
title: any;
|
63
|
+
};
|
64
|
+
};
|
36
65
|
export {};
|
@@ -17,7 +17,7 @@ var react = require('@carbon/react');
|
|
17
17
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
18
18
|
const blockClass = `${settings.pkg.prefix}--empty-state`;
|
19
19
|
const componentName = 'EmptyStateContent';
|
20
|
-
const EmptyStateContent =
|
20
|
+
const EmptyStateContent = props => {
|
21
21
|
const {
|
22
22
|
action,
|
23
23
|
link,
|
@@ -47,7 +47,7 @@ const EmptyStateContent = /*#__PURE__*/React.forwardRef(props => {
|
|
47
47
|
className: `${blockClass}__link`,
|
48
48
|
href: link.href
|
49
49
|
}), link.text));
|
50
|
-
}
|
50
|
+
};
|
51
51
|
|
52
52
|
// The display name of the component, used by React. Note that displayName
|
53
53
|
// is used in preference to relying on function.name.
|
@@ -67,6 +67,7 @@ exports.ExportModal = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
67
67
|
// by default (if it exists) use the first extension in the extension array
|
68
68
|
const [extension, setExtension] = React.useState('');
|
69
69
|
const renderPortalUse = usePortalTarget.usePortalTarget(portalTargetIn);
|
70
|
+
const carbonPrefix = react.usePrefix();
|
70
71
|
React.useEffect(() => {
|
71
72
|
setName(filename);
|
72
73
|
if (preformattedExtensions && preformattedExtensions.length > 0 && preformattedExtensions[0]?.extension) {
|
@@ -75,10 +76,10 @@ exports.ExportModal = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
75
76
|
}, [filename, preformattedExtensions, open]);
|
76
77
|
React.useEffect(() => {
|
77
78
|
if (successful) {
|
78
|
-
const button = document.querySelector(`.${blockClass} .${
|
79
|
+
const button = document.querySelector(`.${blockClass} .${carbonPrefix}--modal-close-button button`);
|
79
80
|
button?.focus();
|
80
81
|
}
|
81
|
-
}, [successful, blockClass]);
|
82
|
+
}, [successful, blockClass, carbonPrefix]);
|
82
83
|
const onNameChangeHandler = evt => {
|
83
84
|
setName(evt.target.value);
|
84
85
|
};
|
@@ -143,7 +144,8 @@ exports.ExportModal = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
143
144
|
orientation: "vertical",
|
144
145
|
onChange: onExtensionChangeHandler,
|
145
146
|
valueSelected: extension,
|
146
|
-
name: "extensions"
|
147
|
+
name: "extensions",
|
148
|
+
"aria-label": "extensions"
|
147
149
|
}, preformattedExtensions.map(o => /*#__PURE__*/React.createElement(react.RadioButton, {
|
148
150
|
key: o.extension,
|
149
151
|
id: o.extension,
|
@@ -1,40 +1,59 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright IBM Corp. 2024,
|
2
|
+
* Copyright IBM Corp. 2024, 2025
|
3
3
|
*
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
-
import React from 'react';
|
7
|
+
import React, { ReactNode, type JSX } from 'react';
|
8
|
+
export interface FeatureFlagsProps {
|
9
|
+
children?: ReactNode;
|
10
|
+
flags?: Record<string, boolean>;
|
11
|
+
defaultPortalTargetBody?: boolean;
|
12
|
+
enableDatagridUseInlineEdit?: boolean;
|
13
|
+
enableDatagridUseEditableCell?: boolean;
|
14
|
+
enableDatagridUseCustomizeColumns?: boolean;
|
15
|
+
enableSidepanelResizer?: boolean;
|
16
|
+
enableTestFlagA?: boolean;
|
17
|
+
enableTestFlagB?: boolean;
|
18
|
+
}
|
8
19
|
/**
|
9
20
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
10
21
|
* or disable feature flags in a given React tree
|
11
22
|
*/
|
12
23
|
declare const FeatureFlagContext: React.Context<any>;
|
13
24
|
/**
|
14
|
-
* Supports
|
25
|
+
* Supports an object of feature flag values with the `flags` prop, merging them
|
15
26
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
16
27
|
* a feature flag is enabled or disabled in a given React tree
|
17
28
|
*/
|
18
|
-
declare function FeatureFlags({ children, flags,
|
19
|
-
[x: string]: any;
|
20
|
-
children: any;
|
21
|
-
flags?: {} | undefined;
|
22
|
-
}): React.JSX.Element;
|
29
|
+
declare function FeatureFlags({ children, flags, defaultPortalTargetBody, enableDatagridUseInlineEdit, enableDatagridUseEditableCell, enableDatagridUseCustomizeColumns, enableSidepanelResizer, enableTestFlagA, enableTestFlagB, }: FeatureFlagsProps): JSX.Element;
|
23
30
|
declare namespace FeatureFlags {
|
24
31
|
var propTypes: {
|
25
32
|
children: any;
|
26
33
|
/**
|
27
|
-
* Provide the feature flags to enabled or disabled in the current React tree
|
34
|
+
* Provide the feature flags to enabled or disabled in the current React tree
|
28
35
|
*/
|
29
|
-
|
36
|
+
defaultPortalTargetBody: any;
|
37
|
+
enableDatagridUseCustomizeColumns: any;
|
38
|
+
enableDatagridUseEditableCell: any;
|
39
|
+
enableDatagridUseInlineEdit: any;
|
40
|
+
enableSidepanelResizer: any;
|
41
|
+
enableTestFlagA: any;
|
42
|
+
enableTestFlagB: any;
|
43
|
+
flags: (props: any, propName: any, comp: any, loc: any, propFullName: any, secret: any) => any;
|
30
44
|
};
|
31
45
|
}
|
32
46
|
/**
|
33
|
-
* Access whether a given flag is enabled or disabled in a given
|
47
|
+
* Access whether a given flag is enabled or disabled in a given
|
48
|
+
* FeatureFlagContext
|
49
|
+
*
|
50
|
+
* @returns {boolean}
|
34
51
|
*/
|
35
|
-
declare function useFeatureFlag(flag:
|
52
|
+
declare function useFeatureFlag(flag: any): any;
|
36
53
|
/**
|
37
54
|
* Access all feature flag information for the given FeatureFlagContext
|
55
|
+
*
|
56
|
+
* @returns {FeatureFlagScope}
|
38
57
|
*/
|
39
58
|
declare function useFeatureFlags(): any;
|
40
59
|
export { FeatureFlags, FeatureFlagContext, useFeatureFlags, useFeatureFlag };
|
@@ -7,9 +7,10 @@
|
|
7
7
|
|
8
8
|
'use strict';
|
9
9
|
|
10
|
-
var React = require('react');
|
11
|
-
var index = require('../../_virtual/index.js');
|
12
10
|
var FeatureFlags$1 = require('@carbon/feature-flags');
|
11
|
+
var index = require('../../_virtual/index.js');
|
12
|
+
var React = require('react');
|
13
|
+
var propsHelper = require('../../global/js/utils/props-helper.js');
|
13
14
|
|
14
15
|
/**
|
15
16
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
@@ -18,7 +19,7 @@ var FeatureFlags$1 = require('@carbon/feature-flags');
|
|
18
19
|
const FeatureFlagContext = /*#__PURE__*/React.createContext(FeatureFlags$1.FeatureFlags);
|
19
20
|
|
20
21
|
/**
|
21
|
-
* Supports
|
22
|
+
* Supports an object of feature flag values with the `flags` prop, merging them
|
22
23
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
23
24
|
* a feature flag is enabled or disabled in a given React tree
|
24
25
|
*/
|
@@ -26,18 +27,30 @@ function FeatureFlags(_ref) {
|
|
26
27
|
let {
|
27
28
|
children,
|
28
29
|
flags = {},
|
29
|
-
|
30
|
+
defaultPortalTargetBody = true,
|
31
|
+
enableDatagridUseInlineEdit = false,
|
32
|
+
enableDatagridUseEditableCell = false,
|
33
|
+
enableDatagridUseCustomizeColumns = false,
|
34
|
+
// exampleComponentSecondaryIcon = false,
|
35
|
+
// exampleComponentUseExample = false,
|
36
|
+
enableSidepanelResizer = false,
|
37
|
+
enableTestFlagA = false,
|
38
|
+
enableTestFlagB = false
|
30
39
|
} = _ref;
|
31
40
|
const parentScope = React.useContext(FeatureFlagContext);
|
32
|
-
const
|
33
|
-
acc[key] = newFlags[key];
|
34
|
-
return acc;
|
35
|
-
}, {});
|
41
|
+
const [prevParentScope, setPrevParentScope] = React.useState(parentScope);
|
36
42
|
const combinedFlags = {
|
37
|
-
|
43
|
+
'default-portal-target-body': defaultPortalTargetBody,
|
44
|
+
'enable-datagrid-useInlineEdit': enableDatagridUseInlineEdit,
|
45
|
+
'enable-datagrid-useEditableCell': enableDatagridUseEditableCell,
|
46
|
+
'enable-datagrid-useCustomizeColumns': enableDatagridUseCustomizeColumns,
|
47
|
+
// 'ExampleComponent.secondaryIcon': exampleComponentSecondaryIcon,
|
48
|
+
// 'ExampleComponent.useExample': exampleComponentUseExample,
|
49
|
+
enableSidepanelResizer: enableSidepanelResizer,
|
50
|
+
'enable-test-flag-a': enableTestFlagA,
|
51
|
+
'enable-test-flag-b': enableTestFlagB,
|
38
52
|
...flags
|
39
53
|
};
|
40
|
-
const [prevParentScope, setPrevParentScope] = React.useState(parentScope);
|
41
54
|
const [scope, updateScope] = React.useState(() => {
|
42
55
|
const scope = FeatureFlags$1.createScope(combinedFlags);
|
43
56
|
scope.mergeWithScope(parentScope);
|
@@ -50,8 +63,9 @@ function FeatureFlags(_ref) {
|
|
50
63
|
setPrevParentScope(parentScope);
|
51
64
|
}
|
52
65
|
|
53
|
-
// We use a custom hook to detect if any of the
|
54
|
-
// If
|
66
|
+
// We use a custom hook to detect if any of the keys or their values change
|
67
|
+
// for flags that are passed in. If they have changed, then we re-create the
|
68
|
+
// FeatureFlagScope using the new flags
|
55
69
|
useChangedValue(combinedFlags, isEqual, changedFlags => {
|
56
70
|
const scope = FeatureFlags$1.createScope(changedFlags);
|
57
71
|
scope.mergeWithScope(parentScope);
|
@@ -64,9 +78,18 @@ function FeatureFlags(_ref) {
|
|
64
78
|
FeatureFlags.propTypes = {
|
65
79
|
children: index.default.node,
|
66
80
|
/**
|
67
|
-
* Provide the feature flags to enabled or disabled in the current React tree
|
81
|
+
* Provide the feature flags to enabled or disabled in the current React tree
|
68
82
|
*/
|
69
|
-
|
83
|
+
defaultPortalTargetBody: index.default.bool,
|
84
|
+
enableDatagridUseCustomizeColumns: index.default.bool,
|
85
|
+
enableDatagridUseEditableCell: index.default.bool,
|
86
|
+
enableDatagridUseInlineEdit: index.default.bool,
|
87
|
+
enableSidepanelResizer: index.default.bool,
|
88
|
+
enableTestFlagA: index.default.bool,
|
89
|
+
enableTestFlagB: index.default.bool,
|
90
|
+
// exampleComponentSecondaryIcon: PropTypes.bool,
|
91
|
+
// exampleComponentUseExample: PropTypes.bool,
|
92
|
+
flags: propsHelper.deprecateProp(index.default.objectOf(index.default.bool), 'The `flags` prop for `FeatureFlag` has been deprecated. Please pass the flags directly as props in camelCase')
|
70
93
|
};
|
71
94
|
|
72
95
|
/**
|
@@ -101,7 +124,10 @@ function useChangedValue(value, compare, callback) {
|
|
101
124
|
}
|
102
125
|
|
103
126
|
/**
|
104
|
-
* Access whether a given flag is enabled or disabled in a given
|
127
|
+
* Access whether a given flag is enabled or disabled in a given
|
128
|
+
* FeatureFlagContext
|
129
|
+
*
|
130
|
+
* @returns {boolean}
|
105
131
|
*/
|
106
132
|
function useFeatureFlag(flag) {
|
107
133
|
const scope = React.useContext(FeatureFlagContext);
|
@@ -110,6 +136,8 @@ function useFeatureFlag(flag) {
|
|
110
136
|
|
111
137
|
/**
|
112
138
|
* Access all feature flag information for the given FeatureFlagContext
|
139
|
+
*
|
140
|
+
* @returns {FeatureFlagScope}
|
113
141
|
*/
|
114
142
|
function useFeatureFlags() {
|
115
143
|
return React.useContext(FeatureFlagContext);
|
@@ -120,6 +148,9 @@ function useFeatureFlags() {
|
|
120
148
|
* comparison since the objects we are comparing are objects with boolean flags
|
121
149
|
* from the flags prop in the `FeatureFlags` component
|
122
150
|
*
|
151
|
+
* @param {object} a
|
152
|
+
* @param {object} b
|
153
|
+
* @returns {boolean}
|
123
154
|
*/
|
124
155
|
function isEqual(a, b) {
|
125
156
|
if (a === b) {
|
@@ -18,7 +18,7 @@ var settings = require('../../settings.js');
|
|
18
18
|
var Carousel = require('../Carousel/Carousel.js');
|
19
19
|
require('../Carousel/CarouselItem.js');
|
20
20
|
|
21
|
-
const InterstitialScreenBody = /*#__PURE__*/React.forwardRef(props => {
|
21
|
+
const InterstitialScreenBody = /*#__PURE__*/React.forwardRef((props, ref) => {
|
22
22
|
const {
|
23
23
|
className = '',
|
24
24
|
contentRenderer,
|
@@ -79,7 +79,7 @@ const InterstitialScreenBody = /*#__PURE__*/React.forwardRef(props => {
|
|
79
79
|
const onScrollHandler = scrollPercent => setScrollPercent(scrollPercent);
|
80
80
|
const renderBody = () => /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
81
81
|
className: `${blockClass}--body ${className}`,
|
82
|
-
ref: bodyScrollRef
|
82
|
+
ref: bodyScrollRef ?? ref
|
83
83
|
}, rest), /*#__PURE__*/React.createElement("div", {
|
84
84
|
className: `${blockClass}--content`
|
85
85
|
}, stepType === 'multi' ? /*#__PURE__*/React.createElement("div", {
|
@@ -90,6 +90,7 @@ const InterstitialScreenBody = /*#__PURE__*/React.forwardRef(props => {
|
|
90
90
|
onScroll: onScrollHandler
|
91
91
|
}, bodyChildrenData)) : stepType === 'single' ? bodyChildrenData : ''));
|
92
92
|
return isFullScreen ? renderBody() : /*#__PURE__*/React.createElement(react.ModalBody, {
|
93
|
+
ref: ref,
|
93
94
|
className: bodyBlockClass
|
94
95
|
}, renderBody());
|
95
96
|
});
|
@@ -19,7 +19,7 @@ var clamp = require('../../global/js/utils/clamp.js');
|
|
19
19
|
var icons = require('@carbon/react/icons');
|
20
20
|
|
21
21
|
var _InlineLoading, _InlineLoading2, _InlineLoading3, _InlineLoading4;
|
22
|
-
const InterstitialScreenFooter = /*#__PURE__*/React.forwardRef(props => {
|
22
|
+
const InterstitialScreenFooter = /*#__PURE__*/React.forwardRef((props, ref) => {
|
23
23
|
const {
|
24
24
|
className = '',
|
25
25
|
skipButtonLabel = 'Skip',
|
@@ -83,6 +83,7 @@ const InterstitialScreenFooter = /*#__PURE__*/React.forwardRef(props => {
|
|
83
83
|
return {};
|
84
84
|
}, [loadingAction, isMultiStep, progStep, progStepCeil]);
|
85
85
|
const getFooterContent = () => /*#__PURE__*/React.createElement("div", {
|
86
|
+
ref: ref,
|
86
87
|
className: `${blockClass}--footer ${className}`
|
87
88
|
}, isMultiStep && skipButtonLabel !== '' && /*#__PURE__*/React.createElement(react.Button, {
|
88
89
|
className: `${blockClass}--skip-btn`,
|
@@ -126,7 +127,9 @@ const InterstitialScreenFooter = /*#__PURE__*/React.forwardRef(props => {
|
|
126
127
|
disableButtonConfig
|
127
128
|
}));
|
128
129
|
}
|
129
|
-
return isFullScreen ? getFooterContent() : /*#__PURE__*/React.createElement(react.ModalFooter,
|
130
|
+
return isFullScreen ? getFooterContent() : /*#__PURE__*/React.createElement(react.ModalFooter, {
|
131
|
+
ref: ref
|
132
|
+
}, getFooterContent());
|
130
133
|
});
|
131
134
|
InterstitialScreenFooter.propTypes = {
|
132
135
|
/**
|
@@ -17,7 +17,7 @@ var cx = require('classnames');
|
|
17
17
|
var InterstitialScreen = require('./InterstitialScreen.js');
|
18
18
|
var useId = require('../../global/js/utils/useId.js');
|
19
19
|
|
20
|
-
const InterstitialScreenHeader = /*#__PURE__*/React.forwardRef(props => {
|
20
|
+
const InterstitialScreenHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
21
21
|
var _h, _h2;
|
22
22
|
const {
|
23
23
|
className = '',
|
@@ -62,10 +62,12 @@ const InterstitialScreenHeader = /*#__PURE__*/React.forwardRef(props => {
|
|
62
62
|
}, "Step ", progStep + 1, " of ", stepCount)));
|
63
63
|
};
|
64
64
|
return isFullScreen ? /*#__PURE__*/React.createElement("header", {
|
65
|
+
ref: ref,
|
65
66
|
className: cx(headerBlockClass, className, {
|
66
67
|
[`${headerBlockClass}--has-title`]: headerTitle || headerSubTitle || children
|
67
68
|
})
|
68
69
|
}, headerContent()) : /*#__PURE__*/React.createElement(react.ModalHeader, {
|
70
|
+
ref: ref,
|
69
71
|
className: cx(headerBlockClass, className, {
|
70
72
|
[`${headerBlockClass}--has-title`]: headerTitle || headerSubTitle || children
|
71
73
|
}),
|
@@ -5,7 +5,7 @@ type overflowAction = {
|
|
5
5
|
id?: string;
|
6
6
|
itemText?: string;
|
7
7
|
onClick?: (event: MouseEvent) => void;
|
8
|
-
|
8
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
9
9
|
};
|
10
10
|
type PlacementType = 'top' | 'bottom';
|
11
11
|
type ClickZoneType = 'one' | 'two' | 'three';
|
@@ -14,6 +14,7 @@ var cx = require('classnames');
|
|
14
14
|
var devtools = require('../../global/js/utils/devtools.js');
|
15
15
|
var settings = require('../../settings.js');
|
16
16
|
var constants = require('./constants.js');
|
17
|
+
var react = require('@carbon/react');
|
17
18
|
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
18
19
|
|
19
20
|
const blockClass = `${settings.pkg.prefix}--scroll-gradient`;
|
@@ -21,7 +22,6 @@ const componentName = 'ScrollGradient';
|
|
21
22
|
|
22
23
|
// Default values for props
|
23
24
|
const defaults = {
|
24
|
-
color: `var(--${settings.carbon.prefix}-layer-01)`,
|
25
25
|
hideStartGradient: false,
|
26
26
|
onScroll: () => {},
|
27
27
|
getScrollElementRef: () => {}
|
@@ -34,7 +34,7 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
34
34
|
let {
|
35
35
|
children,
|
36
36
|
className,
|
37
|
-
color
|
37
|
+
color,
|
38
38
|
onScroll = defaults.onScroll,
|
39
39
|
scrollElementClassName,
|
40
40
|
getScrollElementRef = defaults.getScrollElementRef,
|
@@ -45,6 +45,8 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
45
45
|
const intersectionEndRef = React.useRef();
|
46
46
|
const intersectionLeftRef = React.useRef();
|
47
47
|
const intersectionRightRef = React.useRef();
|
48
|
+
const carbonPrefix = react.usePrefix();
|
49
|
+
const fallbackColor = `var(--${carbonPrefix}-layer-01)`;
|
48
50
|
const scrollContainer = React.useRef(undefined);
|
49
51
|
const contentChildrenContainer = React.useRef(undefined);
|
50
52
|
const {
|
@@ -62,18 +64,18 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
62
64
|
useIsomorphicEffect.useIsomorphicEffect(() => {
|
63
65
|
// start vertical styles
|
64
66
|
startVerticalRef.current.style.right = gradientRight;
|
65
|
-
startVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, transparent, ${color} 90%)`;
|
67
|
+
startVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, transparent, ${color ?? fallbackColor} 90%)`;
|
66
68
|
// start horizontal styles
|
67
|
-
startHorizontalRef.current.backgroundImage = `linear-gradient(-90deg, transparent, ${color} 90%)`;
|
69
|
+
startHorizontalRef.current.backgroundImage = `linear-gradient(-90deg, transparent, ${color ?? fallbackColor} 90%)`;
|
68
70
|
startHorizontalRef.current.bottom = gradientBottom;
|
69
71
|
// end vertical styles
|
70
72
|
endVerticalRef.current.style.right = gradientRight;
|
71
73
|
endVerticalRef.current.style.bottom = gradientBottom;
|
72
|
-
endVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, ${color} 10%, transparent)`;
|
74
|
+
endVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, ${color ?? fallbackColor} 10%, transparent)`;
|
73
75
|
// end horizontal styles
|
74
76
|
endHorizontalRef.current.style.right = gradientRight;
|
75
77
|
endHorizontalRef.current.style.bottom = gradientBottom;
|
76
|
-
endHorizontalRef.current.style.backgroundImage = `linear-gradient(-90deg, ${color} 10%, transparent)`;
|
78
|
+
endHorizontalRef.current.style.backgroundImage = `linear-gradient(-90deg, ${color ?? fallbackColor} 10%, transparent)`;
|
77
79
|
}, [color, gradientRight, gradientBottom]);
|
78
80
|
const setGradientOnIntersection = (entry, gradientRef) => {
|
79
81
|
if (gradientRef.current) {
|
@@ -10,8 +10,10 @@
|
|
10
10
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
11
11
|
var icons = require('@carbon/react/icons');
|
12
12
|
var react = require('@carbon/react');
|
13
|
+
var index$1 = require('../FeatureFlags/index.js');
|
13
14
|
var React = require('react');
|
14
15
|
var ActionSet = require('../ActionSet/ActionSet.js');
|
16
|
+
var Resizer = require('./resizer/Resizer.js');
|
15
17
|
var index = require('../../_virtual/index.js');
|
16
18
|
var constants = require('./constants.js');
|
17
19
|
var propsHelper = require('../../global/js/utils/props-helper.js');
|
@@ -100,6 +102,9 @@ const SidePanelBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
100
102
|
} = useFocus.useFocus(sidePanelRef);
|
101
103
|
const panelRefValue = sidePanelRef.current;
|
102
104
|
const previousOpen = usePreviousValue.usePreviousValue(open);
|
105
|
+
const enableResizer = index$1.useFeatureFlag('enableSidepanelResizer');
|
106
|
+
const sidePanelWidth = React.useRef(undefined);
|
107
|
+
const accumulatedDeltaRef = React.useRef(0);
|
103
108
|
const shouldReduceMotion = usePrefersReducedMotion.usePrefersReducedMotion();
|
104
109
|
const exitAnimationName = shouldReduceMotion ? 'side-panel-exit-reduced' : placement === 'right' ? 'side-panel-exit-right' : 'side-panel-exit-left';
|
105
110
|
const {
|
@@ -113,6 +118,21 @@ const SidePanelBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
113
118
|
onRequestClose?.();
|
114
119
|
}
|
115
120
|
};
|
121
|
+
React.useEffect(() => {
|
122
|
+
if (!enableResizer) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const parentEl = sidePanelRef.current?.parentElement;
|
126
|
+
if (parentEl) {
|
127
|
+
parentEl.style.removeProperty('--c4p-side-panel-modified-size');
|
128
|
+
}
|
129
|
+
}, [size, enableResizer, sidePanelRef]);
|
130
|
+
React.useEffect(() => {
|
131
|
+
if (!enableResizer) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
sidePanelWidth.current = sidePanelRef?.current?.clientWidth;
|
135
|
+
}, [sidePanelRef, sidePanelRef?.current?.clientWidth, enableResizer]);
|
116
136
|
React.useEffect(() => {
|
117
137
|
if (open && !titleRef?.current) {
|
118
138
|
setDoAnimateTitle(false);
|
@@ -120,6 +140,52 @@ const SidePanelBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
120
140
|
setDoAnimateTitle(animateTitle);
|
121
141
|
}
|
122
142
|
}, [animateTitle, open]);
|
143
|
+
const onResize = React.useCallback((event, delta) => {
|
144
|
+
event.preventDefault();
|
145
|
+
event.stopPropagation();
|
146
|
+
const setWidth = width => {
|
147
|
+
const parentEl = sidePanelRef.current?.parentElement;
|
148
|
+
if (parentEl) {
|
149
|
+
parentEl.style.setProperty('--c4p-side-panel-modified-size', typeof width === 'number' ? `${width}px` : width);
|
150
|
+
}
|
151
|
+
};
|
152
|
+
if (event.type === 'keydown') {
|
153
|
+
const key = event.key;
|
154
|
+
switch (key) {
|
155
|
+
case 'Home':
|
156
|
+
setWidth('75vw');
|
157
|
+
break;
|
158
|
+
case 'End':
|
159
|
+
setWidth(constants.SIDE_PANEL_SIZES['xs']);
|
160
|
+
break;
|
161
|
+
case 'ArrowLeft':
|
162
|
+
case 'ArrowRight':
|
163
|
+
accumulatedDeltaRef.current += delta;
|
164
|
+
setWidth((sidePanelWidth.current ?? 0) - (placement === 'right' ? accumulatedDeltaRef.current : -accumulatedDeltaRef.current));
|
165
|
+
break;
|
166
|
+
}
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
if (sidePanelRef.current?.style) {
|
170
|
+
sidePanelRef.current.style.transition = 'none';
|
171
|
+
}
|
172
|
+
setWidth((sidePanelWidth.current ?? 0) - (placement === 'right' ? delta : -delta));
|
173
|
+
}, [placement, sidePanelRef, sidePanelWidth]);
|
174
|
+
const onResizeEnd = React.useCallback((_, ref) => {
|
175
|
+
accumulatedDeltaRef.current = 0;
|
176
|
+
sidePanelRef.current?.style?.removeProperty('transition');
|
177
|
+
const percent = Math.round((sidePanelRef.current.clientWidth || 0) / window.innerWidth * 100);
|
178
|
+
// custom a11y announcements
|
179
|
+
ref.current.setAttribute('aria-label', `side panel is covering ${percent}% of screen`);
|
180
|
+
sidePanelWidth.current = sidePanelRef.current?.clientWidth;
|
181
|
+
}, [sidePanelRef]);
|
182
|
+
const onDoubleClick = React.useCallback(() => {
|
183
|
+
sidePanelWidth.current = Math.min(parseFloat(constants.SIDE_PANEL_SIZES[size]) * 16, window.innerWidth * 0.75);
|
184
|
+
const parentEl = sidePanelRef.current?.parentElement;
|
185
|
+
if (parentEl) {
|
186
|
+
parentEl.style.removeProperty('--c4p-side-panel-modified-size');
|
187
|
+
}
|
188
|
+
}, [sidePanelRef, size]);
|
123
189
|
const titleItemsStyles = React.useCallback(progress => {
|
124
190
|
if (subtitleRef?.current) {
|
125
191
|
const subtitleEl = subtitleRef?.current;
|
@@ -319,6 +385,7 @@ const SidePanelBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
319
385
|
[`${blockClass}--right-placement`]: placement === 'right',
|
320
386
|
[`${blockClass}--left-placement`]: placement === 'left',
|
321
387
|
[`${blockClass}--slide-in`]: slideIn,
|
388
|
+
[`${blockClass}--enable-sidepanel-resizer`]: enableResizer && window.innerWidth > 768,
|
322
389
|
[`${blockClass}--has-decorator`]: decorator,
|
323
390
|
[`${blockClass}--has-slug`]: slug,
|
324
391
|
[`${blockClass}--has-ai-label`]: aiLabel,
|
@@ -462,6 +529,13 @@ const SidePanelBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
462
529
|
onAnimationEnd: onAnimationEnd,
|
463
530
|
onAnimationStart: onAnimationStart,
|
464
531
|
onKeyDown: handleKeyDown
|
532
|
+
}), !slideIn && enableResizer && window.innerWidth > 768 && /*#__PURE__*/React.createElement(Resizer.Resizer, {
|
533
|
+
className: `${blockClass}__resizer`,
|
534
|
+
orientation: "vertical",
|
535
|
+
"aria-valuenow": sidePanelWidth.current,
|
536
|
+
onResize: onResize,
|
537
|
+
onResizeEnd: onResizeEnd,
|
538
|
+
onDoubleClick: onDoubleClick
|
465
539
|
}), renderHeader(), renderMain(), /*#__PURE__*/React.createElement(ActionSet.ActionSet, {
|
466
540
|
actions: actions ?? [],
|
467
541
|
className: primaryActionContainerClassNames,
|
@@ -1,8 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2021
|
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
|
+
export const SIDE_PANEL_SIZES: {
|
8
|
+
xs: string;
|
9
|
+
sm: string;
|
10
|
+
md: string;
|
11
|
+
lg: string;
|
12
|
+
xl: string;
|
13
|
+
'2xl': string;
|
14
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
*
|
4
|
+
* Copyright IBM Corp. 2025
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
import React from 'react';
|
10
|
+
export declare const DEBOUNCE_DELAY = 100;
|
11
|
+
/** Primary UI component for user interaction */
|
12
|
+
interface ResizerProps {
|
13
|
+
orientation: 'horizontal' | 'vertical';
|
14
|
+
onResize?: (event: MouseEvent | KeyboardEvent, delta: number) => void;
|
15
|
+
onResizeEnd?: (event: MouseEvent | KeyboardEvent, ref: React.RefObject<HTMLDivElement>) => void;
|
16
|
+
onDoubleClick?: (event: MouseEvent) => string | void;
|
17
|
+
className?: string;
|
18
|
+
[key: string]: any;
|
19
|
+
}
|
20
|
+
export declare const Resizer: React.ForwardRefExoticComponent<Omit<ResizerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
21
|
+
export default Resizer;
|