carbon-react 149.0.2 → 150.1.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__/hint-text/hint-text.component.d.ts +25 -0
- package/esm/__internal__/hint-text/hint-text.component.js +34 -0
- package/esm/__internal__/hint-text/hint-text.style.d.ts +3 -0
- package/esm/__internal__/hint-text/hint-text.style.js +50 -0
- package/esm/__internal__/hint-text/index.d.ts +2 -0
- package/esm/__internal__/hint-text/index.js +1 -0
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +5 -3
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +0 -3
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.js +0 -12
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +7 -4
- package/esm/components/checkbox/checkbox-group/checkbox-group.style.d.ts +0 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.style.js +0 -6
- package/esm/components/date/__internal__/date-fns-fp/index.d.ts +7 -7
- package/esm/components/date/__internal__/date-fns-fp/index.js +7 -7
- package/esm/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/esm/components/date/__internal__/date-formats/index.js +2 -3
- package/esm/components/date/__internal__/date-picker/date-picker.component.js +1 -10
- package/esm/components/date/__internal__/utils.d.ts +1 -1
- package/esm/components/file-input/file-input.component.js +3 -2
- package/esm/components/numeral-date/numeral-date.component.js +4 -2
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +7 -4
- package/esm/components/radio-button/radio-button-group/radio-button-group.style.d.ts +0 -1
- package/esm/components/radio-button/radio-button-group/radio-button-group.style.js +0 -6
- package/esm/components/switch/switch.component.js +7 -3
- package/esm/components/switch/switch.style.d.ts +0 -4
- package/esm/components/switch/switch.style.js +0 -12
- package/esm/components/text-editor/text-editor.component.js +5 -4
- package/esm/components/text-editor/text-editor.style.d.ts +0 -1
- package/esm/components/text-editor/text-editor.style.js +0 -10
- package/esm/components/textarea/textarea.component.js +4 -2
- package/esm/components/textbox/textbox.component.d.ts +1 -1
- package/esm/components/textbox/textbox.component.js +14 -11
- package/esm/components/textbox/textbox.style.d.ts +1 -2
- package/esm/components/textbox/textbox.style.js +1 -11
- package/esm/components/time/time.component.js +7 -5
- package/esm/components/time/time.style.d.ts +2 -5
- package/esm/components/time/time.style.js +2 -13
- package/esm/locales/de-de.js +1 -1
- package/esm/locales/en-ca.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/en-us.js +1 -1
- package/esm/locales/es-es.js +1 -1
- package/esm/locales/fr-ca.js +1 -1
- package/esm/locales/fr-fr.js +1 -1
- package/lib/__internal__/hint-text/hint-text.component.d.ts +25 -0
- package/lib/__internal__/hint-text/hint-text.component.js +44 -0
- package/lib/__internal__/hint-text/hint-text.style.d.ts +3 -0
- package/lib/__internal__/hint-text/hint-text.style.js +58 -0
- package/lib/__internal__/hint-text/index.d.ts +2 -0
- package/lib/__internal__/hint-text/index.js +13 -0
- package/lib/__internal__/hint-text/package.json +6 -0
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +5 -3
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +0 -3
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.js +1 -13
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +8 -5
- package/lib/components/checkbox/checkbox-group/checkbox-group.style.d.ts +0 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.style.js +1 -7
- package/lib/components/date/__internal__/date-fns-fp/index.d.ts +7 -7
- package/lib/components/date/__internal__/date-fns-fp/index.js +14 -15
- package/lib/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/lib/components/date/__internal__/date-formats/index.js +2 -3
- package/lib/components/date/__internal__/date-picker/date-picker.component.js +1 -10
- package/lib/components/date/__internal__/utils.d.ts +1 -1
- package/lib/components/file-input/file-input.component.js +4 -3
- package/lib/components/numeral-date/numeral-date.component.js +5 -3
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +8 -5
- package/lib/components/radio-button/radio-button-group/radio-button-group.style.d.ts +0 -1
- package/lib/components/radio-button/radio-button-group/radio-button-group.style.js +1 -7
- package/lib/components/switch/switch.component.js +6 -2
- package/lib/components/switch/switch.style.d.ts +0 -4
- package/lib/components/switch/switch.style.js +1 -13
- package/lib/components/text-editor/text-editor.component.js +4 -3
- package/lib/components/text-editor/text-editor.style.d.ts +0 -1
- package/lib/components/text-editor/text-editor.style.js +1 -11
- package/lib/components/textarea/textarea.component.js +5 -3
- package/lib/components/textbox/textbox.component.d.ts +1 -1
- package/lib/components/textbox/textbox.component.js +15 -12
- package/lib/components/textbox/textbox.style.d.ts +1 -2
- package/lib/components/textbox/textbox.style.js +3 -12
- package/lib/components/time/time.component.js +8 -6
- package/lib/components/time/time.style.d.ts +2 -5
- package/lib/components/time/time.style.js +3 -14
- package/lib/locales/de-de.js +2 -3
- package/lib/locales/en-ca.js +2 -3
- package/lib/locales/en-gb.js +2 -3
- package/lib/locales/en-us.js +2 -3
- package/lib/locales/es-es.js +2 -3
- package/lib/locales/fr-ca.js +2 -3
- package/lib/locales/fr-fr.js +2 -3
- package/package.json +2 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface HintTextProps {
|
|
3
|
+
/** The alignment of the hint text */
|
|
4
|
+
align?: "left" | "right";
|
|
5
|
+
/** Children elements */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/** Sets the font weight for the hint text */
|
|
8
|
+
fontWeight?: string;
|
|
9
|
+
/** Sets the id for the component. */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** Indicates whether the parent component is inline. */
|
|
12
|
+
isComponentInline?: boolean;
|
|
13
|
+
/** Indicates whether the parent component has a dark background. */
|
|
14
|
+
isDarkBackground?: boolean;
|
|
15
|
+
/** Indicates whether the parent component is disabled. */
|
|
16
|
+
isDisabled?: boolean;
|
|
17
|
+
/** Margin bottom for the hint text */
|
|
18
|
+
marginBottom?: string;
|
|
19
|
+
/** Margin top for the hint text */
|
|
20
|
+
marginTop?: string;
|
|
21
|
+
/** Max width for the hint text */
|
|
22
|
+
maxWidth?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const HintText: ({ align, children, fontWeight, id, isComponentInline, isDarkBackground, isDisabled, marginBottom, marginTop, maxWidth, }: HintTextProps) => React.JSX.Element | null;
|
|
25
|
+
export default HintText;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import StyledHintText from "./hint-text.style";
|
|
4
|
+
import NewValidationContext from "../../components/carbon-provider/__internal__/new-validation.context";
|
|
5
|
+
export const HintText = ({
|
|
6
|
+
align,
|
|
7
|
+
children,
|
|
8
|
+
fontWeight,
|
|
9
|
+
id,
|
|
10
|
+
isComponentInline = false,
|
|
11
|
+
isDarkBackground = false,
|
|
12
|
+
isDisabled = false,
|
|
13
|
+
marginBottom = "var(--spacing100)",
|
|
14
|
+
marginTop = "var(--spacing000)",
|
|
15
|
+
maxWidth
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
validationRedesignOptIn
|
|
19
|
+
} = useContext(NewValidationContext);
|
|
20
|
+
if (isComponentInline && !validationRedesignOptIn) return null;
|
|
21
|
+
return /*#__PURE__*/React.createElement(StyledHintText, {
|
|
22
|
+
align: align,
|
|
23
|
+
"data-element": "input-hint",
|
|
24
|
+
"data-role": "hint-text",
|
|
25
|
+
fontWeight: fontWeight,
|
|
26
|
+
id: id,
|
|
27
|
+
isDarkBackground: isDarkBackground,
|
|
28
|
+
isDisabled: isDisabled,
|
|
29
|
+
marginBottom: marginBottom,
|
|
30
|
+
marginTop: marginTop,
|
|
31
|
+
maxWidth: maxWidth
|
|
32
|
+
}, children);
|
|
33
|
+
};
|
|
34
|
+
export default HintText;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const getColor = (isDarkBackground, isDisabled) => {
|
|
3
|
+
if (isDarkBackground) {
|
|
4
|
+
return "var(--colorsUtilityYang080)";
|
|
5
|
+
}
|
|
6
|
+
if (isDisabled) {
|
|
7
|
+
return "var(--colorsUtilityYin030)";
|
|
8
|
+
}
|
|
9
|
+
return "var(--colorsUtilityYin055)";
|
|
10
|
+
};
|
|
11
|
+
const StyledHintText = styled.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
|
|
16
|
+
${({
|
|
17
|
+
align
|
|
18
|
+
}) => css`
|
|
19
|
+
justify-content: ${align !== "right" ? "flex-start" : "flex-end"};
|
|
20
|
+
`}
|
|
21
|
+
margin-bottom: ${({
|
|
22
|
+
marginBottom
|
|
23
|
+
}) => marginBottom};
|
|
24
|
+
margin-top: ${({
|
|
25
|
+
marginTop
|
|
26
|
+
}) => marginTop};
|
|
27
|
+
|
|
28
|
+
${({
|
|
29
|
+
isDarkBackground,
|
|
30
|
+
isDisabled
|
|
31
|
+
}) => css`
|
|
32
|
+
color: ${getColor(isDarkBackground, isDisabled)};
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
${({
|
|
36
|
+
fontWeight
|
|
37
|
+
}) => fontWeight && css`
|
|
38
|
+
font-weight: ${fontWeight};
|
|
39
|
+
`}
|
|
40
|
+
${({
|
|
41
|
+
maxWidth
|
|
42
|
+
}) => maxWidth && css`
|
|
43
|
+
max-width: ${maxWidth};
|
|
44
|
+
`}
|
|
45
|
+
|
|
46
|
+
::after {
|
|
47
|
+
content: " ";
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
export default StyledHintText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./hint-text.component";
|
|
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import invariant from "invariant";
|
|
5
5
|
import FormField from "../../../__internal__/form-field";
|
|
6
6
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
7
|
-
import StyledButtonToggleGroup
|
|
7
|
+
import StyledButtonToggleGroup from "./button-toggle-group.style";
|
|
8
8
|
import { ButtonToggle } from "..";
|
|
9
9
|
import { filterStyledSystemMarginProps } from "../../../style/utils";
|
|
10
10
|
import { TooltipProvider } from "../../../__internal__/tooltip-provider";
|
|
@@ -12,6 +12,7 @@ import { InputGroupBehaviour } from "../../../__internal__/input-behaviour";
|
|
|
12
12
|
import Events from "../../../__internal__/utils/helpers/events";
|
|
13
13
|
import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
|
|
14
14
|
import ButtonToggleGroupContext from "./__internal__/button-toggle-group.context";
|
|
15
|
+
import HintText from "../../../__internal__/hint-text";
|
|
15
16
|
const BUTTON_TOGGLE_SELECTOR = '[data-element="button-toggle-button"]';
|
|
16
17
|
const ButtonToggleGroup = ({
|
|
17
18
|
children,
|
|
@@ -129,9 +130,10 @@ const ButtonToggleGroup = ({
|
|
|
129
130
|
childButtonCallbackRef,
|
|
130
131
|
hintTextId: inputHint ? hintTextId.current : undefined
|
|
131
132
|
}
|
|
132
|
-
}, inputHint && /*#__PURE__*/React.createElement(
|
|
133
|
+
}, inputHint && /*#__PURE__*/React.createElement(HintText, {
|
|
133
134
|
id: hintTextId.current,
|
|
134
|
-
isDisabled: disabled
|
|
135
|
+
isDisabled: disabled,
|
|
136
|
+
marginBottom: "var(--spacing150)"
|
|
135
137
|
}, inputHint), /*#__PURE__*/React.createElement(StyledButtonToggleGroup, _extends({
|
|
136
138
|
ref: wrapperRef
|
|
137
139
|
}, label ? {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ButtonToggleGroupProps } from ".";
|
|
2
2
|
declare type StyledButtonToggleGroupProps = Pick<ButtonToggleGroupProps, "inputWidth" | "fullWidth" | "disabled" | "labelInline">;
|
|
3
3
|
declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, StyledButtonToggleGroupProps, never>;
|
|
4
|
-
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
-
isDisabled?: boolean | undefined;
|
|
6
|
-
}, never>;
|
|
7
4
|
export default StyledButtonToggleGroup;
|
|
@@ -41,18 +41,6 @@ const StyledButtonToggleGroup = styled.div`
|
|
|
41
41
|
width: ${`${inputWidth}%`};
|
|
42
42
|
`}
|
|
43
43
|
`;
|
|
44
|
-
export const StyledHintText = styled.div`
|
|
45
|
-
::after {
|
|
46
|
-
content: " ";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
margin-top: var(--spacing000);
|
|
50
|
-
margin-bottom: var(--spacing150);
|
|
51
|
-
color: ${({
|
|
52
|
-
isDisabled
|
|
53
|
-
}) => isDisabled ? "var(--colorsUtilityYin030)" : "var(--colorsUtilityYin055)"};
|
|
54
|
-
font-size: 14px;
|
|
55
|
-
`;
|
|
56
44
|
StyledButtonToggleGroup.defaultProps = {
|
|
57
45
|
theme: baseTheme
|
|
58
46
|
};
|
|
@@ -2,7 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { useContext, useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
|
-
import StyledCheckboxGroup
|
|
5
|
+
import StyledCheckboxGroup from "./checkbox-group.style";
|
|
6
6
|
import Fieldset from "../../../__internal__/fieldset";
|
|
7
7
|
import { filterStyledSystemMarginProps } from "../../../style/utils";
|
|
8
8
|
import { TooltipProvider } from "../../../__internal__/tooltip-provider";
|
|
@@ -10,10 +10,11 @@ import FormSpacingProvider from "../../../__internal__/form-spacing-provider";
|
|
|
10
10
|
import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
|
|
11
11
|
import ValidationMessage from "../../../__internal__/validation-message/validation-message.component";
|
|
12
12
|
import Box from "../../box";
|
|
13
|
-
import
|
|
13
|
+
import ErrorBorder from "../../textbox/textbox.style";
|
|
14
14
|
import CheckboxGroupContext from "./__internal__/checkbox-group.context";
|
|
15
15
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
16
16
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility";
|
|
17
|
+
import HintText from "../../../__internal__/hint-text";
|
|
17
18
|
export const CheckboxGroup = ({
|
|
18
19
|
children,
|
|
19
20
|
legend,
|
|
@@ -61,8 +62,10 @@ export const CheckboxGroup = ({
|
|
|
61
62
|
"aria-describedby": combinedAriaDescribedBy
|
|
62
63
|
}, tagComponent("checkboxgroup", rest), {
|
|
63
64
|
blockGroupBehaviour: !(error || warning)
|
|
64
|
-
}, filterStyledSystemMarginProps(rest)), legendHelp && /*#__PURE__*/React.createElement(
|
|
65
|
-
|
|
65
|
+
}, filterStyledSystemMarginProps(rest)), legendHelp && /*#__PURE__*/React.createElement(HintText, {
|
|
66
|
+
align: legendAlign,
|
|
67
|
+
id: inputHintId,
|
|
68
|
+
marginTop: "-4px"
|
|
66
69
|
}, legendHelp), /*#__PURE__*/React.createElement(Box, {
|
|
67
70
|
position: "relative"
|
|
68
71
|
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
@@ -4,12 +4,6 @@ import StyledIcon from "../../icon/icon.style";
|
|
|
4
4
|
import CheckboxStyle from "../checkbox.style";
|
|
5
5
|
import { StyledLabelContainer } from "../../../__internal__/label/label.style";
|
|
6
6
|
import StyledValidationIcon from "../../../__internal__/validations/validation-icon.style";
|
|
7
|
-
export const StyledHintText = styled.div`
|
|
8
|
-
margin-top: -4px;
|
|
9
|
-
margin-bottom: 8px;
|
|
10
|
-
color: var(--colorsUtilityYin055);
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
`;
|
|
13
7
|
const StyledCheckboxGroup = styled.div`
|
|
14
8
|
display: flex;
|
|
15
9
|
flex-direction: column;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export { format } from "date-fns/fp/format";
|
|
2
|
+
export { formatISO } from "date-fns/fp/formatISO";
|
|
3
|
+
export { isMatch } from "date-fns/fp/isMatch";
|
|
4
|
+
export { isValid } from "date-fns/fp/isValid";
|
|
5
|
+
export { parse } from "date-fns/fp/parse";
|
|
6
|
+
export { parseWithOptions } from "date-fns/fp/parseWithOptions";
|
|
7
|
+
export { parseISO } from "date-fns/fp/parseISO";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Separate index.ts to export only required sub-modules from date-fns/fp
|
|
2
2
|
// import { format, formatISO, isMatch, parse, parseISO } from "date-fns/fp" adds extra 300kb to bundle size.
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
3
|
+
export { format } from "date-fns/fp/format";
|
|
4
|
+
export { formatISO } from "date-fns/fp/formatISO";
|
|
5
|
+
export { isMatch } from "date-fns/fp/isMatch";
|
|
6
|
+
export { isValid } from "date-fns/fp/isValid";
|
|
7
|
+
export { parse } from "date-fns/fp/parse";
|
|
8
|
+
export { parseWithOptions } from "date-fns/fp/parseWithOptions";
|
|
9
|
+
export { parseISO } from "date-fns/fp/parseISO";
|
|
@@ -3,5 +3,5 @@ interface LocaleFormats {
|
|
|
3
3
|
formats: string[];
|
|
4
4
|
format: string;
|
|
5
5
|
}
|
|
6
|
-
declare const getFormatData: (
|
|
6
|
+
declare const getFormatData: (locale?: Partial<Pick<DateFnsLocale, "code">>, dateFormatOverride?: string) => LocaleFormats;
|
|
7
7
|
export default getFormatData;
|
|
@@ -70,9 +70,8 @@ const getTrailingChar = format => {
|
|
|
70
70
|
const lastChar = format.split("").pop();
|
|
71
71
|
return ["y", "M", "d"].includes(lastChar) ? "" : lastChar;
|
|
72
72
|
};
|
|
73
|
-
const getFormatData = ({
|
|
74
|
-
code = "en-GB"
|
|
75
|
-
}, dateFormatOverride) => {
|
|
73
|
+
const getFormatData = (locale, dateFormatOverride) => {
|
|
74
|
+
const code = locale?.code || "en-GB";
|
|
76
75
|
if (dateFormatOverride) {
|
|
77
76
|
const {
|
|
78
77
|
format
|
|
@@ -40,12 +40,6 @@ export const DatePicker = ({
|
|
|
40
40
|
const {
|
|
41
41
|
weekStartsOn
|
|
42
42
|
} = options || /* istanbul ignore next */{};
|
|
43
|
-
const monthsLong = useMemo(() => Array.from({
|
|
44
|
-
length: 12
|
|
45
|
-
}).map((_, i) => {
|
|
46
|
-
const month = localize?.month(i);
|
|
47
|
-
return month[0].toUpperCase() + month.slice(1);
|
|
48
|
-
}), [localize]);
|
|
49
43
|
const weekdaysLong = useMemo(() => Array.from({
|
|
50
44
|
length: 7
|
|
51
45
|
}).map((_, i) => localize?.day(i)), [localize]);
|
|
@@ -156,10 +150,7 @@ export const DatePicker = ({
|
|
|
156
150
|
disabled: getDisabledDays(minDate, maxDate),
|
|
157
151
|
locale: {
|
|
158
152
|
localize: {
|
|
159
|
-
...defaultLocale.localize
|
|
160
|
-
months: monthsLong,
|
|
161
|
-
weekdaysLong,
|
|
162
|
-
weekdaysShort
|
|
153
|
+
...defaultLocale.localize
|
|
163
154
|
}
|
|
164
155
|
},
|
|
165
156
|
selected: selectedDays,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Matcher } from "react-day-picker";
|
|
1
|
+
import type { Locale, Matcher } from "react-day-picker";
|
|
2
2
|
export declare function isValidLocaleDate(date: string, locale: Locale): boolean;
|
|
3
3
|
export declare function parseDate(formatString?: string, valueString?: string): Date | undefined;
|
|
4
4
|
export declare function isDateValid(date?: Date): boolean | undefined;
|
|
@@ -8,12 +8,13 @@ import useUniqueId from "../../hooks/__internal__/useUniqueId";
|
|
|
8
8
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
9
9
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
10
10
|
import { StyledHiddenFileInput, StyledFileInputPresentation } from "./file-input.style";
|
|
11
|
-
import
|
|
11
|
+
import ErrorBorder from "../textbox/textbox.style";
|
|
12
12
|
import ButtonMinor from "../button-minor";
|
|
13
13
|
import Typography from "../typography";
|
|
14
14
|
import FileUploadStatus from "./__internal__/file-upload-status";
|
|
15
15
|
import Box from "../box";
|
|
16
16
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
17
|
+
import HintText from "../../__internal__/hint-text";
|
|
17
18
|
const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
18
19
|
accept,
|
|
19
20
|
buttonText,
|
|
@@ -114,7 +115,7 @@ const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
|
114
115
|
|
|
115
116
|
// allow for single input that a single set of status props is provided
|
|
116
117
|
const filesUploaded = Array.isArray(uploadStatus) ? uploadStatus : [uploadStatus];
|
|
117
|
-
const input = /*#__PURE__*/React.createElement(React.Fragment, null, inputHint && /*#__PURE__*/React.createElement(
|
|
118
|
+
const input = /*#__PURE__*/React.createElement(React.Fragment, null, inputHint && /*#__PURE__*/React.createElement(HintText, null, inputHint), /*#__PURE__*/React.createElement(Box, {
|
|
118
119
|
position: "relative"
|
|
119
120
|
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
120
121
|
error: error,
|
|
@@ -7,7 +7,7 @@ import Events from "../../__internal__/utils/helpers/events";
|
|
|
7
7
|
import { StyledNumeralDate, StyledDateField, StyledFieldset } from "./numeral-date.style";
|
|
8
8
|
import Textbox from "../textbox";
|
|
9
9
|
import Box from "../box";
|
|
10
|
-
import
|
|
10
|
+
import ErrorBorder from "../textbox/textbox.style";
|
|
11
11
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
12
12
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
13
13
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
@@ -18,6 +18,7 @@ import Logger from "../../__internal__/utils/logger";
|
|
|
18
18
|
import FieldHelp from "../../__internal__/field-help";
|
|
19
19
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
20
20
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
21
|
+
import HintText from "../../__internal__/hint-text";
|
|
21
22
|
let deprecateUncontrolledWarnTriggered = false;
|
|
22
23
|
export const ALLOWED_DATE_FORMATS = [["dd", "mm", "yyyy"], ["mm", "dd", "yyyy"], ["yyyy", "mm", "dd"], ["dd", "mm"], ["mm", "dd"], ["mm", "yyyy"]];
|
|
23
24
|
const incorrectDateFormatMessage = "Forbidden prop dateFormat supplied to NumeralDate. " + "Only one of these date formats is allowed: " + "['dd', 'mm', 'yyyy'], " + "['mm', 'dd', 'yyyy'], " + "['yyyy', 'mm', 'dd'], " + "['dd', 'mm'], " + "['mm', 'dd'], " + "['mm', 'yyyy']";
|
|
@@ -336,7 +337,8 @@ export const NumeralDate = ({
|
|
|
336
337
|
isDisabled: disabled,
|
|
337
338
|
name: name,
|
|
338
339
|
"aria-describedby": combinedAriaDescribedBy
|
|
339
|
-
}, filterStyledSystemMarginProps(rest)), labelHelp && /*#__PURE__*/React.createElement(
|
|
340
|
+
}, filterStyledSystemMarginProps(rest)), labelHelp && /*#__PURE__*/React.createElement(HintText, {
|
|
341
|
+
align: labelAlign,
|
|
340
342
|
id: inputHintId.current
|
|
341
343
|
}, labelHelp), /*#__PURE__*/React.createElement(Box, {
|
|
342
344
|
position: "relative",
|
|
@@ -3,7 +3,7 @@ import React, { useContext, useRef } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
5
|
import Fieldset from "../../../__internal__/fieldset";
|
|
6
|
-
import RadioButtonGroupStyle
|
|
6
|
+
import RadioButtonGroupStyle from "../radio-button-group/radio-button-group.style";
|
|
7
7
|
import RadioButtonMapper from "../../../__internal__/radio-button-mapper/radio-button-mapper.component";
|
|
8
8
|
import useIsAboveBreakpoint from "../../../hooks/__internal__/useIsAboveBreakpoint";
|
|
9
9
|
import { filterStyledSystemMarginProps } from "../../../style/utils";
|
|
@@ -12,9 +12,10 @@ import Logger from "../../../__internal__/utils/logger";
|
|
|
12
12
|
import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
|
|
13
13
|
import ValidationMessage from "../../../__internal__/validation-message/validation-message.component";
|
|
14
14
|
import Box from "../../box";
|
|
15
|
-
import { ErrorBorder } from "../../textbox/textbox.style";
|
|
16
15
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
17
16
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility";
|
|
17
|
+
import ErrorBorder from "../../textbox/textbox.style";
|
|
18
|
+
import HintText from "../../../__internal__/hint-text";
|
|
18
19
|
let deprecateUncontrolledWarnTriggered = false;
|
|
19
20
|
export const RadioButtonGroup = ({
|
|
20
21
|
children,
|
|
@@ -85,8 +86,10 @@ export const RadioButtonGroup = ({
|
|
|
85
86
|
blockGroupBehaviour: !(error || warning)
|
|
86
87
|
}, combinedAriaDescribedBy && {
|
|
87
88
|
"aria-describedby": combinedAriaDescribedBy
|
|
88
|
-
}), legendHelp && /*#__PURE__*/React.createElement(
|
|
89
|
-
|
|
89
|
+
}), legendHelp && /*#__PURE__*/React.createElement(HintText, {
|
|
90
|
+
align: legendAlign,
|
|
91
|
+
id: inputHintId,
|
|
92
|
+
marginTop: "-4px"
|
|
90
93
|
}, legendHelp), /*#__PURE__*/React.createElement(Box, {
|
|
91
94
|
position: "relative"
|
|
92
95
|
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
@@ -10,9 +10,10 @@ import Logger from "../../__internal__/utils/logger";
|
|
|
10
10
|
import ValidationMessage from "../../__internal__/validation-message/validation-message.component";
|
|
11
11
|
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
12
12
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
13
|
-
import StyledSwitch, { ErrorBorder
|
|
13
|
+
import StyledSwitch, { ErrorBorder } from "./switch.style";
|
|
14
14
|
import SwitchSlider from "./__internal__/switch-slider.component";
|
|
15
15
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
16
|
+
import HintText from "../../__internal__/hint-text";
|
|
16
17
|
let deprecateUncontrolledWarnTriggered = false;
|
|
17
18
|
const Switch = /*#__PURE__*/React.forwardRef(({
|
|
18
19
|
autoFocus,
|
|
@@ -207,10 +208,13 @@ const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
207
208
|
mb: labelInline ? 0 : 1,
|
|
208
209
|
mr: reverse ? 0 : 1,
|
|
209
210
|
ml: reverse ? 0 : 1
|
|
210
|
-
}, /*#__PURE__*/React.createElement(
|
|
211
|
+
}, /*#__PURE__*/React.createElement(HintText, {
|
|
211
212
|
"data-role": "hint-text",
|
|
213
|
+
fontWeight: "400",
|
|
212
214
|
id: inputHintId.current,
|
|
213
|
-
isDarkBackground: isDarkBackground
|
|
215
|
+
isDarkBackground: isDarkBackground,
|
|
216
|
+
marginTop: "8px",
|
|
217
|
+
maxWidth: "160px"
|
|
214
218
|
}, labelHelp))), /*#__PURE__*/React.createElement(Box, {
|
|
215
219
|
ml: reverse ? errorMargin : 0,
|
|
216
220
|
mr: !reverse ? errorMargin : 0,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
interface StyledHintTextProps {
|
|
2
|
-
isDarkBackground?: boolean;
|
|
3
|
-
}
|
|
4
1
|
export declare const ErrorBorder: import("styled-components").StyledComponent<"span", any, {
|
|
5
2
|
reverse: boolean;
|
|
6
3
|
warning: boolean;
|
|
7
4
|
isDarkBackground: boolean;
|
|
8
5
|
}, never>;
|
|
9
|
-
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, StyledHintTextProps, never>;
|
|
10
6
|
declare const StyledSwitch: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
7
|
export default StyledSwitch;
|
|
@@ -27,18 +27,6 @@ export const ErrorBorder = styled.span`
|
|
|
27
27
|
`;
|
|
28
28
|
}}
|
|
29
29
|
`;
|
|
30
|
-
export const StyledHintText = styled.div`
|
|
31
|
-
margin-top: 8px;
|
|
32
|
-
margin-bottom: 8px;
|
|
33
|
-
font-size: 14px;
|
|
34
|
-
font-weight: 400;
|
|
35
|
-
max-width: 160px;
|
|
36
|
-
${({
|
|
37
|
-
isDarkBackground
|
|
38
|
-
}) => css`
|
|
39
|
-
color: ${isDarkBackground ? "var(--colorsUtilityYang080)" : "var(--colorsUtilityYin055)"};
|
|
40
|
-
`}
|
|
41
|
-
`;
|
|
42
30
|
const StyledSwitch = styled.div`
|
|
43
31
|
${({
|
|
44
32
|
fieldHelpInline,
|
|
@@ -18,8 +18,9 @@ import { COMPONENT_PREFIX, markdownNodes, theme } from "./__internal__/constants
|
|
|
18
18
|
import { validateUrl } from "./__internal__/helpers";
|
|
19
19
|
import { AutoLinkerPlugin, CharacterCounterPlugin, ContentEditor, LinkMonitorPlugin, OnChangePlugin, Placeholder, ToolbarPlugin } from "./__internal__/plugins";
|
|
20
20
|
import TextEditorContext from "./text-editor.context";
|
|
21
|
-
import StyledTextEditor, { StyledEditorToolbarWrapper,
|
|
21
|
+
import StyledTextEditor, { StyledEditorToolbarWrapper, StyledValidationMessage, StyledWrapper } from "./text-editor.style";
|
|
22
22
|
import { createEmpty } from "./__internal__";
|
|
23
|
+
import HintText from "../../__internal__/hint-text";
|
|
23
24
|
export const TextEditor = ({
|
|
24
25
|
characterLimit = 3000,
|
|
25
26
|
error,
|
|
@@ -110,9 +111,9 @@ export const TextEditor = ({
|
|
|
110
111
|
isRequired: required,
|
|
111
112
|
optional: isOptional,
|
|
112
113
|
labelId: `${namespace}-label`
|
|
113
|
-
}, labelText), inputHint && /*#__PURE__*/React.createElement(
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
}, labelText), inputHint && /*#__PURE__*/React.createElement(HintText, {
|
|
115
|
+
id: `${namespace}-input-hint`,
|
|
116
|
+
marginBottom: "var(--spacing100)"
|
|
116
117
|
}, inputHint), /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
117
118
|
initialConfig: initialConfig
|
|
118
119
|
}, /*#__PURE__*/React.createElement(EditorRefPlugin, {
|
|
@@ -11,7 +11,6 @@ interface StyledEditorToolbarWrapperProps {
|
|
|
11
11
|
focused?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare const StyledTextEditor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
14
|
-
export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
14
|
export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, StyledWrapperProps, never>;
|
|
16
15
|
export declare const StyledEditorToolbarWrapper: import("styled-components").StyledComponent<"div", any, StyledEditorToolbarWrapperProps, never>;
|
|
17
16
|
export declare const StyledValidationMessage: import("styled-components").StyledComponent<"div", any, StyledValidationMessageProps, never>;
|
|
@@ -4,16 +4,6 @@ import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
|
4
4
|
export const StyledTextEditor = styled(Box)`
|
|
5
5
|
position: relative;
|
|
6
6
|
`;
|
|
7
|
-
export const StyledHintText = styled.div`
|
|
8
|
-
::after {
|
|
9
|
-
content: " ";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
margin-top: var(--spacing000);
|
|
13
|
-
margin-bottom: var(--spacing150);
|
|
14
|
-
color: var(--colorsUtilityYin055);
|
|
15
|
-
font-size: 14px;
|
|
16
|
-
`;
|
|
17
7
|
export const StyledWrapper = styled.div`
|
|
18
8
|
${({
|
|
19
9
|
error,
|
|
@@ -12,11 +12,12 @@ import StyledTextarea, { DEFAULT_MIN_HEIGHT } from "./textarea.style";
|
|
|
12
12
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
13
13
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
14
14
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
15
|
-
import
|
|
15
|
+
import ErrorBorder from "../textbox/textbox.style";
|
|
16
16
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
17
17
|
import Box from "../box";
|
|
18
18
|
import Logger from "../../__internal__/utils/logger";
|
|
19
19
|
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
20
|
+
import HintText from "../../__internal__/hint-text";
|
|
20
21
|
let deprecateUncontrolledWarnTriggered = false;
|
|
21
22
|
let warnBorderRadiusArrayTooLarge = false;
|
|
22
23
|
const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
@@ -244,7 +245,8 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
244
245
|
useValidationIcon: computeLabelPropValues(validationOnLabel),
|
|
245
246
|
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
|
|
246
247
|
validationRedesignOptIn: validationRedesignOptIn
|
|
247
|
-
}, (inputHint || labelHelp && validationRedesignOptIn) && /*#__PURE__*/React.createElement(
|
|
248
|
+
}, (inputHint || labelHelp && validationRedesignOptIn) && /*#__PURE__*/React.createElement(HintText, {
|
|
249
|
+
align: labelAlign,
|
|
248
250
|
id: inputHintId,
|
|
249
251
|
"data-element": "input-hint"
|
|
250
252
|
}, inputHint || labelHelp), validationRedesignOptIn ? /*#__PURE__*/React.createElement(Box, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconType } from "../icon";
|
|
3
4
|
import { CommonInputProps } from "../../__internal__/input";
|
|
4
5
|
import { ValidationProps } from "../../__internal__/validations";
|
|
5
|
-
import { IconType } from "../icon";
|
|
6
6
|
export declare const ALIGN_DEFAULT = "left";
|
|
7
7
|
export declare const SIZE_DEFAULT = "medium";
|
|
8
8
|
export declare const LABEL_WIDTH_DEFAULT = 30;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useContext, useRef, useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
5
|
-
import { Input, InputPresentation } from "../../__internal__/input";
|
|
6
|
-
import InputIconToggle from "../../__internal__/input-icon-toggle";
|
|
4
|
+
import Box from "../box";
|
|
7
5
|
import FormField from "../../__internal__/form-field";
|
|
8
|
-
import
|
|
6
|
+
import HintText from "../../__internal__/hint-text";
|
|
7
|
+
import { Input, InputPresentation } from "../../__internal__/input";
|
|
9
8
|
import { InputBehaviour } from "../../__internal__/input-behaviour";
|
|
10
|
-
import
|
|
9
|
+
import InputIconToggle from "../../__internal__/input-icon-toggle";
|
|
11
10
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
12
|
-
import useCharacterCount from "../../hooks/__internal__/useCharacterCount";
|
|
13
|
-
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
14
|
-
import { ErrorBorder, StyledHintText } from "./textbox.style";
|
|
15
11
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
12
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
16
13
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
17
14
|
import NumeralDateContext from "../numeral-date/__internal__/numeral-date.context";
|
|
18
|
-
import Box from "../box";
|
|
19
15
|
import Logger from "../../__internal__/utils/logger";
|
|
16
|
+
import useCharacterCount from "../../hooks/__internal__/useCharacterCount";
|
|
17
|
+
import useUniqueId from "../../hooks/__internal__/useUniqueId";
|
|
20
18
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
19
|
+
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
20
|
+
import ErrorBorder from "./textbox.style";
|
|
21
|
+
import StyledPrefix from "./__internal__/prefix.style";
|
|
21
22
|
export const ALIGN_DEFAULT = "left";
|
|
22
23
|
export const SIZE_DEFAULT = "medium";
|
|
23
24
|
export const LABEL_WIDTH_DEFAULT = 30;
|
|
@@ -207,9 +208,11 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
207
208
|
"data-element": dataElement,
|
|
208
209
|
validationIconId: validationRedesignOptIn ? undefined : validationId,
|
|
209
210
|
validationRedesignOptIn: validationRedesignOptIn
|
|
210
|
-
}, filterStyledSystemMarginProps(props)), (inputHint || labelHelp && validationRedesignOptIn) && /*#__PURE__*/React.createElement(
|
|
211
|
+
}, filterStyledSystemMarginProps(props)), (inputHint || labelHelp && validationRedesignOptIn) && /*#__PURE__*/React.createElement(HintText, {
|
|
212
|
+
align: labelAlign,
|
|
213
|
+
"data-element": "input-hint",
|
|
211
214
|
id: inputHintId,
|
|
212
|
-
|
|
215
|
+
isComponentInline: labelInline
|
|
213
216
|
}, inputHint || labelHelp), validationRedesignOptIn ? /*#__PURE__*/React.createElement(Box, {
|
|
214
217
|
position: "relative"
|
|
215
218
|
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|