carbon-react 153.7.0 → 153.7.1
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.component.d.ts +4 -1
- package/esm/__internal__/fieldset/fieldset.component.d.ts +4 -1
- package/esm/__internal__/fieldset/fieldset.style.d.ts +4 -0
- package/esm/__internal__/form-field/form-field.component.d.ts +4 -1
- package/esm/components/button/button.component.js +9 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +4 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +6 -0
- package/esm/components/date-range/date-range.component.d.ts +4 -1
- package/esm/components/date-range/date-range.component.js +6 -0
- package/esm/components/fieldset/fieldset.component.d.ts +4 -1
- package/esm/components/fieldset/fieldset.component.js +6 -0
- package/esm/components/fieldset/fieldset.style.d.ts +4 -1
- package/esm/components/file-input/file-input.component.d.ts +4 -1
- package/esm/components/file-input/file-input.component.js +6 -0
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +4 -1
- package/esm/components/inline-inputs/inline-inputs.component.js +6 -0
- package/esm/components/numeral-date/numeral-date.component.d.ts +4 -1
- package/esm/components/numeral-date/numeral-date.component.js +5 -0
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +4 -1
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +5 -0
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.d.ts +4 -1
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +4 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +5 -0
- package/esm/components/select/multi-select/multi-select.component.d.ts +4 -1
- package/esm/components/select/multi-select/multi-select.component.js +5 -0
- package/esm/components/select/simple-select/simple-select.component.d.ts +4 -1
- package/esm/components/select/simple-select/simple-select.component.js +5 -0
- package/esm/components/text-editor/text-editor.component.d.ts +4 -1
- package/esm/components/text-editor/text-editor.component.js +6 -0
- package/esm/components/textarea/textarea.component.d.ts +4 -1
- package/esm/components/textarea/textarea.component.js +6 -1
- package/esm/components/textbox/textbox.component.d.ts +4 -1
- package/esm/components/textbox/textbox.component.js +6 -1
- package/esm/components/time/time.component.d.ts +4 -1
- package/esm/components/time/time.component.js +6 -0
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +4 -1
- package/lib/__internal__/fieldset/fieldset.component.d.ts +4 -1
- package/lib/__internal__/fieldset/fieldset.style.d.ts +4 -0
- package/lib/__internal__/form-field/form-field.component.d.ts +4 -1
- package/lib/components/button/button.component.js +9 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +4 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +6 -0
- package/lib/components/date-range/date-range.component.d.ts +4 -1
- package/lib/components/date-range/date-range.component.js +6 -0
- package/lib/components/fieldset/fieldset.component.d.ts +4 -1
- package/lib/components/fieldset/fieldset.component.js +6 -0
- package/lib/components/fieldset/fieldset.style.d.ts +4 -1
- package/lib/components/file-input/file-input.component.d.ts +4 -1
- package/lib/components/file-input/file-input.component.js +6 -0
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +4 -1
- package/lib/components/inline-inputs/inline-inputs.component.js +6 -0
- package/lib/components/numeral-date/numeral-date.component.d.ts +4 -1
- package/lib/components/numeral-date/numeral-date.component.js +5 -0
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +4 -1
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +5 -0
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.d.ts +4 -1
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +4 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +5 -0
- package/lib/components/select/multi-select/multi-select.component.d.ts +4 -1
- package/lib/components/select/multi-select/multi-select.component.js +5 -0
- package/lib/components/select/simple-select/simple-select.component.d.ts +4 -1
- package/lib/components/select/simple-select/simple-select.component.js +5 -0
- package/lib/components/text-editor/text-editor.component.d.ts +4 -1
- package/lib/components/text-editor/text-editor.component.js +6 -0
- package/lib/components/textarea/textarea.component.d.ts +4 -1
- package/lib/components/textarea/textarea.component.js +6 -1
- package/lib/components/textbox/textbox.component.d.ts +4 -1
- package/lib/components/textbox/textbox.component.js +6 -1
- package/lib/components/time/time.component.d.ts +4 -1
- package/lib/components/time/time.component.js +6 -0
- package/package.json +5 -4
|
@@ -27,7 +27,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
27
27
|
labelWidth?: number;
|
|
28
28
|
/** Flag to configure component as mandatory */
|
|
29
29
|
required?: boolean;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* [Legacy] Flag to configure component as optional.
|
|
32
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
33
|
+
*/
|
|
31
34
|
isOptional?: boolean;
|
|
32
35
|
/** If true the label switches position with the input */
|
|
33
36
|
reverse?: boolean;
|
|
@@ -26,7 +26,10 @@ export interface FieldsetProps extends MarginProps {
|
|
|
26
26
|
legendMargin?: Pick<MarginProps, "mb">;
|
|
27
27
|
/** Any valid CSS string to set the component's width */
|
|
28
28
|
width?: string;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* [Legacy] Flag to configure component as optional.
|
|
31
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
32
|
+
*/
|
|
30
33
|
isOptional?: boolean;
|
|
31
34
|
/** Apply disabled styling to the legend content */
|
|
32
35
|
isDisabled?: boolean;
|
|
@@ -4,6 +4,10 @@ type StyledFieldsetProps = {
|
|
|
4
4
|
declare const StyledFieldset: import("styled-components").StyledComponent<"fieldset", any, StyledFieldsetProps, never>;
|
|
5
5
|
type StyledLegendContentProps = {
|
|
6
6
|
isRequired?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* [Legacy] Flag to configure component as optional.
|
|
9
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
10
|
+
*/
|
|
7
11
|
isOptional?: boolean;
|
|
8
12
|
isDisabled?: boolean;
|
|
9
13
|
optionalLabel?: string;
|
|
@@ -53,7 +53,10 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
|
|
|
53
53
|
fieldHelpInline?: boolean;
|
|
54
54
|
/** Id of the element a label should be bound to */
|
|
55
55
|
id: string;
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* [Legacy] Flag to configure component as optional.
|
|
58
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
59
|
+
*/
|
|
57
60
|
isOptional?: boolean;
|
|
58
61
|
/** Flag to configure component as mandatory */
|
|
59
62
|
isRequired?: boolean;
|
|
@@ -112,6 +112,14 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
112
112
|
internalRef?.click();
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
+
const handleClick = event => {
|
|
116
|
+
internalRef?.focus();
|
|
117
|
+
if (inSplitButton) {
|
|
118
|
+
onChildButtonClick?.(onClick)?.(event);
|
|
119
|
+
} else if (onClick) {
|
|
120
|
+
onClick(event);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
115
123
|
switch (size) {
|
|
116
124
|
case "small":
|
|
117
125
|
paddingX = 2;
|
|
@@ -135,7 +143,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
135
143
|
"aria-describedby": ariaDescribedBy,
|
|
136
144
|
as: !isDisabled && href ? "a" : "button",
|
|
137
145
|
onKeyDown: href ? handleLinkKeyDown : undefined,
|
|
138
|
-
onClick:
|
|
146
|
+
onClick: handleClick,
|
|
139
147
|
draggable: false,
|
|
140
148
|
buttonType: buttonType,
|
|
141
149
|
disabled: isDisabled,
|
|
@@ -29,7 +29,10 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps, TagPro
|
|
|
29
29
|
labelSpacing?: 1 | 2;
|
|
30
30
|
/** Flag to configure component as mandatory */
|
|
31
31
|
required?: boolean;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* [Legacy] Flag to configure component as optional.
|
|
34
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
35
|
+
*/
|
|
33
36
|
isOptional?: boolean;
|
|
34
37
|
/** [Legacy] Overrides the default tooltip */
|
|
35
38
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
@@ -13,6 +13,8 @@ import CheckboxGroupContext from "./__internal__/checkbox-group.context";
|
|
|
13
13
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
14
14
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility";
|
|
15
15
|
import HintText from "../../../__internal__/hint-text";
|
|
16
|
+
import Logger from "../../../__internal__/utils/logger";
|
|
17
|
+
let deprecateOptionalWarnTriggered = false;
|
|
16
18
|
export const CheckboxGroup = ({
|
|
17
19
|
children,
|
|
18
20
|
legend,
|
|
@@ -31,6 +33,10 @@ export const CheckboxGroup = ({
|
|
|
31
33
|
id,
|
|
32
34
|
...rest
|
|
33
35
|
}) => {
|
|
36
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
37
|
+
deprecateOptionalWarnTriggered = true;
|
|
38
|
+
Logger.deprecate("`isOptional` is deprecated in CheckboxGroup and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
39
|
+
}
|
|
34
40
|
const {
|
|
35
41
|
validationRedesignOptIn
|
|
36
42
|
} = useContext(NewValidationContext);
|
|
@@ -83,7 +83,10 @@ export interface DateRangeProps extends StyledDateRangeProps, MarginProps, TagPr
|
|
|
83
83
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
84
84
|
/** Flag to configure component as mandatory. */
|
|
85
85
|
required?: boolean;
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* [Legacy] Flag to configure component as optional.
|
|
88
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
89
|
+
*/
|
|
87
90
|
isOptional?: boolean;
|
|
88
91
|
/** Date format string to be applied to the date inputs */
|
|
89
92
|
dateFormatOverride?: string;
|
|
@@ -11,6 +11,8 @@ import usePrevious from "../../hooks/__internal__/usePrevious";
|
|
|
11
11
|
import getFormatData from "../date/__internal__/date-formats";
|
|
12
12
|
import DateRangeContext from "./__internal__/date-range.context";
|
|
13
13
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
14
|
+
import Logger from "../../__internal__/utils/logger";
|
|
15
|
+
let deprecateOptionalWarnTriggered = false;
|
|
14
16
|
export const DateRange = ({
|
|
15
17
|
endDateProps = {},
|
|
16
18
|
id,
|
|
@@ -32,6 +34,10 @@ export const DateRange = ({
|
|
|
32
34
|
datePickerEndAriaLabelledBy,
|
|
33
35
|
...rest
|
|
34
36
|
}) => {
|
|
37
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
38
|
+
deprecateOptionalWarnTriggered = true;
|
|
39
|
+
Logger.deprecate("`isOptional` is deprecated in DateRange and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
40
|
+
}
|
|
35
41
|
const {
|
|
36
42
|
validationRedesignOptIn
|
|
37
43
|
} = useContext(NewValidationContext);
|
|
@@ -8,7 +8,10 @@ export interface FieldsetProps extends MarginProps, TagProps {
|
|
|
8
8
|
legend?: string;
|
|
9
9
|
/** Flag to configure fields as mandatory. */
|
|
10
10
|
required?: boolean;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* [Legacy] Flag to configure component as optional.
|
|
13
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
14
|
+
*/
|
|
12
15
|
isOptional?: boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare const Fieldset: {
|
|
@@ -5,6 +5,8 @@ import { FieldsetStyle, StyledLegend } from "./fieldset.style";
|
|
|
5
5
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
6
6
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
7
7
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
8
|
+
import Logger from "../../__internal__/utils/logger";
|
|
9
|
+
let deprecateOptionalWarnTriggered = false;
|
|
8
10
|
export const Fieldset = ({
|
|
9
11
|
children,
|
|
10
12
|
legend,
|
|
@@ -12,6 +14,10 @@ export const Fieldset = ({
|
|
|
12
14
|
isOptional,
|
|
13
15
|
...rest
|
|
14
16
|
}) => {
|
|
17
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
18
|
+
deprecateOptionalWarnTriggered = true;
|
|
19
|
+
Logger.deprecate("`isOptional` is deprecated in Fieldset and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
20
|
+
}
|
|
15
21
|
const [ref, setRef] = useState(null);
|
|
16
22
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
17
23
|
const {
|
|
@@ -5,7 +5,10 @@ declare const FieldsetStyle: import("styled-components").StyledComponent<"fields
|
|
|
5
5
|
export interface StyledLegendProps {
|
|
6
6
|
/** Flag to configure fields as mandatory. */
|
|
7
7
|
isRequired?: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* [Legacy] Flag to configure fields as optional.
|
|
10
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
11
|
+
*/
|
|
9
12
|
isOptional?: boolean;
|
|
10
13
|
/** Text used for the optional label */
|
|
11
14
|
optionalLabel?: string;
|
|
@@ -33,7 +33,10 @@ export interface FileInputProps extends Pick<ValidationProps, "error">, Pick<Inp
|
|
|
33
33
|
uploadStatus?: FileUploadStatusProps | FileUploadStatusProps[];
|
|
34
34
|
/** Flag to configure component as mandatory. */
|
|
35
35
|
required?: boolean;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* [Legacy] Flag to configure component as optional.
|
|
38
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
39
|
+
*/
|
|
37
40
|
isOptional?: boolean;
|
|
38
41
|
}
|
|
39
42
|
export declare const FileInput: React.ForwardRefExoticComponent<FileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -14,6 +14,8 @@ import FileUploadStatus from "./__internal__/file-upload-status";
|
|
|
14
14
|
import Box from "../box";
|
|
15
15
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
16
16
|
import HintText from "../../__internal__/hint-text";
|
|
17
|
+
import Logger from "../../__internal__/utils/logger";
|
|
18
|
+
let deprecateOptionalWarnTriggered = false;
|
|
17
19
|
export const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
18
20
|
accept,
|
|
19
21
|
buttonText,
|
|
@@ -36,6 +38,10 @@ export const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
|
36
38
|
uploadStatus = [],
|
|
37
39
|
...rest
|
|
38
40
|
}, ref) => {
|
|
41
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
42
|
+
deprecateOptionalWarnTriggered = true;
|
|
43
|
+
Logger.deprecate("`isOptional` is deprecated in FileInput and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
44
|
+
}
|
|
39
45
|
const locale = useLocale();
|
|
40
46
|
const textOnButton = buttonText || locale.fileInput.selectFile();
|
|
41
47
|
const mainText = dragAndDropText || locale.fileInput.dragAndDrop();
|
|
@@ -26,7 +26,10 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
26
26
|
labelId?: string;
|
|
27
27
|
/** Flag to configure component as mandatory. */
|
|
28
28
|
required?: boolean;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* [Legacy] Flag to configure component as optional.
|
|
31
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
32
|
+
*/
|
|
30
33
|
isOptional?: boolean;
|
|
31
34
|
}
|
|
32
35
|
declare const InlineInputs: {
|
|
@@ -5,6 +5,7 @@ import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from ".
|
|
|
5
5
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
6
6
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
7
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
|
+
import Logger from "../../__internal__/utils/logger";
|
|
8
9
|
const columnWrapper = (children, gutter) => {
|
|
9
10
|
return React.Children.map(children, input => {
|
|
10
11
|
return /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
@@ -13,6 +14,7 @@ const columnWrapper = (children, gutter) => {
|
|
|
13
14
|
}, input);
|
|
14
15
|
});
|
|
15
16
|
};
|
|
17
|
+
let deprecateOptionalWarnTriggered = false;
|
|
16
18
|
const InlineInputs = ({
|
|
17
19
|
adaptiveLabelBreakpoint,
|
|
18
20
|
label,
|
|
@@ -28,6 +30,10 @@ const InlineInputs = ({
|
|
|
28
30
|
isOptional,
|
|
29
31
|
...rest
|
|
30
32
|
}) => {
|
|
33
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
34
|
+
deprecateOptionalWarnTriggered = true;
|
|
35
|
+
Logger.deprecate("`isOptional` is deprecated in InlineInputs and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
36
|
+
}
|
|
31
37
|
const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
|
|
32
38
|
const ref = useRef(null);
|
|
33
39
|
let inlineLabel = labelInline;
|
|
@@ -80,7 +80,10 @@ export interface NumeralDateProps extends ValidationProps, MarginProps, TagProps
|
|
|
80
80
|
* A React ref to pass to the input corresponding to the year
|
|
81
81
|
*/
|
|
82
82
|
yearRef?: React.ForwardedRef<HTMLInputElement>;
|
|
83
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* [Legacy] Flag to configure component as optional.
|
|
85
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
86
|
+
*/
|
|
84
87
|
isOptional?: boolean;
|
|
85
88
|
}
|
|
86
89
|
export type ValidDateFormat = (typeof ALLOWED_DATE_FORMATS)[number];
|
|
@@ -78,6 +78,7 @@ const getDateLabel = (datePart, locale) => {
|
|
|
78
78
|
return locale.numeralDate.labels.day();
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
let deprecateOptionalWarnTriggered = false;
|
|
81
82
|
export const NumeralDate = /*#__PURE__*/forwardRef(({
|
|
82
83
|
dateFormat = ["dd", "mm", "yyyy"],
|
|
83
84
|
defaultValue,
|
|
@@ -113,6 +114,10 @@ export const NumeralDate = /*#__PURE__*/forwardRef(({
|
|
|
113
114
|
yearRef,
|
|
114
115
|
...rest
|
|
115
116
|
}, ref) => {
|
|
117
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
118
|
+
deprecateOptionalWarnTriggered = true;
|
|
119
|
+
Logger.deprecate("`isOptional` is deprecated in NumeralDate and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
120
|
+
}
|
|
116
121
|
const locale = useLocale();
|
|
117
122
|
const {
|
|
118
123
|
validationRedesignOptIn
|
|
@@ -41,7 +41,10 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps, Tag
|
|
|
41
41
|
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
42
42
|
/** Flag to configure component as mandatory */
|
|
43
43
|
required?: boolean;
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* [Legacy] Flag to configure component as optional.
|
|
46
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
47
|
+
*/
|
|
45
48
|
isOptional?: boolean;
|
|
46
49
|
/** value of the selected RadioButton */
|
|
47
50
|
value?: string;
|
|
@@ -16,6 +16,7 @@ import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibi
|
|
|
16
16
|
import ErrorBorder from "../../textbox/textbox.style";
|
|
17
17
|
import HintText from "../../../__internal__/hint-text";
|
|
18
18
|
let deprecateUncontrolledWarnTriggered = false;
|
|
19
|
+
let deprecateOptionalWarnTriggered = false;
|
|
19
20
|
export const RadioButtonGroup = ({
|
|
20
21
|
children,
|
|
21
22
|
id,
|
|
@@ -41,6 +42,10 @@ export const RadioButtonGroup = ({
|
|
|
41
42
|
tooltipPosition,
|
|
42
43
|
...rest
|
|
43
44
|
}) => {
|
|
45
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
46
|
+
deprecateOptionalWarnTriggered = true;
|
|
47
|
+
Logger.deprecate("`isOptional` is deprecated in RadioButtonGroup and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
48
|
+
}
|
|
44
49
|
const {
|
|
45
50
|
validationRedesignOptIn
|
|
46
51
|
} = useContext(NewValidationContext);
|
|
@@ -56,7 +56,10 @@ export interface FormInputPropTypes extends ValidationProps, Omit<CommonTextboxP
|
|
|
56
56
|
*
|
|
57
57
|
*/
|
|
58
58
|
labelId?: string;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* [Legacy] Flag to configure component as optional.
|
|
61
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
62
|
+
*/
|
|
60
63
|
isOptional?: boolean;
|
|
61
64
|
}
|
|
62
65
|
export interface SelectTextboxProps extends FormInputPropTypes {
|
|
@@ -56,7 +56,10 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
|
|
|
56
56
|
/** Boolean to disable automatic filtering and highlighting of options.
|
|
57
57
|
* This allows custom filtering and option styling to be performed outside of the component when the filter text changes. */
|
|
58
58
|
disableDefaultFiltering?: boolean;
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* [Legacy] Flag to configure component as optional.
|
|
61
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
62
|
+
*/
|
|
60
63
|
isOptional?: boolean;
|
|
61
64
|
/** Flag to configure component as mandatory */
|
|
62
65
|
required?: boolean;
|
|
@@ -15,6 +15,7 @@ import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
|
15
15
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
16
16
|
let deprecateUncontrolledWarnTriggered = false;
|
|
17
17
|
const FilterableSelectList = withFilter(SelectList);
|
|
18
|
+
let deprecateOptionalWarnTriggered = false;
|
|
18
19
|
export const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
19
20
|
"aria-label": ariaLabel,
|
|
20
21
|
"aria-labelledby": ariaLabelledby,
|
|
@@ -55,6 +56,10 @@ export const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
55
56
|
listWidth,
|
|
56
57
|
...textboxProps
|
|
57
58
|
}, ref) => {
|
|
59
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
60
|
+
deprecateOptionalWarnTriggered = true;
|
|
61
|
+
Logger.deprecate("`isOptional` is deprecated in FilterableSelect and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
62
|
+
}
|
|
58
63
|
const [activeDescendantId, setActiveDescendantId] = useState("");
|
|
59
64
|
const selectListId = useRef(guid());
|
|
60
65
|
const containerRef = useRef(null);
|
|
@@ -52,7 +52,10 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
|
|
|
52
52
|
* Higher values make for smoother scrolling but may impact performance.
|
|
53
53
|
* Only used if the `enableVirtualScroll` prop is set. */
|
|
54
54
|
virtualScrollOverscan?: number;
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* [Legacy] Flag to configure component as optional.
|
|
57
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
58
|
+
*/
|
|
56
59
|
isOptional?: boolean;
|
|
57
60
|
/** Specify a callback triggered on change */
|
|
58
61
|
onChange?: (ev: CustomSelectChangeEvent | React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -16,6 +16,7 @@ import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
|
16
16
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
17
17
|
let deprecateUncontrolledWarnTriggered = false;
|
|
18
18
|
const FilterableSelectList = withFilter(SelectList);
|
|
19
|
+
let deprecateOptionalWarnTriggered = false;
|
|
19
20
|
export const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
20
21
|
"aria-label": ariaLabel,
|
|
21
22
|
"aria-labelledby": ariaLabelledby,
|
|
@@ -56,6 +57,10 @@ export const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
56
57
|
listWidth,
|
|
57
58
|
...textboxProps
|
|
58
59
|
}, ref) => {
|
|
60
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
61
|
+
deprecateOptionalWarnTriggered = true;
|
|
62
|
+
Logger.deprecate("`isOptional` is deprecated in MultiSelect and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
63
|
+
}
|
|
59
64
|
const [activeDescendantId, setActiveDescendantId] = useState("");
|
|
60
65
|
const selectListId = useRef(guid());
|
|
61
66
|
const accessibilityLabelId = useRef(guid());
|
|
@@ -50,7 +50,10 @@ export interface SimpleSelectProps extends Omit<FormInputPropTypes, "defaultValu
|
|
|
50
50
|
* Higher values make for smoother scrolling but may impact performance.
|
|
51
51
|
* Only used if the `enableVirtualScroll` prop is set. */
|
|
52
52
|
virtualScrollOverscan?: number;
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* [Legacy] Flag to configure component as optional.
|
|
55
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
56
|
+
*/
|
|
54
57
|
isOptional?: boolean;
|
|
55
58
|
/** Flag to configure component as mandatory */
|
|
56
59
|
isRequired?: boolean;
|
|
@@ -12,6 +12,7 @@ import isNavigationKey from "../__internal__/utils/is-navigation-key";
|
|
|
12
12
|
import Logger from "../../../__internal__/utils/logger";
|
|
13
13
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
14
14
|
let deprecateUncontrolledWarnTriggered = false;
|
|
15
|
+
let deprecateOptionalWarnTriggered = false;
|
|
15
16
|
export const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
16
17
|
"aria-describedby": ariaDescribedBy,
|
|
17
18
|
"aria-label": ariaLabel,
|
|
@@ -49,6 +50,10 @@ export const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
49
50
|
listWidth,
|
|
50
51
|
...props
|
|
51
52
|
}, ref) => {
|
|
53
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
54
|
+
deprecateOptionalWarnTriggered = true;
|
|
55
|
+
Logger.deprecate("`isOptional` is deprecated in SimpleSelect and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
56
|
+
}
|
|
52
57
|
const selectListId = useRef(guid());
|
|
53
58
|
const containerRef = useRef(null);
|
|
54
59
|
const listboxRef = useRef(null);
|
|
@@ -14,7 +14,10 @@ export interface TextEditorProps extends MarginProps, TagProps {
|
|
|
14
14
|
header?: React.ReactNode;
|
|
15
15
|
/** A hint string rendered before the editor but after the label. Intended to describe the purpose or content of the input. */
|
|
16
16
|
inputHint?: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* [Legacy] Whether the content of the editor can be empty
|
|
19
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
20
|
+
*/
|
|
18
21
|
isOptional?: boolean;
|
|
19
22
|
/** The label to display above the editor */
|
|
20
23
|
labelText: string;
|
|
@@ -15,6 +15,7 @@ import { SerializeLexical, validateUrl } from "./__internal__/helpers";
|
|
|
15
15
|
import Label from "../../__internal__/label";
|
|
16
16
|
import useDebounce from "../../hooks/__internal__/useDebounce";
|
|
17
17
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
18
|
+
import Logger from "../../__internal__/utils/logger";
|
|
18
19
|
import { COMPONENT_PREFIX, markdownNodes, theme } from "./__internal__/constants";
|
|
19
20
|
import { AutoLinkerPlugin, CharacterCounterPlugin, ContentEditor, LinkMonitorPlugin, OnChangePlugin, Placeholder, ToolbarPlugin } from "./__internal__/plugins";
|
|
20
21
|
import TextEditorContext from "./text-editor.context";
|
|
@@ -23,6 +24,7 @@ import { createEmpty } from "./utils";
|
|
|
23
24
|
import HintText from "../../__internal__/hint-text";
|
|
24
25
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
25
26
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
27
|
+
let deprecateOptionalWarnTriggered = false;
|
|
26
28
|
export const TextEditor = ({
|
|
27
29
|
characterLimit = 3000,
|
|
28
30
|
error,
|
|
@@ -45,6 +47,10 @@ export const TextEditor = ({
|
|
|
45
47
|
value,
|
|
46
48
|
...rest
|
|
47
49
|
}) => {
|
|
50
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
51
|
+
deprecateOptionalWarnTriggered = true;
|
|
52
|
+
Logger.deprecate("`isOptional` is deprecated in TextEditor and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
53
|
+
}
|
|
48
54
|
const editorRef = useRef(undefined);
|
|
49
55
|
const locale = useLocale();
|
|
50
56
|
const [characterLimitWarning, setCharacterLimitWarning] = useState(undefined);
|
|
@@ -77,7 +77,10 @@ export interface TextareaProps extends ValidationProps, MarginProps, Omit<Common
|
|
|
77
77
|
placeholder?: string;
|
|
78
78
|
/** Adds readOnly property */
|
|
79
79
|
readOnly?: boolean;
|
|
80
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* [Legacy] Flag to configure component as optional.
|
|
82
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
83
|
+
*/
|
|
81
84
|
isOptional?: boolean;
|
|
82
85
|
/** The number of visible text lines for the control. When set, this determines the height of the textarea, and the minHeight property is ignored. */
|
|
83
86
|
rows?: number;
|
|
@@ -18,8 +18,9 @@ import Box from "../box";
|
|
|
18
18
|
import Logger from "../../__internal__/utils/logger";
|
|
19
19
|
import HintText from "../../__internal__/hint-text";
|
|
20
20
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
21
|
-
let deprecateUncontrolledWarnTriggered = false;
|
|
22
21
|
let deprecatedAriaDescribedByWarnTriggered = false;
|
|
22
|
+
let deprecateOptionalWarnTriggered = false;
|
|
23
|
+
let deprecateUncontrolledWarnTriggered = false;
|
|
23
24
|
let warnBorderRadiusArrayTooLarge = false;
|
|
24
25
|
export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
25
26
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -66,6 +67,10 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
66
67
|
minHeight = DEFAULT_MIN_HEIGHT,
|
|
67
68
|
...rest
|
|
68
69
|
}, ref) => {
|
|
70
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
71
|
+
deprecateOptionalWarnTriggered = true;
|
|
72
|
+
Logger.deprecate("`isOptional` is deprecated in TextArea and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
73
|
+
}
|
|
69
74
|
const {
|
|
70
75
|
validationRedesignOptIn
|
|
71
76
|
} = useContext(NewValidationContext);
|
|
@@ -87,7 +87,10 @@ export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<C
|
|
|
87
87
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
88
88
|
/** [Legacy] Aria label for rendered help component. */
|
|
89
89
|
helpAriaLabel?: string;
|
|
90
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* [Legacy] Flag to configure component as optional.
|
|
92
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
93
|
+
*/
|
|
91
94
|
isOptional?: boolean;
|
|
92
95
|
/** The id attribute for the validation tooltip */
|
|
93
96
|
tooltipId?: string;
|
|
@@ -22,8 +22,9 @@ export const ALIGN_DEFAULT = "left";
|
|
|
22
22
|
export const SIZE_DEFAULT = "medium";
|
|
23
23
|
export const LABEL_WIDTH_DEFAULT = 30;
|
|
24
24
|
export const LABEL_VALIDATION_DEFAULT = false;
|
|
25
|
-
let deprecateUncontrolledWarnTriggered = false;
|
|
26
25
|
let deprecatedAriaDescribedByWarnTriggered = false;
|
|
26
|
+
let deprecateOptionalWarnTriggered = false;
|
|
27
|
+
let deprecateUncontrolledWarnTriggered = false;
|
|
27
28
|
export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
28
29
|
"aria-labelledby": ariaLabelledBy,
|
|
29
30
|
"aria-describedby": ariaDescribedByProp,
|
|
@@ -80,6 +81,10 @@ export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
80
81
|
tooltipId,
|
|
81
82
|
...props
|
|
82
83
|
}, ref) => {
|
|
84
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
85
|
+
deprecateOptionalWarnTriggered = true;
|
|
86
|
+
Logger.deprecate("`isOptional` is deprecated in Textbox and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
87
|
+
}
|
|
83
88
|
const characterCountValue = typeof value === "string" ? value : "";
|
|
84
89
|
const [uniqueId, uniqueName] = useUniqueId(id, name);
|
|
85
90
|
const [characterCountAriaLive, setCharacterCountAriaLive] = useState("off");
|
|
@@ -60,7 +60,10 @@ export interface TimeProps extends TagProps, MarginProps {
|
|
|
60
60
|
onBlur?: (ev?: React.FocusEvent<HTMLInputElement>, value?: TimeValue) => void;
|
|
61
61
|
/** Flag to configure component as mandatory */
|
|
62
62
|
required?: boolean;
|
|
63
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* [Legacy] Flag to configure component as optional.
|
|
65
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
66
|
+
*/
|
|
64
67
|
isOptional?: boolean;
|
|
65
68
|
/** If true, the component will be disabled */
|
|
66
69
|
disabled?: boolean;
|
|
@@ -5,6 +5,7 @@ import useLocale from "../../hooks/__internal__/useLocale";
|
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
6
6
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
7
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
|
+
import Logger from "../../__internal__/utils/logger";
|
|
8
9
|
import Fieldset from "../../__internal__/fieldset";
|
|
9
10
|
import Box from "../box";
|
|
10
11
|
import ErrorBorder from "../textbox/textbox.style";
|
|
@@ -14,6 +15,7 @@ import Typography from "../typography";
|
|
|
14
15
|
import StyledLabel from "./time.style";
|
|
15
16
|
import { TimeToggle } from "./__internal__/time-toggle";
|
|
16
17
|
import HintText from "../../__internal__/hint-text";
|
|
18
|
+
let deprecateOptionalWarnTriggered = false;
|
|
17
19
|
const Time = /*#__PURE__*/React.forwardRef(({
|
|
18
20
|
label,
|
|
19
21
|
labelAlign,
|
|
@@ -33,6 +35,10 @@ const Time = /*#__PURE__*/React.forwardRef(({
|
|
|
33
35
|
toggleProps = {},
|
|
34
36
|
...rest
|
|
35
37
|
}, ref) => {
|
|
38
|
+
if (!deprecateOptionalWarnTriggered && isOptional) {
|
|
39
|
+
deprecateOptionalWarnTriggered = true;
|
|
40
|
+
Logger.deprecate("`isOptional` is deprecated in Time and support will soon be removed. If the value of this component is not required, use the `required` prop and set it to false instead.");
|
|
41
|
+
}
|
|
36
42
|
const {
|
|
37
43
|
id: hoursInputId,
|
|
38
44
|
label: hoursLabel,
|
|
@@ -27,7 +27,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
27
27
|
labelWidth?: number;
|
|
28
28
|
/** Flag to configure component as mandatory */
|
|
29
29
|
required?: boolean;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* [Legacy] Flag to configure component as optional.
|
|
32
|
+
* @deprecated If the value of this component is not required, use the `required` prop and set it to false instead.
|
|
33
|
+
*/
|
|
31
34
|
isOptional?: boolean;
|
|
32
35
|
/** If true the label switches position with the input */
|
|
33
36
|
reverse?: boolean;
|
|
@@ -26,7 +26,10 @@ export interface FieldsetProps extends MarginProps {
|
|
|
26
26
|
legendMargin?: Pick<MarginProps, "mb">;
|
|
27
27
|
/** Any valid CSS string to set the component's width */
|
|
28
28
|
width?: string;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* [Legacy] Flag to configure component as optional.
|
|
31
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
32
|
+
*/
|
|
30
33
|
isOptional?: boolean;
|
|
31
34
|
/** Apply disabled styling to the legend content */
|
|
32
35
|
isDisabled?: boolean;
|
|
@@ -4,6 +4,10 @@ type StyledFieldsetProps = {
|
|
|
4
4
|
declare const StyledFieldset: import("styled-components").StyledComponent<"fieldset", any, StyledFieldsetProps, never>;
|
|
5
5
|
type StyledLegendContentProps = {
|
|
6
6
|
isRequired?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* [Legacy] Flag to configure component as optional.
|
|
9
|
+
* @deprecated If the value of this component is not required, use the `isRequired` prop and set it to false instead.
|
|
10
|
+
*/
|
|
7
11
|
isOptional?: boolean;
|
|
8
12
|
isDisabled?: boolean;
|
|
9
13
|
optionalLabel?: string;
|