@carbon/ibm-products 2.41.1-canary.11 → 2.41.1-canary.5
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +0 -6
- 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 +0 -6
- 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 +0 -6
- 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 +0 -6
- 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/Datagrid/Datagrid/DatagridContent.js +1 -21
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +2 -12
- 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 +1 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +3 -12
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +0 -7
- package/es/components/Datagrid/useCustomizeColumns.js +4 -0
- 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 +16 -9
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +3 -4
- package/es/components/ProductiveCard/ProductiveCard.d.ts +2 -115
- package/es/components/ProductiveCard/ProductiveCard.js +9 -9
- package/es/components/index.d.ts +0 -1
- package/es/global/js/hooks/usePortalTarget.js +2 -4
- package/es/index.js +0 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +29 -49
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +19 -13
- 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 +1 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +3 -12
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +0 -7
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -0
- 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 +15 -8
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +3 -4
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +2 -115
- package/lib/components/ProductiveCard/ProductiveCard.js +9 -9
- package/lib/components/index.d.ts +0 -1
- package/lib/global/js/hooks/usePortalTarget.js +2 -4
- package/lib/index.js +0 -4
- package/package.json +3 -7
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +0 -6
- package/es/components/FeatureFlags/index.d.ts +0 -37
- package/es/components/FeatureFlags/index.js +0 -151
- package/es/feature-flags.d.ts +0 -1
- package/lib/components/FeatureFlags/index.d.ts +0 -37
- package/lib/components/FeatureFlags/index.js +0 -162
- package/lib/feature-flags.d.ts +0 -1
@@ -1,37 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Supports an object of feature flag values with the `flags` prop, merging them
|
3
|
-
* along with the current `FeatureFlagContext` to provide consumers to check if
|
4
|
-
* a feature flag is enabled or disabled in a given React tree
|
5
|
-
*/
|
6
|
-
export function FeatureFlags({ children, flags }: {
|
7
|
-
children: any;
|
8
|
-
flags?: {} | undefined;
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
10
|
-
export namespace FeatureFlags {
|
11
|
-
namespace propTypes {
|
12
|
-
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
13
|
-
let flags: PropTypes.Requireable<{
|
14
|
-
[x: string]: boolean | null | undefined;
|
15
|
-
}>;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
20
|
-
* or disable feature flags in a given React tree
|
21
|
-
*/
|
22
|
-
export const FeatureFlagContext: React.Context<any>;
|
23
|
-
/**
|
24
|
-
* Access all feature flag information for the given FeatureFlagContext
|
25
|
-
*
|
26
|
-
* @returns {FeatureFlagScope}
|
27
|
-
*/
|
28
|
-
export function useFeatureFlags(): FeatureFlagScope;
|
29
|
-
/**
|
30
|
-
* Access whether a given flag is enabled or disabled in a given
|
31
|
-
* FeatureFlagContext
|
32
|
-
*
|
33
|
-
* @returns {boolean}
|
34
|
-
*/
|
35
|
-
export function useFeatureFlag(flag: any): boolean;
|
36
|
-
import PropTypes from 'prop-types';
|
37
|
-
import React from 'react';
|
@@ -1,151 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useContext, useState, useRef, useEffect, createContext } from 'react';
|
10
|
-
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
|
-
import { createScope, FeatureFlags as FeatureFlags$1 } from '@carbon/feature-flags';
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
15
|
-
* or disable feature flags in a given React tree
|
16
|
-
*/
|
17
|
-
var FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags$1);
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Supports an object of feature flag values with the `flags` prop, merging them
|
21
|
-
* along with the current `FeatureFlagContext` to provide consumers to check if
|
22
|
-
* a feature flag is enabled or disabled in a given React tree
|
23
|
-
*/
|
24
|
-
function FeatureFlags(_ref) {
|
25
|
-
var children = _ref.children,
|
26
|
-
_ref$flags = _ref.flags,
|
27
|
-
flags = _ref$flags === void 0 ? {} : _ref$flags;
|
28
|
-
var parentScope = useContext(FeatureFlagContext);
|
29
|
-
var _useState = useState(parentScope),
|
30
|
-
_useState2 = _slicedToArray(_useState, 2),
|
31
|
-
prevParentScope = _useState2[0],
|
32
|
-
setPrevParentScope = _useState2[1];
|
33
|
-
var _useState3 = useState(function () {
|
34
|
-
var scope = createScope(flags);
|
35
|
-
scope.mergeWithScope(parentScope);
|
36
|
-
return scope;
|
37
|
-
}),
|
38
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
39
|
-
scope = _useState4[0],
|
40
|
-
updateScope = _useState4[1];
|
41
|
-
if (parentScope !== prevParentScope) {
|
42
|
-
var _scope = createScope(flags);
|
43
|
-
_scope.mergeWithScope(parentScope);
|
44
|
-
updateScope(_scope);
|
45
|
-
setPrevParentScope(parentScope);
|
46
|
-
}
|
47
|
-
|
48
|
-
// We use a custom hook to detect if any of the keys or their values change
|
49
|
-
// for flags that are passed in. If they have changed, then we re-create the
|
50
|
-
// FeatureFlagScope using the new flags
|
51
|
-
useChangedValue(flags, isEqual, function (changedFlags) {
|
52
|
-
var scope = createScope(changedFlags);
|
53
|
-
scope.mergeWithScope(parentScope);
|
54
|
-
updateScope(scope);
|
55
|
-
});
|
56
|
-
return /*#__PURE__*/React__default.createElement(FeatureFlagContext.Provider, {
|
57
|
-
value: scope
|
58
|
-
}, children);
|
59
|
-
}
|
60
|
-
FeatureFlags.propTypes = {
|
61
|
-
children: PropTypes.node,
|
62
|
-
/**
|
63
|
-
* Provide the feature flags to enabled or disabled in the current React tree
|
64
|
-
*/
|
65
|
-
flags: PropTypes.objectOf(PropTypes.bool)
|
66
|
-
};
|
67
|
-
|
68
|
-
/**
|
69
|
-
* This hook will store previous versions of the given `value` and compare the
|
70
|
-
* current value to the previous one using the `compare` function. If the
|
71
|
-
* compare function returns true, then the given `callback` is invoked in an
|
72
|
-
* effect.
|
73
|
-
*
|
74
|
-
* @param {any} value
|
75
|
-
* @param {Function} compare
|
76
|
-
* @param {Function} callback
|
77
|
-
*/
|
78
|
-
function useChangedValue(value, compare, callback) {
|
79
|
-
var initialRender = useRef(false);
|
80
|
-
var savedCallback = useRef(callback);
|
81
|
-
var _useState5 = useState(value),
|
82
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
83
|
-
prevValue = _useState6[0],
|
84
|
-
setPrevValue = _useState6[1];
|
85
|
-
if (!compare(prevValue, value)) {
|
86
|
-
setPrevValue(value);
|
87
|
-
}
|
88
|
-
useEffect(function () {
|
89
|
-
savedCallback.current = callback;
|
90
|
-
});
|
91
|
-
useEffect(function () {
|
92
|
-
// We only want the callback triggered after the first render
|
93
|
-
if (initialRender.current) {
|
94
|
-
savedCallback.current(prevValue);
|
95
|
-
}
|
96
|
-
}, [prevValue]);
|
97
|
-
useEffect(function () {
|
98
|
-
initialRender.current = true;
|
99
|
-
}, []);
|
100
|
-
}
|
101
|
-
|
102
|
-
/**
|
103
|
-
* Access whether a given flag is enabled or disabled in a given
|
104
|
-
* FeatureFlagContext
|
105
|
-
*
|
106
|
-
* @returns {boolean}
|
107
|
-
*/
|
108
|
-
function useFeatureFlag(flag) {
|
109
|
-
var scope = useContext(FeatureFlagContext);
|
110
|
-
// console.log(scope);
|
111
|
-
return scope.enabled(flag);
|
112
|
-
}
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Access all feature flag information for the given FeatureFlagContext
|
116
|
-
*
|
117
|
-
* @returns {FeatureFlagScope}
|
118
|
-
*/
|
119
|
-
function useFeatureFlags() {
|
120
|
-
return useContext(FeatureFlagContext);
|
121
|
-
}
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Compare two objects and determine if they are equal. This is a shallow
|
125
|
-
* comparison since the objects we are comparing are objects with boolean flags
|
126
|
-
* from the flags prop in the `FeatureFlags` component
|
127
|
-
*
|
128
|
-
* @param {object} a
|
129
|
-
* @param {object} b
|
130
|
-
* @returns {boolean}
|
131
|
-
*/
|
132
|
-
function isEqual(a, b) {
|
133
|
-
if (a === b) {
|
134
|
-
return true;
|
135
|
-
}
|
136
|
-
for (var _i = 0, _Object$keys = Object.keys(a); _i < _Object$keys.length; _i++) {
|
137
|
-
var key = _Object$keys[_i];
|
138
|
-
if (a[key] !== b[key]) {
|
139
|
-
return false;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
for (var _i2 = 0, _Object$keys2 = Object.keys(b); _i2 < _Object$keys2.length; _i2++) {
|
143
|
-
var _key = _Object$keys2[_i2];
|
144
|
-
if (b[_key] !== a[_key]) {
|
145
|
-
return false;
|
146
|
-
}
|
147
|
-
}
|
148
|
-
return true;
|
149
|
-
}
|
150
|
-
|
151
|
-
export { FeatureFlagContext, FeatureFlags, useFeatureFlag, useFeatureFlags };
|
package/es/feature-flags.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,37 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Supports an object of feature flag values with the `flags` prop, merging them
|
3
|
-
* along with the current `FeatureFlagContext` to provide consumers to check if
|
4
|
-
* a feature flag is enabled or disabled in a given React tree
|
5
|
-
*/
|
6
|
-
export function FeatureFlags({ children, flags }: {
|
7
|
-
children: any;
|
8
|
-
flags?: {} | undefined;
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
10
|
-
export namespace FeatureFlags {
|
11
|
-
namespace propTypes {
|
12
|
-
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
13
|
-
let flags: PropTypes.Requireable<{
|
14
|
-
[x: string]: boolean | null | undefined;
|
15
|
-
}>;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
20
|
-
* or disable feature flags in a given React tree
|
21
|
-
*/
|
22
|
-
export const FeatureFlagContext: React.Context<any>;
|
23
|
-
/**
|
24
|
-
* Access all feature flag information for the given FeatureFlagContext
|
25
|
-
*
|
26
|
-
* @returns {FeatureFlagScope}
|
27
|
-
*/
|
28
|
-
export function useFeatureFlags(): FeatureFlagScope;
|
29
|
-
/**
|
30
|
-
* Access whether a given flag is enabled or disabled in a given
|
31
|
-
* FeatureFlagContext
|
32
|
-
*
|
33
|
-
* @returns {boolean}
|
34
|
-
*/
|
35
|
-
export function useFeatureFlag(flag: any): boolean;
|
36
|
-
import PropTypes from 'prop-types';
|
37
|
-
import React from 'react';
|
@@ -1,162 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
'use strict';
|
9
|
-
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
-
|
12
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
-
var React = require('react');
|
14
|
-
var index = require('../../node_modules/prop-types/index.js');
|
15
|
-
var FeatureFlags$1 = require('@carbon/feature-flags');
|
16
|
-
|
17
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
|
-
|
19
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
23
|
-
* or disable feature flags in a given React tree
|
24
|
-
*/
|
25
|
-
var FeatureFlagContext = /*#__PURE__*/React.createContext(FeatureFlags$1.FeatureFlags);
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Supports an object of feature flag values with the `flags` prop, merging them
|
29
|
-
* along with the current `FeatureFlagContext` to provide consumers to check if
|
30
|
-
* a feature flag is enabled or disabled in a given React tree
|
31
|
-
*/
|
32
|
-
function FeatureFlags(_ref) {
|
33
|
-
var children = _ref.children,
|
34
|
-
_ref$flags = _ref.flags,
|
35
|
-
flags = _ref$flags === void 0 ? {} : _ref$flags;
|
36
|
-
var parentScope = React.useContext(FeatureFlagContext);
|
37
|
-
var _useState = React.useState(parentScope),
|
38
|
-
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
39
|
-
prevParentScope = _useState2[0],
|
40
|
-
setPrevParentScope = _useState2[1];
|
41
|
-
var _useState3 = React.useState(function () {
|
42
|
-
var scope = FeatureFlags$1.createScope(flags);
|
43
|
-
scope.mergeWithScope(parentScope);
|
44
|
-
return scope;
|
45
|
-
}),
|
46
|
-
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
47
|
-
scope = _useState4[0],
|
48
|
-
updateScope = _useState4[1];
|
49
|
-
if (parentScope !== prevParentScope) {
|
50
|
-
var _scope = FeatureFlags$1.createScope(flags);
|
51
|
-
_scope.mergeWithScope(parentScope);
|
52
|
-
updateScope(_scope);
|
53
|
-
setPrevParentScope(parentScope);
|
54
|
-
}
|
55
|
-
|
56
|
-
// We use a custom hook to detect if any of the keys or their values change
|
57
|
-
// for flags that are passed in. If they have changed, then we re-create the
|
58
|
-
// FeatureFlagScope using the new flags
|
59
|
-
useChangedValue(flags, isEqual, function (changedFlags) {
|
60
|
-
var scope = FeatureFlags$1.createScope(changedFlags);
|
61
|
-
scope.mergeWithScope(parentScope);
|
62
|
-
updateScope(scope);
|
63
|
-
});
|
64
|
-
return /*#__PURE__*/React__default["default"].createElement(FeatureFlagContext.Provider, {
|
65
|
-
value: scope
|
66
|
-
}, children);
|
67
|
-
}
|
68
|
-
FeatureFlags.propTypes = {
|
69
|
-
children: index["default"].node,
|
70
|
-
/**
|
71
|
-
* Provide the feature flags to enabled or disabled in the current React tree
|
72
|
-
*/
|
73
|
-
flags: index["default"].objectOf(index["default"].bool)
|
74
|
-
};
|
75
|
-
|
76
|
-
/**
|
77
|
-
* This hook will store previous versions of the given `value` and compare the
|
78
|
-
* current value to the previous one using the `compare` function. If the
|
79
|
-
* compare function returns true, then the given `callback` is invoked in an
|
80
|
-
* effect.
|
81
|
-
*
|
82
|
-
* @param {any} value
|
83
|
-
* @param {Function} compare
|
84
|
-
* @param {Function} callback
|
85
|
-
*/
|
86
|
-
function useChangedValue(value, compare, callback) {
|
87
|
-
var initialRender = React.useRef(false);
|
88
|
-
var savedCallback = React.useRef(callback);
|
89
|
-
var _useState5 = React.useState(value),
|
90
|
-
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
91
|
-
prevValue = _useState6[0],
|
92
|
-
setPrevValue = _useState6[1];
|
93
|
-
if (!compare(prevValue, value)) {
|
94
|
-
setPrevValue(value);
|
95
|
-
}
|
96
|
-
React.useEffect(function () {
|
97
|
-
savedCallback.current = callback;
|
98
|
-
});
|
99
|
-
React.useEffect(function () {
|
100
|
-
// We only want the callback triggered after the first render
|
101
|
-
if (initialRender.current) {
|
102
|
-
savedCallback.current(prevValue);
|
103
|
-
}
|
104
|
-
}, [prevValue]);
|
105
|
-
React.useEffect(function () {
|
106
|
-
initialRender.current = true;
|
107
|
-
}, []);
|
108
|
-
}
|
109
|
-
|
110
|
-
/**
|
111
|
-
* Access whether a given flag is enabled or disabled in a given
|
112
|
-
* FeatureFlagContext
|
113
|
-
*
|
114
|
-
* @returns {boolean}
|
115
|
-
*/
|
116
|
-
function useFeatureFlag(flag) {
|
117
|
-
var scope = React.useContext(FeatureFlagContext);
|
118
|
-
// console.log(scope);
|
119
|
-
return scope.enabled(flag);
|
120
|
-
}
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Access all feature flag information for the given FeatureFlagContext
|
124
|
-
*
|
125
|
-
* @returns {FeatureFlagScope}
|
126
|
-
*/
|
127
|
-
function useFeatureFlags() {
|
128
|
-
return React.useContext(FeatureFlagContext);
|
129
|
-
}
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Compare two objects and determine if they are equal. This is a shallow
|
133
|
-
* comparison since the objects we are comparing are objects with boolean flags
|
134
|
-
* from the flags prop in the `FeatureFlags` component
|
135
|
-
*
|
136
|
-
* @param {object} a
|
137
|
-
* @param {object} b
|
138
|
-
* @returns {boolean}
|
139
|
-
*/
|
140
|
-
function isEqual(a, b) {
|
141
|
-
if (a === b) {
|
142
|
-
return true;
|
143
|
-
}
|
144
|
-
for (var _i = 0, _Object$keys = Object.keys(a); _i < _Object$keys.length; _i++) {
|
145
|
-
var key = _Object$keys[_i];
|
146
|
-
if (a[key] !== b[key]) {
|
147
|
-
return false;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
for (var _i2 = 0, _Object$keys2 = Object.keys(b); _i2 < _Object$keys2.length; _i2++) {
|
151
|
-
var _key = _Object$keys2[_i2];
|
152
|
-
if (b[_key] !== a[_key]) {
|
153
|
-
return false;
|
154
|
-
}
|
155
|
-
}
|
156
|
-
return true;
|
157
|
-
}
|
158
|
-
|
159
|
-
exports.FeatureFlagContext = FeatureFlagContext;
|
160
|
-
exports.FeatureFlags = FeatureFlags;
|
161
|
-
exports.useFeatureFlag = useFeatureFlag;
|
162
|
-
exports.useFeatureFlags = useFeatureFlags;
|
package/lib/feature-flags.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|