carbon-react 104.54.4 → 104.57.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/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -1
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -1
- package/esm/__internal__/checkable-input/hidden-checkable-input.d.ts +2 -0
- package/esm/__internal__/form-field/form-field.component.js +3 -3
- package/esm/__internal__/input/input-presentation.component.js +6 -1
- package/esm/__internal__/input/input-presentation.style.d.ts +1 -0
- package/esm/__internal__/input/input-presentation.style.js +3 -2
- package/esm/__internal__/validation-message/index.d.ts +1 -0
- package/esm/__internal__/validation-message/index.js +1 -0
- package/esm/__internal__/validation-message/validation-message.component.d.ts +11 -0
- package/esm/__internal__/validation-message/validation-message.component.js +15 -0
- package/esm/__internal__/validation-message/validation-message.style.d.ts +5 -0
- package/esm/__internal__/validation-message/validation-message.style.js +12 -0
- package/esm/components/carbon-provider/carbon-provider.component.d.ts +5 -1
- package/esm/components/carbon-provider/carbon-provider.component.js +11 -4
- package/esm/components/carbon-provider/carbon-provider.d.ts +1 -0
- package/esm/components/date-range/date-range.style.js +1 -1
- package/esm/components/fieldset/fieldset.component.js +7 -2
- package/esm/components/modal/__internal__/modal-manager.d.ts +2 -2
- package/esm/components/modal/__internal__/modal-manager.js +18 -7
- package/esm/components/numeral-date/numeral-date-context.d.ts +3 -0
- package/esm/components/numeral-date/numeral-date-context.js +2 -0
- package/esm/components/numeral-date/numeral-date.component.js +22 -6
- package/esm/components/switch/switch.component.js +1 -0
- package/esm/components/textarea/textarea.component.js +27 -12
- package/esm/components/textbox/textbox.component.js +36 -15
- package/esm/components/textbox/textbox.d.ts +1 -1
- package/esm/components/textbox/textbox.style.d.ts +2 -0
- package/esm/components/textbox/textbox.style.js +33 -0
- package/esm/style/themes/base/base-theme.config.d.ts +2 -0
- package/esm/style/themes/base/base-theme.config.js +3 -1
- package/esm/style/themes/base/index.d.ts +2 -0
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -1
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -1
- package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +2 -0
- package/lib/__internal__/form-field/form-field.component.js +3 -3
- package/lib/__internal__/input/input-presentation.component.js +7 -1
- package/lib/__internal__/input/input-presentation.style.d.ts +1 -0
- package/lib/__internal__/input/input-presentation.style.js +3 -2
- package/lib/__internal__/validation-message/index.d.ts +1 -0
- package/lib/__internal__/validation-message/index.js +15 -0
- package/lib/__internal__/validation-message/package.json +6 -0
- package/lib/__internal__/validation-message/validation-message.component.d.ts +11 -0
- package/lib/__internal__/validation-message/validation-message.component.js +26 -0
- package/lib/__internal__/validation-message/validation-message.style.d.ts +5 -0
- package/lib/__internal__/validation-message/validation-message.style.js +25 -0
- package/lib/components/carbon-provider/carbon-provider.component.d.ts +5 -1
- package/lib/components/carbon-provider/carbon-provider.component.js +18 -5
- package/lib/components/carbon-provider/carbon-provider.d.ts +1 -0
- package/lib/components/date-range/date-range.style.js +1 -1
- package/lib/components/fieldset/fieldset.component.js +8 -2
- package/lib/components/modal/__internal__/modal-manager.d.ts +2 -2
- package/lib/components/modal/__internal__/modal-manager.js +20 -8
- package/lib/components/numeral-date/numeral-date-context.d.ts +3 -0
- package/lib/components/numeral-date/numeral-date-context.js +14 -0
- package/lib/components/numeral-date/numeral-date.component.js +25 -5
- package/lib/components/switch/switch.component.js +1 -0
- package/lib/components/textarea/textarea.component.js +30 -12
- package/lib/components/textbox/textbox.component.js +44 -15
- package/lib/components/textbox/textbox.d.ts +1 -1
- package/lib/components/textbox/textbox.style.d.ts +2 -0
- package/lib/components/textbox/textbox.style.js +49 -0
- package/lib/style/themes/base/base-theme.config.d.ts +2 -0
- package/lib/style/themes/base/base-theme.config.js +3 -1
- package/lib/style/themes/base/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ export interface CommonTextboxProps
|
|
|
20
20
|
"data-role"?: string;
|
|
21
21
|
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
22
22
|
adaptiveLabelBreakpoint?: number;
|
|
23
|
-
/** Integer to determine a timeout for the
|
|
23
|
+
/** Integer to determine a timeout for the deferred callback */
|
|
24
24
|
deferTimeout?: number;
|
|
25
25
|
/** If true, the component will be disabled */
|
|
26
26
|
disabled?: boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
const ErrorBorder = styled.span`
|
|
4
|
+
${({
|
|
5
|
+
warning
|
|
6
|
+
}) => css`
|
|
7
|
+
position: absolute;
|
|
8
|
+
z-index: 6;
|
|
9
|
+
width: 2px;
|
|
10
|
+
height: calc(100% + var(--spacing300));
|
|
11
|
+
background-color: ${warning ? "var(--colorsSemanticCaution500)" : "var(--colorsSemanticNegative500)"};
|
|
12
|
+
left: -12px;
|
|
13
|
+
bottom: 0px;
|
|
14
|
+
`}
|
|
15
|
+
`;
|
|
16
|
+
const StyledHintText = styled.p`
|
|
17
|
+
margin-top: 0px;
|
|
18
|
+
margin-bottom: 8px;
|
|
19
|
+
color: var(--colorsUtilityYin055);
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
`;
|
|
22
|
+
StyledHintText.defaultProps = {
|
|
23
|
+
size: "medium"
|
|
24
|
+
};
|
|
25
|
+
ErrorBorder.propTypes = {
|
|
26
|
+
warning: PropTypes.bool,
|
|
27
|
+
size: PropTypes.string
|
|
28
|
+
};
|
|
29
|
+
ErrorBorder.defaultProps = {
|
|
30
|
+
warning: false,
|
|
31
|
+
size: "medium"
|
|
32
|
+
};
|
|
33
|
+
export { StyledHintText, ErrorBorder };
|
|
@@ -19,9 +19,11 @@ export default (palette => {
|
|
|
19
19
|
focus: palette.gold,
|
|
20
20
|
info: palette.productBlueShade(3),
|
|
21
21
|
warning: palette.carrotOrange,
|
|
22
|
+
warningText: palette.carrotOrangeShade(20),
|
|
22
23
|
destructive: {
|
|
23
24
|
hover: palette.errorRedShade(20)
|
|
24
|
-
}
|
|
25
|
+
},
|
|
26
|
+
placeholder: palette.blackOpacity(0.55)
|
|
25
27
|
},
|
|
26
28
|
disabled: {
|
|
27
29
|
background: palette.slateTint(90)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare var _default: React.MemoExoticComponent<{
|
|
2
|
-
({ name, checked, type, value, inputRef, onChange, autoFocus, ...props }: {
|
|
2
|
+
({ name, checked, type, value, inputRef, onChange, autoFocus, role, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
name: any;
|
|
5
5
|
checked: any;
|
|
@@ -8,6 +8,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
8
8
|
inputRef: any;
|
|
9
9
|
onChange: any;
|
|
10
10
|
autoFocus: any;
|
|
11
|
+
role: any;
|
|
11
12
|
}): JSX.Element;
|
|
12
13
|
propTypes: {
|
|
13
14
|
/** Allows component to be focused on page load */
|
|
@@ -28,6 +29,8 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
28
29
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
30
|
/** HTML type attribute of the input */
|
|
30
31
|
type: PropTypes.Validator<string>;
|
|
32
|
+
/** Role attribute of the input */
|
|
33
|
+
role: PropTypes.Requireable<string>;
|
|
31
34
|
/** Value of the input */
|
|
32
35
|
value: PropTypes.Requireable<string>;
|
|
33
36
|
/** A callback to retrieve the input reference */
|
|
@@ -29,6 +29,7 @@ const HiddenCheckableInput = ({
|
|
|
29
29
|
inputRef,
|
|
30
30
|
onChange,
|
|
31
31
|
autoFocus,
|
|
32
|
+
role,
|
|
32
33
|
...props
|
|
33
34
|
}) => {
|
|
34
35
|
const {
|
|
@@ -73,7 +74,7 @@ const HiddenCheckableInput = ({
|
|
|
73
74
|
"aria-checked": checked,
|
|
74
75
|
checked: checked,
|
|
75
76
|
name: name,
|
|
76
|
-
role: type,
|
|
77
|
+
role: role || type,
|
|
77
78
|
type: type,
|
|
78
79
|
value: value
|
|
79
80
|
}, props, {
|
|
@@ -114,6 +115,9 @@ HiddenCheckableInput.propTypes = {
|
|
|
114
115
|
/** HTML type attribute of the input */
|
|
115
116
|
type: _propTypes.default.string.isRequired,
|
|
116
117
|
|
|
118
|
+
/** Role attribute of the input */
|
|
119
|
+
role: _propTypes.default.string,
|
|
120
|
+
|
|
117
121
|
/** Value of the input */
|
|
118
122
|
value: _propTypes.default.string,
|
|
119
123
|
|
|
@@ -90,9 +90,9 @@ const FormField = ({
|
|
|
90
90
|
labelId: labelId,
|
|
91
91
|
align: labelAlign,
|
|
92
92
|
disabled: disabled,
|
|
93
|
-
error: error,
|
|
94
|
-
warning: warning,
|
|
95
|
-
info: info,
|
|
93
|
+
error: !rest.validationRedesignOptIn && error,
|
|
94
|
+
warning: !rest.validationRedesignOptIn && warning,
|
|
95
|
+
info: !rest.validationRedesignOptIn && info,
|
|
96
96
|
help: labelHelp,
|
|
97
97
|
tooltipId: tooltipId,
|
|
98
98
|
helpTabIndex: helpTabIndex,
|
|
@@ -13,6 +13,8 @@ var _inputPresentation = _interopRequireWildcard(require("./input-presentation.s
|
|
|
13
13
|
|
|
14
14
|
var _inputBehaviour = require("../input-behaviour");
|
|
15
15
|
|
|
16
|
+
var _carbonProvider = require("../../components/carbon-provider/carbon-provider.component");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -37,6 +39,9 @@ const InputPresentation = ({
|
|
|
37
39
|
onMouseEnter,
|
|
38
40
|
onMouseLeave
|
|
39
41
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
42
|
+
const {
|
|
43
|
+
validationRedesignOptIn
|
|
44
|
+
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
40
45
|
const {
|
|
41
46
|
onMouseEnter: onGroupMouseEnter,
|
|
42
47
|
onMouseLeave: onGroupMouseLeave
|
|
@@ -66,7 +71,8 @@ const InputPresentation = ({
|
|
|
66
71
|
size: size,
|
|
67
72
|
warning: warning,
|
|
68
73
|
error: error,
|
|
69
|
-
info: info
|
|
74
|
+
info: info,
|
|
75
|
+
validationRedesignOptIn: validationRedesignOptIn
|
|
70
76
|
}, children));
|
|
71
77
|
};
|
|
72
78
|
|
|
@@ -87,7 +87,8 @@ function stylingForValidations({
|
|
|
87
87
|
error,
|
|
88
88
|
warning,
|
|
89
89
|
info,
|
|
90
|
-
disabled
|
|
90
|
+
disabled,
|
|
91
|
+
validationRedesignOptIn
|
|
91
92
|
}) {
|
|
92
93
|
let validationColor;
|
|
93
94
|
|
|
@@ -98,7 +99,7 @@ function stylingForValidations({
|
|
|
98
99
|
if (error) {
|
|
99
100
|
validationColor = "var(--colorsSemanticNegative500)";
|
|
100
101
|
} else if (warning) {
|
|
101
|
-
validationColor = "var(--colorsSemanticCaution500)";
|
|
102
|
+
validationColor = validationRedesignOptIn ? "var(--colorsUtilityMajor300)" : "var(--colorsSemanticCaution500)";
|
|
102
103
|
} else if (info) {
|
|
103
104
|
validationColor = "var(--colorsSemanticInfo500)";
|
|
104
105
|
} else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./validation-message.component";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _validationMessage.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _validationMessage = _interopRequireDefault(require("./validation-message.component"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ValidationMessageProps {
|
|
3
|
+
/** Indicate that error has occurred
|
|
4
|
+
Pass string to display hint with error */
|
|
5
|
+
error?: boolean | string;
|
|
6
|
+
/** Indicate that warning has occurred
|
|
7
|
+
Pass string to display hint with warning */
|
|
8
|
+
warning?: boolean | string;
|
|
9
|
+
}
|
|
10
|
+
declare const ValidationMessage: ({ error, warning }: ValidationMessageProps) => JSX.Element | null;
|
|
11
|
+
export default ValidationMessage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _validationMessage = _interopRequireDefault(require("./validation-message.style"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const ValidationMessage = ({
|
|
15
|
+
error,
|
|
16
|
+
warning
|
|
17
|
+
}) => {
|
|
18
|
+
const validation = error || warning;
|
|
19
|
+
const isStringValidation = typeof validation === "string";
|
|
20
|
+
return isStringValidation ? /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
|
|
21
|
+
isWarning: !!(!error && warning)
|
|
22
|
+
}, validation) : null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var _default = ValidationMessage;
|
|
26
|
+
exports.default = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
|
|
14
|
+
const StyledValidationMessage = _styledComponents.default.p`
|
|
15
|
+
${({
|
|
16
|
+
isWarning
|
|
17
|
+
}) => (0, _styledComponents.css)`
|
|
18
|
+
color: ${isWarning ? "var(--colorsSemanticCaution600)" : "var(--colorsSemanticNegative500)"};
|
|
19
|
+
font-weight: ${isWarning ? "regular" : "bold"};
|
|
20
|
+
margin-top: 0px;
|
|
21
|
+
margin-bottom: 8px;
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
var _default = StyledValidationMessage;
|
|
25
|
+
exports.default = _default;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
export const NewValidationContext: React.Context<{}>;
|
|
1
2
|
export default CarbonProvider;
|
|
2
|
-
|
|
3
|
+
import React from "react";
|
|
4
|
+
declare function CarbonProvider({ children, theme, validationRedesignOptIn, }: {
|
|
3
5
|
children: any;
|
|
4
6
|
theme?: import("../../style/themes/base").ThemeObject | undefined;
|
|
7
|
+
validationRedesignOptIn?: boolean | undefined;
|
|
5
8
|
}): JSX.Element;
|
|
6
9
|
declare namespace CarbonProvider {
|
|
7
10
|
namespace propTypes {
|
|
8
11
|
const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
9
12
|
const theme: PropTypes.Requireable<object>;
|
|
13
|
+
const validationRedesignOptIn: PropTypes.Requireable<boolean>;
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
import PropTypes from "prop-types";
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.NewValidationContext = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -17,16 +17,29 @@ var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/de
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
const NewValidationContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
25
|
+
exports.NewValidationContext = NewValidationContext;
|
|
26
|
+
|
|
20
27
|
const CarbonProvider = ({
|
|
21
28
|
children,
|
|
22
|
-
theme = _mint.default
|
|
29
|
+
theme = _mint.default,
|
|
30
|
+
validationRedesignOptIn = false
|
|
23
31
|
}) => /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
24
32
|
theme: theme
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null,
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, /*#__PURE__*/_react.default.createElement(NewValidationContext.Provider, {
|
|
34
|
+
value: {
|
|
35
|
+
validationRedesignOptIn
|
|
36
|
+
}
|
|
37
|
+
}, children)));
|
|
26
38
|
|
|
27
39
|
CarbonProvider.propTypes = {
|
|
28
40
|
children: _propTypes.default.node.isRequired,
|
|
29
|
-
theme: _propTypes.default.object
|
|
41
|
+
theme: _propTypes.default.object,
|
|
42
|
+
validationRedesignOptIn: _propTypes.default.bool
|
|
30
43
|
};
|
|
31
44
|
var _default = CarbonProvider;
|
|
32
45
|
exports.default = _default;
|
|
@@ -19,6 +19,8 @@ var _utils = require("../../style/utils");
|
|
|
19
19
|
|
|
20
20
|
var _fieldset = require("./fieldset.style");
|
|
21
21
|
|
|
22
|
+
var _carbonProvider = require("../carbon-provider/carbon-provider.component");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -41,12 +43,16 @@ const Fieldset = props => {
|
|
|
41
43
|
propTypes: Fieldset.propTypes,
|
|
42
44
|
props
|
|
43
45
|
});
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_carbonProvider.NewValidationContext.Provider, {
|
|
47
|
+
value: {
|
|
48
|
+
validationRedesignOptIn: false
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetStyle, _extends({}, (0, _tags.default)("fieldset", props), safeProps, {
|
|
45
51
|
m: 0
|
|
46
52
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetContentStyle, {
|
|
47
53
|
"data-component": "fieldset-style",
|
|
48
54
|
inline: props.inline
|
|
49
|
-
}, legend(), props.children));
|
|
55
|
+
}, legend(), props.children)));
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
Fieldset.propTypes = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default ModalManager;
|
|
2
|
-
|
|
3
|
-
declare class ModalManagerInstance {
|
|
2
|
+
export class ModalManagerInstance {
|
|
4
3
|
addModal: (modal: any, setTriggerRefocusFlag: any) => void;
|
|
5
4
|
isTopmost(modal: any): boolean;
|
|
6
5
|
removeModal(modal: any): void;
|
|
7
6
|
clearList(): void;
|
|
8
7
|
#private;
|
|
9
8
|
}
|
|
9
|
+
declare const ModalManager: ModalManagerInstance;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.ModalManagerInstance = void 0;
|
|
7
7
|
|
|
8
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
9
|
|
|
@@ -13,17 +13,17 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
13
13
|
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
15
|
|
|
16
|
-
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
17
|
-
|
|
18
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
19
|
-
|
|
20
16
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
21
17
|
|
|
22
18
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
23
19
|
|
|
20
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
21
|
+
|
|
22
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
23
|
+
|
|
24
24
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
27
27
|
|
|
28
28
|
var _modalList = /*#__PURE__*/new WeakMap();
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ let ModalManagerInstance = /*#__PURE__*/function () {
|
|
|
37
37
|
|
|
38
38
|
_modalList.set(this, {
|
|
39
39
|
writable: true,
|
|
40
|
-
value:
|
|
40
|
+
value: void 0
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
_defineProperty(this, "addModal", (modal, setTriggerRefocusFlag) => {
|
|
@@ -55,6 +55,14 @@ let ModalManagerInstance = /*#__PURE__*/function () {
|
|
|
55
55
|
setTriggerRefocusFlag
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
+
|
|
59
|
+
// Due to possibility of multiple carbon versions using it
|
|
60
|
+
// it is necessary to maintain same structure in this global variable
|
|
61
|
+
if (!window.__CARBON_INTERNALS_MODAL_LIST) {
|
|
62
|
+
window.__CARBON_INTERNALS_MODAL_LIST = [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
_createClass(ModalManagerInstance, [{
|
|
@@ -98,13 +106,17 @@ let ModalManagerInstance = /*#__PURE__*/function () {
|
|
|
98
106
|
}, {
|
|
99
107
|
key: "clearList",
|
|
100
108
|
value: function clearList() {
|
|
101
|
-
|
|
109
|
+
window.__CARBON_INTERNALS_MODAL_LIST = [];
|
|
110
|
+
|
|
111
|
+
_classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
|
|
102
112
|
}
|
|
103
113
|
}]);
|
|
104
114
|
|
|
105
115
|
return ModalManagerInstance;
|
|
106
116
|
}();
|
|
107
117
|
|
|
118
|
+
exports.ModalManagerInstance = ModalManagerInstance;
|
|
119
|
+
|
|
108
120
|
function _getTopModal2() {
|
|
109
121
|
if (!_classPrivateFieldGet(this, _modalList).length) {
|
|
110
122
|
return {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = /*#__PURE__*/_react.default.createContext({});
|
|
13
|
+
|
|
14
|
+
exports.default = _default;
|
|
@@ -21,6 +21,10 @@ var _numeralDate = require("./numeral-date.style");
|
|
|
21
21
|
|
|
22
22
|
var _textbox = _interopRequireDefault(require("../textbox"));
|
|
23
23
|
|
|
24
|
+
var _textbox2 = require("../textbox/textbox.style");
|
|
25
|
+
|
|
26
|
+
var _validationMessage = _interopRequireDefault(require("../../__internal__/validation-message"));
|
|
27
|
+
|
|
24
28
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
25
29
|
|
|
26
30
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
@@ -31,6 +35,10 @@ var _inputBehaviour = require("../../__internal__/input-behaviour");
|
|
|
31
35
|
|
|
32
36
|
var _tooltipProvider = require("../../__internal__/tooltip-provider");
|
|
33
37
|
|
|
38
|
+
var _carbonProvider = require("../carbon-provider/carbon-provider.component");
|
|
39
|
+
|
|
40
|
+
var _numeralDateContext = _interopRequireDefault(require("./numeral-date-context"));
|
|
41
|
+
|
|
34
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
43
|
|
|
36
44
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -88,6 +96,9 @@ const NumeralDate = ({
|
|
|
88
96
|
...rest
|
|
89
97
|
}) => {
|
|
90
98
|
const l = (0, _useLocale.default)();
|
|
99
|
+
const {
|
|
100
|
+
validationRedesignOptIn
|
|
101
|
+
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
91
102
|
const {
|
|
92
103
|
current: uniqueId
|
|
93
104
|
} = (0, _react.useRef)(id || (0, _guid.default)());
|
|
@@ -188,8 +199,12 @@ const NumeralDate = ({
|
|
|
188
199
|
labelSpacing: labelSpacing,
|
|
189
200
|
fieldHelp: fieldHelp,
|
|
190
201
|
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
|
|
191
|
-
isRequired: required
|
|
192
|
-
|
|
202
|
+
isRequired: required,
|
|
203
|
+
validationRedesignOptIn: validationRedesignOptIn
|
|
204
|
+
}, (0, _utils.filterStyledSystemMarginProps)(rest)), validationRedesignOptIn && labelHelp && /*#__PURE__*/_react.default.createElement(_textbox2.StyledHintText, null, labelHelp), validationRedesignOptIn && /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
|
|
205
|
+
error: internalError,
|
|
206
|
+
warning: internalWarning
|
|
207
|
+
}), /*#__PURE__*/_react.default.createElement(_numeralDate.StyledNumeralDate, {
|
|
193
208
|
name: name,
|
|
194
209
|
onKeyPress: onKeyPress,
|
|
195
210
|
"data-component": "numeral-date"
|
|
@@ -199,7 +214,12 @@ const NumeralDate = ({
|
|
|
199
214
|
const validation = error || warning || info;
|
|
200
215
|
const isStringValidation = typeof validation === "string";
|
|
201
216
|
const hasValidationIcon = isStringValidation && validation.length;
|
|
202
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
217
|
+
return /*#__PURE__*/_react.default.createElement(_numeralDateContext.default.Provider, {
|
|
218
|
+
value: {
|
|
219
|
+
disableErrorBorder: index !== 0
|
|
220
|
+
},
|
|
221
|
+
key: datePart
|
|
222
|
+
}, /*#__PURE__*/_react.default.createElement(_numeralDate.StyledDateField, {
|
|
203
223
|
key: datePart,
|
|
204
224
|
isYearInput: datePart.length === 4,
|
|
205
225
|
isMiddle: isMiddle,
|
|
@@ -222,14 +242,14 @@ const NumeralDate = ({
|
|
|
222
242
|
info: !!info
|
|
223
243
|
}, required && {
|
|
224
244
|
required
|
|
225
|
-
}, isEnd && !validationOnLabel && {
|
|
245
|
+
}, isEnd && !validationRedesignOptIn && !validationOnLabel && {
|
|
226
246
|
error: internalError,
|
|
227
247
|
warning: internalWarning,
|
|
228
248
|
info
|
|
229
249
|
}, {
|
|
230
250
|
size: size,
|
|
231
251
|
tooltipPosition: tooltipPosition
|
|
232
|
-
})));
|
|
252
|
+
}))));
|
|
233
253
|
})))));
|
|
234
254
|
};
|
|
235
255
|
|