@carbon/ibm-products 2.57.0 → 2.57.1-rc.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/es/components/APIKeyModal/APIKeyModal.js +4 -5
- package/es/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
- package/es/components/ConditionBuilder/ConditionBuilder.js +14 -2
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
- package/es/components/CreateTearsheet/CreateTearsheet.js +32 -11
- package/es/components/EmptyStates/EmptyState.d.ts +6 -1
- package/es/components/EmptyStates/EmptyState.js +12 -3
- package/es/components/EmptyStates/EmptyStateContent.d.ts +3 -1
- package/es/components/EmptyStates/EmptyStateContent.js +8 -2
- package/es/components/EmptyStates/EmptyStateIllustration.js +4 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NoDataIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
- package/es/components/FilterSummary/FilterSummary.js +1 -1
- package/es/components/Tearsheet/TearsheetShell.d.ts +11 -7
- package/es/components/Tearsheet/TearsheetShell.js +14 -14
- package/es/global/js/hooks/useFocus.js +21 -19
- package/lib/components/APIKeyModal/APIKeyModal.js +4 -5
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
- package/lib/components/ConditionBuilder/ConditionBuilder.js +14 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
- package/lib/components/CreateTearsheet/CreateTearsheet.js +31 -10
- package/lib/components/EmptyStates/EmptyState.d.ts +6 -1
- package/lib/components/EmptyStates/EmptyState.js +12 -3
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +3 -1
- package/lib/components/EmptyStates/EmptyStateContent.js +7 -1
- package/lib/components/EmptyStates/EmptyStateIllustration.js +3 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
- package/lib/components/FilterSummary/FilterSummary.js +1 -1
- package/lib/components/Tearsheet/TearsheetShell.d.ts +11 -7
- package/lib/components/Tearsheet/TearsheetShell.js +14 -14
- package/lib/global/js/hooks/useFocus.js +21 -19
- package/package.json +6 -6
- package/telemetry.yml +3 -0
@@ -21,7 +21,7 @@ import { useFocus, claimFocus } from '../../global/js/hooks/useFocus.js';
|
|
21
21
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
22
22
|
|
23
23
|
var _ErrorFilled, _InformationFilled;
|
24
|
-
var _excluded = ["apiKey", "apiKeyLabel", "apiKeyName", "body", "className", "closeButtonText", "copyButtonText", "copyErrorText", "copyIconDescription", "customSteps", "downloadBodyText", "downloadFileName", "downloadFileType", "downloadLinkText", "downloadLinkLabel", "editButtonText", "editSuccess", "editSuccessTitle", "editSuccessMessage", "editing", "error", "errorText", "generateButtonText", "generateSuccessBody", "generateSuccessTitle", "generateSuccessMessage", "generateTitle", "hasAPIKeyVisibilityToggle", "hasDownloadLink", "hideAPIKeyLabel", "launcherButtonRef", "loading", "loadingText", "modalLabel", "nameHelperText", "nameLabel", "namePlaceholder", "nameRequired", "nextStepButtonText", "onClose", "onCopy", "onRequestEdit", "onRequestGenerate", "open", "portalTarget", "previousStepButtonText", "
|
24
|
+
var _excluded = ["apiKey", "apiKeyLabel", "apiKeyName", "body", "className", "closeButtonText", "copyButtonText", "copyErrorText", "copyIconDescription", "customSteps", "downloadBodyText", "downloadFileName", "downloadFileType", "downloadLinkText", "downloadLinkLabel", "editButtonText", "editSuccess", "editSuccessTitle", "editSuccessMessage", "editing", "error", "errorText", "generateButtonText", "generateSuccessBody", "generateSuccessTitle", "generateSuccessMessage", "generateTitle", "hasAPIKeyVisibilityToggle", "hasDownloadLink", "hideAPIKeyLabel", "launcherButtonRef", "loading", "loadingText", "modalLabel", "nameHelperText", "nameLabel", "namePlaceholder", "nameRequired", "nextStepButtonText", "onClose", "onCopy", "onRequestEdit", "onRequestGenerate", "open", "portalTarget", "previousStepButtonText", "showAPIKeyLabel", "helperText"];
|
25
25
|
var componentName = 'APIKeyModal';
|
26
26
|
|
27
27
|
// Default values for props
|
@@ -80,7 +80,6 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
80
80
|
open = _ref.open,
|
81
81
|
portalTargetIn = _ref.portalTarget,
|
82
82
|
previousStepButtonText = _ref.previousStepButtonText,
|
83
|
-
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
84
83
|
showAPIKeyLabel = _ref.showAPIKeyLabel,
|
85
84
|
helperText = _ref.helperText,
|
86
85
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -125,7 +124,7 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
125
124
|
var localRef = useRef(undefined);
|
126
125
|
var PasswordInputRef = useRef(null);
|
127
126
|
var modalRef = ref || localRef;
|
128
|
-
var _useFocus = useFocus(modalRef
|
127
|
+
var _useFocus = useFocus(modalRef),
|
129
128
|
firstElement = _useFocus.firstElement,
|
130
129
|
keyDownListener = _useFocus.keyDownListener;
|
131
130
|
var prevOpen = usePreviousValue(open);
|
@@ -140,9 +139,9 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
140
139
|
useEffect(function () {
|
141
140
|
if (open) {
|
142
141
|
// Focusing the first element or selectorPrimaryFocus element
|
143
|
-
claimFocus(firstElement, modalRef,
|
142
|
+
claimFocus(firstElement, modalRef, "#".concat(CSS.escape(apiKeyInputId === null || apiKeyInputId === void 0 ? void 0 : apiKeyInputId.current)));
|
144
143
|
}
|
145
|
-
}, [firstElement, modalRef, open
|
144
|
+
}, [firstElement, modalRef, open]);
|
146
145
|
useEffect(function () {
|
147
146
|
if (prevOpen && !open && launcherButtonRef) {
|
148
147
|
setTimeout(function () {
|
@@ -154,11 +154,6 @@ interface APIKeyModalCommonProps {
|
|
154
154
|
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
155
155
|
*/
|
156
156
|
portalTarget?: ReactNode;
|
157
|
-
/**
|
158
|
-
* Specify a CSS selector that matches the DOM element that should be
|
159
|
-
* focused when the Modal opens.
|
160
|
-
*/
|
161
|
-
selectorPrimaryFocus?: string;
|
162
157
|
/**
|
163
158
|
* label text that's displayed when hovering over visibility toggler to show key
|
164
159
|
*/
|
@@ -17,7 +17,7 @@ import { pkg } from '../../settings.js';
|
|
17
17
|
import { handleKeyDown } from './utils/handleKeyboardEvents.js';
|
18
18
|
import { blockClass, NON_HIERARCHICAL_VARIANT } from './utils/util.js';
|
19
19
|
|
20
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId"];
|
20
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId", "statementConfigCustom"];
|
21
21
|
|
22
22
|
// Carbon and package components we use.
|
23
23
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -58,6 +58,7 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
58
58
|
variant = _ref$variant === void 0 ? NON_HIERARCHICAL_VARIANT : _ref$variant,
|
59
59
|
actions = _ref.actions,
|
60
60
|
translateWithId = _ref.translateWithId,
|
61
|
+
statementConfigCustom = _ref.statementConfigCustom,
|
61
62
|
rest = _objectWithoutProperties(_ref, _excluded);
|
62
63
|
var localRef = useRef(null);
|
63
64
|
var conditionBuilderRef = ref || localRef;
|
@@ -70,7 +71,8 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
70
71
|
getOptions: getOptions,
|
71
72
|
variant: variant,
|
72
73
|
translateWithId: translateWithId,
|
73
|
-
conditionBuilderRef: conditionBuilderRef
|
74
|
+
conditionBuilderRef: conditionBuilderRef,
|
75
|
+
statementConfigCustom: statementConfigCustom
|
74
76
|
}, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
75
77
|
className: cx(blockClass,
|
76
78
|
// Apply the block class to the main HTML element
|
@@ -206,6 +208,16 @@ ConditionBuilder.propTypes = {
|
|
206
208
|
* Provide a label to the button that starts condition builder
|
207
209
|
*/
|
208
210
|
startConditionLabel: PropTypes.string,
|
211
|
+
/**
|
212
|
+
* Optional prop for passing custom configuration for statement option from default op
|
213
|
+
*/
|
214
|
+
/**@ts-ignore */
|
215
|
+
statementConfigCustom: PropTypes.arrayOf(PropTypes.shape({
|
216
|
+
id: PropTypes.string.isRequired,
|
217
|
+
connector: PropTypes.oneOf(['and', 'or']).isRequired,
|
218
|
+
label: PropTypes.string.isRequired,
|
219
|
+
secondaryLabel: PropTypes.string
|
220
|
+
})),
|
209
221
|
/**
|
210
222
|
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
211
223
|
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
@@ -29,14 +29,15 @@ export type Operators = {
|
|
29
29
|
option: OptionOperator;
|
30
30
|
date: DateOperator;
|
31
31
|
};
|
32
|
+
export type option = {
|
33
|
+
id: string;
|
34
|
+
label: string;
|
35
|
+
icon?: CarbonIconType;
|
36
|
+
};
|
32
37
|
export type PropertyConfigOption = {
|
33
38
|
type: 'option';
|
34
39
|
config?: {
|
35
|
-
options?:
|
36
|
-
id: string;
|
37
|
-
label: string;
|
38
|
-
icon?: CarbonIconType;
|
39
|
-
}[];
|
40
|
+
options?: option[];
|
40
41
|
};
|
41
42
|
};
|
42
43
|
export interface PropertyConfigText {
|
@@ -120,6 +121,12 @@ export type Action = {
|
|
120
121
|
label?: string;
|
121
122
|
};
|
122
123
|
export type variantsType = 'Non-Hierarchical' | 'Hierarchical';
|
124
|
+
export type statementConfig = {
|
125
|
+
id: string;
|
126
|
+
connector: 'and' | 'or';
|
127
|
+
label: string;
|
128
|
+
secondaryLabel?: string;
|
129
|
+
};
|
123
130
|
export type ConditionBuilderProps = {
|
124
131
|
inputConfig: inputConfig;
|
125
132
|
initialState?: InitialState;
|
@@ -132,6 +139,7 @@ export type ConditionBuilderProps = {
|
|
132
139
|
startConditionLabel?: string;
|
133
140
|
variant?: 'Non-Hierarchical' | 'Hierarchical';
|
134
141
|
translateWithId: (id: string) => string;
|
142
|
+
statementConfigCustom: statementConfig[];
|
135
143
|
};
|
136
144
|
export type InitialState = {
|
137
145
|
state: ConditionBuilderState;
|
@@ -144,6 +152,7 @@ export interface ConditionBuilderContextInputProps extends PropsWithChildren {
|
|
144
152
|
getOptions?: (state: ConditionBuilderState, condition: Condition) => Promise<Option[]>;
|
145
153
|
variant?: string;
|
146
154
|
translateWithId?: (id: string) => string;
|
155
|
+
statementConfigCustom?: statementConfig[];
|
147
156
|
conditionBuilderRef?: ForwardedRef<HTMLDivElement>;
|
148
157
|
}
|
149
158
|
export type ConditionBuilderContextProps = {
|
@@ -51,7 +51,8 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
|
|
51
51
|
getOptions: props.getOptions,
|
52
52
|
variant: props.variant,
|
53
53
|
translateWithId: props.translateWithId,
|
54
|
-
conditionBuilderRef: props.conditionBuilderRef
|
54
|
+
conditionBuilderRef: props.conditionBuilderRef,
|
55
|
+
statementConfigCustom: props.statementConfigCustom
|
55
56
|
};
|
56
57
|
return /*#__PURE__*/React__default.createElement(ConditionBuilderContext.Provider, {
|
57
58
|
value: contextValue
|
@@ -15,6 +15,7 @@ import { useTranslations } from '../utils/useTranslations.js';
|
|
15
15
|
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
16
16
|
import { handleKeyDownForPopover } from '../utils/handleKeyboardEvents.js';
|
17
17
|
import { blockClass, getValue } from '../utils/util.js';
|
18
|
+
import { translationsObject } from '../ConditionBuilderContext/translationObject.js';
|
18
19
|
|
19
20
|
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren", "onChange"];
|
20
21
|
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
@@ -36,12 +37,19 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
36
37
|
_useState2 = _slicedToArray(_useState, 2),
|
37
38
|
open = _useState2[0],
|
38
39
|
setOpen = _useState2[1];
|
40
|
+
var _useContext = useContext(ConditionBuilderContext),
|
41
|
+
conditionBuilderRef = _useContext.conditionBuilderRef,
|
42
|
+
statementConfigCustom = _useContext.statementConfigCustom;
|
39
43
|
var statementIdMap = {
|
40
|
-
ifAll:
|
41
|
-
ifAny:
|
42
|
-
unlessAll:
|
43
|
-
unlessAny:
|
44
|
+
ifAll: translationsObject.ifText,
|
45
|
+
ifAny: translationsObject.ifText,
|
46
|
+
unlessAll: translationsObject.unlessText,
|
47
|
+
unlessAny: translationsObject.unlessText
|
44
48
|
};
|
49
|
+
//Appending statements from custom statement configuration if present
|
50
|
+
statementConfigCustom === null || statementConfigCustom === void 0 || statementConfigCustom.forEach(function (statement) {
|
51
|
+
statementIdMap[statement.id] = statement.label;
|
52
|
+
});
|
45
53
|
var _useTranslations = useTranslations(['invalidText', 'addConditionText', 'addPropertyText', 'addOperatorText', 'addValueText', label], statementIdMap),
|
46
54
|
_useTranslations2 = _slicedToArray(_useTranslations, 6),
|
47
55
|
invalidText = _useTranslations2[0],
|
@@ -50,8 +58,6 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
50
58
|
addOperatorText = _useTranslations2[3],
|
51
59
|
addValueText = _useTranslations2[4],
|
52
60
|
labelText = _useTranslations2[5];
|
53
|
-
var _useContext = useContext(ConditionBuilderContext),
|
54
|
-
conditionBuilderRef = _useContext.conditionBuilderRef;
|
55
61
|
var getPropertyDetails = function getPropertyDetails() {
|
56
62
|
var _ref2 = condition || {},
|
57
63
|
property = _ref2.property,
|
@@ -6,13 +6,15 @@
|
|
6
6
|
*/
|
7
7
|
import React from 'react';
|
8
8
|
import PropTypes from 'prop-types';
|
9
|
-
import {
|
9
|
+
import { option, statementConfig } from '../../ConditionBuilder.types';
|
10
10
|
interface ItemOptionProps {
|
11
11
|
conditionState: {
|
12
12
|
label?: string;
|
13
13
|
value?: string;
|
14
14
|
};
|
15
|
-
config:
|
15
|
+
config: {
|
16
|
+
options?: option[] | statementConfig[];
|
17
|
+
} & {
|
16
18
|
isStatement?: boolean;
|
17
19
|
};
|
18
20
|
onChange: (value: string, e: Event) => void;
|
package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js
CHANGED
@@ -61,7 +61,7 @@ var ItemOption = function ItemOption(_ref) {
|
|
61
61
|
var getStatementContent = function getStatementContent(option) {
|
62
62
|
return /*#__PURE__*/React__default.createElement("div", {
|
63
63
|
className: "".concat(blockClass, "__statement_wrapper")
|
64
|
-
}, /*#__PURE__*/React__default.createElement("div", null, option.
|
64
|
+
}, /*#__PURE__*/React__default.createElement("div", null, option.label, " (", option.connector, ")"), /*#__PURE__*/React__default.createElement("div", null, option.secondaryLabel));
|
65
65
|
};
|
66
66
|
if (!allOptions) {
|
67
67
|
return;
|
@@ -1,10 +1,9 @@
|
|
1
1
|
export function useDataConfigs(): {
|
2
|
-
statementConfig: {
|
3
|
-
label: string;
|
2
|
+
statementConfig: import("../ConditionBuilder.types").statementConfig[] | {
|
4
3
|
id: string;
|
5
4
|
connector: string;
|
6
|
-
|
7
|
-
|
5
|
+
label: any;
|
6
|
+
secondaryLabel: string;
|
8
7
|
}[];
|
9
8
|
connectorConfig: {
|
10
9
|
label: any;
|
@@ -6,7 +6,9 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import { useContext } from 'react';
|
9
10
|
import { useTranslations } from './useTranslations.js';
|
11
|
+
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
10
12
|
|
11
13
|
var useDataConfigs = function useDataConfigs() {
|
12
14
|
var _useTranslations = useTranslations(['ifAll', 'ifAny', 'unlessAll', 'unlessAny', 'and', 'or', 'is', 'greater', 'greaterEqual', 'lower', 'lowerEqual', 'startsWith', 'endsWith', 'contains', 'oneOf', 'before', 'after', 'between']),
|
@@ -29,30 +31,28 @@ var useDataConfigs = function useDataConfigs() {
|
|
29
31
|
before = _useTranslations2[15],
|
30
32
|
after = _useTranslations2[16],
|
31
33
|
between = _useTranslations2[17];
|
32
|
-
var
|
33
|
-
|
34
|
+
var _useContext = useContext(ConditionBuilderContext),
|
35
|
+
statementConfigCustom = _useContext.statementConfigCustom;
|
36
|
+
var statementConfigDefault = [{
|
34
37
|
id: 'ifAll',
|
35
38
|
connector: 'and',
|
36
|
-
|
37
|
-
|
39
|
+
label: ifAll,
|
40
|
+
secondaryLabel: '(a && b)'
|
38
41
|
}, {
|
39
|
-
label: 'ifText',
|
40
42
|
id: 'ifAny',
|
41
43
|
connector: 'or',
|
42
|
-
|
43
|
-
|
44
|
+
label: ifAny,
|
45
|
+
secondaryLabel: '(a || b)'
|
44
46
|
}, {
|
45
|
-
label: 'unlessText',
|
46
47
|
id: 'unlessAll',
|
47
48
|
connector: 'and',
|
48
|
-
|
49
|
-
|
49
|
+
label: unlessAll,
|
50
|
+
secondaryLabel: '! (a && b)'
|
50
51
|
}, {
|
51
|
-
label: 'unlessText',
|
52
52
|
id: 'unlessAny',
|
53
53
|
connector: 'or',
|
54
|
-
|
55
|
-
|
54
|
+
label: unlessAny,
|
55
|
+
secondaryLabel: '! (a || b)'
|
56
56
|
}];
|
57
57
|
var connectorConfig = [{
|
58
58
|
label: and,
|
@@ -111,7 +111,7 @@ var useDataConfigs = function useDataConfigs() {
|
|
111
111
|
type: 'date'
|
112
112
|
}];
|
113
113
|
return {
|
114
|
-
statementConfig:
|
114
|
+
statementConfig: statementConfigCustom !== null && statementConfigCustom !== void 0 ? statementConfigCustom : statementConfigDefault,
|
115
115
|
connectorConfig: connectorConfig,
|
116
116
|
operatorConfig: operatorConfig
|
117
117
|
};
|
@@ -39,13 +39,27 @@ export interface CreateTearsheetProps extends PropsWithChildren {
|
|
39
39
|
*/
|
40
40
|
experimentalSecondarySubmitText?: string;
|
41
41
|
/**
|
42
|
-
*
|
42
|
+
* Optional prop that allows you to pass any component.
|
43
43
|
*/
|
44
|
-
|
44
|
+
decorator?: ReactNode;
|
45
45
|
/**
|
46
46
|
* Specifies elements to focus on first on render.
|
47
47
|
*/
|
48
48
|
firstFocusElement?: string;
|
49
|
+
/**
|
50
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
51
|
+
*/
|
52
|
+
description?: ReactNode;
|
53
|
+
/**
|
54
|
+
* Specify a CSS selector that matches the DOM element that should be
|
55
|
+
* focused when the Modal opens.
|
56
|
+
*/
|
57
|
+
selectorPrimaryFocus?: string;
|
58
|
+
/**
|
59
|
+
* To indicate an error occurred in the Tearsheet step
|
60
|
+
* Used to pass this value to TearsheetShell
|
61
|
+
*/
|
62
|
+
hasError?: boolean;
|
49
63
|
/**
|
50
64
|
* Used to set the size of the influencer
|
51
65
|
*/
|
@@ -81,10 +95,6 @@ export interface CreateTearsheetProps extends PropsWithChildren {
|
|
81
95
|
* Specifies whether the tearsheet is currently open.
|
82
96
|
*/
|
83
97
|
open?: boolean;
|
84
|
-
/**
|
85
|
-
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
|
86
|
-
*/
|
87
|
-
slug?: ReactNode;
|
88
98
|
/**
|
89
99
|
* The submit button text
|
90
100
|
*/
|
@@ -101,6 +111,10 @@ export interface CreateTearsheetProps extends PropsWithChildren {
|
|
101
111
|
* to allow an action bar navigation or breadcrumbs to also show through.
|
102
112
|
*/
|
103
113
|
verticalPosition?: 'normal' | 'lower';
|
114
|
+
/**
|
115
|
+
* @deprecated Property replaced by `decorator`
|
116
|
+
*/
|
117
|
+
slug?: ReactNode;
|
104
118
|
}
|
105
119
|
interface Step {
|
106
120
|
introStep?: boolean;
|
@@ -5,8 +5,9 @@
|
|
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 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { forwardRef, useState, useRef, useEffect, createContext } from 'react';
|
10
|
+
import { deprecateProp } from '../../global/js/utils/props-helper.js';
|
10
11
|
import { Form } from '@carbon/react';
|
11
12
|
import PropTypes from '../../_virtual/index.js';
|
12
13
|
import { TearsheetShell } from '../Tearsheet/TearsheetShell.js';
|
@@ -22,7 +23,7 @@ import { useResetCreateComponent } from '../../global/js/hooks/useResetCreateCom
|
|
22
23
|
import { useCreateComponentStepChange } from '../../global/js/hooks/useCreateComponentStepChange.js';
|
23
24
|
import { CreateInfluencer } from '../CreateInfluencer/CreateInfluencer.js';
|
24
25
|
|
25
|
-
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "
|
26
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "firstFocusElement", "description", "hasError", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "selectorPrimaryFocus", "slug", "decorator", "submitButtonText", "title", "verticalPosition"];
|
26
27
|
var componentName = 'CreateTearsheet';
|
27
28
|
var blockClass = "".concat(pkg.prefix, "--tearsheet-create");
|
28
29
|
|
@@ -41,7 +42,9 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
41
42
|
children = _ref.children,
|
42
43
|
className = _ref.className,
|
43
44
|
experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText,
|
45
|
+
firstFocusElement = _ref.firstFocusElement,
|
44
46
|
description = _ref.description,
|
47
|
+
hasError = _ref.hasError,
|
45
48
|
_ref$influencerWidth = _ref.influencerWidth,
|
46
49
|
influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
|
47
50
|
initialStep = _ref.initialStep,
|
@@ -50,8 +53,9 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
50
53
|
onClose = _ref.onClose,
|
51
54
|
onRequestSubmit = _ref.onRequestSubmit,
|
52
55
|
open = _ref.open,
|
53
|
-
|
54
|
-
|
56
|
+
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
57
|
+
deprecated_slug = _ref.slug,
|
58
|
+
decorator = _ref.decorator,
|
55
59
|
submitButtonText = _ref.submitButtonText,
|
56
60
|
title = _ref.title,
|
57
61
|
_ref$verticalPosition = _ref.verticalPosition,
|
@@ -193,11 +197,13 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
193
197
|
onClose: onClose,
|
194
198
|
open: open,
|
195
199
|
size: 'wide',
|
196
|
-
|
200
|
+
decorator: decorator || deprecated_slug,
|
197
201
|
title: title,
|
198
202
|
verticalPosition: verticalPosition,
|
199
203
|
closeIconDescription: '',
|
200
|
-
currentStep: currentStep
|
204
|
+
currentStep: currentStep,
|
205
|
+
hasError: hasError,
|
206
|
+
selectorPrimaryFocus: selectorPrimaryFocus
|
201
207
|
}), /*#__PURE__*/React__default.createElement("div", {
|
202
208
|
className: "".concat(blockClass, "__content"),
|
203
209
|
ref: contentRef
|
@@ -239,10 +245,15 @@ CreateTearsheet = pkg.checkComponentEnabled(CreateTearsheet, componentName);
|
|
239
245
|
// The display name of the component, used by React. Note that displayName
|
240
246
|
// is used in preference to relying on function.name.
|
241
247
|
CreateTearsheet.displayName = componentName;
|
242
|
-
|
248
|
+
var deprecatedProps = {
|
249
|
+
/**
|
250
|
+
* @deprecated Property replaced by `decorator`
|
251
|
+
*/
|
252
|
+
slug: deprecateProp(PropTypes.node, 'Property replaced by `decorator`')
|
253
|
+
};
|
243
254
|
// Note that the descriptions here should be kept in sync with those for the
|
244
255
|
// corresponding props for TearsheetNarrow and TearsheetShell components.
|
245
|
-
CreateTearsheet.propTypes = {
|
256
|
+
CreateTearsheet.propTypes = _objectSpread2({
|
246
257
|
/**
|
247
258
|
* The back button text
|
248
259
|
*/
|
@@ -259,6 +270,10 @@ CreateTearsheet.propTypes = {
|
|
259
270
|
* An optional class or classes to be added to the outermost element.
|
260
271
|
*/
|
261
272
|
className: PropTypes.string,
|
273
|
+
/**
|
274
|
+
* Optional prop that allows you to pass any component.
|
275
|
+
*/
|
276
|
+
decorator: PropTypes.node,
|
262
277
|
/**
|
263
278
|
* A description of the flow, displayed in the header area of the tearsheet.
|
264
279
|
*/
|
@@ -271,6 +286,11 @@ CreateTearsheet.propTypes = {
|
|
271
286
|
* Specifies elements to focus on first on render.
|
272
287
|
*/
|
273
288
|
firstFocusElement: PropTypes.string,
|
289
|
+
/**
|
290
|
+
* To indicate an error occurred in the Tearsheet step
|
291
|
+
* Used to pass this value to TearsheetShell
|
292
|
+
*/
|
293
|
+
hasError: PropTypes.bool,
|
274
294
|
/**
|
275
295
|
* Used to set the size of the influencer
|
276
296
|
*/
|
@@ -307,9 +327,10 @@ CreateTearsheet.propTypes = {
|
|
307
327
|
*/
|
308
328
|
open: PropTypes.bool,
|
309
329
|
/**
|
310
|
-
*
|
330
|
+
* Specify a CSS selector that matches the DOM element that should be
|
331
|
+
* focused when the Modal opens.
|
311
332
|
*/
|
312
|
-
|
333
|
+
selectorPrimaryFocus: PropTypes.string,
|
313
334
|
/**
|
314
335
|
* The submit button text
|
315
336
|
*/
|
@@ -326,6 +347,6 @@ CreateTearsheet.propTypes = {
|
|
326
347
|
* to allow an action bar navigation or breadcrumbs to also show through.
|
327
348
|
*/
|
328
349
|
verticalPosition: PropTypes.oneOf(['normal', 'lower'])
|
329
|
-
};
|
350
|
+
}, deprecatedProps);
|
330
351
|
|
331
352
|
export { CreateTearsheet, StepNumberContext, StepsContext };
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import '../../global/js/utils/props-helper';
|
10
10
|
import { ButtonProps } from '@carbon/react';
|
11
11
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
@@ -16,6 +16,7 @@ declare enum sizes {
|
|
16
16
|
export declare const defaults: {
|
17
17
|
position: string;
|
18
18
|
size: sizes;
|
19
|
+
headingAs: string;
|
19
20
|
};
|
20
21
|
export interface EmptyStateProps {
|
21
22
|
/**
|
@@ -51,6 +52,10 @@ export interface EmptyStateProps {
|
|
51
52
|
text?: string | ReactNode;
|
52
53
|
href?: string;
|
53
54
|
};
|
55
|
+
/**
|
56
|
+
* Empty state headingAs allows you to customize the type of heading element
|
57
|
+
*/
|
58
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
54
59
|
/**
|
55
60
|
* Empty state size
|
56
61
|
*/
|
@@ -23,7 +23,7 @@ import { pkg } from '../../settings.js';
|
|
23
23
|
import { EmptyStateContent } from './EmptyStateContent.js';
|
24
24
|
|
25
25
|
var _excluded = ["v2"],
|
26
|
-
_excluded2 = ["action", "className", "illustration", "illustrationDescription", "illustrationPosition", "link", "size", "subtitle", "title"];
|
26
|
+
_excluded2 = ["action", "className", "illustration", "illustrationDescription", "illustrationPosition", "link", "size", "headingAs", "subtitle", "title"];
|
27
27
|
|
28
28
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
29
29
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
@@ -35,7 +35,8 @@ var sizes = /*#__PURE__*/function (sizes) {
|
|
35
35
|
}(sizes || {}); // Default values for props
|
36
36
|
var defaults = {
|
37
37
|
position: 'top',
|
38
|
-
size: sizes.lg
|
38
|
+
size: sizes.lg,
|
39
|
+
headingAs: 'h3'
|
39
40
|
};
|
40
41
|
/**
|
41
42
|
* The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above.
|
@@ -57,6 +58,8 @@ var EmptyState = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
57
58
|
link = props.link,
|
58
59
|
_props$size = props.size,
|
59
60
|
size = _props$size === void 0 ? defaults.size : _props$size,
|
61
|
+
_props$headingAs = props.headingAs,
|
62
|
+
headingAs = _props$headingAs === void 0 ? defaults.headingAs : _props$headingAs,
|
60
63
|
subtitle = props.subtitle,
|
61
64
|
title = props.title,
|
62
65
|
rest = _objectWithoutProperties(props, _excluded2);
|
@@ -66,11 +69,13 @@ var EmptyState = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
66
69
|
}, getDevtoolsProps(componentName)), illustration && /*#__PURE__*/React__default.createElement("img", {
|
67
70
|
src: illustration,
|
68
71
|
alt: illustrationDescription,
|
69
|
-
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
|
72
|
+
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)]),
|
73
|
+
"aria-hidden": "true"
|
70
74
|
}), /*#__PURE__*/React__default.createElement(EmptyStateContent, {
|
71
75
|
action: action,
|
72
76
|
link: link,
|
73
77
|
size: size,
|
78
|
+
headingAs: headingAs,
|
74
79
|
subtitle: subtitle,
|
75
80
|
title: title !== null && title !== void 0 ? title : ''
|
76
81
|
}));
|
@@ -93,6 +98,10 @@ EmptyState.propTypes = {
|
|
93
98
|
* Provide an optional class to be applied to the containing node.
|
94
99
|
*/
|
95
100
|
className: PropTypes.string,
|
101
|
+
/**
|
102
|
+
* Empty state headingAs allows you to customize the type of heading element
|
103
|
+
*/
|
104
|
+
headingAs: PropTypes.elementType,
|
96
105
|
/**
|
97
106
|
* Empty state illustration, specify the `src` for a provided illustration to be displayed. In the case of requiring a light and dark illustration of your own, simply pass the corresponding illustration based on the current theme of your application.
|
98
107
|
* For example: `illustration={appTheme === 'dark' ? darkIllustration : lightIllustration}`
|
@@ -1,6 +1,7 @@
|
|
1
|
-
export function EmptyStateContent({ action, link, size, subtitle, title }: {
|
1
|
+
export function EmptyStateContent({ action, link, headingAs, size, subtitle, title, }: {
|
2
2
|
action: any;
|
3
3
|
link: any;
|
4
|
+
headingAs: any;
|
4
5
|
size: any;
|
5
6
|
subtitle: any;
|
6
7
|
title: any;
|
@@ -9,6 +10,7 @@ export namespace EmptyStateContent {
|
|
9
10
|
export { componentName as displayName };
|
10
11
|
export namespace propTypes {
|
11
12
|
let action: PropTypes.Requireable<PropTypes.InferProps<any>>;
|
13
|
+
let headingAs: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
12
14
|
let link: PropTypes.Requireable<PropTypes.InferProps<any>>;
|
13
15
|
let size: PropTypes.Requireable<string>;
|
14
16
|
let subtitle: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
@@ -10,7 +10,7 @@ import React__default from 'react';
|
|
10
10
|
import PropTypes from '../../_virtual/index.js';
|
11
11
|
import { pkg } from '../../settings.js';
|
12
12
|
import cx from 'classnames';
|
13
|
-
import { Button, Link } from '@carbon/react';
|
13
|
+
import { Section, Button, Link } from '@carbon/react';
|
14
14
|
|
15
15
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
16
16
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
@@ -18,12 +18,14 @@ var componentName = 'EmptyStateContent';
|
|
18
18
|
var EmptyStateContent = function EmptyStateContent(_ref) {
|
19
19
|
var action = _ref.action,
|
20
20
|
link = _ref.link,
|
21
|
+
headingAs = _ref.headingAs,
|
21
22
|
size = _ref.size,
|
22
23
|
subtitle = _ref.subtitle,
|
23
24
|
title = _ref.title;
|
24
25
|
return /*#__PURE__*/React__default.createElement("div", {
|
25
26
|
className: "".concat(blockClass, "__content")
|
26
|
-
}, /*#__PURE__*/React__default.createElement(
|
27
|
+
}, /*#__PURE__*/React__default.createElement(Section, {
|
28
|
+
as: headingAs,
|
27
29
|
className: cx("".concat(blockClass, "__header"), _defineProperty({}, "".concat(blockClass, "__header--small"), size === 'sm'))
|
28
30
|
}, title), subtitle && /*#__PURE__*/React__default.createElement("p", {
|
29
31
|
className: cx("".concat(blockClass, "__subtitle"), _defineProperty({}, "".concat(blockClass, "__subtitle--small"), size === 'sm'))
|
@@ -57,6 +59,10 @@ EmptyStateContent.propTypes = {
|
|
57
59
|
onClick: Button.propTypes.onClick,
|
58
60
|
text: PropTypes.string
|
59
61
|
})),
|
62
|
+
/**
|
63
|
+
* Empty state headingAs allows you to customize the type of heading element
|
64
|
+
*/
|
65
|
+
headingAs: PropTypes.elementType,
|
60
66
|
/**
|
61
67
|
* Empty state link object
|
62
68
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { Suspense, lazy } from 'react';
|
10
10
|
import PropTypes from '../../_virtual/index.js';
|
11
11
|
|
@@ -52,7 +52,9 @@ var EmptyStateIllustration = function EmptyStateIllustration(_ref) {
|
|
52
52
|
var kind = _ref.kind,
|
53
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
54
54
|
var Illustration = getIllustration(kind);
|
55
|
-
return /*#__PURE__*/React__default.createElement(Suspense, null, /*#__PURE__*/React__default.createElement(Illustration,
|
55
|
+
return /*#__PURE__*/React__default.createElement(Suspense, null, /*#__PURE__*/React__default.createElement(Illustration, _extends({
|
56
|
+
"aria-hidden": "true"
|
57
|
+
}, rest)));
|
56
58
|
};
|
57
59
|
EmptyStateIllustration.propTypes = {
|
58
60
|
kind: PropTypes.string
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface ErrorEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface ErrorEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|