@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.
Files changed (80) hide show
  1. package/es/components/APIKeyModal/APIKeyModal.js +4 -5
  2. package/es/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
  3. package/es/components/ConditionBuilder/ConditionBuilder.js +14 -2
  4. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
  5. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
  6. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
  7. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
  8. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
  9. package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
  10. package/es/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
  11. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
  12. package/es/components/CreateTearsheet/CreateTearsheet.js +32 -11
  13. package/es/components/EmptyStates/EmptyState.d.ts +6 -1
  14. package/es/components/EmptyStates/EmptyState.js +12 -3
  15. package/es/components/EmptyStates/EmptyStateContent.d.ts +3 -1
  16. package/es/components/EmptyStates/EmptyStateContent.js +8 -2
  17. package/es/components/EmptyStates/EmptyStateIllustration.js +4 -2
  18. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
  19. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
  20. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
  21. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
  22. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
  23. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
  24. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
  25. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
  26. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
  27. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
  28. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
  29. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
  30. package/es/components/EmptyStates/assets/ErrorIllustration.js +2 -1
  31. package/es/components/EmptyStates/assets/NoDataIllustration.js +2 -1
  32. package/es/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
  33. package/es/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
  34. package/es/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
  35. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
  36. package/es/components/FilterSummary/FilterSummary.js +1 -1
  37. package/es/components/Tearsheet/TearsheetShell.d.ts +11 -7
  38. package/es/components/Tearsheet/TearsheetShell.js +14 -14
  39. package/es/global/js/hooks/useFocus.js +21 -19
  40. package/lib/components/APIKeyModal/APIKeyModal.js +4 -5
  41. package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
  42. package/lib/components/ConditionBuilder/ConditionBuilder.js +14 -2
  43. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
  44. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
  45. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
  46. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
  47. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
  48. package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
  49. package/lib/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
  50. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
  51. package/lib/components/CreateTearsheet/CreateTearsheet.js +31 -10
  52. package/lib/components/EmptyStates/EmptyState.d.ts +6 -1
  53. package/lib/components/EmptyStates/EmptyState.js +12 -3
  54. package/lib/components/EmptyStates/EmptyStateContent.d.ts +3 -1
  55. package/lib/components/EmptyStates/EmptyStateContent.js +7 -1
  56. package/lib/components/EmptyStates/EmptyStateIllustration.js +3 -1
  57. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
  58. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
  59. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
  60. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
  61. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
  62. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
  63. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
  64. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
  65. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
  66. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
  67. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
  68. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
  69. package/lib/components/EmptyStates/assets/ErrorIllustration.js +2 -1
  70. package/lib/components/EmptyStates/assets/NoDataIllustration.js +2 -1
  71. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
  72. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
  73. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
  74. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
  75. package/lib/components/FilterSummary/FilterSummary.js +1 -1
  76. package/lib/components/Tearsheet/TearsheetShell.d.ts +11 -7
  77. package/lib/components/Tearsheet/TearsheetShell.js +14 -14
  78. package/lib/global/js/hooks/useFocus.js +21 -19
  79. package/package.json +6 -6
  80. package/telemetry.yml +3 -0
@@ -23,7 +23,7 @@ var useFocus = require('../../global/js/hooks/useFocus.js');
23
23
  var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
24
24
 
25
25
  var _ErrorFilled, _InformationFilled;
26
- 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", "selectorPrimaryFocus", "showAPIKeyLabel", "helperText"];
26
+ 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"];
27
27
  var componentName = 'APIKeyModal';
28
28
 
29
29
  // Default values for props
@@ -82,7 +82,6 @@ exports.APIKeyModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
82
82
  open = _ref.open,
83
83
  portalTargetIn = _ref.portalTarget,
84
84
  previousStepButtonText = _ref.previousStepButtonText,
85
- selectorPrimaryFocus = _ref.selectorPrimaryFocus,
86
85
  showAPIKeyLabel = _ref.showAPIKeyLabel,
87
86
  helperText = _ref.helperText,
88
87
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
@@ -127,7 +126,7 @@ exports.APIKeyModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
127
126
  var localRef = React.useRef(undefined);
