@carbon/ibm-products 2.63.0 → 2.64.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/css/index-full-carbon.css.map +1 -1
  2. package/css/index-full-carbon.min.css.map +1 -1
  3. package/css/index-without-carbon-released-only.css.map +1 -1
  4. package/css/index-without-carbon-released-only.min.css.map +1 -1
  5. package/css/index-without-carbon.css.map +1 -1
  6. package/css/index-without-carbon.min.css.map +1 -1
  7. package/css/index.css.map +1 -1
  8. package/css/index.min.css.map +1 -1
  9. package/es/components/APIKeyModal/APIKeyModal.js +6 -9
  10. package/es/components/AboutModal/AboutModal.js +5 -4
  11. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +1 -3
  12. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +8 -7
  13. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -3
  14. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  15. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +71 -16
  16. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -0
  17. package/es/components/ConditionBuilder/utils/util.js +10 -45
  18. package/es/components/CreateFullPage/CreateFullPageStep.js +4 -4
  19. package/es/components/CreateInfluencer/CreateInfluencer.js +3 -3
  20. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +0 -3
  21. package/es/components/Datagrid/useSortableColumns.js +1 -1
  22. package/es/components/EmptyStates/EmptyState.d.ts +6 -7
  23. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +3 -48
  24. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
  25. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +3 -48
  26. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +3 -48
  27. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
  28. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +3 -48
  29. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
  30. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +3 -48
  31. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
  32. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +3 -48
  33. package/es/components/InterstitialScreen/InterstitialScreen.js +4 -2
  34. package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +4 -0
  35. package/es/components/InterstitialScreenView/InterstitialScreenView.js +9 -4
  36. package/es/components/OptionsTile/OptionsTile.js +3 -3
  37. package/es/components/ProductiveCard/ProductiveCard.d.ts +9 -5
  38. package/es/components/SimpleHeader/SimpleHeader.js +2 -2
  39. package/es/components/Tearsheet/TearsheetShell.js +80 -50
  40. package/es/global/js/hooks/useFocus.d.ts +1 -1
  41. package/es/global/js/hooks/useFocus.js +23 -31
  42. package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
  43. package/es/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +1 -1
  44. package/lib/components/APIKeyModal/APIKeyModal.js +5 -8
  45. package/lib/components/AboutModal/AboutModal.js +4 -3
  46. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +1 -3
  47. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +8 -7
  48. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -3
  49. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  50. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +68 -13
  51. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -0
  52. package/lib/components/ConditionBuilder/utils/util.js +10 -45
  53. package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -3
  54. package/lib/components/CreateInfluencer/CreateInfluencer.js +2 -2
  55. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +0 -3
  56. package/lib/components/Datagrid/useSortableColumns.js +1 -1
  57. package/lib/components/EmptyStates/EmptyState.d.ts +6 -7
  58. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +3 -48
  59. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
  60. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +3 -48
  61. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +3 -48
  62. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
  63. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +3 -48
  64. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
  65. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +3 -48
  66. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
  67. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +3 -48
  68. package/lib/components/InterstitialScreen/InterstitialScreen.js +4 -2
  69. package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +4 -0
  70. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +9 -4
  71. package/lib/components/OptionsTile/OptionsTile.js +2 -2
  72. package/lib/components/ProductiveCard/ProductiveCard.d.ts +9 -5
  73. package/lib/components/SimpleHeader/SimpleHeader.js +1 -1
  74. package/lib/components/Tearsheet/TearsheetShell.js +78 -48
  75. package/lib/global/js/hooks/useFocus.d.ts +1 -1
  76. package/lib/global/js/hooks/useFocus.js +22 -31
  77. package/lib/node_modules/@carbon/icons-react/es/Icon.js +1 -1
  78. package/lib/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +1 -1
  79. package/package.json +11 -12
  80. package/telemetry.yml +1 -1
@@ -17,7 +17,7 @@ import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
17
17
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
18
18
  import { isRequiredIf } from '../../global/js/utils/props-helper.js';
19
19
  import uuidv4 from '../../global/js/utils/uuidv4.js';
