carbon-react 144.4.1 → 144.6.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/checkable-input.style.js +5 -2
- package/esm/__internal__/label/label.component.d.ts +4 -2
- package/esm/__internal__/label/label.component.js +3 -1
- package/esm/__internal__/label/label.style.d.ts +2 -0
- package/esm/__internal__/label/label.style.js +5 -1
- package/esm/__internal__/validation-message/validation-message.component.d.ts +3 -1
- package/esm/__internal__/validation-message/validation-message.component.js +4 -2
- package/esm/__internal__/validation-message/validation-message.style.d.ts +1 -0
- package/esm/__internal__/validation-message/validation-message.style.js +11 -7
- package/esm/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/esm/components/date/__internal__/date-formats/index.js +25 -1
- package/esm/components/date/date.component.d.ts +2 -0
- package/esm/components/date/date.component.js +4 -2
- package/esm/components/date-range/date-range.component.d.ts +2 -0
- package/esm/components/date-range/date-range.component.js +3 -2
- package/esm/components/flat-table/flat-table.component.d.ts +3 -1
- package/esm/components/flat-table/flat-table.component.js +3 -1
- package/esm/components/switch/__internal__/switch-slider-panel.style.d.ts +1 -0
- package/esm/components/switch/__internal__/switch-slider-panel.style.js +6 -4
- package/esm/components/switch/__internal__/switch-slider.component.d.ts +2 -1
- package/esm/components/switch/__internal__/switch-slider.component.js +6 -3
- package/esm/components/switch/__internal__/switch-slider.style.d.ts +2 -1
- package/esm/components/switch/__internal__/switch-slider.style.js +7 -6
- package/esm/components/switch/switch.component.d.ts +2 -0
- package/esm/components/switch/switch.component.js +64 -18
- package/esm/components/switch/switch.style.d.ts +6 -1
- package/esm/components/switch/switch.style.js +29 -16
- package/esm/components/time/time.style.d.ts +1 -1
- package/esm/locales/en-gb.js +2 -1
- package/esm/locales/locale.d.ts +1 -0
- package/lib/__internal__/checkable-input/checkable-input.style.js +5 -2
- package/lib/__internal__/label/label.component.d.ts +4 -2
- package/lib/__internal__/label/label.component.js +3 -1
- package/lib/__internal__/label/label.style.d.ts +2 -0
- package/lib/__internal__/label/label.style.js +5 -1
- package/lib/__internal__/validation-message/validation-message.component.d.ts +3 -1
- package/lib/__internal__/validation-message/validation-message.component.js +4 -2
- package/lib/__internal__/validation-message/validation-message.style.d.ts +1 -0
- package/lib/__internal__/validation-message/validation-message.style.js +11 -7
- package/lib/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/lib/components/date/__internal__/date-formats/index.js +25 -1
- package/lib/components/date/date.component.d.ts +2 -0
- package/lib/components/date/date.component.js +4 -2
- package/lib/components/date-range/date-range.component.d.ts +2 -0
- package/lib/components/date-range/date-range.component.js +3 -2
- package/lib/components/flat-table/flat-table.component.d.ts +3 -1
- package/lib/components/flat-table/flat-table.component.js +3 -1
- package/lib/components/switch/__internal__/switch-slider-panel.style.d.ts +1 -0
- package/lib/components/switch/__internal__/switch-slider-panel.style.js +6 -4
- package/lib/components/switch/__internal__/switch-slider.component.d.ts +2 -1
- package/lib/components/switch/__internal__/switch-slider.component.js +6 -3
- package/lib/components/switch/__internal__/switch-slider.style.d.ts +2 -1
- package/lib/components/switch/__internal__/switch-slider.style.js +7 -6
- package/lib/components/switch/switch.component.d.ts +2 -0
- package/lib/components/switch/switch.component.js +64 -18
- package/lib/components/switch/switch.style.d.ts +6 -1
- package/lib/components/switch/switch.style.js +29 -16
- package/lib/components/time/time.style.d.ts +1 -1
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/locale.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
|
-
import
|
|
4
|
-
import FieldHelpStyle from "../../__internal__/field-help/field-help.style";
|
|
3
|
+
import { StyledCheckableInput } from "../../__internal__/checkable-input/checkable-input.style";
|
|
5
4
|
import HiddenCheckableInputStyle from "../../__internal__/checkable-input/hidden-checkable-input.style";
|
|
5
|
+
import FieldHelpStyle from "../../__internal__/field-help/field-help.style";
|
|
6
|
+
import { FieldLineStyle } from "../../__internal__/form-field/form-field.style";
|
|
6
7
|
import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
7
|
-
import { StyledCheckableInput } from "../../__internal__/checkable-input/checkable-input.style";
|
|
8
|
-
import StyledSwitchSlider from "./__internal__/switch-slider.style";
|
|
9
8
|
import StyledValidationIcon from "../../__internal__/validations/validation-icon.style";
|
|
10
|
-
import
|
|
9
|
+
import baseTheme from "../../style/themes/base";
|
|
11
10
|
import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
11
|
+
import StyledSwitchSlider from "./__internal__/switch-slider.style";
|
|
12
12
|
const oldFocusStyling = `
|
|
13
13
|
outline: solid 3px var(--colorsSemanticFocus500);
|
|
14
14
|
`;
|
|
15
15
|
export const ErrorBorder = styled.span`
|
|
16
16
|
${({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
reverse,
|
|
18
|
+
warning,
|
|
19
|
+
isDarkBackground
|
|
20
|
+
}) => {
|
|
21
|
+
const darkBgColour = isDarkBackground ? "var(--colorsSemanticNegative450)" : "var(--colorsSemanticNegative500)";
|
|
22
|
+
return css`
|
|
23
|
+
position: absolute;
|
|
24
|
+
z-index: 6;
|
|
25
|
+
width: 2px;
|
|
26
|
+
background-color: ${warning ? "var(--colorsSemanticCaution500)" : darkBgColour};
|
|
27
|
+
${reverse ? "right" : "left"}: -12px;
|
|
28
|
+
bottom: -4px;
|
|
29
|
+
top: 2px;
|
|
30
|
+
`;
|
|
31
|
+
}}
|
|
27
32
|
`;
|
|
28
33
|
export const StyledHintText = styled.div`
|
|
29
34
|
margin-top: 8px;
|
|
30
35
|
margin-bottom: 8px;
|
|
31
|
-
color: var(--colorsUtilityYin055);
|
|
32
36
|
font-size: 14px;
|
|
33
37
|
font-weight: 400;
|
|
38
|
+
max-width: 160px;
|
|
39
|
+
${({
|
|
40
|
+
isDarkBackground
|
|
41
|
+
}) => css`
|
|
42
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang065)" : "var(--colorsUtilityYin055)"};
|
|
43
|
+
`}
|
|
34
44
|
`;
|
|
35
45
|
const StyledSwitch = styled.div`
|
|
36
46
|
${({
|
|
@@ -51,6 +61,9 @@ const StyledSwitch = styled.div`
|
|
|
51
61
|
`}
|
|
52
62
|
}
|
|
53
63
|
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-flow: ${labelInline ? "row wrap" : "column wrap"};
|
|
66
|
+
|
|
54
67
|
${StyledCheckableInput}, ${HiddenCheckableInputStyle} {
|
|
55
68
|
border: none;
|
|
56
69
|
box-sizing: border-box;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
2
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: import("../../__internal__/label").LabelProps) => import("react").JSX.Element>, any, {}, never>;
|
|
3
3
|
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {
|
|
4
4
|
isDisabled?: boolean | undefined;
|
|
5
5
|
hasError?: boolean | undefined;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ exports.StyledCheckableInputWrapper = exports.StyledCheckableInput = void 0;
|
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _fieldHelp = _interopRequireDefault(require("../field-help/field-help.style"));
|
|
9
9
|
var _formField = require("../form-field/form-field.style");
|
|
10
|
-
var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.style"));
|
|
11
10
|
var _label = _interopRequireWildcard(require("../label/label.style"));
|
|
12
|
-
var _help = _interopRequireDefault(require("../../components/help/help.style"));
|
|
13
11
|
var _validationIcon = _interopRequireDefault(require("../validations/validation-icon.style"));
|
|
12
|
+
var _help = _interopRequireDefault(require("../../components/help/help.style"));
|
|
13
|
+
var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.style"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,6 +27,8 @@ const StyledCheckableInputWrapper = exports.StyledCheckableInputWrapper = _style
|
|
|
27
27
|
labelInline,
|
|
28
28
|
reverse
|
|
29
29
|
}) => (0, _styledComponents.css)`
|
|
30
|
+
width: 100% !important;
|
|
31
|
+
|
|
30
32
|
${_formField.FieldLineStyle} {
|
|
31
33
|
display: flex;
|
|
32
34
|
}
|
|
@@ -95,6 +97,7 @@ const StyledCheckableInputWrapper = exports.StyledCheckableInputWrapper = _style
|
|
|
95
97
|
${inputWidth !== undefined && inputWidth !== 0 && (0, _styledComponents.css)`
|
|
96
98
|
${StyledCheckableInput} {
|
|
97
99
|
width: ${inputWidth}% !important;
|
|
100
|
+
min-width: 67px;
|
|
98
101
|
}
|
|
99
102
|
`}
|
|
100
103
|
|
|
@@ -24,7 +24,9 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
24
24
|
className?: string;
|
|
25
25
|
/** Sets aria-label for label element */
|
|
26
26
|
"aria-label"?: string;
|
|
27
|
+
/** Whether this component is shown against a dark background */
|
|
28
|
+
isDarkBackground?: boolean;
|
|
27
29
|
}
|
|
28
|
-
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
|
|
29
|
-
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element>;
|
|
30
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
|
|
31
|
+
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isDarkBackground, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element>;
|
|
30
32
|
export default _default;
|
|
@@ -43,6 +43,7 @@ const Label = ({
|
|
|
43
43
|
htmlFor,
|
|
44
44
|
info,
|
|
45
45
|
inline,
|
|
46
|
+
isDarkBackground = false,
|
|
46
47
|
isRequired,
|
|
47
48
|
labelId,
|
|
48
49
|
optional,
|
|
@@ -125,7 +126,8 @@ const Label = ({
|
|
|
125
126
|
onMouseLeave: handleMouseLeave,
|
|
126
127
|
isRequired: isRequired,
|
|
127
128
|
as: as,
|
|
128
|
-
"aria-label": ariaLabel
|
|
129
|
+
"aria-label": ariaLabel,
|
|
130
|
+
isDarkBackground: isDarkBackground
|
|
129
131
|
}), children), icon());
|
|
130
132
|
};
|
|
131
133
|
exports.Label = Label;
|
|
@@ -3,6 +3,8 @@ export interface StyledLabelProps {
|
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
/** Flag to configure component as mandatory */
|
|
5
5
|
isRequired?: boolean;
|
|
6
|
+
/** Flag to determine whether to use colours for dark backgrounds */
|
|
7
|
+
isDarkBackground?: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare const StyledLabel: import("styled-components").StyledComponent<"label", any, StyledLabelProps, never>;
|
|
8
10
|
export interface StyledLabelContainerProps {
|
|
@@ -8,7 +8,11 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const StyledLabel = _styledComponents.default.label`
|
|
11
|
-
|
|
11
|
+
${({
|
|
12
|
+
isDarkBackground
|
|
13
|
+
}) => (0, _styledComponents.css)`
|
|
14
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityYin090)"};
|
|
15
|
+
`}
|
|
12
16
|
display: block;
|
|
13
17
|
font-weight: var(--fontWeights500);
|
|
14
18
|
|
|
@@ -8,6 +8,8 @@ export interface ValidationMessageProps {
|
|
|
8
8
|
/** Indicate that warning has occurred
|
|
9
9
|
Pass string to display hint with warning */
|
|
10
10
|
warning?: boolean | string;
|
|
11
|
+
/** Whether this component resides on a dark background */
|
|
12
|
+
isDarkBackground?: boolean;
|
|
11
13
|
}
|
|
12
|
-
declare const ValidationMessage: ({ error, validationId, warning, }: ValidationMessageProps) => React.JSX.Element | null;
|
|
14
|
+
declare const ValidationMessage: ({ error, validationId, warning, isDarkBackground, }: ValidationMessageProps) => React.JSX.Element | null;
|
|
13
15
|
export default ValidationMessage;
|
|
@@ -11,14 +11,16 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
11
11
|
const ValidationMessage = ({
|
|
12
12
|
error,
|
|
13
13
|
validationId,
|
|
14
|
-
warning
|
|
14
|
+
warning,
|
|
15
|
+
isDarkBackground
|
|
15
16
|
}) => {
|
|
16
17
|
const validation = error || warning;
|
|
17
18
|
const isStringValidation = typeof validation === "string";
|
|
18
19
|
return isStringValidation ? /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
|
|
19
20
|
id: validationId,
|
|
20
21
|
isWarning: !!(!error && warning),
|
|
21
|
-
"data-role": "validation-message"
|
|
22
|
+
"data-role": "validation-message",
|
|
23
|
+
isDarkBackground: isDarkBackground
|
|
22
24
|
}, validation) : null;
|
|
23
25
|
};
|
|
24
26
|
var _default = exports.default = ValidationMessage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface StyledValidationMessageProps {
|
|
2
2
|
isWarning?: boolean;
|
|
3
|
+
isDarkBackground?: boolean;
|
|
3
4
|
}
|
|
4
5
|
declare const StyledValidationMessage: import("styled-components").StyledComponent<"p", any, StyledValidationMessageProps, never>;
|
|
5
6
|
export default StyledValidationMessage;
|
|
@@ -9,12 +9,16 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const StyledValidationMessage = _styledComponents.default.p`
|
|
11
11
|
${({
|
|
12
|
-
isWarning
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
isWarning,
|
|
13
|
+
isDarkBackground
|
|
14
|
+
}) => {
|
|
15
|
+
const darkBgColour = isDarkBackground ? "var(--colorsSemanticNegative450)" : "var(--colorsSemanticNegative500)";
|
|
16
|
+
return (0, _styledComponents.css)`
|
|
17
|
+
color: ${isWarning ? "var(--colorsSemanticCaution600)" : darkBgColour};
|
|
18
|
+
font-weight: ${isWarning ? "normal" : "500"};
|
|
19
|
+
margin-top: 0px;
|
|
20
|
+
margin-bottom: 8px;
|
|
21
|
+
`;
|
|
22
|
+
}}
|
|
19
23
|
`;
|
|
20
24
|
var _default = exports.default = StyledValidationMessage;
|
|
@@ -3,5 +3,5 @@ interface LocaleFormats {
|
|
|
3
3
|
formats: string[];
|
|
4
4
|
format: string;
|
|
5
5
|
}
|
|
6
|
-
declare const getFormatData: ({ code }: DateFnsLocale) => LocaleFormats;
|
|
6
|
+
declare const getFormatData: ({ code }: DateFnsLocale, dateFormatOverride?: string) => LocaleFormats;
|
|
7
7
|
export default getFormatData;
|
|
@@ -78,7 +78,31 @@ const getTrailingChar = format => {
|
|
|
78
78
|
};
|
|
79
79
|
const getFormatData = ({
|
|
80
80
|
code = "en-GB"
|
|
81
|
-
}) => {
|
|
81
|
+
}, dateFormatOverride) => {
|
|
82
|
+
if (dateFormatOverride) {
|
|
83
|
+
const {
|
|
84
|
+
format
|
|
85
|
+
} = getOutputFormatForLocale(code);
|
|
86
|
+
let formatFromLocale;
|
|
87
|
+
switch (code) {
|
|
88
|
+
case "en-CA":
|
|
89
|
+
case "en-US":
|
|
90
|
+
formatFromLocale = "MM/dd/yyyy";
|
|
91
|
+
break;
|
|
92
|
+
case "ar-EG":
|
|
93
|
+
case "en-ZA":
|
|
94
|
+
case "fr-CA":
|
|
95
|
+
formatFromLocale = "dd/MM/yyyy";
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
formatFromLocale = format;
|
|
99
|
+
}
|
|
100
|
+
const formatsForLocale = getInputFormatsArrayForLocale(formatFromLocale);
|
|
101
|
+
return {
|
|
102
|
+
format: dateFormatOverride,
|
|
103
|
+
formats: generateFormats(formatsForLocale, "/")
|
|
104
|
+
};
|
|
105
|
+
}
|
|
82
106
|
if (["en-CA", "en-US"].includes(code)) {
|
|
83
107
|
const format = "MM/dd/yyyy";
|
|
84
108
|
const formats = getInputFormatsArrayForLocale(format);
|
|
@@ -42,6 +42,8 @@ export interface DateInputProps extends Omit<TextboxProps, "value" | "formattedV
|
|
|
42
42
|
onPickerOpen?: () => void;
|
|
43
43
|
/** Callback triggered when the picker is closed */
|
|
44
44
|
onPickerClose?: () => void;
|
|
45
|
+
/** Date format string to be applied to the date inputs */
|
|
46
|
+
dateFormatOverride?: string;
|
|
45
47
|
}
|
|
46
48
|
export declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
47
49
|
export default DateInput;
|
|
@@ -61,12 +61,13 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
61
61
|
const blockClose = (0, _react.useRef)(false);
|
|
62
62
|
const locale = (0, _useLocale.default)();
|
|
63
63
|
const {
|
|
64
|
-
dateFnsLocale
|
|
64
|
+
dateFnsLocale,
|
|
65
|
+
dateFormatOverride
|
|
65
66
|
} = locale.date;
|
|
66
67
|
const {
|
|
67
68
|
format,
|
|
68
69
|
formats
|
|
69
|
-
} = (0, _react.useMemo)(() => (0, _dateFormats.default)(dateFnsLocale()), [dateFnsLocale]);
|
|
70
|
+
} = (0, _react.useMemo)(() => (0, _dateFormats.default)(dateFnsLocale(), dateFormatOverride), [dateFnsLocale, dateFormatOverride]);
|
|
70
71
|
const {
|
|
71
72
|
inputRefMap,
|
|
72
73
|
setInputRefMap
|
|
@@ -489,6 +490,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
489
490
|
"data-element": _propTypes.default.string,
|
|
490
491
|
"data-role": _propTypes.default.string,
|
|
491
492
|
"datatype": _propTypes.default.string,
|
|
493
|
+
"dateFormatOverride": _propTypes.default.string,
|
|
492
494
|
"defaultChecked": _propTypes.default.bool,
|
|
493
495
|
"defaultValue": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.number, _propTypes.default.string]),
|
|
494
496
|
"dir": _propTypes.default.string,
|
|
@@ -85,6 +85,8 @@ export interface DateRangeProps extends StyledDateRangeProps, MarginProps, TagPr
|
|
|
85
85
|
required?: boolean;
|
|
86
86
|
/** Flag to configure component as optional. */
|
|
87
87
|
isOptional?: boolean;
|
|
88
|
+
/** Date format string to be applied to the date inputs */
|
|
89
|
+
dateFormatOverride?: string;
|
|
88
90
|
}
|
|
89
91
|
export declare const DateRange: {
|
|
90
92
|
({ endDateProps, id, labelsInline, name, onBlur, onChange, startDateProps, tooltipPosition, validationOnLabel, value, startRef, endRef, required, isOptional, ...rest }: DateRangeProps): React.JSX.Element;
|
|
@@ -44,11 +44,12 @@ const DateRange = ({
|
|
|
44
44
|
const labelsInlineWithNewValidation = validationRedesignOptIn ? false : labelsInline;
|
|
45
45
|
const l = (0, _useLocale.default)();
|
|
46
46
|
const {
|
|
47
|
-
dateFnsLocale
|
|
47
|
+
dateFnsLocale,
|
|
48
|
+
dateFormatOverride
|
|
48
49
|
} = l.date;
|
|
49
50
|
const {
|
|
50
51
|
format
|
|
51
|
-
} = (0, _react.useMemo)(() => (0, _dateFormats.default)(dateFnsLocale()), [dateFnsLocale]);
|
|
52
|
+
} = (0, _react.useMemo)(() => (0, _dateFormats.default)(dateFnsLocale(), dateFormatOverride), [dateFnsLocale, dateFormatOverride]);
|
|
52
53
|
const inlineLabelWidth = 40;
|
|
53
54
|
const [lastChangedDate, setLastChangedDate] = (0, _react.useState)("");
|
|
54
55
|
const computedValue = (0, _react.useCallback)(valueString => {
|
|
@@ -35,9 +35,11 @@ export interface FlatTableProps extends MarginProps, Omit<TagProps, "data-compon
|
|
|
35
35
|
overflowX?: string;
|
|
36
36
|
/** Width of the table. Any valid CSS string */
|
|
37
37
|
width?: string;
|
|
38
|
+
/** The title to describe the table when one or more tables are used on a single page */
|
|
39
|
+
title?: string;
|
|
38
40
|
}
|
|
39
41
|
export declare const FlatTable: {
|
|
40
|
-
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
42
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, title, ...rest }: FlatTableProps): React.JSX.Element;
|
|
41
43
|
displayName: string;
|
|
42
44
|
};
|
|
43
45
|
export default FlatTable;
|
|
@@ -32,6 +32,7 @@ const FlatTable = ({
|
|
|
32
32
|
minHeight,
|
|
33
33
|
overflowX,
|
|
34
34
|
width,
|
|
35
|
+
title,
|
|
35
36
|
...rest
|
|
36
37
|
}) => {
|
|
37
38
|
const wrapperRef = (0, _react.useRef)(null);
|
|
@@ -171,7 +172,8 @@ const FlatTable = ({
|
|
|
171
172
|
onKeyDown: handleKeyDown,
|
|
172
173
|
isFocused: focused
|
|
173
174
|
}, rest, {
|
|
174
|
-
"data-component": "flat-table-wrapper"
|
|
175
|
+
"data-component": "flat-table-wrapper",
|
|
176
|
+
title: title
|
|
175
177
|
}), /*#__PURE__*/_react.default.createElement(_flatTable.StyledTableContainer, {
|
|
176
178
|
ref: container,
|
|
177
179
|
onFocus: () => {
|
|
@@ -2,6 +2,7 @@ import { SwitchProps } from "../switch.component";
|
|
|
2
2
|
export interface SwitchSliderPanelProps {
|
|
3
3
|
isLoading?: boolean;
|
|
4
4
|
size?: SwitchProps["size"];
|
|
5
|
+
isDarkBackground?: boolean;
|
|
5
6
|
}
|
|
6
7
|
declare const SwitchSliderPanel: import("styled-components").StyledComponent<"div", any, SwitchSliderPanelProps, never>;
|
|
7
8
|
export default SwitchSliderPanel;
|
|
@@ -5,29 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
-
var _loader = _interopRequireDefault(require("../../loader/loader.style"));
|
|
9
8
|
var _loaderSquare = _interopRequireDefault(require("../../loader/loader-square.style"));
|
|
9
|
+
var _loader = _interopRequireDefault(require("../../loader/loader.style"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
const SwitchSliderPanel = _styledComponents.default.div`
|
|
14
14
|
${({
|
|
15
15
|
isLoading,
|
|
16
|
-
size
|
|
16
|
+
size,
|
|
17
|
+
isDarkBackground
|
|
17
18
|
}) => (0, _styledComponents.css)`
|
|
18
19
|
border: 0;
|
|
19
|
-
color: var(--colorsActionMinorYang100);
|
|
20
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsActionMinorYang100)"};
|
|
20
21
|
margin: auto;
|
|
21
22
|
position: absolute;
|
|
22
23
|
left: 0;
|
|
23
24
|
|
|
24
25
|
&[type="on"] {
|
|
26
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsUtilityYang100)"};
|
|
25
27
|
margin-left: 9px;
|
|
26
28
|
padding-right: ${size === "large" ? "43px" : "27px"};
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
&[type="off"] {
|
|
30
|
-
color: var(--colorsActionMinor500);
|
|
32
|
+
color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor500)"};
|
|
31
33
|
margin-right: 9px;
|
|
32
34
|
padding-left: ${size === "large" ? "43px" : "27px"};
|
|
33
35
|
}
|
|
@@ -6,6 +6,7 @@ export interface SwitchSliderProps extends ValidationProps {
|
|
|
6
6
|
loading?: boolean;
|
|
7
7
|
size?: "small" | "large";
|
|
8
8
|
useValidationIcon?: boolean;
|
|
9
|
+
isDarkBackground?: boolean;
|
|
9
10
|
}
|
|
10
|
-
declare const SwitchSlider: ({ checked, disabled, loading, size, error, warning, info, useValidationIcon, }: SwitchSliderProps) => React.JSX.Element;
|
|
11
|
+
declare const SwitchSlider: ({ checked, disabled, loading, size, error, warning, info, useValidationIcon, isDarkBackground, }: SwitchSliderProps) => React.JSX.Element;
|
|
11
12
|
export default SwitchSlider;
|
|
@@ -21,7 +21,8 @@ const SwitchSlider = ({
|
|
|
21
21
|
error,
|
|
22
22
|
warning,
|
|
23
23
|
info,
|
|
24
|
-
useValidationIcon
|
|
24
|
+
useValidationIcon,
|
|
25
|
+
isDarkBackground
|
|
25
26
|
}) => {
|
|
26
27
|
const locale = (0, _useLocale.default)();
|
|
27
28
|
const onText = locale.switch.on();
|
|
@@ -38,13 +39,15 @@ const SwitchSlider = ({
|
|
|
38
39
|
size,
|
|
39
40
|
error,
|
|
40
41
|
warning,
|
|
41
|
-
info
|
|
42
|
+
info,
|
|
43
|
+
isDarkBackground
|
|
42
44
|
};
|
|
43
45
|
const sliderPanelStyleProps = {
|
|
44
46
|
isLoading: loading,
|
|
45
47
|
size,
|
|
46
48
|
type: checked ? "on" : "off",
|
|
47
|
-
disabled
|
|
49
|
+
disabled,
|
|
50
|
+
isDarkBackground
|
|
48
51
|
};
|
|
49
52
|
const loaderProps = {
|
|
50
53
|
isInsideButton: true,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SwitchSliderProps } from "./switch-slider.component";
|
|
2
1
|
import { ThemeObject } from "../../../style/themes/base";
|
|
2
|
+
import { SwitchSliderProps } from "./switch-slider.component";
|
|
3
3
|
interface StyledSwitchSliderProps extends Pick<SwitchSliderProps, "checked" | "disabled" | "size" | "error" | "warning"> {
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
theme?: Partial<ThemeObject>;
|
|
6
|
+
isDarkBackground?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare const StyledSwitchSlider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
9
|
declare const HiddenContent: import("styled-components").StyledComponent<"div", any, Pick<StyledSwitchSliderProps, "size">, never>;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.StyledSwitchSlider = exports.HiddenContent = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
-
var _switchSliderPanel = _interopRequireDefault(require("./switch-slider-panel.style"));
|
|
9
8
|
var _validationIcon = _interopRequireDefault(require("../../../__internal__/validations/validation-icon.style"));
|
|
10
9
|
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
10
|
+
var _switchSliderPanel = _interopRequireDefault(require("./switch-slider-panel.style"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -19,7 +19,8 @@ const StyledSwitchSlider = exports.StyledSwitchSlider = _styledComponents.defaul
|
|
|
19
19
|
size,
|
|
20
20
|
error,
|
|
21
21
|
warning,
|
|
22
|
-
theme
|
|
22
|
+
theme,
|
|
23
|
+
isDarkBackground
|
|
23
24
|
}) => (0, _styledComponents.css)`
|
|
24
25
|
display: flex;
|
|
25
26
|
font-size: 12px;
|
|
@@ -34,14 +35,14 @@ const StyledSwitchSlider = exports.StyledSwitchSlider = _styledComponents.defaul
|
|
|
34
35
|
z-index: 2;
|
|
35
36
|
border-radius: ${theme?.roundedCornersOptOut ? "90px" : "var(--borderRadius400)"};
|
|
36
37
|
border-style: solid;
|
|
37
|
-
border-color: var(--colorsActionMinor400);
|
|
38
|
+
border-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor400)"};
|
|
38
39
|
border-width: var(--borderWidth200);
|
|
39
40
|
box-sizing: border-box;
|
|
40
41
|
margin-top: ${size === "large" ? "-47px" : "-28px"};
|
|
41
42
|
align-items: center;
|
|
42
43
|
|
|
43
44
|
&::before {
|
|
44
|
-
background-color: var(--colorsActionMinor400);
|
|
45
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor400)"};
|
|
45
46
|
bottom: 4px;
|
|
46
47
|
content: "";
|
|
47
48
|
height: ${size === "large" ? "var(--spacing400)" : "var(--spacing200)"};
|
|
@@ -54,7 +55,7 @@ const StyledSwitchSlider = exports.StyledSwitchSlider = _styledComponents.defaul
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
${checked && (0, _styledComponents.css)`
|
|
57
|
-
background-color: var(--colorsActionMinor500);
|
|
58
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYang100)" : "var(--colorsActionMinor500)"};
|
|
58
59
|
border-color: var(--colorsActionMinorTransparent);
|
|
59
60
|
|
|
60
61
|
&::before {
|
|
@@ -62,7 +63,7 @@ const StyledSwitchSlider = exports.StyledSwitchSlider = _styledComponents.defaul
|
|
|
62
63
|
100% -
|
|
63
64
|
${size === "large" ? "var(--spacing500)" : "var(--spacing300)"}
|
|
64
65
|
);
|
|
65
|
-
background-color: var(--colorsActionMinorYang100);
|
|
66
|
+
background-color: ${isDarkBackground ? "var(--colorsUtilityYin100)" : "var(--colorsActionMinorYang100)"};
|
|
66
67
|
}
|
|
67
68
|
`}
|
|
68
69
|
|
|
@@ -24,6 +24,8 @@ export interface SwitchProps extends CommonCheckableInputProps, MarginProps {
|
|
|
24
24
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
25
25
|
/** [Legacy] Aria label for rendered help component */
|
|
26
26
|
helpAriaLabel?: string;
|
|
27
|
+
/** Whether this component resides on a dark background */
|
|
28
|
+
isDarkBackground?: boolean;
|
|
27
29
|
}
|
|
28
30
|
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
29
31
|
export default Switch;
|