carbon-react 152.1.0 → 152.2.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__/fieldset/fieldset.component.js +2 -2
- package/esm/__internal__/fieldset/fieldset.style.js +1 -0
- package/esm/__internal__/form-field/form-field.component.js +2 -2
- package/esm/__internal__/form-field/form-field.style.js +1 -0
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +2 -7
- package/esm/components/checkbox/checkbox.component.js +2 -2
- package/esm/components/checkbox/checkbox.style.js +1 -0
- package/esm/components/date/date.component.js +2 -3
- package/esm/components/date/date.style.js +1 -0
- package/esm/components/date-range/date-range.style.js +1 -0
- package/esm/components/fieldset/fieldset.component.js +3 -6
- package/esm/components/fieldset/fieldset.style.js +5 -0
- package/esm/components/form/form.component.js +3 -6
- package/esm/components/form/form.style.d.ts +1 -1
- package/esm/components/form/form.style.js +20 -11
- package/esm/components/inline-inputs/inline-inputs.component.js +3 -6
- package/esm/components/inline-inputs/inline-inputs.style.js +1 -0
- package/esm/components/numeral-date/numeral-date.component.js +2 -1
- package/esm/components/search/search.component.js +3 -3
- package/esm/components/search/search.style.js +1 -0
- package/esm/components/select/filterable-select/filterable-select.component.js +2 -3
- package/esm/components/select/multi-select/multi-select.component.js +2 -3
- package/esm/components/select/select.style.js +1 -0
- package/esm/components/select/simple-select/simple-select.component.js +2 -3
- package/esm/components/switch/switch.component.js +2 -2
- package/esm/components/switch/switch.style.js +1 -0
- package/esm/components/text-editor/text-editor.style.js +1 -0
- package/esm/components/textarea/textarea.component.js +4 -3
- package/esm/components/textarea/textarea.style.js +1 -0
- package/esm/components/textbox/textbox.component.js +1 -1
- package/esm/components/tile/tile.component.js +3 -11
- package/esm/components/tile/tile.config.js +1 -1
- package/esm/components/tile/tile.style.d.ts +0 -4
- package/esm/components/tile/tile.style.js +18 -17
- package/esm/components/time/time.component.js +6 -3
- package/lib/__internal__/fieldset/fieldset.component.js +2 -2
- package/lib/__internal__/fieldset/fieldset.style.js +1 -0
- package/lib/__internal__/form-field/form-field.component.js +2 -2
- package/lib/__internal__/form-field/form-field.style.js +1 -0
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +2 -7
- package/lib/components/checkbox/checkbox.component.js +2 -2
- package/lib/components/checkbox/checkbox.style.js +1 -0
- package/lib/components/date/date.component.js +1 -2
- package/lib/components/date/date.style.js +1 -0
- package/lib/components/date-range/date-range.style.js +1 -0
- package/lib/components/fieldset/fieldset.component.js +3 -6
- package/lib/components/fieldset/fieldset.style.js +5 -0
- package/lib/components/form/form.component.js +3 -6
- package/lib/components/form/form.style.d.ts +1 -1
- package/lib/components/form/form.style.js +20 -11
- package/lib/components/inline-inputs/inline-inputs.component.js +3 -6
- package/lib/components/inline-inputs/inline-inputs.style.js +1 -0
- package/lib/components/numeral-date/numeral-date.component.js +2 -1
- package/lib/components/search/search.component.js +3 -3
- package/lib/components/search/search.style.js +1 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +1 -2
- package/lib/components/select/multi-select/multi-select.component.js +1 -2
- package/lib/components/select/select.style.js +1 -0
- package/lib/components/select/simple-select/simple-select.component.js +1 -2
- package/lib/components/switch/switch.component.js +2 -2
- package/lib/components/switch/switch.style.js +1 -0
- package/lib/components/text-editor/text-editor.style.js +1 -0
- package/lib/components/textarea/textarea.component.js +4 -3
- package/lib/components/textarea/textarea.style.js +1 -0
- package/lib/components/textbox/textbox.component.js +1 -1
- package/lib/components/tile/tile.component.js +3 -13
- package/lib/components/tile/tile.config.js +1 -1
- package/lib/components/tile/tile.style.d.ts +0 -4
- package/lib/components/tile/tile.style.js +19 -18
- package/lib/components/time/time.component.js +6 -3
- package/package.json +1 -1
- package/esm/__internal__/form-spacing-provider/form-spacing-provider.component.d.ts +0 -7
- package/esm/__internal__/form-spacing-provider/form-spacing-provider.component.js +0 -11
- package/esm/__internal__/form-spacing-provider/form-spacing.context.d.ts +0 -5
- package/esm/__internal__/form-spacing-provider/form-spacing.context.js +0 -2
- package/esm/__internal__/form-spacing-provider/index.d.ts +0 -3
- package/esm/__internal__/form-spacing-provider/index.js +0 -2
- package/esm/hooks/__internal__/useFormSpacing/add-form-spacing/index.d.ts +0 -3
- package/esm/hooks/__internal__/useFormSpacing/add-form-spacing/index.js +0 -27
- package/esm/hooks/__internal__/useFormSpacing/index.d.ts +0 -3
- package/esm/hooks/__internal__/useFormSpacing/index.js +0 -11
- package/lib/__internal__/form-spacing-provider/form-spacing-provider.component.d.ts +0 -7
- package/lib/__internal__/form-spacing-provider/form-spacing-provider.component.js +0 -18
- package/lib/__internal__/form-spacing-provider/form-spacing.context.d.ts +0 -5
- package/lib/__internal__/form-spacing-provider/form-spacing.context.js +0 -9
- package/lib/__internal__/form-spacing-provider/index.d.ts +0 -3
- package/lib/__internal__/form-spacing-provider/index.js +0 -20
- package/lib/__internal__/form-spacing-provider/package.json +0 -6
- package/lib/hooks/__internal__/useFormSpacing/add-form-spacing/index.d.ts +0 -3
- package/lib/hooks/__internal__/useFormSpacing/add-form-spacing/index.js +0 -34
- package/lib/hooks/__internal__/useFormSpacing/add-form-spacing/package.json +0 -6
- package/lib/hooks/__internal__/useFormSpacing/index.d.ts +0 -3
- package/lib/hooks/__internal__/useFormSpacing/index.js +0 -19
- package/lib/hooks/__internal__/useFormSpacing/package.json +0 -6
|
@@ -4,9 +4,9 @@ import { StyledFieldset, StyledLegend, StyledLegendContent, StyledIconWrapper }
|
|
|
4
4
|
import ValidationIcon from "../validations/validation-icon.component";
|
|
5
5
|
import NewValidationContext from "../../components/carbon-provider/__internal__/new-validation.context";
|
|
6
6
|
import { InputGroupBehaviour, InputGroupContext } from "../input-behaviour";
|
|
7
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
8
7
|
import Help from "../../components/help";
|
|
9
8
|
import Typography from "../../components/typography";
|
|
9
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
10
10
|
const Fieldset = ({
|
|
11
11
|
legend,
|
|
12
12
|
children,
|
|
@@ -29,7 +29,7 @@ const Fieldset = ({
|
|
|
29
29
|
const {
|
|
30
30
|
validationRedesignOptIn
|
|
31
31
|
} = useContext(NewValidationContext);
|
|
32
|
-
const marginProps =
|
|
32
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
33
33
|
const [ref, setRef] = useState(null);
|
|
34
34
|
const [isFocused, setFocus] = useState(false);
|
|
35
35
|
useEffect(() => {
|
|
@@ -7,7 +7,7 @@ import FieldHelp from "../field-help";
|
|
|
7
7
|
import tagComponent from "../utils/helpers/tags/tags";
|
|
8
8
|
import TabContext from "../../components/tabs/tab/__internal__/tab.context";
|
|
9
9
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
10
|
-
import
|
|
10
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
11
|
const FormField = ({
|
|
12
12
|
maxWidth,
|
|
13
13
|
children,
|
|
@@ -61,7 +61,7 @@ const FormField = ({
|
|
|
61
61
|
setWarning,
|
|
62
62
|
setInfo
|
|
63
63
|
} = useContext(TabContext);
|
|
64
|
-
const marginProps =
|
|
64
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
65
65
|
const isMounted = useRef(false);
|
|
66
66
|
useLayoutEffect(() => {
|
|
67
67
|
isMounted.current = true;
|
|
@@ -5,7 +5,6 @@ import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
|
5
5
|
import Fieldset from "../../../__internal__/fieldset";
|
|
6
6
|
import { filterStyledSystemMarginProps } from "../../../style/utils";
|
|
7
7
|
import { TooltipProvider } from "../../../__internal__/tooltip-provider";
|
|
8
|
-
import FormSpacingProvider from "../../../__internal__/form-spacing-provider";
|
|
9
8
|
import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
|
|
10
9
|
import ValidationMessage from "../../../__internal__/validation-message/validation-message.component";
|
|
11
10
|
import Box from "../../box";
|
|
@@ -84,9 +83,7 @@ export const CheckboxGroup = ({
|
|
|
84
83
|
error: !!error,
|
|
85
84
|
warning: !!warning
|
|
86
85
|
}
|
|
87
|
-
}, /*#__PURE__*/React.createElement(
|
|
88
|
-
marginBottom: undefined
|
|
89
|
-
}, children))))) : /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
86
|
+
}, children)))) : /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
90
87
|
tooltipPosition: tooltipPosition
|
|
91
88
|
}, /*#__PURE__*/React.createElement(Fieldset, _extends({
|
|
92
89
|
id: uniqueId,
|
|
@@ -114,9 +111,7 @@ export const CheckboxGroup = ({
|
|
|
114
111
|
warning: !!warning,
|
|
115
112
|
info: !!info
|
|
116
113
|
}
|
|
117
|
-
},
|
|
118
|
-
marginBottom: undefined
|
|
119
|
-
}, children))))));
|
|
114
|
+
}, children)))));
|
|
120
115
|
};
|
|
121
116
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
122
117
|
export default CheckboxGroup;
|
|
@@ -8,8 +8,8 @@ import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint"
|
|
|
8
8
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
9
9
|
import CheckboxGroupContext from "./checkbox-group/__internal__/checkbox-group.context";
|
|
10
10
|
import Logger from "../../__internal__/utils/logger";
|
|
11
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
12
11
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
12
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
13
13
|
let deprecateUncontrolledWarnTriggered = false;
|
|
14
14
|
export const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
15
15
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -97,7 +97,7 @@ export const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
97
97
|
info: contextInfo || info
|
|
98
98
|
})
|
|
99
99
|
};
|
|
100
|
-
const marginProps =
|
|
100
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
101
101
|
const componentToRender = /*#__PURE__*/React.createElement(CheckboxStyle, _extends({
|
|
102
102
|
disabled: disabled,
|
|
103
103
|
labelSpacing: labelSpacing,
|
|
@@ -9,6 +9,7 @@ import StyledValidationIcon from "../../__internal__/validations/validation-icon
|
|
|
9
9
|
import baseTheme from "../../style/themes/base";
|
|
10
10
|
import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
11
11
|
const StyledCheckbox = styled.div`
|
|
12
|
+
margin-bottom: var(--fieldSpacing);
|
|
12
13
|
${margin}
|
|
13
14
|
${({
|
|
14
15
|
disabled,
|
|
@@ -3,14 +3,13 @@ import React, { useContext, useEffect, useMemo, useRef, useState, useCallback }
|
|
|
3
3
|
import { additionalYears, findMatchedFormatAndValue, formattedValue, formatToISO, isDateValid, parseDate, parseISODate, checkISOFormatAndLength, getSeparator, isValidLocaleDate } from "./__internal__/utils";
|
|
4
4
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
5
5
|
import Events from "../../__internal__/utils/helpers/events";
|
|
6
|
-
import { filterOutStyledSystemSpacingProps } from "../../style/utils";
|
|
6
|
+
import { filterOutStyledSystemSpacingProps, filterStyledSystemMarginProps } from "../../style/utils";
|
|
7
7
|
import getFormatData from "./__internal__/date-formats";
|
|
8
8
|
import StyledDateInput from "./date.style";
|
|
9
9
|
import Textbox from "../textbox";
|
|
10
10
|
import DatePicker from "./__internal__/date-picker";
|
|
11
11
|
import DateRangeContext from "../date-range/__internal__/date-range.context";
|
|
12
12
|
import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
|
|
13
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
14
13
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
15
14
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
16
15
|
export const DateInput = /*#__PURE__*/React.forwardRef(({
|
|
@@ -282,7 +281,7 @@ export const DateInput = /*#__PURE__*/React.forwardRef(({
|
|
|
282
281
|
}
|
|
283
282
|
return value;
|
|
284
283
|
};
|
|
285
|
-
const marginProps =
|
|
284
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
286
285
|
return /*#__PURE__*/React.createElement(StyledDateInput, _extends({
|
|
287
286
|
ref: wrapperRef,
|
|
288
287
|
role: "presentation",
|
|
@@ -5,6 +5,7 @@ import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
|
5
5
|
import { StyledInputPresentationContainer } from "../../__internal__/input/input-presentation.style";
|
|
6
6
|
import baseTheme from "../../style/themes/base";
|
|
7
7
|
const StyledDateRange = styled.div`
|
|
8
|
+
margin-bottom: var(--fieldSpacing);
|
|
8
9
|
${margin}
|
|
9
10
|
|
|
10
11
|
& ${StyledDateInput} {
|
|
@@ -3,8 +3,7 @@ import React, { useState, useEffect, useContext } from "react";
|
|
|
3
3
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { FieldsetStyle, StyledLegend } from "./fieldset.style";
|
|
5
5
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
6
|
-
import
|
|
7
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
6
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
7
|
export const Fieldset = ({
|
|
9
8
|
children,
|
|
10
9
|
legend,
|
|
@@ -13,7 +12,7 @@ export const Fieldset = ({
|
|
|
13
12
|
...rest
|
|
14
13
|
}) => {
|
|
15
14
|
const [ref, setRef] = useState(null);
|
|
16
|
-
const marginProps =
|
|
15
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
17
16
|
const {
|
|
18
17
|
validationRedesignOptIn
|
|
19
18
|
} = useContext(NewValidationContext);
|
|
@@ -31,9 +30,7 @@ export const Fieldset = ({
|
|
|
31
30
|
"data-element": "legend",
|
|
32
31
|
isRequired: required,
|
|
33
32
|
isOptional: isOptional
|
|
34
|
-
}, legend),
|
|
35
|
-
marginBottom: undefined
|
|
36
|
-
}, children));
|
|
33
|
+
}, legend), children);
|
|
37
34
|
};
|
|
38
35
|
Fieldset.displayName = "Fieldset";
|
|
39
36
|
export default Fieldset;
|
|
@@ -5,6 +5,7 @@ import baseTheme from "../../style/themes/base";
|
|
|
5
5
|
import CheckboxStyle from "../checkbox/checkbox.style";
|
|
6
6
|
const FieldsetStyle = styled.fieldset`
|
|
7
7
|
margin: 0;
|
|
8
|
+
margin-bottom: var(--fieldSpacing);
|
|
8
9
|
${margin}
|
|
9
10
|
border: none;
|
|
10
11
|
padding: 0;
|
|
@@ -12,6 +13,10 @@ const FieldsetStyle = styled.fieldset`
|
|
|
12
13
|
${({
|
|
13
14
|
newValidation
|
|
14
15
|
}) => !newValidation && css`
|
|
16
|
+
& * {
|
|
17
|
+
--fieldSpacing: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
&&&& ${FormFieldStyle} {
|
|
16
21
|
margin-top: 0;
|
|
17
22
|
margin-bottom: -1px;
|
|
@@ -4,7 +4,6 @@ import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
|
4
4
|
import FormSummary from "./__internal__/form-summary.component";
|
|
5
5
|
import { StyledForm, StyledFormContent, StyledFormFooter, StyledLeftButtons, StyledRightButtons } from "./form.style";
|
|
6
6
|
import { formSpacing } from "./form.config";
|
|
7
|
-
import FormSpacingProvider from "../../__internal__/form-spacing-provider";
|
|
8
7
|
import ModalContext from "../modal/__internal__/modal.context";
|
|
9
8
|
export const Form = ({
|
|
10
9
|
children,
|
|
@@ -35,7 +34,6 @@ export const Form = ({
|
|
|
35
34
|
stickyFooter: stickyFooter,
|
|
36
35
|
onSubmit: onSubmit,
|
|
37
36
|
"data-component": "form",
|
|
38
|
-
fieldSpacing: fieldSpacing,
|
|
39
37
|
noValidate: noValidate,
|
|
40
38
|
height: height,
|
|
41
39
|
isInModal: isInModal
|
|
@@ -44,10 +42,9 @@ export const Form = ({
|
|
|
44
42
|
"data-role": "form-content",
|
|
45
43
|
stickyFooter: stickyFooter,
|
|
46
44
|
tabIndex: -1,
|
|
47
|
-
isInModal: isInModal
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, children)), renderFooter && /*#__PURE__*/React.createElement(StyledFormFooter, _extends({
|
|
45
|
+
isInModal: isInModal,
|
|
46
|
+
fieldSpacing: formSpacing[fieldSpacing]
|
|
47
|
+
}, children), renderFooter && /*#__PURE__*/React.createElement(StyledFormFooter, _extends({
|
|
51
48
|
"data-element": "form-footer",
|
|
52
49
|
"data-role": "form-footer",
|
|
53
50
|
ref: formFooterRef,
|
|
@@ -2,6 +2,7 @@ import { FormButtonAlignment } from "./form.config";
|
|
|
2
2
|
interface StyledFormContentProps {
|
|
3
3
|
stickyFooter?: boolean;
|
|
4
4
|
isInModal?: boolean;
|
|
5
|
+
fieldSpacing?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare const StyledFormContent: import("styled-components").StyledComponent<"div", any, StyledFormContentProps, never>;
|
|
7
8
|
interface StyledFormFooterProps {
|
|
@@ -12,7 +13,6 @@ interface StyledFormFooterProps {
|
|
|
12
13
|
export declare const StyledFormFooter: import("styled-components").StyledComponent<"div", any, StyledFormFooterProps, never>;
|
|
13
14
|
interface StyledFormProps extends StyledFormContentProps {
|
|
14
15
|
height?: string;
|
|
15
|
-
fieldSpacing: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
16
16
|
}
|
|
17
17
|
export declare const StyledForm: import("styled-components").StyledComponent<"form", any, StyledFormProps, never>;
|
|
18
18
|
export declare const StyledRightButtons: import("styled-components").StyledComponent<"div", any, {
|
|
@@ -2,9 +2,10 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { space, padding } from "styled-system";
|
|
3
3
|
import StyledFormField from "../../__internal__/form-field/form-field.style";
|
|
4
4
|
import baseTheme from "../../style/themes/base";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import StyledInlineInputs from "../inline-inputs/inline-inputs.style";
|
|
6
|
+
import StyledSelect from "../select/select.style";
|
|
7
|
+
import { StyledSelectMultiSelect } from "../select/multi-select/multi-select.style";
|
|
8
|
+
import StyledSwitch from "../switch/switch.style";
|
|
8
9
|
export const StyledFormContent = styled.div(({
|
|
9
10
|
stickyFooter,
|
|
10
11
|
isInModal
|
|
@@ -12,6 +13,22 @@ export const StyledFormContent = styled.div(({
|
|
|
12
13
|
flex-grow: 1;
|
|
13
14
|
min-height: 0;
|
|
14
15
|
overflow-y: auto;
|
|
16
|
+
`, ({
|
|
17
|
+
fieldSpacing
|
|
18
|
+
}) => fieldSpacing && css`
|
|
19
|
+
--fieldSpacing: ${fieldSpacing};
|
|
20
|
+
|
|
21
|
+
${StyledFormField} {
|
|
22
|
+
margin-top: var(--spacing000);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// field spacing is also applied to form field here so we need to override
|
|
26
|
+
${StyledInlineInputs} ${StyledFormField},
|
|
27
|
+
${StyledInlineInputs} ${StyledSelect},
|
|
28
|
+
${StyledInlineInputs} ${StyledSelectMultiSelect},
|
|
29
|
+
${StyledSwitch} ${StyledFormField} {
|
|
30
|
+
margin-bottom: var(--spacing000);
|
|
31
|
+
}
|
|
15
32
|
`);
|
|
16
33
|
export const StyledFormFooter = styled.div`
|
|
17
34
|
align-items: center;
|
|
@@ -64,14 +81,6 @@ export const StyledForm = styled.form`
|
|
|
64
81
|
height: ${height};
|
|
65
82
|
`}
|
|
66
83
|
|
|
67
|
-
// field spacing is also applied to form field here so we need to override
|
|
68
|
-
${StyledSearch} ${StyledFormField},
|
|
69
|
-
${StyledTextarea} ${StyledFormField},
|
|
70
|
-
[data-component="time"] ${StyledFormField},
|
|
71
|
-
${StyledNumeralDate} ${StyledFormField} {
|
|
72
|
-
margin-bottom: var(--spacing000);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
84
|
${({
|
|
76
85
|
stickyFooter,
|
|
77
86
|
isInModal
|
|
@@ -2,10 +2,9 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { useRef, useEffect } from "react";
|
|
3
3
|
import Label from "../../__internal__/label";
|
|
4
4
|
import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from "./inline-inputs.style";
|
|
5
|
-
import FormSpacingProvider from "../../__internal__/form-spacing-provider";
|
|
6
5
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
7
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
8
6
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
7
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
9
8
|
const columnWrapper = (children, gutter) => {
|
|
10
9
|
return React.Children.map(children, input => {
|
|
11
10
|
return /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
@@ -46,7 +45,7 @@ const InlineInputs = ({
|
|
|
46
45
|
optional: isOptional
|
|
47
46
|
}, label);
|
|
48
47
|
}
|
|
49
|
-
const marginProps =
|
|
48
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
50
49
|
useEffect(() => {
|
|
51
50
|
if (required) {
|
|
52
51
|
const elements = Array.from(ref.current?.querySelectorAll("input") || /* istanbul ignore next */[]);
|
|
@@ -63,9 +62,7 @@ const InlineInputs = ({
|
|
|
63
62
|
"data-element": "inline-inputs-container",
|
|
64
63
|
"data-role": "inline-inputs-container",
|
|
65
64
|
inputWidth: inputWidth
|
|
66
|
-
},
|
|
67
|
-
marginBottom: undefined
|
|
68
|
-
}, columnWrapper(children, gutter))));
|
|
65
|
+
}, columnWrapper(children, gutter)));
|
|
69
66
|
};
|
|
70
67
|
InlineInputs.displayName = "InlineInputs";
|
|
71
68
|
export default InlineInputs;
|
|
@@ -154,8 +154,7 @@ export const Search = /*#__PURE__*/React.forwardRef(({
|
|
|
154
154
|
maxWidth: maxWidth,
|
|
155
155
|
searchHasValue: searchHasValue,
|
|
156
156
|
showSearchButton: !!searchButton,
|
|
157
|
-
variant: variant
|
|
158
|
-
mb: 0
|
|
157
|
+
variant: variant
|
|
159
158
|
}, filterStyledSystemMarginProps(rest), {
|
|
160
159
|
id: id,
|
|
161
160
|
name: name
|
|
@@ -180,7 +179,8 @@ export const Search = /*#__PURE__*/React.forwardRef(({
|
|
|
180
179
|
type: "search",
|
|
181
180
|
ml: 1
|
|
182
181
|
}) : undefined,
|
|
183
|
-
tooltipPosition: tooltipPosition
|
|
182
|
+
tooltipPosition: tooltipPosition,
|
|
183
|
+
my: 0 // prevents any form spacing being applied
|
|
184
184
|
}), searchButton && /*#__PURE__*/React.createElement(StyledSearchButton, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
185
185
|
"aria-label": searchButtonAriaLabel || searchButtonText,
|
|
186
186
|
size: "medium",
|
|
@@ -19,6 +19,7 @@ const StyledSearch = styled.div`
|
|
|
19
19
|
const darkVariant = variant === "dark";
|
|
20
20
|
const variantColor = darkVariant ? "var(--colorsUtilityYang080)" : "var(--colorsUtilityMajor300)";
|
|
21
21
|
return css`
|
|
22
|
+
margin-bottom: var(--fieldSpacing);
|
|
22
23
|
${margin}
|
|
23
24
|
width: ${searchWidth ? `${searchWidth}` : "100%"};
|
|
24
25
|
max-width: ${maxWidth ? `${maxWidth}` : "100%"};
|
|
@@ -1,7 +1,7 @@
|
|
|
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, { useState, useEffect, useRef, useCallback } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
|
-
import { filterOutStyledSystemSpacingProps } from "../../../style/utils";
|
|
4
|
+
import { filterOutStyledSystemSpacingProps, filterStyledSystemMarginProps } from "../../../style/utils";
|
|
5
5
|
import SelectTextbox from "../__internal__/select-textbox";
|
|
6
6
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
7
7
|
import withFilter from "../__internal__/utils/with-filter.hoc";
|
|
@@ -12,7 +12,6 @@ import areObjectsEqual from "../__internal__/utils/are-objects-equal";
|
|
|
12
12
|
import isNavigationKey from "../__internal__/utils/is-navigation-key";
|
|
13
13
|
import Logger from "../../../__internal__/utils/logger";
|
|
14
14
|
import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
15
|
-
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
16
15
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
17
16
|
let deprecateUncontrolledWarnTriggered = false;
|
|
18
17
|
const FilterableSelectList = withFilter(SelectList);
|
|
@@ -457,7 +456,7 @@ export const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
457
456
|
listWidth
|
|
458
457
|
};
|
|
459
458
|
const selectList = disableDefaultFiltering ? /*#__PURE__*/React.createElement(SelectList, selectListProps, children) : /*#__PURE__*/React.createElement(FilterableSelectList, selectListProps, children);
|
|
460
|
-
const marginProps =
|
|
459
|
+
const marginProps = filterStyledSystemMarginProps(textboxProps);
|
|
461
460
|
return /*#__PURE__*/React.createElement(StyledSelect, _extends({
|
|
462
461
|
hasTextCursor: true,
|
|
463
462
|
readOnly: readOnly,
|
|
@@ -1,7 +1,7 @@
|
|
|
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, { useState, useEffect, useRef, useCallback, useMemo } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
|
-
import { filterOutStyledSystemSpacingProps } from "../../../style/utils";
|
|
4
|
+
import { filterOutStyledSystemSpacingProps, filterStyledSystemMarginProps } from "../../../style/utils";
|
|
5
5
|
import SelectTextbox from "../__internal__/select-textbox";
|
|
6
6
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
7
7
|
import withFilter from "../__internal__/utils/with-filter.hoc";
|
|
@@ -13,7 +13,6 @@ import isExpectedValue from "../__internal__/utils/is-expected-value";
|
|
|
13
13
|
import isNavigationKey from "../__internal__/utils/is-navigation-key";
|
|
14
14
|
import Logger from "../../../__internal__/utils/logger";
|
|
15
15
|
import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
16
|
-
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
17
16
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
18
17
|
let deprecateUncontrolledWarnTriggered = false;
|
|
19
18
|
const FilterableSelectList = withFilter(SelectList);
|
|
@@ -461,7 +460,7 @@ export const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
461
460
|
virtualScrollOverscan: virtualScrollOverscan,
|
|
462
461
|
listWidth: listWidth
|
|
463
462
|
}, children);
|
|
464
|
-
const marginProps =
|
|
463
|
+
const marginProps = filterStyledSystemMarginProps(textboxProps);
|
|
465
464
|
return /*#__PURE__*/React.createElement(StyledSelectMultiSelect, _extends({
|
|
466
465
|
disabled: disabled,
|
|
467
466
|
readOnly: readOnly,
|
|
@@ -1,7 +1,7 @@
|
|
|
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, { useState, useEffect, useRef, useCallback, useMemo } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
|
-
import { filterOutStyledSystemSpacingProps } from "../../../style/utils";
|
|
4
|
+
import { filterOutStyledSystemSpacingProps, filterStyledSystemMarginProps } from "../../../style/utils";
|
|
5
5
|
import StyledSelect from "../select.style";
|
|
6
6
|
import SelectTextbox from "../__internal__/select-textbox";
|
|
7
7
|
import SelectList from "../__internal__/select-list/select-list.component";
|
|
@@ -10,7 +10,6 @@ import getNextChildByText from "../__internal__/utils/get-next-child-by-text";
|
|
|
10
10
|
import isExpectedOption from "../__internal__/utils/is-expected-option";
|
|
11
11
|
import isNavigationKey from "../__internal__/utils/is-navigation-key";
|
|
12
12
|
import Logger from "../../../__internal__/utils/logger";
|
|
13
|
-
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
14
13
|
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
15
14
|
let deprecateUncontrolledWarnTriggered = false;
|
|
16
15
|
export const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
@@ -326,7 +325,7 @@ export const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
326
325
|
virtualScrollOverscan: virtualScrollOverscan,
|
|
327
326
|
listWidth: listWidth
|
|
328
327
|
}, children);
|
|
329
|
-
const marginProps =
|
|
328
|
+
const marginProps = filterStyledSystemMarginProps(props);
|
|
330
329
|
return /*#__PURE__*/React.createElement(StyledSelect, _extends({
|
|
331
330
|
transparent: transparent,
|
|
332
331
|
disabled: disabled,
|
|
@@ -7,12 +7,12 @@ import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
|
7
7
|
import NewValidationContext from "../carbon-provider/__internal__/new-validation.context";
|
|
8
8
|
import Logger from "../../__internal__/utils/logger";
|
|
9
9
|
import ValidationMessage from "../../__internal__/validation-message/validation-message.component";
|
|
10
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
11
10
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
12
11
|
import StyledSwitch, { ErrorBorder } from "./switch.style";
|
|
13
12
|
import SwitchSlider from "./__internal__/switch-slider.component";
|
|
14
13
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
15
14
|
import HintText from "../../__internal__/hint-text";
|
|
15
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
16
16
|
let deprecateUncontrolledWarnTriggered = false;
|
|
17
17
|
export const Switch = /*#__PURE__*/React.forwardRef(({
|
|
18
18
|
autoFocus,
|
|
@@ -71,7 +71,7 @@ export const Switch = /*#__PURE__*/React.forwardRef(({
|
|
|
71
71
|
shouldLabelBeInline = largeScreen;
|
|
72
72
|
}
|
|
73
73
|
const shouldValidationBeOnLabel = labelInline && !reverse ? true : validationOnLabel;
|
|
74
|
-
const marginProps =
|
|
74
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
75
75
|
const switchStyleProps = {
|
|
76
76
|
"data-component": "switch",
|
|
77
77
|
"data-role": dataRole,
|
|
@@ -16,8 +16,8 @@ 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
|
-
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
20
19
|
import HintText from "../../__internal__/hint-text";
|
|
20
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
21
21
|
let deprecateUncontrolledWarnTriggered = false;
|
|
22
22
|
let warnBorderRadiusArrayTooLarge = false;
|
|
23
23
|
export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
@@ -213,7 +213,7 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
213
213
|
validationIconId: validationRedesignOptIn ? undefined : validationId,
|
|
214
214
|
useValidationIcon: !(validationRedesignOptIn || validationOnLabel)
|
|
215
215
|
}));
|
|
216
|
-
const marginProps =
|
|
216
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
217
217
|
return /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
218
218
|
tooltipPosition: tooltipPosition,
|
|
219
219
|
helpAriaLabel: helpAriaLabel
|
|
@@ -243,7 +243,8 @@ export const Textarea = /*#__PURE__*/React.forwardRef(({
|
|
|
243
243
|
isOptional: isOptional,
|
|
244
244
|
useValidationIcon: computeLabelPropValues(validationOnLabel),
|
|
245
245
|
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
|
|
246
|
-
validationRedesignOptIn: validationRedesignOptIn
|
|
246
|
+
validationRedesignOptIn: validationRedesignOptIn,
|
|
247
|
+
my: 0 // prevents any form spacing being applied
|
|
247
248
|
}, (inputHint || labelHelp && validationRedesignOptIn) && /*#__PURE__*/React.createElement(HintText, {
|
|
248
249
|
align: labelAlign,
|
|
249
250
|
id: inputHintId,
|
|
@@ -6,6 +6,7 @@ import InputIconToggleStyle from "../../__internal__/input-icon-toggle/input-ico
|
|
|
6
6
|
import BaseTheme from "../../style/themes/base";
|
|
7
7
|
export const DEFAULT_MIN_HEIGHT = 64;
|
|
8
8
|
const StyledTextarea = styled.div`
|
|
9
|
+
margin-bottom: var(--fieldSpacing);
|
|
9
10
|
${margin};
|
|
10
11
|
|
|
11
12
|
${StyledInput} {
|
|
@@ -220,7 +220,7 @@ export const Textbox = /*#__PURE__*/React.forwardRef(({
|
|
|
220
220
|
warning: warning
|
|
221
221
|
}), !disableErrorBorder && (error || warning) && /*#__PURE__*/React.createElement(ErrorBorder, {
|
|
222
222
|
warning: !!(!error && warning)
|
|
223
|
-
}), input) : input
|
|
223
|
+
}), input) : input, characterCount)));
|
|
224
224
|
});
|
|
225
225
|
Textbox.displayName = "Textbox";
|
|
226
226
|
export default Textbox;
|
|
@@ -1,6 +1,6 @@
|
|
|
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 from "react";
|
|
3
|
-
import StyledTile
|
|
3
|
+
import StyledTile from "./tile.style";
|
|
4
4
|
import TileContext from "./__internal__/tile.context";
|
|
5
5
|
import filterStyledSystemPaddingProps from "../../style/utils/filter-styled-system-padding-props";
|
|
6
6
|
import filterStyledSystemMarginProps from "../../style/utils/filter-styled-system-margin-props";
|
|
@@ -26,13 +26,14 @@ export const Tile = ({
|
|
|
26
26
|
});
|
|
27
27
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
28
28
|
const contentPaddingProps = computeContentPadding(paddingProps, isHorizontal);
|
|
29
|
-
|
|
29
|
+
return /*#__PURE__*/React.createElement(StyledTile, _extends({
|
|
30
30
|
variant: variant,
|
|
31
31
|
width: width,
|
|
32
32
|
height: height,
|
|
33
33
|
isHorizontal: isHorizontal,
|
|
34
34
|
p: p,
|
|
35
35
|
roundness: roundness,
|
|
36
|
+
highlightVariant: highlightVariant,
|
|
36
37
|
borderWidth: borderWidth,
|
|
37
38
|
borderVariant: borderVariant
|
|
38
39
|
}, paddingProps, marginProps, tagComponent("tile", rest)), /*#__PURE__*/React.createElement(TileContext.Provider, {
|
|
@@ -41,14 +42,5 @@ export const Tile = ({
|
|
|
41
42
|
paddingPropsFromTile: contentPaddingProps
|
|
42
43
|
}
|
|
43
44
|
}, children));
|
|
44
|
-
if (highlightVariant) {
|
|
45
|
-
return /*#__PURE__*/React.createElement(StyledHighlight, {
|
|
46
|
-
variant: highlightVariant,
|
|
47
|
-
roundness: roundness,
|
|
48
|
-
"aria-hidden": true,
|
|
49
|
-
"data-role": `tile-${highlightVariant}-highlight`
|
|
50
|
-
}, tile);
|
|
51
|
-
}
|
|
52
|
-
return tile;
|
|
53
45
|
};
|
|
54
46
|
export default Tile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
2
2
|
export const TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
3
3
|
export const TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
4
|
-
export const TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info"];
|
|
4
|
+
export const TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info", "important"];
|
|
@@ -3,8 +3,4 @@ import { TileProps } from "./tile.component";
|
|
|
3
3
|
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant" | "highlightVariant"> & {
|
|
4
4
|
isHorizontal?: boolean | undefined;
|
|
5
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
6
|
-
export declare const StyledHighlight: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
-
variant: Required<TileProps["highlightVariant"]>;
|
|
8
|
-
roundness: TileProps["roundness"];
|
|
9
|
-
}, never>;
|
|
10
6
|
export default StyledTile;
|