20
- import { useFocus, claimFocus } from '../../global/js/hooks/useFocus.js';
20
+ import { useFocus } from '../../global/js/hooks/useFocus.js';
21
21
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
22
22
 
23
23
  var _ErrorFilled, _InformationFilled;
@@ -126,7 +126,8 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
126
126
  var modalRef = ref || localRef;
127
127
  var _useFocus = useFocus(modalRef),
128
128
  firstElement = _useFocus.firstElement,
129
- keyDownListener = _useFocus.keyDownListener;
129
+ keyDownListener = _useFocus.keyDownListener,
130
+ claimFocus = _useFocus.claimFocus;
130
131
  var prevOpen = usePreviousValue(open);
131
132
  useEffect(function () {
132
133
  if (copyRef.current && open && apiKeyLoaded) {
@@ -139,9 +140,10 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
139
140
  useEffect(function () {
140
141
  if (open) {
141
142
  // Focusing the first element or selectorPrimaryFocus element
142
- claimFocus(firstElement, modalRef, "#".concat(CSS.escape(apiKeyInputId === null || apiKeyInputId === void 0 ? void 0 : apiKeyInputId.current)));
143
+ claimFocus();
143
144
  }
144
- }, [firstElement, modalRef, open]);
145
+ // eslint-disable-next-line react-hooks/exhaustive-deps
146
+ }, [modalRef, open, firstElement]);
145
147
  useEffect(function () {
146
148
  if (prevOpen && !open && launcherButtonRef) {
147
149
  setTimeout(function () {
@@ -593,11 +595,6 @@ APIKeyModal.propTypes = _objectSpread2({
593
595
  * text that displays in the secondary button when using custom steps to indicate to the user that there is a previous step
594
596
  */
595
597
  previousStepButtonText: customStepsRequiredProps(PropTypes.string),
596
- /**
597
- * Specify a CSS selector that matches the DOM element that should be
598
- * focused when the Modal opens.
599
- */
600
- selectorPrimaryFocus: PropTypes.string,
601
598
  /**
602
599
  * label text that's displayed when hovering over visibility toggler to show key
603
600
  */
@@ -11,7 +11,7 @@ import React__default, { useRef, useEffect } from 'react';
11
11
  import PropTypes from '../../_virtual/index.js';
12
12
  import cx from 'classnames';
13
13
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
14
- import { useFocus, claimFocus } from '../../global/js/hooks/useFocus.js';
14
+ import { useFocus } from '../../global/js/hooks/useFocus.js';
15
15
  import { pkg } from '../../settings.js';
16
16
  import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
17
17
  import uuidv4 from '../../global/js/utils/uuidv4.js';
@@ -52,7 +52,7 @@ var AboutModal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
52
52
  var contentId = uuidv4();
53
53
  var renderPortalUse = usePortalTarget(portalTargetIn);
54
54
  var _useFocus = useFocus(modalRef),
55
- firstElement = _useFocus.firstElement;
55
+ claimFocus = _useFocus.claimFocus;
56
56
 
57
57
  // We can't add a ref directly to the ModalBody, so track it in a ref
58
58
  // as the parent of the current bodyRef element
@@ -62,9 +62,10 @@ var AboutModal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
62
62
  }, [bodyRef]);
63
63
  useEffect(function () {
64
64
  if (open) {
65
- claimFocus(firstElement, modalRef);
65
+ claimFocus();
66
66
  }
67
- }, [firstElement, modalRef, open]);
67
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ }, [modalRef, open]);
68
69
  return renderPortalUse(/*#__PURE__*/React__default.createElement(unstable_FeatureFlags, {
69
70
  enableExperimentalFocusWrapWithoutSentinels: true
70
71
  }, /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
@@ -144,10 +144,8 @@ var ConditionBlock = function ConditionBlock(props) {
144
144
  return isLastCondition(conditionIndex, conditions);
145
145
  };
146
146
  var getOperators = function getOperators() {
147
- // @ts-ignore
148
147
  if (config !== null && config !== void 0 && config.operators) {
149
- // @ts-ignore
150
- return config.operators;
148
+ return config === null || config === void 0 ? void 0 : config.operators;
151
149
  }
152
150
  return operatorConfig.filter(function (operator) {
153
151
  return operator.type.indexOf(type) != -1 || operator.type == 'all';
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { TextAreaProps, TextInputProps } from '@carbon/react';
7
+ import { TextAreaProps, TextInputProps, type DatePickerProps } from '@carbon/react';
8
8
  import { CarbonIconType } from '@carbon/icons-react';
9
9
  import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
10
10
  import { Dispatch, ForwardedRef, PropsWithChildren, ReactNode, SetStateAction } from 'react';
@@ -46,13 +46,15 @@ export type PropertyConfigOption = {
46
46
  };
47
47
  export interface PropertyConfigText {
48
48
  type: 'text';
49
- config: TextInputProps;
50
- operators?: Item[];
49
+ config: TextInputProps & {
50
+ operators?: Item[];
51
+ };
51
52
  }
52
53
  export interface PropertyConfigTextArea {
53
54
  type: 'textarea';
54
- config: TextAreaProps;
55
- operators?: Item[];
55
+ config: TextAreaProps & {
56
+ operators?: Item[];
57
+ };
56
58
  }
57
59
  export interface PropertyConfigNumber {
58
60
  type: 'number';
@@ -66,8 +68,7 @@ export interface PropertyConfigNumber {
66
68
  }
67
69
  export type PropertyConfigDate = {
68
70
  type: 'date';
69
- config: {
70
- valueFormatter?: (value: string) => string;
71
+ config: DatePickerProps & {
71
72
  operators?: Item[];
72
73
  };
73
74
  };
@@ -144,13 +144,11 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
144
144
  };
145
145
  var getCustomOperatorLabel = function getCustomOperatorLabel(propertyLabel) {
146
146
  var _config$operators;
147
- return propertyLabel && (// @ts-ignore
148
- config === null || config === void 0 || (_config$operators = config.operators) === null || _config$operators === void 0 ? void 0 : _config$operators.find(function (operator) {
147
+ return propertyLabel && (config === null || config === void 0 || (_config$operators = config.operators) === null || _config$operators === void 0 ? void 0 : _config$operators.find(function (operator) {
149
148
  return operator.id === propertyLabel;
150
149
  }));
151
150
  };
152
151
  var getLabel = function getLabel() {
153
- // @ts-ignore
154
152
  if (config !== null && config !== void 0 && config.operators && rest['data-name'] === 'operatorField') {
155
153
  var _getCustomOperatorLab, _getCustomOperatorLab2;
156
154
  return (_getCustomOperatorLab = (_getCustomOperatorLab2 = getCustomOperatorLabel(propertyLabel)) === null || _getCustomOperatorLab2 === void 0 ? void 0 : _getCustomOperatorLab2.label) !== null && _getCustomOperatorLab !== void 0 ? _getCustomOperatorLab : addOperatorText;
@@ -6,16 +6,18 @@
6
6
  */
7
7
  import React from 'react';
8
8
  export declare const ConditionBuilderItemDate: {
9
- ({ conditionState, onChange, parentRef, }: {
9
+ ({ conditionState, onChange, parentRef, config, }: {
10
10
  conditionState: any;
11
11
  onChange: any;
12
12
  parentRef: any;
13
+ config: any;
13
14
  }): React.JSX.Element;
14
15
  propTypes: {
15
16
  /**
16
17
  * current condition object
17
18
  */
18
19
  conditionState: any;
20
+ config: any;
19
21
  /**
20
22
  * callback to update state oin date change
21
23
  */
@@ -5,50 +5,104 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef, useContext } from 'react';
8
+ import { slicedToArray as _slicedToArray, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useRef, useState, useContext, useEffect } from 'react';
10
10
  import { DatePicker, DatePickerInput } from '@carbon/react';
11
11
  import PropTypes from '../../../../_virtual/index.js';
12
12
  import { useTranslations } from '../../utils/useTranslations.js';
13
- import { blockClass } from '../../utils/util.js';
13
+ import { checkForMultiSelectOperator, blockClass, focusThisField } from '../../utils/util.js';
14
14
  import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
15
15
 
16
16
  var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
17
17
  var conditionState = _ref.conditionState,
18
18
  onChange = _ref.onChange,
19
- parentRef = _ref.parentRef;
19
+ parentRef = _ref.parentRef,
20
+ config = _ref.config;
20
21
  var DatePickerInputRef = useRef(null);
21
22
  var _useTranslations = useTranslations(['startText', 'endText']),
22
23
  _useTranslations2 = _slicedToArray(_useTranslations, 2),
23
24
  startText = _useTranslations2[0],
24
25
  endText = _useTranslations2[1];
25
- var _useContext = useContext(ConditionBuilderContext);
26
- _useContext.conditionBuilderRef;
27
- var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
28
- var onCloseHandler = function onCloseHandler(selectedDate) {
29
- onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID');
26
+ var _useState = useState(),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ dateFromState = _useState2[0],
29
+ setDateFromState = _useState2[1];
30
+ var dateFormat = config.dateFormat || 'm/d/Y';
31
+ var _useContext = useContext(ConditionBuilderContext),
32
+ conditionBuilderRef = _useContext.conditionBuilderRef;
33
+ var datePickerType = conditionState.operator == 'between' || checkForMultiSelectOperator(conditionState, config) ? 'range' : 'single';
34
+ useEffect(function () {
35
+ if (datePickerType === 'range') {
36
+ var _getParsedDate;
37
+ setDateFromState((_getParsedDate = getParsedDate(conditionState.value)) !== null && _getParsedDate !== void 0 ? _getParsedDate : undefined);
38
+ }
39
+
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, []);
42
+
43
+ //This method will convert the date string from the condition state to date object based on the dateFormat
44
+ var getParsedDate = function getParsedDate(dateToParse) {
45
+ var _DatePickerInputRef$c;
46
+ // @ts-ignore
47
+ var calendarInstance = DatePickerInputRef === null || DatePickerInputRef === void 0 || (_DatePickerInputRef$c = DatePickerInputRef.current) === null || _DatePickerInputRef$c === void 0 ? void 0 : _DatePickerInputRef$c.calendar;
48
+ if (!calendarInstance || !dateToParse) {
49
+ return null;
50
+ }
51
+ var _dateToParse$split = dateToParse.split(' - '),
52
+ _dateToParse$split2 = _slicedToArray(_dateToParse$split, 2),
53
+ startDate = _dateToParse$split2[0],
54
+ endDate = _dateToParse$split2[1];
55
+ var parsedDates = [];
56
+ if (startDate && startDate !== 'INVALID') {
57
+ parsedDates.push(calendarInstance.parseDate(startDate, dateFormat));
58
+ }
59
+ if (endDate && endDate !== 'INVALID') {
60
+ parsedDates.push(calendarInstance.parseDate(endDate, dateFormat));
61
+ }
62
+ return parsedDates.length ? parsedDates : null;
63
+ };
64
+ var onCloseHandler = function onCloseHandler(selectedDate, selectedDateStr, instance) {
65
+ var formattedDate = selectedDateStr;
66
+ if (datePickerType === 'range' && selectedDate.length === 2) {
67
+ formattedDate = "".concat(instance.formatDate(selectedDate[0], dateFormat), " - ").concat(instance.formatDate(selectedDate[1], dateFormat));
68
+ }
69
+ onChange(formattedDate || 'INVALID');
70
+ };
71
+
72
+ // this will close the popover on enter key press
73
+ //Note: has to use onKeyPress instead of onKeyDown, since core is stop propagating for onKeydown(fixEventsPlugin.js)
74
+ var onKeyPressHandler = function onKeyPressHandler(evt) {
75
+ if (evt.key === 'Enter') {
76
+ var _DatePickerInputRef$c2;
77
+ // @ts-ignore
78
+ var calendarInstance = DatePickerInputRef === null || DatePickerInputRef === void 0 || (_DatePickerInputRef$c2 = DatePickerInputRef.current) === null || _DatePickerInputRef$c2 === void 0 ? void 0 : _DatePickerInputRef$c2.calendar;
79
+ if (calendarInstance) {
80
+ onCloseHandler(calendarInstance.selectedDates, evt.target.value, calendarInstance);
81
+ }
82
+ focusThisField(evt, conditionBuilderRef);
83
+ }
30
84
  };
31
85
  return /*#__PURE__*/React__default.createElement("div", {
32
86
  className: "".concat(blockClass, "__item-date ")
33
- }, datePickerType == 'single' && /*#__PURE__*/React__default.createElement(DatePicker, {
87
+ }, datePickerType == 'single' && /*#__PURE__*/React__default.createElement(DatePicker, _extends({}, config, {
34
88
  ref: DatePickerInputRef,
35
- dateFormat: "d/m/Y",
36
89
  datePickerType: "single",
37
90
  value: conditionState.value,
38
91
  onClose: onCloseHandler,
92
+ onKeyPress: onKeyPressHandler,
39
93
  appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
40
- }, /*#__PURE__*/React__default.createElement(DatePickerInput, {
94
+ }), /*#__PURE__*/React__default.createElement(DatePickerInput, {
41
95
  id: "datePicker",
42
96
  placeholder: "dd/mm/yyyy",
43
97
  labelText: conditionState.property
44
- })), datePickerType == 'range' && /*#__PURE__*/React__default.createElement(DatePicker, {
98
+ })), datePickerType == 'range' && /*#__PURE__*/React__default.createElement(DatePicker, _extends({}, config, {
45
99
  ref: DatePickerInputRef,
46
- dateFormat: "d/m/Y",
47
100
  datePickerType: datePickerType,
48
101
  onClose: onCloseHandler,
49
- value: conditionState.value,
102
+ onKeyPress: onKeyPressHandler,
103
+ value: dateFromState,
50
104
  appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
51
- }, /*#__PURE__*/React__default.createElement(DatePickerInput, {
105
+ }), /*#__PURE__*/React__default.createElement(DatePickerInput, {
52
106
  id: "datePickerStart",
53
107
  placeholder: "dd/mm/yyyy",
54
108
  labelText: startText
@@ -63,6 +117,7 @@ ConditionBuilderItemDate.propTypes = {
63
117
  * current condition object
64
118
  */
65
119
  conditionState: PropTypes.object,
120
+ config: PropTypes.object,
66
121
  /**
67
122
  * callback to update state oin date change
68
123
  */
@@ -37,6 +37,7 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
37
37
  //focus the corresponding field in which the popover is triggered from
38
38
  focusThisField(evt, conditionBuilderRef);
39
39
  evt.preventDefault();
40
+ evt.stopPropagation();
40
41
  }
41
42
  if (isOptionInput) {
42
43
  switch (key) {
@@ -63,54 +63,19 @@ var manageTabIndexAndFocus = function manageTabIndexAndFocus(currentElement, con
63
63
  (_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 || (_conditionBuilderRef$ = _conditionBuilderRef$.querySelector(".".concat(blockClass, "__statement-button"))) === null || _conditionBuilderRef$ === void 0 || _conditionBuilderRef$.setAttribute('tabindex', '1');
64
64
  currentElement === null || currentElement === void 0 || currentElement.focus();
65
65
  };
66
- var formatDate = function formatDate(date) {
67
- var day = String(date.getDate()).padStart(2, '0');
68
- var month = String(date.getMonth() + 1).padStart(2, '0');
69
- var year = date.getFullYear();
70
- return "".concat(day, "/").concat(month, "/").concat(year);
71
- };
72
66
  var getValue = function getValue(type, value, config) {
73
- if (config !== null && config !== void 0 && config.valueFormatter && ['date', 'custom'].includes(type)) {
67
+ if (config !== null && config !== void 0 && config.valueFormatter && ['custom'].includes(type)) {
74
68
  return config.valueFormatter(value);
69
+ } else if (type === 'option') {
70
+ if (value && typeof value !== 'string') {
71
+ var selectedValues = Array.isArray(value) ? value : [value];
72
+ return selectedValues.map(function (option) {
73
+ return option.label;
74
+ }).join(', ');
75
+ }
76
+ return value;
75
77
  } else {
76
- var formatters = {
77
- text: function text(value) {
78
- return value;
79
- },
80
- textarea: function textarea(value) {
81
- return value;
82
- },
83
- time: function time(value) {
84
- return value;
85
- },
86
- number: function number(value) {
87
- return value;
88
- },
89
- option: function option(value) {
90
- if (value && typeof value !== 'string') {
91
- var selectedValues = Array.isArray(value) ? value : [value];
92
- return selectedValues.map(function (option) {
93
- return option.label;
94
- }).join(', ');
95
- }
96
- return value;
97
- },
98
- date: function date(value) {
99
- if (Array.isArray(value) && value.length > 1) {
100
- var start = value !== null && value !== void 0 && value[0] && !isNaN(new Date(value[0])) ? formatDate(new Date(value[0])) : '';
101
- var end = value !== null && value !== void 0 && value[1] && !isNaN(new Date(value[1])) ? formatDate(new Date(value[1])) : '';
102
- return "".concat(start, " To ").concat(end);
103
- } else if (Array.isArray(value) && !isNaN(new Date(value[0]))) {
104
- return formatDate(new Date(value[0]));
105
- } else {
106
- return value;
107
- }
108
- },
109
- custom: function custom(value) {
110
- return value;
111
- }
112
- };
113
- return formatters[type](value, config);
78
+ return value;
114
79
  }
115
80
  };
116
81
 
@@ -10,7 +10,7 @@ import React__default, { forwardRef, useContext, useState, useEffect, isValidEle
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
12
  import { pkg } from '../../settings.js';
13
- import { Grid, Column, FormGroup } from '@carbon/react';
13
+ import { Section, Grid, Column, Heading, FormGroup } from '@carbon/react';
14
14
  import { StepsContext, StepNumberContext } from './CreateFullPage.js';
15
15
  import pconsole from '../../global/js/utils/pconsole.js';
16
16
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
@@ -108,15 +108,15 @@ var CreateFullPageStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
108
108
  }
109
109
  return null;
110
110
  };
111
- return stepsContext ? /*#__PURE__*/React__default.createElement("section", _extends({}, rest, {
111
+ return stepsContext ? /*#__PURE__*/React__default.createElement(Section, _extends({}, rest, {
112
112
  className: cx(blockClass, className, _defineProperty(_defineProperty({}, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep))),
113
113
  ref: ref
114
114
  }), /*#__PURE__*/React__default.createElement(Grid, null, /*#__PURE__*/React__default.createElement(Column, span, /*#__PURE__*/React__default.createElement(Grid, null, /*#__PURE__*/React__default.createElement(Column, _extends({
115
115
  className: "".concat(blockClass, "-title"),
116
- as: "h5"
116
+ as: Heading
117
117
  }, span), title), subtitle && /*#__PURE__*/React__default.createElement(Column, _extends({
118
118
  className: "".concat(blockClass, "-subtitle"),
119
- as: "h6"
119
+ as: "p"
120
120
  }, span), subtitle), renderDescription()))), hasFieldset ? /*#__PURE__*/React__default.createElement(FormGroup, {
121
121
  legendText: fieldsetLegendText,
122
122
  className: "".concat(blockClass, "-fieldset")
@@ -8,7 +8,7 @@
8
8
  import React__default from 'react';
9
9
  import PropTypes from '../../_virtual/index.js';
10
10
  import cx from 'classnames';
11
- import { ProgressIndicator, ProgressStep } from '@carbon/react';
11
+ import { Section, Heading, ProgressIndicator, ProgressStep } from '@carbon/react';
12
12
  import '../../global/js/utils/props-helper.js';
13
13
  import { pkg } from '../../settings.js';
14
14
 
@@ -48,9 +48,9 @@ var CreateInfluencer = function CreateInfluencer(_ref) {
48
48
  // we need to subtract the number of !shouldIncludeStep/s before the current step
49
49
  // which we get from `getNumberOfDynamicStepsBeforeCurrentStep()`
50
50
  var totalDynamicSteps = getNumberOfDynamicStepsBeforeCurrentStep(stepData, 'shouldIncludeStep') || 0;
51
- return /*#__PURE__*/React__default.createElement("div", {
51
+ return /*#__PURE__*/React__default.createElement(Section, {
52
52
  className: "".concat(blockClass, "__left-nav")
53
- }, title && /*#__PURE__*/React__default.createElement("h3", {
53
+ }, title && /*#__PURE__*/React__default.createElement(Heading, {
54
54
  className: "".concat(blockClass, "__title")
55
55
  }, title), currentStep === 1 && (_stepData$ = stepData[0]) !== null && _stepData$ !== void 0 && _stepData$.introStep ? null : /*#__PURE__*/React__default.createElement(ProgressIndicator, {
56
56
  currentIndex: (_stepData$2 = stepData[0]) !== null && _stepData$2 !== void 0 && _stepData$2.introStep ? currentStep - totalDynamicSteps - 2 // minus 2 because we need to account for the intro step in addition to `currentIndex` being 0 index based and our steps being 1 index based
@@ -116,9 +116,6 @@ var FilterPanel = function FilterPanel(_ref) {
116
116
  _useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
117
117
  shouldDisableButtons = _useShouldDisableButt2[0],
118
118
  setShouldDisableButtons = _useShouldDisableButt2[1];
119
-
120
- // NOTE: In the future when we get rid of framer-motion we can use our own usePrefersReducedMotion hook
121
- // using our own was causing an error
122
119
  var shouldReduceMotion = usePrefersReducedMotion();
123
120
  var exitAnimationName = shouldReduceMotion ? 'filter-panel-exit-reduced' : 'filter-panel-exit-left';
124
121
  var _usePresence = usePresence(panelOpen, filterPanelRef, exitAnimationName),
@@ -150,7 +150,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
150
150
  };
151
151
  return _objectSpread2(_objectSpread2({}, column), {}, {
152
152
  Header: Header,
153
- minWidth: column.disableSortBy ? 0 : (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : column.isAction ? 50 : 90
153
+ minWidth: (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : column.disableSortBy ? 50 : column.isAction ? 50 : 90
154
154
  });
155
155
  });
156
156
  return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _toConsumableArray(sortableColumns);
@@ -7,7 +7,6 @@
7
7
  import React, { ElementType, ReactNode } from 'react';
8
8
  import '../../global/js/utils/props-helper';
9
9
  import { ButtonProps } from '@carbon/react';
10
- import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
11
10
  declare enum sizes {
12
11
  lg = "lg",
13
12
  sm = "sm"
@@ -17,16 +16,15 @@ export declare const defaults: {
17
16
  size: sizes;
18
17
  headingAs: string;
19
18
  };
19
+ interface EmptyStateAction extends ButtonProps<React.ElementType> {
20
+ kind?: 'primary' | 'secondary' | 'tertiary';
21
+ text?: string;
22
+ }
20
23
  export interface EmptyStateProps {
21
24
  /**
22
25
  * Empty state action button
23
26
  */
24
- action?: {
25
- kind?: 'primary' | 'secondary' | 'tertiary';
26
- renderIcon?: CarbonIconType;
27
- onClick?: ButtonProps<React.ElementType>['onClick'];
28
- text?: string;
29
- };
27
+ action?: EmptyStateAction;
30
28
  /**
31
29
  * Provide an optional class to be applied to the containing node.
32
30
  */
@@ -73,6 +71,7 @@ export interface EmptyStateProps {
73
71
  */
74
72
  v2?: boolean;
75
73
  }
74
+ export type EmptyStatePresetProps = Omit<EmptyStateProps, 'illustration'>;
76
75
  /**
77
76
  * 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.
78
77
  */
@@ -4,31 +4,9 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { ElementType, ReactNode } from 'react';
8
- import { ButtonProps } from '@carbon/react';
9
- import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
10
- export interface ErrorEmptyStateProps {
11
- /**
12
- * Empty state action button
13
- */
14
- action?: {
15
- kind?: 'primary' | 'secondary' | 'tertiary';
16
- renderIcon?: CarbonIconType;
17
- onClick?: ButtonProps<React.ElementType>['onClick'];
18
- text?: string;
19
- };
20
- /**
21
- * Provide an optional class to be applied to the containing node.
22
- */
23
- className?: string;
24
- /**
25
- * The alt text for empty state svg images. If not provided , title will be used.
26
- */
27
- illustrationDescription?: string;
28
- /**
29
- * Designates the position of the illustration relative to the content
30
- */
31
- illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
7
+ import React from 'react';
8
+ import { EmptyStatePresetProps } from '../EmptyState';
9
+ export interface ErrorEmptyStateProps extends EmptyStatePresetProps {
32
10
  /**
33
11
  * Empty state illustration theme variations.
34
12
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark
@@ -36,29 +14,6 @@ export interface ErrorEmptyStateProps {
36
14
  * `illustrationTheme={appTheme === ('carbon--g100' || 'carbon--g90') ? 'dark' : 'light'}`
37
15
  */
38
16
  illustrationTheme?: 'light' | 'dark';
39
- /**
40
- * Empty state link object
41
- */
42
- link?: {
43
- text?: string | ReactNode;
44
- href?: string;
45
- };
46
- /**
47
- * Empty state headingAs allows you to customize the type of heading element
48
- */
49
- headingAs?: (() => ReactNode) | string | ElementType;
50
- /**
51
- * Empty state size
52
- */
53
- size?: 'lg' | 'sm';
54
- /**
55
- * Empty state subtitle
56
- */
57
- subtitle?: string | ReactNode;
58
- /**
59
- * Empty state title
60
- */
61
- title: string | ReactNode;
62
17
  }
63
18
  /**
64
19
  * 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.
@@ -17,6 +17,7 @@ import { ErrorIllustration } from '../assets/ErrorIllustration.js';
17
17
  import { defaults } from '../EmptyState.js';
18
18
 
19
19
  var _excluded = ["action", "className", "illustrationPosition", "illustrationDescription", "illustrationTheme", "link", "size", "headingAs", "subtitle", "title"];
20
+
20
21
  // The block part of our conventional BEM class names (blockClass__E--M).
21
22
  var blockClass = "".concat(pkg.prefix, "--empty-state");
22
23
  var componentName = 'ErrorEmptyState';
@@ -4,31 +4,9 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { ElementType, ReactNode } from 'react';
8
- import { ButtonProps } from '@carbon/react';
9
- import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
10
- export interface NoDataEmptyStateProps {
11
- /**
12
- * Empty state action button
13
- */
14
- action?: {
15
- kind?: 'primary' | 'secondary' | 'tertiary';
16
- renderIcon?: CarbonIconType;
17
- onClick?: ButtonProps<React.ElementType>['onClick'];
18
- text?: string;
19
- };
20
- /**
21
- * Provide an optional class to be applied to the containing node.
22
- */
23
- className?: string;
24
- /**
25
- * The alt text for empty state svg images. If not provided, title will be used.
26
- */
27
- illustrationDescription?: string;
28
- /**
29
- * Designates the position of the illustration relative to the content
30
- */
31
- illustrationPosition?: 'top' | 'right' | 'bottom' | 'left';
7
+ import React from 'react';
8
+ import { EmptyStatePresetProps } from '../EmptyState';
9
+ export interface NoDataEmptyStateProps extends EmptyStatePresetProps {
32
10
  /**
33
11
  * Empty state illustration theme variations.
34
12
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark
@@ -36,29 +14,6 @@ export interface NoDataEmptyStateProps {
36
14
  * `illustrationTheme={appTheme === ('carbon--g100' || 'carbon--g90') ? 'dark' : 'light'}`
37
15
  */
38
16
  illustrationTheme?: 'light' | 'dark';
39
- /**
40
- * Empty state link object
41
- */
42
- link?: {
43
- text?: string | ReactNode;
44
- href?: string;
45
- };
46
- /**
47
- * Empty state headingAs allows you to customize the type of heading element
48
- */
49
- headingAs?: (() => ReactNode) | string | ElementType;
50
- /**
51
- * Empty state size
52
- */
53
- size?: 'lg' | 'sm';
54
- /**
55
- * Empty state subtitle
56
- */
57
- subtitle?: string | React.ReactNode;
58
- /**
59
- * Empty state title
60
- */
61
- title: string | React.ReactNode;
62
17
  }
63
18
  /**
64
19
  * 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.