@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.
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css.map +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +6 -9
- package/es/components/AboutModal/AboutModal.js +5 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +1 -3
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +8 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +71 -16
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -0
- package/es/components/ConditionBuilder/utils/util.js +10 -45
- package/es/components/CreateFullPage/CreateFullPageStep.js +4 -4
- package/es/components/CreateInfluencer/CreateInfluencer.js +3 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +0 -3
- package/es/components/Datagrid/useSortableColumns.js +1 -1
- package/es/components/EmptyStates/EmptyState.d.ts +6 -7
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +3 -48
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +3 -48
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +3 -48
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +3 -48
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +3 -48
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +3 -48
- package/es/components/InterstitialScreen/InterstitialScreen.js +4 -2
- package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +4 -0
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +9 -4
- package/es/components/OptionsTile/OptionsTile.js +3 -3
- package/es/components/ProductiveCard/ProductiveCard.d.ts +9 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -2
- package/es/components/Tearsheet/TearsheetShell.js +80 -50
- package/es/global/js/hooks/useFocus.d.ts +1 -1
- package/es/global/js/hooks/useFocus.js +23 -31
- package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/es/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +1 -1
- package/lib/components/APIKeyModal/APIKeyModal.js +5 -8
- package/lib/components/AboutModal/AboutModal.js +4 -3
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +1 -3
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +8 -7
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +1 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +68 -13
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -0
- package/lib/components/ConditionBuilder/utils/util.js +10 -45
- package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -3
- package/lib/components/CreateInfluencer/CreateInfluencer.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +0 -3
- package/lib/components/Datagrid/useSortableColumns.js +1 -1
- package/lib/components/EmptyStates/EmptyState.d.ts +6 -7
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +3 -48
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +3 -48
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +3 -48
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +3 -48
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +3 -48
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +3 -48
- package/lib/components/InterstitialScreen/InterstitialScreen.js +4 -2
- package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +4 -0
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +9 -4
- package/lib/components/OptionsTile/OptionsTile.js +2 -2
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +9 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +1 -1
- package/lib/components/Tearsheet/TearsheetShell.js +78 -48
- package/lib/global/js/hooks/useFocus.d.ts +1 -1
- package/lib/global/js/hooks/useFocus.js +22 -31
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/lib/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +1 -1
- package/package.json +11 -12
- package/telemetry.yml +1 -1
@@ -15,7 +15,7 @@ var getSpecificElement = function getSpecificElement(parentEl, elementId) {
|
|
15
15
|
return elementId && !(element !== null && element !== void 0 && element.disabled) ? element : null;
|
16
16
|
};
|
17
17
|
var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
18
|
-
var
|
18
|
+
var _getFocusable3, _getFocusable4, _getFocusable5, _getFocusable6;
|
19
19
|
var carbonPrefix = usePrefix();
|
20
20
|
var tearsheetBaseClass = "".concat(pkg.prefix, "--tearsheet");
|
21
21
|
var sidePanelBaseClass = "".concat(pkg.prefix, "--side-panel");
|
@@ -90,38 +90,30 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
90
90
|
return _ref.apply(this, arguments);
|
91
91
|
};
|
92
92
|
}();
|
93
|
+
var claimFocus = useCallback(function () {
|
94
|
+
var _window2;
|
95
|
+
var _getFocusable2 = getFocusable(),
|
96
|
+
first = _getFocusable2.first,
|
97
|
+
specified = _getFocusable2.specified;
|
98
|
+
if (specified && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specified)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none' && (specified === null || specified === void 0 ? void 0 : specified.tabIndex) !== -1) {
|
99
|
+
setTimeout(function () {
|
100
|
+
return specified.focus();
|
101
|
+
}, 0);
|
102
|
+
} else {
|
103
|
+
setTimeout(function () {
|
104
|
+
return first === null || first === void 0 ? void 0 : first.focus();
|
105
|
+
}, 0);
|
106
|
+
}
|
107
|
+
}, [getFocusable]);
|
93
108
|
return {
|
94
|
-
firstElement: (
|
95
|
-
lastElement: (
|
96
|
-
allElements: (
|
97
|
-
specifiedElement: (
|
109
|
+
firstElement: (_getFocusable3 = getFocusable()) === null || _getFocusable3 === void 0 ? void 0 : _getFocusable3.first,
|
110
|
+
lastElement: (_getFocusable4 = getFocusable()) === null || _getFocusable4 === void 0 ? void 0 : _getFocusable4.last,
|
111
|
+
allElements: (_getFocusable5 = getFocusable()) === null || _getFocusable5 === void 0 ? void 0 : _getFocusable5.all,
|
112
|
+
specifiedElement: (_getFocusable6 = getFocusable()) === null || _getFocusable6 === void 0 ? void 0 : _getFocusable6.specified,
|
98
113
|
keyDownListener: handleKeyDown,
|
99
|
-
getFocusable: getFocusable
|
114
|
+
getFocusable: getFocusable,
|
115
|
+
claimFocus: claimFocus
|
100
116
|
};
|
101
117
|
};
|
102
118
|
|
103
|
-
|
104
|
-
*
|
105
|
-
* @param {*} firstElement
|
106
|
-
* @param {*} modalRef
|
107
|
-
* @param {string | undefined} selectorPrimaryFocus
|
108
|
-
*/
|
109
|
-
var claimFocus = function claimFocus(firstElement, modalRef) {
|
110
|
-
var _window2, _specifiedEl;
|
111
|
-
var selectorPrimaryFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
112
|
-
var specifiedEl;
|
113
|
-
if (selectorPrimaryFocus) {
|
114
|
-
specifiedEl = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
|
115
|
-
}
|
116
|
-
if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none' && ((_specifiedEl = specifiedEl) === null || _specifiedEl === void 0 ? void 0 : _specifiedEl.tabIndex) !== -1) {
|
117
|
-
setTimeout(function () {
|
118
|
-
return specifiedEl.focus();
|
119
|
-
}, 0);
|
120
|
-
} else {
|
121
|
-
setTimeout(function () {
|
122
|
-
return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|
123
|
-
}, 0);
|
124
|
-
}
|
125
|
-
};
|
126
|
-
|
127
|
-
export { claimFocus, getSpecificElement, useFocus };
|
119
|
+
export { getSpecificElement, useFocus };
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { getAttributes } from '
|
9
|
+
import { getAttributes } from '../node_modules/@carbon/icon-helpers/es/index.js';
|
10
10
|
import PropTypes from '../../../../_virtual/index.js';
|
11
11
|
import React__default from 'react';
|
12
12
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { typeof as _typeof } from '
|
8
|
+
import { typeof as _typeof } from '../../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
|
10
10
|
function _defineProperty(e, r, t) {
|
11
11
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
@@ -128,7 +128,8 @@ exports.APIKeyModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
128
128
|
var modalRef = ref || localRef;
|
129
129
|
var _useFocus = useFocus.useFocus(modalRef),
|
130
130
|
firstElement = _useFocus.firstElement,
|
131
|
-
keyDownListener = _useFocus.keyDownListener
|
131
|
+
keyDownListener = _useFocus.keyDownListener,
|
132
|
+
claimFocus = _useFocus.claimFocus;
|
132
133
|
var prevOpen = usePreviousValue.usePreviousValue(open);
|
133
134
|
React.useEffect(function () {
|
134
135
|
if (copyRef.current && open && apiKeyLoaded) {
|
@@ -141,9 +142,10 @@ exports.APIKeyModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
141
142
|
React.useEffect(function () {
|
142
143
|
if (open) {
|
143
144
|
// Focusing the first element or selectorPrimaryFocus element
|
144
|
-
|
145
|
+
claimFocus();
|
145
146
|
}
|
146
|
-
|
147
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
148
|
+
}, [modalRef, open, firstElement]);
|
147
149
|
React.useEffect(function () {
|
148
150
|
if (prevOpen && !open && launcherButtonRef) {
|
149
151
|
setTimeout(function () {
|
@@ -595,11 +597,6 @@ exports.APIKeyModal.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
595
597
|
* text that displays in the secondary button when using custom steps to indicate to the user that there is a previous step
|
596
598
|
*/
|
597
599
|
previousStepButtonText: customStepsRequiredProps(index.default.string),
|
598
|
-
/**
|
599
|
-
* Specify a CSS selector that matches the DOM element that should be
|
600
|
-
* focused when the Modal opens.
|
601
|
-
*/
|
602
|
-
selectorPrimaryFocus: index.default.string,
|
603
600
|
/**
|
604
601
|
* label text that's displayed when hovering over visibility toggler to show key
|
605
602
|
*/
|
@@ -54,7 +54,7 @@ exports.AboutModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
54
54
|
var contentId = uuidv4.default();
|
55
55
|
var renderPortalUse = usePortalTarget.usePortalTarget(portalTargetIn);
|
56
56
|
var _useFocus = useFocus.useFocus(modalRef),
|
57
|
-
|
57
|
+
claimFocus = _useFocus.claimFocus;
|
58
58
|
|
59
59
|
// We can't add a ref directly to the ModalBody, so track it in a ref
|
60
60
|
// as the parent of the current bodyRef element
|
@@ -64,9 +64,10 @@ exports.AboutModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
64
64
|
}, [bodyRef]);
|
65
65
|
React.useEffect(function () {
|
66
66
|
if (open) {
|
67
|
-
|
67
|
+
claimFocus();
|
68
68
|
}
|
69
|
-
|
69
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
70
|
+
}, [modalRef, open]);
|
70
71
|
return renderPortalUse(/*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
|
71
72
|
enableExperimentalFocusWrapWithoutSentinels: true
|
72
73
|
}, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
|
@@ -148,10 +148,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
148
148
|
return isLastCondition(conditionIndex, conditions);
|
149
149
|
};
|
150
150
|
var getOperators = function getOperators() {
|
151
|
-
// @ts-ignore
|
152
151
|
if (config !== null && config !== void 0 && config.operators) {
|
153
|
-
|
154
|
-
return config.operators;
|
152
|
+
return config === null || config === void 0 ? void 0 : config.operators;
|
155
153
|
}
|
156
154
|
return operatorConfig.filter(function (operator) {
|
157
155
|
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
|
-
|
49
|
+
config: TextInputProps & {
|
50
|
+
operators?: Item[];
|
51
|
+
};
|
51
52
|
}
|
52
53
|
export interface PropertyConfigTextArea {
|
53
54
|
type: 'textarea';
|
54
|
-
config: TextAreaProps
|
55
|
-
|
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
|
};
|
@@ -146,13 +146,11 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
146
146
|
};
|
147
147
|
var getCustomOperatorLabel = function getCustomOperatorLabel(propertyLabel) {
|
148
148
|
var _config$operators;
|
149
|
-
return propertyLabel && (
|
150
|
-
config === null || config === void 0 || (_config$operators = config.operators) === null || _config$operators === void 0 ? void 0 : _config$operators.find(function (operator) {
|
149
|
+
return propertyLabel && (config === null || config === void 0 || (_config$operators = config.operators) === null || _config$operators === void 0 ? void 0 : _config$operators.find(function (operator) {
|
151
150
|
return operator.id === propertyLabel;
|
152
151
|
}));
|
153
152
|
};
|
154
153
|
var getLabel = function getLabel() {
|
155
|
-
// @ts-ignore
|
156
154
|
if (config !== null && config !== void 0 && config.operators && rest['data-name'] === 'operatorField') {
|
157
155
|
var _getCustomOperatorLab, _getCustomOperatorLab2;
|
158
156
|
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
|
*/
|
@@ -18,39 +18,93 @@ var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionB
|
|
18
18
|
var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
19
19
|
var conditionState = _ref.conditionState,
|
20
20
|
onChange = _ref.onChange,
|
21
|
-
parentRef = _ref.parentRef
|
21
|
+
parentRef = _ref.parentRef,
|
22
|
+
config = _ref.config;
|
22
23
|
var DatePickerInputRef = React.useRef(null);
|
23
24
|
var _useTranslations = useTranslations.useTranslations(['startText', 'endText']),
|
24
25
|
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 2),
|
25
26
|
startText = _useTranslations2[0],
|
26
27
|
endText = _useTranslations2[1];
|
27
|
-
var
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
var _useState = React.useState(),
|
29
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
30
|
+
dateFromState = _useState2[0],
|
31
|
+
setDateFromState = _useState2[1];
|
32
|
+
var dateFormat = config.dateFormat || 'm/d/Y';
|
33
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
34
|
+
conditionBuilderRef = _useContext.conditionBuilderRef;
|
35
|
+
var datePickerType = conditionState.operator == 'between' || util.checkForMultiSelectOperator(conditionState, config) ? 'range' : 'single';
|
36
|
+
React.useEffect(function () {
|
37
|
+
if (datePickerType === 'range') {
|
38
|
+
var _getParsedDate;
|
39
|
+
setDateFromState((_getParsedDate = getParsedDate(conditionState.value)) !== null && _getParsedDate !== void 0 ? _getParsedDate : undefined);
|
40
|
+
}
|
41
|
+
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
43
|
+
}, []);
|
44
|
+
|
45
|
+
//This method will convert the date string from the condition state to date object based on the dateFormat
|
46
|
+
var getParsedDate = function getParsedDate(dateToParse) {
|
47
|
+
var _DatePickerInputRef$c;
|
48
|
+
// @ts-ignore
|
49
|
+
var calendarInstance = DatePickerInputRef === null || DatePickerInputRef === void 0 || (_DatePickerInputRef$c = DatePickerInputRef.current) === null || _DatePickerInputRef$c === void 0 ? void 0 : _DatePickerInputRef$c.calendar;
|
50
|
+
if (!calendarInstance || !dateToParse) {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
var _dateToParse$split = dateToParse.split(' - '),
|
54
|
+
_dateToParse$split2 = _rollupPluginBabelHelpers.slicedToArray(_dateToParse$split, 2),
|
55
|
+
startDate = _dateToParse$split2[0],
|
56
|
+
endDate = _dateToParse$split2[1];
|
57
|
+
var parsedDates = [];
|
58
|
+
if (startDate && startDate !== 'INVALID') {
|
59
|
+
parsedDates.push(calendarInstance.parseDate(startDate, dateFormat));
|
60
|
+
}
|
61
|
+
if (endDate && endDate !== 'INVALID') {
|
62
|
+
parsedDates.push(calendarInstance.parseDate(endDate, dateFormat));
|
63
|
+
}
|
64
|
+
return parsedDates.length ? parsedDates : null;
|
65
|
+
};
|
66
|
+
var onCloseHandler = function onCloseHandler(selectedDate, selectedDateStr, instance) {
|
67
|
+
var formattedDate = selectedDateStr;
|
68
|
+
if (datePickerType === 'range' && selectedDate.length === 2) {
|
69
|
+
formattedDate = "".concat(instance.formatDate(selectedDate[0], dateFormat), " - ").concat(instance.formatDate(selectedDate[1], dateFormat));
|
70
|
+
}
|
71
|
+
onChange(formattedDate || 'INVALID');
|
72
|
+
};
|
73
|
+
|
74
|
+
// this will close the popover on enter key press
|
75
|
+
//Note: has to use onKeyPress instead of onKeyDown, since core is stop propagating for onKeydown(fixEventsPlugin.js)
|
76
|
+
var onKeyPressHandler = function onKeyPressHandler(evt) {
|
77
|
+
if (evt.key === 'Enter') {
|
78
|
+
var _DatePickerInputRef$c2;
|
79
|
+
// @ts-ignore
|
80
|
+
var calendarInstance = DatePickerInputRef === null || DatePickerInputRef === void 0 || (_DatePickerInputRef$c2 = DatePickerInputRef.current) === null || _DatePickerInputRef$c2 === void 0 ? void 0 : _DatePickerInputRef$c2.calendar;
|
81
|
+
if (calendarInstance) {
|
82
|
+
onCloseHandler(calendarInstance.selectedDates, evt.target.value, calendarInstance);
|
83
|
+
}
|
84
|
+
util.focusThisField(evt, conditionBuilderRef);
|
85
|
+
}
|
32
86
|
};
|
33
87
|
return /*#__PURE__*/React.createElement("div", {
|
34
88
|
className: "".concat(util.blockClass, "__item-date ")
|
35
|
-
}, datePickerType == 'single' && /*#__PURE__*/React.createElement(react.DatePicker, {
|
89
|
+
}, datePickerType == 'single' && /*#__PURE__*/React.createElement(react.DatePicker, _rollupPluginBabelHelpers.extends({}, config, {
|
36
90
|
ref: DatePickerInputRef,
|
37
|
-
dateFormat: "d/m/Y",
|
38
91
|
datePickerType: "single",
|
39
92
|
value: conditionState.value,
|
40
93
|
onClose: onCloseHandler,
|
94
|
+
onKeyPress: onKeyPressHandler,
|
41
95
|
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
42
|
-
}, /*#__PURE__*/React.createElement(react.DatePickerInput, {
|
96
|
+
}), /*#__PURE__*/React.createElement(react.DatePickerInput, {
|
43
97
|
id: "datePicker",
|
44
98
|
placeholder: "dd/mm/yyyy",
|
45
99
|
labelText: conditionState.property
|
46
|
-
})), datePickerType == 'range' && /*#__PURE__*/React.createElement(react.DatePicker, {
|
100
|
+
})), datePickerType == 'range' && /*#__PURE__*/React.createElement(react.DatePicker, _rollupPluginBabelHelpers.extends({}, config, {
|
47
101
|
ref: DatePickerInputRef,
|
48
|
-
dateFormat: "d/m/Y",
|
49
102
|
datePickerType: datePickerType,
|
50
103
|
onClose: onCloseHandler,
|
51
|
-
|
104
|
+
onKeyPress: onKeyPressHandler,
|
105
|
+
value: dateFromState,
|
52
106
|
appendTo: parentRef === null || parentRef === void 0 ? void 0 : parentRef.current
|
53
|
-
}, /*#__PURE__*/React.createElement(react.DatePickerInput, {
|
107
|
+
}), /*#__PURE__*/React.createElement(react.DatePickerInput, {
|
54
108
|
id: "datePickerStart",
|
55
109
|
placeholder: "dd/mm/yyyy",
|
56
110
|
labelText: startText
|
@@ -65,6 +119,7 @@ ConditionBuilderItemDate.propTypes = {
|
|
65
119
|
* current condition object
|
66
120
|
*/
|
67
121
|
conditionState: index.default.object,
|
122
|
+
config: index.default.object,
|
68
123
|
/**
|
69
124
|
* callback to update state oin date change
|
70
125
|
*/
|
@@ -39,6 +39,7 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
39
39
|
//focus the corresponding field in which the popover is triggered from
|
40
40
|
util.focusThisField(evt, conditionBuilderRef);
|
41
41
|
evt.preventDefault();
|
42
|
+
evt.stopPropagation();
|
42
43
|
}
|
43
44
|
if (isOptionInput) {
|
44
45
|
switch (key) {
|
@@ -65,54 +65,19 @@ var manageTabIndexAndFocus = function manageTabIndexAndFocus(currentElement, con
|
|
65
65
|
(_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 || (_conditionBuilderRef$ = _conditionBuilderRef$.querySelector(".".concat(blockClass, "__statement-button"))) === null || _conditionBuilderRef$ === void 0 || _conditionBuilderRef$.setAttribute('tabindex', '1');
|
66
66
|
currentElement === null || currentElement === void 0 || currentElement.focus();
|
67
67
|
};
|
68
|
-
var formatDate = function formatDate(date) {
|
69
|
-
var day = String(date.getDate()).padStart(2, '0');
|
70
|
-
var month = String(date.getMonth() + 1).padStart(2, '0');
|
71
|
-
var year = date.getFullYear();
|
72
|
-
return "".concat(day, "/").concat(month, "/").concat(year);
|
73
|
-
};
|
74
68
|
var getValue = function getValue(type, value, config) {
|
75
|
-
if (config !== null && config !== void 0 && config.valueFormatter && ['
|
69
|
+
if (config !== null && config !== void 0 && config.valueFormatter && ['custom'].includes(type)) {
|
76
70
|
return config.valueFormatter(value);
|
71
|
+
} else if (type === 'option') {
|
72
|
+
if (value && typeof value !== 'string') {
|
73
|
+
var selectedValues = Array.isArray(value) ? value : [value];
|
74
|
+
return selectedValues.map(function (option) {
|
75
|
+
return option.label;
|
76
|
+
}).join(', ');
|
77
|
+
}
|
78
|
+
return value;
|
77
79
|
} else {
|
78
|
-
|
79
|
-
text: function text(value) {
|
80
|
-
return value;
|
81
|
-
},
|
82
|
-
textarea: function textarea(value) {
|
83
|
-
return value;
|
84
|
-
},
|
85
|
-
time: function time(value) {
|
86
|
-
return value;
|
87
|
-
},
|
88
|
-
number: function number(value) {
|
89
|
-
return value;
|
90
|
-
},
|
91
|
-
option: function option(value) {
|
92
|
-
if (value && typeof value !== 'string') {
|
93
|
-
var selectedValues = Array.isArray(value) ? value : [value];
|
94
|
-
return selectedValues.map(function (option) {
|
95
|
-
return option.label;
|
96
|
-
}).join(', ');
|
97
|
-
}
|
98
|
-
return value;
|
99
|
-
},
|
100
|
-
date: function date(value) {
|
101
|
-
if (Array.isArray(value) && value.length > 1) {
|
102
|
-
var start = value !== null && value !== void 0 && value[0] && !isNaN(new Date(value[0])) ? formatDate(new Date(value[0])) : '';
|
103
|
-
var end = value !== null && value !== void 0 && value[1] && !isNaN(new Date(value[1])) ? formatDate(new Date(value[1])) : '';
|
104
|
-
return "".concat(start, " To ").concat(end);
|
105
|
-
} else if (Array.isArray(value) && !isNaN(new Date(value[0]))) {
|
106
|
-
return formatDate(new Date(value[0]));
|
107
|
-
} else {
|
108
|
-
return value;
|
109
|
-
}
|
110
|
-
},
|
111
|
-
custom: function custom(value) {
|
112
|
-
return value;
|
113
|
-
}
|
114
|
-
};
|
115
|
-
return formatters[type](value, config);
|
80
|
+
return value;
|
116
81
|
}
|
117
82
|
};
|
118
83
|
|
@@ -110,15 +110,15 @@ exports.CreateFullPageStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
110
110
|
}
|
111
111
|
return null;
|
112
112
|
};
|
113
|
-
return stepsContext ? /*#__PURE__*/React.createElement(
|
113
|
+
return stepsContext ? /*#__PURE__*/React.createElement(react.Section, _rollupPluginBabelHelpers.extends({}, rest, {
|
114
114
|
className: cx(blockClass, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep))),
|
115
115
|
ref: ref
|
116
116
|
}), /*#__PURE__*/React.createElement(react.Grid, null, /*#__PURE__*/React.createElement(react.Column, span, /*#__PURE__*/React.createElement(react.Grid, null, /*#__PURE__*/React.createElement(react.Column, _rollupPluginBabelHelpers.extends({
|
117
117
|
className: "".concat(blockClass, "-title"),
|
118
|
-
as:
|
118
|
+
as: react.Heading
|
119
119
|
}, span), title), subtitle && /*#__PURE__*/React.createElement(react.Column, _rollupPluginBabelHelpers.extends({
|
120
120
|
className: "".concat(blockClass, "-subtitle"),
|
121
|
-
as: "
|
121
|
+
as: "p"
|
122
122
|
}, span), subtitle), renderDescription()))), hasFieldset ? /*#__PURE__*/React.createElement(react.FormGroup, {
|
123
123
|
legendText: fieldsetLegendText,
|
124
124
|
className: "".concat(blockClass, "-fieldset")
|
@@ -50,9 +50,9 @@ var CreateInfluencer = function CreateInfluencer(_ref) {
|
|
50
50
|
// we need to subtract the number of !shouldIncludeStep/s before the current step
|
51
51
|
// which we get from `getNumberOfDynamicStepsBeforeCurrentStep()`
|
52
52
|
var totalDynamicSteps = getNumberOfDynamicStepsBeforeCurrentStep(stepData, 'shouldIncludeStep') || 0;
|
53
|
-
return /*#__PURE__*/React.createElement(
|
53
|
+
return /*#__PURE__*/React.createElement(react.Section, {
|
54
54
|
className: "".concat(blockClass, "__left-nav")
|
55
|
-
}, title && /*#__PURE__*/React.createElement(
|
55
|
+
}, title && /*#__PURE__*/React.createElement(react.Heading, {
|
56
56
|
className: "".concat(blockClass, "__title")
|
57
57
|
}, title), currentStep === 1 && (_stepData$ = stepData[0]) !== null && _stepData$ !== void 0 && _stepData$.introStep ? null : /*#__PURE__*/React.createElement(react.ProgressIndicator, {
|
58
58
|
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
|
@@ -120,9 +120,6 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
120
120
|
_useShouldDisableButt2 = _rollupPluginBabelHelpers.slicedToArray(_useShouldDisableButt, 2),
|
121
121
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
122
122
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
123
|
-
|
124
|
-
// NOTE: In the future when we get rid of framer-motion we can use our own usePrefersReducedMotion hook
|
125
|
-
// using our own was causing an error
|
126
123
|
var shouldReduceMotion = usePrefersReducedMotion.usePrefersReducedMotion();
|
127
124
|
var exitAnimationName = shouldReduceMotion ? 'filter-panel-exit-reduced' : 'filter-panel-exit-left';
|
128
125
|
var _usePresence = usePresence.usePresence(panelOpen, filterPanelRef, exitAnimationName),
|
@@ -154,7 +154,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
154
154
|
};
|
155
155
|
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, column), {}, {
|
156
156
|
Header: Header,
|
157
|
-
minWidth:
|
157
|
+
minWidth: (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : column.disableSortBy ? 50 : column.isAction ? 50 : 90
|
158
158
|
});
|
159
159
|
});
|
160
160
|
return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _rollupPluginBabelHelpers.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
|
8
|
-
import {
|
9
|
-
|
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.
|
@@ -19,6 +19,7 @@ var ErrorIllustration = require('../assets/ErrorIllustration.js');
|
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
21
|
var _excluded = ["action", "className", "illustrationPosition", "illustrationDescription", "illustrationTheme", "link", "size", "headingAs", "subtitle", "title"];
|
22
|
+
|
22
23
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
24
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
24
25
|
var componentName = 'ErrorEmptyState';
|