@carbon/ibm-products 2.41.0 → 2.41.1-canary.11
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +6 -0
- 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 +6 -0
- 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 +6 -0
- 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 +6 -0
- 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/Coachmark/Coachmark.js +2 -1
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +30 -6
- package/es/components/Datagrid/Datagrid/DatagridContent.js +21 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +12 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts +3 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +5 -5
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +7 -0
- package/es/components/Datagrid/useCustomizeColumns.js +0 -4
- package/es/components/Datagrid/useEditableCell.js +1 -1
- package/es/components/Datagrid/useFocusRowExpander.js +1 -1
- package/es/components/Datagrid/useInlineEdit.d.ts +1 -1
- package/es/components/Datagrid/useInlineEdit.js +9 -16
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/es/components/FeatureFlags/index.d.ts +37 -0
- package/es/components/FeatureFlags/index.js +151 -0
- package/es/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/es/components/ProductiveCard/ProductiveCard.js +9 -9
- package/es/components/TagOverflow/TagOverflowModal.d.ts +34 -28
- package/es/components/TagOverflow/TagOverflowModal.js +4 -4
- package/es/components/index.d.ts +1 -0
- package/es/feature-flags.d.ts +1 -0
- package/es/global/js/hooks/usePortalTarget.js +4 -2
- package/es/index.js +1 -0
- package/lib/components/Coachmark/Coachmark.js +2 -1
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +29 -5
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +49 -29
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +13 -19
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts +3 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +5 -5
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +7 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +0 -4
- package/lib/components/Datagrid/useEditableCell.js +1 -1
- package/lib/components/Datagrid/useFocusRowExpander.js +1 -1
- package/lib/components/Datagrid/useInlineEdit.d.ts +1 -1
- package/lib/components/Datagrid/useInlineEdit.js +8 -15
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/lib/components/FeatureFlags/index.d.ts +37 -0
- package/lib/components/FeatureFlags/index.js +162 -0
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +9 -9
- package/lib/components/TagOverflow/TagOverflowModal.d.ts +34 -28
- package/lib/components/TagOverflow/TagOverflowModal.js +2 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/feature-flags.d.ts +1 -0
- package/lib/global/js/hooks/usePortalTarget.js +4 -2
- package/lib/index.js +4 -0
- package/package.json +7 -3
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +6 -0
@@ -1,2 +1,115 @@
|
|
1
|
-
|
2
|
-
import
|
1
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
2
|
+
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
3
|
+
type ActionIcon = {
|
4
|
+
id?: string;
|
5
|
+
icon?: CarbonIconType;
|
6
|
+
onKeyDown?(): void;
|
7
|
+
onClick?(): void;
|
8
|
+
iconDescription?: string;
|
9
|
+
href?: string;
|
10
|
+
};
|
11
|
+
type overflowAction = {
|
12
|
+
id?: string;
|
13
|
+
itemText?: string;
|
14
|
+
onClick?: () => void;
|
15
|
+
onKeydown?: () => void;
|
16
|
+
};
|
17
|
+
type PlacementType = 'top' | 'bottom';
|
18
|
+
type ClickZoneType = 'one' | 'two' | 'three';
|
19
|
+
interface ProductiveCardProps extends PropsWithChildren {
|
20
|
+
/**
|
21
|
+
* Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
|
22
|
+
*/
|
23
|
+
actionIcons?: ActionIcon[];
|
24
|
+
/**
|
25
|
+
* Determines if the action icons are on the top or bottom of the card
|
26
|
+
*/
|
27
|
+
actionsPlacement?: PlacementType;
|
28
|
+
/**
|
29
|
+
* Content that shows in the body of the card
|
30
|
+
*/
|
31
|
+
/**
|
32
|
+
* Optional user provided class
|
33
|
+
*/
|
34
|
+
className?: string;
|
35
|
+
children: ReactNode;
|
36
|
+
/**
|
37
|
+
* Designates which zones of the card are clickable. Refer to design documentation for implementation guidelines
|
38
|
+
*/
|
39
|
+
clickZone?: ClickZoneType;
|
40
|
+
/**
|
41
|
+
* Optional header description
|
42
|
+
*/
|
43
|
+
description?: string | object | ReactNode;
|
44
|
+
/**
|
45
|
+
* Optional label for the top of the card
|
46
|
+
*/
|
47
|
+
label?: string | object | ReactNode;
|
48
|
+
/**
|
49
|
+
* Provides the callback for a clickable card
|
50
|
+
*/
|
51
|
+
onClick?: () => void;
|
52
|
+
/**
|
53
|
+
* Function that's called from the primary button or action icon
|
54
|
+
*/
|
55
|
+
onPrimaryButtonClick?: () => void;
|
56
|
+
/**
|
57
|
+
* Function that's called from the secondary button
|
58
|
+
*/
|
59
|
+
onSecondaryButtonClick?: () => void;
|
60
|
+
/**
|
61
|
+
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
62
|
+
*/
|
63
|
+
overflowActions?: overflowAction[];
|
64
|
+
/**
|
65
|
+
* Aria label prop required for OverflowMenu
|
66
|
+
*/
|
67
|
+
overflowAriaLabel?: string;
|
68
|
+
/**
|
69
|
+
* Optionally specify an href for your Button to become an <a> element
|
70
|
+
*/
|
71
|
+
primaryButtonHref?: string;
|
72
|
+
/**
|
73
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
74
|
+
*/
|
75
|
+
primaryButtonIcon?: CarbonIconType;
|
76
|
+
/**
|
77
|
+
* Determines if the primary button is on the top or bottom of the card
|
78
|
+
*/
|
79
|
+
primaryButtonPlacement?: PlacementType;
|
80
|
+
/**
|
81
|
+
* The text that's displayed in the primary button
|
82
|
+
*/
|
83
|
+
primaryButtonText?: string;
|
84
|
+
/**
|
85
|
+
* Optionally specify an href for your Button to become an <a> element
|
86
|
+
*/
|
87
|
+
secondaryButtonHref?: string;
|
88
|
+
/**
|
89
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
90
|
+
*/
|
91
|
+
secondaryButtonIcon?: CarbonIconType;
|
92
|
+
/**
|
93
|
+
* Determines if the secondary button is on the top or bottom of the card
|
94
|
+
*/
|
95
|
+
secondaryButtonPlacement?: PlacementType;
|
96
|
+
/**
|
97
|
+
* The text that's displayed in the secondary button
|
98
|
+
*/
|
99
|
+
secondaryButtonText?: string;
|
100
|
+
/**
|
101
|
+
* **Experimental:** For all cases a `Slug` component can be provided.
|
102
|
+
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
103
|
+
*/
|
104
|
+
slug?: ReactNode | boolean;
|
105
|
+
/**
|
106
|
+
* Title that's displayed at the top of the card
|
107
|
+
*/
|
108
|
+
title?: string | object | ReactNode;
|
109
|
+
/**
|
110
|
+
* Determines title size
|
111
|
+
*/
|
112
|
+
titleSize?: 'default' | 'large';
|
113
|
+
}
|
114
|
+
export declare let ProductiveCard: React.ForwardRefExoticComponent<ProductiveCardProps & React.RefAttributes<HTMLDivElement>>;
|
115
|
+
export {};
|
@@ -15,22 +15,16 @@ import { Card } from '../Card/Card.js';
|
|
15
15
|
|
16
16
|
var _excluded = ["actionsPlacement"];
|
17
17
|
var componentName = 'ProductiveCard';
|
18
|
-
|
19
|
-
// Default values for props
|
20
|
-
var defaults = {
|
21
|
-
actionsPlacement: 'top'
|
22
|
-
};
|
23
18
|
var ProductiveCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
24
19
|
var _ref$actionsPlacement = _ref.actionsPlacement,
|
25
|
-
actionsPlacement = _ref$actionsPlacement === void 0 ?
|
20
|
+
actionsPlacement = _ref$actionsPlacement === void 0 ? 'top' : _ref$actionsPlacement,
|
26
21
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
22
|
var validProps = prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
|
28
23
|
return /*#__PURE__*/React__default.createElement(Card, _extends({}, _objectSpread2(_objectSpread2({}, validProps), {}, {
|
29
24
|
actionsPlacement: actionsPlacement,
|
30
|
-
ref: ref
|
31
|
-
}), {
|
25
|
+
ref: ref,
|
32
26
|
productive: true
|
33
|
-
}, getDevtoolsProps(componentName)));
|
27
|
+
}), getDevtoolsProps(componentName)));
|
34
28
|
});
|
35
29
|
|
36
30
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -39,6 +33,7 @@ ProductiveCard.propTypes = {
|
|
39
33
|
/**
|
40
34
|
* Icons that are displayed on card. Refer to design documentation for implementation guidelines
|
41
35
|
*/
|
36
|
+
/**@ts-ignore */
|
42
37
|
actionIcons: PropTypes.arrayOf(PropTypes.shape({
|
43
38
|
id: PropTypes.string,
|
44
39
|
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
@@ -86,6 +81,7 @@ ProductiveCard.propTypes = {
|
|
86
81
|
/**
|
87
82
|
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
88
83
|
*/
|
84
|
+
/**@ts-ignore */
|
89
85
|
overflowActions: PropTypes.arrayOf(PropTypes.shape({
|
90
86
|
id: PropTypes.string,
|
91
87
|
itemText: PropTypes.string,
|
@@ -103,6 +99,7 @@ ProductiveCard.propTypes = {
|
|
103
99
|
/**
|
104
100
|
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
105
101
|
*/
|
102
|
+
/**@ts-ignore */
|
106
103
|
primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
107
104
|
/**
|
108
105
|
* Determines if the primary button is on the top or bottom of the card
|
@@ -111,6 +108,7 @@ ProductiveCard.propTypes = {
|
|
111
108
|
/**
|
112
109
|
* The text that's displayed in the primary button
|
113
110
|
*/
|
111
|
+
/**@ts-ignore */
|
114
112
|
primaryButtonText: PropTypes.node,
|
115
113
|
/**
|
116
114
|
* Optionally specify an href for your Button to become an <a> element
|
@@ -119,6 +117,7 @@ ProductiveCard.propTypes = {
|
|
119
117
|
/**
|
120
118
|
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
121
119
|
*/
|
120
|
+
/**@ts-ignore */
|
122
121
|
secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
123
122
|
/**
|
124
123
|
* Determines if the secondary button is on the top or bottom of the card
|
@@ -127,6 +126,7 @@ ProductiveCard.propTypes = {
|
|
127
126
|
/**
|
128
127
|
* The text that's displayed in the secondary button
|
129
128
|
*/
|
129
|
+
/**@ts-ignore */
|
130
130
|
secondaryButtonText: PropTypes.node,
|
131
131
|
/**
|
132
132
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
@@ -1,31 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
2
|
+
import React, { ReactNode } from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { Tag } from '@carbon/react';
|
5
|
+
interface TagType {
|
6
|
+
label: string;
|
7
|
+
}
|
8
|
+
type AllTags = (TagType & Omit<React.ComponentProps<Tag>, 'filter'>)[];
|
9
|
+
interface TagOverflowModalProps {
|
10
|
+
allTags?: AllTags;
|
11
|
+
className?: string;
|
12
|
+
onClose?: () => void;
|
13
|
+
open?: boolean;
|
14
|
+
overflowType?: 'default' | 'tag';
|
15
|
+
portalTarget?: ReactNode;
|
16
|
+
searchLabel?: string;
|
17
|
+
searchPlaceholder?: string;
|
18
|
+
title?: string;
|
19
|
+
}
|
20
|
+
export declare const TagOverflowModal: {
|
21
|
+
({ allTags, className, title, onClose, open, overflowType, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: TagOverflowModalProps): any;
|
22
|
+
propTypes: {
|
23
|
+
allTags: PropTypes.Requireable<(PropTypes.InferProps<{
|
16
24
|
label: PropTypes.Validator<string>;
|
17
25
|
}> | null | undefined)[]>;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
27
|
-
|
28
|
-
}
|
29
|
-
import PropTypes from 'prop-types';
|
30
|
-
declare const componentName: "TagOverflowModal";
|
26
|
+
className: PropTypes.Requireable<string>;
|
27
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
28
|
+
open: PropTypes.Requireable<boolean>;
|
29
|
+
overflowType: PropTypes.Requireable<string>;
|
30
|
+
portalTarget: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
31
|
+
searchLabel: PropTypes.Requireable<string>;
|
32
|
+
searchPlaceholder: PropTypes.Requireable<string>;
|
33
|
+
title: PropTypes.Requireable<string>;
|
34
|
+
};
|
35
|
+
displayName: string;
|
36
|
+
};
|
31
37
|
export {};
|
@@ -5,11 +5,11 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useState } from 'react';
|
10
10
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
11
|
import cx from 'classnames';
|
12
|
-
import { ComposedModal, ModalHeader, Search, ModalBody
|
12
|
+
import { Tag, ComposedModal, ModalHeader, Search, ModalBody } from '@carbon/react';
|
13
13
|
import { pkg } from '../../settings.js';
|
14
14
|
import { prepareProps } from '../../global/js/utils/props-helper.js';
|
15
15
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
@@ -42,13 +42,13 @@ var TagOverflowModal = function TagOverflowModal(_ref) {
|
|
42
42
|
setSearch = _useState2[1];
|
43
43
|
var renderPortalUse = usePortalTarget(portalTargetIn);
|
44
44
|
var getFilteredItems = function getFilteredItems() {
|
45
|
-
if (open && search) {
|
45
|
+
if (open && search && allTags) {
|
46
46
|
return allTags.filter(function (tag) {
|
47
47
|
var _tag$label;
|
48
48
|
return (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.includes(search.toLocaleLowerCase());
|
49
49
|
});
|
50
50
|
}
|
51
|
-
return allTags;
|
51
|
+
return allTags || [];
|
52
52
|
};
|
53
53
|
var handleSearch = function handleSearch(evt) {
|
54
54
|
setSearch(evt.target.value || '');
|
package/es/components/index.d.ts
CHANGED
@@ -69,3 +69,4 @@ export { Guidebanner, GuidebannerElement, GuidebannerElementButton, GuidebannerE
|
|
69
69
|
export { InlineTip, InlineTipButton, InlineTipLink } from "./InlineTip";
|
70
70
|
export { DescriptionList, DescriptionListBody, DescriptionListCell, DescriptionListRow } from "./DescriptionList";
|
71
71
|
export { FilterPanel, FilterPanelAccordion, FilterPanelAccordionItem, FilterPanelCheckbox, FilterPanelCheckboxWithOverflow, FilterPanelGroup, FilterPanelLabel, FilterPanelSearch } from "./FilterPanel";
|
72
|
+
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from "./FeatureFlags";
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -9,8 +9,10 @@ import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPlugin
|
|
9
9
|
import { useState, useEffect, useCallback } from 'react';
|
10
10
|
import { pkg } from '../../../settings.js';
|
11
11
|
import { createPortal } from 'react-dom';
|
12
|
+
import { useFeatureFlag } from '../../../components/FeatureFlags/index.js';
|
12
13
|
|
13
14
|
var usePortalTarget = function usePortalTarget(portalTargetIn) {
|
15
|
+
var enablePortalTarget = useFeatureFlag('default-portal-target-body');
|
14
16
|
var _useState = useState(null),
|
15
17
|
_useState2 = _slicedToArray(_useState, 2),
|
16
18
|
portalTarget = _useState2[0],
|
@@ -19,11 +21,11 @@ var usePortalTarget = function usePortalTarget(portalTargetIn) {
|
|
19
21
|
if (portalTargetIn) {
|
20
22
|
setPortalTarget(portalTargetIn);
|
21
23
|
} else {
|
22
|
-
if (pkg.isFeatureEnabled('default-portal-target-body')) {
|
24
|
+
if (pkg.isFeatureEnabled('default-portal-target-body') || enablePortalTarget) {
|
23
25
|
setPortalTarget(document.body);
|
24
26
|
}
|
25
27
|
}
|
26
|
-
}, [portalTargetIn]);
|
28
|
+
}, [portalTargetIn, enablePortalTarget]);
|
27
29
|
var renderPortalUse = useCallback(function (children) {
|
28
30
|
return portalTarget ? /*#__PURE__*/createPortal(children, portalTarget) : children;
|
29
31
|
}, [portalTarget]);
|
package/es/index.js
CHANGED
@@ -133,3 +133,4 @@ export { FilterPanelLabel } from './components/FilterPanel/FilterPanelLabel/Filt
|
|
133
133
|
export { FilterPanelSearch } from './components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js';
|
134
134
|
export { ConditionBuilder } from './components/ConditionBuilder/ConditionBuilder.js';
|
135
135
|
export { GetStartedCard } from './components/GetStartedCard/GetStartedCard.js';
|
136
|
+
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
@@ -189,6 +189,7 @@ exports.Coachmark = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
189
189
|
// Default to `document.body` when `portalNode` is `null`
|
190
190
|
portalNode || document.body)));
|
191
191
|
});
|
192
|
+
var overlayRefType = typeof HTMLElement === 'undefined' ? index["default"].object : index["default"].instanceOf(HTMLElement);
|
192
193
|
|
193
194
|
// Return a placeholder if not released and not enabled by feature flag
|
194
195
|
exports.Coachmark = settings.pkg.checkComponentEnabled(exports.Coachmark, componentName);
|
@@ -229,7 +230,7 @@ exports.Coachmark.propTypes = {
|
|
229
230
|
*/
|
230
231
|
overlayKind: index["default"].oneOf(['tooltip', 'floating', 'stacked']),
|
231
232
|
overlayRef: index["default"].shape({
|
232
|
-
current:
|
233
|
+
current: overlayRefType
|
233
234
|
}),
|
234
235
|
/**
|
235
236
|
* By default, the Coachmark will be appended to the end of `document.body`.
|
@@ -53,6 +53,9 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
53
53
|
subtitle = _ref.subtitle,
|
54
54
|
title = _ref.title,
|
55
55
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
56
|
+
var localRef = React.useRef(null);
|
57
|
+
var stepRef = ref || localRef;
|
58
|
+
var stepRefValue = stepRef.current;
|
56
59
|
var stepsContext = React.useContext(CreateTearsheet.StepsContext);
|
57
60
|
var stepNumber = React.useContext(CreateTearsheet.StepNumberContext);
|
58
61
|
var _useState = React.useState(includeStep),
|
@@ -84,16 +87,36 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
84
87
|
React.useEffect(function () {
|
85
88
|
setShouldIncludeStep(includeStep);
|
86
89
|
}, [includeStep, stepsContext, title]);
|
90
|
+
var setFocusChildrenTabIndex = function setFocusChildrenTabIndex(childInputs, value) {
|
91
|
+
if (childInputs !== null && childInputs !== void 0 && childInputs.length) {
|
92
|
+
childInputs.forEach(function (child) {
|
93
|
+
child.tabIndex = value;
|
94
|
+
});
|
95
|
+
}
|
96
|
+
};
|
87
97
|
|
88
98
|
// Whenever we are the current step, supply our disableSubmit and onNext values to the
|
89
99
|
// steps container context so that it can manage the 'Next' button appropriately.
|
90
100
|
React.useEffect(function () {
|
101
|
+
var focusElementQuery = "button, input, select, textarea, a";
|
102
|
+
if (stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
103
|
+
// Specify tab-index -1 for focusable elements not contained
|
104
|
+
// in the current step so that the useFocus hook can exclude
|
105
|
+
// from the focus trap
|
106
|
+
var childInputs = stepRefValue === null || stepRefValue === void 0 ? void 0 : stepRefValue.querySelectorAll(focusElementQuery);
|
107
|
+
setFocusChildrenTabIndex(childInputs, -1);
|
108
|
+
}
|
91
109
|
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
110
|
+
// Specify tab-index 0 for current step focusable elements
|
111
|
+
// for the useFocus hook to know which elements to include
|
112
|
+
// in focus trap
|
113
|
+
var _childInputs = stepRefValue === null || stepRefValue === void 0 ? void 0 : stepRefValue.querySelectorAll(focusElementQuery);
|
114
|
+
setFocusChildrenTabIndex(_childInputs, 0);
|
92
115
|
stepsContext.setIsDisabled(!!disableSubmit);
|
93
116
|
stepsContext === null || stepsContext === void 0 || stepsContext.setOnNext(onNext); // needs to be updated here otherwise there could be stale state values from only initially setting onNext
|
94
117
|
stepsContext === null || stepsContext === void 0 || stepsContext.setOnPrevious(onPrevious);
|
95
118
|
}
|
96
|
-
}, [stepsContext, stepNumber, disableSubmit, onNext, onPrevious]);
|
119
|
+
}, [stepsContext, stepNumber, disableSubmit, onNext, onPrevious, stepRef, stepRefValue]);
|
97
120
|
var renderDescription = function renderDescription() {
|
98
121
|
if (description) {
|
99
122
|
if (typeof description === 'string') {
|
@@ -109,9 +132,10 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
109
132
|
}
|
110
133
|
return null;
|
111
134
|
};
|
112
|
-
return stepsContext ? /*#__PURE__*/React__default["default"].createElement(
|
113
|
-
|
114
|
-
|
135
|
+
return stepsContext ? /*#__PURE__*/React__default["default"].createElement("div", {
|
136
|
+
ref: stepRef
|
137
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Grid, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
138
|
+
className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)))
|
115
139
|
}), /*#__PURE__*/React__default["default"].createElement(react.Column, {
|
116
140
|
xlg: 12,
|
117
141
|
lg: 12,
|
@@ -126,7 +150,7 @@ exports.CreateTearsheetStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
126
150
|
}, hasFieldset ? /*#__PURE__*/React__default["default"].createElement(react.FormGroup, {
|
127
151
|
legendText: fieldsetLegendText,
|
128
152
|
className: "".concat(blockClass, "--fieldset")
|
129
|
-
}, children) : children)) : pconsole["default"].warn("You have tried using a ".concat(componentName, " component outside of a CreateTearsheet. This is not allowed. ").concat(componentName, "s should always be children of the CreateTearsheet"));
|
153
|
+
}, children) : children))) : pconsole["default"].warn("You have tried using a ".concat(componentName, " component outside of a CreateTearsheet. This is not allowed. ").concat(componentName, "s should always be children of the CreateTearsheet"));
|
130
154
|
});
|
131
155
|
|
132
156
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -17,12 +17,13 @@ var constants = require('./addons/Filtering/constants.js');
|
|
17
17
|
var DatagridBody = require('./DatagridBody.js');
|
18
18
|
var DatagridHead = require('./DatagridHead.js');
|
19
19
|
var DatagridToolbar = require('./DatagridToolbar.js');
|
20
|
-
var index = require('../../../node_modules/prop-types/index.js');
|
20
|
+
var index$1 = require('../../../node_modules/prop-types/index.js');
|
21
21
|
var cx = require('classnames');
|
22
22
|
var handleGridFocus = require('./addons/InlineEdit/handleGridFocus.js');
|
23
23
|
var handleGridKeyPress = require('./addons/InlineEdit/handleGridKeyPress.js');
|
24
24
|
var layout = require('@carbon/layout');
|
25
25
|
var FilterProvider = require('./addons/Filtering/FilterProvider.js');
|
26
|
+
var index = require('../../FeatureFlags/index.js');
|
26
27
|
var InlineEditContext = require('./addons/InlineEdit/InlineEditContext/InlineEditContext.js');
|
27
28
|
var useClickOutside = require('../../../global/js/hooks/useClickOutside.js');
|
28
29
|
var useMultipleKeyTracking = require('../../DataSpreadsheet/hooks/useMultipleKeyTracking.js');
|
@@ -50,7 +51,8 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
50
51
|
panelOpen = _useContext2.panelOpen;
|
51
52
|
var activeCellId = inlineEditState.activeCellId,
|
52
53
|
gridActive = inlineEditState.gridActive,
|
53
|
-
editId = inlineEditState.editId
|
54
|
+
editId = inlineEditState.editId,
|
55
|
+
featureFlags = inlineEditState.featureFlags;
|
54
56
|
var getTableProps = datagridState.getTableProps,
|
55
57
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
56
58
|
withVirtualScroll = datagridState.withVirtualScroll,
|
@@ -78,6 +80,24 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
78
80
|
var contentRows = DatagridPagination && page || rows;
|
79
81
|
var gridAreaRef = React.useRef();
|
80
82
|
var multiKeyTrackingRef = React.useRef();
|
83
|
+
var enableEditableCell = index.useFeatureFlag('enable-datagrid-useEditableCell');
|
84
|
+
var enableInlineEdit = index.useFeatureFlag('enable-datagrid-useInlineEdit');
|
85
|
+
var enableCustomizeCols = index.useFeatureFlag('enable-datagrid-useCustomizeColumns');
|
86
|
+
React.useEffect(function () {
|
87
|
+
dispatch({
|
88
|
+
type: 'SET_FEATURE_FLAGS',
|
89
|
+
payload: {
|
90
|
+
'enable-datagrid-useEditableCell': enableEditableCell,
|
91
|
+
'enable-datagrid-useInlineEdit': enableInlineEdit,
|
92
|
+
'enable-datagrid-useCustomizeColumns': enableCustomizeCols
|
93
|
+
}
|
94
|
+
});
|
95
|
+
}, [dispatch, enableEditableCell, enableCustomizeCols, enableInlineEdit]);
|
96
|
+
React.useEffect(function () {
|
97
|
+
if (featureFlags && (featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useEditableCell'] || featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useInlineEdit'])) {
|
98
|
+
console.error("Datagrid useEditableCell/useInlineEdit extension has not been enabled via feature flag.");
|
99
|
+
}
|
100
|
+
}, [featureFlags]);
|
81
101
|
useClickOutside.useClickOutside(gridAreaRef, function (target) {
|
82
102
|
if (!withInlineEdit) {
|
83
103
|
return;
|
@@ -184,34 +204,34 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
184
204
|
}));
|
185
205
|
};
|
186
206
|
DatagridContent.propTypes = {
|
187
|
-
ariaToolbarLabel: index["default"].string,
|
188
|
-
datagridState: index["default"].shape({
|
189
|
-
getTableProps: index["default"].func,
|
190
|
-
getFilterFlyoutProps: index["default"].func,
|
191
|
-
withVirtualScroll: index["default"].bool,
|
192
|
-
DatagridActions: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
193
|
-
DatagridPagination: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
194
|
-
CustomizeColumnsTearsheet: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
195
|
-
isFetching: index["default"].bool,
|
196
|
-
skeletonRowCount: index["default"].number,
|
197
|
-
fullHeightDatagrid: index["default"].bool,
|
198
|
-
filterProps: index["default"].object,
|
199
|
-
variableRowHeight: index["default"].bool,
|
200
|
-
useDenseHeader: index["default"].bool,
|
201
|
-
withInlineEdit: index["default"].bool,
|
202
|
-
verticalAlign: index["default"].string,
|
203
|
-
gridTitle: index["default"].node,
|
204
|
-
gridDescription: index["default"].node,
|
205
|
-
page: index["default"].arrayOf(index["default"].object),
|
206
|
-
rows: index["default"].arrayOf(index["default"].object),
|
207
|
-
tableId: index["default"].string,
|
208
|
-
totalColumnsWidth: index["default"].number,
|
209
|
-
gridRef: index["default"].object,
|
210
|
-
setAllFilters: index["default"].func,
|
211
|
-
getFilterProps: index["default"].func,
|
212
|
-
state: index["default"].object
|
207
|
+
ariaToolbarLabel: index$1["default"].string,
|
208
|
+
datagridState: index$1["default"].shape({
|
209
|
+
getTableProps: index$1["default"].func,
|
210
|
+
getFilterFlyoutProps: index$1["default"].func,
|
211
|
+
withVirtualScroll: index$1["default"].bool,
|
212
|
+
DatagridActions: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
213
|
+
DatagridPagination: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
214
|
+
CustomizeColumnsTearsheet: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
215
|
+
isFetching: index$1["default"].bool,
|
216
|
+
skeletonRowCount: index$1["default"].number,
|
217
|
+
fullHeightDatagrid: index$1["default"].bool,
|
218
|
+
filterProps: index$1["default"].object,
|
219
|
+
variableRowHeight: index$1["default"].bool,
|
220
|
+
useDenseHeader: index$1["default"].bool,
|
221
|
+
withInlineEdit: index$1["default"].bool,
|
222
|
+
verticalAlign: index$1["default"].string,
|
223
|
+
gridTitle: index$1["default"].node,
|
224
|
+
gridDescription: index$1["default"].node,
|
225
|
+
page: index$1["default"].arrayOf(index$1["default"].object),
|
226
|
+
rows: index$1["default"].arrayOf(index$1["default"].object),
|
227
|
+
tableId: index$1["default"].string,
|
228
|
+
totalColumnsWidth: index$1["default"].number,
|
229
|
+
gridRef: index$1["default"].object,
|
230
|
+
setAllFilters: index$1["default"].func,
|
231
|
+
getFilterProps: index$1["default"].func,
|
232
|
+
state: index$1["default"].object
|
213
233
|
}),
|
214
|
-
title: index["default"].string
|
234
|
+
title: index$1["default"].string
|
215
235
|
};
|
216
236
|
|
217
237
|
exports.DatagridContent = DatagridContent;
|
@@ -13,26 +13,11 @@ var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBa
|
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../../../node_modules/prop-types/index.js');
|
15
15
|
var CustomizeColumnsTearsheet = require('./CustomizeColumnsTearsheet.js');
|
16
|
+
var InlineEditContext = require('../InlineEdit/InlineEditContext/InlineEditContext.js');
|
16
17
|
|
17
|
-
function
|
18
|
-
if (e && e.__esModule) return e;
|
19
|
-
var n = Object.create(null);
|
20
|
-
if (e) {
|
21
|
-
Object.keys(e).forEach(function (k) {
|
22
|
-
if (k !== 'default') {
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () { return e[k]; }
|
27
|
-
});
|
28
|
-
}
|
29
|
-
});
|
30
|
-
}
|
31
|
-
n["default"] = e;
|
32
|
-
return Object.freeze(n);
|
33
|
-
}
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
34
19
|
|
35
|
-
var
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
36
21
|
|
37
22
|
var _excluded = ["onSaveColumnPrefs", "isTearsheetOpen", "setIsTearsheetOpen", "labels"];
|
38
23
|
var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
@@ -43,7 +28,16 @@ var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
|
43
28
|
setIsTearsheetOpen = _instance$customizeCo.setIsTearsheetOpen,
|
44
29
|
labels = _instance$customizeCo.labels,
|
45
30
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_instance$customizeCo, _excluded);
|
46
|
-
|
31
|
+
var _useContext = React.useContext(InlineEditContext.InlineEditContext),
|
32
|
+
state = _useContext.state;
|
33
|
+
var _ref2 = state || {},
|
34
|
+
featureFlags = _ref2.featureFlags;
|
35
|
+
React.useEffect(function () {
|
36
|
+
if (featureFlags && !(featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useCustomizeColumns'])) {
|
37
|
+
console.error("Datagrid useCustomizeColumns extension has not been enabled via feature flag.");
|
38
|
+
}
|
39
|
+
}, [featureFlags]);
|
40
|
+
return /*#__PURE__*/React__default["default"].createElement(CustomizeColumnsTearsheet["default"], _rollupPluginBabelHelpers["extends"]({}, rest, labels, {
|
47
41
|
isOpen: isTearsheetOpen,
|
48
42
|
setIsTearsheetOpen: setIsTearsheetOpen,
|
49
43
|
columnDefinitions: instance.allColumns,
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export function InlineEditButton({ label, renderIcon: Icon,
|
1
|
+
export function InlineEditButton({ label, renderIcon: Icon, labelIcon: LabelIcon, placeholder, disabledCell, nonEditCell, isActiveCell, columnConfig, type, }: {
|
2
2
|
label: any;
|
3
3
|
renderIcon: any;
|
4
|
-
disabled: any;
|
5
4
|
labelIcon: any;
|
6
5
|
placeholder: any;
|
6
|
+
disabledCell: any;
|
7
7
|
nonEditCell: any;
|
8
8
|
isActiveCell: any;
|
9
9
|
columnConfig: any;
|
@@ -12,7 +12,7 @@ export function InlineEditButton({ label, renderIcon: Icon, disabled, labelIcon:
|
|
12
12
|
export namespace InlineEditButton {
|
13
13
|
namespace propTypes {
|
14
14
|
let columnConfig: PropTypes.Requireable<object>;
|
15
|
-
let
|
15
|
+
let disabledCell: PropTypes.Requireable<boolean>;
|
16
16
|
let isActiveCell: PropTypes.Requireable<boolean>;
|
17
17
|
let label: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
18
18
|
let labelIcon: PropTypes.Requireable<object>;
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -24,18 +24,18 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
|
|
24
24
|
var InlineEditButton = function InlineEditButton(_ref) {
|
25
25
|
var label = _ref.label,
|
26
26
|
Icon = _ref.renderIcon,
|
27
|
-
disabled = _ref.disabled,
|
28
27
|
LabelIcon = _ref.labelIcon,
|
29
28
|
placeholder = _ref.placeholder,
|
29
|
+
disabledCell = _ref.disabledCell,
|
30
30
|
nonEditCell = _ref.nonEditCell,
|
31
31
|
isActiveCell = _ref.isActiveCell,
|
32
32
|
columnConfig = _ref.columnConfig,
|
33
33
|
type = _ref.type;
|
34
34
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
35
|
-
className: cx__default["default"]("".concat(blockClass, "__inline-edit-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit-button--disabled"),
|
35
|
+
className: cx__default["default"]("".concat(blockClass, "__inline-edit-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit-button--disabled"), disabledCell), "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection')),
|
36
36
|
tabIndex: isActiveCell ? 0 : -1,
|
37
|
-
"data-disabled":
|
38
|
-
"aria-disabled":
|
37
|
+
"data-disabled": disabledCell,
|
38
|
+
"aria-disabled": disabledCell,
|
39
39
|
role: "button",
|
40
40
|
title: label
|
41
41
|
}, LabelIcon && /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -50,7 +50,7 @@ var InlineEditButton = function InlineEditButton(_ref) {
|
|
50
50
|
};
|
51
51
|
InlineEditButton.propTypes = {
|
52
52
|
columnConfig: index["default"].object,
|
53
|
-
|
53
|
+
disabledCell: index["default"].bool,
|
54
54
|
isActiveCell: index["default"].bool,
|
55
55
|
label: index["default"].oneOfType([index["default"].string, index["default"].number]),
|
56
56
|
labelIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|