128
127
  var PasswordInputRef = React.useRef(null);
129
128
  var modalRef = ref || localRef;
130
- var _useFocus = useFocus.useFocus(modalRef, selectorPrimaryFocus),
129
+ var _useFocus = useFocus.useFocus(modalRef),
131
130
  firstElement = _useFocus.firstElement,
132
131
  keyDownListener = _useFocus.keyDownListener;
133
132
  var prevOpen = usePreviousValue.usePreviousValue(open);
@@ -142,9 +141,9 @@ exports.APIKeyModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
142
141
  React.useEffect(function () {
143
142
  if (open) {
144
143
  // Focusing the first element or selectorPrimaryFocus element
145
- useFocus.claimFocus(firstElement, modalRef, selectorPrimaryFocus);
144
+ useFocus.claimFocus(firstElement, modalRef, "#".concat(CSS.escape(apiKeyInputId === null || apiKeyInputId === void 0 ? void 0 : apiKeyInputId.current)));
146
145
  }
147
- }, [firstElement, modalRef, open, selectorPrimaryFocus]);
146
+ }, [firstElement, modalRef, open]);
148
147
  React.useEffect(function () {
149
148
  if (prevOpen && !open && launcherButtonRef) {
150
149
  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
  */
@@ -19,7 +19,7 @@ var settings = require('../../settings.js');
19
19
  var handleKeyboardEvents = require('./utils/handleKeyboardEvents.js');
20
20
  var util = require('./utils/util.js');
21
21
 
22
- var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId"];
22
+ var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId", "statementConfigCustom"];
23
23
 
24
24
  // Carbon and package components we use.
25
25
  /* TODO: @import(s) of carbon components and other package components. */
@@ -60,6 +60,7 @@ exports.ConditionBuilder = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
60
60
  variant = _ref$variant === void 0 ? util.NON_HIERARCHICAL_VARIANT : _ref$variant,
61
61
  actions = _ref.actions,
62
62
  translateWithId = _ref.translateWithId,
63
+ statementConfigCustom = _ref.statementConfigCustom,
63
64
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
64
65
  var localRef = React.useRef(null);
65
66
  var conditionBuilderRef = ref || localRef;
@@ -72,7 +73,8 @@ exports.ConditionBuilder = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
72
73
  getOptions: getOptions,
73
74
  variant: variant,
74
75
  translateWithId: translateWithId,
75
- conditionBuilderRef: conditionBuilderRef
76
+ conditionBuilderRef: conditionBuilderRef,
77
+ statementConfigCustom: statementConfigCustom
76
78
  }, /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
77
79
  className: cx(util.blockClass,
78
80
  // Apply the block class to the main HTML element
@@ -208,6 +210,16 @@ exports.ConditionBuilder.propTypes = {
208
210
  * Provide a label to the button that starts condition builder
209
211
  */
210
212
  startConditionLabel: index.default.string,
213
+ /**
214
+ * Optional prop for passing custom configuration for statement option from default op
215
+ */
216
+ /**@ts-ignore */
217
+ statementConfigCustom: index.default.arrayOf(index.default.shape({
218
+ id: index.default.string.isRequired,
219
+ connector: index.default.oneOf(['and', 'or']).isRequired,
220
+ label: index.default.string.isRequired,
221
+ secondaryLabel: index.default.string
222
+ })),
211
223
  /**
212
224
  * Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
213
225
  * 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 = {
@@ -53,7 +53,8 @@ var ConditionBuilderProvider = function ConditionBuilderProvider(props) {
53
53
  getOptions: props.getOptions,
54
54
  variant: props.variant,
55
55
  translateWithId: props.translateWithId,
56
- conditionBuilderRef: props.conditionBuilderRef
56
+ conditionBuilderRef: props.conditionBuilderRef,
57
+ statementConfigCustom: props.statementConfigCustom
57
58
  };
58
59
  return /*#__PURE__*/React.createElement(ConditionBuilderContext.Provider, {
59
60
  value: contextValue
@@ -17,6 +17,7 @@ var useTranslations = require('../utils/useTranslations.js');
17
17
  var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
18
18
  var handleKeyboardEvents = require('../utils/handleKeyboardEvents.js');
19
19
  var util = require('../utils/util.js');
20
+ var translationObject = require('../ConditionBuilderContext/translationObject.js');
20
21
 
21
22
  var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config", "renderChildren", "onChange"];
22
23
  var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
@@ -38,12 +39,19 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
38
39
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
39
40
  open = _useState2[0],
40
41
  setOpen = _useState2[1];
42
+ var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
43
+ conditionBuilderRef = _useContext.conditionBuilderRef,
44
+ statementConfigCustom = _useContext.statementConfigCustom;
41
45
  var statementIdMap = {
42
- ifAll: 'if',
43
- ifAny: 'if',
44
- unlessAll: 'unless',
45
- unlessAny: 'unless'
46
+ ifAll: translationObject.translationsObject.ifText,
47
+ ifAny: translationObject.translationsObject.ifText,
48
+ unlessAll: translationObject.translationsObject.unlessText,
49
+ unlessAny: translationObject.translationsObject.unlessText
46
50
  };
51
+ //Appending statements from custom statement configuration if present
52
+ statementConfigCustom === null || statementConfigCustom === void 0 || statementConfigCustom.forEach(function (statement) {
53
+ statementIdMap[statement.id] = statement.label;
54
+ });
47
55
  var _useTranslations = useTranslations.useTranslations(['invalidText', 'addConditionText', 'addPropertyText', 'addOperatorText', 'addValueText', label], statementIdMap),
48
56
  _useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 6),
49
57
  invalidText = _useTranslations2[0],
@@ -52,8 +60,6 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
52
60
  addOperatorText = _useTranslations2[3],
53
61
  addValueText = _useTranslations2[4],
54
62
  labelText = _useTranslations2[5];
55
- var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
56
- conditionBuilderRef = _useContext.conditionBuilderRef;
57
63
  var getPropertyDetails = function getPropertyDetails() {
58
64
  var _ref2 = condition || {},
59
65
  property = _ref2.property,
@@ -6,13 +6,15 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import PropTypes from 'prop-types';
9
- import { PropertyConfigOption } from '../../ConditionBuilder.types';
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: PropertyConfigOption['config'] & {
15
+ config: {
16
+ options?: option[] | statementConfig[];
17
+ } & {
16
18
  isStatement?: boolean;
17
19
  };
18
20
  onChange: (value: string, e: Event) => void;
@@ -63,7 +63,7 @@ var ItemOption = function ItemOption(_ref) {
63
63
  var getStatementContent = function getStatementContent(option) {
64
64
  return /*#__PURE__*/React.createElement("div", {
65
65
  className: "".concat(util.blockClass, "__statement_wrapper")
66
- }, /*#__PURE__*/React.createElement("div", null, option.text1, " (", option.connector, ")"), /*#__PURE__*/React.createElement("div", null, option.text2));
66
+ }, /*#__PURE__*/React.createElement("div", null, option.label, " (", option.connector, ")"), /*#__PURE__*/React.createElement("div", null, option.secondaryLabel));
67
67
  };
68
68
  if (!allOptions) {
69
69
  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
- text1: any;
7
- text2: string;
5
+ label: any;
6
+ secondaryLabel: string;
8
7
  }[];
9
8
  connectorConfig: {
10
9
  label: any;
@@ -8,7 +8,9 @@
8
8
  'use strict';
9
9
 
10
10
  var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
11
+ var React = require('react');
11
12
  var useTranslations = require('./useTranslations.js');
13
+ var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
12
14
 
13
15
  var useDataConfigs = function useDataConfigs() {
14
16
  var _useTranslations = useTranslations.useTranslations(['ifAll', 'ifAny', 'unlessAll', 'unlessAny', 'and', 'or', 'is', 'greater', 'greaterEqual', 'lower', 'lowerEqual', 'startsWith', 'endsWith', 'contains', 'oneOf', 'before', 'after', 'between']),
@@ -31,30 +33,28 @@ var useDataConfigs = function useDataConfigs() {
31
33
  before = _useTranslations2[15],
32
34
  after = _useTranslations2[16],
33
35
  between = _useTranslations2[17];
34
- var statementConfig = [{
35
- label: 'ifText',
36
+ var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
37
+ statementConfigCustom = _useContext.statementConfigCustom;
38
+ var statementConfigDefault = [{
36
39
  id: 'ifAll',
37
40
  connector: 'and',
38
- text1: ifAll,
39
- text2: '(a && b)'
41
+ label: ifAll,
42
+ secondaryLabel: '(a && b)'
40
43
  }, {
41
- label: 'ifText',
42
44
  id: 'ifAny',
43
45
  connector: 'or',
44
- text1: ifAny,
45
- text2: '(a || b)'
46
+ label: ifAny,
47
+ secondaryLabel: '(a || b)'
46
48
  }, {
47
- label: 'unlessText',
48
49
  id: 'unlessAll',
49
50
  connector: 'and',
50
- text1: unlessAll,
51
- text2: '! (a && b)'
51
+ label: unlessAll,
52
+ secondaryLabel: '! (a && b)'
52
53
  }, {
53
- label: 'unlessText',
54
54
  id: 'unlessAny',
55
55
  connector: 'or',
56
- text1: unlessAny,
57
- text2: '! (a || b)'
56
+ label: unlessAny,
57
+ secondaryLabel: '! (a || b)'
58
58
  }];
59
59
  var connectorConfig = [{
60
60
  label: and,
@@ -113,7 +113,7 @@ var useDataConfigs = function useDataConfigs() {
113
113
  type: 'date'
114
114
  }];
115
115
  return {
116
- statementConfig: statementConfig,
116
+ statementConfig: statementConfigCustom !== null && statementConfigCustom !== void 0 ? statementConfigCustom : statementConfigDefault,
117
117
  connectorConfig: connectorConfig,
118
118
  operatorConfig: operatorConfig
119
119
  };
@@ -39,13 +39,27 @@ export interface CreateTearsheetProps extends PropsWithChildren {
39
39
  */
40
40
  experimentalSecondarySubmitText?: string;
41
41
  /**
42
- * A description of the flow, displayed in the header area of the tearsheet.
42
+ * Optional prop that allows you to pass any component.
43
43
  */
44
- description?: ReactNode;
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;
@@ -9,6 +9,7 @@
9
9
 
10
10
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
11
11
  var React = require('react');
12
+ var propsHelper = require('../../global/js/utils/props-helper.js');
12
13
  var react = require('@carbon/react');
13
14
  var index = require('../../_virtual/index.js');
14
15
  var TearsheetShell = require('../Tearsheet/TearsheetShell.js');
@@ -24,7 +25,7 @@ var useResetCreateComponent = require('../../global/js/hooks/useResetCreateCompo
24
25
  var useCreateComponentStepChange = require('../../global/js/hooks/useCreateComponentStepChange.js');
25
26
  var CreateInfluencer = require('../CreateInfluencer/CreateInfluencer.js');
26
27
 
27
- var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "slug", "submitButtonText", "title", "verticalPosition"];
28
+ var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "experimentalSecondarySubmitText", "firstFocusElement", "description", "hasError", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "selectorPrimaryFocus", "slug", "decorator", "submitButtonText", "title", "verticalPosition"];
28
29
  var componentName = 'CreateTearsheet';
29
30
  var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-create");
30
31
 
@@ -43,7 +44,9 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
43
44
  children = _ref.children,
44
45
  className = _ref.className,
45
46
  experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText,
47
+ firstFocusElement = _ref.firstFocusElement,
46
48
  description = _ref.description,
49
+ hasError = _ref.hasError,
47
50
  _ref$influencerWidth = _ref.influencerWidth,
48
51
  influencerWidth = _ref$influencerWidth === void 0 ? 'narrow' : _ref$influencerWidth,
49
52
  initialStep = _ref.initialStep,
@@ -52,8 +55,9 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
52
55
  onClose = _ref.onClose,
53
56
  onRequestSubmit = _ref.onRequestSubmit,
54
57
  open = _ref.open,
55
- firstFocusElement = _ref.firstFocusElement,
56
- slug = _ref.slug,
58
+ selectorPrimaryFocus = _ref.selectorPrimaryFocus,
59
+ deprecated_slug = _ref.slug,
60
+ decorator = _ref.decorator,
57
61
  submitButtonText = _ref.submitButtonText,
58
62
  title = _ref.title,
59
63
  _ref$verticalPosition = _ref.verticalPosition,
@@ -195,11 +199,13 @@ exports.CreateTearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
195
199
  onClose: onClose,
196
200
  open: open,
197
201
  size: 'wide',
198
- slug: slug,
202
+ decorator: decorator || deprecated_slug,
199
203
  title: title,
200
204
  verticalPosition: verticalPosition,
201
205
  closeIconDescription: '',
202
- currentStep: currentStep
206
+ currentStep: currentStep,
207
+ hasError: hasError,
208
+ selectorPrimaryFocus: selectorPrimaryFocus
203
209
  }), /*#__PURE__*/React.createElement("div", {
204
210
  className: "".concat(blockClass, "__content"),
205
211
  ref: contentRef
@@ -241,10 +247,15 @@ exports.CreateTearsheet = settings.pkg.checkComponentEnabled(exports.CreateTears
241
247
  // The display name of the component, used by React. Note that displayName
242
248
  // is used in preference to relying on function.name.
243
249
  exports.CreateTearsheet.displayName = componentName;
244
-
250
+ var deprecatedProps = {
251
+ /**
252
+ * @deprecated Property replaced by `decorator`
253
+ */
254
+ slug: propsHelper.deprecateProp(index.default.node, 'Property replaced by `decorator`')
255
+ };
245
256
  // Note that the descriptions here should be kept in sync with those for the
246
257
  // corresponding props for TearsheetNarrow and TearsheetShell components.
247
- exports.CreateTearsheet.propTypes = {
258
+ exports.CreateTearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
248
259
  /**
249
260
  * The back button text
250
261
  */
@@ -261,6 +272,10 @@ exports.CreateTearsheet.propTypes = {
261
272
  * An optional class or classes to be added to the outermost element.
262
273
  */
263
274
  className: index.default.string,
275
+ /**
276
+ * Optional prop that allows you to pass any component.
277
+ */
278
+ decorator: index.default.node,
264
279
  /**
265
280
  * A description of the flow, displayed in the header area of the tearsheet.
266
281
  */
@@ -273,6 +288,11 @@ exports.CreateTearsheet.propTypes = {
273
288
  * Specifies elements to focus on first on render.
274
289
  */
275
290
  firstFocusElement: index.default.string,
291
+ /**
292
+ * To indicate an error occurred in the Tearsheet step
293
+ * Used to pass this value to TearsheetShell
294
+ */
295
+ hasError: index.default.bool,
276
296
  /**
277
297
  * Used to set the size of the influencer
278
298
  */
@@ -309,9 +329,10 @@ exports.CreateTearsheet.propTypes = {
309
329
  */
310
330
  open: index.default.bool,
311
331
  /**
312
- * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
332
+ * Specify a CSS selector that matches the DOM element that should be
333
+ * focused when the Modal opens.
313
334
  */
314
- slug: index.default.node,
335
+ selectorPrimaryFocus: index.default.string,
315
336
  /**
316
337
  * The submit button text
317
338
  */
@@ -328,7 +349,7 @@ exports.CreateTearsheet.propTypes = {
328
349
  * to allow an action bar navigation or breadcrumbs to also show through.
329
350
  */
330
351
  verticalPosition: index.default.oneOf(['normal', 'lower'])
331
- };
352
+ }, deprecatedProps);
332
353
 
333
354
  exports.StepNumberContext = StepNumberContext;
334
355
  exports.StepsContext = 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
  */
@@ -25,7 +25,7 @@ var settings = require('../../settings.js');
25
25
  var EmptyStateContent = require('./EmptyStateContent.js');
26
26
 
27
27
  var _excluded = ["v2"],
28
- _excluded2 = ["action", "className", "illustration", "illustrationDescription", "illustrationPosition", "link", "size", "subtitle", "title"];
28
+ _excluded2 = ["action", "className", "illustration", "illustrationDescription", "illustrationPosition", "link", "size", "headingAs", "subtitle", "title"];
29
29
 
30
30
  // The block part of our conventional BEM class names (blockClass__E--M).
31
31
  var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
@@ -37,7 +37,8 @@ var sizes = /*#__PURE__*/function (sizes) {
37
37
  }(sizes || {}); // Default values for props
38
38
  var defaults = {
39
39
  position: 'top',
40
- size: sizes.lg
40
+ size: sizes.lg,
41
+ headingAs: 'h3'
41
42
  };
42
43
  /**
43
44
  * 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.
@@ -59,6 +60,8 @@ exports.EmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
59
60
  link = props.link,
60
61
  _props$size = props.size,
61
62
  size = _props$size === void 0 ? defaults.size : _props$size,
63
+ _props$headingAs = props.headingAs,
64
+ headingAs = _props$headingAs === void 0 ? defaults.headingAs : _props$headingAs,
62
65
  subtitle = props.subtitle,
63
66
  title = props.title,
64
67
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded2);
@@ -68,11 +71,13 @@ exports.EmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
68
71
  }, devtools.getDevtoolsProps(componentName)), illustration && /*#__PURE__*/React.createElement("img", {
69
72
  src: illustration,
70
73
  alt: illustrationDescription,
71
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
74
+ className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)]),
75
+ "aria-hidden": "true"
72
76
  }), /*#__PURE__*/React.createElement(EmptyStateContent.EmptyStateContent, {
73
77
  action: action,
74
78
  link: link,
75
79
  size: size,
80
+ headingAs: headingAs,
76
81
  subtitle: subtitle,
77
82
  title: title !== null && title !== void 0 ? title : ''
78
83
  }));
@@ -95,6 +100,10 @@ exports.EmptyState.propTypes = {
95
100
  * Provide an optional class to be applied to the containing node.
96
101
  */
97
102
  className: index.default.string,
103
+ /**
104
+ * Empty state headingAs allows you to customize the type of heading element
105
+ */
106
+ headingAs: index.default.elementType,
98
107
  /**
99
108
  * 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.
100
109
  * 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>>;
@@ -20,12 +20,14 @@ var componentName = 'EmptyStateContent';
20
20
  var EmptyStateContent = function EmptyStateContent(_ref) {
21
21
  var action = _ref.action,
22
22
  link = _ref.link,
23
+ headingAs = _ref.headingAs,
23
24
  size = _ref.size,
24
25
  subtitle = _ref.subtitle,
25
26
  title = _ref.title;
26
27
  return /*#__PURE__*/React.createElement("div", {
27
28
  className: "".concat(blockClass, "__content")
28
- }, /*#__PURE__*/React.createElement("h3", {
29
+ }, /*#__PURE__*/React.createElement(react.Section, {
30
+ as: headingAs,
29
31
  className: cx("".concat(blockClass, "__header"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__header--small"), size === 'sm'))
30
32
  }, title), subtitle && /*#__PURE__*/React.createElement("p", {
31
33
  className: cx("".concat(blockClass, "__subtitle"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__subtitle--small"), size === 'sm'))
@@ -59,6 +61,10 @@ EmptyStateContent.propTypes = {
59
61
  onClick: react.Button.propTypes.onClick,
60
62
  text: index.default.string
61
63
  })),
64
+ /**
65
+ * Empty state headingAs allows you to customize the type of heading element
66
+ */
67
+ headingAs: index.default.elementType,
62
68
  /**
63
69
  * Empty state link object
64
70
  */
@@ -56,7 +56,9 @@ var EmptyStateIllustration = function EmptyStateIllustration(_ref) {
56
56
  var kind = _ref.kind,
57
57
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
58
58
  var Illustration = getIllustration(kind);
59
- return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(Illustration, rest));
59
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(Illustration, _rollupPluginBabelHelpers.extends({
60
+ "aria-hidden": "true"
61
+ }, rest)));
60
62
  };
61
63
  EmptyStateIllustration.propTypes = {
62
64
  kind: index.default.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
  */